diff --git "a/train.csv" "b/train.csv" new file mode 100644--- /dev/null +++ "b/train.csv" @@ -0,0 +1,36050 @@ +bug_id,func_before,func_after +Compress-35," public static boolean verifyCheckSum(byte[] header) { + long storedSum = 0; + long unsignedSum = 0; + long signedSum = 0; + int digits = 0; + for (int i = 0; i < header.length; i++) { + byte b = header[i]; + if (CHKSUM_OFFSET <= i && i < CHKSUM_OFFSET + CHKSUMLEN) { + if ('0' <= b && b <= '7' && digits++ < 6) { + storedSum = storedSum * 8 + b - '0'; + } else if (digits > 0) { + digits = 6; + } + b = ' '; + } + unsignedSum += 0xff & b; + signedSum += b; + } + return storedSum == unsignedSum || storedSum == signedSum; + } +"," public static boolean verifyCheckSum(byte[] header) { + long storedSum = parseOctal(header, CHKSUM_OFFSET, CHKSUMLEN); + long unsignedSum = 0; + long signedSum = 0; + int digits = 0; + for (int i = 0; i < header.length; i++) { + byte b = header[i]; + if (CHKSUM_OFFSET <= i && i < CHKSUM_OFFSET + CHKSUMLEN) { + b = ' '; + } + unsignedSum += 0xff & b; + signedSum += b; + } + return storedSum == unsignedSum || storedSum == signedSum; + } +" +JacksonCore-21," public JsonToken nextToken() throws IOException + { + if (!_allowMultipleMatches && (_currToken != null) && (_exposedContext == null)) { + if (_currToken.isStructEnd()) { + if (_headContext.isStartHandled()) { + return (_currToken = null); + } + } else if (_currToken.isScalarValue()) { + if (!_headContext.isStartHandled() && (_itemFilter == TokenFilter.INCLUDE_ALL)) { + return (_currToken = null); + } + } + } + TokenFilterContext ctxt = _exposedContext; + if (ctxt != null) { + while (true) { + JsonToken t = ctxt.nextTokenToRead(); + if (t != null) { + _currToken = t; + return t; + } + if (ctxt == _headContext) { + _exposedContext = null; + if (ctxt.inArray()) { + t = delegate.getCurrentToken(); + _currToken = t; + return t; + } + break; + } + ctxt = _headContext.findChildOf(ctxt); + _exposedContext = ctxt; + if (ctxt == null) { + throw _constructError(""Unexpected problem: chain of filtered context broken""); + } + } + } + JsonToken t = delegate.nextToken(); + if (t == null) { + _currToken = t; + return t; + } + TokenFilter f; + switch (t.id()) { + case ID_START_ARRAY: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartArray(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildArrayContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_START_OBJECT: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartObject(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildObjectContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_END_ARRAY: + case ID_END_OBJECT: + { + boolean returnEnd = _headContext.isStartHandled(); + f = _headContext.getFilter(); + if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) { + f.filterFinishArray(); + } + _headContext = _headContext.getParent(); + _itemFilter = _headContext.getFilter(); + if (returnEnd) { + return (_currToken = t); + } + } + break; + case ID_FIELD_NAME: + { + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); + if (f == TokenFilter.INCLUDE_ALL) { + _itemFilter = f; + if (!_includePath) { + if (_includeImmediateParent && !_headContext.isStartHandled()) { + t = _headContext.nextTokenToRead(); + _exposedContext = _headContext; + } + } + return (_currToken = t); + } + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + f = f.includeProperty(name); + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + if (_includePath) { + return (_currToken = t); + } + } + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + } + default: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + return (_currToken = t); + } + if (f != null) { + f = _headContext.checkValue(f); + if ((f == TokenFilter.INCLUDE_ALL) + || ((f != null) && f.includeValue(delegate))) { + return (_currToken = t); + } + } + break; + } + return _nextToken2(); + } +"," public JsonToken nextToken() throws IOException + { + if (!_allowMultipleMatches && (_currToken != null) && (_exposedContext == null)) { + if (!_includePath) { + if (_currToken.isStructEnd()) { + if (_headContext.isStartHandled()) { + return (_currToken = null); + } + } else if (_currToken.isScalarValue()) { + if (!_headContext.isStartHandled() && (_itemFilter == TokenFilter.INCLUDE_ALL)) { + return (_currToken = null); + } + } + } + } + TokenFilterContext ctxt = _exposedContext; + if (ctxt != null) { + while (true) { + JsonToken t = ctxt.nextTokenToRead(); + if (t != null) { + _currToken = t; + return t; + } + if (ctxt == _headContext) { + _exposedContext = null; + if (ctxt.inArray()) { + t = delegate.getCurrentToken(); + _currToken = t; + return t; + } + break; + } + ctxt = _headContext.findChildOf(ctxt); + _exposedContext = ctxt; + if (ctxt == null) { + throw _constructError(""Unexpected problem: chain of filtered context broken""); + } + } + } + JsonToken t = delegate.nextToken(); + if (t == null) { + _currToken = t; + return t; + } + TokenFilter f; + switch (t.id()) { + case ID_START_ARRAY: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartArray(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildArrayContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_START_OBJECT: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartObject(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildObjectContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_END_ARRAY: + case ID_END_OBJECT: + { + boolean returnEnd = _headContext.isStartHandled(); + f = _headContext.getFilter(); + if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) { + f.filterFinishArray(); + } + _headContext = _headContext.getParent(); + _itemFilter = _headContext.getFilter(); + if (returnEnd) { + return (_currToken = t); + } + } + break; + case ID_FIELD_NAME: + { + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); + if (f == TokenFilter.INCLUDE_ALL) { + _itemFilter = f; + if (!_includePath) { + if (_includeImmediateParent && !_headContext.isStartHandled()) { + t = _headContext.nextTokenToRead(); + _exposedContext = _headContext; + } + } + return (_currToken = t); + } + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + f = f.includeProperty(name); + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + if (_includePath) { + return (_currToken = t); + } + } + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + } + default: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + return (_currToken = t); + } + if (f != null) { + f = _headContext.checkValue(f); + if ((f == TokenFilter.INCLUDE_ALL) + || ((f != null) && f.includeValue(delegate))) { + return (_currToken = t); + } + } + break; + } + return _nextToken2(); + } +" +Lang-5," public static Locale toLocale(final String str) { + if (str == null) { + return null; + } + final int len = str.length(); + if (len < 2) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + final char ch0 = str.charAt(0); + final char ch1 = str.charAt(1); + if (!Character.isLowerCase(ch0) || !Character.isLowerCase(ch1)) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 2) { + return new Locale(str); + } + if (len < 5) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (str.charAt(2) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + final char ch3 = str.charAt(3); + if (ch3 == '_') { + return new Locale(str.substring(0, 2), """", str.substring(4)); + } + final char ch4 = str.charAt(4); + if (!Character.isUpperCase(ch3) || !Character.isUpperCase(ch4)) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 5) { + return new Locale(str.substring(0, 2), str.substring(3, 5)); + } + if (len < 7) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (str.charAt(5) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6)); + } +"," public static Locale toLocale(final String str) { + if (str == null) { + return null; + } + final int len = str.length(); + if (len < 2) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + final char ch0 = str.charAt(0); + if (ch0 == '_') { + if (len < 3) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + final char ch1 = str.charAt(1); + final char ch2 = str.charAt(2); + if (!Character.isUpperCase(ch1) || !Character.isUpperCase(ch2)) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 3) { + return new Locale("""", str.substring(1, 3)); + } + if (len < 5) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (str.charAt(3) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + return new Locale("""", str.substring(1, 3), str.substring(4)); + } else { + final char ch1 = str.charAt(1); + if (!Character.isLowerCase(ch0) || !Character.isLowerCase(ch1)) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 2) { + return new Locale(str); + } + if (len < 5) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (str.charAt(2) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + final char ch3 = str.charAt(3); + if (ch3 == '_') { + return new Locale(str.substring(0, 2), """", str.substring(4)); + } + final char ch4 = str.charAt(4); + if (!Character.isUpperCase(ch3) || !Character.isUpperCase(ch4)) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 5) { + return new Locale(str.substring(0, 2), str.substring(3, 5)); + } + if (len < 7) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (str.charAt(5) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6)); + } + } +" +Codec-17," public static String newStringIso8859_1(final byte[] bytes) { + return new String(bytes, Charsets.ISO_8859_1); + } +"," public static String newStringIso8859_1(final byte[] bytes) { + return newString(bytes, Charsets.ISO_8859_1); + } +" +Compress-12," public TarArchiveEntry getNextTarEntry() throws IOException { + if (hasHitEOF) { + return null; + } + if (currEntry != null) { + long numToSkip = entrySize - entryOffset; + while (numToSkip > 0) { + long skipped = skip(numToSkip); + if (skipped <= 0) { + throw new RuntimeException(""failed to skip current tar entry""); + } + numToSkip -= skipped; + } + readBuf = null; + } + byte[] headerBuf = getRecord(); + if (hasHitEOF) { + currEntry = null; + return null; + } + currEntry = new TarArchiveEntry(headerBuf); + entryOffset = 0; + entrySize = currEntry.getSize(); + if (currEntry.isGNULongNameEntry()) { + StringBuffer longName = new StringBuffer(); + byte[] buf = new byte[SMALL_BUFFER_SIZE]; + int length = 0; + while ((length = read(buf)) >= 0) { + longName.append(new String(buf, 0, length)); + } + getNextEntry(); + if (currEntry == null) { + return null; + } + if (longName.length() > 0 + && longName.charAt(longName.length() - 1) == 0) { + longName.deleteCharAt(longName.length() - 1); + } + currEntry.setName(longName.toString()); + } + if (currEntry.isPaxHeader()){ + paxHeaders(); + } + if (currEntry.isGNUSparse()){ + readGNUSparse(); + } + entrySize = currEntry.getSize(); + return currEntry; + } +"," public TarArchiveEntry getNextTarEntry() throws IOException { + if (hasHitEOF) { + return null; + } + if (currEntry != null) { + long numToSkip = entrySize - entryOffset; + while (numToSkip > 0) { + long skipped = skip(numToSkip); + if (skipped <= 0) { + throw new RuntimeException(""failed to skip current tar entry""); + } + numToSkip -= skipped; + } + readBuf = null; + } + byte[] headerBuf = getRecord(); + if (hasHitEOF) { + currEntry = null; + return null; + } + try { + currEntry = new TarArchiveEntry(headerBuf); + } catch (IllegalArgumentException e) { + IOException ioe = new IOException(""Error detected parsing the header""); + ioe.initCause(e); + throw ioe; + } + entryOffset = 0; + entrySize = currEntry.getSize(); + if (currEntry.isGNULongNameEntry()) { + StringBuffer longName = new StringBuffer(); + byte[] buf = new byte[SMALL_BUFFER_SIZE]; + int length = 0; + while ((length = read(buf)) >= 0) { + longName.append(new String(buf, 0, length)); + } + getNextEntry(); + if (currEntry == null) { + return null; + } + if (longName.length() > 0 + && longName.charAt(longName.length() - 1) == 0) { + longName.deleteCharAt(longName.length() - 1); + } + currEntry.setName(longName.toString()); + } + if (currEntry.isPaxHeader()){ + paxHeaders(); + } + if (currEntry.isGNUSparse()){ + readGNUSparse(); + } + entrySize = currEntry.getSize(); + return currEntry; + } +" +Lang-31," public static boolean containsAny(CharSequence cs, char[] searchChars) { + if (isEmpty(cs) || ArrayUtils.isEmpty(searchChars)) { + return false; + } + int csLength = cs.length(); + int searchLength = searchChars.length; + for (int i = 0; i < csLength; i++) { + char ch = cs.charAt(i); + for (int j = 0; j < searchLength; j++) { + if (searchChars[j] == ch) { + return true; + } + } + } + return false; + } +"," public static boolean containsAny(CharSequence cs, char[] searchChars) { + if (isEmpty(cs) || ArrayUtils.isEmpty(searchChars)) { + return false; + } + int csLength = cs.length(); + int searchLength = searchChars.length; + int csLastIndex = csLength - 1; + int searchLastIndex = searchLength - 1; + for (int i = 0; i < csLength; i++) { + char ch = cs.charAt(i); + for (int j = 0; j < searchLength; j++) { + if (searchChars[j] == ch) { + if (i < csLastIndex && j < searchLastIndex && ch >= Character.MIN_HIGH_SURROGATE && ch <= Character.MAX_HIGH_SURROGATE) { + if (searchChars[j + 1] == cs.charAt(i + 1)) { + return true; + } + } else { + return true; + } + } + } + } + return false; + } +" +Closure-116," private CanInlineResult canInlineReferenceDirectly( + Node callNode, Node fnNode) { + if (!isDirectCallNodeReplacementPossible(fnNode)) { + return CanInlineResult.NO; + } + Node block = fnNode.getLastChild(); + Node cArg = callNode.getFirstChild().getNext(); + if (!callNode.getFirstChild().isName()) { + if (NodeUtil.isFunctionObjectCall(callNode)) { + if (cArg == null || !cArg.isThis()) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } else { + Preconditions.checkState(!NodeUtil.isFunctionObjectApply(callNode)); + } + } + Node fnParam = NodeUtil.getFunctionParameters(fnNode).getFirstChild(); + while (cArg != null || fnParam != null) { + if (fnParam != null) { + if (cArg != null) { + if (NodeUtil.mayEffectMutableState(cArg, compiler) + && NodeUtil.getNameReferenceCount( + block, fnParam.getString()) > 1) { + return CanInlineResult.NO; + } + } + fnParam = fnParam.getNext(); + } + if (cArg != null) { + if (NodeUtil.mayHaveSideEffects(cArg, compiler)) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } + } + return CanInlineResult.YES; + } +"," private CanInlineResult canInlineReferenceDirectly( + Node callNode, Node fnNode) { + if (!isDirectCallNodeReplacementPossible(fnNode)) { + return CanInlineResult.NO; + } + Node block = fnNode.getLastChild(); + boolean hasSideEffects = false; + if (block.hasChildren()) { + Preconditions.checkState(block.hasOneChild()); + Node stmt = block.getFirstChild(); + if (stmt.isReturn()) { + hasSideEffects = NodeUtil.mayHaveSideEffects( + stmt.getFirstChild(), compiler); + } + } + Node cArg = callNode.getFirstChild().getNext(); + if (!callNode.getFirstChild().isName()) { + if (NodeUtil.isFunctionObjectCall(callNode)) { + if (cArg == null || !cArg.isThis()) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } else { + Preconditions.checkState(!NodeUtil.isFunctionObjectApply(callNode)); + } + } + Node fnParam = NodeUtil.getFunctionParameters(fnNode).getFirstChild(); + while (cArg != null || fnParam != null) { + if (fnParam != null) { + if (cArg != null) { + if (hasSideEffects && NodeUtil.canBeSideEffected(cArg)) { + return CanInlineResult.NO; + } + if (NodeUtil.mayEffectMutableState(cArg, compiler) + && NodeUtil.getNameReferenceCount( + block, fnParam.getString()) > 1) { + return CanInlineResult.NO; + } + } + fnParam = fnParam.getNext(); + } + if (cArg != null) { + if (NodeUtil.mayHaveSideEffects(cArg, compiler)) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } + } + return CanInlineResult.YES; + } +" +Mockito-18," Object returnValueFor(Class type) { + if (Primitives.isPrimitiveOrWrapper(type)) { + return Primitives.defaultValueForPrimitiveOrWrapper(type); + } else if (type == Collection.class) { + return new LinkedList(); + } else if (type == Set.class) { + return new HashSet(); + } else if (type == HashSet.class) { + return new HashSet(); + } else if (type == SortedSet.class) { + return new TreeSet(); + } else if (type == TreeSet.class) { + return new TreeSet(); + } else if (type == LinkedHashSet.class) { + return new LinkedHashSet(); + } else if (type == List.class) { + return new LinkedList(); + } else if (type == LinkedList.class) { + return new LinkedList(); + } else if (type == ArrayList.class) { + return new ArrayList(); + } else if (type == Map.class) { + return new HashMap(); + } else if (type == HashMap.class) { + return new HashMap(); + } else if (type == SortedMap.class) { + return new TreeMap(); + } else if (type == TreeMap.class) { + return new TreeMap(); + } else if (type == LinkedHashMap.class) { + return new LinkedHashMap(); + } + return null; + } +"," Object returnValueFor(Class type) { + if (Primitives.isPrimitiveOrWrapper(type)) { + return Primitives.defaultValueForPrimitiveOrWrapper(type); + } else if (type == Iterable.class) { + return new ArrayList(0); + } else if (type == Collection.class) { + return new LinkedList(); + } else if (type == Set.class) { + return new HashSet(); + } else if (type == HashSet.class) { + return new HashSet(); + } else if (type == SortedSet.class) { + return new TreeSet(); + } else if (type == TreeSet.class) { + return new TreeSet(); + } else if (type == LinkedHashSet.class) { + return new LinkedHashSet(); + } else if (type == List.class) { + return new LinkedList(); + } else if (type == LinkedList.class) { + return new LinkedList(); + } else if (type == ArrayList.class) { + return new ArrayList(); + } else if (type == Map.class) { + return new HashMap(); + } else if (type == HashMap.class) { + return new HashMap(); + } else if (type == SortedMap.class) { + return new TreeMap(); + } else if (type == TreeMap.class) { + return new TreeMap(); + } else if (type == LinkedHashMap.class) { + return new LinkedHashMap(); + } + return null; + } +" +Time-7," public int parseInto(ReadWritableInstant instant, String text, int position) { + DateTimeParser parser = requireParser(); + if (instant == null) { + throw new IllegalArgumentException(""Instant must not be null""); + } + long instantMillis = instant.getMillis(); + Chronology chrono = instant.getChronology(); + long instantLocal = instantMillis + chrono.getZone().getOffset(instantMillis); + chrono = selectChronology(chrono); + int defaultYear = chrono.year().get(instantLocal); + DateTimeParserBucket bucket = new DateTimeParserBucket( + instantLocal, chrono, iLocale, iPivotYear, defaultYear); + int newPos = parser.parseInto(bucket, text, position); + instant.setMillis(bucket.computeMillis(false, text)); + if (iOffsetParsed && bucket.getOffsetInteger() != null) { + int parsedOffset = bucket.getOffsetInteger(); + DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); + chrono = chrono.withZone(parsedZone); + } else if (bucket.getZone() != null) { + chrono = chrono.withZone(bucket.getZone()); + } + instant.setChronology(chrono); + if (iZone != null) { + instant.setZone(iZone); + } + return newPos; + } +"," public int parseInto(ReadWritableInstant instant, String text, int position) { + DateTimeParser parser = requireParser(); + if (instant == null) { + throw new IllegalArgumentException(""Instant must not be null""); + } + long instantMillis = instant.getMillis(); + Chronology chrono = instant.getChronology(); + int defaultYear = DateTimeUtils.getChronology(chrono).year().get(instantMillis); + long instantLocal = instantMillis + chrono.getZone().getOffset(instantMillis); + chrono = selectChronology(chrono); + DateTimeParserBucket bucket = new DateTimeParserBucket( + instantLocal, chrono, iLocale, iPivotYear, defaultYear); + int newPos = parser.parseInto(bucket, text, position); + instant.setMillis(bucket.computeMillis(false, text)); + if (iOffsetParsed && bucket.getOffsetInteger() != null) { + int parsedOffset = bucket.getOffsetInteger(); + DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); + chrono = chrono.withZone(parsedZone); + } else if (bucket.getZone() != null) { + chrono = chrono.withZone(bucket.getZone()); + } + instant.setChronology(chrono); + if (iZone != null) { + instant.setZone(iZone); + } + return newPos; + } +" +Closure-18," Node parseInputs() { + boolean devMode = options.devMode != DevMode.OFF; + if (externsRoot != null) { + externsRoot.detachChildren(); + } + if (jsRoot != null) { + jsRoot.detachChildren(); + } + jsRoot = IR.block(); + jsRoot.setIsSyntheticBlock(true); + externsRoot = IR.block(); + externsRoot.setIsSyntheticBlock(true); + externAndJsRoot = IR.block(externsRoot, jsRoot); + externAndJsRoot.setIsSyntheticBlock(true); + if (options.tracer.isOn()) { + tracker = new PerformanceTracker(jsRoot, options.tracer); + addChangeHandler(tracker.getCodeChangeHandler()); + } + Tracer tracer = newTracer(""parseInputs""); + try { + for (CompilerInput input : externs) { + Node n = input.getAstRoot(this); + if (hasErrors()) { + return null; + } + externsRoot.addChildToBack(n); + } + if (options.transformAMDToCJSModules || options.processCommonJSModules) { + processAMDAndCommonJSModules(); + } + hoistExterns(externsRoot); + boolean staleInputs = false; + if (options.dependencyOptions.needsManagement() && options.closurePass) { + for (CompilerInput input : inputs) { + for (String provide : input.getProvides()) { + getTypeRegistry().forwardDeclareType(provide); + } + } + try { + inputs = + (moduleGraph == null ? new JSModuleGraph(modules) : moduleGraph) + .manageDependencies(options.dependencyOptions, inputs); + staleInputs = true; + } catch (CircularDependencyException e) { + report(JSError.make( + JSModule.CIRCULAR_DEPENDENCY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } catch (MissingProvideException e) { + report(JSError.make( + MISSING_ENTRY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } + } + hoistNoCompileFiles(); + if (staleInputs) { + repartitionInputs(); + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (devMode) { + runSanityCheck(); + if (hasErrors()) { + return null; + } + } + if (options.sourceMapOutputPath != null || + options.nameReferenceReportPath != null) { + SourceInformationAnnotator sia = + new SourceInformationAnnotator( + input.getName(), options.devMode != DevMode.OFF); + NodeTraversal.traverse(this, n, sia); + } + jsRoot.addChildToBack(n); + } + if (hasErrors()) { + return null; + } + return externAndJsRoot; + } finally { + stopTracer(tracer, ""parseInputs""); + } + } +"," Node parseInputs() { + boolean devMode = options.devMode != DevMode.OFF; + if (externsRoot != null) { + externsRoot.detachChildren(); + } + if (jsRoot != null) { + jsRoot.detachChildren(); + } + jsRoot = IR.block(); + jsRoot.setIsSyntheticBlock(true); + externsRoot = IR.block(); + externsRoot.setIsSyntheticBlock(true); + externAndJsRoot = IR.block(externsRoot, jsRoot); + externAndJsRoot.setIsSyntheticBlock(true); + if (options.tracer.isOn()) { + tracker = new PerformanceTracker(jsRoot, options.tracer); + addChangeHandler(tracker.getCodeChangeHandler()); + } + Tracer tracer = newTracer(""parseInputs""); + try { + for (CompilerInput input : externs) { + Node n = input.getAstRoot(this); + if (hasErrors()) { + return null; + } + externsRoot.addChildToBack(n); + } + if (options.transformAMDToCJSModules || options.processCommonJSModules) { + processAMDAndCommonJSModules(); + } + hoistExterns(externsRoot); + boolean staleInputs = false; + if (options.dependencyOptions.needsManagement()) { + for (CompilerInput input : inputs) { + for (String provide : input.getProvides()) { + getTypeRegistry().forwardDeclareType(provide); + } + } + try { + inputs = + (moduleGraph == null ? new JSModuleGraph(modules) : moduleGraph) + .manageDependencies(options.dependencyOptions, inputs); + staleInputs = true; + } catch (CircularDependencyException e) { + report(JSError.make( + JSModule.CIRCULAR_DEPENDENCY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } catch (MissingProvideException e) { + report(JSError.make( + MISSING_ENTRY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } + } + hoistNoCompileFiles(); + if (staleInputs) { + repartitionInputs(); + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (devMode) { + runSanityCheck(); + if (hasErrors()) { + return null; + } + } + if (options.sourceMapOutputPath != null || + options.nameReferenceReportPath != null) { + SourceInformationAnnotator sia = + new SourceInformationAnnotator( + input.getName(), options.devMode != DevMode.OFF); + NodeTraversal.traverse(this, n, sia); + } + jsRoot.addChildToBack(n); + } + if (hasErrors()) { + return null; + } + return externAndJsRoot; + } finally { + stopTracer(tracer, ""parseInputs""); + } + } +" +JacksonDatabind-17," public boolean useForType(JavaType t) + { + switch (_appliesFor) { + case NON_CONCRETE_AND_ARRAYS: + while (t.isArrayType()) { + t = t.getContentType(); + } + case OBJECT_AND_NON_CONCRETE: + return (t.getRawClass() == Object.class) + || (!t.isConcrete() + || TreeNode.class.isAssignableFrom(t.getRawClass())); + case NON_FINAL: + while (t.isArrayType()) { + t = t.getContentType(); + } + return !t.isFinal() && !TreeNode.class.isAssignableFrom(t.getRawClass()); + default: + return (t.getRawClass() == Object.class); + } + } +"," public boolean useForType(JavaType t) + { + switch (_appliesFor) { + case NON_CONCRETE_AND_ARRAYS: + while (t.isArrayType()) { + t = t.getContentType(); + } + case OBJECT_AND_NON_CONCRETE: + return (t.getRawClass() == Object.class) + || (!t.isConcrete() + && !TreeNode.class.isAssignableFrom(t.getRawClass())); + case NON_FINAL: + while (t.isArrayType()) { + t = t.getContentType(); + } + return !t.isFinal() && !TreeNode.class.isAssignableFrom(t.getRawClass()); + default: + return (t.getRawClass() == Object.class); + } + } +" +Math-52," public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2) { + double u1u1 = u1.getNormSq(); + double u2u2 = u2.getNormSq(); + double v1v1 = v1.getNormSq(); + double v2v2 = v2.getNormSq(); + if ((u1u1 == 0) || (u2u2 == 0) || (v1v1 == 0) || (v2v2 == 0)) { + throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR); + } + v1 = new Vector3D(FastMath.sqrt(u1u1 / v1v1), v1); + double u1u2 = u1.dotProduct(u2); + double v1v2 = v1.dotProduct(v2); + double coeffU = u1u2 / u1u1; + double coeffV = v1v2 / u1u1; + double beta = FastMath.sqrt((u2u2 - u1u2 * coeffU) / (v2v2 - v1v2 * coeffV)); + double alpha = coeffU - beta * coeffV; + v2 = new Vector3D(alpha, v1, beta, v2); + Vector3D uRef = u1; + Vector3D vRef = v1; + Vector3D v1Su1 = v1.subtract(u1); + Vector3D v2Su2 = v2.subtract(u2); + Vector3D k = v1Su1.crossProduct(v2Su2); + Vector3D u3 = u1.crossProduct(u2); + double c = k.dotProduct(u3); + if (c == 0) { + Vector3D v3 = Vector3D.crossProduct(v1, v2); + Vector3D v3Su3 = v3.subtract(u3); + k = v1Su1.crossProduct(v3Su3); + Vector3D u2Prime = u1.crossProduct(u3); + c = k.dotProduct(u2Prime); + if (c == 0) { + k = v2Su2.crossProduct(v3Su3);; + c = k.dotProduct(u2.crossProduct(u3));; + if (c == 0) { + q0 = 1.0; + q1 = 0.0; + q2 = 0.0; + q3 = 0.0; + return; + } + uRef = u2; + vRef = v2; + } + } + c = FastMath.sqrt(c); + double inv = 1.0 / (c + c); + q1 = inv * k.getX(); + q2 = inv * k.getY(); + q3 = inv * k.getZ(); + k = new Vector3D(uRef.getY() * q3 - uRef.getZ() * q2, + uRef.getZ() * q1 - uRef.getX() * q3, + uRef.getX() * q2 - uRef.getY() * q1); + q0 = vRef.dotProduct(k) / (2 * k.getNormSq()); + } +"," public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2) { + double u1u1 = u1.getNormSq(); + double u2u2 = u2.getNormSq(); + double v1v1 = v1.getNormSq(); + double v2v2 = v2.getNormSq(); + if ((u1u1 == 0) || (u2u2 == 0) || (v1v1 == 0) || (v2v2 == 0)) { + throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR); + } + v1 = new Vector3D(FastMath.sqrt(u1u1 / v1v1), v1); + double u1u2 = u1.dotProduct(u2); + double v1v2 = v1.dotProduct(v2); + double coeffU = u1u2 / u1u1; + double coeffV = v1v2 / u1u1; + double beta = FastMath.sqrt((u2u2 - u1u2 * coeffU) / (v2v2 - v1v2 * coeffV)); + double alpha = coeffU - beta * coeffV; + v2 = new Vector3D(alpha, v1, beta, v2); + Vector3D uRef = u1; + Vector3D vRef = v1; + Vector3D v1Su1 = v1.subtract(u1); + Vector3D v2Su2 = v2.subtract(u2); + Vector3D k = v1Su1.crossProduct(v2Su2); + Vector3D u3 = u1.crossProduct(u2); + double c = k.dotProduct(u3); + final double inPlaneThreshold = 0.001; + if (c <= inPlaneThreshold * k.getNorm() * u3.getNorm()) { + Vector3D v3 = Vector3D.crossProduct(v1, v2); + Vector3D v3Su3 = v3.subtract(u3); + k = v1Su1.crossProduct(v3Su3); + Vector3D u2Prime = u1.crossProduct(u3); + c = k.dotProduct(u2Prime); + if (c <= inPlaneThreshold * k.getNorm() * u2Prime.getNorm()) { + k = v2Su2.crossProduct(v3Su3);; + c = k.dotProduct(u2.crossProduct(u3));; + if (c <= 0) { + q0 = 1.0; + q1 = 0.0; + q2 = 0.0; + q3 = 0.0; + return; + } + uRef = u2; + vRef = v2; + } + } + c = FastMath.sqrt(c); + double inv = 1.0 / (c + c); + q1 = inv * k.getX(); + q2 = inv * k.getY(); + q3 = inv * k.getZ(); + k = new Vector3D(uRef.getY() * q3 - uRef.getZ() * q2, + uRef.getZ() * q1 - uRef.getX() * q3, + uRef.getX() * q2 - uRef.getY() * q1); + q0 = vRef.dotProduct(k) / (2 * k.getNormSq()); + } +" +Chart-8," public Week(Date time, TimeZone zone) { + this(time, RegularTimePeriod.DEFAULT_TIME_ZONE, Locale.getDefault()); + } +"," public Week(Date time, TimeZone zone) { + this(time, zone, Locale.getDefault()); + } +" +Chart-11," public static boolean equal(GeneralPath p1, GeneralPath p2) { + if (p1 == null) { + return (p2 == null); + } + if (p2 == null) { + return false; + } + if (p1.getWindingRule() != p2.getWindingRule()) { + return false; + } + PathIterator iterator1 = p1.getPathIterator(null); + PathIterator iterator2 = p1.getPathIterator(null); + double[] d1 = new double[6]; + double[] d2 = new double[6]; + boolean done = iterator1.isDone() && iterator2.isDone(); + while (!done) { + if (iterator1.isDone() != iterator2.isDone()) { + return false; + } + int seg1 = iterator1.currentSegment(d1); + int seg2 = iterator2.currentSegment(d2); + if (seg1 != seg2) { + return false; + } + if (!Arrays.equals(d1, d2)) { + return false; + } + iterator1.next(); + iterator2.next(); + done = iterator1.isDone() && iterator2.isDone(); + } + return true; + } +"," public static boolean equal(GeneralPath p1, GeneralPath p2) { + if (p1 == null) { + return (p2 == null); + } + if (p2 == null) { + return false; + } + if (p1.getWindingRule() != p2.getWindingRule()) { + return false; + } + PathIterator iterator1 = p1.getPathIterator(null); + PathIterator iterator2 = p2.getPathIterator(null); + double[] d1 = new double[6]; + double[] d2 = new double[6]; + boolean done = iterator1.isDone() && iterator2.isDone(); + while (!done) { + if (iterator1.isDone() != iterator2.isDone()) { + return false; + } + int seg1 = iterator1.currentSegment(d1); + int seg2 = iterator2.currentSegment(d2); + if (seg1 != seg2) { + return false; + } + if (!Arrays.equals(d1, d2)) { + return false; + } + iterator1.next(); + iterator2.next(); + done = iterator1.isDone() && iterator2.isDone(); + } + return true; + } +" +Closure-10," static boolean mayBeString(Node n, boolean recurse) { + if (recurse) { + return allResultsMatch(n, MAY_BE_STRING_PREDICATE); + } else { + return mayBeStringHelper(n); + } + } +"," static boolean mayBeString(Node n, boolean recurse) { + if (recurse) { + return anyResultsMatch(n, MAY_BE_STRING_PREDICATE); + } else { + return mayBeStringHelper(n); + } + } +" +Jsoup-40," public DocumentType(String name, String publicId, String systemId, String baseUri) { + super(baseUri); + Validate.notEmpty(name); + attr(""name"", name); + attr(""publicId"", publicId); + attr(""systemId"", systemId); + } +"," public DocumentType(String name, String publicId, String systemId, String baseUri) { + super(baseUri); + attr(""name"", name); + attr(""publicId"", publicId); + attr(""systemId"", systemId); + } +" +Time-24," public long computeMillis(boolean resetFields, String text) { + SavedField[] savedFields = iSavedFields; + int count = iSavedFieldsCount; + if (iSavedFieldsShared) { + iSavedFields = savedFields = (SavedField[])iSavedFields.clone(); + iSavedFieldsShared = false; + } + sort(savedFields, count); + if (count > 0) { + DurationField months = DurationFieldType.months().getField(iChrono); + DurationField days = DurationFieldType.days().getField(iChrono); + DurationField first = savedFields[0].iField.getDurationField(); + if (compareReverse(first, months) >= 0 && compareReverse(first, days) <= 0) { + saveField(DateTimeFieldType.year(), iDefaultYear); + return computeMillis(resetFields, text); + } + } + long millis = iMillis; + try { + for (int i = 0; i < count; i++) { + millis = savedFields[i].set(millis, resetFields); + } + } catch (IllegalFieldValueException e) { + if (text != null) { + e.prependMessage(""Cannot parse \"""" + text + '""'); + } + throw e; + } + if (iZone == null) { + millis -= iOffset; + } else { + int offset = iZone.getOffsetFromLocal(millis); + millis -= offset; + if (offset != iZone.getOffset(millis)) { + String message = + ""Illegal instant due to time zone offset transition ("" + iZone + ')'; + if (text != null) { + message = ""Cannot parse \"""" + text + ""\"": "" + message; + } + throw new IllegalArgumentException(message); + } + } + return millis; + } +"," public long computeMillis(boolean resetFields, String text) { + SavedField[] savedFields = iSavedFields; + int count = iSavedFieldsCount; + if (iSavedFieldsShared) { + iSavedFields = savedFields = (SavedField[])iSavedFields.clone(); + iSavedFieldsShared = false; + } + sort(savedFields, count); + if (count > 0) { + DurationField months = DurationFieldType.months().getField(iChrono); + DurationField days = DurationFieldType.days().getField(iChrono); + DurationField first = savedFields[0].iField.getDurationField(); + if (compareReverse(first, months) >= 0 && compareReverse(first, days) <= 0) { + saveField(DateTimeFieldType.year(), iDefaultYear); + return computeMillis(resetFields, text); + } + } + long millis = iMillis; + try { + for (int i = 0; i < count; i++) { + millis = savedFields[i].set(millis, resetFields); + } + if (resetFields) { + for (int i = 0; i < count; i++) { + millis = savedFields[i].set(millis, i == (count - 1)); + } + } + } catch (IllegalFieldValueException e) { + if (text != null) { + e.prependMessage(""Cannot parse \"""" + text + '""'); + } + throw e; + } + if (iZone == null) { + millis -= iOffset; + } else { + int offset = iZone.getOffsetFromLocal(millis); + millis -= offset; + if (offset != iZone.getOffset(millis)) { + String message = + ""Illegal instant due to time zone offset transition ("" + iZone + ')'; + if (text != null) { + message = ""Cannot parse \"""" + text + ""\"": "" + message; + } + throw new IllegalArgumentException(message); + } + } + return millis; + } +" +Cli-26," public static Option create(String opt) throws IllegalArgumentException + { + Option option = new Option(opt, description); + option.setLongOpt(longopt); + option.setRequired(required); + option.setOptionalArg(optionalArg); + option.setArgs(numberOfArgs); + option.setType(type); + option.setValueSeparator(valuesep); + option.setArgName(argName); + OptionBuilder.reset(); + return option; + } +"," public static Option create(String opt) throws IllegalArgumentException + { + Option option = null; + try { + option = new Option(opt, description); + option.setLongOpt(longopt); + option.setRequired(required); + option.setOptionalArg(optionalArg); + option.setArgs(numberOfArgs); + option.setType(type); + option.setValueSeparator(valuesep); + option.setArgName(argName); + } finally { + OptionBuilder.reset(); + } + return option; + } +" +Math-82," private Integer getPivotRow(final int col, final SimplexTableau tableau) { + double minRatio = Double.MAX_VALUE; + Integer minRatioPos = null; + for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) { + final double rhs = tableau.getEntry(i, tableau.getWidth() - 1); + final double entry = tableau.getEntry(i, col); + if (MathUtils.compareTo(entry, 0, epsilon) >= 0) { + final double ratio = rhs / entry; + if (ratio < minRatio) { + minRatio = ratio; + minRatioPos = i; + } + } + } + return minRatioPos; + } +"," private Integer getPivotRow(final int col, final SimplexTableau tableau) { + double minRatio = Double.MAX_VALUE; + Integer minRatioPos = null; + for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) { + final double rhs = tableau.getEntry(i, tableau.getWidth() - 1); + final double entry = tableau.getEntry(i, col); + if (MathUtils.compareTo(entry, 0, epsilon) > 0) { + final double ratio = rhs / entry; + if (ratio < minRatio) { + minRatio = ratio; + minRatioPos = i; + } + } + } + return minRatioPos; + } +" +JacksonDatabind-82," protected void addBeanProps(DeserializationContext ctxt, + BeanDescription beanDesc, BeanDeserializerBuilder builder) + throws JsonMappingException + { + final boolean isConcrete = !beanDesc.getType().isAbstract(); + final SettableBeanProperty[] creatorProps = isConcrete + ? builder.getValueInstantiator().getFromObjectArguments(ctxt.getConfig()) + : null; + final boolean hasCreatorProps = (creatorProps != null); + JsonIgnoreProperties.Value ignorals = ctxt.getConfig() + .getDefaultPropertyIgnorals(beanDesc.getBeanClass(), + beanDesc.getClassInfo()); + Set ignored; + if (ignorals != null) { + boolean ignoreAny = ignorals.getIgnoreUnknown(); + builder.setIgnoreUnknownProperties(ignoreAny); + ignored = ignorals.getIgnored(); + for (String propName : ignored) { + builder.addIgnorable(propName); + } + } else { + ignored = Collections.emptySet(); + } + AnnotatedMethod anySetterMethod = beanDesc.findAnySetter(); + AnnotatedMember anySetterField = null; + if (anySetterMethod != null) { + builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetterMethod)); + } + else { + anySetterField = beanDesc.findAnySetterField(); + if(anySetterField != null) { + builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetterField)); + } + } + if (anySetterMethod == null && anySetterField == null) { + Collection ignored2 = beanDesc.getIgnoredPropertyNames(); + if (ignored2 != null) { + for (String propName : ignored2) { + builder.addIgnorable(propName); + } + } + } + final boolean useGettersAsSetters = ctxt.isEnabled(MapperFeature.USE_GETTERS_AS_SETTERS) + && ctxt.isEnabled(MapperFeature.AUTO_DETECT_GETTERS); + List propDefs = filterBeanProps(ctxt, + beanDesc, builder, beanDesc.findProperties(), ignored); + if (_factoryConfig.hasDeserializerModifiers()) { + for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { + propDefs = mod.updateProperties(ctxt.getConfig(), beanDesc, propDefs); + } + } + for (BeanPropertyDefinition propDef : propDefs) { + SettableBeanProperty prop = null; + if (propDef.hasSetter()) { + JavaType propertyType = propDef.getSetter().getParameterType(0); + prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); + } else if (propDef.hasField()) { + JavaType propertyType = propDef.getField().getType(); + prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); + } else if (useGettersAsSetters && propDef.hasGetter()) { + AnnotatedMethod getter = propDef.getGetter(); + Class rawPropertyType = getter.getRawType(); + if (Collection.class.isAssignableFrom(rawPropertyType) + || Map.class.isAssignableFrom(rawPropertyType)) { + prop = constructSetterlessProperty(ctxt, beanDesc, propDef); + } + } + if (hasCreatorProps && propDef.hasConstructorParameter()) { + final String name = propDef.getName(); + CreatorProperty cprop = null; + if (creatorProps != null) { + for (SettableBeanProperty cp : creatorProps) { + if (name.equals(cp.getName()) && (cp instanceof CreatorProperty)) { + cprop = (CreatorProperty) cp; + break; + } + } + } + if (cprop == null) { + List n = new ArrayList<>(); + for (SettableBeanProperty cp : creatorProps) { + n.add(cp.getName()); + } + ctxt.reportBadPropertyDefinition(beanDesc, propDef, + ""Could not find creator property with name '%s' (known Creator properties: %s)"", + name, n); + continue; + } + if (prop != null) { + cprop.setFallbackSetter(prop); + } + prop = cprop; + builder.addCreatorProperty(cprop); + continue; + } + if (prop != null) { + Class[] views = propDef.findViews(); + if (views == null) { + if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) { + views = NO_VIEWS; + } + } + prop.setViews(views); + builder.addProperty(prop); + } + } + } +"," protected void addBeanProps(DeserializationContext ctxt, + BeanDescription beanDesc, BeanDeserializerBuilder builder) + throws JsonMappingException + { + final boolean isConcrete = !beanDesc.getType().isAbstract(); + final SettableBeanProperty[] creatorProps = isConcrete + ? builder.getValueInstantiator().getFromObjectArguments(ctxt.getConfig()) + : null; + final boolean hasCreatorProps = (creatorProps != null); + JsonIgnoreProperties.Value ignorals = ctxt.getConfig() + .getDefaultPropertyIgnorals(beanDesc.getBeanClass(), + beanDesc.getClassInfo()); + Set ignored; + if (ignorals != null) { + boolean ignoreAny = ignorals.getIgnoreUnknown(); + builder.setIgnoreUnknownProperties(ignoreAny); + ignored = ignorals.findIgnoredForDeserialization(); + for (String propName : ignored) { + builder.addIgnorable(propName); + } + } else { + ignored = Collections.emptySet(); + } + AnnotatedMethod anySetterMethod = beanDesc.findAnySetter(); + AnnotatedMember anySetterField = null; + if (anySetterMethod != null) { + builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetterMethod)); + } + else { + anySetterField = beanDesc.findAnySetterField(); + if(anySetterField != null) { + builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetterField)); + } + } + if (anySetterMethod == null && anySetterField == null) { + Collection ignored2 = beanDesc.getIgnoredPropertyNames(); + if (ignored2 != null) { + for (String propName : ignored2) { + builder.addIgnorable(propName); + } + } + } + final boolean useGettersAsSetters = ctxt.isEnabled(MapperFeature.USE_GETTERS_AS_SETTERS) + && ctxt.isEnabled(MapperFeature.AUTO_DETECT_GETTERS); + List propDefs = filterBeanProps(ctxt, + beanDesc, builder, beanDesc.findProperties(), ignored); + if (_factoryConfig.hasDeserializerModifiers()) { + for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { + propDefs = mod.updateProperties(ctxt.getConfig(), beanDesc, propDefs); + } + } + for (BeanPropertyDefinition propDef : propDefs) { + SettableBeanProperty prop = null; + if (propDef.hasSetter()) { + JavaType propertyType = propDef.getSetter().getParameterType(0); + prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); + } else if (propDef.hasField()) { + JavaType propertyType = propDef.getField().getType(); + prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType); + } else if (useGettersAsSetters && propDef.hasGetter()) { + AnnotatedMethod getter = propDef.getGetter(); + Class rawPropertyType = getter.getRawType(); + if (Collection.class.isAssignableFrom(rawPropertyType) + || Map.class.isAssignableFrom(rawPropertyType)) { + prop = constructSetterlessProperty(ctxt, beanDesc, propDef); + } + } + if (hasCreatorProps && propDef.hasConstructorParameter()) { + final String name = propDef.getName(); + CreatorProperty cprop = null; + if (creatorProps != null) { + for (SettableBeanProperty cp : creatorProps) { + if (name.equals(cp.getName()) && (cp instanceof CreatorProperty)) { + cprop = (CreatorProperty) cp; + break; + } + } + } + if (cprop == null) { + List n = new ArrayList<>(); + for (SettableBeanProperty cp : creatorProps) { + n.add(cp.getName()); + } + ctxt.reportBadPropertyDefinition(beanDesc, propDef, + ""Could not find creator property with name '%s' (known Creator properties: %s)"", + name, n); + continue; + } + if (prop != null) { + cprop.setFallbackSetter(prop); + } + prop = cprop; + builder.addCreatorProperty(cprop); + continue; + } + if (prop != null) { + Class[] views = propDef.findViews(); + if (views == null) { + if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) { + views = NO_VIEWS; + } + } + prop.setViews(views); + builder.addProperty(prop); + } + } + } +" +Jsoup-35," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, ""base"", ""basefont"", ""bgsound"", ""command"", ""link"", ""meta"", ""noframes"", ""script"", ""style"", ""title"")) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""center"", ""details"", ""dir"", ""div"", ""dl"", + ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""menu"", ""nav"", ""ol"", + ""p"", ""section"", ""summary"", ""ul"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""pre"", ""listing"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertForm(startTag, true); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), ""dd"", ""dt"")) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, + ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, ""area"", ""br"", ""embed"", ""img"", ""keygen"", ""wbr"")) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, ""param"", ""source"", ""track"")) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + startTag.name(""img""); + return tb.process(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), ""name"", ""action"", ""prompt"")) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(""optgroup"", ""option"")) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(""rp"", ""rt"")) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, + ""caption"", ""col"", ""colgroup"", ""frame"", ""head"", ""tbody"", ""td"", ""tfoot"", ""th"", ""thead"", ""tr"")) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""button"", ""center"", ""details"", ""dir"", ""div"", + ""dl"", ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""listing"", ""menu"", + ""nav"", ""ol"", ""pre"", ""section"", ""summary"", ""ul"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (!tb.inScope(new String[]{""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""})) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, + ""a"", ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""nobr"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + for (int si = 0; si < stack.size() && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), ""table"", ""tbody"", ""tfoot"", ""thead"", ""tr"")) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +"," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, ""base"", ""basefont"", ""bgsound"", ""command"", ""link"", ""meta"", ""noframes"", ""script"", ""style"", ""title"")) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""center"", ""details"", ""dir"", ""div"", ""dl"", + ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""menu"", ""nav"", ""ol"", + ""p"", ""section"", ""summary"", ""ul"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""pre"", ""listing"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertForm(startTag, true); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), ""dd"", ""dt"")) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, + ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, ""area"", ""br"", ""embed"", ""img"", ""keygen"", ""wbr"")) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, ""param"", ""source"", ""track"")) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + startTag.name(""img""); + return tb.process(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), ""name"", ""action"", ""prompt"")) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(""optgroup"", ""option"")) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(""rp"", ""rt"")) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, + ""caption"", ""col"", ""colgroup"", ""frame"", ""head"", ""tbody"", ""td"", ""tfoot"", ""th"", ""thead"", ""tr"")) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""button"", ""center"", ""details"", ""dir"", ""div"", + ""dl"", ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""listing"", ""menu"", + ""nav"", ""ol"", ""pre"", ""section"", ""summary"", ""ul"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (!tb.inScope(new String[]{""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""})) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, + ""a"", ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""nobr"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + for (int si = 0; si < stack.size() && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), ""table"", ""tbody"", ""tfoot"", ""thead"", ""tr"")) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + adopter.attributes().addAll(formatEl.attributes()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +" +Lang-48," public EqualsBuilder append(Object lhs, Object rhs) { + if (isEquals == false) { + return this; + } + if (lhs == rhs) { + return this; + } + if (lhs == null || rhs == null) { + this.setEquals(false); + return this; + } + Class lhsClass = lhs.getClass(); + if (!lhsClass.isArray()) { + isEquals = lhs.equals(rhs); + } else if (lhs.getClass() != rhs.getClass()) { + this.setEquals(false); + } + else if (lhs instanceof long[]) { + append((long[]) lhs, (long[]) rhs); + } else if (lhs instanceof int[]) { + append((int[]) lhs, (int[]) rhs); + } else if (lhs instanceof short[]) { + append((short[]) lhs, (short[]) rhs); + } else if (lhs instanceof char[]) { + append((char[]) lhs, (char[]) rhs); + } else if (lhs instanceof byte[]) { + append((byte[]) lhs, (byte[]) rhs); + } else if (lhs instanceof double[]) { + append((double[]) lhs, (double[]) rhs); + } else if (lhs instanceof float[]) { + append((float[]) lhs, (float[]) rhs); + } else if (lhs instanceof boolean[]) { + append((boolean[]) lhs, (boolean[]) rhs); + } else { + append((Object[]) lhs, (Object[]) rhs); + } + return this; + } +"," public EqualsBuilder append(Object lhs, Object rhs) { + if (isEquals == false) { + return this; + } + if (lhs == rhs) { + return this; + } + if (lhs == null || rhs == null) { + this.setEquals(false); + return this; + } + Class lhsClass = lhs.getClass(); + if (!lhsClass.isArray()) { + if (lhs instanceof java.math.BigDecimal) { + isEquals = (((java.math.BigDecimal)lhs).compareTo(rhs) == 0); + } else { + isEquals = lhs.equals(rhs); + } + } else if (lhs.getClass() != rhs.getClass()) { + this.setEquals(false); + } + else if (lhs instanceof long[]) { + append((long[]) lhs, (long[]) rhs); + } else if (lhs instanceof int[]) { + append((int[]) lhs, (int[]) rhs); + } else if (lhs instanceof short[]) { + append((short[]) lhs, (short[]) rhs); + } else if (lhs instanceof char[]) { + append((char[]) lhs, (char[]) rhs); + } else if (lhs instanceof byte[]) { + append((byte[]) lhs, (byte[]) rhs); + } else if (lhs instanceof double[]) { + append((double[]) lhs, (double[]) rhs); + } else if (lhs instanceof float[]) { + append((float[]) lhs, (float[]) rhs); + } else if (lhs instanceof boolean[]) { + append((boolean[]) lhs, (boolean[]) rhs); + } else { + append((Object[]) lhs, (Object[]) rhs); + } + return this; + } +" +Chart-20," public ValueMarker(double value, Paint paint, Stroke stroke, + Paint outlinePaint, Stroke outlineStroke, float alpha) { + super(paint, stroke, paint, stroke, alpha); + this.value = value; + } +"," public ValueMarker(double value, Paint paint, Stroke stroke, + Paint outlinePaint, Stroke outlineStroke, float alpha) { + super(paint, stroke, outlinePaint, outlineStroke, alpha); + this.value = value; + } +" +Lang-45," public static String abbreviate(String str, int lower, int upper, String appendToEnd) { + if (str == null) { + return null; + } + if (str.length() == 0) { + return StringUtils.EMPTY; + } + if (upper == -1 || upper > str.length()) { + upper = str.length(); + } + if (upper < lower) { + upper = lower; + } + StringBuffer result = new StringBuffer(); + int index = StringUtils.indexOf(str, "" "", lower); + if (index == -1) { + result.append(str.substring(0, upper)); + if (upper != str.length()) { + result.append(StringUtils.defaultString(appendToEnd)); + } + } else if (index > upper) { + result.append(str.substring(0, upper)); + result.append(StringUtils.defaultString(appendToEnd)); + } else { + result.append(str.substring(0, index)); + result.append(StringUtils.defaultString(appendToEnd)); + } + return result.toString(); + } +"," public static String abbreviate(String str, int lower, int upper, String appendToEnd) { + if (str == null) { + return null; + } + if (str.length() == 0) { + return StringUtils.EMPTY; + } + if (lower > str.length()) { + lower = str.length(); + } + if (upper == -1 || upper > str.length()) { + upper = str.length(); + } + if (upper < lower) { + upper = lower; + } + StringBuffer result = new StringBuffer(); + int index = StringUtils.indexOf(str, "" "", lower); + if (index == -1) { + result.append(str.substring(0, upper)); + if (upper != str.length()) { + result.append(StringUtils.defaultString(appendToEnd)); + } + } else if (index > upper) { + result.append(str.substring(0, upper)); + result.append(StringUtils.defaultString(appendToEnd)); + } else { + result.append(str.substring(0, index)); + result.append(StringUtils.defaultString(appendToEnd)); + } + return result.toString(); + } +" +Codec-7," public static String encodeBase64String(byte[] binaryData) { + return StringUtils.newStringUtf8(encodeBase64(binaryData, true)); + } +"," public static String encodeBase64String(byte[] binaryData) { + return StringUtils.newStringUtf8(encodeBase64(binaryData, false)); + } +" +Gson-2," public static TypeAdapterFactory newTypeHierarchyFactory( + final Class clazz, final TypeAdapter typeAdapter) { + return new TypeAdapterFactory() { + @SuppressWarnings(""unchecked"") + public TypeAdapter create(Gson gson, TypeToken typeToken) { + final Class requestedType = typeToken.getRawType(); + if (!clazz.isAssignableFrom(requestedType)) { + return null; + } + return (TypeAdapter) typeAdapter; + } + @Override public String toString() { + return ""Factory[typeHierarchy="" + clazz.getName() + "",adapter="" + typeAdapter + ""]""; + } + }; + } +"," public static TypeAdapterFactory newTypeHierarchyFactory( + final Class clazz, final TypeAdapter typeAdapter) { + return new TypeAdapterFactory() { + @SuppressWarnings(""unchecked"") + public TypeAdapter create(Gson gson, TypeToken typeToken) { + final Class requestedType = typeToken.getRawType(); + if (!clazz.isAssignableFrom(requestedType)) { + return null; + } + return (TypeAdapter) new TypeAdapter() { + @Override public void write(JsonWriter out, T1 value) throws IOException { + typeAdapter.write(out, value); + } + @Override public T1 read(JsonReader in) throws IOException { + T1 result = typeAdapter.read(in); + if (result != null && !requestedType.isInstance(result)) { + throw new JsonSyntaxException(""Expected a "" + requestedType.getName() + + "" but was "" + result.getClass().getName()); + } + return result; + } + }; + } + @Override public String toString() { + return ""Factory[typeHierarchy="" + clazz.getName() + "",adapter="" + typeAdapter + ""]""; + } + }; + } +" +Chart-5," public XYDataItem addOrUpdate(Number x, Number y) { + if (x == null) { + throw new IllegalArgumentException(""Null 'x' argument.""); + } + XYDataItem overwritten = null; + int index = indexOf(x); + if (index >= 0 && !this.allowDuplicateXValues) { + XYDataItem existing = (XYDataItem) this.data.get(index); + try { + overwritten = (XYDataItem) existing.clone(); + } + catch (CloneNotSupportedException e) { + throw new SeriesException(""Couldn't clone XYDataItem!""); + } + existing.setY(y); + } + else { + if (this.autoSort) { + this.data.add(-index - 1, new XYDataItem(x, y)); + } + else { + this.data.add(new XYDataItem(x, y)); + } + if (getItemCount() > this.maximumItemCount) { + this.data.remove(0); + } + } + fireSeriesChanged(); + return overwritten; + } +"," public XYDataItem addOrUpdate(Number x, Number y) { + if (x == null) { + throw new IllegalArgumentException(""Null 'x' argument.""); + } + if (this.allowDuplicateXValues) { + add(x, y); + return null; + } + XYDataItem overwritten = null; + int index = indexOf(x); + if (index >= 0) { + XYDataItem existing = (XYDataItem) this.data.get(index); + try { + overwritten = (XYDataItem) existing.clone(); + } + catch (CloneNotSupportedException e) { + throw new SeriesException(""Couldn't clone XYDataItem!""); + } + existing.setY(y); + } + else { + if (this.autoSort) { + this.data.add(-index - 1, new XYDataItem(x, y)); + } + else { + this.data.add(new XYDataItem(x, y)); + } + if (getItemCount() > this.maximumItemCount) { + this.data.remove(0); + } + } + fireSeriesChanged(); + return overwritten; + } +" +Closure-5," private boolean isInlinableObject(List refs) { + boolean ret = false; + Set validProperties = Sets.newHashSet(); + for (Reference ref : refs) { + Node name = ref.getNode(); + Node parent = ref.getParent(); + Node gramps = ref.getGrandparent(); + if (parent.isGetProp()) { + Preconditions.checkState(parent.getFirstChild() == name); + if (gramps.isCall() + && gramps.getFirstChild() == parent) { + return false; + } + String propName = parent.getLastChild().getString(); + if (!validProperties.contains(propName)) { + if (NodeUtil.isVarOrSimpleAssignLhs(parent, gramps)) { + validProperties.add(propName); + } else { + return false; + } + } + continue; + } + if (!isVarOrAssignExprLhs(name)) { + return false; + } + Node val = ref.getAssignedValue(); + if (val == null) { + continue; + } + if (!val.isObjectLit()) { + return false; + } + for (Node child = val.getFirstChild(); child != null; + child = child.getNext()) { + if (child.isGetterDef() || + child.isSetterDef()) { + return false; + } + validProperties.add(child.getString()); + Node childVal = child.getFirstChild(); + for (Reference t : refs) { + Node refNode = t.getParent(); + while (!NodeUtil.isStatementBlock(refNode)) { + if (refNode == childVal) { + return false; + } + refNode = refNode.getParent(); + } + } + } + ret = true; + } + return ret; + } +"," private boolean isInlinableObject(List refs) { + boolean ret = false; + Set validProperties = Sets.newHashSet(); + for (Reference ref : refs) { + Node name = ref.getNode(); + Node parent = ref.getParent(); + Node gramps = ref.getGrandparent(); + if (parent.isGetProp()) { + Preconditions.checkState(parent.getFirstChild() == name); + if (gramps.isCall() + && gramps.getFirstChild() == parent) { + return false; + } + if (gramps.isDelProp()) { + return false; + } + String propName = parent.getLastChild().getString(); + if (!validProperties.contains(propName)) { + if (NodeUtil.isVarOrSimpleAssignLhs(parent, gramps)) { + validProperties.add(propName); + } else { + return false; + } + } + continue; + } + if (!isVarOrAssignExprLhs(name)) { + return false; + } + Node val = ref.getAssignedValue(); + if (val == null) { + continue; + } + if (!val.isObjectLit()) { + return false; + } + for (Node child = val.getFirstChild(); child != null; + child = child.getNext()) { + if (child.isGetterDef() || + child.isSetterDef()) { + return false; + } + validProperties.add(child.getString()); + Node childVal = child.getFirstChild(); + for (Reference t : refs) { + Node refNode = t.getParent(); + while (!NodeUtil.isStatementBlock(refNode)) { + if (refNode == childVal) { + return false; + } + refNode = refNode.getParent(); + } + } + } + ret = true; + } + return ret; + } +" +Math-64," protected VectorialPointValuePair doOptimize() + throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { + solvedCols = Math.min(rows, cols); + diagR = new double[cols]; + jacNorm = new double[cols]; + beta = new double[cols]; + permutation = new int[cols]; + lmDir = new double[cols]; + double delta = 0; + double xNorm = 0; + double[] diag = new double[cols]; + double[] oldX = new double[cols]; + double[] oldRes = new double[rows]; + double[] work1 = new double[cols]; + double[] work2 = new double[cols]; + double[] work3 = new double[cols]; + updateResidualsAndCost(); + lmPar = 0; + boolean firstIteration = true; + VectorialPointValuePair current = new VectorialPointValuePair(point, objective); + while (true) { + incrementIterationsCounter(); + VectorialPointValuePair previous = current; + updateJacobian(); + qrDecomposition(); + qTy(residuals); + for (int k = 0; k < solvedCols; ++k) { + int pk = permutation[k]; + jacobian[k][pk] = diagR[pk]; + } + if (firstIteration) { + xNorm = 0; + for (int k = 0; k < cols; ++k) { + double dk = jacNorm[k]; + if (dk == 0) { + dk = 1.0; + } + double xk = dk * point[k]; + xNorm += xk * xk; + diag[k] = dk; + } + xNorm = Math.sqrt(xNorm); + delta = (xNorm == 0) ? initialStepBoundFactor : (initialStepBoundFactor * xNorm); + } + double maxCosine = 0; + if (cost != 0) { + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + double s = jacNorm[pj]; + if (s != 0) { + double sum = 0; + for (int i = 0; i <= j; ++i) { + sum += jacobian[i][pj] * residuals[i]; + } + maxCosine = Math.max(maxCosine, Math.abs(sum) / (s * cost)); + } + } + } + if (maxCosine <= orthoTolerance) { + return current; + } + for (int j = 0; j < cols; ++j) { + diag[j] = Math.max(diag[j], jacNorm[j]); + } + for (double ratio = 0; ratio < 1.0e-4;) { + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + oldX[pj] = point[pj]; + } + double previousCost = cost; + double[] tmpVec = residuals; + residuals = oldRes; + oldRes = tmpVec; + determineLMParameter(oldRes, delta, diag, work1, work2, work3); + double lmNorm = 0; + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + lmDir[pj] = -lmDir[pj]; + point[pj] = oldX[pj] + lmDir[pj]; + double s = diag[pj] * lmDir[pj]; + lmNorm += s * s; + } + lmNorm = Math.sqrt(lmNorm); + if (firstIteration) { + delta = Math.min(delta, lmNorm); + } + updateResidualsAndCost(); + current = new VectorialPointValuePair(point, objective); + double actRed = -1.0; + if (0.1 * cost < previousCost) { + double r = cost / previousCost; + actRed = 1.0 - r * r; + } + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + double dirJ = lmDir[pj]; + work1[j] = 0; + for (int i = 0; i <= j; ++i) { + work1[i] += jacobian[i][pj] * dirJ; + } + } + double coeff1 = 0; + for (int j = 0; j < solvedCols; ++j) { + coeff1 += work1[j] * work1[j]; + } + double pc2 = previousCost * previousCost; + coeff1 = coeff1 / pc2; + double coeff2 = lmPar * lmNorm * lmNorm / pc2; + double preRed = coeff1 + 2 * coeff2; + double dirDer = -(coeff1 + coeff2); + ratio = (preRed == 0) ? 0 : (actRed / preRed); + if (ratio <= 0.25) { + double tmp = + (actRed < 0) ? (0.5 * dirDer / (dirDer + 0.5 * actRed)) : 0.5; + if ((0.1 * cost >= previousCost) || (tmp < 0.1)) { + tmp = 0.1; + } + delta = tmp * Math.min(delta, 10.0 * lmNorm); + lmPar /= tmp; + } else if ((lmPar == 0) || (ratio >= 0.75)) { + delta = 2 * lmNorm; + lmPar *= 0.5; + } + if (ratio >= 1.0e-4) { + firstIteration = false; + xNorm = 0; + for (int k = 0; k < cols; ++k) { + double xK = diag[k] * point[k]; + xNorm += xK * xK; + } + xNorm = Math.sqrt(xNorm); + } else { + cost = previousCost; + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + point[pj] = oldX[pj]; + } + tmpVec = residuals; + residuals = oldRes; + oldRes = tmpVec; + } + if (checker==null) { + if (((Math.abs(actRed) <= costRelativeTolerance) && + (preRed <= costRelativeTolerance) && + (ratio <= 2.0)) || + (delta <= parRelativeTolerance * xNorm)) { + return current; + } + } else { + if (checker.converged(getIterations(), previous, current)) { + return current; + } + } + if ((Math.abs(actRed) <= 2.2204e-16) && (preRed <= 2.2204e-16) && (ratio <= 2.0)) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE, + costRelativeTolerance); + } else if (delta <= 2.2204e-16 * xNorm) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE, + parRelativeTolerance); + } else if (maxCosine <= 2.2204e-16) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE, + orthoTolerance); + } + } + } + } +"," protected VectorialPointValuePair doOptimize() + throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { + solvedCols = Math.min(rows, cols); + diagR = new double[cols]; + jacNorm = new double[cols]; + beta = new double[cols]; + permutation = new int[cols]; + lmDir = new double[cols]; + double delta = 0; + double xNorm = 0; + double[] diag = new double[cols]; + double[] oldX = new double[cols]; + double[] oldRes = new double[rows]; + double[] oldObj = new double[rows]; + double[] qtf = new double[rows]; + double[] work1 = new double[cols]; + double[] work2 = new double[cols]; + double[] work3 = new double[cols]; + updateResidualsAndCost(); + lmPar = 0; + boolean firstIteration = true; + VectorialPointValuePair current = new VectorialPointValuePair(point, objective); + while (true) { + for (int i=0;i= previousCost) || (tmp < 0.1)) { + tmp = 0.1; + } + delta = tmp * Math.min(delta, 10.0 * lmNorm); + lmPar /= tmp; + } else if ((lmPar == 0) || (ratio >= 0.75)) { + delta = 2 * lmNorm; + lmPar *= 0.5; + } + if (ratio >= 1.0e-4) { + firstIteration = false; + xNorm = 0; + for (int k = 0; k < cols; ++k) { + double xK = diag[k] * point[k]; + xNorm += xK * xK; + } + xNorm = Math.sqrt(xNorm); + current = new VectorialPointValuePair(point, objective); + if (checker != null) { + if (checker.converged(getIterations(), previous, current)) { + return current; + } + } + } else { + cost = previousCost; + for (int j = 0; j < solvedCols; ++j) { + int pj = permutation[j]; + point[pj] = oldX[pj]; + } + tmpVec = residuals; + residuals = oldRes; + oldRes = tmpVec; + tmpVec = objective; + objective = oldObj; + oldObj = tmpVec; + } + if (checker==null) { + if (((Math.abs(actRed) <= costRelativeTolerance) && + (preRed <= costRelativeTolerance) && + (ratio <= 2.0)) || + (delta <= parRelativeTolerance * xNorm)) { + return current; + } + } + if ((Math.abs(actRed) <= 2.2204e-16) && (preRed <= 2.2204e-16) && (ratio <= 2.0)) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE, + costRelativeTolerance); + } else if (delta <= 2.2204e-16 * xNorm) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE, + parRelativeTolerance); + } else if (maxCosine <= 2.2204e-16) { + throw new OptimizationException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE, + orthoTolerance); + } + } + } + } +" +Mockito-22," public static boolean areEqual(Object o1, Object o2) { + if (o1 == null || o2 == null) { + return o1 == null && o2 == null; + } else if (isArray(o1)) { + return isArray(o2) && areArraysEqual(o1, o2); + } else { + return o1.equals(o2); + } + } +"," public static boolean areEqual(Object o1, Object o2) { + if (o1 == o2 ) { + return true; + } else if (o1 == null || o2 == null) { + return o1 == null && o2 == null; + } else if (isArray(o1)) { + return isArray(o2) && areArraysEqual(o1, o2); + } else { + return o1.equals(o2); + } + } +" +JacksonXml-1," public JsonToken nextToken() throws IOException + { + _binaryValue = null; + if (_nextToken != null) { + JsonToken t = _nextToken; + _currToken = t; + _nextToken = null; + switch (t) { + case START_OBJECT: + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + break; + case START_ARRAY: + _parsingContext = _parsingContext.createChildArrayContext(-1, -1); + break; + case END_OBJECT: + case END_ARRAY: + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + break; + case FIELD_NAME: + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + break; + default: + } + return t; + } + int token = _xmlTokens.next(); + while (token == XmlTokenStream.XML_START_ELEMENT) { + if (_mayBeLeaf) { + _nextToken = JsonToken.FIELD_NAME; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + if (_parsingContext.inArray()) { + token = _xmlTokens.next(); + _mayBeLeaf = true; + continue; + } + String name = _xmlTokens.getLocalName(); + _parsingContext.setCurrentName(name); + if (_namesToWrap != null && _namesToWrap.contains(name)) { + _xmlTokens.repeatStartElement(); + } + _mayBeLeaf = true; + return (_currToken = JsonToken.FIELD_NAME); + } + switch (token) { + case XmlTokenStream.XML_END_ELEMENT: + if (_mayBeLeaf) { + _mayBeLeaf = false; + return (_currToken = JsonToken.VALUE_NULL); + } + _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY : JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + return _currToken; + case XmlTokenStream.XML_ATTRIBUTE_NAME: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _nextToken = JsonToken.FIELD_NAME; + _currText = _xmlTokens.getText(); + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + return (_currToken = JsonToken.FIELD_NAME); + case XmlTokenStream.XML_ATTRIBUTE_VALUE: + _currText = _xmlTokens.getText(); + return (_currToken = JsonToken.VALUE_STRING); + case XmlTokenStream.XML_TEXT: + _currText = _xmlTokens.getText(); + if (_mayBeLeaf) { + _mayBeLeaf = false; + _xmlTokens.skipEndElement(); + if (_parsingContext.inArray()) { + if (_isEmpty(_currText)) { + _currToken = JsonToken.END_ARRAY; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + return _currToken; + } + } + return (_currToken = JsonToken.VALUE_STRING); + } else { + if (_parsingContext.inObject() + && (_currToken != JsonToken.FIELD_NAME) && _isEmpty(_currText)) { + _currToken = JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + return _currToken; + } + } + _parsingContext.setCurrentName(_cfgNameForTextElement); + _nextToken = JsonToken.VALUE_STRING; + return (_currToken = JsonToken.FIELD_NAME); + case XmlTokenStream.XML_END: + return (_currToken = null); + } + _throwInternal(); + return null; + } +"," public JsonToken nextToken() throws IOException + { + _binaryValue = null; + if (_nextToken != null) { + JsonToken t = _nextToken; + _currToken = t; + _nextToken = null; + switch (t) { + case START_OBJECT: + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + break; + case START_ARRAY: + _parsingContext = _parsingContext.createChildArrayContext(-1, -1); + break; + case END_OBJECT: + case END_ARRAY: + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + break; + case FIELD_NAME: + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + break; + default: + } + return t; + } + int token = _xmlTokens.next(); + while (token == XmlTokenStream.XML_START_ELEMENT) { + if (_mayBeLeaf) { + _nextToken = JsonToken.FIELD_NAME; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + if (_parsingContext.inArray()) { + token = _xmlTokens.next(); + _mayBeLeaf = true; + continue; + } + String name = _xmlTokens.getLocalName(); + _parsingContext.setCurrentName(name); + if (_namesToWrap != null && _namesToWrap.contains(name)) { + _xmlTokens.repeatStartElement(); + } + _mayBeLeaf = true; + return (_currToken = JsonToken.FIELD_NAME); + } + switch (token) { + case XmlTokenStream.XML_END_ELEMENT: + if (_mayBeLeaf) { + _mayBeLeaf = false; + if (_parsingContext.inArray()) { + _nextToken = JsonToken.END_OBJECT; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + return (_currToken = JsonToken.VALUE_NULL); + } + _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY : JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + return _currToken; + case XmlTokenStream.XML_ATTRIBUTE_NAME: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _nextToken = JsonToken.FIELD_NAME; + _currText = _xmlTokens.getText(); + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + return (_currToken = JsonToken.FIELD_NAME); + case XmlTokenStream.XML_ATTRIBUTE_VALUE: + _currText = _xmlTokens.getText(); + return (_currToken = JsonToken.VALUE_STRING); + case XmlTokenStream.XML_TEXT: + _currText = _xmlTokens.getText(); + if (_mayBeLeaf) { + _mayBeLeaf = false; + _xmlTokens.skipEndElement(); + if (_parsingContext.inArray()) { + if (_isEmpty(_currText)) { + _nextToken = JsonToken.END_OBJECT; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + return (_currToken = JsonToken.START_OBJECT); + } + } + return (_currToken = JsonToken.VALUE_STRING); + } else { + if (_parsingContext.inObject() + && (_currToken != JsonToken.FIELD_NAME) && _isEmpty(_currText)) { + _currToken = JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + return _currToken; + } + } + _parsingContext.setCurrentName(_cfgNameForTextElement); + _nextToken = JsonToken.VALUE_STRING; + return (_currToken = JsonToken.FIELD_NAME); + case XmlTokenStream.XML_END: + return (_currToken = null); + } + _throwInternal(); + return null; + } +" +Gson-15," public JsonWriter value(double value) throws IOException { + writeDeferredName(); + if (Double.isNaN(value) || Double.isInfinite(value)) { + throw new IllegalArgumentException(""Numeric values must be finite, but was "" + value); + } + beforeValue(); + out.append(Double.toString(value)); + return this; + } +"," public JsonWriter value(double value) throws IOException { + writeDeferredName(); + if (!lenient && (Double.isNaN(value) || Double.isInfinite(value))) { + throw new IllegalArgumentException(""Numeric values must be finite, but was "" + value); + } + beforeValue(); + out.append(Double.toString(value)); + return this; + } +" +Math-74," public double integrate(final FirstOrderDifferentialEquations equations, + final double t0, final double[] y0, + final double t, final double[] y) + throws DerivativeException, IntegratorException { + sanityChecks(equations, t0, y0, t, y); + setEquations(equations); + resetEvaluations(); + final boolean forward = t > t0; + final int stages = c.length + 1; + if (y != y0) { + System.arraycopy(y0, 0, y, 0, y0.length); + } + final double[][] yDotK = new double[stages][y0.length]; + final double[] yTmp = new double[y0.length]; + AbstractStepInterpolator interpolator; + if (requiresDenseOutput() || (! eventsHandlersManager.isEmpty())) { + final RungeKuttaStepInterpolator rki = (RungeKuttaStepInterpolator) prototype.copy(); + rki.reinitialize(this, yTmp, yDotK, forward); + interpolator = rki; + } else { + interpolator = new DummyStepInterpolator(yTmp, forward); + } + interpolator.storeTime(t0); + stepStart = t0; + double hNew = 0; + boolean firstTime = true; + for (StepHandler handler : stepHandlers) { + handler.reset(); + } + CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager); + boolean lastStep = false; + while (!lastStep) { + interpolator.shift(); + double error = 0; + for (boolean loop = true; loop;) { + if (firstTime || !fsal) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (firstTime) { + final double[] scale; + if (vecAbsoluteTolerance == null) { + scale = new double[y0.length]; + java.util.Arrays.fill(scale, scalAbsoluteTolerance); + } else { + scale = vecAbsoluteTolerance; + } + hNew = initializeStep(equations, forward, getOrder(), scale, + stepStart, y, yDotK[0], yTmp, yDotK[1]); + firstTime = false; + } + stepSize = hNew; + for (int k = 1; k < stages; ++k) { + for (int j = 0; j < y0.length; ++j) { + double sum = a[k-1][0] * yDotK[0][j]; + for (int l = 1; l < k; ++l) { + sum += a[k-1][l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]); + } + for (int j = 0; j < y0.length; ++j) { + double sum = b[0] * yDotK[0][j]; + for (int l = 1; l < stages; ++l) { + sum += b[l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + error = estimateError(yDotK, y, yTmp, stepSize); + if (error <= 1.0) { + interpolator.storeTime(stepStart + stepSize); + if (manager.evaluateStep(interpolator)) { + final double dt = manager.getEventTime() - stepStart; + if (Math.abs(dt) <= Math.ulp(stepStart)) { + loop = false; + } else { + hNew = dt; + } + } else { + loop = false; + } + } else { + final double factor = + Math.min(maxGrowth, + Math.max(minReduction, safety * Math.pow(error, exp))); + hNew = filterStep(stepSize * factor, forward, false); + } + } + final double nextStep = stepStart + stepSize; + System.arraycopy(yTmp, 0, y, 0, y0.length); + manager.stepAccepted(nextStep, y); + lastStep = manager.stop(); + interpolator.storeTime(nextStep); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, lastStep); + } + stepStart = nextStep; + if (fsal) { + System.arraycopy(yDotK[stages - 1], 0, yDotK[0], 0, y0.length); + } + if (manager.reset(stepStart, y) && ! lastStep) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (! lastStep) { + stepSize = filterStep(stepSize, forward, true); + final double factor = Math.min(maxGrowth, + Math.max(minReduction, + safety * Math.pow(error, exp))); + final double scaledH = stepSize * factor; + final double nextT = stepStart + scaledH; + final boolean nextIsLast = forward ? (nextT >= t) : (nextT <= t); + hNew = filterStep(scaledH, forward, nextIsLast); + } + } + final double stopTime = stepStart; + resetInternalState(); + return stopTime; + } +"," public double integrate(final FirstOrderDifferentialEquations equations, + final double t0, final double[] y0, + final double t, final double[] y) + throws DerivativeException, IntegratorException { + sanityChecks(equations, t0, y0, t, y); + setEquations(equations); + resetEvaluations(); + final boolean forward = t > t0; + final int stages = c.length + 1; + if (y != y0) { + System.arraycopy(y0, 0, y, 0, y0.length); + } + final double[][] yDotK = new double[stages][y0.length]; + final double[] yTmp = new double[y0.length]; + AbstractStepInterpolator interpolator; + if (requiresDenseOutput() || (! eventsHandlersManager.isEmpty())) { + final RungeKuttaStepInterpolator rki = (RungeKuttaStepInterpolator) prototype.copy(); + rki.reinitialize(this, yTmp, yDotK, forward); + interpolator = rki; + } else { + interpolator = new DummyStepInterpolator(yTmp, forward); + } + interpolator.storeTime(t0); + stepStart = t0; + double hNew = 0; + boolean firstTime = true; + for (StepHandler handler : stepHandlers) { + handler.reset(); + } + CombinedEventsManager manager = addEndTimeChecker(t0, t, eventsHandlersManager); + boolean lastStep = false; + while (!lastStep) { + interpolator.shift(); + double error = 0; + for (boolean loop = true; loop;) { + if (firstTime || !fsal) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (firstTime) { + final double[] scale = new double[y0.length]; + if (vecAbsoluteTolerance == null) { + for (int i = 0; i < scale.length; ++i) { + scale[i] = scalAbsoluteTolerance + scalRelativeTolerance * Math.abs(y[i]); + } + } else { + for (int i = 0; i < scale.length; ++i) { + scale[i] = vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * Math.abs(y[i]); + } + } + hNew = initializeStep(equations, forward, getOrder(), scale, + stepStart, y, yDotK[0], yTmp, yDotK[1]); + firstTime = false; + } + stepSize = hNew; + for (int k = 1; k < stages; ++k) { + for (int j = 0; j < y0.length; ++j) { + double sum = a[k-1][0] * yDotK[0][j]; + for (int l = 1; l < k; ++l) { + sum += a[k-1][l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]); + } + for (int j = 0; j < y0.length; ++j) { + double sum = b[0] * yDotK[0][j]; + for (int l = 1; l < stages; ++l) { + sum += b[l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + error = estimateError(yDotK, y, yTmp, stepSize); + if (error <= 1.0) { + interpolator.storeTime(stepStart + stepSize); + if (manager.evaluateStep(interpolator)) { + final double dt = manager.getEventTime() - stepStart; + if (Math.abs(dt) <= Math.ulp(stepStart)) { + loop = false; + } else { + hNew = dt; + } + } else { + loop = false; + } + } else { + final double factor = + Math.min(maxGrowth, + Math.max(minReduction, safety * Math.pow(error, exp))); + hNew = filterStep(stepSize * factor, forward, false); + } + } + final double nextStep = stepStart + stepSize; + System.arraycopy(yTmp, 0, y, 0, y0.length); + manager.stepAccepted(nextStep, y); + lastStep = manager.stop(); + interpolator.storeTime(nextStep); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, lastStep); + } + stepStart = nextStep; + if (fsal) { + System.arraycopy(yDotK[stages - 1], 0, yDotK[0], 0, y0.length); + } + if (manager.reset(stepStart, y) && ! lastStep) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (! lastStep) { + stepSize = filterStep(stepSize, forward, true); + final double factor = Math.min(maxGrowth, + Math.max(minReduction, + safety * Math.pow(error, exp))); + final double scaledH = stepSize * factor; + final double nextT = stepStart + scaledH; + final boolean nextIsLast = forward ? (nextT >= t) : (nextT <= t); + hNew = filterStep(scaledH, forward, nextIsLast); + } + } + final double stopTime = stepStart; + resetInternalState(); + return stopTime; + } +" +Gson-11," public Number read(JsonReader in) throws IOException { + JsonToken jsonToken = in.peek(); + switch (jsonToken) { + case NULL: + in.nextNull(); + return null; + case NUMBER: + return new LazilyParsedNumber(in.nextString()); + default: + throw new JsonSyntaxException(""Expecting number, got: "" + jsonToken); + } + } +"," public Number read(JsonReader in) throws IOException { + JsonToken jsonToken = in.peek(); + switch (jsonToken) { + case NULL: + in.nextNull(); + return null; + case NUMBER: + case STRING: + return new LazilyParsedNumber(in.nextString()); + default: + throw new JsonSyntaxException(""Expecting number, got: "" + jsonToken); + } + } +" +Jsoup-15," boolean process(Token t, TreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, ""base"", ""basefont"", ""bgsound"", ""command"", ""link"", ""meta"", ""noframes"", ""style"", ""title"")) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""center"", ""details"", ""dir"", ""div"", ""dl"", + ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""menu"", ""nav"", ""ol"", + ""p"", ""section"", ""summary"", ""ul"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""pre"", ""listing"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + Element form = tb.insert(startTag); + tb.setFormElement(form); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), ""dd"", ""dt"")) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, + ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, ""area"", ""br"", ""embed"", ""img"", ""keygen"", ""wbr"")) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, ""param"", ""source"", ""track"")) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + startTag.name(""img""); + return tb.process(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), ""name"", ""action"", ""prompt"")) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + TreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(""optgroup"", ""option"")) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(""rp"", ""rt"")) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, + ""caption"", ""col"", ""colgroup"", ""frame"", ""head"", ""tbody"", ""td"", ""tfoot"", ""th"", ""thead"", ""tr"")) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""button"", ""center"", ""details"", ""dir"", ""div"", + ""dl"", ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""listing"", ""menu"", + ""nav"", ""ol"", ""pre"", ""section"", ""summary"", ""ul"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (!tb.inScope(new String[]{""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""})) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, + ""a"", ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""nobr"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + for (int si = 0; si < stack.size(); si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), ""table"", ""tbody"", ""tfoot"", ""thead"", ""tr"")) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +"," boolean process(Token t, TreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, ""base"", ""basefont"", ""bgsound"", ""command"", ""link"", ""meta"", ""noframes"", ""script"", ""style"", ""title"")) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""center"", ""details"", ""dir"", ""div"", ""dl"", + ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""menu"", ""nav"", ""ol"", + ""p"", ""section"", ""summary"", ""ul"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""pre"", ""listing"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + Element form = tb.insert(startTag); + tb.setFormElement(form); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), ""dd"", ""dt"")) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), ""address"", ""div"", ""p"")) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, + ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, ""area"", ""br"", ""embed"", ""img"", ""keygen"", ""wbr"")) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, ""param"", ""source"", ""track"")) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + startTag.name(""img""); + return tb.process(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), ""name"", ""action"", ""prompt"")) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + TreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(""optgroup"", ""option"")) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(""rp"", ""rt"")) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, + ""caption"", ""col"", ""colgroup"", ""frame"", ""head"", ""tbody"", ""td"", ""tfoot"", ""th"", ""thead"", ""tr"")) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, + ""address"", ""article"", ""aside"", ""blockquote"", ""button"", ""center"", ""details"", ""dir"", ""div"", + ""dl"", ""fieldset"", ""figcaption"", ""figure"", ""footer"", ""header"", ""hgroup"", ""listing"", ""menu"", + ""nav"", ""ol"", ""pre"", ""section"", ""summary"", ""ul"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""dd"", ""dt"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, ""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6"")) { + if (!tb.inScope(new String[]{""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""})) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(""h1"", ""h2"", ""h3"", ""h4"", ""h5"", ""h6""); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, + ""a"", ""b"", ""big"", ""code"", ""em"", ""font"", ""i"", ""nobr"", ""s"", ""small"", ""strike"", ""strong"", ""tt"", ""u"")) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + for (int si = 0; si < stack.size(); si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), ""table"", ""tbody"", ""tfoot"", ""thead"", ""tr"")) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, ""applet"", ""marquee"", ""object"")) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +" +JacksonDatabind-98," public Object complete(JsonParser p, DeserializationContext ctxt, + PropertyValueBuffer buffer, PropertyBasedCreator creator) + throws IOException + { + final int len = _properties.length; + Object[] values = new Object[len]; + for (int i = 0; i < len; ++i) { + String typeId = _typeIds[i]; + final ExtTypedProperty extProp = _properties[i]; + if (typeId == null) { + if (_tokens[i] == null) { + continue; + } + if (!extProp.hasDefaultType()) { + ctxt.reportInputMismatch(_beanType, + ""Missing external type id property '%s'"", + extProp.getTypePropertyName()); + } else { + typeId = extProp.getDefaultTypeId(); + } + } else if (_tokens[i] == null) { + SettableBeanProperty prop = extProp.getProperty(); + ctxt.reportInputMismatch(_beanType, + ""Missing property '%s' for external type id '%s'"", + prop.getName(), _properties[i].getTypePropertyName()); + } + values[i] = _deserialize(p, ctxt, i, typeId); + final SettableBeanProperty prop = extProp.getProperty(); + if (prop.getCreatorIndex() >= 0) { + buffer.assignParameter(prop, values[i]); + SettableBeanProperty typeProp = extProp.getTypeProperty(); + if ((typeProp != null) && (typeProp.getCreatorIndex() >= 0)) { + buffer.assignParameter(typeProp, typeId); + } + } + } + Object bean = creator.build(ctxt, buffer); + for (int i = 0; i < len; ++i) { + SettableBeanProperty prop = _properties[i].getProperty(); + if (prop.getCreatorIndex() < 0) { + prop.set(bean, values[i]); + } + } + return bean; + } +"," public Object complete(JsonParser p, DeserializationContext ctxt, + PropertyValueBuffer buffer, PropertyBasedCreator creator) + throws IOException + { + final int len = _properties.length; + Object[] values = new Object[len]; + for (int i = 0; i < len; ++i) { + String typeId = _typeIds[i]; + final ExtTypedProperty extProp = _properties[i]; + if (typeId == null) { + if (_tokens[i] == null) { + continue; + } + if (!extProp.hasDefaultType()) { + ctxt.reportInputMismatch(_beanType, + ""Missing external type id property '%s'"", + extProp.getTypePropertyName()); + } else { + typeId = extProp.getDefaultTypeId(); + } + } else if (_tokens[i] == null) { + SettableBeanProperty prop = extProp.getProperty(); + ctxt.reportInputMismatch(_beanType, + ""Missing property '%s' for external type id '%s'"", + prop.getName(), _properties[i].getTypePropertyName()); + } + values[i] = _deserialize(p, ctxt, i, typeId); + final SettableBeanProperty prop = extProp.getProperty(); + if (prop.getCreatorIndex() >= 0) { + buffer.assignParameter(prop, values[i]); + SettableBeanProperty typeProp = extProp.getTypeProperty(); + if ((typeProp != null) && (typeProp.getCreatorIndex() >= 0)) { + final Object v; + if (typeProp.getType().hasRawClass(String.class)) { + v = typeId; + } else { + TokenBuffer tb = new TokenBuffer(p, ctxt); + tb.writeString(typeId); + v = typeProp.getValueDeserializer().deserialize(tb.asParserOnFirstToken(), ctxt); + tb.close(); + } + buffer.assignParameter(typeProp, v); + } + } + } + Object bean = creator.build(ctxt, buffer); + for (int i = 0; i < len; ++i) { + SettableBeanProperty prop = _properties[i].getProperty(); + if (prop.getCreatorIndex() < 0) { + prop.set(bean, values[i]); + } + } + return bean; + } +" +Math-69," public RealMatrix getCorrelationPValues() throws MathException { + TDistribution tDistribution = new TDistributionImpl(nObs - 2); + int nVars = correlationMatrix.getColumnDimension(); + double[][] out = new double[nVars][nVars]; + for (int i = 0; i < nVars; i++) { + for (int j = 0; j < nVars; j++) { + if (i == j) { + out[i][j] = 0d; + } else { + double r = correlationMatrix.getEntry(i, j); + double t = Math.abs(r * Math.sqrt((nObs - 2)/(1 - r * r))); + out[i][j] = 2 * (1 - tDistribution.cumulativeProbability(t)); + } + } + } + return new BlockRealMatrix(out); + } +"," public RealMatrix getCorrelationPValues() throws MathException { + TDistribution tDistribution = new TDistributionImpl(nObs - 2); + int nVars = correlationMatrix.getColumnDimension(); + double[][] out = new double[nVars][nVars]; + for (int i = 0; i < nVars; i++) { + for (int j = 0; j < nVars; j++) { + if (i == j) { + out[i][j] = 0d; + } else { + double r = correlationMatrix.getEntry(i, j); + double t = Math.abs(r * Math.sqrt((nObs - 2)/(1 - r * r))); + out[i][j] = 2 * tDistribution.cumulativeProbability(-t); + } + } + } + return new BlockRealMatrix(out); + } +" +Csv-11," private Map initializeHeader() throws IOException { + Map hdrMap = null; + final String[] formatHeader = this.format.getHeader(); + if (formatHeader != null) { + hdrMap = new LinkedHashMap(); + String[] headerRecord = null; + if (formatHeader.length == 0) { + final CSVRecord nextRecord = this.nextRecord(); + if (nextRecord != null) { + headerRecord = nextRecord.values(); + } + } else { + if (this.format.getSkipHeaderRecord()) { + this.nextRecord(); + } + headerRecord = formatHeader; + } + if (headerRecord != null) { + for (int i = 0; i < headerRecord.length; i++) { + final String header = headerRecord[i]; + final boolean containsHeader = hdrMap.containsKey(header); + final boolean emptyHeader = header.trim().isEmpty(); + if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getIgnoreEmptyHeaders()))) { + throw new IllegalArgumentException(""The header contains a duplicate name: \"""" + header + + ""\"" in "" + Arrays.toString(headerRecord)); + } + hdrMap.put(header, Integer.valueOf(i)); + } + } + } + return hdrMap; + } +"," private Map initializeHeader() throws IOException { + Map hdrMap = null; + final String[] formatHeader = this.format.getHeader(); + if (formatHeader != null) { + hdrMap = new LinkedHashMap(); + String[] headerRecord = null; + if (formatHeader.length == 0) { + final CSVRecord nextRecord = this.nextRecord(); + if (nextRecord != null) { + headerRecord = nextRecord.values(); + } + } else { + if (this.format.getSkipHeaderRecord()) { + this.nextRecord(); + } + headerRecord = formatHeader; + } + if (headerRecord != null) { + for (int i = 0; i < headerRecord.length; i++) { + final String header = headerRecord[i]; + final boolean containsHeader = hdrMap.containsKey(header); + final boolean emptyHeader = header == null || header.trim().isEmpty(); + if (containsHeader && (!emptyHeader || (emptyHeader && !this.format.getIgnoreEmptyHeaders()))) { + throw new IllegalArgumentException(""The header contains a duplicate name: \"""" + header + + ""\"" in "" + Arrays.toString(headerRecord)); + } + hdrMap.put(header, Integer.valueOf(i)); + } + } + } + return hdrMap; + } +" +Closure-97," private Node tryFoldShift(Node n, Node left, Node right) { + if (left.getType() == Token.NUMBER && + right.getType() == Token.NUMBER) { + double result; + double lval = left.getDouble(); + double rval = right.getDouble(); + if (!(lval >= Integer.MIN_VALUE && lval <= Integer.MAX_VALUE)) { + error(BITWISE_OPERAND_OUT_OF_RANGE, left); + return n; + } + if (!(rval >= 0 && rval < 32)) { + error(SHIFT_AMOUNT_OUT_OF_BOUNDS, right); + return n; + } + int lvalInt = (int) lval; + if (lvalInt != lval) { + error(FRACTIONAL_BITWISE_OPERAND, left); + return n; + } + int rvalInt = (int) rval; + if (rvalInt != rval) { + error(FRACTIONAL_BITWISE_OPERAND, right); + return n; + } + switch (n.getType()) { + case Token.LSH: + result = lvalInt << rvalInt; + break; + case Token.RSH: + result = lvalInt >> rvalInt; + break; + case Token.URSH: + result = lvalInt >>> rvalInt; + break; + default: + throw new AssertionError(""Unknown shift operator: "" + + Node.tokenToName(n.getType())); + } + Node newNumber = Node.newNumber(result); + n.getParent().replaceChild(n, newNumber); + reportCodeChange(); + return newNumber; + } + return n; + } +"," private Node tryFoldShift(Node n, Node left, Node right) { + if (left.getType() == Token.NUMBER && + right.getType() == Token.NUMBER) { + double result; + double lval = left.getDouble(); + double rval = right.getDouble(); + if (!(lval >= Integer.MIN_VALUE && lval <= Integer.MAX_VALUE)) { + error(BITWISE_OPERAND_OUT_OF_RANGE, left); + return n; + } + if (!(rval >= 0 && rval < 32)) { + error(SHIFT_AMOUNT_OUT_OF_BOUNDS, right); + return n; + } + int lvalInt = (int) lval; + if (lvalInt != lval) { + error(FRACTIONAL_BITWISE_OPERAND, left); + return n; + } + int rvalInt = (int) rval; + if (rvalInt != rval) { + error(FRACTIONAL_BITWISE_OPERAND, right); + return n; + } + switch (n.getType()) { + case Token.LSH: + result = lvalInt << rvalInt; + break; + case Token.RSH: + result = lvalInt >> rvalInt; + break; + case Token.URSH: + long lvalLong = lvalInt & 0xffffffffL; + result = lvalLong >>> rvalInt; + break; + default: + throw new AssertionError(""Unknown shift operator: "" + + Node.tokenToName(n.getType())); + } + Node newNumber = Node.newNumber(result); + n.getParent().replaceChild(n, newNumber); + reportCodeChange(); + return newNumber; + } + return n; + } +" +Jsoup-2," private void parseStartTag() { + tq.consume(""<""); + String tagName = tq.consumeWord(); + if (tagName.length() == 0) { + tq.addFirst(""<""); + parseTextNode(); + return; + } + Attributes attributes = new Attributes(); + while (!tq.matchesAny(""<"", ""/>"", "">"") && !tq.isEmpty()) { + Attribute attribute = parseAttribute(); + if (attribute != null) + attributes.put(attribute); + } + Tag tag = Tag.valueOf(tagName); + Element child = new Element(tag, baseUri, attributes); + boolean isEmptyElement = tag.isEmpty(); + if (tq.matchChomp(""/>"")) { + isEmptyElement = true; + } else { + tq.matchChomp("">""); + } + addChildToParent(child, isEmptyElement); + if (tag.isData()) { + String data = tq.chompTo(""""); + Node dataNode; + if (tag.equals(titleTag) || tag.equals(textareaTag)) + dataNode = TextNode.createFromEncoded(data, baseUri); + else + dataNode = new DataNode(data, baseUri); + child.appendChild(dataNode); + } + if (child.tagName().equals(""base"")) { + String href = child.absUrl(""href""); + if (href.length() != 0) { + baseUri = href; + doc.setBaseUri(href); + } + } + } +"," private void parseStartTag() { + tq.consume(""<""); + String tagName = tq.consumeWord(); + if (tagName.length() == 0) { + tq.addFirst(""<""); + parseTextNode(); + return; + } + Attributes attributes = new Attributes(); + while (!tq.matchesAny(""<"", ""/>"", "">"") && !tq.isEmpty()) { + Attribute attribute = parseAttribute(); + if (attribute != null) + attributes.put(attribute); + } + Tag tag = Tag.valueOf(tagName); + Element child = new Element(tag, baseUri, attributes); + boolean isEmptyElement = tag.isEmpty(); + if (tq.matchChomp(""/>"")) { + isEmptyElement = true; + } else { + tq.matchChomp("">""); + } + addChildToParent(child, isEmptyElement); + if (tag.isData()) { + String data = tq.chompTo(""""); + popStackToClose(tag); + Node dataNode; + if (tag.equals(titleTag) || tag.equals(textareaTag)) + dataNode = TextNode.createFromEncoded(data, baseUri); + else + dataNode = new DataNode(data, baseUri); + child.appendChild(dataNode); + } + if (child.tagName().equals(""base"")) { + String href = child.absUrl(""href""); + if (href.length() != 0) { + baseUri = href; + doc.setBaseUri(href); + } + } + } +" +Jsoup-88," public String getValue() { + return val; + } +"," public String getValue() { + return Attributes.checkNotNull(val); + } +" +Jsoup-86," public XmlDeclaration asXmlDeclaration() { + String data = getData(); + Document doc = Jsoup.parse(""<"" + data.substring(1, data.length() -1) + "">"", baseUri(), Parser.xmlParser()); + XmlDeclaration decl = null; + if (doc.childNodeSize() > 0) { + Element el = doc.child(0); + decl = new XmlDeclaration(NodeUtils.parser(doc).settings().normalizeTag(el.tagName()), data.startsWith(""!"")); + decl.attributes().addAll(el.attributes()); + } + return decl; + } +"," public XmlDeclaration asXmlDeclaration() { + String data = getData(); + Document doc = Jsoup.parse(""<"" + data.substring(1, data.length() -1) + "">"", baseUri(), Parser.xmlParser()); + XmlDeclaration decl = null; + if (doc.children().size() > 0) { + Element el = doc.child(0); + decl = new XmlDeclaration(NodeUtils.parser(doc).settings().normalizeTag(el.tagName()), data.startsWith(""!"")); + decl.attributes().addAll(el.attributes()); + } + return decl; + } +" +Closure-105," void tryFoldStringJoin(NodeTraversal t, Node n, Node left, Node right, + Node parent) { + if (!NodeUtil.isGetProp(left) || !NodeUtil.isImmutableValue(right)) { + return; + } + Node arrayNode = left.getFirstChild(); + Node functionName = arrayNode.getNext(); + if ((arrayNode.getType() != Token.ARRAYLIT) || + !functionName.getString().equals(""join"")) { + return; + } + String joinString = NodeUtil.getStringValue(right); + List arrayFoldedChildren = Lists.newLinkedList(); + StringBuilder sb = new StringBuilder(); + int foldedSize = 0; + Node elem = arrayNode.getFirstChild(); + while (elem != null) { + if (NodeUtil.isImmutableValue(elem)) { + if (sb.length() > 0) { + sb.append(joinString); + } + sb.append(NodeUtil.getStringValue(elem)); + } else { + if (sb.length() > 0) { + foldedSize += sb.length() + 2; + arrayFoldedChildren.add(Node.newString(sb.toString())); + sb = new StringBuilder(); + } + foldedSize += InlineCostEstimator.getCost(elem); + arrayFoldedChildren.add(elem); + } + elem = elem.getNext(); + } + if (sb.length() > 0) { + foldedSize += sb.length() + 2; + arrayFoldedChildren.add(Node.newString(sb.toString())); + } + foldedSize += arrayFoldedChildren.size() - 1; + int originalSize = InlineCostEstimator.getCost(n); + switch (arrayFoldedChildren.size()) { + case 0: + Node emptyStringNode = Node.newString(""""); + parent.replaceChild(n, emptyStringNode); + break; + case 1: + Node foldedStringNode = arrayFoldedChildren.remove(0); + if (foldedSize > originalSize) { + return; + } + arrayNode.detachChildren(); + if (foldedStringNode.getType() != Token.STRING) { + Node replacement = new Node(Token.ADD, + Node.newString(""""), foldedStringNode); + foldedStringNode = replacement; + } + parent.replaceChild(n, foldedStringNode); + break; + default: + if (arrayFoldedChildren.size() == arrayNode.getChildCount()) { + return; + } + int kJoinOverhead = ""[].join()"".length(); + foldedSize += kJoinOverhead; + foldedSize += InlineCostEstimator.getCost(right); + if (foldedSize > originalSize) { + return; + } + arrayNode.detachChildren(); + for (Node node : arrayFoldedChildren) { + arrayNode.addChildToBack(node); + } + break; + } + t.getCompiler().reportCodeChange(); + } +"," void tryFoldStringJoin(NodeTraversal t, Node n, Node left, Node right, + Node parent) { + if (!NodeUtil.isGetProp(left) || !NodeUtil.isImmutableValue(right)) { + return; + } + Node arrayNode = left.getFirstChild(); + Node functionName = arrayNode.getNext(); + if ((arrayNode.getType() != Token.ARRAYLIT) || + !functionName.getString().equals(""join"")) { + return; + } + String joinString = NodeUtil.getStringValue(right); + List arrayFoldedChildren = Lists.newLinkedList(); + StringBuilder sb = null; + int foldedSize = 0; + Node elem = arrayNode.getFirstChild(); + while (elem != null) { + if (NodeUtil.isImmutableValue(elem)) { + if (sb == null) { + sb = new StringBuilder(); + } else { + sb.append(joinString); + } + sb.append(NodeUtil.getStringValue(elem)); + } else { + if (sb != null) { + foldedSize += sb.length() + 2; + arrayFoldedChildren.add(Node.newString(sb.toString())); + sb = null; + } + foldedSize += InlineCostEstimator.getCost(elem); + arrayFoldedChildren.add(elem); + } + elem = elem.getNext(); + } + if (sb != null) { + foldedSize += sb.length() + 2; + arrayFoldedChildren.add(Node.newString(sb.toString())); + } + foldedSize += arrayFoldedChildren.size() - 1; + int originalSize = InlineCostEstimator.getCost(n); + switch (arrayFoldedChildren.size()) { + case 0: + Node emptyStringNode = Node.newString(""""); + parent.replaceChild(n, emptyStringNode); + break; + case 1: + Node foldedStringNode = arrayFoldedChildren.remove(0); + if (foldedSize > originalSize) { + return; + } + arrayNode.detachChildren(); + if (foldedStringNode.getType() != Token.STRING) { + Node replacement = new Node(Token.ADD, + Node.newString(""""), foldedStringNode); + foldedStringNode = replacement; + } + parent.replaceChild(n, foldedStringNode); + break; + default: + if (arrayFoldedChildren.size() == arrayNode.getChildCount()) { + return; + } + int kJoinOverhead = ""[].join()"".length(); + foldedSize += kJoinOverhead; + foldedSize += InlineCostEstimator.getCost(right); + if (foldedSize > originalSize) { + return; + } + arrayNode.detachChildren(); + for (Node node : arrayFoldedChildren) { + arrayNode.addChildToBack(node); + } + break; + } + t.getCompiler().reportCodeChange(); + } +" +Compress-21," private void writeBits(final DataOutput header, final BitSet bits, final int length) throws IOException { + int cache = 0; + int shift = 7; + for (int i = 0; i < length; i++) { + cache |= ((bits.get(i) ? 1 : 0) << shift); + --shift; + if (shift == 0) { + header.write(cache); + shift = 7; + cache = 0; + } + } + if (length > 0 && shift > 0) { + header.write(cache); + } + } +"," private void writeBits(final DataOutput header, final BitSet bits, final int length) throws IOException { + int cache = 0; + int shift = 7; + for (int i = 0; i < length; i++) { + cache |= ((bits.get(i) ? 1 : 0) << shift); + if (--shift < 0) { + header.write(cache); + shift = 7; + cache = 0; + } + } + if (shift != 7) { + header.write(cache); + } + } +" +Codec-2," void encode(byte[] in, int inPos, int inAvail) { + if (eof) { + return; + } + if (inAvail < 0) { + eof = true; + if (buf == null || buf.length - pos < encodeSize) { + resizeBuf(); + } + switch (modulus) { + case 1: + buf[pos++] = encodeTable[(x >> 2) & MASK_6BITS]; + buf[pos++] = encodeTable[(x << 4) & MASK_6BITS]; + if (encodeTable == STANDARD_ENCODE_TABLE) { + buf[pos++] = PAD; + buf[pos++] = PAD; + } + break; + case 2: + buf[pos++] = encodeTable[(x >> 10) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 4) & MASK_6BITS]; + buf[pos++] = encodeTable[(x << 2) & MASK_6BITS]; + if (encodeTable == STANDARD_ENCODE_TABLE) { + buf[pos++] = PAD; + } + break; + } + if (lineLength > 0) { + System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length); + pos += lineSeparator.length; + } + } else { + for (int i = 0; i < inAvail; i++) { + if (buf == null || buf.length - pos < encodeSize) { + resizeBuf(); + } + modulus = (++modulus) % 3; + int b = in[inPos++]; + if (b < 0) { b += 256; } + x = (x << 8) + b; + if (0 == modulus) { + buf[pos++] = encodeTable[(x >> 18) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 12) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 6) & MASK_6BITS]; + buf[pos++] = encodeTable[x & MASK_6BITS]; + currentLinePos += 4; + if (lineLength > 0 && lineLength <= currentLinePos) { + System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length); + pos += lineSeparator.length; + currentLinePos = 0; + } + } + } + } + } +"," void encode(byte[] in, int inPos, int inAvail) { + if (eof) { + return; + } + if (inAvail < 0) { + eof = true; + if (buf == null || buf.length - pos < encodeSize) { + resizeBuf(); + } + switch (modulus) { + case 1: + buf[pos++] = encodeTable[(x >> 2) & MASK_6BITS]; + buf[pos++] = encodeTable[(x << 4) & MASK_6BITS]; + if (encodeTable == STANDARD_ENCODE_TABLE) { + buf[pos++] = PAD; + buf[pos++] = PAD; + } + break; + case 2: + buf[pos++] = encodeTable[(x >> 10) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 4) & MASK_6BITS]; + buf[pos++] = encodeTable[(x << 2) & MASK_6BITS]; + if (encodeTable == STANDARD_ENCODE_TABLE) { + buf[pos++] = PAD; + } + break; + } + if (lineLength > 0 && pos > 0) { + System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length); + pos += lineSeparator.length; + } + } else { + for (int i = 0; i < inAvail; i++) { + if (buf == null || buf.length - pos < encodeSize) { + resizeBuf(); + } + modulus = (++modulus) % 3; + int b = in[inPos++]; + if (b < 0) { b += 256; } + x = (x << 8) + b; + if (0 == modulus) { + buf[pos++] = encodeTable[(x >> 18) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 12) & MASK_6BITS]; + buf[pos++] = encodeTable[(x >> 6) & MASK_6BITS]; + buf[pos++] = encodeTable[x & MASK_6BITS]; + currentLinePos += 4; + if (lineLength > 0 && lineLength <= currentLinePos) { + System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length); + pos += lineSeparator.length; + currentLinePos = 0; + } + } + } + } + } +" +JacksonDatabind-76," protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, + DeserializationContext ctxt) + throws IOException, JsonProcessingException + { + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p, ctxt); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + if (buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt))) { + t = p.nextToken(); + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); + continue; + } + while (t == JsonToken.FIELD_NAME) { + p.nextToken(); + tokens.copyCurrentStructure(p); + t = p.nextToken(); + } + tokens.writeEndObject(); + if (bean.getClass() != _beanType.getRawClass()) { + ctxt.reportMappingException(""Can not create polymorphic instances with unwrapped values""); + return null; + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + tokens.writeFieldName(propName); + tokens.copyCurrentStructure(p); + if (_anySetter != null) { + buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); + } + } + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + return wrapInstantiationProblem(e, ctxt); + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } +"," protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, + DeserializationContext ctxt) + throws IOException, JsonProcessingException + { + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p, ctxt); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + buffer.assignParameter(creatorProp, creatorProp.deserialize(p, ctxt)); + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + tokens.writeFieldName(propName); + tokens.copyCurrentStructure(p); + if (_anySetter != null) { + buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); + } + } + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + return wrapInstantiationProblem(e, ctxt); + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } +" +Mockito-20," public T createMock(MockCreationSettings settings, MockHandler handler) { + if (settings.getSerializableMode() == SerializableMode.ACROSS_CLASSLOADERS) { + throw new MockitoException(""Serialization across classloaders not yet supported with ByteBuddyMockMaker""); + } + Class mockedProxyType = cachingMockBytecodeGenerator.get( + settings.getTypeToMock(), + settings.getExtraInterfaces() + ); + T mockInstance = null; + try { + mockInstance = classInstantiator.instantiate(mockedProxyType); + MockMethodInterceptor.MockAccess mockAccess = (MockMethodInterceptor.MockAccess) mockInstance; + mockAccess.setMockitoInterceptor(new MockMethodInterceptor(asInternalMockHandler(handler), settings)); + return ensureMockIsAssignableToMockedType(settings, mockInstance); + } catch (ClassCastException cce) { + throw new MockitoException(join( + ""ClassCastException occurred while creating the mockito mock :"", + "" class to mock : "" + describeClass(mockedProxyType), + "" created class : "" + describeClass(settings.getTypeToMock()), + "" proxy instance class : "" + describeClass(mockInstance), + "" instance creation by : "" + classInstantiator.getClass().getSimpleName(), + """", + ""You might experience classloading issues, please ask the mockito mailing-list."", + """" + ),cce); + } catch (org.mockito.internal.creation.instance.InstantiationException e) { + throw new MockitoException(""Unable to create mock instance of type '"" + mockedProxyType.getSuperclass().getSimpleName() + ""'"", e); + } + } +"," public T createMock(MockCreationSettings settings, MockHandler handler) { + if (settings.getSerializableMode() == SerializableMode.ACROSS_CLASSLOADERS) { + throw new MockitoException(""Serialization across classloaders not yet supported with ByteBuddyMockMaker""); + } + Class mockedProxyType = cachingMockBytecodeGenerator.get( + settings.getTypeToMock(), + settings.getExtraInterfaces() + ); + Instantiator instantiator = new InstantiatorProvider().getInstantiator(settings); + T mockInstance = null; + try { + mockInstance = instantiator.newInstance(mockedProxyType); + MockMethodInterceptor.MockAccess mockAccess = (MockMethodInterceptor.MockAccess) mockInstance; + mockAccess.setMockitoInterceptor(new MockMethodInterceptor(asInternalMockHandler(handler), settings)); + return ensureMockIsAssignableToMockedType(settings, mockInstance); + } catch (ClassCastException cce) { + throw new MockitoException(join( + ""ClassCastException occurred while creating the mockito mock :"", + "" class to mock : "" + describeClass(mockedProxyType), + "" created class : "" + describeClass(settings.getTypeToMock()), + "" proxy instance class : "" + describeClass(mockInstance), + "" instance creation by : "" + instantiator.getClass().getSimpleName(), + """", + ""You might experience classloading issues, please ask the mockito mailing-list."", + """" + ),cce); + } catch (org.mockito.internal.creation.instance.InstantiationException e) { + throw new MockitoException(""Unable to create mock instance of type '"" + mockedProxyType.getSuperclass().getSimpleName() + ""'"", e); + } + } +" +Jsoup-39," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset; + if (meta.hasAttr(""http-equiv"")) { + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + if (foundCharset == null && meta.hasAttr(""charset"")) { + try { + if (Charset.isSupported(meta.attr(""charset""))) { + foundCharset = meta.attr(""charset""); + } + } catch (IllegalCharsetNameException e) { + foundCharset = null; + } + } + } else { + foundCharset = meta.attr(""charset""); + } + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (docData.length() > 0 && docData.charAt(0) == 65279) { + byteData.rewind(); + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + docData = docData.substring(1); + charsetName = defaultCharset; + } + if (doc == null) { + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +"," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset; + if (meta.hasAttr(""http-equiv"")) { + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + if (foundCharset == null && meta.hasAttr(""charset"")) { + try { + if (Charset.isSupported(meta.attr(""charset""))) { + foundCharset = meta.attr(""charset""); + } + } catch (IllegalCharsetNameException e) { + foundCharset = null; + } + } + } else { + foundCharset = meta.attr(""charset""); + } + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (docData.length() > 0 && docData.charAt(0) == 65279) { + byteData.rewind(); + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + docData = docData.substring(1); + charsetName = defaultCharset; + doc = null; + } + if (doc == null) { + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +" +Jsoup-90," private static boolean looksLikeUtf8(byte[] input) { + int i = 0; + if (input.length >= 3 && (input[0] & 0xFF) == 0xEF + && (input[1] & 0xFF) == 0xBB & (input[2] & 0xFF) == 0xBF) { + i = 3; + } + int end; + for (int j = input.length; i < j; ++i) { + int o = input[i]; + if ((o & 0x80) == 0) { + continue; + } + if ((o & 0xE0) == 0xC0) { + end = i + 1; + } else if ((o & 0xF0) == 0xE0) { + end = i + 2; + } else if ((o & 0xF8) == 0xF0) { + end = i + 3; + } else { + return false; + } + while (i < end) { + i++; + o = input[i]; + if ((o & 0xC0) != 0x80) { + return false; + } + } + } + return true; + } +"," private static boolean looksLikeUtf8(byte[] input) { + int i = 0; + if (input.length >= 3 && (input[0] & 0xFF) == 0xEF + && (input[1] & 0xFF) == 0xBB & (input[2] & 0xFF) == 0xBF) { + i = 3; + } + int end; + for (int j = input.length; i < j; ++i) { + int o = input[i]; + if ((o & 0x80) == 0) { + continue; + } + if ((o & 0xE0) == 0xC0) { + end = i + 1; + } else if ((o & 0xF0) == 0xE0) { + end = i + 2; + } else if ((o & 0xF8) == 0xF0) { + end = i + 3; + } else { + return false; + } + if (end >= input.length) + return false; + while (i < end) { + i++; + o = input[i]; + if ((o & 0xC0) != 0x80) { + return false; + } + } + } + return true; + } +" +Time-5," public Period normalizedStandard(PeriodType type) { + type = DateTimeUtils.getPeriodType(type); + long millis = getMillis(); + millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND)); + millis += (((long) getMinutes()) * ((long) DateTimeConstants.MILLIS_PER_MINUTE)); + millis += (((long) getHours()) * ((long) DateTimeConstants.MILLIS_PER_HOUR)); + millis += (((long) getDays()) * ((long) DateTimeConstants.MILLIS_PER_DAY)); + millis += (((long) getWeeks()) * ((long) DateTimeConstants.MILLIS_PER_WEEK)); + Period result = new Period(millis, type, ISOChronology.getInstanceUTC()); + int years = getYears(); + int months = getMonths(); + if (years != 0 || months != 0) { + years = FieldUtils.safeAdd(years, months / 12); + months = months % 12; + if (years != 0) { + result = result.withYears(years); + } + if (months != 0) { + result = result.withMonths(months); + } + } + return result; + } +"," public Period normalizedStandard(PeriodType type) { + type = DateTimeUtils.getPeriodType(type); + long millis = getMillis(); + millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND)); + millis += (((long) getMinutes()) * ((long) DateTimeConstants.MILLIS_PER_MINUTE)); + millis += (((long) getHours()) * ((long) DateTimeConstants.MILLIS_PER_HOUR)); + millis += (((long) getDays()) * ((long) DateTimeConstants.MILLIS_PER_DAY)); + millis += (((long) getWeeks()) * ((long) DateTimeConstants.MILLIS_PER_WEEK)); + Period result = new Period(millis, type, ISOChronology.getInstanceUTC()); + int years = getYears(); + int months = getMonths(); + if (years != 0 || months != 0) { + long totalMonths = years * 12L + months; + if (type.isSupported(DurationFieldType.YEARS_TYPE)) { + int normalizedYears = FieldUtils.safeToInt(totalMonths / 12); + result = result.withYears(normalizedYears); + totalMonths = totalMonths - (normalizedYears * 12); + } + if (type.isSupported(DurationFieldType.MONTHS_TYPE)) { + int normalizedMonths = FieldUtils.safeToInt(totalMonths); + result = result.withMonths(normalizedMonths); + totalMonths = totalMonths - normalizedMonths; + } + if (totalMonths != 0) { + throw new UnsupportedOperationException(""Unable to normalize as PeriodType is missing either years or months but period has a month/year amount: "" + toString()); + } + } + return result; + } +" +Mockito-5," public void verify(VerificationData data) { + AssertionError error = null; + timer.start(); + while (timer.isCounting()) { + try { + delegate.verify(data); + if (returnOnSuccess) { + return; + } else { + error = null; + } + } catch (MockitoAssertionError e) { + error = handleVerifyException(e); + } + catch (org.mockito.exceptions.verification.junit.ArgumentsAreDifferent e) { + error = handleVerifyException(e); + } + } + if (error != null) { + throw error; + } + } +"," public void verify(VerificationData data) { + AssertionError error = null; + timer.start(); + while (timer.isCounting()) { + try { + delegate.verify(data); + if (returnOnSuccess) { + return; + } else { + error = null; + } + } catch (MockitoAssertionError e) { + error = handleVerifyException(e); + } + catch (AssertionError e) { + error = handleVerifyException(e); + } + } + if (error != null) { + throw error; + } + } +" +Lang-17," public final void translate(CharSequence input, Writer out) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (input == null) { + return; + } + int pos = 0; + int len = Character.codePointCount(input, 0, input.length()); + while (pos < len) { + int consumed = translate(input, pos, out); + if (consumed == 0) { + char[] c = Character.toChars(Character.codePointAt(input, pos)); + out.write(c); + } + else { + for (int pt = 0; pt < consumed; pt++) { + if (pos < len - 2) { + pos += Character.charCount(Character.codePointAt(input, pos)); + } else { + pos++; + } + } + pos--; + } + pos++; + } + } +"," public final void translate(CharSequence input, Writer out) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (input == null) { + return; + } + int pos = 0; + int len = input.length(); + while (pos < len) { + int consumed = translate(input, pos, out); + if (consumed == 0) { + char[] c = Character.toChars(Character.codePointAt(input, pos)); + out.write(c); + pos+= c.length; + continue; + } + for (int pt = 0; pt < consumed; pt++) { + pos += Character.charCount(Character.codePointAt(input, pos)); + } + } + } +" +Compress-1," public void close() throws IOException { + if (!this.closed) { + super.close(); + this.closed = true; + } + } +"," public void close() throws IOException { + if (!this.closed) { + this.finish(); + super.close(); + this.closed = true; + } + } +" +Closure-22," public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isEmpty() || + n.isComma()) { + return; + } + if (parent == null) { + return; + } + if (parent.getType() == Token.COMMA) { + Node gramps = parent.getParent(); + if (gramps.isCall() && parent == gramps.getFirstChild()) { + if (n == parent.getFirstChild() && parent.getChildCount() == 2 && n.getNext().isName() && ""eval"".equals(n.getNext().getString())) { + return; + } + } + if (n == parent.getLastChild()) { + for (Node an : parent.getAncestors()) { + int ancestorType = an.getType(); + if (ancestorType == Token.COMMA) + continue; + if (ancestorType != Token.EXPR_RESULT && ancestorType != Token.BLOCK) + return; + else + break; + } + } + } else if (parent.getType() != Token.EXPR_RESULT && parent.getType() != Token.BLOCK) { + if (parent.getType() == Token.FOR && parent.getChildCount() == 4 && (n == parent.getFirstChild() || + n == parent.getFirstChild().getNext().getNext())) { + } else { + return; + } + } + boolean isResultUsed = NodeUtil.isExpressionResultUsed(n); + boolean isSimpleOp = NodeUtil.isSimpleOperatorType(n.getType()); + if (!isResultUsed && + (isSimpleOp || !NodeUtil.mayHaveSideEffects(n, t.getCompiler()))) { + if (n.isQualifiedName() && n.getJSDocInfo() != null) { + return; + } else if (n.isExprResult()) { + return; + } + String msg = ""This code lacks side-effects. Is there a bug?""; + if (n.isString()) { + msg = ""Is there a missing '+' on the previous line?""; + } else if (isSimpleOp) { + msg = ""The result of the '"" + Token.name(n.getType()).toLowerCase() + + ""' operator is not being used.""; + } + t.getCompiler().report( + t.makeError(n, level, USELESS_CODE_ERROR, msg)); + if (!NodeUtil.isStatement(n)) { + problemNodes.add(n); + } + } + } +"," public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isEmpty() || + n.isComma()) { + return; + } + if (parent == null) { + return; + } + if (n.isExprResult() || n.isBlock()) { + return; + } + if (n.isQualifiedName() && n.getJSDocInfo() != null) { + return; + } + boolean isResultUsed = NodeUtil.isExpressionResultUsed(n); + boolean isSimpleOp = NodeUtil.isSimpleOperatorType(n.getType()); + if (!isResultUsed && + (isSimpleOp || !NodeUtil.mayHaveSideEffects(n, t.getCompiler()))) { + String msg = ""This code lacks side-effects. Is there a bug?""; + if (n.isString()) { + msg = ""Is there a missing '+' on the previous line?""; + } else if (isSimpleOp) { + msg = ""The result of the '"" + Token.name(n.getType()).toLowerCase() + + ""' operator is not being used.""; + } + t.getCompiler().report( + t.makeError(n, level, USELESS_CODE_ERROR, msg)); + if (!NodeUtil.isStatement(n)) { + problemNodes.add(n); + } + } + } +" +JacksonCore-25," private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException + { + _textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr)); + char[] outBuf = _textBuffer.getCurrentSegment(); + int outPtr = _textBuffer.getCurrentSegmentSize(); + final int maxCode = codes.length; + while (true) { + if (_inputPtr >= _inputEnd) { + if (!_loadMore()) { + break; + } + } + char c = _inputBuffer[_inputPtr]; + int i = (int) c; + if (i <= maxCode) { + if (codes[i] != 0) { + break; + } + } else if (!Character.isJavaIdentifierPart(c)) { + break; + } + ++_inputPtr; + hash = (hash * CharsToNameCanonicalizer.HASH_MULT) + i; + outBuf[outPtr++] = c; + if (outPtr >= outBuf.length) { + outBuf = _textBuffer.finishCurrentSegment(); + outPtr = 0; + } + } + _textBuffer.setCurrentLength(outPtr); + { + TextBuffer tb = _textBuffer; + char[] buf = tb.getTextBuffer(); + int start = tb.getTextOffset(); + int len = tb.size(); + return _symbols.findSymbol(buf, start, len, hash); + } + } +"," private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException + { + _textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr)); + char[] outBuf = _textBuffer.getCurrentSegment(); + int outPtr = _textBuffer.getCurrentSegmentSize(); + final int maxCode = codes.length; + while (true) { + if (_inputPtr >= _inputEnd) { + if (!_loadMore()) { + break; + } + } + char c = _inputBuffer[_inputPtr]; + int i = (int) c; + if (i < maxCode) { + if (codes[i] != 0) { + break; + } + } else if (!Character.isJavaIdentifierPart(c)) { + break; + } + ++_inputPtr; + hash = (hash * CharsToNameCanonicalizer.HASH_MULT) + i; + outBuf[outPtr++] = c; + if (outPtr >= outBuf.length) { + outBuf = _textBuffer.finishCurrentSegment(); + outPtr = 0; + } + } + _textBuffer.setCurrentLength(outPtr); + { + TextBuffer tb = _textBuffer; + char[] buf = tb.getTextBuffer(); + int start = tb.getTextOffset(); + int len = tb.size(); + return _symbols.findSymbol(buf, start, len, hash); + } + } +" +Lang-44," public static Number createNumber(String val) throws NumberFormatException { + if (val == null) { + return null; + } + if (val.length() == 0) { + throw new NumberFormatException(""\""\"" is not a valid number.""); + } + if (val.startsWith(""--"")) { + return null; + } + if (val.startsWith(""0x"") || val.startsWith(""-0x"")) { + return createInteger(val); + } + char lastChar = val.charAt(val.length() - 1); + String mant; + String dec; + String exp; + int decPos = val.indexOf('.'); + int expPos = val.indexOf('e') + val.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos) { + throw new NumberFormatException(val + "" is not a valid number.""); + } + dec = val.substring(decPos + 1, expPos); + } else { + dec = val.substring(decPos + 1); + } + mant = val.substring(0, decPos); + } else { + if (expPos > -1) { + mant = val.substring(0, expPos); + } else { + mant = val; + } + dec = null; + } + if (!Character.isDigit(lastChar)) { + if (expPos > -1 && expPos < val.length() - 1) { + exp = val.substring(expPos + 1, val.length() - 1); + } else { + exp = null; + } + String numeric = val.substring(0, val.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(val + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException e) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(val + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < val.length() - 1) { + exp = val.substring(expPos + 1, val.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(val); + } catch (NumberFormatException nfe) { + } + try { + return createLong(val); + } catch (NumberFormatException nfe) { + } + return createBigInteger(val); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(val); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(val); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(val); + } + } + } +"," public static Number createNumber(String val) throws NumberFormatException { + if (val == null) { + return null; + } + if (val.length() == 0) { + throw new NumberFormatException(""\""\"" is not a valid number.""); + } + if (val.length() == 1 && !Character.isDigit(val.charAt(0))) { + throw new NumberFormatException(val + "" is not a valid number.""); + } + if (val.startsWith(""--"")) { + return null; + } + if (val.startsWith(""0x"") || val.startsWith(""-0x"")) { + return createInteger(val); + } + char lastChar = val.charAt(val.length() - 1); + String mant; + String dec; + String exp; + int decPos = val.indexOf('.'); + int expPos = val.indexOf('e') + val.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos) { + throw new NumberFormatException(val + "" is not a valid number.""); + } + dec = val.substring(decPos + 1, expPos); + } else { + dec = val.substring(decPos + 1); + } + mant = val.substring(0, decPos); + } else { + if (expPos > -1) { + mant = val.substring(0, expPos); + } else { + mant = val; + } + dec = null; + } + if (!Character.isDigit(lastChar)) { + if (expPos > -1 && expPos < val.length() - 1) { + exp = val.substring(expPos + 1, val.length() - 1); + } else { + exp = null; + } + String numeric = val.substring(0, val.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(val + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException e) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(val + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < val.length() - 1) { + exp = val.substring(expPos + 1, val.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(val); + } catch (NumberFormatException nfe) { + } + try { + return createLong(val); + } catch (NumberFormatException nfe) { + } + return createBigInteger(val); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(val); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(val); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(val); + } + } + } +" +Chart-9," public TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end) + throws CloneNotSupportedException { + if (start == null) { + throw new IllegalArgumentException(""Null 'start' argument.""); + } + if (end == null) { + throw new IllegalArgumentException(""Null 'end' argument.""); + } + if (start.compareTo(end) > 0) { + throw new IllegalArgumentException( + ""Requires start on or before end.""); + } + boolean emptyRange = false; + int startIndex = getIndex(start); + if (startIndex < 0) { + startIndex = -(startIndex + 1); + if (startIndex == this.data.size()) { + emptyRange = true; + } + } + int endIndex = getIndex(end); + if (endIndex < 0) { + endIndex = -(endIndex + 1); + endIndex = endIndex - 1; + } + if (endIndex < 0) { + emptyRange = true; + } + if (emptyRange) { + TimeSeries copy = (TimeSeries) super.clone(); + copy.data = new java.util.ArrayList(); + return copy; + } + else { + return createCopy(startIndex, endIndex); + } + } +"," public TimeSeries createCopy(RegularTimePeriod start, RegularTimePeriod end) + throws CloneNotSupportedException { + if (start == null) { + throw new IllegalArgumentException(""Null 'start' argument.""); + } + if (end == null) { + throw new IllegalArgumentException(""Null 'end' argument.""); + } + if (start.compareTo(end) > 0) { + throw new IllegalArgumentException( + ""Requires start on or before end.""); + } + boolean emptyRange = false; + int startIndex = getIndex(start); + if (startIndex < 0) { + startIndex = -(startIndex + 1); + if (startIndex == this.data.size()) { + emptyRange = true; + } + } + int endIndex = getIndex(end); + if (endIndex < 0) { + endIndex = -(endIndex + 1); + endIndex = endIndex - 1; + } + if ((endIndex < 0) || (endIndex < startIndex)) { + emptyRange = true; + } + if (emptyRange) { + TimeSeries copy = (TimeSeries) super.clone(); + copy.data = new java.util.ArrayList(); + return copy; + } + else { + return createCopy(startIndex, endIndex); + } + } +" +Closure-81," Node processFunctionNode(FunctionNode functionNode) { + Name name = functionNode.getFunctionName(); + Boolean isUnnamedFunction = false; + if (name == null) { + name = new Name(); + name.setIdentifier(""""); + isUnnamedFunction = true; + } + Node node = newNode(Token.FUNCTION); + Node newName = transform(name); + if (isUnnamedFunction) { + newName.setLineno(functionNode.getLineno()); + int lpColumn = functionNode.getAbsolutePosition() + + functionNode.getLp(); + newName.setCharno(position2charno(lpColumn)); + } + node.addChildToBack(newName); + Node lp = newNode(Token.LP); + Name fnName = functionNode.getFunctionName(); + if (fnName != null) { + lp.setLineno(fnName.getLineno()); + } else { + lp.setLineno(functionNode.getLineno()); + } + int lparenCharno = functionNode.getLp() + + functionNode.getAbsolutePosition(); + lp.setCharno(position2charno(lparenCharno)); + for (AstNode param : functionNode.getParams()) { + lp.addChildToBack(transform(param)); + } + node.addChildToBack(lp); + Node bodyNode = transform(functionNode.getBody()); + parseDirectives(bodyNode); + node.addChildToBack(bodyNode); + return node; + } +"," Node processFunctionNode(FunctionNode functionNode) { + Name name = functionNode.getFunctionName(); + Boolean isUnnamedFunction = false; + if (name == null) { + int functionType = functionNode.getFunctionType(); + if (functionType != FunctionNode.FUNCTION_EXPRESSION) { + errorReporter.error( + ""unnamed function statement"", + sourceName, + functionNode.getLineno(), """", 0); + } + name = new Name(); + name.setIdentifier(""""); + isUnnamedFunction = true; + } + Node node = newNode(Token.FUNCTION); + Node newName = transform(name); + if (isUnnamedFunction) { + newName.setLineno(functionNode.getLineno()); + int lpColumn = functionNode.getAbsolutePosition() + + functionNode.getLp(); + newName.setCharno(position2charno(lpColumn)); + } + node.addChildToBack(newName); + Node lp = newNode(Token.LP); + Name fnName = functionNode.getFunctionName(); + if (fnName != null) { + lp.setLineno(fnName.getLineno()); + } else { + lp.setLineno(functionNode.getLineno()); + } + int lparenCharno = functionNode.getLp() + + functionNode.getAbsolutePosition(); + lp.setCharno(position2charno(lparenCharno)); + for (AstNode param : functionNode.getParams()) { + lp.addChildToBack(transform(param)); + } + node.addChildToBack(lp); + Node bodyNode = transform(functionNode.getBody()); + parseDirectives(bodyNode); + node.addChildToBack(bodyNode); + return node; + } +" +Jsoup-50," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset = null; + if (meta.hasAttr(""http-equiv"")) { + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + } + if (foundCharset == null && meta.hasAttr(""charset"")) { + try { + if (Charset.isSupported(meta.attr(""charset""))) { + foundCharset = meta.attr(""charset""); + } + } catch (IllegalCharsetNameException e) { + foundCharset = null; + } + } + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (docData.length() > 0 && docData.charAt(0) == UNICODE_BOM) { + byteData.rewind(); + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + docData = docData.substring(1); + charsetName = defaultCharset; + doc = null; + } + if (doc == null) { + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +"," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + byteData.mark(); + byte[] bom = new byte[4]; + byteData.get(bom); + byteData.rewind(); + if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte) 0xFE && bom[3] == (byte) 0xFF || + bom[0] == (byte) 0xFF && bom[1] == (byte) 0xFE && bom[2] == 0x00 && bom[3] == 0x00) { + charsetName = ""UTF-32""; + } else if (bom[0] == (byte) 0xFE && bom[1] == (byte) 0xFF || + bom[0] == (byte) 0xFF && bom[1] == (byte) 0xFE) { + charsetName = ""UTF-16""; + } else if (bom[0] == (byte) 0xEF && bom[1] == (byte) 0xBB && bom[2] == (byte) 0xBF) { + charsetName = ""UTF-8""; + byteData.position(3); + } + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset = null; + if (meta.hasAttr(""http-equiv"")) { + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + } + if (foundCharset == null && meta.hasAttr(""charset"")) { + try { + if (Charset.isSupported(meta.attr(""charset""))) { + foundCharset = meta.attr(""charset""); + } + } catch (IllegalCharsetNameException e) { + foundCharset = null; + } + } + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (doc == null) { + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +" +Jsoup-55," void read(Tokeniser t, CharacterReader r) { + char c = r.consume(); + switch (c) { + case '>': + t.tagPending.selfClosing = true; + t.emitTagPending(); + t.transition(Data); + break; + case eof: + t.eofError(this); + t.transition(Data); + break; + default: + t.error(this); + t.transition(BeforeAttributeName); + } + } +"," void read(Tokeniser t, CharacterReader r) { + char c = r.consume(); + switch (c) { + case '>': + t.tagPending.selfClosing = true; + t.emitTagPending(); + t.transition(Data); + break; + case eof: + t.eofError(this); + t.transition(Data); + break; + default: + t.error(this); + r.unconsume(); + t.transition(BeforeAttributeName); + } + } +" +Jsoup-49," protected void addChildren(int index, Node... children) { + Validate.noNullElements(children); + ensureChildNodes(); + for (int i = children.length - 1; i >= 0; i--) { + Node in = children[i]; + reparentChild(in); + childNodes.add(index, in); + } + reindexChildren(index); + } +"," protected void addChildren(int index, Node... children) { + Validate.noNullElements(children); + ensureChildNodes(); + for (int i = children.length - 1; i >= 0; i--) { + Node in = children[i]; + reparentChild(in); + childNodes.add(index, in); + reindexChildren(index); + } + } +" +Lang-21," public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) { + if (cal1 == null || cal2 == null) { + throw new IllegalArgumentException(""The date must not be null""); + } + return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && + cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND) && + cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && + cal1.get(Calendar.HOUR) == cal2.get(Calendar.HOUR) && + cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && + cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && + cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && + cal1.getClass() == cal2.getClass()); + } +"," public static boolean isSameLocalTime(Calendar cal1, Calendar cal2) { + if (cal1 == null || cal2 == null) { + throw new IllegalArgumentException(""The date must not be null""); + } + return (cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && + cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND) && + cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && + cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY) && + cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && + cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && + cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && + cal1.getClass() == cal2.getClass()); + } +" +Jsoup-43," private static Integer indexInList(Element search, List elements) { + Validate.notNull(search); + Validate.notNull(elements); + for (int i = 0; i < elements.size(); i++) { + E element = elements.get(i); + if (element.equals(search)) + return i; + } + return null; + } +"," private static Integer indexInList(Element search, List elements) { + Validate.notNull(search); + Validate.notNull(elements); + for (int i = 0; i < elements.size(); i++) { + E element = elements.get(i); + if (element == search) + return i; + } + return null; + } +" +Cli-25," protected StringBuffer renderWrappedText(StringBuffer sb, int width, + int nextLineTabStop, String text) + { + int pos = findWrapPos(text, width, 0); + if (pos == -1) + { + sb.append(rtrim(text)); + return sb; + } + sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine); + if (nextLineTabStop >= width) + { + nextLineTabStop = width - 1; + } + final String padding = createPadding(nextLineTabStop); + while (true) + { + text = padding + text.substring(pos).trim(); + pos = findWrapPos(text, width, 0); + if (pos == -1) + { + sb.append(text); + return sb; + } + if ( (text.length() > width) && (pos == nextLineTabStop - 1) ) + { + pos = width; + } + sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine); + } + } +"," protected StringBuffer renderWrappedText(StringBuffer sb, int width, + int nextLineTabStop, String text) + { + int pos = findWrapPos(text, width, 0); + if (pos == -1) + { + sb.append(rtrim(text)); + return sb; + } + sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine); + if (nextLineTabStop >= width) + { + nextLineTabStop = 1; + } + final String padding = createPadding(nextLineTabStop); + while (true) + { + text = padding + text.substring(pos).trim(); + pos = findWrapPos(text, width, 0); + if (pos == -1) + { + sb.append(text); + return sb; + } + if ( (text.length() > width) && (pos == nextLineTabStop - 1) ) + { + pos = width; + } + sb.append(rtrim(text.substring(0, pos))).append(defaultNewLine); + } + } +" +Lang-59," public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar) { + if (width > 0) { + ensureCapacity(size + width); + String str = (obj == null ? getNullText() : obj.toString()); + int strLen = str.length(); + if (strLen >= width) { + str.getChars(0, strLen, buffer, size); + } else { + int padLen = width - strLen; + str.getChars(0, strLen, buffer, size); + for (int i = 0; i < padLen; i++) { + buffer[size + strLen + i] = padChar; + } + } + size += width; + } + return this; + } +"," public StrBuilder appendFixedWidthPadRight(Object obj, int width, char padChar) { + if (width > 0) { + ensureCapacity(size + width); + String str = (obj == null ? getNullText() : obj.toString()); + int strLen = str.length(); + if (strLen >= width) { + str.getChars(0, width, buffer, size); + } else { + int padLen = width - strLen; + str.getChars(0, strLen, buffer, size); + for (int i = 0; i < padLen; i++) { + buffer[size + strLen + i] = padChar; + } + } + size += width; + } + return this; + } +" +Closure-118," private void handleObjectLit(NodeTraversal t, Node n) { + for (Node child = n.getFirstChild(); + child != null; + child = child.getNext()) { + String name = child.getString(); + T type = typeSystem.getType(getScope(), n, name); + Property prop = getProperty(name); + if (!prop.scheduleRenaming(child, + processProperty(t, prop, type, null))) { + if (propertiesToErrorFor.containsKey(name)) { + compiler.report(JSError.make( + t.getSourceName(), child, propertiesToErrorFor.get(name), + Warnings.INVALIDATION, name, + (type == null ? ""null"" : type.toString()), n.toString(), """")); + } + } + } + } +"," private void handleObjectLit(NodeTraversal t, Node n) { + for (Node child = n.getFirstChild(); + child != null; + child = child.getNext()) { + if (child.isQuotedString()) { + continue; + } + String name = child.getString(); + T type = typeSystem.getType(getScope(), n, name); + Property prop = getProperty(name); + if (!prop.scheduleRenaming(child, + processProperty(t, prop, type, null))) { + if (propertiesToErrorFor.containsKey(name)) { + compiler.report(JSError.make( + t.getSourceName(), child, propertiesToErrorFor.get(name), + Warnings.INVALIDATION, name, + (type == null ? ""null"" : type.toString()), n.toString(), """")); + } + } + } + } +" +JacksonCore-4," public char[] expandCurrentSegment() + { + final char[] curr = _currentSegment; + final int len = curr.length; + int newLen = (len == MAX_SEGMENT_LEN) ? (MAX_SEGMENT_LEN+1) : Math.min(MAX_SEGMENT_LEN, len + (len >> 1)); + return (_currentSegment = Arrays.copyOf(curr, newLen)); + } +"," public char[] expandCurrentSegment() + { + final char[] curr = _currentSegment; + final int len = curr.length; + int newLen = len + (len >> 1); + if (newLen > MAX_SEGMENT_LEN) { + newLen = len + (len >> 2); + } + return (_currentSegment = Arrays.copyOf(curr, newLen)); + } +" +Closure-133," private String getRemainingJSDocLine() { + String result = stream.getRemainingJSDocLine(); + return result; + } +"," private String getRemainingJSDocLine() { + String result = stream.getRemainingJSDocLine(); + unreadToken = NO_UNREAD_TOKEN; + return result; + } +" +Jsoup-80," void insert(Token.Comment commentToken) { + Comment comment = new Comment(commentToken.getData()); + Node insert = comment; + if (commentToken.bogus) { + String data = comment.getData(); + if (data.length() > 1 && (data.startsWith(""!"") || data.startsWith(""?""))) { + Document doc = Jsoup.parse(""<"" + data.substring(1, data.length() -1) + "">"", baseUri, Parser.xmlParser()); + Element el = doc.child(0); + insert = new XmlDeclaration(settings.normalizeTag(el.tagName()), data.startsWith(""!"")); + insert.attributes().addAll(el.attributes()); + } + } + insertNode(insert); + } +"," void insert(Token.Comment commentToken) { + Comment comment = new Comment(commentToken.getData()); + Node insert = comment; + if (commentToken.bogus) { + String data = comment.getData(); + if (data.length() > 1 && (data.startsWith(""!"") || data.startsWith(""?""))) { + Document doc = Jsoup.parse(""<"" + data.substring(1, data.length() -1) + "">"", baseUri, Parser.xmlParser()); + if (doc.childNodeSize() > 0) { + Element el = doc.child(0); + insert = new XmlDeclaration(settings.normalizeTag(el.tagName()), data.startsWith(""!"")); + insert.attributes().addAll(el.attributes()); + } + } + } + insertNode(insert); + } +" +Math-48," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + case REGULA_FALSI: + break; + default: + throw new MathInternalError(); + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +"," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + case REGULA_FALSI: + if (x == x1) { + throw new ConvergenceException(); + } + break; + default: + throw new MathInternalError(); + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +" +Closure-25," private FlowScope traverseNew(Node n, FlowScope scope) { + Node constructor = n.getFirstChild(); + scope = traverse(constructor, scope); + JSType constructorType = constructor.getJSType(); + JSType type = null; + if (constructorType != null) { + constructorType = constructorType.restrictByNotNullOrUndefined(); + if (constructorType.isUnknownType()) { + type = getNativeType(UNKNOWN_TYPE); + } else { + FunctionType ct = constructorType.toMaybeFunctionType(); + if (ct == null && constructorType instanceof FunctionType) { + ct = (FunctionType) constructorType; + } + if (ct != null && ct.isConstructor()) { + type = ct.getInstanceType(); + } + } + } + n.setJSType(type); + for (Node arg = constructor.getNext(); arg != null; arg = arg.getNext()) { + scope = traverse(arg, scope); + } + return scope; + } +"," private FlowScope traverseNew(Node n, FlowScope scope) { + scope = traverseChildren(n, scope); + Node constructor = n.getFirstChild(); + JSType constructorType = constructor.getJSType(); + JSType type = null; + if (constructorType != null) { + constructorType = constructorType.restrictByNotNullOrUndefined(); + if (constructorType.isUnknownType()) { + type = getNativeType(UNKNOWN_TYPE); + } else { + FunctionType ct = constructorType.toMaybeFunctionType(); + if (ct == null && constructorType instanceof FunctionType) { + ct = (FunctionType) constructorType; + } + if (ct != null && ct.isConstructor()) { + type = ct.getInstanceType(); + backwardsInferenceFromCallSite(n, ct); + } + } + } + n.setJSType(type); + return scope; + } +" +Time-4," public Partial with(DateTimeFieldType fieldType, int value) { + if (fieldType == null) { + throw new IllegalArgumentException(""The field type must not be null""); + } + int index = indexOf(fieldType); + if (index == -1) { + DateTimeFieldType[] newTypes = new DateTimeFieldType[iTypes.length + 1]; + int[] newValues = new int[newTypes.length]; + int i = 0; + DurationField unitField = fieldType.getDurationType().getField(iChronology); + if (unitField.isSupported()) { + for (; i < iTypes.length; i++) { + DateTimeFieldType loopType = iTypes[i]; + DurationField loopUnitField = loopType.getDurationType().getField(iChronology); + if (loopUnitField.isSupported()) { + int compare = unitField.compareTo(loopUnitField); + if (compare > 0) { + break; + } else if (compare == 0) { + DurationField rangeField = fieldType.getRangeDurationType().getField(iChronology); + DurationField loopRangeField = loopType.getRangeDurationType().getField(iChronology); + if (rangeField.compareTo(loopRangeField) > 0) { + break; + } + } + } + } + } + System.arraycopy(iTypes, 0, newTypes, 0, i); + System.arraycopy(iValues, 0, newValues, 0, i); + newTypes[i] = fieldType; + newValues[i] = value; + System.arraycopy(iTypes, i, newTypes, i + 1, newTypes.length - i - 1); + System.arraycopy(iValues, i, newValues, i + 1, newValues.length - i - 1); + Partial newPartial = new Partial(iChronology, newTypes, newValues); + iChronology.validate(newPartial, newValues); + return newPartial; + } + if (value == getValue(index)) { + return this; + } + int[] newValues = getValues(); + newValues = getField(index).set(this, index, newValues, value); + return new Partial(this, newValues); + } +"," public Partial with(DateTimeFieldType fieldType, int value) { + if (fieldType == null) { + throw new IllegalArgumentException(""The field type must not be null""); + } + int index = indexOf(fieldType); + if (index == -1) { + DateTimeFieldType[] newTypes = new DateTimeFieldType[iTypes.length + 1]; + int[] newValues = new int[newTypes.length]; + int i = 0; + DurationField unitField = fieldType.getDurationType().getField(iChronology); + if (unitField.isSupported()) { + for (; i < iTypes.length; i++) { + DateTimeFieldType loopType = iTypes[i]; + DurationField loopUnitField = loopType.getDurationType().getField(iChronology); + if (loopUnitField.isSupported()) { + int compare = unitField.compareTo(loopUnitField); + if (compare > 0) { + break; + } else if (compare == 0) { + DurationField rangeField = fieldType.getRangeDurationType().getField(iChronology); + DurationField loopRangeField = loopType.getRangeDurationType().getField(iChronology); + if (rangeField.compareTo(loopRangeField) > 0) { + break; + } + } + } + } + } + System.arraycopy(iTypes, 0, newTypes, 0, i); + System.arraycopy(iValues, 0, newValues, 0, i); + newTypes[i] = fieldType; + newValues[i] = value; + System.arraycopy(iTypes, i, newTypes, i + 1, newTypes.length - i - 1); + System.arraycopy(iValues, i, newValues, i + 1, newValues.length - i - 1); + Partial newPartial = new Partial(newTypes, newValues, iChronology); + iChronology.validate(newPartial, newValues); + return newPartial; + } + if (value == getValue(index)) { + return this; + } + int[] newValues = getValues(); + newValues = getField(index).set(this, index, newValues, value); + return new Partial(this, newValues); + } +" +Math-85," public static double[] bracket(UnivariateRealFunction function, + double initial, double lowerBound, double upperBound, + int maximumIterations) throws ConvergenceException, + FunctionEvaluationException { + if (function == null) { + throw MathRuntimeException.createIllegalArgumentException(""function is null""); + } + if (maximumIterations <= 0) { + throw MathRuntimeException.createIllegalArgumentException( + ""bad value for maximum iterations number: {0}"", maximumIterations); + } + if (initial < lowerBound || initial > upperBound || lowerBound >= upperBound) { + throw MathRuntimeException.createIllegalArgumentException( + ""invalid bracketing parameters: lower bound={0}, initial={1}, upper bound={2}"", + lowerBound, initial, upperBound); + } + double a = initial; + double b = initial; + double fa; + double fb; + int numIterations = 0 ; + do { + a = Math.max(a - 1.0, lowerBound); + b = Math.min(b + 1.0, upperBound); + fa = function.value(a); + fb = function.value(b); + numIterations++ ; + } while ((fa * fb > 0.0) && (numIterations < maximumIterations) && + ((a > lowerBound) || (b < upperBound))); + if (fa * fb >= 0.0 ) { + throw new ConvergenceException( + ""number of iterations={0}, maximum iterations={1}, "" + + ""initial={2}, lower bound={3}, upper bound={4}, final a value={5}, "" + + ""final b value={6}, f(a)={7}, f(b)={8}"", + numIterations, maximumIterations, initial, + lowerBound, upperBound, a, b, fa, fb); + } + return new double[]{a, b}; + } +"," public static double[] bracket(UnivariateRealFunction function, + double initial, double lowerBound, double upperBound, + int maximumIterations) throws ConvergenceException, + FunctionEvaluationException { + if (function == null) { + throw MathRuntimeException.createIllegalArgumentException(""function is null""); + } + if (maximumIterations <= 0) { + throw MathRuntimeException.createIllegalArgumentException( + ""bad value for maximum iterations number: {0}"", maximumIterations); + } + if (initial < lowerBound || initial > upperBound || lowerBound >= upperBound) { + throw MathRuntimeException.createIllegalArgumentException( + ""invalid bracketing parameters: lower bound={0}, initial={1}, upper bound={2}"", + lowerBound, initial, upperBound); + } + double a = initial; + double b = initial; + double fa; + double fb; + int numIterations = 0 ; + do { + a = Math.max(a - 1.0, lowerBound); + b = Math.min(b + 1.0, upperBound); + fa = function.value(a); + fb = function.value(b); + numIterations++ ; + } while ((fa * fb > 0.0) && (numIterations < maximumIterations) && + ((a > lowerBound) || (b < upperBound))); + if (fa * fb > 0.0 ) { + throw new ConvergenceException( + ""number of iterations={0}, maximum iterations={1}, "" + + ""initial={2}, lower bound={3}, upper bound={4}, final a value={5}, "" + + ""final b value={6}, f(a)={7}, f(b)={8}"", + numIterations, maximumIterations, initial, + lowerBound, upperBound, a, b, fa, fb); + } + return new double[]{a, b}; + } +" +Lang-10," private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) { + boolean wasWhite= false; + for(int i= 0; i 280000000) { + throw new ArithmeticException(""Calendar value too large for accurate calculations""); + } + boolean roundUp = false; + for (int i = 0; i < fields.length; i++) { + for (int j = 0; j < fields[i].length; j++) { + if (fields[i][j] == field) { + if (round && roundUp) { + if (field == DateUtils.SEMI_MONTH) { + if (val.get(Calendar.DATE) == 1) { + val.add(Calendar.DATE, 15); + } else { + val.add(Calendar.DATE, -15); + val.add(Calendar.MONTH, 1); + } + } else { + val.add(fields[i][0], 1); + } + } + return; + } + } + int offset = 0; + boolean offsetSet = false; + switch (field) { + case DateUtils.SEMI_MONTH: + if (fields[i][0] == Calendar.DATE) { + offset = val.get(Calendar.DATE) - 1; + if (offset >= 15) { + offset -= 15; + } + roundUp = offset > 7; + offsetSet = true; + } + break; + case Calendar.AM_PM: + if (fields[i][0] == Calendar.HOUR_OF_DAY) { + offset = val.get(Calendar.HOUR_OF_DAY); + if (offset >= 12) { + offset -= 12; + } + roundUp = offset > 6; + offsetSet = true; + } + break; + } + if (!offsetSet) { + int min = val.getActualMinimum(fields[i][0]); + int max = val.getActualMaximum(fields[i][0]); + offset = val.get(fields[i][0]) - min; + roundUp = offset > ((max - min) / 2); + } + val.set(fields[i][0], val.get(fields[i][0]) - offset); + } + throw new IllegalArgumentException(""The field "" + field + "" is not supported""); + } +"," private static void modify(Calendar val, int field, boolean round) { + if (val.get(Calendar.YEAR) > 280000000) { + throw new ArithmeticException(""Calendar value too large for accurate calculations""); + } + if (field == Calendar.MILLISECOND) { + return; + } + Date date = val.getTime(); + long time = date.getTime(); + boolean done = false; + int millisecs = val.get(Calendar.MILLISECOND); + if (!round || millisecs < 500) { + time = time - millisecs; + if (field == Calendar.SECOND) { + done = true; + } + } + int seconds = val.get(Calendar.SECOND); + if (!done && (!round || seconds < 30)) { + time = time - (seconds * 1000L); + if (field == Calendar.MINUTE) { + done = true; + } + } + int minutes = val.get(Calendar.MINUTE); + if (!done && (!round || minutes < 30)) { + time = time - (minutes * 60000L); + } + if (date.getTime() != time) { + date.setTime(time); + val.setTime(date); + } + boolean roundUp = false; + for (int i = 0; i < fields.length; i++) { + for (int j = 0; j < fields[i].length; j++) { + if (fields[i][j] == field) { + if (round && roundUp) { + if (field == DateUtils.SEMI_MONTH) { + if (val.get(Calendar.DATE) == 1) { + val.add(Calendar.DATE, 15); + } else { + val.add(Calendar.DATE, -15); + val.add(Calendar.MONTH, 1); + } + } else { + val.add(fields[i][0], 1); + } + } + return; + } + } + int offset = 0; + boolean offsetSet = false; + switch (field) { + case DateUtils.SEMI_MONTH: + if (fields[i][0] == Calendar.DATE) { + offset = val.get(Calendar.DATE) - 1; + if (offset >= 15) { + offset -= 15; + } + roundUp = offset > 7; + offsetSet = true; + } + break; + case Calendar.AM_PM: + if (fields[i][0] == Calendar.HOUR_OF_DAY) { + offset = val.get(Calendar.HOUR_OF_DAY); + if (offset >= 12) { + offset -= 12; + } + roundUp = offset > 6; + offsetSet = true; + } + break; + } + if (!offsetSet) { + int min = val.getActualMinimum(fields[i][0]); + int max = val.getActualMaximum(fields[i][0]); + offset = val.get(fields[i][0]) - min; + roundUp = offset > ((max - min) / 2); + } + if (offset != 0) { + val.set(fields[i][0], val.get(fields[i][0]) - offset); + } + } + throw new IllegalArgumentException(""The field "" + field + "" is not supported""); + } +" +JacksonCore-20," public void writeEmbeddedObject(Object object) throws IOException { + throw new JsonGenerationException(""No native support for writing embedded objects"", + this); + } +"," public void writeEmbeddedObject(Object object) throws IOException { + if (object == null) { + writeNull(); + return; + } + if (object instanceof byte[]) { + writeBinary((byte[]) object); + return; + } + throw new JsonGenerationException(""No native support for writing embedded objects of type "" + +object.getClass().getName(), + this); + } +" +Closure-61," static boolean functionCallHasSideEffects( + Node callNode, @Nullable AbstractCompiler compiler) { + if (callNode.getType() != Token.CALL) { + throw new IllegalStateException( + ""Expected CALL node, got "" + Token.name(callNode.getType())); + } + if (callNode.isNoSideEffectsCall()) { + return false; + } + Node nameNode = callNode.getFirstChild(); + if (nameNode.getType() == Token.NAME) { + String name = nameNode.getString(); + if (BUILTIN_FUNCTIONS_WITHOUT_SIDEEFFECTS.contains(name)) { + return false; + } + } else if (nameNode.getType() == Token.GETPROP) { + if (callNode.hasOneChild() + && OBJECT_METHODS_WITHOUT_SIDEEFFECTS.contains( + nameNode.getLastChild().getString())) { + return false; + } + if (callNode.isOnlyModifiesThisCall() + && evaluatesToLocalValue(nameNode.getFirstChild())) { + return false; + } + if (compiler != null && !compiler.hasRegExpGlobalReferences()) { + if (nameNode.getFirstChild().getType() == Token.REGEXP + && REGEXP_METHODS.contains(nameNode.getLastChild().getString())) { + return false; + } else if (nameNode.getFirstChild().getType() == Token.STRING + && STRING_REGEXP_METHODS.contains( + nameNode.getLastChild().getString())) { + Node param = nameNode.getNext(); + if (param != null && + (param.getType() == Token.STRING + || param.getType() == Token.REGEXP)) + return false; + } + } + } + return true; + } +"," static boolean functionCallHasSideEffects( + Node callNode, @Nullable AbstractCompiler compiler) { + if (callNode.getType() != Token.CALL) { + throw new IllegalStateException( + ""Expected CALL node, got "" + Token.name(callNode.getType())); + } + if (callNode.isNoSideEffectsCall()) { + return false; + } + Node nameNode = callNode.getFirstChild(); + if (nameNode.getType() == Token.NAME) { + String name = nameNode.getString(); + if (BUILTIN_FUNCTIONS_WITHOUT_SIDEEFFECTS.contains(name)) { + return false; + } + } else if (nameNode.getType() == Token.GETPROP) { + if (callNode.hasOneChild() + && OBJECT_METHODS_WITHOUT_SIDEEFFECTS.contains( + nameNode.getLastChild().getString())) { + return false; + } + if (callNode.isOnlyModifiesThisCall() + && evaluatesToLocalValue(nameNode.getFirstChild())) { + return false; + } + if (nameNode.getFirstChild().getType() == Token.NAME) { + String namespaceName = nameNode.getFirstChild().getString(); + if (namespaceName.equals(""Math"")) { + return false; + } + } + if (compiler != null && !compiler.hasRegExpGlobalReferences()) { + if (nameNode.getFirstChild().getType() == Token.REGEXP + && REGEXP_METHODS.contains(nameNode.getLastChild().getString())) { + return false; + } else if (nameNode.getFirstChild().getType() == Token.STRING + && STRING_REGEXP_METHODS.contains( + nameNode.getLastChild().getString())) { + Node param = nameNode.getNext(); + if (param != null && + (param.getType() == Token.STRING + || param.getType() == Token.REGEXP)) + return false; + } + } + } + return true; + } +" +Closure-161," private Node tryFoldArrayAccess(Node n, Node left, Node right) { + Node parent = n.getParent(); + if (right.getType() != Token.NUMBER) { + return n; + } + double index = right.getDouble(); + int intIndex = (int) index; + if (intIndex != index) { + error(INVALID_GETELEM_INDEX_ERROR, right); + return n; + } + if (intIndex < 0) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + Node elem = left.getFirstChild(); + for (int i = 0; elem != null && i < intIndex; i++) { + elem = elem.getNext(); + } + if (elem == null) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + if (elem.getType() == Token.EMPTY) { + elem = NodeUtil.newUndefinedNode(elem); + } else { + left.removeChild(elem); + } + n.getParent().replaceChild(n, elem); + reportCodeChange(); + return elem; + } +"," private Node tryFoldArrayAccess(Node n, Node left, Node right) { + Node parent = n.getParent(); + if (isAssignmentTarget(n)) { + return n; + } + if (right.getType() != Token.NUMBER) { + return n; + } + double index = right.getDouble(); + int intIndex = (int) index; + if (intIndex != index) { + error(INVALID_GETELEM_INDEX_ERROR, right); + return n; + } + if (intIndex < 0) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + Node elem = left.getFirstChild(); + for (int i = 0; elem != null && i < intIndex; i++) { + elem = elem.getNext(); + } + if (elem == null) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + if (elem.getType() == Token.EMPTY) { + elem = NodeUtil.newUndefinedNode(elem); + } else { + left.removeChild(elem); + } + n.getParent().replaceChild(n, elem); + reportCodeChange(); + return elem; + } +" +Lang-49," public Fraction reduce() { + int gcd = greatestCommonDivisor(Math.abs(numerator), denominator); + if (gcd == 1) { + return this; + } + return Fraction.getFraction(numerator / gcd, denominator / gcd); + } +"," public Fraction reduce() { + if (numerator == 0) { + return equals(ZERO) ? this : ZERO; + } + int gcd = greatestCommonDivisor(Math.abs(numerator), denominator); + if (gcd == 1) { + return this; + } + return Fraction.getFraction(numerator / gcd, denominator / gcd); + } +" +Lang-55," public void stop() { + if(this.runningState != STATE_RUNNING && this.runningState != STATE_SUSPENDED) { + throw new IllegalStateException(""Stopwatch is not running. ""); + } + stopTime = System.currentTimeMillis(); + this.runningState = STATE_STOPPED; + } +"," public void stop() { + if(this.runningState != STATE_RUNNING && this.runningState != STATE_SUSPENDED) { + throw new IllegalStateException(""Stopwatch is not running. ""); + } + if(this.runningState == STATE_RUNNING) { + stopTime = System.currentTimeMillis(); + } + this.runningState = STATE_STOPPED; + } +" +Closure-53," private void replaceAssignmentExpression(Var v, Reference ref, + Map varmap) { + List nodes = Lists.newArrayList(); + Node val = ref.getAssignedValue(); + blacklistVarReferencesInTree(val, v.scope); + Preconditions.checkState(val.getType() == Token.OBJECTLIT); + Set all = Sets.newLinkedHashSet(varmap.keySet()); + for (Node key = val.getFirstChild(); key != null; + key = key.getNext()) { + String var = key.getString(); + Node value = key.removeFirstChild(); + nodes.add( + new Node(Token.ASSIGN, + Node.newString(Token.NAME, varmap.get(var)), value)); + all.remove(var); + } + for (String var : all) { + nodes.add( + new Node(Token.ASSIGN, + Node.newString(Token.NAME, varmap.get(var)), + NodeUtil.newUndefinedNode(null))); + } + Node replacement; + nodes.add(new Node(Token.TRUE)); + nodes = Lists.reverse(nodes); + replacement = new Node(Token.COMMA); + Node cur = replacement; + int i; + for (i = 0; i < nodes.size() - 2; i++) { + cur.addChildToFront(nodes.get(i)); + Node t = new Node(Token.COMMA); + cur.addChildToFront(t); + cur = t; + } + cur.addChildToFront(nodes.get(i)); + cur.addChildToFront(nodes.get(i + 1)); + Node replace = ref.getParent(); + replacement.copyInformationFromForTree(replace); + if (replace.getType() == Token.VAR) { + replace.getParent().replaceChild( + replace, NodeUtil.newExpr(replacement)); + } else { + replace.getParent().replaceChild(replace, replacement); + } + } +"," private void replaceAssignmentExpression(Var v, Reference ref, + Map varmap) { + List nodes = Lists.newArrayList(); + Node val = ref.getAssignedValue(); + blacklistVarReferencesInTree(val, v.scope); + Preconditions.checkState(val.getType() == Token.OBJECTLIT); + Set all = Sets.newLinkedHashSet(varmap.keySet()); + for (Node key = val.getFirstChild(); key != null; + key = key.getNext()) { + String var = key.getString(); + Node value = key.removeFirstChild(); + nodes.add( + new Node(Token.ASSIGN, + Node.newString(Token.NAME, varmap.get(var)), value)); + all.remove(var); + } + for (String var : all) { + nodes.add( + new Node(Token.ASSIGN, + Node.newString(Token.NAME, varmap.get(var)), + NodeUtil.newUndefinedNode(null))); + } + Node replacement; + if (nodes.isEmpty()) { + replacement = new Node(Token.TRUE); + } else { + nodes.add(new Node(Token.TRUE)); + nodes = Lists.reverse(nodes); + replacement = new Node(Token.COMMA); + Node cur = replacement; + int i; + for (i = 0; i < nodes.size() - 2; i++) { + cur.addChildToFront(nodes.get(i)); + Node t = new Node(Token.COMMA); + cur.addChildToFront(t); + cur = t; + } + cur.addChildToFront(nodes.get(i)); + cur.addChildToFront(nodes.get(i + 1)); + } + Node replace = ref.getParent(); + replacement.copyInformationFromForTree(replace); + if (replace.getType() == Token.VAR) { + replace.getParent().replaceChild( + replace, NodeUtil.newExpr(replacement)); + } else { + replace.getParent().replaceChild(replace, replacement); + } + } +" +Chart-4," public Range getDataRange(ValueAxis axis) { + Range result = null; + List mappedDatasets = new ArrayList(); + List includedAnnotations = new ArrayList(); + boolean isDomainAxis = true; + int domainIndex = getDomainAxisIndex(axis); + if (domainIndex >= 0) { + isDomainAxis = true; + mappedDatasets.addAll(getDatasetsMappedToDomainAxis( + new Integer(domainIndex))); + if (domainIndex == 0) { + Iterator iterator = this.annotations.iterator(); + while (iterator.hasNext()) { + XYAnnotation annotation = (XYAnnotation) iterator.next(); + if (annotation instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(annotation); + } + } + } + } + int rangeIndex = getRangeAxisIndex(axis); + if (rangeIndex >= 0) { + isDomainAxis = false; + mappedDatasets.addAll(getDatasetsMappedToRangeAxis( + new Integer(rangeIndex))); + if (rangeIndex == 0) { + Iterator iterator = this.annotations.iterator(); + while (iterator.hasNext()) { + XYAnnotation annotation = (XYAnnotation) iterator.next(); + if (annotation instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(annotation); + } + } + } + } + Iterator iterator = mappedDatasets.iterator(); + while (iterator.hasNext()) { + XYDataset d = (XYDataset) iterator.next(); + if (d != null) { + XYItemRenderer r = getRendererForDataset(d); + if (isDomainAxis) { + if (r != null) { + result = Range.combine(result, r.findDomainBounds(d)); + } + else { + result = Range.combine(result, + DatasetUtilities.findDomainBounds(d)); + } + } + else { + if (r != null) { + result = Range.combine(result, r.findRangeBounds(d)); + } + else { + result = Range.combine(result, + DatasetUtilities.findRangeBounds(d)); + } + } + Collection c = r.getAnnotations(); + Iterator i = c.iterator(); + while (i.hasNext()) { + XYAnnotation a = (XYAnnotation) i.next(); + if (a instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(a); + } + } + } + } + Iterator it = includedAnnotations.iterator(); + while (it.hasNext()) { + XYAnnotationBoundsInfo xyabi = (XYAnnotationBoundsInfo) it.next(); + if (xyabi.getIncludeInDataBounds()) { + if (isDomainAxis) { + result = Range.combine(result, xyabi.getXRange()); + } + else { + result = Range.combine(result, xyabi.getYRange()); + } + } + } + return result; + } +"," public Range getDataRange(ValueAxis axis) { + Range result = null; + List mappedDatasets = new ArrayList(); + List includedAnnotations = new ArrayList(); + boolean isDomainAxis = true; + int domainIndex = getDomainAxisIndex(axis); + if (domainIndex >= 0) { + isDomainAxis = true; + mappedDatasets.addAll(getDatasetsMappedToDomainAxis( + new Integer(domainIndex))); + if (domainIndex == 0) { + Iterator iterator = this.annotations.iterator(); + while (iterator.hasNext()) { + XYAnnotation annotation = (XYAnnotation) iterator.next(); + if (annotation instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(annotation); + } + } + } + } + int rangeIndex = getRangeAxisIndex(axis); + if (rangeIndex >= 0) { + isDomainAxis = false; + mappedDatasets.addAll(getDatasetsMappedToRangeAxis( + new Integer(rangeIndex))); + if (rangeIndex == 0) { + Iterator iterator = this.annotations.iterator(); + while (iterator.hasNext()) { + XYAnnotation annotation = (XYAnnotation) iterator.next(); + if (annotation instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(annotation); + } + } + } + } + Iterator iterator = mappedDatasets.iterator(); + while (iterator.hasNext()) { + XYDataset d = (XYDataset) iterator.next(); + if (d != null) { + XYItemRenderer r = getRendererForDataset(d); + if (isDomainAxis) { + if (r != null) { + result = Range.combine(result, r.findDomainBounds(d)); + } + else { + result = Range.combine(result, + DatasetUtilities.findDomainBounds(d)); + } + } + else { + if (r != null) { + result = Range.combine(result, r.findRangeBounds(d)); + } + else { + result = Range.combine(result, + DatasetUtilities.findRangeBounds(d)); + } + } + if (r != null) { + Collection c = r.getAnnotations(); + Iterator i = c.iterator(); + while (i.hasNext()) { + XYAnnotation a = (XYAnnotation) i.next(); + if (a instanceof XYAnnotationBoundsInfo) { + includedAnnotations.add(a); + } + } + } + } + } + Iterator it = includedAnnotations.iterator(); + while (it.hasNext()) { + XYAnnotationBoundsInfo xyabi = (XYAnnotationBoundsInfo) it.next(); + if (xyabi.getIncludeInDataBounds()) { + if (isDomainAxis) { + result = Range.combine(result, xyabi.getXRange()); + } + else { + result = Range.combine(result, xyabi.getYRange()); + } + } + } + return result; + } +" +Closure-40," public void visit(NodeTraversal t, Node n, Node parent) { + if (t.inGlobalScope()) { + if (NodeUtil.isVarDeclaration(n)) { + NameInformation ns = createNameInformation(t, n, parent); + Preconditions.checkNotNull(ns); + recordSet(ns.name, n); + } else if (NodeUtil.isFunctionDeclaration(n)) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null) { + JsName nameInfo = getName(nameNode.getString(), true); + recordSet(nameInfo.name, nameNode); + } + } else if (NodeUtil.isObjectLitKey(n, parent)) { + NameInformation ns = createNameInformation(t, n, parent); + if (ns != null) { + recordSet(ns.name, n); + } + } + } + if (n.isAssign()) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null) { + if (ns.isPrototype) { + recordPrototypeSet(ns.prototypeClass, ns.prototypeProperty, n); + } else { + recordSet(ns.name, nameNode); + } + } + } else if (n.isCall()) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null && ns.onlyAffectsClassDef) { + JsName name = getName(ns.name, false); + if (name != null) { + refNodes.add(new ClassDefiningFunctionNode( + name, n, parent, parent.getParent())); + } + } + } + } +"," public void visit(NodeTraversal t, Node n, Node parent) { + if (t.inGlobalScope()) { + if (NodeUtil.isVarDeclaration(n)) { + NameInformation ns = createNameInformation(t, n, parent); + Preconditions.checkNotNull(ns); + recordSet(ns.name, n); + } else if (NodeUtil.isFunctionDeclaration(n)) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null) { + JsName nameInfo = getName(nameNode.getString(), true); + recordSet(nameInfo.name, nameNode); + } + } else if (NodeUtil.isObjectLitKey(n, parent)) { + NameInformation ns = createNameInformation(t, n, parent); + if (ns != null) { + recordSet(ns.name, n); + } + } + } + if (n.isAssign()) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null) { + if (ns.isPrototype) { + recordPrototypeSet(ns.prototypeClass, ns.prototypeProperty, n); + } else { + recordSet(ns.name, nameNode); + } + } + } else if (n.isCall()) { + Node nameNode = n.getFirstChild(); + NameInformation ns = createNameInformation(t, nameNode, n); + if (ns != null && ns.onlyAffectsClassDef) { + JsName name = getName(ns.name, true); + refNodes.add(new ClassDefiningFunctionNode( + name, n, parent, parent.getParent())); + } + } + } +" +JacksonDatabind-24," public BaseSettings withDateFormat(DateFormat df) { + if (_dateFormat == df) { + return this; + } + TimeZone tz = (df == null) ? _timeZone : df.getTimeZone(); + return new BaseSettings(_classIntrospector, _annotationIntrospector, _visibilityChecker, _propertyNamingStrategy, _typeFactory, + _typeResolverBuilder, df, _handlerInstantiator, _locale, + tz, _defaultBase64); + } +"," public BaseSettings withDateFormat(DateFormat df) { + if (_dateFormat == df) { + return this; + } + return new BaseSettings(_classIntrospector, _annotationIntrospector, _visibilityChecker, _propertyNamingStrategy, _typeFactory, + _typeResolverBuilder, df, _handlerInstantiator, _locale, + _timeZone, _defaultBase64); + } +" +Math-13," private RealMatrix squareRoot(RealMatrix m) { + final EigenDecomposition dec = new EigenDecomposition(m); + return dec.getSquareRoot(); + } +"," private RealMatrix squareRoot(RealMatrix m) { + if (m instanceof DiagonalMatrix) { + final int dim = m.getRowDimension(); + final RealMatrix sqrtM = new DiagonalMatrix(dim); + for (int i = 0; i < dim; i++) { + sqrtM.setEntry(i, i, FastMath.sqrt(m.getEntry(i, i))); + } + return sqrtM; + } else { + final EigenDecomposition dec = new EigenDecomposition(m); + return dec.getSquareRoot(); + } + } +" +Codec-18," public static boolean equals(final CharSequence cs1, final CharSequence cs2) { + if (cs1 == cs2) { + return true; + } + if (cs1 == null || cs2 == null) { + return false; + } + if (cs1 instanceof String && cs2 instanceof String) { + return cs1.equals(cs2); + } + return CharSequenceUtils.regionMatches(cs1, false, 0, cs2, 0, Math.max(cs1.length(), cs2.length())); + } +"," public static boolean equals(final CharSequence cs1, final CharSequence cs2) { + if (cs1 == cs2) { + return true; + } + if (cs1 == null || cs2 == null) { + return false; + } + if (cs1 instanceof String && cs2 instanceof String) { + return cs1.equals(cs2); + } + return cs1.length() == cs2.length() && CharSequenceUtils.regionMatches(cs1, false, 0, cs2, 0, cs1.length()); + } +" +JacksonDatabind-93," public void validateSubType(DeserializationContext ctxt, JavaType type) throws JsonMappingException + { + final Class raw = type.getRawClass(); + String full = raw.getName(); + main_check: + do { + if (_cfgIllegalClassNames.contains(full)) { + break; + } + if (full.startsWith(PREFIX_STRING)) { + for (Class cls = raw; cls != Object.class; cls = cls.getSuperclass()) { + String name = cls.getSimpleName(); + if (""AbstractPointcutAdvisor"".equals(name) + || ""AbstractApplicationContext"".equals(name)) { + break main_check; + } + } + } + return; + } while (false); + throw JsonMappingException.from(ctxt, + String.format(""Illegal type (%s) to deserialize: prevented for security reasons"", full)); + } +"," public void validateSubType(DeserializationContext ctxt, JavaType type) throws JsonMappingException + { + final Class raw = type.getRawClass(); + String full = raw.getName(); + main_check: + do { + if (_cfgIllegalClassNames.contains(full)) { + break; + } + if (!raw.isInterface() && full.startsWith(PREFIX_STRING)) { + for (Class cls = raw; (cls != null) && (cls != Object.class); cls = cls.getSuperclass()) { + String name = cls.getSimpleName(); + if (""AbstractPointcutAdvisor"".equals(name) + || ""AbstractApplicationContext"".equals(name)) { + break main_check; + } + } + } + return; + } while (false); + throw JsonMappingException.from(ctxt, + String.format(""Illegal type (%s) to deserialize: prevented for security reasons"", full)); + } +" +Closure-145," private boolean isOneExactlyFunctionOrDo(Node n) { + return (n.getType() == Token.FUNCTION || n.getType() == Token.DO); + } +"," private boolean isOneExactlyFunctionOrDo(Node n) { + if (n.getType() == Token.LABEL) { + Node labeledStatement = n.getLastChild(); + if (labeledStatement.getType() != Token.BLOCK) { + return isOneExactlyFunctionOrDo(labeledStatement); + } else { + if (getNonEmptyChildCount(n, 2) == 1) { + return isOneExactlyFunctionOrDo(getFirstNonEmptyChild(n)); + } else { + return false; + } + } + } else { + return (n.getType() == Token.FUNCTION || n.getType() == Token.DO); + } + } +" +Closure-176," private void updateScopeForTypeChange( + FlowScope scope, Node left, JSType leftType, JSType resultType) { + Preconditions.checkNotNull(resultType); + switch (left.getType()) { + case Token.NAME: + String varName = left.getString(); + Var var = syntacticScope.getVar(varName); + boolean isVarDeclaration = left.hasChildren(); + boolean isVarTypeBetter = !isVarDeclaration || var == null || var.isTypeInferred(); + if (isVarTypeBetter) { + redeclareSimpleVar(scope, left, resultType); + } + left.setJSType(isVarDeclaration || leftType == null ? + resultType : null); + if (var != null && var.isTypeInferred()) { + JSType oldType = var.getType(); + var.setType(oldType == null ? + resultType : oldType.getLeastSupertype(resultType)); + } + break; + case Token.GETPROP: + String qualifiedName = left.getQualifiedName(); + if (qualifiedName != null) { + scope.inferQualifiedSlot(left, qualifiedName, + leftType == null ? unknownType : leftType, + resultType); + } + left.setJSType(resultType); + ensurePropertyDefined(left, resultType); + break; + } + } +"," private void updateScopeForTypeChange( + FlowScope scope, Node left, JSType leftType, JSType resultType) { + Preconditions.checkNotNull(resultType); + switch (left.getType()) { + case Token.NAME: + String varName = left.getString(); + Var var = syntacticScope.getVar(varName); + JSType varType = var == null ? null : var.getType(); + boolean isVarDeclaration = left.hasChildren() + && varType != null && !var.isTypeInferred(); + boolean isVarTypeBetter = isVarDeclaration && + !resultType.isNullType() && !resultType.isVoidType(); + if (isVarTypeBetter) { + redeclareSimpleVar(scope, left, varType); + } else { + redeclareSimpleVar(scope, left, resultType); + } + left.setJSType(resultType); + if (var != null && var.isTypeInferred()) { + JSType oldType = var.getType(); + var.setType(oldType == null ? + resultType : oldType.getLeastSupertype(resultType)); + } + break; + case Token.GETPROP: + String qualifiedName = left.getQualifiedName(); + if (qualifiedName != null) { + scope.inferQualifiedSlot(left, qualifiedName, + leftType == null ? unknownType : leftType, + resultType); + } + left.setJSType(resultType); + ensurePropertyDefined(left, resultType); + break; + } + } +" +Cli-35," public List getMatchingOptions(String opt) + { + opt = Util.stripLeadingHyphens(opt); + List matchingOpts = new ArrayList(); + for (String longOpt : longOpts.keySet()) + { + if (longOpt.startsWith(opt)) + { + matchingOpts.add(longOpt); + } + } + return matchingOpts; + } +"," public List getMatchingOptions(String opt) + { + opt = Util.stripLeadingHyphens(opt); + List matchingOpts = new ArrayList(); + if(longOpts.keySet().contains(opt)) { + return Collections.singletonList(opt); + } + for (String longOpt : longOpts.keySet()) + { + if (longOpt.startsWith(opt)) + { + matchingOpts.add(longOpt); + } + } + return matchingOpts; + } +" +Closure-119," public void collect(JSModule module, Scope scope, Node n) { + Node parent = n.getParent(); + String name; + boolean isSet = false; + Name.Type type = Name.Type.OTHER; + boolean isPropAssign = false; + switch (n.getType()) { + case Token.GETTER_DEF: + case Token.SETTER_DEF: + case Token.STRING_KEY: + name = null; + if (parent != null && parent.isObjectLit()) { + name = getNameForObjLitKey(n); + } + if (name == null) { + return; + } + isSet = true; + switch (n.getType()) { + case Token.STRING_KEY: + type = getValueType(n.getFirstChild()); + break; + case Token.GETTER_DEF: + type = Name.Type.GET; + break; + case Token.SETTER_DEF: + type = Name.Type.SET; + break; + default: + throw new IllegalStateException(""unexpected:"" + n); + } + break; + case Token.NAME: + if (parent != null) { + switch (parent.getType()) { + case Token.VAR: + isSet = true; + Node rvalue = n.getFirstChild(); + type = rvalue == null ? Name.Type.OTHER : getValueType(rvalue); + break; + case Token.ASSIGN: + if (parent.getFirstChild() == n) { + isSet = true; + type = getValueType(n.getNext()); + } + break; + case Token.GETPROP: + return; + case Token.FUNCTION: + Node gramps = parent.getParent(); + if (gramps == null || NodeUtil.isFunctionExpression(parent)) { + return; + } + isSet = true; + type = Name.Type.FUNCTION; + break; + case Token.INC: + case Token.DEC: + isSet = true; + type = Name.Type.OTHER; + break; + default: + if (NodeUtil.isAssignmentOp(parent) && + parent.getFirstChild() == n) { + isSet = true; + type = Name.Type.OTHER; + } + } + } + name = n.getString(); + break; + case Token.GETPROP: + if (parent != null) { + switch (parent.getType()) { + case Token.ASSIGN: + if (parent.getFirstChild() == n) { + isSet = true; + type = getValueType(n.getNext()); + isPropAssign = true; + } + break; + case Token.INC: + case Token.DEC: + isSet = true; + type = Name.Type.OTHER; + break; + case Token.GETPROP: + return; + default: + if (NodeUtil.isAssignmentOp(parent) && + parent.getFirstChild() == n) { + isSet = true; + type = Name.Type.OTHER; + } + } + } + name = n.getQualifiedName(); + if (name == null) { + return; + } + break; + default: + return; + } + if (!isGlobalNameReference(name, scope)) { + return; + } + if (isSet) { + if (isGlobalScope(scope)) { + handleSetFromGlobal(module, scope, n, parent, name, isPropAssign, type); + } else { + handleSetFromLocal(module, scope, n, parent, name); + } + } else { + handleGet(module, scope, n, parent, name); + } + } +"," public void collect(JSModule module, Scope scope, Node n) { + Node parent = n.getParent(); + String name; + boolean isSet = false; + Name.Type type = Name.Type.OTHER; + boolean isPropAssign = false; + switch (n.getType()) { + case Token.GETTER_DEF: + case Token.SETTER_DEF: + case Token.STRING_KEY: + name = null; + if (parent != null && parent.isObjectLit()) { + name = getNameForObjLitKey(n); + } + if (name == null) { + return; + } + isSet = true; + switch (n.getType()) { + case Token.STRING_KEY: + type = getValueType(n.getFirstChild()); + break; + case Token.GETTER_DEF: + type = Name.Type.GET; + break; + case Token.SETTER_DEF: + type = Name.Type.SET; + break; + default: + throw new IllegalStateException(""unexpected:"" + n); + } + break; + case Token.NAME: + if (parent != null) { + switch (parent.getType()) { + case Token.VAR: + isSet = true; + Node rvalue = n.getFirstChild(); + type = rvalue == null ? Name.Type.OTHER : getValueType(rvalue); + break; + case Token.ASSIGN: + if (parent.getFirstChild() == n) { + isSet = true; + type = getValueType(n.getNext()); + } + break; + case Token.GETPROP: + return; + case Token.FUNCTION: + Node gramps = parent.getParent(); + if (gramps == null || NodeUtil.isFunctionExpression(parent)) { + return; + } + isSet = true; + type = Name.Type.FUNCTION; + break; + case Token.CATCH: + case Token.INC: + case Token.DEC: + isSet = true; + type = Name.Type.OTHER; + break; + default: + if (NodeUtil.isAssignmentOp(parent) && + parent.getFirstChild() == n) { + isSet = true; + type = Name.Type.OTHER; + } + } + } + name = n.getString(); + break; + case Token.GETPROP: + if (parent != null) { + switch (parent.getType()) { + case Token.ASSIGN: + if (parent.getFirstChild() == n) { + isSet = true; + type = getValueType(n.getNext()); + isPropAssign = true; + } + break; + case Token.INC: + case Token.DEC: + isSet = true; + type = Name.Type.OTHER; + break; + case Token.GETPROP: + return; + default: + if (NodeUtil.isAssignmentOp(parent) && + parent.getFirstChild() == n) { + isSet = true; + type = Name.Type.OTHER; + } + } + } + name = n.getQualifiedName(); + if (name == null) { + return; + } + break; + default: + return; + } + if (!isGlobalNameReference(name, scope)) { + return; + } + if (isSet) { + if (isGlobalScope(scope)) { + handleSetFromGlobal(module, scope, n, parent, name, isPropAssign, type); + } else { + handleSetFromLocal(module, scope, n, parent, name); + } + } else { + handleGet(module, scope, n, parent, name); + } + } +" +JacksonDatabind-19," private JavaType _mapType(Class rawClass) + { + JavaType[] typeParams = findTypeParameters(rawClass, Map.class); + if (typeParams == null) { + return MapType.construct(rawClass, _unknownType(), _unknownType()); + } + if (typeParams.length != 2) { + throw new IllegalArgumentException(""Strange Map type ""+rawClass.getName()+"": can not determine type parameters""); + } + return MapType.construct(rawClass, typeParams[0], typeParams[1]); + } +"," private JavaType _mapType(Class rawClass) + { + if (rawClass == Properties.class) { + return MapType.construct(rawClass, CORE_TYPE_STRING, CORE_TYPE_STRING); + } + JavaType[] typeParams = findTypeParameters(rawClass, Map.class); + if (typeParams == null) { + return MapType.construct(rawClass, _unknownType(), _unknownType()); + } + if (typeParams.length != 2) { + throw new IllegalArgumentException(""Strange Map type ""+rawClass.getName()+"": can not determine type parameters""); + } + return MapType.construct(rawClass, typeParams[0], typeParams[1]); + } +" +Closure-56," public String getLine(int lineNumber) { + String js = """"; + try { + js = getCode(); + } catch (IOException e) { + return null; + } + int pos = 0; + int startLine = 1; + if (lineNumber >= lastLine) { + pos = lastOffset; + startLine = lastLine; + } + for (int n = startLine; n < lineNumber; n++) { + int nextpos = js.indexOf('\n', pos); + if (nextpos == -1) { + return null; + } + pos = nextpos + 1; + } + lastOffset = pos; + lastLine = lineNumber; + if (js.indexOf('\n', pos) == -1) { + return null; + } else { + return js.substring(pos, js.indexOf('\n', pos)); + } + } +"," public String getLine(int lineNumber) { + String js = """"; + try { + js = getCode(); + } catch (IOException e) { + return null; + } + int pos = 0; + int startLine = 1; + if (lineNumber >= lastLine) { + pos = lastOffset; + startLine = lastLine; + } + for (int n = startLine; n < lineNumber; n++) { + int nextpos = js.indexOf('\n', pos); + if (nextpos == -1) { + return null; + } + pos = nextpos + 1; + } + lastOffset = pos; + lastLine = lineNumber; + if (js.indexOf('\n', pos) == -1) { + if (pos >= js.length()) { + return null; + } else { + return js.substring(pos, js.length()); + } + } else { + return js.substring(pos, js.indexOf('\n', pos)); + } + } +" +Math-103," public double cumulativeProbability(double x) throws MathException { + return 0.5 * (1.0 + Erf.erf((x - mean) / + (standardDeviation * Math.sqrt(2.0)))); + } +"," public double cumulativeProbability(double x) throws MathException { + try { + return 0.5 * (1.0 + Erf.erf((x - mean) / + (standardDeviation * Math.sqrt(2.0)))); + } catch (MaxIterationsExceededException ex) { + if (x < (mean - 20 * standardDeviation)) { + return 0.0d; + } else if (x > (mean + 20 * standardDeviation)) { + return 1.0d; + } else { + throw ex; + } + } + } +" +Math-80," private boolean flipIfWarranted(final int n, final int step) { + if (1.5 * work[pingPong] < work[4 * (n - 1) + pingPong]) { + int j = 4 * n - 1; + for (int i = 0; i < j; i += 4) { + for (int k = 0; k < 4; k += step) { + final double tmp = work[i + k]; + work[i + k] = work[j - k]; + work[j - k] = tmp; + } + j -= 4; + } + return true; + } + return false; + } +"," private boolean flipIfWarranted(final int n, final int step) { + if (1.5 * work[pingPong] < work[4 * (n - 1) + pingPong]) { + int j = 4 * (n - 1); + for (int i = 0; i < j; i += 4) { + for (int k = 0; k < 4; k += step) { + final double tmp = work[i + k]; + work[i + k] = work[j - k]; + work[j - k] = tmp; + } + j -= 4; + } + return true; + } + return false; + } +" +Math-41," public double evaluate(final double[] values, final double[] weights, + final double mean, final int begin, final int length) { + double var = Double.NaN; + if (test(values, weights, begin, length)) { + if (length == 1) { + var = 0.0; + } else if (length > 1) { + double accum = 0.0; + double dev = 0.0; + double accum2 = 0.0; + for (int i = begin; i < begin + length; i++) { + dev = values[i] - mean; + accum += weights[i] * (dev * dev); + accum2 += weights[i] * dev; + } + double sumWts = 0; + for (int i = 0; i < weights.length; i++) { + sumWts += weights[i]; + } + if (isBiasCorrected) { + var = (accum - (accum2 * accum2 / sumWts)) / (sumWts - 1.0); + } else { + var = (accum - (accum2 * accum2 / sumWts)) / sumWts; + } + } + } + return var; + } +"," public double evaluate(final double[] values, final double[] weights, + final double mean, final int begin, final int length) { + double var = Double.NaN; + if (test(values, weights, begin, length)) { + if (length == 1) { + var = 0.0; + } else if (length > 1) { + double accum = 0.0; + double dev = 0.0; + double accum2 = 0.0; + for (int i = begin; i < begin + length; i++) { + dev = values[i] - mean; + accum += weights[i] * (dev * dev); + accum2 += weights[i] * dev; + } + double sumWts = 0; + for (int i = begin; i < begin + length; i++) { + sumWts += weights[i]; + } + if (isBiasCorrected) { + var = (accum - (accum2 * accum2 / sumWts)) / (sumWts - 1.0); + } else { + var = (accum - (accum2 * accum2 / sumWts)) / sumWts; + } + } + } + return var; + } +" +Math-17," public Dfp multiply(final int x) { + return multiplyFast(x); + } +"," public Dfp multiply(final int x) { + if (x >= 0 && x < RADIX) { + return multiplyFast(x); + } else { + return multiply(newInstance(x)); + } + } +" +Math-38," private void prelim(double[] lowerBound, + double[] upperBound) { + printMethod(); + final int n = currentBest.getDimension(); + final int npt = numberOfInterpolationPoints; + final int ndim = bMatrix.getRowDimension(); + final double rhosq = initialTrustRegionRadius * initialTrustRegionRadius; + final double recip = 1d / rhosq; + final int np = n + 1; + for (int j = 0; j < n; j++) { + originShift.setEntry(j, currentBest.getEntry(j)); + for (int k = 0; k < npt; k++) { + interpolationPoints.setEntry(k, j, ZERO); + } + for (int i = 0; i < ndim; i++) { + bMatrix.setEntry(i, j, ZERO); + } + } + for (int i = 0, max = n * np / 2; i < max; i++) { + modelSecondDerivativesValues.setEntry(i, ZERO); + } + for (int k = 0; k < npt; k++) { + modelSecondDerivativesParameters.setEntry(k, ZERO); + for (int j = 0, max = npt - np; j < max; j++) { + zMatrix.setEntry(k, j, ZERO); + } + } + int ipt = 0; + int jpt = 0; + double fbeg = Double.NaN; + do { + final int nfm = getEvaluations(); + final int nfx = nfm - n; + final int nfmm = nfm - 1; + final int nfxm = nfx - 1; + double stepa = 0; + double stepb = 0; + if (nfm <= 2 * n) { + if (nfm >= 1 && + nfm <= n) { + stepa = initialTrustRegionRadius; + if (upperDifference.getEntry(nfmm) == ZERO) { + stepa = -stepa; + throw new PathIsExploredException(); + } + interpolationPoints.setEntry(nfm, nfmm, stepa); + } else if (nfm > n) { + stepa = interpolationPoints.getEntry(nfx, nfxm); + stepb = -initialTrustRegionRadius; + if (lowerDifference.getEntry(nfxm) == ZERO) { + stepb = Math.min(TWO * initialTrustRegionRadius, upperDifference.getEntry(nfxm)); + throw new PathIsExploredException(); + } + if (upperDifference.getEntry(nfxm) == ZERO) { + stepb = Math.max(-TWO * initialTrustRegionRadius, lowerDifference.getEntry(nfxm)); + throw new PathIsExploredException(); + } + interpolationPoints.setEntry(nfm, nfxm, stepb); + } + } else { + final int tmp1 = (nfm - np) / n; + jpt = nfm - tmp1 * n - n; + ipt = jpt + tmp1; + if (ipt > n) { + final int tmp2 = jpt; + jpt = ipt - n; + ipt = tmp2; + throw new PathIsExploredException(); + } + final int iptMinus1 = ipt; + final int jptMinus1 = jpt; + interpolationPoints.setEntry(nfm, iptMinus1, interpolationPoints.getEntry(ipt, iptMinus1)); + interpolationPoints.setEntry(nfm, jptMinus1, interpolationPoints.getEntry(jpt, jptMinus1)); + } + for (int j = 0; j < n; j++) { + currentBest.setEntry(j, Math.min(Math.max(lowerBound[j], + originShift.getEntry(j) + interpolationPoints.getEntry(nfm, j)), + upperBound[j])); + if (interpolationPoints.getEntry(nfm, j) == lowerDifference.getEntry(j)) { + currentBest.setEntry(j, lowerBound[j]); + } + if (interpolationPoints.getEntry(nfm, j) == upperDifference.getEntry(j)) { + currentBest.setEntry(j, upperBound[j]); + } + } + final double objectiveValue = computeObjectiveValue(currentBest.toArray()); + final double f = isMinimize ? objectiveValue : -objectiveValue; + final int numEval = getEvaluations(); + fAtInterpolationPoints.setEntry(nfm, f); + if (numEval == 1) { + fbeg = f; + trustRegionCenterInterpolationPointIndex = 0; + } else if (f < fAtInterpolationPoints.getEntry(trustRegionCenterInterpolationPointIndex)) { + trustRegionCenterInterpolationPointIndex = nfm; + } + if (numEval <= 2 * n + 1) { + if (numEval >= 2 && + numEval <= n + 1) { + gradientAtTrustRegionCenter.setEntry(nfmm, (f - fbeg) / stepa); + if (npt < numEval + n) { + final double oneOverStepA = ONE / stepa; + bMatrix.setEntry(0, nfmm, -oneOverStepA); + bMatrix.setEntry(nfm, nfmm, oneOverStepA); + bMatrix.setEntry(npt + nfmm, nfmm, -HALF * rhosq); + throw new PathIsExploredException(); + } + } else if (numEval >= n + 2) { + final int ih = nfx * (nfx + 1) / 2 - 1; + final double tmp = (f - fbeg) / stepb; + final double diff = stepb - stepa; + modelSecondDerivativesValues.setEntry(ih, TWO * (tmp - gradientAtTrustRegionCenter.getEntry(nfxm)) / diff); + gradientAtTrustRegionCenter.setEntry(nfxm, (gradientAtTrustRegionCenter.getEntry(nfxm) * stepb - tmp * stepa) / diff); + if (stepa * stepb < ZERO) { + if (f < fAtInterpolationPoints.getEntry(nfm - n)) { + fAtInterpolationPoints.setEntry(nfm, fAtInterpolationPoints.getEntry(nfm - n)); + fAtInterpolationPoints.setEntry(nfm - n, f); + if (trustRegionCenterInterpolationPointIndex == nfm) { + trustRegionCenterInterpolationPointIndex = nfm - n; + } + interpolationPoints.setEntry(nfm - n, nfxm, stepb); + interpolationPoints.setEntry(nfm, nfxm, stepa); + } + } + bMatrix.setEntry(0, nfxm, -(stepa + stepb) / (stepa * stepb)); + bMatrix.setEntry(nfm, nfxm, -HALF / interpolationPoints.getEntry(nfm - n, nfxm)); + bMatrix.setEntry(nfm - n, nfxm, + -bMatrix.getEntry(0, nfxm) - bMatrix.getEntry(nfm, nfxm)); + zMatrix.setEntry(0, nfxm, Math.sqrt(TWO) / (stepa * stepb)); + zMatrix.setEntry(nfm, nfxm, Math.sqrt(HALF) / rhosq); + zMatrix.setEntry(nfm - n, nfxm, + -zMatrix.getEntry(0, nfxm) - zMatrix.getEntry(nfm, nfxm)); + } + } else { + zMatrix.setEntry(0, nfxm, recip); + zMatrix.setEntry(nfm, nfxm, recip); + zMatrix.setEntry(ipt, nfxm, -recip); + zMatrix.setEntry(jpt, nfxm, -recip); + final int ih = ipt * (ipt - 1) / 2 + jpt - 1; + final double tmp = interpolationPoints.getEntry(nfm, ipt - 1) * interpolationPoints.getEntry(nfm, jpt - 1); + modelSecondDerivativesValues.setEntry(ih, (fbeg - fAtInterpolationPoints.getEntry(ipt) - fAtInterpolationPoints.getEntry(jpt) + f) / tmp); + throw new PathIsExploredException(); + } + } while (getEvaluations() < npt); + } +"," private void prelim(double[] lowerBound, + double[] upperBound) { + printMethod(); + final int n = currentBest.getDimension(); + final int npt = numberOfInterpolationPoints; + final int ndim = bMatrix.getRowDimension(); + final double rhosq = initialTrustRegionRadius * initialTrustRegionRadius; + final double recip = 1d / rhosq; + final int np = n + 1; + for (int j = 0; j < n; j++) { + originShift.setEntry(j, currentBest.getEntry(j)); + for (int k = 0; k < npt; k++) { + interpolationPoints.setEntry(k, j, ZERO); + } + for (int i = 0; i < ndim; i++) { + bMatrix.setEntry(i, j, ZERO); + } + } + for (int i = 0, max = n * np / 2; i < max; i++) { + modelSecondDerivativesValues.setEntry(i, ZERO); + } + for (int k = 0; k < npt; k++) { + modelSecondDerivativesParameters.setEntry(k, ZERO); + for (int j = 0, max = npt - np; j < max; j++) { + zMatrix.setEntry(k, j, ZERO); + } + } + int ipt = 0; + int jpt = 0; + double fbeg = Double.NaN; + do { + final int nfm = getEvaluations(); + final int nfx = nfm - n; + final int nfmm = nfm - 1; + final int nfxm = nfx - 1; + double stepa = 0; + double stepb = 0; + if (nfm <= 2 * n) { + if (nfm >= 1 && + nfm <= n) { + stepa = initialTrustRegionRadius; + if (upperDifference.getEntry(nfmm) == ZERO) { + stepa = -stepa; + throw new PathIsExploredException(); + } + interpolationPoints.setEntry(nfm, nfmm, stepa); + } else if (nfm > n) { + stepa = interpolationPoints.getEntry(nfx, nfxm); + stepb = -initialTrustRegionRadius; + if (lowerDifference.getEntry(nfxm) == ZERO) { + stepb = Math.min(TWO * initialTrustRegionRadius, upperDifference.getEntry(nfxm)); + throw new PathIsExploredException(); + } + if (upperDifference.getEntry(nfxm) == ZERO) { + stepb = Math.max(-TWO * initialTrustRegionRadius, lowerDifference.getEntry(nfxm)); + throw new PathIsExploredException(); + } + interpolationPoints.setEntry(nfm, nfxm, stepb); + } + } else { + final int tmp1 = (nfm - np) / n; + jpt = nfm - tmp1 * n - n; + ipt = jpt + tmp1; + if (ipt > n) { + final int tmp2 = jpt; + jpt = ipt - n; + ipt = tmp2; + } + final int iptMinus1 = ipt - 1; + final int jptMinus1 = jpt - 1; + interpolationPoints.setEntry(nfm, iptMinus1, interpolationPoints.getEntry(ipt, iptMinus1)); + interpolationPoints.setEntry(nfm, jptMinus1, interpolationPoints.getEntry(jpt, jptMinus1)); + } + for (int j = 0; j < n; j++) { + currentBest.setEntry(j, Math.min(Math.max(lowerBound[j], + originShift.getEntry(j) + interpolationPoints.getEntry(nfm, j)), + upperBound[j])); + if (interpolationPoints.getEntry(nfm, j) == lowerDifference.getEntry(j)) { + currentBest.setEntry(j, lowerBound[j]); + } + if (interpolationPoints.getEntry(nfm, j) == upperDifference.getEntry(j)) { + currentBest.setEntry(j, upperBound[j]); + } + } + final double objectiveValue = computeObjectiveValue(currentBest.toArray()); + final double f = isMinimize ? objectiveValue : -objectiveValue; + final int numEval = getEvaluations(); + fAtInterpolationPoints.setEntry(nfm, f); + if (numEval == 1) { + fbeg = f; + trustRegionCenterInterpolationPointIndex = 0; + } else if (f < fAtInterpolationPoints.getEntry(trustRegionCenterInterpolationPointIndex)) { + trustRegionCenterInterpolationPointIndex = nfm; + } + if (numEval <= 2 * n + 1) { + if (numEval >= 2 && + numEval <= n + 1) { + gradientAtTrustRegionCenter.setEntry(nfmm, (f - fbeg) / stepa); + if (npt < numEval + n) { + final double oneOverStepA = ONE / stepa; + bMatrix.setEntry(0, nfmm, -oneOverStepA); + bMatrix.setEntry(nfm, nfmm, oneOverStepA); + bMatrix.setEntry(npt + nfmm, nfmm, -HALF * rhosq); + throw new PathIsExploredException(); + } + } else if (numEval >= n + 2) { + final int ih = nfx * (nfx + 1) / 2 - 1; + final double tmp = (f - fbeg) / stepb; + final double diff = stepb - stepa; + modelSecondDerivativesValues.setEntry(ih, TWO * (tmp - gradientAtTrustRegionCenter.getEntry(nfxm)) / diff); + gradientAtTrustRegionCenter.setEntry(nfxm, (gradientAtTrustRegionCenter.getEntry(nfxm) * stepb - tmp * stepa) / diff); + if (stepa * stepb < ZERO) { + if (f < fAtInterpolationPoints.getEntry(nfm - n)) { + fAtInterpolationPoints.setEntry(nfm, fAtInterpolationPoints.getEntry(nfm - n)); + fAtInterpolationPoints.setEntry(nfm - n, f); + if (trustRegionCenterInterpolationPointIndex == nfm) { + trustRegionCenterInterpolationPointIndex = nfm - n; + } + interpolationPoints.setEntry(nfm - n, nfxm, stepb); + interpolationPoints.setEntry(nfm, nfxm, stepa); + } + } + bMatrix.setEntry(0, nfxm, -(stepa + stepb) / (stepa * stepb)); + bMatrix.setEntry(nfm, nfxm, -HALF / interpolationPoints.getEntry(nfm - n, nfxm)); + bMatrix.setEntry(nfm - n, nfxm, + -bMatrix.getEntry(0, nfxm) - bMatrix.getEntry(nfm, nfxm)); + zMatrix.setEntry(0, nfxm, Math.sqrt(TWO) / (stepa * stepb)); + zMatrix.setEntry(nfm, nfxm, Math.sqrt(HALF) / rhosq); + zMatrix.setEntry(nfm - n, nfxm, + -zMatrix.getEntry(0, nfxm) - zMatrix.getEntry(nfm, nfxm)); + } + } else { + zMatrix.setEntry(0, nfxm, recip); + zMatrix.setEntry(nfm, nfxm, recip); + zMatrix.setEntry(ipt, nfxm, -recip); + zMatrix.setEntry(jpt, nfxm, -recip); + final int ih = ipt * (ipt - 1) / 2 + jpt - 1; + final double tmp = interpolationPoints.getEntry(nfm, ipt - 1) * interpolationPoints.getEntry(nfm, jpt - 1); + modelSecondDerivativesValues.setEntry(ih, (fbeg - fAtInterpolationPoints.getEntry(ipt) - fAtInterpolationPoints.getEntry(jpt) + f) / tmp); + } + } while (getEvaluations() < npt); + } +" +Lang-37," public static T[] addAll(T[] array1, T... array2) { + if (array1 == null) { + return clone(array2); + } else if (array2 == null) { + return clone(array1); + } + final Class type1 = array1.getClass().getComponentType(); + T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length); + System.arraycopy(array1, 0, joinedArray, 0, array1.length); + System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); + return joinedArray; + } +"," public static T[] addAll(T[] array1, T... array2) { + if (array1 == null) { + return clone(array2); + } else if (array2 == null) { + return clone(array1); + } + final Class type1 = array1.getClass().getComponentType(); + T[] joinedArray = (T[]) Array.newInstance(type1, array1.length + array2.length); + System.arraycopy(array1, 0, joinedArray, 0, array1.length); + try { + System.arraycopy(array2, 0, joinedArray, array1.length, array2.length); + } catch (ArrayStoreException ase) { + final Class type2 = array2.getClass().getComponentType(); + if (!type1.isAssignableFrom(type2)){ + throw new IllegalArgumentException(""Cannot store ""+type2.getName()+"" in an array of ""+type1.getName()); + } + throw ase; + } + return joinedArray; + } +" +Closure-132," private Node tryMinimizeIf(Node n) { + Node parent = n.getParent(); + Node cond = n.getFirstChild(); + if (NodeUtil.isLiteralValue(cond, true)) { + return n; + } + Node thenBranch = cond.getNext(); + Node elseBranch = thenBranch.getNext(); + if (elseBranch == null) { + if (isFoldableExpressBlock(thenBranch)) { + Node expr = getBlockExpression(thenBranch); + if (!late && isPropertyAssignmentInExpression(expr)) { + return n; + } + if (cond.isNot()) { + if (isLowerPrecedenceInExpression(cond, OR_PRECEDENCE) && + isLowerPrecedenceInExpression(expr.getFirstChild(), + OR_PRECEDENCE)) { + return n; + } + Node or = IR.or( + cond.removeFirstChild(), + expr.removeFirstChild()).srcref(n); + Node newExpr = NodeUtil.newExpr(or); + parent.replaceChild(n, newExpr); + reportCodeChange(); + return newExpr; + } + if (isLowerPrecedenceInExpression(cond, AND_PRECEDENCE) && + isLowerPrecedenceInExpression(expr.getFirstChild(), + AND_PRECEDENCE)) { + return n; + } + n.removeChild(cond); + Node and = IR.and(cond, expr.removeFirstChild()).srcref(n); + Node newExpr = NodeUtil.newExpr(and); + parent.replaceChild(n, newExpr); + reportCodeChange(); + return newExpr; + } else { + if (NodeUtil.isStatementBlock(thenBranch) && + thenBranch.hasOneChild()) { + Node innerIf = thenBranch.getFirstChild(); + if (innerIf.isIf()) { + Node innerCond = innerIf.getFirstChild(); + Node innerThenBranch = innerCond.getNext(); + Node innerElseBranch = innerThenBranch.getNext(); + if (innerElseBranch == null && + !(isLowerPrecedenceInExpression(cond, AND_PRECEDENCE) && + isLowerPrecedenceInExpression(innerCond, AND_PRECEDENCE))) { + n.detachChildren(); + n.addChildToBack( + IR.and( + cond, + innerCond.detachFromParent()) + .srcref(cond)); + n.addChildrenToBack(innerThenBranch.detachFromParent()); + reportCodeChange(); + return n; + } + } + } + } + return n; + } + tryRemoveRepeatedStatements(n); + if (cond.isNot() && !consumesDanglingElse(elseBranch)) { + n.replaceChild(cond, cond.removeFirstChild()); + n.removeChild(thenBranch); + n.addChildToBack(thenBranch); + reportCodeChange(); + return n; + } + if (isReturnExpressBlock(thenBranch) && isReturnExpressBlock(elseBranch)) { + Node thenExpr = getBlockReturnExpression(thenBranch); + Node elseExpr = getBlockReturnExpression(elseBranch); + n.removeChild(cond); + thenExpr.detachFromParent(); + elseExpr.detachFromParent(); + Node returnNode = IR.returnNode( + IR.hook(cond, thenExpr, elseExpr) + .srcref(n)); + parent.replaceChild(n, returnNode); + reportCodeChange(); + return returnNode; + } + boolean thenBranchIsExpressionBlock = isFoldableExpressBlock(thenBranch); + boolean elseBranchIsExpressionBlock = isFoldableExpressBlock(elseBranch); + if (thenBranchIsExpressionBlock && elseBranchIsExpressionBlock) { + Node thenOp = getBlockExpression(thenBranch).getFirstChild(); + Node elseOp = getBlockExpression(elseBranch).getFirstChild(); + if (thenOp.getType() == elseOp.getType()) { + if (NodeUtil.isAssignmentOp(thenOp)) { + Node lhs = thenOp.getFirstChild(); + if (areNodesEqualForInlining(lhs, elseOp.getFirstChild()) && + !mayEffectMutableState(lhs)) { + n.removeChild(cond); + Node assignName = thenOp.removeFirstChild(); + Node thenExpr = thenOp.removeFirstChild(); + Node elseExpr = elseOp.getLastChild(); + elseOp.removeChild(elseExpr); + Node hookNode = IR.hook(cond, thenExpr, elseExpr).srcref(n); + Node assign = new Node(thenOp.getType(), assignName, hookNode) + .srcref(thenOp); + Node expr = NodeUtil.newExpr(assign); + parent.replaceChild(n, expr); + reportCodeChange(); + return expr; + } + } + } + n.removeChild(cond); + thenOp.detachFromParent(); + elseOp.detachFromParent(); + Node expr = IR.exprResult( + IR.hook(cond, thenOp, elseOp).srcref(n)); + parent.replaceChild(n, expr); + reportCodeChange(); + return expr; + } + boolean thenBranchIsVar = isVarBlock(thenBranch); + boolean elseBranchIsVar = isVarBlock(elseBranch); + if (thenBranchIsVar && elseBranchIsExpressionBlock && + getBlockExpression(elseBranch).getFirstChild().isAssign()) { + Node var = getBlockVar(thenBranch); + Node elseAssign = getBlockExpression(elseBranch).getFirstChild(); + Node name1 = var.getFirstChild(); + Node maybeName2 = elseAssign.getFirstChild(); + if (name1.hasChildren() + && maybeName2.isName() + && name1.getString().equals(maybeName2.getString())) { + Node thenExpr = name1.removeChildren(); + Node elseExpr = elseAssign.getLastChild().detachFromParent(); + cond.detachFromParent(); + Node hookNode = IR.hook(cond, thenExpr, elseExpr) + .srcref(n); + var.detachFromParent(); + name1.addChildrenToBack(hookNode); + parent.replaceChild(n, var); + reportCodeChange(); + return var; + } + } else if (elseBranchIsVar && thenBranchIsExpressionBlock && + getBlockExpression(thenBranch).getFirstChild().isAssign()) { + Node var = getBlockVar(elseBranch); + Node thenAssign = getBlockExpression(thenBranch).getFirstChild(); + Node maybeName1 = thenAssign.getFirstChild(); + Node name2 = var.getFirstChild(); + if (name2.hasChildren() + && maybeName1.isName() + && maybeName1.getString().equals(name2.getString())) { + Node thenExpr = thenAssign.getLastChild().detachFromParent(); + Node elseExpr = name2.removeChildren(); + cond.detachFromParent(); + Node hookNode = IR.hook(cond, thenExpr, elseExpr) + .srcref(n); + var.detachFromParent(); + name2.addChildrenToBack(hookNode); + parent.replaceChild(n, var); + reportCodeChange(); + return var; + } + } + return n; + } +"," private Node tryMinimizeIf(Node n) { + Node parent = n.getParent(); + Node cond = n.getFirstChild(); + if (NodeUtil.isLiteralValue(cond, true)) { + return n; + } + Node thenBranch = cond.getNext(); + Node elseBranch = thenBranch.getNext(); + if (elseBranch == null) { + if (isFoldableExpressBlock(thenBranch)) { + Node expr = getBlockExpression(thenBranch); + if (!late && isPropertyAssignmentInExpression(expr)) { + return n; + } + if (cond.isNot()) { + if (isLowerPrecedenceInExpression(cond, OR_PRECEDENCE) && + isLowerPrecedenceInExpression(expr.getFirstChild(), + OR_PRECEDENCE)) { + return n; + } + Node or = IR.or( + cond.removeFirstChild(), + expr.removeFirstChild()).srcref(n); + Node newExpr = NodeUtil.newExpr(or); + parent.replaceChild(n, newExpr); + reportCodeChange(); + return newExpr; + } + if (isLowerPrecedenceInExpression(cond, AND_PRECEDENCE) && + isLowerPrecedenceInExpression(expr.getFirstChild(), + AND_PRECEDENCE)) { + return n; + } + n.removeChild(cond); + Node and = IR.and(cond, expr.removeFirstChild()).srcref(n); + Node newExpr = NodeUtil.newExpr(and); + parent.replaceChild(n, newExpr); + reportCodeChange(); + return newExpr; + } else { + if (NodeUtil.isStatementBlock(thenBranch) && + thenBranch.hasOneChild()) { + Node innerIf = thenBranch.getFirstChild(); + if (innerIf.isIf()) { + Node innerCond = innerIf.getFirstChild(); + Node innerThenBranch = innerCond.getNext(); + Node innerElseBranch = innerThenBranch.getNext(); + if (innerElseBranch == null && + !(isLowerPrecedenceInExpression(cond, AND_PRECEDENCE) && + isLowerPrecedenceInExpression(innerCond, AND_PRECEDENCE))) { + n.detachChildren(); + n.addChildToBack( + IR.and( + cond, + innerCond.detachFromParent()) + .srcref(cond)); + n.addChildrenToBack(innerThenBranch.detachFromParent()); + reportCodeChange(); + return n; + } + } + } + } + return n; + } + tryRemoveRepeatedStatements(n); + if (cond.isNot() && !consumesDanglingElse(elseBranch)) { + n.replaceChild(cond, cond.removeFirstChild()); + n.removeChild(thenBranch); + n.addChildToBack(thenBranch); + reportCodeChange(); + return n; + } + if (isReturnExpressBlock(thenBranch) && isReturnExpressBlock(elseBranch)) { + Node thenExpr = getBlockReturnExpression(thenBranch); + Node elseExpr = getBlockReturnExpression(elseBranch); + n.removeChild(cond); + thenExpr.detachFromParent(); + elseExpr.detachFromParent(); + Node returnNode = IR.returnNode( + IR.hook(cond, thenExpr, elseExpr) + .srcref(n)); + parent.replaceChild(n, returnNode); + reportCodeChange(); + return returnNode; + } + boolean thenBranchIsExpressionBlock = isFoldableExpressBlock(thenBranch); + boolean elseBranchIsExpressionBlock = isFoldableExpressBlock(elseBranch); + if (thenBranchIsExpressionBlock && elseBranchIsExpressionBlock) { + Node thenOp = getBlockExpression(thenBranch).getFirstChild(); + Node elseOp = getBlockExpression(elseBranch).getFirstChild(); + if (thenOp.getType() == elseOp.getType()) { + if (NodeUtil.isAssignmentOp(thenOp)) { + Node lhs = thenOp.getFirstChild(); + if (areNodesEqualForInlining(lhs, elseOp.getFirstChild()) && + !mayEffectMutableState(lhs) && + (!mayHaveSideEffects(cond) || + (thenOp.isAssign() && thenOp.getFirstChild().isName()))) { + n.removeChild(cond); + Node assignName = thenOp.removeFirstChild(); + Node thenExpr = thenOp.removeFirstChild(); + Node elseExpr = elseOp.getLastChild(); + elseOp.removeChild(elseExpr); + Node hookNode = IR.hook(cond, thenExpr, elseExpr).srcref(n); + Node assign = new Node(thenOp.getType(), assignName, hookNode) + .srcref(thenOp); + Node expr = NodeUtil.newExpr(assign); + parent.replaceChild(n, expr); + reportCodeChange(); + return expr; + } + } + } + n.removeChild(cond); + thenOp.detachFromParent(); + elseOp.detachFromParent(); + Node expr = IR.exprResult( + IR.hook(cond, thenOp, elseOp).srcref(n)); + parent.replaceChild(n, expr); + reportCodeChange(); + return expr; + } + boolean thenBranchIsVar = isVarBlock(thenBranch); + boolean elseBranchIsVar = isVarBlock(elseBranch); + if (thenBranchIsVar && elseBranchIsExpressionBlock && + getBlockExpression(elseBranch).getFirstChild().isAssign()) { + Node var = getBlockVar(thenBranch); + Node elseAssign = getBlockExpression(elseBranch).getFirstChild(); + Node name1 = var.getFirstChild(); + Node maybeName2 = elseAssign.getFirstChild(); + if (name1.hasChildren() + && maybeName2.isName() + && name1.getString().equals(maybeName2.getString())) { + Node thenExpr = name1.removeChildren(); + Node elseExpr = elseAssign.getLastChild().detachFromParent(); + cond.detachFromParent(); + Node hookNode = IR.hook(cond, thenExpr, elseExpr) + .srcref(n); + var.detachFromParent(); + name1.addChildrenToBack(hookNode); + parent.replaceChild(n, var); + reportCodeChange(); + return var; + } + } else if (elseBranchIsVar && thenBranchIsExpressionBlock && + getBlockExpression(thenBranch).getFirstChild().isAssign()) { + Node var = getBlockVar(elseBranch); + Node thenAssign = getBlockExpression(thenBranch).getFirstChild(); + Node maybeName1 = thenAssign.getFirstChild(); + Node name2 = var.getFirstChild(); + if (name2.hasChildren() + && maybeName1.isName() + && maybeName1.getString().equals(name2.getString())) { + Node thenExpr = thenAssign.getLastChild().detachFromParent(); + Node elseExpr = name2.removeChildren(); + cond.detachFromParent(); + Node hookNode = IR.hook(cond, thenExpr, elseExpr) + .srcref(n); + var.detachFromParent(); + name2.addChildrenToBack(hookNode); + parent.replaceChild(n, var); + reportCodeChange(); + return var; + } + } + return n; + } +" +Chart-12," public MultiplePiePlot(CategoryDataset dataset) { + super(); + this.dataset = dataset; + PiePlot piePlot = new PiePlot(null); + this.pieChart = new JFreeChart(piePlot); + this.pieChart.removeLegend(); + this.dataExtractOrder = TableOrder.BY_COLUMN; + this.pieChart.setBackgroundPaint(null); + TextTitle seriesTitle = new TextTitle(""Series Title"", + new Font(""SansSerif"", Font.BOLD, 12)); + seriesTitle.setPosition(RectangleEdge.BOTTOM); + this.pieChart.setTitle(seriesTitle); + this.aggregatedItemsKey = ""Other""; + this.aggregatedItemsPaint = Color.lightGray; + this.sectionPaints = new HashMap(); + } +"," public MultiplePiePlot(CategoryDataset dataset) { + super(); + setDataset(dataset); + PiePlot piePlot = new PiePlot(null); + this.pieChart = new JFreeChart(piePlot); + this.pieChart.removeLegend(); + this.dataExtractOrder = TableOrder.BY_COLUMN; + this.pieChart.setBackgroundPaint(null); + TextTitle seriesTitle = new TextTitle(""Series Title"", + new Font(""SansSerif"", Font.BOLD, 12)); + seriesTitle.setPosition(RectangleEdge.BOTTOM); + this.pieChart.setTitle(seriesTitle); + this.aggregatedItemsKey = ""Other""; + this.aggregatedItemsPaint = Color.lightGray; + this.sectionPaints = new HashMap(); + } +" +Closure-125," private void visitNew(NodeTraversal t, Node n) { + Node constructor = n.getFirstChild(); + JSType type = getJSType(constructor).restrictByNotNullOrUndefined(); + if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) { + FunctionType fnType = type.toMaybeFunctionType(); + if (fnType != null) { + visitParameterList(t, n, fnType); + ensureTyped(t, n, fnType.getInstanceType()); + } else { + ensureTyped(t, n); + } + } else { + report(t, n, NOT_A_CONSTRUCTOR); + ensureTyped(t, n); + } + } +"," private void visitNew(NodeTraversal t, Node n) { + Node constructor = n.getFirstChild(); + JSType type = getJSType(constructor).restrictByNotNullOrUndefined(); + if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) { + FunctionType fnType = type.toMaybeFunctionType(); + if (fnType != null && fnType.hasInstanceType()) { + visitParameterList(t, n, fnType); + ensureTyped(t, n, fnType.getInstanceType()); + } else { + ensureTyped(t, n); + } + } else { + report(t, n, NOT_A_CONSTRUCTOR); + ensureTyped(t, n); + } + } +" +Lang-16," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +"," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"") || str.startsWith(""0X"") || str.startsWith(""-0X"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +" +Codec-4," public Base64() { + this(false); + } +"," public Base64() { + this(0); + } +" +JacksonDatabind-28," public ObjectNode deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + if (p.getCurrentToken() == JsonToken.START_OBJECT) { + p.nextToken(); + return deserializeObject(p, ctxt, ctxt.getNodeFactory()); + } + if (p.getCurrentToken() == JsonToken.FIELD_NAME) { + return deserializeObject(p, ctxt, ctxt.getNodeFactory()); + } + throw ctxt.mappingException(ObjectNode.class); + } +"," public ObjectNode deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + if (p.isExpectedStartObjectToken() || p.hasToken(JsonToken.FIELD_NAME)) { + return deserializeObject(p, ctxt, ctxt.getNodeFactory()); + } + if (p.hasToken(JsonToken.END_OBJECT)) { + return ctxt.getNodeFactory().objectNode(); + } + throw ctxt.mappingException(ObjectNode.class); + } +" +JacksonDatabind-16," protected final boolean _add(Annotation ann) { + if (_annotations == null) { + _annotations = new HashMap,Annotation>(); + } + Annotation previous = _annotations.put(ann.annotationType(), ann); + return (previous != null) && previous.equals(ann); + } +"," protected final boolean _add(Annotation ann) { + if (_annotations == null) { + _annotations = new HashMap,Annotation>(); + } + Annotation previous = _annotations.put(ann.annotationType(), ann); + return (previous == null) || !previous.equals(ann); + } +" +JacksonDatabind-88," protected JavaType _typeFromId(String id, DatabindContext ctxt) throws IOException + { + TypeFactory tf = ctxt.getTypeFactory(); + if (id.indexOf('<') > 0) { + JavaType t = tf.constructFromCanonical(id); + return t; + } + Class cls; + try { + cls = tf.findClass(id); + } catch (ClassNotFoundException e) { + if (ctxt instanceof DeserializationContext) { + DeserializationContext dctxt = (DeserializationContext) ctxt; + return dctxt.handleUnknownTypeId(_baseType, id, this, ""no such class found""); + } + return null; + } catch (Exception e) { + throw new IllegalArgumentException(""Invalid type id '""+id+""' (for id type 'Id.class'): ""+e.getMessage(), e); + } + return tf.constructSpecializedType(_baseType, cls); + } +"," protected JavaType _typeFromId(String id, DatabindContext ctxt) throws IOException + { + TypeFactory tf = ctxt.getTypeFactory(); + if (id.indexOf('<') > 0) { + JavaType t = tf.constructFromCanonical(id); + if (!t.isTypeOrSubTypeOf(_baseType.getRawClass())) { + throw new IllegalArgumentException(String.format( + ""Class %s not subtype of %s"", t.getRawClass().getName(), _baseType)); + } + return t; + } + Class cls; + try { + cls = tf.findClass(id); + } catch (ClassNotFoundException e) { + if (ctxt instanceof DeserializationContext) { + DeserializationContext dctxt = (DeserializationContext) ctxt; + return dctxt.handleUnknownTypeId(_baseType, id, this, ""no such class found""); + } + return null; + } catch (Exception e) { + throw new IllegalArgumentException(""Invalid type id '""+id+""' (for id type 'Id.class'): ""+e.getMessage(), e); + } + return tf.constructSpecializedType(_baseType, cls); + } +" +Closure-35," private void inferPropertyTypesToMatchConstraint( + JSType type, JSType constraint) { + if (type == null || constraint == null) { + return; + } + ObjectType constraintObj = + ObjectType.cast(constraint.restrictByNotNullOrUndefined()); + if (constraintObj != null && constraintObj.isRecordType()) { + ObjectType objType = ObjectType.cast(type.restrictByNotNullOrUndefined()); + if (objType != null) { + for (String prop : constraintObj.getOwnPropertyNames()) { + JSType propType = constraintObj.getPropertyType(prop); + if (!objType.isPropertyTypeDeclared(prop)) { + JSType typeToInfer = propType; + if (!objType.hasProperty(prop)) { + typeToInfer = + getNativeType(VOID_TYPE).getLeastSupertype(propType); + } + objType.defineInferredProperty(prop, typeToInfer, null); + } + } + } + } + } +"," private void inferPropertyTypesToMatchConstraint( + JSType type, JSType constraint) { + if (type == null || constraint == null) { + return; + } + ObjectType constraintObj = + ObjectType.cast(constraint.restrictByNotNullOrUndefined()); + if (constraintObj != null) { + type.matchConstraint(constraintObj); + } + } +" +Closure-19," protected void declareNameInScope(FlowScope scope, Node node, JSType type) { + switch (node.getType()) { + case Token.NAME: + scope.inferSlotType(node.getString(), type); + break; + case Token.GETPROP: + String qualifiedName = node.getQualifiedName(); + Preconditions.checkNotNull(qualifiedName); + JSType origType = node.getJSType(); + origType = origType == null ? getNativeType(UNKNOWN_TYPE) : origType; + scope.inferQualifiedSlot(node, qualifiedName, origType, type); + break; + default: + throw new IllegalArgumentException(""Node cannot be refined. \n"" + + node.toStringTree()); + } + } +"," protected void declareNameInScope(FlowScope scope, Node node, JSType type) { + switch (node.getType()) { + case Token.NAME: + scope.inferSlotType(node.getString(), type); + break; + case Token.GETPROP: + String qualifiedName = node.getQualifiedName(); + Preconditions.checkNotNull(qualifiedName); + JSType origType = node.getJSType(); + origType = origType == null ? getNativeType(UNKNOWN_TYPE) : origType; + scope.inferQualifiedSlot(node, qualifiedName, origType, type); + break; + case Token.THIS: + break; + default: + throw new IllegalArgumentException(""Node cannot be refined. \n"" + + node.toStringTree()); + } + } +" +Jsoup-76," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (tb.framesetOk() && isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.normalName(); + if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.processEndTag(""a""); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.inSorted(name, Constants.InBodyStartEmptyFormatters)) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (StringUtil.inSorted(name, Constants.InBodyStartPClosers)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""span"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + ArrayList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.processEndTag(""li""); + break; + } + if (tb.isSpecial(el) && !StringUtil.inSorted(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().get(0); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.inSorted(name, Constants.InBodyStartToHead)) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + ArrayList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + ArrayList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.remove(stack.size()-1); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.inSorted(name, Constants.Headings)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + if (StringUtil.inSorted(tb.currentElement().nodeName(), Constants.Headings)) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartPreListing)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insertForm(startTag, true); + } else if (StringUtil.inSorted(name, Constants.DdDt)) { + tb.framesetOk(false); + ArrayList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.inSorted(el.nodeName(), Constants.DdDt)) { + tb.processEndTag(el.nodeName()); + break; + } + if (tb.isSpecial(el) && !StringUtil.inSorted(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.processEndTag(""button""); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (StringUtil.inSorted(name, Constants.Formatters)) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.processEndTag(""nobr""); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.inSorted(name, Constants.InBodyStartApplets)) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.inSorted(name, Constants.InBodyStartMedia)) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + if (tb.getFromStack(""svg"") == null) + return tb.process(startTag.name(""img"")); + else + tb.insert(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.processStartTag(""form""); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.processStartTag(""hr""); + tb.processStartTag(""label""); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character().data(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.inSorted(attr.getKey(), Constants.InBodyStartInputAttribs)) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.processStartTag(""input"", inputAttribs); + tb.processEndTag(""label""); + tb.processStartTag(""hr""); + tb.processEndTag(""form""); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.inSorted(name, Constants.InBodyStartOptions)) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.processEndTag(""option""); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartRuby)) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartDrop)) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.normalName(); + if (StringUtil.inSorted(name, Constants.InBodyEndAdoptionFormatters)) { + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + ArrayList stack = tb.getStack(); + final int stackSize = stack.size(); + for (int si = 0; si < stackSize && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue; + } else if (node == formatEl) + break; + Element replacement = new Element(Tag.valueOf(node.nodeName(), ParseSettings.preserveCase), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.inSorted(commonAncestor.nodeName(), Constants.InBodyEndTableFosters)) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + adopter.attributes().addAll(formatEl.attributes()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.inSorted(name, Constants.InBodyEndClosers)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""span"")) { + return anyOtherEndTag(t, tb); + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.processEndTag(""body""); + if (notIgnored) + return tb.process(endTag); + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.processStartTag(name); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.inSorted(name, Constants.DdDt)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.inSorted(name, Constants.Headings)) { + if (!tb.inScope(Constants.Headings)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(Constants.Headings); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.inSorted(name, Constants.InBodyStartApplets)) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.processStartTag(""br""); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +"," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (tb.framesetOk() && isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.normalName(); + if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.processEndTag(""a""); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.inSorted(name, Constants.InBodyStartEmptyFormatters)) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (StringUtil.inSorted(name, Constants.InBodyStartPClosers)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""span"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + ArrayList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.processEndTag(""li""); + break; + } + if (tb.isSpecial(el) && !StringUtil.inSorted(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().get(0); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.inSorted(name, Constants.InBodyStartToHead)) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + ArrayList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + ArrayList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.remove(stack.size()-1); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.inSorted(name, Constants.Headings)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + if (StringUtil.inSorted(tb.currentElement().nodeName(), Constants.Headings)) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartPreListing)) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.reader.matchConsume(""\n""); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insertForm(startTag, true); + } else if (StringUtil.inSorted(name, Constants.DdDt)) { + tb.framesetOk(false); + ArrayList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.inSorted(el.nodeName(), Constants.DdDt)) { + tb.processEndTag(el.nodeName()); + break; + } + if (tb.isSpecial(el) && !StringUtil.inSorted(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.processEndTag(""button""); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (StringUtil.inSorted(name, Constants.Formatters)) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.processEndTag(""nobr""); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.inSorted(name, Constants.InBodyStartApplets)) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.inSorted(name, Constants.InBodyStartMedia)) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + if (tb.getFromStack(""svg"") == null) + return tb.process(startTag.name(""img"")); + else + tb.insert(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.processStartTag(""form""); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.processStartTag(""hr""); + tb.processStartTag(""label""); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character().data(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.inSorted(attr.getKey(), Constants.InBodyStartInputAttribs)) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.processStartTag(""input"", inputAttribs); + tb.processEndTag(""label""); + tb.processStartTag(""hr""); + tb.processEndTag(""form""); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.processEndTag(""p""); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.inSorted(name, Constants.InBodyStartOptions)) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.processEndTag(""option""); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartRuby)) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.inSorted(name, Constants.InBodyStartDrop)) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.normalName(); + if (StringUtil.inSorted(name, Constants.InBodyEndAdoptionFormatters)) { + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + ArrayList stack = tb.getStack(); + final int stackSize = stack.size(); + for (int si = 0; si < stackSize && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue; + } else if (node == formatEl) + break; + Element replacement = new Element(Tag.valueOf(node.nodeName(), ParseSettings.preserveCase), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.inSorted(commonAncestor.nodeName(), Constants.InBodyEndTableFosters)) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + adopter.attributes().addAll(formatEl.attributes()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.inSorted(name, Constants.InBodyEndClosers)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""span"")) { + return anyOtherEndTag(t, tb); + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.processEndTag(""body""); + if (notIgnored) + return tb.process(endTag); + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.processStartTag(name); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.inSorted(name, Constants.DdDt)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.inSorted(name, Constants.Headings)) { + if (!tb.inScope(Constants.Headings)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(Constants.Headings); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.inSorted(name, Constants.InBodyStartApplets)) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.processStartTag(""br""); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +" +Jsoup-82," static Document parseInputStream(InputStream input, String charsetName, String baseUri, Parser parser) throws IOException { + if (input == null) + return new Document(baseUri); + input = ConstrainableInputStream.wrap(input, bufferSize, 0); + Document doc = null; + boolean fullyRead = false; + input.mark(bufferSize); + ByteBuffer firstBytes = readToByteBuffer(input, firstReadBufferSize - 1); + fullyRead = input.read() == -1; + input.reset(); + BomCharset bomCharset = detectCharsetFromBom(firstBytes); + if (bomCharset != null) + charsetName = bomCharset.charset; + if (charsetName == null) { + String docData = Charset.forName(defaultCharset).decode(firstBytes).toString(); + doc = parser.parseInput(docData, baseUri); + Elements metaElements = doc.select(""meta[http-equiv=content-type], meta[charset]""); + String foundCharset = null; + for (Element meta : metaElements) { + if (meta.hasAttr(""http-equiv"")) + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + if (foundCharset == null && meta.hasAttr(""charset"")) + foundCharset = meta.attr(""charset""); + if (foundCharset != null) + break; + } + if (foundCharset == null && doc.childNodeSize() > 0) { + Node first = doc.childNode(0); + XmlDeclaration decl = null; + if (first instanceof XmlDeclaration) + decl = (XmlDeclaration) first; + else if (first instanceof Comment) { + Comment comment = (Comment) first; + if (comment.isXmlDeclaration()) + decl = comment.asXmlDeclaration(); + } + if (decl != null) { + if (decl.name().equalsIgnoreCase(""xml"")) + foundCharset = decl.attr(""encoding""); + } + } + foundCharset = validateCharset(foundCharset); + if (foundCharset != null && !foundCharset.equalsIgnoreCase(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + doc = null; + } else if (!fullyRead) { + doc = null; + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + } + if (doc == null) { + if (charsetName == null) + charsetName = defaultCharset; + BufferedReader reader = new BufferedReader(new InputStreamReader(input, charsetName), bufferSize); + if (bomCharset != null && bomCharset.offset) + reader.skip(1); + try { + doc = parser.parseInput(reader, baseUri); + } catch (UncheckedIOException e) { + throw e.ioException(); + } + Charset charset = Charset.forName(charsetName); + doc.outputSettings().charset(charset); + } + input.close(); + return doc; + } +"," static Document parseInputStream(InputStream input, String charsetName, String baseUri, Parser parser) throws IOException { + if (input == null) + return new Document(baseUri); + input = ConstrainableInputStream.wrap(input, bufferSize, 0); + Document doc = null; + boolean fullyRead = false; + input.mark(bufferSize); + ByteBuffer firstBytes = readToByteBuffer(input, firstReadBufferSize - 1); + fullyRead = input.read() == -1; + input.reset(); + BomCharset bomCharset = detectCharsetFromBom(firstBytes); + if (bomCharset != null) + charsetName = bomCharset.charset; + if (charsetName == null) { + String docData = Charset.forName(defaultCharset).decode(firstBytes).toString(); + doc = parser.parseInput(docData, baseUri); + Elements metaElements = doc.select(""meta[http-equiv=content-type], meta[charset]""); + String foundCharset = null; + for (Element meta : metaElements) { + if (meta.hasAttr(""http-equiv"")) + foundCharset = getCharsetFromContentType(meta.attr(""content"")); + if (foundCharset == null && meta.hasAttr(""charset"")) + foundCharset = meta.attr(""charset""); + if (foundCharset != null) + break; + } + if (foundCharset == null && doc.childNodeSize() > 0) { + Node first = doc.childNode(0); + XmlDeclaration decl = null; + if (first instanceof XmlDeclaration) + decl = (XmlDeclaration) first; + else if (first instanceof Comment) { + Comment comment = (Comment) first; + if (comment.isXmlDeclaration()) + decl = comment.asXmlDeclaration(); + } + if (decl != null) { + if (decl.name().equalsIgnoreCase(""xml"")) + foundCharset = decl.attr(""encoding""); + } + } + foundCharset = validateCharset(foundCharset); + if (foundCharset != null && !foundCharset.equalsIgnoreCase(defaultCharset)) { + foundCharset = foundCharset.trim().replaceAll(""[\""']"", """"); + charsetName = foundCharset; + doc = null; + } else if (!fullyRead) { + doc = null; + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + } + if (doc == null) { + if (charsetName == null) + charsetName = defaultCharset; + BufferedReader reader = new BufferedReader(new InputStreamReader(input, charsetName), bufferSize); + if (bomCharset != null && bomCharset.offset) + reader.skip(1); + try { + doc = parser.parseInput(reader, baseUri); + } catch (UncheckedIOException e) { + throw e.ioException(); + } + Charset charset = Charset.forName(charsetName); + doc.outputSettings().charset(charset); + if (!charset.canEncode()) { + doc.charset(Charset.forName(defaultCharset)); + } + } + input.close(); + return doc; + } +" +Time-22," protected BasePeriod(long duration) { + this(duration, null, null); + } +"," protected BasePeriod(long duration) { + super(); + iType = PeriodType.time(); + int[] values = ISOChronology.getInstanceUTC().get(this, duration); + iType = PeriodType.standard(); + iValues = new int[8]; + System.arraycopy(values, 0, iValues, 4, 4); + } +" +Closure-164," public boolean isSubtype(JSType other) { + if (!(other instanceof ArrowType)) { + return false; + } + ArrowType that = (ArrowType) other; + if (!this.returnType.isSubtype(that.returnType)) { + return false; + } + Node thisParam = parameters.getFirstChild(); + Node thatParam = that.parameters.getFirstChild(); + while (thisParam != null && thatParam != null) { + JSType thisParamType = thisParam.getJSType(); + JSType thatParamType = thatParam.getJSType(); + if (thisParamType != null) { + if (thatParamType == null || + !thatParamType.isSubtype(thisParamType)) { + return false; + } + } + boolean thisIsVarArgs = thisParam.isVarArgs(); + boolean thatIsVarArgs = thatParam.isVarArgs(); + if (!thisIsVarArgs) { + thisParam = thisParam.getNext(); + } + if (!thatIsVarArgs) { + thatParam = thatParam.getNext(); + } + if (thisIsVarArgs && thatIsVarArgs) { + thisParam = null; + thatParam = null; + } + } + return true; + } +"," public boolean isSubtype(JSType other) { + if (!(other instanceof ArrowType)) { + return false; + } + ArrowType that = (ArrowType) other; + if (!this.returnType.isSubtype(that.returnType)) { + return false; + } + Node thisParam = parameters.getFirstChild(); + Node thatParam = that.parameters.getFirstChild(); + while (thisParam != null && thatParam != null) { + JSType thisParamType = thisParam.getJSType(); + JSType thatParamType = thatParam.getJSType(); + if (thisParamType != null) { + if (thatParamType == null || + !thatParamType.isSubtype(thisParamType)) { + return false; + } + } + boolean thisIsVarArgs = thisParam.isVarArgs(); + boolean thatIsVarArgs = thatParam.isVarArgs(); + boolean thisIsOptional = thisIsVarArgs || thisParam.isOptionalArg(); + boolean thatIsOptional = thatIsVarArgs || thatParam.isOptionalArg(); + if (!thisIsOptional && thatIsOptional) { + boolean isTopFunction = + thatIsVarArgs && + (thatParamType == null || + thatParamType.isUnknownType() || + thatParamType.isNoType()); + if (!isTopFunction) { + return false; + } + } + if (!thisIsVarArgs) { + thisParam = thisParam.getNext(); + } + if (!thatIsVarArgs) { + thatParam = thatParam.getNext(); + } + if (thisIsVarArgs && thatIsVarArgs) { + thisParam = null; + thatParam = null; + } + } + if (thisParam != null + && !thisParam.isOptionalArg() && !thisParam.isVarArgs() + && thatParam == null) { + return false; + } + return true; + } +" +Math-11," public double density(final double[] vals) throws DimensionMismatchException { + final int dim = getDimension(); + if (vals.length != dim) { + throw new DimensionMismatchException(vals.length, dim); + } + return FastMath.pow(2 * FastMath.PI, -dim / 2) * + FastMath.pow(covarianceMatrixDeterminant, -0.5) * + getExponentTerm(vals); + } +"," public double density(final double[] vals) throws DimensionMismatchException { + final int dim = getDimension(); + if (vals.length != dim) { + throw new DimensionMismatchException(vals.length, dim); + } + return FastMath.pow(2 * FastMath.PI, -0.5 * dim) * + FastMath.pow(covarianceMatrixDeterminant, -0.5) * + getExponentTerm(vals); + } +" +Closure-160," public void initOptions(CompilerOptions options) { + this.options = options; + if (errorManager == null) { + if (outStream == null) { + setErrorManager( + new LoggerErrorManager(createMessageFormatter(), logger)); + } else { + PrintStreamErrorManager printer = + new PrintStreamErrorManager(createMessageFormatter(), outStream); + printer.setSummaryDetailLevel(options.summaryDetailLevel); + setErrorManager(printer); + } + } + if (options.enables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = true; + } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = false; + } else if (!options.checkTypes) { + options.setWarningLevel( + DiagnosticGroup.forType( + RhinoErrorReporter.TYPE_PARSE_ERROR), + CheckLevel.OFF); + } + if (options.checkGlobalThisLevel.isOn()) { + options.setWarningLevel( + DiagnosticGroups.GLOBAL_THIS, + options.checkGlobalThisLevel); + } + List guards = Lists.newArrayList(); + guards.add( + new SuppressDocWarningsGuard( + getDiagnosticGroups().getRegisteredGroups())); + guards.add(options.getWarningsGuard()); + if (!options.checkSymbols && + (warningsGuard == null || !warningsGuard.disables( + DiagnosticGroups.CHECK_VARIABLES))) { + guards.add(new DiagnosticGroupWarningsGuard( + DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF)); + } + this.warningsGuard = new ComposeWarningsGuard(guards); + } +"," public void initOptions(CompilerOptions options) { + this.options = options; + if (errorManager == null) { + if (outStream == null) { + setErrorManager( + new LoggerErrorManager(createMessageFormatter(), logger)); + } else { + PrintStreamErrorManager printer = + new PrintStreamErrorManager(createMessageFormatter(), outStream); + printer.setSummaryDetailLevel(options.summaryDetailLevel); + setErrorManager(printer); + } + } + if (options.enables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = true; + } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = false; + } else if (!options.checkTypes) { + options.setWarningLevel( + DiagnosticGroup.forType( + RhinoErrorReporter.TYPE_PARSE_ERROR), + CheckLevel.OFF); + } + if (options.checkGlobalThisLevel.isOn()) { + options.setWarningLevel( + DiagnosticGroups.GLOBAL_THIS, + options.checkGlobalThisLevel); + } + List guards = Lists.newArrayList(); + guards.add( + new SuppressDocWarningsGuard( + getDiagnosticGroups().getRegisteredGroups())); + guards.add(options.getWarningsGuard()); + ComposeWarningsGuard composedGuards = new ComposeWarningsGuard(guards); + if (!options.checkSymbols && + !composedGuards.enables(DiagnosticGroups.CHECK_VARIABLES)) { + composedGuards.addGuard(new DiagnosticGroupWarningsGuard( + DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF)); + } + this.warningsGuard = composedGuards; + } +" +Closure-50," private Node tryFoldArrayJoin(Node n) { + Node callTarget = n.getFirstChild(); + if (callTarget == null || !NodeUtil.isGetProp(callTarget)) { + return n; + } + Node right = callTarget.getNext(); + if (right != null) { + if (!NodeUtil.isImmutableValue(right)) { + return n; + } + } + Node arrayNode = callTarget.getFirstChild(); + Node functionName = arrayNode.getNext(); + if ((arrayNode.getType() != Token.ARRAYLIT) || + !functionName.getString().equals(""join"")) { + return n; + } + String joinString = (right == null) ? "","" : NodeUtil.getStringValue(right); + List arrayFoldedChildren = Lists.newLinkedList(); + StringBuilder sb = null; + int foldedSize = 0; + Node prev = null; + Node elem = arrayNode.getFirstChild(); + while (elem != null) { + if (NodeUtil.isImmutableValue(elem) || elem.getType() == Token.EMPTY) { + if (sb == null) { + sb = new StringBuilder(); + } else { + sb.append(joinString); + } + sb.append(NodeUtil.getArrayElementStringValue(elem)); + } else { + if (sb != null) { + Preconditions.checkNotNull(prev); + foldedSize += sb.length() + 2; + arrayFoldedChildren.add( + Node.newString(sb.toString()).copyInformationFrom(prev)); + sb = null; + } + foldedSize += InlineCostEstimator.getCost(elem); + arrayFoldedChildren.add(elem); + } + prev = elem; + elem = elem.getNext(); + } + if (sb != null) { + Preconditions.checkNotNull(prev); + foldedSize += sb.length() + 2; + arrayFoldedChildren.add( + Node.newString(sb.toString()).copyInformationFrom(prev)); + } + foldedSize += arrayFoldedChildren.size() - 1; + int originalSize = InlineCostEstimator.getCost(n); + switch (arrayFoldedChildren.size()) { + case 0: + Node emptyStringNode = Node.newString(""""); + n.getParent().replaceChild(n, emptyStringNode); + reportCodeChange(); + return emptyStringNode; + case 1: + Node foldedStringNode = arrayFoldedChildren.remove(0); + if (foldedSize > originalSize) { + return n; + } + arrayNode.detachChildren(); + if (foldedStringNode.getType() != Token.STRING) { + Node replacement = new Node(Token.ADD, + Node.newString("""").copyInformationFrom(n), + foldedStringNode); + foldedStringNode = replacement; + } + n.getParent().replaceChild(n, foldedStringNode); + reportCodeChange(); + return foldedStringNode; + default: + if (arrayFoldedChildren.size() == arrayNode.getChildCount()) { + return n; + } + int kJoinOverhead = ""[].join()"".length(); + foldedSize += kJoinOverhead; + foldedSize += (right != null) ? InlineCostEstimator.getCost(right) : 0; + if (foldedSize > originalSize) { + return n; + } + arrayNode.detachChildren(); + for (Node node : arrayFoldedChildren) { + arrayNode.addChildToBack(node); + } + reportCodeChange(); + break; + } + return n; + } +"," private Node tryFoldArrayJoin(Node n) { + Node callTarget = n.getFirstChild(); + if (callTarget == null || !NodeUtil.isGetProp(callTarget)) { + return n; + } + Node right = callTarget.getNext(); + if (right != null) { + if (right.getNext() != null || !NodeUtil.isImmutableValue(right)) { + return n; + } + } + Node arrayNode = callTarget.getFirstChild(); + Node functionName = arrayNode.getNext(); + if ((arrayNode.getType() != Token.ARRAYLIT) || + !functionName.getString().equals(""join"")) { + return n; + } + if (right != null && right.getType() == Token.STRING + && "","".equals(right.getString())) { + n.removeChild(right); + reportCodeChange(); + } + String joinString = (right == null) ? "","" : NodeUtil.getStringValue(right); + List arrayFoldedChildren = Lists.newLinkedList(); + StringBuilder sb = null; + int foldedSize = 0; + Node prev = null; + Node elem = arrayNode.getFirstChild(); + while (elem != null) { + if (NodeUtil.isImmutableValue(elem) || elem.getType() == Token.EMPTY) { + if (sb == null) { + sb = new StringBuilder(); + } else { + sb.append(joinString); + } + sb.append(NodeUtil.getArrayElementStringValue(elem)); + } else { + if (sb != null) { + Preconditions.checkNotNull(prev); + foldedSize += sb.length() + 2; + arrayFoldedChildren.add( + Node.newString(sb.toString()).copyInformationFrom(prev)); + sb = null; + } + foldedSize += InlineCostEstimator.getCost(elem); + arrayFoldedChildren.add(elem); + } + prev = elem; + elem = elem.getNext(); + } + if (sb != null) { + Preconditions.checkNotNull(prev); + foldedSize += sb.length() + 2; + arrayFoldedChildren.add( + Node.newString(sb.toString()).copyInformationFrom(prev)); + } + foldedSize += arrayFoldedChildren.size() - 1; + int originalSize = InlineCostEstimator.getCost(n); + switch (arrayFoldedChildren.size()) { + case 0: + Node emptyStringNode = Node.newString(""""); + n.getParent().replaceChild(n, emptyStringNode); + reportCodeChange(); + return emptyStringNode; + case 1: + Node foldedStringNode = arrayFoldedChildren.remove(0); + if (foldedSize > originalSize) { + return n; + } + arrayNode.detachChildren(); + if (foldedStringNode.getType() != Token.STRING) { + Node replacement = new Node(Token.ADD, + Node.newString("""").copyInformationFrom(n), + foldedStringNode); + foldedStringNode = replacement; + } + n.getParent().replaceChild(n, foldedStringNode); + reportCodeChange(); + return foldedStringNode; + default: + if (arrayFoldedChildren.size() == arrayNode.getChildCount()) { + return n; + } + int kJoinOverhead = ""[].join()"".length(); + foldedSize += kJoinOverhead; + foldedSize += (right != null) ? InlineCostEstimator.getCost(right) : 0; + if (foldedSize > originalSize) { + return n; + } + arrayNode.detachChildren(); + for (Node node : arrayFoldedChildren) { + arrayNode.addChildToBack(node); + } + reportCodeChange(); + break; + } + return n; + } +" +Time-19," public int getOffsetFromLocal(long instantLocal) { + final int offsetLocal = getOffset(instantLocal); + final long instantAdjusted = instantLocal - offsetLocal; + final int offsetAdjusted = getOffset(instantAdjusted); + if (offsetLocal != offsetAdjusted) { + if ((offsetLocal - offsetAdjusted) < 0) { + long nextLocal = nextTransition(instantAdjusted); + long nextAdjusted = nextTransition(instantLocal - offsetAdjusted); + if (nextLocal != nextAdjusted) { + return offsetLocal; + } + } + } else if (offsetLocal > 0) { + long prev = previousTransition(instantAdjusted); + if (prev < instantAdjusted) { + int offsetPrev = getOffset(prev); + int diff = offsetPrev - offsetLocal; + if (instantAdjusted - prev <= diff) { + return offsetPrev; + } + } + } + return offsetAdjusted; + } +"," public int getOffsetFromLocal(long instantLocal) { + final int offsetLocal = getOffset(instantLocal); + final long instantAdjusted = instantLocal - offsetLocal; + final int offsetAdjusted = getOffset(instantAdjusted); + if (offsetLocal != offsetAdjusted) { + if ((offsetLocal - offsetAdjusted) < 0) { + long nextLocal = nextTransition(instantAdjusted); + long nextAdjusted = nextTransition(instantLocal - offsetAdjusted); + if (nextLocal != nextAdjusted) { + return offsetLocal; + } + } + } else if (offsetLocal >= 0) { + long prev = previousTransition(instantAdjusted); + if (prev < instantAdjusted) { + int offsetPrev = getOffset(prev); + int diff = offsetPrev - offsetLocal; + if (instantAdjusted - prev <= diff) { + return offsetPrev; + } + } + } + return offsetAdjusted; + } +" +Math-95," protected double getInitialDomain(double p) { + double ret; + double d = getDenominatorDegreesOfFreedom(); + ret = d / (d - 2.0); + return ret; + } +"," protected double getInitialDomain(double p) { + double ret = 1.0; + double d = getDenominatorDegreesOfFreedom(); + if (d > 2.0) { + ret = d / (d - 2.0); + } + return ret; + } +" +JacksonCore-11," private void _verifySharing() + { + if (_hashShared) { + _hashArea = Arrays.copyOf(_hashArea, _hashArea.length); + _names = Arrays.copyOf(_names, _names.length); + _hashShared = false; + } + if (_needRehash) { + rehash(); + } + } +"," private void _verifySharing() + { + if (_hashShared) { + _hashArea = Arrays.copyOf(_hashArea, _hashArea.length); + _names = Arrays.copyOf(_names, _names.length); + _hashShared = false; + _verifyNeedForRehash(); + } + if (_needRehash) { + rehash(); + } + } +" +Math-91," public int compareTo(Fraction object) { + double nOd = doubleValue(); + double dOn = object.doubleValue(); + return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 0); + } +"," public int compareTo(Fraction object) { + long nOd = ((long) numerator) * object.denominator; + long dOn = ((long) denominator) * object.numerator; + return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 0); + } +" +Math-73," public double solve(final UnivariateRealFunction f, + final double min, final double max, final double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + clearResult(); + verifySequence(min, initial, max); + double yInitial = f.value(initial); + if (Math.abs(yInitial) <= functionValueAccuracy) { + setResult(initial, 0); + return result; + } + double yMin = f.value(min); + if (Math.abs(yMin) <= functionValueAccuracy) { + setResult(yMin, 0); + return result; + } + if (yInitial * yMin < 0) { + return solve(f, min, yMin, initial, yInitial, min, yMin); + } + double yMax = f.value(max); + if (Math.abs(yMax) <= functionValueAccuracy) { + setResult(yMax, 0); + return result; + } + if (yInitial * yMax < 0) { + return solve(f, initial, yInitial, max, yMax, initial, yInitial); + } + return solve(f, min, yMin, max, yMax, initial, yInitial); + } +"," public double solve(final UnivariateRealFunction f, + final double min, final double max, final double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + clearResult(); + verifySequence(min, initial, max); + double yInitial = f.value(initial); + if (Math.abs(yInitial) <= functionValueAccuracy) { + setResult(initial, 0); + return result; + } + double yMin = f.value(min); + if (Math.abs(yMin) <= functionValueAccuracy) { + setResult(yMin, 0); + return result; + } + if (yInitial * yMin < 0) { + return solve(f, min, yMin, initial, yInitial, min, yMin); + } + double yMax = f.value(max); + if (Math.abs(yMax) <= functionValueAccuracy) { + setResult(yMax, 0); + return result; + } + if (yInitial * yMax < 0) { + return solve(f, initial, yInitial, max, yMax, initial, yInitial); + } + if (yMin * yMax > 0) { + throw MathRuntimeException.createIllegalArgumentException( + NON_BRACKETING_MESSAGE, min, max, yMin, yMax); + } + return solve(f, min, yMin, max, yMax, initial, yInitial); + } +" +Closure-17," private JSType getDeclaredType(String sourceName, JSDocInfo info, + Node lValue, @Nullable Node rValue) { + if (info != null && info.hasType()) { + return getDeclaredTypeInAnnotation(sourceName, lValue, info); + } else if (rValue != null && rValue.isFunction() && + shouldUseFunctionLiteralType( + JSType.toMaybeFunctionType(rValue.getJSType()), info, lValue)) { + return rValue.getJSType(); + } else if (info != null) { + if (info.hasEnumParameterType()) { + if (rValue != null && rValue.isObjectLit()) { + return rValue.getJSType(); + } else { + return createEnumTypeFromNodes( + rValue, lValue.getQualifiedName(), info, lValue); + } + } else if (info.isConstructor() || info.isInterface()) { + return createFunctionTypeFromNodes( + rValue, lValue.getQualifiedName(), info, lValue); + } else { + if (info.isConstant()) { + JSType knownType = null; + if (rValue != null) { + if (rValue.getJSType() != null && !rValue.getJSType().isUnknownType()) { + return rValue.getJSType(); + } else if (rValue.isOr()) { + Node firstClause = rValue.getFirstChild(); + Node secondClause = firstClause.getNext(); + boolean namesMatch = firstClause.isName() + && lValue.isName() + && firstClause.getString().equals(lValue.getString()); + if (namesMatch && secondClause.getJSType() != null + && !secondClause.getJSType().isUnknownType()) { + return secondClause.getJSType(); + } + } + } + } + } + } + return getDeclaredTypeInAnnotation(sourceName, lValue, info); + } +"," private JSType getDeclaredType(String sourceName, JSDocInfo info, + Node lValue, @Nullable Node rValue) { + if (info != null && info.hasType()) { + return getDeclaredTypeInAnnotation(sourceName, lValue, info); + } else if (rValue != null && rValue.isFunction() && + shouldUseFunctionLiteralType( + JSType.toMaybeFunctionType(rValue.getJSType()), info, lValue)) { + return rValue.getJSType(); + } else if (info != null) { + if (info.hasEnumParameterType()) { + if (rValue != null && rValue.isObjectLit()) { + return rValue.getJSType(); + } else { + return createEnumTypeFromNodes( + rValue, lValue.getQualifiedName(), info, lValue); + } + } else if (info.isConstructor() || info.isInterface()) { + return createFunctionTypeFromNodes( + rValue, lValue.getQualifiedName(), info, lValue); + } else { + if (info.isConstant()) { + JSType knownType = null; + if (rValue != null) { + JSDocInfo rValueInfo = rValue.getJSDocInfo(); + if (rValueInfo != null && rValueInfo.hasType()) { + return rValueInfo.getType().evaluate(scope, typeRegistry); + } else if (rValue.getJSType() != null + && !rValue.getJSType().isUnknownType()) { + return rValue.getJSType(); + } else if (rValue.isOr()) { + Node firstClause = rValue.getFirstChild(); + Node secondClause = firstClause.getNext(); + boolean namesMatch = firstClause.isName() + && lValue.isName() + && firstClause.getString().equals(lValue.getString()); + if (namesMatch && secondClause.getJSType() != null + && !secondClause.getJSType().isUnknownType()) { + return secondClause.getJSType(); + } + } + } + } + } + } + return getDeclaredTypeInAnnotation(sourceName, lValue, info); + } +" +Gson-10," private ReflectiveTypeAdapterFactory.BoundField createBoundField( + final Gson context, final Field field, final String name, + final TypeToken fieldType, boolean serialize, boolean deserialize) { + final boolean isPrimitive = Primitives.isPrimitive(fieldType.getRawType()); + JsonAdapter annotation = field.getAnnotation(JsonAdapter.class); + TypeAdapter mapped = null; + if (annotation != null) { + mapped = getTypeAdapter(constructorConstructor, context, fieldType, annotation); + } + final boolean jsonAdapterPresent = mapped != null; + if (mapped == null) mapped = context.getAdapter(fieldType); + final TypeAdapter typeAdapter = mapped; + return new ReflectiveTypeAdapterFactory.BoundField(name, serialize, deserialize) { + @SuppressWarnings({""unchecked"", ""rawtypes""}) + @Override void write(JsonWriter writer, Object value) + throws IOException, IllegalAccessException { + Object fieldValue = field.get(value); + TypeAdapter t = + new TypeAdapterRuntimeTypeWrapper(context, typeAdapter, fieldType.getType()); + t.write(writer, fieldValue); + } + @Override void read(JsonReader reader, Object value) + throws IOException, IllegalAccessException { + Object fieldValue = typeAdapter.read(reader); + if (fieldValue != null || !isPrimitive) { + field.set(value, fieldValue); + } + } + @Override public boolean writeField(Object value) throws IOException, IllegalAccessException { + if (!serialized) return false; + Object fieldValue = field.get(value); + return fieldValue != value; + } + }; + } +"," private ReflectiveTypeAdapterFactory.BoundField createBoundField( + final Gson context, final Field field, final String name, + final TypeToken fieldType, boolean serialize, boolean deserialize) { + final boolean isPrimitive = Primitives.isPrimitive(fieldType.getRawType()); + JsonAdapter annotation = field.getAnnotation(JsonAdapter.class); + TypeAdapter mapped = null; + if (annotation != null) { + mapped = getTypeAdapter(constructorConstructor, context, fieldType, annotation); + } + final boolean jsonAdapterPresent = mapped != null; + if (mapped == null) mapped = context.getAdapter(fieldType); + final TypeAdapter typeAdapter = mapped; + return new ReflectiveTypeAdapterFactory.BoundField(name, serialize, deserialize) { + @SuppressWarnings({""unchecked"", ""rawtypes""}) + @Override void write(JsonWriter writer, Object value) + throws IOException, IllegalAccessException { + Object fieldValue = field.get(value); + TypeAdapter t = jsonAdapterPresent ? typeAdapter + : new TypeAdapterRuntimeTypeWrapper(context, typeAdapter, fieldType.getType()); + t.write(writer, fieldValue); + } + @Override void read(JsonReader reader, Object value) + throws IOException, IllegalAccessException { + Object fieldValue = typeAdapter.read(reader); + if (fieldValue != null || !isPrimitive) { + field.set(value, fieldValue); + } + } + @Override public boolean writeField(Object value) throws IOException, IllegalAccessException { + if (!serialized) return false; + Object fieldValue = field.get(value); + return fieldValue != value; + } + }; + } +" +JacksonDatabind-33," public PropertyName findNameForSerialization(Annotated a) + { + String name = null; + JsonGetter jg = _findAnnotation(a, JsonGetter.class); + if (jg != null) { + name = jg.value(); + } else { + JsonProperty pann = _findAnnotation(a, JsonProperty.class); + if (pann != null) { + name = pann.value(); + } else if (_hasAnnotation(a, JsonSerialize.class) + || _hasAnnotation(a, JsonView.class) + || _hasAnnotation(a, JsonRawValue.class)) { + name = """"; + } else { + return null; + } + } + return PropertyName.construct(name); + } +"," public PropertyName findNameForSerialization(Annotated a) + { + String name = null; + JsonGetter jg = _findAnnotation(a, JsonGetter.class); + if (jg != null) { + name = jg.value(); + } else { + JsonProperty pann = _findAnnotation(a, JsonProperty.class); + if (pann != null) { + name = pann.value(); + } else if (_hasAnnotation(a, JsonSerialize.class) + || _hasAnnotation(a, JsonView.class) + || _hasAnnotation(a, JsonRawValue.class) + || _hasAnnotation(a, JsonUnwrapped.class) + || _hasAnnotation(a, JsonBackReference.class) + || _hasAnnotation(a, JsonManagedReference.class)) { + name = """"; + } else { + return null; + } + } + return PropertyName.construct(name); + } +" +Closure-104," JSType meet(JSType that) { + UnionTypeBuilder builder = new UnionTypeBuilder(registry); + for (JSType alternate : alternates) { + if (alternate.isSubtype(that)) { + builder.addAlternate(alternate); + } + } + if (that instanceof UnionType) { + for (JSType otherAlternate : ((UnionType) that).alternates) { + if (otherAlternate.isSubtype(this)) { + builder.addAlternate(otherAlternate); + } + } + } else if (that.isSubtype(this)) { + builder.addAlternate(that); + } + JSType result = builder.build(); + if (result != null) { + return result; + } else if (this.isObject() && that.isObject()) { + return getNativeType(JSTypeNative.NO_OBJECT_TYPE); + } else { + return getNativeType(JSTypeNative.NO_TYPE); + } + } +"," JSType meet(JSType that) { + UnionTypeBuilder builder = new UnionTypeBuilder(registry); + for (JSType alternate : alternates) { + if (alternate.isSubtype(that)) { + builder.addAlternate(alternate); + } + } + if (that instanceof UnionType) { + for (JSType otherAlternate : ((UnionType) that).alternates) { + if (otherAlternate.isSubtype(this)) { + builder.addAlternate(otherAlternate); + } + } + } else if (that.isSubtype(this)) { + builder.addAlternate(that); + } + JSType result = builder.build(); + if (!result.isNoType()) { + return result; + } else if (this.isObject() && that.isObject()) { + return getNativeType(JSTypeNative.NO_OBJECT_TYPE); + } else { + return getNativeType(JSTypeNative.NO_TYPE); + } + } +" +JacksonDatabind-42," protected Object _deserializeFromEmptyString() throws IOException { + if (_kind == STD_URI) { + return URI.create(""""); + } + return super._deserializeFromEmptyString(); + } +"," protected Object _deserializeFromEmptyString() throws IOException { + if (_kind == STD_URI) { + return URI.create(""""); + } + if (_kind == STD_LOCALE) { + return Locale.ROOT; + } + return super._deserializeFromEmptyString(); + } +" +Math-9," public Line revert() { + final Line reverted = new Line(zero, zero.subtract(direction)); + return reverted; + } +"," public Line revert() { + final Line reverted = new Line(this); + reverted.direction = reverted.direction.negate(); + return reverted; + } +" +JacksonDatabind-96," protected void _addExplicitAnyCreator(DeserializationContext ctxt, + BeanDescription beanDesc, CreatorCollector creators, + CreatorCandidate candidate) + throws JsonMappingException + { + if (1 != candidate.paramCount()) { + int oneNotInjected = candidate.findOnlyParamWithoutInjection(); + if (oneNotInjected >= 0) { + if (candidate.paramName(oneNotInjected) == null) { + _addExplicitDelegatingCreator(ctxt, beanDesc, creators, candidate); + return; + } + } + _addExplicitPropertyCreator(ctxt, beanDesc, creators, candidate); + return; + } + AnnotatedParameter param = candidate.parameter(0); + JacksonInject.Value injectId = candidate.injection(0); + PropertyName paramName = candidate.explicitParamName(0); + BeanPropertyDefinition paramDef = candidate.propertyDef(0); + boolean useProps = (paramName != null) || (injectId != null); + if (!useProps && (paramDef != null)) { + paramName = candidate.findImplicitParamName(0); + useProps = (paramName != null) && paramDef.couldSerialize(); + } + if (useProps) { + SettableBeanProperty[] properties = new SettableBeanProperty[] { + constructCreatorProperty(ctxt, beanDesc, paramName, 0, param, injectId) + }; + creators.addPropertyCreator(candidate.creator(), true, properties); + return; + } + _handleSingleArgumentCreator(creators, candidate.creator(), true, true); + if (paramDef != null) { + ((POJOPropertyBuilder) paramDef).removeConstructors(); + } + } +"," protected void _addExplicitAnyCreator(DeserializationContext ctxt, + BeanDescription beanDesc, CreatorCollector creators, + CreatorCandidate candidate) + throws JsonMappingException + { + if (1 != candidate.paramCount()) { + int oneNotInjected = candidate.findOnlyParamWithoutInjection(); + if (oneNotInjected >= 0) { + if (candidate.paramName(oneNotInjected) == null) { + _addExplicitDelegatingCreator(ctxt, beanDesc, creators, candidate); + return; + } + } + _addExplicitPropertyCreator(ctxt, beanDesc, creators, candidate); + return; + } + AnnotatedParameter param = candidate.parameter(0); + JacksonInject.Value injectId = candidate.injection(0); + PropertyName paramName = candidate.explicitParamName(0); + BeanPropertyDefinition paramDef = candidate.propertyDef(0); + boolean useProps = (paramName != null) || (injectId != null); + if (!useProps && (paramDef != null)) { + paramName = candidate.paramName(0); + useProps = (paramName != null) && paramDef.couldSerialize(); + } + if (useProps) { + SettableBeanProperty[] properties = new SettableBeanProperty[] { + constructCreatorProperty(ctxt, beanDesc, paramName, 0, param, injectId) + }; + creators.addPropertyCreator(candidate.creator(), true, properties); + return; + } + _handleSingleArgumentCreator(creators, candidate.creator(), true, true); + if (paramDef != null) { + ((POJOPropertyBuilder) paramDef).removeConstructors(); + } + } +" +Cli-11," private static void appendOption(final StringBuffer buff, + final Option option, + final boolean required) + { + if (!required) + { + buff.append(""[""); + } + if (option.getOpt() != null) + { + buff.append(""-"").append(option.getOpt()); + } + else + { + buff.append(""--"").append(option.getLongOpt()); + } + if (option.hasArg() && (option.getArgName() != null)) + { + buff.append("" <"").append(option.getArgName()).append("">""); + } + if (!required) + { + buff.append(""]""); + } + } +"," private static void appendOption(final StringBuffer buff, + final Option option, + final boolean required) + { + if (!required) + { + buff.append(""[""); + } + if (option.getOpt() != null) + { + buff.append(""-"").append(option.getOpt()); + } + else + { + buff.append(""--"").append(option.getLongOpt()); + } + if (option.hasArg() && option.hasArgName()) + { + buff.append("" <"").append(option.getArgName()).append("">""); + } + if (!required) + { + buff.append(""]""); + } + } +" +Closure-2," private void checkInterfaceConflictProperties(NodeTraversal t, Node n, + String functionName, HashMap properties, + HashMap currentProperties, + ObjectType interfaceType) { + ObjectType implicitProto = interfaceType.getImplicitPrototype(); + Set currentPropertyNames; + currentPropertyNames = implicitProto.getOwnPropertyNames(); + for (String name : currentPropertyNames) { + ObjectType oType = properties.get(name); + if (oType != null) { + if (!interfaceType.getPropertyType(name).isEquivalentTo( + oType.getPropertyType(name))) { + compiler.report( + t.makeError(n, INCOMPATIBLE_EXTENDED_PROPERTY_TYPE, + functionName, name, oType.toString(), + interfaceType.toString())); + } + } + currentProperties.put(name, interfaceType); + } + for (ObjectType iType : interfaceType.getCtorExtendedInterfaces()) { + checkInterfaceConflictProperties(t, n, functionName, properties, + currentProperties, iType); + } + } +"," private void checkInterfaceConflictProperties(NodeTraversal t, Node n, + String functionName, HashMap properties, + HashMap currentProperties, + ObjectType interfaceType) { + ObjectType implicitProto = interfaceType.getImplicitPrototype(); + Set currentPropertyNames; + if (implicitProto == null) { + currentPropertyNames = ImmutableSet.of(); + } else { + currentPropertyNames = implicitProto.getOwnPropertyNames(); + } + for (String name : currentPropertyNames) { + ObjectType oType = properties.get(name); + if (oType != null) { + if (!interfaceType.getPropertyType(name).isEquivalentTo( + oType.getPropertyType(name))) { + compiler.report( + t.makeError(n, INCOMPATIBLE_EXTENDED_PROPERTY_TYPE, + functionName, name, oType.toString(), + interfaceType.toString())); + } + } + currentProperties.put(name, interfaceType); + } + for (ObjectType iType : interfaceType.getCtorExtendedInterfaces()) { + checkInterfaceConflictProperties(t, n, functionName, properties, + currentProperties, iType); + } + } +" +Math-21," public RectangularCholeskyDecomposition(RealMatrix matrix, double small) + throws NonPositiveDefiniteMatrixException { + final int order = matrix.getRowDimension(); + final double[][] c = matrix.getData(); + final double[][] b = new double[order][order]; + int[] swap = new int[order]; + int[] index = new int[order]; + for (int i = 0; i < order; ++i) { + index[i] = i; + } + int r = 0; + for (boolean loop = true; loop;) { + swap[r] = r; + for (int i = r + 1; i < order; ++i) { + int ii = index[i]; + int isi = index[swap[i]]; + if (c[ii][ii] > c[isi][isi]) { + swap[r] = i; + } + } + if (swap[r] != r) { + int tmp = index[r]; + index[r] = index[swap[r]]; + index[swap[r]] = tmp; + } + int ir = index[r]; + if (c[ir][ir] < small) { + if (r == 0) { + throw new NonPositiveDefiniteMatrixException(c[ir][ir], ir, small); + } + for (int i = r; i < order; ++i) { + if (c[index[i]][index[i]] < -small) { + throw new NonPositiveDefiniteMatrixException(c[index[i]][index[i]], i, small); + } + } + ++r; + loop = false; + } else { + final double sqrt = FastMath.sqrt(c[ir][ir]); + b[r][r] = sqrt; + final double inverse = 1 / sqrt; + for (int i = r + 1; i < order; ++i) { + final int ii = index[i]; + final double e = inverse * c[ii][ir]; + b[i][r] = e; + c[ii][ii] -= e * e; + for (int j = r + 1; j < i; ++j) { + final int ij = index[j]; + final double f = c[ii][ij] - e * b[j][r]; + c[ii][ij] = f; + c[ij][ii] = f; + } + } + loop = ++r < order; + } + } + rank = r; + root = MatrixUtils.createRealMatrix(order, r); + for (int i = 0; i < order; ++i) { + for (int j = 0; j < r; ++j) { + root.setEntry(index[i], j, b[i][j]); + } + } + } +"," public RectangularCholeskyDecomposition(RealMatrix matrix, double small) + throws NonPositiveDefiniteMatrixException { + final int order = matrix.getRowDimension(); + final double[][] c = matrix.getData(); + final double[][] b = new double[order][order]; + int[] index = new int[order]; + for (int i = 0; i < order; ++i) { + index[i] = i; + } + int r = 0; + for (boolean loop = true; loop;) { + int swapR = r; + for (int i = r + 1; i < order; ++i) { + int ii = index[i]; + int isr = index[swapR]; + if (c[ii][ii] > c[isr][isr]) { + swapR = i; + } + } + if (swapR != r) { + final int tmpIndex = index[r]; + index[r] = index[swapR]; + index[swapR] = tmpIndex; + final double[] tmpRow = b[r]; + b[r] = b[swapR]; + b[swapR] = tmpRow; + } + int ir = index[r]; + if (c[ir][ir] < small) { + if (r == 0) { + throw new NonPositiveDefiniteMatrixException(c[ir][ir], ir, small); + } + for (int i = r; i < order; ++i) { + if (c[index[i]][index[i]] < -small) { + throw new NonPositiveDefiniteMatrixException(c[index[i]][index[i]], i, small); + } + } + ++r; + loop = false; + } else { + final double sqrt = FastMath.sqrt(c[ir][ir]); + b[r][r] = sqrt; + final double inverse = 1 / sqrt; + final double inverse2 = 1 / c[ir][ir]; + for (int i = r + 1; i < order; ++i) { + final int ii = index[i]; + final double e = inverse * c[ii][ir]; + b[i][r] = e; + c[ii][ii] -= c[ii][ir] * c[ii][ir] * inverse2; + for (int j = r + 1; j < i; ++j) { + final int ij = index[j]; + final double f = c[ii][ij] - e * b[j][r]; + c[ii][ij] = f; + c[ij][ii] = f; + } + } + loop = ++r < order; + } + } + rank = r; + root = MatrixUtils.createRealMatrix(order, r); + for (int i = 0; i < order; ++i) { + for (int j = 0; j < r; ++j) { + root.setEntry(index[i], j, b[i][j]); + } + } + } +" +Jsoup-10," public String absUrl(String attributeKey) { + Validate.notEmpty(attributeKey); + String relUrl = attr(attributeKey); + if (!hasAttr(attributeKey)) { + return """"; + } else { + URL base; + try { + try { + base = new URL(baseUri); + } catch (MalformedURLException e) { + URL abs = new URL(relUrl); + return abs.toExternalForm(); + } + URL abs = new URL(base, relUrl); + return abs.toExternalForm(); + } catch (MalformedURLException e) { + return """"; + } + } + } +"," public String absUrl(String attributeKey) { + Validate.notEmpty(attributeKey); + String relUrl = attr(attributeKey); + if (!hasAttr(attributeKey)) { + return """"; + } else { + URL base; + try { + try { + base = new URL(baseUri); + } catch (MalformedURLException e) { + URL abs = new URL(relUrl); + return abs.toExternalForm(); + } + if (relUrl.startsWith(""?"")) + relUrl = base.getPath() + relUrl; + URL abs = new URL(base, relUrl); + return abs.toExternalForm(); + } catch (MalformedURLException e) { + return """"; + } + } + } +" +Math-101," public Complex parse(String source, ParsePosition pos) { + int initialIndex = pos.getIndex(); + parseAndIgnoreWhitespace(source, pos); + Number re = parseNumber(source, getRealFormat(), pos); + if (re == null) { + pos.setIndex(initialIndex); + return null; + } + int startIndex = pos.getIndex(); + char c = parseNextCharacter(source, pos); + int sign = 0; + switch (c) { + case 0 : + return new Complex(re.doubleValue(), 0.0); + case '-' : + sign = -1; + break; + case '+' : + sign = 1; + break; + default : + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number im = parseNumber(source, getRealFormat(), pos); + if (im == null) { + pos.setIndex(initialIndex); + return null; + } + int n = getImaginaryCharacter().length(); + startIndex = pos.getIndex(); + int endIndex = startIndex + n; + if ( + source.substring(startIndex, endIndex).compareTo( + getImaginaryCharacter()) != 0) { + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + pos.setIndex(endIndex); + return new Complex(re.doubleValue(), im.doubleValue() * sign); + } +"," public Complex parse(String source, ParsePosition pos) { + int initialIndex = pos.getIndex(); + parseAndIgnoreWhitespace(source, pos); + Number re = parseNumber(source, getRealFormat(), pos); + if (re == null) { + pos.setIndex(initialIndex); + return null; + } + int startIndex = pos.getIndex(); + char c = parseNextCharacter(source, pos); + int sign = 0; + switch (c) { + case 0 : + return new Complex(re.doubleValue(), 0.0); + case '-' : + sign = -1; + break; + case '+' : + sign = 1; + break; + default : + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number im = parseNumber(source, getRealFormat(), pos); + if (im == null) { + pos.setIndex(initialIndex); + return null; + } + int n = getImaginaryCharacter().length(); + startIndex = pos.getIndex(); + int endIndex = startIndex + n; + if ((startIndex >= source.length()) || + (endIndex > source.length()) || + source.substring(startIndex, endIndex).compareTo( + getImaginaryCharacter()) != 0) { + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + pos.setIndex(endIndex); + return new Complex(re.doubleValue(), im.doubleValue() * sign); + } +" +Codec-10," public String caverphone(String txt) { + if( txt == null || txt.length() == 0 ) { + return ""1111111111""; + } + txt = txt.toLowerCase(java.util.Locale.ENGLISH); + txt = txt.replaceAll(""[^a-z]"", """"); + txt = txt.replaceAll(""e$"", """"); + txt = txt.replaceAll(""^cough"", ""cou2f""); + txt = txt.replaceAll(""^rough"", ""rou2f""); + txt = txt.replaceAll(""^tough"", ""tou2f""); + txt = txt.replaceAll(""^enough"", ""enou2f""); + txt = txt.replaceAll(""^trough"", ""trou2f""); + txt = txt.replaceAll(""^gn"", ""2n""); + txt = txt.replaceAll(""^mb"", ""m2""); + txt = txt.replaceAll(""cq"", ""2q""); + txt = txt.replaceAll(""ci"", ""si""); + txt = txt.replaceAll(""ce"", ""se""); + txt = txt.replaceAll(""cy"", ""sy""); + txt = txt.replaceAll(""tch"", ""2ch""); + txt = txt.replaceAll(""c"", ""k""); + txt = txt.replaceAll(""q"", ""k""); + txt = txt.replaceAll(""x"", ""k""); + txt = txt.replaceAll(""v"", ""f""); + txt = txt.replaceAll(""dg"", ""2g""); + txt = txt.replaceAll(""tio"", ""sio""); + txt = txt.replaceAll(""tia"", ""sia""); + txt = txt.replaceAll(""d"", ""t""); + txt = txt.replaceAll(""ph"", ""fh""); + txt = txt.replaceAll(""b"", ""p""); + txt = txt.replaceAll(""sh"", ""s2""); + txt = txt.replaceAll(""z"", ""s""); + txt = txt.replaceAll(""^[aeiou]"", ""A""); + txt = txt.replaceAll(""[aeiou]"", ""3""); + txt = txt.replaceAll(""j"", ""y""); + txt = txt.replaceAll(""^y3"", ""Y3""); + txt = txt.replaceAll(""^y"", ""A""); + txt = txt.replaceAll(""y"", ""3""); + txt = txt.replaceAll(""3gh3"", ""3kh3""); + txt = txt.replaceAll(""gh"", ""22""); + txt = txt.replaceAll(""g"", ""k""); + txt = txt.replaceAll(""s+"", ""S""); + txt = txt.replaceAll(""t+"", ""T""); + txt = txt.replaceAll(""p+"", ""P""); + txt = txt.replaceAll(""k+"", ""K""); + txt = txt.replaceAll(""f+"", ""F""); + txt = txt.replaceAll(""m+"", ""M""); + txt = txt.replaceAll(""n+"", ""N""); + txt = txt.replaceAll(""w3"", ""W3""); + txt = txt.replaceAll(""wh3"", ""Wh3""); + txt = txt.replaceAll(""w$"", ""3""); + txt = txt.replaceAll(""w"", ""2""); + txt = txt.replaceAll(""^h"", ""A""); + txt = txt.replaceAll(""h"", ""2""); + txt = txt.replaceAll(""r3"", ""R3""); + txt = txt.replaceAll(""r$"", ""3""); + txt = txt.replaceAll(""r"", ""2""); + txt = txt.replaceAll(""l3"", ""L3""); + txt = txt.replaceAll(""l$"", ""3""); + txt = txt.replaceAll(""l"", ""2""); + txt = txt.replaceAll(""2"", """"); + txt = txt.replaceAll(""3$"", ""A""); + txt = txt.replaceAll(""3"", """"); + txt = txt + ""111111"" + ""1111""; + return txt.substring(0, 10); + } +"," public String caverphone(String txt) { + if( txt == null || txt.length() == 0 ) { + return ""1111111111""; + } + txt = txt.toLowerCase(java.util.Locale.ENGLISH); + txt = txt.replaceAll(""[^a-z]"", """"); + txt = txt.replaceAll(""e$"", """"); + txt = txt.replaceAll(""^cough"", ""cou2f""); + txt = txt.replaceAll(""^rough"", ""rou2f""); + txt = txt.replaceAll(""^tough"", ""tou2f""); + txt = txt.replaceAll(""^enough"", ""enou2f""); + txt = txt.replaceAll(""^trough"", ""trou2f""); + txt = txt.replaceAll(""^gn"", ""2n""); + txt = txt.replaceAll(""mb$"", ""m2""); + txt = txt.replaceAll(""cq"", ""2q""); + txt = txt.replaceAll(""ci"", ""si""); + txt = txt.replaceAll(""ce"", ""se""); + txt = txt.replaceAll(""cy"", ""sy""); + txt = txt.replaceAll(""tch"", ""2ch""); + txt = txt.replaceAll(""c"", ""k""); + txt = txt.replaceAll(""q"", ""k""); + txt = txt.replaceAll(""x"", ""k""); + txt = txt.replaceAll(""v"", ""f""); + txt = txt.replaceAll(""dg"", ""2g""); + txt = txt.replaceAll(""tio"", ""sio""); + txt = txt.replaceAll(""tia"", ""sia""); + txt = txt.replaceAll(""d"", ""t""); + txt = txt.replaceAll(""ph"", ""fh""); + txt = txt.replaceAll(""b"", ""p""); + txt = txt.replaceAll(""sh"", ""s2""); + txt = txt.replaceAll(""z"", ""s""); + txt = txt.replaceAll(""^[aeiou]"", ""A""); + txt = txt.replaceAll(""[aeiou]"", ""3""); + txt = txt.replaceAll(""j"", ""y""); + txt = txt.replaceAll(""^y3"", ""Y3""); + txt = txt.replaceAll(""^y"", ""A""); + txt = txt.replaceAll(""y"", ""3""); + txt = txt.replaceAll(""3gh3"", ""3kh3""); + txt = txt.replaceAll(""gh"", ""22""); + txt = txt.replaceAll(""g"", ""k""); + txt = txt.replaceAll(""s+"", ""S""); + txt = txt.replaceAll(""t+"", ""T""); + txt = txt.replaceAll(""p+"", ""P""); + txt = txt.replaceAll(""k+"", ""K""); + txt = txt.replaceAll(""f+"", ""F""); + txt = txt.replaceAll(""m+"", ""M""); + txt = txt.replaceAll(""n+"", ""N""); + txt = txt.replaceAll(""w3"", ""W3""); + txt = txt.replaceAll(""wh3"", ""Wh3""); + txt = txt.replaceAll(""w$"", ""3""); + txt = txt.replaceAll(""w"", ""2""); + txt = txt.replaceAll(""^h"", ""A""); + txt = txt.replaceAll(""h"", ""2""); + txt = txt.replaceAll(""r3"", ""R3""); + txt = txt.replaceAll(""r$"", ""3""); + txt = txt.replaceAll(""r"", ""2""); + txt = txt.replaceAll(""l3"", ""L3""); + txt = txt.replaceAll(""l$"", ""3""); + txt = txt.replaceAll(""l"", ""2""); + txt = txt.replaceAll(""2"", """"); + txt = txt.replaceAll(""3$"", ""A""); + txt = txt.replaceAll(""3"", """"); + txt = txt + ""111111"" + ""1111""; + return txt.substring(0, 10); + } +" +Compress-30," public int read(final byte[] dest, final int offs, final int len) + throws IOException { + if (offs < 0) { + throw new IndexOutOfBoundsException(""offs("" + offs + "") < 0.""); + } + if (len < 0) { + throw new IndexOutOfBoundsException(""len("" + len + "") < 0.""); + } + if (offs + len > dest.length) { + throw new IndexOutOfBoundsException(""offs("" + offs + "") + len("" + + len + "") > dest.length("" + dest.length + "").""); + } + if (this.in == null) { + throw new IOException(""stream closed""); + } + final int hi = offs + len; + int destOffs = offs; + int b; + while (destOffs < hi && ((b = read0()) >= 0)) { + dest[destOffs++] = (byte) b; + count(1); + } + int c = (destOffs == offs) ? -1 : (destOffs - offs); + return c; + } +"," public int read(final byte[] dest, final int offs, final int len) + throws IOException { + if (offs < 0) { + throw new IndexOutOfBoundsException(""offs("" + offs + "") < 0.""); + } + if (len < 0) { + throw new IndexOutOfBoundsException(""len("" + len + "") < 0.""); + } + if (offs + len > dest.length) { + throw new IndexOutOfBoundsException(""offs("" + offs + "") + len("" + + len + "") > dest.length("" + dest.length + "").""); + } + if (this.in == null) { + throw new IOException(""stream closed""); + } + if (len == 0) { + return 0; + } + final int hi = offs + len; + int destOffs = offs; + int b; + while (destOffs < hi && ((b = read0()) >= 0)) { + dest[destOffs++] = (byte) b; + count(1); + } + int c = (destOffs == offs) ? -1 : (destOffs - offs); + return c; + } +" +Math-5," public Complex reciprocal() { + if (isNaN) { + return NaN; + } + if (real == 0.0 && imaginary == 0.0) { + return NaN; + } + if (isInfinite) { + return ZERO; + } + if (FastMath.abs(real) < FastMath.abs(imaginary)) { + double q = real / imaginary; + double scale = 1. / (real * q + imaginary); + return createComplex(scale * q, -scale); + } else { + double q = imaginary / real; + double scale = 1. / (imaginary * q + real); + return createComplex(scale, -scale * q); + } + } +"," public Complex reciprocal() { + if (isNaN) { + return NaN; + } + if (real == 0.0 && imaginary == 0.0) { + return INF; + } + if (isInfinite) { + return ZERO; + } + if (FastMath.abs(real) < FastMath.abs(imaginary)) { + double q = real / imaginary; + double scale = 1. / (real * q + imaginary); + return createComplex(scale * q, -scale); + } else { + double q = imaginary / real; + double scale = 1. / (imaginary * q + real); + return createComplex(scale, -scale * q); + } + } +" +Closure-55," private static boolean isReduceableFunctionExpression(Node n) { + return NodeUtil.isFunctionExpression(n); + } +"," private static boolean isReduceableFunctionExpression(Node n) { + return NodeUtil.isFunctionExpression(n) + && !NodeUtil.isGetOrSetKey(n.getParent()); + } +" +Closure-67," private boolean isPrototypePropertyAssign(Node assign) { + Node n = assign.getFirstChild(); + if (n != null && NodeUtil.isVarOrSimpleAssignLhs(n, assign) + && n.getType() == Token.GETPROP + ) { + boolean isChainedProperty = + n.getFirstChild().getType() == Token.GETPROP; + if (isChainedProperty) { + Node child = n.getFirstChild().getFirstChild().getNext(); + if (child.getType() == Token.STRING && + child.getString().equals(""prototype"")) { + return true; + } + } + } + return false; + } +"," private boolean isPrototypePropertyAssign(Node assign) { + Node n = assign.getFirstChild(); + if (n != null && NodeUtil.isVarOrSimpleAssignLhs(n, assign) + && n.getType() == Token.GETPROP + && assign.getParent().getType() == Token.EXPR_RESULT) { + boolean isChainedProperty = + n.getFirstChild().getType() == Token.GETPROP; + if (isChainedProperty) { + Node child = n.getFirstChild().getFirstChild().getNext(); + if (child.getType() == Token.STRING && + child.getString().equals(""prototype"")) { + return true; + } + } + } + return false; + } +" +Closure-168," @Override public void visit(NodeTraversal t, Node n, Node parent) { + if (t.inGlobalScope()) { + return; + } + if (n.isReturn() && n.getFirstChild() != null) { + data.get(t.getScopeRoot()).recordNonEmptyReturn(); + } + if (t.getScopeDepth() <= 2) { + return; + } + if (n.isName() && NodeUtil.isLValue(n) && + !NodeUtil.isBleedingFunctionName(n)) { + String name = n.getString(); + Scope scope = t.getScope(); + Var var = scope.getVar(name); + if (var != null) { + Scope ownerScope = var.getScope(); + if (ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()).recordAssignedName(name); + } + if (scope != ownerScope && ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()).recordEscapedVarName(name); + } + } + } else if (n.isGetProp() && n.isUnscopedQualifiedName() && + NodeUtil.isLValue(n)) { + String name = NodeUtil.getRootOfQualifiedName(n).getString(); + Scope scope = t.getScope(); + Var var = scope.getVar(name); + if (var != null) { + Scope ownerScope = var.getScope(); + if (scope != ownerScope && ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()) + .recordEscapedQualifiedName(n.getQualifiedName()); + } + } + } + } +"," @Override public void visit(NodeTraversal t, Node n, Node parent) { + if (t.inGlobalScope()) { + return; + } + if (n.isReturn() && n.getFirstChild() != null) { + data.get(t.getScopeRoot()).recordNonEmptyReturn(); + } + if (t.getScopeDepth() <= 1) { + return; + } + if (n.isName() && NodeUtil.isLValue(n) && + !NodeUtil.isBleedingFunctionName(n)) { + String name = n.getString(); + Scope scope = t.getScope(); + Var var = scope.getVar(name); + if (var != null) { + Scope ownerScope = var.getScope(); + if (ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()).recordAssignedName(name); + } + if (scope != ownerScope && ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()).recordEscapedVarName(name); + } + } + } else if (n.isGetProp() && n.isUnscopedQualifiedName() && + NodeUtil.isLValue(n)) { + String name = NodeUtil.getRootOfQualifiedName(n).getString(); + Scope scope = t.getScope(); + Var var = scope.getVar(name); + if (var != null) { + Scope ownerScope = var.getScope(); + if (scope != ownerScope && ownerScope.isLocal()) { + data.get(ownerScope.getRootNode()) + .recordEscapedQualifiedName(n.getQualifiedName()); + } + } + } + } +" +Closure-39," String toStringHelper(boolean forAnnotations) { + if (hasReferenceName()) { + return getReferenceName(); + } else if (prettyPrint) { + prettyPrint = false; + Set propertyNames = Sets.newTreeSet(); + for (ObjectType current = this; + current != null && !current.isNativeObjectType() && + propertyNames.size() <= MAX_PRETTY_PRINTED_PROPERTIES; + current = current.getImplicitPrototype()) { + propertyNames.addAll(current.getOwnPropertyNames()); + } + StringBuilder sb = new StringBuilder(); + sb.append(""{""); + int i = 0; + for (String property : propertyNames) { + if (i > 0) { + sb.append("", ""); + } + sb.append(property); + sb.append("": ""); + sb.append(getPropertyType(property).toString()); + ++i; + if (i == MAX_PRETTY_PRINTED_PROPERTIES) { + sb.append("", ...""); + break; + } + } + sb.append(""}""); + prettyPrint = true; + return sb.toString(); + } else { + return ""{...}""; + } + } +"," String toStringHelper(boolean forAnnotations) { + if (hasReferenceName()) { + return getReferenceName(); + } else if (prettyPrint) { + prettyPrint = false; + Set propertyNames = Sets.newTreeSet(); + for (ObjectType current = this; + current != null && !current.isNativeObjectType() && + propertyNames.size() <= MAX_PRETTY_PRINTED_PROPERTIES; + current = current.getImplicitPrototype()) { + propertyNames.addAll(current.getOwnPropertyNames()); + } + StringBuilder sb = new StringBuilder(); + sb.append(""{""); + int i = 0; + for (String property : propertyNames) { + if (i > 0) { + sb.append("", ""); + } + sb.append(property); + sb.append("": ""); + sb.append(getPropertyType(property).toStringHelper(forAnnotations)); + ++i; + if (!forAnnotations && i == MAX_PRETTY_PRINTED_PROPERTIES) { + sb.append("", ...""); + break; + } + } + sb.append(""}""); + prettyPrint = true; + return sb.toString(); + } else { + return forAnnotations ? ""?"" : ""{...}""; + } + } +" +Lang-53," private static void modify(Calendar val, int field, boolean round) { + if (val.get(Calendar.YEAR) > 280000000) { + throw new ArithmeticException(""Calendar value too large for accurate calculations""); + } + if (field == Calendar.MILLISECOND) { + return; + } + Date date = val.getTime(); + long time = date.getTime(); + boolean done = false; + int millisecs = val.get(Calendar.MILLISECOND); + if (!round || millisecs < 500) { + time = time - millisecs; + if (field == Calendar.SECOND) { + done = true; + } + } + int seconds = val.get(Calendar.SECOND); + if (!done && (!round || seconds < 30)) { + time = time - (seconds * 1000L); + if (field == Calendar.MINUTE) { + done = true; + } + } + int minutes = val.get(Calendar.MINUTE); + if (!done && (!round || minutes < 30)) { + time = time - (minutes * 60000L); + } + if (date.getTime() != time) { + date.setTime(time); + val.setTime(date); + } + boolean roundUp = false; + for (int i = 0; i < fields.length; i++) { + for (int j = 0; j < fields[i].length; j++) { + if (fields[i][j] == field) { + if (round && roundUp) { + if (field == DateUtils.SEMI_MONTH) { + if (val.get(Calendar.DATE) == 1) { + val.add(Calendar.DATE, 15); + } else { + val.add(Calendar.DATE, -15); + val.add(Calendar.MONTH, 1); + } + } else { + val.add(fields[i][0], 1); + } + } + return; + } + } + int offset = 0; + boolean offsetSet = false; + switch (field) { + case DateUtils.SEMI_MONTH: + if (fields[i][0] == Calendar.DATE) { + offset = val.get(Calendar.DATE) - 1; + if (offset >= 15) { + offset -= 15; + } + roundUp = offset > 7; + offsetSet = true; + } + break; + case Calendar.AM_PM: + if (fields[i][0] == Calendar.HOUR_OF_DAY) { + offset = val.get(Calendar.HOUR_OF_DAY); + if (offset >= 12) { + offset -= 12; + } + roundUp = offset > 6; + offsetSet = true; + } + break; + } + if (!offsetSet) { + int min = val.getActualMinimum(fields[i][0]); + int max = val.getActualMaximum(fields[i][0]); + offset = val.get(fields[i][0]) - min; + roundUp = offset > ((max - min) / 2); + } + if (offset != 0) { + val.set(fields[i][0], val.get(fields[i][0]) - offset); + } + } + throw new IllegalArgumentException(""The field "" + field + "" is not supported""); + } +"," private static void modify(Calendar val, int field, boolean round) { + if (val.get(Calendar.YEAR) > 280000000) { + throw new ArithmeticException(""Calendar value too large for accurate calculations""); + } + if (field == Calendar.MILLISECOND) { + return; + } + Date date = val.getTime(); + long time = date.getTime(); + boolean done = false; + int millisecs = val.get(Calendar.MILLISECOND); + if (!round || millisecs < 500) { + time = time - millisecs; + } + if (field == Calendar.SECOND) { + done = true; + } + int seconds = val.get(Calendar.SECOND); + if (!done && (!round || seconds < 30)) { + time = time - (seconds * 1000L); + } + if (field == Calendar.MINUTE) { + done = true; + } + int minutes = val.get(Calendar.MINUTE); + if (!done && (!round || minutes < 30)) { + time = time - (minutes * 60000L); + } + if (date.getTime() != time) { + date.setTime(time); + val.setTime(date); + } + boolean roundUp = false; + for (int i = 0; i < fields.length; i++) { + for (int j = 0; j < fields[i].length; j++) { + if (fields[i][j] == field) { + if (round && roundUp) { + if (field == DateUtils.SEMI_MONTH) { + if (val.get(Calendar.DATE) == 1) { + val.add(Calendar.DATE, 15); + } else { + val.add(Calendar.DATE, -15); + val.add(Calendar.MONTH, 1); + } + } else { + val.add(fields[i][0], 1); + } + } + return; + } + } + int offset = 0; + boolean offsetSet = false; + switch (field) { + case DateUtils.SEMI_MONTH: + if (fields[i][0] == Calendar.DATE) { + offset = val.get(Calendar.DATE) - 1; + if (offset >= 15) { + offset -= 15; + } + roundUp = offset > 7; + offsetSet = true; + } + break; + case Calendar.AM_PM: + if (fields[i][0] == Calendar.HOUR_OF_DAY) { + offset = val.get(Calendar.HOUR_OF_DAY); + if (offset >= 12) { + offset -= 12; + } + roundUp = offset > 6; + offsetSet = true; + } + break; + } + if (!offsetSet) { + int min = val.getActualMinimum(fields[i][0]); + int max = val.getActualMaximum(fields[i][0]); + offset = val.get(fields[i][0]) - min; + roundUp = offset > ((max - min) / 2); + } + if (offset != 0) { + val.set(fields[i][0], val.get(fields[i][0]) - offset); + } + } + throw new IllegalArgumentException(""The field "" + field + "" is not supported""); + } +" +Csv-1," public int read() throws IOException { + int current = super.read(); + if (current == '\n') { + lineCounter++; + } + lastChar = current; + return lastChar; + } +"," public int read() throws IOException { + int current = super.read(); + if (current == '\r' || (current == '\n' && lastChar != '\r')) { + lineCounter++; + } + lastChar = current; + return lastChar; + } +" +JacksonDatabind-35," private final Object _deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + if (p.canReadTypeId()) { + Object typeId = p.getTypeId(); + if (typeId != null) { + return _deserializeWithNativeTypeId(p, ctxt, typeId); + } + } + if (p.getCurrentToken() != JsonToken.START_OBJECT) { + throw ctxt.wrongTokenException(p, JsonToken.START_OBJECT, + ""need JSON Object to contain As.WRAPPER_OBJECT type information for class ""+baseTypeName()); + } + if (p.nextToken() != JsonToken.FIELD_NAME) { + throw ctxt.wrongTokenException(p, JsonToken.FIELD_NAME, + ""need JSON String that contains type id (for subtype of ""+baseTypeName()+"")""); + } + final String typeId = p.getText(); + JsonDeserializer deser = _findDeserializer(ctxt, typeId); + p.nextToken(); + if (_typeIdVisible && p.getCurrentToken() == JsonToken.START_OBJECT) { + TokenBuffer tb = new TokenBuffer(null, false); + tb.writeStartObject(); + tb.writeFieldName(_typePropertyName); + tb.writeString(typeId); + p = JsonParserSequence.createFlattened(tb.asParser(p), p); + p.nextToken(); + } + Object value = deser.deserialize(p, ctxt); + if (p.nextToken() != JsonToken.END_OBJECT) { + throw ctxt.wrongTokenException(p, JsonToken.END_OBJECT, + ""expected closing END_OBJECT after type information and deserialized value""); + } + return value; + } +"," private final Object _deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + if (p.canReadTypeId()) { + Object typeId = p.getTypeId(); + if (typeId != null) { + return _deserializeWithNativeTypeId(p, ctxt, typeId); + } + } + JsonToken t = p.getCurrentToken(); + if (t == JsonToken.START_OBJECT) { + if (p.nextToken() != JsonToken.FIELD_NAME) { + throw ctxt.wrongTokenException(p, JsonToken.FIELD_NAME, + ""need JSON String that contains type id (for subtype of ""+baseTypeName()+"")""); + } + } else if (t != JsonToken.FIELD_NAME) { + throw ctxt.wrongTokenException(p, JsonToken.START_OBJECT, + ""need JSON Object to contain As.WRAPPER_OBJECT type information for class ""+baseTypeName()); + } + final String typeId = p.getText(); + JsonDeserializer deser = _findDeserializer(ctxt, typeId); + p.nextToken(); + if (_typeIdVisible && p.getCurrentToken() == JsonToken.START_OBJECT) { + TokenBuffer tb = new TokenBuffer(null, false); + tb.writeStartObject(); + tb.writeFieldName(_typePropertyName); + tb.writeString(typeId); + p = JsonParserSequence.createFlattened(tb.asParser(p), p); + p.nextToken(); + } + Object value = deser.deserialize(p, ctxt); + if (p.nextToken() != JsonToken.END_OBJECT) { + throw ctxt.wrongTokenException(p, JsonToken.END_OBJECT, + ""expected closing END_OBJECT after type information and deserialized value""); + } + return value; + } +" +JacksonDatabind-64," protected BeanPropertyWriter buildWriter(SerializerProvider prov, + BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer ser, + TypeSerializer typeSer, TypeSerializer contentTypeSer, + AnnotatedMember am, boolean defaultUseStaticTyping) + throws JsonMappingException + { + JavaType serializationType; + try { + serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); + } catch (JsonMappingException e) { + return prov.reportBadPropertyDefinition(_beanDesc, propDef, e.getMessage()); + } + if (contentTypeSer != null) { + if (serializationType == null) { + serializationType = declaredType; + } + JavaType ct = serializationType.getContentType(); + if (ct == null) { + prov.reportBadPropertyDefinition(_beanDesc, propDef, + ""serialization type ""+serializationType+"" has no content""); + } + serializationType = serializationType.withContentTypeHandler(contentTypeSer); + ct = serializationType.getContentType(); + } + Object valueToSuppress = null; + boolean suppressNulls = false; + JavaType actualType = (serializationType == null) ? declaredType : serializationType; + JsonInclude.Value inclV = _config.getDefaultPropertyInclusion(actualType.getRawClass(), + _defaultInclusion); + inclV = inclV.withOverrides(propDef.findInclusion()); + JsonInclude.Include inclusion = inclV.getValueInclusion(); + if (inclusion == JsonInclude.Include.USE_DEFAULTS) { + inclusion = JsonInclude.Include.ALWAYS; + } + switch (inclusion) { + case NON_DEFAULT: + if (_useRealPropertyDefaults) { + if (prov.isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)) { + am.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + valueToSuppress = getPropertyDefaultValue(propDef.getName(), am, actualType); + } else { + valueToSuppress = getDefaultValue(actualType); + suppressNulls = true; + } + if (valueToSuppress == null) { + suppressNulls = true; + } else { + if (valueToSuppress.getClass().isArray()) { + valueToSuppress = ArrayBuilders.getArrayComparator(valueToSuppress); + } + } + break; + case NON_ABSENT: + suppressNulls = true; + if (actualType.isReferenceType()) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + case NON_EMPTY: + suppressNulls = true; + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + break; + case NON_NULL: + suppressNulls = true; + case ALWAYS: + default: + if (actualType.isContainerType() + && !_config.isEnabled(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS)) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + } + BeanPropertyWriter bpw = new BeanPropertyWriter(propDef, + am, _beanDesc.getClassAnnotations(), declaredType, + ser, typeSer, serializationType, suppressNulls, valueToSuppress); + Object serDef = _annotationIntrospector.findNullSerializer(am); + if (serDef != null) { + bpw.assignNullSerializer(prov.serializerInstance(am, serDef)); + } + NameTransformer unwrapper = _annotationIntrospector.findUnwrappingNameTransformer(am); + if (unwrapper != null) { + bpw = bpw.unwrappingWriter(unwrapper); + } + return bpw; + } +"," protected BeanPropertyWriter buildWriter(SerializerProvider prov, + BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer ser, + TypeSerializer typeSer, TypeSerializer contentTypeSer, + AnnotatedMember am, boolean defaultUseStaticTyping) + throws JsonMappingException + { + JavaType serializationType; + try { + serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); + } catch (JsonMappingException e) { + return prov.reportBadPropertyDefinition(_beanDesc, propDef, e.getMessage()); + } + if (contentTypeSer != null) { + if (serializationType == null) { + serializationType = declaredType; + } + JavaType ct = serializationType.getContentType(); + if (ct == null) { + prov.reportBadPropertyDefinition(_beanDesc, propDef, + ""serialization type ""+serializationType+"" has no content""); + } + serializationType = serializationType.withContentTypeHandler(contentTypeSer); + ct = serializationType.getContentType(); + } + Object valueToSuppress = null; + boolean suppressNulls = false; + JavaType actualType = (serializationType == null) ? declaredType : serializationType; + JsonInclude.Value inclV = _config.getDefaultPropertyInclusion(actualType.getRawClass(), + _defaultInclusion); + inclV = inclV.withOverrides(propDef.findInclusion()); + JsonInclude.Include inclusion = inclV.getValueInclusion(); + if (inclusion == JsonInclude.Include.USE_DEFAULTS) { + inclusion = JsonInclude.Include.ALWAYS; + } + switch (inclusion) { + case NON_DEFAULT: + Object defaultBean; + if (_useRealPropertyDefaults && (defaultBean = getDefaultBean()) != null) { + if (prov.isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)) { + am.fixAccess(_config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + try { + valueToSuppress = am.getValue(defaultBean); + } catch (Exception e) { + _throwWrapped(e, propDef.getName(), defaultBean); + } + } else { + valueToSuppress = getDefaultValue(actualType); + suppressNulls = true; + } + if (valueToSuppress == null) { + suppressNulls = true; + } else { + if (valueToSuppress.getClass().isArray()) { + valueToSuppress = ArrayBuilders.getArrayComparator(valueToSuppress); + } + } + break; + case NON_ABSENT: + suppressNulls = true; + if (actualType.isReferenceType()) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + case NON_EMPTY: + suppressNulls = true; + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + break; + case NON_NULL: + suppressNulls = true; + case ALWAYS: + default: + if (actualType.isContainerType() + && !_config.isEnabled(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS)) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + } + BeanPropertyWriter bpw = new BeanPropertyWriter(propDef, + am, _beanDesc.getClassAnnotations(), declaredType, + ser, typeSer, serializationType, suppressNulls, valueToSuppress); + Object serDef = _annotationIntrospector.findNullSerializer(am); + if (serDef != null) { + bpw.assignNullSerializer(prov.serializerInstance(am, serDef)); + } + NameTransformer unwrapper = _annotationIntrospector.findUnwrappingNameTransformer(am); + if (unwrapper != null) { + bpw = bpw.unwrappingWriter(unwrapper); + } + return bpw; + } +" +Closure-15," public boolean apply(Node n) { + if (n == null) { + return false; + } + if (n.isCall() && NodeUtil.functionCallHasSideEffects(n)) { + return true; + } + if (n.isNew() && NodeUtil.constructorCallHasSideEffects(n)) { + return true; + } + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + if (!ControlFlowGraph.isEnteringNewCfgNode(c) && apply(c)) { + return true; + } + } + return false; + } +"," public boolean apply(Node n) { + if (n == null) { + return false; + } + if (n.isCall() && NodeUtil.functionCallHasSideEffects(n)) { + return true; + } + if (n.isNew() && NodeUtil.constructorCallHasSideEffects(n)) { + return true; + } + if (n.isDelProp()) { + return true; + } + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + if (!ControlFlowGraph.isEnteringNewCfgNode(c) && apply(c)) { + return true; + } + } + return false; + } +" +Math-75," public double getPct(Object v) { + return getCumPct((Comparable) v); + } +"," public double getPct(Object v) { + return getPct((Comparable) v); + } +" +Jsoup-33," Element insert(Token.StartTag startTag) { + if (startTag.isSelfClosing()) { + Element el = insertEmpty(startTag); + stack.add(el); + tokeniser.emit(new Token.EndTag(el.tagName())); + return el; + } + Element el = new Element(Tag.valueOf(startTag.name()), baseUri, startTag.attributes); + insert(el); + return el; + } +"," Element insert(Token.StartTag startTag) { + if (startTag.isSelfClosing()) { + Element el = insertEmpty(startTag); + stack.add(el); + tokeniser.transition(TokeniserState.Data); + tokeniser.emit(new Token.EndTag(el.tagName())); + return el; + } + Element el = new Element(Tag.valueOf(startTag.name()), baseUri, startTag.attributes); + insert(el); + return el; + } +" +Mockito-24," public Object answer(InvocationOnMock invocation) { + if (methodsGuru.isToString(invocation.getMethod())) { + Object mock = invocation.getMock(); + MockName name = mockUtil.getMockName(mock); + if (name.isDefault()) { + return ""Mock for "" + mockUtil.getMockSettings(mock).getTypeToMock().getSimpleName() + "", hashCode: "" + mock.hashCode(); + } else { + return name.toString(); + } + } else if (methodsGuru.isCompareToMethod(invocation.getMethod())) { + return 1; + } + Class returnType = invocation.getMethod().getReturnType(); + return returnValueFor(returnType); + } +"," public Object answer(InvocationOnMock invocation) { + if (methodsGuru.isToString(invocation.getMethod())) { + Object mock = invocation.getMock(); + MockName name = mockUtil.getMockName(mock); + if (name.isDefault()) { + return ""Mock for "" + mockUtil.getMockSettings(mock).getTypeToMock().getSimpleName() + "", hashCode: "" + mock.hashCode(); + } else { + return name.toString(); + } + } else if (methodsGuru.isCompareToMethod(invocation.getMethod())) { + return invocation.getMock() == invocation.getArguments()[0] ? 0 : 1; + } + Class returnType = invocation.getMethod().getReturnType(); + return returnValueFor(returnType); + } +" +JacksonDatabind-11," protected JavaType _fromVariable(TypeVariable type, TypeBindings context) + { + final String name = type.getName(); + if (context == null) { + return _unknownType(); + } else { + JavaType actualType = context.findType(name); + if (actualType != null) { + return actualType; + } + } + Type[] bounds = type.getBounds(); + context._addPlaceholder(name); + return _constructType(bounds[0], context); + } +"," protected JavaType _fromVariable(TypeVariable type, TypeBindings context) + { + final String name = type.getName(); + if (context == null) { + context = new TypeBindings(this, (Class) null); + } else { + JavaType actualType = context.findType(name, false); + if (actualType != null) { + return actualType; + } + } + Type[] bounds = type.getBounds(); + context._addPlaceholder(name); + return _constructType(bounds[0], context); + } +" +Closure-94," static boolean isValidDefineValue(Node val, Set defines) { + switch (val.getType()) { + case Token.STRING: + case Token.NUMBER: + case Token.TRUE: + case Token.FALSE: + return true; + case Token.BITAND: + case Token.BITNOT: + case Token.BITOR: + case Token.BITXOR: + case Token.NOT: + case Token.NEG: + return isValidDefineValue(val.getFirstChild(), defines); + case Token.NAME: + case Token.GETPROP: + if (val.isQualifiedName()) { + return defines.contains(val.getQualifiedName()); + } + } + return false; + } +"," static boolean isValidDefineValue(Node val, Set defines) { + switch (val.getType()) { + case Token.STRING: + case Token.NUMBER: + case Token.TRUE: + case Token.FALSE: + return true; + case Token.ADD: + case Token.BITAND: + case Token.BITNOT: + case Token.BITOR: + case Token.BITXOR: + case Token.DIV: + case Token.EQ: + case Token.GE: + case Token.GT: + case Token.LE: + case Token.LSH: + case Token.LT: + case Token.MOD: + case Token.MUL: + case Token.NE: + case Token.RSH: + case Token.SHEQ: + case Token.SHNE: + case Token.SUB: + case Token.URSH: + return isValidDefineValue(val.getFirstChild(), defines) + && isValidDefineValue(val.getLastChild(), defines); + case Token.NOT: + case Token.NEG: + case Token.POS: + return isValidDefineValue(val.getFirstChild(), defines); + case Token.NAME: + case Token.GETPROP: + if (val.isQualifiedName()) { + return defines.contains(val.getQualifiedName()); + } + } + return false; + } +" +Jsoup-20," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset = meta.hasAttr(""http-equiv"") ? getCharsetFromContentType(meta.attr(""content"")) : meta.attr(""charset""); + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (doc == null) { + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +"," static Document parseByteData(ByteBuffer byteData, String charsetName, String baseUri, Parser parser) { + String docData; + Document doc = null; + if (charsetName == null) { + docData = Charset.forName(defaultCharset).decode(byteData).toString(); + doc = parser.parseInput(docData, baseUri); + Element meta = doc.select(""meta[http-equiv=content-type], meta[charset]"").first(); + if (meta != null) { + String foundCharset = meta.hasAttr(""http-equiv"") ? getCharsetFromContentType(meta.attr(""content"")) : meta.attr(""charset""); + if (foundCharset != null && foundCharset.length() != 0 && !foundCharset.equals(defaultCharset)) { + charsetName = foundCharset; + byteData.rewind(); + docData = Charset.forName(foundCharset).decode(byteData).toString(); + doc = null; + } + } + } else { + Validate.notEmpty(charsetName, ""Must set charset arg to character set of file to parse. Set to null to attempt to detect from HTML""); + docData = Charset.forName(charsetName).decode(byteData).toString(); + } + if (doc == null) { + if (docData.charAt(0) == 65279) + docData = docData.substring(1); + doc = parser.parseInput(docData, baseUri); + doc.outputSettings().charset(charsetName); + } + return doc; + } +" +Cli-9," protected void checkRequiredOptions() + throws MissingOptionException + { + if (getRequiredOptions().size() > 0) + { + Iterator iter = getRequiredOptions().iterator(); + StringBuffer buff = new StringBuffer(""Missing required option""); + buff.append(getRequiredOptions().size() == 1 ? """" : ""s""); + buff.append("": ""); + while (iter.hasNext()) + { + buff.append(iter.next()); + } + throw new MissingOptionException(buff.toString()); + } + } +"," protected void checkRequiredOptions() + throws MissingOptionException + { + if (getRequiredOptions().size() > 0) + { + Iterator iter = getRequiredOptions().iterator(); + StringBuffer buff = new StringBuffer(""Missing required option""); + buff.append(getRequiredOptions().size() == 1 ? """" : ""s""); + buff.append("": ""); + while (iter.hasNext()) + { + buff.append(iter.next()); + buff.append("", ""); + } + throw new MissingOptionException(buff.substring(0, buff.length() - 2)); + } + } +" +Time-25," public int getOffsetFromLocal(long instantLocal) { + final int offsetLocal = getOffset(instantLocal); + final long instantAdjusted = instantLocal - offsetLocal; + final int offsetAdjusted = getOffset(instantAdjusted); + if (offsetLocal != offsetAdjusted) { + if ((offsetLocal - offsetAdjusted) < 0) { + long nextLocal = nextTransition(instantAdjusted); + long nextAdjusted = nextTransition(instantLocal - offsetAdjusted); + if (nextLocal != nextAdjusted) { + return offsetLocal; + } + } + } + return offsetAdjusted; + } +"," public int getOffsetFromLocal(long instantLocal) { + final int offsetLocal = getOffset(instantLocal); + final long instantAdjusted = instantLocal - offsetLocal; + final int offsetAdjusted = getOffset(instantAdjusted); + if (offsetLocal != offsetAdjusted) { + if ((offsetLocal - offsetAdjusted) < 0) { + long nextLocal = nextTransition(instantAdjusted); + long nextAdjusted = nextTransition(instantLocal - offsetAdjusted); + if (nextLocal != nextAdjusted) { + return offsetLocal; + } + } + } else if (offsetLocal > 0) { + long prev = previousTransition(instantAdjusted); + if (prev < instantAdjusted) { + int offsetPrev = getOffset(prev); + int diff = offsetPrev - offsetLocal; + if (instantAdjusted - prev <= diff) { + return offsetPrev; + } + } + } + return offsetAdjusted; + } +" +Math-25," private void guessAOmega() { + double sx2 = 0; + double sy2 = 0; + double sxy = 0; + double sxz = 0; + double syz = 0; + double currentX = observations[0].getX(); + double currentY = observations[0].getY(); + double f2Integral = 0; + double fPrime2Integral = 0; + final double startX = currentX; + for (int i = 1; i < observations.length; ++i) { + final double previousX = currentX; + final double previousY = currentY; + currentX = observations[i].getX(); + currentY = observations[i].getY(); + final double dx = currentX - previousX; + final double dy = currentY - previousY; + final double f2StepIntegral = + dx * (previousY * previousY + previousY * currentY + currentY * currentY) / 3; + final double fPrime2StepIntegral = dy * dy / dx; + final double x = currentX - startX; + f2Integral += f2StepIntegral; + fPrime2Integral += fPrime2StepIntegral; + sx2 += x * x; + sy2 += f2Integral * f2Integral; + sxy += x * f2Integral; + sxz += x * fPrime2Integral; + syz += f2Integral * fPrime2Integral; + } + double c1 = sy2 * sxz - sxy * syz; + double c2 = sxy * sxz - sx2 * syz; + double c3 = sx2 * sy2 - sxy * sxy; + if ((c1 / c2 < 0) || (c2 / c3 < 0)) { + final int last = observations.length - 1; + final double xRange = observations[last].getX() - observations[0].getX(); + if (xRange == 0) { + throw new ZeroException(); + } + omega = 2 * Math.PI / xRange; + double yMin = Double.POSITIVE_INFINITY; + double yMax = Double.NEGATIVE_INFINITY; + for (int i = 1; i < observations.length; ++i) { + final double y = observations[i].getY(); + if (y < yMin) { + yMin = y; + } + if (y > yMax) { + yMax = y; + } + } + a = 0.5 * (yMax - yMin); + } else { + a = FastMath.sqrt(c1 / c2); + omega = FastMath.sqrt(c2 / c3); + } + } +"," private void guessAOmega() { + double sx2 = 0; + double sy2 = 0; + double sxy = 0; + double sxz = 0; + double syz = 0; + double currentX = observations[0].getX(); + double currentY = observations[0].getY(); + double f2Integral = 0; + double fPrime2Integral = 0; + final double startX = currentX; + for (int i = 1; i < observations.length; ++i) { + final double previousX = currentX; + final double previousY = currentY; + currentX = observations[i].getX(); + currentY = observations[i].getY(); + final double dx = currentX - previousX; + final double dy = currentY - previousY; + final double f2StepIntegral = + dx * (previousY * previousY + previousY * currentY + currentY * currentY) / 3; + final double fPrime2StepIntegral = dy * dy / dx; + final double x = currentX - startX; + f2Integral += f2StepIntegral; + fPrime2Integral += fPrime2StepIntegral; + sx2 += x * x; + sy2 += f2Integral * f2Integral; + sxy += x * f2Integral; + sxz += x * fPrime2Integral; + syz += f2Integral * fPrime2Integral; + } + double c1 = sy2 * sxz - sxy * syz; + double c2 = sxy * sxz - sx2 * syz; + double c3 = sx2 * sy2 - sxy * sxy; + if ((c1 / c2 < 0) || (c2 / c3 < 0)) { + final int last = observations.length - 1; + final double xRange = observations[last].getX() - observations[0].getX(); + if (xRange == 0) { + throw new ZeroException(); + } + omega = 2 * Math.PI / xRange; + double yMin = Double.POSITIVE_INFINITY; + double yMax = Double.NEGATIVE_INFINITY; + for (int i = 1; i < observations.length; ++i) { + final double y = observations[i].getY(); + if (y < yMin) { + yMin = y; + } + if (y > yMax) { + yMax = y; + } + } + a = 0.5 * (yMax - yMin); + } else { + if (c2 == 0) { + throw new MathIllegalStateException(LocalizedFormats.ZERO_DENOMINATOR); + } + a = FastMath.sqrt(c1 / c2); + omega = FastMath.sqrt(c2 / c3); + } + } +" +Mockito-27," public void resetMock(T mock) { + MockHandlerInterface oldMockHandler = getMockHandler(mock); + MockHandler newMockHandler = new MockHandler(oldMockHandler); + MethodInterceptorFilter newFilter = new MethodInterceptorFilter(newMockHandler, (MockSettingsImpl) org.mockito.Mockito.withSettings().defaultAnswer(org.mockito.Mockito.RETURNS_DEFAULTS)); + ((Factory) mock).setCallback(0, newFilter); + } +"," public void resetMock(T mock) { + MockHandlerInterface oldMockHandler = getMockHandler(mock); + MethodInterceptorFilter newFilter = newMethodInterceptorFilter(oldMockHandler.getMockSettings()); + ((Factory) mock).setCallback(0, newFilter); + } +" +JacksonDatabind-7," public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException + { + copyCurrentStructure(jp); + return this; + } +"," public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException + { + if (jp.getCurrentTokenId() != JsonToken.FIELD_NAME.id()) { + copyCurrentStructure(jp); + return this; + } + JsonToken t; + writeStartObject(); + do { + copyCurrentStructure(jp); + } while ((t = jp.nextToken()) == JsonToken.FIELD_NAME); + if (t != JsonToken.END_OBJECT) { + throw ctxt.mappingException(""Expected END_OBJECT after copying contents of a JsonParser into TokenBuffer, got ""+t); + } + writeEndObject(); + return this; + } +" +Jsoup-57," public void removeIgnoreCase(String key) { + Validate.notEmpty(key); + if (attributes == null) + return; + for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) { + String attrKey = it.next(); + if (attrKey.equalsIgnoreCase(key)) + attributes.remove(attrKey); + } + } +"," public void removeIgnoreCase(String key) { + Validate.notEmpty(key); + if (attributes == null) + return; + for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) { + String attrKey = it.next(); + if (attrKey.equalsIgnoreCase(key)) + it.remove(); + } + } +" +Lang-27," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +"," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +" +Lang-22," private static int greatestCommonDivisor(int u, int v) { + if (Math.abs(u) <= 1 || Math.abs(v) <= 1) { + return 1; + } + if (u>0) { u=-u; } + if (v>0) { v=-v; } + int k=0; + while ((u&1)==0 && (v&1)==0 && k<31) { + u/=2; v/=2; k++; + } + if (k==31) { + throw new ArithmeticException(""overflow: gcd is 2^31""); + } + int t = ((u&1)==1) ? v : -(u/2); + do { + while ((t&1)==0) { + t/=2; + } + if (t>0) { + u = -t; + } else { + v = t; + } + t = (v - u)/2; + } while (t!=0); + return -u*(1<0) { u=-u; } + if (v>0) { v=-v; } + int k=0; + while ((u&1)==0 && (v&1)==0 && k<31) { + u/=2; v/=2; k++; + } + if (k==31) { + throw new ArithmeticException(""overflow: gcd is 2^31""); + } + int t = ((u&1)==1) ? v : -(u/2); + do { + while ((t&1)==0) { + t/=2; + } + if (t>0) { + u = -t; + } else { + v = t; + } + t = (v - u)/2; + } while (t!=0); + return -u*(1< b.length || offset + len > b.length) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { + return 0; + } else { + if (!base64.hasData()) { + byte[] buf = new byte[doEncode ? 4096 : 8192]; + int c = in.read(buf); + if (c > 0 && b.length == len) { + base64.setInitialBuffer(b, offset, len); + } + if (doEncode) { + base64.encode(buf, 0, c); + } else { + base64.decode(buf, 0, c); + } + } + return base64.readResults(b, offset, len); + } + } +"," public int read(byte b[], int offset, int len) throws IOException { + if (b == null) { + throw new NullPointerException(); + } else if (offset < 0 || len < 0) { + throw new IndexOutOfBoundsException(); + } else if (offset > b.length || offset + len > b.length) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { + return 0; + } else { + int readLen = 0; + while (readLen == 0) { + if (!base64.hasData()) { + byte[] buf = new byte[doEncode ? 4096 : 8192]; + int c = in.read(buf); + if (c > 0 && b.length == len) { + base64.setInitialBuffer(b, offset, len); + } + if (doEncode) { + base64.encode(buf, 0, c); + } else { + base64.decode(buf, 0, c); + } + } + readLen = base64.readResults(b, offset, len); + } + return readLen; + } + } +" +Math-50," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + case REGULA_FALSI: + if (x == x1) { + x0 = 0.5 * (x0 + x1 - FastMath.max(rtol * FastMath.abs(x1), atol)); + f0 = computeObjectiveValue(x0); + } + break; + default: + throw new MathInternalError(); + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +"," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + case REGULA_FALSI: + break; + default: + throw new MathInternalError(); + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +" +Math-39," public void integrate(final ExpandableStatefulODE equations, final double t) + throws MathIllegalStateException, MathIllegalArgumentException { + sanityChecks(equations, t); + setEquations(equations); + final boolean forward = t > equations.getTime(); + final double[] y0 = equations.getCompleteState(); + final double[] y = y0.clone(); + final int stages = c.length + 1; + final double[][] yDotK = new double[stages][y.length]; + final double[] yTmp = y0.clone(); + final double[] yDotTmp = new double[y.length]; + final RungeKuttaStepInterpolator interpolator = (RungeKuttaStepInterpolator) prototype.copy(); + interpolator.reinitialize(this, yTmp, yDotK, forward, + equations.getPrimaryMapper(), equations.getSecondaryMappers()); + interpolator.storeTime(equations.getTime()); + stepStart = equations.getTime(); + double hNew = 0; + boolean firstTime = true; + initIntegration(equations.getTime(), y0, t); + isLastStep = false; + do { + interpolator.shift(); + double error = 10; + while (error >= 1.0) { + if (firstTime || !fsal) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (firstTime) { + final double[] scale = new double[mainSetDimension]; + if (vecAbsoluteTolerance == null) { + for (int i = 0; i < scale.length; ++i) { + scale[i] = scalAbsoluteTolerance + scalRelativeTolerance * FastMath.abs(y[i]); + } + } else { + for (int i = 0; i < scale.length; ++i) { + scale[i] = vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * FastMath.abs(y[i]); + } + } + hNew = initializeStep(forward, getOrder(), scale, + stepStart, y, yDotK[0], yTmp, yDotK[1]); + firstTime = false; + } + stepSize = hNew; + for (int k = 1; k < stages; ++k) { + for (int j = 0; j < y0.length; ++j) { + double sum = a[k-1][0] * yDotK[0][j]; + for (int l = 1; l < k; ++l) { + sum += a[k-1][l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]); + } + for (int j = 0; j < y0.length; ++j) { + double sum = b[0] * yDotK[0][j]; + for (int l = 1; l < stages; ++l) { + sum += b[l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + error = estimateError(yDotK, y, yTmp, stepSize); + if (error >= 1.0) { + final double factor = + FastMath.min(maxGrowth, + FastMath.max(minReduction, safety * FastMath.pow(error, exp))); + hNew = filterStep(stepSize * factor, forward, false); + } + } + interpolator.storeTime(stepStart + stepSize); + System.arraycopy(yTmp, 0, y, 0, y0.length); + System.arraycopy(yDotK[stages - 1], 0, yDotTmp, 0, y0.length); + stepStart = acceptStep(interpolator, y, yDotTmp, t); + System.arraycopy(y, 0, yTmp, 0, y.length); + if (!isLastStep) { + interpolator.storeTime(stepStart); + if (fsal) { + System.arraycopy(yDotTmp, 0, yDotK[0], 0, y0.length); + } + final double factor = + FastMath.min(maxGrowth, FastMath.max(minReduction, safety * FastMath.pow(error, exp))); + final double scaledH = stepSize * factor; + final double nextT = stepStart + scaledH; + final boolean nextIsLast = forward ? (nextT >= t) : (nextT <= t); + hNew = filterStep(scaledH, forward, nextIsLast); + final double filteredNextT = stepStart + hNew; + final boolean filteredNextIsLast = forward ? (filteredNextT >= t) : (filteredNextT <= t); + if (filteredNextIsLast) { + hNew = t - stepStart; + } + } + } while (!isLastStep); + equations.setTime(stepStart); + equations.setCompleteState(y); + resetInternalState(); + } +"," public void integrate(final ExpandableStatefulODE equations, final double t) + throws MathIllegalStateException, MathIllegalArgumentException { + sanityChecks(equations, t); + setEquations(equations); + final boolean forward = t > equations.getTime(); + final double[] y0 = equations.getCompleteState(); + final double[] y = y0.clone(); + final int stages = c.length + 1; + final double[][] yDotK = new double[stages][y.length]; + final double[] yTmp = y0.clone(); + final double[] yDotTmp = new double[y.length]; + final RungeKuttaStepInterpolator interpolator = (RungeKuttaStepInterpolator) prototype.copy(); + interpolator.reinitialize(this, yTmp, yDotK, forward, + equations.getPrimaryMapper(), equations.getSecondaryMappers()); + interpolator.storeTime(equations.getTime()); + stepStart = equations.getTime(); + double hNew = 0; + boolean firstTime = true; + initIntegration(equations.getTime(), y0, t); + isLastStep = false; + do { + interpolator.shift(); + double error = 10; + while (error >= 1.0) { + if (firstTime || !fsal) { + computeDerivatives(stepStart, y, yDotK[0]); + } + if (firstTime) { + final double[] scale = new double[mainSetDimension]; + if (vecAbsoluteTolerance == null) { + for (int i = 0; i < scale.length; ++i) { + scale[i] = scalAbsoluteTolerance + scalRelativeTolerance * FastMath.abs(y[i]); + } + } else { + for (int i = 0; i < scale.length; ++i) { + scale[i] = vecAbsoluteTolerance[i] + vecRelativeTolerance[i] * FastMath.abs(y[i]); + } + } + hNew = initializeStep(forward, getOrder(), scale, + stepStart, y, yDotK[0], yTmp, yDotK[1]); + firstTime = false; + } + stepSize = hNew; + if (forward) { + if (stepStart + stepSize >= t) { + stepSize = t - stepStart; + } + } else { + if (stepStart + stepSize <= t) { + stepSize = t - stepStart; + } + } + for (int k = 1; k < stages; ++k) { + for (int j = 0; j < y0.length; ++j) { + double sum = a[k-1][0] * yDotK[0][j]; + for (int l = 1; l < k; ++l) { + sum += a[k-1][l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + computeDerivatives(stepStart + c[k-1] * stepSize, yTmp, yDotK[k]); + } + for (int j = 0; j < y0.length; ++j) { + double sum = b[0] * yDotK[0][j]; + for (int l = 1; l < stages; ++l) { + sum += b[l] * yDotK[l][j]; + } + yTmp[j] = y[j] + stepSize * sum; + } + error = estimateError(yDotK, y, yTmp, stepSize); + if (error >= 1.0) { + final double factor = + FastMath.min(maxGrowth, + FastMath.max(minReduction, safety * FastMath.pow(error, exp))); + hNew = filterStep(stepSize * factor, forward, false); + } + } + interpolator.storeTime(stepStart + stepSize); + System.arraycopy(yTmp, 0, y, 0, y0.length); + System.arraycopy(yDotK[stages - 1], 0, yDotTmp, 0, y0.length); + stepStart = acceptStep(interpolator, y, yDotTmp, t); + System.arraycopy(y, 0, yTmp, 0, y.length); + if (!isLastStep) { + interpolator.storeTime(stepStart); + if (fsal) { + System.arraycopy(yDotTmp, 0, yDotK[0], 0, y0.length); + } + final double factor = + FastMath.min(maxGrowth, FastMath.max(minReduction, safety * FastMath.pow(error, exp))); + final double scaledH = stepSize * factor; + final double nextT = stepStart + scaledH; + final boolean nextIsLast = forward ? (nextT >= t) : (nextT <= t); + hNew = filterStep(scaledH, forward, nextIsLast); + final double filteredNextT = stepStart + hNew; + final boolean filteredNextIsLast = forward ? (filteredNextT >= t) : (filteredNextT <= t); + if (filteredNextIsLast) { + hNew = t - stepStart; + } + } + } while (!isLastStep); + equations.setTime(stepStart); + equations.setCompleteState(y); + resetInternalState(); + } +" +JacksonDatabind-5," protected void _addMethodMixIns(Class targetClass, AnnotatedMethodMap methods, + Class mixInCls, AnnotatedMethodMap mixIns) + { + List> parents = new ArrayList>(); + parents.add(mixInCls); + ClassUtil.findSuperTypes(mixInCls, targetClass, parents); + for (Class mixin : parents) { + for (Method m : mixin.getDeclaredMethods()) { + if (!_isIncludableMemberMethod(m)) { + continue; + } + AnnotatedMethod am = methods.find(m); + if (am != null) { + _addMixUnders(m, am); + } else { + mixIns.add(_constructMethod(m)); + } + } + } + } +"," protected void _addMethodMixIns(Class targetClass, AnnotatedMethodMap methods, + Class mixInCls, AnnotatedMethodMap mixIns) + { + List> parents = new ArrayList>(); + parents.add(mixInCls); + ClassUtil.findSuperTypes(mixInCls, targetClass, parents); + for (Class mixin : parents) { + for (Method m : mixin.getDeclaredMethods()) { + if (!_isIncludableMemberMethod(m)) { + continue; + } + AnnotatedMethod am = methods.find(m); + if (am != null) { + _addMixUnders(m, am); + } else { + am = mixIns.find(m); + if (am != null) { + _addMixUnders(m, am); + } else { + mixIns.add(_constructMethod(m)); + } + } + } + } + } +" +Closure-69," private void visitCall(NodeTraversal t, Node n) { + Node child = n.getFirstChild(); + JSType childType = getJSType(child).restrictByNotNullOrUndefined(); + if (!childType.canBeCalled()) { + report(t, n, NOT_CALLABLE, childType.toString()); + ensureTyped(t, n); + return; + } + if (childType instanceof FunctionType) { + FunctionType functionType = (FunctionType) childType; + boolean isExtern = false; + JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); + if(functionJSDocInfo != null) { + String sourceName = functionJSDocInfo.getSourceName(); + CompilerInput functionSource = compiler.getInput(sourceName); + isExtern = functionSource.isExtern(); + } + if (functionType.isConstructor() && + !functionType.isNativeObjectType() && + (functionType.getReturnType().isUnknownType() || + functionType.getReturnType().isVoidType() || + !isExtern)) { + report(t, n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); + } + visitParameterList(t, n, functionType); + ensureTyped(t, n, functionType.getReturnType()); + } else { + ensureTyped(t, n); + } + } +"," private void visitCall(NodeTraversal t, Node n) { + Node child = n.getFirstChild(); + JSType childType = getJSType(child).restrictByNotNullOrUndefined(); + if (!childType.canBeCalled()) { + report(t, n, NOT_CALLABLE, childType.toString()); + ensureTyped(t, n); + return; + } + if (childType instanceof FunctionType) { + FunctionType functionType = (FunctionType) childType; + boolean isExtern = false; + JSDocInfo functionJSDocInfo = functionType.getJSDocInfo(); + if(functionJSDocInfo != null) { + String sourceName = functionJSDocInfo.getSourceName(); + CompilerInput functionSource = compiler.getInput(sourceName); + isExtern = functionSource.isExtern(); + } + if (functionType.isConstructor() && + !functionType.isNativeObjectType() && + (functionType.getReturnType().isUnknownType() || + functionType.getReturnType().isVoidType() || + !isExtern)) { + report(t, n, CONSTRUCTOR_NOT_CALLABLE, childType.toString()); + } + if (functionType.isOrdinaryFunction() && + !functionType.getTypeOfThis().isUnknownType() && + !functionType.getTypeOfThis().isNativeObjectType() && + !(child.getType() == Token.GETELEM || + child.getType() == Token.GETPROP)) { + report(t, n, EXPECTED_THIS_TYPE, functionType.toString()); + } + visitParameterList(t, n, functionType); + ensureTyped(t, n, functionType.getReturnType()); + } else { + ensureTyped(t, n); + } + } +" +Jsoup-27," static String getCharsetFromContentType(String contentType) { + if (contentType == null) return null; + Matcher m = charsetPattern.matcher(contentType); + if (m.find()) { + String charset = m.group(1).trim(); + charset = charset.toUpperCase(Locale.ENGLISH); + return charset; + } + return null; + } +"," static String getCharsetFromContentType(String contentType) { + if (contentType == null) return null; + Matcher m = charsetPattern.matcher(contentType); + if (m.find()) { + String charset = m.group(1).trim(); + if (Charset.isSupported(charset)) return charset; + charset = charset.toUpperCase(Locale.ENGLISH); + if (Charset.isSupported(charset)) return charset; + } + return null; + } +" +Gson-6," static TypeAdapter getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, + TypeToken fieldType, JsonAdapter annotation) { + Class value = annotation.value(); + TypeAdapter typeAdapter; + if (TypeAdapter.class.isAssignableFrom(value)) { + Class> typeAdapterClass = (Class>) value; + typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterClass)).construct(); + } else if (TypeAdapterFactory.class.isAssignableFrom(value)) { + Class typeAdapterFactory = (Class) value; + typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterFactory)) + .construct() + .create(gson, fieldType); + } else { + throw new IllegalArgumentException( + ""@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.""); + } + typeAdapter = typeAdapter.nullSafe(); + return typeAdapter; + } +"," static TypeAdapter getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, + TypeToken fieldType, JsonAdapter annotation) { + Class value = annotation.value(); + TypeAdapter typeAdapter; + if (TypeAdapter.class.isAssignableFrom(value)) { + Class> typeAdapterClass = (Class>) value; + typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterClass)).construct(); + } else if (TypeAdapterFactory.class.isAssignableFrom(value)) { + Class typeAdapterFactory = (Class) value; + typeAdapter = constructorConstructor.get(TypeToken.get(typeAdapterFactory)) + .construct() + .create(gson, fieldType); + } else { + throw new IllegalArgumentException( + ""@JsonAdapter value must be TypeAdapter or TypeAdapterFactory reference.""); + } + if (typeAdapter != null) { + typeAdapter = typeAdapter.nullSafe(); + } + return typeAdapter; + } +" +Lang-38," public StringBuffer format(Calendar calendar, StringBuffer buf) { + if (mTimeZoneForced) { + calendar = (Calendar) calendar.clone(); + calendar.setTimeZone(mTimeZone); + } + return applyRules(calendar, buf); + } +"," public StringBuffer format(Calendar calendar, StringBuffer buf) { + if (mTimeZoneForced) { + calendar.getTime(); + calendar = (Calendar) calendar.clone(); + calendar.setTimeZone(mTimeZone); + } + return applyRules(calendar, buf); + } +" +Mockito-38," private boolean toStringEquals(Matcher m, Object arg) { + return StringDescription.toString(m).equals(arg.toString()); + } +"," private boolean toStringEquals(Matcher m, Object arg) { + return StringDescription.toString(m).equals(arg == null? ""null"" : arg.toString()); + } +" +JacksonXml-4," protected void _serializeXmlNull(JsonGenerator jgen) throws IOException + { + if (jgen instanceof ToXmlGenerator) { + _initWithRootName((ToXmlGenerator) jgen, ROOT_NAME_FOR_NULL); + } + super.serializeValue(jgen, null); + } +"," protected void _serializeXmlNull(JsonGenerator jgen) throws IOException + { + QName rootName = _rootNameFromConfig(); + if (rootName == null) { + rootName = ROOT_NAME_FOR_NULL; + } + if (jgen instanceof ToXmlGenerator) { + _initWithRootName((ToXmlGenerator) jgen, rootName); + } + super.serializeValue(jgen, null); + } +" +JacksonDatabind-67," public KeyDeserializer createKeyDeserializer(DeserializationContext ctxt, + JavaType type) + throws JsonMappingException + { + final DeserializationConfig config = ctxt.getConfig(); + KeyDeserializer deser = null; + if (_factoryConfig.hasKeyDeserializers()) { + BeanDescription beanDesc = config.introspectClassAnnotations(type.getRawClass()); + for (KeyDeserializers d : _factoryConfig.keyDeserializers()) { + deser = d.findKeyDeserializer(type, config, beanDesc); + if (deser != null) { + break; + } + } + } + if (deser == null) { + if (type.isEnumType()) { + return _createEnumKeyDeserializer(ctxt, type); + } + deser = StdKeyDeserializers.findStringBasedKeyDeserializer(config, type); + } + if (deser != null) { + if (_factoryConfig.hasDeserializerModifiers()) { + for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { + deser = mod.modifyKeyDeserializer(config, type, deser); + } + } + } + return deser; + } +"," public KeyDeserializer createKeyDeserializer(DeserializationContext ctxt, + JavaType type) + throws JsonMappingException + { + final DeserializationConfig config = ctxt.getConfig(); + KeyDeserializer deser = null; + if (_factoryConfig.hasKeyDeserializers()) { + BeanDescription beanDesc = config.introspectClassAnnotations(type.getRawClass()); + for (KeyDeserializers d : _factoryConfig.keyDeserializers()) { + deser = d.findKeyDeserializer(type, config, beanDesc); + if (deser != null) { + break; + } + } + } + if (deser == null) { + if (type.isEnumType()) { + deser = _createEnumKeyDeserializer(ctxt, type); + } else { + deser = StdKeyDeserializers.findStringBasedKeyDeserializer(config, type); + } + } + if (deser != null) { + if (_factoryConfig.hasDeserializerModifiers()) { + for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) { + deser = mod.modifyKeyDeserializer(config, type, deser); + } + } + } + return deser; + } +" +Closure-13," private void traverse(Node node) { + if (!shouldVisit(node)) { + return; + } + int visits = 0; + do { + Node c = node.getFirstChild(); + while(c != null) { + traverse(c); + Node next = c.getNext(); + c = next; + } + visit(node); + visits++; + Preconditions.checkState(visits < 10000, ""too many interations""); + } while (shouldRetraverse(node)); + exitNode(node); + } +"," private void traverse(Node node) { + if (!shouldVisit(node)) { + return; + } + int visits = 0; + do { + Node c = node.getFirstChild(); + while(c != null) { + Node next = c.getNext(); + traverse(c); + c = next; + } + visit(node); + visits++; + Preconditions.checkState(visits < 10000, ""too many interations""); + } while (shouldRetraverse(node)); + exitNode(node); + } +" +Csv-5," public void println() throws IOException { + final String recordSeparator = format.getRecordSeparator(); + out.append(recordSeparator); + newRecord = true; + } +"," public void println() throws IOException { + final String recordSeparator = format.getRecordSeparator(); + if (recordSeparator != null) { + out.append(recordSeparator); + } + newRecord = true; + } +" +Csv-6," > M putIn(final M map) { + for (final Entry entry : mapping.entrySet()) { + final int col = entry.getValue().intValue(); + map.put(entry.getKey(), values[col]); + } + return map; + } +"," > M putIn(final M map) { + for (final Entry entry : mapping.entrySet()) { + final int col = entry.getValue().intValue(); + if (col < values.length) { + map.put(entry.getKey(), values[col]); + } + } + return map; + } +" +Chart-1," public LegendItemCollection getLegendItems() { + LegendItemCollection result = new LegendItemCollection(); + if (this.plot == null) { + return result; + } + int index = this.plot.getIndexOf(this); + CategoryDataset dataset = this.plot.getDataset(index); + if (dataset != null) { + return result; + } + int seriesCount = dataset.getRowCount(); + if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { + for (int i = 0; i < seriesCount; i++) { + if (isSeriesVisibleInLegend(i)) { + LegendItem item = getLegendItem(index, i); + if (item != null) { + result.add(item); + } + } + } + } + else { + for (int i = seriesCount - 1; i >= 0; i--) { + if (isSeriesVisibleInLegend(i)) { + LegendItem item = getLegendItem(index, i); + if (item != null) { + result.add(item); + } + } + } + } + return result; + } +"," public LegendItemCollection getLegendItems() { + LegendItemCollection result = new LegendItemCollection(); + if (this.plot == null) { + return result; + } + int index = this.plot.getIndexOf(this); + CategoryDataset dataset = this.plot.getDataset(index); + if (dataset == null) { + return result; + } + int seriesCount = dataset.getRowCount(); + if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { + for (int i = 0; i < seriesCount; i++) { + if (isSeriesVisibleInLegend(i)) { + LegendItem item = getLegendItem(index, i); + if (item != null) { + result.add(item); + } + } + } + } + else { + for (int i = seriesCount - 1; i >= 0; i--) { + if (isSeriesVisibleInLegend(i)) { + LegendItem item = getLegendItem(index, i); + if (item != null) { + result.add(item); + } + } + } + } + return result; + } +" +Math-97," public double solve(double min, double max) throws MaxIterationsExceededException, + FunctionEvaluationException { + clearResult(); + verifyInterval(min, max); + double ret = Double.NaN; + double yMin = f.value(min); + double yMax = f.value(max); + double sign = yMin * yMax; + if (sign >= 0) { + throw new IllegalArgumentException + (""Function values at endpoints do not have different signs."" + + "" Endpoints: ["" + min + "","" + max + ""]"" + + "" Values: ["" + yMin + "","" + yMax + ""]""); + } else { + ret = solve(min, yMin, max, yMax, min, yMin); + } + return ret; + } +"," public double solve(double min, double max) throws MaxIterationsExceededException, + FunctionEvaluationException { + clearResult(); + verifyInterval(min, max); + double ret = Double.NaN; + double yMin = f.value(min); + double yMax = f.value(max); + double sign = yMin * yMax; + if (sign > 0) { + if (Math.abs(yMin) <= functionValueAccuracy) { + setResult(min, 0); + ret = min; + } else if (Math.abs(yMax) <= functionValueAccuracy) { + setResult(max, 0); + ret = max; + } else { + throw new IllegalArgumentException + (""Function values at endpoints do not have different signs."" + + "" Endpoints: ["" + min + "","" + max + ""]"" + + "" Values: ["" + yMin + "","" + yMax + ""]""); + } + } else if (sign < 0){ + ret = solve(min, yMin, max, yMax, min, yMin); + } else { + if (yMin == 0.0) { + ret = min; + } else { + ret = max; + } + } + return ret; + } +" +Math-10," public void atan2(final double[] y, final int yOffset, + final double[] x, final int xOffset, + final double[] result, final int resultOffset) { + double[] tmp1 = new double[getSize()]; + multiply(x, xOffset, x, xOffset, tmp1, 0); + double[] tmp2 = new double[getSize()]; + multiply(y, yOffset, y, yOffset, tmp2, 0); + add(tmp1, 0, tmp2, 0, tmp2, 0); + rootN(tmp2, 0, 2, tmp1, 0); + if (x[xOffset] >= 0) { + add(tmp1, 0, x, xOffset, tmp2, 0); + divide(y, yOffset, tmp2, 0, tmp1, 0); + atan(tmp1, 0, tmp2, 0); + for (int i = 0; i < tmp2.length; ++i) { + result[resultOffset + i] = 2 * tmp2[i]; + } + } else { + subtract(tmp1, 0, x, xOffset, tmp2, 0); + divide(y, yOffset, tmp2, 0, tmp1, 0); + atan(tmp1, 0, tmp2, 0); + result[resultOffset] = + ((tmp2[0] <= 0) ? -FastMath.PI : FastMath.PI) - 2 * tmp2[0]; + for (int i = 1; i < tmp2.length; ++i) { + result[resultOffset + i] = -2 * tmp2[i]; + } + } + } +"," public void atan2(final double[] y, final int yOffset, + final double[] x, final int xOffset, + final double[] result, final int resultOffset) { + double[] tmp1 = new double[getSize()]; + multiply(x, xOffset, x, xOffset, tmp1, 0); + double[] tmp2 = new double[getSize()]; + multiply(y, yOffset, y, yOffset, tmp2, 0); + add(tmp1, 0, tmp2, 0, tmp2, 0); + rootN(tmp2, 0, 2, tmp1, 0); + if (x[xOffset] >= 0) { + add(tmp1, 0, x, xOffset, tmp2, 0); + divide(y, yOffset, tmp2, 0, tmp1, 0); + atan(tmp1, 0, tmp2, 0); + for (int i = 0; i < tmp2.length; ++i) { + result[resultOffset + i] = 2 * tmp2[i]; + } + } else { + subtract(tmp1, 0, x, xOffset, tmp2, 0); + divide(y, yOffset, tmp2, 0, tmp1, 0); + atan(tmp1, 0, tmp2, 0); + result[resultOffset] = + ((tmp2[0] <= 0) ? -FastMath.PI : FastMath.PI) - 2 * tmp2[0]; + for (int i = 1; i < tmp2.length; ++i) { + result[resultOffset + i] = -2 * tmp2[i]; + } + } + result[resultOffset] = FastMath.atan2(y[yOffset], x[xOffset]); + } +" +Cli-14," public void validate(final WriteableCommandLine commandLine) + throws OptionException { + int present = 0; + Option unexpected = null; + for (final Iterator i = options.iterator(); i.hasNext();) { + final Option option = (Option) i.next(); + boolean validate = option.isRequired() || option instanceof Group; + if (validate) { + option.validate(commandLine); + } + if (commandLine.hasOption(option)) { + if (++present > maximum) { + unexpected = option; + break; + } + option.validate(commandLine); + } + } + if (unexpected != null) { + throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, + unexpected.getPreferredName()); + } + if (present < minimum) { + throw new OptionException(this, ResourceConstants.MISSING_OPTION); + } + for (final Iterator i = anonymous.iterator(); i.hasNext();) { + final Option option = (Option) i.next(); + option.validate(commandLine); + } + } +"," public void validate(final WriteableCommandLine commandLine) + throws OptionException { + int present = 0; + Option unexpected = null; + for (final Iterator i = options.iterator(); i.hasNext();) { + final Option option = (Option) i.next(); + boolean validate = option.isRequired() || option instanceof Group; + if (commandLine.hasOption(option)) { + if (++present > maximum) { + unexpected = option; + break; + } + validate = true; + } + if (validate) { + option.validate(commandLine); + } + } + if (unexpected != null) { + throw new OptionException(this, ResourceConstants.UNEXPECTED_TOKEN, + unexpected.getPreferredName()); + } + if (present < minimum) { + throw new OptionException(this, ResourceConstants.MISSING_OPTION); + } + for (final Iterator i = anonymous.iterator(); i.hasNext();) { + final Option option = (Option) i.next(); + option.validate(commandLine); + } + } +" +JxPath-21," public int getLength() { + return ValueUtils.getLength(getBaseValue()); + } +"," public int getLength() { + Object baseValue = getBaseValue(); + return baseValue == null ? 1 : ValueUtils.getLength(baseValue); + } +" +Jsoup-72," private static String cacheString(final char[] charBuf, final String[] stringCache, final int start, final int count) { + if (count > maxStringCacheLen) + return new String(charBuf, start, count); + int hash = 0; + int offset = start; + for (int i = 0; i < count; i++) { + hash = 31 * hash + charBuf[offset++]; + } + final int index = hash & stringCache.length - 1; + String cached = stringCache[index]; + if (cached == null) { + cached = new String(charBuf, start, count); + stringCache[index] = cached; + } else { + if (rangeEquals(charBuf, start, count, cached)) { + return cached; + } else { + cached = new String(charBuf, start, count); + stringCache[index] = cached; + } + } + return cached; + } +"," private static String cacheString(final char[] charBuf, final String[] stringCache, final int start, final int count) { + if (count > maxStringCacheLen) + return new String(charBuf, start, count); + if (count < 1) + return """"; + int hash = 0; + int offset = start; + for (int i = 0; i < count; i++) { + hash = 31 * hash + charBuf[offset++]; + } + final int index = hash & stringCache.length - 1; + String cached = stringCache[index]; + if (cached == null) { + cached = new String(charBuf, start, count); + stringCache[index] = cached; + } else { + if (rangeEquals(charBuf, start, count, cached)) { + return cached; + } else { + cached = new String(charBuf, start, count); + stringCache[index] = cached; + } + } + return cached; + } +" +Closure-48," void maybeDeclareQualifiedName(NodeTraversal t, JSDocInfo info, + Node n, Node parent, Node rhsValue) { + Node ownerNode = n.getFirstChild(); + String ownerName = ownerNode.getQualifiedName(); + String qName = n.getQualifiedName(); + String propName = n.getLastChild().getString(); + Preconditions.checkArgument(qName != null && ownerName != null); + JSType valueType = getDeclaredType(t.getSourceName(), info, n, rhsValue); + if (valueType == null && rhsValue != null) { + valueType = rhsValue.getJSType(); + } + if (""prototype"".equals(propName)) { + Var qVar = scope.getVar(qName); + if (qVar != null) { + ObjectType qVarType = ObjectType.cast(qVar.getType()); + if (qVarType != null && + rhsValue != null && + rhsValue.isObjectLit()) { + typeRegistry.resetImplicitPrototype( + rhsValue.getJSType(), qVarType.getImplicitPrototype()); + } else if (!qVar.isTypeInferred()) { + return; + } + if (qVar.getScope() == scope) { + scope.undeclare(qVar); + } + } + } + if (valueType == null) { + if (parent.isExprResult()) { + stubDeclarations.add(new StubDeclaration( + n, + t.getInput() != null && t.getInput().isExtern(), + ownerName)); + } + return; + } + boolean inferred = true; + if (info != null) { + inferred = !(info.hasType() + || info.hasEnumParameterType() + || (info.isConstant() && valueType != null + && !valueType.isUnknownType()) + || FunctionTypeBuilder.isFunctionTypeDeclaration(info)); + } + if (inferred) { + inferred = !(rhsValue != null && + rhsValue.isFunction() && + (info != null || !scope.isDeclared(qName, false))); + } + if (!inferred) { + ObjectType ownerType = getObjectSlot(ownerName); + if (ownerType != null) { + boolean isExtern = t.getInput() != null && t.getInput().isExtern(); + if ((!ownerType.hasOwnProperty(propName) || + ownerType.isPropertyTypeInferred(propName)) && + ((isExtern && !ownerType.isNativeObjectType()) || + !ownerType.isInstanceType())) { + ownerType.defineDeclaredProperty(propName, valueType, n); + } + } + defineSlot(n, parent, valueType, inferred); + } else if (rhsValue != null && rhsValue.isTrue()) { + FunctionType ownerType = + JSType.toMaybeFunctionType(getObjectSlot(ownerName)); + if (ownerType != null) { + JSType ownerTypeOfThis = ownerType.getTypeOfThis(); + String delegateName = codingConvention.getDelegateSuperclassName(); + JSType delegateType = delegateName == null ? + null : typeRegistry.getType(delegateName); + if (delegateType != null && + ownerTypeOfThis.isSubtype(delegateType)) { + defineSlot(n, parent, getNativeType(BOOLEAN_TYPE), true); + } + } + } + } +"," void maybeDeclareQualifiedName(NodeTraversal t, JSDocInfo info, + Node n, Node parent, Node rhsValue) { + Node ownerNode = n.getFirstChild(); + String ownerName = ownerNode.getQualifiedName(); + String qName = n.getQualifiedName(); + String propName = n.getLastChild().getString(); + Preconditions.checkArgument(qName != null && ownerName != null); + JSType valueType = getDeclaredType(t.getSourceName(), info, n, rhsValue); + if (valueType == null && rhsValue != null) { + valueType = rhsValue.getJSType(); + } + if (""prototype"".equals(propName)) { + Var qVar = scope.getVar(qName); + if (qVar != null) { + ObjectType qVarType = ObjectType.cast(qVar.getType()); + if (qVarType != null && + rhsValue != null && + rhsValue.isObjectLit()) { + typeRegistry.resetImplicitPrototype( + rhsValue.getJSType(), qVarType.getImplicitPrototype()); + } else if (!qVar.isTypeInferred()) { + return; + } + if (qVar.getScope() == scope) { + scope.undeclare(qVar); + } + } + } + if (valueType == null) { + if (parent.isExprResult()) { + stubDeclarations.add(new StubDeclaration( + n, + t.getInput() != null && t.getInput().isExtern(), + ownerName)); + } + return; + } + boolean inferred = true; + if (info != null) { + inferred = !(info.hasType() + || info.hasEnumParameterType() + || (info.isConstant() && valueType != null + && !valueType.isUnknownType()) + || FunctionTypeBuilder.isFunctionTypeDeclaration(info)); + } + if (inferred && rhsValue != null && rhsValue.isFunction()) { + if (info != null) { + inferred = false; + } else if (!scope.isDeclared(qName, false) && + n.isUnscopedQualifiedName()) { + inferred = false; + } + } + if (!inferred) { + ObjectType ownerType = getObjectSlot(ownerName); + if (ownerType != null) { + boolean isExtern = t.getInput() != null && t.getInput().isExtern(); + if ((!ownerType.hasOwnProperty(propName) || + ownerType.isPropertyTypeInferred(propName)) && + ((isExtern && !ownerType.isNativeObjectType()) || + !ownerType.isInstanceType())) { + ownerType.defineDeclaredProperty(propName, valueType, n); + } + } + defineSlot(n, parent, valueType, inferred); + } else if (rhsValue != null && rhsValue.isTrue()) { + FunctionType ownerType = + JSType.toMaybeFunctionType(getObjectSlot(ownerName)); + if (ownerType != null) { + JSType ownerTypeOfThis = ownerType.getTypeOfThis(); + String delegateName = codingConvention.getDelegateSuperclassName(); + JSType delegateType = delegateName == null ? + null : typeRegistry.getType(delegateName); + if (delegateType != null && + ownerTypeOfThis.isSubtype(delegateType)) { + defineSlot(n, parent, getNativeType(BOOLEAN_TYPE), true); + } + } + } + } +" +JacksonDatabind-54," protected BeanPropertyWriter buildWriter(SerializerProvider prov, + BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer ser, + TypeSerializer typeSer, TypeSerializer contentTypeSer, + AnnotatedMember am, boolean defaultUseStaticTyping) + throws JsonMappingException + { + JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); + if (contentTypeSer != null) { + if (serializationType == null) { + serializationType = declaredType; + } + JavaType ct = serializationType.getContentType(); + if (ct == null) { + throw new IllegalStateException(""Problem trying to create BeanPropertyWriter for property '"" + +propDef.getName()+""' (of type ""+_beanDesc.getType()+""); serialization type ""+serializationType+"" has no content""); + } + serializationType = serializationType.withContentTypeHandler(contentTypeSer); + ct = serializationType.getContentType(); + } + Object valueToSuppress = null; + boolean suppressNulls = false; + JsonInclude.Value inclV = _defaultInclusion.withOverrides(propDef.findInclusion()); + JsonInclude.Include inclusion = inclV.getValueInclusion(); + if (inclusion == JsonInclude.Include.USE_DEFAULTS) { + inclusion = JsonInclude.Include.ALWAYS; + } + JavaType actualType = (serializationType == null) ? declaredType : serializationType; + switch (inclusion) { + case NON_DEFAULT: + if (_defaultInclusion.getValueInclusion() == JsonInclude.Include.NON_DEFAULT) { + valueToSuppress = getPropertyDefaultValue(propDef.getName(), am, actualType); + } else { + valueToSuppress = getDefaultValue(actualType); + } + if (valueToSuppress == null) { + suppressNulls = true; + } else { + if (valueToSuppress.getClass().isArray()) { + valueToSuppress = ArrayBuilders.getArrayComparator(valueToSuppress); + } + } + break; + case NON_ABSENT: + suppressNulls = true; + if (declaredType.isReferenceType()) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + case NON_EMPTY: + suppressNulls = true; + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + break; + case NON_NULL: + suppressNulls = true; + case ALWAYS: + default: + if (declaredType.isContainerType() + && !_config.isEnabled(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS)) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + } + BeanPropertyWriter bpw = new BeanPropertyWriter(propDef, + am, _beanDesc.getClassAnnotations(), declaredType, + ser, typeSer, serializationType, suppressNulls, valueToSuppress); + Object serDef = _annotationIntrospector.findNullSerializer(am); + if (serDef != null) { + bpw.assignNullSerializer(prov.serializerInstance(am, serDef)); + } + NameTransformer unwrapper = _annotationIntrospector.findUnwrappingNameTransformer(am); + if (unwrapper != null) { + bpw = bpw.unwrappingWriter(unwrapper); + } + return bpw; + } +"," protected BeanPropertyWriter buildWriter(SerializerProvider prov, + BeanPropertyDefinition propDef, JavaType declaredType, JsonSerializer ser, + TypeSerializer typeSer, TypeSerializer contentTypeSer, + AnnotatedMember am, boolean defaultUseStaticTyping) + throws JsonMappingException + { + JavaType serializationType = findSerializationType(am, defaultUseStaticTyping, declaredType); + if (contentTypeSer != null) { + if (serializationType == null) { + serializationType = declaredType; + } + JavaType ct = serializationType.getContentType(); + if (ct == null) { + throw new IllegalStateException(""Problem trying to create BeanPropertyWriter for property '"" + +propDef.getName()+""' (of type ""+_beanDesc.getType()+""); serialization type ""+serializationType+"" has no content""); + } + serializationType = serializationType.withContentTypeHandler(contentTypeSer); + ct = serializationType.getContentType(); + } + Object valueToSuppress = null; + boolean suppressNulls = false; + JsonInclude.Value inclV = _defaultInclusion.withOverrides(propDef.findInclusion()); + JsonInclude.Include inclusion = inclV.getValueInclusion(); + if (inclusion == JsonInclude.Include.USE_DEFAULTS) { + inclusion = JsonInclude.Include.ALWAYS; + } + JavaType actualType = (serializationType == null) ? declaredType : serializationType; + switch (inclusion) { + case NON_DEFAULT: + if (_defaultInclusion.getValueInclusion() == JsonInclude.Include.NON_DEFAULT) { + valueToSuppress = getPropertyDefaultValue(propDef.getName(), am, actualType); + } else { + valueToSuppress = getDefaultValue(actualType); + } + if (valueToSuppress == null) { + suppressNulls = true; + } else { + if (valueToSuppress.getClass().isArray()) { + valueToSuppress = ArrayBuilders.getArrayComparator(valueToSuppress); + } + } + break; + case NON_ABSENT: + suppressNulls = true; + if (actualType.isReferenceType()) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + case NON_EMPTY: + suppressNulls = true; + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + break; + case NON_NULL: + suppressNulls = true; + case ALWAYS: + default: + if (actualType.isContainerType() + && !_config.isEnabled(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS)) { + valueToSuppress = BeanPropertyWriter.MARKER_FOR_EMPTY; + } + break; + } + BeanPropertyWriter bpw = new BeanPropertyWriter(propDef, + am, _beanDesc.getClassAnnotations(), declaredType, + ser, typeSer, serializationType, suppressNulls, valueToSuppress); + Object serDef = _annotationIntrospector.findNullSerializer(am); + if (serDef != null) { + bpw.assignNullSerializer(prov.serializerInstance(am, serDef)); + } + NameTransformer unwrapper = _annotationIntrospector.findUnwrappingNameTransformer(am); + if (unwrapper != null) { + bpw = bpw.unwrappingWriter(unwrapper); + } + return bpw; + } +" +Lang-9," private void init() { + thisYear= Calendar.getInstance(timeZone, locale).get(Calendar.YEAR); + nameValues= new ConcurrentHashMap(); + StringBuilder regex= new StringBuilder(); + List collector = new ArrayList(); + Matcher patternMatcher= formatPattern.matcher(pattern); + if(!patternMatcher.lookingAt()) { + throw new IllegalArgumentException(""Invalid pattern""); + } + currentFormatField= patternMatcher.group(); + Strategy currentStrategy= getStrategy(currentFormatField); + for(;;) { + patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd()); + if(!patternMatcher.lookingAt()) { + nextStrategy = null; + break; + } + String nextFormatField= patternMatcher.group(); + nextStrategy = getStrategy(nextFormatField); + if(currentStrategy.addRegex(this, regex)) { + collector.add(currentStrategy); + } + currentFormatField= nextFormatField; + currentStrategy= nextStrategy; + } + if(currentStrategy.addRegex(this, regex)) { + collector.add(currentStrategy); + } + currentFormatField= null; + strategies= collector.toArray(new Strategy[collector.size()]); + parsePattern= Pattern.compile(regex.toString()); + } +"," private void init() { + thisYear= Calendar.getInstance(timeZone, locale).get(Calendar.YEAR); + nameValues= new ConcurrentHashMap(); + StringBuilder regex= new StringBuilder(); + List collector = new ArrayList(); + Matcher patternMatcher= formatPattern.matcher(pattern); + if(!patternMatcher.lookingAt()) { + throw new IllegalArgumentException(""Invalid pattern""); + } + currentFormatField= patternMatcher.group(); + Strategy currentStrategy= getStrategy(currentFormatField); + for(;;) { + patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd()); + if(!patternMatcher.lookingAt()) { + nextStrategy = null; + break; + } + String nextFormatField= patternMatcher.group(); + nextStrategy = getStrategy(nextFormatField); + if(currentStrategy.addRegex(this, regex)) { + collector.add(currentStrategy); + } + currentFormatField= nextFormatField; + currentStrategy= nextStrategy; + } + if (patternMatcher.regionStart() != patternMatcher.regionEnd()) { + throw new IllegalArgumentException(""Failed to parse \""""+pattern+""\"" ; gave up at index ""+patternMatcher.regionStart()); + } + if(currentStrategy.addRegex(this, regex)) { + collector.add(currentStrategy); + } + currentFormatField= null; + strategies= collector.toArray(new Strategy[collector.size()]); + parsePattern= Pattern.compile(regex.toString()); + } +" +Lang-54," public static Locale toLocale(String str) { + if (str == null) { + return null; + } + int len = str.length(); + if (len != 2 && len != 5 && len < 7) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + char ch0 = str.charAt(0); + char ch1 = str.charAt(1); + if (ch0 < 'a' || ch0 > 'z' || ch1 < 'a' || ch1 > 'z') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 2) { + return new Locale(str, """"); + } else { + if (str.charAt(2) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + char ch3 = str.charAt(3); + char ch4 = str.charAt(4); + if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 5) { + return new Locale(str.substring(0, 2), str.substring(3, 5)); + } else { + if (str.charAt(5) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6)); + } + } + } +"," public static Locale toLocale(String str) { + if (str == null) { + return null; + } + int len = str.length(); + if (len != 2 && len != 5 && len < 7) { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + char ch0 = str.charAt(0); + char ch1 = str.charAt(1); + if (ch0 < 'a' || ch0 > 'z' || ch1 < 'a' || ch1 > 'z') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 2) { + return new Locale(str, """"); + } else { + if (str.charAt(2) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + char ch3 = str.charAt(3); + if (ch3 == '_') { + return new Locale(str.substring(0, 2), """", str.substring(4)); + } + char ch4 = str.charAt(4); + if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + if (len == 5) { + return new Locale(str.substring(0, 2), str.substring(3, 5)); + } else { + if (str.charAt(5) != '_') { + throw new IllegalArgumentException(""Invalid locale format: "" + str); + } + return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6)); + } + } + } +" +JacksonDatabind-9," public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + String str; + if (value instanceof Date) { + provider.defaultSerializeDateKey((Date) value, jgen); + return; + } else { + str = value.toString(); + } + jgen.writeFieldName(str); + } +"," public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + String str; + Class cls = value.getClass(); + if (cls == String.class) { + str = (String) value; + } else if (Date.class.isAssignableFrom(cls)) { + provider.defaultSerializeDateKey((Date) value, jgen); + return; + } else if (cls == Class.class) { + str = ((Class) value).getName(); + } else { + str = value.toString(); + } + jgen.writeFieldName(str); + } +" +Closure-107," protected CompilerOptions createOptions() { + CompilerOptions options = new CompilerOptions(); + if (flags.processJqueryPrimitives) { + options.setCodingConvention(new JqueryCodingConvention()); + } else { + options.setCodingConvention(new ClosureCodingConvention()); + } + options.setExtraAnnotationNames(flags.extraAnnotationName); + CompilationLevel level = flags.compilationLevel; + level.setOptionsForCompilationLevel(options); + if (flags.debug) { + level.setDebugOptionsForCompilationLevel(options); + } + if (flags.useTypesForOptimization) { + level.setTypeBasedOptimizationOptions(options); + } + if (flags.generateExports) { + options.setGenerateExports(flags.generateExports); + } + WarningLevel wLevel = flags.warningLevel; + wLevel.setOptionsForWarningLevel(options); + for (FormattingOption formattingOption : flags.formatting) { + formattingOption.applyToOptions(options); + } + options.closurePass = flags.processClosurePrimitives; + options.jqueryPass = CompilationLevel.ADVANCED_OPTIMIZATIONS == level && + flags.processJqueryPrimitives; + options.angularPass = flags.angularPass; + if (!flags.translationsFile.isEmpty()) { + try { + options.messageBundle = new XtbMessageBundle( + new FileInputStream(flags.translationsFile), + flags.translationsProject); + } catch (IOException e) { + throw new RuntimeException(""Reading XTB file"", e); + } + } else if (CompilationLevel.ADVANCED_OPTIMIZATIONS == level) { + options.messageBundle = new EmptyMessageBundle(); + } + return options; + } +"," protected CompilerOptions createOptions() { + CompilerOptions options = new CompilerOptions(); + if (flags.processJqueryPrimitives) { + options.setCodingConvention(new JqueryCodingConvention()); + } else { + options.setCodingConvention(new ClosureCodingConvention()); + } + options.setExtraAnnotationNames(flags.extraAnnotationName); + CompilationLevel level = flags.compilationLevel; + level.setOptionsForCompilationLevel(options); + if (flags.debug) { + level.setDebugOptionsForCompilationLevel(options); + } + if (flags.useTypesForOptimization) { + level.setTypeBasedOptimizationOptions(options); + } + if (flags.generateExports) { + options.setGenerateExports(flags.generateExports); + } + WarningLevel wLevel = flags.warningLevel; + wLevel.setOptionsForWarningLevel(options); + for (FormattingOption formattingOption : flags.formatting) { + formattingOption.applyToOptions(options); + } + options.closurePass = flags.processClosurePrimitives; + options.jqueryPass = CompilationLevel.ADVANCED_OPTIMIZATIONS == level && + flags.processJqueryPrimitives; + options.angularPass = flags.angularPass; + if (!flags.translationsFile.isEmpty()) { + try { + options.messageBundle = new XtbMessageBundle( + new FileInputStream(flags.translationsFile), + flags.translationsProject); + } catch (IOException e) { + throw new RuntimeException(""Reading XTB file"", e); + } + } else if (CompilationLevel.ADVANCED_OPTIMIZATIONS == level) { + options.messageBundle = new EmptyMessageBundle(); + options.setWarningLevel(JsMessageVisitor.MSG_CONVENTIONS, CheckLevel.OFF); + } + return options; + } +" +Closure-1," private void removeUnreferencedFunctionArgs(Scope fnScope) { + Node function = fnScope.getRootNode(); + Preconditions.checkState(function.isFunction()); + if (NodeUtil.isGetOrSetKey(function.getParent())) { + return; + } + Node argList = getFunctionArgList(function); + boolean modifyCallers = modifyCallSites + && callSiteOptimizer.canModifyCallers(function); + if (!modifyCallers) { + Node lastArg; + while ((lastArg = argList.getLastChild()) != null) { + Var var = fnScope.getVar(lastArg.getString()); + if (!referenced.contains(var)) { + argList.removeChild(lastArg); + compiler.reportCodeChange(); + } else { + break; + } + } + } else { + callSiteOptimizer.optimize(fnScope, referenced); + } + } +"," private void removeUnreferencedFunctionArgs(Scope fnScope) { + if (!removeGlobals) { + return; + } + Node function = fnScope.getRootNode(); + Preconditions.checkState(function.isFunction()); + if (NodeUtil.isGetOrSetKey(function.getParent())) { + return; + } + Node argList = getFunctionArgList(function); + boolean modifyCallers = modifyCallSites + && callSiteOptimizer.canModifyCallers(function); + if (!modifyCallers) { + Node lastArg; + while ((lastArg = argList.getLastChild()) != null) { + Var var = fnScope.getVar(lastArg.getString()); + if (!referenced.contains(var)) { + argList.removeChild(lastArg); + compiler.reportCodeChange(); + } else { + break; + } + } + } else { + callSiteOptimizer.optimize(fnScope, referenced); + } + } +" +Closure-120," boolean isAssignedOnceInLifetime() { + Reference ref = getOneAndOnlyAssignment(); + if (ref == null) { + return false; + } + for (BasicBlock block = ref.getBasicBlock(); + block != null; block = block.getParent()) { + if (block.isFunction) { + break; + } else if (block.isLoop) { + return false; + } + } + return true; + } +"," boolean isAssignedOnceInLifetime() { + Reference ref = getOneAndOnlyAssignment(); + if (ref == null) { + return false; + } + for (BasicBlock block = ref.getBasicBlock(); + block != null; block = block.getParent()) { + if (block.isFunction) { + if (ref.getSymbol().getScope() != ref.scope) { + return false; + } + break; + } else if (block.isLoop) { + return false; + } + } + return true; + } +" +Compress-28," public int read(byte[] buf, int offset, int numToRead) throws IOException { + int totalRead = 0; + if (hasHitEOF || entryOffset >= entrySize) { + return -1; + } + if (currEntry == null) { + throw new IllegalStateException(""No current tar entry""); + } + numToRead = Math.min(numToRead, available()); + totalRead = is.read(buf, offset, numToRead); + count(totalRead); + if (totalRead == -1) { + hasHitEOF = true; + } else { + entryOffset += totalRead; + } + return totalRead; + } +"," public int read(byte[] buf, int offset, int numToRead) throws IOException { + int totalRead = 0; + if (hasHitEOF || entryOffset >= entrySize) { + return -1; + } + if (currEntry == null) { + throw new IllegalStateException(""No current tar entry""); + } + numToRead = Math.min(numToRead, available()); + totalRead = is.read(buf, offset, numToRead); + if (totalRead == -1) { + if (numToRead > 0) { + throw new IOException(""Truncated TAR archive""); + } + hasHitEOF = true; + } else { + count(totalRead); + entryOffset += totalRead; + } + return totalRead; + } +" +Math-102," public double chiSquare(double[] expected, long[] observed) + throws IllegalArgumentException { + if ((expected.length < 2) || (expected.length != observed.length)) { + throw new IllegalArgumentException( + ""observed, expected array lengths incorrect""); + } + if (!isPositive(expected) || !isNonNegative(observed)) { + throw new IllegalArgumentException( + ""observed counts must be non-negative and expected counts must be postive""); + } + double sumSq = 0.0d; + double dev = 0.0d; + for (int i = 0; i < observed.length; i++) { + dev = ((double) observed[i] - expected[i]); + sumSq += dev * dev / expected[i]; + } + return sumSq; + } +"," public double chiSquare(double[] expected, long[] observed) + throws IllegalArgumentException { + if ((expected.length < 2) || (expected.length != observed.length)) { + throw new IllegalArgumentException( + ""observed, expected array lengths incorrect""); + } + if (!isPositive(expected) || !isNonNegative(observed)) { + throw new IllegalArgumentException( + ""observed counts must be non-negative and expected counts must be postive""); + } + double sumExpected = 0d; + double sumObserved = 0d; + for (int i = 0; i < observed.length; i++) { + sumExpected += expected[i]; + sumObserved += observed[i]; + } + double ratio = 1.0d; + boolean rescale = false; + if (Math.abs(sumExpected - sumObserved) > 10E-6) { + ratio = sumObserved / sumExpected; + rescale = true; + } + double sumSq = 0.0d; + double dev = 0.0d; + for (int i = 0; i < observed.length; i++) { + if (rescale) { + dev = ((double) observed[i] - ratio * expected[i]); + sumSq += dev * dev / (ratio * expected[i]); + } else { + dev = ((double) observed[i] - expected[i]); + sumSq += dev * dev / expected[i]; + } + } + return sumSq; + } +" +Closure-82," public final boolean isEmptyType() { + return isNoType() || isNoObjectType() || isNoResolvedType(); + } +"," public final boolean isEmptyType() { + return isNoType() || isNoObjectType() || isNoResolvedType() || + (registry.getNativeFunctionType( + JSTypeNative.LEAST_FUNCTION_TYPE) == this); + } +" +Lang-42," public void escape(Writer writer, String str) throws IOException { + int len = str.length(); + for (int i = 0; i < len; i++) { + char c = str.charAt(i); + String entityName = this.entityName(c); + if (entityName == null) { + if (c > 0x7F) { + writer.write(""&#""); + writer.write(Integer.toString(c, 10)); + writer.write(';'); + } else { + writer.write(c); + } + } else { + writer.write('&'); + writer.write(entityName); + writer.write(';'); + } + } + } +"," public void escape(Writer writer, String str) throws IOException { + int len = str.length(); + for (int i = 0; i < len; i++) { + int c = Character.codePointAt(str, i); + String entityName = this.entityName(c); + if (entityName == null) { + if (c >= 0x010000 && i < len - 1) { + writer.write(""&#""); + writer.write(Integer.toString(c, 10)); + writer.write(';'); + i++; + } else if (c > 0x7F) { + writer.write(""&#""); + writer.write(Integer.toString(c, 10)); + writer.write(';'); + } else { + writer.write(c); + } + } else { + writer.write('&'); + writer.write(entityName); + writer.write(';'); + } + } + } +" +Lang-61," public int indexOf(String str, int startIndex) { + startIndex = (startIndex < 0 ? 0 : startIndex); + if (str == null || startIndex >= size) { + return -1; + } + int strLen = str.length(); + if (strLen == 1) { + return indexOf(str.charAt(0), startIndex); + } + if (strLen == 0) { + return startIndex; + } + if (strLen > size) { + return -1; + } + char[] thisBuf = buffer; + int len = thisBuf.length - strLen; + outer: + for (int i = startIndex; i < len; i++) { + for (int j = 0; j < strLen; j++) { + if (str.charAt(j) != thisBuf[i + j]) { + continue outer; + } + } + return i; + } + return -1; + } +"," public int indexOf(String str, int startIndex) { + startIndex = (startIndex < 0 ? 0 : startIndex); + if (str == null || startIndex >= size) { + return -1; + } + int strLen = str.length(); + if (strLen == 1) { + return indexOf(str.charAt(0), startIndex); + } + if (strLen == 0) { + return startIndex; + } + if (strLen > size) { + return -1; + } + char[] thisBuf = buffer; + int len = size - strLen + 1; + outer: + for (int i = startIndex; i < len; i++) { + for (int j = 0; j < strLen; j++) { + if (str.charAt(j) != thisBuf[i + j]) { + continue outer; + } + } + return i; + } + return -1; + } +" +Closure-33," public void matchConstraint(ObjectType constraintObj) { + if (constraintObj.isRecordType()) { + for (String prop : constraintObj.getOwnPropertyNames()) { + JSType propType = constraintObj.getPropertyType(prop); + if (!isPropertyTypeDeclared(prop)) { + JSType typeToInfer = propType; + if (!hasProperty(prop)) { + typeToInfer = getNativeType(JSTypeNative.VOID_TYPE) + .getLeastSupertype(propType); + } + defineInferredProperty(prop, typeToInfer, null); + } + } + } + } +"," public void matchConstraint(ObjectType constraintObj) { + if (hasReferenceName()) { + return; + } + if (constraintObj.isRecordType()) { + for (String prop : constraintObj.getOwnPropertyNames()) { + JSType propType = constraintObj.getPropertyType(prop); + if (!isPropertyTypeDeclared(prop)) { + JSType typeToInfer = propType; + if (!hasProperty(prop)) { + typeToInfer = getNativeType(JSTypeNative.VOID_TYPE) + .getLeastSupertype(propType); + } + defineInferredProperty(prop, typeToInfer, null); + } + } + } + } +" +JacksonDatabind-102," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + if (property == null) { + return this; + } + JsonFormat.Value format = findFormatOverrides(serializers, property, handledType()); + if (format == null) { + return this; + } + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if (format.hasPattern()) { + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(format.getPattern(), loc); + TimeZone tz = format.hasTimeZone() ? format.getTimeZone() + : serializers.getTimeZone(); + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + final boolean hasLocale = format.hasLocale(); + final boolean hasTZ = format.hasTimeZone(); + final boolean asString = (shape == JsonFormat.Shape.STRING); + if (!hasLocale && !hasTZ && !asString) { + return this; + } + DateFormat df0 = serializers.getConfig().getDateFormat(); + if (df0 instanceof StdDateFormat) { + StdDateFormat std = (StdDateFormat) df0; + if (format.hasLocale()) { + std = std.withLocale(format.getLocale()); + } + if (format.hasTimeZone()) { + std = std.withTimeZone(format.getTimeZone()); + } + return withFormat(Boolean.FALSE, std); + } + if (!(df0 instanceof SimpleDateFormat)) { + serializers.reportBadDefinition(handledType(), String.format( +""Configured `DateFormat` (%s) not a `SimpleDateFormat`; cannot configure `Locale` or `TimeZone`"", +df0.getClass().getName())); + } + SimpleDateFormat df = (SimpleDateFormat) df0; + if (hasLocale) { + df = new SimpleDateFormat(df.toPattern(), format.getLocale()); + } else { + df = (SimpleDateFormat) df.clone(); + } + TimeZone newTz = format.getTimeZone(); + boolean changeTZ = (newTz != null) && !newTz.equals(df.getTimeZone()); + if (changeTZ) { + df.setTimeZone(newTz); + } + return withFormat(Boolean.FALSE, df); + } +"," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + JsonFormat.Value format = findFormatOverrides(serializers, property, handledType()); + if (format == null) { + return this; + } + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if (format.hasPattern()) { + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(format.getPattern(), loc); + TimeZone tz = format.hasTimeZone() ? format.getTimeZone() + : serializers.getTimeZone(); + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + final boolean hasLocale = format.hasLocale(); + final boolean hasTZ = format.hasTimeZone(); + final boolean asString = (shape == JsonFormat.Shape.STRING); + if (!hasLocale && !hasTZ && !asString) { + return this; + } + DateFormat df0 = serializers.getConfig().getDateFormat(); + if (df0 instanceof StdDateFormat) { + StdDateFormat std = (StdDateFormat) df0; + if (format.hasLocale()) { + std = std.withLocale(format.getLocale()); + } + if (format.hasTimeZone()) { + std = std.withTimeZone(format.getTimeZone()); + } + return withFormat(Boolean.FALSE, std); + } + if (!(df0 instanceof SimpleDateFormat)) { + serializers.reportBadDefinition(handledType(), String.format( +""Configured `DateFormat` (%s) not a `SimpleDateFormat`; cannot configure `Locale` or `TimeZone`"", +df0.getClass().getName())); + } + SimpleDateFormat df = (SimpleDateFormat) df0; + if (hasLocale) { + df = new SimpleDateFormat(df.toPattern(), format.getLocale()); + } else { + df = (SimpleDateFormat) df.clone(); + } + TimeZone newTz = format.getTimeZone(); + boolean changeTZ = (newTz != null) && !newTz.equals(df.getTimeZone()); + if (changeTZ) { + df.setTimeZone(newTz); + } + return withFormat(Boolean.FALSE, df); + } +" +Compress-36," private InputStream getCurrentStream() throws IOException { + if (deferredBlockStreams.isEmpty()) { + throw new IllegalStateException(""No current 7z entry (call getNextEntry() first).""); + } + while (deferredBlockStreams.size() > 1) { + final InputStream stream = deferredBlockStreams.remove(0); + IOUtils.skip(stream, Long.MAX_VALUE); + stream.close(); + } + return deferredBlockStreams.get(0); + } +"," private InputStream getCurrentStream() throws IOException { + if (archive.files[currentEntryIndex].getSize() == 0) { + return new ByteArrayInputStream(new byte[0]); + } + if (deferredBlockStreams.isEmpty()) { + throw new IllegalStateException(""No current 7z entry (call getNextEntry() first).""); + } + while (deferredBlockStreams.size() > 1) { + final InputStream stream = deferredBlockStreams.remove(0); + IOUtils.skip(stream, Long.MAX_VALUE); + stream.close(); + } + return deferredBlockStreams.get(0); + } +" +Chart-3," public TimeSeries createCopy(int start, int end) + throws CloneNotSupportedException { + if (start < 0) { + throw new IllegalArgumentException(""Requires start >= 0.""); + } + if (end < start) { + throw new IllegalArgumentException(""Requires start <= end.""); + } + TimeSeries copy = (TimeSeries) super.clone(); + copy.data = new java.util.ArrayList(); + if (this.data.size() > 0) { + for (int index = start; index <= end; index++) { + TimeSeriesDataItem item + = (TimeSeriesDataItem) this.data.get(index); + TimeSeriesDataItem clone = (TimeSeriesDataItem) item.clone(); + try { + copy.add(clone); + } + catch (SeriesException e) { + e.printStackTrace(); + } + } + } + return copy; + } +"," public TimeSeries createCopy(int start, int end) + throws CloneNotSupportedException { + if (start < 0) { + throw new IllegalArgumentException(""Requires start >= 0.""); + } + if (end < start) { + throw new IllegalArgumentException(""Requires start <= end.""); + } + TimeSeries copy = (TimeSeries) super.clone(); + copy.minY = Double.NaN; + copy.maxY = Double.NaN; + copy.data = new java.util.ArrayList(); + if (this.data.size() > 0) { + for (int index = start; index <= end; index++) { + TimeSeriesDataItem item + = (TimeSeriesDataItem) this.data.get(index); + TimeSeriesDataItem clone = (TimeSeriesDataItem) item.clone(); + try { + copy.add(clone); + } + catch (SeriesException e) { + e.printStackTrace(); + } + } + } + return copy; + } +" +Cli-37," private boolean isShortOption(String token) + { + return token.startsWith(""-"") && token.length() >= 2 && options.hasShortOption(token.substring(1, 2)); + } +"," private boolean isShortOption(String token) + { + if (!token.startsWith(""-"") || token.length() == 1) + { + return false; + } + int pos = token.indexOf(""=""); + String optName = pos == -1 ? token.substring(1) : token.substring(1, pos); + return options.hasShortOption(optName); + } +" +Math-44," protected double acceptStep(final AbstractStepInterpolator interpolator, + final double[] y, final double[] yDot, final double tEnd) + throws MathIllegalStateException { + double previousT = interpolator.getGlobalPreviousTime(); + final double currentT = interpolator.getGlobalCurrentTime(); + resetOccurred = false; + if (! statesInitialized) { + for (EventState state : eventsStates) { + state.reinitializeBegin(interpolator); + } + statesInitialized = true; + } + final int orderingSign = interpolator.isForward() ? +1 : -1; + SortedSet occuringEvents = new TreeSet(new Comparator() { + public int compare(EventState es0, EventState es1) { + return orderingSign * Double.compare(es0.getEventTime(), es1.getEventTime()); + } + }); + for (final EventState state : eventsStates) { + if (state.evaluateStep(interpolator)) { + occuringEvents.add(state); + } + } + while (!occuringEvents.isEmpty()) { + final Iterator iterator = occuringEvents.iterator(); + final EventState currentEvent = iterator.next(); + iterator.remove(); + final double eventT = currentEvent.getEventTime(); + interpolator.setSoftPreviousTime(previousT); + interpolator.setSoftCurrentTime(eventT); + interpolator.setInterpolatedTime(eventT); + final double[] eventY = interpolator.getInterpolatedState(); + currentEvent.stepAccepted(eventT, eventY); + isLastStep = currentEvent.stop(); + for (final StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + if (isLastStep) { + System.arraycopy(eventY, 0, y, 0, y.length); + return eventT; + } + if (currentEvent.reset(eventT, eventY)) { + System.arraycopy(eventY, 0, y, 0, y.length); + computeDerivatives(eventT, y, yDot); + resetOccurred = true; + return eventT; + } + previousT = eventT; + interpolator.setSoftPreviousTime(eventT); + interpolator.setSoftCurrentTime(currentT); + if (currentEvent.evaluateStep(interpolator)) { + occuringEvents.add(currentEvent); + } + } + interpolator.setInterpolatedTime(currentT); + final double[] currentY = interpolator.getInterpolatedState(); + for (final EventState state : eventsStates) { + state.stepAccepted(currentT, currentY); + isLastStep = isLastStep || state.stop(); + } + isLastStep = isLastStep || Precision.equals(currentT, tEnd, 1); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + return currentT; + } +"," protected double acceptStep(final AbstractStepInterpolator interpolator, + final double[] y, final double[] yDot, final double tEnd) + throws MathIllegalStateException { + double previousT = interpolator.getGlobalPreviousTime(); + final double currentT = interpolator.getGlobalCurrentTime(); + if (! statesInitialized) { + for (EventState state : eventsStates) { + state.reinitializeBegin(interpolator); + } + statesInitialized = true; + } + final int orderingSign = interpolator.isForward() ? +1 : -1; + SortedSet occuringEvents = new TreeSet(new Comparator() { + public int compare(EventState es0, EventState es1) { + return orderingSign * Double.compare(es0.getEventTime(), es1.getEventTime()); + } + }); + for (final EventState state : eventsStates) { + if (state.evaluateStep(interpolator)) { + occuringEvents.add(state); + } + } + while (!occuringEvents.isEmpty()) { + final Iterator iterator = occuringEvents.iterator(); + final EventState currentEvent = iterator.next(); + iterator.remove(); + final double eventT = currentEvent.getEventTime(); + interpolator.setSoftPreviousTime(previousT); + interpolator.setSoftCurrentTime(eventT); + interpolator.setInterpolatedTime(eventT); + final double[] eventY = interpolator.getInterpolatedState(); + currentEvent.stepAccepted(eventT, eventY); + isLastStep = currentEvent.stop(); + for (final StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + if (isLastStep) { + System.arraycopy(eventY, 0, y, 0, y.length); + for (final EventState remaining : occuringEvents) { + remaining.stepAccepted(eventT, eventY); + } + return eventT; + } + if (currentEvent.reset(eventT, eventY)) { + System.arraycopy(eventY, 0, y, 0, y.length); + computeDerivatives(eventT, y, yDot); + resetOccurred = true; + for (final EventState remaining : occuringEvents) { + remaining.stepAccepted(eventT, eventY); + } + return eventT; + } + previousT = eventT; + interpolator.setSoftPreviousTime(eventT); + interpolator.setSoftCurrentTime(currentT); + if (currentEvent.evaluateStep(interpolator)) { + occuringEvents.add(currentEvent); + } + } + interpolator.setInterpolatedTime(currentT); + final double[] currentY = interpolator.getInterpolatedState(); + for (final EventState state : eventsStates) { + state.stepAccepted(currentT, currentY); + isLastStep = isLastStep || state.stop(); + } + isLastStep = isLastStep || Precision.equals(currentT, tEnd, 1); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + return currentT; + } +" +Csv-9," > M putIn(final M map) { + for (final Entry entry : mapping.entrySet()) { + final int col = entry.getValue().intValue(); + if (col < values.length) { + map.put(entry.getKey(), values[col]); + } + } + return map; + } +"," > M putIn(final M map) { + if (mapping == null) { + return map; + } + for (final Entry entry : mapping.entrySet()) { + final int col = entry.getValue().intValue(); + if (col < values.length) { + map.put(entry.getKey(), values[col]); + } + } + return map; + } +" +Closure-170," private void getNumUseInUseCfgNode(final Node cfgNode) { + numUsesWithinCfgNode = 0; + AbstractCfgNodeTraversalCallback gatherCb = + new AbstractCfgNodeTraversalCallback() { + @Override + public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isName() && n.getString().equals(varName) && + !(parent.isAssign() && + (parent.getFirstChild() == n))) { + numUsesWithinCfgNode++; + } + } + }; + NodeTraversal.traverse(compiler, cfgNode, gatherCb); + } +"," private void getNumUseInUseCfgNode(final Node cfgNode) { + numUsesWithinCfgNode = 0; + AbstractCfgNodeTraversalCallback gatherCb = + new AbstractCfgNodeTraversalCallback() { + @Override + public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isName() && n.getString().equals(varName)) { + if (parent.isAssign() && (parent.getFirstChild() == n) + && isAssignChain(parent, cfgNode)) { + return; + } else { + numUsesWithinCfgNode++; + } + } + } + private boolean isAssignChain(Node child, Node ancestor) { + for (Node n = child; n != ancestor; n = n.getParent()) { + if (!n.isAssign()) { + return false; + } + } + return true; + } + }; + NodeTraversal.traverse(compiler, cfgNode, gatherCb); + } +" +Lang-18," protected List parsePattern() { + DateFormatSymbols symbols = new DateFormatSymbols(mLocale); + List rules = new ArrayList(); + String[] ERAs = symbols.getEras(); + String[] months = symbols.getMonths(); + String[] shortMonths = symbols.getShortMonths(); + String[] weekdays = symbols.getWeekdays(); + String[] shortWeekdays = symbols.getShortWeekdays(); + String[] AmPmStrings = symbols.getAmPmStrings(); + int length = mPattern.length(); + int[] indexRef = new int[1]; + for (int i = 0; i < length; i++) { + indexRef[0] = i; + String token = parseToken(mPattern, indexRef); + i = indexRef[0]; + int tokenLen = token.length(); + if (tokenLen == 0) { + break; + } + Rule rule; + char c = token.charAt(0); + switch (c) { + case 'G': + rule = new TextField(Calendar.ERA, ERAs); + break; + case 'y': + if (tokenLen >= 4) { + rule = selectNumberRule(Calendar.YEAR, tokenLen); + } else { + rule = TwoDigitYearField.INSTANCE; + } + break; + case 'M': + if (tokenLen >= 4) { + rule = new TextField(Calendar.MONTH, months); + } else if (tokenLen == 3) { + rule = new TextField(Calendar.MONTH, shortMonths); + } else if (tokenLen == 2) { + rule = TwoDigitMonthField.INSTANCE; + } else { + rule = UnpaddedMonthField.INSTANCE; + } + break; + case 'd': + rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen); + break; + case 'h': + rule = new TwelveHourField(selectNumberRule(Calendar.HOUR, tokenLen)); + break; + case 'H': + rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen); + break; + case 'm': + rule = selectNumberRule(Calendar.MINUTE, tokenLen); + break; + case 's': + rule = selectNumberRule(Calendar.SECOND, tokenLen); + break; + case 'S': + rule = selectNumberRule(Calendar.MILLISECOND, tokenLen); + break; + case 'E': + rule = new TextField(Calendar.DAY_OF_WEEK, tokenLen < 4 ? shortWeekdays : weekdays); + break; + case 'D': + rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen); + break; + case 'F': + rule = selectNumberRule(Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen); + break; + case 'w': + rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen); + break; + case 'W': + rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen); + break; + case 'a': + rule = new TextField(Calendar.AM_PM, AmPmStrings); + break; + case 'k': + rule = new TwentyFourHourField(selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen)); + break; + case 'K': + rule = selectNumberRule(Calendar.HOUR, tokenLen); + break; + case 'z': + if (tokenLen >= 4) { + rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG); + } else { + rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.SHORT); + } + break; + case 'Z': + if (tokenLen == 1) { + rule = TimeZoneNumberRule.INSTANCE_NO_COLON; + } else { + rule = TimeZoneNumberRule.INSTANCE_COLON; + } + break; + case '\'': + String sub = token.substring(1); + if (sub.length() == 1) { + rule = new CharacterLiteral(sub.charAt(0)); + } else { + rule = new StringLiteral(sub); + } + break; + default: + throw new IllegalArgumentException(""Illegal pattern component: "" + token); + } + rules.add(rule); + } + return rules; + } +"," protected List parsePattern() { + DateFormatSymbols symbols = new DateFormatSymbols(mLocale); + List rules = new ArrayList(); + String[] ERAs = symbols.getEras(); + String[] months = symbols.getMonths(); + String[] shortMonths = symbols.getShortMonths(); + String[] weekdays = symbols.getWeekdays(); + String[] shortWeekdays = symbols.getShortWeekdays(); + String[] AmPmStrings = symbols.getAmPmStrings(); + int length = mPattern.length(); + int[] indexRef = new int[1]; + for (int i = 0; i < length; i++) { + indexRef[0] = i; + String token = parseToken(mPattern, indexRef); + i = indexRef[0]; + int tokenLen = token.length(); + if (tokenLen == 0) { + break; + } + Rule rule; + char c = token.charAt(0); + switch (c) { + case 'G': + rule = new TextField(Calendar.ERA, ERAs); + break; + case 'y': + if (tokenLen == 2) { + rule = TwoDigitYearField.INSTANCE; + } else { + rule = selectNumberRule(Calendar.YEAR, tokenLen < 4 ? 4 : tokenLen); + } + break; + case 'M': + if (tokenLen >= 4) { + rule = new TextField(Calendar.MONTH, months); + } else if (tokenLen == 3) { + rule = new TextField(Calendar.MONTH, shortMonths); + } else if (tokenLen == 2) { + rule = TwoDigitMonthField.INSTANCE; + } else { + rule = UnpaddedMonthField.INSTANCE; + } + break; + case 'd': + rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen); + break; + case 'h': + rule = new TwelveHourField(selectNumberRule(Calendar.HOUR, tokenLen)); + break; + case 'H': + rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen); + break; + case 'm': + rule = selectNumberRule(Calendar.MINUTE, tokenLen); + break; + case 's': + rule = selectNumberRule(Calendar.SECOND, tokenLen); + break; + case 'S': + rule = selectNumberRule(Calendar.MILLISECOND, tokenLen); + break; + case 'E': + rule = new TextField(Calendar.DAY_OF_WEEK, tokenLen < 4 ? shortWeekdays : weekdays); + break; + case 'D': + rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen); + break; + case 'F': + rule = selectNumberRule(Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen); + break; + case 'w': + rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen); + break; + case 'W': + rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen); + break; + case 'a': + rule = new TextField(Calendar.AM_PM, AmPmStrings); + break; + case 'k': + rule = new TwentyFourHourField(selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen)); + break; + case 'K': + rule = selectNumberRule(Calendar.HOUR, tokenLen); + break; + case 'z': + if (tokenLen >= 4) { + rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.LONG); + } else { + rule = new TimeZoneNameRule(mTimeZone, mLocale, TimeZone.SHORT); + } + break; + case 'Z': + if (tokenLen == 1) { + rule = TimeZoneNumberRule.INSTANCE_NO_COLON; + } else { + rule = TimeZoneNumberRule.INSTANCE_COLON; + } + break; + case '\'': + String sub = token.substring(1); + if (sub.length() == 1) { + rule = new CharacterLiteral(sub.charAt(0)); + } else { + rule = new StringLiteral(sub); + } + break; + default: + throw new IllegalArgumentException(""Illegal pattern component: "" + token); + } + rules.add(rule); + } + return rules; + } +" +Closure-115," private CanInlineResult canInlineReferenceDirectly( + Node callNode, Node fnNode) { + if (!isDirectCallNodeReplacementPossible(fnNode)) { + return CanInlineResult.NO; + } + Node block = fnNode.getLastChild(); + boolean hasSideEffects = false; + if (block.hasChildren()) { + Preconditions.checkState(block.hasOneChild()); + Node stmt = block.getFirstChild(); + if (stmt.isReturn()) { + hasSideEffects = NodeUtil.mayHaveSideEffects(stmt.getFirstChild(), compiler); + } + } + Node cArg = callNode.getFirstChild().getNext(); + if (!callNode.getFirstChild().isName()) { + if (NodeUtil.isFunctionObjectCall(callNode)) { + if (cArg == null || !cArg.isThis()) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } else { + Preconditions.checkState(!NodeUtil.isFunctionObjectApply(callNode)); + } + } + Node fnParam = NodeUtil.getFunctionParameters(fnNode).getFirstChild(); + while (cArg != null || fnParam != null) { + if (fnParam != null) { + if (cArg != null) { + if (hasSideEffects && NodeUtil.canBeSideEffected(cArg)) { + return CanInlineResult.NO; + } + if (NodeUtil.mayEffectMutableState(cArg, compiler) + && NodeUtil.getNameReferenceCount( + block, fnParam.getString()) > 1) { + return CanInlineResult.NO; + } + } + fnParam = fnParam.getNext(); + } + if (cArg != null) { + if (NodeUtil.mayHaveSideEffects(cArg, compiler)) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } + } + return CanInlineResult.YES; + } +"," private CanInlineResult canInlineReferenceDirectly( + Node callNode, Node fnNode) { + if (!isDirectCallNodeReplacementPossible(fnNode)) { + return CanInlineResult.NO; + } + Node block = fnNode.getLastChild(); + Node cArg = callNode.getFirstChild().getNext(); + if (!callNode.getFirstChild().isName()) { + if (NodeUtil.isFunctionObjectCall(callNode)) { + if (cArg == null || !cArg.isThis()) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } else { + Preconditions.checkState(!NodeUtil.isFunctionObjectApply(callNode)); + } + } + Node fnParam = NodeUtil.getFunctionParameters(fnNode).getFirstChild(); + while (cArg != null || fnParam != null) { + if (fnParam != null) { + if (cArg != null) { + if (NodeUtil.mayEffectMutableState(cArg, compiler) + && NodeUtil.getNameReferenceCount( + block, fnParam.getString()) > 1) { + return CanInlineResult.NO; + } + } + fnParam = fnParam.getNext(); + } + if (cArg != null) { + if (NodeUtil.mayHaveSideEffects(cArg, compiler)) { + return CanInlineResult.NO; + } + cArg = cArg.getNext(); + } + } + return CanInlineResult.YES; + } +" +Closure-159," private void findCalledFunctions( + Node node, Set changed) { + Preconditions.checkArgument(changed != null); + if (node.getType() == Token.CALL) { + Node child = node.getFirstChild(); + if (child.getType() == Token.NAME) { + changed.add(child.getString()); + } + } + for (Node c = node.getFirstChild(); c != null; c = c.getNext()) { + findCalledFunctions(c, changed); + } + } +"," private void findCalledFunctions( + Node node, Set changed) { + Preconditions.checkArgument(changed != null); + if (node.getType() == Token.NAME) { + if (isCandidateUsage(node)) { + changed.add(node.getString()); + } + } + for (Node c = node.getFirstChild(); c != null; c = c.getNext()) { + findCalledFunctions(c, changed); + } + } +" +Chart-7," private void updateBounds(TimePeriod period, int index) { + long start = period.getStart().getTime(); + long end = period.getEnd().getTime(); + long middle = start + ((end - start) / 2); + if (this.minStartIndex >= 0) { + long minStart = getDataItem(this.minStartIndex).getPeriod() + .getStart().getTime(); + if (start < minStart) { + this.minStartIndex = index; + } + } + else { + this.minStartIndex = index; + } + if (this.maxStartIndex >= 0) { + long maxStart = getDataItem(this.maxStartIndex).getPeriod() + .getStart().getTime(); + if (start > maxStart) { + this.maxStartIndex = index; + } + } + else { + this.maxStartIndex = index; + } + if (this.minMiddleIndex >= 0) { + long s = getDataItem(this.minMiddleIndex).getPeriod().getStart() + .getTime(); + long e = getDataItem(this.minMiddleIndex).getPeriod().getEnd() + .getTime(); + long minMiddle = s + (e - s) / 2; + if (middle < minMiddle) { + this.minMiddleIndex = index; + } + } + else { + this.minMiddleIndex = index; + } + if (this.maxMiddleIndex >= 0) { + long s = getDataItem(this.minMiddleIndex).getPeriod().getStart() + .getTime(); + long e = getDataItem(this.minMiddleIndex).getPeriod().getEnd() + .getTime(); + long maxMiddle = s + (e - s) / 2; + if (middle > maxMiddle) { + this.maxMiddleIndex = index; + } + } + else { + this.maxMiddleIndex = index; + } + if (this.minEndIndex >= 0) { + long minEnd = getDataItem(this.minEndIndex).getPeriod().getEnd() + .getTime(); + if (end < minEnd) { + this.minEndIndex = index; + } + } + else { + this.minEndIndex = index; + } + if (this.maxEndIndex >= 0) { + long maxEnd = getDataItem(this.maxEndIndex).getPeriod().getEnd() + .getTime(); + if (end > maxEnd) { + this.maxEndIndex = index; + } + } + else { + this.maxEndIndex = index; + } + } +"," private void updateBounds(TimePeriod period, int index) { + long start = period.getStart().getTime(); + long end = period.getEnd().getTime(); + long middle = start + ((end - start) / 2); + if (this.minStartIndex >= 0) { + long minStart = getDataItem(this.minStartIndex).getPeriod() + .getStart().getTime(); + if (start < minStart) { + this.minStartIndex = index; + } + } + else { + this.minStartIndex = index; + } + if (this.maxStartIndex >= 0) { + long maxStart = getDataItem(this.maxStartIndex).getPeriod() + .getStart().getTime(); + if (start > maxStart) { + this.maxStartIndex = index; + } + } + else { + this.maxStartIndex = index; + } + if (this.minMiddleIndex >= 0) { + long s = getDataItem(this.minMiddleIndex).getPeriod().getStart() + .getTime(); + long e = getDataItem(this.minMiddleIndex).getPeriod().getEnd() + .getTime(); + long minMiddle = s + (e - s) / 2; + if (middle < minMiddle) { + this.minMiddleIndex = index; + } + } + else { + this.minMiddleIndex = index; + } + if (this.maxMiddleIndex >= 0) { + long s = getDataItem(this.maxMiddleIndex).getPeriod().getStart() + .getTime(); + long e = getDataItem(this.maxMiddleIndex).getPeriod().getEnd() + .getTime(); + long maxMiddle = s + (e - s) / 2; + if (middle > maxMiddle) { + this.maxMiddleIndex = index; + } + } + else { + this.maxMiddleIndex = index; + } + if (this.minEndIndex >= 0) { + long minEnd = getDataItem(this.minEndIndex).getPeriod().getEnd() + .getTime(); + if (end < minEnd) { + this.minEndIndex = index; + } + } + else { + this.minEndIndex = index; + } + if (this.maxEndIndex >= 0) { + long maxEnd = getDataItem(this.maxEndIndex).getPeriod().getEnd() + .getTime(); + if (end > maxEnd) { + this.maxEndIndex = index; + } + } + else { + this.maxEndIndex = index; + } + } +" +Jsoup-48," void processResponseHeaders(Map> resHeaders) { + for (Map.Entry> entry : resHeaders.entrySet()) { + String name = entry.getKey(); + if (name == null) + continue; + List values = entry.getValue(); + if (name.equalsIgnoreCase(""Set-Cookie"")) { + for (String value : values) { + if (value == null) + continue; + TokenQueue cd = new TokenQueue(value); + String cookieName = cd.chompTo(""="").trim(); + String cookieVal = cd.consumeTo("";"").trim(); + if (cookieName.length() > 0) + cookie(cookieName, cookieVal); + } + } else { + if (!values.isEmpty()) + header(name, values.get(0)); + } + } + } +"," void processResponseHeaders(Map> resHeaders) { + for (Map.Entry> entry : resHeaders.entrySet()) { + String name = entry.getKey(); + if (name == null) + continue; + List values = entry.getValue(); + if (name.equalsIgnoreCase(""Set-Cookie"")) { + for (String value : values) { + if (value == null) + continue; + TokenQueue cd = new TokenQueue(value); + String cookieName = cd.chompTo(""="").trim(); + String cookieVal = cd.consumeTo("";"").trim(); + if (cookieName.length() > 0) + cookie(cookieName, cookieVal); + } + } else { + if (values.size() == 1) + header(name, values.get(0)); + else if (values.size() > 1) { + StringBuilder accum = new StringBuilder(); + for (int i = 0; i < values.size(); i++) { + final String val = values.get(i); + if (i != 0) + accum.append("", ""); + accum.append(val); + } + header(name, accum.toString()); + } + } + } + } +" +Closure-109," private Node parseContextTypeExpression(JsDocToken token) { + return parseTypeName(token); + } +"," private Node parseContextTypeExpression(JsDocToken token) { + if (token == JsDocToken.QMARK) { + return newNode(Token.QMARK); + } else { + return parseBasicTypeExpression(token); + } + } +" +Closure-70," private void declareArguments(Node functionNode) { + Node astParameters = functionNode.getFirstChild().getNext(); + Node body = astParameters.getNext(); + FunctionType functionType = (FunctionType) functionNode.getJSType(); + if (functionType != null) { + Node jsDocParameters = functionType.getParametersNode(); + if (jsDocParameters != null) { + Node jsDocParameter = jsDocParameters.getFirstChild(); + for (Node astParameter : astParameters.children()) { + if (jsDocParameter != null) { + defineSlot(astParameter, functionNode, + jsDocParameter.getJSType(), true); + jsDocParameter = jsDocParameter.getNext(); + } else { + defineSlot(astParameter, functionNode, null, true); + } + } + } + } + } +"," private void declareArguments(Node functionNode) { + Node astParameters = functionNode.getFirstChild().getNext(); + Node body = astParameters.getNext(); + FunctionType functionType = (FunctionType) functionNode.getJSType(); + if (functionType != null) { + Node jsDocParameters = functionType.getParametersNode(); + if (jsDocParameters != null) { + Node jsDocParameter = jsDocParameters.getFirstChild(); + for (Node astParameter : astParameters.children()) { + if (jsDocParameter != null) { + defineSlot(astParameter, functionNode, + jsDocParameter.getJSType(), false); + jsDocParameter = jsDocParameter.getNext(); + } else { + defineSlot(astParameter, functionNode, null, true); + } + } + } + } + } +" +Closure-129," private void annotateCalls(Node n) { + Preconditions.checkState(n.isCall()); + Node first = n.getFirstChild(); + if (!NodeUtil.isGet(first)) { + n.putBooleanProp(Node.FREE_CALL, true); + } + if (first.isName() && + ""eval"".equals(first.getString())) { + first.putBooleanProp(Node.DIRECT_EVAL, true); + } + } +"," private void annotateCalls(Node n) { + Preconditions.checkState(n.isCall()); + Node first = n.getFirstChild(); + while (first.isCast()) { + first = first.getFirstChild(); + } + if (!NodeUtil.isGet(first)) { + n.putBooleanProp(Node.FREE_CALL, true); + } + if (first.isName() && + ""eval"".equals(first.getString())) { + first.putBooleanProp(Node.DIRECT_EVAL, true); + } + } +" +Gson-17," public Date read(JsonReader in) throws IOException { + if (in.peek() != JsonToken.STRING) { + throw new JsonParseException(""The date should be a string value""); + } + Date date = deserializeToDate(in.nextString()); + if (dateType == Date.class) { + return date; + } else if (dateType == Timestamp.class) { + return new Timestamp(date.getTime()); + } else if (dateType == java.sql.Date.class) { + return new java.sql.Date(date.getTime()); + } else { + throw new AssertionError(); + } + } +"," public Date read(JsonReader in) throws IOException { + if (in.peek() == JsonToken.NULL) { + in.nextNull(); + return null; + } + Date date = deserializeToDate(in.nextString()); + if (dateType == Date.class) { + return date; + } else if (dateType == Timestamp.class) { + return new Timestamp(date.getTime()); + } else if (dateType == java.sql.Date.class) { + return new java.sql.Date(date.getTime()); + } else { + throw new AssertionError(); + } + } +" +Compress-32," private void applyPaxHeadersToCurrentEntry(Map headers) { + for (Entry ent : headers.entrySet()){ + String key = ent.getKey(); + String val = ent.getValue(); + if (""path"".equals(key)){ + currEntry.setName(val); + } else if (""linkpath"".equals(key)){ + currEntry.setLinkName(val); + } else if (""gid"".equals(key)){ + currEntry.setGroupId(Integer.parseInt(val)); + } else if (""gname"".equals(key)){ + currEntry.setGroupName(val); + } else if (""uid"".equals(key)){ + currEntry.setUserId(Integer.parseInt(val)); + } else if (""uname"".equals(key)){ + currEntry.setUserName(val); + } else if (""size"".equals(key)){ + currEntry.setSize(Long.parseLong(val)); + } else if (""mtime"".equals(key)){ + currEntry.setModTime((long) (Double.parseDouble(val) * 1000)); + } else if (""SCHILY.devminor"".equals(key)){ + currEntry.setDevMinor(Integer.parseInt(val)); + } else if (""SCHILY.devmajor"".equals(key)){ + currEntry.setDevMajor(Integer.parseInt(val)); + } + } + } +"," private void applyPaxHeadersToCurrentEntry(Map headers) { + for (Entry ent : headers.entrySet()){ + String key = ent.getKey(); + String val = ent.getValue(); + if (""path"".equals(key)){ + currEntry.setName(val); + } else if (""linkpath"".equals(key)){ + currEntry.setLinkName(val); + } else if (""gid"".equals(key)){ + currEntry.setGroupId(Long.parseLong(val)); + } else if (""gname"".equals(key)){ + currEntry.setGroupName(val); + } else if (""uid"".equals(key)){ + currEntry.setUserId(Long.parseLong(val)); + } else if (""uname"".equals(key)){ + currEntry.setUserName(val); + } else if (""size"".equals(key)){ + currEntry.setSize(Long.parseLong(val)); + } else if (""mtime"".equals(key)){ + currEntry.setModTime((long) (Double.parseDouble(val) * 1000)); + } else if (""SCHILY.devminor"".equals(key)){ + currEntry.setDevMinor(Integer.parseInt(val)); + } else if (""SCHILY.devmajor"".equals(key)){ + currEntry.setDevMajor(Integer.parseInt(val)); + } + } + } +" +JacksonDatabind-51," protected final JsonDeserializer _findDeserializer(DeserializationContext ctxt, + String typeId) throws IOException + { + JsonDeserializer deser = _deserializers.get(typeId); + if (deser == null) { + JavaType type = _idResolver.typeFromId(ctxt, typeId); + if (type == null) { + deser = _findDefaultImplDeserializer(ctxt); + if (deser == null) { + JavaType actual = _handleUnknownTypeId(ctxt, typeId, _idResolver, _baseType); + if (actual == null) { + return null; + } + deser = ctxt.findContextualValueDeserializer(actual, _property); + } + } else { + if ((_baseType != null) + && _baseType.getClass() == type.getClass()) { + type = ctxt.getTypeFactory().constructSpecializedType(_baseType, type.getRawClass()); + } + deser = ctxt.findContextualValueDeserializer(type, _property); + } + _deserializers.put(typeId, deser); + } + return deser; + } +"," protected final JsonDeserializer _findDeserializer(DeserializationContext ctxt, + String typeId) throws IOException + { + JsonDeserializer deser = _deserializers.get(typeId); + if (deser == null) { + JavaType type = _idResolver.typeFromId(ctxt, typeId); + if (type == null) { + deser = _findDefaultImplDeserializer(ctxt); + if (deser == null) { + JavaType actual = _handleUnknownTypeId(ctxt, typeId, _idResolver, _baseType); + if (actual == null) { + return null; + } + deser = ctxt.findContextualValueDeserializer(actual, _property); + } + } else { + if ((_baseType != null) + && _baseType.getClass() == type.getClass()) { + if (!type.hasGenericTypes()) { + type = ctxt.getTypeFactory().constructSpecializedType(_baseType, type.getRawClass()); + } + } + deser = ctxt.findContextualValueDeserializer(type, _property); + } + _deserializers.put(typeId, deser); + } + return deser; + } +" +Jsoup-5," private Attribute parseAttribute() { + tq.consumeWhitespace(); + String key = tq.consumeAttributeKey(); + String value = """"; + tq.consumeWhitespace(); + if (tq.matchChomp(""="")) { + tq.consumeWhitespace(); + if (tq.matchChomp(SQ)) { + value = tq.chompTo(SQ); + } else if (tq.matchChomp(DQ)) { + value = tq.chompTo(DQ); + } else { + StringBuilder valueAccum = new StringBuilder(); + while (!tq.matchesAny(""<"", ""/>"", "">"") && !tq.matchesWhitespace() && !tq.isEmpty()) { + valueAccum.append(tq.consume()); + } + value = valueAccum.toString(); + } + tq.consumeWhitespace(); + } + if (key.length() != 0) + return Attribute.createFromEncoded(key, value); + else { + tq.consume(); + return null; + } + } +"," private Attribute parseAttribute() { + tq.consumeWhitespace(); + String key = tq.consumeAttributeKey(); + String value = """"; + tq.consumeWhitespace(); + if (tq.matchChomp(""="")) { + tq.consumeWhitespace(); + if (tq.matchChomp(SQ)) { + value = tq.chompTo(SQ); + } else if (tq.matchChomp(DQ)) { + value = tq.chompTo(DQ); + } else { + StringBuilder valueAccum = new StringBuilder(); + while (!tq.matchesAny(""<"", ""/>"", "">"") && !tq.matchesWhitespace() && !tq.isEmpty()) { + valueAccum.append(tq.consume()); + } + value = valueAccum.toString(); + } + tq.consumeWhitespace(); + } + if (key.length() != 0) + return Attribute.createFromEncoded(key, value); + else { + if (value.length() == 0) + tq.advance(); + return null; + } + } +" +Jsoup-47," static void escape(StringBuilder accum, String string, Document.OutputSettings out, + boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) { + boolean lastWasWhite = false; + boolean reachedNonWhite = false; + final EscapeMode escapeMode = out.escapeMode(); + final CharsetEncoder encoder = out.encoder(); + final CoreCharset coreCharset = CoreCharset.byName(encoder.charset().name()); + final Map map = escapeMode.getMap(); + final int length = string.length(); + int codePoint; + for (int offset = 0; offset < length; offset += Character.charCount(codePoint)) { + codePoint = string.codePointAt(offset); + if (normaliseWhite) { + if (StringUtil.isWhitespace(codePoint)) { + if ((stripLeadingWhite && !reachedNonWhite) || lastWasWhite) + continue; + accum.append(' '); + lastWasWhite = true; + continue; + } else { + lastWasWhite = false; + reachedNonWhite = true; + } + } + if (codePoint < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + final char c = (char) codePoint; + switch (c) { + case '&': + accum.append(""&""); + break; + case 0xA0: + if (escapeMode != EscapeMode.xhtml) + accum.append("" ""); + else + accum.append("" ""); + break; + case '<': + if (!inAttribute) + accum.append(""<""); + else + accum.append(c); + break; + case '>': + if (!inAttribute) + accum.append("">""); + else + accum.append(c); + break; + case '""': + if (inAttribute) + accum.append("""""); + else + accum.append(c); + break; + default: + if (canEncode(coreCharset, c, encoder)) + accum.append(c); + else if (map.containsKey(c)) + accum.append('&').append(map.get(c)).append(';'); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } else { + final String c = new String(Character.toChars(codePoint)); + if (encoder.canEncode(c)) + accum.append(c); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } + } +"," static void escape(StringBuilder accum, String string, Document.OutputSettings out, + boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) { + boolean lastWasWhite = false; + boolean reachedNonWhite = false; + final EscapeMode escapeMode = out.escapeMode(); + final CharsetEncoder encoder = out.encoder(); + final CoreCharset coreCharset = CoreCharset.byName(encoder.charset().name()); + final Map map = escapeMode.getMap(); + final int length = string.length(); + int codePoint; + for (int offset = 0; offset < length; offset += Character.charCount(codePoint)) { + codePoint = string.codePointAt(offset); + if (normaliseWhite) { + if (StringUtil.isWhitespace(codePoint)) { + if ((stripLeadingWhite && !reachedNonWhite) || lastWasWhite) + continue; + accum.append(' '); + lastWasWhite = true; + continue; + } else { + lastWasWhite = false; + reachedNonWhite = true; + } + } + if (codePoint < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + final char c = (char) codePoint; + switch (c) { + case '&': + accum.append(""&""); + break; + case 0xA0: + if (escapeMode != EscapeMode.xhtml) + accum.append("" ""); + else + accum.append("" ""); + break; + case '<': + if (!inAttribute || escapeMode == EscapeMode.xhtml) + accum.append(""<""); + else + accum.append(c); + break; + case '>': + if (!inAttribute) + accum.append("">""); + else + accum.append(c); + break; + case '""': + if (inAttribute) + accum.append("""""); + else + accum.append(c); + break; + default: + if (canEncode(coreCharset, c, encoder)) + accum.append(c); + else if (map.containsKey(c)) + accum.append('&').append(map.get(c)).append(';'); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } else { + final String c = new String(Character.toChars(codePoint)); + if (encoder.canEncode(c)) + accum.append(c); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } + } +" +JacksonDatabind-71," public static StdKeyDeserializer forType(Class raw) + { + int kind; + if (raw == String.class || raw == Object.class) { + return StringKD.forType(raw); + } else if (raw == UUID.class) { + kind = TYPE_UUID; + } else if (raw == Integer.class) { + kind = TYPE_INT; + } else if (raw == Long.class) { + kind = TYPE_LONG; + } else if (raw == Date.class) { + kind = TYPE_DATE; + } else if (raw == Calendar.class) { + kind = TYPE_CALENDAR; + } else if (raw == Boolean.class) { + kind = TYPE_BOOLEAN; + } else if (raw == Byte.class) { + kind = TYPE_BYTE; + } else if (raw == Character.class) { + kind = TYPE_CHAR; + } else if (raw == Short.class) { + kind = TYPE_SHORT; + } else if (raw == Float.class) { + kind = TYPE_FLOAT; + } else if (raw == Double.class) { + kind = TYPE_DOUBLE; + } else if (raw == URI.class) { + kind = TYPE_URI; + } else if (raw == URL.class) { + kind = TYPE_URL; + } else if (raw == Class.class) { + kind = TYPE_CLASS; + } else if (raw == Locale.class) { + FromStringDeserializer deser = FromStringDeserializer.findDeserializer(Locale.class); + return new StdKeyDeserializer(TYPE_LOCALE, raw, deser); + } else if (raw == Currency.class) { + FromStringDeserializer deser = FromStringDeserializer.findDeserializer(Currency.class); + return new StdKeyDeserializer(TYPE_CURRENCY, raw, deser); + } else { + return null; + } + return new StdKeyDeserializer(kind, raw); + } +"," public static StdKeyDeserializer forType(Class raw) + { + int kind; + if (raw == String.class || raw == Object.class || raw == CharSequence.class) { + return StringKD.forType(raw); + } else if (raw == UUID.class) { + kind = TYPE_UUID; + } else if (raw == Integer.class) { + kind = TYPE_INT; + } else if (raw == Long.class) { + kind = TYPE_LONG; + } else if (raw == Date.class) { + kind = TYPE_DATE; + } else if (raw == Calendar.class) { + kind = TYPE_CALENDAR; + } else if (raw == Boolean.class) { + kind = TYPE_BOOLEAN; + } else if (raw == Byte.class) { + kind = TYPE_BYTE; + } else if (raw == Character.class) { + kind = TYPE_CHAR; + } else if (raw == Short.class) { + kind = TYPE_SHORT; + } else if (raw == Float.class) { + kind = TYPE_FLOAT; + } else if (raw == Double.class) { + kind = TYPE_DOUBLE; + } else if (raw == URI.class) { + kind = TYPE_URI; + } else if (raw == URL.class) { + kind = TYPE_URL; + } else if (raw == Class.class) { + kind = TYPE_CLASS; + } else if (raw == Locale.class) { + FromStringDeserializer deser = FromStringDeserializer.findDeserializer(Locale.class); + return new StdKeyDeserializer(TYPE_LOCALE, raw, deser); + } else if (raw == Currency.class) { + FromStringDeserializer deser = FromStringDeserializer.findDeserializer(Currency.class); + return new StdKeyDeserializer(TYPE_CURRENCY, raw, deser); + } else { + return null; + } + return new StdKeyDeserializer(kind, raw); + } +" +Closure-124," private boolean isSafeReplacement(Node node, Node replacement) { + if (node.isName()) { + return true; + } + Preconditions.checkArgument(node.isGetProp()); + node = node.getFirstChild(); + if (node.isName() + && isNameAssignedTo(node.getString(), replacement)) { + return false; + } + return true; + } +"," private boolean isSafeReplacement(Node node, Node replacement) { + if (node.isName()) { + return true; + } + Preconditions.checkArgument(node.isGetProp()); + while (node.isGetProp()) { + node = node.getFirstChild(); + } + if (node.isName() + && isNameAssignedTo(node.getString(), replacement)) { + return false; + } + return true; + } +" +Jsoup-41," public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + Element element = (Element) o; + return this == o; + } +"," public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + Element element = (Element) o; + return tag.equals(element.tag); + } +" +Mockito-8," protected void registerTypeVariablesOn(Type classType) { + if (!(classType instanceof ParameterizedType)) { + return; + } + ParameterizedType parameterizedType = (ParameterizedType) classType; + TypeVariable[] typeParameters = ((Class) parameterizedType.getRawType()).getTypeParameters(); + Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); + for (int i = 0; i < actualTypeArguments.length; i++) { + TypeVariable typeParameter = typeParameters[i]; + Type actualTypeArgument = actualTypeArguments[i]; + if (actualTypeArgument instanceof WildcardType) { + contextualActualTypeParameters.put(typeParameter, boundsOf((WildcardType) actualTypeArgument)); + } else { + contextualActualTypeParameters.put(typeParameter, actualTypeArgument); + } + } + } +"," protected void registerTypeVariablesOn(Type classType) { + if (!(classType instanceof ParameterizedType)) { + return; + } + ParameterizedType parameterizedType = (ParameterizedType) classType; + TypeVariable[] typeParameters = ((Class) parameterizedType.getRawType()).getTypeParameters(); + Type[] actualTypeArguments = parameterizedType.getActualTypeArguments(); + for (int i = 0; i < actualTypeArguments.length; i++) { + TypeVariable typeParameter = typeParameters[i]; + Type actualTypeArgument = actualTypeArguments[i]; + if (actualTypeArgument instanceof WildcardType) { + contextualActualTypeParameters.put(typeParameter, boundsOf((WildcardType) actualTypeArgument)); + } else if (typeParameter != actualTypeArgument) { + contextualActualTypeParameters.put(typeParameter, actualTypeArgument); + } + } + } +" +JacksonCore-8," public char[] getTextBuffer() + { + if (_inputStart >= 0) return _inputBuffer; + if (_resultArray != null) return _resultArray; + if (_resultString != null) { + return (_resultArray = _resultString.toCharArray()); + } + if (!_hasSegments) return _currentSegment; + return contentsAsArray(); + } +"," public char[] getTextBuffer() + { + if (_inputStart >= 0) return _inputBuffer; + if (_resultArray != null) return _resultArray; + if (_resultString != null) { + return (_resultArray = _resultString.toCharArray()); + } + if (!_hasSegments && _currentSegment != null) return _currentSegment; + return contentsAsArray(); + } +" +Cli-17," protected void burstToken(String token, boolean stopAtNonOption) + { + for (int i = 1; i < token.length(); i++) + { + String ch = String.valueOf(token.charAt(i)); + if (options.hasOption(ch)) + { + tokens.add(""-"" + ch); + currentOption = options.getOption(ch); + if (currentOption.hasArg() && (token.length() != (i + 1))) + { + tokens.add(token.substring(i + 1)); + break; + } + } + else if (stopAtNonOption) + { + process(token.substring(i)); + } + else + { + tokens.add(token); + break; + } + } + } +"," protected void burstToken(String token, boolean stopAtNonOption) + { + for (int i = 1; i < token.length(); i++) + { + String ch = String.valueOf(token.charAt(i)); + if (options.hasOption(ch)) + { + tokens.add(""-"" + ch); + currentOption = options.getOption(ch); + if (currentOption.hasArg() && (token.length() != (i + 1))) + { + tokens.add(token.substring(i + 1)); + break; + } + } + else if (stopAtNonOption) + { + process(token.substring(i)); + break; + } + else + { + tokens.add(token); + break; + } + } + } +" +Math-86," public CholeskyDecompositionImpl(final RealMatrix matrix, + final double relativeSymmetryThreshold, + final double absolutePositivityThreshold) + throws NonSquareMatrixException, + NotSymmetricMatrixException, NotPositiveDefiniteMatrixException { + if (!matrix.isSquare()) { + throw new NonSquareMatrixException(matrix.getRowDimension(), + matrix.getColumnDimension()); + } + final int order = matrix.getRowDimension(); + lTData = matrix.getData(); + cachedL = null; + cachedLT = null; + for (int i = 0; i < order; ++i) { + final double[] lI = lTData[i]; + if (lTData[i][i] < absolutePositivityThreshold) { + throw new NotPositiveDefiniteMatrixException(); + } + for (int j = i + 1; j < order; ++j) { + final double[] lJ = lTData[j]; + final double lIJ = lI[j]; + final double lJI = lJ[i]; + final double maxDelta = + relativeSymmetryThreshold * Math.max(Math.abs(lIJ), Math.abs(lJI)); + if (Math.abs(lIJ - lJI) > maxDelta) { + throw new NotSymmetricMatrixException(); + } + lJ[i] = 0; + } + } + for (int i = 0; i < order; ++i) { + final double[] ltI = lTData[i]; + ltI[i] = Math.sqrt(ltI[i]); + final double inverse = 1.0 / ltI[i]; + for (int q = order - 1; q > i; --q) { + ltI[q] *= inverse; + final double[] ltQ = lTData[q]; + for (int p = q; p < order; ++p) { + ltQ[p] -= ltI[q] * ltI[p]; + } + } + } + } +"," public CholeskyDecompositionImpl(final RealMatrix matrix, + final double relativeSymmetryThreshold, + final double absolutePositivityThreshold) + throws NonSquareMatrixException, + NotSymmetricMatrixException, NotPositiveDefiniteMatrixException { + if (!matrix.isSquare()) { + throw new NonSquareMatrixException(matrix.getRowDimension(), + matrix.getColumnDimension()); + } + final int order = matrix.getRowDimension(); + lTData = matrix.getData(); + cachedL = null; + cachedLT = null; + for (int i = 0; i < order; ++i) { + final double[] lI = lTData[i]; + for (int j = i + 1; j < order; ++j) { + final double[] lJ = lTData[j]; + final double lIJ = lI[j]; + final double lJI = lJ[i]; + final double maxDelta = + relativeSymmetryThreshold * Math.max(Math.abs(lIJ), Math.abs(lJI)); + if (Math.abs(lIJ - lJI) > maxDelta) { + throw new NotSymmetricMatrixException(); + } + lJ[i] = 0; + } + } + for (int i = 0; i < order; ++i) { + final double[] ltI = lTData[i]; + if (ltI[i] < absolutePositivityThreshold) { + throw new NotPositiveDefiniteMatrixException(); + } + ltI[i] = Math.sqrt(ltI[i]); + final double inverse = 1.0 / ltI[i]; + for (int q = order - 1; q > i; --q) { + ltI[q] *= inverse; + final double[] ltQ = lTData[q]; + for (int p = q; p < order; ++p) { + ltQ[p] -= ltI[q] * ltI[p]; + } + } + } + } +" +Closure-83," public int parseArguments(Parameters params) throws CmdLineException { + String param = params.getParameter(0); + if (param == null) { + setter.addValue(true); + return 0; + } else { + String lowerParam = param.toLowerCase(); + if (TRUES.contains(lowerParam)) { + setter.addValue(true); + } else if (FALSES.contains(lowerParam)) { + setter.addValue(false); + } else { + setter.addValue(true); + return 0; + } + return 1; + } + } +"," public int parseArguments(Parameters params) throws CmdLineException { + String param = null; + try { + param = params.getParameter(0); + } catch (CmdLineException e) {} + if (param == null) { + setter.addValue(true); + return 0; + } else { + String lowerParam = param.toLowerCase(); + if (TRUES.contains(lowerParam)) { + setter.addValue(true); + } else if (FALSES.contains(lowerParam)) { + setter.addValue(false); + } else { + setter.addValue(true); + return 0; + } + return 1; + } + } +" +Jsoup-61," public boolean hasClass(String className) { + final String classAttr = attributes.get(""class""); + final int len = classAttr.length(); + final int wantLen = className.length(); + if (len == 0 || len < wantLen) { + return false; + } + if (len == wantLen) { + return className.equalsIgnoreCase(classAttr); + } + boolean inClass = false; + int start = 0; + for (int i = 0; i < len; i++) { + if (Character.isWhitespace(classAttr.charAt(i))) { + if (inClass) { + if (i - start == wantLen && classAttr.regionMatches(true, start, className, 0, wantLen)) { + return true; + } + inClass = false; + } + } else { + if (!inClass) { + inClass = true; + start = i; + } + } + } + if (inClass && len - start == wantLen) { + return classAttr.regionMatches(true, start, className, 0, wantLen); + } + return false; + } +"," public boolean hasClass(String className) { + final String classAttr = attributes.getIgnoreCase(""class""); + final int len = classAttr.length(); + final int wantLen = className.length(); + if (len == 0 || len < wantLen) { + return false; + } + if (len == wantLen) { + return className.equalsIgnoreCase(classAttr); + } + boolean inClass = false; + int start = 0; + for (int i = 0; i < len; i++) { + if (Character.isWhitespace(classAttr.charAt(i))) { + if (inClass) { + if (i - start == wantLen && classAttr.regionMatches(true, start, className, 0, wantLen)) { + return true; + } + inClass = false; + } + } else { + if (!inClass) { + inClass = true; + start = i; + } + } + } + if (inClass && len - start == wantLen) { + return classAttr.regionMatches(true, start, className, 0, wantLen); + } + return false; + } +" +Closure-32," private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, + WhitespaceOption option) { + if (token == JsDocToken.EOC || token == JsDocToken.EOL || + token == JsDocToken.EOF) { + return new ExtractionInfo("""", token); + } + stream.update(); + int startLineno = stream.getLineno(); + int startCharno = stream.getCharno() + 1; + String line = stream.getRemainingJSDocLine(); + if (option != WhitespaceOption.PRESERVE) { + line = line.trim(); + } + StringBuilder builder = new StringBuilder(); + builder.append(line); + state = State.SEARCHING_ANNOTATION; + token = next(); + boolean ignoreStar = false; + do { + switch (token) { + case STAR: + if (ignoreStar) { + } else { + if (builder.length() > 0) { + builder.append(' '); + } + builder.append('*'); + } + token = next(); + continue; + case EOL: + if (option != WhitespaceOption.SINGLE_LINE) { + builder.append(""\n""); + } + ignoreStar = true; + token = next(); + continue; + default: + ignoreStar = false; + state = State.SEARCHING_ANNOTATION; + if (token == JsDocToken.EOC || + token == JsDocToken.EOF || + (token == JsDocToken.ANNOTATION && + option != WhitespaceOption.PRESERVE)) { + String multilineText = builder.toString(); + if (option != WhitespaceOption.PRESERVE) { + multilineText = multilineText.trim(); + } + int endLineno = stream.getLineno(); + int endCharno = stream.getCharno(); + if (multilineText.length() > 0) { + jsdocBuilder.markText(multilineText, startLineno, startCharno, + endLineno, endCharno); + } + return new ExtractionInfo(multilineText, token); + } + if (builder.length() > 0) { + builder.append(' '); + } + builder.append(toString(token)); + line = stream.getRemainingJSDocLine(); + if (option != WhitespaceOption.PRESERVE) { + line = trimEnd(line); + } + builder.append(line); + token = next(); + } + } while (true); + } +"," private ExtractionInfo extractMultilineTextualBlock(JsDocToken token, + WhitespaceOption option) { + if (token == JsDocToken.EOC || token == JsDocToken.EOL || + token == JsDocToken.EOF) { + return new ExtractionInfo("""", token); + } + stream.update(); + int startLineno = stream.getLineno(); + int startCharno = stream.getCharno() + 1; + String line = stream.getRemainingJSDocLine(); + if (option != WhitespaceOption.PRESERVE) { + line = line.trim(); + } + StringBuilder builder = new StringBuilder(); + builder.append(line); + state = State.SEARCHING_ANNOTATION; + token = next(); + boolean ignoreStar = false; + int lineStartChar = -1; + do { + switch (token) { + case STAR: + if (ignoreStar) { + lineStartChar = stream.getCharno() + 1; + } else { + if (builder.length() > 0) { + builder.append(' '); + } + builder.append('*'); + } + token = next(); + continue; + case EOL: + if (option != WhitespaceOption.SINGLE_LINE) { + builder.append(""\n""); + } + ignoreStar = true; + lineStartChar = 0; + token = next(); + continue; + default: + ignoreStar = false; + state = State.SEARCHING_ANNOTATION; + boolean isEOC = token == JsDocToken.EOC; + if (!isEOC) { + if (lineStartChar != -1 && option == WhitespaceOption.PRESERVE) { + int numSpaces = stream.getCharno() - lineStartChar; + for (int i = 0; i < numSpaces; i++) { + builder.append(' '); + } + lineStartChar = -1; + } else if (builder.length() > 0) { + builder.append(' '); + } + } + if (token == JsDocToken.EOC || + token == JsDocToken.EOF || + (token == JsDocToken.ANNOTATION && + option != WhitespaceOption.PRESERVE)) { + String multilineText = builder.toString(); + if (option != WhitespaceOption.PRESERVE) { + multilineText = multilineText.trim(); + } + int endLineno = stream.getLineno(); + int endCharno = stream.getCharno(); + if (multilineText.length() > 0) { + jsdocBuilder.markText(multilineText, startLineno, startCharno, + endLineno, endCharno); + } + return new ExtractionInfo(multilineText, token); + } + builder.append(toString(token)); + line = stream.getRemainingJSDocLine(); + if (option != WhitespaceOption.PRESERVE) { + line = trimEnd(line); + } + builder.append(line); + token = next(); + } + } while (true); + } +" +Math-53," public Complex add(Complex rhs) + throws NullArgumentException { + MathUtils.checkNotNull(rhs); + return createComplex(real + rhs.getReal(), + imaginary + rhs.getImaginary()); + } +"," public Complex add(Complex rhs) + throws NullArgumentException { + MathUtils.checkNotNull(rhs); + if (isNaN || rhs.isNaN) { + return NaN; + } + return createComplex(real + rhs.getReal(), + imaginary + rhs.getImaginary()); + } +" +Math-28," private Integer getPivotRow(SimplexTableau tableau, final int col) { + List minRatioPositions = new ArrayList(); + double minRatio = Double.MAX_VALUE; + for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) { + final double rhs = tableau.getEntry(i, tableau.getWidth() - 1); + final double entry = tableau.getEntry(i, col); + if (Precision.compareTo(entry, 0d, maxUlps) > 0) { + final double ratio = rhs / entry; + final int cmp = Double.compare(ratio, minRatio); + if (cmp == 0) { + minRatioPositions.add(i); + } else if (cmp < 0) { + minRatio = ratio; + minRatioPositions = new ArrayList(); + minRatioPositions.add(i); + } + } + } + if (minRatioPositions.size() == 0) { + return null; + } else if (minRatioPositions.size() > 1) { + for (Integer row : minRatioPositions) { + for (int i = 0; i < tableau.getNumArtificialVariables(); i++) { + int column = i + tableau.getArtificialVariableOffset(); + final double entry = tableau.getEntry(row, column); + if (Precision.equals(entry, 1d, maxUlps) && row.equals(tableau.getBasicRow(column))) { + return row; + } + } + } + Integer minRow = null; + int minIndex = tableau.getWidth(); + for (Integer row : minRatioPositions) { + int i = tableau.getNumObjectiveFunctions(); + for (; i < tableau.getWidth() - 1 && minRow != row; i++) { + if (row == tableau.getBasicRow(i)) { + if (i < minIndex) { + minIndex = i; + minRow = row; + } + } + } + } + return minRow; + } + return minRatioPositions.get(0); + } +"," private Integer getPivotRow(SimplexTableau tableau, final int col) { + List minRatioPositions = new ArrayList(); + double minRatio = Double.MAX_VALUE; + for (int i = tableau.getNumObjectiveFunctions(); i < tableau.getHeight(); i++) { + final double rhs = tableau.getEntry(i, tableau.getWidth() - 1); + final double entry = tableau.getEntry(i, col); + if (Precision.compareTo(entry, 0d, maxUlps) > 0) { + final double ratio = rhs / entry; + final int cmp = Double.compare(ratio, minRatio); + if (cmp == 0) { + minRatioPositions.add(i); + } else if (cmp < 0) { + minRatio = ratio; + minRatioPositions = new ArrayList(); + minRatioPositions.add(i); + } + } + } + if (minRatioPositions.size() == 0) { + return null; + } else if (minRatioPositions.size() > 1) { + if (tableau.getNumArtificialVariables() > 0) { + for (Integer row : minRatioPositions) { + for (int i = 0; i < tableau.getNumArtificialVariables(); i++) { + int column = i + tableau.getArtificialVariableOffset(); + final double entry = tableau.getEntry(row, column); + if (Precision.equals(entry, 1d, maxUlps) && row.equals(tableau.getBasicRow(column))) { + return row; + } + } + } + } + if (getIterations() < getMaxIterations() / 2) { + Integer minRow = null; + int minIndex = tableau.getWidth(); + for (Integer row : minRatioPositions) { + int i = tableau.getNumObjectiveFunctions(); + for (; i < tableau.getWidth() - 1 && minRow != row; i++) { + if (row == tableau.getBasicRow(i)) { + if (i < minIndex) { + minIndex = i; + minRow = row; + } + } + } + } + return minRow; + } + } + return minRatioPositions.get(0); + } +" +Closure-128," static boolean isSimpleNumber(String s) { + int len = s.length(); + for (int index = 0; index < len; index++) { + char c = s.charAt(index); + if (c < '0' || c > '9') { + return false; + } + } + return len > 0 && s.charAt(0) != '0'; + } +"," static boolean isSimpleNumber(String s) { + int len = s.length(); + if (len == 0) { + return false; + } + for (int index = 0; index < len; index++) { + char c = s.charAt(index); + if (c < '0' || c > '9') { + return false; + } + } + return len == 1 || s.charAt(0) != '0'; + } +" +Compress-37," Map parsePaxHeaders(final InputStream i) + throws IOException { + final Map headers = new HashMap(globalPaxHeaders); + while(true){ + int ch; + int len = 0; + int read = 0; + while((ch = i.read()) != -1) { + read++; + if (ch == ' '){ + final ByteArrayOutputStream coll = new ByteArrayOutputStream(); + while((ch = i.read()) != -1) { + read++; + if (ch == '='){ + final String keyword = coll.toString(CharsetNames.UTF_8); + final int restLen = len - read; + if (restLen == 1) { + headers.remove(keyword); + } else { + final byte[] rest = new byte[restLen]; + final int got = IOUtils.readFully(i, rest); + if (got != restLen) { + throw new IOException(""Failed to read "" + + ""Paxheader. Expected "" + + restLen + + "" bytes, read "" + + got); + } + final String value = new String(rest, 0, + restLen - 1, CharsetNames.UTF_8); + headers.put(keyword, value); + } + break; + } + coll.write((byte) ch); + } + break; + } + len *= 10; + len += ch - '0'; + } + if (ch == -1){ + break; + } + } + return headers; + } +"," Map parsePaxHeaders(final InputStream i) + throws IOException { + final Map headers = new HashMap(globalPaxHeaders); + while(true){ + int ch; + int len = 0; + int read = 0; + while((ch = i.read()) != -1) { + read++; + if (ch == '\n') { + break; + } else if (ch == ' '){ + final ByteArrayOutputStream coll = new ByteArrayOutputStream(); + while((ch = i.read()) != -1) { + read++; + if (ch == '='){ + final String keyword = coll.toString(CharsetNames.UTF_8); + final int restLen = len - read; + if (restLen == 1) { + headers.remove(keyword); + } else { + final byte[] rest = new byte[restLen]; + final int got = IOUtils.readFully(i, rest); + if (got != restLen) { + throw new IOException(""Failed to read "" + + ""Paxheader. Expected "" + + restLen + + "" bytes, read "" + + got); + } + final String value = new String(rest, 0, + restLen - 1, CharsetNames.UTF_8); + headers.put(keyword, value); + } + break; + } + coll.write((byte) ch); + } + break; + } + len *= 10; + len += ch - '0'; + } + if (ch == -1){ + break; + } + } + return headers; + } +" +Compress-7," public static String parseName(byte[] buffer, final int offset, final int length) { + StringBuffer result = new StringBuffer(length); + int end = offset + length; + for (int i = offset; i < end; ++i) { + if (buffer[i] == 0) { + break; + } + result.append((char) buffer[i]); + } + return result.toString(); + } +"," public static String parseName(byte[] buffer, final int offset, final int length) { + StringBuffer result = new StringBuffer(length); + int end = offset + length; + for (int i = offset; i < end; ++i) { + byte b = buffer[i]; + if (b == 0) { + break; + } + result.append((char) (b & 0xFF)); + } + return result.toString(); + } +" +Cli-4," private void checkRequiredOptions() + throws MissingOptionException + { + if (requiredOptions.size() > 0) + { + Iterator iter = requiredOptions.iterator(); + StringBuffer buff = new StringBuffer(); + while (iter.hasNext()) + { + buff.append(iter.next()); + } + throw new MissingOptionException(buff.toString()); + } + } +"," private void checkRequiredOptions() + throws MissingOptionException + { + if (requiredOptions.size() > 0) + { + Iterator iter = requiredOptions.iterator(); + StringBuffer buff = new StringBuffer(""Missing required option""); + buff.append(requiredOptions.size() == 1 ? """" : ""s""); + buff.append("": ""); + while (iter.hasNext()) + { + buff.append(iter.next()); + } + throw new MissingOptionException(buff.toString()); + } + } +" +Time-16," public int parseInto(ReadWritableInstant instant, String text, int position) { + DateTimeParser parser = requireParser(); + if (instant == null) { + throw new IllegalArgumentException(""Instant must not be null""); + } + long instantMillis = instant.getMillis(); + Chronology chrono = instant.getChronology(); + long instantLocal = instantMillis + chrono.getZone().getOffset(instantMillis); + chrono = selectChronology(chrono); + DateTimeParserBucket bucket = new DateTimeParserBucket( + instantLocal, chrono, iLocale, iPivotYear, iDefaultYear); + int newPos = parser.parseInto(bucket, text, position); + instant.setMillis(bucket.computeMillis(false, text)); + if (iOffsetParsed && bucket.getOffsetInteger() != null) { + int parsedOffset = bucket.getOffsetInteger(); + DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); + chrono = chrono.withZone(parsedZone); + } else if (bucket.getZone() != null) { + chrono = chrono.withZone(bucket.getZone()); + } + instant.setChronology(chrono); + if (iZone != null) { + instant.setZone(iZone); + } + return newPos; + } +"," public int parseInto(ReadWritableInstant instant, String text, int position) { + DateTimeParser parser = requireParser(); + if (instant == null) { + throw new IllegalArgumentException(""Instant must not be null""); + } + long instantMillis = instant.getMillis(); + Chronology chrono = instant.getChronology(); + long instantLocal = instantMillis + chrono.getZone().getOffset(instantMillis); + chrono = selectChronology(chrono); + DateTimeParserBucket bucket = new DateTimeParserBucket( + instantLocal, chrono, iLocale, iPivotYear, chrono.year().get(instantLocal)); + int newPos = parser.parseInto(bucket, text, position); + instant.setMillis(bucket.computeMillis(false, text)); + if (iOffsetParsed && bucket.getOffsetInteger() != null) { + int parsedOffset = bucket.getOffsetInteger(); + DateTimeZone parsedZone = DateTimeZone.forOffsetMillis(parsedOffset); + chrono = chrono.withZone(parsedZone); + } else if (bucket.getZone() != null) { + chrono = chrono.withZone(bucket.getZone()); + } + instant.setChronology(chrono); + if (iZone != null) { + instant.setZone(iZone); + } + return newPos; + } +" +Jsoup-42," public List formData() { + ArrayList data = new ArrayList(); + for (Element el: elements) { + if (!el.tag().isFormSubmittable()) continue; + String name = el.attr(""name""); + if (name.length() == 0) continue; + String type = el.attr(""type""); + if (""select"".equals(el.tagName())) { + Elements options = el.select(""option[selected]""); + boolean set = false; + for (Element option: options) { + data.add(HttpConnection.KeyVal.create(name, option.val())); + set = true; + } + if (!set) { + Element option = el.select(""option"").first(); + if (option != null) + data.add(HttpConnection.KeyVal.create(name, option.val())); + } + } else if (""checkbox"".equalsIgnoreCase(type) || ""radio"".equalsIgnoreCase(type)) { + if (el.hasAttr(""checked"")) { + final String val = el.val(); + data.add(HttpConnection.KeyVal.create(name, val)); + } + } else { + data.add(HttpConnection.KeyVal.create(name, el.val())); + } + } + return data; + } +"," public List formData() { + ArrayList data = new ArrayList(); + for (Element el: elements) { + if (!el.tag().isFormSubmittable()) continue; + if (el.hasAttr(""disabled"")) continue; + String name = el.attr(""name""); + if (name.length() == 0) continue; + String type = el.attr(""type""); + if (""select"".equals(el.tagName())) { + Elements options = el.select(""option[selected]""); + boolean set = false; + for (Element option: options) { + data.add(HttpConnection.KeyVal.create(name, option.val())); + set = true; + } + if (!set) { + Element option = el.select(""option"").first(); + if (option != null) + data.add(HttpConnection.KeyVal.create(name, option.val())); + } + } else if (""checkbox"".equalsIgnoreCase(type) || ""radio"".equalsIgnoreCase(type)) { + if (el.hasAttr(""checked"")) { + final String val = el.val().length() > 0 ? el.val() : ""on""; + data.add(HttpConnection.KeyVal.create(name, val)); + } + } else { + data.add(HttpConnection.KeyVal.create(name, el.val())); + } + } + return data; + } +" +Closure-166," public void matchConstraint(JSType constraint) { + if (hasReferenceName()) { + return; + } + if (constraint.isRecordType()) { + matchRecordTypeConstraint(constraint.toObjectType()); + } + } +"," public void matchConstraint(JSType constraint) { + if (hasReferenceName()) { + return; + } + if (constraint.isRecordType()) { + matchRecordTypeConstraint(constraint.toObjectType()); + } else if (constraint.isUnionType()) { + for (JSType alt : constraint.toMaybeUnionType().getAlternates()) { + if (alt.isRecordType()) { + matchRecordTypeConstraint(alt.toObjectType()); + } + } + } + } +" +Closure-87," private boolean isFoldableExpressBlock(Node n) { + if (n.getType() == Token.BLOCK) { + if (n.hasOneChild()) { + Node maybeExpr = n.getFirstChild(); + return NodeUtil.isExpressionNode(maybeExpr); + } + } + return false; + } +"," private boolean isFoldableExpressBlock(Node n) { + if (n.getType() == Token.BLOCK) { + if (n.hasOneChild()) { + Node maybeExpr = n.getFirstChild(); + if (maybeExpr.getType() == Token.EXPR_RESULT) { + if (maybeExpr.getFirstChild().getType() == Token.CALL) { + Node calledFn = maybeExpr.getFirstChild().getFirstChild(); + if (calledFn.getType() == Token.GETELEM) { + return false; + } else if (calledFn.getType() == Token.GETPROP && + calledFn.getLastChild().getString().startsWith(""on"")) { + return false; + } + } + return true; + } + return false; + } + } + return false; + } +" +JacksonDatabind-107," protected final JsonDeserializer _findDeserializer(DeserializationContext ctxt, + String typeId) throws IOException + { + JsonDeserializer deser = _deserializers.get(typeId); + if (deser == null) { + JavaType type = _idResolver.typeFromId(ctxt, typeId); + if (type == null) { + deser = _findDefaultImplDeserializer(ctxt); + if (deser == null) { + JavaType actual = _handleUnknownTypeId(ctxt, typeId); + if (actual == null) { + return null; + } + deser = ctxt.findContextualValueDeserializer(actual, _property); + } + } else { + if ((_baseType != null) + && _baseType.getClass() == type.getClass()) { + if (!type.hasGenericTypes()) { + type = ctxt.getTypeFactory().constructSpecializedType(_baseType, type.getRawClass()); + } + } + deser = ctxt.findContextualValueDeserializer(type, _property); + } + _deserializers.put(typeId, deser); + } + return deser; + } +"," protected final JsonDeserializer _findDeserializer(DeserializationContext ctxt, + String typeId) throws IOException + { + JsonDeserializer deser = _deserializers.get(typeId); + if (deser == null) { + JavaType type = _idResolver.typeFromId(ctxt, typeId); + if (type == null) { + deser = _findDefaultImplDeserializer(ctxt); + if (deser == null) { + JavaType actual = _handleUnknownTypeId(ctxt, typeId); + if (actual == null) { + return NullifyingDeserializer.instance; + } + deser = ctxt.findContextualValueDeserializer(actual, _property); + } + } else { + if ((_baseType != null) + && _baseType.getClass() == type.getClass()) { + if (!type.hasGenericTypes()) { + type = ctxt.getTypeFactory().constructSpecializedType(_baseType, type.getRawClass()); + } + } + deser = ctxt.findContextualValueDeserializer(type, _property); + } + _deserializers.put(typeId, deser); + } + return deser; + } +" +Jsoup-62," boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { + String name = t.asEndTag().normalName(); + ArrayList stack = tb.getStack(); + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element node = stack.get(pos); + if (node.nodeName().equals(name)) { + tb.generateImpliedEndTags(name); + if (!name.equals(tb.currentElement().nodeName())) + tb.error(this); + tb.popStackToClose(name); + break; + } else { + if (tb.isSpecial(node)) { + tb.error(this); + return false; + } + } + } + return true; + } +"," boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { + String name = t.asEndTag().name(); + ArrayList stack = tb.getStack(); + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element node = stack.get(pos); + if (node.nodeName().equals(name)) { + tb.generateImpliedEndTags(name); + if (!name.equals(tb.currentElement().nodeName())) + tb.error(this); + tb.popStackToClose(name); + break; + } else { + if (tb.isSpecial(node)) { + tb.error(this); + return false; + } + } + } + return true; + } +" +JacksonDatabind-37," protected JavaType _narrow(Class subclass) + { + if (_class == subclass) { + return this; + } + return new SimpleType(subclass, _bindings, _superClass, _superInterfaces, + _valueHandler, _typeHandler, _asStatic); + } +"," protected JavaType _narrow(Class subclass) + { + if (_class == subclass) { + return this; + } + return new SimpleType(subclass, _bindings, this, _superInterfaces, + _valueHandler, _typeHandler, _asStatic); + } +" +Math-51," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + default: + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +"," protected final double doSolve() { + double x0 = getMin(); + double x1 = getMax(); + double f0 = computeObjectiveValue(x0); + double f1 = computeObjectiveValue(x1); + if (f0 == 0.0) { + return x0; + } + if (f1 == 0.0) { + return x1; + } + verifyBracketing(x0, x1); + final double ftol = getFunctionValueAccuracy(); + final double atol = getAbsoluteAccuracy(); + final double rtol = getRelativeAccuracy(); + boolean inverted = false; + while (true) { + final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0)); + final double fx = computeObjectiveValue(x); + if (fx == 0.0) { + return x; + } + if (f1 * fx < 0) { + x0 = x1; + f0 = f1; + inverted = !inverted; + } else { + switch (method) { + case ILLINOIS: + f0 *= 0.5; + break; + case PEGASUS: + f0 *= f1 / (f1 + fx); + break; + case REGULA_FALSI: + if (x == x1) { + final double delta = FastMath.max(rtol * FastMath.abs(x1), + atol); + x0 = 0.5 * (x0 + x1 - delta); + f0 = computeObjectiveValue(x0); + } + break; + default: + throw new MathInternalError(); + } + } + x1 = x; + f1 = fx; + if (FastMath.abs(f1) <= ftol) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + if (inverted) { + return x1; + } + break; + case RIGHT_SIDE: + if (!inverted) { + return x1; + } + break; + case BELOW_SIDE: + if (f1 <= 0) { + return x1; + } + break; + case ABOVE_SIDE: + if (f1 >= 0) { + return x1; + } + break; + default: + throw new MathInternalError(); + } + } + if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), + atol)) { + switch (allowed) { + case ANY_SIDE: + return x1; + case LEFT_SIDE: + return inverted ? x1 : x0; + case RIGHT_SIDE: + return inverted ? x0 : x1; + case BELOW_SIDE: + return (f1 <= 0) ? x1 : x0; + case ABOVE_SIDE: + return (f1 >= 0) ? x1 : x0; + default: + throw new MathInternalError(); + } + } + } + } +" +JacksonDatabind-100," public byte[] getBinaryValue(Base64Variant b64variant) + throws IOException, JsonParseException + { + JsonNode n = currentNode(); + if (n != null) { + byte[] data = n.binaryValue(); + if (data != null) { + return data; + } + if (n.isPojo()) { + Object ob = ((POJONode) n).getPojo(); + if (ob instanceof byte[]) { + return (byte[]) ob; + } + } + } + return null; + } +"," public byte[] getBinaryValue(Base64Variant b64variant) + throws IOException, JsonParseException + { + JsonNode n = currentNode(); + if (n != null) { + if (n instanceof TextNode) { + return ((TextNode) n).getBinaryValue(b64variant); + } + return n.binaryValue(); + } + return null; + } +" +Time-20," public int parseInto(DateTimeParserBucket bucket, String text, int position) { + String str = text.substring(position); + for (String id : ALL_IDS) { + if (str.startsWith(id)) { + bucket.setZone(DateTimeZone.forID(id)); + return position + id.length(); + } + } + return ~position; + } +"," public int parseInto(DateTimeParserBucket bucket, String text, int position) { + String str = text.substring(position); + String best = null; + for (String id : ALL_IDS) { + if (str.startsWith(id)) { + if (best == null || id.length() > best.length()) { + best = id; + } + } + } + if (best != null) { + bucket.setZone(DateTimeZone.forID(best)); + return position + best.length(); + } + return ~position; + } +" +Jsoup-68," private boolean inSpecificScope(String[] targetNames, String[] baseTypes, String[] extraTypes) { + int bottom = stack.size() -1; + if (bottom > MaxScopeSearchDepth) { + bottom = MaxScopeSearchDepth; + } + final int top = bottom > MaxScopeSearchDepth ? bottom - MaxScopeSearchDepth : 0; + for (int pos = bottom; pos >= top; pos--) { + final String elName = stack.get(pos).nodeName(); + if (inSorted(elName, targetNames)) + return true; + if (inSorted(elName, baseTypes)) + return false; + if (extraTypes != null && inSorted(elName, extraTypes)) + return false; + } + return false; + } +"," private boolean inSpecificScope(String[] targetNames, String[] baseTypes, String[] extraTypes) { + final int bottom = stack.size() -1; + final int top = bottom > MaxScopeSearchDepth ? bottom - MaxScopeSearchDepth : 0; + for (int pos = bottom; pos >= top; pos--) { + final String elName = stack.get(pos).nodeName(); + if (inSorted(elName, targetNames)) + return true; + if (inSorted(elName, baseTypes)) + return false; + if (extraTypes != null && inSorted(elName, extraTypes)) + return false; + } + return false; + } +" +Jsoup-51," boolean matchesLetter() { + if (isEmpty()) + return false; + char c = input[pos]; + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } +"," boolean matchesLetter() { + if (isEmpty()) + return false; + char c = input[pos]; + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || Character.isLetter(c); + } +" +Gson-18," static Type getSupertype(Type context, Class contextRawType, Class supertype) { + checkArgument(supertype.isAssignableFrom(contextRawType)); + return resolve(context, contextRawType, + $Gson$Types.getGenericSupertype(context, contextRawType, supertype)); + } +"," static Type getSupertype(Type context, Class contextRawType, Class supertype) { + if (context instanceof WildcardType) { + context = ((WildcardType)context).getUpperBounds()[0]; + } + checkArgument(supertype.isAssignableFrom(contextRawType)); + return resolve(context, contextRawType, + $Gson$Types.getGenericSupertype(context, contextRawType, supertype)); + } +" +Closure-88," private VariableLiveness isVariableReadBeforeKill( + Node n, String variable) { + if (NodeUtil.isName(n) && variable.equals(n.getString())) { + if (NodeUtil.isLhs(n, n.getParent())) { + return VariableLiveness.KILL; + } else { + return VariableLiveness.READ; + } + } + for (Node child = n.getFirstChild(); + child != null; child = child.getNext()) { + if (!ControlFlowGraph.isEnteringNewCfgNode(child)) { + VariableLiveness state = isVariableReadBeforeKill(child, variable); + if (state != VariableLiveness.MAYBE_LIVE) { + return state; + } + } + } + return VariableLiveness.MAYBE_LIVE; + } +"," private VariableLiveness isVariableReadBeforeKill( + Node n, String variable) { + if (NodeUtil.isName(n) && variable.equals(n.getString())) { + if (NodeUtil.isLhs(n, n.getParent())) { + Preconditions.checkState(n.getParent().getType() == Token.ASSIGN); + Node rhs = n.getNext(); + VariableLiveness state = isVariableReadBeforeKill(rhs, variable); + if (state == VariableLiveness.READ) { + return state; + } + return VariableLiveness.KILL; + } else { + return VariableLiveness.READ; + } + } + for (Node child = n.getFirstChild(); + child != null; child = child.getNext()) { + if (!ControlFlowGraph.isEnteringNewCfgNode(child)) { + VariableLiveness state = isVariableReadBeforeKill(child, variable); + if (state != VariableLiveness.MAYBE_LIVE) { + return state; + } + } + } + return VariableLiveness.MAYBE_LIVE; + } +" +Closure-123," void add(Node n, Context context) { + if (!cc.continueProcessing()) { + return; + } + int type = n.getType(); + String opstr = NodeUtil.opToStr(type); + int childCount = n.getChildCount(); + Node first = n.getFirstChild(); + Node last = n.getLastChild(); + if (opstr != null && first != last) { + Preconditions.checkState( + childCount == 2, + ""Bad binary operator \""%s\"": expected 2 arguments but got %s"", + opstr, childCount); + int p = NodeUtil.precedence(type); + Context rhsContext = getContextForNoInOperator(context); + if (last.getType() == type && + NodeUtil.isAssociative(type)) { + addExpr(first, p, context); + cc.addOp(opstr, true); + addExpr(last, p, rhsContext); + } else if (NodeUtil.isAssignmentOp(n) && NodeUtil.isAssignmentOp(last)) { + addExpr(first, p, context); + cc.addOp(opstr, true); + addExpr(last, p, rhsContext); + } else { + unrollBinaryOperator(n, type, opstr, context, rhsContext, p, p + 1); + } + return; + } + cc.startSourceMapping(n); + switch (type) { + case Token.TRY: { + Preconditions.checkState(first.getNext().isBlock() && + !first.getNext().hasMoreThanOneChild()); + Preconditions.checkState(childCount >= 2 && childCount <= 3); + add(""try""); + add(first, Context.PRESERVE_BLOCK); + Node catchblock = first.getNext().getFirstChild(); + if (catchblock != null) { + add(catchblock); + } + if (childCount == 3) { + add(""finally""); + add(last, Context.PRESERVE_BLOCK); + } + break; + } + case Token.CATCH: + Preconditions.checkState(childCount == 2); + add(""catch(""); + add(first); + add("")""); + add(last, Context.PRESERVE_BLOCK); + break; + case Token.THROW: + Preconditions.checkState(childCount == 1); + add(""throw""); + add(first); + cc.endStatement(true); + break; + case Token.RETURN: + add(""return""); + if (childCount == 1) { + add(first); + } else { + Preconditions.checkState(childCount == 0); + } + cc.endStatement(); + break; + case Token.VAR: + if (first != null) { + add(""var ""); + addList(first, false, getContextForNoInOperator(context)); + } + break; + case Token.LABEL_NAME: + Preconditions.checkState(!n.getString().isEmpty()); + addIdentifier(n.getString()); + break; + case Token.NAME: + if (first == null || first.isEmpty()) { + addIdentifier(n.getString()); + } else { + Preconditions.checkState(childCount == 1); + addIdentifier(n.getString()); + cc.addOp(""="", true); + if (first.isComma()) { + addExpr(first, NodeUtil.precedence(Token.ASSIGN), Context.OTHER); + } else { + addExpr(first, 0, getContextForNoInOperator(context)); + } + } + break; + case Token.ARRAYLIT: + add(""[""); + addArrayList(first); + add(""]""); + break; + case Token.PARAM_LIST: + add(""(""); + addList(first); + add("")""); + break; + case Token.COMMA: + Preconditions.checkState(childCount == 2); + unrollBinaryOperator(n, Token.COMMA, "","", context, + getContextForNoInOperator(context), 0, 0); + break; + case Token.NUMBER: + Preconditions.checkState(childCount == 0); + cc.addNumber(n.getDouble()); + break; + case Token.TYPEOF: + case Token.VOID: + case Token.NOT: + case Token.BITNOT: + case Token.POS: { + Preconditions.checkState(childCount == 1); + cc.addOp(NodeUtil.opToStrNoFail(type), false); + addExpr(first, NodeUtil.precedence(type), Context.OTHER); + break; + } + case Token.NEG: { + Preconditions.checkState(childCount == 1); + if (n.getFirstChild().isNumber()) { + cc.addNumber(-n.getFirstChild().getDouble()); + } else { + cc.addOp(NodeUtil.opToStrNoFail(type), false); + addExpr(first, NodeUtil.precedence(type), Context.OTHER); + } + break; + } + case Token.HOOK: { + Preconditions.checkState(childCount == 3); + int p = NodeUtil.precedence(type); + Context rhsContext = Context.OTHER; + addExpr(first, p + 1, context); + cc.addOp(""?"", true); + addExpr(first.getNext(), 1, rhsContext); + cc.addOp("":"", true); + addExpr(last, 1, rhsContext); + break; + } + case Token.REGEXP: + if (!first.isString() || + !last.isString()) { + throw new Error(""Expected children to be strings""); + } + String regexp = regexpEscape(first.getString(), outputCharsetEncoder); + if (childCount == 2) { + add(regexp + last.getString()); + } else { + Preconditions.checkState(childCount == 1); + add(regexp); + } + break; + case Token.FUNCTION: + if (n.getClass() != Node.class) { + throw new Error(""Unexpected Node subclass.""); + } + Preconditions.checkState(childCount == 3); + boolean funcNeedsParens = (context == Context.START_OF_EXPR); + if (funcNeedsParens) { + add(""(""); + } + add(""function""); + add(first); + add(first.getNext()); + add(last, Context.PRESERVE_BLOCK); + cc.endFunction(context == Context.STATEMENT); + if (funcNeedsParens) { + add("")""); + } + break; + case Token.GETTER_DEF: + case Token.SETTER_DEF: + Preconditions.checkState(n.getParent().isObjectLit()); + Preconditions.checkState(childCount == 1); + Preconditions.checkState(first.isFunction()); + Preconditions.checkState(first.getFirstChild().getString().isEmpty()); + if (type == Token.GETTER_DEF) { + Preconditions.checkState(!first.getChildAtIndex(1).hasChildren()); + add(""get ""); + } else { + Preconditions.checkState(first.getChildAtIndex(1).hasOneChild()); + add(""set ""); + } + String name = n.getString(); + Node fn = first; + Node parameters = fn.getChildAtIndex(1); + Node body = fn.getLastChild(); + if (!n.isQuotedString() && + TokenStream.isJSIdentifier(name) && + NodeUtil.isLatin(name)) { + add(name); + } else { + double d = getSimpleNumber(name); + if (!Double.isNaN(d)) { + cc.addNumber(d); + } else { + addJsString(n); + } + } + add(parameters); + add(body, Context.PRESERVE_BLOCK); + break; + case Token.SCRIPT: + case Token.BLOCK: { + if (n.getClass() != Node.class) { + throw new Error(""Unexpected Node subclass.""); + } + boolean preserveBlock = context == Context.PRESERVE_BLOCK; + if (preserveBlock) { + cc.beginBlock(); + } + boolean preferLineBreaks = + type == Token.SCRIPT || + (type == Token.BLOCK && + !preserveBlock && + n.getParent() != null && + n.getParent().isScript()); + for (Node c = first; c != null; c = c.getNext()) { + add(c, Context.STATEMENT); + if (c.isVar()) { + cc.endStatement(); + } + if (c.isFunction()) { + cc.maybeLineBreak(); + } + if (preferLineBreaks) { + cc.notePreferredLineBreak(); + } + } + if (preserveBlock) { + cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT)); + } + break; + } + case Token.FOR: + if (childCount == 4) { + add(""for(""); + if (first.isVar()) { + add(first, Context.IN_FOR_INIT_CLAUSE); + } else { + addExpr(first, 0, Context.IN_FOR_INIT_CLAUSE); + } + add("";""); + add(first.getNext()); + add("";""); + add(first.getNext().getNext()); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } else { + Preconditions.checkState(childCount == 3); + add(""for(""); + add(first); + add(""in""); + add(first.getNext()); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } + break; + case Token.DO: + Preconditions.checkState(childCount == 2); + add(""do""); + addNonEmptyStatement(first, Context.OTHER, false); + add(""while(""); + add(last); + add("")""); + cc.endStatement(); + break; + case Token.WHILE: + Preconditions.checkState(childCount == 2); + add(""while(""); + add(first); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + break; + case Token.EMPTY: + Preconditions.checkState(childCount == 0); + break; + case Token.GETPROP: { + Preconditions.checkState( + childCount == 2, + ""Bad GETPROP: expected 2 children, but got %s"", childCount); + Preconditions.checkState( + last.isString(), + ""Bad GETPROP: RHS should be STRING""); + boolean needsParens = (first.isNumber()); + if (needsParens) { + add(""(""); + } + addExpr(first, NodeUtil.precedence(type), context); + if (needsParens) { + add("")""); + } + if (this.languageMode == LanguageMode.ECMASCRIPT3 + && TokenStream.isKeyword(last.getString())) { + add(""[""); + add(last); + add(""]""); + } else { + add("".""); + addIdentifier(last.getString()); + } + break; + } + case Token.GETELEM: + Preconditions.checkState( + childCount == 2, + ""Bad GETELEM: expected 2 children but got %s"", childCount); + addExpr(first, NodeUtil.precedence(type), context); + add(""[""); + add(first.getNext()); + add(""]""); + break; + case Token.WITH: + Preconditions.checkState(childCount == 2); + add(""with(""); + add(first); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + break; + case Token.INC: + case Token.DEC: { + Preconditions.checkState(childCount == 1); + String o = type == Token.INC ? ""++"" : ""--""; + int postProp = n.getIntProp(Node.INCRDECR_PROP); + if (postProp != 0) { + addExpr(first, NodeUtil.precedence(type), context); + cc.addOp(o, false); + } else { + cc.addOp(o, false); + add(first); + } + break; + } + case Token.CALL: + if (isIndirectEval(first) + || n.getBooleanProp(Node.FREE_CALL) && NodeUtil.isGet(first)) { + add(""(0,""); + addExpr(first, NodeUtil.precedence(Token.COMMA), Context.OTHER); + add("")""); + } else { + addExpr(first, NodeUtil.precedence(type), context); + } + add(""(""); + addList(first.getNext()); + add("")""); + break; + case Token.IF: + boolean hasElse = childCount == 3; + boolean ambiguousElseClause = + context == Context.BEFORE_DANGLING_ELSE && !hasElse; + if (ambiguousElseClause) { + cc.beginBlock(); + } + add(""if(""); + add(first); + add("")""); + if (hasElse) { + addNonEmptyStatement( + first.getNext(), Context.BEFORE_DANGLING_ELSE, false); + add(""else""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } else { + addNonEmptyStatement(first.getNext(), Context.OTHER, false); + Preconditions.checkState(childCount == 2); + } + if (ambiguousElseClause) { + cc.endBlock(); + } + break; + case Token.NULL: + Preconditions.checkState(childCount == 0); + cc.addConstant(""null""); + break; + case Token.THIS: + Preconditions.checkState(childCount == 0); + add(""this""); + break; + case Token.FALSE: + Preconditions.checkState(childCount == 0); + cc.addConstant(""false""); + break; + case Token.TRUE: + Preconditions.checkState(childCount == 0); + cc.addConstant(""true""); + break; + case Token.CONTINUE: + Preconditions.checkState(childCount <= 1); + add(""continue""); + if (childCount == 1) { + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add("" ""); + add(first); + } + cc.endStatement(); + break; + case Token.DEBUGGER: + Preconditions.checkState(childCount == 0); + add(""debugger""); + cc.endStatement(); + break; + case Token.BREAK: + Preconditions.checkState(childCount <= 1); + add(""break""); + if (childCount == 1) { + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add("" ""); + add(first); + } + cc.endStatement(); + break; + case Token.EXPR_RESULT: + Preconditions.checkState(childCount == 1); + add(first, Context.START_OF_EXPR); + cc.endStatement(); + break; + case Token.NEW: + add(""new ""); + int precedence = NodeUtil.precedence(type); + if (NodeUtil.containsType( + first, Token.CALL, NodeUtil.MATCH_NOT_FUNCTION)) { + precedence = NodeUtil.precedence(first.getType()) + 1; + } + addExpr(first, precedence, Context.OTHER); + Node next = first.getNext(); + if (next != null) { + add(""(""); + addList(next); + add("")""); + } + break; + case Token.STRING_KEY: + Preconditions.checkState( + childCount == 1, ""Object lit key must have 1 child""); + addJsString(n); + break; + case Token.STRING: + Preconditions.checkState( + childCount == 0, ""A string may not have children""); + addJsString(n); + break; + case Token.DELPROP: + Preconditions.checkState(childCount == 1); + add(""delete ""); + add(first); + break; + case Token.OBJECTLIT: { + boolean needsParens = (context == Context.START_OF_EXPR); + if (needsParens) { + add(""(""); + } + add(""{""); + for (Node c = first; c != null; c = c.getNext()) { + if (c != first) { + cc.listSeparator(); + } + if (c.isGetterDef() || c.isSetterDef()) { + add(c); + } else { + Preconditions.checkState(c.isStringKey()); + String key = c.getString(); + if (!c.isQuotedString() + && !(languageMode == LanguageMode.ECMASCRIPT3 + && TokenStream.isKeyword(key)) + && TokenStream.isJSIdentifier(key) + && NodeUtil.isLatin(key)) { + add(key); + } else { + double d = getSimpleNumber(key); + if (!Double.isNaN(d)) { + cc.addNumber(d); + } else { + addExpr(c, 1, Context.OTHER); + } + } + add("":""); + addExpr(c.getFirstChild(), 1, Context.OTHER); + } + } + add(""}""); + if (needsParens) { + add("")""); + } + break; + } + case Token.SWITCH: + add(""switch(""); + add(first); + add("")""); + cc.beginBlock(); + addAllSiblings(first.getNext()); + cc.endBlock(context == Context.STATEMENT); + break; + case Token.CASE: + Preconditions.checkState(childCount == 2); + add(""case ""); + add(first); + addCaseBody(last); + break; + case Token.DEFAULT_CASE: + Preconditions.checkState(childCount == 1); + add(""default""); + addCaseBody(first); + break; + case Token.LABEL: + Preconditions.checkState(childCount == 2); + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add(first); + add("":""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), true); + break; + case Token.CAST: + add(""(""); + add(first); + add("")""); + break; + default: + throw new Error(""Unknown type "" + type + ""\n"" + n.toStringTree()); + } + cc.endSourceMapping(n); + } +"," void add(Node n, Context context) { + if (!cc.continueProcessing()) { + return; + } + int type = n.getType(); + String opstr = NodeUtil.opToStr(type); + int childCount = n.getChildCount(); + Node first = n.getFirstChild(); + Node last = n.getLastChild(); + if (opstr != null && first != last) { + Preconditions.checkState( + childCount == 2, + ""Bad binary operator \""%s\"": expected 2 arguments but got %s"", + opstr, childCount); + int p = NodeUtil.precedence(type); + Context rhsContext = getContextForNoInOperator(context); + if (last.getType() == type && + NodeUtil.isAssociative(type)) { + addExpr(first, p, context); + cc.addOp(opstr, true); + addExpr(last, p, rhsContext); + } else if (NodeUtil.isAssignmentOp(n) && NodeUtil.isAssignmentOp(last)) { + addExpr(first, p, context); + cc.addOp(opstr, true); + addExpr(last, p, rhsContext); + } else { + unrollBinaryOperator(n, type, opstr, context, rhsContext, p, p + 1); + } + return; + } + cc.startSourceMapping(n); + switch (type) { + case Token.TRY: { + Preconditions.checkState(first.getNext().isBlock() && + !first.getNext().hasMoreThanOneChild()); + Preconditions.checkState(childCount >= 2 && childCount <= 3); + add(""try""); + add(first, Context.PRESERVE_BLOCK); + Node catchblock = first.getNext().getFirstChild(); + if (catchblock != null) { + add(catchblock); + } + if (childCount == 3) { + add(""finally""); + add(last, Context.PRESERVE_BLOCK); + } + break; + } + case Token.CATCH: + Preconditions.checkState(childCount == 2); + add(""catch(""); + add(first); + add("")""); + add(last, Context.PRESERVE_BLOCK); + break; + case Token.THROW: + Preconditions.checkState(childCount == 1); + add(""throw""); + add(first); + cc.endStatement(true); + break; + case Token.RETURN: + add(""return""); + if (childCount == 1) { + add(first); + } else { + Preconditions.checkState(childCount == 0); + } + cc.endStatement(); + break; + case Token.VAR: + if (first != null) { + add(""var ""); + addList(first, false, getContextForNoInOperator(context)); + } + break; + case Token.LABEL_NAME: + Preconditions.checkState(!n.getString().isEmpty()); + addIdentifier(n.getString()); + break; + case Token.NAME: + if (first == null || first.isEmpty()) { + addIdentifier(n.getString()); + } else { + Preconditions.checkState(childCount == 1); + addIdentifier(n.getString()); + cc.addOp(""="", true); + if (first.isComma()) { + addExpr(first, NodeUtil.precedence(Token.ASSIGN), Context.OTHER); + } else { + addExpr(first, 0, getContextForNoInOperator(context)); + } + } + break; + case Token.ARRAYLIT: + add(""[""); + addArrayList(first); + add(""]""); + break; + case Token.PARAM_LIST: + add(""(""); + addList(first); + add("")""); + break; + case Token.COMMA: + Preconditions.checkState(childCount == 2); + unrollBinaryOperator(n, Token.COMMA, "","", context, + getContextForNoInOperator(context), 0, 0); + break; + case Token.NUMBER: + Preconditions.checkState(childCount == 0); + cc.addNumber(n.getDouble()); + break; + case Token.TYPEOF: + case Token.VOID: + case Token.NOT: + case Token.BITNOT: + case Token.POS: { + Preconditions.checkState(childCount == 1); + cc.addOp(NodeUtil.opToStrNoFail(type), false); + addExpr(first, NodeUtil.precedence(type), Context.OTHER); + break; + } + case Token.NEG: { + Preconditions.checkState(childCount == 1); + if (n.getFirstChild().isNumber()) { + cc.addNumber(-n.getFirstChild().getDouble()); + } else { + cc.addOp(NodeUtil.opToStrNoFail(type), false); + addExpr(first, NodeUtil.precedence(type), Context.OTHER); + } + break; + } + case Token.HOOK: { + Preconditions.checkState(childCount == 3); + int p = NodeUtil.precedence(type); + Context rhsContext = getContextForNoInOperator(context); + addExpr(first, p + 1, context); + cc.addOp(""?"", true); + addExpr(first.getNext(), 1, rhsContext); + cc.addOp("":"", true); + addExpr(last, 1, rhsContext); + break; + } + case Token.REGEXP: + if (!first.isString() || + !last.isString()) { + throw new Error(""Expected children to be strings""); + } + String regexp = regexpEscape(first.getString(), outputCharsetEncoder); + if (childCount == 2) { + add(regexp + last.getString()); + } else { + Preconditions.checkState(childCount == 1); + add(regexp); + } + break; + case Token.FUNCTION: + if (n.getClass() != Node.class) { + throw new Error(""Unexpected Node subclass.""); + } + Preconditions.checkState(childCount == 3); + boolean funcNeedsParens = (context == Context.START_OF_EXPR); + if (funcNeedsParens) { + add(""(""); + } + add(""function""); + add(first); + add(first.getNext()); + add(last, Context.PRESERVE_BLOCK); + cc.endFunction(context == Context.STATEMENT); + if (funcNeedsParens) { + add("")""); + } + break; + case Token.GETTER_DEF: + case Token.SETTER_DEF: + Preconditions.checkState(n.getParent().isObjectLit()); + Preconditions.checkState(childCount == 1); + Preconditions.checkState(first.isFunction()); + Preconditions.checkState(first.getFirstChild().getString().isEmpty()); + if (type == Token.GETTER_DEF) { + Preconditions.checkState(!first.getChildAtIndex(1).hasChildren()); + add(""get ""); + } else { + Preconditions.checkState(first.getChildAtIndex(1).hasOneChild()); + add(""set ""); + } + String name = n.getString(); + Node fn = first; + Node parameters = fn.getChildAtIndex(1); + Node body = fn.getLastChild(); + if (!n.isQuotedString() && + TokenStream.isJSIdentifier(name) && + NodeUtil.isLatin(name)) { + add(name); + } else { + double d = getSimpleNumber(name); + if (!Double.isNaN(d)) { + cc.addNumber(d); + } else { + addJsString(n); + } + } + add(parameters); + add(body, Context.PRESERVE_BLOCK); + break; + case Token.SCRIPT: + case Token.BLOCK: { + if (n.getClass() != Node.class) { + throw new Error(""Unexpected Node subclass.""); + } + boolean preserveBlock = context == Context.PRESERVE_BLOCK; + if (preserveBlock) { + cc.beginBlock(); + } + boolean preferLineBreaks = + type == Token.SCRIPT || + (type == Token.BLOCK && + !preserveBlock && + n.getParent() != null && + n.getParent().isScript()); + for (Node c = first; c != null; c = c.getNext()) { + add(c, Context.STATEMENT); + if (c.isVar()) { + cc.endStatement(); + } + if (c.isFunction()) { + cc.maybeLineBreak(); + } + if (preferLineBreaks) { + cc.notePreferredLineBreak(); + } + } + if (preserveBlock) { + cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT)); + } + break; + } + case Token.FOR: + if (childCount == 4) { + add(""for(""); + if (first.isVar()) { + add(first, Context.IN_FOR_INIT_CLAUSE); + } else { + addExpr(first, 0, Context.IN_FOR_INIT_CLAUSE); + } + add("";""); + add(first.getNext()); + add("";""); + add(first.getNext().getNext()); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } else { + Preconditions.checkState(childCount == 3); + add(""for(""); + add(first); + add(""in""); + add(first.getNext()); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } + break; + case Token.DO: + Preconditions.checkState(childCount == 2); + add(""do""); + addNonEmptyStatement(first, Context.OTHER, false); + add(""while(""); + add(last); + add("")""); + cc.endStatement(); + break; + case Token.WHILE: + Preconditions.checkState(childCount == 2); + add(""while(""); + add(first); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + break; + case Token.EMPTY: + Preconditions.checkState(childCount == 0); + break; + case Token.GETPROP: { + Preconditions.checkState( + childCount == 2, + ""Bad GETPROP: expected 2 children, but got %s"", childCount); + Preconditions.checkState( + last.isString(), + ""Bad GETPROP: RHS should be STRING""); + boolean needsParens = (first.isNumber()); + if (needsParens) { + add(""(""); + } + addExpr(first, NodeUtil.precedence(type), context); + if (needsParens) { + add("")""); + } + if (this.languageMode == LanguageMode.ECMASCRIPT3 + && TokenStream.isKeyword(last.getString())) { + add(""[""); + add(last); + add(""]""); + } else { + add("".""); + addIdentifier(last.getString()); + } + break; + } + case Token.GETELEM: + Preconditions.checkState( + childCount == 2, + ""Bad GETELEM: expected 2 children but got %s"", childCount); + addExpr(first, NodeUtil.precedence(type), context); + add(""[""); + add(first.getNext()); + add(""]""); + break; + case Token.WITH: + Preconditions.checkState(childCount == 2); + add(""with(""); + add(first); + add("")""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + break; + case Token.INC: + case Token.DEC: { + Preconditions.checkState(childCount == 1); + String o = type == Token.INC ? ""++"" : ""--""; + int postProp = n.getIntProp(Node.INCRDECR_PROP); + if (postProp != 0) { + addExpr(first, NodeUtil.precedence(type), context); + cc.addOp(o, false); + } else { + cc.addOp(o, false); + add(first); + } + break; + } + case Token.CALL: + if (isIndirectEval(first) + || n.getBooleanProp(Node.FREE_CALL) && NodeUtil.isGet(first)) { + add(""(0,""); + addExpr(first, NodeUtil.precedence(Token.COMMA), Context.OTHER); + add("")""); + } else { + addExpr(first, NodeUtil.precedence(type), context); + } + add(""(""); + addList(first.getNext()); + add("")""); + break; + case Token.IF: + boolean hasElse = childCount == 3; + boolean ambiguousElseClause = + context == Context.BEFORE_DANGLING_ELSE && !hasElse; + if (ambiguousElseClause) { + cc.beginBlock(); + } + add(""if(""); + add(first); + add("")""); + if (hasElse) { + addNonEmptyStatement( + first.getNext(), Context.BEFORE_DANGLING_ELSE, false); + add(""else""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), false); + } else { + addNonEmptyStatement(first.getNext(), Context.OTHER, false); + Preconditions.checkState(childCount == 2); + } + if (ambiguousElseClause) { + cc.endBlock(); + } + break; + case Token.NULL: + Preconditions.checkState(childCount == 0); + cc.addConstant(""null""); + break; + case Token.THIS: + Preconditions.checkState(childCount == 0); + add(""this""); + break; + case Token.FALSE: + Preconditions.checkState(childCount == 0); + cc.addConstant(""false""); + break; + case Token.TRUE: + Preconditions.checkState(childCount == 0); + cc.addConstant(""true""); + break; + case Token.CONTINUE: + Preconditions.checkState(childCount <= 1); + add(""continue""); + if (childCount == 1) { + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add("" ""); + add(first); + } + cc.endStatement(); + break; + case Token.DEBUGGER: + Preconditions.checkState(childCount == 0); + add(""debugger""); + cc.endStatement(); + break; + case Token.BREAK: + Preconditions.checkState(childCount <= 1); + add(""break""); + if (childCount == 1) { + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add("" ""); + add(first); + } + cc.endStatement(); + break; + case Token.EXPR_RESULT: + Preconditions.checkState(childCount == 1); + add(first, Context.START_OF_EXPR); + cc.endStatement(); + break; + case Token.NEW: + add(""new ""); + int precedence = NodeUtil.precedence(type); + if (NodeUtil.containsType( + first, Token.CALL, NodeUtil.MATCH_NOT_FUNCTION)) { + precedence = NodeUtil.precedence(first.getType()) + 1; + } + addExpr(first, precedence, Context.OTHER); + Node next = first.getNext(); + if (next != null) { + add(""(""); + addList(next); + add("")""); + } + break; + case Token.STRING_KEY: + Preconditions.checkState( + childCount == 1, ""Object lit key must have 1 child""); + addJsString(n); + break; + case Token.STRING: + Preconditions.checkState( + childCount == 0, ""A string may not have children""); + addJsString(n); + break; + case Token.DELPROP: + Preconditions.checkState(childCount == 1); + add(""delete ""); + add(first); + break; + case Token.OBJECTLIT: { + boolean needsParens = (context == Context.START_OF_EXPR); + if (needsParens) { + add(""(""); + } + add(""{""); + for (Node c = first; c != null; c = c.getNext()) { + if (c != first) { + cc.listSeparator(); + } + if (c.isGetterDef() || c.isSetterDef()) { + add(c); + } else { + Preconditions.checkState(c.isStringKey()); + String key = c.getString(); + if (!c.isQuotedString() + && !(languageMode == LanguageMode.ECMASCRIPT3 + && TokenStream.isKeyword(key)) + && TokenStream.isJSIdentifier(key) + && NodeUtil.isLatin(key)) { + add(key); + } else { + double d = getSimpleNumber(key); + if (!Double.isNaN(d)) { + cc.addNumber(d); + } else { + addExpr(c, 1, Context.OTHER); + } + } + add("":""); + addExpr(c.getFirstChild(), 1, Context.OTHER); + } + } + add(""}""); + if (needsParens) { + add("")""); + } + break; + } + case Token.SWITCH: + add(""switch(""); + add(first); + add("")""); + cc.beginBlock(); + addAllSiblings(first.getNext()); + cc.endBlock(context == Context.STATEMENT); + break; + case Token.CASE: + Preconditions.checkState(childCount == 2); + add(""case ""); + add(first); + addCaseBody(last); + break; + case Token.DEFAULT_CASE: + Preconditions.checkState(childCount == 1); + add(""default""); + addCaseBody(first); + break; + case Token.LABEL: + Preconditions.checkState(childCount == 2); + if (!first.isLabelName()) { + throw new Error(""Unexpected token type. Should be LABEL_NAME.""); + } + add(first); + add("":""); + addNonEmptyStatement( + last, getContextForNonEmptyExpression(context), true); + break; + case Token.CAST: + add(""(""); + add(first); + add("")""); + break; + default: + throw new Error(""Unknown type "" + type + ""\n"" + n.toStringTree()); + } + cc.endSourceMapping(n); + } +" +Math-42," protected RealPointValuePair getSolution() { + int negativeVarColumn = columnLabels.indexOf(NEGATIVE_VAR_COLUMN_LABEL); + Integer negativeVarBasicRow = negativeVarColumn > 0 ? getBasicRow(negativeVarColumn) : null; + double mostNegative = negativeVarBasicRow == null ? 0 : getEntry(negativeVarBasicRow, getRhsOffset()); + Set basicRows = new HashSet(); + double[] coefficients = new double[getOriginalNumDecisionVariables()]; + for (int i = 0; i < coefficients.length; i++) { + int colIndex = columnLabels.indexOf(""x"" + i); + if (colIndex < 0) { + coefficients[i] = 0; + continue; + } + Integer basicRow = getBasicRow(colIndex); + if (basicRows.contains(basicRow)) { + coefficients[i] = 0 - (restrictToNonNegative ? 0 : mostNegative); + } else { + basicRows.add(basicRow); + coefficients[i] = + (basicRow == null ? 0 : getEntry(basicRow, getRhsOffset())) - + (restrictToNonNegative ? 0 : mostNegative); + } + } + return new RealPointValuePair(coefficients, f.getValue(coefficients)); + } +"," protected RealPointValuePair getSolution() { + int negativeVarColumn = columnLabels.indexOf(NEGATIVE_VAR_COLUMN_LABEL); + Integer negativeVarBasicRow = negativeVarColumn > 0 ? getBasicRow(negativeVarColumn) : null; + double mostNegative = negativeVarBasicRow == null ? 0 : getEntry(negativeVarBasicRow, getRhsOffset()); + Set basicRows = new HashSet(); + double[] coefficients = new double[getOriginalNumDecisionVariables()]; + for (int i = 0; i < coefficients.length; i++) { + int colIndex = columnLabels.indexOf(""x"" + i); + if (colIndex < 0) { + coefficients[i] = 0; + continue; + } + Integer basicRow = getBasicRow(colIndex); + if (basicRow != null && basicRow == 0) { + coefficients[i] = 0; + } else if (basicRows.contains(basicRow)) { + coefficients[i] = 0 - (restrictToNonNegative ? 0 : mostNegative); + } else { + basicRows.add(basicRow); + coefficients[i] = + (basicRow == null ? 0 : getEntry(basicRow, getRhsOffset())) - + (restrictToNonNegative ? 0 : mostNegative); + } + } + return new RealPointValuePair(coefficients, f.getValue(coefficients)); + } +" +Math-89," public void addValue(Object v) { + addValue((Comparable) v); + } +"," public void addValue(Object v) { + if (v instanceof Comparable){ + addValue((Comparable) v); + } else { + throw new IllegalArgumentException(""Object must implement Comparable""); + } + } +" +Math-78," public boolean evaluateStep(final StepInterpolator interpolator) + throws DerivativeException, EventException, ConvergenceException { + try { + forward = interpolator.isForward(); + final double t1 = interpolator.getCurrentTime(); + final int n = Math.max(1, (int) Math.ceil(Math.abs(t1 - t0) / maxCheckInterval)); + final double h = (t1 - t0) / n; + double ta = t0; + double ga = g0; + double tb = t0 + (interpolator.isForward() ? convergence : -convergence); + for (int i = 0; i < n; ++i) { + tb += h; + interpolator.setInterpolatedTime(tb); + final double gb = handler.g(tb, interpolator.getInterpolatedState()); + if (g0Positive ^ (gb >= 0)) { + increasing = gb >= ga; + final UnivariateRealFunction f = new UnivariateRealFunction() { + public double value(final double t) throws FunctionEvaluationException { + try { + interpolator.setInterpolatedTime(t); + return handler.g(t, interpolator.getInterpolatedState()); + } catch (DerivativeException e) { + throw new FunctionEvaluationException(e, t); + } catch (EventException e) { + throw new FunctionEvaluationException(e, t); + } + } + }; + final BrentSolver solver = new BrentSolver(); + solver.setAbsoluteAccuracy(convergence); + solver.setMaximalIterationCount(maxIterationCount); + final double root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta); + if ((Math.abs(root - ta) <= convergence) && + (Math.abs(root - previousEventTime) <= convergence)) { + ta = tb; + ga = gb; + } else if (Double.isNaN(previousEventTime) || + (Math.abs(previousEventTime - root) > convergence)) { + pendingEventTime = root; + if (pendingEvent && (Math.abs(t1 - pendingEventTime) <= convergence)) { + return false; + } + pendingEvent = true; + return true; + } + } else { + ta = tb; + ga = gb; + } + } + pendingEvent = false; + pendingEventTime = Double.NaN; + return false; + } catch (FunctionEvaluationException e) { + final Throwable cause = e.getCause(); + if ((cause != null) && (cause instanceof DerivativeException)) { + throw (DerivativeException) cause; + } else if ((cause != null) && (cause instanceof EventException)) { + throw (EventException) cause; + } + throw new EventException(e); + } + } +"," public boolean evaluateStep(final StepInterpolator interpolator) + throws DerivativeException, EventException, ConvergenceException { + try { + forward = interpolator.isForward(); + final double t1 = interpolator.getCurrentTime(); + final int n = Math.max(1, (int) Math.ceil(Math.abs(t1 - t0) / maxCheckInterval)); + final double h = (t1 - t0) / n; + double ta = t0; + double ga = g0; + double tb = t0 + (interpolator.isForward() ? convergence : -convergence); + for (int i = 0; i < n; ++i) { + tb += h; + interpolator.setInterpolatedTime(tb); + final double gb = handler.g(tb, interpolator.getInterpolatedState()); + if (g0Positive ^ (gb >= 0)) { + if (ga * gb > 0) { + final double epsilon = (forward ? 0.25 : -0.25) * convergence; + for (int k = 0; (k < 4) && (ga * gb > 0); ++k) { + ta += epsilon; + interpolator.setInterpolatedTime(ta); + ga = handler.g(ta, interpolator.getInterpolatedState()); + } + if (ga * gb > 0) { + throw MathRuntimeException.createInternalError(null); + } + } + increasing = gb >= ga; + final UnivariateRealFunction f = new UnivariateRealFunction() { + public double value(final double t) throws FunctionEvaluationException { + try { + interpolator.setInterpolatedTime(t); + return handler.g(t, interpolator.getInterpolatedState()); + } catch (DerivativeException e) { + throw new FunctionEvaluationException(e, t); + } catch (EventException e) { + throw new FunctionEvaluationException(e, t); + } + } + }; + final BrentSolver solver = new BrentSolver(); + solver.setAbsoluteAccuracy(convergence); + solver.setMaximalIterationCount(maxIterationCount); + final double root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta); + if ((Math.abs(root - ta) <= convergence) && + (Math.abs(root - previousEventTime) <= convergence)) { + ta = tb; + ga = gb; + } else if (Double.isNaN(previousEventTime) || + (Math.abs(previousEventTime - root) > convergence)) { + pendingEventTime = root; + if (pendingEvent && (Math.abs(t1 - pendingEventTime) <= convergence)) { + return false; + } + pendingEvent = true; + return true; + } + } else { + ta = tb; + ga = gb; + } + } + pendingEvent = false; + pendingEventTime = Double.NaN; + return false; + } catch (FunctionEvaluationException e) { + final Throwable cause = e.getCause(); + if ((cause != null) && (cause instanceof DerivativeException)) { + throw (DerivativeException) cause; + } else if ((cause != null) && (cause instanceof EventException)) { + throw (EventException) cause; + } + throw new EventException(e); + } + } +" +Time-27," private static PeriodFormatter toFormatter(List elementPairs, boolean notPrinter, boolean notParser) { + if (notPrinter && notParser) { + throw new IllegalStateException(""Builder has created neither a printer nor a parser""); + } + int size = elementPairs.size(); + if (size >= 2 && elementPairs.get(0) instanceof Separator) { + Separator sep = (Separator) elementPairs.get(0); + PeriodFormatter f = toFormatter(elementPairs.subList(2, size), notPrinter, notParser); + sep = sep.finish(f.getPrinter(), f.getParser()); + return new PeriodFormatter(sep, sep); + } + Object[] comp = createComposite(elementPairs); + if (notPrinter) { + return new PeriodFormatter(null, (PeriodParser) comp[1]); + } else if (notParser) { + return new PeriodFormatter((PeriodPrinter) comp[0], null); + } else { + return new PeriodFormatter((PeriodPrinter) comp[0], (PeriodParser) comp[1]); + } + } +"," private static PeriodFormatter toFormatter(List elementPairs, boolean notPrinter, boolean notParser) { + if (notPrinter && notParser) { + throw new IllegalStateException(""Builder has created neither a printer nor a parser""); + } + int size = elementPairs.size(); + if (size >= 2 && elementPairs.get(0) instanceof Separator) { + Separator sep = (Separator) elementPairs.get(0); + if (sep.iAfterParser == null && sep.iAfterPrinter == null) { + PeriodFormatter f = toFormatter(elementPairs.subList(2, size), notPrinter, notParser); + sep = sep.finish(f.getPrinter(), f.getParser()); + return new PeriodFormatter(sep, sep); + } + } + Object[] comp = createComposite(elementPairs); + if (notPrinter) { + return new PeriodFormatter(null, (PeriodParser) comp[1]); + } else if (notParser) { + return new PeriodFormatter((PeriodPrinter) comp[0], null); + } else { + return new PeriodFormatter((PeriodPrinter) comp[0], (PeriodParser) comp[1]); + } + } +" +Time-14," public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) { + if (valueToAdd == 0) { + return values; + } + if (DateTimeUtils.isContiguous(partial)) { + long instant = 0L; + for (int i = 0, isize = partial.size(); i < isize; i++) { + instant = partial.getFieldType(i).getField(iChronology).set(instant, values[i]); + } + instant = add(instant, valueToAdd); + return iChronology.get(partial, instant); + } else { + return super.add(partial, fieldIndex, values, valueToAdd); + } + } +"," public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) { + if (valueToAdd == 0) { + return values; + } + if (partial.size() > 0 && partial.getFieldType(0).equals(DateTimeFieldType.monthOfYear()) && fieldIndex == 0) { + int curMonth0 = partial.getValue(0) - 1; + int newMonth = ((curMonth0 + (valueToAdd % 12) + 12) % 12) + 1; + return set(partial, 0, values, newMonth); + } + if (DateTimeUtils.isContiguous(partial)) { + long instant = 0L; + for (int i = 0, isize = partial.size(); i < isize; i++) { + instant = partial.getFieldType(i).getField(iChronology).set(instant, values[i]); + } + instant = add(instant, valueToAdd); + return iChronology.get(partial, instant); + } else { + return super.add(partial, fieldIndex, values, valueToAdd); + } + } +" +Chart-23,," public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof MinMaxCategoryRenderer)) { + return false; + } + MinMaxCategoryRenderer that = (MinMaxCategoryRenderer) obj; + if (this.plotLines != that.plotLines) { + return false; + } + if (!PaintUtilities.equal(this.groupPaint, that.groupPaint)) { + return false; + } + if (!this.groupStroke.equals(that.groupStroke)) { + return false; + } + return super.equals(obj); + } +" +Mockito-33," public boolean hasSameMethod(Invocation candidate) { + Method m1 = invocation.getMethod(); + Method m2 = candidate.getMethod(); + return m1.equals(m2); + } +"," public boolean hasSameMethod(Invocation candidate) { + Method m1 = invocation.getMethod(); + Method m2 = candidate.getMethod(); + if (m1.getName() != null && m1.getName().equals(m2.getName())) { + Class[] params1 = m1.getParameterTypes(); + Class[] params2 = m2.getParameterTypes(); + if (params1.length == params2.length) { + for (int i = 0; i < params1.length; i++) { + if (params1[i] != params2[i]) + return false; + } + return true; + } + } + return false; + } +" +Closure-101," protected CompilerOptions createOptions() { + CompilerOptions options = new CompilerOptions(); + options.setCodingConvention(new ClosureCodingConvention()); + CompilationLevel level = flags.compilation_level; + level.setOptionsForCompilationLevel(options); + if (flags.debug) { + level.setDebugOptionsForCompilationLevel(options); + } + WarningLevel wLevel = flags.warning_level; + wLevel.setOptionsForWarningLevel(options); + for (FormattingOption formattingOption : flags.formatting) { + formattingOption.applyToOptions(options); + } + if (flags.process_closure_primitives) { + options.closurePass = true; + } + initOptionsFromFlags(options); + return options; + } +"," protected CompilerOptions createOptions() { + CompilerOptions options = new CompilerOptions(); + options.setCodingConvention(new ClosureCodingConvention()); + CompilationLevel level = flags.compilation_level; + level.setOptionsForCompilationLevel(options); + if (flags.debug) { + level.setDebugOptionsForCompilationLevel(options); + } + WarningLevel wLevel = flags.warning_level; + wLevel.setOptionsForWarningLevel(options); + for (FormattingOption formattingOption : flags.formatting) { + formattingOption.applyToOptions(options); + } + options.closurePass = flags.process_closure_primitives; + initOptionsFromFlags(options); + return options; + } +" +Closure-38," void addNumber(double x) { + char prev = getLastChar(); + boolean negativeZero = isNegativeZero(x); + if (x < 0 && prev == '-') { + add("" ""); + } + if ((long) x == x && !negativeZero) { + long value = (long) x; + long mantissa = value; + int exp = 0; + if (Math.abs(x) >= 100) { + while (mantissa / 10 * Math.pow(10, exp + 1) == value) { + mantissa /= 10; + exp++; + } + } + if (exp > 2) { + add(Long.toString(mantissa) + ""E"" + Integer.toString(exp)); + } else { + add(Long.toString(value)); + } + } else { + add(String.valueOf(x)); + } + } +"," void addNumber(double x) { + char prev = getLastChar(); + boolean negativeZero = isNegativeZero(x); + if ((x < 0 || negativeZero) && prev == '-') { + add("" ""); + } + if ((long) x == x && !negativeZero) { + long value = (long) x; + long mantissa = value; + int exp = 0; + if (Math.abs(x) >= 100) { + while (mantissa / 10 * Math.pow(10, exp + 1) == value) { + mantissa /= 10; + exp++; + } + } + if (exp > 2) { + add(Long.toString(mantissa) + ""E"" + Integer.toString(exp)); + } else { + add(Long.toString(value)); + } + } else { + add(String.valueOf(x)); + } + } +" +JacksonDatabind-70," public void remove(SettableBeanProperty propToRm) + { + ArrayList props = new ArrayList(_size); + String key = getPropertyName(propToRm); + boolean found = false; + for (int i = 1, end = _hashArea.length; i < end; i += 2) { + SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; + if (prop == null) { + continue; + } + if (!found) { + found = key.equals(prop.getName()); + if (found) { + _propsInOrder[_findFromOrdered(prop)] = null; + continue; + } + } + props.add(prop); + } + if (!found) { + throw new NoSuchElementException(""No entry '""+propToRm.getName()+""' found, can't remove""); + } + init(props); + } +"," public void remove(SettableBeanProperty propToRm) + { + ArrayList props = new ArrayList(_size); + String key = getPropertyName(propToRm); + boolean found = false; + for (int i = 1, end = _hashArea.length; i < end; i += 2) { + SettableBeanProperty prop = (SettableBeanProperty) _hashArea[i]; + if (prop == null) { + continue; + } + if (!found) { + found = key.equals(_hashArea[i-1]); + if (found) { + _propsInOrder[_findFromOrdered(prop)] = null; + continue; + } + } + props.add(prop); + } + if (!found) { + throw new NoSuchElementException(""No entry '""+propToRm.getName()+""' found, can't remove""); + } + init(props); + } +" +JacksonDatabind-6," protected Date parseAsISO8601(String dateStr, ParsePosition pos) + { + int len = dateStr.length(); + char c = dateStr.charAt(len-1); + DateFormat df; + if (len <= 10 && Character.isDigit(c)) { + df = _formatPlain; + if (df == null) { + df = _formatPlain = _cloneFormat(DATE_FORMAT_PLAIN, DATE_FORMAT_STR_PLAIN, _timezone, _locale); + } + } else if (c == 'Z') { + df = _formatISO8601_z; + if (df == null) { + df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, DATE_FORMAT_STR_ISO8601_Z, _timezone, _locale); + } + if (dateStr.charAt(len-4) == ':') { + StringBuilder sb = new StringBuilder(dateStr); + sb.insert(len-1, "".000""); + dateStr = sb.toString(); + } + } else { + if (hasTimeZone(dateStr)) { + c = dateStr.charAt(len-3); + if (c == ':') { + StringBuilder sb = new StringBuilder(dateStr); + sb.delete(len-3, len-2); + dateStr = sb.toString(); + } else if (c == '+' || c == '-') { + dateStr += ""00""; + } + len = dateStr.length(); + c = dateStr.charAt(len-9); + if (Character.isDigit(c)) { + StringBuilder sb = new StringBuilder(dateStr); + sb.insert(len-5, "".000""); + dateStr = sb.toString(); + } + df = _formatISO8601; + if (_formatISO8601 == null) { + df = _formatISO8601 = _cloneFormat(DATE_FORMAT_ISO8601, DATE_FORMAT_STR_ISO8601, _timezone, _locale); + } + } else { + StringBuilder sb = new StringBuilder(dateStr); + int timeLen = len - dateStr.lastIndexOf('T') - 1; + if (timeLen <= 8) { + sb.append("".000""); + } + sb.append('Z'); + dateStr = sb.toString(); + df = _formatISO8601_z; + if (df == null) { + df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, DATE_FORMAT_STR_ISO8601_Z, + _timezone, _locale); + } + } + } + return df.parse(dateStr, pos); + } +"," protected Date parseAsISO8601(String dateStr, ParsePosition pos) + { + int len = dateStr.length(); + char c = dateStr.charAt(len-1); + DateFormat df; + if (len <= 10 && Character.isDigit(c)) { + df = _formatPlain; + if (df == null) { + df = _formatPlain = _cloneFormat(DATE_FORMAT_PLAIN, DATE_FORMAT_STR_PLAIN, _timezone, _locale); + } + } else if (c == 'Z') { + df = _formatISO8601_z; + if (df == null) { + df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, DATE_FORMAT_STR_ISO8601_Z, _timezone, _locale); + } + if (dateStr.charAt(len-4) == ':') { + StringBuilder sb = new StringBuilder(dateStr); + sb.insert(len-1, "".000""); + dateStr = sb.toString(); + } + } else { + if (hasTimeZone(dateStr)) { + c = dateStr.charAt(len-3); + if (c == ':') { + StringBuilder sb = new StringBuilder(dateStr); + sb.delete(len-3, len-2); + dateStr = sb.toString(); + } else if (c == '+' || c == '-') { + dateStr += ""00""; + } + len = dateStr.length(); + int timeLen = len - dateStr.lastIndexOf('T') - 6; + if (timeLen < 12) { + int offset = len - 5; + StringBuilder sb = new StringBuilder(dateStr); + switch (timeLen) { + case 11: + sb.insert(offset, '0'); break; + case 10: + sb.insert(offset, ""00""); break; + case 9: + sb.insert(offset, ""000""); break; + case 8: + sb.insert(offset, "".000""); break; + case 7: + break; + case 6: + sb.insert(offset, ""00.000""); + case 5: + sb.insert(offset, "":00.000""); + } + dateStr = sb.toString(); + } + df = _formatISO8601; + if (_formatISO8601 == null) { + df = _formatISO8601 = _cloneFormat(DATE_FORMAT_ISO8601, DATE_FORMAT_STR_ISO8601, _timezone, _locale); + } + } else { + StringBuilder sb = new StringBuilder(dateStr); + int timeLen = len - dateStr.lastIndexOf('T') - 1; + if (timeLen < 12) { + switch (timeLen) { + case 11: sb.append('0'); + case 10: sb.append('0'); + case 9: sb.append('0'); + break; + default: + sb.append("".000""); + } + } + sb.append('Z'); + dateStr = sb.toString(); + df = _formatISO8601_z; + if (df == null) { + df = _formatISO8601_z = _cloneFormat(DATE_FORMAT_ISO8601_Z, DATE_FORMAT_STR_ISO8601_Z, + _timezone, _locale); + } + } + } + return df.parse(dateStr, pos); + } +" +JacksonDatabind-101," protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, DeserializationContext ctxt) + throws IOException + { + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p, ctxt); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + if (buffer.assignParameter(creatorProp, + _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { + t = p.nextToken(); + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + bean = wrapInstantiationProblem(e, ctxt); + } + p.setCurrentValue(bean); + while (t == JsonToken.FIELD_NAME) { + p.nextToken(); + tokens.copyCurrentStructure(p); + t = p.nextToken(); + } + tokens.writeEndObject(); + if (bean.getClass() != _beanType.getRawClass()) { + ctxt.reportInputMismatch(creatorProp, + ""Cannot create polymorphic instances with unwrapped values""); + return null; + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, _deserializeWithErrorWrapping(p, ctxt, prop)); + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + if (_anySetter == null) { + tokens.writeFieldName(propName); + tokens.copyCurrentStructure(p); + } else { + TokenBuffer b2 = TokenBuffer.asCopyOfValue(p); + tokens.writeFieldName(propName); + tokens.append(b2); + try { + buffer.bufferAnyProperty(_anySetter, propName, + _anySetter.deserialize(b2.asParserOnFirstToken(), ctxt)); + } catch (Exception e) { + wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); + } + continue; + } + } + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + wrapInstantiationProblem(e, ctxt); + return null; + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } +"," protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, DeserializationContext ctxt) + throws IOException + { + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p, ctxt); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + if (buffer.assignParameter(creatorProp, + _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { + t = p.nextToken(); + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + bean = wrapInstantiationProblem(e, ctxt); + } + p.setCurrentValue(bean); + while (t == JsonToken.FIELD_NAME) { + tokens.copyCurrentStructure(p); + t = p.nextToken(); + } + if (t != JsonToken.END_OBJECT) { + ctxt.reportWrongTokenException(this, JsonToken.END_OBJECT, + ""Attempted to unwrap '%s' value"", + handledType().getName()); + } + tokens.writeEndObject(); + if (bean.getClass() != _beanType.getRawClass()) { + ctxt.reportInputMismatch(creatorProp, + ""Cannot create polymorphic instances with unwrapped values""); + return null; + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, _deserializeWithErrorWrapping(p, ctxt, prop)); + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + if (_anySetter == null) { + tokens.writeFieldName(propName); + tokens.copyCurrentStructure(p); + } else { + TokenBuffer b2 = TokenBuffer.asCopyOfValue(p); + tokens.writeFieldName(propName); + tokens.append(b2); + try { + buffer.bufferAnyProperty(_anySetter, propName, + _anySetter.deserialize(b2.asParserOnFirstToken(), ctxt)); + } catch (Exception e) { + wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); + } + continue; + } + } + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + wrapInstantiationProblem(e, ctxt); + return null; + } + return _unwrappedPropertyHandler.processUnwrapped(p, ctxt, bean, tokens); + } +" +Time-23," private static synchronized String getConvertedId(String id) { + Map map = cZoneIdConversion; + if (map == null) { + map = new HashMap(); + map.put(""GMT"", ""UTC""); + map.put(""MIT"", ""Pacific/Apia""); + map.put(""HST"", ""Pacific/Honolulu""); + map.put(""AST"", ""America/Anchorage""); + map.put(""PST"", ""America/Los_Angeles""); + map.put(""MST"", ""America/Denver""); + map.put(""PNT"", ""America/Phoenix""); + map.put(""CST"", ""America/Chicago""); + map.put(""EST"", ""America/New_York""); + map.put(""IET"", ""America/Indianapolis""); + map.put(""PRT"", ""America/Puerto_Rico""); + map.put(""CNT"", ""America/St_Johns""); + map.put(""AGT"", ""America/Buenos_Aires""); + map.put(""BET"", ""America/Sao_Paulo""); + map.put(""WET"", ""Europe/London""); + map.put(""ECT"", ""Europe/Paris""); + map.put(""ART"", ""Africa/Cairo""); + map.put(""CAT"", ""Africa/Harare""); + map.put(""EET"", ""Europe/Bucharest""); + map.put(""EAT"", ""Africa/Addis_Ababa""); + map.put(""MET"", ""Asia/Tehran""); + map.put(""NET"", ""Asia/Yerevan""); + map.put(""PLT"", ""Asia/Karachi""); + map.put(""IST"", ""Asia/Calcutta""); + map.put(""BST"", ""Asia/Dhaka""); + map.put(""VST"", ""Asia/Saigon""); + map.put(""CTT"", ""Asia/Shanghai""); + map.put(""JST"", ""Asia/Tokyo""); + map.put(""ACT"", ""Australia/Darwin""); + map.put(""AET"", ""Australia/Sydney""); + map.put(""SST"", ""Pacific/Guadalcanal""); + map.put(""NST"", ""Pacific/Auckland""); + cZoneIdConversion = map; + } + return map.get(id); + } +"," private static synchronized String getConvertedId(String id) { + Map map = cZoneIdConversion; + if (map == null) { + map = new HashMap(); + map.put(""GMT"", ""UTC""); + map.put(""WET"", ""WET""); + map.put(""CET"", ""CET""); + map.put(""MET"", ""CET""); + map.put(""ECT"", ""CET""); + map.put(""EET"", ""EET""); + map.put(""MIT"", ""Pacific/Apia""); + map.put(""HST"", ""Pacific/Honolulu""); + map.put(""AST"", ""America/Anchorage""); + map.put(""PST"", ""America/Los_Angeles""); + map.put(""MST"", ""America/Denver""); + map.put(""PNT"", ""America/Phoenix""); + map.put(""CST"", ""America/Chicago""); + map.put(""EST"", ""America/New_York""); + map.put(""IET"", ""America/Indiana/Indianapolis""); + map.put(""PRT"", ""America/Puerto_Rico""); + map.put(""CNT"", ""America/St_Johns""); + map.put(""AGT"", ""America/Argentina/Buenos_Aires""); + map.put(""BET"", ""America/Sao_Paulo""); + map.put(""ART"", ""Africa/Cairo""); + map.put(""CAT"", ""Africa/Harare""); + map.put(""EAT"", ""Africa/Addis_Ababa""); + map.put(""NET"", ""Asia/Yerevan""); + map.put(""PLT"", ""Asia/Karachi""); + map.put(""IST"", ""Asia/Kolkata""); + map.put(""BST"", ""Asia/Dhaka""); + map.put(""VST"", ""Asia/Ho_Chi_Minh""); + map.put(""CTT"", ""Asia/Shanghai""); + map.put(""JST"", ""Asia/Tokyo""); + map.put(""ACT"", ""Australia/Darwin""); + map.put(""AET"", ""Australia/Sydney""); + map.put(""SST"", ""Pacific/Guadalcanal""); + map.put(""NST"", ""Pacific/Auckland""); + cZoneIdConversion = map; + } + return map.get(id); + } +" +Csv-2," public String get(final String name) { + if (mapping == null) { + throw new IllegalStateException( + ""No header mapping was specified, the record values can't be accessed by name""); + } + final Integer index = mapping.get(name); + return index != null ? values[index.intValue()] : null; + } +"," public String get(final String name) { + if (mapping == null) { + throw new IllegalStateException( + ""No header mapping was specified, the record values can't be accessed by name""); + } + final Integer index = mapping.get(name); + try { + return index != null ? values[index.intValue()] : null; + } catch (ArrayIndexOutOfBoundsException e) { + throw new IllegalArgumentException( + String.format( + ""Index for header '%s' is %d but CSVRecord only has %d values!"", + name, index.intValue(), values.length)); + } + } +" +Closure-20," private Node tryFoldSimpleFunctionCall(Node n) { + Preconditions.checkState(n.isCall()); + Node callTarget = n.getFirstChild(); + if (callTarget != null && callTarget.isName() && + callTarget.getString().equals(""String"")) { + Node value = callTarget.getNext(); + if (value != null) { + Node addition = IR.add( + IR.string("""").srcref(callTarget), + value.detachFromParent()); + n.getParent().replaceChild(n, addition); + reportCodeChange(); + return addition; + } + } + return n; + } +"," private Node tryFoldSimpleFunctionCall(Node n) { + Preconditions.checkState(n.isCall()); + Node callTarget = n.getFirstChild(); + if (callTarget != null && callTarget.isName() && + callTarget.getString().equals(""String"")) { + Node value = callTarget.getNext(); + if (value != null && value.getNext() == null && + NodeUtil.isImmutableValue(value)) { + Node addition = IR.add( + IR.string("""").srcref(callTarget), + value.detachFromParent()); + n.getParent().replaceChild(n, addition); + reportCodeChange(); + return addition; + } + } + return n; + } +" +Compress-45," public static int formatLongOctalOrBinaryBytes( + final long value, final byte[] buf, final int offset, final int length) { + final long maxAsOctalChar = length == TarConstants.UIDLEN ? TarConstants.MAXID : TarConstants.MAXSIZE; + final boolean negative = value < 0; + if (!negative && value <= maxAsOctalChar) { + return formatLongOctalBytes(value, buf, offset, length); + } + if (length < 9) { + formatLongBinary(value, buf, offset, length, negative); + } + formatBigIntegerBinary(value, buf, offset, length, negative); + buf[offset] = (byte) (negative ? 0xff : 0x80); + return offset + length; + } +"," public static int formatLongOctalOrBinaryBytes( + final long value, final byte[] buf, final int offset, final int length) { + final long maxAsOctalChar = length == TarConstants.UIDLEN ? TarConstants.MAXID : TarConstants.MAXSIZE; + final boolean negative = value < 0; + if (!negative && value <= maxAsOctalChar) { + return formatLongOctalBytes(value, buf, offset, length); + } + if (length < 9) { + formatLongBinary(value, buf, offset, length, negative); + } else { + formatBigIntegerBinary(value, buf, offset, length, negative); + } + buf[offset] = (byte) (negative ? 0xff : 0x80); + return offset + length; + } +" +Jsoup-54," private void copyAttributes(org.jsoup.nodes.Node source, Element el) { + for (Attribute attribute : source.attributes()) { + String key = attribute.getKey().replaceAll(""[^-a-zA-Z0-9_:.]"", """"); + el.setAttribute(key, attribute.getValue()); + } + } +"," private void copyAttributes(org.jsoup.nodes.Node source, Element el) { + for (Attribute attribute : source.attributes()) { + String key = attribute.getKey().replaceAll(""[^-a-zA-Z0-9_:.]"", """"); + if (key.matches(""[a-zA-Z_:]{1}[-a-zA-Z0-9_:.]*"")) + el.setAttribute(key, attribute.getValue()); + } + } +" +Compress-11," public ArchiveInputStream createArchiveInputStream(final InputStream in) + throws ArchiveException { + if (in == null) { + throw new IllegalArgumentException(""Stream must not be null.""); + } + if (!in.markSupported()) { + throw new IllegalArgumentException(""Mark is not supported.""); + } + final byte[] signature = new byte[12]; + in.mark(signature.length); + try { + int signatureLength = in.read(signature); + in.reset(); + if (ZipArchiveInputStream.matches(signature, signatureLength)) { + return new ZipArchiveInputStream(in); + } else if (JarArchiveInputStream.matches(signature, signatureLength)) { + return new JarArchiveInputStream(in); + } else if (ArArchiveInputStream.matches(signature, signatureLength)) { + return new ArArchiveInputStream(in); + } else if (CpioArchiveInputStream.matches(signature, signatureLength)) { + return new CpioArchiveInputStream(in); + } + final byte[] dumpsig = new byte[32]; + in.mark(dumpsig.length); + signatureLength = in.read(dumpsig); + in.reset(); + if (DumpArchiveInputStream.matches(dumpsig, signatureLength)) { + return new DumpArchiveInputStream(in); + } + final byte[] tarheader = new byte[512]; + in.mark(tarheader.length); + signatureLength = in.read(tarheader); + in.reset(); + if (TarArchiveInputStream.matches(tarheader, signatureLength)) { + return new TarArchiveInputStream(in); + } + try { + TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader)); + tais.getNextEntry(); + return new TarArchiveInputStream(in); + } catch (Exception e) { + } + } catch (IOException e) { + throw new ArchiveException(""Could not use reset and mark operations."", e); + } + throw new ArchiveException(""No Archiver found for the stream signature""); + } +"," public ArchiveInputStream createArchiveInputStream(final InputStream in) + throws ArchiveException { + if (in == null) { + throw new IllegalArgumentException(""Stream must not be null.""); + } + if (!in.markSupported()) { + throw new IllegalArgumentException(""Mark is not supported.""); + } + final byte[] signature = new byte[12]; + in.mark(signature.length); + try { + int signatureLength = in.read(signature); + in.reset(); + if (ZipArchiveInputStream.matches(signature, signatureLength)) { + return new ZipArchiveInputStream(in); + } else if (JarArchiveInputStream.matches(signature, signatureLength)) { + return new JarArchiveInputStream(in); + } else if (ArArchiveInputStream.matches(signature, signatureLength)) { + return new ArArchiveInputStream(in); + } else if (CpioArchiveInputStream.matches(signature, signatureLength)) { + return new CpioArchiveInputStream(in); + } + final byte[] dumpsig = new byte[32]; + in.mark(dumpsig.length); + signatureLength = in.read(dumpsig); + in.reset(); + if (DumpArchiveInputStream.matches(dumpsig, signatureLength)) { + return new DumpArchiveInputStream(in); + } + final byte[] tarheader = new byte[512]; + in.mark(tarheader.length); + signatureLength = in.read(tarheader); + in.reset(); + if (TarArchiveInputStream.matches(tarheader, signatureLength)) { + return new TarArchiveInputStream(in); + } + if (signatureLength >= 512) { + try { + TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader)); + tais.getNextEntry(); + return new TarArchiveInputStream(in); + } catch (Exception e) { + } + } + } catch (IOException e) { + throw new ArchiveException(""Could not use reset and mark operations."", e); + } + throw new ArchiveException(""No Archiver found for the stream signature""); + } +" +JacksonXml-5," protected XmlSerializerProvider(XmlSerializerProvider src) { + super(src); + _rootNameLookup = src._rootNameLookup; + } +"," protected XmlSerializerProvider(XmlSerializerProvider src) { + super(src); + _rootNameLookup = new XmlRootNameLookup(); + } +" +Csv-15," private void printAndQuote(final Object object, final CharSequence value, final int offset, final int len, + final Appendable out, final boolean newRecord) throws IOException { + boolean quote = false; + int start = offset; + int pos = offset; + final int end = offset + len; + final char delimChar = getDelimiter(); + final char quoteChar = getQuoteCharacter().charValue(); + QuoteMode quoteModePolicy = getQuoteMode(); + if (quoteModePolicy == null) { + quoteModePolicy = QuoteMode.MINIMAL; + } + switch (quoteModePolicy) { + case ALL: + case ALL_NON_NULL: + quote = true; + break; + case NON_NUMERIC: + quote = !(object instanceof Number); + break; + case NONE: + printAndEscape(value, offset, len, out); + return; + case MINIMAL: + if (len <= 0) { + if (newRecord) { + quote = true; + } + } else { + char c = value.charAt(pos); + if (newRecord && (c < 0x20 || c > 0x21 && c < 0x23 || c > 0x2B && c < 0x2D || c > 0x7E)) { + quote = true; + } else if (c <= COMMENT) { + quote = true; + } else { + while (pos < end) { + c = value.charAt(pos); + if (c == LF || c == CR || c == quoteChar || c == delimChar) { + quote = true; + break; + } + pos++; + } + if (!quote) { + pos = end - 1; + c = value.charAt(pos); + if (c <= SP) { + quote = true; + } + } + } + } + if (!quote) { + out.append(value, start, end); + return; + } + break; + default: + throw new IllegalStateException(""Unexpected Quote value: "" + quoteModePolicy); + } + if (!quote) { + out.append(value, start, end); + return; + } + out.append(quoteChar); + while (pos < end) { + final char c = value.charAt(pos); + if (c == quoteChar) { + out.append(value, start, pos + 1); + start = pos; + } + pos++; + } + out.append(value, start, pos); + out.append(quoteChar); + } +"," private void printAndQuote(final Object object, final CharSequence value, final int offset, final int len, + final Appendable out, final boolean newRecord) throws IOException { + boolean quote = false; + int start = offset; + int pos = offset; + final int end = offset + len; + final char delimChar = getDelimiter(); + final char quoteChar = getQuoteCharacter().charValue(); + QuoteMode quoteModePolicy = getQuoteMode(); + if (quoteModePolicy == null) { + quoteModePolicy = QuoteMode.MINIMAL; + } + switch (quoteModePolicy) { + case ALL: + case ALL_NON_NULL: + quote = true; + break; + case NON_NUMERIC: + quote = !(object instanceof Number); + break; + case NONE: + printAndEscape(value, offset, len, out); + return; + case MINIMAL: + if (len <= 0) { + if (newRecord) { + quote = true; + } + } else { + char c = value.charAt(pos); + if (c <= COMMENT) { + quote = true; + } else { + while (pos < end) { + c = value.charAt(pos); + if (c == LF || c == CR || c == quoteChar || c == delimChar) { + quote = true; + break; + } + pos++; + } + if (!quote) { + pos = end - 1; + c = value.charAt(pos); + if (c <= SP) { + quote = true; + } + } + } + } + if (!quote) { + out.append(value, start, end); + return; + } + break; + default: + throw new IllegalStateException(""Unexpected Quote value: "" + quoteModePolicy); + } + if (!quote) { + out.append(value, start, end); + return; + } + out.append(quoteChar); + while (pos < end) { + final char c = value.charAt(pos); + if (c == quoteChar) { + out.append(value, start, pos + 1); + start = pos; + } + pos++; + } + out.append(value, start, pos); + out.append(quoteChar); + } +" +Chart-6," public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ShapeList)) { + return false; + } + return super.equals(obj); + } +"," public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof ShapeList)) { + return false; + } + ShapeList that = (ShapeList) obj; + int listSize = size(); + for (int i = 0; i < listSize; i++) { + if (!ShapeUtilities.equal((Shape) get(i), (Shape) that.get(i))) { + return false; + } + } + return true; + } +" +Mockito-34," public void captureArgumentsFrom(Invocation i) { + int k = 0; + for (Matcher m : matchers) { + if (m instanceof CapturesArguments) { + ((CapturesArguments) m).captureFrom(i.getArguments()[k]); + } + k++; + } + } +"," public void captureArgumentsFrom(Invocation i) { + int k = 0; + for (Matcher m : matchers) { + if (m instanceof CapturesArguments && i.getArguments().length > k) { + ((CapturesArguments) m).captureFrom(i.getArguments()[k]); + } + k++; + } + } +" +Math-34," public Iterator iterator() { + return chromosomes.iterator(); + } +"," public Iterator iterator() { + return getChromosomes().iterator(); + } +" +Closure-44," void add(String newcode) { + maybeEndStatement(); + if (newcode.length() == 0) { + return; + } + char c = newcode.charAt(0); + if ((isWordChar(c) || c == '\\') && + isWordChar(getLastChar())) { + append("" ""); + } + append(newcode); + } +"," void add(String newcode) { + maybeEndStatement(); + if (newcode.length() == 0) { + return; + } + char c = newcode.charAt(0); + if ((isWordChar(c) || c == '\\') && + isWordChar(getLastChar())) { + append("" ""); + } else if (c == '/' && getLastChar() == '/') { + append("" ""); + } + append(newcode); + } +" +Compress-25," public ZipArchiveInputStream(InputStream inputStream, + String encoding, + boolean useUnicodeExtraFields, + boolean allowStoredEntriesWithDataDescriptor) { + zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); + this.useUnicodeExtraFields = useUnicodeExtraFields; + in = new PushbackInputStream(inputStream, buf.capacity()); + this.allowStoredEntriesWithDataDescriptor = + allowStoredEntriesWithDataDescriptor; + } +"," public ZipArchiveInputStream(InputStream inputStream, + String encoding, + boolean useUnicodeExtraFields, + boolean allowStoredEntriesWithDataDescriptor) { + zipEncoding = ZipEncodingHelper.getZipEncoding(encoding); + this.useUnicodeExtraFields = useUnicodeExtraFields; + in = new PushbackInputStream(inputStream, buf.capacity()); + this.allowStoredEntriesWithDataDescriptor = + allowStoredEntriesWithDataDescriptor; + buf.limit(0); + } +" +Closure-52," static boolean isSimpleNumber(String s) { + int len = s.length(); + for (int index = 0; index < len; index++) { + char c = s.charAt(index); + if (c < '0' || c > '9') { + return false; + } + } + return len > 0; + } +"," static boolean isSimpleNumber(String s) { + int len = s.length(); + for (int index = 0; index < len; index++) { + char c = s.charAt(index); + if (c < '0' || c > '9') { + return false; + } + } + return len > 0 && s.charAt(0) != '0'; + } +" +Closure-14," private static Node computeFollowNode( + Node fromNode, Node node, ControlFlowAnalysis cfa) { + Node parent = node.getParent(); + if (parent == null || parent.isFunction() || + (cfa != null && node == cfa.root)) { + return null; + } + switch (parent.getType()) { + case Token.IF: + return computeFollowNode(fromNode, parent, cfa); + case Token.CASE: + case Token.DEFAULT_CASE: + if (parent.getNext() != null) { + if (parent.getNext().isCase()) { + return parent.getNext().getFirstChild().getNext(); + } else if (parent.getNext().isDefaultCase()) { + return parent.getNext().getFirstChild(); + } else { + Preconditions.checkState(false, ""Not reachable""); + } + } else { + return computeFollowNode(fromNode, parent, cfa); + } + break; + case Token.FOR: + if (NodeUtil.isForIn(parent)) { + return parent; + } else { + return parent.getFirstChild().getNext().getNext(); + } + case Token.WHILE: + case Token.DO: + return parent; + case Token.TRY: + if (parent.getFirstChild() == node) { + if (NodeUtil.hasFinally(parent)) { + return computeFallThrough(parent.getLastChild()); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } else if (NodeUtil.getCatchBlock(parent) == node){ + if (NodeUtil.hasFinally(parent)) { + return computeFallThrough(node.getNext()); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } else if (parent.getLastChild() == node){ + if (cfa != null) { + for (Node finallyNode : cfa.finallyMap.get(parent)) { + cfa.createEdge(fromNode, Branch.UNCOND, finallyNode); + } + } + return computeFollowNode(fromNode, parent, cfa); + } + } + Node nextSibling = node.getNext(); + while (nextSibling != null && nextSibling.isFunction()) { + nextSibling = nextSibling.getNext(); + } + if (nextSibling != null) { + return computeFallThrough(nextSibling); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } +"," private static Node computeFollowNode( + Node fromNode, Node node, ControlFlowAnalysis cfa) { + Node parent = node.getParent(); + if (parent == null || parent.isFunction() || + (cfa != null && node == cfa.root)) { + return null; + } + switch (parent.getType()) { + case Token.IF: + return computeFollowNode(fromNode, parent, cfa); + case Token.CASE: + case Token.DEFAULT_CASE: + if (parent.getNext() != null) { + if (parent.getNext().isCase()) { + return parent.getNext().getFirstChild().getNext(); + } else if (parent.getNext().isDefaultCase()) { + return parent.getNext().getFirstChild(); + } else { + Preconditions.checkState(false, ""Not reachable""); + } + } else { + return computeFollowNode(fromNode, parent, cfa); + } + break; + case Token.FOR: + if (NodeUtil.isForIn(parent)) { + return parent; + } else { + return parent.getFirstChild().getNext().getNext(); + } + case Token.WHILE: + case Token.DO: + return parent; + case Token.TRY: + if (parent.getFirstChild() == node) { + if (NodeUtil.hasFinally(parent)) { + return computeFallThrough(parent.getLastChild()); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } else if (NodeUtil.getCatchBlock(parent) == node){ + if (NodeUtil.hasFinally(parent)) { + return computeFallThrough(node.getNext()); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } else if (parent.getLastChild() == node){ + if (cfa != null) { + for (Node finallyNode : cfa.finallyMap.get(parent)) { + cfa.createEdge(fromNode, Branch.ON_EX, finallyNode); + } + } + return computeFollowNode(fromNode, parent, cfa); + } + } + Node nextSibling = node.getNext(); + while (nextSibling != null && nextSibling.isFunction()) { + nextSibling = nextSibling.getNext(); + } + if (nextSibling != null) { + return computeFallThrough(nextSibling); + } else { + return computeFollowNode(fromNode, parent, cfa); + } + } +" +Math-56," public int[] getCounts(int index) { + if (index < 0 || + index >= totalSize) { + throw new OutOfRangeException(index, 0, totalSize); + } + final int[] indices = new int[dimension]; + int count = 0; + for (int i = 0; i < last; i++) { + int idx = 0; + final int offset = uniCounterOffset[i]; + while (count <= index) { + count += offset; + ++idx; + } + --idx; + count -= offset; + indices[i] = idx; + } + int idx = 1; + while (count < index) { + count += idx; + ++idx; + } + --idx; + indices[last] = idx; + return indices; + } +"," public int[] getCounts(int index) { + if (index < 0 || + index >= totalSize) { + throw new OutOfRangeException(index, 0, totalSize); + } + final int[] indices = new int[dimension]; + int count = 0; + for (int i = 0; i < last; i++) { + int idx = 0; + final int offset = uniCounterOffset[i]; + while (count <= index) { + count += offset; + ++idx; + } + --idx; + count -= offset; + indices[i] = idx; + } + indices[last] = index - count; + return indices; + } +" +Math-79," public static double distance(int[] p1, int[] p2) { + int sum = 0; + for (int i = 0; i < p1.length; i++) { + final int dp = p1[i] - p2[i]; + sum += dp * dp; + } + return Math.sqrt(sum); + } +"," public static double distance(int[] p1, int[] p2) { + double sum = 0; + for (int i = 0; i < p1.length; i++) { + final double dp = p1[i] - p2[i]; + sum += dp * dp; + } + return Math.sqrt(sum); + } +" +Jsoup-53," public String chompBalanced(char open, char close) { + int start = -1; + int end = -1; + int depth = 0; + char last = 0; + do { + if (isEmpty()) break; + Character c = consume(); + if (last == 0 || last != ESC) { + if (c.equals(open)) { + depth++; + if (start == -1) + start = pos; + } + else if (c.equals(close)) + depth--; + } + if (depth > 0 && last != 0) + end = pos; + last = c; + } while (depth > 0); + return (end >= 0) ? queue.substring(start, end) : """"; + } +"," public String chompBalanced(char open, char close) { + int start = -1; + int end = -1; + int depth = 0; + char last = 0; + boolean inQuote = false; + do { + if (isEmpty()) break; + Character c = consume(); + if (last == 0 || last != ESC) { + if (c.equals('\'') || c.equals('""') && c != open) + inQuote = !inQuote; + if (inQuote) + continue; + if (c.equals(open)) { + depth++; + if (start == -1) + start = pos; + } + else if (c.equals(close)) + depth--; + } + if (depth > 0 && last != 0) + end = pos; + last = c; + } while (depth > 0); + return (end >= 0) ? queue.substring(start, end) : """"; + } +" +Closure-92," void replace() { + if (firstNode == null) { + replacementNode = candidateDefinition; + return; + } + if (candidateDefinition != null && explicitNode != null) { + explicitNode.detachFromParent(); + compiler.reportCodeChange(); + replacementNode = candidateDefinition; + if (NodeUtil.isExpressionNode(candidateDefinition)) { + candidateDefinition.putBooleanProp(Node.IS_NAMESPACE, true); + Node assignNode = candidateDefinition.getFirstChild(); + Node nameNode = assignNode.getFirstChild(); + if (nameNode.getType() == Token.NAME) { + Node valueNode = nameNode.getNext(); + assignNode.removeChild(nameNode); + assignNode.removeChild(valueNode); + nameNode.addChildToFront(valueNode); + Node varNode = new Node(Token.VAR, nameNode); + varNode.copyInformationFrom(candidateDefinition); + candidateDefinition.getParent().replaceChild( + candidateDefinition, varNode); + nameNode.setJSDocInfo(assignNode.getJSDocInfo()); + compiler.reportCodeChange(); + replacementNode = varNode; + } + } + } else { + replacementNode = createDeclarationNode(); + if (firstModule == minimumModule) { + firstNode.getParent().addChildBefore(replacementNode, firstNode); + } else { + int indexOfDot = namespace.indexOf('.'); + if (indexOfDot == -1) { + compiler.getNodeForCodeInsertion(minimumModule) + .addChildToBack(replacementNode); + } else { + ProvidedName parentName = + providedNames.get(namespace.substring(0, indexOfDot)); + Preconditions.checkNotNull(parentName); + Preconditions.checkNotNull(parentName.replacementNode); + parentName.replacementNode.getParent().addChildAfter( + replacementNode, parentName.replacementNode); + } + } + if (explicitNode != null) { + explicitNode.detachFromParent(); + } + compiler.reportCodeChange(); + } + } +"," void replace() { + if (firstNode == null) { + replacementNode = candidateDefinition; + return; + } + if (candidateDefinition != null && explicitNode != null) { + explicitNode.detachFromParent(); + compiler.reportCodeChange(); + replacementNode = candidateDefinition; + if (NodeUtil.isExpressionNode(candidateDefinition)) { + candidateDefinition.putBooleanProp(Node.IS_NAMESPACE, true); + Node assignNode = candidateDefinition.getFirstChild(); + Node nameNode = assignNode.getFirstChild(); + if (nameNode.getType() == Token.NAME) { + Node valueNode = nameNode.getNext(); + assignNode.removeChild(nameNode); + assignNode.removeChild(valueNode); + nameNode.addChildToFront(valueNode); + Node varNode = new Node(Token.VAR, nameNode); + varNode.copyInformationFrom(candidateDefinition); + candidateDefinition.getParent().replaceChild( + candidateDefinition, varNode); + nameNode.setJSDocInfo(assignNode.getJSDocInfo()); + compiler.reportCodeChange(); + replacementNode = varNode; + } + } + } else { + replacementNode = createDeclarationNode(); + if (firstModule == minimumModule) { + firstNode.getParent().addChildBefore(replacementNode, firstNode); + } else { + int indexOfDot = namespace.lastIndexOf('.'); + if (indexOfDot == -1) { + compiler.getNodeForCodeInsertion(minimumModule) + .addChildToBack(replacementNode); + } else { + ProvidedName parentName = + providedNames.get(namespace.substring(0, indexOfDot)); + Preconditions.checkNotNull(parentName); + Preconditions.checkNotNull(parentName.replacementNode); + parentName.replacementNode.getParent().addChildAfter( + replacementNode, parentName.replacementNode); + } + } + if (explicitNode != null) { + explicitNode.detachFromParent(); + } + compiler.reportCodeChange(); + } + } +" +Compress-10," private void resolveLocalFileHeaderData(Map + entriesWithoutUTF8Flag) + throws IOException { + for (ZipArchiveEntry ze : entries.keySet()) { + OffsetEntry offsetEntry = entries.get(ze); + long offset = offsetEntry.headerOffset; + archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH); + byte[] b = new byte[SHORT]; + archive.readFully(b); + int fileNameLen = ZipShort.getValue(b); + archive.readFully(b); + int extraFieldLen = ZipShort.getValue(b); + int lenToSkip = fileNameLen; + while (lenToSkip > 0) { + int skipped = archive.skipBytes(lenToSkip); + if (skipped <= 0) { + throw new RuntimeException(""failed to skip file name in"" + + "" local file header""); + } + lenToSkip -= skipped; + } + byte[] localExtraData = new byte[extraFieldLen]; + archive.readFully(localExtraData); + ze.setExtra(localExtraData); + offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH + + SHORT + SHORT + fileNameLen + extraFieldLen; + if (entriesWithoutUTF8Flag.containsKey(ze)) { + String orig = ze.getName(); + NameAndComment nc = entriesWithoutUTF8Flag.get(ze); + ZipUtil.setNameAndCommentFromExtraFields(ze, nc.name, + nc.comment); + if (!orig.equals(ze.getName())) { + nameMap.remove(orig); + nameMap.put(ze.getName(), ze); + } + } + } + } +"," private void resolveLocalFileHeaderData(Map + entriesWithoutUTF8Flag) + throws IOException { + Map origMap = + new LinkedHashMap(entries); + entries.clear(); + for (ZipArchiveEntry ze : origMap.keySet()) { + OffsetEntry offsetEntry = origMap.get(ze); + long offset = offsetEntry.headerOffset; + archive.seek(offset + LFH_OFFSET_FOR_FILENAME_LENGTH); + byte[] b = new byte[SHORT]; + archive.readFully(b); + int fileNameLen = ZipShort.getValue(b); + archive.readFully(b); + int extraFieldLen = ZipShort.getValue(b); + int lenToSkip = fileNameLen; + while (lenToSkip > 0) { + int skipped = archive.skipBytes(lenToSkip); + if (skipped <= 0) { + throw new RuntimeException(""failed to skip file name in"" + + "" local file header""); + } + lenToSkip -= skipped; + } + byte[] localExtraData = new byte[extraFieldLen]; + archive.readFully(localExtraData); + ze.setExtra(localExtraData); + offsetEntry.dataOffset = offset + LFH_OFFSET_FOR_FILENAME_LENGTH + + SHORT + SHORT + fileNameLen + extraFieldLen; + if (entriesWithoutUTF8Flag.containsKey(ze)) { + String orig = ze.getName(); + NameAndComment nc = entriesWithoutUTF8Flag.get(ze); + ZipUtil.setNameAndCommentFromExtraFields(ze, nc.name, + nc.comment); + if (!orig.equals(ze.getName())) { + nameMap.remove(orig); + nameMap.put(ze.getName(), ze); + } + } + entries.put(ze, offsetEntry); + } + } +" +Closure-121," private void inlineNonConstants( + Var v, ReferenceCollection referenceInfo, + boolean maybeModifiedArguments) { + int refCount = referenceInfo.references.size(); + Reference declaration = referenceInfo.references.get(0); + Reference init = referenceInfo.getInitializingReference(); + int firstRefAfterInit = (declaration == init) ? 2 : 3; + if (refCount > 1 && + isImmutableAndWellDefinedVariable(v, referenceInfo)) { + Node value; + if (init != null) { + value = init.getAssignedValue(); + } else { + Node srcLocation = declaration.getNode(); + value = NodeUtil.newUndefinedNode(srcLocation); + } + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(v, value, referenceInfo.references); + staleVars.add(v); + } else if (refCount == firstRefAfterInit) { + Reference reference = referenceInfo.references.get( + firstRefAfterInit - 1); + if (canInline(declaration, init, reference)) { + inline(v, declaration, init, reference); + staleVars.add(v); + } + } else if (declaration != init && refCount == 2) { + if (isValidDeclaration(declaration) && isValidInitialization(init)) { + Node value = init.getAssignedValue(); + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(v, value, referenceInfo.references); + staleVars.add(v); + } + } + if (!maybeModifiedArguments && + !staleVars.contains(v) && + referenceInfo.isWellDefined() && + referenceInfo.isAssignedOnceInLifetime()) { + List refs = referenceInfo.references; + for (int i = 1 ; i < refs.size(); i++) { + Node nameNode = refs.get(i).getNode(); + if (aliasCandidates.containsKey(nameNode)) { + AliasCandidate candidate = aliasCandidates.get(nameNode); + if (!staleVars.contains(candidate.alias) && + !isVarInlineForbidden(candidate.alias)) { + Reference aliasInit; + aliasInit = candidate.refInfo.getInitializingReference(); + Node value = aliasInit.getAssignedValue(); + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(candidate.alias, + value, + candidate.refInfo.references); + staleVars.add(candidate.alias); + } + } + } + } + } +"," private void inlineNonConstants( + Var v, ReferenceCollection referenceInfo, + boolean maybeModifiedArguments) { + int refCount = referenceInfo.references.size(); + Reference declaration = referenceInfo.references.get(0); + Reference init = referenceInfo.getInitializingReference(); + int firstRefAfterInit = (declaration == init) ? 2 : 3; + if (refCount > 1 && + isImmutableAndWellDefinedVariable(v, referenceInfo)) { + Node value; + if (init != null) { + value = init.getAssignedValue(); + } else { + Node srcLocation = declaration.getNode(); + value = NodeUtil.newUndefinedNode(srcLocation); + } + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(v, value, referenceInfo.references); + staleVars.add(v); + } else if (refCount == firstRefAfterInit) { + Reference reference = referenceInfo.references.get( + firstRefAfterInit - 1); + if (canInline(declaration, init, reference)) { + inline(v, declaration, init, reference); + staleVars.add(v); + } + } else if (declaration != init && refCount == 2) { + if (isValidDeclaration(declaration) && isValidInitialization(init)) { + Node value = init.getAssignedValue(); + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(v, value, referenceInfo.references); + staleVars.add(v); + } + } + if (!maybeModifiedArguments && + !staleVars.contains(v) && + referenceInfo.isWellDefined() && + referenceInfo.isAssignedOnceInLifetime() && + (isInlineableDeclaredConstant(v, referenceInfo) || + referenceInfo.isOnlyAssignmentSameScopeAsDeclaration())) { + List refs = referenceInfo.references; + for (int i = 1 ; i < refs.size(); i++) { + Node nameNode = refs.get(i).getNode(); + if (aliasCandidates.containsKey(nameNode)) { + AliasCandidate candidate = aliasCandidates.get(nameNode); + if (!staleVars.contains(candidate.alias) && + !isVarInlineForbidden(candidate.alias)) { + Reference aliasInit; + aliasInit = candidate.refInfo.getInitializingReference(); + Node value = aliasInit.getAssignedValue(); + Preconditions.checkNotNull(value); + inlineWellDefinedVariable(candidate.alias, + value, + candidate.refInfo.references); + staleVars.add(candidate.alias); + } + } + } + } + } +" +Jsoup-59," final void newAttribute() { + if (attributes == null) + attributes = new Attributes(); + if (pendingAttributeName != null) { + pendingAttributeName = pendingAttributeName.trim(); + Attribute attribute; + if (hasPendingAttributeValue) + attribute = new Attribute(pendingAttributeName, + pendingAttributeValue.length() > 0 ? pendingAttributeValue.toString() : pendingAttributeValueS); + else if (hasEmptyAttributeValue) + attribute = new Attribute(pendingAttributeName, """"); + else + attribute = new BooleanAttribute(pendingAttributeName); + attributes.put(attribute); + } + pendingAttributeName = null; + hasEmptyAttributeValue = false; + hasPendingAttributeValue = false; + reset(pendingAttributeValue); + pendingAttributeValueS = null; + } +"," final void newAttribute() { + if (attributes == null) + attributes = new Attributes(); + if (pendingAttributeName != null) { + pendingAttributeName = pendingAttributeName.trim(); + if (pendingAttributeName.length() > 0) { + Attribute attribute; + if (hasPendingAttributeValue) + attribute = new Attribute(pendingAttributeName, + pendingAttributeValue.length() > 0 ? pendingAttributeValue.toString() : pendingAttributeValueS); + else if (hasEmptyAttributeValue) + attribute = new Attribute(pendingAttributeName, """"); + else + attribute = new BooleanAttribute(pendingAttributeName); + attributes.put(attribute); + } + } + pendingAttributeName = null; + hasEmptyAttributeValue = false; + hasPendingAttributeValue = false; + reset(pendingAttributeValue); + pendingAttributeValueS = null; + } +" +Lang-28," public int translate(CharSequence input, int index, Writer out) throws IOException { + if(input.charAt(index) == '&' && input.charAt(index + 1) == '#') { + int start = index + 2; + boolean isHex = false; + char firstChar = input.charAt(start); + if(firstChar == 'x' || firstChar == 'X') { + start++; + isHex = true; + } + int end = start; + while(input.charAt(end) != ';') { + end++; + } + int entityValue; + try { + if(isHex) { + entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16); + } else { + entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10); + } + } catch(NumberFormatException nfe) { + return 0; + } + out.write(entityValue); + return 2 + (end - start) + (isHex ? 1 : 0) + 1; + } + return 0; + } +"," public int translate(CharSequence input, int index, Writer out) throws IOException { + if(input.charAt(index) == '&' && input.charAt(index + 1) == '#') { + int start = index + 2; + boolean isHex = false; + char firstChar = input.charAt(start); + if(firstChar == 'x' || firstChar == 'X') { + start++; + isHex = true; + } + int end = start; + while(input.charAt(end) != ';') { + end++; + } + int entityValue; + try { + if(isHex) { + entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 16); + } else { + entityValue = Integer.parseInt(input.subSequence(start, end).toString(), 10); + } + } catch(NumberFormatException nfe) { + return 0; + } + if(entityValue > 0xFFFF) { + char[] chrs = Character.toChars(entityValue); + out.write(chrs[0]); + out.write(chrs[1]); + } else { + out.write(entityValue); + } + return 2 + (end - start) + (isHex ? 1 : 0) + 1; + } + return 0; + } +" +Math-87," private Integer getBasicRow(final int col) { + Integer row = null; + for (int i = getNumObjectiveFunctions(); i < getHeight(); i++) { + if (!MathUtils.equals(getEntry(i, col), 0.0, epsilon)) { + if (row == null) { + row = i; + } else { + return null; + } + } + } + return row; + } +"," private Integer getBasicRow(final int col) { + Integer row = null; + for (int i = getNumObjectiveFunctions(); i < getHeight(); i++) { + if (MathUtils.equals(getEntry(i, col), 1.0, epsilon) && (row == null)) { + row = i; + } else if (!MathUtils.equals(getEntry(i, col), 0.0, epsilon)) { + return null; + } + } + return row; + } +" +JacksonCore-23," public DefaultPrettyPrinter createInstance() { + return new DefaultPrettyPrinter(this); + } +"," public DefaultPrettyPrinter createInstance() { + if (getClass() != DefaultPrettyPrinter.class) { + throw new IllegalStateException(""Failed `createInstance()`: ""+getClass().getName() + +"" does not override method; it has to""); + } + return new DefaultPrettyPrinter(this); + } +" +Closure-122," private void handleBlockComment(Comment comment) { + if (comment.getValue().indexOf(""/* @"") != -1 || comment.getValue().indexOf(""\n * @"") != -1) { + errorReporter.warning( + SUSPICIOUS_COMMENT_WARNING, + sourceName, + comment.getLineno(), """", 0); + } + } +"," private void handleBlockComment(Comment comment) { + Pattern p = Pattern.compile(""(/|(\n[ \t]*))\\*[ \t]*@[a-zA-Z]""); + if (p.matcher(comment.getValue()).find()) { + errorReporter.warning( + SUSPICIOUS_COMMENT_WARNING, + sourceName, + comment.getLineno(), """", 0); + } + } +" +JacksonDatabind-8," protected void verifyNonDup(AnnotatedWithParams newOne, int typeIndex, boolean explicit) + { + final int mask = (1 << typeIndex); + _hasNonDefaultCreator = true; + AnnotatedWithParams oldOne = _creators[typeIndex]; + if (oldOne != null) { + if ((_explicitCreators & mask) != 0) { + if (!explicit) { + return; + } + } + if (oldOne.getClass() == newOne.getClass()) { + throw new IllegalArgumentException(""Conflicting ""+TYPE_DESCS[typeIndex] + +"" creators: already had explicitly marked ""+oldOne+"", encountered ""+newOne); + } + } + if (explicit) { + _explicitCreators |= mask; + } + _creators[typeIndex] = _fixAccess(newOne); + } +"," protected void verifyNonDup(AnnotatedWithParams newOne, int typeIndex, boolean explicit) + { + final int mask = (1 << typeIndex); + _hasNonDefaultCreator = true; + AnnotatedWithParams oldOne = _creators[typeIndex]; + if (oldOne != null) { + boolean verify; + if ((_explicitCreators & mask) != 0) { + if (!explicit) { + return; + } + verify = true; + } else { + verify = !explicit; + } + if (verify && (oldOne.getClass() == newOne.getClass())) { + Class oldType = oldOne.getRawParameterType(0); + Class newType = newOne.getRawParameterType(0); + if (oldType == newType) { + throw new IllegalArgumentException(""Conflicting ""+TYPE_DESCS[typeIndex] + +"" creators: already had explicitly marked ""+oldOne+"", encountered ""+newOne); + } + if (newType.isAssignableFrom(oldType)) { + return; + } + } + } + if (explicit) { + _explicitCreators |= mask; + } + _creators[typeIndex] = _fixAccess(newOne); + } +" +JacksonDatabind-49," public Object generateId(Object forPojo) { + id = generator.generateId(forPojo); + return id; + } +"," public Object generateId(Object forPojo) { + if (id == null) { + id = generator.generateId(forPojo); + } + return id; + } +" +Jsoup-6," static String unescape(String string) { + if (!string.contains(""&"")) + return string; + Matcher m = unescapePattern.matcher(string); + StringBuffer accum = new StringBuffer(string.length()); + while (m.find()) { + int charval = -1; + String num = m.group(3); + if (num != null) { + try { + int base = m.group(2) != null ? 16 : 10; + charval = Integer.valueOf(num, base); + } catch (NumberFormatException e) { + } + } else { + String name = m.group(1); + if (full.containsKey(name)) + charval = full.get(name); + } + if (charval != -1 || charval > 0xFFFF) { + String c = Character.toString((char) charval); + m.appendReplacement(accum, c); + } else { + m.appendReplacement(accum, m.group(0)); + } + } + m.appendTail(accum); + return accum.toString(); + } +"," static String unescape(String string) { + if (!string.contains(""&"")) + return string; + Matcher m = unescapePattern.matcher(string); + StringBuffer accum = new StringBuffer(string.length()); + while (m.find()) { + int charval = -1; + String num = m.group(3); + if (num != null) { + try { + int base = m.group(2) != null ? 16 : 10; + charval = Integer.valueOf(num, base); + } catch (NumberFormatException e) { + } + } else { + String name = m.group(1); + if (full.containsKey(name)) + charval = full.get(name); + } + if (charval != -1 || charval > 0xFFFF) { + String c = Character.toString((char) charval); + m.appendReplacement(accum, Matcher.quoteReplacement(c)); + } else { + m.appendReplacement(accum, Matcher.quoteReplacement(m.group(0))); + } + } + m.appendTail(accum); + return accum.toString(); + } +" +Cli-12," protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption) + { + List tokens = new ArrayList(); + boolean eatTheRest = false; + for (int i = 0; i < arguments.length; i++) + { + String arg = arguments[i]; + if (""--"".equals(arg)) + { + eatTheRest = true; + tokens.add(""--""); + } + else if (""-"".equals(arg)) + { + tokens.add(""-""); + } + else if (arg.startsWith(""-"")) + { + String opt = Util.stripLeadingHyphens(arg); + if (options.hasOption(opt)) + { + tokens.add(arg); + } + else + { + if (options.hasOption(arg.substring(0, 2))) + { + tokens.add(arg.substring(0, 2)); + tokens.add(arg.substring(2)); + } + else + { + eatTheRest = stopAtNonOption; + tokens.add(arg); + } + } + } + else + { + tokens.add(arg); + } + if (eatTheRest) + { + for (i++; i < arguments.length; i++) + { + tokens.add(arguments[i]); + } + } + } + return (String[]) tokens.toArray(new String[tokens.size()]); + } +"," protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption) + { + List tokens = new ArrayList(); + boolean eatTheRest = false; + for (int i = 0; i < arguments.length; i++) + { + String arg = arguments[i]; + if (""--"".equals(arg)) + { + eatTheRest = true; + tokens.add(""--""); + } + else if (""-"".equals(arg)) + { + tokens.add(""-""); + } + else if (arg.startsWith(""-"")) + { + String opt = Util.stripLeadingHyphens(arg); + if (options.hasOption(opt)) + { + tokens.add(arg); + } + else + { + if (opt.indexOf('=') != -1 && options.hasOption(opt.substring(0, opt.indexOf('=')))) + { + tokens.add(arg.substring(0, arg.indexOf('='))); + tokens.add(arg.substring(arg.indexOf('=') + 1)); + } + else if (options.hasOption(arg.substring(0, 2))) + { + tokens.add(arg.substring(0, 2)); + tokens.add(arg.substring(2)); + } + else + { + eatTheRest = stopAtNonOption; + tokens.add(arg); + } + } + } + else + { + tokens.add(arg); + } + if (eatTheRest) + { + for (i++; i < arguments.length; i++) + { + tokens.add(arguments[i]); + } + } + } + return (String[]) tokens.toArray(new String[tokens.size()]); + } +" +Codec-5," void decode(byte[] in, int inPos, int inAvail) { + if (eof) { + return; + } + if (inAvail < 0) { + eof = true; + } + for (int i = 0; i < inAvail; i++) { + if (buffer == null || buffer.length - pos < decodeSize) { + resizeBuffer(); + } + byte b = in[inPos++]; + if (b == PAD) { + eof = true; + break; + } else { + if (b >= 0 && b < DECODE_TABLE.length) { + int result = DECODE_TABLE[b]; + if (result >= 0) { + modulus = (++modulus) % 4; + x = (x << 6) + result; + if (modulus == 0) { + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + buffer[pos++] = (byte) ((x >> 8) & MASK_8BITS); + buffer[pos++] = (byte) (x & MASK_8BITS); + } + } + } + } + } + if (eof && modulus != 0) { + x = x << 6; + switch (modulus) { + case 2 : + x = x << 6; + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + break; + case 3 : + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + buffer[pos++] = (byte) ((x >> 8) & MASK_8BITS); + break; + } + } + } +"," void decode(byte[] in, int inPos, int inAvail) { + if (eof) { + return; + } + if (inAvail < 0) { + eof = true; + } + for (int i = 0; i < inAvail; i++) { + if (buffer == null || buffer.length - pos < decodeSize) { + resizeBuffer(); + } + byte b = in[inPos++]; + if (b == PAD) { + eof = true; + break; + } else { + if (b >= 0 && b < DECODE_TABLE.length) { + int result = DECODE_TABLE[b]; + if (result >= 0) { + modulus = (++modulus) % 4; + x = (x << 6) + result; + if (modulus == 0) { + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + buffer[pos++] = (byte) ((x >> 8) & MASK_8BITS); + buffer[pos++] = (byte) (x & MASK_8BITS); + } + } + } + } + } + if (eof && modulus != 0) { + if (buffer == null || buffer.length - pos < decodeSize) { + resizeBuffer(); + } + x = x << 6; + switch (modulus) { + case 2 : + x = x << 6; + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + break; + case 3 : + buffer[pos++] = (byte) ((x >> 16) & MASK_8BITS); + buffer[pos++] = (byte) ((x >> 8) & MASK_8BITS); + break; + } + } + } +" +Chart-26," protected AxisState drawLabel(String label, Graphics2D g2, + Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, + AxisState state, PlotRenderingInfo plotState) { + if (state == null) { + throw new IllegalArgumentException(""Null 'state' argument.""); + } + if ((label == null) || (label.equals(""""))) { + return state; + } + Font font = getLabelFont(); + RectangleInsets insets = getLabelInsets(); + g2.setFont(font); + g2.setPaint(getLabelPaint()); + FontMetrics fm = g2.getFontMetrics(); + Rectangle2D labelBounds = TextUtilities.getTextBounds(label, g2, fm); + Shape hotspot = null; + if (edge == RectangleEdge.TOP) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) dataArea.getCenterX(); + float labely = (float) (state.getCursor() - insets.getBottom() + - h / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorUp(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.BOTTOM) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) dataArea.getCenterX(); + float labely = (float) (state.getCursor() + insets.getTop() + + h / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorDown(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.LEFT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() - Math.PI / 2.0, labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) (state.getCursor() - insets.getRight() + - w / 2.0); + float labely = (float) dataArea.getCenterY(); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle() - Math.PI / 2.0, + TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorLeft(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + else if (edge == RectangleEdge.RIGHT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() + Math.PI / 2.0, + labelBounds.getCenterX(), labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) (state.getCursor() + + insets.getLeft() + w / 2.0); + float labely = (float) (dataArea.getY() + dataArea.getHeight() + / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle() + Math.PI / 2.0, + TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorRight(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + if (plotState != null && hotspot != null) { + ChartRenderingInfo owner = plotState.getOwner(); + EntityCollection entities = owner.getEntityCollection(); + if (entities != null) { + entities.add(new AxisLabelEntity(this, hotspot, + this.labelToolTip, this.labelURL)); + } + } + return state; + } +"," protected AxisState drawLabel(String label, Graphics2D g2, + Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, + AxisState state, PlotRenderingInfo plotState) { + if (state == null) { + throw new IllegalArgumentException(""Null 'state' argument.""); + } + if ((label == null) || (label.equals(""""))) { + return state; + } + Font font = getLabelFont(); + RectangleInsets insets = getLabelInsets(); + g2.setFont(font); + g2.setPaint(getLabelPaint()); + FontMetrics fm = g2.getFontMetrics(); + Rectangle2D labelBounds = TextUtilities.getTextBounds(label, g2, fm); + Shape hotspot = null; + if (edge == RectangleEdge.TOP) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) dataArea.getCenterX(); + float labely = (float) (state.getCursor() - insets.getBottom() + - h / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorUp(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.BOTTOM) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle(), labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) dataArea.getCenterX(); + float labely = (float) (state.getCursor() + insets.getTop() + + h / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle(), TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorDown(insets.getTop() + labelBounds.getHeight() + + insets.getBottom()); + } + else if (edge == RectangleEdge.LEFT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() - Math.PI / 2.0, labelBounds.getCenterX(), + labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) (state.getCursor() - insets.getRight() + - w / 2.0); + float labely = (float) dataArea.getCenterY(); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle() - Math.PI / 2.0, + TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorLeft(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + else if (edge == RectangleEdge.RIGHT) { + AffineTransform t = AffineTransform.getRotateInstance( + getLabelAngle() + Math.PI / 2.0, + labelBounds.getCenterX(), labelBounds.getCenterY()); + Shape rotatedLabelBounds = t.createTransformedShape(labelBounds); + labelBounds = rotatedLabelBounds.getBounds2D(); + float w = (float) labelBounds.getWidth(); + float h = (float) labelBounds.getHeight(); + float labelx = (float) (state.getCursor() + + insets.getLeft() + w / 2.0); + float labely = (float) (dataArea.getY() + dataArea.getHeight() + / 2.0); + TextUtilities.drawRotatedString(label, g2, labelx, labely, + TextAnchor.CENTER, getLabelAngle() + Math.PI / 2.0, + TextAnchor.CENTER); + hotspot = new Rectangle2D.Float(labelx - w / 2.0f, + labely - h / 2.0f, w, h); + state.cursorRight(insets.getLeft() + labelBounds.getWidth() + + insets.getRight()); + } + if (plotState != null && hotspot != null) { + ChartRenderingInfo owner = plotState.getOwner(); + if (owner != null) { + EntityCollection entities = owner.getEntityCollection(); + if (entities != null) { + entities.add(new AxisLabelEntity(this, hotspot, + this.labelToolTip, this.labelURL)); + } + } + } + return state; + } +" +Math-105," public double getSumSquaredErrors() { + return sumYY - sumXY * sumXY / sumXX; + } +"," public double getSumSquaredErrors() { + return Math.max(0d, sumYY - sumXY * sumXY / sumXX); + } +" +Time-18," public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, + int hourOfDay, int minuteOfHour, + int secondOfMinute, int millisOfSecond) + throws IllegalArgumentException + { + Chronology base; + if ((base = getBase()) != null) { + return base.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + } + long instant; + instant = iGregorianChronology.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + if (instant < iCutoverMillis) { + instant = iJulianChronology.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + if (instant >= iCutoverMillis) { + throw new IllegalArgumentException(""Specified date does not exist""); + } + } + return instant; + } +"," public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, + int hourOfDay, int minuteOfHour, + int secondOfMinute, int millisOfSecond) + throws IllegalArgumentException + { + Chronology base; + if ((base = getBase()) != null) { + return base.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + } + long instant; + try { + instant = iGregorianChronology.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + } catch (IllegalFieldValueException ex) { + if (monthOfYear != 2 || dayOfMonth != 29) { + throw ex; + } + instant = iGregorianChronology.getDateTimeMillis + (year, monthOfYear, 28, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + if (instant >= iCutoverMillis) { + throw ex; + } + } + if (instant < iCutoverMillis) { + instant = iJulianChronology.getDateTimeMillis + (year, monthOfYear, dayOfMonth, + hourOfDay, minuteOfHour, secondOfMinute, millisOfSecond); + if (instant >= iCutoverMillis) { + throw new IllegalArgumentException(""Specified date does not exist""); + } + } + return instant; + } +" +JacksonDatabind-34," public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException + { + if (_isInt) { + visitIntFormat(visitor, typeHint, JsonParser.NumberType.BIG_INTEGER); + } else { + Class h = handledType(); + if (h == BigDecimal.class) { + visitFloatFormat(visitor, typeHint, JsonParser.NumberType.BIG_INTEGER); + } else { + visitor.expectNumberFormat(typeHint); + } + } + } +"," public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException + { + if (_isInt) { + visitIntFormat(visitor, typeHint, JsonParser.NumberType.BIG_INTEGER); + } else { + Class h = handledType(); + if (h == BigDecimal.class) { + visitFloatFormat(visitor, typeHint, JsonParser.NumberType.BIG_DECIMAL); + } else { + visitor.expectNumberFormat(typeHint); + } + } + } +" +Mockito-28," private void injectMockCandidate(Class awaitingInjectionClazz, Set mocks, Object fieldInstance) { + for(Field field : orderedInstanceFieldsFrom(awaitingInjectionClazz)) { + mockCandidateFilter.filterCandidate(mocks, field, fieldInstance).thenInject(); + } + } +"," private void injectMockCandidate(Class awaitingInjectionClazz, Set mocks, Object fieldInstance) { + for(Field field : orderedInstanceFieldsFrom(awaitingInjectionClazz)) { + Object injected = mockCandidateFilter.filterCandidate(mocks, field, fieldInstance).thenInject(); + mocks.remove(injected); + } + } +" +Mockito-29," public void describeTo(Description description) { + description.appendText(""same(""); + appendQuoting(description); + description.appendText(wanted.toString()); + appendQuoting(description); + description.appendText("")""); + } +"," public void describeTo(Description description) { + description.appendText(""same(""); + appendQuoting(description); + description.appendText(wanted == null ? ""null"" : wanted.toString()); + appendQuoting(description); + description.appendText("")""); + } +" +Lang-52," private static void escapeJavaStyleString(Writer out, String str, boolean escapeSingleQuote) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (str == null) { + return; + } + int sz; + sz = str.length(); + for (int i = 0; i < sz; i++) { + char ch = str.charAt(i); + if (ch > 0xfff) { + out.write(""\\u"" + hex(ch)); + } else if (ch > 0xff) { + out.write(""\\u0"" + hex(ch)); + } else if (ch > 0x7f) { + out.write(""\\u00"" + hex(ch)); + } else if (ch < 32) { + switch (ch) { + case '\b': + out.write('\\'); + out.write('b'); + break; + case '\n': + out.write('\\'); + out.write('n'); + break; + case '\t': + out.write('\\'); + out.write('t'); + break; + case '\f': + out.write('\\'); + out.write('f'); + break; + case '\r': + out.write('\\'); + out.write('r'); + break; + default : + if (ch > 0xf) { + out.write(""\\u00"" + hex(ch)); + } else { + out.write(""\\u000"" + hex(ch)); + } + break; + } + } else { + switch (ch) { + case '\'': + if (escapeSingleQuote) { + out.write('\\'); + } + out.write('\''); + break; + case '""': + out.write('\\'); + out.write('""'); + break; + case '\\': + out.write('\\'); + out.write('\\'); + break; + default : + out.write(ch); + break; + } + } + } + } +"," private static void escapeJavaStyleString(Writer out, String str, boolean escapeSingleQuote) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (str == null) { + return; + } + int sz; + sz = str.length(); + for (int i = 0; i < sz; i++) { + char ch = str.charAt(i); + if (ch > 0xfff) { + out.write(""\\u"" + hex(ch)); + } else if (ch > 0xff) { + out.write(""\\u0"" + hex(ch)); + } else if (ch > 0x7f) { + out.write(""\\u00"" + hex(ch)); + } else if (ch < 32) { + switch (ch) { + case '\b': + out.write('\\'); + out.write('b'); + break; + case '\n': + out.write('\\'); + out.write('n'); + break; + case '\t': + out.write('\\'); + out.write('t'); + break; + case '\f': + out.write('\\'); + out.write('f'); + break; + case '\r': + out.write('\\'); + out.write('r'); + break; + default : + if (ch > 0xf) { + out.write(""\\u00"" + hex(ch)); + } else { + out.write(""\\u000"" + hex(ch)); + } + break; + } + } else { + switch (ch) { + case '\'': + if (escapeSingleQuote) { + out.write('\\'); + } + out.write('\''); + break; + case '""': + out.write('\\'); + out.write('""'); + break; + case '\\': + out.write('\\'); + out.write('\\'); + break; + case '/': + out.write('\\'); + out.write('/'); + break; + default : + out.write(ch); + break; + } + } + } + } +" +Jsoup-34," int nextIndexOf(CharSequence seq) { + char startChar = seq.charAt(0); + for (int offset = pos; offset < length; offset++) { + if (startChar != input[offset]) + while(++offset < length && startChar != input[offset]); + int i = offset + 1; + int last = i + seq.length()-1; + if (offset < length) { + for (int j = 1; i < last && seq.charAt(j) == input[i]; i++, j++); + if (i == last) + return offset - pos; + } + } + return -1; + } +"," int nextIndexOf(CharSequence seq) { + char startChar = seq.charAt(0); + for (int offset = pos; offset < length; offset++) { + if (startChar != input[offset]) + while(++offset < length && startChar != input[offset]); + int i = offset + 1; + int last = i + seq.length()-1; + if (offset < length && last <= length) { + for (int j = 1; i < last && seq.charAt(j) == input[i]; i++, j++); + if (i == last) + return offset - pos; + } + } + return -1; + } +" +Closure-86," static boolean evaluatesToLocalValue(Node value, Predicate locals) { + switch (value.getType()) { + case Token.ASSIGN: + return NodeUtil.isImmutableValue(value.getLastChild()) + || (locals.apply(value) + && evaluatesToLocalValue(value.getLastChild(), locals)); + case Token.COMMA: + return evaluatesToLocalValue(value.getLastChild(), locals); + case Token.AND: + case Token.OR: + return evaluatesToLocalValue(value.getFirstChild(), locals) + && evaluatesToLocalValue(value.getLastChild(), locals); + case Token.HOOK: + return evaluatesToLocalValue(value.getFirstChild().getNext(), locals) + && evaluatesToLocalValue(value.getLastChild(), locals); + case Token.INC: + case Token.DEC: + if (value.getBooleanProp(Node.INCRDECR_PROP)) { + return evaluatesToLocalValue(value.getFirstChild(), locals); + } else { + return true; + } + case Token.THIS: + return locals.apply(value); + case Token.NAME: + return isImmutableValue(value) || locals.apply(value); + case Token.GETELEM: + case Token.GETPROP: + return locals.apply(value); + case Token.CALL: + return callHasLocalResult(value) + || isToStringMethodCall(value) + || locals.apply(value); + case Token.NEW: + return true; + case Token.FUNCTION: + case Token.REGEXP: + case Token.ARRAYLIT: + case Token.OBJECTLIT: + return true; + case Token.IN: + return true; + default: + if (isAssignmentOp(value) + || isSimpleOperator(value) + || isImmutableValue(value)) { + return true; + } + throw new IllegalStateException( + ""Unexpected expression node"" + value + + ""\n parent:"" + value.getParent()); + } + } +"," static boolean evaluatesToLocalValue(Node value, Predicate locals) { + switch (value.getType()) { + case Token.ASSIGN: + return NodeUtil.isImmutableValue(value.getLastChild()) + || (locals.apply(value) + && evaluatesToLocalValue(value.getLastChild(), locals)); + case Token.COMMA: + return evaluatesToLocalValue(value.getLastChild(), locals); + case Token.AND: + case Token.OR: + return evaluatesToLocalValue(value.getFirstChild(), locals) + && evaluatesToLocalValue(value.getLastChild(), locals); + case Token.HOOK: + return evaluatesToLocalValue(value.getFirstChild().getNext(), locals) + && evaluatesToLocalValue(value.getLastChild(), locals); + case Token.INC: + case Token.DEC: + if (value.getBooleanProp(Node.INCRDECR_PROP)) { + return evaluatesToLocalValue(value.getFirstChild(), locals); + } else { + return true; + } + case Token.THIS: + return locals.apply(value); + case Token.NAME: + return isImmutableValue(value) || locals.apply(value); + case Token.GETELEM: + case Token.GETPROP: + return locals.apply(value); + case Token.CALL: + return callHasLocalResult(value) + || isToStringMethodCall(value) + || locals.apply(value); + case Token.NEW: + return false; + case Token.FUNCTION: + case Token.REGEXP: + case Token.ARRAYLIT: + case Token.OBJECTLIT: + return true; + case Token.IN: + return true; + default: + if (isAssignmentOp(value) + || isSimpleOperator(value) + || isImmutableValue(value)) { + return true; + } + throw new IllegalStateException( + ""Unexpected expression node"" + value + + ""\n parent:"" + value.getParent()); + } + } +" +Jsoup-32," public Element clone() { + Element clone = (Element) super.clone(); + clone.classNames(); + return clone; + } +"," public Element clone() { + Element clone = (Element) super.clone(); + clone.classNames = null; + return clone; + } +" +Jsoup-64," private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rawtext); + tb.markInsertionMode(); + tb.transition(Text); + } +"," private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { + tb.tokeniser.transition(TokeniserState.Rawtext); + tb.markInsertionMode(); + tb.transition(Text); + tb.insert(startTag); + } +" +Lang-11," public static String random(int count, int start, int end, boolean letters, boolean numbers, + char[] chars, Random random) { + if (count == 0) { + return """"; + } else if (count < 0) { + throw new IllegalArgumentException(""Requested random string length "" + count + "" is less than 0.""); + } + if (chars != null && chars.length == 0) { + throw new IllegalArgumentException(""The chars array must not be empty""); + } + if (start == 0 && end == 0) { + if (chars != null) { + end = chars.length; + } else { + if (!letters && !numbers) { + end = Integer.MAX_VALUE; + } else { + end = 'z' + 1; + start = ' '; + } + } + } + char[] buffer = new char[count]; + int gap = end - start; + while (count-- != 0) { + char ch; + if (chars == null) { + ch = (char) (random.nextInt(gap) + start); + } else { + ch = chars[random.nextInt(gap) + start]; + } + if (letters && Character.isLetter(ch) + || numbers && Character.isDigit(ch) + || !letters && !numbers) { + if(ch >= 56320 && ch <= 57343) { + if(count == 0) { + count++; + } else { + buffer[count] = ch; + count--; + buffer[count] = (char) (55296 + random.nextInt(128)); + } + } else if(ch >= 55296 && ch <= 56191) { + if(count == 0) { + count++; + } else { + buffer[count] = (char) (56320 + random.nextInt(128)); + count--; + buffer[count] = ch; + } + } else if(ch >= 56192 && ch <= 56319) { + count++; + } else { + buffer[count] = ch; + } + } else { + count++; + } + } + return new String(buffer); + } +"," public static String random(int count, int start, int end, boolean letters, boolean numbers, + char[] chars, Random random) { + if (count == 0) { + return """"; + } else if (count < 0) { + throw new IllegalArgumentException(""Requested random string length "" + count + "" is less than 0.""); + } + if (chars != null && chars.length == 0) { + throw new IllegalArgumentException(""The chars array must not be empty""); + } + if (start == 0 && end == 0) { + if (chars != null) { + end = chars.length; + } else { + if (!letters && !numbers) { + end = Integer.MAX_VALUE; + } else { + end = 'z' + 1; + start = ' '; + } + } + } else { + if (end <= start) { + throw new IllegalArgumentException(""Parameter end ("" + end + "") must be greater than start ("" + start + "")""); + } + } + char[] buffer = new char[count]; + int gap = end - start; + while (count-- != 0) { + char ch; + if (chars == null) { + ch = (char) (random.nextInt(gap) + start); + } else { + ch = chars[random.nextInt(gap) + start]; + } + if (letters && Character.isLetter(ch) + || numbers && Character.isDigit(ch) + || !letters && !numbers) { + if(ch >= 56320 && ch <= 57343) { + if(count == 0) { + count++; + } else { + buffer[count] = ch; + count--; + buffer[count] = (char) (55296 + random.nextInt(128)); + } + } else if(ch >= 55296 && ch <= 56191) { + if(count == 0) { + count++; + } else { + buffer[count] = (char) (56320 + random.nextInt(128)); + count--; + buffer[count] = ch; + } + } else if(ch >= 56192 && ch <= 56319) { + count++; + } else { + buffer[count] = ch; + } + } else { + count++; + } + } + return new String(buffer); + } +" +Jsoup-46," static void escape(StringBuilder accum, String string, Document.OutputSettings out, + boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) { + boolean lastWasWhite = false; + boolean reachedNonWhite = false; + final EscapeMode escapeMode = out.escapeMode(); + final CharsetEncoder encoder = out.encoder(); + final CoreCharset coreCharset = CoreCharset.byName(encoder.charset().name()); + final Map map = escapeMode.getMap(); + final int length = string.length(); + int codePoint; + for (int offset = 0; offset < length; offset += Character.charCount(codePoint)) { + codePoint = string.codePointAt(offset); + if (normaliseWhite) { + if (StringUtil.isWhitespace(codePoint)) { + if ((stripLeadingWhite && !reachedNonWhite) || lastWasWhite) + continue; + accum.append(' '); + lastWasWhite = true; + continue; + } else { + lastWasWhite = false; + reachedNonWhite = true; + } + } + if (codePoint < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + final char c = (char) codePoint; + switch (c) { + case '&': + accum.append(""&""); + break; + case 0xA0: + if (escapeMode != EscapeMode.xhtml) + accum.append("" ""); + else + accum.append(c); + break; + case '<': + if (!inAttribute) + accum.append(""<""); + else + accum.append(c); + break; + case '>': + if (!inAttribute) + accum.append("">""); + else + accum.append(c); + break; + case '""': + if (inAttribute) + accum.append("""""); + else + accum.append(c); + break; + default: + if (canEncode(coreCharset, c, encoder)) + accum.append(c); + else if (map.containsKey(c)) + accum.append('&').append(map.get(c)).append(';'); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } else { + final String c = new String(Character.toChars(codePoint)); + if (encoder.canEncode(c)) + accum.append(c); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } + } +"," static void escape(StringBuilder accum, String string, Document.OutputSettings out, + boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) { + boolean lastWasWhite = false; + boolean reachedNonWhite = false; + final EscapeMode escapeMode = out.escapeMode(); + final CharsetEncoder encoder = out.encoder(); + final CoreCharset coreCharset = CoreCharset.byName(encoder.charset().name()); + final Map map = escapeMode.getMap(); + final int length = string.length(); + int codePoint; + for (int offset = 0; offset < length; offset += Character.charCount(codePoint)) { + codePoint = string.codePointAt(offset); + if (normaliseWhite) { + if (StringUtil.isWhitespace(codePoint)) { + if ((stripLeadingWhite && !reachedNonWhite) || lastWasWhite) + continue; + accum.append(' '); + lastWasWhite = true; + continue; + } else { + lastWasWhite = false; + reachedNonWhite = true; + } + } + if (codePoint < Character.MIN_SUPPLEMENTARY_CODE_POINT) { + final char c = (char) codePoint; + switch (c) { + case '&': + accum.append(""&""); + break; + case 0xA0: + if (escapeMode != EscapeMode.xhtml) + accum.append("" ""); + else + accum.append("" ""); + break; + case '<': + if (!inAttribute) + accum.append(""<""); + else + accum.append(c); + break; + case '>': + if (!inAttribute) + accum.append("">""); + else + accum.append(c); + break; + case '""': + if (inAttribute) + accum.append("""""); + else + accum.append(c); + break; + default: + if (canEncode(coreCharset, c, encoder)) + accum.append(c); + else if (map.containsKey(c)) + accum.append('&').append(map.get(c)).append(';'); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } else { + final String c = new String(Character.toChars(codePoint)); + if (encoder.canEncode(c)) + accum.append(c); + else + accum.append(""&#x"").append(Integer.toHexString(codePoint)).append(';'); + } + } + } +" +Math-58," public double[] fit() { + final double[] guess = (new ParameterGuesser(getObservations())).guess(); + return fit(new Gaussian.Parametric(), guess); + } +"," public double[] fit() { + final double[] guess = (new ParameterGuesser(getObservations())).guess(); + return fit(guess); + } +" +Closure-7," public JSType caseObjectType(ObjectType type) { + if (value.equals(""function"")) { + JSType ctorType = getNativeType(U2U_CONSTRUCTOR_TYPE); + return resultEqualsValue && ctorType.isSubtype(type) ? ctorType : null; + } + return matchesExpectation(""object"") ? type : null; + } +"," public JSType caseObjectType(ObjectType type) { + if (value.equals(""function"")) { + JSType ctorType = getNativeType(U2U_CONSTRUCTOR_TYPE); + if (resultEqualsValue) { + return ctorType.getGreatestSubtype(type); + } else { + return type.isSubtype(ctorType) ? null : type; + } + } + return matchesExpectation(""object"") ? type : null; + } +" +Closure-73," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\0': sb.append(""\\0""); break; + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c <= 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +"," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\0': sb.append(""\\0""); break; + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c < 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +" +Cli-28," protected void processProperties(Properties properties) + { + if (properties == null) + { + return; + } + for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) + { + String option = e.nextElement().toString(); + if (!cmd.hasOption(option)) + { + Option opt = getOptions().getOption(option); + String value = properties.getProperty(option); + if (opt.hasArg()) + { + if (opt.getValues() == null || opt.getValues().length == 0) + { + try + { + opt.addValueForProcessing(value); + } + catch (RuntimeException exp) + { + } + } + } + else if (!(""yes"".equalsIgnoreCase(value) + || ""true"".equalsIgnoreCase(value) + || ""1"".equalsIgnoreCase(value))) + { + break; + } + cmd.addOption(opt); + } + } + } +"," protected void processProperties(Properties properties) + { + if (properties == null) + { + return; + } + for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) + { + String option = e.nextElement().toString(); + if (!cmd.hasOption(option)) + { + Option opt = getOptions().getOption(option); + String value = properties.getProperty(option); + if (opt.hasArg()) + { + if (opt.getValues() == null || opt.getValues().length == 0) + { + try + { + opt.addValueForProcessing(value); + } + catch (RuntimeException exp) + { + } + } + } + else if (!(""yes"".equalsIgnoreCase(value) + || ""true"".equalsIgnoreCase(value) + || ""1"".equalsIgnoreCase(value))) + { + continue; + } + cmd.addOption(opt); + } + } + } +" +Closure-77," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c <= 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +"," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\0': sb.append(""\\0""); break; + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c <= 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +" +Cli-40," public static T createValue(final String str, final Class clazz) throws ParseException + { + if (PatternOptionBuilder.STRING_VALUE == clazz) + { + return (T) str; + } + else if (PatternOptionBuilder.OBJECT_VALUE == clazz) + { + return (T) createObject(str); + } + else if (PatternOptionBuilder.NUMBER_VALUE == clazz) + { + return (T) createNumber(str); + } + else if (PatternOptionBuilder.DATE_VALUE == clazz) + { + return (T) createDate(str); + } + else if (PatternOptionBuilder.CLASS_VALUE == clazz) + { + return (T) createClass(str); + } + else if (PatternOptionBuilder.FILE_VALUE == clazz) + { + return (T) createFile(str); + } + else if (PatternOptionBuilder.EXISTING_FILE_VALUE == clazz) + { + return (T) openFile(str); + } + else if (PatternOptionBuilder.FILES_VALUE == clazz) + { + return (T) createFiles(str); + } + else if (PatternOptionBuilder.URL_VALUE == clazz) + { + return (T) createURL(str); + } + else + { + return null; + } + } +"," public static T createValue(final String str, final Class clazz) throws ParseException + { + if (PatternOptionBuilder.STRING_VALUE == clazz) + { + return (T) str; + } + else if (PatternOptionBuilder.OBJECT_VALUE == clazz) + { + return (T) createObject(str); + } + else if (PatternOptionBuilder.NUMBER_VALUE == clazz) + { + return (T) createNumber(str); + } + else if (PatternOptionBuilder.DATE_VALUE == clazz) + { + return (T) createDate(str); + } + else if (PatternOptionBuilder.CLASS_VALUE == clazz) + { + return (T) createClass(str); + } + else if (PatternOptionBuilder.FILE_VALUE == clazz) + { + return (T) createFile(str); + } + else if (PatternOptionBuilder.EXISTING_FILE_VALUE == clazz) + { + return (T) openFile(str); + } + else if (PatternOptionBuilder.FILES_VALUE == clazz) + { + return (T) createFiles(str); + } + else if (PatternOptionBuilder.URL_VALUE == clazz) + { + return (T) createURL(str); + } + else + { + throw new ParseException(""Unable to handle the class: "" + clazz); + } + } +" +Lang-43," private StringBuffer appendQuotedString(String pattern, ParsePosition pos, + StringBuffer appendTo, boolean escapingOn) { + int start = pos.getIndex(); + char[] c = pattern.toCharArray(); + if (escapingOn && c[start] == QUOTE) { + return appendTo == null ? null : appendTo.append(QUOTE); + } + int lastHold = start; + for (int i = pos.getIndex(); i < pattern.length(); i++) { + if (escapingOn && pattern.substring(i).startsWith(ESCAPED_QUOTE)) { + appendTo.append(c, lastHold, pos.getIndex() - lastHold).append( + QUOTE); + pos.setIndex(i + ESCAPED_QUOTE.length()); + lastHold = pos.getIndex(); + continue; + } + switch (c[pos.getIndex()]) { + case QUOTE: + next(pos); + return appendTo == null ? null : appendTo.append(c, lastHold, + pos.getIndex() - lastHold); + default: + next(pos); + } + } + throw new IllegalArgumentException( + ""Unterminated quoted string at position "" + start); + } +"," private StringBuffer appendQuotedString(String pattern, ParsePosition pos, + StringBuffer appendTo, boolean escapingOn) { + int start = pos.getIndex(); + char[] c = pattern.toCharArray(); + if (escapingOn && c[start] == QUOTE) { + next(pos); + return appendTo == null ? null : appendTo.append(QUOTE); + } + int lastHold = start; + for (int i = pos.getIndex(); i < pattern.length(); i++) { + if (escapingOn && pattern.substring(i).startsWith(ESCAPED_QUOTE)) { + appendTo.append(c, lastHold, pos.getIndex() - lastHold).append( + QUOTE); + pos.setIndex(i + ESCAPED_QUOTE.length()); + lastHold = pos.getIndex(); + continue; + } + switch (c[pos.getIndex()]) { + case QUOTE: + next(pos); + return appendTo == null ? null : appendTo.append(c, lastHold, + pos.getIndex() - lastHold); + default: + next(pos); + } + } + throw new IllegalArgumentException( + ""Unterminated quoted string at position "" + start); + } +" +Compress-38," public boolean isDirectory() { + if (file != null) { + return file.isDirectory(); + } + if (linkFlag == LF_DIR) { + return true; + } + if (getName().endsWith(""/"")) { + return true; + } + return false; + } +"," public boolean isDirectory() { + if (file != null) { + return file.isDirectory(); + } + if (linkFlag == LF_DIR) { + return true; + } + if (!isPaxHeader() && !isGlobalPaxHeader() && getName().endsWith(""/"")) { + return true; + } + return false; + } +" +Time-17," public long adjustOffset(long instant, boolean earlierOrLater) { + long instantBefore = convertUTCToLocal(instant - 3 * DateTimeConstants.MILLIS_PER_HOUR); + long instantAfter = convertUTCToLocal(instant + 3 * DateTimeConstants.MILLIS_PER_HOUR); + if (instantBefore == instantAfter) { + return instant; + } + long local = convertUTCToLocal(instant); + return convertLocalToUTC(local, false, earlierOrLater ? instantAfter : instantBefore); + } +"," public long adjustOffset(long instant, boolean earlierOrLater) { + long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR; + long instantAfter = instant + 3 * DateTimeConstants.MILLIS_PER_HOUR; + long offsetBefore = getOffset(instantBefore); + long offsetAfter = getOffset(instantAfter); + if (offsetBefore <= offsetAfter) { + return instant; + } + long diff = offsetBefore - offsetAfter; + long transition = nextTransition(instantBefore); + long overlapStart = transition - diff; + long overlapEnd = transition + diff; + if (instant < overlapStart || instant >= overlapEnd) { + return instant; + } + long afterStart = instant - overlapStart; + if (afterStart >= diff) { + return earlierOrLater ? instant : instant - diff; + } else { + return earlierOrLater ? instant + diff : instant; + } + } +" +Math-45," public OpenMapRealMatrix(int rowDimension, int columnDimension) { + super(rowDimension, columnDimension); + this.rows = rowDimension; + this.columns = columnDimension; + this.entries = new OpenIntToDoubleHashMap(0.0); + } +"," public OpenMapRealMatrix(int rowDimension, int columnDimension) { + super(rowDimension, columnDimension); + long lRow = (long) rowDimension; + long lCol = (long) columnDimension; + if (lRow * lCol >= (long) Integer.MAX_VALUE) { + throw new NumberIsTooLargeException(lRow * lCol, Integer.MAX_VALUE, false); + } + this.rows = rowDimension; + this.columns = columnDimension; + this.entries = new OpenIntToDoubleHashMap(0.0); + } +" +Codec-9," public static byte[] encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) { + if (binaryData == null || binaryData.length == 0) { + return binaryData; + } + long len = getEncodeLength(binaryData, MIME_CHUNK_SIZE, CHUNK_SEPARATOR); + if (len > maxResultSize) { + throw new IllegalArgumentException(""Input array too big, the output array would be bigger ("" + + len + + "") than the specified maxium size of "" + + maxResultSize); + } + Base64 b64 = isChunked ? new Base64(urlSafe) : new Base64(0, CHUNK_SEPARATOR, urlSafe); + return b64.encode(binaryData); + } +"," public static byte[] encodeBase64(byte[] binaryData, boolean isChunked, boolean urlSafe, int maxResultSize) { + if (binaryData == null || binaryData.length == 0) { + return binaryData; + } + long len = getEncodeLength(binaryData, isChunked ? MIME_CHUNK_SIZE : 0, CHUNK_SEPARATOR); + if (len > maxResultSize) { + throw new IllegalArgumentException(""Input array too big, the output array would be bigger ("" + + len + + "") than the specified maxium size of "" + + maxResultSize); + } + Base64 b64 = isChunked ? new Base64(urlSafe) : new Base64(0, CHUNK_SEPARATOR, urlSafe); + return b64.encode(binaryData); + } +" +Math-33," protected void dropPhase1Objective() { + if (getNumObjectiveFunctions() == 1) { + return; + } + List columnsToDrop = new ArrayList(); + columnsToDrop.add(0); + for (int i = getNumObjectiveFunctions(); i < getArtificialVariableOffset(); i++) { + final double entry = tableau.getEntry(0, i); + if (Precision.compareTo(entry, 0d, maxUlps) > 0) { + columnsToDrop.add(i); + } + } + for (int i = 0; i < getNumArtificialVariables(); i++) { + int col = i + getArtificialVariableOffset(); + if (getBasicRow(col) == null) { + columnsToDrop.add(col); + } + } + double[][] matrix = new double[getHeight() - 1][getWidth() - columnsToDrop.size()]; + for (int i = 1; i < getHeight(); i++) { + int col = 0; + for (int j = 0; j < getWidth(); j++) { + if (!columnsToDrop.contains(j)) { + matrix[i - 1][col++] = tableau.getEntry(i, j); + } + } + } + for (int i = columnsToDrop.size() - 1; i >= 0; i--) { + columnLabels.remove((int) columnsToDrop.get(i)); + } + this.tableau = new Array2DRowRealMatrix(matrix); + this.numArtificialVariables = 0; + } +"," protected void dropPhase1Objective() { + if (getNumObjectiveFunctions() == 1) { + return; + } + List columnsToDrop = new ArrayList(); + columnsToDrop.add(0); + for (int i = getNumObjectiveFunctions(); i < getArtificialVariableOffset(); i++) { + final double entry = tableau.getEntry(0, i); + if (Precision.compareTo(entry, 0d, epsilon) > 0) { + columnsToDrop.add(i); + } + } + for (int i = 0; i < getNumArtificialVariables(); i++) { + int col = i + getArtificialVariableOffset(); + if (getBasicRow(col) == null) { + columnsToDrop.add(col); + } + } + double[][] matrix = new double[getHeight() - 1][getWidth() - columnsToDrop.size()]; + for (int i = 1; i < getHeight(); i++) { + int col = 0; + for (int j = 0; j < getWidth(); j++) { + if (!columnsToDrop.contains(j)) { + matrix[i - 1][col++] = tableau.getEntry(i, j); + } + } + } + for (int i = columnsToDrop.size() - 1; i >= 0; i--) { + columnLabels.remove((int) columnsToDrop.get(i)); + } + this.tableau = new Array2DRowRealMatrix(matrix); + this.numArtificialVariables = 0; + } +" +Jsoup-24," void read(Tokeniser t, CharacterReader r) { + if (r.matchesLetter()) { + String name = r.consumeLetterSequence(); + t.tagPending.appendTagName(name.toLowerCase()); + t.dataBuffer.append(name); + r.advance(); + return; + } + if (t.isAppropriateEndTagToken() && !r.isEmpty()) { + char c = r.consume(); + switch (c) { + case '\t': + case '\n': + case '\f': + case ' ': + t.transition(BeforeAttributeName); + break; + case '/': + t.transition(SelfClosingStartTag); + break; + case '>': + t.emitTagPending(); + t.transition(Data); + break; + default: + t.dataBuffer.append(c); + anythingElse(t, r); + break; + } + } else { + anythingElse(t, r); + } + } +"," void read(Tokeniser t, CharacterReader r) { + if (r.matchesLetter()) { + String name = r.consumeLetterSequence(); + t.tagPending.appendTagName(name.toLowerCase()); + t.dataBuffer.append(name); + return; + } + if (t.isAppropriateEndTagToken() && !r.isEmpty()) { + char c = r.consume(); + switch (c) { + case '\t': + case '\n': + case '\f': + case ' ': + t.transition(BeforeAttributeName); + break; + case '/': + t.transition(SelfClosingStartTag); + break; + case '>': + t.emitTagPending(); + t.transition(Data); + break; + default: + t.dataBuffer.append(c); + anythingElse(t, r); + break; + } + } else { + anythingElse(t, r); + } + } +" +JacksonXml-3," public String nextTextValue() throws IOException + { + _binaryValue = null; + if (_nextToken != null) { + JsonToken t = _nextToken; + _currToken = t; + _nextToken = null; + if (t == JsonToken.VALUE_STRING) { + return _currText; + } + _updateState(t); + return null; + } + int token = _xmlTokens.next(); + while (token == XmlTokenStream.XML_START_ELEMENT) { + if (_mayBeLeaf) { + _nextToken = JsonToken.FIELD_NAME; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + _currToken = JsonToken.START_OBJECT; + return null; + } + if (_parsingContext.inArray()) { + token = _xmlTokens.next(); + _mayBeLeaf = true; + continue; + } + String name = _xmlTokens.getLocalName(); + _parsingContext.setCurrentName(name); + if (_namesToWrap != null && _namesToWrap.contains(name)) { + _xmlTokens.repeatStartElement(); + } + _mayBeLeaf = true; + _currToken = JsonToken.FIELD_NAME; + return null; + } + switch (token) { + case XmlTokenStream.XML_END_ELEMENT: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _currToken = JsonToken.VALUE_STRING; + return (_currText = """"); + } + _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY : JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + break; + case XmlTokenStream.XML_ATTRIBUTE_NAME: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _nextToken = JsonToken.FIELD_NAME; + _currText = _xmlTokens.getText(); + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + _currToken = JsonToken.START_OBJECT; + } else { + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + _currToken = JsonToken.FIELD_NAME; + } + break; + case XmlTokenStream.XML_ATTRIBUTE_VALUE: + _currText = _xmlTokens.getText(); + _currToken = JsonToken.VALUE_STRING; + break; + case XmlTokenStream.XML_TEXT: + _currText = _xmlTokens.getText(); + if (_mayBeLeaf) { + _mayBeLeaf = false; + _xmlTokens.skipEndElement(); + _currToken = JsonToken.VALUE_STRING; + return _currText; + } + _parsingContext.setCurrentName(_cfgNameForTextElement); + _nextToken = JsonToken.VALUE_STRING; + _currToken = JsonToken.FIELD_NAME; + break; + case XmlTokenStream.XML_END: + _currToken = null; + } + return null; + } +"," public String nextTextValue() throws IOException + { + _binaryValue = null; + if (_nextToken != null) { + JsonToken t = _nextToken; + _currToken = t; + _nextToken = null; + if (t == JsonToken.VALUE_STRING) { + return _currText; + } + _updateState(t); + return null; + } + int token = _xmlTokens.next(); + while (token == XmlTokenStream.XML_START_ELEMENT) { + if (_mayBeLeaf) { + _nextToken = JsonToken.FIELD_NAME; + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + _currToken = JsonToken.START_OBJECT; + return null; + } + if (_parsingContext.inArray()) { + token = _xmlTokens.next(); + _mayBeLeaf = true; + continue; + } + String name = _xmlTokens.getLocalName(); + _parsingContext.setCurrentName(name); + if (_namesToWrap != null && _namesToWrap.contains(name)) { + _xmlTokens.repeatStartElement(); + } + _mayBeLeaf = true; + _currToken = JsonToken.FIELD_NAME; + return null; + } + switch (token) { + case XmlTokenStream.XML_END_ELEMENT: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _currToken = JsonToken.VALUE_STRING; + return (_currText = """"); + } + _currToken = _parsingContext.inArray() ? JsonToken.END_ARRAY : JsonToken.END_OBJECT; + _parsingContext = _parsingContext.getParent(); + _namesToWrap = _parsingContext.getNamesToWrap(); + break; + case XmlTokenStream.XML_ATTRIBUTE_NAME: + if (_mayBeLeaf) { + _mayBeLeaf = false; + _nextToken = JsonToken.FIELD_NAME; + _currText = _xmlTokens.getText(); + _parsingContext = _parsingContext.createChildObjectContext(-1, -1); + _currToken = JsonToken.START_OBJECT; + } else { + _parsingContext.setCurrentName(_xmlTokens.getLocalName()); + _currToken = JsonToken.FIELD_NAME; + } + break; + case XmlTokenStream.XML_ATTRIBUTE_VALUE: + _currToken = JsonToken.VALUE_STRING; + return (_currText = _xmlTokens.getText()); + case XmlTokenStream.XML_TEXT: + _currText = _xmlTokens.getText(); + if (_mayBeLeaf) { + _mayBeLeaf = false; + _xmlTokens.skipEndElement(); + _currToken = JsonToken.VALUE_STRING; + return _currText; + } + _parsingContext.setCurrentName(_cfgNameForTextElement); + _nextToken = JsonToken.VALUE_STRING; + _currToken = JsonToken.FIELD_NAME; + break; + case XmlTokenStream.XML_END: + _currToken = null; + } + return null; + } +" +Chart-10," public String generateToolTipFragment(String toolTipText) { + return "" title=\"""" + toolTipText + + ""\"" alt=\""\""""; + } +"," public String generateToolTipFragment(String toolTipText) { + return "" title=\"""" + ImageMapUtilities.htmlEscape(toolTipText) + + ""\"" alt=\""\""""; + } +" +Closure-102," public void process(Node externs, Node root) { + NodeTraversal.traverse(compiler, root, this); + if (MAKE_LOCAL_NAMES_UNIQUE) { + MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique(); + NodeTraversal t = new NodeTraversal(compiler, renamer); + t.traverseRoots(externs, root); + } + removeDuplicateDeclarations(root); + new PropogateConstantAnnotations(compiler, assertOnChange) + .process(externs, root); + } +"," public void process(Node externs, Node root) { + NodeTraversal.traverse(compiler, root, this); + removeDuplicateDeclarations(root); + if (MAKE_LOCAL_NAMES_UNIQUE) { + MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique(); + NodeTraversal t = new NodeTraversal(compiler, renamer); + t.traverseRoots(externs, root); + } + new PropogateConstantAnnotations(compiler, assertOnChange) + .process(externs, root); + } +" +Closure-71," private void checkPropertyVisibility(NodeTraversal t, + Node getprop, Node parent) { + ObjectType objectType = + ObjectType.cast(dereference(getprop.getFirstChild().getJSType())); + String propertyName = getprop.getLastChild().getString(); + if (objectType != null) { + boolean isOverride = t.inGlobalScope() && + parent.getType() == Token.ASSIGN && + parent.getFirstChild() == getprop; + if (isOverride) { + objectType = objectType.getImplicitPrototype(); + } + JSDocInfo docInfo = null; + for (; objectType != null; + objectType = objectType.getImplicitPrototype()) { + docInfo = objectType.getOwnPropertyJSDocInfo(propertyName); + if (docInfo != null && + docInfo.getVisibility() != Visibility.INHERITED) { + break; + } + } + if (objectType == null) { + return; + } + boolean sameInput = + t.getInput().getName().equals(docInfo.getSourceName()); + Visibility visibility = docInfo.getVisibility(); + JSType ownerType = normalizeClassType(objectType); + if (isOverride) { + JSDocInfo overridingInfo = parent.getJSDocInfo(); + Visibility overridingVisibility = overridingInfo == null ? + Visibility.INHERITED : overridingInfo.getVisibility(); + if (visibility == Visibility.PRIVATE && !sameInput) { + compiler.report( + t.makeError(getprop, PRIVATE_OVERRIDE, + objectType.toString())); + } else if (overridingVisibility != Visibility.INHERITED && + overridingVisibility != visibility) { + compiler.report( + t.makeError(getprop, VISIBILITY_MISMATCH, + visibility.name(), objectType.toString(), + overridingVisibility.name())); + } + } else { + if (sameInput) { + return; + } else if (visibility == Visibility.PRIVATE && + (currentClass == null || ownerType.differsFrom(currentClass))) { + if (docInfo.isConstructor() && + isValidPrivateConstructorAccess(parent)) { + return; + } + compiler.report( + t.makeError(getprop, + BAD_PRIVATE_PROPERTY_ACCESS, + propertyName, + validator.getReadableJSTypeName( + getprop.getFirstChild(), true))); + } else if (visibility == Visibility.PROTECTED) { + if (currentClass == null || !currentClass.isSubtype(ownerType)) { + compiler.report( + t.makeError(getprop, BAD_PROTECTED_PROPERTY_ACCESS, + propertyName, + validator.getReadableJSTypeName( + getprop.getFirstChild(), true))); + } + } + } + } + } +"," private void checkPropertyVisibility(NodeTraversal t, + Node getprop, Node parent) { + ObjectType objectType = + ObjectType.cast(dereference(getprop.getFirstChild().getJSType())); + String propertyName = getprop.getLastChild().getString(); + if (objectType != null) { + boolean isOverride = parent.getJSDocInfo() != null && + parent.getType() == Token.ASSIGN && + parent.getFirstChild() == getprop; + if (isOverride) { + objectType = objectType.getImplicitPrototype(); + } + JSDocInfo docInfo = null; + for (; objectType != null; + objectType = objectType.getImplicitPrototype()) { + docInfo = objectType.getOwnPropertyJSDocInfo(propertyName); + if (docInfo != null && + docInfo.getVisibility() != Visibility.INHERITED) { + break; + } + } + if (objectType == null) { + return; + } + boolean sameInput = + t.getInput().getName().equals(docInfo.getSourceName()); + Visibility visibility = docInfo.getVisibility(); + JSType ownerType = normalizeClassType(objectType); + if (isOverride) { + JSDocInfo overridingInfo = parent.getJSDocInfo(); + Visibility overridingVisibility = overridingInfo == null ? + Visibility.INHERITED : overridingInfo.getVisibility(); + if (visibility == Visibility.PRIVATE && !sameInput) { + compiler.report( + t.makeError(getprop, PRIVATE_OVERRIDE, + objectType.toString())); + } else if (overridingVisibility != Visibility.INHERITED && + overridingVisibility != visibility) { + compiler.report( + t.makeError(getprop, VISIBILITY_MISMATCH, + visibility.name(), objectType.toString(), + overridingVisibility.name())); + } + } else { + if (sameInput) { + return; + } else if (visibility == Visibility.PRIVATE && + (currentClass == null || ownerType.differsFrom(currentClass))) { + if (docInfo.isConstructor() && + isValidPrivateConstructorAccess(parent)) { + return; + } + compiler.report( + t.makeError(getprop, + BAD_PRIVATE_PROPERTY_ACCESS, + propertyName, + validator.getReadableJSTypeName( + getprop.getFirstChild(), true))); + } else if (visibility == Visibility.PROTECTED) { + if (currentClass == null || !currentClass.isSubtype(ownerType)) { + compiler.report( + t.makeError(getprop, BAD_PROTECTED_PROPERTY_ACCESS, + propertyName, + validator.getReadableJSTypeName( + getprop.getFirstChild(), true))); + } + } + } + } + } +" +Closure-42," Node processForInLoop(ForInLoop loopNode) { + return newNode( + Token.FOR, + transform(loopNode.getIterator()), + transform(loopNode.getIteratedObject()), + transformBlock(loopNode.getBody())); + } +"," Node processForInLoop(ForInLoop loopNode) { + if (loopNode.isForEach()) { + errorReporter.error( + ""unsupported language extension: for each"", + sourceName, + loopNode.getLineno(), """", 0); + return newNode(Token.EXPR_RESULT, Node.newNumber(0)); + } + return newNode( + Token.FOR, + transform(loopNode.getIterator()), + transform(loopNode.getIteratedObject()), + transformBlock(loopNode.getBody())); + } +" +JacksonDatabind-45," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + if (property != null) { + JsonFormat.Value format = serializers.getAnnotationIntrospector().findFormat((Annotated)property.getMember()); + if (format != null) { + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if (format.getShape() == JsonFormat.Shape.STRING) { + TimeZone tz = format.getTimeZone(); + final String pattern = format.hasPattern() + ? format.getPattern() + : StdDateFormat.DATE_FORMAT_STR_ISO8601; + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(pattern, loc); + if (tz == null) { + tz = serializers.getTimeZone(); + } + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + } + } + return this; + } +"," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + if (property != null) { + JsonFormat.Value format = serializers.getAnnotationIntrospector().findFormat((Annotated)property.getMember()); + if (format != null) { + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if ((shape == JsonFormat.Shape.STRING) || format.hasPattern() + || format.hasLocale() || format.hasTimeZone()) { + TimeZone tz = format.getTimeZone(); + final String pattern = format.hasPattern() + ? format.getPattern() + : StdDateFormat.DATE_FORMAT_STR_ISO8601; + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(pattern, loc); + if (tz == null) { + tz = serializers.getTimeZone(); + } + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + } + } + return this; + } +" +Compress-23," InputStream decode(final InputStream in, final Coder coder, + byte[] password) throws IOException { + byte propsByte = coder.properties[0]; + long dictSize = coder.properties[1]; + for (int i = 1; i < 4; i++) { + dictSize |= (coder.properties[i + 1] << (8 * i)); + } + if (dictSize > LZMAInputStream.DICT_SIZE_MAX) { + throw new IOException(""Dictionary larger than 4GiB maximum size""); + } + return new LZMAInputStream(in, -1, propsByte, (int) dictSize); + } +"," InputStream decode(final InputStream in, final Coder coder, + byte[] password) throws IOException { + byte propsByte = coder.properties[0]; + long dictSize = coder.properties[1]; + for (int i = 1; i < 4; i++) { + dictSize |= (coder.properties[i + 1] & 0xffl) << (8 * i); + } + if (dictSize > LZMAInputStream.DICT_SIZE_MAX) { + throw new IOException(""Dictionary larger than 4GiB maximum size""); + } + return new LZMAInputStream(in, -1, propsByte, (int) dictSize); + } +" +Cli-27," public void setSelected(Option option) throws AlreadySelectedException + { + if (option == null) + { + selected = null; + return; + } + if (selected == null || selected.equals(option.getOpt())) + { + selected = option.getOpt(); + } + else + { + throw new AlreadySelectedException(this, option); + } + } +"," public void setSelected(Option option) throws AlreadySelectedException + { + if (option == null) + { + selected = null; + return; + } + if (selected == null || selected.equals(option.getKey())) + { + selected = option.getKey(); + } + else + { + throw new AlreadySelectedException(this, option); + } + } +" +Closure-29," private boolean isInlinableObject(List refs) { + boolean ret = false; + for (Reference ref : refs) { + Node name = ref.getNode(); + Node parent = ref.getParent(); + Node gramps = ref.getGrandparent(); + if (parent.isGetProp()) { + Preconditions.checkState(parent.getFirstChild() == name); + if (gramps.isCall() + && gramps.getFirstChild() == parent) { + return false; + } + continue; + } + if (!isVarOrAssignExprLhs(name)) { + return false; + } + Node val = ref.getAssignedValue(); + if (val == null) { + continue; + } + if (!val.isObjectLit()) { + return false; + } + for (Node child = val.getFirstChild(); child != null; + child = child.getNext()) { + if (child.isGetterDef() || + child.isSetterDef()) { + return false; + } + Node childVal = child.getFirstChild(); + for (Reference t : refs) { + Node refNode = t.getParent(); + while (!NodeUtil.isStatementBlock(refNode)) { + if (refNode == childVal) { + return false; + } + refNode = refNode.getParent(); + } + } + } + ret = true; + } + return ret; + } +"," private boolean isInlinableObject(List refs) { + boolean ret = false; + Set validProperties = Sets.newHashSet(); + for (Reference ref : refs) { + Node name = ref.getNode(); + Node parent = ref.getParent(); + Node gramps = ref.getGrandparent(); + if (parent.isGetProp()) { + Preconditions.checkState(parent.getFirstChild() == name); + if (gramps.isCall() + && gramps.getFirstChild() == parent) { + return false; + } + String propName = parent.getLastChild().getString(); + if (!validProperties.contains(propName)) { + if (NodeUtil.isVarOrSimpleAssignLhs(parent, gramps)) { + validProperties.add(propName); + } else { + return false; + } + } + continue; + } + if (!isVarOrAssignExprLhs(name)) { + return false; + } + Node val = ref.getAssignedValue(); + if (val == null) { + continue; + } + if (!val.isObjectLit()) { + return false; + } + for (Node child = val.getFirstChild(); child != null; + child = child.getNext()) { + if (child.isGetterDef() || + child.isSetterDef()) { + return false; + } + validProperties.add(child.getString()); + Node childVal = child.getFirstChild(); + for (Reference t : refs) { + Node refNode = t.getParent(); + while (!NodeUtil.isStatementBlock(refNode)) { + if (refNode == childVal) { + return false; + } + refNode = refNode.getParent(); + } + } + } + ret = true; + } + return ret; + } +" +Math-70," public double solve(final UnivariateRealFunction f, double min, double max, double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + return solve(min, max); + } +"," public double solve(final UnivariateRealFunction f, double min, double max, double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + return solve(f, min, max); + } +" +Compress-16," public ArchiveInputStream createArchiveInputStream(final InputStream in) + throws ArchiveException { + if (in == null) { + throw new IllegalArgumentException(""Stream must not be null.""); + } + if (!in.markSupported()) { + throw new IllegalArgumentException(""Mark is not supported.""); + } + final byte[] signature = new byte[12]; + in.mark(signature.length); + try { + int signatureLength = in.read(signature); + in.reset(); + if (ZipArchiveInputStream.matches(signature, signatureLength)) { + return new ZipArchiveInputStream(in); + } else if (JarArchiveInputStream.matches(signature, signatureLength)) { + return new JarArchiveInputStream(in); + } else if (ArArchiveInputStream.matches(signature, signatureLength)) { + return new ArArchiveInputStream(in); + } else if (CpioArchiveInputStream.matches(signature, signatureLength)) { + return new CpioArchiveInputStream(in); + } + final byte[] dumpsig = new byte[32]; + in.mark(dumpsig.length); + signatureLength = in.read(dumpsig); + in.reset(); + if (DumpArchiveInputStream.matches(dumpsig, signatureLength)) { + return new DumpArchiveInputStream(in); + } + final byte[] tarheader = new byte[512]; + in.mark(tarheader.length); + signatureLength = in.read(tarheader); + in.reset(); + if (TarArchiveInputStream.matches(tarheader, signatureLength)) { + return new TarArchiveInputStream(in); + } + if (signatureLength >= 512) { + try { + TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader)); + tais.getNextEntry(); + return new TarArchiveInputStream(in); + } catch (Exception e) { + } + } + } catch (IOException e) { + throw new ArchiveException(""Could not use reset and mark operations."", e); + } + throw new ArchiveException(""No Archiver found for the stream signature""); + } +"," public ArchiveInputStream createArchiveInputStream(final InputStream in) + throws ArchiveException { + if (in == null) { + throw new IllegalArgumentException(""Stream must not be null.""); + } + if (!in.markSupported()) { + throw new IllegalArgumentException(""Mark is not supported.""); + } + final byte[] signature = new byte[12]; + in.mark(signature.length); + try { + int signatureLength = in.read(signature); + in.reset(); + if (ZipArchiveInputStream.matches(signature, signatureLength)) { + return new ZipArchiveInputStream(in); + } else if (JarArchiveInputStream.matches(signature, signatureLength)) { + return new JarArchiveInputStream(in); + } else if (ArArchiveInputStream.matches(signature, signatureLength)) { + return new ArArchiveInputStream(in); + } else if (CpioArchiveInputStream.matches(signature, signatureLength)) { + return new CpioArchiveInputStream(in); + } + final byte[] dumpsig = new byte[32]; + in.mark(dumpsig.length); + signatureLength = in.read(dumpsig); + in.reset(); + if (DumpArchiveInputStream.matches(dumpsig, signatureLength)) { + return new DumpArchiveInputStream(in); + } + final byte[] tarheader = new byte[512]; + in.mark(tarheader.length); + signatureLength = in.read(tarheader); + in.reset(); + if (TarArchiveInputStream.matches(tarheader, signatureLength)) { + return new TarArchiveInputStream(in); + } + if (signatureLength >= 512) { + try { + TarArchiveInputStream tais = new TarArchiveInputStream(new ByteArrayInputStream(tarheader)); + if (tais.getNextTarEntry().isCheckSumOK()) { + return new TarArchiveInputStream(in); + } + } catch (Exception e) { + } + } + } catch (IOException e) { + throw new ArchiveException(""Could not use reset and mark operations."", e); + } + throw new ArchiveException(""No Archiver found for the stream signature""); + } +" +Math-24," protected UnivariatePointValuePair doOptimize() { + final boolean isMinim = getGoalType() == GoalType.MINIMIZE; + final double lo = getMin(); + final double mid = getStartValue(); + final double hi = getMax(); + final ConvergenceChecker checker + = getConvergenceChecker(); + double a; + double b; + if (lo < hi) { + a = lo; + b = hi; + } else { + a = hi; + b = lo; + } + double x = mid; + double v = x; + double w = x; + double d = 0; + double e = 0; + double fx = computeObjectiveValue(x); + if (!isMinim) { + fx = -fx; + } + double fv = fx; + double fw = fx; + UnivariatePointValuePair previous = null; + UnivariatePointValuePair current + = new UnivariatePointValuePair(x, isMinim ? fx : -fx); + int iter = 0; + while (true) { + final double m = 0.5 * (a + b); + final double tol1 = relativeThreshold * FastMath.abs(x) + absoluteThreshold; + final double tol2 = 2 * tol1; + final boolean stop = FastMath.abs(x - m) <= tol2 - 0.5 * (b - a); + if (!stop) { + double p = 0; + double q = 0; + double r = 0; + double u = 0; + if (FastMath.abs(e) > tol1) { + r = (x - w) * (fx - fv); + q = (x - v) * (fx - fw); + p = (x - v) * q - (x - w) * r; + q = 2 * (q - r); + if (q > 0) { + p = -p; + } else { + q = -q; + } + r = e; + e = d; + if (p > q * (a - x) && + p < q * (b - x) && + FastMath.abs(p) < FastMath.abs(0.5 * q * r)) { + d = p / q; + u = x + d; + if (u - a < tol2 || b - u < tol2) { + if (x <= m) { + d = tol1; + } else { + d = -tol1; + } + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + if (FastMath.abs(d) < tol1) { + if (d >= 0) { + u = x + tol1; + } else { + u = x - tol1; + } + } else { + u = x + d; + } + double fu = computeObjectiveValue(u); + if (!isMinim) { + fu = -fu; + } + previous = current; + current = new UnivariatePointValuePair(u, isMinim ? fu : -fu); + if (checker != null) { + if (checker.converged(iter, previous, current)) { + return current; + } + } + if (fu <= fx) { + if (u < x) { + b = x; + } else { + a = x; + } + v = w; + fv = fw; + w = x; + fw = fx; + x = u; + fx = fu; + } else { + if (u < x) { + a = u; + } else { + b = u; + } + if (fu <= fw || + Precision.equals(w, x)) { + v = w; + fv = fw; + w = u; + fw = fu; + } else if (fu <= fv || + Precision.equals(v, x) || + Precision.equals(v, w)) { + v = u; + fv = fu; + } + } + } else { + return current; + } + ++iter; + } + } +"," protected UnivariatePointValuePair doOptimize() { + final boolean isMinim = getGoalType() == GoalType.MINIMIZE; + final double lo = getMin(); + final double mid = getStartValue(); + final double hi = getMax(); + final ConvergenceChecker checker + = getConvergenceChecker(); + double a; + double b; + if (lo < hi) { + a = lo; + b = hi; + } else { + a = hi; + b = lo; + } + double x = mid; + double v = x; + double w = x; + double d = 0; + double e = 0; + double fx = computeObjectiveValue(x); + if (!isMinim) { + fx = -fx; + } + double fv = fx; + double fw = fx; + UnivariatePointValuePair previous = null; + UnivariatePointValuePair current + = new UnivariatePointValuePair(x, isMinim ? fx : -fx); + int iter = 0; + while (true) { + final double m = 0.5 * (a + b); + final double tol1 = relativeThreshold * FastMath.abs(x) + absoluteThreshold; + final double tol2 = 2 * tol1; + final boolean stop = FastMath.abs(x - m) <= tol2 - 0.5 * (b - a); + if (!stop) { + double p = 0; + double q = 0; + double r = 0; + double u = 0; + if (FastMath.abs(e) > tol1) { + r = (x - w) * (fx - fv); + q = (x - v) * (fx - fw); + p = (x - v) * q - (x - w) * r; + q = 2 * (q - r); + if (q > 0) { + p = -p; + } else { + q = -q; + } + r = e; + e = d; + if (p > q * (a - x) && + p < q * (b - x) && + FastMath.abs(p) < FastMath.abs(0.5 * q * r)) { + d = p / q; + u = x + d; + if (u - a < tol2 || b - u < tol2) { + if (x <= m) { + d = tol1; + } else { + d = -tol1; + } + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + if (FastMath.abs(d) < tol1) { + if (d >= 0) { + u = x + tol1; + } else { + u = x - tol1; + } + } else { + u = x + d; + } + double fu = computeObjectiveValue(u); + if (!isMinim) { + fu = -fu; + } + previous = current; + current = new UnivariatePointValuePair(u, isMinim ? fu : -fu); + if (checker != null) { + if (checker.converged(iter, previous, current)) { + return best(current, previous, isMinim); + } + } + if (fu <= fx) { + if (u < x) { + b = x; + } else { + a = x; + } + v = w; + fv = fw; + w = x; + fw = fx; + x = u; + fx = fu; + } else { + if (u < x) { + a = u; + } else { + b = u; + } + if (fu <= fw || + Precision.equals(w, x)) { + v = w; + fv = fw; + w = u; + fw = fu; + } else if (fu <= fv || + Precision.equals(v, x) || + Precision.equals(v, w)) { + v = u; + fv = fu; + } + } + } else { + return best(current, previous, isMinim); + } + ++iter; + } + } +" +Lang-40," public static boolean containsIgnoreCase(String str, String searchStr) { + if (str == null || searchStr == null) { + return false; + } + return contains(str.toUpperCase(), searchStr.toUpperCase()); + } +"," public static boolean containsIgnoreCase(String str, String searchStr) { + if (str == null || searchStr == null) { + return false; + } + int len = searchStr.length(); + int max = str.length() - len; + for (int i = 0; i <= max; i++) { + if (str.regionMatches(true, i, searchStr, 0, len)) { + return true; + } + } + return false; + } +" +Jsoup-38," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, Constants.InBodyStartToHead)) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, Constants.InBodyStartPClosers)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.Headings)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), Constants.Headings)) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.InBodyStartPreListing)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertForm(startTag, true); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.DdDt)) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), Constants.DdDt)) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, Constants.Formatters)) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, Constants.InBodyStartEmptyFormatters)) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, Constants.InBodyStartMedia)) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + return tb.process(startTag.name(""img"")); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), Constants.InBodyStartInputAttribs)) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(name, Constants.InBodyStartOptions)) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.InBodyStartRuby)) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, Constants.InBodyStartDrop)) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, Constants.InBodyEndClosers)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, Constants.DdDt)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, Constants.Headings)) { + if (!tb.inScope(Constants.Headings)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(Constants.Headings); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, Constants.InBodyEndAdoptionFormatters)) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + final int stackSize = stack.size(); + for (int si = 0; si < stackSize && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), Constants.InBodyEndTableFosters)) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + adopter.attributes().addAll(formatEl.attributes()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +"," boolean process(Token t, HtmlTreeBuilder tb) { + switch (t.type) { + case Character: { + Token.Character c = t.asCharacter(); + if (c.getData().equals(nullString)) { + tb.error(this); + return false; + } else if (isWhitespace(c)) { + tb.reconstructFormattingElements(); + tb.insert(c); + } else { + tb.reconstructFormattingElements(); + tb.insert(c); + tb.framesetOk(false); + } + break; + } + case Comment: { + tb.insert(t.asComment()); + break; + } + case Doctype: { + tb.error(this); + return false; + } + case StartTag: + Token.StartTag startTag = t.asStartTag(); + String name = startTag.name(); + if (name.equals(""html"")) { + tb.error(this); + Element html = tb.getStack().getFirst(); + for (Attribute attribute : startTag.getAttributes()) { + if (!html.hasAttr(attribute.getKey())) + html.attributes().put(attribute); + } + } else if (StringUtil.in(name, Constants.InBodyStartToHead)) { + return tb.process(t, InHead); + } else if (name.equals(""body"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else { + tb.framesetOk(false); + Element body = stack.get(1); + for (Attribute attribute : startTag.getAttributes()) { + if (!body.hasAttr(attribute.getKey())) + body.attributes().put(attribute); + } + } + } else if (name.equals(""frameset"")) { + tb.error(this); + LinkedList stack = tb.getStack(); + if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals(""body""))) { + return false; + } else if (!tb.framesetOk()) { + return false; + } else { + Element second = stack.get(1); + if (second.parent() != null) + second.remove(); + while (stack.size() > 1) + stack.removeLast(); + tb.insert(startTag); + tb.transition(InFrameset); + } + } else if (StringUtil.in(name, Constants.InBodyStartPClosers)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.Headings)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + if (StringUtil.in(tb.currentElement().nodeName(), Constants.Headings)) { + tb.error(this); + tb.pop(); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.InBodyStartPreListing)) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + } else if (name.equals(""form"")) { + if (tb.getFormElement() != null) { + tb.error(this); + return false; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertForm(startTag, true); + } else if (name.equals(""li"")) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (el.nodeName().equals(""li"")) { + tb.process(new Token.EndTag(""li"")); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.DdDt)) { + tb.framesetOk(false); + LinkedList stack = tb.getStack(); + for (int i = stack.size() - 1; i > 0; i--) { + Element el = stack.get(i); + if (StringUtil.in(el.nodeName(), Constants.DdDt)) { + tb.process(new Token.EndTag(el.nodeName())); + break; + } + if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), Constants.InBodyStartLiBreakers)) + break; + } + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + } else if (name.equals(""plaintext"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.PLAINTEXT); + } else if (name.equals(""button"")) { + if (tb.inButtonScope(""button"")) { + tb.error(this); + tb.process(new Token.EndTag(""button"")); + tb.process(startTag); + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + } + } else if (name.equals(""a"")) { + if (tb.getActiveFormattingElement(""a"") != null) { + tb.error(this); + tb.process(new Token.EndTag(""a"")); + Element remainingA = tb.getFromStack(""a""); + if (remainingA != null) { + tb.removeFromActiveFormattingElements(remainingA); + tb.removeFromStack(remainingA); + } + } + tb.reconstructFormattingElements(); + Element a = tb.insert(startTag); + tb.pushActiveFormattingElements(a); + } else if (StringUtil.in(name, Constants.Formatters)) { + tb.reconstructFormattingElements(); + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (name.equals(""nobr"")) { + tb.reconstructFormattingElements(); + if (tb.inScope(""nobr"")) { + tb.error(this); + tb.process(new Token.EndTag(""nobr"")); + tb.reconstructFormattingElements(); + } + Element el = tb.insert(startTag); + tb.pushActiveFormattingElements(el); + } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.insertMarkerToFormattingElements(); + tb.framesetOk(false); + } else if (name.equals(""table"")) { + if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insert(startTag); + tb.framesetOk(false); + tb.transition(InTable); + } else if (StringUtil.in(name, Constants.InBodyStartEmptyFormatters)) { + tb.reconstructFormattingElements(); + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""input"")) { + tb.reconstructFormattingElements(); + Element el = tb.insertEmpty(startTag); + if (!el.attr(""type"").equalsIgnoreCase(""hidden"")) + tb.framesetOk(false); + } else if (StringUtil.in(name, Constants.InBodyStartMedia)) { + tb.insertEmpty(startTag); + } else if (name.equals(""hr"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.insertEmpty(startTag); + tb.framesetOk(false); + } else if (name.equals(""image"")) { + if (tb.getFromStack(""svg"") == null) + return tb.process(startTag.name(""img"")); + else + tb.insert(startTag); + } else if (name.equals(""isindex"")) { + tb.error(this); + if (tb.getFormElement() != null) + return false; + tb.tokeniser.acknowledgeSelfClosingFlag(); + tb.process(new Token.StartTag(""form"")); + if (startTag.attributes.hasKey(""action"")) { + Element form = tb.getFormElement(); + form.attr(""action"", startTag.attributes.get(""action"")); + } + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.StartTag(""label"")); + String prompt = startTag.attributes.hasKey(""prompt"") ? + startTag.attributes.get(""prompt"") : + ""This is a searchable index. Enter search keywords: ""; + tb.process(new Token.Character(prompt)); + Attributes inputAttribs = new Attributes(); + for (Attribute attr : startTag.attributes) { + if (!StringUtil.in(attr.getKey(), Constants.InBodyStartInputAttribs)) + inputAttribs.put(attr); + } + inputAttribs.put(""name"", ""isindex""); + tb.process(new Token.StartTag(""input"", inputAttribs)); + tb.process(new Token.EndTag(""label"")); + tb.process(new Token.StartTag(""hr"")); + tb.process(new Token.EndTag(""form"")); + } else if (name.equals(""textarea"")) { + tb.insert(startTag); + tb.tokeniser.transition(TokeniserState.Rcdata); + tb.markInsertionMode(); + tb.framesetOk(false); + tb.transition(Text); + } else if (name.equals(""xmp"")) { + if (tb.inButtonScope(""p"")) { + tb.process(new Token.EndTag(""p"")); + } + tb.reconstructFormattingElements(); + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""iframe"")) { + tb.framesetOk(false); + handleRawtext(startTag, tb); + } else if (name.equals(""noembed"")) { + handleRawtext(startTag, tb); + } else if (name.equals(""select"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.framesetOk(false); + HtmlTreeBuilderState state = tb.state(); + if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) + tb.transition(InSelectInTable); + else + tb.transition(InSelect); + } else if (StringUtil.in(name, Constants.InBodyStartOptions)) { + if (tb.currentElement().nodeName().equals(""option"")) + tb.process(new Token.EndTag(""option"")); + tb.reconstructFormattingElements(); + tb.insert(startTag); + } else if (StringUtil.in(name, Constants.InBodyStartRuby)) { + if (tb.inScope(""ruby"")) { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(""ruby"")) { + tb.error(this); + tb.popStackToBefore(""ruby""); + } + tb.insert(startTag); + } + } else if (name.equals(""math"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (name.equals(""svg"")) { + tb.reconstructFormattingElements(); + tb.insert(startTag); + tb.tokeniser.acknowledgeSelfClosingFlag(); + } else if (StringUtil.in(name, Constants.InBodyStartDrop)) { + tb.error(this); + return false; + } else { + tb.reconstructFormattingElements(); + tb.insert(startTag); + } + break; + case EndTag: + Token.EndTag endTag = t.asEndTag(); + name = endTag.name(); + if (name.equals(""body"")) { + if (!tb.inScope(""body"")) { + tb.error(this); + return false; + } else { + tb.transition(AfterBody); + } + } else if (name.equals(""html"")) { + boolean notIgnored = tb.process(new Token.EndTag(""body"")); + if (notIgnored) + return tb.process(endTag); + } else if (StringUtil.in(name, Constants.InBodyEndClosers)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""form"")) { + Element currentForm = tb.getFormElement(); + tb.setFormElement(null); + if (currentForm == null || !tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.removeFromStack(currentForm); + } + } else if (name.equals(""p"")) { + if (!tb.inButtonScope(name)) { + tb.error(this); + tb.process(new Token.StartTag(name)); + return tb.process(endTag); + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (name.equals(""li"")) { + if (!tb.inListItemScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, Constants.DdDt)) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + } + } else if (StringUtil.in(name, Constants.Headings)) { + if (!tb.inScope(Constants.Headings)) { + tb.error(this); + return false; + } else { + tb.generateImpliedEndTags(name); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(Constants.Headings); + } + } else if (name.equals(""sarcasm"")) { + return anyOtherEndTag(t, tb); + } else if (StringUtil.in(name, Constants.InBodyEndAdoptionFormatters)) { + OUTER: + for (int i = 0; i < 8; i++) { + Element formatEl = tb.getActiveFormattingElement(name); + if (formatEl == null) + return anyOtherEndTag(t, tb); + else if (!tb.onStack(formatEl)) { + tb.error(this); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } else if (!tb.inScope(formatEl.nodeName())) { + tb.error(this); + return false; + } else if (tb.currentElement() != formatEl) + tb.error(this); + Element furthestBlock = null; + Element commonAncestor = null; + boolean seenFormattingElement = false; + LinkedList stack = tb.getStack(); + final int stackSize = stack.size(); + for (int si = 0; si < stackSize && si < 64; si++) { + Element el = stack.get(si); + if (el == formatEl) { + commonAncestor = stack.get(si - 1); + seenFormattingElement = true; + } else if (seenFormattingElement && tb.isSpecial(el)) { + furthestBlock = el; + break; + } + } + if (furthestBlock == null) { + tb.popStackToClose(formatEl.nodeName()); + tb.removeFromActiveFormattingElements(formatEl); + return true; + } + Element node = furthestBlock; + Element lastNode = furthestBlock; + INNER: + for (int j = 0; j < 3; j++) { + if (tb.onStack(node)) + node = tb.aboveOnStack(node); + if (!tb.isInActiveFormattingElements(node)) { + tb.removeFromStack(node); + continue INNER; + } else if (node == formatEl) + break INNER; + Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); + tb.replaceActiveFormattingElement(node, replacement); + tb.replaceOnStack(node, replacement); + node = replacement; + if (lastNode == furthestBlock) { + } + if (lastNode.parent() != null) + lastNode.remove(); + node.appendChild(lastNode); + lastNode = node; + } + if (StringUtil.in(commonAncestor.nodeName(), Constants.InBodyEndTableFosters)) { + if (lastNode.parent() != null) + lastNode.remove(); + tb.insertInFosterParent(lastNode); + } else { + if (lastNode.parent() != null) + lastNode.remove(); + commonAncestor.appendChild(lastNode); + } + Element adopter = new Element(formatEl.tag(), tb.getBaseUri()); + adopter.attributes().addAll(formatEl.attributes()); + Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodeSize()]); + for (Node childNode : childNodes) { + adopter.appendChild(childNode); + } + furthestBlock.appendChild(adopter); + tb.removeFromActiveFormattingElements(formatEl); + tb.removeFromStack(formatEl); + tb.insertOnStackAfter(furthestBlock, adopter); + } + } else if (StringUtil.in(name, Constants.InBodyStartApplets)) { + if (!tb.inScope(""name"")) { + if (!tb.inScope(name)) { + tb.error(this); + return false; + } + tb.generateImpliedEndTags(); + if (!tb.currentElement().nodeName().equals(name)) + tb.error(this); + tb.popStackToClose(name); + tb.clearFormattingElementsToLastMarker(); + } + } else if (name.equals(""br"")) { + tb.error(this); + tb.process(new Token.StartTag(""br"")); + return false; + } else { + return anyOtherEndTag(t, tb); + } + break; + case EOF: + break; + } + return true; + } +" +Math-20," public double[] repairAndDecode(final double[] x) { + return + decode(x); + } +"," public double[] repairAndDecode(final double[] x) { + return boundaries != null && isRepairMode ? + decode(repair(x)) : + decode(x); + } +" +Mockito-7," private void readTypeVariables() { + for (Type type : typeVariable.getBounds()) { + registerTypeVariablesOn(type); + } + registerTypeVariablesOn(getActualTypeArgumentFor(typeVariable)); + } +"," private void readTypeVariables() { + for (Type type : typeVariable.getBounds()) { + registerTypeVariablesOn(type); + } + registerTypeParametersOn(new TypeVariable[] { typeVariable }); + registerTypeVariablesOn(getActualTypeArgumentFor(typeVariable)); + } +" +JacksonDatabind-1," public void serializeAsColumn(Object bean, JsonGenerator jgen, SerializerProvider prov) + throws Exception + { + Object value = get(bean); + if (value == null) { + if (_nullSerializer != null) { + _nullSerializer.serialize(null, jgen, prov); + } else { + jgen.writeNull(); + } + } + JsonSerializer ser = _serializer; + if (ser == null) { + Class cls = value.getClass(); + PropertySerializerMap map = _dynamicSerializers; + ser = map.serializerFor(cls); + if (ser == null) { + ser = _findAndAddDynamic(map, cls, prov); + } + } + if (_suppressableValue != null) { + if (MARKER_FOR_EMPTY == _suppressableValue) { + if (ser.isEmpty(value)) { + serializeAsPlaceholder(bean, jgen, prov); + return; + } + } else if (_suppressableValue.equals(value)) { + serializeAsPlaceholder(bean, jgen, prov); + return; + } + } + if (value == bean) { + _handleSelfReference(bean, ser); + } + if (_typeSerializer == null) { + ser.serialize(value, jgen, prov); + } else { + ser.serializeWithType(value, jgen, prov, _typeSerializer); + } + } +"," public void serializeAsColumn(Object bean, JsonGenerator jgen, SerializerProvider prov) + throws Exception + { + Object value = get(bean); + if (value == null) { + if (_nullSerializer != null) { + _nullSerializer.serialize(null, jgen, prov); + } else { + jgen.writeNull(); + } + return; + } + JsonSerializer ser = _serializer; + if (ser == null) { + Class cls = value.getClass(); + PropertySerializerMap map = _dynamicSerializers; + ser = map.serializerFor(cls); + if (ser == null) { + ser = _findAndAddDynamic(map, cls, prov); + } + } + if (_suppressableValue != null) { + if (MARKER_FOR_EMPTY == _suppressableValue) { + if (ser.isEmpty(value)) { + serializeAsPlaceholder(bean, jgen, prov); + return; + } + } else if (_suppressableValue.equals(value)) { + serializeAsPlaceholder(bean, jgen, prov); + return; + } + } + if (value == bean) { + _handleSelfReference(bean, ser); + } + if (_typeSerializer == null) { + ser.serialize(value, jgen, prov); + } else { + ser.serializeWithType(value, jgen, prov, _typeSerializer); + } + } +" +Mockito-12," public Class getGenericType(Field field) { + Type generic = field.getGenericType(); + if (generic != null && generic instanceof ParameterizedType) { + Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0]; + return (Class) actual; + } + return Object.class; + } +"," public Class getGenericType(Field field) { + Type generic = field.getGenericType(); + if (generic != null && generic instanceof ParameterizedType) { + Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0]; + if (actual instanceof Class) { + return (Class) actual; + } else if (actual instanceof ParameterizedType) { + return (Class) ((ParameterizedType) actual).getRawType(); + } + } + return Object.class; + } +" +Codec-3," private int handleG(String value, + DoubleMetaphoneResult result, + int index, + boolean slavoGermanic) { + if (charAt(value, index + 1) == 'H') { + index = handleGH(value, result, index); + } else if (charAt(value, index + 1) == 'N') { + if (index == 1 && isVowel(charAt(value, 0)) && !slavoGermanic) { + result.append(""KN"", ""N""); + } else if (!contains(value, index + 2, 2, ""EY"") && + charAt(value, index + 1) != 'Y' && !slavoGermanic) { + result.append(""N"", ""KN""); + } else { + result.append(""KN""); + } + index = index + 2; + } else if (contains(value, index + 1, 2, ""LI"") && !slavoGermanic) { + result.append(""KL"", ""L""); + index += 2; + } else if (index == 0 && (charAt(value, index + 1) == 'Y' || contains(value, index + 1, 2, ES_EP_EB_EL_EY_IB_IL_IN_IE_EI_ER))) { + result.append('K', 'J'); + index += 2; + } else if ((contains(value, index + 1, 2, ""ER"") || + charAt(value, index + 1) == 'Y') && + !contains(value, 0, 6, ""DANGER"", ""RANGER"", ""MANGER"") && + !contains(value, index - 1, 1, ""E"", ""I"") && + !contains(value, index - 1, 3, ""RGY"", ""OGY"")) { + result.append('K', 'J'); + index += 2; + } else if (contains(value, index + 1, 1, ""E"", ""I"", ""Y"") || + contains(value, index - 1, 4, ""AGGI"", ""OGGI"")) { + if ((contains(value, 0 ,4, ""VAN "", ""VON "") || contains(value, 0, 3, ""SCH"")) || contains(value, index + 1, 2, ""ET"")) { + result.append('K'); + } else if (contains(value, index + 1, 4, ""IER"")) { + result.append('J'); + } else { + result.append('J', 'K'); + } + index += 2; + } else if (charAt(value, index + 1) == 'G') { + index += 2; + result.append('K'); + } else { + index++; + result.append('K'); + } + return index; + } +"," private int handleG(String value, + DoubleMetaphoneResult result, + int index, + boolean slavoGermanic) { + if (charAt(value, index + 1) == 'H') { + index = handleGH(value, result, index); + } else if (charAt(value, index + 1) == 'N') { + if (index == 1 && isVowel(charAt(value, 0)) && !slavoGermanic) { + result.append(""KN"", ""N""); + } else if (!contains(value, index + 2, 2, ""EY"") && + charAt(value, index + 1) != 'Y' && !slavoGermanic) { + result.append(""N"", ""KN""); + } else { + result.append(""KN""); + } + index = index + 2; + } else if (contains(value, index + 1, 2, ""LI"") && !slavoGermanic) { + result.append(""KL"", ""L""); + index += 2; + } else if (index == 0 && (charAt(value, index + 1) == 'Y' || contains(value, index + 1, 2, ES_EP_EB_EL_EY_IB_IL_IN_IE_EI_ER))) { + result.append('K', 'J'); + index += 2; + } else if ((contains(value, index + 1, 2, ""ER"") || + charAt(value, index + 1) == 'Y') && + !contains(value, 0, 6, ""DANGER"", ""RANGER"", ""MANGER"") && + !contains(value, index - 1, 1, ""E"", ""I"") && + !contains(value, index - 1, 3, ""RGY"", ""OGY"")) { + result.append('K', 'J'); + index += 2; + } else if (contains(value, index + 1, 1, ""E"", ""I"", ""Y"") || + contains(value, index - 1, 4, ""AGGI"", ""OGGI"")) { + if ((contains(value, 0 ,4, ""VAN "", ""VON "") || contains(value, 0, 3, ""SCH"")) || contains(value, index + 1, 2, ""ET"")) { + result.append('K'); + } else if (contains(value, index + 1, 3, ""IER"")) { + result.append('J'); + } else { + result.append('J', 'K'); + } + index += 2; + } else if (charAt(value, index + 1) == 'G') { + index += 2; + result.append('K'); + } else { + index++; + result.append('K'); + } + return index; + } +" +Jsoup-19," private boolean testValidProtocol(Element el, Attribute attr, Set protocols) { + String value = el.absUrl(attr.getKey()); + if (!preserveRelativeLinks) + attr.setValue(value); + for (Protocol protocol : protocols) { + String prot = protocol.toString() + "":""; + if (value.toLowerCase().startsWith(prot)) { + return true; + } + } + return false; + } +"," private boolean testValidProtocol(Element el, Attribute attr, Set protocols) { + String value = el.absUrl(attr.getKey()); + if (value.length() == 0) + value = attr.getValue(); + if (!preserveRelativeLinks) + attr.setValue(value); + for (Protocol protocol : protocols) { + String prot = protocol.toString() + "":""; + if (value.toLowerCase().startsWith(prot)) { + return true; + } + } + return false; + } +" +Jsoup-89," public String setValue(String val) { + String oldVal = parent.get(this.key); + if (parent != null) { + int i = parent.indexOfKey(this.key); + if (i != Attributes.NotFound) + parent.vals[i] = val; + } + this.val = val; + return Attributes.checkNotNull(oldVal); + } +"," public String setValue(String val) { + String oldVal = this.val; + if (parent != null) { + oldVal = parent.get(this.key); + int i = parent.indexOfKey(this.key); + if (i != Attributes.NotFound) + parent.vals[i] = val; + } + this.val = val; + return Attributes.checkNotNull(oldVal); + } +" +JacksonDatabind-44," protected JavaType _narrow(Class subclass) + { + if (_class == subclass) { + return this; + } + return new SimpleType(subclass, _bindings, this, _superInterfaces, + _valueHandler, _typeHandler, _asStatic); + } +"," protected JavaType _narrow(Class subclass) + { + if (_class == subclass) { + return this; + } + if (!_class.isAssignableFrom(subclass)) { + return new SimpleType(subclass, _bindings, this, _superInterfaces, + _valueHandler, _typeHandler, _asStatic); + } + Class next = subclass.getSuperclass(); + if (next == _class) { + return new SimpleType(subclass, _bindings, this, + _superInterfaces, _valueHandler, _typeHandler, _asStatic); + } + if ((next != null) && _class.isAssignableFrom(next)) { + JavaType superb = _narrow(next); + return new SimpleType(subclass, _bindings, superb, + null, _valueHandler, _typeHandler, _asStatic); + } + Class[] nextI = subclass.getInterfaces(); + for (Class iface : nextI) { + if (iface == _class) { + return new SimpleType(subclass, _bindings, null, + new JavaType[] { this }, _valueHandler, _typeHandler, _asStatic); + } + if (_class.isAssignableFrom(iface)) { + JavaType superb = _narrow(iface); + return new SimpleType(subclass, _bindings, null, + new JavaType[] { superb }, _valueHandler, _typeHandler, _asStatic); + } + } + throw new IllegalArgumentException(""Internal error: Can not resolve sub-type for Class ""+subclass.getName()+"" to "" + +_class.getName()); + } +" +Closure-62," private String format(JSError error, boolean warning) { + SourceExcerptProvider source = getSource(); + String sourceExcerpt = source == null ? null : + excerpt.get( + source, error.sourceName, error.lineNumber, excerptFormatter); + StringBuilder b = new StringBuilder(); + if (error.sourceName != null) { + b.append(error.sourceName); + if (error.lineNumber > 0) { + b.append(':'); + b.append(error.lineNumber); + } + b.append("": ""); + } + b.append(getLevelName(warning ? CheckLevel.WARNING : CheckLevel.ERROR)); + b.append("" - ""); + b.append(error.description); + b.append('\n'); + if (sourceExcerpt != null) { + b.append(sourceExcerpt); + b.append('\n'); + int charno = error.getCharno(); + if (excerpt.equals(LINE) + && 0 <= charno && charno < sourceExcerpt.length()) { + for (int i = 0; i < charno; i++) { + char c = sourceExcerpt.charAt(i); + if (Character.isWhitespace(c)) { + b.append(c); + } else { + b.append(' '); + } + } + b.append(""^\n""); + } + } + return b.toString(); + } +"," private String format(JSError error, boolean warning) { + SourceExcerptProvider source = getSource(); + String sourceExcerpt = source == null ? null : + excerpt.get( + source, error.sourceName, error.lineNumber, excerptFormatter); + StringBuilder b = new StringBuilder(); + if (error.sourceName != null) { + b.append(error.sourceName); + if (error.lineNumber > 0) { + b.append(':'); + b.append(error.lineNumber); + } + b.append("": ""); + } + b.append(getLevelName(warning ? CheckLevel.WARNING : CheckLevel.ERROR)); + b.append("" - ""); + b.append(error.description); + b.append('\n'); + if (sourceExcerpt != null) { + b.append(sourceExcerpt); + b.append('\n'); + int charno = error.getCharno(); + if (excerpt.equals(LINE) + && 0 <= charno && charno <= sourceExcerpt.length()) { + for (int i = 0; i < charno; i++) { + char c = sourceExcerpt.charAt(i); + if (Character.isWhitespace(c)) { + b.append(c); + } else { + b.append(' '); + } + } + b.append(""^\n""); + } + } + return b.toString(); + } +" +Jsoup-93," public List formData() { + ArrayList data = new ArrayList<>(); + for (Element el: elements) { + if (!el.tag().isFormSubmittable()) continue; + if (el.hasAttr(""disabled"")) continue; + String name = el.attr(""name""); + if (name.length() == 0) continue; + String type = el.attr(""type""); + if (""select"".equals(el.normalName())) { + Elements options = el.select(""option[selected]""); + boolean set = false; + for (Element option: options) { + data.add(HttpConnection.KeyVal.create(name, option.val())); + set = true; + } + if (!set) { + Element option = el.select(""option"").first(); + if (option != null) + data.add(HttpConnection.KeyVal.create(name, option.val())); + } + } else if (""checkbox"".equalsIgnoreCase(type) || ""radio"".equalsIgnoreCase(type)) { + if (el.hasAttr(""checked"")) { + final String val = el.val().length() > 0 ? el.val() : ""on""; + data.add(HttpConnection.KeyVal.create(name, val)); + } + } else { + data.add(HttpConnection.KeyVal.create(name, el.val())); + } + } + return data; + } +"," public List formData() { + ArrayList data = new ArrayList<>(); + for (Element el: elements) { + if (!el.tag().isFormSubmittable()) continue; + if (el.hasAttr(""disabled"")) continue; + String name = el.attr(""name""); + if (name.length() == 0) continue; + String type = el.attr(""type""); + if (type.equalsIgnoreCase(""button"")) continue; + if (""select"".equals(el.normalName())) { + Elements options = el.select(""option[selected]""); + boolean set = false; + for (Element option: options) { + data.add(HttpConnection.KeyVal.create(name, option.val())); + set = true; + } + if (!set) { + Element option = el.select(""option"").first(); + if (option != null) + data.add(HttpConnection.KeyVal.create(name, option.val())); + } + } else if (""checkbox"".equalsIgnoreCase(type) || ""radio"".equalsIgnoreCase(type)) { + if (el.hasAttr(""checked"")) { + final String val = el.val().length() > 0 ? el.val() : ""on""; + data.add(HttpConnection.KeyVal.create(name, val)); + } + } else { + data.add(HttpConnection.KeyVal.create(name, el.val())); + } + } + return data; + } +" +Closure-21," public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isEmpty() || + n.isComma()) { + return; + } + if (parent == null) { + return; + } + if (n.isExprResult()) { + return; + } + if (n.isQualifiedName() && n.getJSDocInfo() != null) { + return; + } + boolean isResultUsed = NodeUtil.isExpressionResultUsed(n); + boolean isSimpleOp = NodeUtil.isSimpleOperatorType(n.getType()); + if (parent.getType() == Token.COMMA) { + if (isResultUsed) { + return; + } + if (n == parent.getLastChild()) { + for (Node an : parent.getAncestors()) { + int ancestorType = an.getType(); + if (ancestorType == Token.COMMA) continue; + if (ancestorType != Token.EXPR_RESULT && ancestorType != Token.BLOCK) return; + else break; + } + } + } else if (parent.getType() != Token.EXPR_RESULT && parent.getType() != Token.BLOCK) { + if (! (parent.getType() == Token.FOR && parent.getChildCount() == 4 && (n == parent.getFirstChild() || n == parent.getFirstChild().getNext().getNext()))) { + return; + } + } + if ( + (isSimpleOp || !NodeUtil.mayHaveSideEffects(n, t.getCompiler()))) { + String msg = ""This code lacks side-effects. Is there a bug?""; + if (n.isString()) { + msg = ""Is there a missing '+' on the previous line?""; + } else if (isSimpleOp) { + msg = ""The result of the '"" + Token.name(n.getType()).toLowerCase() + + ""' operator is not being used.""; + } + t.getCompiler().report( + t.makeError(n, level, USELESS_CODE_ERROR, msg)); + if (!NodeUtil.isStatement(n)) { + problemNodes.add(n); + } + } + } +"," public void visit(NodeTraversal t, Node n, Node parent) { + if (n.isEmpty() || + n.isComma()) { + return; + } + if (parent == null) { + return; + } + if (n.isExprResult() || n.isBlock()) { + return; + } + if (n.isQualifiedName() && n.getJSDocInfo() != null) { + return; + } + boolean isResultUsed = NodeUtil.isExpressionResultUsed(n); + boolean isSimpleOp = NodeUtil.isSimpleOperatorType(n.getType()); + if (!isResultUsed && + (isSimpleOp || !NodeUtil.mayHaveSideEffects(n, t.getCompiler()))) { + String msg = ""This code lacks side-effects. Is there a bug?""; + if (n.isString()) { + msg = ""Is there a missing '+' on the previous line?""; + } else if (isSimpleOp) { + msg = ""The result of the '"" + Token.name(n.getType()).toLowerCase() + + ""' operator is not being used.""; + } + t.getCompiler().report( + t.makeError(n, level, USELESS_CODE_ERROR, msg)); + if (!NodeUtil.isStatement(n)) { + problemNodes.add(n); + } + } + } +" +Math-8," public T[] sample(int sampleSize) throws NotStrictlyPositiveException { + if (sampleSize <= 0) { + throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, + sampleSize); + } + final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(0).getClass(), sampleSize); + for (int i = 0; i < sampleSize; i++) { + out[i] = sample(); + } + return out; + } +"," public Object[] sample(int sampleSize) throws NotStrictlyPositiveException { + if (sampleSize <= 0) { + throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, + sampleSize); + } + final Object[] out = new Object[sampleSize]; + for (int i = 0; i < sampleSize; i++) { + out[i] = sample(); + } + return out; + } +" +JacksonDatabind-46," public StringBuilder getGenericSignature(StringBuilder sb) + { + _classSignature(_class, sb, false); + sb.append('<'); + sb = _referencedType.getGenericSignature(sb); + sb.append(';'); + return sb; + } +"," public StringBuilder getGenericSignature(StringBuilder sb) + { + _classSignature(_class, sb, false); + sb.append('<'); + sb = _referencedType.getGenericSignature(sb); + sb.append("">;""); + return sb; + } +" +JacksonDatabind-91," private boolean _hasCustomHandlers(JavaType t) { + if (t.isContainerType()) { + JavaType ct = t.getContentType(); + if (ct != null) { + return (ct.getValueHandler() != null) || (ct.getTypeHandler() != null); + } + } + return false; + } +"," private boolean _hasCustomHandlers(JavaType t) { + if (t.isContainerType()) { + JavaType ct = t.getContentType(); + if (ct != null) { + if ((ct.getValueHandler() != null) || (ct.getTypeHandler() != null)) { + return true; + } + } + if (t.isMapLikeType()) { + JavaType kt = t.getKeyType(); + if (kt.getValueHandler() != null) { + return true; + } + } + } + return false; + } +" +Lang-6," public final void translate(CharSequence input, Writer out) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (input == null) { + return; + } + int pos = 0; + int len = input.length(); + while (pos < len) { + int consumed = translate(input, pos, out); + if (consumed == 0) { + char[] c = Character.toChars(Character.codePointAt(input, pos)); + out.write(c); + pos+= c.length; + continue; + } + for (int pt = 0; pt < consumed; pt++) { + pos += Character.charCount(Character.codePointAt(input, pos)); + } + } + } +"," public final void translate(CharSequence input, Writer out) throws IOException { + if (out == null) { + throw new IllegalArgumentException(""The Writer must not be null""); + } + if (input == null) { + return; + } + int pos = 0; + int len = input.length(); + while (pos < len) { + int consumed = translate(input, pos, out); + if (consumed == 0) { + char[] c = Character.toChars(Character.codePointAt(input, pos)); + out.write(c); + pos+= c.length; + continue; + } + for (int pt = 0; pt < consumed; pt++) { + pos += Character.charCount(Character.codePointAt(input, pt)); + } + } + } +" +Compress-19," public void reparseCentralDirectoryData(boolean hasUncompressedSize, + boolean hasCompressedSize, + boolean hasRelativeHeaderOffset, + boolean hasDiskStart) + throws ZipException { + if (rawCentralDirectoryData != null) { + int expectedLength = (hasUncompressedSize ? DWORD : 0) + + (hasCompressedSize ? DWORD : 0) + + (hasRelativeHeaderOffset ? DWORD : 0) + + (hasDiskStart ? WORD : 0); + if (rawCentralDirectoryData.length != expectedLength) { + throw new ZipException(""central directory zip64 extended"" + + "" information extra field's length"" + + "" doesn't match central directory"" + + "" data. Expected length "" + + expectedLength + "" but is "" + + rawCentralDirectoryData.length); + } + int offset = 0; + if (hasUncompressedSize) { + size = new ZipEightByteInteger(rawCentralDirectoryData, offset); + offset += DWORD; + } + if (hasCompressedSize) { + compressedSize = new ZipEightByteInteger(rawCentralDirectoryData, + offset); + offset += DWORD; + } + if (hasRelativeHeaderOffset) { + relativeHeaderOffset = + new ZipEightByteInteger(rawCentralDirectoryData, offset); + offset += DWORD; + } + if (hasDiskStart) { + diskStart = new ZipLong(rawCentralDirectoryData, offset); + offset += WORD; + } + } + } +"," public void reparseCentralDirectoryData(boolean hasUncompressedSize, + boolean hasCompressedSize, + boolean hasRelativeHeaderOffset, + boolean hasDiskStart) + throws ZipException { + if (rawCentralDirectoryData != null) { + int expectedLength = (hasUncompressedSize ? DWORD : 0) + + (hasCompressedSize ? DWORD : 0) + + (hasRelativeHeaderOffset ? DWORD : 0) + + (hasDiskStart ? WORD : 0); + if (rawCentralDirectoryData.length < expectedLength) { + throw new ZipException(""central directory zip64 extended"" + + "" information extra field's length"" + + "" doesn't match central directory"" + + "" data. Expected length "" + + expectedLength + "" but is "" + + rawCentralDirectoryData.length); + } + int offset = 0; + if (hasUncompressedSize) { + size = new ZipEightByteInteger(rawCentralDirectoryData, offset); + offset += DWORD; + } + if (hasCompressedSize) { + compressedSize = new ZipEightByteInteger(rawCentralDirectoryData, + offset); + offset += DWORD; + } + if (hasRelativeHeaderOffset) { + relativeHeaderOffset = + new ZipEightByteInteger(rawCentralDirectoryData, offset); + offset += DWORD; + } + if (hasDiskStart) { + diskStart = new ZipLong(rawCentralDirectoryData, offset); + offset += WORD; + } + } + } +" +JacksonCore-7," public int writeValue() { + if (_type == TYPE_OBJECT) { + _gotName = false; + ++_index; + return STATUS_OK_AFTER_COLON; + } + if (_type == TYPE_ARRAY) { + int ix = _index; + ++_index; + return (ix < 0) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_COMMA; + } + ++_index; + return (_index == 0) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_SPACE; + } +"," public int writeValue() { + if (_type == TYPE_OBJECT) { + if (!_gotName) { + return STATUS_EXPECT_NAME; + } + _gotName = false; + ++_index; + return STATUS_OK_AFTER_COLON; + } + if (_type == TYPE_ARRAY) { + int ix = _index; + ++_index; + return (ix < 0) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_COMMA; + } + ++_index; + return (_index == 0) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_SPACE; + } +" +Compress-5," public int read(byte[] buffer, int start, int length) throws IOException { + if (closed) { + throw new IOException(""The stream is closed""); + } + if (inf.finished() || current == null) { + return -1; + } + if (start <= buffer.length && length >= 0 && start >= 0 + && buffer.length - start >= length) { + if (current.getMethod() == ZipArchiveOutputStream.STORED) { + int csize = (int) current.getSize(); + if (readBytesOfEntry >= csize) { + return -1; + } + if (offsetInBuffer >= lengthOfLastRead) { + offsetInBuffer = 0; + if ((lengthOfLastRead = in.read(buf)) == -1) { + return -1; + } + count(lengthOfLastRead); + bytesReadFromStream += lengthOfLastRead; + } + int toRead = length > lengthOfLastRead + ? lengthOfLastRead - offsetInBuffer + : length; + if ((csize - readBytesOfEntry) < toRead) { + toRead = csize - readBytesOfEntry; + } + System.arraycopy(buf, offsetInBuffer, buffer, start, toRead); + offsetInBuffer += toRead; + readBytesOfEntry += toRead; + crc.update(buffer, start, toRead); + return toRead; + } + if (inf.needsInput()) { + fill(); + if (lengthOfLastRead > 0) { + bytesReadFromStream += lengthOfLastRead; + } + } + int read = 0; + try { + read = inf.inflate(buffer, start, length); + } catch (DataFormatException e) { + throw new ZipException(e.getMessage()); + } + if (read == 0 && inf.finished()) { + return -1; + } + crc.update(buffer, start, read); + return read; + } + throw new ArrayIndexOutOfBoundsException(); + } +"," public int read(byte[] buffer, int start, int length) throws IOException { + if (closed) { + throw new IOException(""The stream is closed""); + } + if (inf.finished() || current == null) { + return -1; + } + if (start <= buffer.length && length >= 0 && start >= 0 + && buffer.length - start >= length) { + if (current.getMethod() == ZipArchiveOutputStream.STORED) { + int csize = (int) current.getSize(); + if (readBytesOfEntry >= csize) { + return -1; + } + if (offsetInBuffer >= lengthOfLastRead) { + offsetInBuffer = 0; + if ((lengthOfLastRead = in.read(buf)) == -1) { + return -1; + } + count(lengthOfLastRead); + bytesReadFromStream += lengthOfLastRead; + } + int toRead = length > lengthOfLastRead + ? lengthOfLastRead - offsetInBuffer + : length; + if ((csize - readBytesOfEntry) < toRead) { + toRead = csize - readBytesOfEntry; + } + System.arraycopy(buf, offsetInBuffer, buffer, start, toRead); + offsetInBuffer += toRead; + readBytesOfEntry += toRead; + crc.update(buffer, start, toRead); + return toRead; + } + if (inf.needsInput()) { + fill(); + if (lengthOfLastRead > 0) { + bytesReadFromStream += lengthOfLastRead; + } + } + int read = 0; + try { + read = inf.inflate(buffer, start, length); + } catch (DataFormatException e) { + throw new ZipException(e.getMessage()); + } + if (read == 0) { + if (inf.finished()) { + return -1; + } else if (lengthOfLastRead == -1) { + throw new IOException(""Truncated ZIP file""); + } + } + crc.update(buffer, start, read); + return read; + } + throw new ArrayIndexOutOfBoundsException(); + } +" +JacksonCore-5," private final static int _parseIndex(String str) { + final int len = str.length(); + if (len == 0 || len > 10) { + return -1; + } + for (int i = 0; i < len; ++i) { + char c = str.charAt(i++); + if (c > '9' || c < '0') { + return -1; + } + } + if (len == 10) { + long l = NumberInput.parseLong(str); + if (l > Integer.MAX_VALUE) { + return -1; + } + } + return NumberInput.parseInt(str); + } +"," private final static int _parseIndex(String str) { + final int len = str.length(); + if (len == 0 || len > 10) { + return -1; + } + for (int i = 0; i < len; ++i) { + char c = str.charAt(i); + if (c > '9' || c < '0') { + return -1; + } + } + if (len == 10) { + long l = NumberInput.parseLong(str); + if (l > Integer.MAX_VALUE) { + return -1; + } + } + return NumberInput.parseInt(str); + } +" +JacksonDatabind-12," public boolean isCachable() { + return (_valueTypeDeserializer == null) + && (_ignorableProperties == null); + } +"," public boolean isCachable() { + return (_valueDeserializer == null) + && (_keyDeserializer == null) + && (_valueTypeDeserializer == null) + && (_ignorableProperties == null); + } +" +Compress-46," private static ZipLong unixTimeToZipLong(long l) { + final long TWO_TO_32 = 0x100000000L; + if (l >= TWO_TO_32) { + throw new IllegalArgumentException(""X5455 timestamps must fit in a signed 32 bit integer: "" + l); + } + return new ZipLong(l); + } +"," private static ZipLong unixTimeToZipLong(long l) { + if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) { + throw new IllegalArgumentException(""X5455 timestamps must fit in a signed 32 bit integer: "" + l); + } + return new ZipLong(l); + } +" +JxPath-12," public static boolean testNode(Node node, NodeTest test) { + if (test == null) { + return true; + } + if (test instanceof NodeNameTest) { + if (node.getNodeType() != Node.ELEMENT_NODE) { + return false; + } + NodeNameTest nodeNameTest = (NodeNameTest) test; + QName testName = nodeNameTest.getNodeName(); + String namespaceURI = nodeNameTest.getNamespaceURI(); + boolean wildcard = nodeNameTest.isWildcard(); + String testPrefix = testName.getPrefix(); + if (wildcard && testPrefix == null) { + return true; + } + if (wildcard + || testName.getName() + .equals(DOMNodePointer.getLocalName(node))) { + String nodeNS = DOMNodePointer.getNamespaceURI(node); + return equalStrings(namespaceURI, nodeNS); + } + return false; + } + if (test instanceof NodeTypeTest) { + int nodeType = node.getNodeType(); + switch (((NodeTypeTest) test).getNodeType()) { + case Compiler.NODE_TYPE_NODE : + return nodeType == Node.ELEMENT_NODE + || nodeType == Node.DOCUMENT_NODE; + case Compiler.NODE_TYPE_TEXT : + return nodeType == Node.CDATA_SECTION_NODE + || nodeType == Node.TEXT_NODE; + case Compiler.NODE_TYPE_COMMENT : + return nodeType == Node.COMMENT_NODE; + case Compiler.NODE_TYPE_PI : + return nodeType == Node.PROCESSING_INSTRUCTION_NODE; + } + return false; + } + if (test instanceof ProcessingInstructionTest) { + if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { + String testPI = ((ProcessingInstructionTest) test).getTarget(); + String nodePI = ((ProcessingInstruction) node).getTarget(); + return testPI.equals(nodePI); + } + } + return false; + } +"," public static boolean testNode(Node node, NodeTest test) { + if (test == null) { + return true; + } + if (test instanceof NodeNameTest) { + if (node.getNodeType() != Node.ELEMENT_NODE) { + return false; + } + NodeNameTest nodeNameTest = (NodeNameTest) test; + QName testName = nodeNameTest.getNodeName(); + String namespaceURI = nodeNameTest.getNamespaceURI(); + boolean wildcard = nodeNameTest.isWildcard(); + String testPrefix = testName.getPrefix(); + if (wildcard && testPrefix == null) { + return true; + } + if (wildcard + || testName.getName() + .equals(DOMNodePointer.getLocalName(node))) { + String nodeNS = DOMNodePointer.getNamespaceURI(node); + return equalStrings(namespaceURI, nodeNS) || nodeNS == null + && equalStrings(testPrefix, getPrefix(node)); + } + return false; + } + if (test instanceof NodeTypeTest) { + int nodeType = node.getNodeType(); + switch (((NodeTypeTest) test).getNodeType()) { + case Compiler.NODE_TYPE_NODE : + return nodeType == Node.ELEMENT_NODE + || nodeType == Node.DOCUMENT_NODE; + case Compiler.NODE_TYPE_TEXT : + return nodeType == Node.CDATA_SECTION_NODE + || nodeType == Node.TEXT_NODE; + case Compiler.NODE_TYPE_COMMENT : + return nodeType == Node.COMMENT_NODE; + case Compiler.NODE_TYPE_PI : + return nodeType == Node.PROCESSING_INSTRUCTION_NODE; + } + return false; + } + if (test instanceof ProcessingInstructionTest) { + if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { + String testPI = ((ProcessingInstructionTest) test).getTarget(); + String nodePI = ((ProcessingInstruction) node).getTarget(); + return testPI.equals(nodePI); + } + } + return false; + } +" +Math-63," public static boolean equals(double x, double y) { + return (Double.isNaN(x) && Double.isNaN(y)) || x == y; + } +"," public static boolean equals(double x, double y) { + return equals(x, y, 1); + } +" +Math-60," public double cumulativeProbability(double x) throws MathException { + final double dev = x - mean; + try { + return 0.5 * (1.0 + Erf.erf((dev) / + (standardDeviation * FastMath.sqrt(2.0)))); + } catch (MaxIterationsExceededException ex) { + if (x < (mean - 20 * standardDeviation)) { + return 0; + } else if (x > (mean + 20 * standardDeviation)) { + return 1; + } else { + throw ex; + } + } + } +"," public double cumulativeProbability(double x) throws MathException { + final double dev = x - mean; + if (FastMath.abs(dev) > 40 * standardDeviation) { + return dev < 0 ? 0.0d : 1.0d; + } + return 0.5 * (1.0 + Erf.erf((dev) / + (standardDeviation * FastMath.sqrt(2.0)))); + } +" +Lang-29," static float toJavaVersionInt(String version) { + return toVersionInt(toJavaVersionIntArray(version, JAVA_VERSION_TRIM_SIZE)); + } +"," static int toJavaVersionInt(String version) { + return toVersionInt(toJavaVersionIntArray(version, JAVA_VERSION_TRIM_SIZE)); + } +" +JxPath-5," private int compareNodePointers( + NodePointer p1, + int depth1, + NodePointer p2, + int depth2) + { + if (depth1 < depth2) { + int r = compareNodePointers(p1, depth1, p2.parent, depth2 - 1); + return r == 0 ? -1 : r; + } + if (depth1 > depth2) { + int r = compareNodePointers(p1.parent, depth1 - 1, p2, depth2); + return r == 0 ? 1 : r; + } + if (p1 == null && p2 == null) { + return 0; + } + if (p1 != null && p1.equals(p2)) { + return 0; + } + if (depth1 == 1) { + throw new JXPathException( + ""Cannot compare pointers that do not belong to the same tree: '"" + + p1 + ""' and '"" + p2 + ""'""); + } + int r = compareNodePointers(p1.parent, depth1 - 1, p2.parent, depth2 - 1); + if (r != 0) { + return r; + } + return p1.parent.compareChildNodePointers(p1, p2); + } +"," private int compareNodePointers( + NodePointer p1, + int depth1, + NodePointer p2, + int depth2) + { + if (depth1 < depth2) { + int r = compareNodePointers(p1, depth1, p2.parent, depth2 - 1); + return r == 0 ? -1 : r; + } + if (depth1 > depth2) { + int r = compareNodePointers(p1.parent, depth1 - 1, p2, depth2); + return r == 0 ? 1 : r; + } + if (p1 == null && p2 == null) { + return 0; + } + if (p1 != null && p1.equals(p2)) { + return 0; + } + if (depth1 == 1) { + return 0; + } + int r = compareNodePointers(p1.parent, depth1 - 1, p2.parent, depth2 - 1); + if (r != 0) { + return r; + } + return p1.parent.compareChildNodePointers(p1, p2); + } +" +Math-59," public static float max(final float a, final float b) { + return (a <= b) ? b : (Float.isNaN(a + b) ? Float.NaN : b); + } +"," public static float max(final float a, final float b) { + return (a <= b) ? b : (Float.isNaN(a + b) ? Float.NaN : a); + } +" +Lang-33," public static Class[] toClass(Object[] array) { + if (array == null) { + return null; + } else if (array.length == 0) { + return ArrayUtils.EMPTY_CLASS_ARRAY; + } + Class[] classes = new Class[array.length]; + for (int i = 0; i < array.length; i++) { + classes[i] = array[i].getClass(); + } + return classes; + } +"," public static Class[] toClass(Object[] array) { + if (array == null) { + return null; + } else if (array.length == 0) { + return ArrayUtils.EMPTY_CLASS_ARRAY; + } + Class[] classes = new Class[array.length]; + for (int i = 0; i < array.length; i++) { + classes[i] = array[i] == null ? null : array[i].getClass(); + } + return classes; + } +" +JacksonDatabind-74," protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt, + TokenBuffer tb) throws IOException + { + JsonDeserializer deser = _findDefaultImplDeserializer(ctxt); + if (deser != null) { + if (tb != null) { + tb.writeEndObject(); + p = tb.asParser(p); + p.nextToken(); + } + return deser.deserialize(p, ctxt); + } + Object result = TypeDeserializer.deserializeIfNatural(p, ctxt, _baseType); + if (result != null) { + return result; + } + if (p.getCurrentToken() == JsonToken.START_ARRAY) { + return super.deserializeTypedFromAny(p, ctxt); + } + ctxt.reportWrongTokenException(p, JsonToken.FIELD_NAME, + ""missing property '""+_typePropertyName+""' that is to contain type id (for class ""+baseTypeName()+"")""); + return null; + } +"," protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt, + TokenBuffer tb) throws IOException + { + JsonDeserializer deser = _findDefaultImplDeserializer(ctxt); + if (deser != null) { + if (tb != null) { + tb.writeEndObject(); + p = tb.asParser(p); + p.nextToken(); + } + return deser.deserialize(p, ctxt); + } + Object result = TypeDeserializer.deserializeIfNatural(p, ctxt, _baseType); + if (result != null) { + return result; + } + if (p.getCurrentToken() == JsonToken.START_ARRAY) { + return super.deserializeTypedFromAny(p, ctxt); + } else if (p.getCurrentToken() == JsonToken.VALUE_STRING) { + if (ctxt.isEnabled(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT)) { + String str = p.getText().trim(); + if (str.isEmpty()) { + return null; + } + } + } + ctxt.reportWrongTokenException(p, JsonToken.FIELD_NAME, + ""missing property '""+_typePropertyName+""' that is to contain type id (for class ""+baseTypeName()+"")""); + return null; + } +" +Compress-15," public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ZipArchiveEntry other = (ZipArchiveEntry) obj; + String myName = getName(); + String otherName = other.getName(); + if (myName == null) { + if (otherName != null) { + return false; + } + } else if (!myName.equals(otherName)) { + return false; + } + String myComment = getComment(); + String otherComment = other.getComment(); + if (myComment == null) { + if (otherComment != null) { + return false; + } + } else if (!myComment.equals(otherComment)) { + return false; + } + return getTime() == other.getTime() + && getInternalAttributes() == other.getInternalAttributes() + && getPlatform() == other.getPlatform() + && getExternalAttributes() == other.getExternalAttributes() + && getMethod() == other.getMethod() + && getSize() == other.getSize() + && getCrc() == other.getCrc() + && getCompressedSize() == other.getCompressedSize() + && Arrays.equals(getCentralDirectoryExtra(), + other.getCentralDirectoryExtra()) + && Arrays.equals(getLocalFileDataExtra(), + other.getLocalFileDataExtra()) + && gpb.equals(other.gpb); + } +"," public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ZipArchiveEntry other = (ZipArchiveEntry) obj; + String myName = getName(); + String otherName = other.getName(); + if (myName == null) { + if (otherName != null) { + return false; + } + } else if (!myName.equals(otherName)) { + return false; + } + String myComment = getComment(); + String otherComment = other.getComment(); + if (myComment == null) { + myComment = """"; + } + if (otherComment == null) { + otherComment = """"; + } + return getTime() == other.getTime() + && myComment.equals(otherComment) + && getInternalAttributes() == other.getInternalAttributes() + && getPlatform() == other.getPlatform() + && getExternalAttributes() == other.getExternalAttributes() + && getMethod() == other.getMethod() + && getSize() == other.getSize() + && getCrc() == other.getCrc() + && getCompressedSize() == other.getCompressedSize() + && Arrays.equals(getCentralDirectoryExtra(), + other.getCentralDirectoryExtra()) + && Arrays.equals(getLocalFileDataExtra(), + other.getLocalFileDataExtra()) + && gpb.equals(other.gpb); + } +" +Closure-31," Node parseInputs() { + boolean devMode = options.devMode != DevMode.OFF; + if (externsRoot != null) { + externsRoot.detachChildren(); + } + if (jsRoot != null) { + jsRoot.detachChildren(); + } + jsRoot = IR.block(); + jsRoot.setIsSyntheticBlock(true); + externsRoot = IR.block(); + externsRoot.setIsSyntheticBlock(true); + externAndJsRoot = IR.block(externsRoot, jsRoot); + externAndJsRoot.setIsSyntheticBlock(true); + if (options.tracer.isOn()) { + tracker = new PerformanceTracker(jsRoot, options.tracer); + addChangeHandler(tracker.getCodeChangeHandler()); + } + Tracer tracer = newTracer(""parseInputs""); + try { + for (CompilerInput input : externs) { + Node n = input.getAstRoot(this); + if (hasErrors()) { + return null; + } + externsRoot.addChildToBack(n); + } + if (options.transformAMDToCJSModules || options.processCommonJSModules) { + processAMDAndCommonJSModules(); + } + boolean staleInputs = false; + if (options.dependencyOptions.needsManagement() && + !options.skipAllPasses && + options.closurePass) { + for (CompilerInput input : inputs) { + for (String provide : input.getProvides()) { + getTypeRegistry().forwardDeclareType(provide); + } + } + try { + inputs = + (moduleGraph == null ? new JSModuleGraph(modules) : moduleGraph) + .manageDependencies(options.dependencyOptions, inputs); + staleInputs = true; + } catch (CircularDependencyException e) { + report(JSError.make( + JSModule.CIRCULAR_DEPENDENCY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } catch (MissingProvideException e) { + report(JSError.make( + MISSING_ENTRY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (n.getJSDocInfo() != null) { + JSDocInfo info = n.getJSDocInfo(); + if (info.isExterns()) { + externsRoot.addChildToBack(n); + input.setIsExtern(true); + input.getModule().remove(input); + externs.add(input); + staleInputs = true; + } else if (info.isNoCompile()) { + input.getModule().remove(input); + staleInputs = true; + } + } + } + if (staleInputs) { + fillEmptyModules(modules); + rebuildInputsFromModules(); + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (devMode) { + runSanityCheck(); + if (hasErrors()) { + return null; + } + } + if (options.sourceMapOutputPath != null || + options.nameReferenceReportPath != null) { + SourceInformationAnnotator sia = + new SourceInformationAnnotator( + input.getName(), options.devMode != DevMode.OFF); + NodeTraversal.traverse(this, n, sia); + } + jsRoot.addChildToBack(n); + } + if (hasErrors()) { + return null; + } + return externAndJsRoot; + } finally { + stopTracer(tracer, ""parseInputs""); + } + } +"," Node parseInputs() { + boolean devMode = options.devMode != DevMode.OFF; + if (externsRoot != null) { + externsRoot.detachChildren(); + } + if (jsRoot != null) { + jsRoot.detachChildren(); + } + jsRoot = IR.block(); + jsRoot.setIsSyntheticBlock(true); + externsRoot = IR.block(); + externsRoot.setIsSyntheticBlock(true); + externAndJsRoot = IR.block(externsRoot, jsRoot); + externAndJsRoot.setIsSyntheticBlock(true); + if (options.tracer.isOn()) { + tracker = new PerformanceTracker(jsRoot, options.tracer); + addChangeHandler(tracker.getCodeChangeHandler()); + } + Tracer tracer = newTracer(""parseInputs""); + try { + for (CompilerInput input : externs) { + Node n = input.getAstRoot(this); + if (hasErrors()) { + return null; + } + externsRoot.addChildToBack(n); + } + if (options.transformAMDToCJSModules || options.processCommonJSModules) { + processAMDAndCommonJSModules(); + } + boolean staleInputs = false; + if (options.dependencyOptions.needsManagement() && + options.closurePass) { + for (CompilerInput input : inputs) { + for (String provide : input.getProvides()) { + getTypeRegistry().forwardDeclareType(provide); + } + } + try { + inputs = + (moduleGraph == null ? new JSModuleGraph(modules) : moduleGraph) + .manageDependencies(options.dependencyOptions, inputs); + staleInputs = true; + } catch (CircularDependencyException e) { + report(JSError.make( + JSModule.CIRCULAR_DEPENDENCY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } catch (MissingProvideException e) { + report(JSError.make( + MISSING_ENTRY_ERROR, e.getMessage())); + if (hasErrors()) { + return null; + } + } + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (n.getJSDocInfo() != null) { + JSDocInfo info = n.getJSDocInfo(); + if (info.isExterns()) { + externsRoot.addChildToBack(n); + input.setIsExtern(true); + input.getModule().remove(input); + externs.add(input); + staleInputs = true; + } else if (info.isNoCompile()) { + input.getModule().remove(input); + staleInputs = true; + } + } + } + if (staleInputs) { + fillEmptyModules(modules); + rebuildInputsFromModules(); + } + for (CompilerInput input : inputs) { + Node n = input.getAstRoot(this); + if (n == null) { + continue; + } + if (devMode) { + runSanityCheck(); + if (hasErrors()) { + return null; + } + } + if (options.sourceMapOutputPath != null || + options.nameReferenceReportPath != null) { + SourceInformationAnnotator sia = + new SourceInformationAnnotator( + input.getName(), options.devMode != DevMode.OFF); + NodeTraversal.traverse(this, n, sia); + } + jsRoot.addChildToBack(n); + } + if (hasErrors()) { + return null; + } + return externAndJsRoot; + } finally { + stopTracer(tracer, ""parseInputs""); + } + } +" +Lang-57," public static boolean isAvailableLocale(Locale locale) { + return cAvailableLocaleSet.contains(locale); + } +"," public static boolean isAvailableLocale(Locale locale) { + return availableLocaleList().contains(locale); + } +" +Jsoup-75," final void html(final Appendable accum, final Document.OutputSettings out) throws IOException { + final int sz = size; + for (int i = 0; i < sz; i++) { + final String key = keys[i]; + final String val = vals[i]; + accum.append(' ').append(key); + if (!(out.syntax() == Document.OutputSettings.Syntax.html + && (val == null || val.equals(key) && Attribute.isBooleanAttribute(key)))) { + accum.append(""=\""""); + Entities.escape(accum, val == null ? EmptyString : val, out, true, false, false); + accum.append('""'); + } + } + } +"," final void html(final Appendable accum, final Document.OutputSettings out) throws IOException { + final int sz = size; + for (int i = 0; i < sz; i++) { + final String key = keys[i]; + final String val = vals[i]; + accum.append(' ').append(key); + if (!Attribute.shouldCollapseAttribute(key, val, out)) { + accum.append(""=\""""); + Entities.escape(accum, val == null ? EmptyString : val, out, true, false, false); + accum.append('""'); + } + } + } +" +Lang-51," public static boolean toBoolean(String str) { + if (str == ""true"") { + return true; + } + if (str == null) { + return false; + } + switch (str.length()) { + case 2: { + char ch0 = str.charAt(0); + char ch1 = str.charAt(1); + return + (ch0 == 'o' || ch0 == 'O') && + (ch1 == 'n' || ch1 == 'N'); + } + case 3: { + char ch = str.charAt(0); + if (ch == 'y') { + return + (str.charAt(1) == 'e' || str.charAt(1) == 'E') && + (str.charAt(2) == 's' || str.charAt(2) == 'S'); + } + if (ch == 'Y') { + return + (str.charAt(1) == 'E' || str.charAt(1) == 'e') && + (str.charAt(2) == 'S' || str.charAt(2) == 's'); + } + } + case 4: { + char ch = str.charAt(0); + if (ch == 't') { + return + (str.charAt(1) == 'r' || str.charAt(1) == 'R') && + (str.charAt(2) == 'u' || str.charAt(2) == 'U') && + (str.charAt(3) == 'e' || str.charAt(3) == 'E'); + } + if (ch == 'T') { + return + (str.charAt(1) == 'R' || str.charAt(1) == 'r') && + (str.charAt(2) == 'U' || str.charAt(2) == 'u') && + (str.charAt(3) == 'E' || str.charAt(3) == 'e'); + } + } + } + return false; + } +"," public static boolean toBoolean(String str) { + if (str == ""true"") { + return true; + } + if (str == null) { + return false; + } + switch (str.length()) { + case 2: { + char ch0 = str.charAt(0); + char ch1 = str.charAt(1); + return + (ch0 == 'o' || ch0 == 'O') && + (ch1 == 'n' || ch1 == 'N'); + } + case 3: { + char ch = str.charAt(0); + if (ch == 'y') { + return + (str.charAt(1) == 'e' || str.charAt(1) == 'E') && + (str.charAt(2) == 's' || str.charAt(2) == 'S'); + } + if (ch == 'Y') { + return + (str.charAt(1) == 'E' || str.charAt(1) == 'e') && + (str.charAt(2) == 'S' || str.charAt(2) == 's'); + } + return false; + } + case 4: { + char ch = str.charAt(0); + if (ch == 't') { + return + (str.charAt(1) == 'r' || str.charAt(1) == 'R') && + (str.charAt(2) == 'u' || str.charAt(2) == 'U') && + (str.charAt(3) == 'e' || str.charAt(3) == 'E'); + } + if (ch == 'T') { + return + (str.charAt(1) == 'R' || str.charAt(1) == 'r') && + (str.charAt(2) == 'U' || str.charAt(2) == 'u') && + (str.charAt(3) == 'E' || str.charAt(3) == 'e'); + } + } + } + return false; + } +" +Closure-126," void tryMinimizeExits(Node n, int exitType, String labelName) { + if (matchingExitNode(n, exitType, labelName)) { + NodeUtil.removeChild(n.getParent(), n); + compiler.reportCodeChange(); + return; + } + if (n.isIf()) { + Node ifBlock = n.getFirstChild().getNext(); + tryMinimizeExits(ifBlock, exitType, labelName); + Node elseBlock = ifBlock.getNext(); + if (elseBlock != null) { + tryMinimizeExits(elseBlock, exitType, labelName); + } + return; + } + if (n.isTry()) { + Node tryBlock = n.getFirstChild(); + tryMinimizeExits(tryBlock, exitType, labelName); + Node allCatchNodes = NodeUtil.getCatchBlock(n); + if (NodeUtil.hasCatchHandler(allCatchNodes)) { + Preconditions.checkState(allCatchNodes.hasOneChild()); + Node catchNode = allCatchNodes.getFirstChild(); + Node catchCodeBlock = catchNode.getLastChild(); + tryMinimizeExits(catchCodeBlock, exitType, labelName); + } + if (NodeUtil.hasFinally(n)) { + Node finallyBlock = n.getLastChild(); + tryMinimizeExits(finallyBlock, exitType, labelName); + } + } + if (n.isLabel()) { + Node labelBlock = n.getLastChild(); + tryMinimizeExits(labelBlock, exitType, labelName); + } + if (!n.isBlock() || n.getLastChild() == null) { + return; + } + for (Node c : n.children()) { + if (c.isIf()) { + Node ifTree = c; + Node trueBlock, falseBlock; + trueBlock = ifTree.getFirstChild().getNext(); + falseBlock = trueBlock.getNext(); + tryMinimizeIfBlockExits(trueBlock, falseBlock, + ifTree, exitType, labelName); + trueBlock = ifTree.getFirstChild().getNext(); + falseBlock = trueBlock.getNext(); + if (falseBlock != null) { + tryMinimizeIfBlockExits(falseBlock, trueBlock, + ifTree, exitType, labelName); + } + } + if (c == n.getLastChild()) { + break; + } + } + for (Node c = n.getLastChild(); c != null; c = n.getLastChild()) { + tryMinimizeExits(c, exitType, labelName); + if (c == n.getLastChild()) { + break; + } + } + } +"," void tryMinimizeExits(Node n, int exitType, String labelName) { + if (matchingExitNode(n, exitType, labelName)) { + NodeUtil.removeChild(n.getParent(), n); + compiler.reportCodeChange(); + return; + } + if (n.isIf()) { + Node ifBlock = n.getFirstChild().getNext(); + tryMinimizeExits(ifBlock, exitType, labelName); + Node elseBlock = ifBlock.getNext(); + if (elseBlock != null) { + tryMinimizeExits(elseBlock, exitType, labelName); + } + return; + } + if (n.isTry()) { + Node tryBlock = n.getFirstChild(); + tryMinimizeExits(tryBlock, exitType, labelName); + Node allCatchNodes = NodeUtil.getCatchBlock(n); + if (NodeUtil.hasCatchHandler(allCatchNodes)) { + Preconditions.checkState(allCatchNodes.hasOneChild()); + Node catchNode = allCatchNodes.getFirstChild(); + Node catchCodeBlock = catchNode.getLastChild(); + tryMinimizeExits(catchCodeBlock, exitType, labelName); + } + } + if (n.isLabel()) { + Node labelBlock = n.getLastChild(); + tryMinimizeExits(labelBlock, exitType, labelName); + } + if (!n.isBlock() || n.getLastChild() == null) { + return; + } + for (Node c : n.children()) { + if (c.isIf()) { + Node ifTree = c; + Node trueBlock, falseBlock; + trueBlock = ifTree.getFirstChild().getNext(); + falseBlock = trueBlock.getNext(); + tryMinimizeIfBlockExits(trueBlock, falseBlock, + ifTree, exitType, labelName); + trueBlock = ifTree.getFirstChild().getNext(); + falseBlock = trueBlock.getNext(); + if (falseBlock != null) { + tryMinimizeIfBlockExits(falseBlock, trueBlock, + ifTree, exitType, labelName); + } + } + if (c == n.getLastChild()) { + break; + } + } + for (Node c = n.getLastChild(); c != null; c = n.getLastChild()) { + tryMinimizeExits(c, exitType, labelName); + if (c == n.getLastChild()) { + break; + } + } + } +" +Lang-58," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar)) { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && isDigits(numeric.substring(1)) + && (numeric.charAt(0) == '-' || Character.isDigit(numeric.charAt(0)))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +"," public static Number createNumber(String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + if (str.startsWith(""--"")) { + return null; + } + if (str.startsWith(""0x"") || str.startsWith(""-0x"")) { + return createInteger(str); + } + char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + int decPos = str.indexOf('.'); + int expPos = str.indexOf('e') + str.indexOf('E') + 1; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + } else { + if (expPos > -1) { + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar)) { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + String numeric = str.substring(0, str.length() - 1); + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } else { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (NumberFormatException nfe) { + } + return createBigInteger(str); + } else { + boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (NumberFormatException nfe) { + } + try { + Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (NumberFormatException nfe) { + } + return createBigDecimal(str); + } + } + } +" +Lang-24," public static boolean isNumber(String str) { + if (StringUtils.isEmpty(str)) { + return false; + } + char[] chars = str.toCharArray(); + int sz = chars.length; + boolean hasExp = false; + boolean hasDecPoint = false; + boolean allowSigns = false; + boolean foundDigit = false; + int start = (chars[0] == '-') ? 1 : 0; + if (sz > start + 1) { + if (chars[start] == '0' && chars[start + 1] == 'x') { + int i = start + 2; + if (i == sz) { + return false; + } + for (; i < chars.length; i++) { + if ((chars[i] < '0' || chars[i] > '9') + && (chars[i] < 'a' || chars[i] > 'f') + && (chars[i] < 'A' || chars[i] > 'F')) { + return false; + } + } + return true; + } + } + sz--; + int i = start; + while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) { + if (chars[i] >= '0' && chars[i] <= '9') { + foundDigit = true; + allowSigns = false; + } else if (chars[i] == '.') { + if (hasDecPoint || hasExp) { + return false; + } + hasDecPoint = true; + } else if (chars[i] == 'e' || chars[i] == 'E') { + if (hasExp) { + return false; + } + if (!foundDigit) { + return false; + } + hasExp = true; + allowSigns = true; + } else if (chars[i] == '+' || chars[i] == '-') { + if (!allowSigns) { + return false; + } + allowSigns = false; + foundDigit = false; + } else { + return false; + } + i++; + } + if (i < chars.length) { + if (chars[i] >= '0' && chars[i] <= '9') { + return true; + } + if (chars[i] == 'e' || chars[i] == 'E') { + return false; + } + if (chars[i] == '.') { + if (hasDecPoint || hasExp) { + return false; + } + return foundDigit; + } + if (!allowSigns + && (chars[i] == 'd' + || chars[i] == 'D' + || chars[i] == 'f' + || chars[i] == 'F')) { + return foundDigit; + } + if (chars[i] == 'l' + || chars[i] == 'L') { + return foundDigit && !hasExp; + } + return false; + } + return !allowSigns && foundDigit; + } +"," public static boolean isNumber(String str) { + if (StringUtils.isEmpty(str)) { + return false; + } + char[] chars = str.toCharArray(); + int sz = chars.length; + boolean hasExp = false; + boolean hasDecPoint = false; + boolean allowSigns = false; + boolean foundDigit = false; + int start = (chars[0] == '-') ? 1 : 0; + if (sz > start + 1) { + if (chars[start] == '0' && chars[start + 1] == 'x') { + int i = start + 2; + if (i == sz) { + return false; + } + for (; i < chars.length; i++) { + if ((chars[i] < '0' || chars[i] > '9') + && (chars[i] < 'a' || chars[i] > 'f') + && (chars[i] < 'A' || chars[i] > 'F')) { + return false; + } + } + return true; + } + } + sz--; + int i = start; + while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) { + if (chars[i] >= '0' && chars[i] <= '9') { + foundDigit = true; + allowSigns = false; + } else if (chars[i] == '.') { + if (hasDecPoint || hasExp) { + return false; + } + hasDecPoint = true; + } else if (chars[i] == 'e' || chars[i] == 'E') { + if (hasExp) { + return false; + } + if (!foundDigit) { + return false; + } + hasExp = true; + allowSigns = true; + } else if (chars[i] == '+' || chars[i] == '-') { + if (!allowSigns) { + return false; + } + allowSigns = false; + foundDigit = false; + } else { + return false; + } + i++; + } + if (i < chars.length) { + if (chars[i] >= '0' && chars[i] <= '9') { + return true; + } + if (chars[i] == 'e' || chars[i] == 'E') { + return false; + } + if (chars[i] == '.') { + if (hasDecPoint || hasExp) { + return false; + } + return foundDigit; + } + if (!allowSigns + && (chars[i] == 'd' + || chars[i] == 'D' + || chars[i] == 'f' + || chars[i] == 'F')) { + return foundDigit; + } + if (chars[i] == 'l' + || chars[i] == 'L') { + return foundDigit && !hasExp && !hasDecPoint; + } + return false; + } + return !allowSigns && foundDigit; + } +" +Csv-10," public CSVPrinter(final Appendable out, final CSVFormat format) throws IOException { + Assertions.notNull(out, ""out""); + Assertions.notNull(format, ""format""); + this.out = out; + this.format = format; + this.format.validate(); + } +"," public CSVPrinter(final Appendable out, final CSVFormat format) throws IOException { + Assertions.notNull(out, ""out""); + Assertions.notNull(format, ""format""); + this.out = out; + this.format = format; + this.format.validate(); + if (format.getHeader() != null) { + this.printRecord((Object[]) format.getHeader()); + } + } +" +Mockito-1," public void captureArgumentsFrom(Invocation invocation) { + if (invocation.getMethod().isVarArgs()) { + int indexOfVararg = invocation.getRawArguments().length - 1; + throw new UnsupportedOperationException(); + } else { + for (int position = 0; position < matchers.size(); position++) { + Matcher m = matchers.get(position); + if (m instanceof CapturesArguments) { + ((CapturesArguments) m).captureFrom(invocation.getArgumentAt(position, Object.class)); + } + } + } + } +"," public void captureArgumentsFrom(Invocation invocation) { + if (invocation.getMethod().isVarArgs()) { + int indexOfVararg = invocation.getRawArguments().length - 1; + for (int position = 0; position < indexOfVararg; position++) { + Matcher m = matchers.get(position); + if (m instanceof CapturesArguments) { + ((CapturesArguments) m).captureFrom(invocation.getArgumentAt(position, Object.class)); + } + } + for (int position = indexOfVararg; position < matchers.size(); position++) { + Matcher m = matchers.get(position); + if (m instanceof CapturesArguments) { + ((CapturesArguments) m).captureFrom(invocation.getRawArguments()[position - indexOfVararg]); + } + } + } else { + for (int position = 0; position < matchers.size(); position++) { + Matcher m = matchers.get(position); + if (m instanceof CapturesArguments) { + ((CapturesArguments) m).captureFrom(invocation.getArgumentAt(position, Object.class)); + } + } + } + } +" +Math-7," protected double acceptStep(final AbstractStepInterpolator interpolator, + final double[] y, final double[] yDot, final double tEnd) + throws MaxCountExceededException, DimensionMismatchException, NoBracketingException { + double previousT = interpolator.getGlobalPreviousTime(); + final double currentT = interpolator.getGlobalCurrentTime(); + if (! statesInitialized) { + for (EventState state : eventsStates) { + state.reinitializeBegin(interpolator); + } + statesInitialized = true; + } + final int orderingSign = interpolator.isForward() ? +1 : -1; + SortedSet occuringEvents = new TreeSet(new Comparator() { + public int compare(EventState es0, EventState es1) { + return orderingSign * Double.compare(es0.getEventTime(), es1.getEventTime()); + } + }); + for (final EventState state : eventsStates) { + if (state.evaluateStep(interpolator)) { + occuringEvents.add(state); + } + } + while (!occuringEvents.isEmpty()) { + final Iterator iterator = occuringEvents.iterator(); + final EventState currentEvent = iterator.next(); + iterator.remove(); + final double eventT = currentEvent.getEventTime(); + interpolator.setSoftPreviousTime(previousT); + interpolator.setSoftCurrentTime(eventT); + interpolator.setInterpolatedTime(eventT); + final double[] eventY = interpolator.getInterpolatedState().clone(); + currentEvent.stepAccepted(eventT, eventY); + isLastStep = currentEvent.stop(); + for (final StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + if (isLastStep) { + System.arraycopy(eventY, 0, y, 0, y.length); + for (final EventState remaining : occuringEvents) { + remaining.stepAccepted(eventT, eventY); + } + return eventT; + } + boolean needReset = currentEvent.reset(eventT, eventY); + if (needReset) { + System.arraycopy(eventY, 0, y, 0, y.length); + computeDerivatives(eventT, y, yDot); + resetOccurred = true; + for (final EventState remaining : occuringEvents) { + remaining.stepAccepted(eventT, eventY); + } + return eventT; + } + previousT = eventT; + interpolator.setSoftPreviousTime(eventT); + interpolator.setSoftCurrentTime(currentT); + if (currentEvent.evaluateStep(interpolator)) { + occuringEvents.add(currentEvent); + } + } + interpolator.setInterpolatedTime(currentT); + final double[] currentY = interpolator.getInterpolatedState(); + for (final EventState state : eventsStates) { + state.stepAccepted(currentT, currentY); + isLastStep = isLastStep || state.stop(); + } + isLastStep = isLastStep || Precision.equals(currentT, tEnd, 1); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + return currentT; + } +"," protected double acceptStep(final AbstractStepInterpolator interpolator, + final double[] y, final double[] yDot, final double tEnd) + throws MaxCountExceededException, DimensionMismatchException, NoBracketingException { + double previousT = interpolator.getGlobalPreviousTime(); + final double currentT = interpolator.getGlobalCurrentTime(); + if (! statesInitialized) { + for (EventState state : eventsStates) { + state.reinitializeBegin(interpolator); + } + statesInitialized = true; + } + final int orderingSign = interpolator.isForward() ? +1 : -1; + SortedSet occuringEvents = new TreeSet(new Comparator() { + public int compare(EventState es0, EventState es1) { + return orderingSign * Double.compare(es0.getEventTime(), es1.getEventTime()); + } + }); + for (final EventState state : eventsStates) { + if (state.evaluateStep(interpolator)) { + occuringEvents.add(state); + } + } + while (!occuringEvents.isEmpty()) { + final Iterator iterator = occuringEvents.iterator(); + final EventState currentEvent = iterator.next(); + iterator.remove(); + final double eventT = currentEvent.getEventTime(); + interpolator.setSoftPreviousTime(previousT); + interpolator.setSoftCurrentTime(eventT); + interpolator.setInterpolatedTime(eventT); + final double[] eventY = interpolator.getInterpolatedState().clone(); + for (final EventState state : eventsStates) { + state.stepAccepted(eventT, eventY); + isLastStep = isLastStep || state.stop(); + } + for (final StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + if (isLastStep) { + System.arraycopy(eventY, 0, y, 0, y.length); + return eventT; + } + boolean needReset = false; + for (final EventState state : eventsStates) { + needReset = needReset || state.reset(eventT, eventY); + } + if (needReset) { + System.arraycopy(eventY, 0, y, 0, y.length); + computeDerivatives(eventT, y, yDot); + resetOccurred = true; + return eventT; + } + previousT = eventT; + interpolator.setSoftPreviousTime(eventT); + interpolator.setSoftCurrentTime(currentT); + if (currentEvent.evaluateStep(interpolator)) { + occuringEvents.add(currentEvent); + } + } + interpolator.setInterpolatedTime(currentT); + final double[] currentY = interpolator.getInterpolatedState(); + for (final EventState state : eventsStates) { + state.stepAccepted(currentT, currentY); + isLastStep = isLastStep || state.stop(); + } + isLastStep = isLastStep || Precision.equals(currentT, tEnd, 1); + for (StepHandler handler : stepHandlers) { + handler.handleStep(interpolator, isLastStep); + } + return currentT; + } +" +Closure-114," private void recordAssignment(NodeTraversal t, Node n, Node recordNode) { + Node nameNode = n.getFirstChild(); + Node parent = n.getParent(); + NameInformation ns = createNameInformation(t, nameNode); + if (ns != null) { + if (parent.isFor() && !NodeUtil.isForIn(parent)) { + if (parent.getFirstChild().getNext() != n) { + recordDepScope(recordNode, ns); + } else { + recordDepScope(nameNode, ns); + } + } else { + recordDepScope(recordNode, ns); + } + } + } +"," private void recordAssignment(NodeTraversal t, Node n, Node recordNode) { + Node nameNode = n.getFirstChild(); + Node parent = n.getParent(); + NameInformation ns = createNameInformation(t, nameNode); + if (ns != null) { + if (parent.isFor() && !NodeUtil.isForIn(parent)) { + if (parent.getFirstChild().getNext() != n) { + recordDepScope(recordNode, ns); + } else { + recordDepScope(nameNode, ns); + } + } else if (!(parent.isCall() && parent.getFirstChild() == n)) { + recordDepScope(recordNode, ns); + } + } + } +" +JacksonCore-26," public void feedInput(byte[] buf, int start, int end) throws IOException + { + if (_inputPtr < _inputEnd) { + _reportError(""Still have %d undecoded bytes, should not call 'feedInput'"", _inputEnd - _inputPtr); + } + if (end < start) { + _reportError(""Input end (%d) may not be before start (%d)"", end, start); + } + if (_endOfInput) { + _reportError(""Already closed, can not feed more input""); + } + _currInputProcessed += _origBufferLen; + _currInputRowStart = start - (_inputEnd - _currInputRowStart); + _inputBuffer = buf; + _inputPtr = start; + _inputEnd = end; + _origBufferLen = end - start; + } +"," public void feedInput(byte[] buf, int start, int end) throws IOException + { + if (_inputPtr < _inputEnd) { + _reportError(""Still have %d undecoded bytes, should not call 'feedInput'"", _inputEnd - _inputPtr); + } + if (end < start) { + _reportError(""Input end (%d) may not be before start (%d)"", end, start); + } + if (_endOfInput) { + _reportError(""Already closed, can not feed more input""); + } + _currInputProcessed += _origBufferLen; + _currInputRowStart = start - (_inputEnd - _currInputRowStart); + _currBufferStart = start; + _inputBuffer = buf; + _inputPtr = start; + _inputEnd = end; + _origBufferLen = end - start; + } +" +Math-43," public void addValue(double value) { + sumImpl.increment(value); + sumsqImpl.increment(value); + minImpl.increment(value); + maxImpl.increment(value); + sumLogImpl.increment(value); + secondMoment.increment(value); + if (!(meanImpl instanceof Mean)) { + meanImpl.increment(value); + } + if (!(varianceImpl instanceof Variance)) { + varianceImpl.increment(value); + } + if (!(geoMeanImpl instanceof GeometricMean)) { + geoMeanImpl.increment(value); + } + n++; + } +"," public void addValue(double value) { + sumImpl.increment(value); + sumsqImpl.increment(value); + minImpl.increment(value); + maxImpl.increment(value); + sumLogImpl.increment(value); + secondMoment.increment(value); + if (meanImpl != mean) { + meanImpl.increment(value); + } + if (varianceImpl != variance) { + varianceImpl.increment(value); + } + if (geoMeanImpl != geoMean) { + geoMeanImpl.increment(value); + } + n++; + } +" +Closure-11," private void visitGetProp(NodeTraversal t, Node n, Node parent) { + Node property = n.getLastChild(); + Node objNode = n.getFirstChild(); + JSType childType = getJSType(objNode); + if (childType.isDict()) { + report(t, property, TypeValidator.ILLEGAL_PROPERTY_ACCESS, ""'.'"", ""dict""); + } else if (n.getJSType() != null && parent.isAssign()) { + return; + } else if (validator.expectNotNullOrUndefined(t, n, childType, + ""No properties on this expression"", getNativeType(OBJECT_TYPE))) { + checkPropertyAccess(childType, property.getString(), t, n); + } + ensureTyped(t, n); + } +"," private void visitGetProp(NodeTraversal t, Node n, Node parent) { + Node property = n.getLastChild(); + Node objNode = n.getFirstChild(); + JSType childType = getJSType(objNode); + if (childType.isDict()) { + report(t, property, TypeValidator.ILLEGAL_PROPERTY_ACCESS, ""'.'"", ""dict""); + } else if (validator.expectNotNullOrUndefined(t, n, childType, + ""No properties on this expression"", getNativeType(OBJECT_TYPE))) { + checkPropertyAccess(childType, property.getString(), t, n); + } + ensureTyped(t, n); + } +" +Lang-26," public String format(Date date) { + Calendar c = new GregorianCalendar(mTimeZone); + c.setTime(date); + return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString(); + } +"," public String format(Date date) { + Calendar c = new GregorianCalendar(mTimeZone, mLocale); + c.setTime(date); + return applyRules(c, new StringBuffer(mMaxLengthEstimate)).toString(); + } +" +Codec-15," private char getMappingCode(final String str, final int index) { + final char mappedChar = this.map(str.charAt(index)); + if (index > 1 && mappedChar != '0') { + final char hwChar = str.charAt(index - 1); + if ('H' == hwChar || 'W' == hwChar) { + final char preHWChar = str.charAt(index - 2); + final char firstCode = this.map(preHWChar); + if (firstCode == mappedChar || 'H' == preHWChar || 'W' == preHWChar) { + return 0; + } + } + } + return mappedChar; + } +"," private char getMappingCode(final String str, final int index) { + final char mappedChar = this.map(str.charAt(index)); + if (index > 1 && mappedChar != '0') { + for (int i=index-1 ; i>=0 ; i--) { + final char prevChar = str.charAt(i); + if (this.map(prevChar)==mappedChar) { + return 0; + } + if ('H'!=prevChar && 'W'!=prevChar) { + break; + } + } + } + return mappedChar; + } +" +Math-84," protected void iterateSimplex(final Comparator comparator) + throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { + while (true) { + incrementIterationsCounter(); + final RealPointValuePair[] original = simplex; + final RealPointValuePair best = original[0]; + final RealPointValuePair reflected = evaluateNewSimplex(original, 1.0, comparator); + if (comparator.compare(reflected, best) < 0) { + final RealPointValuePair[] reflectedSimplex = simplex; + final RealPointValuePair expanded = evaluateNewSimplex(original, khi, comparator); + if (comparator.compare(reflected, expanded) <= 0) { + simplex = reflectedSimplex; + } + return; + } + final RealPointValuePair contracted = evaluateNewSimplex(original, gamma, comparator); + if (comparator.compare(contracted, best) < 0) { + return; + } + } + } +"," protected void iterateSimplex(final Comparator comparator) + throws FunctionEvaluationException, OptimizationException, IllegalArgumentException { + final RealConvergenceChecker checker = getConvergenceChecker(); + while (true) { + incrementIterationsCounter(); + final RealPointValuePair[] original = simplex; + final RealPointValuePair best = original[0]; + final RealPointValuePair reflected = evaluateNewSimplex(original, 1.0, comparator); + if (comparator.compare(reflected, best) < 0) { + final RealPointValuePair[] reflectedSimplex = simplex; + final RealPointValuePair expanded = evaluateNewSimplex(original, khi, comparator); + if (comparator.compare(reflected, expanded) <= 0) { + simplex = reflectedSimplex; + } + return; + } + final RealPointValuePair contracted = evaluateNewSimplex(original, gamma, comparator); + if (comparator.compare(contracted, best) < 0) { + return; + } + final int iter = getIterations(); + boolean converged = true; + for (int i = 0; i < simplex.length; ++i) { + converged &= checker.converged(iter, original[i], simplex[i]); + } + if (converged) { + return; + } + } + } +" +Lang-14," public static boolean equals(CharSequence cs1, CharSequence cs2) { + if (cs1 == cs2) { + return true; + } + if (cs1 == null || cs2 == null) { + return false; + } + return cs1.equals(cs2); + } +"," public static boolean equals(CharSequence cs1, CharSequence cs2) { + if (cs1 == cs2) { + return true; + } + if (cs1 == null || cs2 == null) { + return false; + } + if (cs1 instanceof String && cs2 instanceof String) { + return cs1.equals(cs2); + } + return CharSequenceUtils.regionMatches(cs1, false, 0, cs2, 0, Math.max(cs1.length(), cs2.length())); + } +" +Chart-17," public Object clone() throws CloneNotSupportedException { + Object clone = createCopy(0, getItemCount() - 1); + return clone; + } +"," public Object clone() throws CloneNotSupportedException { + TimeSeries clone = (TimeSeries) super.clone(); + clone.data = (List) ObjectUtilities.deepClone(this.data); + return clone; + } +" +Jsoup-85," public Attribute(String key, String val, Attributes parent) { + Validate.notNull(key); + this.key = key.trim(); + Validate.notEmpty(key); + this.val = val; + this.parent = parent; + } +"," public Attribute(String key, String val, Attributes parent) { + Validate.notNull(key); + key = key.trim(); + Validate.notEmpty(key); + this.key = key; + this.val = val; + this.parent = parent; + } +" +Math-94," public static int gcd(int u, int v) { + if (u * v == 0) { + return (Math.abs(u) + Math.abs(v)); + } + if (u > 0) { + u = -u; + } + if (v > 0) { + v = -v; + } + int k = 0; + while ((u & 1) == 0 && (v & 1) == 0 && k < 31) { + u /= 2; + v /= 2; + k++; + } + if (k == 31) { + throw new ArithmeticException(""overflow: gcd is 2^31""); + } + int t = ((u & 1) == 1) ? v : -(u / 2); + do { + while ((t & 1) == 0) { + t /= 2; + } + if (t > 0) { + u = -t; + } else { + v = t; + } + t = (v - u) / 2; + } while (t != 0); + return -u * (1 << k); + } +"," public static int gcd(int u, int v) { + if ((u == 0) || (v == 0)) { + return (Math.abs(u) + Math.abs(v)); + } + if (u > 0) { + u = -u; + } + if (v > 0) { + v = -v; + } + int k = 0; + while ((u & 1) == 0 && (v & 1) == 0 && k < 31) { + u /= 2; + v /= 2; + k++; + } + if (k == 31) { + throw new ArithmeticException(""overflow: gcd is 2^31""); + } + int t = ((u & 1) == 1) ? v : -(u / 2); + do { + while ((t & 1) == 0) { + t /= 2; + } + if (t > 0) { + u = -t; + } else { + v = t; + } + t = (v - u) / 2; + } while (t != 0); + return -u * (1 << k); + } +" +Compress-27," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer = buffer[end - 1]; + while (start < end && (trailer == 0 || trailer == ' ')) { + end--; + trailer = buffer[end - 1]; + } + if (start == end) { + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, trailer)); + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +"," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer = buffer[end - 1]; + while (start < end && (trailer == 0 || trailer == ' ')) { + end--; + trailer = buffer[end - 1]; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +" +Closure-58," private void computeGenKill(Node n, BitSet gen, BitSet kill, + boolean conditional) { + switch (n.getType()) { + case Token.SCRIPT: + case Token.BLOCK: + case Token.FUNCTION: + return; + case Token.WHILE: + case Token.DO: + case Token.IF: + computeGenKill(NodeUtil.getConditionExpression(n), gen, kill, + conditional); + return; + case Token.FOR: + if (!NodeUtil.isForIn(n)) { + computeGenKill(NodeUtil.getConditionExpression(n), gen, kill, + conditional); + } else { + Node lhs = n.getFirstChild(); + Node rhs = lhs.getNext(); + if (NodeUtil.isVar(lhs)) { + lhs = lhs.getLastChild(); + } + addToSetIfLocal(lhs, kill); + addToSetIfLocal(lhs, gen); + computeGenKill(rhs, gen, kill, conditional); + } + return; + case Token.VAR: + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + if (c.hasChildren()) { + computeGenKill(c.getFirstChild(), gen, kill, conditional); + if (!conditional) { + addToSetIfLocal(c, kill); + } + } + } + return; + case Token.AND: + case Token.OR: + computeGenKill(n.getFirstChild(), gen, kill, conditional); + computeGenKill(n.getLastChild(), gen, kill, true); + return; + case Token.HOOK: + computeGenKill(n.getFirstChild(), gen, kill, conditional); + computeGenKill(n.getFirstChild().getNext(), gen, kill, true); + computeGenKill(n.getLastChild(), gen, kill, true); + return; + case Token.NAME: + if (isArgumentsName(n)) { + markAllParametersEscaped(); + } else { + addToSetIfLocal(n, gen); + } + return; + default: + if (NodeUtil.isAssignmentOp(n) && NodeUtil.isName(n.getFirstChild())) { + Node lhs = n.getFirstChild(); + if (!conditional) { + addToSetIfLocal(lhs, kill); + } + if (!NodeUtil.isAssign(n)) { + addToSetIfLocal(lhs, gen); + } + computeGenKill(lhs.getNext(), gen, kill, conditional); + } else { + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + computeGenKill(c, gen, kill, conditional); + } + } + return; + } + } +"," private void computeGenKill(Node n, BitSet gen, BitSet kill, + boolean conditional) { + switch (n.getType()) { + case Token.SCRIPT: + case Token.BLOCK: + case Token.FUNCTION: + return; + case Token.WHILE: + case Token.DO: + case Token.IF: + computeGenKill(NodeUtil.getConditionExpression(n), gen, kill, + conditional); + return; + case Token.FOR: + if (!NodeUtil.isForIn(n)) { + computeGenKill(NodeUtil.getConditionExpression(n), gen, kill, + conditional); + } else { + Node lhs = n.getFirstChild(); + Node rhs = lhs.getNext(); + if (NodeUtil.isVar(lhs)) { + lhs = lhs.getLastChild(); + } + if (NodeUtil.isName(lhs)) { + addToSetIfLocal(lhs, kill); + addToSetIfLocal(lhs, gen); + } else { + computeGenKill(lhs, gen, kill, conditional); + } + computeGenKill(rhs, gen, kill, conditional); + } + return; + case Token.VAR: + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + if (c.hasChildren()) { + computeGenKill(c.getFirstChild(), gen, kill, conditional); + if (!conditional) { + addToSetIfLocal(c, kill); + } + } + } + return; + case Token.AND: + case Token.OR: + computeGenKill(n.getFirstChild(), gen, kill, conditional); + computeGenKill(n.getLastChild(), gen, kill, true); + return; + case Token.HOOK: + computeGenKill(n.getFirstChild(), gen, kill, conditional); + computeGenKill(n.getFirstChild().getNext(), gen, kill, true); + computeGenKill(n.getLastChild(), gen, kill, true); + return; + case Token.NAME: + if (isArgumentsName(n)) { + markAllParametersEscaped(); + } else { + addToSetIfLocal(n, gen); + } + return; + default: + if (NodeUtil.isAssignmentOp(n) && NodeUtil.isName(n.getFirstChild())) { + Node lhs = n.getFirstChild(); + if (!conditional) { + addToSetIfLocal(lhs, kill); + } + if (!NodeUtil.isAssign(n)) { + addToSetIfLocal(lhs, gen); + } + computeGenKill(lhs.getNext(), gen, kill, conditional); + } else { + for (Node c = n.getFirstChild(); c != null; c = c.getNext()) { + computeGenKill(c, gen, kill, conditional); + } + } + return; + } + } +" +Lang-1," public static Number createNumber(final String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + final String[] hex_prefixes = {""0x"", ""0X"", ""-0x"", ""-0X"", ""#"", ""-#""}; + int pfxLen = 0; + for(final String pfx : hex_prefixes) { + if (str.startsWith(pfx)) { + pfxLen += pfx.length(); + break; + } + } + if (pfxLen > 0) { + final int hexDigits = str.length() - pfxLen; + if (hexDigits > 16) { + return createBigInteger(str); + } + if (hexDigits > 8) { + return createLong(str); + } + return createInteger(str); + } + final char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + final int decPos = str.indexOf('.'); + final int expPos = str.indexOf('e') + str.indexOf('E') + 1; + int numDecimals = 0; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + numDecimals = dec.length(); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + final String numeric = str.substring(0, str.length() - 1); + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + final Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (final NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + final Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (final NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (final NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (final NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(str); + } + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + if(numDecimals <= 7){ + final Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } + } catch (final NumberFormatException nfe) { + } + try { + if(numDecimals <= 16){ + final Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } + } catch (final NumberFormatException nfe) { + } + return createBigDecimal(str); + } +"," public static Number createNumber(final String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + final String[] hex_prefixes = {""0x"", ""0X"", ""-0x"", ""-0X"", ""#"", ""-#""}; + int pfxLen = 0; + for(final String pfx : hex_prefixes) { + if (str.startsWith(pfx)) { + pfxLen += pfx.length(); + break; + } + } + if (pfxLen > 0) { + char firstSigDigit = 0; + for(int i = pfxLen; i < str.length(); i++) { + firstSigDigit = str.charAt(i); + if (firstSigDigit == '0') { + pfxLen++; + } else { + break; + } + } + final int hexDigits = str.length() - pfxLen; + if (hexDigits > 16 || (hexDigits == 16 && firstSigDigit > '7')) { + return createBigInteger(str); + } + if (hexDigits > 8 || (hexDigits == 8 && firstSigDigit > '7')) { + return createLong(str); + } + return createInteger(str); + } + final char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + final int decPos = str.indexOf('.'); + final int expPos = str.indexOf('e') + str.indexOf('E') + 1; + int numDecimals = 0; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + numDecimals = dec.length(); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + final String numeric = str.substring(0, str.length() - 1); + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + final Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (final NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + final Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (final NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (final NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (final NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(str); + } + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + if(numDecimals <= 7){ + final Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } + } catch (final NumberFormatException nfe) { + } + try { + if(numDecimals <= 16){ + final Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } + } catch (final NumberFormatException nfe) { + } + return createBigDecimal(str); + } +" +Collections-26," private Object readResolve() { + calculateHashCode(keys); + return this; + } +"," protected Object readResolve() { + calculateHashCode(keys); + return this; + } +" +JacksonCore-15," public JsonToken nextToken() throws IOException + { + TokenFilterContext ctxt = _exposedContext; + if (ctxt != null) { + while (true) { + JsonToken t = ctxt.nextTokenToRead(); + if (t != null) { + _currToken = t; + return t; + } + if (ctxt == _headContext) { + _exposedContext = null; + if (ctxt.inArray()) { + t = delegate.getCurrentToken(); + _currToken = t; + return t; + } + break; + } + ctxt = _headContext.findChildOf(ctxt); + _exposedContext = ctxt; + if (ctxt == null) { + throw _constructError(""Unexpected problem: chain of filtered context broken""); + } + } + } + JsonToken t = delegate.nextToken(); + if (t == null) { + return (_currToken = t); + } + TokenFilter f; + switch (t.id()) { + case ID_START_ARRAY: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartArray(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildArrayContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_START_OBJECT: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartObject(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildObjectContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_END_ARRAY: + case ID_END_OBJECT: + { + boolean returnEnd = _headContext.isStartHandled(); + f = _headContext.getFilter(); + if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) { + f.filterFinishArray(); + } + _headContext = _headContext.getParent(); + _itemFilter = _headContext.getFilter(); + if (returnEnd) { + return (_currToken = t); + } + } + break; + case ID_FIELD_NAME: + { + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); + if (f == TokenFilter.INCLUDE_ALL) { + _itemFilter = f; + if (!_includePath) { + if (_includeImmediateParent && !_headContext.isStartHandled()) { + t = _headContext.nextTokenToRead(); + _exposedContext = _headContext; + } + } + return (_currToken = t); + } + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + f = f.includeProperty(name); + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + if (_includePath) { + return (_currToken = t); + } + } + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + } + default: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + return (_currToken = t); + } + if (f != null) { + f = _headContext.checkValue(f); + if ((f == TokenFilter.INCLUDE_ALL) + || ((f != null) && f.includeValue(delegate))) { + return (_currToken = t); + } + } + break; + } + return _nextToken2(); + } +"," public JsonToken nextToken() throws IOException + { + if(!_allowMultipleMatches && _currToken != null && _exposedContext == null){ + if((_currToken.isStructEnd() && _headContext.isStartHandled()) ){ + return (_currToken = null); + } + else if(_currToken.isScalarValue() && !_headContext.isStartHandled() && !_includePath + && _itemFilter == TokenFilter.INCLUDE_ALL) { + return (_currToken = null); + } + } + TokenFilterContext ctxt = _exposedContext; + if (ctxt != null) { + while (true) { + JsonToken t = ctxt.nextTokenToRead(); + if (t != null) { + _currToken = t; + return t; + } + if (ctxt == _headContext) { + _exposedContext = null; + if (ctxt.inArray()) { + t = delegate.getCurrentToken(); + _currToken = t; + return t; + } + break; + } + ctxt = _headContext.findChildOf(ctxt); + _exposedContext = ctxt; + if (ctxt == null) { + throw _constructError(""Unexpected problem: chain of filtered context broken""); + } + } + } + JsonToken t = delegate.nextToken(); + if (t == null) { + return (_currToken = t); + } + TokenFilter f; + switch (t.id()) { + case ID_START_ARRAY: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartArray(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildArrayContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildArrayContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_START_OBJECT: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + if (f == null) { + delegate.skipChildren(); + break; + } + f = _headContext.checkValue(f); + if (f == null) { + delegate.skipChildren(); + break; + } + if (f != TokenFilter.INCLUDE_ALL) { + f = f.filterStartObject(); + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + _headContext = _headContext.createChildObjectContext(f, true); + return (_currToken = t); + } + _headContext = _headContext.createChildObjectContext(f, false); + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + case ID_END_ARRAY: + case ID_END_OBJECT: + { + boolean returnEnd = _headContext.isStartHandled(); + f = _headContext.getFilter(); + if ((f != null) && (f != TokenFilter.INCLUDE_ALL)) { + f.filterFinishArray(); + } + _headContext = _headContext.getParent(); + _itemFilter = _headContext.getFilter(); + if (returnEnd) { + return (_currToken = t); + } + } + break; + case ID_FIELD_NAME: + { + final String name = delegate.getCurrentName(); + f = _headContext.setFieldName(name); + if (f == TokenFilter.INCLUDE_ALL) { + _itemFilter = f; + if (!_includePath) { + if (_includeImmediateParent && !_headContext.isStartHandled()) { + t = _headContext.nextTokenToRead(); + _exposedContext = _headContext; + } + } + return (_currToken = t); + } + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + f = f.includeProperty(name); + if (f == null) { + delegate.nextToken(); + delegate.skipChildren(); + break; + } + _itemFilter = f; + if (f == TokenFilter.INCLUDE_ALL) { + if (_includePath) { + return (_currToken = t); + } + } + if (_includePath) { + t = _nextTokenWithBuffering(_headContext); + if (t != null) { + _currToken = t; + return t; + } + } + break; + } + default: + f = _itemFilter; + if (f == TokenFilter.INCLUDE_ALL) { + return (_currToken = t); + } + if (f != null) { + f = _headContext.checkValue(f); + if ((f == TokenFilter.INCLUDE_ALL) + || ((f != null) && f.includeValue(delegate))) { + return (_currToken = t); + } + } + break; + } + return _nextToken2(); + } +" +Gson-12," @Override public void skipValue() throws IOException { + if (peek() == JsonToken.NAME) { + nextName(); + pathNames[stackSize - 2] = ""null""; + } else { + popStack(); + pathNames[stackSize - 1] = ""null""; + } + pathIndices[stackSize - 1]++; + } +"," @Override public void skipValue() throws IOException { + if (peek() == JsonToken.NAME) { + nextName(); + pathNames[stackSize - 2] = ""null""; + } else { + popStack(); + if (stackSize > 0) { + pathNames[stackSize - 1] = ""null""; + } + } + if (stackSize > 0) { + pathIndices[stackSize - 1]++; + } + } +" +Math-23," protected UnivariatePointValuePair doOptimize() { + final boolean isMinim = getGoalType() == GoalType.MINIMIZE; + final double lo = getMin(); + final double mid = getStartValue(); + final double hi = getMax(); + final ConvergenceChecker checker + = getConvergenceChecker(); + double a; + double b; + if (lo < hi) { + a = lo; + b = hi; + } else { + a = hi; + b = lo; + } + double x = mid; + double v = x; + double w = x; + double d = 0; + double e = 0; + double fx = computeObjectiveValue(x); + if (!isMinim) { + fx = -fx; + } + double fv = fx; + double fw = fx; + UnivariatePointValuePair previous = null; + UnivariatePointValuePair current + = new UnivariatePointValuePair(x, isMinim ? fx : -fx); + int iter = 0; + while (true) { + final double m = 0.5 * (a + b); + final double tol1 = relativeThreshold * FastMath.abs(x) + absoluteThreshold; + final double tol2 = 2 * tol1; + final boolean stop = FastMath.abs(x - m) <= tol2 - 0.5 * (b - a); + if (!stop) { + double p = 0; + double q = 0; + double r = 0; + double u = 0; + if (FastMath.abs(e) > tol1) { + r = (x - w) * (fx - fv); + q = (x - v) * (fx - fw); + p = (x - v) * q - (x - w) * r; + q = 2 * (q - r); + if (q > 0) { + p = -p; + } else { + q = -q; + } + r = e; + e = d; + if (p > q * (a - x) && + p < q * (b - x) && + FastMath.abs(p) < FastMath.abs(0.5 * q * r)) { + d = p / q; + u = x + d; + if (u - a < tol2 || b - u < tol2) { + if (x <= m) { + d = tol1; + } else { + d = -tol1; + } + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + if (FastMath.abs(d) < tol1) { + if (d >= 0) { + u = x + tol1; + } else { + u = x - tol1; + } + } else { + u = x + d; + } + double fu = computeObjectiveValue(u); + if (!isMinim) { + fu = -fu; + } + previous = current; + current = new UnivariatePointValuePair(u, isMinim ? fu : -fu); + if (checker != null) { + if (checker.converged(iter, previous, current)) { + return best(current, previous, isMinim); + } + } + if (fu <= fx) { + if (u < x) { + b = x; + } else { + a = x; + } + v = w; + fv = fw; + w = x; + fw = fx; + x = u; + fx = fu; + } else { + if (u < x) { + a = u; + } else { + b = u; + } + if (fu <= fw || + Precision.equals(w, x)) { + v = w; + fv = fw; + w = u; + fw = fu; + } else if (fu <= fv || + Precision.equals(v, x) || + Precision.equals(v, w)) { + v = u; + fv = fu; + } + } + } else { + return + best(current, + previous, + isMinim); + } + ++iter; + } + } +"," protected UnivariatePointValuePair doOptimize() { + final boolean isMinim = getGoalType() == GoalType.MINIMIZE; + final double lo = getMin(); + final double mid = getStartValue(); + final double hi = getMax(); + final ConvergenceChecker checker + = getConvergenceChecker(); + double a; + double b; + if (lo < hi) { + a = lo; + b = hi; + } else { + a = hi; + b = lo; + } + double x = mid; + double v = x; + double w = x; + double d = 0; + double e = 0; + double fx = computeObjectiveValue(x); + if (!isMinim) { + fx = -fx; + } + double fv = fx; + double fw = fx; + UnivariatePointValuePair previous = null; + UnivariatePointValuePair current + = new UnivariatePointValuePair(x, isMinim ? fx : -fx); + UnivariatePointValuePair best = current; + int iter = 0; + while (true) { + final double m = 0.5 * (a + b); + final double tol1 = relativeThreshold * FastMath.abs(x) + absoluteThreshold; + final double tol2 = 2 * tol1; + final boolean stop = FastMath.abs(x - m) <= tol2 - 0.5 * (b - a); + if (!stop) { + double p = 0; + double q = 0; + double r = 0; + double u = 0; + if (FastMath.abs(e) > tol1) { + r = (x - w) * (fx - fv); + q = (x - v) * (fx - fw); + p = (x - v) * q - (x - w) * r; + q = 2 * (q - r); + if (q > 0) { + p = -p; + } else { + q = -q; + } + r = e; + e = d; + if (p > q * (a - x) && + p < q * (b - x) && + FastMath.abs(p) < FastMath.abs(0.5 * q * r)) { + d = p / q; + u = x + d; + if (u - a < tol2 || b - u < tol2) { + if (x <= m) { + d = tol1; + } else { + d = -tol1; + } + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + } else { + if (x < m) { + e = b - x; + } else { + e = a - x; + } + d = GOLDEN_SECTION * e; + } + if (FastMath.abs(d) < tol1) { + if (d >= 0) { + u = x + tol1; + } else { + u = x - tol1; + } + } else { + u = x + d; + } + double fu = computeObjectiveValue(u); + if (!isMinim) { + fu = -fu; + } + previous = current; + current = new UnivariatePointValuePair(u, isMinim ? fu : -fu); + best = best(best, + best(current, + previous, + isMinim), + isMinim); + if (checker != null) { + if (checker.converged(iter, previous, current)) { + return best; + } + } + if (fu <= fx) { + if (u < x) { + b = x; + } else { + a = x; + } + v = w; + fv = fw; + w = x; + fw = fx; + x = u; + fx = fu; + } else { + if (u < x) { + a = u; + } else { + b = u; + } + if (fu <= fw || + Precision.equals(w, x)) { + v = w; + fv = fw; + w = u; + fw = fu; + } else if (fu <= fv || + Precision.equals(v, x) || + Precision.equals(v, w)) { + v = u; + fv = fu; + } + } + } else { + return best(best, + best(current, + previous, + isMinim), + isMinim); + } + ++iter; + } + } +" +Math-55," public static Vector3D crossProduct(final Vector3D v1, final Vector3D v2) { + return new Vector3D(v1.y * v2.z - v1.z * v2.y, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v1.y * v2.x); + } +"," public static Vector3D crossProduct(final Vector3D v1, final Vector3D v2) { + final double n1 = v1.getNormSq(); + final double n2 = v2.getNormSq(); + if ((n1 * n2) < MathUtils.SAFE_MIN) { + return ZERO; + } + final int deltaExp = (FastMath.getExponent(n1) - FastMath.getExponent(n2)) / 4; + final double x1 = FastMath.scalb(v1.x, -deltaExp); + final double y1 = FastMath.scalb(v1.y, -deltaExp); + final double z1 = FastMath.scalb(v1.z, -deltaExp); + final double x2 = FastMath.scalb(v2.x, deltaExp); + final double y2 = FastMath.scalb(v2.y, deltaExp); + final double z2 = FastMath.scalb(v2.z, deltaExp); + final double ratio = (x1 * x2 + y1 * y2 + z1 * z2) / FastMath.scalb(n2, 2 * deltaExp); + final double rho = FastMath.rint(256 * ratio) / 256; + final double x3 = x1 - rho * x2; + final double y3 = y1 - rho * y2; + final double z3 = z1 - rho * z2; + return new Vector3D(y3 * z2 - z3 * y2, z3 * x2 - x3 * z2, x3 * y2 - y3 * x2); + } +" +Gson-16," private static Type resolve(Type context, Class contextRawType, Type toResolve, + Collection visitedTypeVariables) { + while (true) { + if (toResolve instanceof TypeVariable) { + TypeVariable typeVariable = (TypeVariable) toResolve; + toResolve = resolveTypeVariable(context, contextRawType, typeVariable); + if (toResolve == typeVariable) { + return toResolve; + } + } else if (toResolve instanceof Class && ((Class) toResolve).isArray()) { + Class original = (Class) toResolve; + Type componentType = original.getComponentType(); + Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); + return componentType == newComponentType + ? original + : arrayOf(newComponentType); + } else if (toResolve instanceof GenericArrayType) { + GenericArrayType original = (GenericArrayType) toResolve; + Type componentType = original.getGenericComponentType(); + Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); + return componentType == newComponentType + ? original + : arrayOf(newComponentType); + } else if (toResolve instanceof ParameterizedType) { + ParameterizedType original = (ParameterizedType) toResolve; + Type ownerType = original.getOwnerType(); + Type newOwnerType = resolve(context, contextRawType, ownerType, visitedTypeVariables); + boolean changed = newOwnerType != ownerType; + Type[] args = original.getActualTypeArguments(); + for (int t = 0, length = args.length; t < length; t++) { + Type resolvedTypeArgument = resolve(context, contextRawType, args[t], visitedTypeVariables); + if (resolvedTypeArgument != args[t]) { + if (!changed) { + args = args.clone(); + changed = true; + } + args[t] = resolvedTypeArgument; + } + } + return changed + ? newParameterizedTypeWithOwner(newOwnerType, original.getRawType(), args) + : original; + } else if (toResolve instanceof WildcardType) { + WildcardType original = (WildcardType) toResolve; + Type[] originalLowerBound = original.getLowerBounds(); + Type[] originalUpperBound = original.getUpperBounds(); + if (originalLowerBound.length == 1) { + Type lowerBound = resolve(context, contextRawType, originalLowerBound[0], visitedTypeVariables); + if (lowerBound != originalLowerBound[0]) { + return supertypeOf(lowerBound); + } + } else if (originalUpperBound.length == 1) { + Type upperBound = resolve(context, contextRawType, originalUpperBound[0], visitedTypeVariables); + if (upperBound != originalUpperBound[0]) { + return subtypeOf(upperBound); + } + } + return original; + } else { + return toResolve; + } + } + } +"," private static Type resolve(Type context, Class contextRawType, Type toResolve, + Collection visitedTypeVariables) { + while (true) { + if (toResolve instanceof TypeVariable) { + TypeVariable typeVariable = (TypeVariable) toResolve; + if (visitedTypeVariables.contains(typeVariable)) { + return toResolve; + } else { + visitedTypeVariables.add(typeVariable); + } + toResolve = resolveTypeVariable(context, contextRawType, typeVariable); + if (toResolve == typeVariable) { + return toResolve; + } + } else if (toResolve instanceof Class && ((Class) toResolve).isArray()) { + Class original = (Class) toResolve; + Type componentType = original.getComponentType(); + Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); + return componentType == newComponentType + ? original + : arrayOf(newComponentType); + } else if (toResolve instanceof GenericArrayType) { + GenericArrayType original = (GenericArrayType) toResolve; + Type componentType = original.getGenericComponentType(); + Type newComponentType = resolve(context, contextRawType, componentType, visitedTypeVariables); + return componentType == newComponentType + ? original + : arrayOf(newComponentType); + } else if (toResolve instanceof ParameterizedType) { + ParameterizedType original = (ParameterizedType) toResolve; + Type ownerType = original.getOwnerType(); + Type newOwnerType = resolve(context, contextRawType, ownerType, visitedTypeVariables); + boolean changed = newOwnerType != ownerType; + Type[] args = original.getActualTypeArguments(); + for (int t = 0, length = args.length; t < length; t++) { + Type resolvedTypeArgument = resolve(context, contextRawType, args[t], visitedTypeVariables); + if (resolvedTypeArgument != args[t]) { + if (!changed) { + args = args.clone(); + changed = true; + } + args[t] = resolvedTypeArgument; + } + } + return changed + ? newParameterizedTypeWithOwner(newOwnerType, original.getRawType(), args) + : original; + } else if (toResolve instanceof WildcardType) { + WildcardType original = (WildcardType) toResolve; + Type[] originalLowerBound = original.getLowerBounds(); + Type[] originalUpperBound = original.getUpperBounds(); + if (originalLowerBound.length == 1) { + Type lowerBound = resolve(context, contextRawType, originalLowerBound[0], visitedTypeVariables); + if (lowerBound != originalLowerBound[0]) { + return supertypeOf(lowerBound); + } + } else if (originalUpperBound.length == 1) { + Type upperBound = resolve(context, contextRawType, originalUpperBound[0], visitedTypeVariables); + if (upperBound != originalUpperBound[0]) { + return subtypeOf(upperBound); + } + } + return original; + } else { + return toResolve; + } + } + } +" +Closure-99," public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { + if (n.getType() == Token.FUNCTION) { + JSDocInfo jsDoc = getFunctionJsDocInfo(n); + if (jsDoc != null && + (jsDoc.isConstructor() || + jsDoc.hasThisType() || + jsDoc.isOverride())) { + return false; + } + int pType = parent.getType(); + if (!(pType == Token.BLOCK || + pType == Token.SCRIPT || + pType == Token.NAME || + pType == Token.ASSIGN)) { + return false; + } + } + if (parent != null && parent.getType() == Token.ASSIGN) { + Node lhs = parent.getFirstChild(); + Node rhs = lhs.getNext(); + if (n == lhs) { + if (assignLhsChild == null) { + assignLhsChild = lhs; + } + } else { + if (lhs.getType() == Token.GETPROP && + lhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + if (lhs.getQualifiedName() != null && lhs.getQualifiedName().contains("".prototype."")) { + return false; + } + } + } + return true; + } +"," public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { + if (n.getType() == Token.FUNCTION) { + JSDocInfo jsDoc = getFunctionJsDocInfo(n); + if (jsDoc != null && + (jsDoc.isConstructor() || + jsDoc.isInterface() || + jsDoc.hasThisType() || + jsDoc.isOverride())) { + return false; + } + int pType = parent.getType(); + if (!(pType == Token.BLOCK || + pType == Token.SCRIPT || + pType == Token.NAME || + pType == Token.ASSIGN)) { + return false; + } + } + if (parent != null && parent.getType() == Token.ASSIGN) { + Node lhs = parent.getFirstChild(); + Node rhs = lhs.getNext(); + if (n == lhs) { + if (assignLhsChild == null) { + assignLhsChild = lhs; + } + } else { + if (NodeUtil.isGet(lhs)) { + if (lhs.getType() == Token.GETPROP && + lhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + Node llhs = lhs.getFirstChild(); + if (llhs.getType() == Token.GETPROP && + llhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + } + } + } + return true; + } +" +JacksonDatabind-62," public CollectionDeserializer createContextual(DeserializationContext ctxt, + BeanProperty property) throws JsonMappingException + { + JsonDeserializer delegateDeser = null; + if (_valueInstantiator != null) { + if (_valueInstantiator.canCreateUsingDelegate()) { + JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); + if (delegateType == null) { + throw new IllegalArgumentException(""Invalid delegate-creator definition for ""+_collectionType + +"": value instantiator (""+_valueInstantiator.getClass().getName() + +"") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'""); + } + delegateDeser = findDeserializer(ctxt, delegateType, property); + } + } + Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, + JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + JsonDeserializer valueDeser = _valueDeserializer; + valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); + final JavaType vt = _collectionType.getContentType(); + if (valueDeser == null) { + valueDeser = ctxt.findContextualValueDeserializer(vt, property); + } else { + valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, vt); + } + TypeDeserializer valueTypeDeser = _valueTypeDeserializer; + if (valueTypeDeser != null) { + valueTypeDeser = valueTypeDeser.forProperty(property); + } + return withResolved(delegateDeser, valueDeser, valueTypeDeser, unwrapSingle); + } +"," public CollectionDeserializer createContextual(DeserializationContext ctxt, + BeanProperty property) throws JsonMappingException + { + JsonDeserializer delegateDeser = null; + if (_valueInstantiator != null) { + if (_valueInstantiator.canCreateUsingDelegate()) { + JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); + if (delegateType == null) { + throw new IllegalArgumentException(""Invalid delegate-creator definition for ""+_collectionType + +"": value instantiator (""+_valueInstantiator.getClass().getName() + +"") returned true for 'canCreateUsingDelegate()', but null for 'getDelegateType()'""); + } + delegateDeser = findDeserializer(ctxt, delegateType, property); + } else if (_valueInstantiator.canCreateUsingArrayDelegate()) { + JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig()); + if (delegateType == null) { + throw new IllegalArgumentException(""Invalid array-delegate-creator definition for ""+_collectionType + +"": value instantiator (""+_valueInstantiator.getClass().getName() + +"") returned true for 'canCreateUsingArrayDelegate()', but null for 'getArrayDelegateType()'""); + } + delegateDeser = findDeserializer(ctxt, delegateType, property); + } + } + Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, + JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + JsonDeserializer valueDeser = _valueDeserializer; + valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); + final JavaType vt = _collectionType.getContentType(); + if (valueDeser == null) { + valueDeser = ctxt.findContextualValueDeserializer(vt, property); + } else { + valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, vt); + } + TypeDeserializer valueTypeDeser = _valueTypeDeserializer; + if (valueTypeDeser != null) { + valueTypeDeser = valueTypeDeser.forProperty(property); + } + return withResolved(delegateDeser, valueDeser, valueTypeDeser, unwrapSingle); + } +" +Cli-38," private boolean isShortOption(String token) + { + if (!token.startsWith(""-"") || token.length() == 1) + { + return false; + } + int pos = token.indexOf(""=""); + String optName = pos == -1 ? token.substring(1) : token.substring(1, pos); + return options.hasShortOption(optName); + } +"," private boolean isShortOption(String token) + { + if (!token.startsWith(""-"") || token.length() == 1) + { + return false; + } + int pos = token.indexOf(""=""); + String optName = pos == -1 ? token.substring(1) : token.substring(1, pos); + if (options.hasShortOption(optName)) + { + return true; + } + return optName.length() > 0 && options.hasShortOption(String.valueOf(optName.charAt(0))); + } +" +Time-15," public static long safeMultiply(long val1, int val2) { + switch (val2) { + case -1: + return -val1; + case 0: + return 0L; + case 1: + return val1; + } + long total = val1 * val2; + if (total / val2 != val1) { + throw new ArithmeticException(""Multiplication overflows a long: "" + val1 + "" * "" + val2); + } + return total; + } +"," public static long safeMultiply(long val1, int val2) { + switch (val2) { + case -1: + if (val1 == Long.MIN_VALUE) { + throw new ArithmeticException(""Multiplication overflows a long: "" + val1 + "" * "" + val2); + } + return -val1; + case 0: + return 0L; + case 1: + return val1; + } + long total = val1 * val2; + if (total / val2 != val1) { + throw new ArithmeticException(""Multiplication overflows a long: "" + val1 + "" * "" + val2); + } + return total; + } +" +Csv-3," int readEscape() throws IOException { + final int c = in.read(); + switch (c) { + case 'r': + return CR; + case 'n': + return LF; + case 't': + return TAB; + case 'b': + return BACKSPACE; + case 'f': + return FF; + case CR: + case LF: + case FF: + case TAB: + case BACKSPACE: + return c; + case END_OF_STREAM: + throw new IOException(""EOF whilst processing escape sequence""); + default: + return c; + } + } +"," int readEscape() throws IOException { + final int c = in.read(); + switch (c) { + case 'r': + return CR; + case 'n': + return LF; + case 't': + return TAB; + case 'b': + return BACKSPACE; + case 'f': + return FF; + case CR: + case LF: + case FF: + case TAB: + case BACKSPACE: + return c; + case END_OF_STREAM: + throw new IOException(""EOF whilst processing escape sequence""); + default: + if (isDelimiter(c) || isEscape(c) || isQuoteChar(c) || isCommentStart(c)) { + return c; + } + return END_OF_STREAM; + } + } +" +Closure-4," JSType resolveInternal(ErrorReporter t, StaticScope enclosing) { + boolean resolved = resolveViaRegistry(t, enclosing); + if (detectImplicitPrototypeCycle()) { + handleTypeCycle(t); + } + if (resolved) { + super.resolveInternal(t, enclosing); + finishPropertyContinuations(); + return registry.isLastGeneration() ? + getReferencedType() : this; + } + resolveViaProperties(t, enclosing); + if (detectImplicitPrototypeCycle()) { + handleTypeCycle(t); + } + super.resolveInternal(t, enclosing); + if (isResolved()) { + finishPropertyContinuations(); + } + return registry.isLastGeneration() ? + getReferencedType() : this; + } +"," JSType resolveInternal(ErrorReporter t, StaticScope enclosing) { + boolean resolved = resolveViaRegistry(t, enclosing); + if (detectInheritanceCycle()) { + handleTypeCycle(t); + } + if (resolved) { + super.resolveInternal(t, enclosing); + finishPropertyContinuations(); + return registry.isLastGeneration() ? + getReferencedType() : this; + } + resolveViaProperties(t, enclosing); + if (detectInheritanceCycle()) { + handleTypeCycle(t); + } + super.resolveInternal(t, enclosing); + if (isResolved()) { + finishPropertyContinuations(); + } + return registry.isLastGeneration() ? + getReferencedType() : this; + } +" +Collections-27,," private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { + is.defaultReadObject(); + if (clazz != null && !Collection.class.isAssignableFrom(clazz)) { + throw new UnsupportedOperationException(); + } + } +" +Csv-4," public Map getHeaderMap() { + return new LinkedHashMap(this.headerMap); + } +"," public Map getHeaderMap() { + return this.headerMap == null ? null : new LinkedHashMap(this.headerMap); + } +" +Compress-18," void writePaxHeaders(String entryName, + Map headers) throws IOException { + String name = ""./PaxHeaders.X/"" + stripTo7Bits(entryName); + if (name.length() >= TarConstants.NAMELEN) { + name = name.substring(0, TarConstants.NAMELEN - 1); + } + TarArchiveEntry pex = new TarArchiveEntry(name, + TarConstants.LF_PAX_EXTENDED_HEADER_LC); + StringWriter w = new StringWriter(); + for (Map.Entry h : headers.entrySet()) { + String key = h.getKey(); + String value = h.getValue(); + int len = key.length() + value.length() + + 3 + + 2 ; + String line = len + "" "" + key + ""="" + value + ""\n""; + int actualLength = line.getBytes(CharsetNames.UTF_8).length; + while (len != actualLength) { + len = actualLength; + line = len + "" "" + key + ""="" + value + ""\n""; + actualLength = line.getBytes(CharsetNames.UTF_8).length; + } + w.write(line); + } + byte[] data = w.toString().getBytes(CharsetNames.UTF_8); + pex.setSize(data.length); + putArchiveEntry(pex); + write(data); + closeArchiveEntry(); + } +"," void writePaxHeaders(String entryName, + Map headers) throws IOException { + String name = ""./PaxHeaders.X/"" + stripTo7Bits(entryName); + while (name.endsWith(""/"")) { + name = name.substring(0, name.length() - 1); + } + if (name.length() >= TarConstants.NAMELEN) { + name = name.substring(0, TarConstants.NAMELEN - 1); + } + TarArchiveEntry pex = new TarArchiveEntry(name, + TarConstants.LF_PAX_EXTENDED_HEADER_LC); + StringWriter w = new StringWriter(); + for (Map.Entry h : headers.entrySet()) { + String key = h.getKey(); + String value = h.getValue(); + int len = key.length() + value.length() + + 3 + + 2 ; + String line = len + "" "" + key + ""="" + value + ""\n""; + int actualLength = line.getBytes(CharsetNames.UTF_8).length; + while (len != actualLength) { + len = actualLength; + line = len + "" "" + key + ""="" + value + ""\n""; + actualLength = line.getBytes(CharsetNames.UTF_8).length; + } + w.write(line); + } + byte[] data = w.toString().getBytes(CharsetNames.UTF_8); + pex.setSize(data.length); + putArchiveEntry(pex); + write(data); + closeArchiveEntry(); + } +" +Closure-96," private void visitParameterList(NodeTraversal t, Node call, + FunctionType functionType) { + Iterator arguments = call.children().iterator(); + arguments.next(); + Iterator parameters = functionType.getParameters().iterator(); + int ordinal = 0; + Node parameter = null; + Node argument = null; + while (arguments.hasNext() && + parameters.hasNext()) { + parameter = parameters.next(); + argument = arguments.next(); + ordinal++; + validator.expectArgumentMatchesParameter(t, argument, + getJSType(argument), getJSType(parameter), call, ordinal); + } + int numArgs = call.getChildCount() - 1; + int minArgs = functionType.getMinArguments(); + int maxArgs = functionType.getMaxArguments(); + if (minArgs > numArgs || maxArgs < numArgs) { + report(t, call, WRONG_ARGUMENT_COUNT, + validator.getReadableJSTypeName(call.getFirstChild(), false), + String.valueOf(numArgs), String.valueOf(minArgs), + maxArgs != Integer.MAX_VALUE ? + "" and no more than "" + maxArgs + "" argument(s)"" : """"); + } + } +"," private void visitParameterList(NodeTraversal t, Node call, + FunctionType functionType) { + Iterator arguments = call.children().iterator(); + arguments.next(); + Iterator parameters = functionType.getParameters().iterator(); + int ordinal = 0; + Node parameter = null; + Node argument = null; + while (arguments.hasNext() && + (parameters.hasNext() || + parameter != null && parameter.isVarArgs())) { + if (parameters.hasNext()) { + parameter = parameters.next(); + } + argument = arguments.next(); + ordinal++; + validator.expectArgumentMatchesParameter(t, argument, + getJSType(argument), getJSType(parameter), call, ordinal); + } + int numArgs = call.getChildCount() - 1; + int minArgs = functionType.getMinArguments(); + int maxArgs = functionType.getMaxArguments(); + if (minArgs > numArgs || maxArgs < numArgs) { + report(t, call, WRONG_ARGUMENT_COUNT, + validator.getReadableJSTypeName(call.getFirstChild(), false), + String.valueOf(numArgs), String.valueOf(minArgs), + maxArgs != Integer.MAX_VALUE ? + "" and no more than "" + maxArgs + "" argument(s)"" : """"); + } + } +" +JacksonDatabind-97," public final void serialize(JsonGenerator gen, SerializerProvider ctxt) throws IOException + { + if (_value == null) { + ctxt.defaultSerializeNull(gen); + } else if (_value instanceof JsonSerializable) { + ((JsonSerializable) _value).serialize(gen, ctxt); + } else { + gen.writeObject(_value); + } + } +"," public final void serialize(JsonGenerator gen, SerializerProvider ctxt) throws IOException + { + if (_value == null) { + ctxt.defaultSerializeNull(gen); + } else if (_value instanceof JsonSerializable) { + ((JsonSerializable) _value).serialize(gen, ctxt); + } else { + ctxt.defaultSerializeValue(_value, gen); + } + } +" +JacksonDatabind-47," public JavaType refineSerializationType(final MapperConfig config, + final Annotated a, final JavaType baseType) throws JsonMappingException + { + JavaType type = baseType; + final TypeFactory tf = config.getTypeFactory(); + Class serClass = findSerializationType(a); + if (serClass != null) { + if (type.hasRawClass(serClass)) { + type = type.withStaticTyping(); + } else { + try { + type = tf.constructGeneralizedType(type, serClass); + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Failed to widen type %s with annotation (value %s), from '%s': %s"", + type, serClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + } + if (type.isMapLikeType()) { + JavaType keyType = type.getKeyType(); + Class keyClass = findSerializationKeyType(a, keyType); + if (keyClass != null) { + if (keyType.hasRawClass(keyClass)) { + keyType = keyType.withStaticTyping(); + } else { + Class currRaw = keyType.getRawClass(); + try { + if (keyClass.isAssignableFrom(currRaw)) { + keyType = tf.constructGeneralizedType(keyType, keyClass); + } else if (currRaw.isAssignableFrom(keyClass)) { + keyType = tf.constructSpecializedType(keyType, keyClass); + } else { + throw new JsonMappingException(null, + String.format(""Can not refine serialization key type %s into %s; types not related"", + keyType, keyClass.getName())); + } + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Failed to widen key type of %s with concrete-type annotation (value %s), from '%s': %s"", + type, keyClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + type = ((MapLikeType) type).withKeyType(keyType); + } + } + JavaType contentType = type.getContentType(); + if (contentType != null) { + Class contentClass = findSerializationContentType(a, contentType); + if (contentClass != null) { + if (contentType.hasRawClass(contentClass)) { + contentType = contentType.withStaticTyping(); + } else { + Class currRaw = contentType.getRawClass(); + try { + if (contentClass.isAssignableFrom(currRaw)) { + contentType = tf.constructGeneralizedType(contentType, contentClass); + } else if (currRaw.isAssignableFrom(contentClass)) { + contentType = tf.constructSpecializedType(contentType, contentClass); + } else { + throw new JsonMappingException(null, + String.format(""Can not refine serialization content type %s into %s; types not related"", + contentType, contentClass.getName())); + } + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Internal error: failed to refine value type of %s with concrete-type annotation (value %s), from '%s': %s"", + type, contentClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + type = type.withContentType(contentType); + } + } + return type; + } +"," public JavaType refineSerializationType(final MapperConfig config, + final Annotated a, final JavaType baseType) throws JsonMappingException + { + JavaType type = baseType; + final TypeFactory tf = config.getTypeFactory(); + Class serClass = findSerializationType(a); + if (serClass != null) { + if (type.hasRawClass(serClass)) { + type = type.withStaticTyping(); + } else { + Class currRaw = type.getRawClass(); + try { + if (serClass.isAssignableFrom(currRaw)) { + type = tf.constructGeneralizedType(type, serClass); + } else if (currRaw.isAssignableFrom(serClass)) { + type = tf.constructSpecializedType(type, serClass); + } else { + throw new JsonMappingException(null, + String.format(""Can not refine serialization type %s into %s; types not related"", + type, serClass.getName())); + } + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Failed to widen type %s with annotation (value %s), from '%s': %s"", + type, serClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + } + if (type.isMapLikeType()) { + JavaType keyType = type.getKeyType(); + Class keyClass = findSerializationKeyType(a, keyType); + if (keyClass != null) { + if (keyType.hasRawClass(keyClass)) { + keyType = keyType.withStaticTyping(); + } else { + Class currRaw = keyType.getRawClass(); + try { + if (keyClass.isAssignableFrom(currRaw)) { + keyType = tf.constructGeneralizedType(keyType, keyClass); + } else if (currRaw.isAssignableFrom(keyClass)) { + keyType = tf.constructSpecializedType(keyType, keyClass); + } else { + throw new JsonMappingException(null, + String.format(""Can not refine serialization key type %s into %s; types not related"", + keyType, keyClass.getName())); + } + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Failed to widen key type of %s with concrete-type annotation (value %s), from '%s': %s"", + type, keyClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + type = ((MapLikeType) type).withKeyType(keyType); + } + } + JavaType contentType = type.getContentType(); + if (contentType != null) { + Class contentClass = findSerializationContentType(a, contentType); + if (contentClass != null) { + if (contentType.hasRawClass(contentClass)) { + contentType = contentType.withStaticTyping(); + } else { + Class currRaw = contentType.getRawClass(); + try { + if (contentClass.isAssignableFrom(currRaw)) { + contentType = tf.constructGeneralizedType(contentType, contentClass); + } else if (currRaw.isAssignableFrom(contentClass)) { + contentType = tf.constructSpecializedType(contentType, contentClass); + } else { + throw new JsonMappingException(null, + String.format(""Can not refine serialization content type %s into %s; types not related"", + contentType, contentClass.getName())); + } + } catch (IllegalArgumentException iae) { + throw new JsonMappingException(null, + String.format(""Internal error: failed to refine value type of %s with concrete-type annotation (value %s), from '%s': %s"", + type, contentClass.getName(), a.getName(), iae.getMessage()), + iae); + } + } + type = type.withContentType(contentType); + } + } + return type; + } +" +Math-27," public double percentageValue() { + return multiply(100).doubleValue(); + } +"," public double percentageValue() { + return 100 * doubleValue(); + } +" +Closure-36," private boolean canInline( + Reference declaration, + Reference initialization, + Reference reference) { + if (!isValidDeclaration(declaration) + || !isValidInitialization(initialization) + || !isValidReference(reference)) { + return false; + } + if (declaration != initialization && + !initialization.getGrandparent().isExprResult()) { + return false; + } + if (declaration.getBasicBlock() != initialization.getBasicBlock() + || declaration.getBasicBlock() != reference.getBasicBlock()) { + return false; + } + Node value = initialization.getAssignedValue(); + Preconditions.checkState(value != null); + if (value.isGetProp() + && reference.getParent().isCall() + && reference.getParent().getFirstChild() == reference.getNode()) { + return false; + } + if (value.isFunction()) { + Node callNode = reference.getParent(); + if (reference.getParent().isCall()) { + CodingConvention convention = compiler.getCodingConvention(); + SubclassRelationship relationship = + convention.getClassesDefinedByCall(callNode); + if (relationship != null) { + return false; + } + } + } + return canMoveAggressively(value) || + canMoveModerately(initialization, reference); + } +"," private boolean canInline( + Reference declaration, + Reference initialization, + Reference reference) { + if (!isValidDeclaration(declaration) + || !isValidInitialization(initialization) + || !isValidReference(reference)) { + return false; + } + if (declaration != initialization && + !initialization.getGrandparent().isExprResult()) { + return false; + } + if (declaration.getBasicBlock() != initialization.getBasicBlock() + || declaration.getBasicBlock() != reference.getBasicBlock()) { + return false; + } + Node value = initialization.getAssignedValue(); + Preconditions.checkState(value != null); + if (value.isGetProp() + && reference.getParent().isCall() + && reference.getParent().getFirstChild() == reference.getNode()) { + return false; + } + if (value.isFunction()) { + Node callNode = reference.getParent(); + if (reference.getParent().isCall()) { + CodingConvention convention = compiler.getCodingConvention(); + SubclassRelationship relationship = + convention.getClassesDefinedByCall(callNode); + if (relationship != null) { + return false; + } + if (convention.getSingletonGetterClassName(callNode) != null) { + return false; + } + } + } + return canMoveAggressively(value) || + canMoveModerately(initialization, reference); + } +" +Jsoup-13," public boolean hasAttr(String attributeKey) { + Validate.notNull(attributeKey); + return attributes.hasKey(attributeKey); + } +"," public boolean hasAttr(String attributeKey) { + Validate.notNull(attributeKey); + if (attributeKey.toLowerCase().startsWith(""abs:"")) { + String key = attributeKey.substring(""abs:"".length()); + if (attributes.hasKey(key) && !absUrl(key).equals("""")) + return true; + } + return attributes.hasKey(attributeKey); + } +" +Compress-14," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + boolean allNUL = true; + for (int i = start; i < end; i++){ + if (buffer[i] != 0){ + allNUL = false; + break; + } + } + if (allNUL) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer; + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } else { + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, end-1, trailer)); + } + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +"," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer; + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } else { + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, end-1, trailer)); + } + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +" +JacksonDatabind-83," public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + String text = p.getValueAsString(); + if (text != null) { + if (text.length() == 0 || (text = text.trim()).length() == 0) { + return _deserializeFromEmptyString(); + } + Exception cause = null; + try { + if (_deserialize(text, ctxt) != null) { + return _deserialize(text, ctxt); + } + } catch (IllegalArgumentException iae) { + cause = iae; + } catch (MalformedURLException me) { + cause = me; + } + String msg = ""not a valid textual representation""; + if (cause != null) { + String m2 = cause.getMessage(); + if (m2 != null) { + msg = msg + "", problem: ""+m2; + } + } + JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg); + if (cause != null) { + e.initCause(cause); + } + throw e; + } + JsonToken t = p.getCurrentToken(); + if (t == JsonToken.START_ARRAY) { + return _deserializeFromArray(p, ctxt); + } + if (t == JsonToken.VALUE_EMBEDDED_OBJECT) { + Object ob = p.getEmbeddedObject(); + if (ob == null) { + return null; + } + if (_valueClass.isAssignableFrom(ob.getClass())) { + return (T) ob; + } + return _deserializeEmbedded(ob, ctxt); + } + return (T) ctxt.handleUnexpectedToken(_valueClass, p); + } +"," public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + String text = p.getValueAsString(); + if (text != null) { + if (text.length() == 0 || (text = text.trim()).length() == 0) { + return _deserializeFromEmptyString(); + } + Exception cause = null; + try { + return _deserialize(text, ctxt); + } catch (IllegalArgumentException iae) { + cause = iae; + } catch (MalformedURLException me) { + cause = me; + } + String msg = ""not a valid textual representation""; + if (cause != null) { + String m2 = cause.getMessage(); + if (m2 != null) { + msg = msg + "", problem: ""+m2; + } + } + JsonMappingException e = ctxt.weirdStringException(text, _valueClass, msg); + if (cause != null) { + e.initCause(cause); + } + throw e; + } + JsonToken t = p.getCurrentToken(); + if (t == JsonToken.START_ARRAY) { + return _deserializeFromArray(p, ctxt); + } + if (t == JsonToken.VALUE_EMBEDDED_OBJECT) { + Object ob = p.getEmbeddedObject(); + if (ob == null) { + return null; + } + if (_valueClass.isAssignableFrom(ob.getClass())) { + return (T) ob; + } + return _deserializeEmbedded(ob, ctxt); + } + return (T) ctxt.handleUnexpectedToken(_valueClass, p); + } +" +Closure-24," private void findAliases(NodeTraversal t) { + Scope scope = t.getScope(); + for (Var v : scope.getVarIterable()) { + Node n = v.getNode(); + int type = n.getType(); + Node parent = n.getParent(); + if (parent.isVar()) { + if (n.hasChildren() && n.getFirstChild().isQualifiedName()) { + String name = n.getString(); + Var aliasVar = scope.getVar(name); + aliases.put(name, aliasVar); + String qualifiedName = + aliasVar.getInitialValue().getQualifiedName(); + transformation.addAlias(name, qualifiedName); + } else { + report(t, n, GOOG_SCOPE_NON_ALIAS_LOCAL, n.getString()); + } + } + } + } +"," private void findAliases(NodeTraversal t) { + Scope scope = t.getScope(); + for (Var v : scope.getVarIterable()) { + Node n = v.getNode(); + int type = n.getType(); + Node parent = n.getParent(); + if (parent.isVar() && + n.hasChildren() && n.getFirstChild().isQualifiedName()) { + String name = n.getString(); + Var aliasVar = scope.getVar(name); + aliases.put(name, aliasVar); + String qualifiedName = + aliasVar.getInitialValue().getQualifiedName(); + transformation.addAlias(name, qualifiedName); + } else if (v.isBleedingFunction()) { + } else if (parent.getType() == Token.LP) { + } else { + report(t, n, GOOG_SCOPE_NON_ALIAS_LOCAL, n.getString()); + } + } + } +" +Math-57," private static > List> + chooseInitialCenters(final Collection points, final int k, final Random random) { + final List pointSet = new ArrayList(points); + final List> resultSet = new ArrayList>(); + final T firstPoint = pointSet.remove(random.nextInt(pointSet.size())); + resultSet.add(new Cluster(firstPoint)); + final double[] dx2 = new double[pointSet.size()]; + while (resultSet.size() < k) { + int sum = 0; + for (int i = 0; i < pointSet.size(); i++) { + final T p = pointSet.get(i); + final Cluster nearest = getNearestCluster(resultSet, p); + final double d = p.distanceFrom(nearest.getCenter()); + sum += d * d; + dx2[i] = sum; + } + final double r = random.nextDouble() * sum; + for (int i = 0 ; i < dx2.length; i++) { + if (dx2[i] >= r) { + final T p = pointSet.remove(i); + resultSet.add(new Cluster(p)); + break; + } + } + } + return resultSet; + } +"," private static > List> + chooseInitialCenters(final Collection points, final int k, final Random random) { + final List pointSet = new ArrayList(points); + final List> resultSet = new ArrayList>(); + final T firstPoint = pointSet.remove(random.nextInt(pointSet.size())); + resultSet.add(new Cluster(firstPoint)); + final double[] dx2 = new double[pointSet.size()]; + while (resultSet.size() < k) { + double sum = 0; + for (int i = 0; i < pointSet.size(); i++) { + final T p = pointSet.get(i); + final Cluster nearest = getNearestCluster(resultSet, p); + final double d = p.distanceFrom(nearest.getCenter()); + sum += d * d; + dx2[i] = sum; + } + final double r = random.nextDouble() * sum; + for (int i = 0 ; i < dx2.length; i++) { + if (dx2[i] >= r) { + final T p = pointSet.remove(i); + resultSet.add(new Cluster(p)); + break; + } + } + } + return resultSet; + } +" +Closure-57," private static String extractClassNameIfGoog(Node node, Node parent, + String functionName){ + String className = null; + if (NodeUtil.isExprCall(parent)) { + Node callee = node.getFirstChild(); + if (callee != null && callee.getType() == Token.GETPROP) { + String qualifiedName = callee.getQualifiedName(); + if (functionName.equals(qualifiedName)) { + Node target = callee.getNext(); + if (target != null) { + className = target.getString(); + } + } + } + } + return className; + } +"," private static String extractClassNameIfGoog(Node node, Node parent, + String functionName){ + String className = null; + if (NodeUtil.isExprCall(parent)) { + Node callee = node.getFirstChild(); + if (callee != null && callee.getType() == Token.GETPROP) { + String qualifiedName = callee.getQualifiedName(); + if (functionName.equals(qualifiedName)) { + Node target = callee.getNext(); + if (target != null && target.getType() == Token.STRING) { + className = target.getString(); + } + } + } + } + return className; + } +" +Jsoup-1," private void normalise(Element element) { + List toMove = new ArrayList(); + for (Node node: element.childNodes) { + if (node instanceof TextNode) { + TextNode tn = (TextNode) node; + if (!tn.isBlank()) + toMove.add(tn); + } + } + for (Node node: toMove) { + element.removeChild(node); + body().appendChild(new TextNode("" "", """")); + body().appendChild(node); + } + } +"," private void normalise(Element element) { + List toMove = new ArrayList(); + for (Node node: element.childNodes) { + if (node instanceof TextNode) { + TextNode tn = (TextNode) node; + if (!tn.isBlank()) + toMove.add(tn); + } + } + for (Node node: toMove) { + element.removeChild(node); + body().prependChild(node); + body().prependChild(new TextNode("" "", """")); + } + } +" +Math-32," protected void computeGeometricalProperties() { + final Vector2D[][] v = getVertices(); + if (v.length == 0) { + final BSPTree tree = getTree(false); + if ((Boolean) tree.getAttribute()) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + setSize(0); + setBarycenter(new Vector2D(0, 0)); + } + } else if (v[0][0] == null) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + double sum = 0; + double sumX = 0; + double sumY = 0; + for (Vector2D[] loop : v) { + double x1 = loop[loop.length - 1].getX(); + double y1 = loop[loop.length - 1].getY(); + for (final Vector2D point : loop) { + final double x0 = x1; + final double y0 = y1; + x1 = point.getX(); + y1 = point.getY(); + final double factor = x0 * y1 - y0 * x1; + sum += factor; + sumX += factor * (x0 + x1); + sumY += factor * (y0 + y1); + } + } + if (sum < 0) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + setSize(sum / 2); + setBarycenter(new Vector2D(sumX / (3 * sum), sumY / (3 * sum))); + } + } + } +"," protected void computeGeometricalProperties() { + final Vector2D[][] v = getVertices(); + if (v.length == 0) { + final BSPTree tree = getTree(false); + if (tree.getCut() == null && (Boolean) tree.getAttribute()) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + setSize(0); + setBarycenter(new Vector2D(0, 0)); + } + } else if (v[0][0] == null) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + double sum = 0; + double sumX = 0; + double sumY = 0; + for (Vector2D[] loop : v) { + double x1 = loop[loop.length - 1].getX(); + double y1 = loop[loop.length - 1].getY(); + for (final Vector2D point : loop) { + final double x0 = x1; + final double y0 = y1; + x1 = point.getX(); + y1 = point.getY(); + final double factor = x0 * y1 - y0 * x1; + sum += factor; + sumX += factor * (x0 + x1); + sumY += factor * (y0 + y1); + } + } + if (sum < 0) { + setSize(Double.POSITIVE_INFINITY); + setBarycenter(Vector2D.NaN); + } else { + setSize(sum / 2); + setBarycenter(new Vector2D(sumX / (3 * sum), sumY / (3 * sum))); + } + } + } +" +Math-72," public double solve(final UnivariateRealFunction f, + final double min, final double max, final double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + clearResult(); + verifySequence(min, initial, max); + double yInitial = f.value(initial); + if (Math.abs(yInitial) <= functionValueAccuracy) { + setResult(initial, 0); + return result; + } + double yMin = f.value(min); + if (Math.abs(yMin) <= functionValueAccuracy) { + setResult(yMin, 0); + return result; + } + if (yInitial * yMin < 0) { + return solve(f, min, yMin, initial, yInitial, min, yMin); + } + double yMax = f.value(max); + if (Math.abs(yMax) <= functionValueAccuracy) { + setResult(yMax, 0); + return result; + } + if (yInitial * yMax < 0) { + return solve(f, initial, yInitial, max, yMax, initial, yInitial); + } + if (yMin * yMax > 0) { + throw MathRuntimeException.createIllegalArgumentException( + NON_BRACKETING_MESSAGE, min, max, yMin, yMax); + } + return solve(f, min, yMin, max, yMax, initial, yInitial); + } +"," public double solve(final UnivariateRealFunction f, + final double min, final double max, final double initial) + throws MaxIterationsExceededException, FunctionEvaluationException { + clearResult(); + verifySequence(min, initial, max); + double yInitial = f.value(initial); + if (Math.abs(yInitial) <= functionValueAccuracy) { + setResult(initial, 0); + return result; + } + double yMin = f.value(min); + if (Math.abs(yMin) <= functionValueAccuracy) { + setResult(min, 0); + return result; + } + if (yInitial * yMin < 0) { + return solve(f, min, yMin, initial, yInitial, min, yMin); + } + double yMax = f.value(max); + if (Math.abs(yMax) <= functionValueAccuracy) { + setResult(max, 0); + return result; + } + if (yInitial * yMax < 0) { + return solve(f, initial, yInitial, max, yMax, initial, yInitial); + } + if (yMin * yMax > 0) { + throw MathRuntimeException.createIllegalArgumentException( + NON_BRACKETING_MESSAGE, min, max, yMin, yMax); + } + return solve(f, min, yMin, max, yMax, initial, yInitial); + } +" +JacksonCore-6," private final static int _parseIndex(String str) { + final int len = str.length(); + if (len == 0 || len > 10) { + return -1; + } + for (int i = 0; i < len; ++i) { + char c = str.charAt(i); + if (c > '9' || c < '0') { + return -1; + } + } + if (len == 10) { + long l = NumberInput.parseLong(str); + if (l > Integer.MAX_VALUE) { + return -1; + } + } + return NumberInput.parseInt(str); + } +"," private final static int _parseIndex(String str) { + final int len = str.length(); + if (len == 0 || len > 10) { + return -1; + } + char c = str.charAt(0); + if (c <= '0') { + return (len == 1 && c == '0') ? 0 : -1; + } + if (c > '9') { + return -1; + } + for (int i = 1; i < len; ++i) { + c = str.charAt(i); + if (c > '9' || c < '0') { + return -1; + } + } + if (len == 10) { + long l = NumberInput.parseLong(str); + if (l > Integer.MAX_VALUE) { + return -1; + } + } + return NumberInput.parseInt(str); + } +" +Closure-172," private boolean isQualifiedNameInferred( + String qName, Node n, JSDocInfo info, + Node rhsValue, JSType valueType) { + if (valueType == null) { + return true; + } + if (qName != null && qName.endsWith("".prototype"")) { + return false; + } + boolean inferred = true; + if (info != null) { + inferred = !(info.hasType() + || info.hasEnumParameterType() + || (isConstantSymbol(info, n) && valueType != null + && !valueType.isUnknownType()) + || FunctionTypeBuilder.isFunctionTypeDeclaration(info)); + } + if (inferred && rhsValue != null && rhsValue.isFunction()) { + if (info != null) { + return false; + } else if (!scope.isDeclared(qName, false) && + n.isUnscopedQualifiedName()) { + for (Node current = n.getParent(); + !(current.isScript() || current.isFunction()); + current = current.getParent()) { + if (NodeUtil.isControlStructure(current)) { + return true; + } + } + AstFunctionContents contents = + getFunctionAnalysisResults(scope.getRootNode()); + if (contents == null || + !contents.getEscapedQualifiedNames().contains(qName)) { + return false; + } + } + } + return inferred; + } +"," private boolean isQualifiedNameInferred( + String qName, Node n, JSDocInfo info, + Node rhsValue, JSType valueType) { + if (valueType == null) { + return true; + } + if (qName != null && qName.endsWith("".prototype"")) { + String className = qName.substring(0, qName.lastIndexOf("".prototype"")); + Var slot = scope.getSlot(className); + JSType classType = slot == null ? null : slot.getType(); + if (classType != null + && (classType.isConstructor() || classType.isInterface())) { + return false; + } + } + boolean inferred = true; + if (info != null) { + inferred = !(info.hasType() + || info.hasEnumParameterType() + || (isConstantSymbol(info, n) && valueType != null + && !valueType.isUnknownType()) + || FunctionTypeBuilder.isFunctionTypeDeclaration(info)); + } + if (inferred && rhsValue != null && rhsValue.isFunction()) { + if (info != null) { + return false; + } else if (!scope.isDeclared(qName, false) && + n.isUnscopedQualifiedName()) { + for (Node current = n.getParent(); + !(current.isScript() || current.isFunction()); + current = current.getParent()) { + if (NodeUtil.isControlStructure(current)) { + return true; + } + } + AstFunctionContents contents = + getFunctionAnalysisResults(scope.getRootNode()); + if (contents == null || + !contents.getEscapedQualifiedNames().contains(qName)) { + return false; + } + } + } + return inferred; + } +" +Closure-150," @Override public void visit(NodeTraversal t, Node n, Node parent) { + if (n == scope.getRootNode()) return; + if (n.getType() == Token.LP && parent == scope.getRootNode()) { + handleFunctionInputs(parent); + return; + } + attachLiteralTypes(n); + switch (n.getType()) { + case Token.FUNCTION: + if (parent.getType() == Token.NAME) { + return; + } + defineDeclaredFunction(n, parent); + break; + case Token.CATCH: + defineCatch(n, parent); + break; + case Token.VAR: + defineVar(n, parent); + break; + } + } +"," @Override public void visit(NodeTraversal t, Node n, Node parent) { + if (n == scope.getRootNode()) return; + if (n.getType() == Token.LP && parent == scope.getRootNode()) { + handleFunctionInputs(parent); + return; + } + super.visit(t, n, parent); + } +" +Jsoup-45," void resetInsertionMode() { + boolean last = false; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element node = stack.get(pos); + if (pos == 0) { + last = true; + node = contextElement; + } + String name = node.nodeName(); + if (""select"".equals(name)) { + transition(HtmlTreeBuilderState.InSelect); + break; + } else if ((""td"".equals(name) || ""td"".equals(name) && !last)) { + transition(HtmlTreeBuilderState.InCell); + break; + } else if (""tr"".equals(name)) { + transition(HtmlTreeBuilderState.InRow); + break; + } else if (""tbody"".equals(name) || ""thead"".equals(name) || ""tfoot"".equals(name)) { + transition(HtmlTreeBuilderState.InTableBody); + break; + } else if (""caption"".equals(name)) { + transition(HtmlTreeBuilderState.InCaption); + break; + } else if (""colgroup"".equals(name)) { + transition(HtmlTreeBuilderState.InColumnGroup); + break; + } else if (""table"".equals(name)) { + transition(HtmlTreeBuilderState.InTable); + break; + } else if (""head"".equals(name)) { + transition(HtmlTreeBuilderState.InBody); + break; + } else if (""body"".equals(name)) { + transition(HtmlTreeBuilderState.InBody); + break; + } else if (""frameset"".equals(name)) { + transition(HtmlTreeBuilderState.InFrameset); + break; + } else if (""html"".equals(name)) { + transition(HtmlTreeBuilderState.BeforeHead); + break; + } else if (last) { + transition(HtmlTreeBuilderState.InBody); + break; + } + } + } +"," void resetInsertionMode() { + boolean last = false; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element node = stack.get(pos); + if (pos == 0) { + last = true; + node = contextElement; + } + String name = node.nodeName(); + if (""select"".equals(name)) { + transition(HtmlTreeBuilderState.InSelect); + break; + } else if ((""td"".equals(name) || ""th"".equals(name) && !last)) { + transition(HtmlTreeBuilderState.InCell); + break; + } else if (""tr"".equals(name)) { + transition(HtmlTreeBuilderState.InRow); + break; + } else if (""tbody"".equals(name) || ""thead"".equals(name) || ""tfoot"".equals(name)) { + transition(HtmlTreeBuilderState.InTableBody); + break; + } else if (""caption"".equals(name)) { + transition(HtmlTreeBuilderState.InCaption); + break; + } else if (""colgroup"".equals(name)) { + transition(HtmlTreeBuilderState.InColumnGroup); + break; + } else if (""table"".equals(name)) { + transition(HtmlTreeBuilderState.InTable); + break; + } else if (""head"".equals(name)) { + transition(HtmlTreeBuilderState.InBody); + break; + } else if (""body"".equals(name)) { + transition(HtmlTreeBuilderState.InBody); + break; + } else if (""frameset"".equals(name)) { + transition(HtmlTreeBuilderState.InFrameset); + break; + } else if (""html"".equals(name)) { + transition(HtmlTreeBuilderState.BeforeHead); + break; + } else if (last) { + transition(HtmlTreeBuilderState.InBody); + break; + } + } + } +" +Compress-40," public long readBits(final int count) throws IOException { + if (count < 0 || count > MAXIMUM_CACHE_SIZE) { + throw new IllegalArgumentException(""count must not be negative or greater than "" + MAXIMUM_CACHE_SIZE); + } + while (bitsCachedSize < count) { + final long nextByte = in.read(); + if (nextByte < 0) { + return nextByte; + } + if (byteOrder == ByteOrder.LITTLE_ENDIAN) { + bitsCached |= (nextByte << bitsCachedSize); + } else { + bitsCached <<= 8; + bitsCached |= nextByte; + } + bitsCachedSize += 8; + } + final long bitsOut; + if (byteOrder == ByteOrder.LITTLE_ENDIAN) { + bitsOut = (bitsCached & MASKS[count]); + bitsCached >>>= count; + } else { + bitsOut = (bitsCached >> (bitsCachedSize - count)) & MASKS[count]; + } + bitsCachedSize -= count; + return bitsOut; + } +"," public long readBits(final int count) throws IOException { + if (count < 0 || count > MAXIMUM_CACHE_SIZE) { + throw new IllegalArgumentException(""count must not be negative or greater than "" + MAXIMUM_CACHE_SIZE); + } + while (bitsCachedSize < count && bitsCachedSize < 57) { + final long nextByte = in.read(); + if (nextByte < 0) { + return nextByte; + } + if (byteOrder == ByteOrder.LITTLE_ENDIAN) { + bitsCached |= (nextByte << bitsCachedSize); + } else { + bitsCached <<= 8; + bitsCached |= nextByte; + } + bitsCachedSize += 8; + } + int overflowBits = 0; + long overflow = 0l; + if (bitsCachedSize < count) { + int bitsToAddCount = count - bitsCachedSize; + overflowBits = 8 - bitsToAddCount; + final long nextByte = in.read(); + if (nextByte < 0) { + return nextByte; + } + if (byteOrder == ByteOrder.LITTLE_ENDIAN) { + long bitsToAdd = nextByte & MASKS[bitsToAddCount]; + bitsCached |= (bitsToAdd << bitsCachedSize); + overflow = (nextByte >>> bitsToAddCount) & MASKS[overflowBits]; + } else { + bitsCached <<= bitsToAddCount; + long bitsToAdd = (nextByte >>> (overflowBits)) & MASKS[bitsToAddCount]; + bitsCached |= bitsToAdd; + overflow = nextByte & MASKS[overflowBits]; + } + bitsCachedSize = count; + } + final long bitsOut; + if (overflowBits == 0) { + if (byteOrder == ByteOrder.LITTLE_ENDIAN) { + bitsOut = (bitsCached & MASKS[count]); + bitsCached >>>= count; + } else { + bitsOut = (bitsCached >> (bitsCachedSize - count)) & MASKS[count]; + } + bitsCachedSize -= count; + } else { + bitsOut = bitsCached & MASKS[count]; + bitsCached = overflow; + bitsCachedSize = overflowBits; + } + return bitsOut; + } +" +JacksonDatabind-39," public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + p.skipChildren(); + return null; + } +"," public Object deserialize(JsonParser p, DeserializationContext ctxt) throws IOException + { + if (p.hasToken(JsonToken.FIELD_NAME)) { + while (true) { + JsonToken t = p.nextToken(); + if ((t == null) || (t == JsonToken.END_OBJECT)) { + break; + } + p.skipChildren(); + } + } else { + p.skipChildren(); + } + return null; + } +" +Closure-117," String getReadableJSTypeName(Node n, boolean dereference) { + if (n.isGetProp()) { + ObjectType objectType = getJSType(n.getFirstChild()).dereference(); + if (objectType != null) { + String propName = n.getLastChild().getString(); + if (objectType.getConstructor() != null && + objectType.getConstructor().isInterface()) { + objectType = FunctionType.getTopDefiningInterface( + objectType, propName); + } else { + while (objectType != null && !objectType.hasOwnProperty(propName)) { + objectType = objectType.getImplicitPrototype(); + } + } + if (objectType != null && + (objectType.getConstructor() != null || + objectType.isFunctionPrototypeType())) { + return objectType.toString() + ""."" + propName; + } + } + } + JSType type = getJSType(n); + if (dereference) { + ObjectType dereferenced = type.dereference(); + if (dereferenced != null) { + type = dereferenced; + } + } + if (type.isFunctionPrototypeType() || + (type.toObjectType() != null && + type.toObjectType().getConstructor() != null)) { + return type.toString(); + } + String qualifiedName = n.getQualifiedName(); + if (qualifiedName != null) { + return qualifiedName; + } else if (type.isFunctionType()) { + return ""function""; + } else { + return type.toString(); + } + } +"," String getReadableJSTypeName(Node n, boolean dereference) { + JSType type = getJSType(n); + if (dereference) { + ObjectType dereferenced = type.dereference(); + if (dereferenced != null) { + type = dereferenced; + } + } + if (type.isFunctionPrototypeType() || + (type.toObjectType() != null && + type.toObjectType().getConstructor() != null)) { + return type.toString(); + } + if (n.isGetProp()) { + ObjectType objectType = getJSType(n.getFirstChild()).dereference(); + if (objectType != null) { + String propName = n.getLastChild().getString(); + if (objectType.getConstructor() != null && + objectType.getConstructor().isInterface()) { + objectType = FunctionType.getTopDefiningInterface( + objectType, propName); + } else { + while (objectType != null && !objectType.hasOwnProperty(propName)) { + objectType = objectType.getImplicitPrototype(); + } + } + if (objectType != null && + (objectType.getConstructor() != null || + objectType.isFunctionPrototypeType())) { + return objectType.toString() + ""."" + propName; + } + } + } + String qualifiedName = n.getQualifiedName(); + if (qualifiedName != null) { + return qualifiedName; + } else if (type.isFunctionType()) { + return ""function""; + } else { + return type.toString(); + } + } +" +Closure-130," private void inlineAliases(GlobalNamespace namespace) { + Deque workList = new ArrayDeque(namespace.getNameForest()); + while (!workList.isEmpty()) { + Name name = workList.pop(); + if (name.type == Name.Type.GET || name.type == Name.Type.SET) { + continue; + } + if (name.globalSets == 1 && name.localSets == 0 && + name.aliasingGets > 0) { + List refs = Lists.newArrayList(name.getRefs()); + for (Ref ref : refs) { + if (ref.type == Type.ALIASING_GET && ref.scope.isLocal()) { + if (inlineAliasIfPossible(ref, namespace)) { + name.removeRef(ref); + } + } + } + } + if ((name.type == Name.Type.OBJECTLIT || + name.type == Name.Type.FUNCTION) && + name.aliasingGets == 0 && name.props != null) { + workList.addAll(name.props); + } + } + } +"," private void inlineAliases(GlobalNamespace namespace) { + Deque workList = new ArrayDeque(namespace.getNameForest()); + while (!workList.isEmpty()) { + Name name = workList.pop(); + if (name.type == Name.Type.GET || name.type == Name.Type.SET) { + continue; + } + if (!name.inExterns && name.globalSets == 1 && name.localSets == 0 && + name.aliasingGets > 0) { + List refs = Lists.newArrayList(name.getRefs()); + for (Ref ref : refs) { + if (ref.type == Type.ALIASING_GET && ref.scope.isLocal()) { + if (inlineAliasIfPossible(ref, namespace)) { + name.removeRef(ref); + } + } + } + } + if ((name.type == Name.Type.OBJECTLIT || + name.type == Name.Type.FUNCTION) && + name.aliasingGets == 0 && name.props != null) { + workList.addAll(name.props); + } + } + } +" +Gson-5," public static Date parse(String date, ParsePosition pos) throws ParseException { + Exception fail = null; + try { + int offset = pos.getIndex(); + int year = parseInt(date, offset, offset += 4); + if (checkOffset(date, offset, '-')) { + offset += 1; + } + int month = parseInt(date, offset, offset += 2); + if (checkOffset(date, offset, '-')) { + offset += 1; + } + int day = parseInt(date, offset, offset += 2); + int hour = 0; + int minutes = 0; + int seconds = 0; + int milliseconds = 0; + boolean hasT = checkOffset(date, offset, 'T'); + if (!hasT && (date.length() <= offset)) { + Calendar calendar = new GregorianCalendar(year, month - 1, day); + pos.setIndex(offset); + return calendar.getTime(); + } + if (hasT) { + hour = parseInt(date, offset += 1, offset += 2); + if (checkOffset(date, offset, ':')) { + offset += 1; + } + minutes = parseInt(date, offset, offset += 2); + if (checkOffset(date, offset, ':')) { + offset += 1; + } + if (date.length() > offset) { + char c = date.charAt(offset); + if (c != 'Z' && c != '+' && c != '-') { + seconds = parseInt(date, offset, offset += 2); + if (seconds > 59 && seconds < 63) seconds = 59; + if (checkOffset(date, offset, '.')) { + offset += 1; + int endOffset = indexOfNonDigit(date, offset + 1); + int parseEndOffset = Math.min(endOffset, offset + 3); + int fraction = parseInt(date, offset, parseEndOffset); + switch (parseEndOffset - offset) { + case 2: + milliseconds = fraction * 10; + break; + case 1: + milliseconds = fraction * 100; + break; + default: + milliseconds = fraction; + } + offset = endOffset; + } + } + } + } + if (date.length() <= offset) { + throw new IllegalArgumentException(""No time zone indicator""); + } + TimeZone timezone = null; + char timezoneIndicator = date.charAt(offset); + if (timezoneIndicator == 'Z') { + timezone = TIMEZONE_UTC; + offset += 1; + } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { + String timezoneOffset = date.substring(offset); + offset += timezoneOffset.length(); + if (""+0000"".equals(timezoneOffset) || ""+00:00"".equals(timezoneOffset)) { + timezone = TIMEZONE_UTC; + } else { + String timezoneId = ""GMT"" + timezoneOffset; + timezone = TimeZone.getTimeZone(timezoneId); + String act = timezone.getID(); + if (!act.equals(timezoneId)) { + String cleaned = act.replace("":"", """"); + if (!cleaned.equals(timezoneId)) { + throw new IndexOutOfBoundsException(""Mismatching time zone indicator: ""+timezoneId+"" given, resolves to "" + +timezone.getID()); + } + } + } + } else { + throw new IndexOutOfBoundsException(""Invalid time zone indicator '"" + timezoneIndicator+""'""); + } + Calendar calendar = new GregorianCalendar(timezone); + calendar.setLenient(false); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DAY_OF_MONTH, day); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minutes); + calendar.set(Calendar.SECOND, seconds); + calendar.set(Calendar.MILLISECOND, milliseconds); + pos.setIndex(offset); + return calendar.getTime(); + } catch (IndexOutOfBoundsException e) { + fail = e; + } catch (NumberFormatException e) { + fail = e; + } catch (IllegalArgumentException e) { + fail = e; + } + String input = (date == null) ? null : ('""' + date + ""'""); + String msg = fail.getMessage(); + if (msg == null || msg.isEmpty()) { + msg = ""(""+fail.getClass().getName()+"")""; + } + ParseException ex = new ParseException(""Failed to parse date ["" + input + ""]: "" + msg, pos.getIndex()); + ex.initCause(fail); + throw ex; + } +"," public static Date parse(String date, ParsePosition pos) throws ParseException { + Exception fail = null; + try { + int offset = pos.getIndex(); + int year = parseInt(date, offset, offset += 4); + if (checkOffset(date, offset, '-')) { + offset += 1; + } + int month = parseInt(date, offset, offset += 2); + if (checkOffset(date, offset, '-')) { + offset += 1; + } + int day = parseInt(date, offset, offset += 2); + int hour = 0; + int minutes = 0; + int seconds = 0; + int milliseconds = 0; + boolean hasT = checkOffset(date, offset, 'T'); + if (!hasT && (date.length() <= offset)) { + Calendar calendar = new GregorianCalendar(year, month - 1, day); + pos.setIndex(offset); + return calendar.getTime(); + } + if (hasT) { + hour = parseInt(date, offset += 1, offset += 2); + if (checkOffset(date, offset, ':')) { + offset += 1; + } + minutes = parseInt(date, offset, offset += 2); + if (checkOffset(date, offset, ':')) { + offset += 1; + } + if (date.length() > offset) { + char c = date.charAt(offset); + if (c != 'Z' && c != '+' && c != '-') { + seconds = parseInt(date, offset, offset += 2); + if (seconds > 59 && seconds < 63) seconds = 59; + if (checkOffset(date, offset, '.')) { + offset += 1; + int endOffset = indexOfNonDigit(date, offset + 1); + int parseEndOffset = Math.min(endOffset, offset + 3); + int fraction = parseInt(date, offset, parseEndOffset); + switch (parseEndOffset - offset) { + case 2: + milliseconds = fraction * 10; + break; + case 1: + milliseconds = fraction * 100; + break; + default: + milliseconds = fraction; + } + offset = endOffset; + } + } + } + } + if (date.length() <= offset) { + throw new IllegalArgumentException(""No time zone indicator""); + } + TimeZone timezone = null; + char timezoneIndicator = date.charAt(offset); + if (timezoneIndicator == 'Z') { + timezone = TIMEZONE_UTC; + offset += 1; + } else if (timezoneIndicator == '+' || timezoneIndicator == '-') { + String timezoneOffset = date.substring(offset); + timezoneOffset = timezoneOffset.length() >= 5 ? timezoneOffset : timezoneOffset + ""00""; + offset += timezoneOffset.length(); + if (""+0000"".equals(timezoneOffset) || ""+00:00"".equals(timezoneOffset)) { + timezone = TIMEZONE_UTC; + } else { + String timezoneId = ""GMT"" + timezoneOffset; + timezone = TimeZone.getTimeZone(timezoneId); + String act = timezone.getID(); + if (!act.equals(timezoneId)) { + String cleaned = act.replace("":"", """"); + if (!cleaned.equals(timezoneId)) { + throw new IndexOutOfBoundsException(""Mismatching time zone indicator: ""+timezoneId+"" given, resolves to "" + +timezone.getID()); + } + } + } + } else { + throw new IndexOutOfBoundsException(""Invalid time zone indicator '"" + timezoneIndicator+""'""); + } + Calendar calendar = new GregorianCalendar(timezone); + calendar.setLenient(false); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, month - 1); + calendar.set(Calendar.DAY_OF_MONTH, day); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minutes); + calendar.set(Calendar.SECOND, seconds); + calendar.set(Calendar.MILLISECOND, milliseconds); + pos.setIndex(offset); + return calendar.getTime(); + } catch (IndexOutOfBoundsException e) { + fail = e; + } catch (NumberFormatException e) { + fail = e; + } catch (IllegalArgumentException e) { + fail = e; + } + String input = (date == null) ? null : ('""' + date + ""'""); + String msg = fail.getMessage(); + if (msg == null || msg.isEmpty()) { + msg = ""(""+fail.getClass().getName()+"")""; + } + ParseException ex = new ParseException(""Failed to parse date ["" + input + ""]: "" + msg, pos.getIndex()); + ex.initCause(fail); + throw ex; + } +" +Closure-131," public static boolean isJSIdentifier(String s) { + int length = s.length(); + if (length == 0 || + !Character.isJavaIdentifierStart(s.charAt(0))) { + return false; + } + for (int i = 1; i < length; i++) { + if ( + !Character.isJavaIdentifierPart(s.charAt(i))) { + return false; + } + } + return true; + } +"," public static boolean isJSIdentifier(String s) { + int length = s.length(); + if (length == 0 || + Character.isIdentifierIgnorable(s.charAt(0)) || + !Character.isJavaIdentifierStart(s.charAt(0))) { + return false; + } + for (int i = 1; i < length; i++) { + if (Character.isIdentifierIgnorable(s.charAt(i)) || + !Character.isJavaIdentifierPart(s.charAt(i))) { + return false; + } + } + return true; + } +" +Closure-95," void defineSlot(Node n, Node parent, JSType type, boolean inferred) { + Preconditions.checkArgument(inferred || type != null); + boolean shouldDeclareOnGlobalThis = false; + if (n.getType() == Token.NAME) { + Preconditions.checkArgument( + parent.getType() == Token.FUNCTION || + parent.getType() == Token.VAR || + parent.getType() == Token.LP || + parent.getType() == Token.CATCH); + shouldDeclareOnGlobalThis = scope.isGlobal() && + (parent.getType() == Token.VAR || + parent.getType() == Token.FUNCTION); + } else { + Preconditions.checkArgument( + n.getType() == Token.GETPROP && + (parent.getType() == Token.ASSIGN || + parent.getType() == Token.EXPR_RESULT)); + } + String variableName = n.getQualifiedName(); + Preconditions.checkArgument(!variableName.isEmpty()); + Scope scopeToDeclareIn = scope; + if (scopeToDeclareIn.isDeclared(variableName, false)) { + Var oldVar = scopeToDeclareIn.getVar(variableName); + validator.expectUndeclaredVariable( + sourceName, n, parent, oldVar, variableName, type); + } else { + if (!inferred) { + setDeferredType(n, type); + } + CompilerInput input = compiler.getInput(sourceName); + scopeToDeclareIn.declare(variableName, n, type, input, inferred); + if (shouldDeclareOnGlobalThis) { + ObjectType globalThis = + typeRegistry.getNativeObjectType(JSTypeNative.GLOBAL_THIS); + boolean isExtern = input.isExtern(); + if (inferred) { + globalThis.defineInferredProperty(variableName, + type == null ? + getNativeType(JSTypeNative.NO_TYPE) : + type, + isExtern); + } else { + globalThis.defineDeclaredProperty(variableName, type, isExtern); + } + } + if (scopeToDeclareIn.isGlobal() && type instanceof FunctionType) { + FunctionType fnType = (FunctionType) type; + if (fnType.isConstructor() || fnType.isInterface()) { + FunctionType superClassCtor = fnType.getSuperClassConstructor(); + scopeToDeclareIn.declare(variableName + "".prototype"", n, + fnType.getPrototype(), compiler.getInput(sourceName), + superClassCtor == null || + superClassCtor.getInstanceType().equals( + getNativeType(OBJECT_TYPE))); + } + } + } + } +"," void defineSlot(Node n, Node parent, JSType type, boolean inferred) { + Preconditions.checkArgument(inferred || type != null); + boolean shouldDeclareOnGlobalThis = false; + if (n.getType() == Token.NAME) { + Preconditions.checkArgument( + parent.getType() == Token.FUNCTION || + parent.getType() == Token.VAR || + parent.getType() == Token.LP || + parent.getType() == Token.CATCH); + shouldDeclareOnGlobalThis = scope.isGlobal() && + (parent.getType() == Token.VAR || + parent.getType() == Token.FUNCTION); + } else { + Preconditions.checkArgument( + n.getType() == Token.GETPROP && + (parent.getType() == Token.ASSIGN || + parent.getType() == Token.EXPR_RESULT)); + } + String variableName = n.getQualifiedName(); + Preconditions.checkArgument(!variableName.isEmpty()); + Scope scopeToDeclareIn = scope; + if (n.getType() == Token.GETPROP && !scope.isGlobal() && + isQnameRootedInGlobalScope(n)) { + Scope globalScope = scope.getGlobalScope(); + if (!globalScope.isDeclared(variableName, false)) { + scopeToDeclareIn = scope.getGlobalScope(); + } + } + if (scopeToDeclareIn.isDeclared(variableName, false)) { + Var oldVar = scopeToDeclareIn.getVar(variableName); + validator.expectUndeclaredVariable( + sourceName, n, parent, oldVar, variableName, type); + } else { + if (!inferred) { + setDeferredType(n, type); + } + CompilerInput input = compiler.getInput(sourceName); + scopeToDeclareIn.declare(variableName, n, type, input, inferred); + if (shouldDeclareOnGlobalThis) { + ObjectType globalThis = + typeRegistry.getNativeObjectType(JSTypeNative.GLOBAL_THIS); + boolean isExtern = input.isExtern(); + if (inferred) { + globalThis.defineInferredProperty(variableName, + type == null ? + getNativeType(JSTypeNative.NO_TYPE) : + type, + isExtern); + } else { + globalThis.defineDeclaredProperty(variableName, type, isExtern); + } + } + if (scopeToDeclareIn.isGlobal() && type instanceof FunctionType) { + FunctionType fnType = (FunctionType) type; + if (fnType.isConstructor() || fnType.isInterface()) { + FunctionType superClassCtor = fnType.getSuperClassConstructor(); + scopeToDeclareIn.declare(variableName + "".prototype"", n, + fnType.getPrototype(), compiler.getInput(sourceName), + superClassCtor == null || + superClassCtor.getInstanceType().equals( + getNativeType(OBJECT_TYPE))); + } + } + } + } +" +Closure-78," private Node performArithmeticOp(int opType, Node left, Node right) { + if (opType == Token.ADD + && (NodeUtil.mayBeString(left, false) + || NodeUtil.mayBeString(right, false))) { + return null; + } + double result; + Double lValObj = NodeUtil.getNumberValue(left); + if (lValObj == null) { + return null; + } + Double rValObj = NodeUtil.getNumberValue(right); + if (rValObj == null) { + return null; + } + double lval = lValObj; + double rval = rValObj; + switch (opType) { + case Token.BITAND: + result = ScriptRuntime.toInt32(lval) & ScriptRuntime.toInt32(rval); + break; + case Token.BITOR: + result = ScriptRuntime.toInt32(lval) | ScriptRuntime.toInt32(rval); + break; + case Token.BITXOR: + result = ScriptRuntime.toInt32(lval) ^ ScriptRuntime.toInt32(rval); + break; + case Token.ADD: + result = lval + rval; + break; + case Token.SUB: + result = lval - rval; + break; + case Token.MUL: + result = lval * rval; + break; + case Token.MOD: + if (rval == 0) { + error(DiagnosticType.error(""JSC_DIVIDE_BY_0_ERROR"", ""Divide by 0""), right); + return null; + } + result = lval % rval; + break; + case Token.DIV: + if (rval == 0) { + error(DiagnosticType.error(""JSC_DIVIDE_BY_0_ERROR"", ""Divide by 0""), right); + return null; + } + result = lval / rval; + break; + default: + throw new Error(""Unexpected arithmetic operator""); + } + if (String.valueOf(result).length() <= + String.valueOf(lval).length() + String.valueOf(rval).length() + 1 && + Math.abs(result) <= MAX_FOLD_NUMBER) { + Node newNumber = Node.newNumber(result); + return newNumber; + } else if (Double.isNaN(result)) { + return Node.newString(Token.NAME, ""NaN""); + } else if (result == Double.POSITIVE_INFINITY) { + return Node.newString(Token.NAME, ""Infinity""); + } else if (result == Double.NEGATIVE_INFINITY) { + return new Node(Token.NEG, Node.newString(Token.NAME, ""Infinity"")); + } + return null; + } +"," private Node performArithmeticOp(int opType, Node left, Node right) { + if (opType == Token.ADD + && (NodeUtil.mayBeString(left, false) + || NodeUtil.mayBeString(right, false))) { + return null; + } + double result; + Double lValObj = NodeUtil.getNumberValue(left); + if (lValObj == null) { + return null; + } + Double rValObj = NodeUtil.getNumberValue(right); + if (rValObj == null) { + return null; + } + double lval = lValObj; + double rval = rValObj; + switch (opType) { + case Token.BITAND: + result = ScriptRuntime.toInt32(lval) & ScriptRuntime.toInt32(rval); + break; + case Token.BITOR: + result = ScriptRuntime.toInt32(lval) | ScriptRuntime.toInt32(rval); + break; + case Token.BITXOR: + result = ScriptRuntime.toInt32(lval) ^ ScriptRuntime.toInt32(rval); + break; + case Token.ADD: + result = lval + rval; + break; + case Token.SUB: + result = lval - rval; + break; + case Token.MUL: + result = lval * rval; + break; + case Token.MOD: + if (rval == 0) { + return null; + } + result = lval % rval; + break; + case Token.DIV: + if (rval == 0) { + return null; + } + result = lval / rval; + break; + default: + throw new Error(""Unexpected arithmetic operator""); + } + if (String.valueOf(result).length() <= + String.valueOf(lval).length() + String.valueOf(rval).length() + 1 && + Math.abs(result) <= MAX_FOLD_NUMBER) { + Node newNumber = Node.newNumber(result); + return newNumber; + } else if (Double.isNaN(result)) { + return Node.newString(Token.NAME, ""NaN""); + } else if (result == Double.POSITIVE_INFINITY) { + return Node.newString(Token.NAME, ""Infinity""); + } else if (result == Double.NEGATIVE_INFINITY) { + return new Node(Token.NEG, Node.newString(Token.NAME, ""Infinity"")); + } + return null; + } +" +JacksonDatabind-27," protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt) + throws IOException + { + final ExternalTypeHandler ext = _externalTypeIdHandler.start(); + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + if (ext.handlePropertyValue(p, ctxt, propName, buffer)) { + ; + } else { + if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { + t = p.nextToken(); + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); + continue; + } + while (t == JsonToken.FIELD_NAME) { + p.nextToken(); + tokens.copyCurrentStructure(p); + t = p.nextToken(); + } + if (bean.getClass() != _beanType.getRawClass()) { + throw ctxt.mappingException(""Can not create polymorphic instances with unwrapped values""); + } + return ext.complete(p, ctxt, bean); + } + } + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); + continue; + } + if (ext.handlePropertyValue(p, ctxt, propName, null)) { + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + if (_anySetter != null) { + buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); + } + } + try { + return ext.complete(p, ctxt, buffer, creator); + } catch (Exception e) { + wrapInstantiationProblem(e, ctxt); + return null; + } + } +"," protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt) + throws IOException + { + final ExternalTypeHandler ext = _externalTypeIdHandler.start(); + final PropertyBasedCreator creator = _propertyBasedCreator; + PropertyValueBuffer buffer = creator.startBuilding(p, ctxt, _objectIdReader); + TokenBuffer tokens = new TokenBuffer(p); + tokens.writeStartObject(); + JsonToken t = p.getCurrentToken(); + for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) { + String propName = p.getCurrentName(); + p.nextToken(); + SettableBeanProperty creatorProp = creator.findCreatorProperty(propName); + if (creatorProp != null) { + if (ext.handlePropertyValue(p, ctxt, propName, null)) { + ; + } else { + if (buffer.assignParameter(creatorProp, _deserializeWithErrorWrapping(p, ctxt, creatorProp))) { + t = p.nextToken(); + Object bean; + try { + bean = creator.build(ctxt, buffer); + } catch (Exception e) { + wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt); + continue; + } + while (t == JsonToken.FIELD_NAME) { + p.nextToken(); + tokens.copyCurrentStructure(p); + t = p.nextToken(); + } + if (bean.getClass() != _beanType.getRawClass()) { + throw ctxt.mappingException(""Can not create polymorphic instances with unwrapped values""); + } + return ext.complete(p, ctxt, bean); + } + } + continue; + } + if (buffer.readIdProperty(propName)) { + continue; + } + SettableBeanProperty prop = _beanProperties.find(propName); + if (prop != null) { + buffer.bufferProperty(prop, prop.deserialize(p, ctxt)); + continue; + } + if (ext.handlePropertyValue(p, ctxt, propName, null)) { + continue; + } + if (_ignorableProps != null && _ignorableProps.contains(propName)) { + handleIgnoredProperty(p, ctxt, handledType(), propName); + continue; + } + if (_anySetter != null) { + buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt)); + } + } + try { + return ext.complete(p, ctxt, buffer, creator); + } catch (Exception e) { + wrapInstantiationProblem(e, ctxt); + return null; + } + } +" +Math-31," public double evaluate(double x, double epsilon, int maxIterations) { + final double small = 1e-50; + double hPrev = getA(0, x); + if (Precision.equals(hPrev, 0.0, small)) { + hPrev = small; + } + int n = 1; + double dPrev = 0.0; + double p0 = 1.0; + double q1 = 1.0; + double cPrev = hPrev; + double hN = hPrev; + while (n < maxIterations) { + final double a = getA(n, x); + final double b = getB(n, x); + double cN = a * hPrev + b * p0; + double q2 = a * q1 + b * dPrev; + if (Double.isInfinite(cN) || Double.isInfinite(q2)) { + double scaleFactor = 1d; + double lastScaleFactor = 1d; + final int maxPower = 5; + final double scale = FastMath.max(a,b); + if (scale <= 0) { + throw new ConvergenceException(LocalizedFormats.CONTINUED_FRACTION_INFINITY_DIVERGENCE, x); + } + for (int i = 0; i < maxPower; i++) { + lastScaleFactor = scaleFactor; + scaleFactor *= scale; + if (a != 0.0 && a > b) { + cN = hPrev / lastScaleFactor + (b / scaleFactor * p0); + q2 = q1 / lastScaleFactor + (b / scaleFactor * dPrev); + } else if (b != 0) { + cN = (a / scaleFactor * hPrev) + p0 / lastScaleFactor; + q2 = (a / scaleFactor * q1) + dPrev / lastScaleFactor; + } + if (!(Double.isInfinite(cN) || Double.isInfinite(q2))) { + break; + } + } + } + final double deltaN = cN / q2 / cPrev; + hN = cPrev * deltaN; + if (Double.isInfinite(hN)) { + throw new ConvergenceException(LocalizedFormats.CONTINUED_FRACTION_INFINITY_DIVERGENCE, + x); + } + if (Double.isNaN(hN)) { + throw new ConvergenceException(LocalizedFormats.CONTINUED_FRACTION_NAN_DIVERGENCE, + x); + } + if (FastMath.abs(deltaN - 1.0) < epsilon) { + break; + } + dPrev = q1; + cPrev = cN / q2; + p0 = hPrev; + hPrev = cN; + q1 = q2; + n++; + } + if (n >= maxIterations) { + throw new MaxCountExceededException(LocalizedFormats.NON_CONVERGENT_CONTINUED_FRACTION, + maxIterations, x); + } + return hN; + } +"," public double evaluate(double x, double epsilon, int maxIterations) { + final double small = 1e-50; + double hPrev = getA(0, x); + if (Precision.equals(hPrev, 0.0, small)) { + hPrev = small; + } + int n = 1; + double dPrev = 0.0; + double cPrev = hPrev; + double hN = hPrev; + while (n < maxIterations) { + final double a = getA(n, x); + final double b = getB(n, x); + double dN = a + b * dPrev; + if (Precision.equals(dN, 0.0, small)) { + dN = small; + } + double cN = a + b / cPrev; + if (Precision.equals(cN, 0.0, small)) { + cN = small; + } + dN = 1 / dN; + final double deltaN = cN * dN; + hN = hPrev * deltaN; + if (Double.isInfinite(hN)) { + throw new ConvergenceException(LocalizedFormats.CONTINUED_FRACTION_INFINITY_DIVERGENCE, + x); + } + if (Double.isNaN(hN)) { + throw new ConvergenceException(LocalizedFormats.CONTINUED_FRACTION_NAN_DIVERGENCE, + x); + } + if (FastMath.abs(deltaN - 1.0) < epsilon) { + break; + } + dPrev = dN; + cPrev = cN; + hPrev = hN; + n++; + } + if (n >= maxIterations) { + throw new MaxCountExceededException(LocalizedFormats.NON_CONVERGENT_CONTINUED_FRACTION, + maxIterations, x); + } + return hN; + } +" +Chart-13," protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + double[] w = new double[5]; + double[] h = new double[5]; + w[0] = constraint.getWidth(); + if (this.topBlock != null) { + RectangleConstraint c1 = new RectangleConstraint(w[0], null, + LengthConstraintType.FIXED, 0.0, + new Range(0.0, constraint.getHeight()), + LengthConstraintType.RANGE); + Size2D size = this.topBlock.arrange(g2, c1); + h[0] = size.height; + } + w[1] = w[0]; + if (this.bottomBlock != null) { + RectangleConstraint c2 = new RectangleConstraint(w[0], null, + LengthConstraintType.FIXED, 0.0, new Range(0.0, + constraint.getHeight() - h[0]), LengthConstraintType.RANGE); + Size2D size = this.bottomBlock.arrange(g2, c2); + h[1] = size.height; + } + h[2] = constraint.getHeight() - h[1] - h[0]; + if (this.leftBlock != null) { + RectangleConstraint c3 = new RectangleConstraint(0.0, + new Range(0.0, constraint.getWidth()), + LengthConstraintType.RANGE, h[2], null, + LengthConstraintType.FIXED); + Size2D size = this.leftBlock.arrange(g2, c3); + w[2] = size.width; + } + h[3] = h[2]; + if (this.rightBlock != null) { + RectangleConstraint c4 = new RectangleConstraint(0.0, + new Range(0.0, constraint.getWidth() - w[2]), + LengthConstraintType.RANGE, h[2], null, + LengthConstraintType.FIXED); + Size2D size = this.rightBlock.arrange(g2, c4); + w[3] = size.width; + } + h[4] = h[2]; + w[4] = constraint.getWidth() - w[3] - w[2]; + RectangleConstraint c5 = new RectangleConstraint(w[4], h[4]); + if (this.centerBlock != null) { + this.centerBlock.arrange(g2, c5); + } + if (this.topBlock != null) { + this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, w[0], + h[0])); + } + if (this.bottomBlock != null) { + this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, h[0] + h[2], + w[1], h[1])); + } + if (this.leftBlock != null) { + this.leftBlock.setBounds(new Rectangle2D.Double(0.0, h[0], w[2], + h[2])); + } + if (this.rightBlock != null) { + this.rightBlock.setBounds(new Rectangle2D.Double(w[2] + w[4], h[0], + w[3], h[3])); + } + if (this.centerBlock != null) { + this.centerBlock.setBounds(new Rectangle2D.Double(w[2], h[0], w[4], + h[4])); + } + return new Size2D(constraint.getWidth(), constraint.getHeight()); + } +"," protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + double[] w = new double[5]; + double[] h = new double[5]; + w[0] = constraint.getWidth(); + if (this.topBlock != null) { + RectangleConstraint c1 = new RectangleConstraint(w[0], null, + LengthConstraintType.FIXED, 0.0, + new Range(0.0, constraint.getHeight()), + LengthConstraintType.RANGE); + Size2D size = this.topBlock.arrange(g2, c1); + h[0] = size.height; + } + w[1] = w[0]; + if (this.bottomBlock != null) { + RectangleConstraint c2 = new RectangleConstraint(w[0], null, + LengthConstraintType.FIXED, 0.0, new Range(0.0, + constraint.getHeight() - h[0]), LengthConstraintType.RANGE); + Size2D size = this.bottomBlock.arrange(g2, c2); + h[1] = size.height; + } + h[2] = constraint.getHeight() - h[1] - h[0]; + if (this.leftBlock != null) { + RectangleConstraint c3 = new RectangleConstraint(0.0, + new Range(0.0, constraint.getWidth()), + LengthConstraintType.RANGE, h[2], null, + LengthConstraintType.FIXED); + Size2D size = this.leftBlock.arrange(g2, c3); + w[2] = size.width; + } + h[3] = h[2]; + if (this.rightBlock != null) { + RectangleConstraint c4 = new RectangleConstraint(0.0, + new Range(0.0, Math.max(constraint.getWidth() - w[2], 0.0)), + LengthConstraintType.RANGE, h[2], null, + LengthConstraintType.FIXED); + Size2D size = this.rightBlock.arrange(g2, c4); + w[3] = size.width; + } + h[4] = h[2]; + w[4] = constraint.getWidth() - w[3] - w[2]; + RectangleConstraint c5 = new RectangleConstraint(w[4], h[4]); + if (this.centerBlock != null) { + this.centerBlock.arrange(g2, c5); + } + if (this.topBlock != null) { + this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, w[0], + h[0])); + } + if (this.bottomBlock != null) { + this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, h[0] + h[2], + w[1], h[1])); + } + if (this.leftBlock != null) { + this.leftBlock.setBounds(new Rectangle2D.Double(0.0, h[0], w[2], + h[2])); + } + if (this.rightBlock != null) { + this.rightBlock.setBounds(new Rectangle2D.Double(w[2] + w[4], h[0], + w[3], h[3])); + } + if (this.centerBlock != null) { + this.centerBlock.setBounds(new Rectangle2D.Double(w[2], h[0], w[4], + h[4])); + } + return new Size2D(constraint.getWidth(), constraint.getHeight()); + } +" +Math-106," public Fraction parse(String source, ParsePosition pos) { + Fraction ret = super.parse(source, pos); + if (ret != null) { + return ret; + } + int initialIndex = pos.getIndex(); + parseAndIgnoreWhitespace(source, pos); + Number whole = getWholeFormat().parse(source, pos); + if (whole == null) { + pos.setIndex(initialIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number num = getNumeratorFormat().parse(source, pos); + if (num == null) { + pos.setIndex(initialIndex); + return null; + } + int startIndex = pos.getIndex(); + char c = parseNextCharacter(source, pos); + switch (c) { + case 0 : + return new Fraction(num.intValue(), 1); + case '/' : + break; + default : + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number den = getDenominatorFormat().parse(source, pos); + if (den == null) { + pos.setIndex(initialIndex); + return null; + } + int w = whole.intValue(); + int n = num.intValue(); + int d = den.intValue(); + return new Fraction(((Math.abs(w) * d) + n) * MathUtils.sign(w), d); + } +"," public Fraction parse(String source, ParsePosition pos) { + Fraction ret = super.parse(source, pos); + if (ret != null) { + return ret; + } + int initialIndex = pos.getIndex(); + parseAndIgnoreWhitespace(source, pos); + Number whole = getWholeFormat().parse(source, pos); + if (whole == null) { + pos.setIndex(initialIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number num = getNumeratorFormat().parse(source, pos); + if (num == null) { + pos.setIndex(initialIndex); + return null; + } + if (num.intValue() < 0) { + pos.setIndex(initialIndex); + return null; + } + int startIndex = pos.getIndex(); + char c = parseNextCharacter(source, pos); + switch (c) { + case 0 : + return new Fraction(num.intValue(), 1); + case '/' : + break; + default : + pos.setIndex(initialIndex); + pos.setErrorIndex(startIndex); + return null; + } + parseAndIgnoreWhitespace(source, pos); + Number den = getDenominatorFormat().parse(source, pos); + if (den == null) { + pos.setIndex(initialIndex); + return null; + } + if (den.intValue() < 0) { + pos.setIndex(initialIndex); + return null; + } + int w = whole.intValue(); + int n = num.intValue(); + int d = den.intValue(); + return new Fraction(((Math.abs(w) * d) + n) * MathUtils.sign(w), d); + } +" +Compress-41," public ZipArchiveEntry getNextZipEntry() throws IOException { + boolean firstEntry = true; + if (closed || hitCentralDirectory) { + return null; + } + if (current != null) { + closeEntry(); + firstEntry = false; + } + try { + if (firstEntry) { + readFirstLocalFileHeader(LFH_BUF); + } else { + readFully(LFH_BUF); + } + } catch (final EOFException e) { + return null; + } + final ZipLong sig = new ZipLong(LFH_BUF); + if (sig.equals(ZipLong.CFH_SIG) || sig.equals(ZipLong.AED_SIG)) { + hitCentralDirectory = true; + skipRemainderOfArchive(); + } + if (!sig.equals(ZipLong.LFH_SIG)) { + return null; + } + int off = WORD; + current = new CurrentEntry(); + final int versionMadeBy = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + current.entry.setPlatform((versionMadeBy >> ZipFile.BYTE_SHIFT) & ZipFile.NIBLET_MASK); + final GeneralPurposeBit gpFlag = GeneralPurposeBit.parse(LFH_BUF, off); + final boolean hasUTF8Flag = gpFlag.usesUTF8ForNames(); + final ZipEncoding entryEncoding = hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding; + current.hasDataDescriptor = gpFlag.usesDataDescriptor(); + current.entry.setGeneralPurposeBit(gpFlag); + off += SHORT; + current.entry.setMethod(ZipShort.getValue(LFH_BUF, off)); + off += SHORT; + final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(LFH_BUF, off)); + current.entry.setTime(time); + off += WORD; + ZipLong size = null, cSize = null; + if (!current.hasDataDescriptor) { + current.entry.setCrc(ZipLong.getValue(LFH_BUF, off)); + off += WORD; + cSize = new ZipLong(LFH_BUF, off); + off += WORD; + size = new ZipLong(LFH_BUF, off); + off += WORD; + } else { + off += 3 * WORD; + } + final int fileNameLen = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + final int extraLen = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + final byte[] fileName = new byte[fileNameLen]; + readFully(fileName); + current.entry.setName(entryEncoding.decode(fileName), fileName); + final byte[] extraData = new byte[extraLen]; + readFully(extraData); + current.entry.setExtra(extraData); + if (!hasUTF8Flag && useUnicodeExtraFields) { + ZipUtil.setNameAndCommentFromExtraFields(current.entry, fileName, null); + } + processZip64Extra(size, cSize); + if (current.entry.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN) { + if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) { + current.in = new UnshrinkingInputStream(new BoundedInputStream(in, current.entry.getCompressedSize())); + } else if (current.entry.getMethod() == ZipMethod.IMPLODING.getCode()) { + current.in = new ExplodingInputStream( + current.entry.getGeneralPurposeBit().getSlidingDictionarySize(), + current.entry.getGeneralPurposeBit().getNumberOfShannonFanoTrees(), + new BoundedInputStream(in, current.entry.getCompressedSize())); + } else if (current.entry.getMethod() == ZipMethod.BZIP2.getCode()) { + current.in = new BZip2CompressorInputStream(new BoundedInputStream(in, current.entry.getCompressedSize())); + } + } + entriesRead++; + return current.entry; + } +"," public ZipArchiveEntry getNextZipEntry() throws IOException { + boolean firstEntry = true; + if (closed || hitCentralDirectory) { + return null; + } + if (current != null) { + closeEntry(); + firstEntry = false; + } + try { + if (firstEntry) { + readFirstLocalFileHeader(LFH_BUF); + } else { + readFully(LFH_BUF); + } + } catch (final EOFException e) { + return null; + } + final ZipLong sig = new ZipLong(LFH_BUF); + if (sig.equals(ZipLong.CFH_SIG) || sig.equals(ZipLong.AED_SIG)) { + hitCentralDirectory = true; + skipRemainderOfArchive(); + return null; + } + if (!sig.equals(ZipLong.LFH_SIG)) { + throw new ZipException(String.format(""Unexpected record signature: 0X%X"", sig.getValue())); + } + int off = WORD; + current = new CurrentEntry(); + final int versionMadeBy = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + current.entry.setPlatform((versionMadeBy >> ZipFile.BYTE_SHIFT) & ZipFile.NIBLET_MASK); + final GeneralPurposeBit gpFlag = GeneralPurposeBit.parse(LFH_BUF, off); + final boolean hasUTF8Flag = gpFlag.usesUTF8ForNames(); + final ZipEncoding entryEncoding = hasUTF8Flag ? ZipEncodingHelper.UTF8_ZIP_ENCODING : zipEncoding; + current.hasDataDescriptor = gpFlag.usesDataDescriptor(); + current.entry.setGeneralPurposeBit(gpFlag); + off += SHORT; + current.entry.setMethod(ZipShort.getValue(LFH_BUF, off)); + off += SHORT; + final long time = ZipUtil.dosToJavaTime(ZipLong.getValue(LFH_BUF, off)); + current.entry.setTime(time); + off += WORD; + ZipLong size = null, cSize = null; + if (!current.hasDataDescriptor) { + current.entry.setCrc(ZipLong.getValue(LFH_BUF, off)); + off += WORD; + cSize = new ZipLong(LFH_BUF, off); + off += WORD; + size = new ZipLong(LFH_BUF, off); + off += WORD; + } else { + off += 3 * WORD; + } + final int fileNameLen = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + final int extraLen = ZipShort.getValue(LFH_BUF, off); + off += SHORT; + final byte[] fileName = new byte[fileNameLen]; + readFully(fileName); + current.entry.setName(entryEncoding.decode(fileName), fileName); + final byte[] extraData = new byte[extraLen]; + readFully(extraData); + current.entry.setExtra(extraData); + if (!hasUTF8Flag && useUnicodeExtraFields) { + ZipUtil.setNameAndCommentFromExtraFields(current.entry, fileName, null); + } + processZip64Extra(size, cSize); + if (current.entry.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN) { + if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) { + current.in = new UnshrinkingInputStream(new BoundedInputStream(in, current.entry.getCompressedSize())); + } else if (current.entry.getMethod() == ZipMethod.IMPLODING.getCode()) { + current.in = new ExplodingInputStream( + current.entry.getGeneralPurposeBit().getSlidingDictionarySize(), + current.entry.getGeneralPurposeBit().getNumberOfShannonFanoTrees(), + new BoundedInputStream(in, current.entry.getCompressedSize())); + } else if (current.entry.getMethod() == ZipMethod.BZIP2.getCode()) { + current.in = new BZip2CompressorInputStream(new BoundedInputStream(in, current.entry.getCompressedSize())); + } + } + entriesRead++; + return current.entry; + } +" +Closure-59," public void initOptions(CompilerOptions options) { + this.options = options; + if (errorManager == null) { + if (outStream == null) { + setErrorManager( + new LoggerErrorManager(createMessageFormatter(), logger)); + } else { + PrintStreamErrorManager printer = + new PrintStreamErrorManager(createMessageFormatter(), outStream); + printer.setSummaryDetailLevel(options.summaryDetailLevel); + setErrorManager(printer); + } + } + if (options.enables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = true; + } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = false; + } else if (!options.checkTypes) { + options.setWarningLevel( + DiagnosticGroup.forType( + RhinoErrorReporter.TYPE_PARSE_ERROR), + CheckLevel.OFF); + } + if (options.checkGlobalThisLevel.isOn()) { + options.setWarningLevel( + DiagnosticGroups.GLOBAL_THIS, + options.checkGlobalThisLevel); + } + if (options.getLanguageIn() == LanguageMode.ECMASCRIPT5_STRICT) { + options.setWarningLevel( + DiagnosticGroups.ES5_STRICT, + CheckLevel.ERROR); + } + List guards = Lists.newArrayList(); + guards.add( + new SuppressDocWarningsGuard( + getDiagnosticGroups().getRegisteredGroups())); + guards.add(options.getWarningsGuard()); + ComposeWarningsGuard composedGuards = new ComposeWarningsGuard(guards); + if (!options.checkSymbols && + !composedGuards.enables(DiagnosticGroups.CHECK_VARIABLES)) { + composedGuards.addGuard(new DiagnosticGroupWarningsGuard( + DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF)); + } + this.warningsGuard = composedGuards; + } +"," public void initOptions(CompilerOptions options) { + this.options = options; + if (errorManager == null) { + if (outStream == null) { + setErrorManager( + new LoggerErrorManager(createMessageFormatter(), logger)); + } else { + PrintStreamErrorManager printer = + new PrintStreamErrorManager(createMessageFormatter(), outStream); + printer.setSummaryDetailLevel(options.summaryDetailLevel); + setErrorManager(printer); + } + } + if (options.enables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = true; + } else if (options.disables(DiagnosticGroups.CHECK_TYPES)) { + options.checkTypes = false; + } else if (!options.checkTypes) { + options.setWarningLevel( + DiagnosticGroup.forType( + RhinoErrorReporter.TYPE_PARSE_ERROR), + CheckLevel.OFF); + } + if (options.checkGlobalThisLevel.isOn() && + !options.disables(DiagnosticGroups.GLOBAL_THIS)) { + options.setWarningLevel( + DiagnosticGroups.GLOBAL_THIS, + options.checkGlobalThisLevel); + } + if (options.getLanguageIn() == LanguageMode.ECMASCRIPT5_STRICT) { + options.setWarningLevel( + DiagnosticGroups.ES5_STRICT, + CheckLevel.ERROR); + } + List guards = Lists.newArrayList(); + guards.add( + new SuppressDocWarningsGuard( + getDiagnosticGroups().getRegisteredGroups())); + guards.add(options.getWarningsGuard()); + ComposeWarningsGuard composedGuards = new ComposeWarningsGuard(guards); + if (!options.checkSymbols && + !composedGuards.enables(DiagnosticGroups.CHECK_VARIABLES)) { + composedGuards.addGuard(new DiagnosticGroupWarningsGuard( + DiagnosticGroups.CHECK_VARIABLES, CheckLevel.OFF)); + } + this.warningsGuard = composedGuards; + } +" +Lang-3," public static Number createNumber(final String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + final String[] hex_prefixes = {""0x"", ""0X"", ""-0x"", ""-0X"", ""#"", ""-#""}; + int pfxLen = 0; + for(final String pfx : hex_prefixes) { + if (str.startsWith(pfx)) { + pfxLen += pfx.length(); + break; + } + } + if (pfxLen > 0) { + final int hexDigits = str.length() - pfxLen; + if (hexDigits > 16) { + return createBigInteger(str); + } + if (hexDigits > 8) { + return createLong(str); + } + return createInteger(str); + } + final char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + final int decPos = str.indexOf('.'); + final int expPos = str.indexOf('e') + str.indexOf('E') + 1; + int numDecimals = 0; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + numDecimals = dec.length(); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + final String numeric = str.substring(0, str.length() - 1); + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + final Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (final NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + final Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (final NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (final NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (final NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(str); + } + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + final Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (final NumberFormatException nfe) { + } + try { + final Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } catch (final NumberFormatException nfe) { + } + return createBigDecimal(str); + } +"," public static Number createNumber(final String str) throws NumberFormatException { + if (str == null) { + return null; + } + if (StringUtils.isBlank(str)) { + throw new NumberFormatException(""A blank string is not a valid number""); + } + final String[] hex_prefixes = {""0x"", ""0X"", ""-0x"", ""-0X"", ""#"", ""-#""}; + int pfxLen = 0; + for(final String pfx : hex_prefixes) { + if (str.startsWith(pfx)) { + pfxLen += pfx.length(); + break; + } + } + if (pfxLen > 0) { + final int hexDigits = str.length() - pfxLen; + if (hexDigits > 16) { + return createBigInteger(str); + } + if (hexDigits > 8) { + return createLong(str); + } + return createInteger(str); + } + final char lastChar = str.charAt(str.length() - 1); + String mant; + String dec; + String exp; + final int decPos = str.indexOf('.'); + final int expPos = str.indexOf('e') + str.indexOf('E') + 1; + int numDecimals = 0; + if (decPos > -1) { + if (expPos > -1) { + if (expPos < decPos || expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + dec = str.substring(decPos + 1, expPos); + } else { + dec = str.substring(decPos + 1); + } + mant = str.substring(0, decPos); + numDecimals = dec.length(); + } else { + if (expPos > -1) { + if (expPos > str.length()) { + throw new NumberFormatException(str + "" is not a valid number.""); + } + mant = str.substring(0, expPos); + } else { + mant = str; + } + dec = null; + } + if (!Character.isDigit(lastChar) && lastChar != '.') { + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length() - 1); + } else { + exp = null; + } + final String numeric = str.substring(0, str.length() - 1); + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + switch (lastChar) { + case 'l' : + case 'L' : + if (dec == null + && exp == null + && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { + try { + return createLong(numeric); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(numeric); + } + throw new NumberFormatException(str + "" is not a valid number.""); + case 'f' : + case 'F' : + try { + final Float f = NumberUtils.createFloat(numeric); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } catch (final NumberFormatException nfe) { + } + case 'd' : + case 'D' : + try { + final Double d = NumberUtils.createDouble(numeric); + if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { + return d; + } + } catch (final NumberFormatException nfe) { + } + try { + return createBigDecimal(numeric); + } catch (final NumberFormatException e) { + } + default : + throw new NumberFormatException(str + "" is not a valid number.""); + } + } + if (expPos > -1 && expPos < str.length() - 1) { + exp = str.substring(expPos + 1, str.length()); + } else { + exp = null; + } + if (dec == null && exp == null) { + try { + return createInteger(str); + } catch (final NumberFormatException nfe) { + } + try { + return createLong(str); + } catch (final NumberFormatException nfe) { + } + return createBigInteger(str); + } + final boolean allZeros = isAllZeros(mant) && isAllZeros(exp); + try { + if(numDecimals <= 7){ + final Float f = createFloat(str); + if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { + return f; + } + } + } catch (final NumberFormatException nfe) { + } + try { + if(numDecimals <= 16){ + final Double d = createDouble(str); + if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { + return d; + } + } + } catch (final NumberFormatException nfe) { + } + return createBigDecimal(str); + } +" +Closure-152," JSType resolveInternal(ErrorReporter t, StaticScope scope) { + setResolvedTypeInternal(this); + call = (ArrowType) safeResolve(call, t, scope); + prototype = (FunctionPrototypeType) safeResolve(prototype, t, scope); + typeOfThis = (ObjectType) safeResolve(typeOfThis, t, scope); + boolean changed = false; + ImmutableList.Builder resolvedInterfaces = + ImmutableList.builder(); + for (ObjectType iface : implementedInterfaces) { + ObjectType resolvedIface = (ObjectType) iface.resolve(t, scope); + resolvedInterfaces.add(resolvedIface); + changed |= (resolvedIface != iface); + } + if (changed) { + implementedInterfaces = resolvedInterfaces.build(); + } + if (subTypes != null) { + for (int i = 0; i < subTypes.size(); i++) { + subTypes.set(i, (FunctionType) subTypes.get(i).resolve(t, scope)); + } + } + return super.resolveInternal(t, scope); + } +"," JSType resolveInternal(ErrorReporter t, StaticScope scope) { + setResolvedTypeInternal(this); + call = (ArrowType) safeResolve(call, t, scope); + prototype = (FunctionPrototypeType) safeResolve(prototype, t, scope); + JSType maybeTypeOfThis = safeResolve(typeOfThis, t, scope); + if (maybeTypeOfThis instanceof ObjectType) { + typeOfThis = (ObjectType) maybeTypeOfThis; + } + boolean changed = false; + ImmutableList.Builder resolvedInterfaces = + ImmutableList.builder(); + for (ObjectType iface : implementedInterfaces) { + ObjectType resolvedIface = (ObjectType) iface.resolve(t, scope); + resolvedInterfaces.add(resolvedIface); + changed |= (resolvedIface != iface); + } + if (changed) { + implementedInterfaces = resolvedInterfaces.build(); + } + if (subTypes != null) { + for (int i = 0; i < subTypes.size(); i++) { + subTypes.set(i, (FunctionType) subTypes.get(i).resolve(t, scope)); + } + } + return super.resolveInternal(t, scope); + } +" +JacksonDatabind-58," protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, + BeanDescription beanDesc, BeanPropertyDefinition propDef, + JavaType propType0) + throws JsonMappingException + { + AnnotatedMember mutator = propDef.getNonConstructorMutator(); + if (ctxt.canOverrideAccessModifiers()) { + mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), + propType0, propDef.getWrapperName(), + beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); + JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); + if (type != propType0) { + property = property.withType(type); + } + JsonDeserializer propDeser = findDeserializerFromAnnotation(ctxt, mutator); + type = modifyTypeByAnnotation(ctxt, mutator, type); + TypeDeserializer typeDeser = type.getTypeHandler(); + SettableBeanProperty prop; + if (mutator instanceof AnnotatedMethod) { + prop = new MethodProperty(propDef, type, typeDeser, + beanDesc.getClassAnnotations(), (AnnotatedMethod) mutator); + } else { + prop = new FieldProperty(propDef, type, typeDeser, + beanDesc.getClassAnnotations(), (AnnotatedField) mutator); + } + if (propDeser != null) { + prop = prop.withValueDeserializer(propDeser); + } + AnnotationIntrospector.ReferenceProperty ref = propDef.findReferenceType(); + if (ref != null && ref.isManagedReference()) { + prop.setManagedReferenceName(ref.getName()); + } + ObjectIdInfo objectIdInfo = propDef.findObjectIdInfo(); + if(objectIdInfo != null){ + prop.setObjectIdInfo(objectIdInfo); + } + return prop; + } +"," protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, + BeanDescription beanDesc, BeanPropertyDefinition propDef, + JavaType propType0) + throws JsonMappingException + { + AnnotatedMember mutator = propDef.getNonConstructorMutator(); + if (ctxt.canOverrideAccessModifiers()) { + if ((mutator instanceof AnnotatedField) + && ""cause"".equals(mutator.getName())) { + ; + } else { + mutator.fixAccess(ctxt.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS)); + } + } + BeanProperty.Std property = new BeanProperty.Std(propDef.getFullName(), + propType0, propDef.getWrapperName(), + beanDesc.getClassAnnotations(), mutator, propDef.getMetadata()); + JavaType type = resolveType(ctxt, beanDesc, propType0, mutator); + if (type != propType0) { + property = property.withType(type); + } + JsonDeserializer propDeser = findDeserializerFromAnnotation(ctxt, mutator); + type = modifyTypeByAnnotation(ctxt, mutator, type); + TypeDeserializer typeDeser = type.getTypeHandler(); + SettableBeanProperty prop; + if (mutator instanceof AnnotatedMethod) { + prop = new MethodProperty(propDef, type, typeDeser, + beanDesc.getClassAnnotations(), (AnnotatedMethod) mutator); + } else { + prop = new FieldProperty(propDef, type, typeDeser, + beanDesc.getClassAnnotations(), (AnnotatedField) mutator); + } + if (propDeser != null) { + prop = prop.withValueDeserializer(propDeser); + } + AnnotationIntrospector.ReferenceProperty ref = propDef.findReferenceType(); + if (ref != null && ref.isManagedReference()) { + prop.setManagedReferenceName(ref.getName()); + } + ObjectIdInfo objectIdInfo = propDef.findObjectIdInfo(); + if(objectIdInfo != null){ + prop.setObjectIdInfo(objectIdInfo); + } + return prop; + } +" +Math-3," public static double linearCombination(final double[] a, final double[] b) + throws DimensionMismatchException { + final int len = a.length; + if (len != b.length) { + throw new DimensionMismatchException(len, b.length); + } + final double[] prodHigh = new double[len]; + double prodLowSum = 0; + for (int i = 0; i < len; i++) { + final double ai = a[i]; + final double ca = SPLIT_FACTOR * ai; + final double aHigh = ca - (ca - ai); + final double aLow = ai - aHigh; + final double bi = b[i]; + final double cb = SPLIT_FACTOR * bi; + final double bHigh = cb - (cb - bi); + final double bLow = bi - bHigh; + prodHigh[i] = ai * bi; + final double prodLow = aLow * bLow - (((prodHigh[i] - + aHigh * bHigh) - + aLow * bHigh) - + aHigh * bLow); + prodLowSum += prodLow; + } + final double prodHighCur = prodHigh[0]; + double prodHighNext = prodHigh[1]; + double sHighPrev = prodHighCur + prodHighNext; + double sPrime = sHighPrev - prodHighNext; + double sLowSum = (prodHighNext - (sHighPrev - sPrime)) + (prodHighCur - sPrime); + final int lenMinusOne = len - 1; + for (int i = 1; i < lenMinusOne; i++) { + prodHighNext = prodHigh[i + 1]; + final double sHighCur = sHighPrev + prodHighNext; + sPrime = sHighCur - prodHighNext; + sLowSum += (prodHighNext - (sHighCur - sPrime)) + (sHighPrev - sPrime); + sHighPrev = sHighCur; + } + double result = sHighPrev + (prodLowSum + sLowSum); + if (Double.isNaN(result)) { + result = 0; + for (int i = 0; i < len; ++i) { + result += a[i] * b[i]; + } + } + return result; + } +"," public static double linearCombination(final double[] a, final double[] b) + throws DimensionMismatchException { + final int len = a.length; + if (len != b.length) { + throw new DimensionMismatchException(len, b.length); + } + if (len == 1) { + return a[0] * b[0]; + } + final double[] prodHigh = new double[len]; + double prodLowSum = 0; + for (int i = 0; i < len; i++) { + final double ai = a[i]; + final double ca = SPLIT_FACTOR * ai; + final double aHigh = ca - (ca - ai); + final double aLow = ai - aHigh; + final double bi = b[i]; + final double cb = SPLIT_FACTOR * bi; + final double bHigh = cb - (cb - bi); + final double bLow = bi - bHigh; + prodHigh[i] = ai * bi; + final double prodLow = aLow * bLow - (((prodHigh[i] - + aHigh * bHigh) - + aLow * bHigh) - + aHigh * bLow); + prodLowSum += prodLow; + } + final double prodHighCur = prodHigh[0]; + double prodHighNext = prodHigh[1]; + double sHighPrev = prodHighCur + prodHighNext; + double sPrime = sHighPrev - prodHighNext; + double sLowSum = (prodHighNext - (sHighPrev - sPrime)) + (prodHighCur - sPrime); + final int lenMinusOne = len - 1; + for (int i = 1; i < lenMinusOne; i++) { + prodHighNext = prodHigh[i + 1]; + final double sHighCur = sHighPrev + prodHighNext; + sPrime = sHighCur - prodHighNext; + sLowSum += (prodHighNext - (sHighCur - sPrime)) + (sHighPrev - sPrime); + sHighPrev = sHighCur; + } + double result = sHighPrev + (prodLowSum + sLowSum); + if (Double.isNaN(result)) { + result = 0; + for (int i = 0; i < len; ++i) { + result += a[i] * b[i]; + } + } + return result; + } +" +JacksonCore-3," public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in, + ObjectCodec codec, BytesToNameCanonicalizer sym, + byte[] inputBuffer, int start, int end, + boolean bufferRecyclable) + { + super(ctxt, features); + _inputStream = in; + _objectCodec = codec; + _symbols = sym; + _inputBuffer = inputBuffer; + _inputPtr = start; + _inputEnd = end; + _bufferRecyclable = bufferRecyclable; + } +"," public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in, + ObjectCodec codec, BytesToNameCanonicalizer sym, + byte[] inputBuffer, int start, int end, + boolean bufferRecyclable) + { + super(ctxt, features); + _inputStream = in; + _objectCodec = codec; + _symbols = sym; + _inputBuffer = inputBuffer; + _inputPtr = start; + _inputEnd = end; + _currInputRowStart = start; + _currInputProcessed = -start; + _bufferRecyclable = bufferRecyclable; + } +" +Lang-39," private static String replaceEach(String text, String[] searchList, String[] replacementList, + boolean repeat, int timeToLive) + { + if (text == null || text.length() == 0 || searchList == null || + searchList.length == 0 || replacementList == null || replacementList.length == 0) + { + return text; + } + if (timeToLive < 0) { + throw new IllegalStateException(""TimeToLive of "" + timeToLive + "" is less than 0: "" + text); + } + int searchLength = searchList.length; + int replacementLength = replacementList.length; + if (searchLength != replacementLength) { + throw new IllegalArgumentException(""Search and Replace array lengths don't match: "" + + searchLength + + "" vs "" + + replacementLength); + } + boolean[] noMoreMatchesForReplIndex = new boolean[searchLength]; + int textIndex = -1; + int replaceIndex = -1; + int tempIndex = -1; + for (int i = 0; i < searchLength; i++) { + if (noMoreMatchesForReplIndex[i] || searchList[i] == null || + searchList[i].length() == 0 || replacementList[i] == null) + { + continue; + } + tempIndex = text.indexOf(searchList[i]); + if (tempIndex == -1) { + noMoreMatchesForReplIndex[i] = true; + } else { + if (textIndex == -1 || tempIndex < textIndex) { + textIndex = tempIndex; + replaceIndex = i; + } + } + } + if (textIndex == -1) { + return text; + } + int start = 0; + int increase = 0; + for (int i = 0; i < searchList.length; i++) { + int greater = replacementList[i].length() - searchList[i].length(); + if (greater > 0) { + increase += 3 * greater; + } + } + increase = Math.min(increase, text.length() / 5); + StringBuilder buf = new StringBuilder(text.length() + increase); + while (textIndex != -1) { + for (int i = start; i < textIndex; i++) { + buf.append(text.charAt(i)); + } + buf.append(replacementList[replaceIndex]); + start = textIndex + searchList[replaceIndex].length(); + textIndex = -1; + replaceIndex = -1; + tempIndex = -1; + for (int i = 0; i < searchLength; i++) { + if (noMoreMatchesForReplIndex[i] || searchList[i] == null || + searchList[i].length() == 0 || replacementList[i] == null) + { + continue; + } + tempIndex = text.indexOf(searchList[i], start); + if (tempIndex == -1) { + noMoreMatchesForReplIndex[i] = true; + } else { + if (textIndex == -1 || tempIndex < textIndex) { + textIndex = tempIndex; + replaceIndex = i; + } + } + } + } + int textLength = text.length(); + for (int i = start; i < textLength; i++) { + buf.append(text.charAt(i)); + } + String result = buf.toString(); + if (!repeat) { + return result; + } + return replaceEach(result, searchList, replacementList, repeat, timeToLive - 1); + } +"," private static String replaceEach(String text, String[] searchList, String[] replacementList, + boolean repeat, int timeToLive) + { + if (text == null || text.length() == 0 || searchList == null || + searchList.length == 0 || replacementList == null || replacementList.length == 0) + { + return text; + } + if (timeToLive < 0) { + throw new IllegalStateException(""TimeToLive of "" + timeToLive + "" is less than 0: "" + text); + } + int searchLength = searchList.length; + int replacementLength = replacementList.length; + if (searchLength != replacementLength) { + throw new IllegalArgumentException(""Search and Replace array lengths don't match: "" + + searchLength + + "" vs "" + + replacementLength); + } + boolean[] noMoreMatchesForReplIndex = new boolean[searchLength]; + int textIndex = -1; + int replaceIndex = -1; + int tempIndex = -1; + for (int i = 0; i < searchLength; i++) { + if (noMoreMatchesForReplIndex[i] || searchList[i] == null || + searchList[i].length() == 0 || replacementList[i] == null) + { + continue; + } + tempIndex = text.indexOf(searchList[i]); + if (tempIndex == -1) { + noMoreMatchesForReplIndex[i] = true; + } else { + if (textIndex == -1 || tempIndex < textIndex) { + textIndex = tempIndex; + replaceIndex = i; + } + } + } + if (textIndex == -1) { + return text; + } + int start = 0; + int increase = 0; + for (int i = 0; i < searchList.length; i++) { + if (searchList[i] == null || replacementList[i] == null) { + continue; + } + int greater = replacementList[i].length() - searchList[i].length(); + if (greater > 0) { + increase += 3 * greater; + } + } + increase = Math.min(increase, text.length() / 5); + StringBuilder buf = new StringBuilder(text.length() + increase); + while (textIndex != -1) { + for (int i = start; i < textIndex; i++) { + buf.append(text.charAt(i)); + } + buf.append(replacementList[replaceIndex]); + start = textIndex + searchList[replaceIndex].length(); + textIndex = -1; + replaceIndex = -1; + tempIndex = -1; + for (int i = 0; i < searchLength; i++) { + if (noMoreMatchesForReplIndex[i] || searchList[i] == null || + searchList[i].length() == 0 || replacementList[i] == null) + { + continue; + } + tempIndex = text.indexOf(searchList[i], start); + if (tempIndex == -1) { + noMoreMatchesForReplIndex[i] = true; + } else { + if (textIndex == -1 || tempIndex < textIndex) { + textIndex = tempIndex; + replaceIndex = i; + } + } + } + } + int textLength = text.length(); + for (int i = start; i < textLength; i++) { + buf.append(text.charAt(i)); + } + String result = buf.toString(); + if (!repeat) { + return result; + } + return replaceEach(result, searchList, replacementList, repeat, timeToLive - 1); + } +" +Compress-13," protected void setName(String name) { + this.name = name; + } +"," protected void setName(String name) { + if (name != null && getPlatform() == PLATFORM_FAT + && name.indexOf(""/"") == -1) { + name = name.replace('\\', '/'); + } + this.name = name; + } +" +Gson-13," private int peekNumber() throws IOException { + char[] buffer = this.buffer; + int p = pos; + int l = limit; + long value = 0; + boolean negative = false; + boolean fitsInLong = true; + int last = NUMBER_CHAR_NONE; + int i = 0; + charactersOfNumber: + for (; true; i++) { + if (p + i == l) { + if (i == buffer.length) { + return PEEKED_NONE; + } + if (!fillBuffer(i + 1)) { + break; + } + p = pos; + l = limit; + } + char c = buffer[p + i]; + switch (c) { + case '-': + if (last == NUMBER_CHAR_NONE) { + negative = true; + last = NUMBER_CHAR_SIGN; + continue; + } else if (last == NUMBER_CHAR_EXP_E) { + last = NUMBER_CHAR_EXP_SIGN; + continue; + } + return PEEKED_NONE; + case '+': + if (last == NUMBER_CHAR_EXP_E) { + last = NUMBER_CHAR_EXP_SIGN; + continue; + } + return PEEKED_NONE; + case 'e': + case 'E': + if (last == NUMBER_CHAR_DIGIT || last == NUMBER_CHAR_FRACTION_DIGIT) { + last = NUMBER_CHAR_EXP_E; + continue; + } + return PEEKED_NONE; + case '.': + if (last == NUMBER_CHAR_DIGIT) { + last = NUMBER_CHAR_DECIMAL; + continue; + } + return PEEKED_NONE; + default: + if (c < '0' || c > '9') { + if (!isLiteral(c)) { + break charactersOfNumber; + } + return PEEKED_NONE; + } + if (last == NUMBER_CHAR_SIGN || last == NUMBER_CHAR_NONE) { + value = -(c - '0'); + last = NUMBER_CHAR_DIGIT; + } else if (last == NUMBER_CHAR_DIGIT) { + if (value == 0) { + return PEEKED_NONE; + } + long newValue = value * 10 - (c - '0'); + fitsInLong &= value > MIN_INCOMPLETE_INTEGER + || (value == MIN_INCOMPLETE_INTEGER && newValue < value); + value = newValue; + } else if (last == NUMBER_CHAR_DECIMAL) { + last = NUMBER_CHAR_FRACTION_DIGIT; + } else if (last == NUMBER_CHAR_EXP_E || last == NUMBER_CHAR_EXP_SIGN) { + last = NUMBER_CHAR_EXP_DIGIT; + } + } + } + if (last == NUMBER_CHAR_DIGIT && fitsInLong && (value != Long.MIN_VALUE || negative)) { + peekedLong = negative ? value : -value; + pos += i; + return peeked = PEEKED_LONG; + } else if (last == NUMBER_CHAR_DIGIT || last == NUMBER_CHAR_FRACTION_DIGIT + || last == NUMBER_CHAR_EXP_DIGIT) { + peekedNumberLength = i; + return peeked = PEEKED_NUMBER; + } else { + return PEEKED_NONE; + } + } +"," private int peekNumber() throws IOException { + char[] buffer = this.buffer; + int p = pos; + int l = limit; + long value = 0; + boolean negative = false; + boolean fitsInLong = true; + int last = NUMBER_CHAR_NONE; + int i = 0; + charactersOfNumber: + for (; true; i++) { + if (p + i == l) { + if (i == buffer.length) { + return PEEKED_NONE; + } + if (!fillBuffer(i + 1)) { + break; + } + p = pos; + l = limit; + } + char c = buffer[p + i]; + switch (c) { + case '-': + if (last == NUMBER_CHAR_NONE) { + negative = true; + last = NUMBER_CHAR_SIGN; + continue; + } else if (last == NUMBER_CHAR_EXP_E) { + last = NUMBER_CHAR_EXP_SIGN; + continue; + } + return PEEKED_NONE; + case '+': + if (last == NUMBER_CHAR_EXP_E) { + last = NUMBER_CHAR_EXP_SIGN; + continue; + } + return PEEKED_NONE; + case 'e': + case 'E': + if (last == NUMBER_CHAR_DIGIT || last == NUMBER_CHAR_FRACTION_DIGIT) { + last = NUMBER_CHAR_EXP_E; + continue; + } + return PEEKED_NONE; + case '.': + if (last == NUMBER_CHAR_DIGIT) { + last = NUMBER_CHAR_DECIMAL; + continue; + } + return PEEKED_NONE; + default: + if (c < '0' || c > '9') { + if (!isLiteral(c)) { + break charactersOfNumber; + } + return PEEKED_NONE; + } + if (last == NUMBER_CHAR_SIGN || last == NUMBER_CHAR_NONE) { + value = -(c - '0'); + last = NUMBER_CHAR_DIGIT; + } else if (last == NUMBER_CHAR_DIGIT) { + if (value == 0) { + return PEEKED_NONE; + } + long newValue = value * 10 - (c - '0'); + fitsInLong &= value > MIN_INCOMPLETE_INTEGER + || (value == MIN_INCOMPLETE_INTEGER && newValue < value); + value = newValue; + } else if (last == NUMBER_CHAR_DECIMAL) { + last = NUMBER_CHAR_FRACTION_DIGIT; + } else if (last == NUMBER_CHAR_EXP_E || last == NUMBER_CHAR_EXP_SIGN) { + last = NUMBER_CHAR_EXP_DIGIT; + } + } + } + if (last == NUMBER_CHAR_DIGIT && fitsInLong && (value != Long.MIN_VALUE || negative) && (value!=0 || false==negative)) { + peekedLong = negative ? value : -value; + pos += i; + return peeked = PEEKED_LONG; + } else if (last == NUMBER_CHAR_DIGIT || last == NUMBER_CHAR_FRACTION_DIGIT + || last == NUMBER_CHAR_EXP_DIGIT) { + peekedNumberLength = i; + return peeked = PEEKED_NUMBER; + } else { + return PEEKED_NONE; + } + } +" +JacksonDatabind-112," public JsonDeserializer createContextual(DeserializationContext ctxt, + BeanProperty property) throws JsonMappingException + { + JsonDeserializer delegate = null; + if (_valueInstantiator != null) { + AnnotatedWithParams delegateCreator = _valueInstantiator.getDelegateCreator(); + if (delegateCreator != null) { + JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); + delegate = findDeserializer(ctxt, delegateType, property); + } + } + JsonDeserializer valueDeser = _valueDeserializer; + final JavaType valueType = _containerType.getContentType(); + if (valueDeser == null) { + valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); + if (valueDeser == null) { + valueDeser = ctxt.findContextualValueDeserializer(valueType, property); + } + } else { + valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, valueType); + } + Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, + JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + NullValueProvider nuller = findContentNullProvider(ctxt, property, valueDeser); + if (isDefaultDeserializer(valueDeser)) { + valueDeser = null; + } + return withResolved(delegate, valueDeser, nuller, unwrapSingle); + } +"," public JsonDeserializer createContextual(DeserializationContext ctxt, + BeanProperty property) throws JsonMappingException + { + JsonDeserializer delegate = null; + if (_valueInstantiator != null) { + AnnotatedWithParams delegateCreator = _valueInstantiator.getArrayDelegateCreator(); + if (delegateCreator != null) { + JavaType delegateType = _valueInstantiator.getArrayDelegateType(ctxt.getConfig()); + delegate = findDeserializer(ctxt, delegateType, property); + } else if ((delegateCreator = _valueInstantiator.getDelegateCreator()) != null) { + JavaType delegateType = _valueInstantiator.getDelegateType(ctxt.getConfig()); + delegate = findDeserializer(ctxt, delegateType, property); + } + } + JsonDeserializer valueDeser = _valueDeserializer; + final JavaType valueType = _containerType.getContentType(); + if (valueDeser == null) { + valueDeser = findConvertingContentDeserializer(ctxt, property, valueDeser); + if (valueDeser == null) { + valueDeser = ctxt.findContextualValueDeserializer(valueType, property); + } + } else { + valueDeser = ctxt.handleSecondaryContextualization(valueDeser, property, valueType); + } + Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class, + JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + NullValueProvider nuller = findContentNullProvider(ctxt, property, valueDeser); + if (isDefaultDeserializer(valueDeser)) { + valueDeser = null; + } + return withResolved(delegate, valueDeser, nuller, unwrapSingle); + } +" +Closure-65," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\0': sb.append(""\\0""); break; + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c < 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +"," static String strEscape(String s, char quote, + String doublequoteEscape, + String singlequoteEscape, + String backslashEscape, + CharsetEncoder outputCharsetEncoder) { + StringBuilder sb = new StringBuilder(s.length() + 2); + sb.append(quote); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + switch (c) { + case '\0': sb.append(""\\000""); break; + case '\n': sb.append(""\\n""); break; + case '\r': sb.append(""\\r""); break; + case '\t': sb.append(""\\t""); break; + case '\\': sb.append(backslashEscape); break; + case '\""': sb.append(doublequoteEscape); break; + case '\'': sb.append(singlequoteEscape); break; + case '>': + if (i >= 2 && + ((s.charAt(i - 1) == '-' && s.charAt(i - 2) == '-') || + (s.charAt(i - 1) == ']' && s.charAt(i - 2) == ']'))) { + sb.append(""\\>""); + } else { + sb.append(c); + } + break; + case '<': + final String END_SCRIPT = ""/script""; + final String START_COMMENT = ""!--""; + if (s.regionMatches(true, i + 1, END_SCRIPT, 0, + END_SCRIPT.length())) { + sb.append(""<\\""); + } else if (s.regionMatches(false, i + 1, START_COMMENT, 0, + START_COMMENT.length())) { + sb.append(""<\\""); + } else { + sb.append(c); + } + break; + default: + if (outputCharsetEncoder != null) { + if (outputCharsetEncoder.canEncode(c)) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } else { + if (c > 0x1f && c < 0x7f) { + sb.append(c); + } else { + appendHexJavaScriptRepresentation(sb, c); + } + } + } + } + sb.append(quote); + return sb.toString(); + } +" +Math-26," private Fraction(double value, double epsilon, int maxDenominator, int maxIterations) + throws FractionConversionException + { + long overflow = Integer.MAX_VALUE; + double r0 = value; + long a0 = (long)FastMath.floor(r0); + if (a0 > overflow) { + throw new FractionConversionException(value, a0, 1l); + } + if (FastMath.abs(a0 - value) < epsilon) { + this.numerator = (int) a0; + this.denominator = 1; + return; + } + long p0 = 1; + long q0 = 0; + long p1 = a0; + long q1 = 1; + long p2 = 0; + long q2 = 1; + int n = 0; + boolean stop = false; + do { + ++n; + double r1 = 1.0 / (r0 - a0); + long a1 = (long)FastMath.floor(r1); + p2 = (a1 * p1) + p0; + q2 = (a1 * q1) + q0; + if ((p2 > overflow) || (q2 > overflow)) { + throw new FractionConversionException(value, p2, q2); + } + double convergent = (double)p2 / (double)q2; + if (n < maxIterations && FastMath.abs(convergent - value) > epsilon && q2 < maxDenominator) { + p0 = p1; + p1 = p2; + q0 = q1; + q1 = q2; + a0 = a1; + r0 = r1; + } else { + stop = true; + } + } while (!stop); + if (n >= maxIterations) { + throw new FractionConversionException(value, maxIterations); + } + if (q2 < maxDenominator) { + this.numerator = (int) p2; + this.denominator = (int) q2; + } else { + this.numerator = (int) p1; + this.denominator = (int) q1; + } + } +"," private Fraction(double value, double epsilon, int maxDenominator, int maxIterations) + throws FractionConversionException + { + long overflow = Integer.MAX_VALUE; + double r0 = value; + long a0 = (long)FastMath.floor(r0); + if (FastMath.abs(a0) > overflow) { + throw new FractionConversionException(value, a0, 1l); + } + if (FastMath.abs(a0 - value) < epsilon) { + this.numerator = (int) a0; + this.denominator = 1; + return; + } + long p0 = 1; + long q0 = 0; + long p1 = a0; + long q1 = 1; + long p2 = 0; + long q2 = 1; + int n = 0; + boolean stop = false; + do { + ++n; + double r1 = 1.0 / (r0 - a0); + long a1 = (long)FastMath.floor(r1); + p2 = (a1 * p1) + p0; + q2 = (a1 * q1) + q0; + if ((FastMath.abs(p2) > overflow) || (FastMath.abs(q2) > overflow)) { + throw new FractionConversionException(value, p2, q2); + } + double convergent = (double)p2 / (double)q2; + if (n < maxIterations && FastMath.abs(convergent - value) > epsilon && q2 < maxDenominator) { + p0 = p1; + p1 = p2; + q0 = q1; + q1 = q2; + a0 = a1; + r0 = r1; + } else { + stop = true; + } + } while (!stop); + if (n >= maxIterations) { + throw new FractionConversionException(value, maxIterations); + } + if (q2 < maxDenominator) { + this.numerator = (int) p2; + this.denominator = (int) q2; + } else { + this.numerator = (int) p1; + this.denominator = (int) q1; + } + } +" +Jsoup-77," private void popStackToClose(Token.EndTag endTag) { + String elName = endTag.name(); + Element firstFound = null; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element next = stack.get(pos); + if (next.nodeName().equals(elName)) { + firstFound = next; + break; + } + } + if (firstFound == null) + return; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element next = stack.get(pos); + stack.remove(pos); + if (next == firstFound) + break; + } + } +"," private void popStackToClose(Token.EndTag endTag) { + String elName = endTag.normalName(); + Element firstFound = null; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element next = stack.get(pos); + if (next.nodeName().equals(elName)) { + firstFound = next; + break; + } + } + if (firstFound == null) + return; + for (int pos = stack.size() -1; pos >= 0; pos--) { + Element next = stack.get(pos); + stack.remove(pos); + if (next == firstFound) + break; + } + } +" +Jsoup-26," public Document clean(Document dirtyDocument) { + Validate.notNull(dirtyDocument); + Document clean = Document.createShell(dirtyDocument.baseUri()); + copySafeNodes(dirtyDocument.body(), clean.body()); + return clean; + } +"," public Document clean(Document dirtyDocument) { + Validate.notNull(dirtyDocument); + Document clean = Document.createShell(dirtyDocument.baseUri()); + if (dirtyDocument.body() != null) + copySafeNodes(dirtyDocument.body(), clean.body()); + return clean; + } +" +JxPath-8," private boolean compute(Object left, Object right) { + left = reduce(left); + right = reduce(right); + if (left instanceof InitialContext) { + ((InitialContext) left).reset(); + } + if (right instanceof InitialContext) { + ((InitialContext) right).reset(); + } + if (left instanceof Iterator && right instanceof Iterator) { + return findMatch((Iterator) left, (Iterator) right); + } + if (left instanceof Iterator) { + return containsMatch((Iterator) left, right); + } + if (right instanceof Iterator) { + return containsMatch((Iterator) right, left); + } + double ld = InfoSetUtil.doubleValue(left); + double rd = InfoSetUtil.doubleValue(right); + return evaluateCompare(ld == rd ? 0 : ld < rd ? -1 : 1); + } +"," private boolean compute(Object left, Object right) { + left = reduce(left); + right = reduce(right); + if (left instanceof InitialContext) { + ((InitialContext) left).reset(); + } + if (right instanceof InitialContext) { + ((InitialContext) right).reset(); + } + if (left instanceof Iterator && right instanceof Iterator) { + return findMatch((Iterator) left, (Iterator) right); + } + if (left instanceof Iterator) { + return containsMatch((Iterator) left, right); + } + if (right instanceof Iterator) { + return containsMatch((Iterator) right, left); + } + double ld = InfoSetUtil.doubleValue(left); + if (Double.isNaN(ld)) { + return false; + } + double rd = InfoSetUtil.doubleValue(right); + if (Double.isNaN(rd)) { + return false; + } + return evaluateCompare(ld == rd ? 0 : ld < rd ? -1 : 1); + } +" +Math-30," private double calculateAsymptoticPValue(final double Umin, + final int n1, + final int n2) + throws ConvergenceException, MaxCountExceededException { + final int n1n2prod = n1 * n2; + final double EU = n1n2prod / 2.0; + final double VarU = n1n2prod * (n1 + n2 + 1) / 12.0; + final double z = (Umin - EU) / FastMath.sqrt(VarU); + final NormalDistribution standardNormal = new NormalDistribution(0, 1); + return 2 * standardNormal.cumulativeProbability(z); + } +"," private double calculateAsymptoticPValue(final double Umin, + final int n1, + final int n2) + throws ConvergenceException, MaxCountExceededException { + final double n1n2prod = n1 * n2; + final double EU = n1n2prod / 2.0; + final double VarU = n1n2prod * (n1 + n2 + 1) / 12.0; + final double z = (Umin - EU) / FastMath.sqrt(VarU); + final NormalDistribution standardNormal = new NormalDistribution(0, 1); + return 2 * standardNormal.cumulativeProbability(z); + } +" +JacksonDatabind-99," protected String buildCanonicalName() + { + StringBuilder sb = new StringBuilder(); + sb.append(_class.getName()); + sb.append('<'); + sb.append(_referencedType.toCanonical()); + return sb.toString(); + } +"," protected String buildCanonicalName() + { + StringBuilder sb = new StringBuilder(); + sb.append(_class.getName()); + sb.append('<'); + sb.append(_referencedType.toCanonical()); + sb.append('>'); + return sb.toString(); + } +" +Math-40," protected double doSolve() { + final double[] x = new double[maximalOrder + 1]; + final double[] y = new double[maximalOrder + 1]; + x[0] = getMin(); + x[1] = getStartValue(); + x[2] = getMax(); + verifySequence(x[0], x[1], x[2]); + y[1] = computeObjectiveValue(x[1]); + if (Precision.equals(y[1], 0.0, 1)) { + return x[1]; + } + y[0] = computeObjectiveValue(x[0]); + if (Precision.equals(y[0], 0.0, 1)) { + return x[0]; + } + int nbPoints; + int signChangeIndex; + if (y[0] * y[1] < 0) { + nbPoints = 2; + signChangeIndex = 1; + } else { + y[2] = computeObjectiveValue(x[2]); + if (Precision.equals(y[2], 0.0, 1)) { + return x[2]; + } + if (y[1] * y[2] < 0) { + nbPoints = 3; + signChangeIndex = 2; + } else { + throw new NoBracketingException(x[0], x[2], y[0], y[2]); + } + } + final double[] tmpX = new double[x.length]; + double xA = x[signChangeIndex - 1]; + double yA = y[signChangeIndex - 1]; + double absYA = FastMath.abs(yA); + int agingA = 0; + double xB = x[signChangeIndex]; + double yB = y[signChangeIndex]; + double absYB = FastMath.abs(yB); + int agingB = 0; + while (true) { + final double xTol = getAbsoluteAccuracy() + + getRelativeAccuracy() * FastMath.max(FastMath.abs(xA), FastMath.abs(xB)); + if (((xB - xA) <= xTol) || (FastMath.max(absYA, absYB) < getFunctionValueAccuracy())) { + switch (allowed) { + case ANY_SIDE : + return absYA < absYB ? xA : xB; + case LEFT_SIDE : + return xA; + case RIGHT_SIDE : + return xB; + case BELOW_SIDE : + return (yA <= 0) ? xA : xB; + case ABOVE_SIDE : + return (yA < 0) ? xB : xA; + default : + throw new MathInternalError(null); + } + } + double targetY; + if (agingA >= MAXIMAL_AGING) { + targetY = -REDUCTION_FACTOR * yB; + } else if (agingB >= MAXIMAL_AGING) { + targetY = -REDUCTION_FACTOR * yA; + } else { + targetY = 0; + } + double nextX; + int start = 0; + int end = nbPoints; + do { + System.arraycopy(x, start, tmpX, start, end - start); + nextX = guessX(targetY, tmpX, y, start, end); + if (!((nextX > xA) && (nextX < xB))) { + if (signChangeIndex - start >= end - signChangeIndex) { + ++start; + } else { + --end; + } + nextX = Double.NaN; + } + } while (Double.isNaN(nextX) && (end - start > 1)); + if (Double.isNaN(nextX)) { + nextX = xA + 0.5 * (xB - xA); + start = signChangeIndex - 1; + end = signChangeIndex; + } + final double nextY = computeObjectiveValue(nextX); + if (Precision.equals(nextY, 0.0, 1)) { + return nextX; + } + if ((nbPoints > 2) && (end - start != nbPoints)) { + nbPoints = end - start; + System.arraycopy(x, start, x, 0, nbPoints); + System.arraycopy(y, start, y, 0, nbPoints); + signChangeIndex -= start; + } else if (nbPoints == x.length) { + nbPoints--; + if (signChangeIndex >= (x.length + 1) / 2) { + System.arraycopy(x, 1, x, 0, nbPoints); + System.arraycopy(y, 1, y, 0, nbPoints); + --signChangeIndex; + } + } + System.arraycopy(x, signChangeIndex, x, signChangeIndex + 1, nbPoints - signChangeIndex); + x[signChangeIndex] = nextX; + System.arraycopy(y, signChangeIndex, y, signChangeIndex + 1, nbPoints - signChangeIndex); + y[signChangeIndex] = nextY; + ++nbPoints; + if (nextY * yA <= 0) { + xB = nextX; + yB = nextY; + absYB = FastMath.abs(yB); + ++agingA; + agingB = 0; + } else { + xA = nextX; + yA = nextY; + absYA = FastMath.abs(yA); + agingA = 0; + ++agingB; + signChangeIndex++; + } + } + } +"," protected double doSolve() { + final double[] x = new double[maximalOrder + 1]; + final double[] y = new double[maximalOrder + 1]; + x[0] = getMin(); + x[1] = getStartValue(); + x[2] = getMax(); + verifySequence(x[0], x[1], x[2]); + y[1] = computeObjectiveValue(x[1]); + if (Precision.equals(y[1], 0.0, 1)) { + return x[1]; + } + y[0] = computeObjectiveValue(x[0]); + if (Precision.equals(y[0], 0.0, 1)) { + return x[0]; + } + int nbPoints; + int signChangeIndex; + if (y[0] * y[1] < 0) { + nbPoints = 2; + signChangeIndex = 1; + } else { + y[2] = computeObjectiveValue(x[2]); + if (Precision.equals(y[2], 0.0, 1)) { + return x[2]; + } + if (y[1] * y[2] < 0) { + nbPoints = 3; + signChangeIndex = 2; + } else { + throw new NoBracketingException(x[0], x[2], y[0], y[2]); + } + } + final double[] tmpX = new double[x.length]; + double xA = x[signChangeIndex - 1]; + double yA = y[signChangeIndex - 1]; + double absYA = FastMath.abs(yA); + int agingA = 0; + double xB = x[signChangeIndex]; + double yB = y[signChangeIndex]; + double absYB = FastMath.abs(yB); + int agingB = 0; + while (true) { + final double xTol = getAbsoluteAccuracy() + + getRelativeAccuracy() * FastMath.max(FastMath.abs(xA), FastMath.abs(xB)); + if (((xB - xA) <= xTol) || (FastMath.max(absYA, absYB) < getFunctionValueAccuracy())) { + switch (allowed) { + case ANY_SIDE : + return absYA < absYB ? xA : xB; + case LEFT_SIDE : + return xA; + case RIGHT_SIDE : + return xB; + case BELOW_SIDE : + return (yA <= 0) ? xA : xB; + case ABOVE_SIDE : + return (yA < 0) ? xB : xA; + default : + throw new MathInternalError(null); + } + } + double targetY; + if (agingA >= MAXIMAL_AGING) { + final int p = agingA - MAXIMAL_AGING; + final double weightA = (1 << p) - 1; + final double weightB = p + 1; + targetY = (weightA * yA - weightB * REDUCTION_FACTOR * yB) / (weightA + weightB); + } else if (agingB >= MAXIMAL_AGING) { + final int p = agingB - MAXIMAL_AGING; + final double weightA = p + 1; + final double weightB = (1 << p) - 1; + targetY = (weightB * yB - weightA * REDUCTION_FACTOR * yA) / (weightA + weightB); + } else { + targetY = 0; + } + double nextX; + int start = 0; + int end = nbPoints; + do { + System.arraycopy(x, start, tmpX, start, end - start); + nextX = guessX(targetY, tmpX, y, start, end); + if (!((nextX > xA) && (nextX < xB))) { + if (signChangeIndex - start >= end - signChangeIndex) { + ++start; + } else { + --end; + } + nextX = Double.NaN; + } + } while (Double.isNaN(nextX) && (end - start > 1)); + if (Double.isNaN(nextX)) { + nextX = xA + 0.5 * (xB - xA); + start = signChangeIndex - 1; + end = signChangeIndex; + } + final double nextY = computeObjectiveValue(nextX); + if (Precision.equals(nextY, 0.0, 1)) { + return nextX; + } + if ((nbPoints > 2) && (end - start != nbPoints)) { + nbPoints = end - start; + System.arraycopy(x, start, x, 0, nbPoints); + System.arraycopy(y, start, y, 0, nbPoints); + signChangeIndex -= start; + } else if (nbPoints == x.length) { + nbPoints--; + if (signChangeIndex >= (x.length + 1) / 2) { + System.arraycopy(x, 1, x, 0, nbPoints); + System.arraycopy(y, 1, y, 0, nbPoints); + --signChangeIndex; + } + } + System.arraycopy(x, signChangeIndex, x, signChangeIndex + 1, nbPoints - signChangeIndex); + x[signChangeIndex] = nextX; + System.arraycopy(y, signChangeIndex, y, signChangeIndex + 1, nbPoints - signChangeIndex); + y[signChangeIndex] = nextY; + ++nbPoints; + if (nextY * yA <= 0) { + xB = nextX; + yB = nextY; + absYB = FastMath.abs(yB); + ++agingA; + agingB = 0; + } else { + xA = nextX; + yA = nextY; + absYA = FastMath.abs(yA); + agingA = 0; + ++agingB; + signChangeIndex++; + } + } + } +" +Jsoup-37," public String html() { + StringBuilder accum = new StringBuilder(); + html(accum); + return accum.toString().trim(); + } +"," public String html() { + StringBuilder accum = new StringBuilder(); + html(accum); + return getOutputSettings().prettyPrint() ? accum.toString().trim() : accum.toString(); + } +" +Cli-15," public List getValues(final Option option, + List defaultValues) { + List valueList = (List) values.get(option); + if ((valueList == null) || valueList.isEmpty()) { + valueList = defaultValues; + } + if ((valueList == null) || valueList.isEmpty()) { + valueList = (List) this.defaultValues.get(option); + } + return valueList == null ? Collections.EMPTY_LIST : valueList; + } +"," public List getValues(final Option option, + List defaultValues) { + List valueList = (List) values.get(option); + if (defaultValues == null || defaultValues.isEmpty()) { + defaultValues = (List) this.defaultValues.get(option); + } + if (defaultValues != null && !defaultValues.isEmpty()) { + if (valueList == null || valueList.isEmpty()) { + valueList = defaultValues; + } else { + if (defaultValues.size() > valueList.size()) { + valueList = new ArrayList(valueList); + for (int i=valueList.size(); i 0) { + long skipped = input.skip(numToSkip); + if (skipped == 0) { + break; + } + numToSkip -= skipped; + } + return available - numToSkip; + } +"," public static long skip(InputStream input, long numToSkip) throws IOException { + long available = numToSkip; + while (numToSkip > 0) { + long skipped = input.skip(numToSkip); + if (skipped == 0) { + break; + } + numToSkip -= skipped; + } + if (numToSkip > 0) { + byte[] skipBuf = new byte[SKIP_BUF_SIZE]; + while (numToSkip > 0) { + int read = readFully(input, skipBuf, 0, + (int) Math.min(numToSkip, SKIP_BUF_SIZE)); + if (read < 1) { + break; + } + numToSkip -= read; + } + } + return available - numToSkip; + } +" +Compress-31," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer = buffer[end - 1]; + while (start < end && (trailer == 0 || trailer == ' ')) { + end--; + trailer = buffer[end - 1]; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte == 0) { + break; + } + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +"," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer = buffer[end - 1]; + while (start < end && (trailer == 0 || trailer == ' ')) { + end--; + trailer = buffer[end - 1]; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +" +Lang-12," public static String random(int count, int start, int end, boolean letters, boolean numbers, + char[] chars, Random random) { + if (count == 0) { + return """"; + } else if (count < 0) { + throw new IllegalArgumentException(""Requested random string length "" + count + "" is less than 0.""); + } + if (start == 0 && end == 0) { + if (!letters && !numbers) { + end = Integer.MAX_VALUE; + } else { + end = 'z' + 1; + start = ' '; + } + } + char[] buffer = new char[count]; + int gap = end - start; + while (count-- != 0) { + char ch; + if (chars == null) { + ch = (char) (random.nextInt(gap) + start); + } else { + ch = chars[random.nextInt(gap) + start]; + } + if (letters && Character.isLetter(ch) + || numbers && Character.isDigit(ch) + || !letters && !numbers) { + if(ch >= 56320 && ch <= 57343) { + if(count == 0) { + count++; + } else { + buffer[count] = ch; + count--; + buffer[count] = (char) (55296 + random.nextInt(128)); + } + } else if(ch >= 55296 && ch <= 56191) { + if(count == 0) { + count++; + } else { + buffer[count] = (char) (56320 + random.nextInt(128)); + count--; + buffer[count] = ch; + } + } else if(ch >= 56192 && ch <= 56319) { + count++; + } else { + buffer[count] = ch; + } + } else { + count++; + } + } + return new String(buffer); + } +"," public static String random(int count, int start, int end, boolean letters, boolean numbers, + char[] chars, Random random) { + if (count == 0) { + return """"; + } else if (count < 0) { + throw new IllegalArgumentException(""Requested random string length "" + count + "" is less than 0.""); + } + if (chars != null && chars.length == 0) { + throw new IllegalArgumentException(""The chars array must not be empty""); + } + if (start == 0 && end == 0) { + if (chars != null) { + end = chars.length; + } else { + if (!letters && !numbers) { + end = Integer.MAX_VALUE; + } else { + end = 'z' + 1; + start = ' '; + } + } + } + char[] buffer = new char[count]; + int gap = end - start; + while (count-- != 0) { + char ch; + if (chars == null) { + ch = (char) (random.nextInt(gap) + start); + } else { + ch = chars[random.nextInt(gap) + start]; + } + if (letters && Character.isLetter(ch) + || numbers && Character.isDigit(ch) + || !letters && !numbers) { + if(ch >= 56320 && ch <= 57343) { + if(count == 0) { + count++; + } else { + buffer[count] = ch; + count--; + buffer[count] = (char) (55296 + random.nextInt(128)); + } + } else if(ch >= 55296 && ch <= 56191) { + if(count == 0) { + count++; + } else { + buffer[count] = (char) (56320 + random.nextInt(128)); + count--; + buffer[count] = ch; + } + } else if(ch >= 56192 && ch <= 56319) { + count++; + } else { + buffer[count] = ch; + } + } else { + count++; + } + } + return new String(buffer); + } +" +Compress-44," public ChecksumCalculatingInputStream(final Checksum checksum, final InputStream in) { + this.checksum = checksum; + this.in = in; + } +"," public ChecksumCalculatingInputStream(final Checksum checksum, final InputStream in) { + if ( checksum == null ){ + throw new NullPointerException(""Parameter checksum must not be null""); + } + if ( in == null ){ + throw new NullPointerException(""Parameter in must not be null""); + } + this.checksum = checksum; + this.in = in; + } +" +Time-8," public static DateTimeZone forOffsetHoursMinutes(int hoursOffset, int minutesOffset) throws IllegalArgumentException { + if (hoursOffset == 0 && minutesOffset == 0) { + return DateTimeZone.UTC; + } + if (hoursOffset < -23 || hoursOffset > 23) { + throw new IllegalArgumentException(""Hours out of range: "" + hoursOffset); + } + if (minutesOffset < 0 || minutesOffset > 59) { + throw new IllegalArgumentException(""Minutes out of range: "" + minutesOffset); + } + int offset = 0; + try { + int hoursInMinutes = hoursOffset * 60; + if (hoursInMinutes < 0) { + minutesOffset = hoursInMinutes - minutesOffset; + } else { + minutesOffset = hoursInMinutes + minutesOffset; + } + offset = FieldUtils.safeMultiply(minutesOffset, DateTimeConstants.MILLIS_PER_MINUTE); + } catch (ArithmeticException ex) { + throw new IllegalArgumentException(""Offset is too large""); + } + return forOffsetMillis(offset); + } +"," public static DateTimeZone forOffsetHoursMinutes(int hoursOffset, int minutesOffset) throws IllegalArgumentException { + if (hoursOffset == 0 && minutesOffset == 0) { + return DateTimeZone.UTC; + } + if (hoursOffset < -23 || hoursOffset > 23) { + throw new IllegalArgumentException(""Hours out of range: "" + hoursOffset); + } + if (minutesOffset < -59 || minutesOffset > 59) { + throw new IllegalArgumentException(""Minutes out of range: "" + minutesOffset); + } + if (hoursOffset > 0 && minutesOffset < 0) { + throw new IllegalArgumentException(""Positive hours must not have negative minutes: "" + minutesOffset); + } + int offset = 0; + try { + int hoursInMinutes = hoursOffset * 60; + if (hoursInMinutes < 0) { + minutesOffset = hoursInMinutes - Math.abs(minutesOffset); + } else { + minutesOffset = hoursInMinutes + minutesOffset; + } + offset = FieldUtils.safeMultiply(minutesOffset, DateTimeConstants.MILLIS_PER_MINUTE); + } catch (ArithmeticException ex) { + throw new IllegalArgumentException(""Offset is too large""); + } + return forOffsetMillis(offset); + } +" +Math-2," public double getNumericalMean() { + return (double) (getSampleSize() * getNumberOfSuccesses()) / (double) getPopulationSize(); + } +"," public double getNumericalMean() { + return getSampleSize() * (getNumberOfSuccesses() / (double) getPopulationSize()); + } +" +Csv-14," private void printAndQuote(final Object object, final CharSequence value, final int offset, final int len, + final Appendable out, final boolean newRecord) throws IOException { + boolean quote = false; + int start = offset; + int pos = offset; + final int end = offset + len; + final char delimChar = getDelimiter(); + final char quoteChar = getQuoteCharacter().charValue(); + QuoteMode quoteModePolicy = getQuoteMode(); + if (quoteModePolicy == null) { + quoteModePolicy = QuoteMode.MINIMAL; + } + switch (quoteModePolicy) { + case ALL: + quote = true; + break; + case NON_NUMERIC: + quote = !(object instanceof Number); + break; + case NONE: + printAndEscape(value, offset, len, out); + return; + case MINIMAL: + if (len <= 0) { + if (newRecord) { + quote = true; + } + } else { + char c = value.charAt(pos); + if (newRecord && (c < '0' || c > '9' && c < 'A' || c > 'Z' && c < 'a' || c > 'z')) { + quote = true; + } else if (c <= COMMENT) { + quote = true; + } else { + while (pos < end) { + c = value.charAt(pos); + if (c == LF || c == CR || c == quoteChar || c == delimChar) { + quote = true; + break; + } + pos++; + } + if (!quote) { + pos = end - 1; + c = value.charAt(pos); + if (c <= SP) { + quote = true; + } + } + } + } + if (!quote) { + out.append(value, start, end); + return; + } + break; + default: + throw new IllegalStateException(""Unexpected Quote value: "" + quoteModePolicy); + } + if (!quote) { + out.append(value, start, end); + return; + } + out.append(quoteChar); + while (pos < end) { + final char c = value.charAt(pos); + if (c == quoteChar) { + out.append(value, start, pos + 1); + start = pos; + } + pos++; + } + out.append(value, start, pos); + out.append(quoteChar); + } +"," private void printAndQuote(final Object object, final CharSequence value, final int offset, final int len, + final Appendable out, final boolean newRecord) throws IOException { + boolean quote = false; + int start = offset; + int pos = offset; + final int end = offset + len; + final char delimChar = getDelimiter(); + final char quoteChar = getQuoteCharacter().charValue(); + QuoteMode quoteModePolicy = getQuoteMode(); + if (quoteModePolicy == null) { + quoteModePolicy = QuoteMode.MINIMAL; + } + switch (quoteModePolicy) { + case ALL: + quote = true; + break; + case NON_NUMERIC: + quote = !(object instanceof Number); + break; + case NONE: + printAndEscape(value, offset, len, out); + return; + case MINIMAL: + if (len <= 0) { + if (newRecord) { + quote = true; + } + } else { + char c = value.charAt(pos); + if (newRecord && (c < 0x20 || c > 0x21 && c < 0x23 || c > 0x2B && c < 0x2D || c > 0x7E)) { + quote = true; + } else if (c <= COMMENT) { + quote = true; + } else { + while (pos < end) { + c = value.charAt(pos); + if (c == LF || c == CR || c == quoteChar || c == delimChar) { + quote = true; + break; + } + pos++; + } + if (!quote) { + pos = end - 1; + c = value.charAt(pos); + if (c <= SP) { + quote = true; + } + } + } + } + if (!quote) { + out.append(value, start, end); + return; + } + break; + default: + throw new IllegalStateException(""Unexpected Quote value: "" + quoteModePolicy); + } + if (!quote) { + out.append(value, start, end); + return; + } + out.append(quoteChar); + while (pos < end) { + final char c = value.charAt(pos); + if (c == quoteChar) { + out.append(value, start, pos + 1); + start = pos; + } + pos++; + } + out.append(value, start, pos); + out.append(quoteChar); + } +" +JacksonDatabind-85," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + if (property == null) { + return this; + } + JsonFormat.Value format = findFormatOverrides(serializers, property, handledType()); + if (format == null) { + return this; + } + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if ((shape == JsonFormat.Shape.STRING) || format.hasPattern() + || format.hasLocale() || format.hasTimeZone()) { + TimeZone tz = format.getTimeZone(); + final String pattern = format.hasPattern() + ? format.getPattern() + : StdDateFormat.DATE_FORMAT_STR_ISO8601; + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(pattern, loc); + if (tz == null) { + tz = serializers.getTimeZone(); + } + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + return this; + } +"," public JsonSerializer createContextual(SerializerProvider serializers, + BeanProperty property) throws JsonMappingException + { + if (property == null) { + return this; + } + JsonFormat.Value format = findFormatOverrides(serializers, property, handledType()); + if (format == null) { + return this; + } + JsonFormat.Shape shape = format.getShape(); + if (shape.isNumeric()) { + return withFormat(Boolean.TRUE, null); + } + if (format.hasPattern()) { + final Locale loc = format.hasLocale() + ? format.getLocale() + : serializers.getLocale(); + SimpleDateFormat df = new SimpleDateFormat(format.getPattern(), loc); + TimeZone tz = format.hasTimeZone() ? format.getTimeZone() + : serializers.getTimeZone(); + df.setTimeZone(tz); + return withFormat(Boolean.FALSE, df); + } + final boolean hasLocale = format.hasLocale(); + final boolean hasTZ = format.hasTimeZone(); + final boolean asString = (shape == JsonFormat.Shape.STRING); + if (!hasLocale && !hasTZ && !asString) { + return this; + } + DateFormat df0 = serializers.getConfig().getDateFormat(); + if (df0 instanceof StdDateFormat) { + StdDateFormat std = (StdDateFormat) df0; + if (format.hasLocale()) { + std = std.withLocale(format.getLocale()); + } + if (format.hasTimeZone()) { + std = std.withTimeZone(format.getTimeZone()); + } + return withFormat(Boolean.FALSE, std); + } + if (!(df0 instanceof SimpleDateFormat)) { + serializers.reportMappingProblem( +""Configured `DateFormat` (%s) not a `SimpleDateFormat`; can not configure `Locale` or `TimeZone`"", +df0.getClass().getName()); + } + SimpleDateFormat df = (SimpleDateFormat) df0; + if (hasLocale) { + df = new SimpleDateFormat(df.toPattern(), format.getLocale()); + } else { + df = (SimpleDateFormat) df.clone(); + } + TimeZone newTz = format.getTimeZone(); + boolean changeTZ = (newTz != null) && !newTz.equals(df.getTimeZone()); + if (changeTZ) { + df.setTimeZone(newTz); + } + return withFormat(Boolean.FALSE, df); + } +" +Compress-17," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer; + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } else { + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, end-1, trailer)); + } + trailer = buffer[end - 1]; + if (trailer == 0 || trailer == ' '){ + end--; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +"," public static long parseOctal(final byte[] buffer, final int offset, final int length) { + long result = 0; + int end = offset + length; + int start = offset; + if (length < 2){ + throw new IllegalArgumentException(""Length ""+length+"" must be at least 2""); + } + if (buffer[start] == 0) { + return 0L; + } + while (start < end){ + if (buffer[start] == ' '){ + start++; + } else { + break; + } + } + byte trailer; + trailer = buffer[end-1]; + if (trailer == 0 || trailer == ' '){ + end--; + } else { + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, end-1, trailer)); + } + trailer = buffer[end - 1]; + while (start < end - 1 && (trailer == 0 || trailer == ' ')) { + end--; + trailer = buffer[end - 1]; + } + for ( ;start < end; start++) { + final byte currentByte = buffer[start]; + if (currentByte < '0' || currentByte > '7'){ + throw new IllegalArgumentException( + exceptionMessage(buffer, offset, length, start, currentByte)); + } + result = (result << 3) + (currentByte - '0'); + } + return result; + } +" +Math-88," protected RealPointValuePair getSolution() { + double[] coefficients = new double[getOriginalNumDecisionVariables()]; + Integer basicRow = + getBasicRow(getNumObjectiveFunctions() + getOriginalNumDecisionVariables()); + double mostNegative = basicRow == null ? 0 : getEntry(basicRow, getRhsOffset()); + for (int i = 0; i < coefficients.length; i++) { + basicRow = getBasicRow(getNumObjectiveFunctions() + i); + coefficients[i] = + (basicRow == null ? 0 : getEntry(basicRow, getRhsOffset())) - + (restrictToNonNegative ? 0 : mostNegative); + if (basicRow != null) { + for (int j = getNumObjectiveFunctions(); j < getNumObjectiveFunctions() + i; j++) { + if (tableau.getEntry(basicRow, j) == 1) { + coefficients[i] = 0; + } + } + } + } + return new RealPointValuePair(coefficients, f.getValue(coefficients)); + } +"," protected RealPointValuePair getSolution() { + double[] coefficients = new double[getOriginalNumDecisionVariables()]; + Integer basicRow = + getBasicRow(getNumObjectiveFunctions() + getOriginalNumDecisionVariables()); + double mostNegative = basicRow == null ? 0 : getEntry(basicRow, getRhsOffset()); + Set basicRows = new HashSet(); + for (int i = 0; i < coefficients.length; i++) { + basicRow = getBasicRow(getNumObjectiveFunctions() + i); + if (basicRows.contains(basicRow)) { + coefficients[i] = 0; + } else { + basicRows.add(basicRow); + coefficients[i] = + (basicRow == null ? 0 : getEntry(basicRow, getRhsOffset())) - + (restrictToNonNegative ? 0 : mostNegative); + } + } + return new RealPointValuePair(coefficients, f.getValue(coefficients)); + } +" +Closure-91," public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { + if (n.getType() == Token.FUNCTION) { + JSDocInfo jsDoc = getFunctionJsDocInfo(n); + if (jsDoc != null && + (jsDoc.isConstructor() || + jsDoc.isInterface() || + jsDoc.hasThisType() || + jsDoc.isOverride())) { + return false; + } + int pType = parent.getType(); + if (!(pType == Token.BLOCK || + pType == Token.SCRIPT || + pType == Token.NAME || + pType == Token.ASSIGN || + pType == Token.STRING || + pType == Token.NUMBER)) { + return false; + } + } + if (parent != null && parent.getType() == Token.ASSIGN) { + Node lhs = parent.getFirstChild(); + Node rhs = lhs.getNext(); + if (n == lhs) { + if (assignLhsChild == null) { + assignLhsChild = lhs; + } + } else { + if (NodeUtil.isGet(lhs)) { + if (lhs.getType() == Token.GETPROP && + lhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + Node llhs = lhs.getFirstChild(); + if (llhs.getType() == Token.GETPROP && + llhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + } + } + } + return true; + } +"," public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) { + if (n.getType() == Token.FUNCTION) { + JSDocInfo jsDoc = getFunctionJsDocInfo(n); + if (jsDoc != null && + (jsDoc.isConstructor() || + jsDoc.isInterface() || + jsDoc.hasThisType() || + jsDoc.isOverride())) { + return false; + } + int pType = parent.getType(); + if (!(pType == Token.BLOCK || + pType == Token.SCRIPT || + pType == Token.NAME || + pType == Token.ASSIGN || + pType == Token.STRING || + pType == Token.NUMBER)) { + return false; + } + Node gramps = parent.getParent(); + if (NodeUtil.isObjectLitKey(parent, gramps)) { + JSDocInfo maybeLends = gramps.getJSDocInfo(); + if (maybeLends != null && + maybeLends.getLendsName() != null && + maybeLends.getLendsName().endsWith("".prototype"")) { + return false; + } + } + } + if (parent != null && parent.getType() == Token.ASSIGN) { + Node lhs = parent.getFirstChild(); + Node rhs = lhs.getNext(); + if (n == lhs) { + if (assignLhsChild == null) { + assignLhsChild = lhs; + } + } else { + if (NodeUtil.isGet(lhs)) { + if (lhs.getType() == Token.GETPROP && + lhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + Node llhs = lhs.getFirstChild(); + if (llhs.getType() == Token.GETPROP && + llhs.getLastChild().getString().equals(""prototype"")) { + return false; + } + } + } + } + return true; + } +" +Closure-113," private void processRequireCall(NodeTraversal t, Node n, Node parent) { + Node left = n.getFirstChild(); + Node arg = left.getNext(); + if (verifyLastArgumentIsString(t, left, arg)) { + String ns = arg.getString(); + ProvidedName provided = providedNames.get(ns); + if (provided == null || !provided.isExplicitlyProvided()) { + unrecognizedRequires.add( + new UnrecognizedRequire(n, ns, t.getSourceName())); + } else { + JSModule providedModule = provided.explicitModule; + Preconditions.checkNotNull(providedModule); + JSModule module = t.getModule(); + if (moduleGraph != null && + module != providedModule && + !moduleGraph.dependsOn(module, providedModule)) { + compiler.report( + t.makeError(n, XMODULE_REQUIRE_ERROR, ns, + providedModule.getName(), + module.getName())); + } + } + maybeAddToSymbolTable(left); + maybeAddStringNodeToSymbolTable(arg); + if (provided != null) { + parent.detachFromParent(); + compiler.reportCodeChange(); + } + } + } +"," private void processRequireCall(NodeTraversal t, Node n, Node parent) { + Node left = n.getFirstChild(); + Node arg = left.getNext(); + if (verifyLastArgumentIsString(t, left, arg)) { + String ns = arg.getString(); + ProvidedName provided = providedNames.get(ns); + if (provided == null || !provided.isExplicitlyProvided()) { + unrecognizedRequires.add( + new UnrecognizedRequire(n, ns, t.getSourceName())); + } else { + JSModule providedModule = provided.explicitModule; + Preconditions.checkNotNull(providedModule); + JSModule module = t.getModule(); + if (moduleGraph != null && + module != providedModule && + !moduleGraph.dependsOn(module, providedModule)) { + compiler.report( + t.makeError(n, XMODULE_REQUIRE_ERROR, ns, + providedModule.getName(), + module.getName())); + } + } + maybeAddToSymbolTable(left); + maybeAddStringNodeToSymbolTable(arg); + if (provided != null || requiresLevel.isOn()) { + parent.detachFromParent(); + compiler.reportCodeChange(); + } + } + } +" +Closure-111," protected JSType caseTopType(JSType topType) { + return topType; + } +"," protected JSType caseTopType(JSType topType) { + return topType.isAllType() ? + getNativeType(ARRAY_TYPE) : topType; + } +" +Closure-12," private boolean hasExceptionHandler(Node cfgNode) { + return false; + } +"," private boolean hasExceptionHandler(Node cfgNode) { + List> branchEdges = getCfg().getOutEdges(cfgNode); + for (DiGraphEdge edge : branchEdges) { + if (edge.getValue() == Branch.ON_EX) { + return true; + } + } + return false; + } +" +Jsoup-70," static boolean preserveWhitespace(Node node) { + if (node != null && node instanceof Element) { + Element el = (Element) node; + if (el.tag.preserveWhitespace()) + return true; + else + return el.parent() != null && el.parent().tag.preserveWhitespace(); + } + return false; + } +"," static boolean preserveWhitespace(Node node) { + if (node != null && node instanceof Element) { + Element el = (Element) node; + int i = 0; + do { + if (el.tag.preserveWhitespace()) + return true; + el = el.parent(); + i++; + } while (i < 6 && el != null); + } + return false; + } +" +Closure-66," public void visit(NodeTraversal t, Node n, Node parent) { + JSType childType; + JSType leftType, rightType; + Node left, right; + boolean typeable = true; + switch (n.getType()) { + case Token.NAME: + typeable = visitName(t, n, parent); + break; + case Token.LP: + if (parent.getType() != Token.FUNCTION) { + ensureTyped(t, n, getJSType(n.getFirstChild())); + } else { + typeable = false; + } + break; + case Token.COMMA: + ensureTyped(t, n, getJSType(n.getLastChild())); + break; + case Token.TRUE: + case Token.FALSE: + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.THIS: + ensureTyped(t, n, t.getScope().getTypeOfThis()); + break; + case Token.REF_SPECIAL: + ensureTyped(t, n); + break; + case Token.GET_REF: + ensureTyped(t, n, getJSType(n.getFirstChild())); + break; + case Token.NULL: + ensureTyped(t, n, NULL_TYPE); + break; + case Token.NUMBER: + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.STRING: + if (!NodeUtil.isObjectLitKey(n, n.getParent())) { + ensureTyped(t, n, STRING_TYPE); + } + break; + case Token.GET: + case Token.SET: + break; + case Token.ARRAYLIT: + ensureTyped(t, n, ARRAY_TYPE); + break; + case Token.REGEXP: + ensureTyped(t, n, REGEXP_TYPE); + break; + case Token.GETPROP: + visitGetProp(t, n, parent); + typeable = !(parent.getType() == Token.ASSIGN && + parent.getFirstChild() == n); + break; + case Token.GETELEM: + visitGetElem(t, n); + typeable = false; + break; + case Token.VAR: + visitVar(t, n); + typeable = false; + break; + case Token.NEW: + visitNew(t, n); + typeable = true; + break; + case Token.CALL: + visitCall(t, n); + typeable = !NodeUtil.isExpressionNode(parent); + break; + case Token.RETURN: + visitReturn(t, n); + typeable = false; + break; + case Token.DEC: + case Token.INC: + left = n.getFirstChild(); + validator.expectNumber( + t, left, getJSType(left), ""increment/decrement""); + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.NOT: + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.VOID: + ensureTyped(t, n, VOID_TYPE); + break; + case Token.TYPEOF: + ensureTyped(t, n, STRING_TYPE); + break; + case Token.BITNOT: + childType = getJSType(n.getFirstChild()); + if (!childType.matchesInt32Context()) { + report(t, n, BIT_OPERATION, NodeUtil.opToStr(n.getType()), + childType.toString()); + } + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.POS: + case Token.NEG: + left = n.getFirstChild(); + validator.expectNumber(t, left, getJSType(left), ""sign operator""); + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.EQ: + case Token.NE: { + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + JSType leftTypeRestricted = leftType.restrictByNotNullOrUndefined(); + JSType rightTypeRestricted = rightType.restrictByNotNullOrUndefined(); + TernaryValue result = + leftTypeRestricted.testForEquality(rightTypeRestricted); + if (result != TernaryValue.UNKNOWN) { + if (n.getType() == Token.NE) { + result = result.not(); + } + report(t, n, DETERMINISTIC_TEST, leftType.toString(), + rightType.toString(), result.toString()); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + } + case Token.SHEQ: + case Token.SHNE: { + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + JSType leftTypeRestricted = leftType.restrictByNotNullOrUndefined(); + JSType rightTypeRestricted = rightType.restrictByNotNullOrUndefined(); + if (!leftTypeRestricted.canTestForShallowEqualityWith( + rightTypeRestricted)) { + report(t, n, DETERMINISTIC_TEST_NO_RESULT, leftType.toString(), + rightType.toString()); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + } + case Token.LT: + case Token.LE: + case Token.GT: + case Token.GE: + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + if (rightType.isNumber()) { + validator.expectNumber( + t, n, leftType, ""left side of numeric comparison""); + } else if (leftType.isNumber()) { + validator.expectNumber( + t, n, rightType, ""right side of numeric comparison""); + } else if (leftType.matchesNumberContext() && + rightType.matchesNumberContext()) { + } else { + String message = ""left side of comparison""; + validator.expectString(t, n, leftType, message); + validator.expectNotNullOrUndefined( + t, n, leftType, message, getNativeType(STRING_TYPE)); + message = ""right side of comparison""; + validator.expectString(t, n, rightType, message); + validator.expectNotNullOrUndefined( + t, n, rightType, message, getNativeType(STRING_TYPE)); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.IN: + left = n.getFirstChild(); + right = n.getLastChild(); + leftType = getJSType(left); + rightType = getJSType(right); + validator.expectObject(t, n, rightType, ""'in' requires an object""); + validator.expectString(t, left, leftType, ""left side of 'in'""); + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.INSTANCEOF: + left = n.getFirstChild(); + right = n.getLastChild(); + leftType = getJSType(left); + rightType = getJSType(right).restrictByNotNullOrUndefined(); + validator.expectAnyObject( + t, left, leftType, ""deterministic instanceof yields false""); + validator.expectActualObject( + t, right, rightType, ""instanceof requires an object""); + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.ASSIGN: + visitAssign(t, n); + typeable = false; + break; + case Token.ASSIGN_LSH: + case Token.ASSIGN_RSH: + case Token.ASSIGN_URSH: + case Token.ASSIGN_DIV: + case Token.ASSIGN_MOD: + case Token.ASSIGN_BITOR: + case Token.ASSIGN_BITXOR: + case Token.ASSIGN_BITAND: + case Token.ASSIGN_SUB: + case Token.ASSIGN_ADD: + case Token.ASSIGN_MUL: + case Token.LSH: + case Token.RSH: + case Token.URSH: + case Token.DIV: + case Token.MOD: + case Token.BITOR: + case Token.BITXOR: + case Token.BITAND: + case Token.SUB: + case Token.ADD: + case Token.MUL: + visitBinaryOperator(n.getType(), t, n); + break; + case Token.DELPROP: + if (!isReference(n.getFirstChild())) { + report(t, n, BAD_DELETE); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.CASE: + JSType switchType = getJSType(parent.getFirstChild()); + JSType caseType = getJSType(n.getFirstChild()); + validator.expectSwitchMatchesCase(t, n, switchType, caseType); + typeable = false; + break; + case Token.WITH: { + Node child = n.getFirstChild(); + childType = getJSType(child); + validator.expectObject( + t, child, childType, ""with requires an object""); + typeable = false; + break; + } + case Token.FUNCTION: + visitFunction(t, n); + break; + case Token.LABEL: + case Token.LABEL_NAME: + case Token.SWITCH: + case Token.BREAK: + case Token.CATCH: + case Token.TRY: + case Token.SCRIPT: + case Token.EXPR_RESULT: + case Token.BLOCK: + case Token.EMPTY: + case Token.DEFAULT: + case Token.CONTINUE: + case Token.DEBUGGER: + case Token.THROW: + typeable = false; + break; + case Token.DO: + case Token.FOR: + case Token.IF: + case Token.WHILE: + typeable = false; + break; + case Token.AND: + case Token.HOOK: + case Token.OBJECTLIT: + case Token.OR: + if (n.getJSType() != null) { + ensureTyped(t, n); + } else { + if ((n.getType() == Token.OBJECTLIT) + && (parent.getJSType() instanceof EnumType)) { + ensureTyped(t, n, parent.getJSType()); + } else { + ensureTyped(t, n); + } + } + if (n.getType() == Token.OBJECTLIT) { + for (Node key : n.children()) { + visitObjLitKey(t, key, n); + } + } + break; + default: + report(t, n, UNEXPECTED_TOKEN, Token.name(n.getType())); + ensureTyped(t, n); + break; + } + typeable = typeable && !inExterns; + if (typeable) { + doPercentTypedAccounting(t, n); + } + checkNoTypeCheckSection(n, false); + } +"," public void visit(NodeTraversal t, Node n, Node parent) { + JSType childType; + JSType leftType, rightType; + Node left, right; + boolean typeable = true; + switch (n.getType()) { + case Token.NAME: + typeable = visitName(t, n, parent); + break; + case Token.LP: + if (parent.getType() != Token.FUNCTION) { + ensureTyped(t, n, getJSType(n.getFirstChild())); + } else { + typeable = false; + } + break; + case Token.COMMA: + ensureTyped(t, n, getJSType(n.getLastChild())); + break; + case Token.TRUE: + case Token.FALSE: + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.THIS: + ensureTyped(t, n, t.getScope().getTypeOfThis()); + break; + case Token.REF_SPECIAL: + ensureTyped(t, n); + break; + case Token.GET_REF: + ensureTyped(t, n, getJSType(n.getFirstChild())); + break; + case Token.NULL: + ensureTyped(t, n, NULL_TYPE); + break; + case Token.NUMBER: + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.STRING: + if (!NodeUtil.isObjectLitKey(n, n.getParent())) { + ensureTyped(t, n, STRING_TYPE); + } else { + typeable = false; + } + break; + case Token.GET: + case Token.SET: + break; + case Token.ARRAYLIT: + ensureTyped(t, n, ARRAY_TYPE); + break; + case Token.REGEXP: + ensureTyped(t, n, REGEXP_TYPE); + break; + case Token.GETPROP: + visitGetProp(t, n, parent); + typeable = !(parent.getType() == Token.ASSIGN && + parent.getFirstChild() == n); + break; + case Token.GETELEM: + visitGetElem(t, n); + typeable = false; + break; + case Token.VAR: + visitVar(t, n); + typeable = false; + break; + case Token.NEW: + visitNew(t, n); + typeable = true; + break; + case Token.CALL: + visitCall(t, n); + typeable = !NodeUtil.isExpressionNode(parent); + break; + case Token.RETURN: + visitReturn(t, n); + typeable = false; + break; + case Token.DEC: + case Token.INC: + left = n.getFirstChild(); + validator.expectNumber( + t, left, getJSType(left), ""increment/decrement""); + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.NOT: + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.VOID: + ensureTyped(t, n, VOID_TYPE); + break; + case Token.TYPEOF: + ensureTyped(t, n, STRING_TYPE); + break; + case Token.BITNOT: + childType = getJSType(n.getFirstChild()); + if (!childType.matchesInt32Context()) { + report(t, n, BIT_OPERATION, NodeUtil.opToStr(n.getType()), + childType.toString()); + } + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.POS: + case Token.NEG: + left = n.getFirstChild(); + validator.expectNumber(t, left, getJSType(left), ""sign operator""); + ensureTyped(t, n, NUMBER_TYPE); + break; + case Token.EQ: + case Token.NE: { + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + JSType leftTypeRestricted = leftType.restrictByNotNullOrUndefined(); + JSType rightTypeRestricted = rightType.restrictByNotNullOrUndefined(); + TernaryValue result = + leftTypeRestricted.testForEquality(rightTypeRestricted); + if (result != TernaryValue.UNKNOWN) { + if (n.getType() == Token.NE) { + result = result.not(); + } + report(t, n, DETERMINISTIC_TEST, leftType.toString(), + rightType.toString(), result.toString()); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + } + case Token.SHEQ: + case Token.SHNE: { + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + JSType leftTypeRestricted = leftType.restrictByNotNullOrUndefined(); + JSType rightTypeRestricted = rightType.restrictByNotNullOrUndefined(); + if (!leftTypeRestricted.canTestForShallowEqualityWith( + rightTypeRestricted)) { + report(t, n, DETERMINISTIC_TEST_NO_RESULT, leftType.toString(), + rightType.toString()); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + } + case Token.LT: + case Token.LE: + case Token.GT: + case Token.GE: + leftType = getJSType(n.getFirstChild()); + rightType = getJSType(n.getLastChild()); + if (rightType.isNumber()) { + validator.expectNumber( + t, n, leftType, ""left side of numeric comparison""); + } else if (leftType.isNumber()) { + validator.expectNumber( + t, n, rightType, ""right side of numeric comparison""); + } else if (leftType.matchesNumberContext() && + rightType.matchesNumberContext()) { + } else { + String message = ""left side of comparison""; + validator.expectString(t, n, leftType, message); + validator.expectNotNullOrUndefined( + t, n, leftType, message, getNativeType(STRING_TYPE)); + message = ""right side of comparison""; + validator.expectString(t, n, rightType, message); + validator.expectNotNullOrUndefined( + t, n, rightType, message, getNativeType(STRING_TYPE)); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.IN: + left = n.getFirstChild(); + right = n.getLastChild(); + leftType = getJSType(left); + rightType = getJSType(right); + validator.expectObject(t, n, rightType, ""'in' requires an object""); + validator.expectString(t, left, leftType, ""left side of 'in'""); + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.INSTANCEOF: + left = n.getFirstChild(); + right = n.getLastChild(); + leftType = getJSType(left); + rightType = getJSType(right).restrictByNotNullOrUndefined(); + validator.expectAnyObject( + t, left, leftType, ""deterministic instanceof yields false""); + validator.expectActualObject( + t, right, rightType, ""instanceof requires an object""); + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.ASSIGN: + visitAssign(t, n); + typeable = false; + break; + case Token.ASSIGN_LSH: + case Token.ASSIGN_RSH: + case Token.ASSIGN_URSH: + case Token.ASSIGN_DIV: + case Token.ASSIGN_MOD: + case Token.ASSIGN_BITOR: + case Token.ASSIGN_BITXOR: + case Token.ASSIGN_BITAND: + case Token.ASSIGN_SUB: + case Token.ASSIGN_ADD: + case Token.ASSIGN_MUL: + case Token.LSH: + case Token.RSH: + case Token.URSH: + case Token.DIV: + case Token.MOD: + case Token.BITOR: + case Token.BITXOR: + case Token.BITAND: + case Token.SUB: + case Token.ADD: + case Token.MUL: + visitBinaryOperator(n.getType(), t, n); + break; + case Token.DELPROP: + if (!isReference(n.getFirstChild())) { + report(t, n, BAD_DELETE); + } + ensureTyped(t, n, BOOLEAN_TYPE); + break; + case Token.CASE: + JSType switchType = getJSType(parent.getFirstChild()); + JSType caseType = getJSType(n.getFirstChild()); + validator.expectSwitchMatchesCase(t, n, switchType, caseType); + typeable = false; + break; + case Token.WITH: { + Node child = n.getFirstChild(); + childType = getJSType(child); + validator.expectObject( + t, child, childType, ""with requires an object""); + typeable = false; + break; + } + case Token.FUNCTION: + visitFunction(t, n); + break; + case Token.LABEL: + case Token.LABEL_NAME: + case Token.SWITCH: + case Token.BREAK: + case Token.CATCH: + case Token.TRY: + case Token.SCRIPT: + case Token.EXPR_RESULT: + case Token.BLOCK: + case Token.EMPTY: + case Token.DEFAULT: + case Token.CONTINUE: + case Token.DEBUGGER: + case Token.THROW: + typeable = false; + break; + case Token.DO: + case Token.FOR: + case Token.IF: + case Token.WHILE: + typeable = false; + break; + case Token.AND: + case Token.HOOK: + case Token.OBJECTLIT: + case Token.OR: + if (n.getJSType() != null) { + ensureTyped(t, n); + } else { + if ((n.getType() == Token.OBJECTLIT) + && (parent.getJSType() instanceof EnumType)) { + ensureTyped(t, n, parent.getJSType()); + } else { + ensureTyped(t, n); + } + } + if (n.getType() == Token.OBJECTLIT) { + for (Node key : n.children()) { + visitObjLitKey(t, key, n); + } + } + break; + default: + report(t, n, UNEXPECTED_TOKEN, Token.name(n.getType())); + ensureTyped(t, n); + break; + } + typeable = typeable && !inExterns; + if (typeable) { + doPercentTypedAccounting(t, n); + } + checkNoTypeCheckSection(n, false); + } +" +Closure-23," private Node tryFoldArrayAccess(Node n, Node left, Node right) { + Node parent = n.getParent(); + if (isAssignmentTarget(n)) { + return n; + } + if (!right.isNumber()) { + return n; + } + double index = right.getDouble(); + int intIndex = (int) index; + if (intIndex != index) { + error(INVALID_GETELEM_INDEX_ERROR, right); + return n; + } + if (intIndex < 0) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + Node current = left.getFirstChild(); + Node elem = null; + for (int i = 0; current != null && i < intIndex; i++) { + elem = current; + current = current.getNext(); + } + if (elem == null) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + if (elem.isEmpty()) { + elem = NodeUtil.newUndefinedNode(elem); + } else { + left.removeChild(elem); + } + n.getParent().replaceChild(n, elem); + reportCodeChange(); + return elem; + } +"," private Node tryFoldArrayAccess(Node n, Node left, Node right) { + Node parent = n.getParent(); + if (isAssignmentTarget(n)) { + return n; + } + if (!right.isNumber()) { + return n; + } + double index = right.getDouble(); + int intIndex = (int) index; + if (intIndex != index) { + error(INVALID_GETELEM_INDEX_ERROR, right); + return n; + } + if (intIndex < 0) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + Node current = left.getFirstChild(); + Node elem = null; + for (int i = 0; current != null; i++) { + if (i != intIndex) { + if (mayHaveSideEffects(current)) { + return n; + } + } else { + elem = current; + } + current = current.getNext(); + } + if (elem == null) { + error(INDEX_OUT_OF_BOUNDS_ERROR, right); + return n; + } + if (elem.isEmpty()) { + elem = NodeUtil.newUndefinedNode(elem); + } else { + left.removeChild(elem); + } + n.getParent().replaceChild(n, elem); + reportCodeChange(); + return elem; + } +"