_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q29400
TimeUnit.readResolve
train
private Object readResolve() throws ObjectStreamException { // The old index field used to uniquely identify the time unit. switch (index) { case 6: return SECOND; case 5: return MINUTE; case 4: return HOUR; case 3: return D...
java
{ "resource": "" }
q29401
LongPipeline.asDoubleStream
train
@Override public final DoubleStream asDoubleStream() { return new DoublePipeline.StatelessOp<Long>(this, StreamShape.LONG_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override public Sink<Long> opWrapSink(int flags...
java
{ "resource": "" }
q29402
LongPipeline.limit
train
@Override public final LongStream limit(long maxSize) { if (maxSize < 0) throw new IllegalArgumentException(Long.toString(maxSize)); return SliceOps.makeLong(this, 0, maxSize); }
java
{ "resource": "" }
q29403
TransliterationRule.getIndexValue
train
final int getIndexValue() { if (anteContextLength == pattern.length()) { // A pattern with just ante context {such as foo)>bar} can // match any key. return -1; } int c = UTF16.charAt(pattern, anteContextLength); return data.lookupMatcher(c) == null ? ...
java
{ "resource": "" }
q29404
TransliterationRule.matchesIndexValue
train
final boolean matchesIndexValue(int v) { // Delegate to the key, or if there is none, to the postContext. // If there is neither then we match any key; return true. UnicodeMatcher m = (key != null) ? key : postContext; return (m != null) ? m.matchesIndexValue(v) : true; }
java
{ "resource": "" }
q29405
TransliterationRule.matchAndReplace
train
public int matchAndReplace(Replaceable text, Transliterator.Position pos, boolean incremental) { // Matching and replacing are done in one method because the // replacement operation needs information obtained during the // match. An...
java
{ "resource": "" }
q29406
TransliterationRule.toRule
train
public String toRule(boolean escapeUnprintable) { // int i; StringBuffer rule = new StringBuffer(); // Accumulate special characters (and non-specials following them) // into quoteBuf. Append quoteBuf, within single quotes, when // a non-quoted element must be inserted. ...
java
{ "resource": "" }
q29407
TransliterationRule.addSourceTargetSet
train
void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet, UnicodeSet revisiting) { int limit = anteContextLength + keyLength; UnicodeSet tempSource = new UnicodeSet(); UnicodeSet temp = new UnicodeSet(); // We need to walk through the pattern. // Iff...
java
{ "resource": "" }
q29408
URLClassLoader.findResources
train
@Override public Enumeration<URL> findResources(final String name) throws IOException { if (name == null) { return null; } // On iOS, every resource is resolved by the SystemClassLoader, so // any URL in this class loader will, too. return Collections.enumeration(...
java
{ "resource": "" }
q29409
EnumSet.noneOf
train
public static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType) { Enum<?>[] universe = getUniverse(elementType); if (universe == null) throw new ClassCastException(elementType + " not an enum"); if (universe.length <= 64) return new RegularEnumSet<>(elementType...
java
{ "resource": "" }
q29410
EnumSet.allOf
train
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) { EnumSet<E> result = noneOf(elementType); result.addAll(); return result; }
java
{ "resource": "" }
q29411
EnumSet.of
train
public static <E extends Enum<E>> EnumSet<E> of(E e) { EnumSet<E> result = noneOf(e.getDeclaringClass()); result.add(e); return result; }
java
{ "resource": "" }
q29412
EnumSet.of
train
public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2) { EnumSet<E> result = noneOf(e1.getDeclaringClass()); result.add(e1); result.add(e2); return result; }
java
{ "resource": "" }
q29413
EnumSet.of
train
@SafeVarargs public static <E extends Enum<E>> EnumSet<E> of(E first, E... rest) { EnumSet<E> result = noneOf(first.getDeclaringClass()); result.add(first); for (E e : rest) result.add(e); return result; }
java
{ "resource": "" }
q29414
EnumSet.range
train
public static <E extends Enum<E>> EnumSet<E> range(E from, E to) { if (from.compareTo(to) > 0) throw new IllegalArgumentException(from + " > " + to); EnumSet<E> result = noneOf(from.getDeclaringClass()); result.addRange(from, to); return result; }
java
{ "resource": "" }
q29415
EnumSet.getUniverse
train
private static <E extends Enum<E>> E[] getUniverse(Class<E> elementType) { // Android-changed: Use JavaLangAccess directly instead of going via // SharedSecrets. return java.lang.JavaLangAccess.getEnumConstantsShared(elementType); }
java
{ "resource": "" }
q29416
Vertex.certToString
train
public String certToString() { StringBuilder sb = new StringBuilder(); X509CertImpl x509Cert = null; try { x509Cert = X509CertImpl.toImpl(cert); } catch (CertificateException ce) { if (debug != null) { debug.println("Vertex.certToString() unexpect...
java
{ "resource": "" }
q29417
Vertex.throwableToString
train
public String throwableToString() { StringBuilder sb = new StringBuilder("Exception: "); if (throwable != null) sb.append(throwable.toString()); else sb.append("null"); sb.append("\n"); return sb.toString(); }
java
{ "resource": "" }
q29418
ConstantBranchPruner.removeUnreachable
train
private boolean removeUnreachable(Block block) { List<Statement> stmts = block.getStatements(); for (int i = 0; i < stmts.size(); i++) { Statement stmt = stmts.get(i); if (stmt instanceof ReturnStatement || (stmt instanceof Block && removeUnreachable((Block) stmt))) { stmts.subList...
java
{ "resource": "" }
q29419
ConstantBranchPruner.endVisit
train
@Override public void endVisit(PrefixExpression node) { Boolean value = getReplaceableValue(node.getOperand()); if (node.getOperator() == PrefixExpression.Operator.NOT && value != null) { node.replaceWith(new BooleanLiteral(!value, typeUtil)); } }
java
{ "resource": "" }
q29420
ConstantBranchPruner.endVisit
train
@Override public void endVisit(ParenthesizedExpression node) { if (getReplaceableValue(node.getExpression()) != null) { node.replaceWith(node.getExpression().copy()); } }
java
{ "resource": "" }
q29421
ConstantBranchPruner.getKnownValue
train
private Boolean getKnownValue(Expression expr) { Object value = expr.getConstantValue(); if (value instanceof Boolean) { return (Boolean) value; } switch (expr.getKind()) { case BOOLEAN_LITERAL: return ((BooleanLiteral) expr).booleanValue(); case INFIX_EXPRESSION: { ...
java
{ "resource": "" }
q29422
ConstantBranchPruner.getSideEffects
train
private Statement getSideEffects(Expression expr) { Expression sideEffectsExpr = extractSideEffects(expr); return sideEffectsExpr == null ? null : new ExpressionStatement(sideEffectsExpr); }
java
{ "resource": "" }
q29423
ConstantBranchPruner.extractSideEffects
train
private Expression extractSideEffects(Expression expr) { if (expr.getConstantValue() instanceof Boolean) { return null; } switch (expr.getKind()) { case INFIX_EXPRESSION: { List<Expression> operands = ((InfixExpression) expr).getOperands(); Expression lastOperand = op...
java
{ "resource": "" }
q29424
OCSPResponse.initializeClockSkew
train
private static int initializeClockSkew() { // Integer tmp = java.security.AccessController.doPrivileged( // new GetIntegerAction("com.sun.security.ocsp.clockSkew")); Integer tmp = Integer.getInteger("com.sun.security.ocsp.clockSkew"); if (tmp == null || tmp < 0) { retur...
java
{ "resource": "" }
q29425
Collectors.computeFinalSum
train
static double computeFinalSum(double[] summands) { // Better error bounds to add both terms as the final sum double tmp = summands[0] + summands[1]; double simpleSum = summands[summands.length - 1]; if (Double.isNaN(tmp) && Double.isInfinite(simpleSum)) return simpleSum; ...
java
{ "resource": "" }
q29426
StringSearch.setPattern
train
public void setPattern(String pattern) { if (pattern == null || pattern.length() <= 0) { throw new IllegalArgumentException( "Pattern to search for can not be null or of length 0"); } pattern_.text_ = pattern; initialize(); }
java
{ "resource": "" }
q29427
StringSearch.getMask
train
private static int getMask(int strength) { switch (strength) { case Collator.PRIMARY: return PRIMARYORDERMASK; case Collator.SECONDARY: return SECONDARYORDERMASK | PRIMARYORDERMASK; default: return TERTIARYORDERMASK | SECONDARYORDERMASK | PRIMARYORDERM...
java
{ "resource": "" }
q29428
StringSearch.getCE
train
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_) { ...
java
{ "resource": "" }
q29429
StringSearch.initializePatternPCETable
train
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 Collation...
java
{ "resource": "" }
q29430
StringSearch.checkIdentical
train
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 = ge...
java
{ "resource": "" }
q29431
StringSearch.getString
train
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...
java
{ "resource": "" }
q29432
TimeZoneNamesImpl.addAllNamesIntoTrie
train
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().addAsMetaZoneIntoT...
java
{ "resource": "" }
q29433
TimeZoneNamesImpl.initialize
train
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-...
java
{ "resource": "" }
q29434
TimeZoneNamesImpl.loadStrings
train
private synchronized void loadStrings(String tzCanonicalID) { if (tzCanonicalID == null || tzCanonicalID.length() == 0) { return; } loadTimeZoneNames(tzCanonicalID); Set<String> mzIDs = getAvailableMetaZoneIDs(tzCanonicalID); for (String mzID : mzIDs) { l...
java
{ "resource": "" }
q29435
TimeZoneNamesImpl.loadMetaZoneNames
train
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, loa...
java
{ "resource": "" }
q29436
TimeZoneNamesImpl.loadTimeZoneNames
train
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, loa...
java
{ "resource": "" }
q29437
CollationSettings.setStrength
train
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 << ...
java
{ "resource": "" }
q29438
Buffer.completeSegmentByteCount
train
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
{ "resource": "" }
q29439
Buffer.segmentSizes
train
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
{ "resource": "" }
q29440
Provider.entrySet
train
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(); // Re...
java
{ "resource": "" }
q29441
Provider.putId
train
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().getNam...
java
{ "resource": "" }
q29442
Provider.implPutAll
train
private void implPutAll(Map t) { for (Map.Entry e : ((Map<?,?>)t).entrySet()) { implPut(e.getKey(), e.getValue()); } if (registered) { Security.increaseVersion(); } }
java
{ "resource": "" }
q29443
Provider.ensureLegacyParsed
train
private void ensureLegacyParsed() { if ((legacyChanged == false) || (legacyStrings == null)) { return; } serviceSet = null; if (legacyMap == null) { legacyMap = new LinkedHashMap<ServiceKey,Service>(); } else { legacyMap.clear(); } ...
java
{ "resource": "" }
q29444
Provider.removeInvalidServices
train
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
{ "resource": "" }
q29445
Provider.getServices
train
public synchronized Set<Service> getServices() { checkInitialized(); if (legacyChanged || servicesChanged) { serviceSet = null; } if (serviceSet == null) { ensureLegacyParsed(); Set<Service> set = new LinkedHashSet<>(); if (serviceMap != nu...
java
{ "resource": "" }
q29446
Provider.putPropertyStrings
train
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....
java
{ "resource": "" }
q29447
Provider.removePropertyStrings
train
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...
java
{ "resource": "" }
q29448
IntPipeline.asLongStream
train
@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...
java
{ "resource": "" }
q29449
IntPipeline.limit
train
@Override public final IntStream limit(long maxSize) { if (maxSize < 0) throw new IllegalArgumentException(Long.toString(maxSize)); return SliceOps.makeInt(this, 0, maxSize); }
java
{ "resource": "" }
q29450
ObjectPool.getInstanceIfFree
train
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
{ "resource": "" }
q29451
ElemWithParam.getValue
train
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...
java
{ "resource": "" }
q29452
NFRuleSet.parseRules
train
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 cur...
java
{ "resource": "" }
q29453
NFRuleSet.setNonNumericalRule
train
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(NFRu...
java
{ "resource": "" }
q29454
NFRuleSet.setBestFractionRule
train
private void setBestFractionRule(int originalIndex, NFRule newRule, boolean rememberRule) { if (rememberRule) { if (fractionRules == null) { fractionRules = new LinkedList<NFRule>(); } fractionRules.add(newRule); } NFRule bestResult = nonNumeri...
java
{ "resource": "" }
q29455
NFRuleSet.format
train
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); app...
java
{ "resource": "" }
q29456
NFRuleSet.findRule
train
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 ...
java
{ "resource": "" }
q29457
NFRuleSet.lcm
train
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; ...
java
{ "resource": "" }
q29458
Version.jarVersion
train
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 = mani...
java
{ "resource": "" }
q29459
Rewriter.endVisit
train
@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)...
java
{ "resource": "" }
q29460
ArraySet.contains
train
@Override public boolean contains(Object key) { return key == null ? (indexOfNull() >= 0) : (indexOf(key, key.hashCode()) >= 0); }
java
{ "resource": "" }
q29461
ArraySet.add
train
@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) { ret...
java
{ "resource": "" }
q29462
ArraySet.remove
train
@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
{ "resource": "" }
q29463
DateIntervalFormat.format
train
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 give...
java
{ "resource": "" }
q29464
DateIntervalFormat.format
train
public final synchronized StringBuffer format(DateInterval dtInterval, StringBuffer appendTo, FieldPosition fieldPosition) { fFromCalendar.setTimeInMillis(dtInterval.getFromDate()); fToCalendar.setTimeInMillis(dtInterval.getTo...
java
{ "resource": "" }
q29465
DateIntervalFormat.setDateIntervalInfo
train
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 ...
java
{ "resource": "" }
q29466
DateIntervalFormat.getTimeZone
train
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)(fDateForm...
java
{ "resource": "" }
q29467
DateIntervalFormat.setTimeZone
train
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 DateIntervalFor...
java
{ "resource": "" }
q29468
DateIntervalFormat.getConcatenationPattern
train
private String getConcatenationPattern(ULocale locale) { ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale); ICUResourceBundle dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns"); ICUResourceBundle concatenationPattern...
java
{ "resource": "" }
q29469
SortedSetRelation.hasRelation
train
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 // t...
java
{ "resource": "" }
q29470
ThreadLocalRandom.internalNextLong
train
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 candid...
java
{ "resource": "" }
q29471
ThreadLocalRandom.internalNextInt
train
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; ...
java
{ "resource": "" }
q29472
ThreadLocalRandom.internalNextDouble
train
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)...
java
{ "resource": "" }
q29473
Currency.getInstance
train
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(loc...
java
{ "resource": "" }
q29474
Currency.getAvailableCurrencyCodes
train
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 d...
java
{ "resource": "" }
q29475
Currency.getAvailableCurrencies
train
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...
java
{ "resource": "" }
q29476
Currency.getInstance
train
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...
java
{ "resource": "" }
q29477
Currency.registerInstance
train
public static Object registerInstance(Currency currency, ULocale locale) { return getShim().registerInstance(currency, locale); }
java
{ "resource": "" }
q29478
Currency.parse
train
@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 = ne...
java
{ "resource": "" }
q29479
Currency.getDefaultFractionDigits
train
public int getDefaultFractionDigits(CurrencyUsage Usage) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); CurrencyDigits digits = info.currencyDigits(subType, Usage); return digits.fractionDigits; }
java
{ "resource": "" }
q29480
Currency.getRoundingIncrement
train
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. //...
java
{ "resource": "" }
q29481
Currency.getTenderCurrencies
train
private static List<String> getTenderCurrencies(CurrencyFilter filter) { CurrencyMetaInfo info = CurrencyMetaInfo.getInstance(); return info.currencies(filter.withTender()); }
java
{ "resource": "" }
q29482
ExpressionVisitor.visitFunction
train
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 FuncExtFunctionAvail...
java
{ "resource": "" }
q29483
ManifestDigester.findSection
train
@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]; ...
java
{ "resource": "" }
q29484
CompactDecimalDataCache.get
train
DataBundle get(ULocale locale) { DataBundle result = cache.get(locale); if (result == null) { result = load(locale); cache.put(locale, result); } return result; }
java
{ "resource": "" }
q29485
CompactDecimalDataCache.calculateDivisor
train
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 v...
java
{ "resource": "" }
q29486
CompactDecimalDataCache.checkForOtherVariants
train
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, ...
java
{ "resource": "" }
q29487
CompactDecimalDataCache.fillInMissing
train
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] = lastDi...
java
{ "resource": "" }
q29488
CompactDecimalDataCache.getUnit
train
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
{ "resource": "" }
q29489
NamespaceMappings.lookupNamespace
train
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
{ "resource": "" }
q29490
NamespaceMappings.lookupPrefix
train
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 !=...
java
{ "resource": "" }
q29491
NamespaceMappings.popNamespace
train
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 t...
java
{ "resource": "" }
q29492
NamespaceMappings.pushNamespace
train
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 ...
java
{ "resource": "" }
q29493
NamespaceMappings.popNamespaces
train
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_de...
java
{ "resource": "" }
q29494
NamespaceMappings.createPrefixStack
train
private Stack createPrefixStack(String prefix) { Stack fs = new Stack(); m_namespaces.put(prefix, fs); return fs; }
java
{ "resource": "" }
q29495
NamespaceMappings.lookupAllPrefixes
train
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 = looku...
java
{ "resource": "" }
q29496
CharsetDetector.detect
train
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 mat...
java
{ "resource": "" }
q29497
CharsetDetector.getDetectableCharsets
train
@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 == n...
java
{ "resource": "" }
q29498
TransformerIdentityImpl.reset
train
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; ...
java
{ "resource": "" }
q29499
TransformerIdentityImpl.setParameter
train
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(na...
java
{ "resource": "" }