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,300
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java
StringSearch.getCE
private int getCE(int sourcece) { // note for tertiary we can't use the collator->tertiaryMask, that // is a preprocessed mask that takes into account case options. since // we are only concerned with exact matches, we don't need that. sourcece &= ceMask_; if (toShift_) { // alternate handling here, since only the 16 most significant digits // is only used, we can safely do a compare without masking // if the ce is a variable, we mask and get only the primary values // no shifting to quartenary is required since all primary values // less than variabletop will need to be masked off anyway. if (variableTop_ > sourcece) { if (strength_ >= Collator.QUATERNARY) { sourcece &= PRIMARYORDERMASK; } else { sourcece = CollationElementIterator.IGNORABLE; } } } else if (strength_ >= Collator.QUATERNARY && sourcece == CollationElementIterator.IGNORABLE) { sourcece = 0xFFFF; } return sourcece; }
java
private int getCE(int sourcece) { // note for tertiary we can't use the collator->tertiaryMask, that // is a preprocessed mask that takes into account case options. since // we are only concerned with exact matches, we don't need that. sourcece &= ceMask_; if (toShift_) { // alternate handling here, since only the 16 most significant digits // is only used, we can safely do a compare without masking // if the ce is a variable, we mask and get only the primary values // no shifting to quartenary is required since all primary values // less than variabletop will need to be masked off anyway. if (variableTop_ > sourcece) { if (strength_ >= Collator.QUATERNARY) { sourcece &= PRIMARYORDERMASK; } else { sourcece = CollationElementIterator.IGNORABLE; } } } else if (strength_ >= Collator.QUATERNARY && sourcece == CollationElementIterator.IGNORABLE) { sourcece = 0xFFFF; } return sourcece; }
[ "private", "int", "getCE", "(", "int", "sourcece", ")", "{", "// note for tertiary we can't use the collator->tertiaryMask, that", "// is a preprocessed mask that takes into account case options. since", "// we are only concerned with exact matches, we don't need that.", "sourcece", "&=", ...
Getting the modified collation elements taking into account the collation attributes. @param sourcece @return the modified collation element
[ "Getting", "the", "modified", "collation", "elements", "taking", "into", "account", "the", "collation", "attributes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L605-L629
35,301
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java
StringSearch.initializePatternPCETable
private int initializePatternPCETable() { long[] pcetable = new long[INITIAL_ARRAY_SIZE_]; int pcetablesize = pcetable.length; int patternlength = pattern_.text_.length(); CollationElementIterator coleiter = utilIter_; if (coleiter == null) { coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); } int offset = 0; int result = 0; long pce; CollationPCE iter = new CollationPCE(coleiter); // ** Should processed CEs be signed or unsigned? // ** (the rest of the code in this file seems to play fast-and-loose with // ** whether a CE is signed or unsigned. For example, look at routine above this one.) while ((pce = iter.nextProcessed(null)) != CollationPCE.PROCESSED_NULLORDER) { long[] temp = addToLongArray(pcetable, offset, pcetablesize, pce, patternlength - coleiter.getOffset() + 1); offset++; pcetable = temp; } pcetable[offset] = 0; pattern_.PCE_ = pcetable; pattern_.PCELength_ = offset; return result; }
java
private int initializePatternPCETable() { long[] pcetable = new long[INITIAL_ARRAY_SIZE_]; int pcetablesize = pcetable.length; int patternlength = pattern_.text_.length(); CollationElementIterator coleiter = utilIter_; if (coleiter == null) { coleiter = new CollationElementIterator(pattern_.text_, collator_); utilIter_ = coleiter; } else { coleiter.setText(pattern_.text_); } int offset = 0; int result = 0; long pce; CollationPCE iter = new CollationPCE(coleiter); // ** Should processed CEs be signed or unsigned? // ** (the rest of the code in this file seems to play fast-and-loose with // ** whether a CE is signed or unsigned. For example, look at routine above this one.) while ((pce = iter.nextProcessed(null)) != CollationPCE.PROCESSED_NULLORDER) { long[] temp = addToLongArray(pcetable, offset, pcetablesize, pce, patternlength - coleiter.getOffset() + 1); offset++; pcetable = temp; } pcetable[offset] = 0; pattern_.PCE_ = pcetable; pattern_.PCELength_ = offset; return result; }
[ "private", "int", "initializePatternPCETable", "(", ")", "{", "long", "[", "]", "pcetable", "=", "new", "long", "[", "INITIAL_ARRAY_SIZE_", "]", ";", "int", "pcetablesize", "=", "pcetable", ".", "length", ";", "int", "patternlength", "=", "pattern_", ".", "t...
Initializing the pce table for a pattern. Stores non-ignorable collation keys. Table size will be estimated by the size of the pattern text. Table expansion will be perform as we go along. Adding 1 to ensure that the table size definitely increases. @return total number of expansions
[ "Initializing", "the", "pce", "table", "for", "a", "pattern", ".", "Stores", "non", "-", "ignorable", "collation", "keys", ".", "Table", "size", "will", "be", "estimated", "by", "the", "size", "of", "the", "pattern", "text", ".", "Table", "expansion", "wil...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L733-L766
35,302
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java
StringSearch.checkIdentical
private boolean checkIdentical(int start, int end) { if (strength_ != Collator.IDENTICAL) { return true; } // Note: We could use Normalizer::compare() or similar, but for short strings // which may not be in FCD it might be faster to just NFD them. String textstr = getString(targetText, start, end - start); if (Normalizer.quickCheck(textstr, Normalizer.NFD, 0) == Normalizer.NO) { textstr = Normalizer.decompose(textstr, false); } String patternstr = pattern_.text_; if (Normalizer.quickCheck(patternstr, Normalizer.NFD, 0) == Normalizer.NO) { patternstr = Normalizer.decompose(patternstr, false); } return textstr.equals(patternstr); }
java
private boolean checkIdentical(int start, int end) { if (strength_ != Collator.IDENTICAL) { return true; } // Note: We could use Normalizer::compare() or similar, but for short strings // which may not be in FCD it might be faster to just NFD them. String textstr = getString(targetText, start, end - start); if (Normalizer.quickCheck(textstr, Normalizer.NFD, 0) == Normalizer.NO) { textstr = Normalizer.decompose(textstr, false); } String patternstr = pattern_.text_; if (Normalizer.quickCheck(patternstr, Normalizer.NFD, 0) == Normalizer.NO) { patternstr = Normalizer.decompose(patternstr, false); } return textstr.equals(patternstr); }
[ "private", "boolean", "checkIdentical", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "strength_", "!=", "Collator", ".", "IDENTICAL", ")", "{", "return", "true", ";", "}", "// Note: We could use Normalizer::compare() or similar, but for short strings",...
Checks for identical match @param start offset of possible match @param end offset of possible match @return TRUE if identical match is found
[ "Checks", "for", "identical", "match" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L856-L871
35,303
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java
StringSearch.getString
private static final String getString(CharacterIterator text, int start, int length) { StringBuilder result = new StringBuilder(length); int offset = text.getIndex(); text.setIndex(start); for (int i = 0; i < length; i++) { result.append(text.current()); text.next(); } text.setIndex(offset); return result.toString(); }
java
private static final String getString(CharacterIterator text, int start, int length) { StringBuilder result = new StringBuilder(length); int offset = text.getIndex(); text.setIndex(start); for (int i = 0; i < length; i++) { result.append(text.current()); text.next(); } text.setIndex(offset); return result.toString(); }
[ "private", "static", "final", "String", "getString", "(", "CharacterIterator", "text", ",", "int", "start", ",", "int", "length", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "length", ")", ";", "int", "offset", "=", "text", ".", ...
Gets a substring out of a CharacterIterator Java porting note: Not available in ICU4C @param text CharacterIterator @param start start offset @param length of substring @return substring from text starting at start and length length
[ "Gets", "a", "substring", "out", "of", "a", "CharacterIterator" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L1580-L1590
35,304
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java
TimeZoneNamesImpl.addAllNamesIntoTrie
private void addAllNamesIntoTrie() { for (Map.Entry<String, ZNames> entry : _tzNamesMap.entrySet()) { entry.getValue().addAsTimeZoneIntoTrie(entry.getKey(), _namesTrie); } for (Map.Entry<String, ZNames> entry : _mzNamesMap.entrySet()) { entry.getValue().addAsMetaZoneIntoTrie(entry.getKey(), _namesTrie); } }
java
private void addAllNamesIntoTrie() { for (Map.Entry<String, ZNames> entry : _tzNamesMap.entrySet()) { entry.getValue().addAsTimeZoneIntoTrie(entry.getKey(), _namesTrie); } for (Map.Entry<String, ZNames> entry : _mzNamesMap.entrySet()) { entry.getValue().addAsMetaZoneIntoTrie(entry.getKey(), _namesTrie); } }
[ "private", "void", "addAllNamesIntoTrie", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ZNames", ">", "entry", ":", "_tzNamesMap", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "addAsTimeZoneIntoTrie...
Caller must synchronize.
[ "Caller", "must", "synchronize", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java#L296-L303
35,305
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java
TimeZoneNamesImpl.initialize
private void initialize(ULocale locale) { ICUResourceBundle bundle = (ICUResourceBundle)ICUResourceBundle.getBundleInstance( ICUData.ICU_ZONE_BASE_NAME, locale); _zoneStrings = (ICUResourceBundle)bundle.get(ZONE_STRINGS_BUNDLE); // TODO: Access is synchronized, can we use a non-concurrent map? _tzNamesMap = new ConcurrentHashMap<String, ZNames>(); _mzNamesMap = new ConcurrentHashMap<String, ZNames>(); _namesFullyLoaded = false; _namesTrie = new TextTrieMap<NameInfo>(true); _namesTrieFullyLoaded = false; // Preload zone strings for the default time zone TimeZone tz = TimeZone.getDefault(); String tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { loadStrings(tzCanonicalID); } }
java
private void initialize(ULocale locale) { ICUResourceBundle bundle = (ICUResourceBundle)ICUResourceBundle.getBundleInstance( ICUData.ICU_ZONE_BASE_NAME, locale); _zoneStrings = (ICUResourceBundle)bundle.get(ZONE_STRINGS_BUNDLE); // TODO: Access is synchronized, can we use a non-concurrent map? _tzNamesMap = new ConcurrentHashMap<String, ZNames>(); _mzNamesMap = new ConcurrentHashMap<String, ZNames>(); _namesFullyLoaded = false; _namesTrie = new TextTrieMap<NameInfo>(true); _namesTrieFullyLoaded = false; // Preload zone strings for the default time zone TimeZone tz = TimeZone.getDefault(); String tzCanonicalID = ZoneMeta.getCanonicalCLDRID(tz); if (tzCanonicalID != null) { loadStrings(tzCanonicalID); } }
[ "private", "void", "initialize", "(", "ULocale", "locale", ")", "{", "ICUResourceBundle", "bundle", "=", "(", "ICUResourceBundle", ")", "ICUResourceBundle", ".", "getBundleInstance", "(", "ICUData", ".", "ICU_ZONE_BASE_NAME", ",", "locale", ")", ";", "_zoneStrings",...
Initialize the transient fields, called from the constructor and readObject. @param locale The locale
[ "Initialize", "the", "transient", "fields", "called", "from", "the", "constructor", "and", "readObject", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java#L420-L439
35,306
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java
TimeZoneNamesImpl.loadStrings
private synchronized void loadStrings(String tzCanonicalID) { if (tzCanonicalID == null || tzCanonicalID.length() == 0) { return; } loadTimeZoneNames(tzCanonicalID); Set<String> mzIDs = getAvailableMetaZoneIDs(tzCanonicalID); for (String mzID : mzIDs) { loadMetaZoneNames(mzID); } }
java
private synchronized void loadStrings(String tzCanonicalID) { if (tzCanonicalID == null || tzCanonicalID.length() == 0) { return; } loadTimeZoneNames(tzCanonicalID); Set<String> mzIDs = getAvailableMetaZoneIDs(tzCanonicalID); for (String mzID : mzIDs) { loadMetaZoneNames(mzID); } }
[ "private", "synchronized", "void", "loadStrings", "(", "String", "tzCanonicalID", ")", "{", "if", "(", "tzCanonicalID", "==", "null", "||", "tzCanonicalID", ".", "length", "(", ")", "==", "0", ")", "{", "return", ";", "}", "loadTimeZoneNames", "(", "tzCanoni...
Load all strings used by the specified time zone. This is called from the initializer to load default zone's strings. @param tzCanonicalID the canonical time zone ID
[ "Load", "all", "strings", "used", "by", "the", "specified", "time", "zone", ".", "This", "is", "called", "from", "the", "initializer", "to", "load", "default", "zone", "s", "strings", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java#L447-L457
35,307
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java
TimeZoneNamesImpl.loadMetaZoneNames
private synchronized ZNames loadMetaZoneNames(String mzID) { ZNames mznames = _mzNamesMap.get(mzID); if (mznames == null) { ZNamesLoader loader = new ZNamesLoader(); loader.loadMetaZone(_zoneStrings, mzID); mznames = ZNames.createMetaZoneAndPutInCache(_mzNamesMap, loader.getNames(), mzID); } return mznames; }
java
private synchronized ZNames loadMetaZoneNames(String mzID) { ZNames mznames = _mzNamesMap.get(mzID); if (mznames == null) { ZNamesLoader loader = new ZNamesLoader(); loader.loadMetaZone(_zoneStrings, mzID); mznames = ZNames.createMetaZoneAndPutInCache(_mzNamesMap, loader.getNames(), mzID); } return mznames; }
[ "private", "synchronized", "ZNames", "loadMetaZoneNames", "(", "String", "mzID", ")", "{", "ZNames", "mznames", "=", "_mzNamesMap", ".", "get", "(", "mzID", ")", ";", "if", "(", "mznames", "==", "null", ")", "{", "ZNamesLoader", "loader", "=", "new", "ZNam...
Returns a set of names for the given meta zone ID. This method loads the set of names into the internal map and trie for future references. @param mzID the meta zone ID @return An instance of ZNames that includes a set of meta zone display names.
[ "Returns", "a", "set", "of", "names", "for", "the", "given", "meta", "zone", "ID", ".", "This", "method", "loads", "the", "set", "of", "names", "into", "the", "internal", "map", "and", "trie", "for", "future", "references", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java#L483-L491
35,308
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java
TimeZoneNamesImpl.loadTimeZoneNames
private synchronized ZNames loadTimeZoneNames(String tzID) { ZNames tznames = _tzNamesMap.get(tzID); if (tznames == null) { ZNamesLoader loader = new ZNamesLoader(); loader.loadTimeZone(_zoneStrings, tzID); tznames = ZNames.createTimeZoneAndPutInCache(_tzNamesMap, loader.getNames(), tzID); } return tznames; }
java
private synchronized ZNames loadTimeZoneNames(String tzID) { ZNames tznames = _tzNamesMap.get(tzID); if (tznames == null) { ZNamesLoader loader = new ZNamesLoader(); loader.loadTimeZone(_zoneStrings, tzID); tznames = ZNames.createTimeZoneAndPutInCache(_tzNamesMap, loader.getNames(), tzID); } return tznames; }
[ "private", "synchronized", "ZNames", "loadTimeZoneNames", "(", "String", "tzID", ")", "{", "ZNames", "tznames", "=", "_tzNamesMap", ".", "get", "(", "tzID", ")", ";", "if", "(", "tznames", "==", "null", ")", "{", "ZNamesLoader", "loader", "=", "new", "ZNam...
Returns a set of names for the given time zone ID. This method loads the set of names into the internal map and trie for future references. @param tzID the canonical time zone ID @return An instance of ZNames that includes a set of time zone display names.
[ "Returns", "a", "set", "of", "names", "for", "the", "given", "time", "zone", "ID", ".", "This", "method", "loads", "the", "set", "of", "names", "into", "the", "internal", "map", "and", "trie", "for", "future", "references", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneNamesImpl.java#L499-L507
35,309
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationSettings.java
CollationSettings.setStrength
public void setStrength(int value) { int noStrength = options & ~STRENGTH_MASK; switch(value) { case Collator.PRIMARY: case Collator.SECONDARY: case Collator.TERTIARY: case Collator.QUATERNARY: case Collator.IDENTICAL: options = noStrength | (value << STRENGTH_SHIFT); break; default: throw new IllegalArgumentException("illegal strength value " + value); } }
java
public void setStrength(int value) { int noStrength = options & ~STRENGTH_MASK; switch(value) { case Collator.PRIMARY: case Collator.SECONDARY: case Collator.TERTIARY: case Collator.QUATERNARY: case Collator.IDENTICAL: options = noStrength | (value << STRENGTH_SHIFT); break; default: throw new IllegalArgumentException("illegal strength value " + value); } }
[ "public", "void", "setStrength", "(", "int", "value", ")", "{", "int", "noStrength", "=", "options", "&", "~", "STRENGTH_MASK", ";", "switch", "(", "value", ")", "{", "case", "Collator", ".", "PRIMARY", ":", "case", "Collator", ".", "SECONDARY", ":", "ca...
except that this class uses bits in its own bit set for simple values.
[ "except", "that", "this", "class", "uses", "bits", "in", "its", "own", "bit", "set", "for", "simple", "values", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationSettings.java#L313-L326
35,310
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java
Buffer.completeSegmentByteCount
public long completeSegmentByteCount() { long result = size; if (result == 0) return 0; // Omit the tail if it's still writable. Segment tail = head.prev; if (tail.limit < Segment.SIZE && tail.owner) { result -= tail.limit - tail.pos; } return result; }
java
public long completeSegmentByteCount() { long result = size; if (result == 0) return 0; // Omit the tail if it's still writable. Segment tail = head.prev; if (tail.limit < Segment.SIZE && tail.owner) { result -= tail.limit - tail.pos; } return result; }
[ "public", "long", "completeSegmentByteCount", "(", ")", "{", "long", "result", "=", "size", ";", "if", "(", "result", "==", "0", ")", "return", "0", ";", "// Omit the tail if it's still writable.", "Segment", "tail", "=", "head", ".", "prev", ";", "if", "(",...
Returns the number of bytes in segments that are not writable. This is the number of bytes that can be flushed immediately to an underlying sink without harming throughput.
[ "Returns", "the", "number", "of", "bytes", "in", "segments", "that", "are", "not", "writable", ".", "This", "is", "the", "number", "of", "bytes", "that", "can", "be", "flushed", "immediately", "to", "an", "underlying", "sink", "without", "harming", "throughp...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java#L257-L268
35,311
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java
Buffer.segmentSizes
List<Integer> segmentSizes() { if (head == null) return Collections.emptyList(); List<Integer> result = new ArrayList<>(); result.add(head.limit - head.pos); for (Segment s = head.next; s != head; s = s.next) { result.add(s.limit - s.pos); } return result; }
java
List<Integer> segmentSizes() { if (head == null) return Collections.emptyList(); List<Integer> result = new ArrayList<>(); result.add(head.limit - head.pos); for (Segment s = head.next; s != head; s = s.next) { result.add(s.limit - s.pos); } return result; }
[ "List", "<", "Integer", ">", "segmentSizes", "(", ")", "{", "if", "(", "head", "==", "null", ")", "return", "Collections", ".", "emptyList", "(", ")", ";", "List", "<", "Integer", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "result",...
For testing. This returns the sizes of the segments in this buffer.
[ "For", "testing", ".", "This", "returns", "the", "sizes", "of", "the", "segments", "in", "this", "buffer", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java#L1327-L1335
35,312
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.entrySet
public synchronized Set<Map.Entry<Object,Object>> entrySet() { checkInitialized(); if (entrySet == null) { if (entrySetCallCount++ == 0) // Initial call entrySet = Collections.unmodifiableMap(this).entrySet(); else return super.entrySet(); // Recursive call } // This exception will be thrown if the implementation of // Collections.unmodifiableMap.entrySet() is changed such that it // no longer calls entrySet() on the backing Map. (Provider's // entrySet implementation depends on this "implementation detail", // which is unlikely to change. if (entrySetCallCount != 2) throw new RuntimeException("Internal error."); return entrySet; }
java
public synchronized Set<Map.Entry<Object,Object>> entrySet() { checkInitialized(); if (entrySet == null) { if (entrySetCallCount++ == 0) // Initial call entrySet = Collections.unmodifiableMap(this).entrySet(); else return super.entrySet(); // Recursive call } // This exception will be thrown if the implementation of // Collections.unmodifiableMap.entrySet() is changed such that it // no longer calls entrySet() on the backing Map. (Provider's // entrySet implementation depends on this "implementation detail", // which is unlikely to change. if (entrySetCallCount != 2) throw new RuntimeException("Internal error."); return entrySet; }
[ "public", "synchronized", "Set", "<", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", ">", "entrySet", "(", ")", "{", "checkInitialized", "(", ")", ";", "if", "(", "entrySet", "==", "null", ")", "{", "if", "(", "entrySetCallCount", "++", "==", ...
Returns an unmodifiable Set view of the property entries contained in this Provider. @see java.util.Map.Entry @since 1.2
[ "Returns", "an", "unmodifiable", "Set", "view", "of", "the", "property", "entries", "contained", "in", "this", "Provider", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L261-L279
35,313
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.putId
private void putId() { // note: name and info may be null super.put("Provider.id name", String.valueOf(name)); super.put("Provider.id version", String.valueOf(version)); super.put("Provider.id info", String.valueOf(info)); super.put("Provider.id className", this.getClass().getName()); }
java
private void putId() { // note: name and info may be null super.put("Provider.id name", String.valueOf(name)); super.put("Provider.id version", String.valueOf(version)); super.put("Provider.id info", String.valueOf(info)); super.put("Provider.id className", this.getClass().getName()); }
[ "private", "void", "putId", "(", ")", "{", "// note: name and info may be null", "super", ".", "put", "(", "\"Provider.id name\"", ",", "String", ".", "valueOf", "(", "name", ")", ")", ";", "super", ".", "put", "(", "\"Provider.id version\"", ",", "String", "....
report to different provider objects as the same
[ "report", "to", "different", "provider", "objects", "as", "the", "same" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L445-L451
35,314
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.implPutAll
private void implPutAll(Map t) { for (Map.Entry e : ((Map<?,?>)t).entrySet()) { implPut(e.getKey(), e.getValue()); } if (registered) { Security.increaseVersion(); } }
java
private void implPutAll(Map t) { for (Map.Entry e : ((Map<?,?>)t).entrySet()) { implPut(e.getKey(), e.getValue()); } if (registered) { Security.increaseVersion(); } }
[ "private", "void", "implPutAll", "(", "Map", "t", ")", "{", "for", "(", "Map", ".", "Entry", "e", ":", "(", "(", "Map", "<", "?", ",", "?", ">", ")", "t", ")", ".", "entrySet", "(", ")", ")", "{", "implPut", "(", "e", ".", "getKey", "(", ")...
Copies all of the mappings from the specified Map to this provider. Internal method to be called AFTER the security check has been performed.
[ "Copies", "all", "of", "the", "mappings", "from", "the", "specified", "Map", "to", "this", "provider", ".", "Internal", "method", "to", "be", "called", "AFTER", "the", "security", "check", "has", "been", "performed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L472-L479
35,315
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.ensureLegacyParsed
private void ensureLegacyParsed() { if ((legacyChanged == false) || (legacyStrings == null)) { return; } serviceSet = null; if (legacyMap == null) { legacyMap = new LinkedHashMap<ServiceKey,Service>(); } else { legacyMap.clear(); } for (Map.Entry<String,String> entry : legacyStrings.entrySet()) { parseLegacyPut(entry.getKey(), entry.getValue()); } removeInvalidServices(legacyMap); legacyChanged = false; }
java
private void ensureLegacyParsed() { if ((legacyChanged == false) || (legacyStrings == null)) { return; } serviceSet = null; if (legacyMap == null) { legacyMap = new LinkedHashMap<ServiceKey,Service>(); } else { legacyMap.clear(); } for (Map.Entry<String,String> entry : legacyStrings.entrySet()) { parseLegacyPut(entry.getKey(), entry.getValue()); } removeInvalidServices(legacyMap); legacyChanged = false; }
[ "private", "void", "ensureLegacyParsed", "(", ")", "{", "if", "(", "(", "legacyChanged", "==", "false", ")", "||", "(", "legacyStrings", "==", "null", ")", ")", "{", "return", ";", "}", "serviceSet", "=", "null", ";", "if", "(", "legacyMap", "==", "nul...
Ensure all the legacy String properties are fully parsed into service objects.
[ "Ensure", "all", "the", "legacy", "String", "properties", "are", "fully", "parsed", "into", "service", "objects", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L571-L586
35,316
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.removeInvalidServices
private void removeInvalidServices(Map<ServiceKey,Service> map) { for (Iterator t = map.entrySet().iterator(); t.hasNext(); ) { Map.Entry entry = (Map.Entry)t.next(); Service s = (Service)entry.getValue(); if (s.isValid() == false) { t.remove(); } } }
java
private void removeInvalidServices(Map<ServiceKey,Service> map) { for (Iterator t = map.entrySet().iterator(); t.hasNext(); ) { Map.Entry entry = (Map.Entry)t.next(); Service s = (Service)entry.getValue(); if (s.isValid() == false) { t.remove(); } } }
[ "private", "void", "removeInvalidServices", "(", "Map", "<", "ServiceKey", ",", "Service", ">", "map", ")", "{", "for", "(", "Iterator", "t", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "t", ".", "hasNext", "(", ")", ";", ...
Remove all invalid services from the Map. Invalid services can only occur if the legacy properties are inconsistent or incomplete.
[ "Remove", "all", "invalid", "services", "from", "the", "Map", ".", "Invalid", "services", "can", "only", "occur", "if", "the", "legacy", "properties", "are", "inconsistent", "or", "incomplete", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L592-L600
35,317
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.getServices
public synchronized Set<Service> getServices() { checkInitialized(); if (legacyChanged || servicesChanged) { serviceSet = null; } if (serviceSet == null) { ensureLegacyParsed(); Set<Service> set = new LinkedHashSet<>(); if (serviceMap != null) { set.addAll(serviceMap.values()); } if (legacyMap != null) { set.addAll(legacyMap.values()); } serviceSet = Collections.unmodifiableSet(set); servicesChanged = false; } return serviceSet; }
java
public synchronized Set<Service> getServices() { checkInitialized(); if (legacyChanged || servicesChanged) { serviceSet = null; } if (serviceSet == null) { ensureLegacyParsed(); Set<Service> set = new LinkedHashSet<>(); if (serviceMap != null) { set.addAll(serviceMap.values()); } if (legacyMap != null) { set.addAll(legacyMap.values()); } serviceSet = Collections.unmodifiableSet(set); servicesChanged = false; } return serviceSet; }
[ "public", "synchronized", "Set", "<", "Service", ">", "getServices", "(", ")", "{", "checkInitialized", "(", ")", ";", "if", "(", "legacyChanged", "||", "servicesChanged", ")", "{", "serviceSet", "=", "null", ";", "}", "if", "(", "serviceSet", "==", "null"...
Get an unmodifiable Set of all services supported by this Provider. @return an unmodifiable Set of all services supported by this Provider @since 1.5
[ "Get", "an", "unmodifiable", "Set", "of", "all", "services", "supported", "by", "this", "Provider", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L743-L761
35,318
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.putPropertyStrings
private void putPropertyStrings(Service s) { String type = s.getType(); String algorithm = s.getAlgorithm(); // use super() to avoid permission check and other processing super.put(type + "." + algorithm, s.getClassName()); for (String alias : s.getAliases()) { super.put(ALIAS_PREFIX + type + "." + alias, algorithm); } for (Map.Entry<UString,String> entry : s.attributes.entrySet()) { String key = type + "." + algorithm + " " + entry.getKey(); super.put(key, entry.getValue()); } if (registered) { Security.increaseVersion(); } }
java
private void putPropertyStrings(Service s) { String type = s.getType(); String algorithm = s.getAlgorithm(); // use super() to avoid permission check and other processing super.put(type + "." + algorithm, s.getClassName()); for (String alias : s.getAliases()) { super.put(ALIAS_PREFIX + type + "." + alias, algorithm); } for (Map.Entry<UString,String> entry : s.attributes.entrySet()) { String key = type + "." + algorithm + " " + entry.getKey(); super.put(key, entry.getValue()); } if (registered) { Security.increaseVersion(); } }
[ "private", "void", "putPropertyStrings", "(", "Service", "s", ")", "{", "String", "type", "=", "s", ".", "getType", "(", ")", ";", "String", "algorithm", "=", "s", ".", "getAlgorithm", "(", ")", ";", "// use super() to avoid permission check and other processing",...
Put the string properties for this Service in this Provider's Hashtable.
[ "Put", "the", "string", "properties", "for", "this", "Service", "in", "this", "Provider", "s", "Hashtable", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L824-L839
35,319
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java
Provider.removePropertyStrings
private void removePropertyStrings(Service s) { String type = s.getType(); String algorithm = s.getAlgorithm(); // use super() to avoid permission check and other processing super.remove(type + "." + algorithm); for (String alias : s.getAliases()) { super.remove(ALIAS_PREFIX + type + "." + alias); } for (Map.Entry<UString,String> entry : s.attributes.entrySet()) { String key = type + "." + algorithm + " " + entry.getKey(); super.remove(key); } if (registered) { Security.increaseVersion(); } }
java
private void removePropertyStrings(Service s) { String type = s.getType(); String algorithm = s.getAlgorithm(); // use super() to avoid permission check and other processing super.remove(type + "." + algorithm); for (String alias : s.getAliases()) { super.remove(ALIAS_PREFIX + type + "." + alias); } for (Map.Entry<UString,String> entry : s.attributes.entrySet()) { String key = type + "." + algorithm + " " + entry.getKey(); super.remove(key); } if (registered) { Security.increaseVersion(); } }
[ "private", "void", "removePropertyStrings", "(", "Service", "s", ")", "{", "String", "type", "=", "s", ".", "getType", "(", ")", ";", "String", "algorithm", "=", "s", ".", "getAlgorithm", "(", ")", ";", "// use super() to avoid permission check and other processin...
Remove the string properties for this Service from this Provider's Hashtable.
[ "Remove", "the", "string", "properties", "for", "this", "Service", "from", "this", "Provider", "s", "Hashtable", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Provider.java#L845-L860
35,320
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/IntPipeline.java
IntPipeline.asLongStream
@Override public final LongStream asLongStream() { return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override public Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept((long) t); } }; } }; }
java
@Override public final LongStream asLongStream() { return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override public Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept((long) t); } }; } }; }
[ "@", "Override", "public", "final", "LongStream", "asLongStream", "(", ")", "{", "return", "new", "LongPipeline", ".", "StatelessOp", "<", "Integer", ">", "(", "this", ",", "StreamShape", ".", "INT_VALUE", ",", "StreamOpFlag", ".", "NOT_SORTED", "|", "StreamOp...
Stateless intermediate ops from IntStream
[ "Stateless", "intermediate", "ops", "from", "IntStream" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/IntPipeline.java#L187-L201
35,321
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/IntPipeline.java
IntPipeline.limit
@Override public final IntStream limit(long maxSize) { if (maxSize < 0) throw new IllegalArgumentException(Long.toString(maxSize)); return SliceOps.makeInt(this, 0, maxSize); }
java
@Override public final IntStream limit(long maxSize) { if (maxSize < 0) throw new IllegalArgumentException(Long.toString(maxSize)); return SliceOps.makeInt(this, 0, maxSize); }
[ "@", "Override", "public", "final", "IntStream", "limit", "(", "long", "maxSize", ")", "{", "if", "(", "maxSize", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "Long", ".", "toString", "(", "maxSize", ")", ")", ";", "return", "SliceOps", ...
Stateful intermediate ops from IntStream
[ "Stateful", "intermediate", "ops", "from", "IntStream" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/IntPipeline.java#L372-L377
35,322
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectPool.java
ObjectPool.getInstanceIfFree
public synchronized Object getInstanceIfFree() { // Check if the pool is empty. if (!freeStack.isEmpty()) { // Remove object from end of free pool. Object result = freeStack.remove(freeStack.size() - 1); return result; } return null; }
java
public synchronized Object getInstanceIfFree() { // Check if the pool is empty. if (!freeStack.isEmpty()) { // Remove object from end of free pool. Object result = freeStack.remove(freeStack.size() - 1); return result; } return null; }
[ "public", "synchronized", "Object", "getInstanceIfFree", "(", ")", "{", "// Check if the pool is empty.", "if", "(", "!", "freeStack", ".", "isEmpty", "(", ")", ")", "{", "// Remove object from end of free pool.", "Object", "result", "=", "freeStack", ".", "remove", ...
Get an instance of the given object in this pool if available @return an instance of the given object if available or null
[ "Get", "an", "instance", "of", "the", "given", "object", "in", "this", "pool", "if", "available" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectPool.java#L105-L118
35,323
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemWithParam.java
ElemWithParam.getValue
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment int df = transformer.transformToRTF(this); var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; }
java
public XObject getValue(TransformerImpl transformer, int sourceNode) throws TransformerException { XObject var; XPathContext xctxt = transformer.getXPathContext(); xctxt.pushCurrentNode(sourceNode); try { if (null != m_selectPattern) { var = m_selectPattern.execute(xctxt, sourceNode, this); var.allowDetachToRelease(false); } else if (null == getFirstChildElem()) { var = XString.EMPTYSTRING; } else { // Use result tree fragment int df = transformer.transformToRTF(this); var = new XRTreeFrag(df, xctxt, this); } } finally { xctxt.popCurrentNode(); } return var; }
[ "public", "XObject", "getValue", "(", "TransformerImpl", "transformer", ",", "int", "sourceNode", ")", "throws", "TransformerException", "{", "XObject", "var", ";", "XPathContext", "xctxt", "=", "transformer", ".", "getXPathContext", "(", ")", ";", "xctxt", ".", ...
Get the XObject representation of the variable. @param transformer non-null reference to the the current transform-time state. @param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>. @return the XObject representation of the variable. @throws TransformerException
[ "Get", "the", "XObject", "representation", "of", "the", "variable", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemWithParam.java#L190-L226
35,324
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.parseRules
public void parseRules(String description) { // (the number of elements in the description list isn't necessarily // the number of rules-- some descriptions may expend into two rules) List<NFRule> tempRules = new ArrayList<NFRule>(); // we keep track of the rule before the one we're currently working // on solely to support >>> substitutions NFRule predecessor = null; // Iterate through the rules. The rules // are separated by semicolons (there's no escape facility: ALL // semicolons are rule delimiters) int oldP = 0; int descriptionLen = description.length(); int p; do { p = description.indexOf(';', oldP); if (p < 0) { p = descriptionLen; } // makeRules (a factory method on NFRule) will return either // a single rule or an array of rules. Either way, add them // to our rule vector NFRule.makeRules(description.substring(oldP, p), this, predecessor, owner, tempRules); if (!tempRules.isEmpty()) { predecessor = tempRules.get(tempRules.size() - 1); } oldP = p + 1; } while (oldP < descriptionLen); // for rules that didn't specify a base value, their base values // were initialized to 0. Make another pass through the list and // set all those rules' base values. We also remove any special // rules from the list and put them into their own member variables long defaultBaseValue = 0; for (NFRule rule : tempRules) { long baseValue = rule.getBaseValue(); if (baseValue == 0) { // if the rule's base value is 0, fill in a default // base value (this will be 1 plus the preceding // rule's base value for regular rule sets, and the // same as the preceding rule's base value in fraction // rule sets) rule.setBaseValue(defaultBaseValue); } else { // if it's a regular rule that already knows its base value, // check to make sure the rules are in order, and update // the default base value for the next rule if (baseValue < defaultBaseValue) { throw new IllegalArgumentException("Rules are not in order, base: " + baseValue + " < " + defaultBaseValue); } defaultBaseValue = baseValue; } if (!isFractionRuleSet) { ++defaultBaseValue; } } // finally, we can copy the rules from the vector into a // fixed-length array rules = new NFRule[tempRules.size()]; tempRules.toArray(rules); }
java
public void parseRules(String description) { // (the number of elements in the description list isn't necessarily // the number of rules-- some descriptions may expend into two rules) List<NFRule> tempRules = new ArrayList<NFRule>(); // we keep track of the rule before the one we're currently working // on solely to support >>> substitutions NFRule predecessor = null; // Iterate through the rules. The rules // are separated by semicolons (there's no escape facility: ALL // semicolons are rule delimiters) int oldP = 0; int descriptionLen = description.length(); int p; do { p = description.indexOf(';', oldP); if (p < 0) { p = descriptionLen; } // makeRules (a factory method on NFRule) will return either // a single rule or an array of rules. Either way, add them // to our rule vector NFRule.makeRules(description.substring(oldP, p), this, predecessor, owner, tempRules); if (!tempRules.isEmpty()) { predecessor = tempRules.get(tempRules.size() - 1); } oldP = p + 1; } while (oldP < descriptionLen); // for rules that didn't specify a base value, their base values // were initialized to 0. Make another pass through the list and // set all those rules' base values. We also remove any special // rules from the list and put them into their own member variables long defaultBaseValue = 0; for (NFRule rule : tempRules) { long baseValue = rule.getBaseValue(); if (baseValue == 0) { // if the rule's base value is 0, fill in a default // base value (this will be 1 plus the preceding // rule's base value for regular rule sets, and the // same as the preceding rule's base value in fraction // rule sets) rule.setBaseValue(defaultBaseValue); } else { // if it's a regular rule that already knows its base value, // check to make sure the rules are in order, and update // the default base value for the next rule if (baseValue < defaultBaseValue) { throw new IllegalArgumentException("Rules are not in order, base: " + baseValue + " < " + defaultBaseValue); } defaultBaseValue = baseValue; } if (!isFractionRuleSet) { ++defaultBaseValue; } } // finally, we can copy the rules from the vector into a // fixed-length array rules = new NFRule[tempRules.size()]; tempRules.toArray(rules); }
[ "public", "void", "parseRules", "(", "String", "description", ")", "{", "// (the number of elements in the description list isn't necessarily", "// the number of rules-- some descriptions may expend into two rules)", "List", "<", "NFRule", ">", "tempRules", "=", "new", "ArrayList",...
Construct the subordinate data structures used by this object. This function is called by the RuleBasedNumberFormat constructor after all the rule sets have been created to actually parse the description and build rules from it. Since any rule set can refer to any other rule set, we have to have created all of them before we can create anything else. @param description The textual description of this rule set
[ "Construct", "the", "subordinate", "data", "structures", "used", "by", "this", "object", ".", "This", "function", "is", "called", "by", "the", "RuleBasedNumberFormat", "constructor", "after", "all", "the", "rule", "sets", "have", "been", "created", "to", "actual...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L163-L232
35,325
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.setNonNumericalRule
void setNonNumericalRule(NFRule rule) { long baseValue = rule.getBaseValue(); if (baseValue == NFRule.NEGATIVE_NUMBER_RULE) { nonNumericalRules[NFRuleSet.NEGATIVE_RULE_INDEX] = rule; } else if (baseValue == NFRule.IMPROPER_FRACTION_RULE) { setBestFractionRule(NFRuleSet.IMPROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule.PROPER_FRACTION_RULE) { setBestFractionRule(NFRuleSet.PROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule.MASTER_RULE) { setBestFractionRule(NFRuleSet.MASTER_RULE_INDEX, rule, true); } else if (baseValue == NFRule.INFINITY_RULE) { nonNumericalRules[NFRuleSet.INFINITY_RULE_INDEX] = rule; } else if (baseValue == NFRule.NAN_RULE) { nonNumericalRules[NFRuleSet.NAN_RULE_INDEX] = rule; } }
java
void setNonNumericalRule(NFRule rule) { long baseValue = rule.getBaseValue(); if (baseValue == NFRule.NEGATIVE_NUMBER_RULE) { nonNumericalRules[NFRuleSet.NEGATIVE_RULE_INDEX] = rule; } else if (baseValue == NFRule.IMPROPER_FRACTION_RULE) { setBestFractionRule(NFRuleSet.IMPROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule.PROPER_FRACTION_RULE) { setBestFractionRule(NFRuleSet.PROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule.MASTER_RULE) { setBestFractionRule(NFRuleSet.MASTER_RULE_INDEX, rule, true); } else if (baseValue == NFRule.INFINITY_RULE) { nonNumericalRules[NFRuleSet.INFINITY_RULE_INDEX] = rule; } else if (baseValue == NFRule.NAN_RULE) { nonNumericalRules[NFRuleSet.NAN_RULE_INDEX] = rule; } }
[ "void", "setNonNumericalRule", "(", "NFRule", "rule", ")", "{", "long", "baseValue", "=", "rule", ".", "getBaseValue", "(", ")", ";", "if", "(", "baseValue", "==", "NFRule", ".", "NEGATIVE_NUMBER_RULE", ")", "{", "nonNumericalRules", "[", "NFRuleSet", ".", "...
Set one of the non-numerical rules. @param rule The rule to set.
[ "Set", "one", "of", "the", "non", "-", "numerical", "rules", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L238-L258
35,326
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.setBestFractionRule
private void setBestFractionRule(int originalIndex, NFRule newRule, boolean rememberRule) { if (rememberRule) { if (fractionRules == null) { fractionRules = new LinkedList<NFRule>(); } fractionRules.add(newRule); } NFRule bestResult = nonNumericalRules[originalIndex]; if (bestResult == null) { nonNumericalRules[originalIndex] = newRule; } else { // We have more than one. Which one is better? DecimalFormatSymbols decimalFormatSymbols = owner.getDecimalFormatSymbols(); if (decimalFormatSymbols.getDecimalSeparator() == newRule.getDecimalPoint()) { nonNumericalRules[originalIndex] = newRule; } // else leave it alone } }
java
private void setBestFractionRule(int originalIndex, NFRule newRule, boolean rememberRule) { if (rememberRule) { if (fractionRules == null) { fractionRules = new LinkedList<NFRule>(); } fractionRules.add(newRule); } NFRule bestResult = nonNumericalRules[originalIndex]; if (bestResult == null) { nonNumericalRules[originalIndex] = newRule; } else { // We have more than one. Which one is better? DecimalFormatSymbols decimalFormatSymbols = owner.getDecimalFormatSymbols(); if (decimalFormatSymbols.getDecimalSeparator() == newRule.getDecimalPoint()) { nonNumericalRules[originalIndex] = newRule; } // else leave it alone } }
[ "private", "void", "setBestFractionRule", "(", "int", "originalIndex", ",", "NFRule", "newRule", ",", "boolean", "rememberRule", ")", "{", "if", "(", "rememberRule", ")", "{", "if", "(", "fractionRules", "==", "null", ")", "{", "fractionRules", "=", "new", "...
Determine the best fraction rule to use. Rules matching the decimal point from DecimalFormatSymbols become the main set of rules to use. @param originalIndex The index into nonNumericalRules @param newRule The new rule to consider @param rememberRule Should the new rule be added to fractionRules.
[ "Determine", "the", "best", "fraction", "rule", "to", "use", ".", "Rules", "matching", "the", "decimal", "point", "from", "DecimalFormatSymbols", "become", "the", "main", "set", "of", "rules", "to", "use", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L267-L286
35,327
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.format
public void format(long number, StringBuilder toInsertInto, int pos, int recursionCount) { if (recursionCount >= RECURSION_LIMIT) { throw new IllegalStateException("Recursion limit exceeded when applying ruleSet " + name); } NFRule applicableRule = findNormalRule(number); applicableRule.doFormat(number, toInsertInto, pos, ++recursionCount); }
java
public void format(long number, StringBuilder toInsertInto, int pos, int recursionCount) { if (recursionCount >= RECURSION_LIMIT) { throw new IllegalStateException("Recursion limit exceeded when applying ruleSet " + name); } NFRule applicableRule = findNormalRule(number); applicableRule.doFormat(number, toInsertInto, pos, ++recursionCount); }
[ "public", "void", "format", "(", "long", "number", ",", "StringBuilder", "toInsertInto", ",", "int", "pos", ",", "int", "recursionCount", ")", "{", "if", "(", "recursionCount", ">=", "RECURSION_LIMIT", ")", "{", "throw", "new", "IllegalStateException", "(", "\...
Formats a long. Selects an appropriate rule and dispatches control to it. @param number The number being formatted @param toInsertInto The string where the result is to be placed @param pos The position in toInsertInto where the result of this operation is to be inserted
[ "Formats", "a", "long", ".", "Selects", "an", "appropriate", "rule", "and", "dispatches", "control", "to", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L436-L442
35,328
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.findRule
NFRule findRule(double number) { // if this is a fraction rule set, use findFractionRuleSetRule() if (isFractionRuleSet) { return findFractionRuleSetRule(number); } if (Double.isNaN(number)) { NFRule rule = nonNumericalRules[NAN_RULE_INDEX]; if (rule == null) { rule = owner.getDefaultNaNRule(); } return rule; } // if the number is negative, return the negative number rule // (if there isn't a negative-number rule, we pretend it's a // positive number) if (number < 0) { if (nonNumericalRules[NEGATIVE_RULE_INDEX] != null) { return nonNumericalRules[NEGATIVE_RULE_INDEX]; } else { number = -number; } } if (Double.isInfinite(number)) { NFRule rule = nonNumericalRules[INFINITY_RULE_INDEX]; if (rule == null) { rule = owner.getDefaultInfinityRule(); } return rule; } // if the number isn't an integer, we use one f the fraction rules... if (number != Math.floor(number)) { if (number < 1 && nonNumericalRules[PROPER_FRACTION_RULE_INDEX] != null) { // if the number is between 0 and 1, return the proper // fraction rule return nonNumericalRules[PROPER_FRACTION_RULE_INDEX]; } else if (nonNumericalRules[IMPROPER_FRACTION_RULE_INDEX] != null) { // otherwise, return the improper fraction rule return nonNumericalRules[IMPROPER_FRACTION_RULE_INDEX]; } } // if there's a master rule, use it to format the number if (nonNumericalRules[MASTER_RULE_INDEX] != null) { return nonNumericalRules[MASTER_RULE_INDEX]; } else { // and if we haven't yet returned a rule, use findNormalRule() // to find the applicable rule return findNormalRule(Math.round(number)); } }
java
NFRule findRule(double number) { // if this is a fraction rule set, use findFractionRuleSetRule() if (isFractionRuleSet) { return findFractionRuleSetRule(number); } if (Double.isNaN(number)) { NFRule rule = nonNumericalRules[NAN_RULE_INDEX]; if (rule == null) { rule = owner.getDefaultNaNRule(); } return rule; } // if the number is negative, return the negative number rule // (if there isn't a negative-number rule, we pretend it's a // positive number) if (number < 0) { if (nonNumericalRules[NEGATIVE_RULE_INDEX] != null) { return nonNumericalRules[NEGATIVE_RULE_INDEX]; } else { number = -number; } } if (Double.isInfinite(number)) { NFRule rule = nonNumericalRules[INFINITY_RULE_INDEX]; if (rule == null) { rule = owner.getDefaultInfinityRule(); } return rule; } // if the number isn't an integer, we use one f the fraction rules... if (number != Math.floor(number)) { if (number < 1 && nonNumericalRules[PROPER_FRACTION_RULE_INDEX] != null) { // if the number is between 0 and 1, return the proper // fraction rule return nonNumericalRules[PROPER_FRACTION_RULE_INDEX]; } else if (nonNumericalRules[IMPROPER_FRACTION_RULE_INDEX] != null) { // otherwise, return the improper fraction rule return nonNumericalRules[IMPROPER_FRACTION_RULE_INDEX]; } } // if there's a master rule, use it to format the number if (nonNumericalRules[MASTER_RULE_INDEX] != null) { return nonNumericalRules[MASTER_RULE_INDEX]; } else { // and if we haven't yet returned a rule, use findNormalRule() // to find the applicable rule return findNormalRule(Math.round(number)); } }
[ "NFRule", "findRule", "(", "double", "number", ")", "{", "// if this is a fraction rule set, use findFractionRuleSetRule()", "if", "(", "isFractionRuleSet", ")", "{", "return", "findFractionRuleSetRule", "(", "number", ")", ";", "}", "if", "(", "Double", ".", "isNaN",...
Selects an appropriate rule for formatting the number. @param number The number being formatted. @return The rule that should be used to format it
[ "Selects", "an", "appropriate", "rule", "for", "formatting", "the", "number", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L465-L520
35,329
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java
NFRuleSet.lcm
private static long lcm(long x, long y) { // binary gcd algorithm from Knuth, "The Art of Computer Programming," // vol. 2, 1st ed., pp. 298-299 long x1 = x; long y1 = y; int p2 = 0; while ((x1 & 1) == 0 && (y1 & 1) == 0) { ++p2; x1 >>= 1; y1 >>= 1; } long t; if ((x1 & 1) == 1) { t = -y1; } else { t = x1; } while (t != 0) { while ((t & 1) == 0) { t >>= 1; } if (t > 0) { x1 = t; } else { y1 = -t; } t = x1 - y1; } long gcd = x1 << p2; // x * y == gcd(x, y) * lcm(x, y) return x / gcd * y; }
java
private static long lcm(long x, long y) { // binary gcd algorithm from Knuth, "The Art of Computer Programming," // vol. 2, 1st ed., pp. 298-299 long x1 = x; long y1 = y; int p2 = 0; while ((x1 & 1) == 0 && (y1 & 1) == 0) { ++p2; x1 >>= 1; y1 >>= 1; } long t; if ((x1 & 1) == 1) { t = -y1; } else { t = x1; } while (t != 0) { while ((t & 1) == 0) { t >>= 1; } if (t > 0) { x1 = t; } else { y1 = -t; } t = x1 - y1; } long gcd = x1 << p2; // x * y == gcd(x, y) * lcm(x, y) return x / gcd * y; }
[ "private", "static", "long", "lcm", "(", "long", "x", ",", "long", "y", ")", "{", "// binary gcd algorithm from Knuth, \"The Art of Computer Programming,\"", "// vol. 2, 1st ed., pp. 298-299", "long", "x1", "=", "x", ";", "long", "y1", "=", "y", ";", "int", "p2", ...
Calculates the least common multiple of x and y.
[ "Calculates", "the", "least", "common", "multiple", "of", "x", "and", "y", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFRuleSet.java#L692-L727
35,330
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/Version.java
Version.jarVersion
public static String jarVersion(Class<?> jarClass) { String j2objcVersion = null; String path = jarClass.getProtectionDomain().getCodeSource().getLocation().getPath(); try (JarFile jar = new JarFile(URLDecoder.decode(path, "UTF-8"))) { Manifest manifest = jar.getManifest(); j2objcVersion = manifest.getMainAttributes().getValue("version"); } catch (IOException e) { // fall-through } if (j2objcVersion == null) { j2objcVersion = "(j2objc version not available)"; } String javacVersion = Parser.newParser(null).version(); return String.format("%s (javac %s)", j2objcVersion, javacVersion); }
java
public static String jarVersion(Class<?> jarClass) { String j2objcVersion = null; String path = jarClass.getProtectionDomain().getCodeSource().getLocation().getPath(); try (JarFile jar = new JarFile(URLDecoder.decode(path, "UTF-8"))) { Manifest manifest = jar.getManifest(); j2objcVersion = manifest.getMainAttributes().getValue("version"); } catch (IOException e) { // fall-through } if (j2objcVersion == null) { j2objcVersion = "(j2objc version not available)"; } String javacVersion = Parser.newParser(null).version(); return String.format("%s (javac %s)", j2objcVersion, javacVersion); }
[ "public", "static", "String", "jarVersion", "(", "Class", "<", "?", ">", "jarClass", ")", "{", "String", "j2objcVersion", "=", "null", ";", "String", "path", "=", "jarClass", ".", "getProtectionDomain", "(", ")", ".", "getCodeSource", "(", ")", ".", "getLo...
Returns the "version" entry from a jar file's manifest, if available. If the class isn't in a jar file, or that jar file doesn't define a "version" entry, then a "not available" string is returned. @param jarClass any class from the target jar
[ "Returns", "the", "version", "entry", "from", "a", "jar", "file", "s", "manifest", "if", "available", ".", "If", "the", "class", "isn", "t", "in", "a", "jar", "file", "or", "that", "jar", "file", "doesn", "t", "define", "a", "version", "entry", "then",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/Version.java#L31-L47
35,331
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/Rewriter.java
Rewriter.endVisit
@Override public void endVisit(PropertyAnnotation node) { FieldDeclaration field = (FieldDeclaration) node.getParent(); TypeMirror fieldType = field.getTypeMirror(); String getter = node.getGetter(); String setter = node.getSetter(); if (field.getFragments().size() > 1) { if (getter != null) { ErrorUtil.error(field, "@Property getter declared for multiple fields"); return; } if (setter != null) { ErrorUtil.error(field, "@Property setter declared for multiple fields"); return; } } else { // Check that specified accessors exist. TypeElement enclosingType = TreeUtil.getEnclosingTypeElement(node); if (getter != null) { if (ElementUtil.findMethod(enclosingType, getter) == null) { ErrorUtil.error(field, "Non-existent getter specified: " + getter); } } if (setter != null) { if (ElementUtil.findMethod( enclosingType, setter, TypeUtil.getQualifiedName(fieldType)) == null) { ErrorUtil.error(field, "Non-existent setter specified: " + setter); } } } }
java
@Override public void endVisit(PropertyAnnotation node) { FieldDeclaration field = (FieldDeclaration) node.getParent(); TypeMirror fieldType = field.getTypeMirror(); String getter = node.getGetter(); String setter = node.getSetter(); if (field.getFragments().size() > 1) { if (getter != null) { ErrorUtil.error(field, "@Property getter declared for multiple fields"); return; } if (setter != null) { ErrorUtil.error(field, "@Property setter declared for multiple fields"); return; } } else { // Check that specified accessors exist. TypeElement enclosingType = TreeUtil.getEnclosingTypeElement(node); if (getter != null) { if (ElementUtil.findMethod(enclosingType, getter) == null) { ErrorUtil.error(field, "Non-existent getter specified: " + getter); } } if (setter != null) { if (ElementUtil.findMethod( enclosingType, setter, TypeUtil.getQualifiedName(fieldType)) == null) { ErrorUtil.error(field, "Non-existent setter specified: " + setter); } } } }
[ "@", "Override", "public", "void", "endVisit", "(", "PropertyAnnotation", "node", ")", "{", "FieldDeclaration", "field", "=", "(", "FieldDeclaration", ")", "node", ".", "getParent", "(", ")", ";", "TypeMirror", "fieldType", "=", "field", ".", "getTypeMirror", ...
Make sure attempt isn't made to specify an accessor method for fields with multiple fragments, since each variable needs unique accessors.
[ "Make", "sure", "attempt", "isn", "t", "made", "to", "specify", "an", "accessor", "method", "for", "fields", "with", "multiple", "fragments", "since", "each", "variable", "needs", "unique", "accessors", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Rewriter.java#L242-L272
35,332
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java
ArraySet.contains
@Override public boolean contains(Object key) { return key == null ? (indexOfNull() >= 0) : (indexOf(key, key.hashCode()) >= 0); }
java
@Override public boolean contains(Object key) { return key == null ? (indexOfNull() >= 0) : (indexOf(key, key.hashCode()) >= 0); }
[ "@", "Override", "public", "boolean", "contains", "(", "Object", "key", ")", "{", "return", "key", "==", "null", "?", "(", "indexOfNull", "(", ")", ">=", "0", ")", ":", "(", "indexOf", "(", "key", ",", "key", ".", "hashCode", "(", ")", ")", ">=", ...
Check whether a value exists in the set. @param key The value to search for. @return Returns true if the value exists, else false.
[ "Check", "whether", "a", "value", "exists", "in", "the", "set", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java#L292-L295
35,333
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java
ArraySet.add
@Override public boolean add(E value) { final int hash; int index; if (value == null) { hash = 0; index = indexOfNull(); } else { hash = value.hashCode(); index = indexOf(value, hash); } if (index >= 0) { return false; } index = ~index; if (mSize >= mHashes.length) { final int n = mSize >= (BASE_SIZE*2) ? (mSize+(mSize>>1)) : (mSize >= BASE_SIZE ? (BASE_SIZE*2) : BASE_SIZE); if (DEBUG) Log.d(TAG, "add: grow from " + mHashes.length + " to " + n); final int[] ohashes = mHashes; final Object[] oarray = mArray; allocArrays(n); if (mHashes.length > 0) { if (DEBUG) Log.d(TAG, "add: copy 0-" + mSize + " to 0"); System.arraycopy(ohashes, 0, mHashes, 0, ohashes.length); System.arraycopy(oarray, 0, mArray, 0, oarray.length); } freeArrays(ohashes, oarray, mSize); } if (index < mSize) { if (DEBUG) Log.d(TAG, "add: move " + index + "-" + (mSize-index) + " to " + (index+1)); System.arraycopy(mHashes, index, mHashes, index + 1, mSize - index); System.arraycopy(mArray, index, mArray, index + 1, mSize - index); } mHashes[index] = hash; mArray[index] = value; mSize++; return true; }
java
@Override public boolean add(E value) { final int hash; int index; if (value == null) { hash = 0; index = indexOfNull(); } else { hash = value.hashCode(); index = indexOf(value, hash); } if (index >= 0) { return false; } index = ~index; if (mSize >= mHashes.length) { final int n = mSize >= (BASE_SIZE*2) ? (mSize+(mSize>>1)) : (mSize >= BASE_SIZE ? (BASE_SIZE*2) : BASE_SIZE); if (DEBUG) Log.d(TAG, "add: grow from " + mHashes.length + " to " + n); final int[] ohashes = mHashes; final Object[] oarray = mArray; allocArrays(n); if (mHashes.length > 0) { if (DEBUG) Log.d(TAG, "add: copy 0-" + mSize + " to 0"); System.arraycopy(ohashes, 0, mHashes, 0, ohashes.length); System.arraycopy(oarray, 0, mArray, 0, oarray.length); } freeArrays(ohashes, oarray, mSize); } if (index < mSize) { if (DEBUG) Log.d(TAG, "add: move " + index + "-" + (mSize-index) + " to " + (index+1)); System.arraycopy(mHashes, index, mHashes, index + 1, mSize - index); System.arraycopy(mArray, index, mArray, index + 1, mSize - index); } mHashes[index] = hash; mArray[index] = value; mSize++; return true; }
[ "@", "Override", "public", "boolean", "add", "(", "E", "value", ")", "{", "final", "int", "hash", ";", "int", "index", ";", "if", "(", "value", "==", "null", ")", "{", "hash", "=", "0", ";", "index", "=", "indexOfNull", "(", ")", ";", "}", "else"...
Adds the specified object to this set. The set is not modified if it already contains the object. @param value the object to add. @return {@code true} if this set is modified, {@code false} otherwise. @throws ClassCastException when the class of the object is inappropriate for this set.
[ "Adds", "the", "specified", "object", "to", "this", "set", ".", "The", "set", "is", "not", "modified", "if", "it", "already", "contains", "the", "object", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java#L323-L369
35,334
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java
ArraySet.remove
@Override public boolean remove(Object object) { int index = object == null ? indexOfNull() : indexOf(object, object.hashCode()); if (index >= 0) { removeAt(index); return true; } return false; }
java
@Override public boolean remove(Object object) { int index = object == null ? indexOfNull() : indexOf(object, object.hashCode()); if (index >= 0) { removeAt(index); return true; } return false; }
[ "@", "Override", "public", "boolean", "remove", "(", "Object", "object", ")", "{", "int", "index", "=", "object", "==", "null", "?", "indexOfNull", "(", ")", ":", "indexOf", "(", "object", ",", "object", ".", "hashCode", "(", ")", ")", ";", "if", "("...
Removes the specified object from this set. @param object the object to remove. @return {@code true} if this set was modified, {@code false} otherwise.
[ "Removes", "the", "specified", "object", "from", "this", "set", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArraySet.java#L397-L405
35,335
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.format
public final StringBuffer format(Object obj, StringBuffer appendTo, FieldPosition fieldPosition) { if ( obj instanceof DateInterval ) { return format( (DateInterval)obj, appendTo, fieldPosition); } else { throw new IllegalArgumentException("Cannot format given Object (" + obj.getClass().getName() + ") as a DateInterval"); } }
java
public final StringBuffer format(Object obj, StringBuffer appendTo, FieldPosition fieldPosition) { if ( obj instanceof DateInterval ) { return format( (DateInterval)obj, appendTo, fieldPosition); } else { throw new IllegalArgumentException("Cannot format given Object (" + obj.getClass().getName() + ") as a DateInterval"); } }
[ "public", "final", "StringBuffer", "format", "(", "Object", "obj", ",", "StringBuffer", "appendTo", ",", "FieldPosition", "fieldPosition", ")", "{", "if", "(", "obj", "instanceof", "DateInterval", ")", "{", "return", "format", "(", "(", "DateInterval", ")", "o...
Format an object to produce a string. This method handles Formattable objects with a DateInterval type. If a the Formattable object type is not a DateInterval, IllegalArgumentException is thrown. @param obj The object to format. Must be a DateInterval. @param appendTo Output parameter to receive result. Result is appended to existing contents. @param fieldPosition On input: an alignment field, if desired. On output: the offsets of the alignment field. There may be multiple instances of a given field type in an interval format; in this case the fieldPosition offsets refer to the first instance. @return Reference to 'appendTo' parameter. @throws IllegalArgumentException if the formatted object is not DateInterval object
[ "Format", "an", "object", "to", "produce", "a", "string", ".", "This", "method", "handles", "Formattable", "objects", "with", "a", "DateInterval", "type", ".", "If", "a", "the", "Formattable", "object", "type", "is", "not", "a", "DateInterval", "IllegalArgumen...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L603-L612
35,336
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.format
public final synchronized StringBuffer format(DateInterval dtInterval, StringBuffer appendTo, FieldPosition fieldPosition) { fFromCalendar.setTimeInMillis(dtInterval.getFromDate()); fToCalendar.setTimeInMillis(dtInterval.getToDate()); return format(fFromCalendar, fToCalendar, appendTo, fieldPosition); }
java
public final synchronized StringBuffer format(DateInterval dtInterval, StringBuffer appendTo, FieldPosition fieldPosition) { fFromCalendar.setTimeInMillis(dtInterval.getFromDate()); fToCalendar.setTimeInMillis(dtInterval.getToDate()); return format(fFromCalendar, fToCalendar, appendTo, fieldPosition); }
[ "public", "final", "synchronized", "StringBuffer", "format", "(", "DateInterval", "dtInterval", ",", "StringBuffer", "appendTo", ",", "FieldPosition", "fieldPosition", ")", "{", "fFromCalendar", ".", "setTimeInMillis", "(", "dtInterval", ".", "getFromDate", "(", ")", ...
Format a DateInterval to produce a string. @param dtInterval DateInterval to be formatted. @param appendTo Output parameter to receive result. Result is appended to existing contents. @param fieldPosition On input: an alignment field, if desired. On output: the offsets of the alignment field. There may be multiple instances of a given field type in an interval format; in this case the fieldPosition offsets refer to the first instance. @return Reference to 'appendTo' parameter.
[ "Format", "a", "DateInterval", "to", "produce", "a", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L627-L634
35,337
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.setDateIntervalInfo
public void setDateIntervalInfo(DateIntervalInfo newItvPattern) { // clone it. If it is frozen, the clone returns itself. // Otherwise, clone returns a copy fInfo = (DateIntervalInfo)newItvPattern.clone(); this.isDateIntervalInfoDefault = false; fInfo.freeze(); // freeze it if ( fDateFormat != null ) { initializePattern(null); } }
java
public void setDateIntervalInfo(DateIntervalInfo newItvPattern) { // clone it. If it is frozen, the clone returns itself. // Otherwise, clone returns a copy fInfo = (DateIntervalInfo)newItvPattern.clone(); this.isDateIntervalInfoDefault = false; fInfo.freeze(); // freeze it if ( fDateFormat != null ) { initializePattern(null); } }
[ "public", "void", "setDateIntervalInfo", "(", "DateIntervalInfo", "newItvPattern", ")", "{", "// clone it. If it is frozen, the clone returns itself.", "// Otherwise, clone returns a copy", "fInfo", "=", "(", "DateIntervalInfo", ")", "newItvPattern", ".", "clone", "(", ")", "...
Set the date time interval patterns. @param newItvPattern the given interval patterns to copy.
[ "Set", "the", "date", "time", "interval", "patterns", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L958-L968
35,338
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getTimeZone
public TimeZone getTimeZone() { if ( fDateFormat != null ) { // Here we clone, like other getters here, but unlike // DateFormat.getTimeZone() and Calendar.getTimeZone() // which return the TimeZone from the Calendar's zone variable return (TimeZone)(fDateFormat.getTimeZone().clone()); } // If fDateFormat is null (unexpected), return default timezone. return TimeZone.getDefault(); }
java
public TimeZone getTimeZone() { if ( fDateFormat != null ) { // Here we clone, like other getters here, but unlike // DateFormat.getTimeZone() and Calendar.getTimeZone() // which return the TimeZone from the Calendar's zone variable return (TimeZone)(fDateFormat.getTimeZone().clone()); } // If fDateFormat is null (unexpected), return default timezone. return TimeZone.getDefault(); }
[ "public", "TimeZone", "getTimeZone", "(", ")", "{", "if", "(", "fDateFormat", "!=", "null", ")", "{", "// Here we clone, like other getters here, but unlike", "// DateFormat.getTimeZone() and Calendar.getTimeZone()", "// which return the TimeZone from the Calendar's zone variable", "...
Get the TimeZone @return A copy of the TimeZone associated with this date interval formatter.
[ "Get", "the", "TimeZone" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L974-L984
35,339
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.setTimeZone
public void setTimeZone(TimeZone zone) { // zone is cloned once for all three usages below: TimeZone zoneToSet = (TimeZone)zone.clone(); if (fDateFormat != null) { fDateFormat.setTimeZone(zoneToSet); } // fDateFormat has the master calendar for the DateIntervalFormat; // fFromCalendar and fToCalendar are internal work clones of that calendar. if (fFromCalendar != null) { fFromCalendar.setTimeZone(zoneToSet); } if (fToCalendar != null) { fToCalendar.setTimeZone(zoneToSet); } }
java
public void setTimeZone(TimeZone zone) { // zone is cloned once for all three usages below: TimeZone zoneToSet = (TimeZone)zone.clone(); if (fDateFormat != null) { fDateFormat.setTimeZone(zoneToSet); } // fDateFormat has the master calendar for the DateIntervalFormat; // fFromCalendar and fToCalendar are internal work clones of that calendar. if (fFromCalendar != null) { fFromCalendar.setTimeZone(zoneToSet); } if (fToCalendar != null) { fToCalendar.setTimeZone(zoneToSet); } }
[ "public", "void", "setTimeZone", "(", "TimeZone", "zone", ")", "{", "// zone is cloned once for all three usages below:", "TimeZone", "zoneToSet", "=", "(", "TimeZone", ")", "zone", ".", "clone", "(", ")", ";", "if", "(", "fDateFormat", "!=", "null", ")", "{", ...
Set the TimeZone for the calendar used by this DateIntervalFormat object. @param zone The new TimeZone, will be cloned for use by this DateIntervalFormat.
[ "Set", "the", "TimeZone", "for", "the", "calendar", "used", "by", "this", "DateIntervalFormat", "object", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L991-L1006
35,340
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java
DateIntervalFormat.getConcatenationPattern
private String getConcatenationPattern(ULocale locale) { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); ICUResourceBundle dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns"); ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(8); if (concatenationPatternRb.getType() == UResourceBundle.STRING) { return concatenationPatternRb.getString(); } else { return concatenationPatternRb.getString(0); } }
java
private String getConcatenationPattern(ULocale locale) { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); ICUResourceBundle dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns"); ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(8); if (concatenationPatternRb.getType() == UResourceBundle.STRING) { return concatenationPatternRb.getString(); } else { return concatenationPatternRb.getString(0); } }
[ "private", "String", "getConcatenationPattern", "(", "ULocale", "locale", ")", "{", "ICUResourceBundle", "rb", "=", "(", "ICUResourceBundle", ")", "UResourceBundle", ".", "getBundleInstance", "(", "ICUData", ".", "ICU_BASE_NAME", ",", "locale", ")", ";", "ICUResourc...
Retrieves the concatenation DateTime pattern from the resource bundle. @param locale Locale to retrieve. @return Concatenation DateTime pattern.
[ "Retrieves", "the", "concatenation", "DateTime", "pattern", "from", "the", "resource", "bundle", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalFormat.java#L1259-L1268
35,341
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SortedSetRelation.java
SortedSetRelation.hasRelation
public static <T extends Object & Comparable<? super T>> boolean hasRelation(SortedSet<T> a, int allow, SortedSet<T> b) { if (allow < NONE || allow > ANY) { throw new IllegalArgumentException("Relation " + allow + " out of range"); } // extract filter conditions // these are the ALLOWED conditions Set boolean anb = (allow & A_NOT_B) != 0; boolean ab = (allow & A_AND_B) != 0; boolean bna = (allow & B_NOT_A) != 0; // quick check on sizes switch(allow) { case CONTAINS: if (a.size() < b.size()) return false; break; case ISCONTAINED: if (a.size() > b.size()) return false; break; case EQUALS: if (a.size() != b.size()) return false; break; } // check for null sets if (a.size() == 0) { if (b.size() == 0) return true; return bna; } else if (b.size() == 0) { return anb; } // pick up first strings, and start comparing Iterator<? extends T> ait = a.iterator(); Iterator<? extends T> bit = b.iterator(); T aa = ait.next(); T bb = bit.next(); while (true) { int comp = aa.compareTo(bb); if (comp == 0) { if (!ab) return false; if (!ait.hasNext()) { if (!bit.hasNext()) return true; return bna; } else if (!bit.hasNext()) { return anb; } aa = ait.next(); bb = bit.next(); } else if (comp < 0) { if (!anb) return false; if (!ait.hasNext()) { return bna; } aa = ait.next(); } else { if (!bna) return false; if (!bit.hasNext()) { return anb; } bb = bit.next(); } } }
java
public static <T extends Object & Comparable<? super T>> boolean hasRelation(SortedSet<T> a, int allow, SortedSet<T> b) { if (allow < NONE || allow > ANY) { throw new IllegalArgumentException("Relation " + allow + " out of range"); } // extract filter conditions // these are the ALLOWED conditions Set boolean anb = (allow & A_NOT_B) != 0; boolean ab = (allow & A_AND_B) != 0; boolean bna = (allow & B_NOT_A) != 0; // quick check on sizes switch(allow) { case CONTAINS: if (a.size() < b.size()) return false; break; case ISCONTAINED: if (a.size() > b.size()) return false; break; case EQUALS: if (a.size() != b.size()) return false; break; } // check for null sets if (a.size() == 0) { if (b.size() == 0) return true; return bna; } else if (b.size() == 0) { return anb; } // pick up first strings, and start comparing Iterator<? extends T> ait = a.iterator(); Iterator<? extends T> bit = b.iterator(); T aa = ait.next(); T bb = bit.next(); while (true) { int comp = aa.compareTo(bb); if (comp == 0) { if (!ab) return false; if (!ait.hasNext()) { if (!bit.hasNext()) return true; return bna; } else if (!bit.hasNext()) { return anb; } aa = ait.next(); bb = bit.next(); } else if (comp < 0) { if (!anb) return false; if (!ait.hasNext()) { return bna; } aa = ait.next(); } else { if (!bna) return false; if (!bit.hasNext()) { return anb; } bb = bit.next(); } } }
[ "public", "static", "<", "T", "extends", "Object", "&", "Comparable", "<", "?", "super", "T", ">", ">", "boolean", "hasRelation", "(", "SortedSet", "<", "T", ">", "a", ",", "int", "allow", ",", "SortedSet", "<", "T", ">", "b", ")", "{", "if", "(", ...
Utility that could be on SortedSet. Faster implementation than what is in Java for doing contains, equals, etc. @param a first set @param allow filter, using ANY, CONTAINS, etc. @param b second set @return whether the filter relationship is true or not.
[ "Utility", "that", "could", "be", "on", "SortedSet", ".", "Faster", "implementation", "than", "what", "is", "in", "Java", "for", "doing", "contains", "equals", "etc", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SortedSetRelation.java#L74-L134
35,342
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.internalNextLong
final long internalNextLong(long origin, long bound) { long r = mix64(nextSeed()); if (origin < bound) { long n = bound - origin, m = n - 1; if ((n & m) == 0L) // power of two r = (r & m) + origin; else if (n > 0L) { // reject over-represented candidates for (long u = r >>> 1; // ensure nonnegative u + m - (r = u % n) < 0L; // rejection check u = mix64(nextSeed()) >>> 1) // retry ; r += origin; } else { // range not representable as long while (r < origin || r >= bound) r = mix64(nextSeed()); } } return r; }
java
final long internalNextLong(long origin, long bound) { long r = mix64(nextSeed()); if (origin < bound) { long n = bound - origin, m = n - 1; if ((n & m) == 0L) // power of two r = (r & m) + origin; else if (n > 0L) { // reject over-represented candidates for (long u = r >>> 1; // ensure nonnegative u + m - (r = u % n) < 0L; // rejection check u = mix64(nextSeed()) >>> 1) // retry ; r += origin; } else { // range not representable as long while (r < origin || r >= bound) r = mix64(nextSeed()); } } return r; }
[ "final", "long", "internalNextLong", "(", "long", "origin", ",", "long", "bound", ")", "{", "long", "r", "=", "mix64", "(", "nextSeed", "(", ")", ")", ";", "if", "(", "origin", "<", "bound", ")", "{", "long", "n", "=", "bound", "-", "origin", ",", ...
The form of nextLong used by LongStream Spliterators. If origin is greater than bound, acts as unbounded form of nextLong, else as bounded form. @param origin the least value, unless greater than bound @param bound the upper bound (exclusive), must not equal origin @return a pseudorandom value
[ "The", "form", "of", "nextLong", "used", "by", "LongStream", "Spliterators", ".", "If", "origin", "is", "greater", "than", "bound", "acts", "as", "unbounded", "form", "of", "nextLong", "else", "as", "bounded", "form", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L210-L229
35,343
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.internalNextInt
final int internalNextInt(int origin, int bound) { int r = mix32(nextSeed()); if (origin < bound) { int n = bound - origin, m = n - 1; if ((n & m) == 0) r = (r & m) + origin; else if (n > 0) { for (int u = r >>> 1; u + m - (r = u % n) < 0; u = mix32(nextSeed()) >>> 1) ; r += origin; } else { while (r < origin || r >= bound) r = mix32(nextSeed()); } } return r; }
java
final int internalNextInt(int origin, int bound) { int r = mix32(nextSeed()); if (origin < bound) { int n = bound - origin, m = n - 1; if ((n & m) == 0) r = (r & m) + origin; else if (n > 0) { for (int u = r >>> 1; u + m - (r = u % n) < 0; u = mix32(nextSeed()) >>> 1) ; r += origin; } else { while (r < origin || r >= bound) r = mix32(nextSeed()); } } return r; }
[ "final", "int", "internalNextInt", "(", "int", "origin", ",", "int", "bound", ")", "{", "int", "r", "=", "mix32", "(", "nextSeed", "(", ")", ")", ";", "if", "(", "origin", "<", "bound", ")", "{", "int", "n", "=", "bound", "-", "origin", ",", "m",...
The form of nextInt used by IntStream Spliterators. Exactly the same as long version, except for types. @param origin the least value, unless greater than bound @param bound the upper bound (exclusive), must not equal origin @return a pseudorandom value
[ "The", "form", "of", "nextInt", "used", "by", "IntStream", "Spliterators", ".", "Exactly", "the", "same", "as", "long", "version", "except", "for", "types", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L239-L258
35,344
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.internalNextDouble
final double internalNextDouble(double origin, double bound) { double r = (nextLong() >>> 11) * DOUBLE_UNIT; if (origin < bound) { r = r * (bound - origin) + origin; if (r >= bound) // correct for rounding r = Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1); } return r; }
java
final double internalNextDouble(double origin, double bound) { double r = (nextLong() >>> 11) * DOUBLE_UNIT; if (origin < bound) { r = r * (bound - origin) + origin; if (r >= bound) // correct for rounding r = Double.longBitsToDouble(Double.doubleToLongBits(bound) - 1); } return r; }
[ "final", "double", "internalNextDouble", "(", "double", "origin", ",", "double", "bound", ")", "{", "double", "r", "=", "(", "nextLong", "(", ")", ">>>", "11", ")", "*", "DOUBLE_UNIT", ";", "if", "(", "origin", "<", "bound", ")", "{", "r", "=", "r", ...
The form of nextDouble used by DoubleStream Spliterators. @param origin the least value, unless greater than bound @param bound the upper bound (exclusive), must not equal origin @return a pseudorandom value
[ "The", "form", "of", "nextDouble", "used", "by", "DoubleStream", "Spliterators", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L267-L275
35,345
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getInstance
public static Currency getInstance(ULocale locale) { String currency = locale.getKeywordValue("currency"); if (currency != null) { return getInstance(currency); } if (shim == null) { return createCurrency(locale); } return shim.createInstance(locale); }
java
public static Currency getInstance(ULocale locale) { String currency = locale.getKeywordValue("currency"); if (currency != null) { return getInstance(currency); } if (shim == null) { return createCurrency(locale); } return shim.createInstance(locale); }
[ "public", "static", "Currency", "getInstance", "(", "ULocale", "locale", ")", "{", "String", "currency", "=", "locale", ".", "getKeywordValue", "(", "\"currency\"", ")", ";", "if", "(", "currency", "!=", "null", ")", "{", "return", "getInstance", "(", "curre...
Returns a currency object for the default currency in the given locale.
[ "Returns", "a", "currency", "object", "for", "the", "default", "currency", "in", "the", "given", "locale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L157-L168
35,346
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getAvailableCurrencyCodes
public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) { String region = ULocale.getRegionForSupplementalData(loc, false); CurrencyFilter filter = CurrencyFilter.onDate(d).withRegion(region); List<String> list = getTenderCurrencies(filter); // Note: Prior to 4.4 the spec didn't say that we return null if there are no results, but // the test assumed it did. Kept the behavior and amended the spec. if (list.isEmpty()) { return null; } return list.toArray(new String[list.size()]); }
java
public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) { String region = ULocale.getRegionForSupplementalData(loc, false); CurrencyFilter filter = CurrencyFilter.onDate(d).withRegion(region); List<String> list = getTenderCurrencies(filter); // Note: Prior to 4.4 the spec didn't say that we return null if there are no results, but // the test assumed it did. Kept the behavior and amended the spec. if (list.isEmpty()) { return null; } return list.toArray(new String[list.size()]); }
[ "public", "static", "String", "[", "]", "getAvailableCurrencyCodes", "(", "ULocale", "loc", ",", "Date", "d", ")", "{", "String", "region", "=", "ULocale", ".", "getRegionForSupplementalData", "(", "loc", ",", "false", ")", ";", "CurrencyFilter", "filter", "="...
Returns an array of Strings which contain the currency identifiers that are valid for the given locale on the given date. If there are no such identifiers, returns null. Returned identifiers are in preference order. @param loc the locale for which to retrieve currency codes. @param d the date for which to retrieve currency codes for the given locale. @return The array of ISO currency codes.
[ "Returns", "an", "array", "of", "Strings", "which", "contain", "the", "currency", "identifiers", "that", "are", "valid", "for", "the", "given", "locale", "on", "the", "given", "date", ".", "If", "there", "are", "no", "such", "identifiers", "returns", "null",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L179-L189
35,347
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getAvailableCurrencies
public static Set<Currency> getAvailableCurrencies() { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); List<String> list = info.currencies(CurrencyFilter.all()); HashSet<Currency> resultSet = new HashSet<Currency>(list.size()); for (String code : list) { resultSet.add(getInstance(code)); } return resultSet; }
java
public static Set<Currency> getAvailableCurrencies() { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); List<String> list = info.currencies(CurrencyFilter.all()); HashSet<Currency> resultSet = new HashSet<Currency>(list.size()); for (String code : list) { resultSet.add(getInstance(code)); } return resultSet; }
[ "public", "static", "Set", "<", "Currency", ">", "getAvailableCurrencies", "(", ")", "{", "CurrencyMetaInfo", "info", "=", "CurrencyMetaInfo", ".", "getInstance", "(", ")", ";", "List", "<", "String", ">", "list", "=", "info", ".", "currencies", "(", "Curren...
Returns the set of available currencies. The returned set of currencies contains all of the available currencies, including obsolete ones. The result set can be modified without affecting the available currencies in the runtime. @return The set of available currencies. The returned set could be empty if there is no currency data available.
[ "Returns", "the", "set", "of", "available", "currencies", ".", "The", "returned", "set", "of", "currencies", "contains", "all", "of", "the", "available", "currencies", "including", "obsolete", "ones", ".", "The", "result", "set", "can", "be", "modified", "with...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L212-L220
35,348
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getInstance
public static Currency getInstance(String theISOCode) { if (theISOCode == null) { throw new NullPointerException("The input currency code is null."); } if (!isAlpha3Code(theISOCode)) { throw new IllegalArgumentException( "The input currency code is not 3-letter alphabetic code."); } return (Currency) MeasureUnit.internalGetInstance("currency", theISOCode.toUpperCase(Locale.ENGLISH)); }
java
public static Currency getInstance(String theISOCode) { if (theISOCode == null) { throw new NullPointerException("The input currency code is null."); } if (!isAlpha3Code(theISOCode)) { throw new IllegalArgumentException( "The input currency code is not 3-letter alphabetic code."); } return (Currency) MeasureUnit.internalGetInstance("currency", theISOCode.toUpperCase(Locale.ENGLISH)); }
[ "public", "static", "Currency", "getInstance", "(", "String", "theISOCode", ")", "{", "if", "(", "theISOCode", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"The input currency code is null.\"", ")", ";", "}", "if", "(", "!", "isAlpha3Co...
Returns a currency object given an ISO 4217 3-letter code. @param theISOCode the iso code @return the currency for this iso code @throws NullPointerException if <code>theISOCode</code> is null. @throws IllegalArgumentException if <code>theISOCode</code> is not a 3-letter alpha code.
[ "Returns", "a", "currency", "object", "given", "an", "ISO", "4217", "3", "-", "letter", "code", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L282-L291
35,349
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.registerInstance
public static Object registerInstance(Currency currency, ULocale locale) { return getShim().registerInstance(currency, locale); }
java
public static Object registerInstance(Currency currency, ULocale locale) { return getShim().registerInstance(currency, locale); }
[ "public", "static", "Object", "registerInstance", "(", "Currency", "currency", ",", "ULocale", "locale", ")", "{", "return", "getShim", "(", ")", ".", "registerInstance", "(", "currency", ",", "locale", ")", ";", "}" ]
Registers a new currency for the provided locale. The returned object is a key that can be used to unregister this currency object. <p>Because ICU may choose to cache Currency objects internally, this must be called at application startup, prior to any calls to Currency.getInstance to avoid undefined behavior. @param currency the currency to register @param locale the ulocale under which to register the currency @return a registry key that can be used to unregister this currency @see #unregister @hide unsupported on Android
[ "Registers", "a", "new", "currency", "for", "the", "provided", "locale", ".", "The", "returned", "object", "is", "a", "key", "that", "can", "be", "used", "to", "unregister", "this", "currency", "object", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L322-L324
35,350
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.parse
@Deprecated public static String parse(ULocale locale, String text, int type, ParsePosition pos) { List<TextTrieMap<CurrencyStringInfo>> currencyTrieVec = CURRENCY_NAME_CACHE.get(locale); if (currencyTrieVec == null) { TextTrieMap<CurrencyStringInfo> currencyNameTrie = new TextTrieMap<CurrencyStringInfo>(true); TextTrieMap<CurrencyStringInfo> currencySymbolTrie = new TextTrieMap<CurrencyStringInfo>(false); currencyTrieVec = new ArrayList<TextTrieMap<CurrencyStringInfo>>(); currencyTrieVec.add(currencySymbolTrie); currencyTrieVec.add(currencyNameTrie); setupCurrencyTrieVec(locale, currencyTrieVec); CURRENCY_NAME_CACHE.put(locale, currencyTrieVec); } int maxLength = 0; String isoResult = null; // look for the names TextTrieMap<CurrencyStringInfo> currencyNameTrie = currencyTrieVec.get(1); CurrencyNameResultHandler handler = new CurrencyNameResultHandler(); currencyNameTrie.find(text, pos.getIndex(), handler); isoResult = handler.getBestCurrencyISOCode(); maxLength = handler.getBestMatchLength(); if (type != Currency.LONG_NAME) { // not long name only TextTrieMap<CurrencyStringInfo> currencySymbolTrie = currencyTrieVec.get(0); handler = new CurrencyNameResultHandler(); currencySymbolTrie.find(text, pos.getIndex(), handler); if (handler.getBestMatchLength() > maxLength) { isoResult = handler.getBestCurrencyISOCode(); maxLength = handler.getBestMatchLength(); } } int start = pos.getIndex(); pos.setIndex(start + maxLength); return isoResult; }
java
@Deprecated public static String parse(ULocale locale, String text, int type, ParsePosition pos) { List<TextTrieMap<CurrencyStringInfo>> currencyTrieVec = CURRENCY_NAME_CACHE.get(locale); if (currencyTrieVec == null) { TextTrieMap<CurrencyStringInfo> currencyNameTrie = new TextTrieMap<CurrencyStringInfo>(true); TextTrieMap<CurrencyStringInfo> currencySymbolTrie = new TextTrieMap<CurrencyStringInfo>(false); currencyTrieVec = new ArrayList<TextTrieMap<CurrencyStringInfo>>(); currencyTrieVec.add(currencySymbolTrie); currencyTrieVec.add(currencyNameTrie); setupCurrencyTrieVec(locale, currencyTrieVec); CURRENCY_NAME_CACHE.put(locale, currencyTrieVec); } int maxLength = 0; String isoResult = null; // look for the names TextTrieMap<CurrencyStringInfo> currencyNameTrie = currencyTrieVec.get(1); CurrencyNameResultHandler handler = new CurrencyNameResultHandler(); currencyNameTrie.find(text, pos.getIndex(), handler); isoResult = handler.getBestCurrencyISOCode(); maxLength = handler.getBestMatchLength(); if (type != Currency.LONG_NAME) { // not long name only TextTrieMap<CurrencyStringInfo> currencySymbolTrie = currencyTrieVec.get(0); handler = new CurrencyNameResultHandler(); currencySymbolTrie.find(text, pos.getIndex(), handler); if (handler.getBestMatchLength() > maxLength) { isoResult = handler.getBestCurrencyISOCode(); maxLength = handler.getBestMatchLength(); } } int start = pos.getIndex(); pos.setIndex(start + maxLength); return isoResult; }
[ "@", "Deprecated", "public", "static", "String", "parse", "(", "ULocale", "locale", ",", "String", "text", ",", "int", "type", ",", "ParsePosition", "pos", ")", "{", "List", "<", "TextTrieMap", "<", "CurrencyStringInfo", ">>", "currencyTrieVec", "=", "CURRENCY...
Attempt to parse the given string as a currency, either as a display name in the given locale, or as a 3-letter ISO 4217 code. If multiple display names match, then the longest one is selected. If both a display name and a 3-letter ISO code match, then the display name is preferred, unless it's length is less than 3. @param locale the locale of the display names to match @param text the text to parse @param type parse against currency type: LONG_NAME only or not @param pos input-output position; on input, the position within text to match; must have 0 &lt;= pos.getIndex() &lt; text.length(); on output, the position after the last matched character. If the parse fails, the position in unchanged upon output. @return the ISO 4217 code, as a string, of the best match, or null if there is no match @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Attempt", "to", "parse", "the", "given", "string", "as", "a", "currency", "either", "as", "a", "display", "name", "in", "the", "given", "locale", "or", "as", "a", "3", "-", "letter", "ISO", "4217", "code", ".", "If", "multiple", "display", "names", "m...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L649-L686
35,351
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getDefaultFractionDigits
public int getDefaultFractionDigits(CurrencyUsage Usage) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); CurrencyDigits digits = info.currencyDigits(subType, Usage); return digits.fractionDigits; }
java
public int getDefaultFractionDigits(CurrencyUsage Usage) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); CurrencyDigits digits = info.currencyDigits(subType, Usage); return digits.fractionDigits; }
[ "public", "int", "getDefaultFractionDigits", "(", "CurrencyUsage", "Usage", ")", "{", "CurrencyMetaInfo", "info", "=", "CurrencyMetaInfo", ".", "getInstance", "(", ")", ";", "CurrencyDigits", "digits", "=", "info", ".", "currencyDigits", "(", "subType", ",", "Usag...
Returns the number of the number of fraction digits that should be displayed for this currency with Usage. @param Usage the usage of currency(Standard or Cash) @return a non-negative number of fraction digits to be displayed
[ "Returns", "the", "number", "of", "the", "number", "of", "fraction", "digits", "that", "should", "be", "displayed", "for", "this", "currency", "with", "Usage", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L778-L782
35,352
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getRoundingIncrement
public double getRoundingIncrement(CurrencyUsage Usage) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); CurrencyDigits digits = info.currencyDigits(subType, Usage); int data1 = digits.roundingIncrement; // If there is no rounding return 0.0 to indicate no rounding. // This is the high-runner case, by far. if (data1 == 0) { return 0.0; } int data0 = digits.fractionDigits; // If the meta data is invalid, return 0.0 to indicate no rounding. if (data0 < 0 || data0 >= POW10.length) { return 0.0; } // Return data[1] / 10^(data[0]). The only actual rounding data, // as of this writing, is CHF { 2, 25 }. return (double) data1 / POW10[data0]; }
java
public double getRoundingIncrement(CurrencyUsage Usage) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); CurrencyDigits digits = info.currencyDigits(subType, Usage); int data1 = digits.roundingIncrement; // If there is no rounding return 0.0 to indicate no rounding. // This is the high-runner case, by far. if (data1 == 0) { return 0.0; } int data0 = digits.fractionDigits; // If the meta data is invalid, return 0.0 to indicate no rounding. if (data0 < 0 || data0 >= POW10.length) { return 0.0; } // Return data[1] / 10^(data[0]). The only actual rounding data, // as of this writing, is CHF { 2, 25 }. return (double) data1 / POW10[data0]; }
[ "public", "double", "getRoundingIncrement", "(", "CurrencyUsage", "Usage", ")", "{", "CurrencyMetaInfo", "info", "=", "CurrencyMetaInfo", ".", "getInstance", "(", ")", ";", "CurrencyDigits", "digits", "=", "info", ".", "currencyDigits", "(", "subType", ",", "Usage...
Returns the rounding increment for this currency, or 0.0 if no rounding is done by this currency with the Usage. @param Usage the usage of currency(Standard or Cash) @return the non-negative rounding increment, or 0.0 if none
[ "Returns", "the", "rounding", "increment", "for", "this", "currency", "or", "0", ".", "0", "if", "no", "rounding", "is", "done", "by", "this", "currency", "with", "the", "Usage", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L800-L822
35,353
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getTenderCurrencies
private static List<String> getTenderCurrencies(CurrencyFilter filter) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); return info.currencies(filter.withTender()); }
java
private static List<String> getTenderCurrencies(CurrencyFilter filter) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); return info.currencies(filter.withTender()); }
[ "private", "static", "List", "<", "String", ">", "getTenderCurrencies", "(", "CurrencyFilter", "filter", ")", "{", "CurrencyMetaInfo", "info", "=", "CurrencyMetaInfo", ".", "getInstance", "(", ")", ";", "return", "info", ".", "currencies", "(", "filter", ".", ...
Returns the list of remaining tender currencies after a filter is applied. @param filter the filter to apply to the tender currencies @return a list of tender currencies
[ "Returns", "the", "list", "of", "remaining", "tender", "currencies", "after", "a", "filter", "is", "applied", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L928-L931
35,354
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExpressionVisitor.java
ExpressionVisitor.visitFunction
public boolean visitFunction(ExpressionOwner owner, Function func) { if (func instanceof FuncExtFunction) { String namespace = ((FuncExtFunction)func).getNamespace(); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } else if (func instanceof FuncExtFunctionAvailable) { String arg = ((FuncExtFunctionAvailable)func).getArg0().toString(); if (arg.indexOf(":") > 0) { String prefix = arg.substring(0,arg.indexOf(":")); String namespace = this.m_sroot.getNamespaceForPrefix(prefix); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } } return true; }
java
public boolean visitFunction(ExpressionOwner owner, Function func) { if (func instanceof FuncExtFunction) { String namespace = ((FuncExtFunction)func).getNamespace(); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } else if (func instanceof FuncExtFunctionAvailable) { String arg = ((FuncExtFunctionAvailable)func).getArg0().toString(); if (arg.indexOf(":") > 0) { String prefix = arg.substring(0,arg.indexOf(":")); String namespace = this.m_sroot.getNamespaceForPrefix(prefix); m_sroot.getExtensionNamespacesManager().registerExtension(namespace); } } return true; }
[ "public", "boolean", "visitFunction", "(", "ExpressionOwner", "owner", ",", "Function", "func", ")", "{", "if", "(", "func", "instanceof", "FuncExtFunction", ")", "{", "String", "namespace", "=", "(", "(", "FuncExtFunction", ")", "func", ")", ".", "getNamespac...
If the function is an extension function, register the namespace. @param owner The current XPath object that owns the expression. @param func The function currently being visited. @return true to continue the visit in the subtree, if any.
[ "If", "the", "function", "is", "an", "extension", "function", "register", "the", "namespace", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExpressionVisitor.java#L62-L80
35,355
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ManifestDigester.java
ManifestDigester.findSection
@SuppressWarnings("fallthrough") private boolean findSection(int offset, Position pos) { int i = offset, len = rawBytes.length; int last = offset; int next; boolean allBlank = true; pos.endOfFirstLine = -1; while (i < len) { byte b = rawBytes[i]; switch(b) { case '\r': if (pos.endOfFirstLine == -1) pos.endOfFirstLine = i-1; if ((i < len) && (rawBytes[i+1] == '\n')) i++; /* fall through */ case '\n': if (pos.endOfFirstLine == -1) pos.endOfFirstLine = i-1; if (allBlank || (i == len-1)) { if (i == len-1) pos.endOfSection = i; else pos.endOfSection = last; pos.startOfNext = i+1; return true; } else { // start of a new line last = i; allBlank = true; } break; default: allBlank = false; break; } i++; } return false; }
java
@SuppressWarnings("fallthrough") private boolean findSection(int offset, Position pos) { int i = offset, len = rawBytes.length; int last = offset; int next; boolean allBlank = true; pos.endOfFirstLine = -1; while (i < len) { byte b = rawBytes[i]; switch(b) { case '\r': if (pos.endOfFirstLine == -1) pos.endOfFirstLine = i-1; if ((i < len) && (rawBytes[i+1] == '\n')) i++; /* fall through */ case '\n': if (pos.endOfFirstLine == -1) pos.endOfFirstLine = i-1; if (allBlank || (i == len-1)) { if (i == len-1) pos.endOfSection = i; else pos.endOfSection = last; pos.startOfNext = i+1; return true; } else { // start of a new line last = i; allBlank = true; } break; default: allBlank = false; break; } i++; } return false; }
[ "@", "SuppressWarnings", "(", "\"fallthrough\"", ")", "private", "boolean", "findSection", "(", "int", "offset", ",", "Position", "pos", ")", "{", "int", "i", "=", "offset", ",", "len", "=", "rawBytes", ".", "length", ";", "int", "last", "=", "offset", "...
find a section in the manifest. @param offset should point to the starting offset with in the raw bytes of the next section. @pos set by @returns false if end of bytes has been reached, otherwise returns true
[ "find", "a", "section", "in", "the", "manifest", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ManifestDigester.java#L65-L108
35,356
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java
CompactDecimalDataCache.get
DataBundle get(ULocale locale) { DataBundle result = cache.get(locale); if (result == null) { result = load(locale); cache.put(locale, result); } return result; }
java
DataBundle get(ULocale locale) { DataBundle result = cache.get(locale); if (result == null) { result = load(locale); cache.put(locale, result); } return result; }
[ "DataBundle", "get", "(", "ULocale", "locale", ")", "{", "DataBundle", "result", "=", "cache", ".", "get", "(", "locale", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "load", "(", "locale", ")", ";", "cache", ".", "put", "(...
Fetch data for a particular locale. Clients must not modify any part of the returned data. Portions of returned data may be shared so modifying it will have unpredictable results.
[ "Fetch", "data", "for", "a", "particular", "locale", ".", "Clients", "must", "not", "modify", "any", "part", "of", "the", "returned", "data", ".", "Portions", "of", "returned", "data", "may", "be", "shared", "so", "modifying", "it", "will", "have", "unpred...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L273-L280
35,357
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java
CompactDecimalDataCache.calculateDivisor
private static long calculateDivisor(long power10, int numZeros) { // We craft our divisor such that when we divide by it, we get a // number with the same number of digits as zeros found in the // plural variant templates. If our magnitude is 10000 and we have // two 0's in our plural variants, then we want a divisor of 1000. // Note that if we have 43560 which is of same magnitude as 10000. // When we divide by 1000 we a quotient which rounds to 44 (2 digits) long divisor = power10; for (int i = 1; i < numZeros; i++) { divisor /= 10; } return divisor; }
java
private static long calculateDivisor(long power10, int numZeros) { // We craft our divisor such that when we divide by it, we get a // number with the same number of digits as zeros found in the // plural variant templates. If our magnitude is 10000 and we have // two 0's in our plural variants, then we want a divisor of 1000. // Note that if we have 43560 which is of same magnitude as 10000. // When we divide by 1000 we a quotient which rounds to 44 (2 digits) long divisor = power10; for (int i = 1; i < numZeros; i++) { divisor /= 10; } return divisor; }
[ "private", "static", "long", "calculateDivisor", "(", "long", "power10", ",", "int", "numZeros", ")", "{", "// We craft our divisor such that when we divide by it, we get a", "// number with the same number of digits as zeros found in the", "// plural variant templates. If our magnitude ...
Calculate a divisor based on the magnitude and number of zeros in the template string. @param power10 @param numZeros @return
[ "Calculate", "a", "divisor", "based", "on", "the", "magnitude", "and", "number", "of", "zeros", "in", "the", "template", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L381-L393
35,358
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java
CompactDecimalDataCache.checkForOtherVariants
private static void checkForOtherVariants(Data data, ULocale locale, String style) { DecimalFormat.Unit[] otherByBase = data.units.get(OTHER); if (otherByBase == null) { throw new IllegalArgumentException("No 'other' plural variants defined in " + localeAndStyle(locale, style)); } // Check all other plural variants, and make sure that if any of them are populated, then // other is also populated for (Map.Entry<String, Unit[]> entry : data.units.entrySet()) { if (entry.getKey() == OTHER) continue; DecimalFormat.Unit[] variantByBase = entry.getValue(); for (int log10Value = 0; log10Value < MAX_DIGITS; log10Value++) { if (variantByBase[log10Value] != null && otherByBase[log10Value] == null) { throw new IllegalArgumentException( "No 'other' plural variant defined for 10^" + log10Value + " but a '" + entry.getKey() + "' variant is defined" + " in " +localeAndStyle(locale, style)); } } } }
java
private static void checkForOtherVariants(Data data, ULocale locale, String style) { DecimalFormat.Unit[] otherByBase = data.units.get(OTHER); if (otherByBase == null) { throw new IllegalArgumentException("No 'other' plural variants defined in " + localeAndStyle(locale, style)); } // Check all other plural variants, and make sure that if any of them are populated, then // other is also populated for (Map.Entry<String, Unit[]> entry : data.units.entrySet()) { if (entry.getKey() == OTHER) continue; DecimalFormat.Unit[] variantByBase = entry.getValue(); for (int log10Value = 0; log10Value < MAX_DIGITS; log10Value++) { if (variantByBase[log10Value] != null && otherByBase[log10Value] == null) { throw new IllegalArgumentException( "No 'other' plural variant defined for 10^" + log10Value + " but a '" + entry.getKey() + "' variant is defined" + " in " +localeAndStyle(locale, style)); } } } }
[ "private", "static", "void", "checkForOtherVariants", "(", "Data", "data", ",", "ULocale", "locale", ",", "String", "style", ")", "{", "DecimalFormat", ".", "Unit", "[", "]", "otherByBase", "=", "data", ".", "units", ".", "get", "(", "OTHER", ")", ";", "...
Checks to make sure that an "other" variant is present in all powers of 10. @param data
[ "Checks", "to", "make", "sure", "that", "an", "other", "variant", "is", "present", "in", "all", "powers", "of", "10", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L413-L435
35,359
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java
CompactDecimalDataCache.fillInMissing
private static void fillInMissing(Data result) { // Initially we assume that previous divisor is 1 with no prefix or suffix. long lastDivisor = 1L; for (int i = 0; i < result.divisors.length; i++) { if (result.units.get(OTHER)[i] == null) { result.divisors[i] = lastDivisor; copyFromPreviousIndex(i, result.units); } else { lastDivisor = result.divisors[i]; propagateOtherToMissing(i, result.units); } } }
java
private static void fillInMissing(Data result) { // Initially we assume that previous divisor is 1 with no prefix or suffix. long lastDivisor = 1L; for (int i = 0; i < result.divisors.length; i++) { if (result.units.get(OTHER)[i] == null) { result.divisors[i] = lastDivisor; copyFromPreviousIndex(i, result.units); } else { lastDivisor = result.divisors[i]; propagateOtherToMissing(i, result.units); } } }
[ "private", "static", "void", "fillInMissing", "(", "Data", "result", ")", "{", "// Initially we assume that previous divisor is 1 with no prefix or suffix.", "long", "lastDivisor", "=", "1L", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "di...
After reading information from resource bundle into a Data object, there is guarantee that it is complete. This method fixes any incomplete data it finds within <code>result</code>. It looks at each log10 value applying the two rules. <p> If no prefix is defined for the "other" variant, use the divisor, prefixes and suffixes for all defined variants from the previous log10. For log10 = 0, use all empty prefixes and suffixes and a divisor of 1. </p><p> Otherwise, examine each plural variant defined for the given log10 value. If it has no prefix and suffix for a particular variant, use the one from the "other" variant. </p> @param result this instance is fixed in-place.
[ "After", "reading", "information", "from", "resource", "bundle", "into", "a", "Data", "object", "there", "is", "guarantee", "that", "it", "is", "complete", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L455-L467
35,360
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java
CompactDecimalDataCache.getUnit
static DecimalFormat.Unit getUnit( Map<String, DecimalFormat.Unit[]> units, String variant, int base) { DecimalFormat.Unit[] byBase = units.get(variant); if (byBase == null) { byBase = units.get(CompactDecimalDataCache.OTHER); } return byBase[base]; }
java
static DecimalFormat.Unit getUnit( Map<String, DecimalFormat.Unit[]> units, String variant, int base) { DecimalFormat.Unit[] byBase = units.get(variant); if (byBase == null) { byBase = units.get(CompactDecimalDataCache.OTHER); } return byBase[base]; }
[ "static", "DecimalFormat", ".", "Unit", "getUnit", "(", "Map", "<", "String", ",", "DecimalFormat", ".", "Unit", "[", "]", ">", "units", ",", "String", "variant", ",", "int", "base", ")", "{", "DecimalFormat", ".", "Unit", "[", "]", "byBase", "=", "uni...
Fetches a prefix or suffix given a plural variant and log10 value. If it can't find the given variant, it falls back to "other". @param prefixOrSuffix the prefix or suffix map @param variant the plural variant @param base log10 value. 0 <= base < MAX_DIGITS. @return the prefix or suffix.
[ "Fetches", "a", "prefix", "or", "suffix", "given", "a", "plural", "variant", "and", "log10", "value", ".", "If", "it", "can", "t", "find", "the", "given", "variant", "it", "falls", "back", "to", "other", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalDataCache.java#L517-L524
35,361
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.lookupNamespace
public String lookupNamespace(String prefix) { String uri = null; final Stack stack = getPrefixStack(prefix); if (stack != null && !stack.isEmpty()) { uri = ((MappingRecord) stack.peek()).m_uri; } if (uri == null) uri = EMPTYSTRING; return uri; }
java
public String lookupNamespace(String prefix) { String uri = null; final Stack stack = getPrefixStack(prefix); if (stack != null && !stack.isEmpty()) { uri = ((MappingRecord) stack.peek()).m_uri; } if (uri == null) uri = EMPTYSTRING; return uri; }
[ "public", "String", "lookupNamespace", "(", "String", "prefix", ")", "{", "String", "uri", "=", "null", ";", "final", "Stack", "stack", "=", "getPrefixStack", "(", "prefix", ")", ";", "if", "(", "stack", "!=", "null", "&&", "!", "stack", ".", "isEmpty", ...
Use a namespace prefix to lookup a namespace URI. @param prefix String the prefix of the namespace @return the URI corresponding to the prefix, returns "" if there is no visible mapping.
[ "Use", "a", "namespace", "prefix", "to", "lookup", "a", "namespace", "URI", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L138-L148
35,362
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.lookupPrefix
public String lookupPrefix(String uri) { String foundPrefix = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefix = prefix; break; } } return foundPrefix; }
java
public String lookupPrefix(String uri) { String foundPrefix = null; Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefix = prefix; break; } } return foundPrefix; }
[ "public", "String", "lookupPrefix", "(", "String", "uri", ")", "{", "String", "foundPrefix", "=", "null", ";", "Enumeration", "prefixes", "=", "m_namespaces", ".", "keys", "(", ")", ";", "while", "(", "prefixes", ".", "hasMoreElements", "(", ")", ")", "{",...
Given a namespace uri, and the namespaces mappings for the current element, return the current prefix for that uri. @param uri the namespace URI to be search for @return an existing prefix that maps to the given URI, null if no prefix maps to the given namespace URI.
[ "Given", "a", "namespace", "uri", "and", "the", "namespaces", "mappings", "for", "the", "current", "element", "return", "the", "current", "prefix", "for", "that", "uri", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L165-L180
35,363
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.popNamespace
boolean popNamespace(String prefix) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; if ((stack = getPrefixStack(prefix)) != null) { stack.pop(); return true; } return false; }
java
boolean popNamespace(String prefix) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; if ((stack = getPrefixStack(prefix)) != null) { stack.pop(); return true; } return false; }
[ "boolean", "popNamespace", "(", "String", "prefix", ")", "{", "// Prefixes \"xml\" and \"xmlns\" cannot be redefined", "if", "(", "prefix", ".", "startsWith", "(", "XML_PREFIX", ")", ")", "{", "return", "false", ";", "}", "Stack", "stack", ";", "if", "(", "(", ...
Undeclare the namespace that is currently pointed to by a given prefix
[ "Undeclare", "the", "namespace", "that", "is", "currently", "pointed", "to", "by", "a", "given", "prefix" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L202-L217
35,364
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.pushNamespace
public boolean pushNamespace(String prefix, String uri, int elemDepth) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; // Get the stack that contains URIs for the specified prefix if ((stack = (Stack) m_namespaces.get(prefix)) == null) { m_namespaces.put(prefix, stack = new Stack()); } if (!stack.empty()) { MappingRecord mr = (MappingRecord)stack.peek(); if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth) { // If the same prefix/uri mapping is already on the stack // don't push this one. // Or if we have a mapping at the same depth // don't replace by pushing this one. return false; } } MappingRecord map = new MappingRecord(prefix,uri,elemDepth); stack.push(map); m_nodeStack.push(map); return true; }
java
public boolean pushNamespace(String prefix, String uri, int elemDepth) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; // Get the stack that contains URIs for the specified prefix if ((stack = (Stack) m_namespaces.get(prefix)) == null) { m_namespaces.put(prefix, stack = new Stack()); } if (!stack.empty()) { MappingRecord mr = (MappingRecord)stack.peek(); if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth) { // If the same prefix/uri mapping is already on the stack // don't push this one. // Or if we have a mapping at the same depth // don't replace by pushing this one. return false; } } MappingRecord map = new MappingRecord(prefix,uri,elemDepth); stack.push(map); m_nodeStack.push(map); return true; }
[ "public", "boolean", "pushNamespace", "(", "String", "prefix", ",", "String", "uri", ",", "int", "elemDepth", ")", "{", "// Prefixes \"xml\" and \"xmlns\" cannot be redefined", "if", "(", "prefix", ".", "startsWith", "(", "XML_PREFIX", ")", ")", "{", "return", "fa...
Declare a mapping of a prefix to namespace URI at the given element depth. @param prefix a String with the prefix for a qualified name @param uri a String with the uri to which the prefix is to map @param elemDepth the depth of current declaration
[ "Declare", "a", "mapping", "of", "a", "prefix", "to", "namespace", "URI", "at", "the", "given", "element", "depth", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L225-L255
35,365
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.popNamespaces
void popNamespaces(int elemDepth, ContentHandler saxHandler) { while (true) { if (m_nodeStack.isEmpty()) return; MappingRecord map = (MappingRecord) (m_nodeStack.peek()); int depth = map.m_declarationDepth; if (elemDepth < 1 || map.m_declarationDepth < elemDepth) break; /* the depth of the declared mapping is elemDepth or deeper * so get rid of it */ MappingRecord nm1 = (MappingRecord) m_nodeStack.pop(); // pop the node from the stack String prefix = map.m_prefix; Stack prefixStack = getPrefixStack(prefix); MappingRecord nm2 = (MappingRecord) prefixStack.peek(); if (nm1 == nm2) { // It would be nice to always pop() but we // need to check that the prefix stack still has // the node we want to get rid of. This is because // the optimization of essentially this situation: // <a xmlns:x="abc"><b xmlns:x="" xmlns:x="abc" /></a> // will remove both mappings in <b> because the // new mapping is the same as the masked one and we get // <a xmlns:x="abc"><b/></a> // So we are only removing xmlns:x="" or // xmlns:x="abc" from the depth of element <b> // when going back to <a> if in fact they have // not been optimized away. // prefixStack.pop(); if (saxHandler != null) { try { saxHandler.endPrefixMapping(prefix); } catch (SAXException e) { // not much we can do if they aren't willing to listen } } } } }
java
void popNamespaces(int elemDepth, ContentHandler saxHandler) { while (true) { if (m_nodeStack.isEmpty()) return; MappingRecord map = (MappingRecord) (m_nodeStack.peek()); int depth = map.m_declarationDepth; if (elemDepth < 1 || map.m_declarationDepth < elemDepth) break; /* the depth of the declared mapping is elemDepth or deeper * so get rid of it */ MappingRecord nm1 = (MappingRecord) m_nodeStack.pop(); // pop the node from the stack String prefix = map.m_prefix; Stack prefixStack = getPrefixStack(prefix); MappingRecord nm2 = (MappingRecord) prefixStack.peek(); if (nm1 == nm2) { // It would be nice to always pop() but we // need to check that the prefix stack still has // the node we want to get rid of. This is because // the optimization of essentially this situation: // <a xmlns:x="abc"><b xmlns:x="" xmlns:x="abc" /></a> // will remove both mappings in <b> because the // new mapping is the same as the masked one and we get // <a xmlns:x="abc"><b/></a> // So we are only removing xmlns:x="" or // xmlns:x="abc" from the depth of element <b> // when going back to <a> if in fact they have // not been optimized away. // prefixStack.pop(); if (saxHandler != null) { try { saxHandler.endPrefixMapping(prefix); } catch (SAXException e) { // not much we can do if they aren't willing to listen } } } } }
[ "void", "popNamespaces", "(", "int", "elemDepth", ",", "ContentHandler", "saxHandler", ")", "{", "while", "(", "true", ")", "{", "if", "(", "m_nodeStack", ".", "isEmpty", "(", ")", ")", "return", ";", "MappingRecord", "map", "=", "(", "MappingRecord", ")",...
Pop, or undeclare all namespace definitions that are currently declared at the given element depth, or deepter. @param elemDepth the element depth for which mappings declared at this depth or deeper will no longer be valid @param saxHandler The ContentHandler to notify of any endPrefixMapping() calls. This parameter can be null.
[ "Pop", "or", "undeclare", "all", "namespace", "definitions", "that", "are", "currently", "declared", "at", "the", "given", "element", "depth", "or", "deepter", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L265-L315
35,366
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.createPrefixStack
private Stack createPrefixStack(String prefix) { Stack fs = new Stack(); m_namespaces.put(prefix, fs); return fs; }
java
private Stack createPrefixStack(String prefix) { Stack fs = new Stack(); m_namespaces.put(prefix, fs); return fs; }
[ "private", "Stack", "createPrefixStack", "(", "String", "prefix", ")", "{", "Stack", "fs", "=", "new", "Stack", "(", ")", ";", "m_namespaces", ".", "put", "(", "prefix", ",", "fs", ")", ";", "return", "fs", ";", "}" ]
A more type-safe way of saving stacks under the m_namespaces Hashtable.
[ "A", "more", "type", "-", "safe", "way", "of", "saving", "stacks", "under", "the", "m_namespaces", "Hashtable", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L467-L472
35,367
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.lookupAllPrefixes
public String[] lookupAllPrefixes(String uri) { java.util.ArrayList foundPrefixes = new java.util.ArrayList(); Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefixes.add(prefix); } } String[] prefixArray = new String[foundPrefixes.size()]; foundPrefixes.toArray(prefixArray); return prefixArray; }
java
public String[] lookupAllPrefixes(String uri) { java.util.ArrayList foundPrefixes = new java.util.ArrayList(); Enumeration prefixes = m_namespaces.keys(); while (prefixes.hasMoreElements()) { String prefix = (String) prefixes.nextElement(); String uri2 = lookupNamespace(prefix); if (uri2 != null && uri2.equals(uri)) { foundPrefixes.add(prefix); } } String[] prefixArray = new String[foundPrefixes.size()]; foundPrefixes.toArray(prefixArray); return prefixArray; }
[ "public", "String", "[", "]", "lookupAllPrefixes", "(", "String", "uri", ")", "{", "java", ".", "util", ".", "ArrayList", "foundPrefixes", "=", "new", "java", ".", "util", ".", "ArrayList", "(", ")", ";", "Enumeration", "prefixes", "=", "m_namespaces", "."...
Given a namespace uri, get all prefixes bound to the Namespace URI in the current scope. @param uri the namespace URI to be search for @return An array of Strings which are all prefixes bound to the namespace URI in the current scope. An array of zero elements is returned if no prefixes map to the given namespace URI.
[ "Given", "a", "namespace", "uri", "get", "all", "prefixes", "bound", "to", "the", "Namespace", "URI", "in", "the", "current", "scope", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L483-L499
35,368
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java
CharsetDetector.detect
public CharsetMatch detect() { // TODO: A better implementation would be to copy the detect loop from // detectAll(), and cut it short as soon as a match with a high confidence // is found. This is something to be done later, after things are otherwise // working. CharsetMatch matches[] = detectAll(); if (matches == null || matches.length == 0) { return null; } return matches[0]; }
java
public CharsetMatch detect() { // TODO: A better implementation would be to copy the detect loop from // detectAll(), and cut it short as soon as a match with a high confidence // is found. This is something to be done later, after things are otherwise // working. CharsetMatch matches[] = detectAll(); if (matches == null || matches.length == 0) { return null; } return matches[0]; }
[ "public", "CharsetMatch", "detect", "(", ")", "{", "// TODO: A better implementation would be to copy the detect loop from", "// detectAll(), and cut it short as soon as a match with a high confidence", "// is found. This is something to be done later, after things are otherwis...
Return the charset that best matches the supplied input data. Note though, that because the detection only looks at the start of the input data, there is a possibility that the returned charset will fail to handle the full set of input data. <p> Raise an exception if <ul> <li>no charset appears to match the data.</li> <li>no input text has been provided</li> </ul> @return a CharsetMatch object representing the best matching charset, or <code>null</code> if there are no matches.
[ "Return", "the", "charset", "that", "best", "matches", "the", "supplied", "input", "data", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java#L148-L160
35,369
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java
CharsetDetector.getDetectableCharsets
@Deprecated public String[] getDetectableCharsets() { List<String> csnames = new ArrayList<String>(ALL_CS_RECOGNIZERS.size()); for (int i = 0; i < ALL_CS_RECOGNIZERS.size(); i++) { CSRecognizerInfo rcinfo = ALL_CS_RECOGNIZERS.get(i); boolean active = (fEnabledRecognizers == null) ? rcinfo.isDefaultEnabled : fEnabledRecognizers[i]; if (active) { csnames.add(rcinfo.recognizer.getName()); } } return csnames.toArray(new String[csnames.size()]); }
java
@Deprecated public String[] getDetectableCharsets() { List<String> csnames = new ArrayList<String>(ALL_CS_RECOGNIZERS.size()); for (int i = 0; i < ALL_CS_RECOGNIZERS.size(); i++) { CSRecognizerInfo rcinfo = ALL_CS_RECOGNIZERS.get(i); boolean active = (fEnabledRecognizers == null) ? rcinfo.isDefaultEnabled : fEnabledRecognizers[i]; if (active) { csnames.add(rcinfo.recognizer.getName()); } } return csnames.toArray(new String[csnames.size()]); }
[ "@", "Deprecated", "public", "String", "[", "]", "getDetectableCharsets", "(", ")", "{", "List", "<", "String", ">", "csnames", "=", "new", "ArrayList", "<", "String", ">", "(", "ALL_CS_RECOGNIZERS", ".", "size", "(", ")", ")", ";", "for", "(", "int", ...
Get the names of charsets that can be recognized by this CharsetDetector instance. @return an array of the names of charsets that can be recognized by this CharsetDetector instance. @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Get", "the", "names", "of", "charsets", "that", "can", "be", "recognized", "by", "this", "CharsetDetector", "instance", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetDetector.java#L504-L515
35,370
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.reset
public void reset() { m_flushedStartDoc = false; m_foundFirstElement = false; m_outputStream = null; clearParameters(); m_result = null; m_resultContentHandler = null; m_resultDeclHandler = null; m_resultDTDHandler = null; m_resultLexicalHandler = null; m_serializer = null; m_systemID = null; m_URIResolver = null; m_outputFormat = new OutputProperties(Method.XML); }
java
public void reset() { m_flushedStartDoc = false; m_foundFirstElement = false; m_outputStream = null; clearParameters(); m_result = null; m_resultContentHandler = null; m_resultDeclHandler = null; m_resultDTDHandler = null; m_resultLexicalHandler = null; m_serializer = null; m_systemID = null; m_URIResolver = null; m_outputFormat = new OutputProperties(Method.XML); }
[ "public", "void", "reset", "(", ")", "{", "m_flushedStartDoc", "=", "false", ";", "m_foundFirstElement", "=", "false", ";", "m_outputStream", "=", "null", ";", "clearParameters", "(", ")", ";", "m_result", "=", "null", ";", "m_resultContentHandler", "=", "null...
Reset the status of the transformer.
[ "Reset", "the", "status", "of", "the", "transformer", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L150-L165
35,371
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setParameter
public void setParameter(String name, Object value) { if (value == null) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object[]{name})); } if (null == m_params) { m_params = new Hashtable(); } m_params.put(name, value); }
java
public void setParameter(String name, Object value) { if (value == null) { throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object[]{name})); } if (null == m_params) { m_params = new Hashtable(); } m_params.put(name, value); }
[ "public", "void", "setParameter", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "XSLMessages", ".", "createMessage", "(", "XSLTErrorResources", ".", "ER_INV...
Add a parameter for the transformation. <p>Pass a qualified name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.</p> <p>For example, if a URI and local name were obtained from an element defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.</p> @param name The name of the parameter, which may begin with a namespace URI in curly braces ({}). @param value The value object. This can be any valid Java object. It is up to the processor to provide the proper object coersion or to simply pass the object on for use in an extension.
[ "Add", "a", "parameter", "for", "the", "transformation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L546-L558
35,372
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setOutputProperty
public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); }
java
public void setOutputProperty(String name, String value) throws IllegalArgumentException { if (!OutputProperties.isLegalPropertyKey(name)) throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: " //+ name); m_outputFormat.setProperty(name, value); }
[ "public", "void", "setOutputProperty", "(", "String", "name", ",", "String", "value", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "OutputProperties", ".", "isLegalPropertyKey", "(", "name", ")", ")", "throw", "new", "IllegalArgumentException", ...
Set an output property that will be in effect for the transformation. <p>Pass a qualified property name as a two-part string, the namespace URI enclosed in curly braces ({}), followed by the local name. If the name has a null URL, the String only contain the local name. An application can safely check for a non-null URI by testing to see if the first character of the name is a '{' character.</p> <p>For example, if a URI and local name were obtained from an element defined with &lt;xyz:foo xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;, then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo". Note that no prefix is used.</p> <p>The Properties object that was passed to {@link #setOutputProperties} won't be effected by calling this method.</p> @param name A non-null String that specifies an output property name, which may be namespace qualified. @param value The non-null string value of the output property. @throws IllegalArgumentException If the property is not supported, and is not qualified with a namespace. @see javax.xml.transform.OutputKeys
[ "Set", "an", "output", "property", "that", "will", "be", "in", "effect", "for", "the", "transformation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L735-L744
35,373
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.setDocumentLocator
public void setDocumentLocator(Locator locator) { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } m_resultContentHandler.setDocumentLocator(locator); }
java
public void setDocumentLocator(Locator locator) { try { if (null == m_resultContentHandler) createResultContentHandler(m_result); } catch (TransformerException te) { throw new org.apache.xml.utils.WrappedRuntimeException(te); } m_resultContentHandler.setDocumentLocator(locator); }
[ "public", "void", "setDocumentLocator", "(", "Locator", "locator", ")", "{", "try", "{", "if", "(", "null", "==", "m_resultContentHandler", ")", "createResultContentHandler", "(", "m_result", ")", ";", "}", "catch", "(", "TransformerException", "te", ")", "{", ...
Receive a Locator object for document events. <p>By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.</p> @param locator A locator for all SAX document events. @see org.xml.sax.ContentHandler#setDocumentLocator @see org.xml.sax.Locator
[ "Receive", "a", "Locator", "object", "for", "document", "events", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L876-L889
35,374
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java
Segment.pop
public Segment pop() { Segment result = next != this ? next : null; prev.next = next; next.prev = prev; next = null; prev = null; return result; }
java
public Segment pop() { Segment result = next != this ? next : null; prev.next = next; next.prev = prev; next = null; prev = null; return result; }
[ "public", "Segment", "pop", "(", ")", "{", "Segment", "result", "=", "next", "!=", "this", "?", "next", ":", "null", ";", "prev", ".", "next", "=", "next", ";", "next", ".", "prev", "=", "prev", ";", "next", "=", "null", ";", "prev", "=", "null",...
Removes this segment of a circularly-linked list and returns its successor. Returns null if the list is now empty.
[ "Removes", "this", "segment", "of", "a", "circularly", "-", "linked", "list", "and", "returns", "its", "successor", ".", "Returns", "null", "if", "the", "list", "is", "now", "empty", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java#L80-L87
35,375
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java
Segment.compact
public void compact() { if (prev == this) throw new IllegalStateException(); if (!prev.owner) return; // Cannot compact: prev isn't writable. int byteCount = limit - pos; int availableByteCount = SIZE - prev.limit + (prev.shared ? 0 : prev.pos); if (byteCount > availableByteCount) return; // Cannot compact: not enough writable space. writeTo(prev, byteCount); pop(); SegmentPool.recycle(this); }
java
public void compact() { if (prev == this) throw new IllegalStateException(); if (!prev.owner) return; // Cannot compact: prev isn't writable. int byteCount = limit - pos; int availableByteCount = SIZE - prev.limit + (prev.shared ? 0 : prev.pos); if (byteCount > availableByteCount) return; // Cannot compact: not enough writable space. writeTo(prev, byteCount); pop(); SegmentPool.recycle(this); }
[ "public", "void", "compact", "(", ")", "{", "if", "(", "prev", "==", "this", ")", "throw", "new", "IllegalStateException", "(", ")", ";", "if", "(", "!", "prev", ".", "owner", ")", "return", ";", "// Cannot compact: prev isn't writable.", "int", "byteCount",...
Call this when the tail and its predecessor may both be less than half full. This will copy data so that segments can be recycled.
[ "Call", "this", "when", "the", "tail", "and", "its", "predecessor", "may", "both", "be", "less", "than", "half", "full", ".", "This", "will", "copy", "data", "so", "that", "segments", "can", "be", "recycled", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java#L122-L131
35,376
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.getInstance
@Deprecated public static SimpleDateFormat getInstance(Calendar.FormatConfiguration formatConfig) { String ostr = formatConfig.getOverrideString(); boolean useFast = ( ostr != null && ostr.length() > 0 ); return new SimpleDateFormat(formatConfig.getPatternString(), formatConfig.getDateFormatSymbols(), formatConfig.getCalendar(), null, formatConfig.getLocale(), useFast, formatConfig.getOverrideString()); }
java
@Deprecated public static SimpleDateFormat getInstance(Calendar.FormatConfiguration formatConfig) { String ostr = formatConfig.getOverrideString(); boolean useFast = ( ostr != null && ostr.length() > 0 ); return new SimpleDateFormat(formatConfig.getPatternString(), formatConfig.getDateFormatSymbols(), formatConfig.getCalendar(), null, formatConfig.getLocale(), useFast, formatConfig.getOverrideString()); }
[ "@", "Deprecated", "public", "static", "SimpleDateFormat", "getInstance", "(", "Calendar", ".", "FormatConfiguration", "formatConfig", ")", "{", "String", "ostr", "=", "formatConfig", ".", "getOverrideString", "(", ")", ";", "boolean", "useFast", "=", "(", "ostr",...
Creates an instance of SimpleDateFormat for the given format configuration @param formatConfig the format configuration @return A SimpleDateFormat instance @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Creates", "an", "instance", "of", "SimpleDateFormat", "for", "the", "given", "format", "configuration" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1083-L1096
35,377
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.initializeTimeZoneFormat
private synchronized void initializeTimeZoneFormat(boolean bForceUpdate) { if (bForceUpdate || tzFormat == null) { tzFormat = TimeZoneFormat.getInstance(locale); String digits = null; if (numberFormat instanceof DecimalFormat) { DecimalFormatSymbols decsym = ((DecimalFormat) numberFormat).getDecimalFormatSymbols(); digits = new String(decsym.getDigits()); } else if (numberFormat instanceof DateNumberFormat) { digits = new String(((DateNumberFormat)numberFormat).getDigits()); } if (digits != null) { if (!tzFormat.getGMTOffsetDigits().equals(digits)) { if (tzFormat.isFrozen()) { tzFormat = tzFormat.cloneAsThawed(); } tzFormat.setGMTOffsetDigits(digits); } } } }
java
private synchronized void initializeTimeZoneFormat(boolean bForceUpdate) { if (bForceUpdate || tzFormat == null) { tzFormat = TimeZoneFormat.getInstance(locale); String digits = null; if (numberFormat instanceof DecimalFormat) { DecimalFormatSymbols decsym = ((DecimalFormat) numberFormat).getDecimalFormatSymbols(); digits = new String(decsym.getDigits()); } else if (numberFormat instanceof DateNumberFormat) { digits = new String(((DateNumberFormat)numberFormat).getDigits()); } if (digits != null) { if (!tzFormat.getGMTOffsetDigits().equals(digits)) { if (tzFormat.isFrozen()) { tzFormat = tzFormat.cloneAsThawed(); } tzFormat.setGMTOffsetDigits(digits); } } } }
[ "private", "synchronized", "void", "initializeTimeZoneFormat", "(", "boolean", "bForceUpdate", ")", "{", "if", "(", "bForceUpdate", "||", "tzFormat", "==", "null", ")", "{", "tzFormat", "=", "TimeZoneFormat", ".", "getInstance", "(", "locale", ")", ";", "String"...
Private method lazily instantiate the TimeZoneFormat field @param bForceUpdate when true, check if tzFormat is synchronized with the current numberFormat and update its digits if necessary. When false, this check is skipped.
[ "Private", "method", "lazily", "instantiate", "the", "TimeZoneFormat", "field" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1142-L1163
35,378
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.setContext
@Override public void setContext(DisplayContext context) { super.setContext(context); if (capitalizationBrkIter == null && (context==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU || context==DisplayContext.CAPITALIZATION_FOR_STANDALONE)) { capitalizationBrkIter = BreakIterator.getSentenceInstance(locale); } }
java
@Override public void setContext(DisplayContext context) { super.setContext(context); if (capitalizationBrkIter == null && (context==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU || context==DisplayContext.CAPITALIZATION_FOR_STANDALONE)) { capitalizationBrkIter = BreakIterator.getSentenceInstance(locale); } }
[ "@", "Override", "public", "void", "setContext", "(", "DisplayContext", "context", ")", "{", "super", ".", "setContext", "(", "context", ")", ";", "if", "(", "capitalizationBrkIter", "==", "null", "&&", "(", "context", "==", "DisplayContext", ".", "CAPITALIZAT...
Here we override the DateFormat implementation in order to lazily initialize relevant items
[ "Here", "we", "override", "the", "DateFormat", "implementation", "in", "order", "to", "lazily", "initialize", "relevant", "items" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1290-L1298
35,379
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.format
private StringBuffer format(Calendar cal, DisplayContext capitalizationContext, StringBuffer toAppendTo, FieldPosition pos, List<FieldPosition> attributes) { // Initialize pos.setBeginIndex(0); pos.setEndIndex(0); // Careful: For best performance, minimize the number of calls // to StringBuffer.append() by consolidating appends when // possible. Object[] items = getPatternItems(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof String) { toAppendTo.append((String)items[i]); } else { PatternItem item = (PatternItem)items[i]; int start = 0; if (attributes != null) { // Save the current length start = toAppendTo.length(); } if (useFastFormat) { subFormat(toAppendTo, item.type, item.length, toAppendTo.length(), i, capitalizationContext, pos, cal); } else { toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(), i, capitalizationContext, pos, cal)); } if (attributes != null) { // Check the sub format length int end = toAppendTo.length(); if (end - start > 0) { // Append the attribute to the list DateFormat.Field attr = patternCharToDateFormatField(item.type); FieldPosition fp = new FieldPosition(attr); fp.setBeginIndex(start); fp.setEndIndex(end); attributes.add(fp); } } } } return toAppendTo; }
java
private StringBuffer format(Calendar cal, DisplayContext capitalizationContext, StringBuffer toAppendTo, FieldPosition pos, List<FieldPosition> attributes) { // Initialize pos.setBeginIndex(0); pos.setEndIndex(0); // Careful: For best performance, minimize the number of calls // to StringBuffer.append() by consolidating appends when // possible. Object[] items = getPatternItems(); for (int i = 0; i < items.length; i++) { if (items[i] instanceof String) { toAppendTo.append((String)items[i]); } else { PatternItem item = (PatternItem)items[i]; int start = 0; if (attributes != null) { // Save the current length start = toAppendTo.length(); } if (useFastFormat) { subFormat(toAppendTo, item.type, item.length, toAppendTo.length(), i, capitalizationContext, pos, cal); } else { toAppendTo.append(subFormat(item.type, item.length, toAppendTo.length(), i, capitalizationContext, pos, cal)); } if (attributes != null) { // Check the sub format length int end = toAppendTo.length(); if (end - start > 0) { // Append the attribute to the list DateFormat.Field attr = patternCharToDateFormatField(item.type); FieldPosition fp = new FieldPosition(attr); fp.setBeginIndex(start); fp.setEndIndex(end); attributes.add(fp); } } } } return toAppendTo; }
[ "private", "StringBuffer", "format", "(", "Calendar", "cal", ",", "DisplayContext", "capitalizationContext", ",", "StringBuffer", "toAppendTo", ",", "FieldPosition", "pos", ",", "List", "<", "FieldPosition", ">", "attributes", ")", "{", "// Initialize", "pos", ".", ...
then attribute information will be recorded.
[ "then", "attribute", "information", "will", "be", "recorded", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1335-L1379
35,380
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.patternCharToDateFormatField
protected DateFormat.Field patternCharToDateFormatField(char ch) { int patternCharIndex = getIndexFromChar(ch); if (patternCharIndex != -1) { return PATTERN_INDEX_TO_DATE_FORMAT_ATTRIBUTE[patternCharIndex]; } return null; }
java
protected DateFormat.Field patternCharToDateFormatField(char ch) { int patternCharIndex = getIndexFromChar(ch); if (patternCharIndex != -1) { return PATTERN_INDEX_TO_DATE_FORMAT_ATTRIBUTE[patternCharIndex]; } return null; }
[ "protected", "DateFormat", ".", "Field", "patternCharToDateFormatField", "(", "char", "ch", ")", "{", "int", "patternCharIndex", "=", "getIndexFromChar", "(", "ch", ")", ";", "if", "(", "patternCharIndex", "!=", "-", "1", ")", "{", "return", "PATTERN_INDEX_TO_DA...
Returns a DateFormat.Field constant associated with the specified format pattern character. @param ch The pattern character @return DateFormat.Field associated with the pattern character
[ "Returns", "a", "DateFormat", ".", "Field", "constant", "associated", "with", "the", "specified", "format", "pattern", "character", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1482-L1488
35,381
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.subFormat
protected String subFormat(char ch, int count, int beginOffset, FieldPosition pos, DateFormatSymbols fmtData, Calendar cal) throws IllegalArgumentException { // Note: formatData is ignored return subFormat(ch, count, beginOffset, 0, DisplayContext.CAPITALIZATION_NONE, pos, cal); }
java
protected String subFormat(char ch, int count, int beginOffset, FieldPosition pos, DateFormatSymbols fmtData, Calendar cal) throws IllegalArgumentException { // Note: formatData is ignored return subFormat(ch, count, beginOffset, 0, DisplayContext.CAPITALIZATION_NONE, pos, cal); }
[ "protected", "String", "subFormat", "(", "char", "ch", ",", "int", "count", ",", "int", "beginOffset", ",", "FieldPosition", "pos", ",", "DateFormatSymbols", "fmtData", ",", "Calendar", "cal", ")", "throws", "IllegalArgumentException", "{", "// Note: formatData is i...
Formats a single field, given its pattern character. Subclasses may override this method in order to modify or add formatting capabilities. @param ch the pattern character @param count the number of times ch is repeated in the pattern @param beginOffset the offset of the output string at the start of this field; used to set pos when appropriate @param pos receives the position of a field, when appropriate @param fmtData the symbols for this formatter
[ "Formats", "a", "single", "field", "given", "its", "pattern", "character", ".", "Subclasses", "may", "override", "this", "method", "in", "order", "to", "modify", "or", "add", "formatting", "capabilities", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L1501-L1508
35,382
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.zeroPaddingNumber
@Deprecated protected void zeroPaddingNumber(NumberFormat nf,StringBuffer buf, int value, int minDigits, int maxDigits) { // Note: Indian calendar uses negative value for a calendar // field. fastZeroPaddingNumber cannot handle negative numbers. // BTW, it looks like a design bug in the Indian calendar... if (useLocalZeroPaddingNumberFormat && value >= 0) { fastZeroPaddingNumber(buf, value, minDigits, maxDigits); } else { nf.setMinimumIntegerDigits(minDigits); nf.setMaximumIntegerDigits(maxDigits); nf.format(value, buf, new FieldPosition(-1)); } }
java
@Deprecated protected void zeroPaddingNumber(NumberFormat nf,StringBuffer buf, int value, int minDigits, int maxDigits) { // Note: Indian calendar uses negative value for a calendar // field. fastZeroPaddingNumber cannot handle negative numbers. // BTW, it looks like a design bug in the Indian calendar... if (useLocalZeroPaddingNumberFormat && value >= 0) { fastZeroPaddingNumber(buf, value, minDigits, maxDigits); } else { nf.setMinimumIntegerDigits(minDigits); nf.setMaximumIntegerDigits(maxDigits); nf.format(value, buf, new FieldPosition(-1)); } }
[ "@", "Deprecated", "protected", "void", "zeroPaddingNumber", "(", "NumberFormat", "nf", ",", "StringBuffer", "buf", ",", "int", "value", ",", "int", "minDigits", ",", "int", "maxDigits", ")", "{", "// Note: Indian calendar uses negative value for a calendar", "// field....
Internal high-speed method. Reuses a StringBuffer for results instead of creating a String on the heap for each call. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Internal", "high", "-", "speed", "method", ".", "Reuses", "a", "StringBuffer", "for", "results", "instead", "of", "creating", "a", "String", "on", "the", "heap", "for", "each", "call", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L2187-L2200
35,383
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.isNumeric
private static final boolean isNumeric(char formatChar, int count) { return NUMERIC_FORMAT_CHARS.indexOf(formatChar) >= 0 || (count <= 2 && NUMERIC_FORMAT_CHARS2.indexOf(formatChar) >= 0); }
java
private static final boolean isNumeric(char formatChar, int count) { return NUMERIC_FORMAT_CHARS.indexOf(formatChar) >= 0 || (count <= 2 && NUMERIC_FORMAT_CHARS2.indexOf(formatChar) >= 0); }
[ "private", "static", "final", "boolean", "isNumeric", "(", "char", "formatChar", ",", "int", "count", ")", "{", "return", "NUMERIC_FORMAT_CHARS", ".", "indexOf", "(", "formatChar", ")", ">=", "0", "||", "(", "count", "<=", "2", "&&", "NUMERIC_FORMAT_CHARS2", ...
Return true if the given format character, occuring count times, represents a numeric field.
[ "Return", "true", "if", "the", "given", "format", "character", "occuring", "count", "times", "represents", "a", "numeric", "field", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L2309-L2312
35,384
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.matchDayPeriodString
private int matchDayPeriodString(String text, int start, String[] data, int dataLength, Output<DayPeriodRules.DayPeriod> dayPeriod) { int bestMatchLength = 0, bestMatch = -1; int matchLength = 0; for (int i = 0; i < dataLength; ++i) { // Only try matching if the string exists. if (data[i] != null) { int length = data[i].length(); if (length > bestMatchLength && (matchLength = regionMatchesWithOptionalDot(text, start, data[i], length)) >= 0) { bestMatch = i; bestMatchLength = matchLength; } } } if (bestMatch >= 0) { dayPeriod.value = DayPeriodRules.DayPeriod.VALUES[bestMatch]; return start + bestMatchLength; } return -start; }
java
private int matchDayPeriodString(String text, int start, String[] data, int dataLength, Output<DayPeriodRules.DayPeriod> dayPeriod) { int bestMatchLength = 0, bestMatch = -1; int matchLength = 0; for (int i = 0; i < dataLength; ++i) { // Only try matching if the string exists. if (data[i] != null) { int length = data[i].length(); if (length > bestMatchLength && (matchLength = regionMatchesWithOptionalDot(text, start, data[i], length)) >= 0) { bestMatch = i; bestMatchLength = matchLength; } } } if (bestMatch >= 0) { dayPeriod.value = DayPeriodRules.DayPeriod.VALUES[bestMatch]; return start + bestMatchLength; } return -start; }
[ "private", "int", "matchDayPeriodString", "(", "String", "text", ",", "int", "start", ",", "String", "[", "]", "data", ",", "int", "dataLength", ",", "Output", "<", "DayPeriodRules", ".", "DayPeriod", ">", "dayPeriod", ")", "{", "int", "bestMatchLength", "="...
Similar to matchQuarterString but customized for day periods.
[ "Similar", "to", "matchQuarterString", "but", "customized", "for", "day", "periods", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L2994-L3017
35,385
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.allowNumericFallback
private boolean allowNumericFallback(int patternCharIndex) { if (patternCharIndex == 26 /*'L' STAND_ALONE_MONTH*/ || patternCharIndex == 19 /*'e' DOW_LOCAL*/ || patternCharIndex == 25 /*'c' STAND_ALONE_DAY_OF_WEEK*/ || patternCharIndex == 30 /*'U' YEAR_NAME_FIELD*/ || patternCharIndex == 27 /* 'Q' - QUARTER*/ || patternCharIndex == 28 /* 'q' - STANDALONE QUARTER*/) { return true; } return false; }
java
private boolean allowNumericFallback(int patternCharIndex) { if (patternCharIndex == 26 /*'L' STAND_ALONE_MONTH*/ || patternCharIndex == 19 /*'e' DOW_LOCAL*/ || patternCharIndex == 25 /*'c' STAND_ALONE_DAY_OF_WEEK*/ || patternCharIndex == 30 /*'U' YEAR_NAME_FIELD*/ || patternCharIndex == 27 /* 'Q' - QUARTER*/ || patternCharIndex == 28 /* 'q' - STANDALONE QUARTER*/) { return true; } return false; }
[ "private", "boolean", "allowNumericFallback", "(", "int", "patternCharIndex", ")", "{", "if", "(", "patternCharIndex", "==", "26", "/*'L' STAND_ALONE_MONTH*/", "||", "patternCharIndex", "==", "19", "/*'e' DOW_LOCAL*/", "||", "patternCharIndex", "==", "25", "/*'c' STAND_...
return true if the pattern specified by patternCharIndex is one that allows numeric fallback regardless of actual pattern size.
[ "return", "true", "if", "the", "pattern", "specified", "by", "patternCharIndex", "is", "one", "that", "allows", "numeric", "fallback", "regardless", "of", "actual", "pattern", "size", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3704-L3714
35,386
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.parseInt
private Number parseInt(String text, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { return parseInt(text, -1, pos, allowNegative, fmt); }
java
private Number parseInt(String text, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { return parseInt(text, -1, pos, allowNegative, fmt); }
[ "private", "Number", "parseInt", "(", "String", "text", ",", "ParsePosition", "pos", ",", "boolean", "allowNegative", ",", "NumberFormat", "fmt", ")", "{", "return", "parseInt", "(", "text", ",", "-", "1", ",", "pos", ",", "allowNegative", ",", "fmt", ")",...
Parse an integer using numberFormat. This method is semantically const, but actually may modify fNumberFormat.
[ "Parse", "an", "integer", "using", "numberFormat", ".", "This", "method", "is", "semantically", "const", "but", "actually", "may", "modify", "fNumberFormat", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3720-L3725
35,387
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.parseInt
private Number parseInt(String text, int maxDigits, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { Number number; int oldPos = pos.getIndex(); if (allowNegative) { number = fmt.parse(text, pos); } else { // Invalidate negative numbers if (fmt instanceof DecimalFormat) { String oldPrefix = ((DecimalFormat)fmt).getNegativePrefix(); ((DecimalFormat)fmt).setNegativePrefix(SUPPRESS_NEGATIVE_PREFIX); number = fmt.parse(text, pos); ((DecimalFormat)fmt).setNegativePrefix(oldPrefix); } else { boolean dateNumberFormat = (fmt instanceof DateNumberFormat); if (dateNumberFormat) { ((DateNumberFormat)fmt).setParsePositiveOnly(true); } number = fmt.parse(text, pos); if (dateNumberFormat) { ((DateNumberFormat)fmt).setParsePositiveOnly(false); } } } if (maxDigits > 0) { // adjust the result to fit into // the maxDigits and move the position back int nDigits = pos.getIndex() - oldPos; if (nDigits > maxDigits) { double val = number.doubleValue(); nDigits -= maxDigits; while (nDigits > 0) { val /= 10; nDigits--; } pos.setIndex(oldPos + maxDigits); number = Integer.valueOf((int)val); } } return number; }
java
private Number parseInt(String text, int maxDigits, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { Number number; int oldPos = pos.getIndex(); if (allowNegative) { number = fmt.parse(text, pos); } else { // Invalidate negative numbers if (fmt instanceof DecimalFormat) { String oldPrefix = ((DecimalFormat)fmt).getNegativePrefix(); ((DecimalFormat)fmt).setNegativePrefix(SUPPRESS_NEGATIVE_PREFIX); number = fmt.parse(text, pos); ((DecimalFormat)fmt).setNegativePrefix(oldPrefix); } else { boolean dateNumberFormat = (fmt instanceof DateNumberFormat); if (dateNumberFormat) { ((DateNumberFormat)fmt).setParsePositiveOnly(true); } number = fmt.parse(text, pos); if (dateNumberFormat) { ((DateNumberFormat)fmt).setParsePositiveOnly(false); } } } if (maxDigits > 0) { // adjust the result to fit into // the maxDigits and move the position back int nDigits = pos.getIndex() - oldPos; if (nDigits > maxDigits) { double val = number.doubleValue(); nDigits -= maxDigits; while (nDigits > 0) { val /= 10; nDigits--; } pos.setIndex(oldPos + maxDigits); number = Integer.valueOf((int)val); } } return number; }
[ "private", "Number", "parseInt", "(", "String", "text", ",", "int", "maxDigits", ",", "ParsePosition", "pos", ",", "boolean", "allowNegative", ",", "NumberFormat", "fmt", ")", "{", "Number", "number", ";", "int", "oldPos", "=", "pos", ".", "getIndex", "(", ...
Parse an integer using numberFormat up to maxDigits.
[ "Parse", "an", "integer", "using", "numberFormat", "up", "to", "maxDigits", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3730-L3773
35,388
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.translatePattern
private String translatePattern(String pat, String from, String to) { StringBuilder result = new StringBuilder(); boolean inQuote = false; for (int i = 0; i < pat.length(); ++i) { char c = pat.charAt(i); if (inQuote) { if (c == '\'') inQuote = false; } else { if (c == '\'') { inQuote = true; } else if (isSyntaxChar(c)) { int ci = from.indexOf(c); if (ci != -1) { c = to.charAt(ci); } // do not worry on translatepattern if the character is not listed // we do the validity check elsewhere } } result.append(c); } if (inQuote) { throw new IllegalArgumentException("Unfinished quote in pattern"); } return result.toString(); }
java
private String translatePattern(String pat, String from, String to) { StringBuilder result = new StringBuilder(); boolean inQuote = false; for (int i = 0; i < pat.length(); ++i) { char c = pat.charAt(i); if (inQuote) { if (c == '\'') inQuote = false; } else { if (c == '\'') { inQuote = true; } else if (isSyntaxChar(c)) { int ci = from.indexOf(c); if (ci != -1) { c = to.charAt(ci); } // do not worry on translatepattern if the character is not listed // we do the validity check elsewhere } } result.append(c); } if (inQuote) { throw new IllegalArgumentException("Unfinished quote in pattern"); } return result.toString(); }
[ "private", "String", "translatePattern", "(", "String", "pat", ",", "String", "from", ",", "String", "to", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "inQuote", "=", "false", ";", "for", "(", "int", "i", "...
Translate a pattern, mapping each character in the from string to the corresponding character in the to string.
[ "Translate", "a", "pattern", "mapping", "each", "character", "in", "the", "from", "string", "to", "the", "corresponding", "character", "in", "the", "to", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3780-L3806
35,389
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.applyPattern
public void applyPattern(String pat) { this.pattern = pat; parsePattern(); setLocale(null, null); // reset parsed pattern items patternItems = null; }
java
public void applyPattern(String pat) { this.pattern = pat; parsePattern(); setLocale(null, null); // reset parsed pattern items patternItems = null; }
[ "public", "void", "applyPattern", "(", "String", "pat", ")", "{", "this", ".", "pattern", "=", "pat", ";", "parsePattern", "(", ")", ";", "setLocale", "(", "null", ",", "null", ")", ";", "// reset parsed pattern items", "patternItems", "=", "null", ";", "}...
Apply the given unlocalized pattern string to this date format.
[ "Apply", "the", "given", "unlocalized", "pattern", "string", "to", "this", "date", "format", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3833-L3841
35,390
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.applyLocalizedPattern
public void applyLocalizedPattern(String pat) { this.pattern = translatePattern(pat, formatData.localPatternChars, DateFormatSymbols.patternChars); setLocale(null, null); }
java
public void applyLocalizedPattern(String pat) { this.pattern = translatePattern(pat, formatData.localPatternChars, DateFormatSymbols.patternChars); setLocale(null, null); }
[ "public", "void", "applyLocalizedPattern", "(", "String", "pat", ")", "{", "this", ".", "pattern", "=", "translatePattern", "(", "pat", ",", "formatData", ".", "localPatternChars", ",", "DateFormatSymbols", ".", "patternChars", ")", ";", "setLocale", "(", "null"...
Apply the given localized pattern string to this date format.
[ "Apply", "the", "given", "localized", "pattern", "string", "to", "this", "date", "format", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3846-L3851
35,391
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.formatToCharacterIterator
@Override public AttributedCharacterIterator formatToCharacterIterator(Object obj) { Calendar cal = calendar; if (obj instanceof Calendar) { cal = (Calendar)obj; } else if (obj instanceof Date) { calendar.setTime((Date)obj); } else if (obj instanceof Number) { calendar.setTimeInMillis(((Number)obj).longValue()); } else { throw new IllegalArgumentException("Cannot format given Object as a Date"); } StringBuffer toAppendTo = new StringBuffer(); FieldPosition pos = new FieldPosition(0); List<FieldPosition> attributes = new ArrayList<FieldPosition>(); format(cal, getContext(DisplayContext.Type.CAPITALIZATION), toAppendTo, pos, attributes); AttributedString as = new AttributedString(toAppendTo.toString()); // add DateFormat field attributes to the AttributedString for (int i = 0; i < attributes.size(); i++) { FieldPosition fp = attributes.get(i); Format.Field attribute = fp.getFieldAttribute(); as.addAttribute(attribute, attribute, fp.getBeginIndex(), fp.getEndIndex()); } // return the CharacterIterator from AttributedString return as.getIterator(); }
java
@Override public AttributedCharacterIterator formatToCharacterIterator(Object obj) { Calendar cal = calendar; if (obj instanceof Calendar) { cal = (Calendar)obj; } else if (obj instanceof Date) { calendar.setTime((Date)obj); } else if (obj instanceof Number) { calendar.setTimeInMillis(((Number)obj).longValue()); } else { throw new IllegalArgumentException("Cannot format given Object as a Date"); } StringBuffer toAppendTo = new StringBuffer(); FieldPosition pos = new FieldPosition(0); List<FieldPosition> attributes = new ArrayList<FieldPosition>(); format(cal, getContext(DisplayContext.Type.CAPITALIZATION), toAppendTo, pos, attributes); AttributedString as = new AttributedString(toAppendTo.toString()); // add DateFormat field attributes to the AttributedString for (int i = 0; i < attributes.size(); i++) { FieldPosition fp = attributes.get(i); Format.Field attribute = fp.getFieldAttribute(); as.addAttribute(attribute, attribute, fp.getBeginIndex(), fp.getEndIndex()); } // return the CharacterIterator from AttributedString return as.getIterator(); }
[ "@", "Override", "public", "AttributedCharacterIterator", "formatToCharacterIterator", "(", "Object", "obj", ")", "{", "Calendar", "cal", "=", "calendar", ";", "if", "(", "obj", "instanceof", "Calendar", ")", "{", "cal", "=", "(", "Calendar", ")", "obj", ";", ...
Format the object to an attributed string, and return the corresponding iterator Overrides superclass method. @param obj The object to format @return <code>AttributedCharacterIterator</code> describing the formatted value.
[ "Format", "the", "object", "to", "an", "attributed", "string", "and", "return", "the", "corresponding", "iterator", "Overrides", "superclass", "method", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L4013-L4040
35,392
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.diffCalFieldValue
private boolean diffCalFieldValue(Calendar fromCalendar, Calendar toCalendar, Object[] items, int i) throws IllegalArgumentException { if ( items[i] instanceof String) { return false; } PatternItem item = (PatternItem)items[i]; char ch = item.type; int patternCharIndex = getIndexFromChar(ch); if (patternCharIndex == -1) { throw new IllegalArgumentException("Illegal pattern character " + "'" + ch + "' in \"" + pattern + '"'); } final int field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex]; if (field >= 0) { int value = fromCalendar.get(field); int value_2 = toCalendar.get(field); if ( value != value_2 ) { return true; } } return false; }
java
private boolean diffCalFieldValue(Calendar fromCalendar, Calendar toCalendar, Object[] items, int i) throws IllegalArgumentException { if ( items[i] instanceof String) { return false; } PatternItem item = (PatternItem)items[i]; char ch = item.type; int patternCharIndex = getIndexFromChar(ch); if (patternCharIndex == -1) { throw new IllegalArgumentException("Illegal pattern character " + "'" + ch + "' in \"" + pattern + '"'); } final int field = PATTERN_INDEX_TO_CALENDAR_FIELD[patternCharIndex]; if (field >= 0) { int value = fromCalendar.get(field); int value_2 = toCalendar.get(field); if ( value != value_2 ) { return true; } } return false; }
[ "private", "boolean", "diffCalFieldValue", "(", "Calendar", "fromCalendar", ",", "Calendar", "toCalendar", ",", "Object", "[", "]", "items", ",", "int", "i", ")", "throws", "IllegalArgumentException", "{", "if", "(", "items", "[", "i", "]", "instanceof", "Stri...
check whether the i-th item in 2 calendar is in different value. It is supposed to be used only by CLDR survey tool. It is used by intervalFormatByAlgorithm(). @param fromCalendar one calendar @param toCalendar the other calendar @param items pattern items @param i the i-th item in pattern items @exception IllegalArgumentException when there is non-recognized pattern letter @return true is i-th item in 2 calendar is in different value, false otherwise.
[ "check", "whether", "the", "i", "-", "th", "item", "in", "2", "calendar", "is", "in", "different", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L4299-L4324
35,393
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.lowerLevel
private boolean lowerLevel(Object[] items, int i, int level) throws IllegalArgumentException { if (items[i] instanceof String) { return false; } PatternItem item = (PatternItem)items[i]; char ch = item.type; int patternCharIndex = getLevelFromChar(ch); if (patternCharIndex == -1) { throw new IllegalArgumentException("Illegal pattern character " + "'" + ch + "' in \"" + pattern + '"'); } if (patternCharIndex >= level) { return true; } return false; }
java
private boolean lowerLevel(Object[] items, int i, int level) throws IllegalArgumentException { if (items[i] instanceof String) { return false; } PatternItem item = (PatternItem)items[i]; char ch = item.type; int patternCharIndex = getLevelFromChar(ch); if (patternCharIndex == -1) { throw new IllegalArgumentException("Illegal pattern character " + "'" + ch + "' in \"" + pattern + '"'); } if (patternCharIndex >= level) { return true; } return false; }
[ "private", "boolean", "lowerLevel", "(", "Object", "[", "]", "items", ",", "int", "i", ",", "int", "level", ")", "throws", "IllegalArgumentException", "{", "if", "(", "items", "[", "i", "]", "instanceof", "String", ")", "{", "return", "false", ";", "}", ...
check whether the i-th item's level is lower than the input 'level' It is supposed to be used only by CLDR survey tool. It is used by intervalFormatByAlgorithm(). @param items the pattern items @param i the i-th item in pattern items @param level the level with which the i-th pattern item compared to @exception IllegalArgumentException when there is non-recognized pattern letter @return true if i-th pattern item is lower than 'level', false otherwise
[ "check", "whether", "the", "i", "-", "th", "item", "s", "level", "is", "lower", "than", "the", "input", "level" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L4341-L4359
35,394
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.addUniqueAttribute
public void addUniqueAttribute(String rawName, String value, int flags) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.addUniqueAttribute(rawName, value, flags); }
java
public void addUniqueAttribute(String rawName, String value, int flags) throws SAXException { if (m_firstTagNotEmitted) { flush(); } m_handler.addUniqueAttribute(rawName, value, flags); }
[ "public", "void", "addUniqueAttribute", "(", "String", "rawName", ",", "String", "value", ",", "int", "flags", ")", "throws", "SAXException", "{", "if", "(", "m_firstTagNotEmitted", ")", "{", "flush", "(", ")", ";", "}", "m_handler", ".", "addUniqueAttribute",...
Adds a unique attribute to the currenly open tag
[ "Adds", "a", "unique", "attribute", "to", "the", "currenly", "open", "tag" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L300-L309
35,395
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.getPrefixPartUnknown
private String getPrefixPartUnknown(String qname) { final int index = qname.indexOf(':'); return (index > 0) ? qname.substring(0, index) : EMPTYSTRING; }
java
private String getPrefixPartUnknown(String qname) { final int index = qname.indexOf(':'); return (index > 0) ? qname.substring(0, index) : EMPTYSTRING; }
[ "private", "String", "getPrefixPartUnknown", "(", "String", "qname", ")", "{", "final", "int", "index", "=", "qname", ".", "indexOf", "(", "'", "'", ")", ";", "return", "(", "index", ">", "0", ")", "?", "qname", ".", "substring", "(", "0", ",", "inde...
Utility function to return prefix Don't want to override static function on SerializerBase So added Unknown suffix to method name.
[ "Utility", "function", "to", "return", "prefix" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L1099-L1103
35,396
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.getNamespaceMappings
public NamespaceMappings getNamespaceMappings() { NamespaceMappings mappings = null; if (m_handler != null) { mappings = m_handler.getNamespaceMappings(); } return mappings; }
java
public NamespaceMappings getNamespaceMappings() { NamespaceMappings mappings = null; if (m_handler != null) { mappings = m_handler.getNamespaceMappings(); } return mappings; }
[ "public", "NamespaceMappings", "getNamespaceMappings", "(", ")", "{", "NamespaceMappings", "mappings", "=", "null", ";", "if", "(", "m_handler", "!=", "null", ")", "{", "mappings", "=", "m_handler", ".", "getNamespaceMappings", "(", ")", ";", "}", "return", "m...
Get the current namespace mappings. Simply returns the mappings of the wrapped handler. @see ExtendedContentHandler#getNamespaceMappings()
[ "Get", "the", "current", "namespace", "mappings", ".", "Simply", "returns", "the", "mappings", "of", "the", "wrapped", "handler", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L1184-L1192
35,397
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
ExpandedNameTable.initExtendedTypes
private void initExtendedTypes() { m_extendedTypes = new ExtendedType[m_initialSize]; for (int i = 0; i < DTM.NTYPES; i++) { m_extendedTypes[i] = m_defaultExtendedTypes[i]; m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null); } m_nextType = DTM.NTYPES; }
java
private void initExtendedTypes() { m_extendedTypes = new ExtendedType[m_initialSize]; for (int i = 0; i < DTM.NTYPES; i++) { m_extendedTypes[i] = m_defaultExtendedTypes[i]; m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null); } m_nextType = DTM.NTYPES; }
[ "private", "void", "initExtendedTypes", "(", ")", "{", "m_extendedTypes", "=", "new", "ExtendedType", "[", "m_initialSize", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "DTM", ".", "NTYPES", ";", "i", "++", ")", "{", "m_extendedTypes", "[...
Initialize the vector of extended types with the basic DOM node types.
[ "Initialize", "the", "vector", "of", "extended", "types", "with", "the", "basic", "DOM", "node", "types", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java#L133-L142
35,398
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
ExpandedNameTable.getExpandedTypeID
public int getExpandedTypeID(String namespace, String localName, int type) { return getExpandedTypeID(namespace, localName, type, false); }
java
public int getExpandedTypeID(String namespace, String localName, int type) { return getExpandedTypeID(namespace, localName, type, false); }
[ "public", "int", "getExpandedTypeID", "(", "String", "namespace", ",", "String", "localName", ",", "int", "type", ")", "{", "return", "getExpandedTypeID", "(", "namespace", ",", "localName", ",", "type", ",", "false", ")", ";", "}" ]
Given an expanded name represented by namespace, local name and node type, return an ID. If the expanded-name does not exist in the internal tables, the entry will be created, and the ID will be returned. Any additional nodes that are created that have this expanded name will use this ID. @param namespace The namespace @param localName The local name @param type The node type @return the expanded-name id of the node.
[ "Given", "an", "expanded", "name", "represented", "by", "namespace", "local", "name", "and", "node", "type", "return", "an", "ID", ".", "If", "the", "expanded", "-", "name", "does", "not", "exist", "in", "the", "internal", "tables", "the", "entry", "will",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java#L156-L159
35,399
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java
ExpandedNameTable.rehash
private void rehash() { int oldCapacity = m_capacity; HashEntry[] oldTable = m_table; int newCapacity = 2 * oldCapacity + 1; m_capacity = newCapacity; m_threshold = (int)(newCapacity * m_loadFactor); m_table = new HashEntry[newCapacity]; for (int i = oldCapacity-1; i >=0 ; i--) { for (HashEntry old = oldTable[i]; old != null; ) { HashEntry e = old; old = old.next; int newIndex = e.hash % newCapacity; if (newIndex < 0) newIndex = -newIndex; e.next = m_table[newIndex]; m_table[newIndex] = e; } } }
java
private void rehash() { int oldCapacity = m_capacity; HashEntry[] oldTable = m_table; int newCapacity = 2 * oldCapacity + 1; m_capacity = newCapacity; m_threshold = (int)(newCapacity * m_loadFactor); m_table = new HashEntry[newCapacity]; for (int i = oldCapacity-1; i >=0 ; i--) { for (HashEntry old = oldTable[i]; old != null; ) { HashEntry e = old; old = old.next; int newIndex = e.hash % newCapacity; if (newIndex < 0) newIndex = -newIndex; e.next = m_table[newIndex]; m_table[newIndex] = e; } } }
[ "private", "void", "rehash", "(", ")", "{", "int", "oldCapacity", "=", "m_capacity", ";", "HashEntry", "[", "]", "oldTable", "=", "m_table", ";", "int", "newCapacity", "=", "2", "*", "oldCapacity", "+", "1", ";", "m_capacity", "=", "newCapacity", ";", "m...
Increases the capacity of and internally reorganizes the hashtable, in order to accommodate and access its entries more efficiently. This method is called when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.
[ "Increases", "the", "capacity", "of", "and", "internally", "reorganizes", "the", "hashtable", "in", "order", "to", "accommodate", "and", "access", "its", "entries", "more", "efficiently", ".", "This", "method", "is", "called", "when", "the", "number", "of", "k...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/ExpandedNameTable.java#L245-L270