repo
stringclasses
11 values
path
stringlengths
41
214
func_name
stringlengths
7
82
original_string
stringlengths
77
11.9k
language
stringclasses
1 value
code
stringlengths
77
11.9k
code_tokens
listlengths
22
1.57k
docstring
stringlengths
2
2.27k
docstring_tokens
listlengths
1
352
sha
stringclasses
11 values
url
stringlengths
129
319
partition
stringclasses
1 value
summary
stringlengths
7
191
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.findMultipartDisposition
private InterfaceHttpData findMultipartDisposition() { int readerIndex = undecodedChunk.readerIndex(); if (currentStatus == MultiPartStatus.DISPOSITION) { currentFieldAttributes = new TreeMap<CharSequence, Attribute>(CaseIgnoringComparator.INSTANCE); } // read many lines until empty line with newline found! Store all data while (!skipOneLine()) { String newline; try { skipControlCharacters(undecodedChunk); newline = readLine(undecodedChunk, charset); } catch (NotEnoughDataDecoderException ignored) { undecodedChunk.readerIndex(readerIndex); return null; } String[] contents = splitMultipartHeader(newline); if (HttpHeaderNames.CONTENT_DISPOSITION.contentEqualsIgnoreCase(contents[0])) { boolean checkSecondArg; if (currentStatus == MultiPartStatus.DISPOSITION) { checkSecondArg = HttpHeaderValues.FORM_DATA.contentEqualsIgnoreCase(contents[1]); } else { checkSecondArg = HttpHeaderValues.ATTACHMENT.contentEqualsIgnoreCase(contents[1]) || HttpHeaderValues.FILE.contentEqualsIgnoreCase(contents[1]); } if (checkSecondArg) { // read next values and store them in the map as Attribute for (int i = 2; i < contents.length; i++) { String[] values = contents[i].split("=", 2); Attribute attribute; try { attribute = getContentDispositionAttribute(values); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(attribute.getName(), attribute); } } } else if (HttpHeaderNames.CONTENT_TRANSFER_ENCODING.contentEqualsIgnoreCase(contents[0])) { Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_TRANSFER_ENCODING.toString(), cleanString(contents[1])); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderNames.CONTENT_TRANSFER_ENCODING, attribute); } else if (HttpHeaderNames.CONTENT_LENGTH.contentEqualsIgnoreCase(contents[0])) { Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_LENGTH.toString(), cleanString(contents[1])); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderNames.CONTENT_LENGTH, attribute); } else if (HttpHeaderNames.CONTENT_TYPE.contentEqualsIgnoreCase(contents[0])) { // Take care of possible "multipart/mixed" if (HttpHeaderValues.MULTIPART_MIXED.contentEqualsIgnoreCase(contents[1])) { if (currentStatus == MultiPartStatus.DISPOSITION) { String values = StringUtil.substringAfter(contents[2], '='); multipartMixedBoundary = "--" + values; currentStatus = MultiPartStatus.MIXEDDELIMITER; return decodeMultipart(MultiPartStatus.MIXEDDELIMITER); } else { throw new ErrorDataDecoderException("Mixed Multipart found in a previous Mixed Multipart"); } } else { for (int i = 1; i < contents.length; i++) { final String charsetHeader = HttpHeaderValues.CHARSET.toString(); if (contents[i].regionMatches(true, 0, charsetHeader, 0, charsetHeader.length())) { String values = StringUtil.substringAfter(contents[i], '='); Attribute attribute; try { attribute = factory.createAttribute(request, charsetHeader, cleanString(values)); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderValues.CHARSET, attribute); } else { Attribute attribute; try { attribute = factory.createAttribute(request, cleanString(contents[0]), contents[i]); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(attribute.getName(), attribute); } } } } else { throw new ErrorDataDecoderException("Unknown Params: " + newline); } } // Is it a FileUpload Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME); if (currentStatus == MultiPartStatus.DISPOSITION) { if (filenameAttribute != null) { // FileUpload currentStatus = MultiPartStatus.FILEUPLOAD; // do not change the buffer position return decodeMultipart(MultiPartStatus.FILEUPLOAD); } else { // Field currentStatus = MultiPartStatus.FIELD; // do not change the buffer position return decodeMultipart(MultiPartStatus.FIELD); } } else { if (filenameAttribute != null) { // FileUpload currentStatus = MultiPartStatus.MIXEDFILEUPLOAD; // do not change the buffer position return decodeMultipart(MultiPartStatus.MIXEDFILEUPLOAD); } else { // Field is not supported in MIXED mode throw new ErrorDataDecoderException("Filename not found"); } } }
java
private InterfaceHttpData findMultipartDisposition() { int readerIndex = undecodedChunk.readerIndex(); if (currentStatus == MultiPartStatus.DISPOSITION) { currentFieldAttributes = new TreeMap<CharSequence, Attribute>(CaseIgnoringComparator.INSTANCE); } // read many lines until empty line with newline found! Store all data while (!skipOneLine()) { String newline; try { skipControlCharacters(undecodedChunk); newline = readLine(undecodedChunk, charset); } catch (NotEnoughDataDecoderException ignored) { undecodedChunk.readerIndex(readerIndex); return null; } String[] contents = splitMultipartHeader(newline); if (HttpHeaderNames.CONTENT_DISPOSITION.contentEqualsIgnoreCase(contents[0])) { boolean checkSecondArg; if (currentStatus == MultiPartStatus.DISPOSITION) { checkSecondArg = HttpHeaderValues.FORM_DATA.contentEqualsIgnoreCase(contents[1]); } else { checkSecondArg = HttpHeaderValues.ATTACHMENT.contentEqualsIgnoreCase(contents[1]) || HttpHeaderValues.FILE.contentEqualsIgnoreCase(contents[1]); } if (checkSecondArg) { // read next values and store them in the map as Attribute for (int i = 2; i < contents.length; i++) { String[] values = contents[i].split("=", 2); Attribute attribute; try { attribute = getContentDispositionAttribute(values); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(attribute.getName(), attribute); } } } else if (HttpHeaderNames.CONTENT_TRANSFER_ENCODING.contentEqualsIgnoreCase(contents[0])) { Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_TRANSFER_ENCODING.toString(), cleanString(contents[1])); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderNames.CONTENT_TRANSFER_ENCODING, attribute); } else if (HttpHeaderNames.CONTENT_LENGTH.contentEqualsIgnoreCase(contents[0])) { Attribute attribute; try { attribute = factory.createAttribute(request, HttpHeaderNames.CONTENT_LENGTH.toString(), cleanString(contents[1])); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderNames.CONTENT_LENGTH, attribute); } else if (HttpHeaderNames.CONTENT_TYPE.contentEqualsIgnoreCase(contents[0])) { // Take care of possible "multipart/mixed" if (HttpHeaderValues.MULTIPART_MIXED.contentEqualsIgnoreCase(contents[1])) { if (currentStatus == MultiPartStatus.DISPOSITION) { String values = StringUtil.substringAfter(contents[2], '='); multipartMixedBoundary = "--" + values; currentStatus = MultiPartStatus.MIXEDDELIMITER; return decodeMultipart(MultiPartStatus.MIXEDDELIMITER); } else { throw new ErrorDataDecoderException("Mixed Multipart found in a previous Mixed Multipart"); } } else { for (int i = 1; i < contents.length; i++) { final String charsetHeader = HttpHeaderValues.CHARSET.toString(); if (contents[i].regionMatches(true, 0, charsetHeader, 0, charsetHeader.length())) { String values = StringUtil.substringAfter(contents[i], '='); Attribute attribute; try { attribute = factory.createAttribute(request, charsetHeader, cleanString(values)); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(HttpHeaderValues.CHARSET, attribute); } else { Attribute attribute; try { attribute = factory.createAttribute(request, cleanString(contents[0]), contents[i]); } catch (NullPointerException e) { throw new ErrorDataDecoderException(e); } catch (IllegalArgumentException e) { throw new ErrorDataDecoderException(e); } currentFieldAttributes.put(attribute.getName(), attribute); } } } } else { throw new ErrorDataDecoderException("Unknown Params: " + newline); } } // Is it a FileUpload Attribute filenameAttribute = currentFieldAttributes.get(HttpHeaderValues.FILENAME); if (currentStatus == MultiPartStatus.DISPOSITION) { if (filenameAttribute != null) { // FileUpload currentStatus = MultiPartStatus.FILEUPLOAD; // do not change the buffer position return decodeMultipart(MultiPartStatus.FILEUPLOAD); } else { // Field currentStatus = MultiPartStatus.FIELD; // do not change the buffer position return decodeMultipart(MultiPartStatus.FIELD); } } else { if (filenameAttribute != null) { // FileUpload currentStatus = MultiPartStatus.MIXEDFILEUPLOAD; // do not change the buffer position return decodeMultipart(MultiPartStatus.MIXEDFILEUPLOAD); } else { // Field is not supported in MIXED mode throw new ErrorDataDecoderException("Filename not found"); } } }
[ "private", "InterfaceHttpData", "findMultipartDisposition", "(", ")", "{", "int", "readerIndex", "=", "undecodedChunk", ".", "readerIndex", "(", ")", ";", "if", "(", "currentStatus", "==", "MultiPartStatus", ".", "DISPOSITION", ")", "{", "currentFieldAttributes", "=...
Find the next Disposition @return the next InterfaceHttpData if any @throws ErrorDataDecoderException
[ "Find", "the", "next", "Disposition" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L665-L796
train
Find the multipart disposition.
[ 30522, 2797, 8278, 11039, 25856, 2850, 2696, 2424, 12274, 7096, 11514, 8445, 10521, 26994, 1006, 1007, 1063, 20014, 8068, 22254, 10288, 1027, 6151, 8586, 10244, 16409, 17157, 2243, 1012, 8068, 22254, 10288, 1006, 1007, 1025, 2065, 1006, 14731...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java
BarrierBuffer.releaseBlocksAndResetBarriers
private void releaseBlocksAndResetBarriers() throws IOException { LOG.debug("{}: End of stream alignment, feeding buffered data back.", inputGate.getOwningTaskName()); for (int i = 0; i < blockedChannels.length; i++) { blockedChannels[i] = false; } if (currentBuffered == null) { // common case: no more buffered data currentBuffered = bufferBlocker.rollOverReusingResources(); if (currentBuffered != null) { currentBuffered.open(); } } else { // uncommon case: buffered data pending // push back the pending data, if we have any LOG.debug("{}: Checkpoint skipped via buffered data:" + "Pushing back current alignment buffers and feeding back new alignment data first.", inputGate.getOwningTaskName()); // since we did not fully drain the previous sequence, we need to allocate a new buffer for this one BufferOrEventSequence bufferedNow = bufferBlocker.rollOverWithoutReusingResources(); if (bufferedNow != null) { bufferedNow.open(); queuedBuffered.addFirst(currentBuffered); numQueuedBytes += currentBuffered.size(); currentBuffered = bufferedNow; } } if (LOG.isDebugEnabled()) { LOG.debug("{}: Size of buffered data: {} bytes", inputGate.getOwningTaskName(), currentBuffered == null ? 0L : currentBuffered.size()); } // the next barrier that comes must assume it is the first numBarriersReceived = 0; if (startOfAlignmentTimestamp > 0) { latestAlignmentDurationNanos = System.nanoTime() - startOfAlignmentTimestamp; startOfAlignmentTimestamp = 0; } }
java
private void releaseBlocksAndResetBarriers() throws IOException { LOG.debug("{}: End of stream alignment, feeding buffered data back.", inputGate.getOwningTaskName()); for (int i = 0; i < blockedChannels.length; i++) { blockedChannels[i] = false; } if (currentBuffered == null) { // common case: no more buffered data currentBuffered = bufferBlocker.rollOverReusingResources(); if (currentBuffered != null) { currentBuffered.open(); } } else { // uncommon case: buffered data pending // push back the pending data, if we have any LOG.debug("{}: Checkpoint skipped via buffered data:" + "Pushing back current alignment buffers and feeding back new alignment data first.", inputGate.getOwningTaskName()); // since we did not fully drain the previous sequence, we need to allocate a new buffer for this one BufferOrEventSequence bufferedNow = bufferBlocker.rollOverWithoutReusingResources(); if (bufferedNow != null) { bufferedNow.open(); queuedBuffered.addFirst(currentBuffered); numQueuedBytes += currentBuffered.size(); currentBuffered = bufferedNow; } } if (LOG.isDebugEnabled()) { LOG.debug("{}: Size of buffered data: {} bytes", inputGate.getOwningTaskName(), currentBuffered == null ? 0L : currentBuffered.size()); } // the next barrier that comes must assume it is the first numBarriersReceived = 0; if (startOfAlignmentTimestamp > 0) { latestAlignmentDurationNanos = System.nanoTime() - startOfAlignmentTimestamp; startOfAlignmentTimestamp = 0; } }
[ "private", "void", "releaseBlocksAndResetBarriers", "(", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"{}: End of stream alignment, feeding buffered data back.\"", ",", "inputGate", ".", "getOwningTaskName", "(", ")", ")", ";", "for", "(", "int", "i"...
Releases the blocks on all channels and resets the barrier count. Makes sure the just written data is the next to be consumed.
[ "Releases", "the", "blocks", "on", "all", "channels", "and", "resets", "the", "barrier", "count", ".", "Makes", "sure", "the", "just", "written", "data", "is", "the", "next", "to", "be", "consumed", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/BarrierBuffer.java#L503-L548
train
Releases the blocks and resets the barrier counters.
[ 30522, 2797, 11675, 2713, 23467, 8791, 16200, 13462, 8237, 16252, 2015, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 8833, 1012, 2139, 8569, 2290, 1006, 1000, 1063, 1065, 1024, 2203, 1997, 5460, 12139, 1010, 8521, 17698, 2098, 2951, 2067, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/word2vec/Word2VecTrainer.java
Word2VecTrainer.train
public WordVectorModel train(String trainFileName, String modelFileName) { Config settings = new Config(); settings.setInputFile(trainFileName); settings.setLayer1Size(layerSize); settings.setUseContinuousBagOfWords(type == NeuralNetworkType.CBOW); settings.setUseHierarchicalSoftmax(useHierarchicalSoftmax); settings.setNegative(negativeSamples); settings.setNumThreads(numThreads); settings.setAlpha(initialLearningRate == null ? type.getDefaultInitialLearningRate() : initialLearningRate); settings.setSample(downSampleRate); settings.setWindow(windowSize); settings.setIter(iterations); settings.setMinCount(minFrequency); settings.setOutputFile(modelFileName); Word2VecTraining model = new Word2VecTraining(settings); final long timeStart = System.currentTimeMillis(); // if (callback == null) // { // callback = new TrainingCallback() // { // public void corpusLoading(float percent) // { // System.out.printf("\r加载训练语料:%.2f%%", percent); // } // // public void corpusLoaded(int vocWords, int trainWords, int totalWords) // { // System.out.println(); // System.out.printf("词表大小:%d\n", vocWords); // System.out.printf("训练词数:%d\n", trainWords); // System.out.printf("语料词数:%d\n", totalWords); // } // // public void training(float alpha, float progress) // { // System.out.printf("\r学习率:%.6f 进度:%.2f%%", alpha, progress); // long timeNow = System.currentTimeMillis(); // long costTime = timeNow - timeStart + 1; // progress /= 100; // String etd = Utility.humanTime((long) (costTime / progress * (1.f - progress))); // if (etd.length() > 0) System.out.printf(" 剩余时间:%s", etd); // System.out.flush(); // } // }; // } settings.setCallback(callback); try { model.trainModel(); System.out.println(); System.out.printf("训练结束,一共耗时:%s\n", Utility.humanTime(System.currentTimeMillis() - timeStart)); return new WordVectorModel(modelFileName); } catch (IOException e) { logger.warning("训练过程中发生IO异常\n" + TextUtility.exceptionToString(e)); } return null; }
java
public WordVectorModel train(String trainFileName, String modelFileName) { Config settings = new Config(); settings.setInputFile(trainFileName); settings.setLayer1Size(layerSize); settings.setUseContinuousBagOfWords(type == NeuralNetworkType.CBOW); settings.setUseHierarchicalSoftmax(useHierarchicalSoftmax); settings.setNegative(negativeSamples); settings.setNumThreads(numThreads); settings.setAlpha(initialLearningRate == null ? type.getDefaultInitialLearningRate() : initialLearningRate); settings.setSample(downSampleRate); settings.setWindow(windowSize); settings.setIter(iterations); settings.setMinCount(minFrequency); settings.setOutputFile(modelFileName); Word2VecTraining model = new Word2VecTraining(settings); final long timeStart = System.currentTimeMillis(); // if (callback == null) // { // callback = new TrainingCallback() // { // public void corpusLoading(float percent) // { // System.out.printf("\r加载训练语料:%.2f%%", percent); // } // // public void corpusLoaded(int vocWords, int trainWords, int totalWords) // { // System.out.println(); // System.out.printf("词表大小:%d\n", vocWords); // System.out.printf("训练词数:%d\n", trainWords); // System.out.printf("语料词数:%d\n", totalWords); // } // // public void training(float alpha, float progress) // { // System.out.printf("\r学习率:%.6f 进度:%.2f%%", alpha, progress); // long timeNow = System.currentTimeMillis(); // long costTime = timeNow - timeStart + 1; // progress /= 100; // String etd = Utility.humanTime((long) (costTime / progress * (1.f - progress))); // if (etd.length() > 0) System.out.printf(" 剩余时间:%s", etd); // System.out.flush(); // } // }; // } settings.setCallback(callback); try { model.trainModel(); System.out.println(); System.out.printf("训练结束,一共耗时:%s\n", Utility.humanTime(System.currentTimeMillis() - timeStart)); return new WordVectorModel(modelFileName); } catch (IOException e) { logger.warning("训练过程中发生IO异常\n" + TextUtility.exceptionToString(e)); } return null; }
[ "public", "WordVectorModel", "train", "(", "String", "trainFileName", ",", "String", "modelFileName", ")", "{", "Config", "settings", "=", "new", "Config", "(", ")", ";", "settings", ".", "setInputFile", "(", "trainFileName", ")", ";", "settings", ".", "setLay...
执行训练 @param trainFileName 输入语料文件 @param modelFileName 输出模型路径 @return 词向量模型
[ "执行训练" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/Word2VecTrainer.java#L168-L229
train
Train a word vector model using the specified train file and model file name.
[ 30522, 2270, 2773, 3726, 16761, 5302, 9247, 3345, 1006, 5164, 3345, 8873, 20844, 4168, 1010, 5164, 2944, 8873, 20844, 4168, 1007, 1063, 9530, 8873, 2290, 10906, 1027, 2047, 9530, 8873, 2290, 1006, 1007, 1025, 10906, 1012, 2275, 2378, 18780,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java
HashCodeBuilder.reflectionHashCode
public static <T> int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final T object, final boolean testTransients, final Class<? super T> reflectUpToClass, final String... excludeFields) { if (object == null) { throw new IllegalArgumentException("The object to build a hash code for must not be null"); } final HashCodeBuilder builder = new HashCodeBuilder(initialNonZeroOddNumber, multiplierNonZeroOddNumber); Class<?> clazz = object.getClass(); reflectionAppend(object, clazz, builder, testTransients, excludeFields); while (clazz.getSuperclass() != null && clazz != reflectUpToClass) { clazz = clazz.getSuperclass(); reflectionAppend(object, clazz, builder, testTransients, excludeFields); } return builder.toHashCode(); }
java
public static <T> int reflectionHashCode(final int initialNonZeroOddNumber, final int multiplierNonZeroOddNumber, final T object, final boolean testTransients, final Class<? super T> reflectUpToClass, final String... excludeFields) { if (object == null) { throw new IllegalArgumentException("The object to build a hash code for must not be null"); } final HashCodeBuilder builder = new HashCodeBuilder(initialNonZeroOddNumber, multiplierNonZeroOddNumber); Class<?> clazz = object.getClass(); reflectionAppend(object, clazz, builder, testTransients, excludeFields); while (clazz.getSuperclass() != null && clazz != reflectUpToClass) { clazz = clazz.getSuperclass(); reflectionAppend(object, clazz, builder, testTransients, excludeFields); } return builder.toHashCode(); }
[ "public", "static", "<", "T", ">", "int", "reflectionHashCode", "(", "final", "int", "initialNonZeroOddNumber", ",", "final", "int", "multiplierNonZeroOddNumber", ",", "final", "T", "object", ",", "final", "boolean", "testTransients", ",", "final", "Class", "<", ...
<p> Uses reflection to build a valid hash code from the fields of {@code object}. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <p> If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>. </p> <p> Static fields will not be included. Superclass fields will be included up to and including the specified superclass. A null superclass is treated as java.lang.Object. </p> <p> Two randomly chosen, non-zero, odd numbers must be passed in. Ideally these should be different for each class, however this is not vital. Prime numbers are preferred, especially for the multiplier. </p> @param <T> the type of the object involved @param initialNonZeroOddNumber a non-zero, odd number used as the initial value. This will be the returned value if no fields are found to include in the hash code @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier @param object the Object to create a <code>hashCode</code> for @param testTransients whether to include transient fields @param reflectUpToClass the superclass to reflect up to (inclusive), may be <code>null</code> @param excludeFields array of field names to exclude from use in calculation of hash code @return int hash code @throws IllegalArgumentException if the Object is <code>null</code> @throws IllegalArgumentException if the number is zero or even @since 2.0
[ "<p", ">", "Uses", "reflection", "to", "build", "a", "valid", "hash", "code", "from", "the", "fields", "of", "{", "@code", "object", "}", ".", "<", "/", "p", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L331-L345
train
Gets the hash code of the given object using reflection.
[ 30522, 2270, 10763, 1026, 1056, 1028, 20014, 9185, 14949, 16257, 10244, 1006, 2345, 20014, 3988, 8540, 6290, 17139, 2094, 19172, 5677, 1010, 2345, 20014, 4800, 24759, 3771, 8540, 6290, 17139, 2094, 19172, 5677, 1010, 2345, 1056, 4874, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.toUnsignedByteArray
public static byte[] toUnsignedByteArray(BigInteger value) { byte[] bytes = value.toByteArray(); if (bytes[0] == 0) { byte[] tmp = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, tmp, 0, tmp.length); return tmp; } return bytes; }
java
public static byte[] toUnsignedByteArray(BigInteger value) { byte[] bytes = value.toByteArray(); if (bytes[0] == 0) { byte[] tmp = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, tmp, 0, tmp.length); return tmp; } return bytes; }
[ "public", "static", "byte", "[", "]", "toUnsignedByteArray", "(", "BigInteger", "value", ")", "{", "byte", "[", "]", "bytes", "=", "value", ".", "toByteArray", "(", ")", ";", "if", "(", "bytes", "[", "0", "]", "==", "0", ")", "{", "byte", "[", "]",...
以无符号字节数组的形式返回传入值。 @param value 需要转换的值 @return 无符号bytes @since 4.5.0
[ "以无符号字节数组的形式返回传入值。" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L2235-L2246
train
Converts a BigInteger to a byte array of unsigned bytes.
[ 30522, 2270, 10763, 24880, 1031, 1033, 2000, 4609, 5332, 19225, 3762, 27058, 11335, 2100, 1006, 2502, 18447, 26320, 3643, 1007, 1063, 24880, 1031, 1033, 27507, 1027, 3643, 1012, 11291, 27058, 11335, 2100, 1006, 1007, 1025, 2065, 1006, 27507, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/support/Color.java
Color.fromString
public static Color fromString(String value) { for (Converter converter : CONVERTERS) { Color color = converter.getColor(value); if (color != null) { return color; } } throw new IllegalArgumentException( String.format("Did not know how to convert %s into color", value) ); }
java
public static Color fromString(String value) { for (Converter converter : CONVERTERS) { Color color = converter.getColor(value); if (color != null) { return color; } } throw new IllegalArgumentException( String.format("Did not know how to convert %s into color", value) ); }
[ "public", "static", "Color", "fromString", "(", "String", "value", ")", "{", "for", "(", "Converter", "converter", ":", "CONVERTERS", ")", "{", "Color", "color", "=", "converter", ".", "getColor", "(", "value", ")", ";", "if", "(", "color", "!=", "null",...
/* Guesses what format the input color is in.
[ "/", "*", "Guesses", "what", "format", "the", "input", "color", "is", "in", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/Color.java#L44-L54
train
Convert a string to a color.
[ 30522, 2270, 10763, 3609, 2013, 3367, 4892, 1006, 5164, 3643, 1007, 1063, 2005, 1006, 10463, 2121, 10463, 2121, 1024, 10463, 2545, 1007, 1063, 3609, 3609, 1027, 10463, 2121, 1012, 2131, 18717, 1006, 3643, 1007, 1025, 2065, 1006, 3609, 999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport/src/main/java/io/netty/channel/SingleThreadEventLoop.java
SingleThreadEventLoop.executeAfterEventLoopIteration
@UnstableApi public final void executeAfterEventLoopIteration(Runnable task) { ObjectUtil.checkNotNull(task, "task"); if (isShutdown()) { reject(); } if (!tailTasks.offer(task)) { reject(task); } if (wakesUpForTask(task)) { wakeup(inEventLoop()); } }
java
@UnstableApi public final void executeAfterEventLoopIteration(Runnable task) { ObjectUtil.checkNotNull(task, "task"); if (isShutdown()) { reject(); } if (!tailTasks.offer(task)) { reject(task); } if (wakesUpForTask(task)) { wakeup(inEventLoop()); } }
[ "@", "UnstableApi", "public", "final", "void", "executeAfterEventLoopIteration", "(", "Runnable", "task", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "task", ",", "\"task\"", ")", ";", "if", "(", "isShutdown", "(", ")", ")", "{", "reject", "(", ")", ...
Adds a task to be run once at the end of next (or current) {@code eventloop} iteration. @param task to be added.
[ "Adds", "a", "task", "to", "be", "run", "once", "at", "the", "end", "of", "next", "(", "or", "current", ")", "{", "@code", "eventloop", "}", "iteration", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/SingleThreadEventLoop.java#L103-L117
train
Execute after event loop iteration.
[ 30522, 1030, 14480, 9331, 2072, 2270, 2345, 11675, 15389, 10354, 3334, 18697, 3372, 4135, 7361, 21646, 3370, 1006, 2448, 22966, 4708, 1007, 1063, 4874, 21823, 2140, 1012, 4638, 17048, 11231, 3363, 1006, 4708, 1010, 1000, 4708, 1000, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java
RocksDBKeyedStateBackend.dispose
@Override public void dispose() { if (this.disposed) { return; } super.dispose(); // This call will block until all clients that still acquire access to the RocksDB instance have released it, // so that we cannot release the native resources while clients are still working with it in parallel. rocksDBResourceGuard.close(); // IMPORTANT: null reference to signal potential async checkpoint workers that the db was disposed, as // working on the disposed object results in SEGFAULTS. if (db != null) { IOUtils.closeQuietly(writeBatchWrapper); // Metric collection occurs on a background thread. When this method returns // it is guaranteed that thr RocksDB reference has been invalidated // and no more metric collection will be attempted against the database. if (nativeMetricMonitor != null) { nativeMetricMonitor.close(); } List<ColumnFamilyOptions> columnFamilyOptions = new ArrayList<>(kvStateInformation.values().size()); // RocksDB's native memory management requires that *all* CFs (including default) are closed before the // DB is closed. See: // https://github.com/facebook/rocksdb/wiki/RocksJava-Basics#opening-a-database-with-column-families // Start with default CF ... RocksDBOperationUtils.addColumnFamilyOptionsToCloseLater(columnFamilyOptions, defaultColumnFamily); IOUtils.closeQuietly(defaultColumnFamily); // ... continue with the ones created by Flink... for (RocksDbKvStateInfo kvStateInfo : kvStateInformation.values()) { RocksDBOperationUtils.addColumnFamilyOptionsToCloseLater(columnFamilyOptions, kvStateInfo.columnFamilyHandle); IOUtils.closeQuietly(kvStateInfo.columnFamilyHandle); } // ... and finally close the DB instance ... IOUtils.closeQuietly(db); columnFamilyOptions.forEach(IOUtils::closeQuietly); IOUtils.closeQuietly(dbOptions); IOUtils.closeQuietly(writeOptions); ttlCompactFiltersManager.disposeAndClearRegisteredCompactionFactories(); kvStateInformation.clear(); cleanInstanceBasePath(); } this.disposed = true; }
java
@Override public void dispose() { if (this.disposed) { return; } super.dispose(); // This call will block until all clients that still acquire access to the RocksDB instance have released it, // so that we cannot release the native resources while clients are still working with it in parallel. rocksDBResourceGuard.close(); // IMPORTANT: null reference to signal potential async checkpoint workers that the db was disposed, as // working on the disposed object results in SEGFAULTS. if (db != null) { IOUtils.closeQuietly(writeBatchWrapper); // Metric collection occurs on a background thread. When this method returns // it is guaranteed that thr RocksDB reference has been invalidated // and no more metric collection will be attempted against the database. if (nativeMetricMonitor != null) { nativeMetricMonitor.close(); } List<ColumnFamilyOptions> columnFamilyOptions = new ArrayList<>(kvStateInformation.values().size()); // RocksDB's native memory management requires that *all* CFs (including default) are closed before the // DB is closed. See: // https://github.com/facebook/rocksdb/wiki/RocksJava-Basics#opening-a-database-with-column-families // Start with default CF ... RocksDBOperationUtils.addColumnFamilyOptionsToCloseLater(columnFamilyOptions, defaultColumnFamily); IOUtils.closeQuietly(defaultColumnFamily); // ... continue with the ones created by Flink... for (RocksDbKvStateInfo kvStateInfo : kvStateInformation.values()) { RocksDBOperationUtils.addColumnFamilyOptionsToCloseLater(columnFamilyOptions, kvStateInfo.columnFamilyHandle); IOUtils.closeQuietly(kvStateInfo.columnFamilyHandle); } // ... and finally close the DB instance ... IOUtils.closeQuietly(db); columnFamilyOptions.forEach(IOUtils::closeQuietly); IOUtils.closeQuietly(dbOptions); IOUtils.closeQuietly(writeOptions); ttlCompactFiltersManager.disposeAndClearRegisteredCompactionFactories(); kvStateInformation.clear(); cleanInstanceBasePath(); } this.disposed = true; }
[ "@", "Override", "public", "void", "dispose", "(", ")", "{", "if", "(", "this", ".", "disposed", ")", "{", "return", ";", "}", "super", ".", "dispose", "(", ")", ";", "// This call will block until all clients that still acquire access to the RocksDB instance have rel...
Should only be called by one thread, and only after all accesses to the DB happened.
[ "Should", "only", "be", "called", "by", "one", "thread", "and", "only", "after", "all", "accesses", "to", "the", "DB", "happened", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBKeyedStateBackend.java#L305-L359
train
This method is called by the RocksDB instance when the DB is disposed.
[ 30522, 1030, 2058, 15637, 2270, 11675, 27764, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 21866, 1007, 1063, 2709, 1025, 1065, 3565, 1012, 27764, 1006, 1007, 1025, 1013, 1013, 2023, 2655, 2097, 3796, 2127, 2035, 7846, 2008, 2145, 9878, 3229, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java
HttpServerKeepAliveHandler.isSelfDefinedMessageLength
private static boolean isSelfDefinedMessageLength(HttpResponse response) { return isContentLengthSet(response) || isTransferEncodingChunked(response) || isMultipart(response) || isInformational(response) || response.status().code() == HttpResponseStatus.NO_CONTENT.code(); }
java
private static boolean isSelfDefinedMessageLength(HttpResponse response) { return isContentLengthSet(response) || isTransferEncodingChunked(response) || isMultipart(response) || isInformational(response) || response.status().code() == HttpResponseStatus.NO_CONTENT.code(); }
[ "private", "static", "boolean", "isSelfDefinedMessageLength", "(", "HttpResponse", "response", ")", "{", "return", "isContentLengthSet", "(", "response", ")", "||", "isTransferEncodingChunked", "(", "response", ")", "||", "isMultipart", "(", "response", ")", "||", "...
Keep-alive only works if the client can detect when the message has ended without relying on the connection being closed. <p> <ul> <li>See <a href="https://tools.ietf.org/html/rfc7230#section-6.3"/></li> <li>See <a href="https://tools.ietf.org/html/rfc7230#section-3.3.2"/></li> <li>See <a href="https://tools.ietf.org/html/rfc7230#section-3.3.3"/></li> </ul> @param response The HttpResponse to check @return true if the response has a self defined message length.
[ "Keep", "-", "alive", "only", "works", "if", "the", "client", "can", "detect", "when", "the", "message", "has", "ended", "without", "relying", "on", "the", "connection", "being", "closed", ".", "<p", ">", "<ul", ">", "<li", ">", "See", "<a", "href", "=...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerKeepAliveHandler.java#L114-L117
train
Returns true if the response is self - defined.
[ 30522, 2797, 10763, 22017, 20898, 26354, 2884, 2546, 3207, 23460, 22117, 7971, 4270, 7770, 13512, 2232, 1006, 8299, 6072, 26029, 3366, 3433, 1007, 1063, 2709, 2003, 8663, 6528, 9286, 3070, 26830, 3388, 1006, 3433, 1007, 1064, 1064, 21541, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java
FastDatePrinter.getTimeZoneDisplay
static String getTimeZoneDisplay(final TimeZone tz, final boolean daylight, final int style, final Locale locale) { final TimeZoneDisplayKey key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); final String prior = cTimeZoneDisplayCache.putIfAbsent(key, value); if (prior != null) { value = prior; } } return value; }
java
static String getTimeZoneDisplay(final TimeZone tz, final boolean daylight, final int style, final Locale locale) { final TimeZoneDisplayKey key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); final String prior = cTimeZoneDisplayCache.putIfAbsent(key, value); if (prior != null) { value = prior; } } return value; }
[ "static", "String", "getTimeZoneDisplay", "(", "final", "TimeZone", "tz", ",", "final", "boolean", "daylight", ",", "final", "int", "style", ",", "final", "Locale", "locale", ")", "{", "final", "TimeZoneDisplayKey", "key", "=", "new", "TimeZoneDisplayKey", "(", ...
<p> Gets the time zone display name, using a cache for performance. </p> @param tz the zone to query @param daylight true if daylight savings @param style the style to use {@code TimeZone.LONG} or {@code TimeZone.SHORT} @param locale the locale to use @return the textual name of the time zone
[ "<p", ">", "Gets", "the", "time", "zone", "display", "name", "using", "a", "cache", "for", "performance", ".", "<", "/", "p", ">" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L1069-L1081
train
Gets the display name of the specified time zone.
[ 30522, 10763, 5164, 2131, 7292, 15975, 10521, 13068, 1006, 2345, 2051, 15975, 1056, 2480, 1010, 2345, 22017, 20898, 11695, 1010, 2345, 20014, 2806, 1010, 2345, 2334, 2063, 2334, 2063, 1007, 1063, 2345, 2051, 15975, 10521, 13068, 14839, 3145, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.appendRange
public static Collection<Integer> appendRange(int start, int stop, Collection<Integer> values) { return appendRange(start, stop, 1, values); }
java
public static Collection<Integer> appendRange(int start, int stop, Collection<Integer> values) { return appendRange(start, stop, 1, values); }
[ "public", "static", "Collection", "<", "Integer", ">", "appendRange", "(", "int", "start", ",", "int", "stop", ",", "Collection", "<", "Integer", ">", "values", ")", "{", "return", "appendRange", "(", "start", ",", "stop", ",", "1", ",", "values", ")", ...
将给定范围内的整数添加到已有集合中,步进为1 @param start 开始(包含) @param stop 结束(包含) @param values 集合 @return 集合
[ "将给定范围内的整数添加到已有集合中,步进为1" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1343-L1345
train
Append a range of integers to a collection of integers.
[ 30522, 2270, 10763, 3074, 1026, 16109, 1028, 10439, 19524, 15465, 1006, 20014, 2707, 1010, 20014, 2644, 1010, 3074, 1026, 16109, 1028, 5300, 1007, 1063, 2709, 10439, 19524, 15465, 1006, 2707, 1010, 2644, 1010, 1015, 1010, 5300, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java
CsvUtil.getWriter
public static CsvWriter getWriter(File file, Charset charset, boolean isAppend, CsvWriteConfig config) { return new CsvWriter(file, charset, isAppend, config); }
java
public static CsvWriter getWriter(File file, Charset charset, boolean isAppend, CsvWriteConfig config) { return new CsvWriter(file, charset, isAppend, config); }
[ "public", "static", "CsvWriter", "getWriter", "(", "File", "file", ",", "Charset", "charset", ",", "boolean", "isAppend", ",", "CsvWriteConfig", "config", ")", "{", "return", "new", "CsvWriter", "(", "file", ",", "charset", ",", "isAppend", ",", "config", ")...
获取CSV生成器(写出器) @param file File CSV文件 @param charset 编码 @param isAppend 是否追加 @param config 写出配置,null则使用默认配置
[ "获取CSV生成器(写出器)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java#L86-L88
train
Returns a writer for a CSV file.
[ 30522, 2270, 10763, 20116, 2615, 15994, 2131, 15994, 1006, 5371, 5371, 1010, 25869, 13462, 25869, 13462, 1010, 22017, 20898, 18061, 21512, 4859, 1010, 20116, 2615, 26373, 8663, 8873, 2290, 9530, 8873, 2290, 1007, 1063, 2709, 2047, 20116, 2615...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.excAsync
public static Runnable excAsync(final Runnable runnable, boolean isDeamon) { Thread thread = new Thread() { @Override public void run() { runnable.run(); } }; thread.setDaemon(isDeamon); thread.start(); return runnable; }
java
public static Runnable excAsync(final Runnable runnable, boolean isDeamon) { Thread thread = new Thread() { @Override public void run() { runnable.run(); } }; thread.setDaemon(isDeamon); thread.start(); return runnable; }
[ "public", "static", "Runnable", "excAsync", "(", "final", "Runnable", "runnable", ",", "boolean", "isDeamon", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "runnable", ".", "ru...
执行异步方法 @param runnable 需要执行的方法体 @param isDeamon 是否守护线程。守护线程会在主线程结束后自动结束 @return 执行的方法体
[ "执行异步方法" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L101-L112
train
Creates an async thread that runs the given Runnable in a background thread.
[ 30522, 2270, 10763, 2448, 22966, 4654, 15671, 6038, 2278, 1006, 2345, 2448, 22966, 2448, 22966, 1010, 22017, 20898, 2003, 3207, 22591, 2078, 1007, 1063, 11689, 11689, 1027, 2047, 11689, 1006, 1007, 1063, 1030, 2058, 15637, 2270, 11675, 2448, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java
CoNLLSentence.getEdgeArray
public String[][] getEdgeArray() { String[][] edge = new String[word.length + 1][word.length + 1]; for (CoNLLWord coNLLWord : word) { edge[coNLLWord.ID][coNLLWord.HEAD.ID] = coNLLWord.DEPREL; } return edge; }
java
public String[][] getEdgeArray() { String[][] edge = new String[word.length + 1][word.length + 1]; for (CoNLLWord coNLLWord : word) { edge[coNLLWord.ID][coNLLWord.HEAD.ID] = coNLLWord.DEPREL; } return edge; }
[ "public", "String", "[", "]", "[", "]", "getEdgeArray", "(", ")", "{", "String", "[", "]", "[", "]", "edge", "=", "new", "String", "[", "word", ".", "length", "+", "1", "]", "[", "word", ".", "length", "+", "1", "]", ";", "for", "(", "CoNLLWord...
获取边的列表,edge[i][j]表示id为i的词语与j存在一条依存关系为该值的边,否则为null @return
[ "获取边的列表,edge", "[", "i", "]", "[", "j", "]", "表示id为i的词语与j存在一条依存关系为该值的边,否则为null" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dependency/CoNll/CoNLLSentence.java#L77-L86
train
Get the edge array for this word.
[ 30522, 2270, 5164, 1031, 1033, 1031, 1033, 2131, 24225, 2906, 9447, 1006, 1007, 1063, 5164, 1031, 1033, 1031, 1033, 3341, 1027, 2047, 5164, 1031, 2773, 1012, 3091, 1009, 1015, 1033, 1031, 2773, 1012, 3091, 1009, 1015, 1033, 1025, 2005, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java
UploadFile.write
public File write(File destination) throws IOException { assertValid(); if (destination.isDirectory() == true) { destination = new File(destination, this.header.getFileName()); } if (data != null) { FileUtil.writeBytes(data, destination); data = null; } else { if (tempFile != null) { FileUtil.move(tempFile, destination, true); } } return destination; }
java
public File write(File destination) throws IOException { assertValid(); if (destination.isDirectory() == true) { destination = new File(destination, this.header.getFileName()); } if (data != null) { FileUtil.writeBytes(data, destination); data = null; } else { if (tempFile != null) { FileUtil.move(tempFile, destination, true); } } return destination; }
[ "public", "File", "write", "(", "File", "destination", ")", "throws", "IOException", "{", "assertValid", "(", ")", ";", "if", "(", "destination", ".", "isDirectory", "(", ")", "==", "true", ")", "{", "destination", "=", "new", "File", "(", "destination", ...
将上传的文件写入目标文件<br> 写入后原临时文件会被删除 @return 目标文件
[ "将上传的文件写入目标文件<br", ">", "写入后原临时文件会被删除" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java#L86-L101
train
Write the contents of this object to the given file.
[ 30522, 2270, 5371, 4339, 1006, 5371, 7688, 1007, 11618, 22834, 10288, 24422, 1063, 20865, 10175, 3593, 1006, 1007, 1025, 2065, 1006, 7688, 1012, 2003, 4305, 2890, 16761, 2100, 1006, 1007, 1027, 1027, 2995, 1007, 30524, 1065, 2842, 1063, 206...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/ds/simple/SimpleDataSource.java
SimpleDataSource.init
public void init(String url, String user, String pass, String driver) { this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url); try { Class.forName(this.driver); } catch (ClassNotFoundException e) { throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver); } this.url = url; this.user = user; this.pass = pass; }
java
public void init(String url, String user, String pass, String driver) { this.driver = StrUtil.isNotBlank(driver) ? driver : DriverUtil.identifyDriver(url); try { Class.forName(this.driver); } catch (ClassNotFoundException e) { throw new DbRuntimeException(e, "Get jdbc driver [{}] error!", driver); } this.url = url; this.user = user; this.pass = pass; }
[ "public", "void", "init", "(", "String", "url", ",", "String", "user", ",", "String", "pass", ",", "String", "driver", ")", "{", "this", ".", "driver", "=", "StrUtil", ".", "isNotBlank", "(", "driver", ")", "?", "driver", ":", "DriverUtil", ".", "ident...
初始化 @param url jdbc url @param user 用户名 @param pass 密码 @param driver JDBC驱动类,传入空则自动识别驱动类 @since 3.1.2
[ "初始化" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/ds/simple/SimpleDataSource.java#L137-L147
train
Initializes the object with the parameters.
[ 30522, 2270, 11675, 1999, 4183, 1006, 5164, 24471, 2140, 1010, 5164, 5310, 1010, 5164, 3413, 1010, 5164, 4062, 1007, 1063, 2023, 1012, 4062, 1027, 2358, 22134, 4014, 1012, 3475, 4140, 28522, 8950, 1006, 4062, 1007, 1029, 4062, 1024, 4062, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java
HttpTunnelServer.handle
protected void handle(HttpConnection httpConnection) throws IOException { try { getServerThread().handleIncomingHttp(httpConnection); httpConnection.waitForResponse(); } catch (ConnectException ex) { httpConnection.respond(HttpStatus.GONE); } }
java
protected void handle(HttpConnection httpConnection) throws IOException { try { getServerThread().handleIncomingHttp(httpConnection); httpConnection.waitForResponse(); } catch (ConnectException ex) { httpConnection.respond(HttpStatus.GONE); } }
[ "protected", "void", "handle", "(", "HttpConnection", "httpConnection", ")", "throws", "IOException", "{", "try", "{", "getServerThread", "(", ")", ".", "handleIncomingHttp", "(", "httpConnection", ")", ";", "httpConnection", ".", "waitForResponse", "(", ")", ";",...
Handle an incoming HTTP connection. @param httpConnection the HTTP connection @throws IOException in case of I/O errors
[ "Handle", "an", "incoming", "HTTP", "connection", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java#L153-L161
train
Handle incoming HTTP connection.
[ 30522, 5123, 11675, 5047, 1006, 8299, 8663, 2638, 7542, 8299, 8663, 2638, 7542, 1007, 11618, 22834, 10288, 24422, 1063, 3046, 1063, 4152, 2121, 16874, 28362, 4215, 1006, 1007, 1012, 5047, 2378, 18935, 11039, 25856, 1006, 8299, 8663, 2638, 7...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
client/src/main/java/com/networknt/client/ssl/APINameChecker.java
APINameChecker.verifyAndThrow
public static void verifyAndThrow(final Set<String> nameSet, final X509Certificate cert) throws CertificateException{ if (!verify(nameSet, cert)) { throw new CertificateException("No name matching " + nameSet + " found"); } }
java
public static void verifyAndThrow(final Set<String> nameSet, final X509Certificate cert) throws CertificateException{ if (!verify(nameSet, cert)) { throw new CertificateException("No name matching " + nameSet + " found"); } }
[ "public", "static", "void", "verifyAndThrow", "(", "final", "Set", "<", "String", ">", "nameSet", ",", "final", "X509Certificate", "cert", ")", "throws", "CertificateException", "{", "if", "(", "!", "verify", "(", "nameSet", ",", "cert", ")", ")", "{", "th...
Perform server identify check using given names and throw CertificateException if the check fails. @param nameSet - a set of names from the config file @param cert - the server certificate @throws CertificateException - throws CertificateException if none of the name in the nameSet matches the names in the cert
[ "Perform", "server", "identify", "check", "using", "given", "names", "and", "throw", "CertificateException", "if", "the", "check", "fails", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/ssl/APINameChecker.java#L41-L45
train
Verifies that a certificate matches a set of names and throws an exception if not.
[ 30522, 2270, 10763, 11675, 20410, 5685, 2705, 10524, 1006, 2345, 2275, 1026, 5164, 1028, 3415, 3388, 1010, 2345, 1060, 12376, 2683, 17119, 3775, 8873, 16280, 8292, 5339, 1007, 11618, 8196, 10288, 24422, 1063, 2065, 1006, 999, 20410, 1006, 3...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java
WindowOperator.emitWindowResult
private void emitWindowResult(W window) throws Exception { BaseRow aggResult = windowFunction.getWindowAggregationResult(window); if (sendRetraction) { previousState.setCurrentNamespace(window); BaseRow previousAggResult = previousState.value(); // has emitted result for the window if (previousAggResult != null) { // current agg is not equal to the previous emitted, should emit retract if (!equaliser.equalsWithoutHeader(aggResult, previousAggResult)) { reuseOutput.replace((BaseRow) getCurrentKey(), previousAggResult); BaseRowUtil.setRetract(reuseOutput); // send retraction collector.collect(reuseOutput); // send accumulate reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); BaseRowUtil.setAccumulate(reuseOutput); collector.collect(reuseOutput); // update previousState previousState.update(aggResult); } // if the previous agg equals to the current agg, no need to send retract and accumulate } // the first fire for the window, only send accumulate else { // send accumulate reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); BaseRowUtil.setAccumulate(reuseOutput); collector.collect(reuseOutput); // update previousState previousState.update(aggResult); } } else { reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); // no need to set header collector.collect(reuseOutput); } }
java
private void emitWindowResult(W window) throws Exception { BaseRow aggResult = windowFunction.getWindowAggregationResult(window); if (sendRetraction) { previousState.setCurrentNamespace(window); BaseRow previousAggResult = previousState.value(); // has emitted result for the window if (previousAggResult != null) { // current agg is not equal to the previous emitted, should emit retract if (!equaliser.equalsWithoutHeader(aggResult, previousAggResult)) { reuseOutput.replace((BaseRow) getCurrentKey(), previousAggResult); BaseRowUtil.setRetract(reuseOutput); // send retraction collector.collect(reuseOutput); // send accumulate reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); BaseRowUtil.setAccumulate(reuseOutput); collector.collect(reuseOutput); // update previousState previousState.update(aggResult); } // if the previous agg equals to the current agg, no need to send retract and accumulate } // the first fire for the window, only send accumulate else { // send accumulate reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); BaseRowUtil.setAccumulate(reuseOutput); collector.collect(reuseOutput); // update previousState previousState.update(aggResult); } } else { reuseOutput.replace((BaseRow) getCurrentKey(), aggResult); // no need to set header collector.collect(reuseOutput); } }
[ "private", "void", "emitWindowResult", "(", "W", "window", ")", "throws", "Exception", "{", "BaseRow", "aggResult", "=", "windowFunction", ".", "getWindowAggregationResult", "(", "window", ")", ";", "if", "(", "sendRetraction", ")", "{", "previousState", ".", "s...
Emits the window result of the given window.
[ "Emits", "the", "window", "result", "of", "the", "given", "window", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/WindowOperator.java#L428-L465
train
Emits the window result.
[ 30522, 2797, 11675, 12495, 2102, 11101, 5004, 6072, 11314, 1006, 1059, 3332, 1007, 11618, 6453, 1063, 2918, 10524, 12943, 17603, 23722, 2102, 1027, 3332, 11263, 27989, 1012, 2131, 11101, 21293, 13871, 2890, 12540, 6072, 11314, 1006, 3332, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.rotate
public static void rotate(Image image, int degree, OutputStream out) throws IORuntimeException { writeJpg(rotate(image, degree), getImageOutputStream(out)); }
java
public static void rotate(Image image, int degree, OutputStream out) throws IORuntimeException { writeJpg(rotate(image, degree), getImageOutputStream(out)); }
[ "public", "static", "void", "rotate", "(", "Image", "image", ",", "int", "degree", ",", "OutputStream", "out", ")", "throws", "IORuntimeException", "{", "writeJpg", "(", "rotate", "(", "image", ",", "degree", ")", ",", "getImageOutputStream", "(", "out", ")"...
旋转图片为指定角度<br> 此方法不会关闭输出流 @param image 目标图像 @param degree 旋转角度 @param out 输出流 @since 3.2.2 @throws IORuntimeException IO异常
[ "旋转图片为指定角度<br", ">", "此方法不会关闭输出流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1030-L1032
train
Rotate the image to degree degrees and write the result to the OutputStream.
[ 30522, 2270, 10763, 11675, 24357, 1006, 3746, 3746, 1010, 20014, 3014, 1010, 27852, 25379, 2041, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 4339, 3501, 26952, 1006, 24357, 1006, 3746, 1010, 3014, 1007, 1010, 2131, 9581, 3351, 5833, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TGetTablesReq.java
TGetTablesReq.isSet
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SESSION_HANDLE: return isSetSessionHandle(); case CATALOG_NAME: return isSetCatalogName(); case SCHEMA_NAME: return isSetSchemaName(); case TABLE_NAME: return isSetTableName(); case TABLE_TYPES: return isSetTableTypes(); } throw new IllegalStateException(); }
java
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case SESSION_HANDLE: return isSetSessionHandle(); case CATALOG_NAME: return isSetCatalogName(); case SCHEMA_NAME: return isSetSchemaName(); case TABLE_NAME: return isSetTableName(); case TABLE_TYPES: return isSetTableTypes(); } throw new IllegalStateException(); }
[ "public", "boolean", "isSet", "(", "_Fields", "field", ")", "{", "if", "(", "field", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "switch", "(", "field", ")", "{", "case", "SESSION_HANDLE", ":", "return", "isSet...
Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise
[ "Returns", "true", "if", "field", "corresponding", "to", "fieldID", "is", "set", "(", "has", "been", "assigned", "a", "value", ")", "and", "false", "otherwise" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/gen/java/org/apache/hive/service/cli/thrift/TGetTablesReq.java#L390-L408
train
Checks if the specified field is set to a value of a CRAS_ or CRAS_ _ object.
[ 30522, 2270, 22017, 20898, 26354, 3388, 1006, 1035, 4249, 2492, 1007, 1063, 2065, 1006, 2492, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1007, 1025, 1065, 6942, 1006, 2492, 1007, 1063, 2553, 5219...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/Mail.java
Mail.buildContent
private Multipart buildContent(Charset charset) throws MessagingException { final Multipart mainPart = new MimeMultipart(); // 正文 final BodyPart body = new MimeBodyPart(); body.setContent(content, StrUtil.format("text/{}; charset={}", isHtml ? "html" : "plain", charset)); mainPart.addBodyPart(body); // 附件 if (ArrayUtil.isNotEmpty(this.attachments)) { BodyPart bodyPart; for (DataSource attachment : attachments) { bodyPart = new MimeBodyPart(); bodyPart.setDataHandler(new DataHandler(attachment)); bodyPart.setFileName(InternalMailUtil.encodeText(attachment.getName(), charset)); mainPart.addBodyPart(bodyPart); } } return mainPart; }
java
private Multipart buildContent(Charset charset) throws MessagingException { final Multipart mainPart = new MimeMultipart(); // 正文 final BodyPart body = new MimeBodyPart(); body.setContent(content, StrUtil.format("text/{}; charset={}", isHtml ? "html" : "plain", charset)); mainPart.addBodyPart(body); // 附件 if (ArrayUtil.isNotEmpty(this.attachments)) { BodyPart bodyPart; for (DataSource attachment : attachments) { bodyPart = new MimeBodyPart(); bodyPart.setDataHandler(new DataHandler(attachment)); bodyPart.setFileName(InternalMailUtil.encodeText(attachment.getName(), charset)); mainPart.addBodyPart(bodyPart); } } return mainPart; }
[ "private", "Multipart", "buildContent", "(", "Charset", "charset", ")", "throws", "MessagingException", "{", "final", "Multipart", "mainPart", "=", "new", "MimeMultipart", "(", ")", ";", "// 正文\r", "final", "BodyPart", "body", "=", "new", "MimeBodyPart", "(", ")...
构建邮件信息主体 @param charset 编码 @return 邮件信息主体 @throws MessagingException 消息异常
[ "构建邮件信息主体" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/Mail.java#L288-L308
train
Build the content.
[ 30522, 2797, 4800, 19362, 2102, 3857, 8663, 6528, 2102, 1006, 25869, 13462, 25869, 13462, 1007, 11618, 24732, 10288, 24422, 1063, 2345, 4800, 19362, 2102, 2364, 19362, 2102, 1027, 2047, 2771, 4168, 12274, 7096, 11514, 8445, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setDate
@Deprecated public static void setDate(HttpMessage message, Date value) { message.headers().set(HttpHeaderNames.DATE, value); }
java
@Deprecated public static void setDate(HttpMessage message, Date value) { message.headers().set(HttpHeaderNames.DATE, value); }
[ "@", "Deprecated", "public", "static", "void", "setDate", "(", "HttpMessage", "message", ",", "Date", "value", ")", "{", "message", ".", "headers", "(", ")", ".", "set", "(", "HttpHeaderNames", ".", "DATE", ",", "value", ")", ";", "}" ]
@deprecated Use {@link #set(CharSequence, Object)} instead. Sets the {@code "Date"} header.
[ "@deprecated", "Use", "{", "@link", "#set", "(", "CharSequence", "Object", ")", "}", "instead", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1069-L1072
train
Sets the Date header of the given message.
[ 30522, 1030, 2139, 28139, 12921, 2270, 10763, 11675, 2275, 13701, 1006, 8299, 7834, 3736, 3351, 4471, 1010, 3058, 3643, 1007, 1063, 4471, 1012, 20346, 2015, 1006, 1007, 1012, 2275, 1006, 8299, 4974, 11795, 14074, 2015, 1012, 3058, 1010, 364...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java
FileInputFormat.open
@Override public void open(FileInputSplit fileSplit) throws IOException { this.currentSplit = fileSplit; this.splitStart = fileSplit.getStart(); this.splitLength = fileSplit.getLength(); if (LOG.isDebugEnabled()) { LOG.debug("Opening input split " + fileSplit.getPath() + " [" + this.splitStart + "," + this.splitLength + "]"); } // open the split in an asynchronous thread final InputSplitOpenThread isot = new InputSplitOpenThread(fileSplit, this.openTimeout); isot.start(); try { this.stream = isot.waitForCompletion(); this.stream = decorateInputStream(this.stream, fileSplit); } catch (Throwable t) { throw new IOException("Error opening the Input Split " + fileSplit.getPath() + " [" + splitStart + "," + splitLength + "]: " + t.getMessage(), t); } // get FSDataInputStream if (this.splitStart != 0) { this.stream.seek(this.splitStart); } }
java
@Override public void open(FileInputSplit fileSplit) throws IOException { this.currentSplit = fileSplit; this.splitStart = fileSplit.getStart(); this.splitLength = fileSplit.getLength(); if (LOG.isDebugEnabled()) { LOG.debug("Opening input split " + fileSplit.getPath() + " [" + this.splitStart + "," + this.splitLength + "]"); } // open the split in an asynchronous thread final InputSplitOpenThread isot = new InputSplitOpenThread(fileSplit, this.openTimeout); isot.start(); try { this.stream = isot.waitForCompletion(); this.stream = decorateInputStream(this.stream, fileSplit); } catch (Throwable t) { throw new IOException("Error opening the Input Split " + fileSplit.getPath() + " [" + splitStart + "," + splitLength + "]: " + t.getMessage(), t); } // get FSDataInputStream if (this.splitStart != 0) { this.stream.seek(this.splitStart); } }
[ "@", "Override", "public", "void", "open", "(", "FileInputSplit", "fileSplit", ")", "throws", "IOException", "{", "this", ".", "currentSplit", "=", "fileSplit", ";", "this", ".", "splitStart", "=", "fileSplit", ".", "getStart", "(", ")", ";", "this", ".", ...
Opens an input stream to the file defined in the input format. The stream is positioned at the beginning of the given split. <p> The stream is actually opened in an asynchronous thread to make sure any interruptions to the thread working on the input format do not reach the file system.
[ "Opens", "an", "input", "stream", "to", "the", "file", "defined", "in", "the", "input", "format", ".", "The", "stream", "is", "positioned", "at", "the", "beginning", "of", "the", "given", "split", ".", "<p", ">", "The", "stream", "is", "actually", "opene...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L802-L831
train
Open the input split.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2330, 1006, 5371, 2378, 18780, 13102, 15909, 6764, 24759, 4183, 1007, 11618, 22834, 10288, 24422, 1063, 2023, 1012, 14731, 24759, 4183, 1027, 6764, 24759, 4183, 1025, 2023, 1012, 19584, 7559, 2102, 1027,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Console.java
Console.error
public static void error(Throwable t, String template, Object... values) { err.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(err); err.flush(); } }
java
public static void error(Throwable t, String template, Object... values) { err.println(StrUtil.format(template, values)); if (null != t) { t.printStackTrace(err); err.flush(); } }
[ "public", "static", "void", "error", "(", "Throwable", "t", ",", "String", "template", ",", "Object", "...", "values", ")", "{", "err", ".", "println", "(", "StrUtil", ".", "format", "(", "template", ",", "values", ")", ")", ";", "if", "(", "null", "...
同 System.err.println()方法,打印控制台日志 @param t 异常对象 @param template 文本模板,被替换的部分用 {} 表示 @param values 值
[ "同", "System", ".", "err", ".", "println", "()", "方法,打印控制台日志" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Console.java#L154-L160
train
Print an error message with a throwable.
[ 30522, 2270, 10763, 11675, 7561, 1006, 5466, 3085, 1056, 1010, 5164, 23561, 1010, 4874, 1012, 1012, 1012, 5300, 1007, 1063, 9413, 2099, 1012, 6140, 19666, 1006, 2358, 22134, 4014, 1012, 4289, 1006, 23561, 1010, 5300, 1007, 1007, 1025, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBIncrementalCheckpointUtils.java
RocksDBIncrementalCheckpointUtils.clipDBWithKeyGroupRange
public static void clipDBWithKeyGroupRange( @Nonnull RocksDB db, @Nonnull List<ColumnFamilyHandle> columnFamilyHandles, @Nonnull KeyGroupRange targetKeyGroupRange, @Nonnull KeyGroupRange currentKeyGroupRange, @Nonnegative int keyGroupPrefixBytes) throws RocksDBException { final byte[] beginKeyGroupBytes = new byte[keyGroupPrefixBytes]; final byte[] endKeyGroupBytes = new byte[keyGroupPrefixBytes]; if (currentKeyGroupRange.getStartKeyGroup() < targetKeyGroupRange.getStartKeyGroup()) { RocksDBKeySerializationUtils.serializeKeyGroup( currentKeyGroupRange.getStartKeyGroup(), beginKeyGroupBytes); RocksDBKeySerializationUtils.serializeKeyGroup( targetKeyGroupRange.getStartKeyGroup(), endKeyGroupBytes); deleteRange(db, columnFamilyHandles, beginKeyGroupBytes, endKeyGroupBytes); } if (currentKeyGroupRange.getEndKeyGroup() > targetKeyGroupRange.getEndKeyGroup()) { RocksDBKeySerializationUtils.serializeKeyGroup( targetKeyGroupRange.getEndKeyGroup() + 1, beginKeyGroupBytes); RocksDBKeySerializationUtils.serializeKeyGroup( currentKeyGroupRange.getEndKeyGroup() + 1, endKeyGroupBytes); deleteRange(db, columnFamilyHandles, beginKeyGroupBytes, endKeyGroupBytes); } }
java
public static void clipDBWithKeyGroupRange( @Nonnull RocksDB db, @Nonnull List<ColumnFamilyHandle> columnFamilyHandles, @Nonnull KeyGroupRange targetKeyGroupRange, @Nonnull KeyGroupRange currentKeyGroupRange, @Nonnegative int keyGroupPrefixBytes) throws RocksDBException { final byte[] beginKeyGroupBytes = new byte[keyGroupPrefixBytes]; final byte[] endKeyGroupBytes = new byte[keyGroupPrefixBytes]; if (currentKeyGroupRange.getStartKeyGroup() < targetKeyGroupRange.getStartKeyGroup()) { RocksDBKeySerializationUtils.serializeKeyGroup( currentKeyGroupRange.getStartKeyGroup(), beginKeyGroupBytes); RocksDBKeySerializationUtils.serializeKeyGroup( targetKeyGroupRange.getStartKeyGroup(), endKeyGroupBytes); deleteRange(db, columnFamilyHandles, beginKeyGroupBytes, endKeyGroupBytes); } if (currentKeyGroupRange.getEndKeyGroup() > targetKeyGroupRange.getEndKeyGroup()) { RocksDBKeySerializationUtils.serializeKeyGroup( targetKeyGroupRange.getEndKeyGroup() + 1, beginKeyGroupBytes); RocksDBKeySerializationUtils.serializeKeyGroup( currentKeyGroupRange.getEndKeyGroup() + 1, endKeyGroupBytes); deleteRange(db, columnFamilyHandles, beginKeyGroupBytes, endKeyGroupBytes); } }
[ "public", "static", "void", "clipDBWithKeyGroupRange", "(", "@", "Nonnull", "RocksDB", "db", ",", "@", "Nonnull", "List", "<", "ColumnFamilyHandle", ">", "columnFamilyHandles", ",", "@", "Nonnull", "KeyGroupRange", "targetKeyGroupRange", ",", "@", "Nonnull", "KeyGro...
The method to clip the db instance according to the target key group range using the {@link RocksDB#delete(ColumnFamilyHandle, byte[])}. @param db the RocksDB instance to be clipped. @param columnFamilyHandles the column families in the db instance. @param targetKeyGroupRange the target key group range. @param currentKeyGroupRange the key group range of the db instance. @param keyGroupPrefixBytes Number of bytes required to prefix the key groups.
[ "The", "method", "to", "clip", "the", "db", "instance", "according", "to", "the", "target", "key", "group", "range", "using", "the", "{", "@link", "RocksDB#delete", "(", "ColumnFamilyHandle", "byte", "[]", ")", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBIncrementalCheckpointUtils.java#L75-L100
train
Clips the given RocksDB database with the given key group ranges.
[ 30522, 2270, 10763, 11675, 12528, 18939, 24415, 14839, 17058, 24388, 2063, 1006, 1030, 2512, 11231, 3363, 5749, 18939, 16962, 1010, 1030, 2512, 11231, 3363, 2862, 1026, 5930, 7011, 30524, 4244, 1010, 1030, 2512, 11231, 3363, 3145, 17058, 2438...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java
FileWriter.printNewLine
private void printNewLine(PrintWriter writer, LineSeparator lineSeparator) { if(null == lineSeparator) { //默认换行符 writer.println(); }else { //自定义换行符 writer.print(lineSeparator.getValue()); } }
java
private void printNewLine(PrintWriter writer, LineSeparator lineSeparator) { if(null == lineSeparator) { //默认换行符 writer.println(); }else { //自定义换行符 writer.print(lineSeparator.getValue()); } }
[ "private", "void", "printNewLine", "(", "PrintWriter", "writer", ",", "LineSeparator", "lineSeparator", ")", "{", "if", "(", "null", "==", "lineSeparator", ")", "{", "//默认换行符\r", "writer", ".", "println", "(", ")", ";", "}", "else", "{", "//自定义换行符\r", "write...
打印新行 @param writer Writer @param lineSeparator 换行符枚举 @since 4.0.5
[ "打印新行" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L380-L388
train
Print a new line.
[ 30522, 2797, 11675, 6140, 2638, 13668, 3170, 1006, 6140, 15994, 3213, 1010, 3210, 13699, 25879, 2953, 3210, 13699, 25879, 2953, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 3210, 13699, 25879, 2953, 1007, 1063, 1013, 1013, 100, 100, 100, 1945...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraOutputFormatBase.java
CassandraOutputFormatBase.open
@Override public void open(int taskNumber, int numTasks) throws IOException { this.session = cluster.connect(); this.prepared = session.prepare(insertQuery); this.callback = new FutureCallback<ResultSet>() { @Override public void onSuccess(ResultSet ignored) { onWriteSuccess(ignored); } @Override public void onFailure(Throwable t) { onWriteFailure(t); } }; }
java
@Override public void open(int taskNumber, int numTasks) throws IOException { this.session = cluster.connect(); this.prepared = session.prepare(insertQuery); this.callback = new FutureCallback<ResultSet>() { @Override public void onSuccess(ResultSet ignored) { onWriteSuccess(ignored); } @Override public void onFailure(Throwable t) { onWriteFailure(t); } }; }
[ "@", "Override", "public", "void", "open", "(", "int", "taskNumber", ",", "int", "numTasks", ")", "throws", "IOException", "{", "this", ".", "session", "=", "cluster", ".", "connect", "(", ")", ";", "this", ".", "prepared", "=", "session", ".", "prepare"...
Opens a Session to Cassandra and initializes the prepared statement. @param taskNumber The number of the parallel instance. @throws IOException Thrown, if the output could not be opened due to an I/O problem.
[ "Opens", "a", "Session", "to", "Cassandra", "and", "initializes", "the", "prepared", "statement", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraOutputFormatBase.java#L75-L90
train
Open the connection and prepare the query.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2330, 1006, 20014, 4708, 19172, 5677, 1010, 20014, 16371, 20492, 19895, 2015, 1007, 11618, 22834, 10288, 24422, 1063, 2023, 1012, 5219, 1027, 9324, 1012, 7532, 1006, 1007, 1025, 2023, 1012, 4810, 1027, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java
ExitCodeGenerators.getExitCode
public int getExitCode() { int exitCode = 0; for (ExitCodeGenerator generator : this.generators) { try { int value = generator.getExitCode(); if (value > 0 && value > exitCode || value < 0 && value < exitCode) { exitCode = value; } } catch (Exception ex) { exitCode = (exitCode != 0) ? exitCode : 1; ex.printStackTrace(); } } return exitCode; }
java
public int getExitCode() { int exitCode = 0; for (ExitCodeGenerator generator : this.generators) { try { int value = generator.getExitCode(); if (value > 0 && value > exitCode || value < 0 && value < exitCode) { exitCode = value; } } catch (Exception ex) { exitCode = (exitCode != 0) ? exitCode : 1; ex.printStackTrace(); } } return exitCode; }
[ "public", "int", "getExitCode", "(", ")", "{", "int", "exitCode", "=", "0", ";", "for", "(", "ExitCodeGenerator", "generator", ":", "this", ".", "generators", ")", "{", "try", "{", "int", "value", "=", "generator", ".", "getExitCode", "(", ")", ";", "i...
Get the final exit code that should be returned based on all contained generators. @return the final exit code.
[ "Get", "the", "final", "exit", "code", "that", "should", "be", "returned", "based", "on", "all", "contained", "generators", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ExitCodeGenerators.java#L86-L101
train
Gets the exit code.
[ 30522, 2270, 20014, 2131, 10288, 4183, 16044, 1006, 1007, 1063, 20014, 6164, 16044, 1027, 1014, 1025, 2005, 1006, 6164, 16044, 6914, 6906, 4263, 13103, 1024, 2023, 1012, 16937, 1007, 1063, 3046, 1063, 20014, 3643, 1027, 13103, 1012, 2131, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/tag/Nature.java
Nature.create
public static final Nature create(String name) { Nature nature = fromString(name); if (nature == null) return new Nature(name); return nature; }
java
public static final Nature create(String name) { Nature nature = fromString(name); if (nature == null) return new Nature(name); return nature; }
[ "public", "static", "final", "Nature", "create", "(", "String", "name", ")", "{", "Nature", "nature", "=", "fromString", "(", "name", ")", ";", "if", "(", "nature", "==", "null", ")", "return", "new", "Nature", "(", "name", ")", ";", "return", "nature"...
创建自定义词性,如果已有该对应词性,则直接返回已有的词性 @param name 字符串词性 @return Enum词性
[ "创建自定义词性", "如果已有该对应词性", "则直接返回已有的词性" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/tag/Nature.java#L839-L845
train
Create a Nature object from a string.
[ 30522, 2270, 10763, 2345, 3267, 3443, 1006, 5164, 2171, 1007, 1063, 3267, 3267, 1027, 2013, 3367, 4892, 1006, 2171, 1007, 1025, 2065, 1006, 3267, 1027, 1027, 19701, 1007, 2709, 2047, 3267, 1006, 2171, 1007, 1025, 2709, 3267, 1025, 1065, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/MySQLErrPacketFactory.java
MySQLErrPacketFactory.newInstance
public static MySQLErrPacket newInstance(final int sequenceId, final Exception cause) { if (cause instanceof SQLException) { SQLException sqlException = (SQLException) cause; return new MySQLErrPacket(sequenceId, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage()); } if (cause instanceof ShardingCTLException) { ShardingCTLException shardingCTLException = (ShardingCTLException) cause; return new MySQLErrPacket(sequenceId, ShardingCTLErrorCode.valueOf(shardingCTLException), shardingCTLException.getShardingCTL()); } if (cause instanceof TableModifyInTransactionException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, ((TableModifyInTransactionException) cause).getTableName()); } if (cause instanceof UnknownDatabaseException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) cause).getDatabaseName()); } if (cause instanceof NoDatabaseSelectedException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_NO_DB_ERROR); } return new MySQLErrPacket(sequenceId, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage()); }
java
public static MySQLErrPacket newInstance(final int sequenceId, final Exception cause) { if (cause instanceof SQLException) { SQLException sqlException = (SQLException) cause; return new MySQLErrPacket(sequenceId, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage()); } if (cause instanceof ShardingCTLException) { ShardingCTLException shardingCTLException = (ShardingCTLException) cause; return new MySQLErrPacket(sequenceId, ShardingCTLErrorCode.valueOf(shardingCTLException), shardingCTLException.getShardingCTL()); } if (cause instanceof TableModifyInTransactionException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_ERROR_ON_MODIFYING_GTID_EXECUTED_TABLE, ((TableModifyInTransactionException) cause).getTableName()); } if (cause instanceof UnknownDatabaseException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_BAD_DB_ERROR, ((UnknownDatabaseException) cause).getDatabaseName()); } if (cause instanceof NoDatabaseSelectedException) { return new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_NO_DB_ERROR); } return new MySQLErrPacket(sequenceId, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage()); }
[ "public", "static", "MySQLErrPacket", "newInstance", "(", "final", "int", "sequenceId", ",", "final", "Exception", "cause", ")", "{", "if", "(", "cause", "instanceof", "SQLException", ")", "{", "SQLException", "sqlException", "=", "(", "SQLException", ")", "caus...
New instance of MytSQL ERR packet. @param sequenceId sequence ID @param cause cause @return instance of MySQL ERR packet
[ "New", "instance", "of", "MytSQL", "ERR", "packet", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/MySQLErrPacketFactory.java#L48-L67
train
Create new instance of MySQLErrPacket.
[ 30522, 2270, 10763, 2026, 2015, 4160, 3917, 14536, 8684, 3388, 2047, 7076, 26897, 1006, 2345, 20014, 5537, 3593, 1010, 2345, 6453, 3426, 1007, 1063, 2065, 1006, 3426, 6013, 11253, 29296, 10288, 24422, 1007, 1063, 29296, 10288, 24422, 29296, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java
NeuralNetworkParser.setup_system
void setup_system() { system = new TransitionSystem(); system.set_root_relation(deprels_alphabet.idOf(root)); system.set_number_of_relations(deprels_alphabet.size() - 2); }
java
void setup_system() { system = new TransitionSystem(); system.set_root_relation(deprels_alphabet.idOf(root)); system.set_number_of_relations(deprels_alphabet.size() - 2); }
[ "void", "setup_system", "(", ")", "{", "system", "=", "new", "TransitionSystem", "(", ")", ";", "system", ".", "set_root_relation", "(", "deprels_alphabet", ".", "idOf", "(", "root", ")", ")", ";", "system", ".", "set_number_of_relations", "(", "deprels_alphab...
初始化
[ "初始化" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L375-L380
train
Setup the system.
[ 30522, 11675, 16437, 1035, 2291, 1006, 1007, 1063, 2291, 1027, 2047, 22166, 27268, 6633, 1006, 1007, 1025, 2291, 1012, 2275, 1035, 7117, 1035, 7189, 1006, 2139, 28139, 4877, 1035, 12440, 1012, 8909, 11253, 1006, 7117, 1007, 1007, 1025, 2291...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java
WindowedStream.apply
public <R> SingleOutputStreamOperator<R> apply(WindowFunction<T, R, K, W> function) { TypeInformation<R> resultType = getWindowFunctionReturnType(function, getInputType()); return apply(function, resultType); }
java
public <R> SingleOutputStreamOperator<R> apply(WindowFunction<T, R, K, W> function) { TypeInformation<R> resultType = getWindowFunctionReturnType(function, getInputType()); return apply(function, resultType); }
[ "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "apply", "(", "WindowFunction", "<", "T", ",", "R", ",", "K", ",", "W", ">", "function", ")", "{", "TypeInformation", "<", "R", ">", "resultType", "=", "getWindowFunctionReturnType", "("...
Applies the given window function to each window. The window function is called for each evaluation of the window for each key individually. The output of the window function is interpreted as a regular non-windowed stream. <p>Note that this function requires that all data in the windows is buffered until the window is evaluated, as the function provides no means of incremental aggregation. @param function The window function. @return The data stream that is the result of applying the window function to the window.
[ "Applies", "the", "given", "window", "function", "to", "each", "window", ".", "The", "window", "function", "is", "called", "for", "each", "evaluation", "of", "the", "window", "for", "each", "key", "individually", ".", "The", "output", "of", "the", "window", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L1018-L1022
train
Applies the given window function to this stream.
[ 30522, 2270, 1026, 1054, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 1054, 1028, 6611, 1006, 3332, 11263, 27989, 1026, 1056, 1010, 1054, 1010, 1047, 1010, 1059, 1028, 3853, 1007, 1063, 2828, 2378, 14192, 3370, 1026, 1054, 1028, 2765,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
HiveSessionImplwithUGI.cancelDelegationToken
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
java
private void cancelDelegationToken() throws HiveSQLException { if (delegationTokenStr != null) { try { Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr); } catch (HiveException e) { throw new HiveSQLException("Couldn't cancel delegation token", e); } // close the metastore connection created with this delegation token Hive.closeCurrent(); } }
[ "private", "void", "cancelDelegationToken", "(", ")", "throws", "HiveSQLException", "{", "if", "(", "delegationTokenStr", "!=", "null", ")", "{", "try", "{", "Hive", ".", "get", "(", "getHiveConf", "(", ")", ")", ".", "cancelDelegationToken", "(", "delegationT...
If the session has a delegation token obtained from the metastore, then cancel it
[ "If", "the", "session", "has", "a", "delegation", "token", "obtained", "from", "the", "metastore", "then", "cancel", "it" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L141-L151
train
Cancel the delegation token
[ 30522, 2797, 11675, 17542, 9247, 29107, 3508, 18715, 2368, 1006, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1063, 2065, 1006, 10656, 18715, 6132, 16344, 999, 1027, 19701, 1007, 1063, 3046, 1063, 26736, 1012, 2131, 1006, 2131, 4048, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException { writeJpg(scale(srcImage, width, height, fixedColor), destImageStream); }
java
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException { writeJpg(scale(srcImage, width, height, fixedColor), destImageStream); }
[ "public", "static", "void", "scale", "(", "Image", "srcImage", ",", "ImageOutputStream", "destImageStream", ",", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "throws", "IORuntimeException", "{", "writeJpg", "(", "scale", "(", "srcImage"...
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcImage 源图像 @param destImageStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式,此方法并不关闭流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L229-L231
train
Scales the image using the specified color and writes it to the specified output stream.
[ 30522, 2270, 10763, 11675, 4094, 1006, 3746, 5034, 6895, 26860, 1010, 3746, 5833, 18780, 21422, 4078, 3775, 26860, 21422, 1010, 20014, 9381, 1010, 20014, 4578, 1010, 3609, 4964, 18717, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 4339...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java
DataSetUtils.zipWithIndex
public static <T> DataSet<Tuple2<Long, T>> zipWithIndex(DataSet<T> input) { DataSet<Tuple2<Integer, Long>> elementCount = countElementsPerPartition(input); return input.mapPartition(new RichMapPartitionFunction<T, Tuple2<Long, T>>() { long start = 0; @Override public void open(Configuration parameters) throws Exception { super.open(parameters); List<Tuple2<Integer, Long>> offsets = getRuntimeContext().getBroadcastVariableWithInitializer( "counts", new BroadcastVariableInitializer<Tuple2<Integer, Long>, List<Tuple2<Integer, Long>>>() { @Override public List<Tuple2<Integer, Long>> initializeBroadcastVariable(Iterable<Tuple2<Integer, Long>> data) { // sort the list by task id to calculate the correct offset List<Tuple2<Integer, Long>> sortedData = new ArrayList<>(); for (Tuple2<Integer, Long> datum : data) { sortedData.add(datum); } Collections.sort(sortedData, new Comparator<Tuple2<Integer, Long>>() { @Override public int compare(Tuple2<Integer, Long> o1, Tuple2<Integer, Long> o2) { return o1.f0.compareTo(o2.f0); } }); return sortedData; } }); // compute the offset for each partition for (int i = 0; i < getRuntimeContext().getIndexOfThisSubtask(); i++) { start += offsets.get(i).f1; } } @Override public void mapPartition(Iterable<T> values, Collector<Tuple2<Long, T>> out) throws Exception { for (T value: values) { out.collect(new Tuple2<>(start++, value)); } } }).withBroadcastSet(elementCount, "counts"); }
java
public static <T> DataSet<Tuple2<Long, T>> zipWithIndex(DataSet<T> input) { DataSet<Tuple2<Integer, Long>> elementCount = countElementsPerPartition(input); return input.mapPartition(new RichMapPartitionFunction<T, Tuple2<Long, T>>() { long start = 0; @Override public void open(Configuration parameters) throws Exception { super.open(parameters); List<Tuple2<Integer, Long>> offsets = getRuntimeContext().getBroadcastVariableWithInitializer( "counts", new BroadcastVariableInitializer<Tuple2<Integer, Long>, List<Tuple2<Integer, Long>>>() { @Override public List<Tuple2<Integer, Long>> initializeBroadcastVariable(Iterable<Tuple2<Integer, Long>> data) { // sort the list by task id to calculate the correct offset List<Tuple2<Integer, Long>> sortedData = new ArrayList<>(); for (Tuple2<Integer, Long> datum : data) { sortedData.add(datum); } Collections.sort(sortedData, new Comparator<Tuple2<Integer, Long>>() { @Override public int compare(Tuple2<Integer, Long> o1, Tuple2<Integer, Long> o2) { return o1.f0.compareTo(o2.f0); } }); return sortedData; } }); // compute the offset for each partition for (int i = 0; i < getRuntimeContext().getIndexOfThisSubtask(); i++) { start += offsets.get(i).f1; } } @Override public void mapPartition(Iterable<T> values, Collector<Tuple2<Long, T>> out) throws Exception { for (T value: values) { out.collect(new Tuple2<>(start++, value)); } } }).withBroadcastSet(elementCount, "counts"); }
[ "public", "static", "<", "T", ">", "DataSet", "<", "Tuple2", "<", "Long", ",", "T", ">", ">", "zipWithIndex", "(", "DataSet", "<", "T", ">", "input", ")", "{", "DataSet", "<", "Tuple2", "<", "Integer", ",", "Long", ">", ">", "elementCount", "=", "c...
Method that assigns a unique {@link Long} value to all elements in the input data set. The generated values are consecutive. @param input the input data set @return a data set of tuple 2 consisting of consecutive ids and initial values.
[ "Method", "that", "assigns", "a", "unique", "{", "@link", "Long", "}", "value", "to", "all", "elements", "in", "the", "input", "data", "set", ".", "The", "generated", "values", "are", "consecutive", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L89-L134
train
Zip with index.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2951, 13462, 1026, 10722, 10814, 2475, 1026, 2146, 1010, 1056, 1028, 1028, 14101, 24415, 22254, 10288, 1006, 2951, 13462, 1026, 1056, 1028, 7953, 1007, 1063, 2951, 13462, 1026, 10722, 10814, 2475, 1026, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/ResultSetUtil.java
ResultSetUtil.convertValue
public static Object convertValue(final Object value, final Class<?> convertType) { if (null == value) { return convertNullValue(convertType); } if (value.getClass() == convertType) { return value; } if (value instanceof Number) { return convertNumberValue(value, convertType); } if (value instanceof Date) { return convertDateValue(value, convertType); } if (String.class.equals(convertType)) { return value.toString(); } else { return value; } }
java
public static Object convertValue(final Object value, final Class<?> convertType) { if (null == value) { return convertNullValue(convertType); } if (value.getClass() == convertType) { return value; } if (value instanceof Number) { return convertNumberValue(value, convertType); } if (value instanceof Date) { return convertDateValue(value, convertType); } if (String.class.equals(convertType)) { return value.toString(); } else { return value; } }
[ "public", "static", "Object", "convertValue", "(", "final", "Object", "value", ",", "final", "Class", "<", "?", ">", "convertType", ")", "{", "if", "(", "null", "==", "value", ")", "{", "return", "convertNullValue", "(", "convertType", ")", ";", "}", "if...
Convert value via expected class type. @param value original value @param convertType expected class type @return converted value
[ "Convert", "value", "via", "expected", "class", "type", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/ResultSetUtil.java#L44-L62
train
Convert value.
[ 30522, 2270, 10763, 4874, 10463, 10175, 5657, 1006, 2345, 4874, 3643, 1010, 2345, 2465, 1026, 1029, 1028, 10463, 13874, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 3643, 1007, 1063, 2709, 10463, 11231, 3363, 10175, 5657, 1006, 10463, 13874, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
NetworkBufferPool.createBufferPool
@Override public BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers) throws IOException { return createBufferPool(numRequiredBuffers, maxUsedBuffers, Optional.empty()); }
java
@Override public BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers) throws IOException { return createBufferPool(numRequiredBuffers, maxUsedBuffers, Optional.empty()); }
[ "@", "Override", "public", "BufferPool", "createBufferPool", "(", "int", "numRequiredBuffers", ",", "int", "maxUsedBuffers", ")", "throws", "IOException", "{", "return", "createBufferPool", "(", "numRequiredBuffers", ",", "maxUsedBuffers", ",", "Optional", ".", "empty...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java#L255-L258
train
Create a buffer pool.
[ 30522, 1030, 2058, 15637, 2270, 17698, 16869, 3443, 8569, 12494, 16869, 1006, 20014, 16371, 2213, 2890, 15549, 5596, 8569, 12494, 2015, 1010, 20014, 4098, 13901, 8569, 12494, 2015, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 3443, 8569, 124...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec/src/main/java/io/netty/handler/codec/HeadersUtils.java
HeadersUtils.namesAsString
public static Set<String> namesAsString(Headers<CharSequence, CharSequence, ?> headers) { return new CharSequenceDelegatingStringSet(headers.names()); }
java
public static Set<String> namesAsString(Headers<CharSequence, CharSequence, ?> headers) { return new CharSequenceDelegatingStringSet(headers.names()); }
[ "public", "static", "Set", "<", "String", ">", "namesAsString", "(", "Headers", "<", "CharSequence", ",", "CharSequence", ",", "?", ">", "headers", ")", "{", "return", "new", "CharSequenceDelegatingStringSet", "(", "headers", ".", "names", "(", ")", ")", ";"...
{@link Headers#names()} and convert each element of {@link Set} to a {@link String}. @param headers the headers to get the names from @return a {@link Set} of header values or an empty {@link Set} if no values are found.
[ "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/HeadersUtils.java#L106-L108
train
Returns a set of names as a string set.
[ 30522, 2270, 10763, 2275, 1026, 5164, 1028, 3415, 12054, 18886, 3070, 1006, 20346, 2015, 1026, 25869, 3366, 4226, 5897, 1010, 25869, 3366, 4226, 5897, 1010, 1029, 1028, 20346, 2015, 1007, 1063, 2709, 2047, 25869, 3366, 4226, 5897, 9247, 291...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java
FileInputFormat.setFilePaths
public void setFilePaths(String... filePaths) { Path[] paths = new Path[filePaths.length]; for (int i = 0; i < paths.length; i++) { paths[i] = new Path(filePaths[i]); } setFilePaths(paths); }
java
public void setFilePaths(String... filePaths) { Path[] paths = new Path[filePaths.length]; for (int i = 0; i < paths.length; i++) { paths[i] = new Path(filePaths[i]); } setFilePaths(paths); }
[ "public", "void", "setFilePaths", "(", "String", "...", "filePaths", ")", "{", "Path", "[", "]", "paths", "=", "new", "Path", "[", "filePaths", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "paths", ".", "length", ";", ...
Sets multiple paths of files to be read. @param filePaths The paths of the files to read.
[ "Sets", "multiple", "paths", "of", "files", "to", "be", "read", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L340-L346
train
Sets the file paths.
[ 30522, 2270, 11675, 2275, 8873, 2571, 15069, 2015, 1006, 5164, 1012, 1012, 1012, 5371, 15069, 2015, 1007, 1063, 4130, 1031, 1033, 10425, 1027, 2047, 4130, 1031, 5371, 15069, 2015, 1012, 3091, 1033, 1025, 2005, 1006, 20014, 1045, 1027, 1014,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readUtf8Lines
public static List<String> readUtf8Lines(URL url) throws IORuntimeException { return readLines(url, CharsetUtil.CHARSET_UTF_8); }
java
public static List<String> readUtf8Lines(URL url) throws IORuntimeException { return readLines(url, CharsetUtil.CHARSET_UTF_8); }
[ "public", "static", "List", "<", "String", ">", "readUtf8Lines", "(", "URL", "url", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "url", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ";", "}" ]
从文件中读取每一行数据 @param url 文件的URL @return 文件中的每行内容的集合List @throws IORuntimeException IO异常
[ "从文件中读取每一行数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2295-L2297
train
Reads the contents of the given URL as UTF - 8 lines.
[ 30522, 2270, 10763, 2862, 1026, 5164, 1028, 3191, 4904, 2546, 2620, 12735, 1006, 24471, 2140, 24471, 2140, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2709, 3191, 12735, 1006, 24471, 2140, 1010, 25869, 13462, 21823, 2140, 1012, 25869...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.timestampToString
public static String timestampToString(long ts, int precision, TimeZone tz) { int p = (precision <= 3 && precision >= 0) ? precision : 3; String format = DEFAULT_DATETIME_FORMATS[p]; return dateFormat(ts, format, tz); }
java
public static String timestampToString(long ts, int precision, TimeZone tz) { int p = (precision <= 3 && precision >= 0) ? precision : 3; String format = DEFAULT_DATETIME_FORMATS[p]; return dateFormat(ts, format, tz); }
[ "public", "static", "String", "timestampToString", "(", "long", "ts", ",", "int", "precision", ",", "TimeZone", "tz", ")", "{", "int", "p", "=", "(", "precision", "<=", "3", "&&", "precision", ">=", "0", ")", "?", "precision", ":", "3", ";", "String", ...
Convert a timestamp to string. @param ts the timestamp to convert. @param precision the milli second precision to preserve @param tz the time zone
[ "Convert", "a", "timestamp", "to", "string", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L391-L395
train
Convert a timestamp to a string.
[ 30522, 2270, 10763, 5164, 2335, 15464, 13876, 14122, 4892, 1006, 2146, 24529, 1010, 20014, 11718, 1010, 2051, 15975, 1056, 2480, 1007, 1063, 20014, 1052, 1027, 1006, 11718, 1026, 1027, 1017, 1004, 1004, 11718, 1028, 1027, 1014, 1007, 1029, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/utility/TextUtility.java
TextUtility.isAllIndex
public static boolean isAllIndex(byte[] sString) { int nLen = sString.length; int i = 0; while (i < nLen - 1 && getUnsigned(sString[i]) == 162) { i += 2; } if (i >= nLen) return true; while (i < nLen && (sString[i] > 'A' - 1 && sString[i] < 'Z' + 1) || (sString[i] > 'a' - 1 && sString[i] < 'z' + 1)) {// single // byte // number // char i += 1; } if (i < nLen) return false; return true; }
java
public static boolean isAllIndex(byte[] sString) { int nLen = sString.length; int i = 0; while (i < nLen - 1 && getUnsigned(sString[i]) == 162) { i += 2; } if (i >= nLen) return true; while (i < nLen && (sString[i] > 'A' - 1 && sString[i] < 'Z' + 1) || (sString[i] > 'a' - 1 && sString[i] < 'z' + 1)) {// single // byte // number // char i += 1; } if (i < nLen) return false; return true; }
[ "public", "static", "boolean", "isAllIndex", "(", "byte", "[", "]", "sString", ")", "{", "int", "nLen", "=", "sString", ".", "length", ";", "int", "i", "=", "0", ";", "while", "(", "i", "<", "nLen", "-", "1", "&&", "getUnsigned", "(", "sString", "[...
是否全是序号 @param sString @return
[ "是否全是序号" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/TextUtility.java#L210-L234
train
is all index of a string in a CIS file
[ 30522, 2270, 10763, 22017, 20898, 18061, 21202, 3207, 2595, 1006, 24880, 1031, 1033, 7020, 18886, 3070, 1007, 1063, 20014, 17953, 2368, 1027, 7020, 18886, 3070, 1012, 3091, 1025, 20014, 1045, 1027, 1014, 1025, 2096, 1006, 1045, 1026, 17953, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
http-url/src/main/java/com/networknt/url/URLNormalizer.java
URLNormalizer.addDomainTrailingSlash
public URLNormalizer addDomainTrailingSlash() { String urlRoot = HttpURL.getRoot(url); String path = toURL().getPath(); if (StringUtils.isNotBlank(path)) { // there is a path so do nothing return this; } String urlRootAndPath = urlRoot + "/"; url = StringUtils.replaceOnce(url, urlRoot, urlRootAndPath); return this; }
java
public URLNormalizer addDomainTrailingSlash() { String urlRoot = HttpURL.getRoot(url); String path = toURL().getPath(); if (StringUtils.isNotBlank(path)) { // there is a path so do nothing return this; } String urlRootAndPath = urlRoot + "/"; url = StringUtils.replaceOnce(url, urlRoot, urlRootAndPath); return this; }
[ "public", "URLNormalizer", "addDomainTrailingSlash", "(", ")", "{", "String", "urlRoot", "=", "HttpURL", ".", "getRoot", "(", "url", ")", ";", "String", "path", "=", "toURL", "(", ")", ".", "getPath", "(", ")", ";", "if", "(", "StringUtils", ".", "isNotB...
<p>Adds a trailing slash (/) right after the domain for URLs with no path, before any fragment (#) or query string (?).</p> <p><b>Please Note:</b> Adding a trailing slash to URLs could potentially break its semantic equivalence.</p> <code>http://www.example.com &rarr; http://www.example.com/</code> @return this instance @since 1.12.0
[ "<p", ">", "Adds", "a", "trailing", "slash", "(", "/", ")", "right", "after", "the", "domain", "for", "URLs", "with", "no", "path", "before", "any", "fragment", "(", "#", ")", "or", "query", "string", "(", "?", ")", ".", "<", "/", "p", ">" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L348-L358
train
Add a trailing slash to the URL.
[ 30522, 2270, 24471, 19666, 2953, 9067, 17629, 5587, 9527, 22325, 15118, 8613, 27067, 1006, 1007, 1063, 5164, 24471, 20974, 17206, 1027, 8299, 3126, 2140, 1012, 2131, 3217, 4140, 1006, 24471, 2140, 1007, 1025, 5164, 4130, 1027, 2778, 2140, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandler.java
HttpToHttp2ConnectionHandler.write
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!(msg instanceof HttpMessage || msg instanceof HttpContent)) { ctx.write(msg, promise); return; } boolean release = true; SimpleChannelPromiseAggregator promiseAggregator = new SimpleChannelPromiseAggregator(promise, ctx.channel(), ctx.executor()); try { Http2ConnectionEncoder encoder = encoder(); boolean endStream = false; if (msg instanceof HttpMessage) { final HttpMessage httpMsg = (HttpMessage) msg; // Provide the user the opportunity to specify the streamId currentStreamId = getStreamId(httpMsg.headers()); // Convert and write the headers. Http2Headers http2Headers = HttpConversionUtil.toHttp2Headers(httpMsg, validateHeaders); endStream = msg instanceof FullHttpMessage && !((FullHttpMessage) msg).content().isReadable(); writeHeaders(ctx, encoder, currentStreamId, httpMsg.headers(), http2Headers, endStream, promiseAggregator); } if (!endStream && msg instanceof HttpContent) { boolean isLastContent = false; HttpHeaders trailers = EmptyHttpHeaders.INSTANCE; Http2Headers http2Trailers = EmptyHttp2Headers.INSTANCE; if (msg instanceof LastHttpContent) { isLastContent = true; // Convert any trailing headers. final LastHttpContent lastContent = (LastHttpContent) msg; trailers = lastContent.trailingHeaders(); http2Trailers = HttpConversionUtil.toHttp2Headers(trailers, validateHeaders); } // Write the data final ByteBuf content = ((HttpContent) msg).content(); endStream = isLastContent && trailers.isEmpty(); release = false; encoder.writeData(ctx, currentStreamId, content, 0, endStream, promiseAggregator.newPromise()); if (!trailers.isEmpty()) { // Write trailing headers. writeHeaders(ctx, encoder, currentStreamId, trailers, http2Trailers, true, promiseAggregator); } } } catch (Throwable t) { onError(ctx, true, t); promiseAggregator.setFailure(t); } finally { if (release) { ReferenceCountUtil.release(msg); } promiseAggregator.doneAllocatingPromises(); } }
java
@Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { if (!(msg instanceof HttpMessage || msg instanceof HttpContent)) { ctx.write(msg, promise); return; } boolean release = true; SimpleChannelPromiseAggregator promiseAggregator = new SimpleChannelPromiseAggregator(promise, ctx.channel(), ctx.executor()); try { Http2ConnectionEncoder encoder = encoder(); boolean endStream = false; if (msg instanceof HttpMessage) { final HttpMessage httpMsg = (HttpMessage) msg; // Provide the user the opportunity to specify the streamId currentStreamId = getStreamId(httpMsg.headers()); // Convert and write the headers. Http2Headers http2Headers = HttpConversionUtil.toHttp2Headers(httpMsg, validateHeaders); endStream = msg instanceof FullHttpMessage && !((FullHttpMessage) msg).content().isReadable(); writeHeaders(ctx, encoder, currentStreamId, httpMsg.headers(), http2Headers, endStream, promiseAggregator); } if (!endStream && msg instanceof HttpContent) { boolean isLastContent = false; HttpHeaders trailers = EmptyHttpHeaders.INSTANCE; Http2Headers http2Trailers = EmptyHttp2Headers.INSTANCE; if (msg instanceof LastHttpContent) { isLastContent = true; // Convert any trailing headers. final LastHttpContent lastContent = (LastHttpContent) msg; trailers = lastContent.trailingHeaders(); http2Trailers = HttpConversionUtil.toHttp2Headers(trailers, validateHeaders); } // Write the data final ByteBuf content = ((HttpContent) msg).content(); endStream = isLastContent && trailers.isEmpty(); release = false; encoder.writeData(ctx, currentStreamId, content, 0, endStream, promiseAggregator.newPromise()); if (!trailers.isEmpty()) { // Write trailing headers. writeHeaders(ctx, encoder, currentStreamId, trailers, http2Trailers, true, promiseAggregator); } } } catch (Throwable t) { onError(ctx, true, t); promiseAggregator.setFailure(t); } finally { if (release) { ReferenceCountUtil.release(msg); } promiseAggregator.doneAllocatingPromises(); } }
[ "@", "Override", "public", "void", "write", "(", "ChannelHandlerContext", "ctx", ",", "Object", "msg", ",", "ChannelPromise", "promise", ")", "{", "if", "(", "!", "(", "msg", "instanceof", "HttpMessage", "||", "msg", "instanceof", "HttpContent", ")", ")", "{...
Handles conversion of {@link HttpMessage} and {@link HttpContent} to HTTP/2 frames.
[ "Handles", "conversion", "of", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandler.java#L70-L130
train
Write the message to the channel.
[ 30522, 1030, 2058, 15637, 2270, 11675, 4339, 1006, 3149, 11774, 3917, 8663, 18209, 14931, 2595, 1010, 4874, 5796, 2290, 1010, 3149, 21572, 28732, 4872, 1007, 1063, 2065, 1006, 999, 1006, 5796, 2290, 6013, 11253, 8299, 7834, 3736, 3351, 1064...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/crf/CRFModel.java
CRFModel.loadBin
public static CRFModel loadBin(String path) { ByteArray byteArray = ByteArray.createByteArray(path); if (byteArray == null) return null; CRFModel model = new CRFModel(); if (model.load(byteArray)) return model; return null; }
java
public static CRFModel loadBin(String path) { ByteArray byteArray = ByteArray.createByteArray(path); if (byteArray == null) return null; CRFModel model = new CRFModel(); if (model.load(byteArray)) return model; return null; }
[ "public", "static", "CRFModel", "loadBin", "(", "String", "path", ")", "{", "ByteArray", "byteArray", "=", "ByteArray", ".", "createByteArray", "(", "path", ")", ";", "if", "(", "byteArray", "==", "null", ")", "return", "null", ";", "CRFModel", "model", "=...
加载Bin形式的CRF++模型<br> 注意该Bin形式不是CRF++的二进制模型,而是HanLP由CRF++的文本模型转换过来的私有格式 @param path @return
[ "加载Bin形式的CRF", "++", "模型<br", ">", "注意该Bin形式不是CRF", "++", "的二进制模型", "而是HanLP由CRF", "++", "的文本模型转换过来的私有格式" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/CRFModel.java#L428-L435
train
Load a CRFModel from a binary file.
[ 30522, 2270, 10763, 13675, 16715, 10244, 2140, 7170, 8428, 1006, 5164, 4130, 1007, 1063, 24880, 2906, 9447, 24880, 2906, 9447, 1027, 24880, 2906, 9447, 1012, 3443, 3762, 27058, 11335, 2100, 1006, 4130, 1007, 1025, 2065, 1006, 24880, 2906, 9...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java
Viterbi.computeEnumSimply
public static <E extends Enum<E>> List<E> computeEnumSimply(List<EnumItem<E>> roleTagList, TransformMatrixDictionary<E> transformMatrixDictionary) { int length = roleTagList.size() - 1; List<E> tagList = new LinkedList<E>(); Iterator<EnumItem<E>> iterator = roleTagList.iterator(); EnumItem<E> start = iterator.next(); E pre = start.labelMap.entrySet().iterator().next().getKey(); E perfect_tag = pre; // 第一个是确定的 tagList.add(pre); for (int i = 0; i < length; ++i) { double perfect_cost = Double.MAX_VALUE; EnumItem<E> item = iterator.next(); for (E cur : item.labelMap.keySet()) { double now = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur)); if (perfect_cost > now) { perfect_cost = now; perfect_tag = cur; } } pre = perfect_tag; tagList.add(pre); } return tagList; }
java
public static <E extends Enum<E>> List<E> computeEnumSimply(List<EnumItem<E>> roleTagList, TransformMatrixDictionary<E> transformMatrixDictionary) { int length = roleTagList.size() - 1; List<E> tagList = new LinkedList<E>(); Iterator<EnumItem<E>> iterator = roleTagList.iterator(); EnumItem<E> start = iterator.next(); E pre = start.labelMap.entrySet().iterator().next().getKey(); E perfect_tag = pre; // 第一个是确定的 tagList.add(pre); for (int i = 0; i < length; ++i) { double perfect_cost = Double.MAX_VALUE; EnumItem<E> item = iterator.next(); for (E cur : item.labelMap.keySet()) { double now = transformMatrixDictionary.transititon_probability[pre.ordinal()][cur.ordinal()] - Math.log((item.getFrequency(cur) + 1e-8) / transformMatrixDictionary.getTotalFrequency(cur)); if (perfect_cost > now) { perfect_cost = now; perfect_tag = cur; } } pre = perfect_tag; tagList.add(pre); } return tagList; }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "List", "<", "E", ">", "computeEnumSimply", "(", "List", "<", "EnumItem", "<", "E", ">", ">", "roleTagList", ",", "TransformMatrixDictionary", "<", "E", ">", "transformMatrixDictionary", ...
仅仅利用了转移矩阵的“维特比”算法 @param roleTagList 观测序列 @param transformMatrixDictionary 转移矩阵 @param <E> EnumItem的具体类型 @return 预测结果
[ "仅仅利用了转移矩阵的“维特比”算法" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/Viterbi.java#L243-L270
train
Compute the list of tag simply.
[ 30522, 2270, 10763, 1026, 1041, 8908, 4372, 2819, 1026, 1041, 1028, 1028, 2862, 1026, 1041, 1028, 24134, 2368, 18163, 5714, 22086, 1006, 2862, 1026, 4372, 12717, 18532, 1026, 1041, 1028, 1028, 2535, 15900, 9863, 1010, 10938, 18900, 17682, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java
LogBuffer.getUlong56
public final long getUlong56() { if (position + 6 >= origin + limit) throw new IllegalArgumentException("limit excceed: " + (position - origin + 6)); byte[] buf = buffer; return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 48); }
java
public final long getUlong56() { if (position + 6 >= origin + limit) throw new IllegalArgumentException("limit excceed: " + (position - origin + 6)); byte[] buf = buffer; return ((long) (0xff & buf[position++])) | ((long) (0xff & buf[position++]) << 8) | ((long) (0xff & buf[position++]) << 16) | ((long) (0xff & buf[position++]) << 24) | ((long) (0xff & buf[position++]) << 32) | ((long) (0xff & buf[position++]) << 40) | ((long) (0xff & buf[position++]) << 48); }
[ "public", "final", "long", "getUlong56", "(", ")", "{", "if", "(", "position", "+", "6", ">=", "origin", "+", "limit", ")", "throw", "new", "IllegalArgumentException", "(", "\"limit excceed: \"", "+", "(", "position", "-", "origin", "+", "6", ")", ")", "...
Return next 56-bit unsigned int from buffer. (little-endian)
[ "Return", "next", "56", "-", "bit", "unsigned", "int", "from", "buffer", ".", "(", "little", "-", "endian", ")" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L791-L800
train
Gets the ulong 56 from the buffer.
[ 30522, 2270, 2345, 2146, 2131, 18845, 3070, 26976, 1006, 1007, 1063, 2065, 1006, 2597, 1009, 1020, 1028, 1027, 4761, 1009, 5787, 1007, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 5787, 4654, 9468, 13089, 1024, 1000, 1009,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java
ServiceCapabilitiesReportGenerator.generate
public String generate(String url) throws IOException { Object content = this.initializrService.loadServiceCapabilities(url); if (content instanceof InitializrServiceMetadata) { return generateHelp(url, (InitializrServiceMetadata) content); } return content.toString(); }
java
public String generate(String url) throws IOException { Object content = this.initializrService.loadServiceCapabilities(url); if (content instanceof InitializrServiceMetadata) { return generateHelp(url, (InitializrServiceMetadata) content); } return content.toString(); }
[ "public", "String", "generate", "(", "String", "url", ")", "throws", "IOException", "{", "Object", "content", "=", "this", ".", "initializrService", ".", "loadServiceCapabilities", "(", "url", ")", ";", "if", "(", "content", "instanceof", "InitializrServiceMetadat...
Generate a report for the specified service. The report contains the available capabilities as advertised by the root endpoint. @param url the url of the service @return the report that describes the service @throws IOException if the report cannot be generated
[ "Generate", "a", "report", "for", "the", "specified", "service", ".", "The", "report", "contains", "the", "available", "capabilities", "as", "advertised", "by", "the", "root", "endpoint", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java#L58-L64
train
Generate a help page for the given URL.
[ 30522, 2270, 5164, 9699, 1006, 5164, 24471, 2140, 1007, 11618, 22834, 10288, 24422, 1063, 4874, 4180, 1027, 2023, 1012, 3988, 10993, 22573, 2099, 7903, 2063, 1012, 15665, 2121, 7903, 19281, 4502, 14680, 1006, 24471, 2140, 1007, 1025, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/common/MemoryQueryResultRow.java
MemoryQueryResultRow.setCell
public void setCell(final int columnIndex, final Object value) { Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1); data[columnIndex - 1] = value; }
java
public void setCell(final int columnIndex, final Object value) { Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1); data[columnIndex - 1] = value; }
[ "public", "void", "setCell", "(", "final", "int", "columnIndex", ",", "final", "Object", "value", ")", "{", "Preconditions", ".", "checkArgument", "(", "columnIndex", ">", "0", "&&", "columnIndex", "<", "data", ".", "length", "+", "1", ")", ";", "data", ...
Set data for cell. @param columnIndex column index @param value data for cell
[ "Set", "data", "for", "cell", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/common/MemoryQueryResultRow.java#L64-L67
train
Sets the value of the specified column.
[ 30522, 2270, 11675, 2275, 29109, 2140, 1006, 2345, 20014, 5930, 22254, 10288, 1010, 2345, 4874, 3643, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 5930, 22254, 10288, 1028, 1014, 1004, 1004, 5930, 22254, 10288, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java
CompactingHashTable.getProber
@Override public <PT> HashTableProber<PT> getProber(TypeComparator<PT> probeSideComparator, TypePairComparator<PT, T> pairComparator) { return new HashTableProber<PT>(probeSideComparator, pairComparator); }
java
@Override public <PT> HashTableProber<PT> getProber(TypeComparator<PT> probeSideComparator, TypePairComparator<PT, T> pairComparator) { return new HashTableProber<PT>(probeSideComparator, pairComparator); }
[ "@", "Override", "public", "<", "PT", ">", "HashTableProber", "<", "PT", ">", "getProber", "(", "TypeComparator", "<", "PT", ">", "probeSideComparator", ",", "TypePairComparator", "<", "PT", ",", "T", ">", "pairComparator", ")", "{", "return", "new", "HashTa...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/CompactingHashTable.java#L658-L661
train
Get a new instance of the HashTableProber interface.
[ 30522, 1030, 2058, 15637, 2270, 1026, 13866, 1028, 23325, 10880, 21572, 5677, 1026, 13866, 1028, 2131, 21572, 5677, 1006, 2828, 9006, 28689, 4263, 1026, 13866, 1028, 15113, 7363, 9006, 28689, 4263, 1010, 2828, 4502, 4313, 9006, 28689, 4263, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.readKeyStore
public static KeyStore readKeyStore(String type, InputStream in, char[] password) { KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(type); keyStore.load(in, password); } catch (Exception e) { throw new CryptoException(e); } return keyStore; }
java
public static KeyStore readKeyStore(String type, InputStream in, char[] password) { KeyStore keyStore = null; try { keyStore = KeyStore.getInstance(type); keyStore.load(in, password); } catch (Exception e) { throw new CryptoException(e); } return keyStore; }
[ "public", "static", "KeyStore", "readKeyStore", "(", "String", "type", ",", "InputStream", "in", ",", "char", "[", "]", "password", ")", "{", "KeyStore", "keyStore", "=", "null", ";", "try", "{", "keyStore", "=", "KeyStore", ".", "getInstance", "(", "type"...
读取KeyStore文件<br> KeyStore文件用于数字证书的密钥对保存<br> see: http://snowolf.iteye.com/blog/391931 @param type 类型 @param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取 @param password 密码 @return {@link KeyStore}
[ "读取KeyStore文件<br", ">", "KeyStore文件用于数字证书的密钥对保存<br", ">", "see", ":", "http", ":", "//", "snowolf", ".", "iteye", ".", "com", "/", "blog", "/", "391931" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L571-L580
train
Reads a key store from an input stream.
[ 30522, 2270, 10763, 6309, 19277, 3191, 14839, 23809, 2063, 1006, 5164, 2828, 1010, 20407, 25379, 1999, 1010, 25869, 1031, 1033, 20786, 1007, 1063, 6309, 19277, 6309, 19277, 1027, 19701, 1025, 3046, 1063, 6309, 19277, 1027, 6309, 19277, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java
RepackageMojo.getSourceArtifact
private Artifact getSourceArtifact() { Artifact sourceArtifact = getArtifact(this.classifier); return (sourceArtifact != null) ? sourceArtifact : this.project.getArtifact(); }
java
private Artifact getSourceArtifact() { Artifact sourceArtifact = getArtifact(this.classifier); return (sourceArtifact != null) ? sourceArtifact : this.project.getArtifact(); }
[ "private", "Artifact", "getSourceArtifact", "(", ")", "{", "Artifact", "sourceArtifact", "=", "getArtifact", "(", "this", ".", "classifier", ")", ";", "return", "(", "sourceArtifact", "!=", "null", ")", "?", "sourceArtifact", ":", "this", ".", "project", ".", ...
Return the source {@link Artifact} to repackage. If a classifier is specified and an artifact with that classifier exists, it is used. Otherwise, the main artifact is used. @return the source artifact to repackage
[ "Return", "the", "source", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/RepackageMojo.java#L236-L239
train
Get the source artifact.
[ 30522, 2797, 20785, 4152, 8162, 21456, 28228, 7011, 6593, 1006, 1007, 1063, 20785, 3120, 8445, 10128, 18908, 1027, 2131, 8445, 10128, 18908, 1006, 2023, 1012, 2465, 18095, 1007, 1025, 2709, 1006, 3120, 8445, 10128, 18908, 999, 1027, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java
DoubleArrayTrie.transition
public int transition(char c, int from) { int b = from; int p; p = b + (int) (c) + 1; if (b == check[p]) b = base[p]; else return -1; return b; }
java
public int transition(char c, int from) { int b = from; int p; p = b + (int) (c) + 1; if (b == check[p]) b = base[p]; else return -1; return b; }
[ "public", "int", "transition", "(", "char", "c", ",", "int", "from", ")", "{", "int", "b", "=", "from", ";", "int", "p", ";", "p", "=", "b", "+", "(", "int", ")", "(", "c", ")", "+", "1", ";", "if", "(", "b", "==", "check", "[", "p", "]",...
转移状态 @param c @param from @return
[ "转移状态" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L1093-L1105
train
transition to a single character
[ 30522, 2270, 20014, 6653, 1006, 25869, 1039, 1010, 20014, 2013, 1007, 1063, 20014, 1038, 1027, 2013, 1025, 20014, 1052, 1025, 1052, 1027, 1038, 1009, 1006, 20014, 1007, 1006, 1039, 1007, 1009, 1015, 1025, 2065, 1006, 1038, 1027, 1027, 4638,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryExternalSorter.java
BinaryExternalSorter.startThreads
public void startThreads() { if (this.sortThread != null) { this.sortThread.start(); } if (this.spillThread != null) { this.spillThread.start(); } if (this.mergeThread != null) { this.mergeThread.start(); } }
java
public void startThreads() { if (this.sortThread != null) { this.sortThread.start(); } if (this.spillThread != null) { this.spillThread.start(); } if (this.mergeThread != null) { this.mergeThread.start(); } }
[ "public", "void", "startThreads", "(", ")", "{", "if", "(", "this", ".", "sortThread", "!=", "null", ")", "{", "this", ".", "sortThread", ".", "start", "(", ")", ";", "}", "if", "(", "this", ".", "spillThread", "!=", "null", ")", "{", "this", ".", ...
Starts all the threads that are used by this sorter.
[ "Starts", "all", "the", "threads", "that", "are", "used", "by", "this", "sorter", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/BinaryExternalSorter.java#L347-L357
train
Start all threads.
[ 30522, 2270, 11675, 2707, 2705, 16416, 5104, 1006, 1007, 1063, 2065, 1006, 2023, 1012, 4066, 2705, 16416, 2094, 999, 1027, 19701, 1007, 1063, 2023, 1012, 4066, 2705, 16416, 2094, 1012, 2707, 30524, 19701, 1007, 1063, 2023, 1012, 13590, 2705...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java
TransportClientFactory.createClient
private TransportClient createClient(InetSocketAddress address) throws IOException, InterruptedException { logger.debug("Creating new connection to {}", address); Bootstrap bootstrap = new Bootstrap(); bootstrap.group(workerGroup) .channel(socketChannelClass) // Disable Nagle's Algorithm since we don't want packets to wait .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, conf.connectionTimeoutMs()) .option(ChannelOption.ALLOCATOR, pooledAllocator); if (conf.receiveBuf() > 0) { bootstrap.option(ChannelOption.SO_RCVBUF, conf.receiveBuf()); } if (conf.sendBuf() > 0) { bootstrap.option(ChannelOption.SO_SNDBUF, conf.sendBuf()); } final AtomicReference<TransportClient> clientRef = new AtomicReference<>(); final AtomicReference<Channel> channelRef = new AtomicReference<>(); bootstrap.handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { TransportChannelHandler clientHandler = context.initializePipeline(ch); clientRef.set(clientHandler.getClient()); channelRef.set(ch); } }); // Connect to the remote server long preConnect = System.nanoTime(); ChannelFuture cf = bootstrap.connect(address); if (!cf.await(conf.connectionTimeoutMs())) { throw new IOException( String.format("Connecting to %s timed out (%s ms)", address, conf.connectionTimeoutMs())); } else if (cf.cause() != null) { throw new IOException(String.format("Failed to connect to %s", address), cf.cause()); } TransportClient client = clientRef.get(); Channel channel = channelRef.get(); assert client != null : "Channel future completed successfully with null client"; // Execute any client bootstraps synchronously before marking the Client as successful. long preBootstrap = System.nanoTime(); logger.debug("Connection to {} successful, running bootstraps...", address); try { for (TransportClientBootstrap clientBootstrap : clientBootstraps) { clientBootstrap.doBootstrap(client, channel); } } catch (Exception e) { // catch non-RuntimeExceptions too as bootstrap may be written in Scala long bootstrapTimeMs = (System.nanoTime() - preBootstrap) / 1000000; logger.error("Exception while bootstrapping client after " + bootstrapTimeMs + " ms", e); client.close(); throw Throwables.propagate(e); } long postBootstrap = System.nanoTime(); logger.info("Successfully created connection to {} after {} ms ({} ms spent in bootstraps)", address, (postBootstrap - preConnect) / 1000000, (postBootstrap - preBootstrap) / 1000000); return client; }
java
private TransportClient createClient(InetSocketAddress address) throws IOException, InterruptedException { logger.debug("Creating new connection to {}", address); Bootstrap bootstrap = new Bootstrap(); bootstrap.group(workerGroup) .channel(socketChannelClass) // Disable Nagle's Algorithm since we don't want packets to wait .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, conf.connectionTimeoutMs()) .option(ChannelOption.ALLOCATOR, pooledAllocator); if (conf.receiveBuf() > 0) { bootstrap.option(ChannelOption.SO_RCVBUF, conf.receiveBuf()); } if (conf.sendBuf() > 0) { bootstrap.option(ChannelOption.SO_SNDBUF, conf.sendBuf()); } final AtomicReference<TransportClient> clientRef = new AtomicReference<>(); final AtomicReference<Channel> channelRef = new AtomicReference<>(); bootstrap.handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) { TransportChannelHandler clientHandler = context.initializePipeline(ch); clientRef.set(clientHandler.getClient()); channelRef.set(ch); } }); // Connect to the remote server long preConnect = System.nanoTime(); ChannelFuture cf = bootstrap.connect(address); if (!cf.await(conf.connectionTimeoutMs())) { throw new IOException( String.format("Connecting to %s timed out (%s ms)", address, conf.connectionTimeoutMs())); } else if (cf.cause() != null) { throw new IOException(String.format("Failed to connect to %s", address), cf.cause()); } TransportClient client = clientRef.get(); Channel channel = channelRef.get(); assert client != null : "Channel future completed successfully with null client"; // Execute any client bootstraps synchronously before marking the Client as successful. long preBootstrap = System.nanoTime(); logger.debug("Connection to {} successful, running bootstraps...", address); try { for (TransportClientBootstrap clientBootstrap : clientBootstraps) { clientBootstrap.doBootstrap(client, channel); } } catch (Exception e) { // catch non-RuntimeExceptions too as bootstrap may be written in Scala long bootstrapTimeMs = (System.nanoTime() - preBootstrap) / 1000000; logger.error("Exception while bootstrapping client after " + bootstrapTimeMs + " ms", e); client.close(); throw Throwables.propagate(e); } long postBootstrap = System.nanoTime(); logger.info("Successfully created connection to {} after {} ms ({} ms spent in bootstraps)", address, (postBootstrap - preConnect) / 1000000, (postBootstrap - preBootstrap) / 1000000); return client; }
[ "private", "TransportClient", "createClient", "(", "InetSocketAddress", "address", ")", "throws", "IOException", ",", "InterruptedException", "{", "logger", ".", "debug", "(", "\"Creating new connection to {}\"", ",", "address", ")", ";", "Bootstrap", "bootstrap", "=", ...
Create a completely new {@link TransportClient} to the remote address.
[ "Create", "a", "completely", "new", "{" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java#L210-L276
train
Create a new connection to the remote server.
[ 30522, 2797, 3665, 20464, 11638, 3443, 20464, 11638, 30524, 1000, 1010, 4769, 1007, 1025, 6879, 6494, 2361, 6879, 6494, 2361, 1027, 2047, 6879, 6494, 2361, 1006, 1007, 1025, 6879, 6494, 2361, 1012, 2177, 1006, 7309, 17058, 1007, 1012, 3149,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractPartitionDiscoverer.java
AbstractPartitionDiscoverer.discoverPartitions
public List<KafkaTopicPartition> discoverPartitions() throws WakeupException, ClosedException { if (!closed && !wakeup) { try { List<KafkaTopicPartition> newDiscoveredPartitions; // (1) get all possible partitions, based on whether we are subscribed to fixed topics or a topic pattern if (topicsDescriptor.isFixedTopics()) { newDiscoveredPartitions = getAllPartitionsForTopics(topicsDescriptor.getFixedTopics()); } else { List<String> matchedTopics = getAllTopics(); // retain topics that match the pattern Iterator<String> iter = matchedTopics.iterator(); while (iter.hasNext()) { if (!topicsDescriptor.isMatchingTopic(iter.next())) { iter.remove(); } } if (matchedTopics.size() != 0) { // get partitions only for matched topics newDiscoveredPartitions = getAllPartitionsForTopics(matchedTopics); } else { newDiscoveredPartitions = null; } } // (2) eliminate partition that are old partitions or should not be subscribed by this subtask if (newDiscoveredPartitions == null || newDiscoveredPartitions.isEmpty()) { throw new RuntimeException("Unable to retrieve any partitions with KafkaTopicsDescriptor: " + topicsDescriptor); } else { Iterator<KafkaTopicPartition> iter = newDiscoveredPartitions.iterator(); KafkaTopicPartition nextPartition; while (iter.hasNext()) { nextPartition = iter.next(); if (!setAndCheckDiscoveredPartition(nextPartition)) { iter.remove(); } } } return newDiscoveredPartitions; } catch (WakeupException e) { // the actual topic / partition metadata fetching methods // may be woken up midway; reset the wakeup flag and rethrow wakeup = false; throw e; } } else if (!closed && wakeup) { // may have been woken up before the method call wakeup = false; throw new WakeupException(); } else { throw new ClosedException(); } }
java
public List<KafkaTopicPartition> discoverPartitions() throws WakeupException, ClosedException { if (!closed && !wakeup) { try { List<KafkaTopicPartition> newDiscoveredPartitions; // (1) get all possible partitions, based on whether we are subscribed to fixed topics or a topic pattern if (topicsDescriptor.isFixedTopics()) { newDiscoveredPartitions = getAllPartitionsForTopics(topicsDescriptor.getFixedTopics()); } else { List<String> matchedTopics = getAllTopics(); // retain topics that match the pattern Iterator<String> iter = matchedTopics.iterator(); while (iter.hasNext()) { if (!topicsDescriptor.isMatchingTopic(iter.next())) { iter.remove(); } } if (matchedTopics.size() != 0) { // get partitions only for matched topics newDiscoveredPartitions = getAllPartitionsForTopics(matchedTopics); } else { newDiscoveredPartitions = null; } } // (2) eliminate partition that are old partitions or should not be subscribed by this subtask if (newDiscoveredPartitions == null || newDiscoveredPartitions.isEmpty()) { throw new RuntimeException("Unable to retrieve any partitions with KafkaTopicsDescriptor: " + topicsDescriptor); } else { Iterator<KafkaTopicPartition> iter = newDiscoveredPartitions.iterator(); KafkaTopicPartition nextPartition; while (iter.hasNext()) { nextPartition = iter.next(); if (!setAndCheckDiscoveredPartition(nextPartition)) { iter.remove(); } } } return newDiscoveredPartitions; } catch (WakeupException e) { // the actual topic / partition metadata fetching methods // may be woken up midway; reset the wakeup flag and rethrow wakeup = false; throw e; } } else if (!closed && wakeup) { // may have been woken up before the method call wakeup = false; throw new WakeupException(); } else { throw new ClosedException(); } }
[ "public", "List", "<", "KafkaTopicPartition", ">", "discoverPartitions", "(", ")", "throws", "WakeupException", ",", "ClosedException", "{", "if", "(", "!", "closed", "&&", "!", "wakeup", ")", "{", "try", "{", "List", "<", "KafkaTopicPartition", ">", "newDisco...
Execute a partition discovery attempt for this subtask. This method lets the partition discoverer update what partitions it has discovered so far. @return List of discovered new partitions that this subtask should subscribe to.
[ "Execute", "a", "partition", "discovery", "attempt", "for", "this", "subtask", ".", "This", "method", "lets", "the", "partition", "discoverer", "update", "what", "partitions", "it", "has", "discovered", "so", "far", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/AbstractPartitionDiscoverer.java#L124-L179
train
Discover partitions for the topic.
[ 30522, 2270, 2862, 1026, 10556, 24316, 10610, 24330, 19362, 3775, 3508, 1028, 7523, 19362, 3775, 9285, 1006, 1007, 11618, 5256, 6279, 10288, 24422, 1010, 2701, 10288, 24422, 1063, 2065, 1006, 999, 2701, 1004, 1004, 999, 5256, 6279, 1007, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/NetUtil.java
NetUtil.createByteArrayFromIpAddressString
public static byte[] createByteArrayFromIpAddressString(String ipAddressString) { if (isValidIpV4Address(ipAddressString)) { return validIpV4ToBytes(ipAddressString); } if (isValidIpV6Address(ipAddressString)) { if (ipAddressString.charAt(0) == '[') { ipAddressString = ipAddressString.substring(1, ipAddressString.length() - 1); } int percentPos = ipAddressString.indexOf('%'); if (percentPos >= 0) { ipAddressString = ipAddressString.substring(0, percentPos); } return getIPv6ByName(ipAddressString, true); } return null; }
java
public static byte[] createByteArrayFromIpAddressString(String ipAddressString) { if (isValidIpV4Address(ipAddressString)) { return validIpV4ToBytes(ipAddressString); } if (isValidIpV6Address(ipAddressString)) { if (ipAddressString.charAt(0) == '[') { ipAddressString = ipAddressString.substring(1, ipAddressString.length() - 1); } int percentPos = ipAddressString.indexOf('%'); if (percentPos >= 0) { ipAddressString = ipAddressString.substring(0, percentPos); } return getIPv6ByName(ipAddressString, true); } return null; }
[ "public", "static", "byte", "[", "]", "createByteArrayFromIpAddressString", "(", "String", "ipAddressString", ")", "{", "if", "(", "isValidIpV4Address", "(", "ipAddressString", ")", ")", "{", "return", "validIpV4ToBytes", "(", "ipAddressString", ")", ";", "}", "if...
Creates an byte[] based on an ipAddressString. No error handling is performed here.
[ "Creates", "an", "byte", "[]", "based", "on", "an", "ipAddressString", ".", "No", "error", "handling", "is", "performed", "here", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L366-L385
train
Create a byte array from an ipAddress string.
[ 30522, 2270, 10763, 24880, 1031, 1033, 3443, 3762, 27058, 11335, 2100, 19699, 20936, 15455, 16200, 4757, 3367, 4892, 1006, 5164, 25249, 16200, 4757, 3367, 4892, 1007, 1063, 2065, 1006, 2003, 10175, 28173, 2361, 2615, 2549, 4215, 16200, 4757, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java
WebSocketUtil.base64
static String base64(byte[] data) { ByteBuf encodedData = Unpooled.wrappedBuffer(data); ByteBuf encoded = Base64.encode(encodedData); String encodedString = encoded.toString(CharsetUtil.UTF_8); encoded.release(); return encodedString; }
java
static String base64(byte[] data) { ByteBuf encodedData = Unpooled.wrappedBuffer(data); ByteBuf encoded = Base64.encode(encodedData); String encodedString = encoded.toString(CharsetUtil.UTF_8); encoded.release(); return encodedString; }
[ "static", "String", "base64", "(", "byte", "[", "]", "data", ")", "{", "ByteBuf", "encodedData", "=", "Unpooled", ".", "wrappedBuffer", "(", "data", ")", ";", "ByteBuf", "encoded", "=", "Base64", ".", "encode", "(", "encodedData", ")", ";", "String", "en...
Performs base64 encoding on the specified data @param data The data to encode @return An encoded string containing the data
[ "Performs", "base64", "encoding", "on", "the", "specified", "data" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java#L93-L99
train
Base64 encodes the byte array data.
[ 30522, 10763, 5164, 2918, 21084, 1006, 24880, 1031, 1033, 2951, 1007, 1063, 24880, 8569, 2546, 12359, 2850, 2696, 1027, 4895, 16869, 2098, 1012, 5058, 8569, 12494, 1006, 2951, 1007, 1025, 24880, 8569, 2546, 12359, 1027, 2918, 21084, 1012, 4...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java
LaunchableMesosWorker.launch
@Override public Protos.TaskInfo launch(Protos.SlaveID slaveId, MesosResourceAllocation allocation) { ContaineredTaskManagerParameters tmParams = params.containeredParameters(); final Configuration dynamicProperties = new Configuration(); // incorporate the dynamic properties set by the template dynamicProperties.addAll(containerSpec.getDynamicConfiguration()); // build a TaskInfo with assigned resources, environment variables, etc final Protos.TaskInfo.Builder taskInfo = Protos.TaskInfo.newBuilder() .setSlaveId(slaveId) .setTaskId(taskID) .setName(taskID.getValue()); // take needed resources from the overall allocation, under the assumption of adequate resources Set<String> roles = mesosConfiguration.roles(); taskInfo.addAllResources(allocation.takeScalar("cpus", taskRequest.getCPUs(), roles)); taskInfo.addAllResources(allocation.takeScalar("gpus", taskRequest.getGPUs(), roles)); taskInfo.addAllResources(allocation.takeScalar("mem", taskRequest.getMemory(), roles)); if (taskRequest.getDisk() > 0.0) { taskInfo.addAllResources(allocation.takeScalar("disk", taskRequest.getDisk(), roles)); } final Protos.CommandInfo.Builder cmd = taskInfo.getCommandBuilder(); final Protos.Environment.Builder env = cmd.getEnvironmentBuilder(); final StringBuilder jvmArgs = new StringBuilder(); //configure task manager hostname property if hostname override property is supplied Option<String> taskManagerHostnameOption = params.getTaskManagerHostname(); if (taskManagerHostnameOption.isDefined()) { // replace the TASK_ID pattern by the actual task id value of the Mesos task final String taskManagerHostname = MesosTaskManagerParameters.TASK_ID_PATTERN .matcher(taskManagerHostnameOption.get()) .replaceAll(Matcher.quoteReplacement(taskID.getValue())); dynamicProperties.setString(TaskManagerOptions.HOST, taskManagerHostname); } // take needed ports for the TM Set<String> tmPortKeys = extractPortKeys(containerSpec.getDynamicConfiguration()); List<Protos.Resource> portResources = allocation.takeRanges("ports", tmPortKeys.size(), roles); taskInfo.addAllResources(portResources); Iterator<String> portsToAssign = tmPortKeys.iterator(); rangeValues(portResources).forEach(port -> dynamicProperties.setLong(portsToAssign.next(), port)); if (portsToAssign.hasNext()) { throw new IllegalArgumentException("insufficient # of ports assigned"); } // ship additional files for (ContainerSpecification.Artifact artifact : containerSpec.getArtifacts()) { cmd.addUris(Utils.uri(resolver, artifact)); } // add user-specified URIs for (String uri : params.uris()) { cmd.addUris(CommandInfo.URI.newBuilder().setValue(uri)); } // propagate environment variables for (Map.Entry<String, String> entry : params.containeredParameters().taskManagerEnv().entrySet()) { env.addVariables(variable(entry.getKey(), entry.getValue())); } for (Map.Entry<String, String> entry : containerSpec.getEnvironmentVariables().entrySet()) { env.addVariables(variable(entry.getKey(), entry.getValue())); } // propagate the Mesos task ID to the TM env.addVariables(variable(MesosConfigKeys.ENV_FLINK_CONTAINER_ID, taskInfo.getTaskId().getValue())); // finalize the memory parameters jvmArgs.append(" -Xms").append(tmParams.taskManagerHeapSizeMB()).append("m"); jvmArgs.append(" -Xmx").append(tmParams.taskManagerHeapSizeMB()).append("m"); if (tmParams.taskManagerDirectMemoryLimitMB() >= 0) { jvmArgs.append(" -XX:MaxDirectMemorySize=").append(tmParams.taskManagerDirectMemoryLimitMB()).append("m"); } // pass dynamic system properties jvmArgs.append(' ').append( ContainerSpecification.formatSystemProperties(containerSpec.getSystemProperties())); // finalize JVM args env.addVariables(variable(MesosConfigKeys.ENV_JVM_ARGS, jvmArgs.toString())); // populate TASK_NAME and FRAMEWORK_NAME environment variables to the TM container env.addVariables(variable(MesosConfigKeys.ENV_TASK_NAME, taskInfo.getTaskId().getValue())); env.addVariables(variable(MesosConfigKeys.ENV_FRAMEWORK_NAME, mesosConfiguration.frameworkInfo().getName())); // build the launch command w/ dynamic application properties StringBuilder launchCommand = new StringBuilder(); if (params.bootstrapCommand().isDefined()) { launchCommand.append(params.bootstrapCommand().get()).append(" && "); } launchCommand .append(params.command()) .append(" ") .append(ContainerSpecification.formatSystemProperties(dynamicProperties)); cmd.setValue(launchCommand.toString()); // build the container info Protos.ContainerInfo.Builder containerInfo = Protos.ContainerInfo.newBuilder(); // in event that no docker image or mesos image name is specified, we must still // set type to MESOS containerInfo.setType(Protos.ContainerInfo.Type.MESOS); switch (params.containerType()) { case MESOS: if (params.containerImageName().isDefined()) { containerInfo .setMesos(Protos.ContainerInfo.MesosInfo.newBuilder() .setImage(Protos.Image.newBuilder() .setType(Protos.Image.Type.DOCKER) .setDocker(Protos.Image.Docker.newBuilder() .setName(params.containerImageName().get())))); } break; case DOCKER: assert(params.containerImageName().isDefined()); containerInfo .setType(Protos.ContainerInfo.Type.DOCKER) .setDocker(Protos.ContainerInfo.DockerInfo.newBuilder() .addAllParameters(params.dockerParameters()) .setNetwork(Protos.ContainerInfo.DockerInfo.Network.HOST) .setImage(params.containerImageName().get()) .setForcePullImage(params.dockerForcePullImage())); break; default: throw new IllegalStateException("unsupported container type"); } // add any volumes to the containerInfo containerInfo.addAllVolumes(params.containerVolumes()); taskInfo.setContainer(containerInfo); return taskInfo.build(); }
java
@Override public Protos.TaskInfo launch(Protos.SlaveID slaveId, MesosResourceAllocation allocation) { ContaineredTaskManagerParameters tmParams = params.containeredParameters(); final Configuration dynamicProperties = new Configuration(); // incorporate the dynamic properties set by the template dynamicProperties.addAll(containerSpec.getDynamicConfiguration()); // build a TaskInfo with assigned resources, environment variables, etc final Protos.TaskInfo.Builder taskInfo = Protos.TaskInfo.newBuilder() .setSlaveId(slaveId) .setTaskId(taskID) .setName(taskID.getValue()); // take needed resources from the overall allocation, under the assumption of adequate resources Set<String> roles = mesosConfiguration.roles(); taskInfo.addAllResources(allocation.takeScalar("cpus", taskRequest.getCPUs(), roles)); taskInfo.addAllResources(allocation.takeScalar("gpus", taskRequest.getGPUs(), roles)); taskInfo.addAllResources(allocation.takeScalar("mem", taskRequest.getMemory(), roles)); if (taskRequest.getDisk() > 0.0) { taskInfo.addAllResources(allocation.takeScalar("disk", taskRequest.getDisk(), roles)); } final Protos.CommandInfo.Builder cmd = taskInfo.getCommandBuilder(); final Protos.Environment.Builder env = cmd.getEnvironmentBuilder(); final StringBuilder jvmArgs = new StringBuilder(); //configure task manager hostname property if hostname override property is supplied Option<String> taskManagerHostnameOption = params.getTaskManagerHostname(); if (taskManagerHostnameOption.isDefined()) { // replace the TASK_ID pattern by the actual task id value of the Mesos task final String taskManagerHostname = MesosTaskManagerParameters.TASK_ID_PATTERN .matcher(taskManagerHostnameOption.get()) .replaceAll(Matcher.quoteReplacement(taskID.getValue())); dynamicProperties.setString(TaskManagerOptions.HOST, taskManagerHostname); } // take needed ports for the TM Set<String> tmPortKeys = extractPortKeys(containerSpec.getDynamicConfiguration()); List<Protos.Resource> portResources = allocation.takeRanges("ports", tmPortKeys.size(), roles); taskInfo.addAllResources(portResources); Iterator<String> portsToAssign = tmPortKeys.iterator(); rangeValues(portResources).forEach(port -> dynamicProperties.setLong(portsToAssign.next(), port)); if (portsToAssign.hasNext()) { throw new IllegalArgumentException("insufficient # of ports assigned"); } // ship additional files for (ContainerSpecification.Artifact artifact : containerSpec.getArtifacts()) { cmd.addUris(Utils.uri(resolver, artifact)); } // add user-specified URIs for (String uri : params.uris()) { cmd.addUris(CommandInfo.URI.newBuilder().setValue(uri)); } // propagate environment variables for (Map.Entry<String, String> entry : params.containeredParameters().taskManagerEnv().entrySet()) { env.addVariables(variable(entry.getKey(), entry.getValue())); } for (Map.Entry<String, String> entry : containerSpec.getEnvironmentVariables().entrySet()) { env.addVariables(variable(entry.getKey(), entry.getValue())); } // propagate the Mesos task ID to the TM env.addVariables(variable(MesosConfigKeys.ENV_FLINK_CONTAINER_ID, taskInfo.getTaskId().getValue())); // finalize the memory parameters jvmArgs.append(" -Xms").append(tmParams.taskManagerHeapSizeMB()).append("m"); jvmArgs.append(" -Xmx").append(tmParams.taskManagerHeapSizeMB()).append("m"); if (tmParams.taskManagerDirectMemoryLimitMB() >= 0) { jvmArgs.append(" -XX:MaxDirectMemorySize=").append(tmParams.taskManagerDirectMemoryLimitMB()).append("m"); } // pass dynamic system properties jvmArgs.append(' ').append( ContainerSpecification.formatSystemProperties(containerSpec.getSystemProperties())); // finalize JVM args env.addVariables(variable(MesosConfigKeys.ENV_JVM_ARGS, jvmArgs.toString())); // populate TASK_NAME and FRAMEWORK_NAME environment variables to the TM container env.addVariables(variable(MesosConfigKeys.ENV_TASK_NAME, taskInfo.getTaskId().getValue())); env.addVariables(variable(MesosConfigKeys.ENV_FRAMEWORK_NAME, mesosConfiguration.frameworkInfo().getName())); // build the launch command w/ dynamic application properties StringBuilder launchCommand = new StringBuilder(); if (params.bootstrapCommand().isDefined()) { launchCommand.append(params.bootstrapCommand().get()).append(" && "); } launchCommand .append(params.command()) .append(" ") .append(ContainerSpecification.formatSystemProperties(dynamicProperties)); cmd.setValue(launchCommand.toString()); // build the container info Protos.ContainerInfo.Builder containerInfo = Protos.ContainerInfo.newBuilder(); // in event that no docker image or mesos image name is specified, we must still // set type to MESOS containerInfo.setType(Protos.ContainerInfo.Type.MESOS); switch (params.containerType()) { case MESOS: if (params.containerImageName().isDefined()) { containerInfo .setMesos(Protos.ContainerInfo.MesosInfo.newBuilder() .setImage(Protos.Image.newBuilder() .setType(Protos.Image.Type.DOCKER) .setDocker(Protos.Image.Docker.newBuilder() .setName(params.containerImageName().get())))); } break; case DOCKER: assert(params.containerImageName().isDefined()); containerInfo .setType(Protos.ContainerInfo.Type.DOCKER) .setDocker(Protos.ContainerInfo.DockerInfo.newBuilder() .addAllParameters(params.dockerParameters()) .setNetwork(Protos.ContainerInfo.DockerInfo.Network.HOST) .setImage(params.containerImageName().get()) .setForcePullImage(params.dockerForcePullImage())); break; default: throw new IllegalStateException("unsupported container type"); } // add any volumes to the containerInfo containerInfo.addAllVolumes(params.containerVolumes()); taskInfo.setContainer(containerInfo); return taskInfo.build(); }
[ "@", "Override", "public", "Protos", ".", "TaskInfo", "launch", "(", "Protos", ".", "SlaveID", "slaveId", ",", "MesosResourceAllocation", "allocation", ")", "{", "ContaineredTaskManagerParameters", "tmParams", "=", "params", ".", "containeredParameters", "(", ")", "...
Construct the TaskInfo needed to launch the worker. @param slaveId the assigned slave. @param allocation the resource allocation (available resources). @return a fully-baked TaskInfo.
[ "Construct", "the", "TaskInfo", "needed", "to", "launch", "the", "worker", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/runtime/clusterframework/LaunchableMesosWorker.java#L202-L341
train
Launch the task manager with the given parameters.
[ 30522, 1030, 2058, 15637, 2270, 15053, 2015, 1012, 4708, 2378, 14876, 4888, 1006, 15053, 2015, 1012, 6658, 3593, 6658, 3593, 1010, 2033, 17063, 6072, 8162, 21456, 7174, 10719, 16169, 1007, 1063, 11661, 2098, 10230, 22287, 5162, 4590, 28689, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
http-url/src/main/java/com/networknt/url/URLNormalizer.java
URLNormalizer.removeTrailingQuestionMark
public URLNormalizer removeTrailingQuestionMark() { if (url.endsWith("?") && StringUtils.countMatches(url, "?") == 1) { url = StringUtils.removeEnd(url, "?"); } return this; }
java
public URLNormalizer removeTrailingQuestionMark() { if (url.endsWith("?") && StringUtils.countMatches(url, "?") == 1) { url = StringUtils.removeEnd(url, "?"); } return this; }
[ "public", "URLNormalizer", "removeTrailingQuestionMark", "(", ")", "{", "if", "(", "url", ".", "endsWith", "(", "\"?\"", ")", "&&", "StringUtils", ".", "countMatches", "(", "url", ",", "\"?\"", ")", "==", "1", ")", "{", "url", "=", "StringUtils", ".", "r...
<p>Removes trailing question mark ("?").</p> <code>http://www.example.com/display? &rarr; http://www.example.com/display </code> @return this instance
[ "<p", ">", "Removes", "trailing", "question", "mark", "(", "?", ")", ".", "<", "/", "p", ">", "<code", ">", "http", ":", "//", "www", ".", "example", ".", "com", "/", "display?", "&rarr", ";", "http", ":", "//", "www", ".", "example", ".", "com",...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/URLNormalizer.java#L727-L732
train
Removes trailing question mark from URL.
[ 30522, 2270, 24471, 19666, 2953, 9067, 17629, 6366, 6494, 16281, 15500, 3258, 10665, 1006, 1007, 1063, 2065, 1006, 24471, 2140, 1012, 4515, 24415, 1006, 1000, 1029, 1000, 1007, 1004, 1004, 5164, 21823, 4877, 1012, 4175, 18900, 8376, 1006, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/NetUtils.java
NetUtils.unresolvedHostAndPortToNormalizedString
public static String unresolvedHostAndPortToNormalizedString(String host, int port) { Preconditions.checkArgument(port >= 0 && port < 65536, "Port is not within the valid range,"); return unresolvedHostToNormalizedString(host) + ":" + port; }
java
public static String unresolvedHostAndPortToNormalizedString(String host, int port) { Preconditions.checkArgument(port >= 0 && port < 65536, "Port is not within the valid range,"); return unresolvedHostToNormalizedString(host) + ":" + port; }
[ "public", "static", "String", "unresolvedHostAndPortToNormalizedString", "(", "String", "host", ",", "int", "port", ")", "{", "Preconditions", ".", "checkArgument", "(", "port", ">=", "0", "&&", "port", "<", "65536", ",", "\"Port is not within the valid range,\"", "...
Returns a valid address for Akka. It returns a String of format 'host:port'. When an IPv6 address is specified, it normalizes the IPv6 address to avoid complications with the exact URL match policy of Akka. @param host The hostname, IPv4 or IPv6 address @param port The port @return host:port where host will be normalized if it is an IPv6 address
[ "Returns", "a", "valid", "address", "for", "Akka", ".", "It", "returns", "a", "String", "of", "format", "host", ":", "port", ".", "When", "an", "IPv6", "address", "is", "specified", "it", "normalizes", "the", "IPv6", "address", "to", "avoid", "complication...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L165-L169
train
Converts a host and port string to a normalized host and port string.
[ 30522, 2270, 10763, 5164, 4895, 6072, 16116, 15006, 5794, 18927, 11589, 2669, 2953, 9067, 3550, 3367, 4892, 1006, 5164, 3677, 1010, 20014, 3417, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 3417, 1028, 1027, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.decode
public static String decode(String content, Charset charset) { if (null == charset) { charset = CharsetUtil.defaultCharset(); } return decode(content, charset.name()); }
java
public static String decode(String content, Charset charset) { if (null == charset) { charset = CharsetUtil.defaultCharset(); } return decode(content, charset.name()); }
[ "public", "static", "String", "decode", "(", "String", "content", ",", "Charset", "charset", ")", "{", "if", "(", "null", "==", "charset", ")", "{", "charset", "=", "CharsetUtil", ".", "defaultCharset", "(", ")", ";", "}", "return", "decode", "(", "conte...
解码application/x-www-form-urlencoded字符 @param content 被解码内容 @param charset 编码 @return 编码后的字符 @since 4.4.1
[ "解码application", "/", "x", "-", "www", "-", "form", "-", "urlencoded字符" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L357-L362
train
Decodes a base64 encoded string.
[ 30522, 2270, 10763, 5164, 21933, 3207, 1006, 5164, 4180, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 25869, 13462, 1007, 1063, 25869, 30524, 2102, 1006, 1007, 1025, 1065, 2709, 21933, 3207, 1006, 4180, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java
NettyRSocketServerFactory.addServerCustomizers
public void addServerCustomizers( ServerRSocketFactoryCustomizer... serverCustomizers) { Assert.notNull(serverCustomizers, "ServerCustomizer must not be null"); this.serverCustomizers.addAll(Arrays.asList(serverCustomizers)); }
java
public void addServerCustomizers( ServerRSocketFactoryCustomizer... serverCustomizers) { Assert.notNull(serverCustomizers, "ServerCustomizer must not be null"); this.serverCustomizers.addAll(Arrays.asList(serverCustomizers)); }
[ "public", "void", "addServerCustomizers", "(", "ServerRSocketFactoryCustomizer", "...", "serverCustomizers", ")", "{", "Assert", ".", "notNull", "(", "serverCustomizers", ",", "\"ServerCustomizer must not be null\"", ")", ";", "this", ".", "serverCustomizers", ".", "addAl...
Add {@link ServerRSocketFactoryCustomizer}s that should applied while building the server. @param serverCustomizers the customizers to add
[ "Add", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/rsocket/netty/NettyRSocketServerFactory.java#L105-L109
train
Add server customizers.
[ 30522, 2270, 11675, 9909, 2121, 6299, 7874, 20389, 17629, 2015, 1006, 8241, 25301, 19869, 24475, 18908, 10253, 7874, 20389, 17629, 1012, 1012, 1012, 8241, 7874, 20389, 17629, 2015, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 8241, 7874,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.fromDataSet
public static <K, EV> Graph<K, NullValue, EV> fromDataSet( DataSet<Edge<K, EV>> edges, ExecutionEnvironment context) { DataSet<Vertex<K, NullValue>> vertices = edges .flatMap(new EmitSrcAndTarget<>()) .name("Source and target IDs") .distinct() .name("IDs"); return new Graph<>(vertices, edges, context); }
java
public static <K, EV> Graph<K, NullValue, EV> fromDataSet( DataSet<Edge<K, EV>> edges, ExecutionEnvironment context) { DataSet<Vertex<K, NullValue>> vertices = edges .flatMap(new EmitSrcAndTarget<>()) .name("Source and target IDs") .distinct() .name("IDs"); return new Graph<>(vertices, edges, context); }
[ "public", "static", "<", "K", ",", "EV", ">", "Graph", "<", "K", ",", "NullValue", ",", "EV", ">", "fromDataSet", "(", "DataSet", "<", "Edge", "<", "K", ",", "EV", ">", ">", "edges", ",", "ExecutionEnvironment", "context", ")", "{", "DataSet", "<", ...
Creates a graph from a DataSet of edges. Vertices are created automatically and their values are set to NullValue. @param edges a DataSet of edges. @param context the flink execution environment. @return the newly created graph.
[ "Creates", "a", "graph", "from", "a", "DataSet", "of", "edges", ".", "Vertices", "are", "created", "automatically", "and", "their", "values", "are", "set", "to", "NullValue", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L176-L186
train
Creates a graph from a DataSet of Categorical edges.
[ 30522, 2270, 10763, 1026, 1047, 1010, 23408, 1028, 10629, 1026, 1047, 1010, 19701, 10175, 5657, 1010, 23408, 1028, 2013, 2850, 18260, 2102, 1006, 2951, 13462, 1026, 3341, 1026, 1047, 1010, 23408, 1028, 1028, 7926, 1010, 7781, 2368, 21663, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java
Costs.addCosts
public void addCosts(Costs other) { // ---------- quantifiable costs ---------- if (this.networkCost == UNKNOWN || other.networkCost == UNKNOWN) { this.networkCost = UNKNOWN; } else { this.networkCost += other.networkCost; } if (this.diskCost == UNKNOWN || other.diskCost == UNKNOWN) { this.diskCost = UNKNOWN; } else { this.diskCost += other.diskCost; } if (this.cpuCost == UNKNOWN || other.cpuCost == UNKNOWN) { this.cpuCost = UNKNOWN; } else { this.cpuCost += other.cpuCost; } // ---------- heuristic costs ---------- this.heuristicNetworkCost += other.heuristicNetworkCost; this.heuristicDiskCost += other.heuristicDiskCost; this.heuristicCpuCost += other.heuristicCpuCost; }
java
public void addCosts(Costs other) { // ---------- quantifiable costs ---------- if (this.networkCost == UNKNOWN || other.networkCost == UNKNOWN) { this.networkCost = UNKNOWN; } else { this.networkCost += other.networkCost; } if (this.diskCost == UNKNOWN || other.diskCost == UNKNOWN) { this.diskCost = UNKNOWN; } else { this.diskCost += other.diskCost; } if (this.cpuCost == UNKNOWN || other.cpuCost == UNKNOWN) { this.cpuCost = UNKNOWN; } else { this.cpuCost += other.cpuCost; } // ---------- heuristic costs ---------- this.heuristicNetworkCost += other.heuristicNetworkCost; this.heuristicDiskCost += other.heuristicDiskCost; this.heuristicCpuCost += other.heuristicCpuCost; }
[ "public", "void", "addCosts", "(", "Costs", "other", ")", "{", "// ---------- quantifiable costs ----------", "if", "(", "this", ".", "networkCost", "==", "UNKNOWN", "||", "other", ".", "networkCost", "==", "UNKNOWN", ")", "{", "this", ".", "networkCost", "=", ...
Adds the given costs to these costs. If for one of the different cost components (network, disk), the costs are unknown, the resulting costs will be unknown. @param other The costs to add.
[ "Adds", "the", "given", "costs", "to", "these", "costs", ".", "If", "for", "one", "of", "the", "different", "cost", "components", "(", "network", "disk", ")", "the", "costs", "are", "unknown", "the", "resulting", "costs", "will", "be", "unknown", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/costs/Costs.java#L311-L336
train
Adds the costs of two costs.
[ 30522, 2270, 11675, 5587, 13186, 3215, 1006, 5366, 2060, 1007, 1063, 1013, 1013, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 24110, 3775, 22749, 3468, 5366, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 2065, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java
GraphicsUtil.getMinY
public static int getMinY(Graphics g) { // 获取允许文字最小高度 FontMetrics metrics = null; try { metrics = g.getFontMetrics(); } catch (Exception e) { // 此处报告bug某些情况下会抛出IndexOutOfBoundsException,在此做容错处理 } int minY; if (null != metrics) { minY = metrics.getAscent() - metrics.getLeading() - metrics.getDescent(); } else { minY = -1; } return minY; }
java
public static int getMinY(Graphics g) { // 获取允许文字最小高度 FontMetrics metrics = null; try { metrics = g.getFontMetrics(); } catch (Exception e) { // 此处报告bug某些情况下会抛出IndexOutOfBoundsException,在此做容错处理 } int minY; if (null != metrics) { minY = metrics.getAscent() - metrics.getLeading() - metrics.getDescent(); } else { minY = -1; } return minY; }
[ "public", "static", "int", "getMinY", "(", "Graphics", "g", ")", "{", "// 获取允许文字最小高度\r", "FontMetrics", "metrics", "=", "null", ";", "try", "{", "metrics", "=", "g", ".", "getFontMetrics", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "...
获取最小高度 @param g {@link Graphics2D}画笔 @return 最小高度,-1表示无法获取
[ "获取最小高度" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java#L40-L55
train
Gets the minimal Y coordinate of the specified graphics object.
[ 30522, 2270, 10763, 20014, 2131, 10020, 2100, 1006, 8389, 1043, 1007, 1063, 1013, 1013, 100, 100, 100, 100, 1861, 100, 100, 1829, 1981, 100, 15489, 12589, 2015, 12046, 2015, 1027, 19701, 1025, 3046, 1063, 12046, 2015, 1027, 1043, 1012, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
Http2ConnectionHandler.checkCloseConnection
private void checkCloseConnection(ChannelFuture future) { // If this connection is closing and the graceful shutdown has completed, close the connection // once this operation completes. if (closeListener != null && isGracefulShutdownComplete()) { ChannelFutureListener closeListener = this.closeListener; // This method could be called multiple times // and we don't want to notify the closeListener multiple times. this.closeListener = null; try { closeListener.operationComplete(future); } catch (Exception e) { throw new IllegalStateException("Close listener threw an unexpected exception", e); } } }
java
private void checkCloseConnection(ChannelFuture future) { // If this connection is closing and the graceful shutdown has completed, close the connection // once this operation completes. if (closeListener != null && isGracefulShutdownComplete()) { ChannelFutureListener closeListener = this.closeListener; // This method could be called multiple times // and we don't want to notify the closeListener multiple times. this.closeListener = null; try { closeListener.operationComplete(future); } catch (Exception e) { throw new IllegalStateException("Close listener threw an unexpected exception", e); } } }
[ "private", "void", "checkCloseConnection", "(", "ChannelFuture", "future", ")", "{", "// If this connection is closing and the graceful shutdown has completed, close the connection", "// once this operation completes.", "if", "(", "closeListener", "!=", "null", "&&", "isGracefulShutd...
Closes the connection if the graceful shutdown process has completed. @param future Represents the status that will be passed to the {@link #closeListener}.
[ "Closes", "the", "connection", "if", "the", "graceful", "shutdown", "process", "has", "completed", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L853-L867
train
Check if the connection has been closed and if it has completed the close listener.
[ 30522, 2797, 11675, 4638, 20464, 9232, 8663, 2638, 7542, 1006, 3149, 11263, 11244, 2925, 1007, 1063, 1013, 1013, 2065, 2023, 4434, 2003, 5494, 1998, 1996, 19415, 3844, 7698, 2038, 2949, 1010, 2485, 1996, 4434, 1013, 1013, 2320, 2023, 3169, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java
Scheduler.newInstanceAvailable
@Override public void newInstanceAvailable(Instance instance) { if (instance == null) { throw new IllegalArgumentException(); } if (instance.getNumberOfAvailableSlots() <= 0) { throw new IllegalArgumentException("The given instance has no resources."); } if (!instance.isAlive()) { throw new IllegalArgumentException("The instance is not alive."); } // synchronize globally for instance changes synchronized (this.globalLock) { // check we do not already use this instance if (!this.allInstances.add(instance)) { throw new IllegalArgumentException("The instance is already contained."); } try { // make sure we get notifications about slots becoming available instance.setSlotAvailabilityListener(this); // store the instance in the by-host-lookup String instanceHostName = instance.getTaskManagerLocation().getHostname(); Set<Instance> instanceSet = allInstancesByHost.get(instanceHostName); if (instanceSet == null) { instanceSet = new HashSet<Instance>(); allInstancesByHost.put(instanceHostName, instanceSet); } instanceSet.add(instance); // add it to the available resources and let potential waiters know this.instancesWithAvailableResources.put(instance.getTaskManagerID(), instance); // add all slots as available for (int i = 0; i < instance.getNumberOfAvailableSlots(); i++) { newSlotAvailable(instance); } } catch (Throwable t) { LOG.error("Scheduler could not add new instance " + instance, t); removeInstance(instance); } } }
java
@Override public void newInstanceAvailable(Instance instance) { if (instance == null) { throw new IllegalArgumentException(); } if (instance.getNumberOfAvailableSlots() <= 0) { throw new IllegalArgumentException("The given instance has no resources."); } if (!instance.isAlive()) { throw new IllegalArgumentException("The instance is not alive."); } // synchronize globally for instance changes synchronized (this.globalLock) { // check we do not already use this instance if (!this.allInstances.add(instance)) { throw new IllegalArgumentException("The instance is already contained."); } try { // make sure we get notifications about slots becoming available instance.setSlotAvailabilityListener(this); // store the instance in the by-host-lookup String instanceHostName = instance.getTaskManagerLocation().getHostname(); Set<Instance> instanceSet = allInstancesByHost.get(instanceHostName); if (instanceSet == null) { instanceSet = new HashSet<Instance>(); allInstancesByHost.put(instanceHostName, instanceSet); } instanceSet.add(instance); // add it to the available resources and let potential waiters know this.instancesWithAvailableResources.put(instance.getTaskManagerID(), instance); // add all slots as available for (int i = 0; i < instance.getNumberOfAvailableSlots(); i++) { newSlotAvailable(instance); } } catch (Throwable t) { LOG.error("Scheduler could not add new instance " + instance, t); removeInstance(instance); } } }
[ "@", "Override", "public", "void", "newInstanceAvailable", "(", "Instance", "instance", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "if", "(", "instance", ".", "getNumberOfAvailableSl...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/scheduler/Scheduler.java#L646-L692
train
This method is called by the scheduler when an instance is available.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2047, 7076, 26897, 12462, 11733, 3468, 1006, 6013, 6013, 1007, 1063, 2065, 1006, 6013, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1007, 1025, 1065, 2065, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java
SqlDateTimeUtils.dateDiff
public static int dateDiff(long t1, long t2, TimeZone tz) { ZoneId zoneId = tz.toZoneId(); LocalDate ld1 = Instant.ofEpochMilli(t1).atZone(zoneId).toLocalDate(); LocalDate ld2 = Instant.ofEpochMilli(t2).atZone(zoneId).toLocalDate(); return (int) ChronoUnit.DAYS.between(ld2, ld1); }
java
public static int dateDiff(long t1, long t2, TimeZone tz) { ZoneId zoneId = tz.toZoneId(); LocalDate ld1 = Instant.ofEpochMilli(t1).atZone(zoneId).toLocalDate(); LocalDate ld2 = Instant.ofEpochMilli(t2).atZone(zoneId).toLocalDate(); return (int) ChronoUnit.DAYS.between(ld2, ld1); }
[ "public", "static", "int", "dateDiff", "(", "long", "t1", ",", "long", "t2", ",", "TimeZone", "tz", ")", "{", "ZoneId", "zoneId", "=", "tz", ".", "toZoneId", "(", ")", ";", "LocalDate", "ld1", "=", "Instant", ".", "ofEpochMilli", "(", "t1", ")", ".",...
NOTE: (1). JDK relies on the operating system clock for time. Each operating system has its own method of handling date changes such as leap seconds(e.g. OS will slow down the clock to accommodate for this). (2). DST(Daylight Saving Time) is a legal issue, governments changed it over time. Some days are NOT exactly 24 hours long, it could be 23/25 hours long on the first or last day of daylight saving time. JDK can handle DST correctly. TODO: carefully written algorithm can improve the performance
[ "NOTE", ":", "(", "1", ")", ".", "JDK", "relies", "on", "the", "operating", "system", "clock", "for", "time", ".", "Each", "operating", "system", "has", "its", "own", "method", "of", "handling", "date", "changes", "such", "as", "leap", "seconds", "(", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L724-L729
train
Get the number of days between two dates.
[ 30522, 2270, 10763, 20014, 6052, 13355, 1006, 2146, 1056, 2487, 1010, 2146, 1056, 2475, 1010, 2051, 15975, 1056, 2480, 1007, 1063, 4224, 3593, 4224, 3593, 1027, 1056, 2480, 1012, 2000, 15975, 3593, 1006, 1007, 1025, 2334, 13701, 25510, 2487...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/NonReusingBuildFirstHashJoinIterator.java
NonReusingBuildFirstHashJoinIterator.open
@Override public void open() throws IOException, MemoryAllocationException, InterruptedException { this.hashJoin.open(this.firstInput, this.secondInput, this.buildSideOuterJoin); }
java
@Override public void open() throws IOException, MemoryAllocationException, InterruptedException { this.hashJoin.open(this.firstInput, this.secondInput, this.buildSideOuterJoin); }
[ "@", "Override", "public", "void", "open", "(", ")", "throws", "IOException", ",", "MemoryAllocationException", ",", "InterruptedException", "{", "this", ".", "hashJoin", ".", "open", "(", "this", ".", "firstInput", ",", "this", ".", "secondInput", ",", "this"...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/NonReusingBuildFirstHashJoinIterator.java#L96-L99
train
Open the hash join.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2330, 1006, 1007, 11618, 22834, 10288, 24422, 1010, 3638, 8095, 23909, 10288, 24422, 1010, 7153, 10288, 24422, 1063, 2023, 1012, 23325, 5558, 2378, 1012, 2330, 1006, 2023, 1012, 2034, 2378, 18780, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.getContentTypeByRequestBody
public static String getContentTypeByRequestBody(String body) { final ContentType contentType = ContentType.get(body); return (null == contentType) ? null : contentType.toString(); }
java
public static String getContentTypeByRequestBody(String body) { final ContentType contentType = ContentType.get(body); return (null == contentType) ? null : contentType.toString(); }
[ "public", "static", "String", "getContentTypeByRequestBody", "(", "String", "body", ")", "{", "final", "ContentType", "contentType", "=", "ContentType", ".", "get", "(", "body", ")", ";", "return", "(", "null", "==", "contentType", ")", "?", "null", ":", "co...
从请求参数的body中判断请求的Content-Type类型,支持的类型有: <pre> 1. application/json 1. application/xml </pre> @param body 请求参数体 @return Content-Type类型,如果无法判断返回null @since 3.2.0 @see ContentType#get(String)
[ "从请求参数的body中判断请求的Content", "-", "Type类型,支持的类型有:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L749-L752
train
Gets the content type by request body.
[ 30522, 2270, 10763, 5164, 2131, 8663, 6528, 15353, 5051, 3762, 2890, 15500, 23684, 1006, 5164, 2303, 1007, 1063, 2345, 4180, 13874, 4180, 13874, 1027, 4180, 13874, 1012, 2131, 1006, 2303, 1007, 1025, 2709, 1006, 19701, 1027, 1027, 4180, 138...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/swing/RobotUtil.java
RobotUtil.keyPressString
public static void keyPressString(String str) { ClipboardUtil.setStr(str); keyPressWithCtrl(KeyEvent.VK_V);// 粘贴 delay(); }
java
public static void keyPressString(String str) { ClipboardUtil.setStr(str); keyPressWithCtrl(KeyEvent.VK_V);// 粘贴 delay(); }
[ "public", "static", "void", "keyPressString", "(", "String", "str", ")", "{", "ClipboardUtil", ".", "setStr", "(", "str", ")", ";", "keyPressWithCtrl", "(", "KeyEvent", ".", "VK_V", ")", ";", "// 粘贴\r", "delay", "(", ")", ";", "}" ]
打印输出指定字符串(借助剪贴板) @param str 字符串
[ "打印输出指定字符串(借助剪贴板)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/RobotUtil.java#L111-L115
train
keyPressString Method.
[ 30522, 2270, 10763, 11675, 3145, 20110, 3367, 4892, 1006, 5164, 2358, 2099, 1007, 1063, 12528, 6277, 21823, 2140, 1012, 4520, 16344, 1006, 2358, 2099, 1007, 1025, 3145, 20110, 24415, 6593, 12190, 1006, 3145, 18697, 3372, 1012, 1058, 2243, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONGetter.java
JSONGetter.getJSONArray
public JSONArray getJSONArray(K key) { final Object object = this.getObj(key); if(null == object) { return null; } if(object instanceof JSONArray) { return (JSONArray) object; } return new JSONArray(object); }
java
public JSONArray getJSONArray(K key) { final Object object = this.getObj(key); if(null == object) { return null; } if(object instanceof JSONArray) { return (JSONArray) object; } return new JSONArray(object); }
[ "public", "JSONArray", "getJSONArray", "(", "K", "key", ")", "{", "final", "Object", "object", "=", "this", ".", "getObj", "(", "key", ")", ";", "if", "(", "null", "==", "object", ")", "{", "return", "null", ";", "}", "if", "(", "object", "instanceof...
获得JSONArray对象<br> 如果值为其它类型对象,尝试转换为{@link JSONArray}返回,否则抛出异常 @param key KEY @return JSONArray对象,如果值为null或者非JSONArray类型,返回null
[ "获得JSONArray对象<br", ">", "如果值为其它类型对象,尝试转换为", "{", "@link", "JSONArray", "}", "返回,否则抛出异常" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONGetter.java#L54-L64
train
Gets the JSONArray associated with the given key.
[ 30522, 2270, 1046, 3385, 2906, 9447, 2131, 22578, 7856, 11335, 2100, 1006, 1047, 3145, 1007, 1063, 2345, 4874, 4874, 1027, 2023, 1012, 2131, 16429, 3501, 1006, 3145, 1007, 1025, 2065, 1006, 19701, 1027, 1027, 4874, 1007, 1063, 2709, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java
Types.MAP
public static <K, V> TypeInformation<Map<K, V>> MAP(TypeInformation<K> keyType, TypeInformation<V> valueType) { return new MapTypeInfo<>(keyType, valueType); }
java
public static <K, V> TypeInformation<Map<K, V>> MAP(TypeInformation<K> keyType, TypeInformation<V> valueType) { return new MapTypeInfo<>(keyType, valueType); }
[ "public", "static", "<", "K", ",", "V", ">", "TypeInformation", "<", "Map", "<", "K", ",", "V", ">", ">", "MAP", "(", "TypeInformation", "<", "K", ">", "keyType", ",", "TypeInformation", "<", "V", ">", "valueType", ")", "{", "return", "new", "MapType...
Returns type information for a Java {@link java.util.Map}. A map must not be null. Null values in keys are not supported. An entry's value can be null. <p>By default, maps are untyped and treated as a generic type in Flink; therefore, it is useful to pass type information whenever a map is used. <p><strong>Note:</strong> Flink does not preserve the concrete {@link Map} type. It converts a map into {@link HashMap} when copying or deserializing. @param keyType type information for the map's keys @param valueType type information for the map's values
[ "Returns", "type", "information", "for", "a", "Java", "{", "@link", "java", ".", "util", ".", "Map", "}", ".", "A", "map", "must", "not", "be", "null", ".", "Null", "values", "in", "keys", "are", "not", "supported", ".", "An", "entry", "s", "value", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeinfo/Types.java#L415-L417
train
Returns a type information for a MAP operation.
[ 30522, 2270, 10763, 1026, 1047, 1010, 1058, 1028, 2828, 2378, 14192, 3370, 1026, 4949, 1026, 1047, 1010, 1058, 1028, 1028, 4949, 1006, 2828, 2378, 14192, 3370, 1026, 1047, 1028, 3145, 13874, 1010, 2828, 2378, 14192, 3370, 1026, 1058, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/Proxy.java
Proxy.setProxyAutoconfigUrl
public Proxy setProxyAutoconfigUrl(String proxyAutoconfigUrl) { verifyProxyTypeCompatibility(ProxyType.PAC); this.proxyType = ProxyType.PAC; this.proxyAutoconfigUrl = proxyAutoconfigUrl; return this; }
java
public Proxy setProxyAutoconfigUrl(String proxyAutoconfigUrl) { verifyProxyTypeCompatibility(ProxyType.PAC); this.proxyType = ProxyType.PAC; this.proxyAutoconfigUrl = proxyAutoconfigUrl; return this; }
[ "public", "Proxy", "setProxyAutoconfigUrl", "(", "String", "proxyAutoconfigUrl", ")", "{", "verifyProxyTypeCompatibility", "(", "ProxyType", ".", "PAC", ")", ";", "this", ".", "proxyType", "=", "ProxyType", ".", "PAC", ";", "this", ".", "proxyAutoconfigUrl", "=", ...
Specifies the URL to be used for proxy auto-configuration. Expected format is <code>http://hostname.com:1234/pacfile</code>. This is required if {@link #getProxyType()} is set to {@link ProxyType#PAC}, ignored otherwise. @param proxyAutoconfigUrl the URL for proxy auto-configuration @return reference to self
[ "Specifies", "the", "URL", "to", "be", "used", "for", "proxy", "auto", "-", "configuration", ".", "Expected", "format", "is", "<code", ">", "http", ":", "//", "hostname", ".", "com", ":", "1234", "/", "pacfile<", "/", "code", ">", ".", "This", "is", ...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L395-L400
train
Sets the proxy autoconfig url.
[ 30522, 2270, 24540, 2275, 21572, 18037, 4887, 3406, 8663, 8873, 27390, 2140, 1006, 5164, 24540, 4887, 3406, 8663, 8873, 27390, 2140, 1007, 1063, 20410, 21572, 18037, 13874, 9006, 24952, 8553, 1006, 24540, 13874, 1012, 14397, 1007, 1025, 2023,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
RestTemplateBuilder.basicAuthentication
public RestTemplateBuilder basicAuthentication(String username, String password) { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, new BasicAuthenticationInterceptor(username, password), this.restTemplateCustomizers, this.requestFactoryCustomizer, this.interceptors); }
java
public RestTemplateBuilder basicAuthentication(String username, String password) { return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, this.messageConverters, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, new BasicAuthenticationInterceptor(username, password), this.restTemplateCustomizers, this.requestFactoryCustomizer, this.interceptors); }
[ "public", "RestTemplateBuilder", "basicAuthentication", "(", "String", "username", ",", "String", "password", ")", "{", "return", "new", "RestTemplateBuilder", "(", "this", ".", "detectRequestFactory", ",", "this", ".", "rootUri", ",", "this", ".", "messageConverter...
Add HTTP basic authentication to requests. See {@link BasicAuthenticationInterceptor} for details. @param username the user name @param password the password @return a new builder instance @since 2.1.0
[ "Add", "HTTP", "basic", "authentication", "to", "requests", ".", "See", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L381-L388
train
Creates a new RestTemplateBuilder with a BasicAuthenticationInterceptor.
[ 30522, 2270, 2717, 18532, 15725, 8569, 23891, 2099, 3937, 4887, 10760, 16778, 10719, 1006, 5164, 5310, 18442, 1010, 5164, 20786, 1007, 1063, 2709, 2047, 2717, 18532, 15725, 8569, 23891, 2099, 1006, 2023, 1012, 11487, 2890, 15500, 21450, 1010,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/analyzer/Tokenizer.java
Tokenizer.scanIdentifier
public Token scanIdentifier() { if ('`' == charAt(offset)) { int length = getLengthUntilTerminatedChar('`'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } if ('"' == charAt(offset)) { int length = getLengthUntilTerminatedChar('"'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } if ('[' == charAt(offset)) { int length = getLengthUntilTerminatedChar(']'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } int length = 0; while (isIdentifierChar(charAt(offset + length))) { length++; } String literals = input.substring(offset, offset + length); if (isAmbiguousIdentifier(literals)) { return new Token(processAmbiguousIdentifier(offset + length, literals), literals, offset + length); } return new Token(dictionary.findTokenType(literals, Literals.IDENTIFIER), literals, offset + length); }
java
public Token scanIdentifier() { if ('`' == charAt(offset)) { int length = getLengthUntilTerminatedChar('`'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } if ('"' == charAt(offset)) { int length = getLengthUntilTerminatedChar('"'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } if ('[' == charAt(offset)) { int length = getLengthUntilTerminatedChar(']'); return new Token(Literals.IDENTIFIER, input.substring(offset, offset + length), offset + length); } int length = 0; while (isIdentifierChar(charAt(offset + length))) { length++; } String literals = input.substring(offset, offset + length); if (isAmbiguousIdentifier(literals)) { return new Token(processAmbiguousIdentifier(offset + length, literals), literals, offset + length); } return new Token(dictionary.findTokenType(literals, Literals.IDENTIFIER), literals, offset + length); }
[ "public", "Token", "scanIdentifier", "(", ")", "{", "if", "(", "'", "'", "==", "charAt", "(", "offset", ")", ")", "{", "int", "length", "=", "getLengthUntilTerminatedChar", "(", "'", "'", ")", ";", "return", "new", "Token", "(", "Literals", ".", "IDENT...
scan identifier. @return identifier token
[ "scan", "identifier", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/analyzer/Tokenizer.java#L151-L173
train
Scans the identifier.
[ 30522, 2270, 19204, 13594, 5178, 16778, 8873, 2121, 1006, 1007, 1063, 2065, 1006, 1005, 1036, 1005, 1027, 1027, 25869, 4017, 1006, 16396, 1007, 1007, 1063, 20014, 3091, 1027, 2131, 7770, 13512, 17157, 3775, 21928, 26972, 7507, 2099, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java
FlinkKafkaConsumerBase.setStartFromSpecificOffsets
public FlinkKafkaConsumerBase<T> setStartFromSpecificOffsets(Map<KafkaTopicPartition, Long> specificStartupOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.startupOffsetsTimestamp = null; this.specificStartupOffsets = checkNotNull(specificStartupOffsets); return this; }
java
public FlinkKafkaConsumerBase<T> setStartFromSpecificOffsets(Map<KafkaTopicPartition, Long> specificStartupOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.startupOffsetsTimestamp = null; this.specificStartupOffsets = checkNotNull(specificStartupOffsets); return this; }
[ "public", "FlinkKafkaConsumerBase", "<", "T", ">", "setStartFromSpecificOffsets", "(", "Map", "<", "KafkaTopicPartition", ",", "Long", ">", "specificStartupOffsets", ")", "{", "this", ".", "startupMode", "=", "StartupMode", ".", "SPECIFIC_OFFSETS", ";", "this", ".",...
Specifies the consumer to start reading partitions from specific offsets, set independently for each partition. The specified offset should be the offset of the next record that will be read from partitions. This lets the consumer ignore any committed group offsets in Zookeeper / Kafka brokers. <p>If the provided map of offsets contains entries whose {@link KafkaTopicPartition} is not subscribed by the consumer, the entry will be ignored. If the consumer subscribes to a partition that does not exist in the provided map of offsets, the consumer will fallback to the default group offset behaviour (see {@link FlinkKafkaConsumerBase#setStartFromGroupOffsets()}) for that particular partition. <p>If the specified offset for a partition is invalid, or the behaviour for that partition is defaulted to group offsets but still no group offset could be found for it, then the "auto.offset.reset" behaviour set in the configuration properties will be used for the partition <p>This method does not affect where partitions are read from when the consumer is restored from a checkpoint or savepoint. When the consumer is restored from a checkpoint or savepoint, only the offsets in the restored state will be used. @return The consumer object, to allow function chaining.
[ "Specifies", "the", "consumer", "to", "start", "reading", "partitions", "from", "specific", "offsets", "set", "independently", "for", "each", "partition", ".", "The", "specified", "offset", "should", "be", "the", "offset", "of", "the", "next", "record", "that", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBase.java#L463-L468
train
Sets the startup offsets for the Kafka consumer.
[ 30522, 2270, 13109, 19839, 2912, 24316, 22684, 3619, 17897, 28483, 3366, 1026, 1056, 1028, 4520, 7559, 24475, 21716, 13102, 8586, 18513, 27475, 8454, 1006, 4949, 1026, 10556, 24316, 10610, 24330, 19362, 3775, 3508, 1010, 2146, 1028, 3563, 141...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/Proxy.java
Proxy.setNoProxy
public Proxy setNoProxy(String noProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.noProxy = noProxy; return this; }
java
public Proxy setNoProxy(String noProxy) { verifyProxyTypeCompatibility(ProxyType.MANUAL); this.proxyType = ProxyType.MANUAL; this.noProxy = noProxy; return this; }
[ "public", "Proxy", "setNoProxy", "(", "String", "noProxy", ")", "{", "verifyProxyTypeCompatibility", "(", "ProxyType", ".", "MANUAL", ")", ";", "this", ".", "proxyType", "=", "ProxyType", ".", "MANUAL", ";", "this", ".", "noProxy", "=", "noProxy", ";", "retu...
Sets proxy bypass (noproxy) addresses @param noProxy The proxy bypass (noproxy) addresses separated by commas @return reference to self
[ "Sets", "proxy", "bypass", "(", "noproxy", ")", "addresses" ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/Proxy.java#L261-L266
train
Sets the noProxy attribute of the proxy.
[ 30522, 2270, 24540, 2275, 3630, 21572, 18037, 1006, 5164, 2053, 21572, 18037, 1007, 1063, 20410, 21572, 18037, 13874, 9006, 24952, 8553, 1006, 24540, 13874, 1012, 6410, 1007, 1025, 2023, 1012, 24540, 13874, 1027, 24540, 13874, 1012, 6410, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) { send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files); }
java
public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) { send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files); }
[ "public", "static", "void", "send", "(", "Collection", "<", "String", ">", "tos", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "send", "(", "GlobalMailAccount", ".", "INSTANCE", ".", ...
使用配置文件中设置的账户发送邮件,发送给多人 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表
[ "使用配置文件中设置的账户发送邮件,发送给多人" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L111-L113
train
Creates a mail with the specified tos subject and content.
[ 30522, 2270, 10763, 11675, 4604, 1006, 3074, 1026, 5164, 1028, 2000, 2015, 1010, 5164, 3395, 1010, 5164, 4180, 1010, 22017, 20898, 2003, 11039, 19968, 1010, 5371, 1012, 1012, 1012, 6764, 1007, 1063, 4604, 1006, 3795, 21397, 6305, 3597, 1667...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateHex
public static <T extends CharSequence> T validateHex(T value, String errorMsg) throws ValidateException { if (false == isHex(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateHex(T value, String errorMsg) throws ValidateException { if (false == isHex(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateHex", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isHex", "(", "value", ")", ")", "{", "throw", "new", "Vali...
验证是否为Hex(16进制)字符串 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常 @since 4.3.3
[ "验证是否为Hex(16进制)字符串" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1030-L1035
train
Validate hex.
[ 30522, 2270, 10763, 1026, 1056, 8908, 25869, 3366, 4226, 5897, 1028, 1056, 9398, 3686, 5369, 2595, 1006, 1056, 3643, 1010, 5164, 7561, 5244, 30524, 7561, 5244, 2290, 1007, 1025, 1065, 2709, 3643, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/GroupedSet.java
GroupedSet.contains
public boolean contains(String group, Collection<String> values) { final LinkedHashSet<String> valueSet = getValues(group); if (CollectionUtil.isEmpty(values) || CollectionUtil.isEmpty(valueSet)) { return false; } return valueSet.containsAll(values); }
java
public boolean contains(String group, Collection<String> values) { final LinkedHashSet<String> valueSet = getValues(group); if (CollectionUtil.isEmpty(values) || CollectionUtil.isEmpty(valueSet)) { return false; } return valueSet.containsAll(values); }
[ "public", "boolean", "contains", "(", "String", "group", ",", "Collection", "<", "String", ">", "values", ")", "{", "final", "LinkedHashSet", "<", "String", ">", "valueSet", "=", "getValues", "(", "group", ")", ";", "if", "(", "CollectionUtil", ".", "isEmp...
是否在给定分组的集合中全部包含指定值集合<br> 如果给定分组对应集合不存在,则返回false @param group 分组名 @param values 测试的值集合 @return 是否包含
[ "是否在给定分组的集合中全部包含指定值集合<br", ">", "如果给定分组对应集合不存在,则返回false" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/GroupedSet.java#L307-L314
train
Checks if the specified group contains all of the specified values.
[ 30522, 2270, 22017, 20898, 3397, 1006, 5164, 2177, 1010, 3074, 1026, 5164, 1028, 5300, 1007, 1063, 2345, 5799, 14949, 7898, 3388, 1026, 5164, 1028, 5300, 3388, 1027, 2131, 10175, 15808, 1006, 2177, 1007, 1025, 2065, 1006, 3074, 21823, 2140,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java
TaskSchedulerBuilder.configure
public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this.poolSize).to(taskScheduler::setPoolSize); map.from(this.awaitTermination) .to(taskScheduler::setWaitForTasksToCompleteOnShutdown); map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds) .to(taskScheduler::setAwaitTerminationSeconds); map.from(this.threadNamePrefix).to(taskScheduler::setThreadNamePrefix); if (!CollectionUtils.isEmpty(this.customizers)) { this.customizers.forEach((customizer) -> customizer.customize(taskScheduler)); } return taskScheduler; }
java
public <T extends ThreadPoolTaskScheduler> T configure(T taskScheduler) { PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull(); map.from(this.poolSize).to(taskScheduler::setPoolSize); map.from(this.awaitTermination) .to(taskScheduler::setWaitForTasksToCompleteOnShutdown); map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds) .to(taskScheduler::setAwaitTerminationSeconds); map.from(this.threadNamePrefix).to(taskScheduler::setThreadNamePrefix); if (!CollectionUtils.isEmpty(this.customizers)) { this.customizers.forEach((customizer) -> customizer.customize(taskScheduler)); } return taskScheduler; }
[ "public", "<", "T", "extends", "ThreadPoolTaskScheduler", ">", "T", "configure", "(", "T", "taskScheduler", ")", "{", "PropertyMapper", "map", "=", "PropertyMapper", ".", "get", "(", ")", ".", "alwaysApplyingWhenNonNull", "(", ")", ";", "map", ".", "from", "...
Configure the provided {@link ThreadPoolTaskScheduler} instance using this builder. @param <T> the type of task scheduler @param taskScheduler the {@link ThreadPoolTaskScheduler} to configure @return the task scheduler instance @see #build()
[ "Configure", "the", "provided", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java#L197-L209
train
Configure the given task scheduler.
[ 30522, 2270, 1026, 1056, 8908, 11689, 16869, 10230, 5705, 7690, 9307, 2099, 1028, 1056, 9530, 8873, 27390, 2063, 1006, 1056, 8518, 7690, 9307, 2099, 1007, 1063, 3200, 2863, 18620, 4949, 1027, 3200, 2863, 18620, 1012, 2131, 1006, 1007, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandler.java
CreditBasedPartitionRequestClientHandler.addInputChannel
@Override public void addInputChannel(RemoteInputChannel listener) throws IOException { checkError(); inputChannels.putIfAbsent(listener.getInputChannelId(), listener); }
java
@Override public void addInputChannel(RemoteInputChannel listener) throws IOException { checkError(); inputChannels.putIfAbsent(listener.getInputChannelId(), listener); }
[ "@", "Override", "public", "void", "addInputChannel", "(", "RemoteInputChannel", "listener", ")", "throws", "IOException", "{", "checkError", "(", ")", ";", "inputChannels", ".", "putIfAbsent", "(", "listener", ".", "getInputChannelId", "(", ")", ",", "listener", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/CreditBasedPartitionRequestClientHandler.java#L88-L93
train
Add an input channel to the remote input channel manager.
[ 30522, 1030, 2058, 15637, 2270, 11675, 5587, 2378, 18780, 26058, 1006, 6556, 2378, 18780, 26058, 19373, 1007, 11618, 22834, 10288, 24422, 1063, 4638, 2121, 29165, 1006, 1007, 1025, 7953, 26058, 2015, 1012, 2404, 10128, 7875, 5054, 2102, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
deployer/src/main/java/com/alibaba/otter/canal/deployer/monitor/remote/DbRemoteConfigLoader.java
DbRemoteConfigLoader.getRemoteCanalConfig
private ConfigItem getRemoteCanalConfig() { String sql = "select name, content, modified_time from canal_config where id=1"; try (Connection conn = dataSource.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql)) { if (rs.next()) { ConfigItem configItem = new ConfigItem(); configItem.setId(1L); configItem.setName(rs.getString("name")); configItem.setContent(rs.getString("content")); configItem.setModifiedTime(rs.getTimestamp("modified_time").getTime()); return configItem; } } catch (Exception e) { logger.error(e.getMessage(), e); } return null; }
java
private ConfigItem getRemoteCanalConfig() { String sql = "select name, content, modified_time from canal_config where id=1"; try (Connection conn = dataSource.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql)) { if (rs.next()) { ConfigItem configItem = new ConfigItem(); configItem.setId(1L); configItem.setName(rs.getString("name")); configItem.setContent(rs.getString("content")); configItem.setModifiedTime(rs.getTimestamp("modified_time").getTime()); return configItem; } } catch (Exception e) { logger.error(e.getMessage(), e); } return null; }
[ "private", "ConfigItem", "getRemoteCanalConfig", "(", ")", "{", "String", "sql", "=", "\"select name, content, modified_time from canal_config where id=1\"", ";", "try", "(", "Connection", "conn", "=", "dataSource", ".", "getConnection", "(", ")", ";", "Statement", "stm...
获取远程canal.properties配置内容 @return 内容对象
[ "获取远程canal", ".", "properties配置内容" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/deployer/src/main/java/com/alibaba/otter/canal/deployer/monitor/remote/DbRemoteConfigLoader.java#L117-L134
train
Get the remote canal config
[ 30522, 2797, 9530, 8873, 23806, 6633, 2131, 28578, 12184, 28621, 22499, 2078, 8873, 2290, 1006, 1007, 1063, 5164, 29296, 1027, 1000, 7276, 2171, 1010, 4180, 1010, 6310, 1035, 2051, 2013, 5033, 1035, 9530, 8873, 2290, 2073, 8909, 1027, 1015,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getTrimmedStrings
public String[] getTrimmedStrings(String name, String... defaultValue) { String valueString = get(name); if (null == valueString) { return defaultValue; } else { return StringUtils.getTrimmedStrings(valueString); } }
java
public String[] getTrimmedStrings(String name, String... defaultValue) { String valueString = get(name); if (null == valueString) { return defaultValue; } else { return StringUtils.getTrimmedStrings(valueString); } }
[ "public", "String", "[", "]", "getTrimmedStrings", "(", "String", "name", ",", "String", "...", "defaultValue", ")", "{", "String", "valueString", "=", "get", "(", "name", ")", ";", "if", "(", "null", "==", "valueString", ")", "{", "return", "defaultValue"...
Get the comma delimited values of the <code>name</code> property as an array of <code>String</code>s, trimmed of the leading and trailing whitespace. If no such property is specified then default value is returned. @param name property name. @param defaultValue The default value @return property value as an array of trimmed <code>String</code>s, or default value.
[ "Get", "the", "comma", "delimited", "values", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "an", "array", "of", "<code", ">", "String<", "/", "code", ">", "s", "trimmed", "of", "the", "leading", "and", "trailing", "whitespace",...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2126-L2133
train
Returns an array of trimmed Strings from the specified name.
[ 30522, 2270, 5164, 1031, 1033, 2131, 18886, 20058, 5104, 18886, 3070, 2015, 1006, 5164, 2171, 1010, 5164, 1012, 1012, 1012, 12398, 10175, 5657, 1007, 1063, 5164, 5300, 18886, 3070, 1027, 2131, 1006, 2171, 1007, 1025, 2065, 1006, 19701, 1027...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
redisson/redisson
redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/strategy/AbstractReadWriteAccessStrategy.java
AbstractReadWriteAccessStrategy.handleLockExpiry
protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, Lockable lock) { long ts = region.nextTimestamp() + region.getTimeout(); // create new lock that times out immediately Lock newLock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); newLock.unlock(ts); region.put(session, key, newLock); }
java
protected void handleLockExpiry(SharedSessionContractImplementor session, Object key, Lockable lock) { long ts = region.nextTimestamp() + region.getTimeout(); // create new lock that times out immediately Lock newLock = new Lock(ts, uuid, nextLockId.getAndIncrement(), null); newLock.unlock(ts); region.put(session, key, newLock); }
[ "protected", "void", "handleLockExpiry", "(", "SharedSessionContractImplementor", "session", ",", "Object", "key", ",", "Lockable", "lock", ")", "{", "long", "ts", "=", "region", ".", "nextTimestamp", "(", ")", "+", "region", ".", "getTimeout", "(", ")", ";", ...
Handle the timeout of a previous lock mapped to this key
[ "Handle", "the", "timeout", "of", "a", "previous", "lock", "mapped", "to", "this", "key" ]
d3acc0249b2d5d658d36d99e2c808ce49332ea44
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson-hibernate/redisson-hibernate-52/src/main/java/org/redisson/hibernate/strategy/AbstractReadWriteAccessStrategy.java#L157-L163
train
Handle expiry of a lock.
[ 30522, 5123, 11675, 5047, 7878, 10288, 8197, 2854, 1006, 4207, 8583, 10992, 8663, 6494, 6593, 5714, 10814, 23065, 2099, 5219, 1010, 4874, 3145, 1010, 5843, 3085, 5843, 1007, 1063, 2146, 24529, 1027, 2555, 1012, 2279, 7292, 9153, 8737, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ModifierUtil.java
ModifierUtil.modifiersToInt
private static int modifiersToInt(ModifierType... modifierTypes) { int modifier = modifierTypes[0].getValue(); for(int i = 1; i < modifierTypes.length; i++) { modifier &= modifierTypes[i].getValue(); } return modifier; }
java
private static int modifiersToInt(ModifierType... modifierTypes) { int modifier = modifierTypes[0].getValue(); for(int i = 1; i < modifierTypes.length; i++) { modifier &= modifierTypes[i].getValue(); } return modifier; }
[ "private", "static", "int", "modifiersToInt", "(", "ModifierType", "...", "modifierTypes", ")", "{", "int", "modifier", "=", "modifierTypes", "[", "0", "]", ".", "getValue", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "modifierTypes",...
多个修饰符做“与”操作,表示同时存在多个修饰符 @param modifierTypes 修饰符列表,元素不能为空 @return “与”之后的修饰符
[ "多个修饰符做“与”操作,表示同时存在多个修饰符" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ModifierUtil.java#L202-L208
train
Converts a list of modifier types to an integer.
[ 30522, 2797, 10763, 20014, 16913, 28295, 3406, 18447, 1006, 16913, 18095, 13874, 1012, 1012, 1012, 16913, 18095, 13874, 2015, 1007, 1063, 20014, 16913, 18095, 1027, 16913, 18095, 13874, 2015, 1031, 1014, 1033, 1012, 2131, 10175, 5657, 1006, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
UnsafeRow.writeToStream
public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException { if (baseObject instanceof byte[]) { int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET); out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes); }
java
public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException { if (baseObject instanceof byte[]) { int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET); out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes); }
[ "public", "void", "writeToStream", "(", "OutputStream", "out", ",", "byte", "[", "]", "writeBuffer", ")", "throws", "IOException", "{", "if", "(", "baseObject", "instanceof", "byte", "[", "]", ")", "{", "int", "offsetInByteArray", "=", "(", "int", ")", "("...
Write this UnsafeRow's underlying bytes to the given OutputStream. @param out the stream to write to. @param writeBuffer a byte array for buffering chunks of off-heap data while writing to the output stream. If this row is backed by an on-heap byte array, then this buffer will not be used and may be null.
[ "Write", "this", "UnsafeRow", "s", "underlying", "bytes", "to", "the", "given", "OutputStream", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L506-L510
train
Write the contents of this object to the given output stream.
[ 30522, 2270, 11675, 4339, 13122, 25379, 1006, 27852, 25379, 2041, 1010, 24880, 1031, 1033, 4339, 8569, 12494, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 2918, 16429, 20614, 6013, 11253, 24880, 1031, 1033, 1007, 1063, 20014, 16396, 23...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/internal/AppendableCharSequence.java
AppendableCharSequence.substring
public String substring(int start, int end) { int length = end - start; if (start > pos || length > pos) { throw new IndexOutOfBoundsException(); } return new String(chars, start, length); }
java
public String substring(int start, int end) { int length = end - start; if (start > pos || length > pos) { throw new IndexOutOfBoundsException(); } return new String(chars, start, length); }
[ "public", "String", "substring", "(", "int", "start", ",", "int", "end", ")", "{", "int", "length", "=", "end", "-", "start", ";", "if", "(", "start", ">", "pos", "||", "length", ">", "pos", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ...
Create a new {@link String} from the given start to end.
[ "Create", "a", "new", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/AppendableCharSequence.java#L131-L137
train
Returns a substring of this string.
[ 30522, 2270, 5164, 4942, 3367, 4892, 1006, 20014, 2707, 1010, 20014, 2203, 1007, 1063, 20014, 3091, 1027, 2203, 1011, 2707, 1025, 2065, 1006, 2707, 1028, 13433, 2015, 1064, 1064, 3091, 1028, 13433, 2015, 1007, 1063, 5466, 2047, 5950, 5833, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.forEach
public static <T> void forEach(Iterator<T> iterator, Consumer<T> consumer) { int index = 0; while (iterator.hasNext()) { consumer.accept(iterator.next(), index); index++; } }
java
public static <T> void forEach(Iterator<T> iterator, Consumer<T> consumer) { int index = 0; while (iterator.hasNext()) { consumer.accept(iterator.next(), index); index++; } }
[ "public", "static", "<", "T", ">", "void", "forEach", "(", "Iterator", "<", "T", ">", "iterator", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "int", "index", "=", "0", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "...
循环遍历 {@link Iterator},使用{@link Consumer} 接受遍历的每条数据,并针对每条数据做处理 @param <T> 集合元素类型 @param iterator {@link Iterator} @param consumer {@link Consumer} 遍历的每条数据处理器
[ "循环遍历", "{", "@link", "Iterator", "}", ",使用", "{", "@link", "Consumer", "}", "接受遍历的每条数据,并针对每条数据做处理" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2239-L2245
train
Iterates over the elements of the iterator and passes each element to the consumer.
[ 30522, 2270, 10763, 1026, 1056, 1028, 11675, 18921, 6776, 1006, 2009, 6906, 4263, 1026, 1056, 1028, 2009, 6906, 4263, 1010, 7325, 1026, 1056, 1028, 7325, 1007, 1063, 20014, 5950, 1027, 1014, 1025, 2096, 1006, 2009, 6906, 4263, 1012, 8440, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/DataSet.java
DataSet.rightOuterJoin
public <R> JoinOperatorSetsBase<T, R> rightOuterJoin(DataSet<R> other, JoinHint strategy) { switch(strategy) { case OPTIMIZER_CHOOSES: case REPARTITION_SORT_MERGE: case REPARTITION_HASH_FIRST: case REPARTITION_HASH_SECOND: case BROADCAST_HASH_FIRST: return new JoinOperatorSetsBase<>(this, other, strategy, JoinType.RIGHT_OUTER); default: throw new InvalidProgramException("Invalid JoinHint for RightOuterJoin: " + strategy); } }
java
public <R> JoinOperatorSetsBase<T, R> rightOuterJoin(DataSet<R> other, JoinHint strategy) { switch(strategy) { case OPTIMIZER_CHOOSES: case REPARTITION_SORT_MERGE: case REPARTITION_HASH_FIRST: case REPARTITION_HASH_SECOND: case BROADCAST_HASH_FIRST: return new JoinOperatorSetsBase<>(this, other, strategy, JoinType.RIGHT_OUTER); default: throw new InvalidProgramException("Invalid JoinHint for RightOuterJoin: " + strategy); } }
[ "public", "<", "R", ">", "JoinOperatorSetsBase", "<", "T", ",", "R", ">", "rightOuterJoin", "(", "DataSet", "<", "R", ">", "other", ",", "JoinHint", "strategy", ")", "{", "switch", "(", "strategy", ")", "{", "case", "OPTIMIZER_CHOOSES", ":", "case", "REP...
Initiates a Right Outer Join transformation. <p>An Outer Join transformation joins two elements of two {@link DataSet DataSets} on key equality and provides multiple ways to combine joining elements into one DataSet. <p>Elements of the <b>right</b> DataSet (i.e. {@code other}) that do not have a matching element on {@code this} side are joined with {@code null} and emitted to the resulting DataSet. @param other The other DataSet with which this DataSet is joined. @param strategy The strategy that should be used execute the join. If {@code null} is given, then the optimizer will pick the join strategy. @return A JoinOperatorSet to continue the definition of the Join transformation. @see org.apache.flink.api.java.operators.join.JoinOperatorSetsBase @see DataSet
[ "Initiates", "a", "Right", "Outer", "Join", "transformation", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L918-L929
train
Creates a new JoinOperatorSetsBase for the Right Outer Join
[ 30522, 2270, 1026, 1054, 1028, 3693, 25918, 18926, 8454, 15058, 1026, 1056, 30524, 6290, 1035, 15867, 1024, 2553, 16360, 8445, 22753, 1035, 4066, 1035, 13590, 1024, 2553, 16360, 8445, 22753, 1035, 23325, 1035, 2034, 1024, 2553, 16360, 8445, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.query
public static <T> T query(Connection conn, String sql, RsHandler<T> rsh, Object... params) throws SQLException { PreparedStatement ps = null; try { ps = StatementUtil.prepareStatement(conn, sql, params); return executeQuery(ps, rsh); } finally { DbUtil.close(ps); } }
java
public static <T> T query(Connection conn, String sql, RsHandler<T> rsh, Object... params) throws SQLException { PreparedStatement ps = null; try { ps = StatementUtil.prepareStatement(conn, sql, params); return executeQuery(ps, rsh); } finally { DbUtil.close(ps); } }
[ "public", "static", "<", "T", ">", "T", "query", "(", "Connection", "conn", ",", "String", "sql", ",", "RsHandler", "<", "T", ">", "rsh", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "PreparedStatement", "ps", "=", "null", ";", "...
执行查询语句<br> 此方法不会关闭Connection @param <T> 处理结果类型 @param conn 数据库连接对象 @param sql 查询语句 @param rsh 结果集处理对象 @param params 参数 @return 结果对象 @throws SQLException SQL执行异常
[ "执行查询语句<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L258-L266
train
Query a SQL statement and return a single result.
[ 30522, 2270, 10763, 1026, 1056, 1028, 1056, 23032, 1006, 4434, 9530, 2078, 1010, 5164, 29296, 1010, 12667, 11774, 3917, 1026, 1056, 1028, 12667, 2232, 1010, 4874, 1012, 1012, 1012, 11498, 5244, 1007, 11618, 29296, 10288, 24422, 1063, 4810, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.executeBatch
public static int[] executeBatch(Connection conn, Iterable<String> sqls) throws SQLException { Statement statement = null; try { statement = conn.createStatement(); for (String sql : sqls) { statement.addBatch(sql); } return statement.executeBatch(); } finally { DbUtil.close(statement); } }
java
public static int[] executeBatch(Connection conn, Iterable<String> sqls) throws SQLException { Statement statement = null; try { statement = conn.createStatement(); for (String sql : sqls) { statement.addBatch(sql); } return statement.executeBatch(); } finally { DbUtil.close(statement); } }
[ "public", "static", "int", "[", "]", "executeBatch", "(", "Connection", "conn", ",", "Iterable", "<", "String", ">", "sqls", ")", "throws", "SQLException", "{", "Statement", "statement", "=", "null", ";", "try", "{", "statement", "=", "conn", ".", "createS...
批量执行非查询语句<br> 语句包括 插入、更新、删除<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sqls SQL列表 @return 每个SQL执行影响的行数 @throws SQLException SQL执行异常 @since 4.5.6
[ "批量执行非查询语句<br", ">", "语句包括", "插入、更新、删除<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L215-L226
train
Execute batch.
[ 30522, 2270, 10763, 20014, 1031, 1033, 15389, 14479, 2818, 1006, 4434, 9530, 2078, 1010, 2009, 6906, 3468, 1026, 5164, 1028, 29296, 2015, 1007, 11618, 29296, 10288, 24422, 1063, 4861, 4861, 1027, 19701, 1025, 3046, 1063, 4861, 1027, 9530, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java
BinaryHashTable.spillPartition
@Override protected int spillPartition() throws IOException { // find the largest partition int largestNumBlocks = 0; int largestPartNum = -1; for (int i = 0; i < partitionsBeingBuilt.size(); i++) { BinaryHashPartition p = partitionsBeingBuilt.get(i); if (p.isInMemory() && p.getNumOccupiedMemorySegments() > largestNumBlocks) { largestNumBlocks = p.getNumOccupiedMemorySegments(); largestPartNum = i; } } final BinaryHashPartition p = partitionsBeingBuilt.get(largestPartNum); // spill the partition int numBuffersFreed = p.spillPartition(this.ioManager, this.currentEnumerator.next(), this.buildSpillReturnBuffers); this.buildSpillRetBufferNumbers += numBuffersFreed; LOG.info(String.format("Grace hash join: Ran out memory, choosing partition " + "[%d] to spill, %d memory segments being freed", largestPartNum, numBuffersFreed)); // grab as many buffers as are available directly MemorySegment currBuff; while (this.buildSpillRetBufferNumbers > 0 && (currBuff = this.buildSpillReturnBuffers.poll()) != null) { this.availableMemory.add(currBuff); this.buildSpillRetBufferNumbers--; } numSpillFiles++; spillInBytes += numBuffersFreed * segmentSize; // The bloomFilter is built after the data is spilled, so that we can use enough memory. p.buildBloomFilterAndFreeBucket(); return largestPartNum; }
java
@Override protected int spillPartition() throws IOException { // find the largest partition int largestNumBlocks = 0; int largestPartNum = -1; for (int i = 0; i < partitionsBeingBuilt.size(); i++) { BinaryHashPartition p = partitionsBeingBuilt.get(i); if (p.isInMemory() && p.getNumOccupiedMemorySegments() > largestNumBlocks) { largestNumBlocks = p.getNumOccupiedMemorySegments(); largestPartNum = i; } } final BinaryHashPartition p = partitionsBeingBuilt.get(largestPartNum); // spill the partition int numBuffersFreed = p.spillPartition(this.ioManager, this.currentEnumerator.next(), this.buildSpillReturnBuffers); this.buildSpillRetBufferNumbers += numBuffersFreed; LOG.info(String.format("Grace hash join: Ran out memory, choosing partition " + "[%d] to spill, %d memory segments being freed", largestPartNum, numBuffersFreed)); // grab as many buffers as are available directly MemorySegment currBuff; while (this.buildSpillRetBufferNumbers > 0 && (currBuff = this.buildSpillReturnBuffers.poll()) != null) { this.availableMemory.add(currBuff); this.buildSpillRetBufferNumbers--; } numSpillFiles++; spillInBytes += numBuffersFreed * segmentSize; // The bloomFilter is built after the data is spilled, so that we can use enough memory. p.buildBloomFilterAndFreeBucket(); return largestPartNum; }
[ "@", "Override", "protected", "int", "spillPartition", "(", ")", "throws", "IOException", "{", "// find the largest partition", "int", "largestNumBlocks", "=", "0", ";", "int", "largestPartNum", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i",...
Selects a partition and spills it. The number of the spilled partition is returned. @return The number of the spilled partition.
[ "Selects", "a", "partition", "and", "spills", "it", ".", "The", "number", "of", "the", "spilled", "partition", "is", "returned", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BinaryHashTable.java#L615-L650
train
Spill the partition.
[ 30522, 1030, 2058, 15637, 5123, 20014, 14437, 19362, 3775, 3508, 1006, 1007, 11618, 22834, 10288, 24422, 1063, 1013, 1013, 2424, 1996, 2922, 13571, 20014, 2922, 19172, 23467, 2015, 1027, 1014, 1025, 20014, 2922, 19362, 2102, 19172, 1027, 1011...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.writeLines
public static <T> File writeLines(Collection<T> list, File file, String charset) throws IORuntimeException { return writeLines(list, file, charset, false); }
java
public static <T> File writeLines(Collection<T> list, File file, String charset) throws IORuntimeException { return writeLines(list, file, charset, false); }
[ "public", "static", "<", "T", ">", "File", "writeLines", "(", "Collection", "<", "T", ">", "list", ",", "File", "file", ",", "String", "charset", ")", "throws", "IORuntimeException", "{", "return", "writeLines", "(", "list", ",", "file", ",", "charset", ...
将列表写入文件,覆盖模式 @param <T> 集合元素类型 @param list 列表 @param file 文件 @param charset 字符集 @return 目标文件 @throws IORuntimeException IO异常 @since 4.2.0
[ "将列表写入文件,覆盖模式" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2910-L2912
train
Write a collection of objects to a file.
[ 30522, 2270, 10763, 1026, 1056, 1028, 5371, 4339, 12735, 1006, 3074, 1026, 1056, 1028, 2862, 1010, 5371, 5371, 1010, 5164, 25869, 13462, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2709, 4339, 12735, 1006, 2862, 1010, 5371, 1010, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java
SlotManager.unregisterTaskManager
public boolean unregisterTaskManager(InstanceID instanceId) { checkInit(); LOG.debug("Unregister TaskManager {} from the SlotManager.", instanceId); TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.remove(instanceId); if (null != taskManagerRegistration) { internalUnregisterTaskManager(taskManagerRegistration); return true; } else { LOG.debug("There is no task manager registered with instance ID {}. Ignoring this message.", instanceId); return false; } }
java
public boolean unregisterTaskManager(InstanceID instanceId) { checkInit(); LOG.debug("Unregister TaskManager {} from the SlotManager.", instanceId); TaskManagerRegistration taskManagerRegistration = taskManagerRegistrations.remove(instanceId); if (null != taskManagerRegistration) { internalUnregisterTaskManager(taskManagerRegistration); return true; } else { LOG.debug("There is no task manager registered with instance ID {}. Ignoring this message.", instanceId); return false; } }
[ "public", "boolean", "unregisterTaskManager", "(", "InstanceID", "instanceId", ")", "{", "checkInit", "(", ")", ";", "LOG", ".", "debug", "(", "\"Unregister TaskManager {} from the SlotManager.\"", ",", "instanceId", ")", ";", "TaskManagerRegistration", "taskManagerRegist...
Unregisters the task manager identified by the given instance id and its associated slots from the slot manager. @param instanceId identifying the task manager to unregister @return True if there existed a registered task manager with the given instance id
[ "Unregisters", "the", "task", "manager", "identified", "by", "the", "given", "instance", "id", "and", "its", "associated", "slots", "from", "the", "slot", "manager", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L383-L399
train
Unregister a TaskManager from the SlotManager.
[ 30522, 2270, 22017, 20898, 4895, 2890, 24063, 8743, 19895, 24805, 4590, 1006, 6013, 3593, 6013, 3593, 1007, 1063, 4638, 5498, 2102, 1006, 1007, 1025, 8833, 1012, 2139, 8569, 2290, 1006, 1000, 4895, 2890, 24063, 2121, 4708, 24805, 4590, 1063...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.newHashMap
public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) { return MapUtil.newHashMap(size, isOrder); }
java
public static <K, V> HashMap<K, V> newHashMap(int size, boolean isOrder) { return MapUtil.newHashMap(size, isOrder); }
[ "public", "static", "<", "K", ",", "V", ">", "HashMap", "<", "K", ",", "V", ">", "newHashMap", "(", "int", "size", ",", "boolean", "isOrder", ")", "{", "return", "MapUtil", ".", "newHashMap", "(", "size", ",", "isOrder", ")", ";", "}" ]
新建一个HashMap @param <K> Key类型 @param <V> Value类型 @param size 初始大小,由于默认负载因子0.75,传入的size会实际初始大小为size / 0.75 @param isOrder Map的Key是否有序,有序返回 {@link LinkedHashMap},否则返回 {@link HashMap} @return HashMap对象 @since 3.0.4 @see MapUtil#newHashMap(int, boolean)
[ "新建一个HashMap" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L376-L378
train
Creates a new HashMap with the specified size.
[ 30522, 2270, 10763, 1026, 1047, 1010, 1058, 1028, 23325, 2863, 2361, 1026, 1047, 1010, 1058, 1028, 2047, 14949, 22444, 2361, 1006, 20014, 2946, 1010, 22017, 20898, 11163, 26764, 1007, 1063, 2709, 4949, 21823, 2140, 1012, 2047, 14949, 22444, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ShuffleIndexInformation.java
ShuffleIndexInformation.getIndex
public ShuffleIndexRecord getIndex(int reduceId) { long offset = offsets.get(reduceId); long nextOffset = offsets.get(reduceId + 1); return new ShuffleIndexRecord(offset, nextOffset - offset); }
java
public ShuffleIndexRecord getIndex(int reduceId) { long offset = offsets.get(reduceId); long nextOffset = offsets.get(reduceId + 1); return new ShuffleIndexRecord(offset, nextOffset - offset); }
[ "public", "ShuffleIndexRecord", "getIndex", "(", "int", "reduceId", ")", "{", "long", "offset", "=", "offsets", ".", "get", "(", "reduceId", ")", ";", "long", "nextOffset", "=", "offsets", ".", "get", "(", "reduceId", "+", "1", ")", ";", "return", "new",...
Get index offset for a particular reducer.
[ "Get", "index", "offset", "for", "a", "particular", "reducer", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ShuffleIndexInformation.java#L56-L60
train
Get the index for a given reduce id.
[ 30522, 2270, 23046, 22254, 10288, 2890, 27108, 2094, 2131, 22254, 10288, 1006, 20014, 5547, 3593, 1007, 1063, 2146, 16396, 1027, 16396, 2015, 1012, 2131, 1006, 5547, 3593, 1007, 1025, 2146, 2279, 27475, 3388, 1027, 16396, 2015, 1012, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...