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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spring-projects/spring-boot | spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java | InitializrService.executeInitializrMetadataRetrieval | private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) {
HttpGet request = new HttpGet(url);
request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA));
return execute(request, url, "retrieve metadata");
} | java | private CloseableHttpResponse executeInitializrMetadataRetrieval(String url) {
HttpGet request = new HttpGet(url);
request.setHeader(new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_META_DATA));
return execute(request, url, "retrieve metadata");
} | [
"private",
"CloseableHttpResponse",
"executeInitializrMetadataRetrieval",
"(",
"String",
"url",
")",
"{",
"HttpGet",
"request",
"=",
"new",
"HttpGet",
"(",
"url",
")",
";",
"request",
".",
"setHeader",
"(",
"new",
"BasicHeader",
"(",
"HttpHeaders",
".",
"ACCEPT",
... | Retrieves the meta-data of the service at the specified URL.
@param url the URL
@return the response | [
"Retrieves",
"the",
"meta",
"-",
"data",
"of",
"the",
"service",
"at",
"the",
"specified",
"URL",
"."
] | 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/InitializrService.java#L185-L189 | train | Executes initializr metadata retrieval. | [
30522,
2797,
2485,
3085,
11039,
25856,
6072,
26029,
3366,
15389,
5498,
20925,
10993,
10867,
12928,
2850,
7559,
3388,
7373,
10175,
1006,
5164,
24471,
2140,
1007,
1063,
8299,
18150,
5227,
1027,
2047,
8299,
18150,
1006,
24471,
2140,
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/util/NumberUtil.java | NumberUtil.add | public static double add(Double v1, Double v2) {
return add((Number) v1, (Number) v2).doubleValue();
} | java | public static double add(Double v1, Double v2) {
return add((Number) v1, (Number) v2).doubleValue();
} | [
"public",
"static",
"double",
"add",
"(",
"Double",
"v1",
",",
"Double",
"v2",
")",
"{",
"return",
"add",
"(",
"(",
"Number",
")",
"v1",
",",
"(",
"Number",
")",
"v2",
")",
".",
"doubleValue",
"(",
")",
";",
"}"
] | 提供精确的加法运算
@param v1 被加数
@param v2 加数
@return 和
@since 3.1.1 | [
"提供精确的加法运算"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L97-L99 | train | Adds two doubles. | [
30522,
2270,
10763,
3313,
5587,
1006,
3313,
1058,
2487,
1010,
3313,
1058,
2475,
1007,
1063,
2709,
5587,
1006,
1006,
2193,
1007,
1058,
2487,
1010,
1006,
2193,
1007,
1058,
2475,
1007,
1012,
3313,
10175,
5657,
1006,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/deployment/TaskDeploymentDescriptor.java | TaskDeploymentDescriptor.getSerializedTaskInformation | @Nullable
public SerializedValue<TaskInformation> getSerializedTaskInformation() {
if (serializedTaskInformation instanceof NonOffloaded) {
NonOffloaded<TaskInformation> taskInformation =
(NonOffloaded<TaskInformation>) serializedTaskInformation;
return taskInformation.serializedValue;
} else {
throw new IllegalStateException(
"Trying to work with offloaded serialized job information.");
}
} | java | @Nullable
public SerializedValue<TaskInformation> getSerializedTaskInformation() {
if (serializedTaskInformation instanceof NonOffloaded) {
NonOffloaded<TaskInformation> taskInformation =
(NonOffloaded<TaskInformation>) serializedTaskInformation;
return taskInformation.serializedValue;
} else {
throw new IllegalStateException(
"Trying to work with offloaded serialized job information.");
}
} | [
"@",
"Nullable",
"public",
"SerializedValue",
"<",
"TaskInformation",
">",
"getSerializedTaskInformation",
"(",
")",
"{",
"if",
"(",
"serializedTaskInformation",
"instanceof",
"NonOffloaded",
")",
"{",
"NonOffloaded",
"<",
"TaskInformation",
">",
"taskInformation",
"=",... | Return the sub task's serialized task information.
@return serialized task information (may be <tt>null</tt> before a call to {@link
#loadBigData(PermanentBlobService)}). | [
"Return",
"the",
"sub",
"task",
"s",
"serialized",
"task",
"information",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/deployment/TaskDeploymentDescriptor.java#L209-L219 | train | Returns the serialized task information. | [
30522,
1030,
19701,
3085,
2270,
27289,
10175,
5657,
1026,
4708,
2378,
14192,
3370,
1028,
4152,
11610,
28931,
10230,
4939,
14192,
3370,
1006,
1007,
1063,
2065,
1006,
27289,
10230,
4939,
14192,
3370,
6013,
11253,
2512,
7245,
17468,
1007,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/Document.java | Document.getComplexSentenceList | public List<List<IWord>> getComplexSentenceList()
{
List<List<IWord>> complexList = new LinkedList<List<IWord>>();
for (Sentence sentence : sentenceList)
{
complexList.add(sentence.wordList);
}
return complexList;
} | java | public List<List<IWord>> getComplexSentenceList()
{
List<List<IWord>> complexList = new LinkedList<List<IWord>>();
for (Sentence sentence : sentenceList)
{
complexList.add(sentence.wordList);
}
return complexList;
} | [
"public",
"List",
"<",
"List",
"<",
"IWord",
">",
">",
"getComplexSentenceList",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"IWord",
">>",
"complexList",
"=",
"new",
"LinkedList",
"<",
"List",
"<",
"IWord",
">",
">",
"(",
")",
";",
"for",
"(",
"Sentenc... | 获取复杂句子列表,句子中的每个单词有可能是复合词,有可能是简单词
@return | [
"获取复杂句子列表,句子中的每个单词有可能是复合词,有可能是简单词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/Document.java#L131-L140 | train | Get the list of complex sentence lists. | [
30522,
2270,
2862,
1026,
2862,
1026,
1045,
18351,
1028,
1028,
2131,
9006,
19386,
5054,
6528,
29109,
2923,
1006,
1007,
1063,
2862,
1026,
2862,
1026,
1045,
18351,
1028,
1028,
3375,
9863,
1027,
2047,
5799,
9863,
1026,
2862,
1026,
1045,
18351,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/executiongraph/failover/RestartIndividualStrategy.java | RestartIndividualStrategy.onTaskFailure | @Override
public void onTaskFailure(Execution taskExecution, Throwable cause) {
executionGraph.getJobMasterMainThreadExecutor().assertRunningInMainThread();
// to better handle the lack of resources (potentially by a scale-in), we
// make failures due to missing resources global failures
if (cause instanceof NoResourceAvailableException) {
LOG.info("Not enough resources to schedule {} - triggering full recovery.", taskExecution);
executionGraph.failGlobal(cause);
return;
}
LOG.info("Recovering task failure for {} (#{}) via individual restart.",
taskExecution.getVertex().getTaskNameWithSubtaskIndex(), taskExecution.getAttemptNumber());
numTaskFailures.inc();
// trigger the restart once the task has reached its terminal state
// Note: currently all tasks passed here are already in their terminal state,
// so we could actually avoid the future. We use it anyways because it is cheap and
// it helps to support better testing
final CompletableFuture<ExecutionState> terminationFuture = taskExecution.getTerminalStateFuture();
terminationFuture.thenRun(
() -> performExecutionVertexRestart(taskExecution.getVertex(), taskExecution.getGlobalModVersion()));
} | java | @Override
public void onTaskFailure(Execution taskExecution, Throwable cause) {
executionGraph.getJobMasterMainThreadExecutor().assertRunningInMainThread();
// to better handle the lack of resources (potentially by a scale-in), we
// make failures due to missing resources global failures
if (cause instanceof NoResourceAvailableException) {
LOG.info("Not enough resources to schedule {} - triggering full recovery.", taskExecution);
executionGraph.failGlobal(cause);
return;
}
LOG.info("Recovering task failure for {} (#{}) via individual restart.",
taskExecution.getVertex().getTaskNameWithSubtaskIndex(), taskExecution.getAttemptNumber());
numTaskFailures.inc();
// trigger the restart once the task has reached its terminal state
// Note: currently all tasks passed here are already in their terminal state,
// so we could actually avoid the future. We use it anyways because it is cheap and
// it helps to support better testing
final CompletableFuture<ExecutionState> terminationFuture = taskExecution.getTerminalStateFuture();
terminationFuture.thenRun(
() -> performExecutionVertexRestart(taskExecution.getVertex(), taskExecution.getGlobalModVersion()));
} | [
"@",
"Override",
"public",
"void",
"onTaskFailure",
"(",
"Execution",
"taskExecution",
",",
"Throwable",
"cause",
")",
"{",
"executionGraph",
".",
"getJobMasterMainThreadExecutor",
"(",
")",
".",
"assertRunningInMainThread",
"(",
")",
";",
"// to better handle the lack ... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/RestartIndividualStrategy.java#L70-L95 | train | Called when a task fails. | [
30522,
1030,
2058,
15637,
2270,
11675,
2006,
10230,
2243,
7011,
4014,
5397,
1006,
7781,
4708,
10288,
8586,
13700,
1010,
5466,
3085,
3426,
1007,
1063,
7781,
14413,
1012,
2131,
5558,
25526,
24268,
24238,
2705,
16416,
3207,
2595,
8586,
16161,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/template/engine/velocity/VelocityTemplate.java | VelocityTemplate.toContext | private VelocityContext toContext(Map<?, ?> bindingMap) {
final Map<String, Object> map = Convert.convert(new TypeReference<Map<String, Object>>() {}, bindingMap);
return new VelocityContext(map);
} | java | private VelocityContext toContext(Map<?, ?> bindingMap) {
final Map<String, Object> map = Convert.convert(new TypeReference<Map<String, Object>>() {}, bindingMap);
return new VelocityContext(map);
} | [
"private",
"VelocityContext",
"toContext",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"bindingMap",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"Convert",
".",
"convert",
"(",
"new",
"TypeReference",
"<",
"Map",
"<",
"String",
",... | 将Map转为VelocityContext
@param bindingMap 参数绑定的Map
@return {@link VelocityContext} | [
"将Map转为VelocityContext"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityTemplate.java#L69-L72 | train | Converts a map of strings to VelocityContext. | [
30522,
2797,
10146,
8663,
18209,
2000,
8663,
18209,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
8031,
2863,
2361,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
4874,
1028,
4949,
1027,
10463,
1012,
10463,
1006,
2047,
2828,
2890,
25523,
1026,
4949,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/LongHashPartition.java | LongHashPartition.setReadPosition | @Override
public void setReadPosition(long pointer) {
final int bufferNum = (int) (pointer >>> this.segmentSizeBits);
final int offset = (int) (pointer & segmentSizeMask);
this.currentBufferNum = bufferNum;
seekInput(this.partitionBuffers[bufferNum], offset,
bufferNum < partitionBuffers.length - 1 ? segmentSize : finalBufferLimit);
} | java | @Override
public void setReadPosition(long pointer) {
final int bufferNum = (int) (pointer >>> this.segmentSizeBits);
final int offset = (int) (pointer & segmentSizeMask);
this.currentBufferNum = bufferNum;
seekInput(this.partitionBuffers[bufferNum], offset,
bufferNum < partitionBuffers.length - 1 ? segmentSize : finalBufferLimit);
} | [
"@",
"Override",
"public",
"void",
"setReadPosition",
"(",
"long",
"pointer",
")",
"{",
"final",
"int",
"bufferNum",
"=",
"(",
"int",
")",
"(",
"pointer",
">>>",
"this",
".",
"segmentSizeBits",
")",
";",
"final",
"int",
"offset",
"=",
"(",
"int",
")",
... | ------------------ PagedInputView for read -------------------- | [
"------------------",
"PagedInputView",
"for",
"read",
"--------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java#L529-L538 | train | Set the read position of the input buffer. | [
30522,
1030,
2058,
15637,
2270,
11675,
2275,
16416,
18927,
19234,
1006,
2146,
20884,
1007,
1063,
2345,
20014,
17698,
19172,
1027,
1006,
20014,
1007,
1006,
20884,
1028,
1028,
1028,
2023,
1012,
9214,
4697,
16313,
2015,
1007,
1025,
2345,
20014,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.removeHeader | @Deprecated
public static void removeHeader(HttpMessage message, String name) {
message.headers().remove(name);
} | java | @Deprecated
public static void removeHeader(HttpMessage message, String name) {
message.headers().remove(name);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"removeHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"remove",
"(",
"name",
")",
";",
"}"
] | @deprecated Use {@link #remove(CharSequence)} instead.
@see #removeHeader(HttpMessage, CharSequence) | [
"@deprecated",
"Use",
"{",
"@link",
"#remove",
"(",
"CharSequence",
")",
"}",
"instead",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L679-L682 | train | Removes a header from the message. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
11675,
6366,
4974,
2121,
1006,
8299,
7834,
3736,
3351,
4471,
1010,
5164,
2171,
1007,
1063,
4471,
1012,
20346,
2015,
1006,
1007,
1012,
6366,
1006,
2171,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.readLines | public static void readLines(File file, Charset charset, LineHandler lineHandler) throws IORuntimeException {
FileReader.create(file, charset).readLines(lineHandler);
} | java | public static void readLines(File file, Charset charset, LineHandler lineHandler) throws IORuntimeException {
FileReader.create(file, charset).readLines(lineHandler);
} | [
"public",
"static",
"void",
"readLines",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineHandler",
"lineHandler",
")",
"throws",
"IORuntimeException",
"{",
"FileReader",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"readLines",
"(",
"lineHan... | 按行处理文件内容
@param file 文件
@param charset 编码
@param lineHandler {@link LineHandler}行处理器
@throws IORuntimeException IO异常 | [
"按行处理文件内容"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2415-L2417 | train | Reads the lines of a file into a LineHandler. | [
30522,
2270,
10763,
11675,
3191,
12735,
1006,
5371,
5371,
1010,
25869,
13462,
25869,
13462,
1010,
2240,
11774,
3917,
2240,
11774,
3917,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
5371,
16416,
4063,
1012,
3443,
1006,
5371,
1010,
2586... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ZipUtil.java | ZipUtil.addDir | private static void addDir(String path, ZipOutputStream out) throws UtilException {
path = StrUtil.addSuffixIfNot(path, StrUtil.SLASH);
try {
out.putNextEntry(new ZipEntry(path));
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | java | private static void addDir(String path, ZipOutputStream out) throws UtilException {
path = StrUtil.addSuffixIfNot(path, StrUtil.SLASH);
try {
out.putNextEntry(new ZipEntry(path));
} catch (IOException e) {
throw new UtilException(e);
} finally {
closeEntry(out);
}
} | [
"private",
"static",
"void",
"addDir",
"(",
"String",
"path",
",",
"ZipOutputStream",
"out",
")",
"throws",
"UtilException",
"{",
"path",
"=",
"StrUtil",
".",
"addSuffixIfNot",
"(",
"path",
",",
"StrUtil",
".",
"SLASH",
")",
";",
"try",
"{",
"out",
".",
... | 在压缩包中新建目录
@param path 压缩的路径
@param out 压缩文件存储对象
@throws UtilException IO异常 | [
"在压缩包中新建目录"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L841-L850 | train | Adds a directory to the output stream. | [
30522,
2797,
10763,
11675,
5587,
4305,
2099,
1006,
5164,
4130,
1010,
14101,
5833,
18780,
21422,
2041,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
4130,
1027,
2358,
22134,
4014,
1012,
9909,
16093,
8873,
9048,
2546,
17048,
1006,
4130,
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/lang/Dict.java | Dict.setIgnoreNull | public Dict setIgnoreNull(String attr, Object value) {
if (null != attr && null != value) {
set(attr, value);
}
return this;
} | java | public Dict setIgnoreNull(String attr, Object value) {
if (null != attr && null != value) {
set(attr, value);
}
return this;
} | [
"public",
"Dict",
"setIgnoreNull",
"(",
"String",
"attr",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"attr",
"&&",
"null",
"!=",
"value",
")",
"{",
"set",
"(",
"attr",
",",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] | 设置列,当键或值为null时忽略
@param attr 属性
@param value 值
@return 本身 | [
"设置列,当键或值为null时忽略"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Dict.java#L247-L252 | train | Sets the value of an attribute to ignore null. | [
30522,
2270,
4487,
6593,
2275,
23773,
5686,
11231,
3363,
1006,
5164,
2012,
16344,
1010,
4874,
3643,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2012,
16344,
1004,
1004,
19701,
999,
1027,
3643,
1007,
1063,
2275,
1006,
2012,
16344,
1010,
3643,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/LexerEngineFactory.java | LexerEngineFactory.newInstance | public static LexerEngine newInstance(final DatabaseType dbType, final String sql) {
switch (dbType) {
case H2:
return new LexerEngine(new H2Lexer(sql));
case MySQL:
return new LexerEngine(new MySQLLexer(sql));
case Oracle:
return new LexerEngine(new OracleLexer(sql));
case SQLServer:
return new LexerEngine(new SQLServerLexer(sql));
case PostgreSQL:
return new LexerEngine(new PostgreSQLLexer(sql));
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | java | public static LexerEngine newInstance(final DatabaseType dbType, final String sql) {
switch (dbType) {
case H2:
return new LexerEngine(new H2Lexer(sql));
case MySQL:
return new LexerEngine(new MySQLLexer(sql));
case Oracle:
return new LexerEngine(new OracleLexer(sql));
case SQLServer:
return new LexerEngine(new SQLServerLexer(sql));
case PostgreSQL:
return new LexerEngine(new PostgreSQLLexer(sql));
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | [
"public",
"static",
"LexerEngine",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"String",
"sql",
")",
"{",
"switch",
"(",
"dbType",
")",
"{",
"case",
"H2",
":",
"return",
"new",
"LexerEngine",
"(",
"new",
"H2Lexer",
"(",
"sql",
")",... | Create lexical analysis engine instance.
@param dbType database type
@param sql SQL
@return lexical analysis engine instance | [
"Create",
"lexical",
"analysis",
"engine",
"instance",
"."
] | 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/LexerEngineFactory.java#L44-L59 | train | Create lexer engine instance. | [
30522,
2270,
10763,
17244,
7869,
3070,
3170,
2047,
7076,
26897,
1006,
2345,
7809,
13874,
16962,
13874,
1010,
2345,
5164,
29296,
1007,
1063,
6942,
1006,
16962,
13874,
1007,
1063,
2553,
1044,
2475,
1024,
2709,
2047,
17244,
7869,
3070,
3170,
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-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java | AbstractBinaryMemcacheDecoder.invalidChunk | private MemcacheContent invalidChunk(Exception cause) {
state = State.BAD_MESSAGE;
MemcacheContent chunk = new DefaultLastMemcacheContent(Unpooled.EMPTY_BUFFER);
chunk.setDecoderResult(DecoderResult.failure(cause));
return chunk;
} | java | private MemcacheContent invalidChunk(Exception cause) {
state = State.BAD_MESSAGE;
MemcacheContent chunk = new DefaultLastMemcacheContent(Unpooled.EMPTY_BUFFER);
chunk.setDecoderResult(DecoderResult.failure(cause));
return chunk;
} | [
"private",
"MemcacheContent",
"invalidChunk",
"(",
"Exception",
"cause",
")",
"{",
"state",
"=",
"State",
".",
"BAD_MESSAGE",
";",
"MemcacheContent",
"chunk",
"=",
"new",
"DefaultLastMemcacheContent",
"(",
"Unpooled",
".",
"EMPTY_BUFFER",
")",
";",
"chunk",
".",
... | Helper method to create a content chunk indicating a invalid decoding result.
@param cause the cause of the decoding failure.
@return a valid content chunk indicating failure. | [
"Helper",
"method",
"to",
"create",
"a",
"content",
"chunk",
"indicating",
"a",
"invalid",
"decoding",
"result",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-memcache/src/main/java/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java#L188-L193 | train | This method is called when a cache entry is invalid. | [
30522,
2797,
2033,
12458,
15395,
8663,
6528,
2102,
19528,
20760,
8950,
1006,
6453,
3426,
1007,
1063,
2110,
1027,
2110,
1012,
2919,
1035,
4471,
1025,
2033,
12458,
15395,
8663,
6528,
2102,
20000,
1027,
2047,
12398,
8523,
21246,
6633,
3540,
54... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-examples/src/main/java/org/apache/flink/graph/drivers/parameter/LongParameter.java | LongParameter.setMinimumValue | public LongParameter setMinimumValue(long minimumValue) {
if (hasMaximumValue) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
return this;
} | java | public LongParameter setMinimumValue(long minimumValue) {
if (hasMaximumValue) {
Util.checkParameter(minimumValue <= maximumValue,
"Minimum value (" + minimumValue + ") must be less than or equal to maximum (" + maximumValue + ")");
}
this.hasMinimumValue = true;
this.minimumValue = minimumValue;
return this;
} | [
"public",
"LongParameter",
"setMinimumValue",
"(",
"long",
"minimumValue",
")",
"{",
"if",
"(",
"hasMaximumValue",
")",
"{",
"Util",
".",
"checkParameter",
"(",
"minimumValue",
"<=",
"maximumValue",
",",
"\"Minimum value (\"",
"+",
"minimumValue",
"+",
"\") must be ... | Set the minimum value.
<p>If a maximum value has been set then the minimum value must not be
greater than the maximum value.
@param minimumValue the minimum value
@return this | [
"Set",
"the",
"minimum",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/LongParameter.java#L73-L83 | train | Sets the minimum value. | [
30522,
2270,
2146,
28689,
22828,
2275,
25300,
27147,
10175,
5657,
1006,
2146,
6263,
10175,
5657,
30524,
1006,
6263,
10175,
5657,
1026,
1027,
4555,
10175,
5657,
1010,
1000,
6263,
3643,
1006,
1000,
1009,
6263,
10175,
5657,
1009,
1000,
1007,
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... |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.setAlign | public static CellStyle setAlign(CellStyle cellStyle, HorizontalAlignment halign, VerticalAlignment valign) {
cellStyle.setAlignment(halign);
cellStyle.setVerticalAlignment(valign);
return cellStyle;
} | java | public static CellStyle setAlign(CellStyle cellStyle, HorizontalAlignment halign, VerticalAlignment valign) {
cellStyle.setAlignment(halign);
cellStyle.setVerticalAlignment(valign);
return cellStyle;
} | [
"public",
"static",
"CellStyle",
"setAlign",
"(",
"CellStyle",
"cellStyle",
",",
"HorizontalAlignment",
"halign",
",",
"VerticalAlignment",
"valign",
")",
"{",
"cellStyle",
".",
"setAlignment",
"(",
"halign",
")",
";",
"cellStyle",
".",
"setVerticalAlignment",
"(",
... | 设置cell文本对齐样式
@param cellStyle {@link CellStyle}
@param halign 横向位置
@param valign 纵向位置
@return {@link CellStyle} | [
"设置cell文本对齐样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L55-L59 | train | Sets the alignment of a cell style. | [
30522,
2270,
10763,
4442,
27983,
2275,
11475,
16206,
1006,
4442,
27983,
4442,
27983,
1010,
9876,
11475,
16206,
3672,
11085,
23773,
1010,
7471,
11475,
16206,
3672,
11748,
23773,
1007,
1063,
4442,
27983,
1012,
2275,
11475,
16206,
3672,
1006,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/instance/SharedSlot.java | SharedSlot.getNumberLeaves | @Override
public int getNumberLeaves() {
while (true) {
try {
int result = 0;
for (Slot slot: subSlots){
result += slot.getNumberLeaves();
}
return result;
}
catch (ConcurrentModificationException e) {
// ignore and retry
}
}
} | java | @Override
public int getNumberLeaves() {
while (true) {
try {
int result = 0;
for (Slot slot: subSlots){
result += slot.getNumberLeaves();
}
return result;
}
catch (ConcurrentModificationException e) {
// ignore and retry
}
}
} | [
"@",
"Override",
"public",
"int",
"getNumberLeaves",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"int",
"result",
"=",
"0",
";",
"for",
"(",
"Slot",
"slot",
":",
"subSlots",
")",
"{",
"result",
"+=",
"slot",
".",
"getNumberLeaves",
"("... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SharedSlot.java#L143-L157 | train | Returns the number of leaves in this slot. | [
30522,
1030,
2058,
15637,
2270,
20014,
2131,
19172,
5677,
19738,
6961,
1006,
1007,
1063,
2096,
1006,
2995,
1007,
1063,
3046,
1063,
20014,
2765,
1027,
1014,
1025,
2005,
1006,
10453,
10453,
1024,
4942,
14540,
12868,
1007,
1063,
2765,
1009,
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-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java | RuntimeUtil.execForLines | public static List<String> execForLines(Charset charset, String... cmds) throws IORuntimeException {
return getResultLines(exec(cmds), charset);
} | java | public static List<String> execForLines(Charset charset, String... cmds) throws IORuntimeException {
return getResultLines(exec(cmds), charset);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"execForLines",
"(",
"Charset",
"charset",
",",
"String",
"...",
"cmds",
")",
"throws",
"IORuntimeException",
"{",
"return",
"getResultLines",
"(",
"exec",
"(",
"cmds",
")",
",",
"charset",
")",
";",
"}"
] | 执行系统命令,使用系统默认编码
@param charset 编码
@param cmds 命令列表,每个元素代表一条命令
@return 执行结果,按行区分
@throws IORuntimeException IO异常
@since 3.1.2 | [
"执行系统命令,使用系统默认编码"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L65-L67 | train | Executes the given commands and returns a list of strings. | [
30522,
2270,
10763,
2862,
1026,
5164,
1028,
4654,
8586,
29278,
12735,
1006,
25869,
13462,
25869,
13462,
1010,
5164,
1012,
1012,
1012,
4642,
5104,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
2131,
6072,
11314,
12735,
1006,
4654,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java | ReferenceCountedOpenSslEngine.toJavaCipherSuite | private String toJavaCipherSuite(String openSslCipherSuite) {
if (openSslCipherSuite == null) {
return null;
}
String version = SSL.getVersion(ssl);
String prefix = toJavaCipherSuitePrefix(version);
return CipherSuiteConverter.toJava(openSslCipherSuite, prefix);
} | java | private String toJavaCipherSuite(String openSslCipherSuite) {
if (openSslCipherSuite == null) {
return null;
}
String version = SSL.getVersion(ssl);
String prefix = toJavaCipherSuitePrefix(version);
return CipherSuiteConverter.toJava(openSslCipherSuite, prefix);
} | [
"private",
"String",
"toJavaCipherSuite",
"(",
"String",
"openSslCipherSuite",
")",
"{",
"if",
"(",
"openSslCipherSuite",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"version",
"=",
"SSL",
".",
"getVersion",
"(",
"ssl",
")",
";",
"String",
... | Converts the specified OpenSSL cipher suite to the Java cipher suite. | [
"Converts",
"the",
"specified",
"OpenSSL",
"cipher",
"suite",
"to",
"the",
"Java",
"cipher",
"suite",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java#L1810-L1818 | train | Convert a OpenSslCipherSuite to a Java CipherSuite. | [
30522,
2797,
5164,
2000,
3900,
24887,
11514,
22328,
14663,
2063,
1006,
5164,
7480,
14540,
6895,
27921,
28880,
2063,
1007,
1063,
2065,
1006,
7480,
14540,
6895,
27921,
28880,
2063,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
5164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ZipUtil.java | ZipUtil.inflater | private static void inflater(InputStream in, OutputStream out) {
final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
IoUtil.copy(in, ios);
try {
ios.finish();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | private static void inflater(InputStream in, OutputStream out) {
final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
IoUtil.copy(in, ios);
try {
ios.finish();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"private",
"static",
"void",
"inflater",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"{",
"final",
"InflaterOutputStream",
"ios",
"=",
"(",
"out",
"instanceof",
"InflaterOutputStream",
")",
"?",
"(",
"InflaterOutputStream",
")",
"out",
":",
"new",... | 将Zlib流解压到out中
@param in zlib数据流
@param out 输出 | [
"将Zlib流解压到out中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L924-L932 | train | Inflater the input stream and write the result to the output stream. | [
30522,
2797,
10763,
11675,
1999,
10258,
24932,
1006,
20407,
25379,
1999,
1010,
27852,
25379,
2041,
1007,
1063,
2345,
1999,
10258,
24932,
5833,
18780,
21422,
16380,
1027,
1006,
2041,
6013,
11253,
1999,
10258,
24932,
5833,
18780,
21422,
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... |
alibaba/canal | parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/request/AbstractRequest.java | AbstractRequest.executeHttpRequest | @SuppressWarnings("deprecation")
private final HttpResponse executeHttpRequest(HttpGet getMethod, String host) throws Exception {
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
return true;
}
}).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
new String[] { "TLSv1" },
null,
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Registry registry = RegistryBuilder.create()
.register("http", PlainConnectionSocketFactory.INSTANCE)
.register("https", sslsf)
.build();
HttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager(registry);
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setMaxConnPerRoute(50)
.setMaxConnTotal(100)
.setConnectionManager(httpClientConnectionManager)
.build();
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout)
.build();
getMethod.setConfig(requestConfig);
HttpResponse response = httpClient.execute(getMethod);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpResponseStatus.OK.code() && statusCode != HttpResponseStatus.PARTIAL_CONTENT.code()) {
String result = EntityUtils.toString(response.getEntity());
throw new RuntimeException("return error !" + response.getStatusLine().getReasonPhrase() + ", " + result);
}
return response;
} | java | @SuppressWarnings("deprecation")
private final HttpResponse executeHttpRequest(HttpGet getMethod, String host) throws Exception {
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
return true;
}
}).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
new String[] { "TLSv1" },
null,
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Registry registry = RegistryBuilder.create()
.register("http", PlainConnectionSocketFactory.INSTANCE)
.register("https", sslsf)
.build();
HttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager(registry);
CloseableHttpClient httpClient = HttpClientBuilder.create()
.setMaxConnPerRoute(50)
.setMaxConnTotal(100)
.setConnectionManager(httpClientConnectionManager)
.build();
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout)
.setSocketTimeout(timeout)
.build();
getMethod.setConfig(requestConfig);
HttpResponse response = httpClient.execute(getMethod);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != HttpResponseStatus.OK.code() && statusCode != HttpResponseStatus.PARTIAL_CONTENT.code()) {
String result = EntityUtils.toString(response.getEntity());
throw new RuntimeException("return error !" + response.getStatusLine().getReasonPhrase() + ", " + result);
}
return response;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"final",
"HttpResponse",
"executeHttpRequest",
"(",
"HttpGet",
"getMethod",
",",
"String",
"host",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslContext",
"=",
"SSLContexts",
".",
"custom",
"(",
... | 执行http请求
@param getMethod
@return
@throws IOException | [
"执行http请求"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/request/AbstractRequest.java#L196-L232 | train | Execute HTTP request. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
2139,
28139,
10719,
1000,
1007,
2797,
2345,
8299,
6072,
26029,
3366,
15389,
11039,
25856,
2890,
15500,
1006,
8299,
18150,
2131,
11368,
6806,
2094,
1010,
5164,
3677,
1007,
11618,
6453,
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... |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java | EpollSocketChannelConfig.setSoBusyPoll | public EpollSocketChannelConfig setSoBusyPoll(int loopMicros) {
try {
((EpollSocketChannel) channel).socket.setSoBusyPoll(loopMicros);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | public EpollSocketChannelConfig setSoBusyPoll(int loopMicros) {
try {
((EpollSocketChannel) channel).socket.setSoBusyPoll(loopMicros);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"public",
"EpollSocketChannelConfig",
"setSoBusyPoll",
"(",
"int",
"loopMicros",
")",
"{",
"try",
"{",
"(",
"(",
"EpollSocketChannel",
")",
"channel",
")",
".",
"socket",
".",
"setSoBusyPoll",
"(",
"loopMicros",
")",
";",
"return",
"this",
";",
"}",
"catch",
... | Set the {@code SO_BUSY_POLL} option on the socket. See {@code man 7 tcp} for more details. | [
"Set",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java#L400-L407 | train | Sets the timeout for a socket to wait for a certain number of milliseconds. | [
30522,
2270,
4958,
14511,
6499,
19869,
10649,
20147,
22499,
2078,
8873,
2290,
4520,
16429,
2271,
22571,
14511,
1006,
20014,
7077,
7712,
7352,
1007,
1063,
3046,
1063,
1006,
1006,
4958,
14511,
6499,
19869,
10649,
20147,
2140,
1007,
3149,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/FileUtils.java | FileUtils.deleteFileOrDirectory | public static void deleteFileOrDirectory(File file) throws IOException {
checkNotNull(file, "file");
guardIfWindows(FileUtils::deleteFileOrDirectoryInternal, file);
} | java | public static void deleteFileOrDirectory(File file) throws IOException {
checkNotNull(file, "file");
guardIfWindows(FileUtils::deleteFileOrDirectoryInternal, file);
} | [
"public",
"static",
"void",
"deleteFileOrDirectory",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"file",
",",
"\"file\"",
")",
";",
"guardIfWindows",
"(",
"FileUtils",
"::",
"deleteFileOrDirectoryInternal",
",",
"file",
")",
";",
... | Removes the given file or directory recursively.
<p>If the file or directory does not exist, this does not throw an exception, but simply does nothing.
It considers the fact that a file-to-be-deleted is not present a success.
<p>This method is safe against other concurrent deletion attempts.
@param file The file or directory to delete.
@throws IOException Thrown if the directory could not be cleaned for some reason, for example
due to missing access/write permissions. | [
"Removes",
"the",
"given",
"file",
"or",
"directory",
"recursively",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L223-L227 | train | Deletes the given file or directory. | [
30522,
2270,
10763,
11675,
3972,
12870,
8873,
2571,
8551,
7442,
16761,
2100,
1006,
5371,
5371,
1007,
11618,
22834,
10288,
24422,
1063,
4638,
17048,
11231,
3363,
1006,
5371,
1010,
1000,
5371,
1000,
1007,
1025,
3457,
10128,
11101,
15568,
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... |
apache/flink | flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java | ConfigUtil.normalizeYaml | public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) {
final Map<String, String> normalized = new HashMap<>();
yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v));
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(normalized);
return properties;
} | java | public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) {
final Map<String, String> normalized = new HashMap<>();
yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v));
final DescriptorProperties properties = new DescriptorProperties(true);
properties.putProperties(normalized);
return properties;
} | [
"public",
"static",
"DescriptorProperties",
"normalizeYaml",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"yamlMap",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"normalized",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"yamlMap",
".",
... | Normalizes key-value properties from Yaml in the normalized format of the Table API. | [
"Normalizes",
"key",
"-",
"value",
"properties",
"from",
"Yaml",
"in",
"the",
"normalized",
"format",
"of",
"the",
"Table",
"API",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java#L48-L54 | train | Normalize YAML map. | [
30522,
2270,
10763,
4078,
23235,
2953,
21572,
4842,
7368,
3671,
4697,
14852,
2140,
1006,
4949,
1026,
5164,
1010,
4874,
1028,
8038,
19968,
2863,
2361,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
3671,
3550,
1027,
2047,
23325,
2863,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/net/LocalPortGenerater.java | LocalPortGenerater.generate | public int generate() {
int validPort = alternativePort.get();
// 获取可用端口
while (false == NetUtil.isUsableLocalPort(validPort)) {
validPort = alternativePort.incrementAndGet();
}
return validPort;
} | java | public int generate() {
int validPort = alternativePort.get();
// 获取可用端口
while (false == NetUtil.isUsableLocalPort(validPort)) {
validPort = alternativePort.incrementAndGet();
}
return validPort;
} | [
"public",
"int",
"generate",
"(",
")",
"{",
"int",
"validPort",
"=",
"alternativePort",
".",
"get",
"(",
")",
";",
"// 获取可用端口\r",
"while",
"(",
"false",
"==",
"NetUtil",
".",
"isUsableLocalPort",
"(",
"validPort",
")",
")",
"{",
"validPort",
"=",
"alternat... | 生成一个本地端口,用于远程端口映射
@return 未被使用的本地端口 | [
"生成一个本地端口,用于远程端口映射"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/LocalPortGenerater.java#L33-L40 | train | generate - returns a valid port number | [
30522,
2270,
20014,
9699,
1006,
1007,
1063,
20014,
9398,
6442,
1027,
4522,
6442,
1012,
2131,
1006,
1007,
1025,
1013,
1013,
100,
100,
100,
100,
100,
1788,
2096,
1006,
6270,
1027,
1027,
5658,
21823,
2140,
1012,
2003,
10383,
3468,
4135,
9289... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ServletUtil.java | ServletUtil.getClientIP | public static String getClientIP(HttpServletRequest request, String... otherHeaderNames) {
String[] headers = { "X-Forwarded-For", "X-Real-IP", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR" };
if (ArrayUtil.isNotEmpty(otherHeaderNames)) {
headers = ArrayUtil.addAll(headers, otherHeaderNames);
}
return getClientIPByHeader(request, headers);
} | java | public static String getClientIP(HttpServletRequest request, String... otherHeaderNames) {
String[] headers = { "X-Forwarded-For", "X-Real-IP", "Proxy-Client-IP", "WL-Proxy-Client-IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR" };
if (ArrayUtil.isNotEmpty(otherHeaderNames)) {
headers = ArrayUtil.addAll(headers, otherHeaderNames);
}
return getClientIPByHeader(request, headers);
} | [
"public",
"static",
"String",
"getClientIP",
"(",
"HttpServletRequest",
"request",
",",
"String",
"...",
"otherHeaderNames",
")",
"{",
"String",
"[",
"]",
"headers",
"=",
"{",
"\"X-Forwarded-For\"",
",",
"\"X-Real-IP\"",
",",
"\"Proxy-Client-IP\"",
",",
"\"WL-Proxy-... | 获取客户端IP
<p>
默认检测的Header:
<pre>
1、X-Forwarded-For
2、X-Real-IP
3、Proxy-Client-IP
4、WL-Proxy-Client-IP
</pre>
</p>
<p>
otherHeaderNames参数用于自定义检测的Header<br>
需要注意的是,使用此方法获取的客户IP地址必须在Http服务器(例如Nginx)中配置头信息,否则容易造成IP伪造。
</p>
@param request 请求对象{@link HttpServletRequest}
@param otherHeaderNames 其他自定义头文件,通常在Http服务器(例如Nginx)中配置
@return IP地址 | [
"获取客户端IP"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L200-L207 | train | Gets the client IP from the request. | [
30522,
2270,
10763,
5164,
2131,
20464,
11638,
11514,
1006,
16770,
2121,
2615,
7485,
2890,
15500,
5227,
1010,
5164,
1012,
1012,
1012,
2060,
4974,
11795,
14074,
2015,
1007,
1063,
5164,
1031,
1033,
20346,
2015,
1027,
1063,
1000,
1060,
1011,
28... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/bean/BeanDesc.java | BeanDesc.createProp | private PropDesc createProp(Field field) {
final String fieldName = field.getName();
final Class<?> fieldType = field.getType();
final boolean isBooeanField = BooleanUtil.isBoolean(fieldType);
Method getter = null;
Method setter = null;
String methodName;
Class<?>[] parameterTypes;
for (Method method : ReflectUtil.getMethods(this.beanClass)) {
parameterTypes = method.getParameterTypes();
if (parameterTypes.length > 1) {
// 多于1个参数说明非Getter或Setter
continue;
}
methodName = method.getName();
if (parameterTypes.length == 0) {
// 无参数,可能为Getter方法
if (isMatchGetter(methodName, fieldName, isBooeanField)) {
// 方法名与字段名匹配,则为Getter方法
getter = method;
}
} else if (isMatchSetter(methodName, fieldName, isBooeanField)) {
// 只有一个参数的情况下方法名与字段名对应匹配,则为Setter方法
setter = method;
}
if (null != getter && null != setter) {
// 如果Getter和Setter方法都找到了,不再继续寻找
break;
}
}
return new PropDesc(field, getter, setter);
} | java | private PropDesc createProp(Field field) {
final String fieldName = field.getName();
final Class<?> fieldType = field.getType();
final boolean isBooeanField = BooleanUtil.isBoolean(fieldType);
Method getter = null;
Method setter = null;
String methodName;
Class<?>[] parameterTypes;
for (Method method : ReflectUtil.getMethods(this.beanClass)) {
parameterTypes = method.getParameterTypes();
if (parameterTypes.length > 1) {
// 多于1个参数说明非Getter或Setter
continue;
}
methodName = method.getName();
if (parameterTypes.length == 0) {
// 无参数,可能为Getter方法
if (isMatchGetter(methodName, fieldName, isBooeanField)) {
// 方法名与字段名匹配,则为Getter方法
getter = method;
}
} else if (isMatchSetter(methodName, fieldName, isBooeanField)) {
// 只有一个参数的情况下方法名与字段名对应匹配,则为Setter方法
setter = method;
}
if (null != getter && null != setter) {
// 如果Getter和Setter方法都找到了,不再继续寻找
break;
}
}
return new PropDesc(field, getter, setter);
} | [
"private",
"PropDesc",
"createProp",
"(",
"Field",
"field",
")",
"{",
"final",
"String",
"fieldName",
"=",
"field",
".",
"getName",
"(",
")",
";",
"final",
"Class",
"<",
"?",
">",
"fieldType",
"=",
"field",
".",
"getType",
"(",
")",
";",
"final",
"bool... | 根据字段创建属性描述<br>
查找Getter和Setter方法时会:
<pre>
1. 忽略字段和方法名的大小写
2. Getter查找getXXX、isXXX、getIsXXX
3. Setter查找setXXX、setIsXXX
4. Setter忽略参数值与字段值不匹配的情况,因此有多个参数类型的重载时,会调用首次匹配的
</pre>
@param field 字段
@return {@link PropDesc}
@since 4.0.2 | [
"根据字段创建属性描述<br",
">",
"查找Getter和Setter方法时会:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanDesc.java#L163-L197 | train | Creates a PropDesc object for a given field. | [
30522,
2797,
17678,
6155,
2278,
3443,
21572,
2361,
1006,
2492,
2492,
1007,
1063,
2345,
5164,
2492,
18442,
1027,
2492,
1012,
2131,
18442,
1006,
1007,
1025,
2345,
2465,
1026,
1029,
1028,
2492,
13874,
1027,
2492,
1012,
2131,
13874,
1006,
1007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/gsa/GatherSumApplyIteration.java | GatherSumApplyIteration.createResult | @Override
public DataSet<Vertex<K, VV>> createResult() {
if (vertexDataSet == null) {
throw new IllegalStateException("The input data set has not been set.");
}
// Prepare type information
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertexDataSet.getType()).getTypeAt(0);
TypeInformation<M> messageType = TypeExtractor.createTypeInfo(gather, GatherFunction.class, gather.getClass(), 2);
TypeInformation<Tuple2<K, M>> innerType = new TupleTypeInfo<>(keyType, messageType);
TypeInformation<Vertex<K, VV>> outputType = vertexDataSet.getType();
// check whether the numVertices option is set and, if so, compute the total number of vertices
// and set it within the gather, sum and apply functions
DataSet<LongValue> numberOfVertices = null;
if (this.configuration != null && this.configuration.isOptNumVertices()) {
try {
numberOfVertices = GraphUtils.count(this.vertexDataSet);
} catch (Exception e) {
e.printStackTrace();
}
}
// Prepare UDFs
GatherUdf<K, VV, EV, M> gatherUdf = new GatherUdf<>(gather, innerType);
SumUdf<K, VV, EV, M> sumUdf = new SumUdf<>(sum, innerType);
ApplyUdf<K, VV, EV, M> applyUdf = new ApplyUdf<>(apply, outputType);
final int[] zeroKeyPos = new int[] {0};
final DeltaIteration<Vertex<K, VV>, Vertex<K, VV>> iteration =
vertexDataSet.iterateDelta(vertexDataSet, maximumNumberOfIterations, zeroKeyPos);
// set up the iteration operator
if (this.configuration != null) {
iteration.name(this.configuration.getName(
"Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")"));
iteration.parallelism(this.configuration.getParallelism());
iteration.setSolutionSetUnManaged(this.configuration.isSolutionSetUnmanagedMemory());
// register all aggregators
for (Map.Entry<String, Aggregator<?>> entry : this.configuration.getAggregators().entrySet()) {
iteration.registerAggregator(entry.getKey(), entry.getValue());
}
}
else {
// no configuration provided; set default name
iteration.name("Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")");
}
// Prepare the neighbors
if (this.configuration != null) {
direction = this.configuration.getDirection();
}
DataSet<Tuple2<K, Neighbor<VV, EV>>> neighbors;
switch(direction) {
case OUT:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
break;
case IN:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>());
break;
case ALL:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>()).union(iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>()));
break;
default:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
break;
}
// Gather, sum and apply
MapOperator<Tuple2<K, Neighbor<VV, EV>>, Tuple2<K, M>> gatherMapOperator = neighbors.map(gatherUdf);
// configure map gather function with name and broadcast variables
gatherMapOperator = gatherMapOperator.name("Gather");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getGatherBcastVars()) {
gatherMapOperator = gatherMapOperator.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
gatherMapOperator = gatherMapOperator.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
DataSet<Tuple2<K, M>> gatheredSet = gatherMapOperator;
ReduceOperator<Tuple2<K, M>> sumReduceOperator = gatheredSet.groupBy(0).reduce(sumUdf);
// configure reduce sum function with name and broadcast variables
sumReduceOperator = sumReduceOperator.name("Sum");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getSumBcastVars()) {
sumReduceOperator = sumReduceOperator.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
sumReduceOperator = sumReduceOperator.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
DataSet<Tuple2<K, M>> summedSet = sumReduceOperator;
JoinOperator<?, ?, Vertex<K, VV>> appliedSet = summedSet
.join(iteration.getSolutionSet())
.where(0)
.equalTo(0)
.with(applyUdf);
// configure join apply function with name and broadcast variables
appliedSet = appliedSet.name("Apply");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getApplyBcastVars()) {
appliedSet = appliedSet.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
appliedSet = appliedSet.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
// let the operator know that we preserve the key field
appliedSet.withForwardedFieldsFirst("0").withForwardedFieldsSecond("0");
return iteration.closeWith(appliedSet, appliedSet);
} | java | @Override
public DataSet<Vertex<K, VV>> createResult() {
if (vertexDataSet == null) {
throw new IllegalStateException("The input data set has not been set.");
}
// Prepare type information
TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertexDataSet.getType()).getTypeAt(0);
TypeInformation<M> messageType = TypeExtractor.createTypeInfo(gather, GatherFunction.class, gather.getClass(), 2);
TypeInformation<Tuple2<K, M>> innerType = new TupleTypeInfo<>(keyType, messageType);
TypeInformation<Vertex<K, VV>> outputType = vertexDataSet.getType();
// check whether the numVertices option is set and, if so, compute the total number of vertices
// and set it within the gather, sum and apply functions
DataSet<LongValue> numberOfVertices = null;
if (this.configuration != null && this.configuration.isOptNumVertices()) {
try {
numberOfVertices = GraphUtils.count(this.vertexDataSet);
} catch (Exception e) {
e.printStackTrace();
}
}
// Prepare UDFs
GatherUdf<K, VV, EV, M> gatherUdf = new GatherUdf<>(gather, innerType);
SumUdf<K, VV, EV, M> sumUdf = new SumUdf<>(sum, innerType);
ApplyUdf<K, VV, EV, M> applyUdf = new ApplyUdf<>(apply, outputType);
final int[] zeroKeyPos = new int[] {0};
final DeltaIteration<Vertex<K, VV>, Vertex<K, VV>> iteration =
vertexDataSet.iterateDelta(vertexDataSet, maximumNumberOfIterations, zeroKeyPos);
// set up the iteration operator
if (this.configuration != null) {
iteration.name(this.configuration.getName(
"Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")"));
iteration.parallelism(this.configuration.getParallelism());
iteration.setSolutionSetUnManaged(this.configuration.isSolutionSetUnmanagedMemory());
// register all aggregators
for (Map.Entry<String, Aggregator<?>> entry : this.configuration.getAggregators().entrySet()) {
iteration.registerAggregator(entry.getKey(), entry.getValue());
}
}
else {
// no configuration provided; set default name
iteration.name("Gather-sum-apply iteration (" + gather + " | " + sum + " | " + apply + ")");
}
// Prepare the neighbors
if (this.configuration != null) {
direction = this.configuration.getDirection();
}
DataSet<Tuple2<K, Neighbor<VV, EV>>> neighbors;
switch(direction) {
case OUT:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
break;
case IN:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>());
break;
case ALL:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>()).union(iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(1).with(new ProjectKeyWithNeighborIN<>()));
break;
default:
neighbors = iteration
.getWorkset().join(edgeDataSet)
.where(0).equalTo(0).with(new ProjectKeyWithNeighborOUT<>());
break;
}
// Gather, sum and apply
MapOperator<Tuple2<K, Neighbor<VV, EV>>, Tuple2<K, M>> gatherMapOperator = neighbors.map(gatherUdf);
// configure map gather function with name and broadcast variables
gatherMapOperator = gatherMapOperator.name("Gather");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getGatherBcastVars()) {
gatherMapOperator = gatherMapOperator.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
gatherMapOperator = gatherMapOperator.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
DataSet<Tuple2<K, M>> gatheredSet = gatherMapOperator;
ReduceOperator<Tuple2<K, M>> sumReduceOperator = gatheredSet.groupBy(0).reduce(sumUdf);
// configure reduce sum function with name and broadcast variables
sumReduceOperator = sumReduceOperator.name("Sum");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getSumBcastVars()) {
sumReduceOperator = sumReduceOperator.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
sumReduceOperator = sumReduceOperator.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
DataSet<Tuple2<K, M>> summedSet = sumReduceOperator;
JoinOperator<?, ?, Vertex<K, VV>> appliedSet = summedSet
.join(iteration.getSolutionSet())
.where(0)
.equalTo(0)
.with(applyUdf);
// configure join apply function with name and broadcast variables
appliedSet = appliedSet.name("Apply");
if (this.configuration != null) {
for (Tuple2<String, DataSet<?>> e : this.configuration.getApplyBcastVars()) {
appliedSet = appliedSet.withBroadcastSet(e.f1, e.f0);
}
if (this.configuration.isOptNumVertices()) {
appliedSet = appliedSet.withBroadcastSet(numberOfVertices, "number of vertices");
}
}
// let the operator know that we preserve the key field
appliedSet.withForwardedFieldsFirst("0").withForwardedFieldsSecond("0");
return iteration.closeWith(appliedSet, appliedSet);
} | [
"@",
"Override",
"public",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"createResult",
"(",
")",
"{",
"if",
"(",
"vertexDataSet",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The input data set has not been set.\"",
")"... | Computes the results of the gather-sum-apply iteration.
@return The resulting DataSet | [
"Computes",
"the",
"results",
"of",
"the",
"gather",
"-",
"sum",
"-",
"apply",
"iteration",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java#L112-L246 | train | Create the result DataSet. | [
30522,
1030,
2058,
15637,
2270,
2951,
13462,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
3443,
6072,
11314,
1006,
1007,
1063,
2065,
1006,
19449,
2850,
18260,
2102,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
259... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java | GlobalChannelTrafficShapingHandler.createGlobalTrafficCounter | void createGlobalTrafficCounter(ScheduledExecutorService executor) {
// Default
setMaxDeviation(DEFAULT_DEVIATION, DEFAULT_SLOWDOWN, DEFAULT_ACCELERATION);
if (executor == null) {
throw new IllegalArgumentException("Executor must not be null");
}
TrafficCounter tc = new GlobalChannelTrafficCounter(this, executor, "GlobalChannelTC", checkInterval);
setTrafficCounter(tc);
tc.start();
} | java | void createGlobalTrafficCounter(ScheduledExecutorService executor) {
// Default
setMaxDeviation(DEFAULT_DEVIATION, DEFAULT_SLOWDOWN, DEFAULT_ACCELERATION);
if (executor == null) {
throw new IllegalArgumentException("Executor must not be null");
}
TrafficCounter tc = new GlobalChannelTrafficCounter(this, executor, "GlobalChannelTC", checkInterval);
setTrafficCounter(tc);
tc.start();
} | [
"void",
"createGlobalTrafficCounter",
"(",
"ScheduledExecutorService",
"executor",
")",
"{",
"// Default",
"setMaxDeviation",
"(",
"DEFAULT_DEVIATION",
",",
"DEFAULT_SLOWDOWN",
",",
"DEFAULT_ACCELERATION",
")",
";",
"if",
"(",
"executor",
"==",
"null",
")",
"{",
"thro... | Create the global TrafficCounter | [
"Create",
"the",
"global",
"TrafficCounter"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java#L147-L156 | train | Create a TrafficCounter object and start it. | [
30522,
11675,
3443,
23296,
16429,
2389,
6494,
26989,
21408,
16671,
2121,
1006,
5115,
10288,
8586,
16161,
22573,
2099,
7903,
2063,
4654,
8586,
16161,
2099,
1007,
1063,
1013,
1013,
12398,
2275,
17848,
24844,
18963,
1006,
12398,
1035,
24353,
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/io/watch/WatchMonitor.java | WatchMonitor.createAll | public static WatchMonitor createAll(Path path, Watcher watcher){
final WatchMonitor watchMonitor = create(path, EVENTS_ALL);
watchMonitor.setWatcher(watcher);
return watchMonitor;
} | java | public static WatchMonitor createAll(Path path, Watcher watcher){
final WatchMonitor watchMonitor = create(path, EVENTS_ALL);
watchMonitor.setWatcher(watcher);
return watchMonitor;
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"Path",
"path",
",",
"Watcher",
"watcher",
")",
"{",
"final",
"WatchMonitor",
"watchMonitor",
"=",
"create",
"(",
"path",
",",
"EVENTS_ALL",
")",
";",
"watchMonitor",
".",
"setWatcher",
"(",
"watcher",
")",... | 创建并初始化监听,监听所有事件
@param path 路径
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L238-L242 | train | Creates a new WatchMonitor and sets the given Watcher. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
8095,
1006,
4130,
4130,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
2345,
3422,
8202,
15660,
3422,
8202,
15660,
1027,
3443,
1006,
4130,
30524,
15660,
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,
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/typeutils/TypeSerializerUtils.java | TypeSerializerUtils.snapshotBackwardsCompatible | public static <T> TypeSerializerSnapshot<T> snapshotBackwardsCompatible(TypeSerializer<T> originatingSerializer) {
return configureForBackwardsCompatibility(originatingSerializer.snapshotConfiguration(), originatingSerializer);
} | java | public static <T> TypeSerializerSnapshot<T> snapshotBackwardsCompatible(TypeSerializer<T> originatingSerializer) {
return configureForBackwardsCompatibility(originatingSerializer.snapshotConfiguration(), originatingSerializer);
} | [
"public",
"static",
"<",
"T",
">",
"TypeSerializerSnapshot",
"<",
"T",
">",
"snapshotBackwardsCompatible",
"(",
"TypeSerializer",
"<",
"T",
">",
"originatingSerializer",
")",
"{",
"return",
"configureForBackwardsCompatibility",
"(",
"originatingSerializer",
".",
"snapsh... | Takes a snapshot of the given serializer. In case where the snapshot
is still extending the old {@code TypeSerializerConfigSnapshot} class, the snapshot
is set up properly (with its originating serializer) such that the backwards
compatible code paths work. | [
"Takes",
"a",
"snapshot",
"of",
"the",
"given",
"serializer",
".",
"In",
"case",
"where",
"the",
"snapshot",
"is",
"still",
"extending",
"the",
"old",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerUtils.java#L48-L50 | train | Creates a snapshot of the given serializer that is backwards compatible with the given serializer. | [
30522,
2270,
10763,
1026,
1056,
1028,
4127,
11610,
28863,
2015,
2532,
4523,
12326,
1026,
1056,
1028,
20057,
12326,
5963,
7652,
9363,
8737,
10450,
3468,
1006,
4127,
11610,
28863,
1026,
1056,
1028,
14802,
8043,
4818,
17629,
1007,
1063,
2709,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/RetryingBlockFetcher.java | RetryingBlockFetcher.initiateRetry | private synchronized void initiateRetry() {
retryCount += 1;
currentListener = new RetryingBlockFetchListener();
logger.info("Retrying fetch ({}/{}) for {} outstanding blocks after {} ms",
retryCount, maxRetries, outstandingBlocksIds.size(), retryWaitTime);
executorService.submit(() -> {
Uninterruptibles.sleepUninterruptibly(retryWaitTime, TimeUnit.MILLISECONDS);
fetchAllOutstanding();
});
} | java | private synchronized void initiateRetry() {
retryCount += 1;
currentListener = new RetryingBlockFetchListener();
logger.info("Retrying fetch ({}/{}) for {} outstanding blocks after {} ms",
retryCount, maxRetries, outstandingBlocksIds.size(), retryWaitTime);
executorService.submit(() -> {
Uninterruptibles.sleepUninterruptibly(retryWaitTime, TimeUnit.MILLISECONDS);
fetchAllOutstanding();
});
} | [
"private",
"synchronized",
"void",
"initiateRetry",
"(",
")",
"{",
"retryCount",
"+=",
"1",
";",
"currentListener",
"=",
"new",
"RetryingBlockFetchListener",
"(",
")",
";",
"logger",
".",
"info",
"(",
"\"Retrying fetch ({}/{}) for {} outstanding blocks after {} ms\"",
"... | Lightweight method which initiates a retry in a different thread. The retry will involve
calling fetchAllOutstanding() after a configured wait time. | [
"Lightweight",
"method",
"which",
"initiates",
"a",
"retry",
"in",
"a",
"different",
"thread",
".",
"The",
"retry",
"will",
"involve",
"calling",
"fetchAllOutstanding",
"()",
"after",
"a",
"configured",
"wait",
"time",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RetryingBlockFetcher.java#L160-L171 | train | Initiate retry. | [
30522,
2797,
25549,
11675,
17820,
13465,
2854,
1006,
1007,
1063,
2128,
11129,
3597,
16671,
1009,
1027,
1015,
1025,
2783,
9863,
24454,
1027,
2047,
2128,
11129,
2075,
23467,
7959,
10649,
9863,
24454,
1006,
1007,
1025,
8833,
4590,
1012,
18558,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-api-java/src/main/java/org/apache/flink/table/factories/TableFactoryUtil.java | TableFactoryUtil.findAndCreateExternalCatalog | public static ExternalCatalog findAndCreateExternalCatalog(Descriptor descriptor) {
Map<String, String> properties = descriptor.toProperties();
return TableFactoryService
.find(ExternalCatalogFactory.class, properties)
.createExternalCatalog(properties);
} | java | public static ExternalCatalog findAndCreateExternalCatalog(Descriptor descriptor) {
Map<String, String> properties = descriptor.toProperties();
return TableFactoryService
.find(ExternalCatalogFactory.class, properties)
.createExternalCatalog(properties);
} | [
"public",
"static",
"ExternalCatalog",
"findAndCreateExternalCatalog",
"(",
"Descriptor",
"descriptor",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"descriptor",
".",
"toProperties",
"(",
")",
";",
"return",
"TableFactoryService",
".",
"... | Returns an external catalog. | [
"Returns",
"an",
"external",
"catalog",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/factories/TableFactoryUtil.java#L37-L42 | train | Find and create an external catalog. | [
30522,
2270,
10763,
6327,
11266,
23067,
2290,
2424,
5685,
16748,
3686,
10288,
16451,
2389,
11266,
23067,
2290,
1006,
4078,
23235,
2953,
4078,
23235,
2953,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
5144,
1027,
4078,
23235,
2953,
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/taskmanager/NetworkEnvironmentConfiguration.java | NetworkEnvironmentConfiguration.fromConfiguration | public static NetworkEnvironmentConfiguration fromConfiguration(
Configuration configuration,
long maxJvmHeapMemory,
boolean localTaskManagerCommunication,
InetAddress taskManagerAddress) {
final int dataport = getDataport(configuration);
final int pageSize = getPageSize(configuration);
final int numberOfNetworkBuffers = calculateNumberOfNetworkBuffers(configuration, maxJvmHeapMemory);
final NettyConfig nettyConfig = createNettyConfig(configuration, localTaskManagerCommunication, taskManagerAddress, dataport);
int initialRequestBackoff = configuration.getInteger(TaskManagerOptions.NETWORK_REQUEST_BACKOFF_INITIAL);
int maxRequestBackoff = configuration.getInteger(TaskManagerOptions.NETWORK_REQUEST_BACKOFF_MAX);
int buffersPerChannel = configuration.getInteger(TaskManagerOptions.NETWORK_BUFFERS_PER_CHANNEL);
int extraBuffersPerGate = configuration.getInteger(TaskManagerOptions.NETWORK_EXTRA_BUFFERS_PER_GATE);
boolean isCreditBased = nettyConfig != null && configuration.getBoolean(TaskManagerOptions.NETWORK_CREDIT_MODEL);
return new NetworkEnvironmentConfiguration(
numberOfNetworkBuffers,
pageSize,
initialRequestBackoff,
maxRequestBackoff,
buffersPerChannel,
extraBuffersPerGate,
isCreditBased,
nettyConfig);
} | java | public static NetworkEnvironmentConfiguration fromConfiguration(
Configuration configuration,
long maxJvmHeapMemory,
boolean localTaskManagerCommunication,
InetAddress taskManagerAddress) {
final int dataport = getDataport(configuration);
final int pageSize = getPageSize(configuration);
final int numberOfNetworkBuffers = calculateNumberOfNetworkBuffers(configuration, maxJvmHeapMemory);
final NettyConfig nettyConfig = createNettyConfig(configuration, localTaskManagerCommunication, taskManagerAddress, dataport);
int initialRequestBackoff = configuration.getInteger(TaskManagerOptions.NETWORK_REQUEST_BACKOFF_INITIAL);
int maxRequestBackoff = configuration.getInteger(TaskManagerOptions.NETWORK_REQUEST_BACKOFF_MAX);
int buffersPerChannel = configuration.getInteger(TaskManagerOptions.NETWORK_BUFFERS_PER_CHANNEL);
int extraBuffersPerGate = configuration.getInteger(TaskManagerOptions.NETWORK_EXTRA_BUFFERS_PER_GATE);
boolean isCreditBased = nettyConfig != null && configuration.getBoolean(TaskManagerOptions.NETWORK_CREDIT_MODEL);
return new NetworkEnvironmentConfiguration(
numberOfNetworkBuffers,
pageSize,
initialRequestBackoff,
maxRequestBackoff,
buffersPerChannel,
extraBuffersPerGate,
isCreditBased,
nettyConfig);
} | [
"public",
"static",
"NetworkEnvironmentConfiguration",
"fromConfiguration",
"(",
"Configuration",
"configuration",
",",
"long",
"maxJvmHeapMemory",
",",
"boolean",
"localTaskManagerCommunication",
",",
"InetAddress",
"taskManagerAddress",
")",
"{",
"final",
"int",
"dataport",... | Utility method to extract network related parameters from the configuration and to
sanity check them.
@param configuration configuration object
@param maxJvmHeapMemory the maximum JVM heap size (in bytes)
@param localTaskManagerCommunication true, to skip initializing the network stack
@param taskManagerAddress identifying the IP address under which the TaskManager will be accessible
@return NetworkEnvironmentConfiguration | [
"Utility",
"method",
"to",
"extract",
"network",
"related",
"parameters",
"from",
"the",
"configuration",
"and",
"to",
"sanity",
"check",
"them",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L131-L162 | train | Creates a new NetworkEnvironmentConfiguration from the given configuration. | [
30522,
2270,
10763,
2897,
2368,
21663,
2239,
3672,
8663,
8873,
27390,
3370,
2013,
8663,
8873,
27390,
3370,
1006,
9563,
9563,
1010,
2146,
4098,
3501,
2615,
2213,
20192,
9737,
6633,
10253,
1010,
22017,
20898,
2334,
10230,
22287,
5162,
4590,
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... |
networknt/light-4j | security/src/main/java/com/networknt/security/JwtHelper.java | JwtHelper.getJwtFromAuthorization | public static String getJwtFromAuthorization(String authorization) {
String jwt = null;
if(authorization != null) {
String[] parts = authorization.split(" ");
if (parts.length == 2) {
String scheme = parts[0];
String credentials = parts[1];
Pattern pattern = Pattern.compile("^Bearer$", Pattern.CASE_INSENSITIVE);
if (pattern.matcher(scheme).matches()) {
jwt = credentials;
}
}
}
return jwt;
} | java | public static String getJwtFromAuthorization(String authorization) {
String jwt = null;
if(authorization != null) {
String[] parts = authorization.split(" ");
if (parts.length == 2) {
String scheme = parts[0];
String credentials = parts[1];
Pattern pattern = Pattern.compile("^Bearer$", Pattern.CASE_INSENSITIVE);
if (pattern.matcher(scheme).matches()) {
jwt = credentials;
}
}
}
return jwt;
} | [
"public",
"static",
"String",
"getJwtFromAuthorization",
"(",
"String",
"authorization",
")",
"{",
"String",
"jwt",
"=",
"null",
";",
"if",
"(",
"authorization",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"authorization",
".",
"split",
"(",
... | Parse the jwt token from Authorization header.
@param authorization authorization header.
@return JWT token | [
"Parse",
"the",
"jwt",
"token",
"from",
"Authorization",
"header",
"."
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/security/src/main/java/com/networknt/security/JwtHelper.java#L145-L159 | train | Get the JWT from the Authorization header. | [
30522,
2270,
10763,
5164,
2131,
3501,
26677,
19699,
9626,
14317,
10050,
9276,
1006,
5164,
20104,
1007,
1063,
5164,
1046,
26677,
1027,
19701,
1025,
2065,
1006,
20104,
999,
1027,
19701,
1007,
1063,
5164,
1031,
1033,
3033,
1027,
20104,
1012,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java | BeanTypeRegistry.getNamesForType | public Set<String> getNamesForType(Class<?> type, TypeExtractor typeExtractor) {
updateTypesIfNecessary();
return this.beanTypes.entrySet().stream().filter((entry) -> {
Class<?> beanType = extractType(entry.getValue(), typeExtractor);
return beanType != null && type.isAssignableFrom(beanType);
} | java | public Set<String> getNamesForType(Class<?> type, TypeExtractor typeExtractor) {
updateTypesIfNecessary();
return this.beanTypes.entrySet().stream().filter((entry) -> {
Class<?> beanType = extractType(entry.getValue(), typeExtractor);
return beanType != null && type.isAssignableFrom(beanType);
} | [
"public",
"Set",
"<",
"String",
">",
"getNamesForType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"TypeExtractor",
"typeExtractor",
")",
"{",
"updateTypesIfNecessary",
"(",
")",
";",
"return",
"this",
".",
"beanTypes",
".",
"entrySet",
"(",
")",
".",
"stre... | Return the names of beans matching the given type (including subclasses), judging
from either bean definitions or the value of {@link FactoryBean#getObjectType()} in
the case of {@link FactoryBean FactoryBeans}. Will include singletons but will not
cause early bean initialization.
@param type the class or interface to match (must not be {@code null})
@param typeExtractor function used to extract the actual type
@return the names of beans (or objects created by FactoryBeans) matching the given
object type (including subclasses), or an empty set if none | [
"Return",
"the",
"names",
"of",
"beans",
"matching",
"the",
"given",
"type",
"(",
"including",
"subclasses",
")",
"judging",
"from",
"either",
"bean",
"definitions",
"or",
"the",
"value",
"of",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/BeanTypeRegistry.java#L96-L101 | train | Returns the names of the bean types that are assignable to the given type. | [
30522,
2270,
2275,
1026,
5164,
1028,
2131,
18442,
22747,
11589,
18863,
1006,
2465,
1026,
1029,
1028,
2828,
1010,
2828,
10288,
6494,
16761,
2828,
10288,
6494,
16761,
1007,
1063,
10651,
13874,
5332,
2546,
2638,
9623,
10286,
2100,
1006,
1007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java | DefaultProxyHtmlRenderer.tabConfig | private String tabConfig() {
StringBuilder builder = new StringBuilder();
builder.append("<div type='config' class='content_detail'>");
builder.append(proxy.getConfig().toString("<p>%1$s: %2$s</p>"));
builder.append("</div>");
return builder.toString();
} | java | private String tabConfig() {
StringBuilder builder = new StringBuilder();
builder.append("<div type='config' class='content_detail'>");
builder.append(proxy.getConfig().toString("<p>%1$s: %2$s</p>"));
builder.append("</div>");
return builder.toString();
} | [
"private",
"String",
"tabConfig",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<div type='config' class='content_detail'>\"",
")",
";",
"builder",
".",
"append",
"(",
"proxy",
".",
"getC... | content of the config tab. | [
"content",
"of",
"the",
"config",
"tab",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/web/servlet/console/DefaultProxyHtmlRenderer.java#L88-L94 | train | tab config | [
30522,
2797,
5164,
21628,
8663,
8873,
2290,
1006,
1007,
1063,
5164,
8569,
23891,
2099,
12508,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
12508,
1012,
10439,
10497,
1006,
1000,
1026,
4487,
2615,
2828,
1027,
1005,
9530,
8873,
2290... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.popPart | public static <T> List<T> popPart(Stack<T> surplusAlaDatas, int partSize) {
if (isEmpty(surplusAlaDatas)) {
return null;
}
final List<T> currentAlaDatas = new ArrayList<>();
int size = surplusAlaDatas.size();
// 切割
if (size > partSize) {
for (int i = 0; i < partSize; i++) {
currentAlaDatas.add(surplusAlaDatas.pop());
}
} else {
for (int i = 0; i < size; i++) {
currentAlaDatas.add(surplusAlaDatas.pop());
}
}
return currentAlaDatas;
} | java | public static <T> List<T> popPart(Stack<T> surplusAlaDatas, int partSize) {
if (isEmpty(surplusAlaDatas)) {
return null;
}
final List<T> currentAlaDatas = new ArrayList<>();
int size = surplusAlaDatas.size();
// 切割
if (size > partSize) {
for (int i = 0; i < partSize; i++) {
currentAlaDatas.add(surplusAlaDatas.pop());
}
} else {
for (int i = 0; i < size; i++) {
currentAlaDatas.add(surplusAlaDatas.pop());
}
}
return currentAlaDatas;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"popPart",
"(",
"Stack",
"<",
"T",
">",
"surplusAlaDatas",
",",
"int",
"partSize",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"surplusAlaDatas",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
... | 切取部分数据<br>
切取后的栈将减少这些元素
@param <T> 集合元素类型
@param surplusAlaDatas 原数据
@param partSize 每部分数据的长度
@return 切取出的数据或null | [
"切取部分数据<br",
">",
"切取后的栈将减少这些元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L303-L321 | train | Pop a part of the data from the stack. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
1056,
1028,
3769,
19362,
2102,
1006,
9991,
1026,
1056,
1028,
15726,
7911,
2850,
10230,
1010,
20014,
3033,
4697,
1007,
1063,
2065,
1006,
2003,
6633,
13876,
2100,
1006,
15726,
7911,
2850,
1023... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/IterUtil.java | IterUtil.getFirst | public static <T> T getFirst(Iterator<T> iterator) {
if (null != iterator && iterator.hasNext()) {
return iterator.next();
}
return null;
} | java | public static <T> T getFirst(Iterator<T> iterator) {
if (null != iterator && iterator.hasNext()) {
return iterator.next();
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getFirst",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
")",
"{",
"if",
"(",
"null",
"!=",
"iterator",
"&&",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"iterator",
".",
"next",
"(",
")",
";",
... | 获取集合的第一个元素
@param <T> 集合元素类型
@param iterator {@link Iterator}
@return 第一个元素 | [
"获取集合的第一个元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L511-L516 | train | Gets the first element of the iterator. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
2131,
8873,
12096,
1006,
2009,
6906,
4263,
1026,
1056,
1028,
2009,
6906,
4263,
1007,
1063,
2065,
1006,
19701,
999,
1027,
2009,
6906,
4263,
1004,
1004,
2009,
6906,
4263,
1012,
8440,
10288,
2102,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/FastDateParser.java | FastDateParser.getLocaleSpecificStrategy | private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
final ConcurrentMap<Locale, Strategy> cache = getCache(field);
Strategy strategy = cache.get(locale);
if (strategy == null) {
strategy = field == Calendar.ZONE_OFFSET ? new TimeZoneStrategy(locale) : new CaseInsensitiveTextStrategy(field, definingCalendar, locale);
final Strategy inCache = cache.putIfAbsent(locale, strategy);
if (inCache != null) {
return inCache;
}
}
return strategy;
} | java | private Strategy getLocaleSpecificStrategy(final int field, final Calendar definingCalendar) {
final ConcurrentMap<Locale, Strategy> cache = getCache(field);
Strategy strategy = cache.get(locale);
if (strategy == null) {
strategy = field == Calendar.ZONE_OFFSET ? new TimeZoneStrategy(locale) : new CaseInsensitiveTextStrategy(field, definingCalendar, locale);
final Strategy inCache = cache.putIfAbsent(locale, strategy);
if (inCache != null) {
return inCache;
}
}
return strategy;
} | [
"private",
"Strategy",
"getLocaleSpecificStrategy",
"(",
"final",
"int",
"field",
",",
"final",
"Calendar",
"definingCalendar",
")",
"{",
"final",
"ConcurrentMap",
"<",
"Locale",
",",
"Strategy",
">",
"cache",
"=",
"getCache",
"(",
"field",
")",
";",
"Strategy",... | Construct a Strategy that parses a Text field
@param field The Calendar field
@param definingCalendar The calendar to obtain the short and long values
@return a TextStrategy for the field and Locale | [
"Construct",
"a",
"Strategy",
"that",
"parses",
"a",
"Text",
"field"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateParser.java#L474-L485 | train | Gets the strategy for the given field. | [
30522,
2797,
5656,
2131,
4135,
9289,
2229,
5051,
6895,
8873,
6169,
6494,
2618,
6292,
1006,
2345,
20014,
2492,
1010,
2345,
8094,
12854,
9289,
10497,
2906,
1007,
1063,
2345,
16483,
2863,
2361,
1026,
2334,
2063,
1010,
5656,
1028,
17053,
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... |
apache/flink | flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java | YarnResourceManager.parseHostPort | private static Tuple2<String, Integer> parseHostPort(String address) {
String[] hostPort = address.split("@")[1].split(":");
String host = hostPort[0];
String port = hostPort[1].split("/")[0];
return new Tuple2<>(host, Integer.valueOf(port));
} | java | private static Tuple2<String, Integer> parseHostPort(String address) {
String[] hostPort = address.split("@")[1].split(":");
String host = hostPort[0];
String port = hostPort[1].split("/")[0];
return new Tuple2<>(host, Integer.valueOf(port));
} | [
"private",
"static",
"Tuple2",
"<",
"String",
",",
"Integer",
">",
"parseHostPort",
"(",
"String",
"address",
")",
"{",
"String",
"[",
"]",
"hostPort",
"=",
"address",
".",
"split",
"(",
"\"@\"",
")",
"[",
"1",
"]",
".",
"split",
"(",
"\":\"",
")",
"... | the akka address is like akka.tcp://flink@100.81.153.180:49712/user/$a | [
"the",
"akka",
"address",
"is",
"like",
"akka",
".",
"tcp",
":",
"//",
"flink"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java#L494-L499 | train | Parse the host and port from the given address. | [
30522,
2797,
10763,
10722,
10814,
2475,
1026,
5164,
1010,
16109,
1028,
11968,
3366,
15006,
25856,
11589,
1006,
5164,
4769,
1007,
1063,
5164,
1031,
1033,
3677,
6442,
1027,
4769,
1012,
3975,
1006,
1000,
1030,
1000,
1007,
1031,
1015,
1033,
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/img/Img.java | Img.calcRotatedSize | private static Rectangle calcRotatedSize(int width, int height, int degree) {
if (degree >= 90) {
if (degree / 90 % 2 == 1) {
int temp = height;
height = width;
width = temp;
}
degree = degree % 90;
}
double r = Math.sqrt(height * height + width * width) / 2;
double len = 2 * Math.sin(Math.toRadians(degree) / 2) * r;
double angel_alpha = (Math.PI - Math.toRadians(degree)) / 2;
double angel_dalta_width = Math.atan((double) height / width);
double angel_dalta_height = Math.atan((double) width / height);
int len_dalta_width = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_width));
int len_dalta_height = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_height));
int des_width = width + len_dalta_width * 2;
int des_height = height + len_dalta_height * 2;
return new Rectangle(des_width, des_height);
} | java | private static Rectangle calcRotatedSize(int width, int height, int degree) {
if (degree >= 90) {
if (degree / 90 % 2 == 1) {
int temp = height;
height = width;
width = temp;
}
degree = degree % 90;
}
double r = Math.sqrt(height * height + width * width) / 2;
double len = 2 * Math.sin(Math.toRadians(degree) / 2) * r;
double angel_alpha = (Math.PI - Math.toRadians(degree)) / 2;
double angel_dalta_width = Math.atan((double) height / width);
double angel_dalta_height = Math.atan((double) width / height);
int len_dalta_width = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_width));
int len_dalta_height = (int) (len * Math.cos(Math.PI - angel_alpha - angel_dalta_height));
int des_width = width + len_dalta_width * 2;
int des_height = height + len_dalta_height * 2;
return new Rectangle(des_width, des_height);
} | [
"private",
"static",
"Rectangle",
"calcRotatedSize",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"degree",
")",
"{",
"if",
"(",
"degree",
">=",
"90",
")",
"{",
"if",
"(",
"degree",
"/",
"90",
"%",
"2",
"==",
"1",
")",
"{",
"int",
"temp",... | 计算旋转后的图片尺寸
@param width 宽度
@param height 高度
@param degree 旋转角度
@return 计算后目标尺寸
@since 4.1.20 | [
"计算旋转后的图片尺寸"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L636-L656 | train | Calculates the rotated size of the image based on the degree. | [
30522,
2797,
10763,
28667,
23395,
10250,
26775,
17287,
3064,
5332,
4371,
1006,
20014,
9381,
1010,
20014,
4578,
1010,
20014,
3014,
1007,
1063,
2065,
1006,
3014,
1028,
1027,
3938,
1007,
1063,
2065,
1006,
3014,
1013,
3938,
1003,
1016,
1027,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.of | public static <T> Bindable<T> of(Class<T> type) {
Assert.notNull(type, "Type must not be null");
return of(ResolvableType.forClass(type));
} | java | public static <T> Bindable<T> of(Class<T> type) {
Assert.notNull(type, "Type must not be null");
return of(ResolvableType.forClass(type));
} | [
"public",
"static",
"<",
"T",
">",
"Bindable",
"<",
"T",
">",
"of",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Assert",
".",
"notNull",
"(",
"type",
",",
"\"Type must not be null\"",
")",
";",
"return",
"of",
"(",
"ResolvableType",
".",
"forClass"... | Create a new {@link Bindable} of the specified type.
@param <T> the source type
@param type the type (must not be {@code null})
@return a {@link Bindable} instance
@see #of(ResolvableType) | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L202-L205 | train | Create a Bindable instance for the given type. | [
30522,
2270,
10763,
1026,
1056,
1028,
14187,
3085,
1026,
1056,
1028,
1997,
1006,
2465,
1026,
1056,
1028,
2828,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
2828,
1010,
1000,
2828,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
2709,
1997,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/XmlUtil.java | XmlUtil.getElementByXPath | public static Element getElementByXPath(String expression, Object source) {
return (Element) getNodeByXPath(expression, source);
} | java | public static Element getElementByXPath(String expression, Object source) {
return (Element) getNodeByXPath(expression, source);
} | [
"public",
"static",
"Element",
"getElementByXPath",
"(",
"String",
"expression",
",",
"Object",
"source",
")",
"{",
"return",
"(",
"Element",
")",
"getNodeByXPath",
"(",
"expression",
",",
"source",
")",
";",
"}"
] | 通过XPath方式读取XML节点等信息<br>
Xpath相关文章:https://www.ibm.com/developerworks/cn/xml/x-javaxpathapi.html
@param expression XPath表达式
@param source 资源,可以是Docunent、Node节点等
@return 匹配返回类型的值
@since 4.0.9 | [
"通过XPath方式读取XML节点等信息<br",
">",
"Xpath相关文章:https",
":",
"//",
"www",
".",
"ibm",
".",
"com",
"/",
"developerworks",
"/",
"cn",
"/",
"xml",
"/",
"x",
"-",
"javaxpathapi",
".",
"html"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L572-L574 | train | Get the Element by XPath | [
30522,
2270,
10763,
5783,
2131,
12260,
3672,
3762,
2595,
15069,
1006,
5164,
3670,
1010,
4874,
3120,
1007,
1063,
2709,
1006,
5783,
1007,
2131,
3630,
3207,
3762,
2595,
15069,
1006,
3670,
1010,
3120,
1007,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/maxent/MaxEntModel.java | MaxEntModel.predict | public final List<Pair<String, Double>> predict(Collection<String> context)
{
return predict(context.toArray(new String[0]));
} | java | public final List<Pair<String, Double>> predict(Collection<String> context)
{
return predict(context.toArray(new String[0]));
} | [
"public",
"final",
"List",
"<",
"Pair",
"<",
"String",
",",
"Double",
">",
">",
"predict",
"(",
"Collection",
"<",
"String",
">",
"context",
")",
"{",
"return",
"predict",
"(",
"context",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",... | 预测分布
@param context
@return | [
"预测分布"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/maxent/MaxEntModel.java#L116-L119 | train | Predict a sequence of tokens in a collection of tokens. | [
30522,
2270,
2345,
2862,
1026,
3940,
1026,
5164,
1010,
3313,
1028,
1028,
16014,
1006,
3074,
1026,
5164,
1028,
6123,
1007,
1063,
2709,
16014,
1006,
6123,
1012,
2000,
2906,
9447,
1006,
2047,
5164,
1031,
1014,
1033,
1007,
1007,
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/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedAllReduceDriver.java | ChainedAllReduceDriver.collect | @Override
public void collect(IT record) {
numRecordsIn.inc();
try {
if (base == null) {
base = serializer.copy(record);
} else {
base = objectReuseEnabled ? reducer.reduce(base, record) : serializer.copy(reducer.reduce(base, record));
}
} catch (Exception e) {
throw new ExceptionInChainedStubException(taskName, e);
}
} | java | @Override
public void collect(IT record) {
numRecordsIn.inc();
try {
if (base == null) {
base = serializer.copy(record);
} else {
base = objectReuseEnabled ? reducer.reduce(base, record) : serializer.copy(reducer.reduce(base, record));
}
} catch (Exception e) {
throw new ExceptionInChainedStubException(taskName, e);
}
} | [
"@",
"Override",
"public",
"void",
"collect",
"(",
"IT",
"record",
")",
"{",
"numRecordsIn",
".",
"inc",
"(",
")",
";",
"try",
"{",
"if",
"(",
"base",
"==",
"null",
")",
"{",
"base",
"=",
"serializer",
".",
"copy",
"(",
"record",
")",
";",
"}",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/chaining/ChainedAllReduceDriver.java#L87-L99 | train | Collect a single record. | [
30522,
1030,
2058,
15637,
2270,
11675,
8145,
1006,
2009,
2501,
1007,
1063,
16371,
2213,
2890,
27108,
5104,
2378,
1012,
4297,
1006,
1007,
1025,
3046,
1063,
2065,
1006,
2918,
1027,
1027,
19701,
1007,
1063,
2918,
1027,
7642,
17629,
1012,
6100,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/asymmetric/SM2.java | SM2.setMode | public SM2 setMode(SM2Mode mode) {
this.mode = mode;
if (null != this.engine) {
this.engine.setMode(mode);
}
return this;
} | java | public SM2 setMode(SM2Mode mode) {
this.mode = mode;
if (null != this.engine) {
this.engine.setMode(mode);
}
return this;
} | [
"public",
"SM2",
"setMode",
"(",
"SM2Mode",
"mode",
")",
"{",
"this",
".",
"mode",
"=",
"mode",
";",
"if",
"(",
"null",
"!=",
"this",
".",
"engine",
")",
"{",
"this",
".",
"engine",
".",
"setMode",
"(",
"mode",
")",
";",
"}",
"return",
"this",
";... | 设置加密类型
@param mode {@link SM2Mode}
@return this | [
"设置加密类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L243-L249 | train | Sets the mode of the SM2 object. | [
30522,
2270,
15488,
2475,
2275,
5302,
3207,
1006,
15488,
2475,
5302,
3207,
5549,
1007,
1063,
2023,
1012,
5549,
1027,
5549,
1025,
2065,
1006,
19701,
999,
1027,
2023,
1012,
3194,
1007,
1063,
2023,
1012,
3194,
1012,
2275,
5302,
3207,
1006,
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... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/JoinTypeUtil.java | JoinTypeUtil.toJoinRelType | public static JoinRelType toJoinRelType(FlinkJoinType joinType) {
switch (joinType) {
case INNER:
return JoinRelType.INNER;
case LEFT:
return JoinRelType.LEFT;
case RIGHT:
return JoinRelType.RIGHT;
case FULL:
return JoinRelType.FULL;
default:
throw new IllegalArgumentException("invalid: " + joinType);
}
} | java | public static JoinRelType toJoinRelType(FlinkJoinType joinType) {
switch (joinType) {
case INNER:
return JoinRelType.INNER;
case LEFT:
return JoinRelType.LEFT;
case RIGHT:
return JoinRelType.RIGHT;
case FULL:
return JoinRelType.FULL;
default:
throw new IllegalArgumentException("invalid: " + joinType);
}
} | [
"public",
"static",
"JoinRelType",
"toJoinRelType",
"(",
"FlinkJoinType",
"joinType",
")",
"{",
"switch",
"(",
"joinType",
")",
"{",
"case",
"INNER",
":",
"return",
"JoinRelType",
".",
"INNER",
";",
"case",
"LEFT",
":",
"return",
"JoinRelType",
".",
"LEFT",
... | Converts {@link FlinkJoinType} to {@link JoinRelType}. | [
"Converts",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/JoinTypeUtil.java#L65-L78 | train | Converts a FlinkJoinType to a JoinRelType. | [
30522,
2270,
10763,
3693,
16570,
13874,
2000,
5558,
2378,
16570,
13874,
1006,
13109,
19839,
5558,
18447,
18863,
4101,
18863,
1007,
1063,
6942,
1006,
4101,
18863,
1007,
1063,
2553,
5110,
1024,
2709,
3693,
16570,
13874,
1012,
5110,
1025,
2553,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java | CommandExecutorSelector.getExecutor | public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) {
return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType)
? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService();
} | java | public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) {
return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType)
? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService();
} | [
"public",
"static",
"ExecutorService",
"getExecutor",
"(",
"final",
"boolean",
"isOccupyThreadForPerConnection",
",",
"final",
"TransactionType",
"transactionType",
",",
"final",
"ChannelId",
"channelId",
")",
"{",
"return",
"(",
"isOccupyThreadForPerConnection",
"||",
"T... | Get executor service.
@param isOccupyThreadForPerConnection is occupy thread for per connection or not
@param transactionType transaction type
@param channelId channel ID
@return executor service | [
"Get",
"executor",
"service",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java#L43-L46 | train | Gets the executor. | [
30522,
2270,
10763,
4654,
8586,
16161,
22573,
2099,
7903,
2063,
2131,
10288,
8586,
16161,
2099,
1006,
2345,
22017,
20898,
11163,
9468,
6279,
22123,
28362,
4215,
29278,
4842,
8663,
2638,
7542,
1010,
2345,
12598,
13874,
12598,
13874,
1010,
2345... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/operators/SingleInputOperator.java | SingleInputOperator.setInput | @Deprecated
public void setInput(Operator<IN>... input) {
this.input = Operator.createUnionCascade(null, input);
} | java | @Deprecated
public void setInput(Operator<IN>... input) {
this.input = Operator.createUnionCascade(null, input);
} | [
"@",
"Deprecated",
"public",
"void",
"setInput",
"(",
"Operator",
"<",
"IN",
">",
"...",
"input",
")",
"{",
"this",
".",
"input",
"=",
"Operator",
".",
"createUnionCascade",
"(",
"null",
",",
"input",
")",
";",
"}"
] | Sets the input to the union of the given operators.
@param input The operator(s) that form the input.
@deprecated This method will be removed in future versions. Use the {@link Union} operator instead. | [
"Sets",
"the",
"input",
"to",
"the",
"union",
"of",
"the",
"given",
"operators",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputOperator.java#L118-L121 | train | Sets the input operator. | [
30522,
1030,
2139,
28139,
12921,
2270,
11675,
2275,
2378,
18780,
1006,
6872,
1026,
1999,
1028,
1012,
1012,
1012,
7953,
1007,
1063,
2023,
1012,
7953,
1027,
6872,
1012,
3443,
19496,
2239,
15671,
21869,
1006,
19701,
1010,
7953,
1007,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java | AWSUtil.setAwsClientConfigProperties | public static void setAwsClientConfigProperties(ClientConfiguration config,
Properties configProps) {
Map<String, Object> awsConfigProperties = new HashMap<>();
for (Map.Entry<Object, Object> entry : configProps.entrySet()) {
String key = (String) entry.getKey();
if (key.startsWith(AWS_CLIENT_CONFIG_PREFIX)) {
awsConfigProperties.put(key.substring(AWS_CLIENT_CONFIG_PREFIX.length()), entry.getValue());
}
}
// Jackson does not like the following properties
String[] ignorableProperties = {"secureRandom"};
BeanDeserializerModifier modifier = new BeanDeserializerModifierForIgnorables(
ClientConfiguration.class, ignorableProperties);
DeserializerFactory factory = BeanDeserializerFactory.instance.withDeserializerModifier(
modifier);
ObjectMapper mapper = new ObjectMapper(null, null,
new DefaultDeserializationContext.Impl(factory));
JsonNode propTree = mapper.convertValue(awsConfigProperties, JsonNode.class);
try {
mapper.readerForUpdating(config).readValue(propTree);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | java | public static void setAwsClientConfigProperties(ClientConfiguration config,
Properties configProps) {
Map<String, Object> awsConfigProperties = new HashMap<>();
for (Map.Entry<Object, Object> entry : configProps.entrySet()) {
String key = (String) entry.getKey();
if (key.startsWith(AWS_CLIENT_CONFIG_PREFIX)) {
awsConfigProperties.put(key.substring(AWS_CLIENT_CONFIG_PREFIX.length()), entry.getValue());
}
}
// Jackson does not like the following properties
String[] ignorableProperties = {"secureRandom"};
BeanDeserializerModifier modifier = new BeanDeserializerModifierForIgnorables(
ClientConfiguration.class, ignorableProperties);
DeserializerFactory factory = BeanDeserializerFactory.instance.withDeserializerModifier(
modifier);
ObjectMapper mapper = new ObjectMapper(null, null,
new DefaultDeserializationContext.Impl(factory));
JsonNode propTree = mapper.convertValue(awsConfigProperties, JsonNode.class);
try {
mapper.readerForUpdating(config).readValue(propTree);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"static",
"void",
"setAwsClientConfigProperties",
"(",
"ClientConfiguration",
"config",
",",
"Properties",
"configProps",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"awsConfigProperties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",... | Set all prefixed properties on {@link ClientConfiguration}.
@param config
@param configProps | [
"Set",
"all",
"prefixed",
"properties",
"on",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/util/AWSUtil.java#L207-L232 | train | Sets the AWS client configuration properties. | [
30522,
2270,
10763,
11675,
2275,
10376,
11020,
8751,
3372,
8663,
8873,
21600,
18981,
8743,
3111,
1006,
7396,
8663,
8873,
27390,
3370,
9530,
8873,
2290,
1010,
5144,
9530,
8873,
21600,
18981,
2015,
1007,
1063,
4949,
1026,
5164,
1010,
4874,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.removeEdge | public Graph<K, VV, EV> removeEdge(Edge<K, EV> edge) {
DataSet<Edge<K, EV>> newEdges = getEdges().filter(new EdgeRemovalEdgeFilter<>(edge)).name("Remove edge");
return new Graph<>(this.vertices, newEdges, this.context);
} | java | public Graph<K, VV, EV> removeEdge(Edge<K, EV> edge) {
DataSet<Edge<K, EV>> newEdges = getEdges().filter(new EdgeRemovalEdgeFilter<>(edge)).name("Remove edge");
return new Graph<>(this.vertices, newEdges, this.context);
} | [
"public",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"removeEdge",
"(",
"Edge",
"<",
"K",
",",
"EV",
">",
"edge",
")",
"{",
"DataSet",
"<",
"Edge",
"<",
"K",
",",
"EV",
">",
">",
"newEdges",
"=",
"getEdges",
"(",
")",
".",
"filter",
"(",
"... | Removes all edges that match the given edge from the graph.
@param edge the edge to remove
@return the new graph containing the existing vertices and edges without
the removed edges | [
"Removes",
"all",
"edges",
"that",
"match",
"the",
"given",
"edge",
"from",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1545-L1548 | train | Removes the given edge from this graph. | [
30522,
2270,
10629,
1026,
30524,
1063,
2951,
13462,
1026,
3341,
1026,
1047,
1010,
23408,
1028,
1028,
2047,
24225,
2015,
1027,
2131,
24225,
2015,
1006,
1007,
1012,
11307,
1006,
2047,
3341,
28578,
7103,
3709,
3351,
8873,
21928,
1026,
1028,
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-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.getAny | @SuppressWarnings("unchecked")
public static <K, V> Map<K, V> getAny(Map<K, V> map, final K... keys) {
return filter(map, new Filter<Entry<K, V>>() {
@Override
public boolean accept(Entry<K, V> entry) {
return ArrayUtil.contains(keys, entry.getKey());
}
});
} | java | @SuppressWarnings("unchecked")
public static <K, V> Map<K, V> getAny(Map<K, V> map, final K... keys) {
return filter(map, new Filter<Entry<K, V>>() {
@Override
public boolean accept(Entry<K, V> entry) {
return ArrayUtil.contains(keys, entry.getKey());
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"getAny",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"final",
"K",
"...",
"keys",
")",
"{",
"return",
"filter",... | 获取Map的部分key生成新的Map
@param <K> Key类型
@param <V> Value类型
@param map Map
@param keys 键列表
@return 新Map,只包含指定的key
@since 4.0.6 | [
"获取Map的部分key生成新的Map"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L737-L746 | train | Returns a view of the specified map that contains any of the specified keys. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1047,
1010,
1058,
1028,
2131,
19092,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
2345,
1047,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-metrics/flink-metrics-dropwizard/src/main/java/org/apache/flink/dropwizard/ScheduledDropwizardReporter.java | ScheduledDropwizardReporter.notifyOfAddedMetric | @Override
public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) {
final String fullName = group.getMetricIdentifier(metricName, this);
synchronized (this) {
if (metric instanceof Counter) {
counters.put((Counter) metric, fullName);
registry.register(fullName, new FlinkCounterWrapper((Counter) metric));
}
else if (metric instanceof Gauge) {
gauges.put((Gauge<?>) metric, fullName);
registry.register(fullName, FlinkGaugeWrapper.fromGauge((Gauge<?>) metric));
} else if (metric instanceof Histogram) {
Histogram histogram = (Histogram) metric;
histograms.put(histogram, fullName);
if (histogram instanceof DropwizardHistogramWrapper) {
registry.register(fullName, ((DropwizardHistogramWrapper) histogram).getDropwizardHistogram());
} else {
registry.register(fullName, new FlinkHistogramWrapper(histogram));
}
} else if (metric instanceof Meter) {
Meter meter = (Meter) metric;
meters.put(meter, fullName);
if (meter instanceof DropwizardMeterWrapper) {
registry.register(fullName, ((DropwizardMeterWrapper) meter).getDropwizardMeter());
} else {
registry.register(fullName, new FlinkMeterWrapper(meter));
}
} else {
log.warn("Cannot add metric of type {}. This indicates that the reporter " +
"does not support this metric type.", metric.getClass().getName());
}
}
} | java | @Override
public void notifyOfAddedMetric(Metric metric, String metricName, MetricGroup group) {
final String fullName = group.getMetricIdentifier(metricName, this);
synchronized (this) {
if (metric instanceof Counter) {
counters.put((Counter) metric, fullName);
registry.register(fullName, new FlinkCounterWrapper((Counter) metric));
}
else if (metric instanceof Gauge) {
gauges.put((Gauge<?>) metric, fullName);
registry.register(fullName, FlinkGaugeWrapper.fromGauge((Gauge<?>) metric));
} else if (metric instanceof Histogram) {
Histogram histogram = (Histogram) metric;
histograms.put(histogram, fullName);
if (histogram instanceof DropwizardHistogramWrapper) {
registry.register(fullName, ((DropwizardHistogramWrapper) histogram).getDropwizardHistogram());
} else {
registry.register(fullName, new FlinkHistogramWrapper(histogram));
}
} else if (metric instanceof Meter) {
Meter meter = (Meter) metric;
meters.put(meter, fullName);
if (meter instanceof DropwizardMeterWrapper) {
registry.register(fullName, ((DropwizardMeterWrapper) meter).getDropwizardMeter());
} else {
registry.register(fullName, new FlinkMeterWrapper(meter));
}
} else {
log.warn("Cannot add metric of type {}. This indicates that the reporter " +
"does not support this metric type.", metric.getClass().getName());
}
}
} | [
"@",
"Override",
"public",
"void",
"notifyOfAddedMetric",
"(",
"Metric",
"metric",
",",
"String",
"metricName",
",",
"MetricGroup",
"group",
")",
"{",
"final",
"String",
"fullName",
"=",
"group",
".",
"getMetricIdentifier",
"(",
"metricName",
",",
"this",
")",
... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-dropwizard/src/main/java/org/apache/flink/dropwizard/ScheduledDropwizardReporter.java#L124-L159 | train | Notifies the reporter that a metric has been added to the registry. | [
30522,
1030,
2058,
15637,
2270,
11675,
2025,
8757,
11253,
4215,
5732,
12589,
1006,
12046,
12046,
1010,
5164,
12046,
18442,
1010,
12046,
17058,
2177,
1007,
1063,
2345,
5164,
2440,
18442,
1027,
2177,
1012,
2131,
12589,
5178,
16778,
8873,
2121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/jobmaster/JobMaster.java | JobMaster.cancel | @Override
public CompletableFuture<Acknowledge> cancel(Time timeout) {
executionGraph.cancel();
return CompletableFuture.completedFuture(Acknowledge.get());
} | java | @Override
public CompletableFuture<Acknowledge> cancel(Time timeout) {
executionGraph.cancel();
return CompletableFuture.completedFuture(Acknowledge.get());
} | [
"@",
"Override",
"public",
"CompletableFuture",
"<",
"Acknowledge",
">",
"cancel",
"(",
"Time",
"timeout",
")",
"{",
"executionGraph",
".",
"cancel",
"(",
")",
";",
"return",
"CompletableFuture",
".",
"completedFuture",
"(",
"Acknowledge",
".",
"get",
"(",
")"... | ---------------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L363-L368 | train | Cancels the cluster. | [
30522,
1030,
2058,
15637,
2270,
4012,
10814,
10880,
11263,
11244,
1026,
13399,
1028,
17542,
1006,
2051,
2051,
5833,
1007,
1063,
7781,
14413,
1012,
17542,
1006,
1007,
1025,
2709,
4012,
10814,
10880,
11263,
11244,
1012,
2949,
11263,
11244,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/util/PosTagUtil.java | PosTagUtil.evaluate | public static float evaluate(POSTagger tagger, String corpus)
{
int correct = 0, total = 0;
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
for (String line : lineIterator)
{
Sentence sentence = Sentence.create(line);
if (sentence == null) continue;
String[][] wordTagArray = sentence.toWordTagArray();
String[] prediction = tagger.tag(wordTagArray[0]);
assert prediction.length == wordTagArray[1].length;
total += prediction.length;
for (int i = 0; i < prediction.length; i++)
{
if (prediction[i].equals(wordTagArray[1][i]))
++correct;
}
}
if (total == 0) return 0;
return correct / (float) total * 100;
} | java | public static float evaluate(POSTagger tagger, String corpus)
{
int correct = 0, total = 0;
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
for (String line : lineIterator)
{
Sentence sentence = Sentence.create(line);
if (sentence == null) continue;
String[][] wordTagArray = sentence.toWordTagArray();
String[] prediction = tagger.tag(wordTagArray[0]);
assert prediction.length == wordTagArray[1].length;
total += prediction.length;
for (int i = 0; i < prediction.length; i++)
{
if (prediction[i].equals(wordTagArray[1][i]))
++correct;
}
}
if (total == 0) return 0;
return correct / (float) total * 100;
} | [
"public",
"static",
"float",
"evaluate",
"(",
"POSTagger",
"tagger",
",",
"String",
"corpus",
")",
"{",
"int",
"correct",
"=",
"0",
",",
"total",
"=",
"0",
";",
"IOUtil",
".",
"LineIterator",
"lineIterator",
"=",
"new",
"IOUtil",
".",
"LineIterator",
"(",
... | 评估词性标注器的准确率
@param tagger 词性标注器
@param corpus 测试集
@return Accuracy百分比 | [
"评估词性标注器的准确率"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/util/PosTagUtil.java#L208-L228 | train | Evaluate the result of a CRS corpus | [
30522,
2270,
10763,
14257,
16157,
1006,
2695,
27609,
6415,
4590,
1010,
5164,
13931,
1007,
1063,
20014,
6149,
1027,
1014,
1010,
2561,
1027,
1014,
1025,
22834,
21823,
2140,
1012,
2240,
21646,
8844,
2240,
21646,
8844,
1027,
2047,
22834,
21823,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08PartitionDiscoverer.java | Kafka08PartitionDiscoverer.brokerToNode | private static Node brokerToNode(Broker broker) {
return new Node(broker.id(), broker.host(), broker.port());
} | java | private static Node brokerToNode(Broker broker) {
return new Node(broker.id(), broker.host(), broker.port());
} | [
"private",
"static",
"Node",
"brokerToNode",
"(",
"Broker",
"broker",
")",
"{",
"return",
"new",
"Node",
"(",
"broker",
".",
"id",
"(",
")",
",",
"broker",
".",
"host",
"(",
")",
",",
"broker",
".",
"port",
"(",
")",
")",
";",
"}"
] | Turn a broker instance into a node instance.
@param broker broker instance
@return Node representing the given broker | [
"Turn",
"a",
"broker",
"instance",
"into",
"a",
"node",
"instance",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.8/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/Kafka08PartitionDiscoverer.java#L261-L263 | train | Convert a broker to a node. | [
30522,
2797,
10763,
13045,
20138,
2669,
10244,
1006,
20138,
20138,
1007,
1063,
30524,
20138,
1012,
8909,
1006,
1007,
1010,
20138,
1012,
3677,
1006,
1007,
1010,
20138,
1012,
3417,
1006,
1007,
1007,
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-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java | CronPattern.isMatch | private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
return (matchers.size() > index) ? matchers.get(index).match(value) : true;
} | java | private static boolean isMatch(List<ValueMatcher> matchers, int index, int value) {
return (matchers.size() > index) ? matchers.get(index).match(value) : true;
} | [
"private",
"static",
"boolean",
"isMatch",
"(",
"List",
"<",
"ValueMatcher",
">",
"matchers",
",",
"int",
"index",
",",
"int",
"value",
")",
"{",
"return",
"(",
"matchers",
".",
"size",
"(",
")",
">",
"index",
")",
"?",
"matchers",
".",
"get",
"(",
"... | 是否匹配指定的日期时间位置
@param matchers 匹配器列表
@param index 位置
@param value 被匹配的值
@return 是否匹配
@since 4.0.2 | [
"是否匹配指定的日期时间位置"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPattern.java#L213-L215 | train | Returns true if the value matches the given index. | [
30522,
2797,
10763,
22017,
20898,
2003,
18900,
2818,
1006,
2862,
1026,
3643,
18900,
7474,
1028,
2674,
2545,
1010,
20014,
5950,
1010,
20014,
3643,
1007,
1063,
2709,
1006,
2674,
2545,
1012,
2946,
1006,
1007,
1028,
5950,
1007,
1029,
2674,
2545... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.groupByField | public static <T> List<List<T>> groupByField(Collection<T> collection, final String fieldName) {
return group(collection, new Hash<T>() {
private List<Object> fieldNameList = new ArrayList<>();
@Override
public int hash(T t) {
if (null == t || false == BeanUtil.isBean(t.getClass())) {
// 非Bean放在同一子分组中
return 0;
}
final Object value = ReflectUtil.getFieldValue(t, fieldName);
int hash = fieldNameList.indexOf(value);
if (hash < 0) {
fieldNameList.add(value);
return fieldNameList.size() - 1;
} else {
return hash;
}
}
});
} | java | public static <T> List<List<T>> groupByField(Collection<T> collection, final String fieldName) {
return group(collection, new Hash<T>() {
private List<Object> fieldNameList = new ArrayList<>();
@Override
public int hash(T t) {
if (null == t || false == BeanUtil.isBean(t.getClass())) {
// 非Bean放在同一子分组中
return 0;
}
final Object value = ReflectUtil.getFieldValue(t, fieldName);
int hash = fieldNameList.indexOf(value);
if (hash < 0) {
fieldNameList.add(value);
return fieldNameList.size() - 1;
} else {
return hash;
}
}
});
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"groupByField",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"final",
"String",
"fieldName",
")",
"{",
"return",
"group",
"(",
"collection",
",",
"new",
"Hash",
"<",
... | 根据元素的指定字段名分组,非Bean都放在第一个分组中
@param <T> 元素类型
@param collection 集合
@param fieldName 元素Bean中的字段名,非Bean都放在第一个分组中
@return 分组列表 | [
"根据元素的指定字段名分组,非Bean都放在第一个分组中"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2330-L2350 | train | Group by field. | [
30522,
2270,
10763,
1026,
1056,
1028,
2862,
1026,
2862,
1026,
1056,
1028,
1028,
2177,
3762,
3790,
1006,
3074,
1026,
1056,
1028,
3074,
1010,
2345,
5164,
2492,
18442,
1007,
1063,
2709,
2177,
1006,
3074,
1010,
2047,
23325,
1026,
1056,
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... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.columnMaxValue | public Statistics columnMaxValue(String columnName, Number max) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(MAX_VALUE, String.valueOf(max));
return this;
} | java | public Statistics columnMaxValue(String columnName, Number max) {
this.columnStats
.computeIfAbsent(columnName, column -> new HashMap<>())
.put(MAX_VALUE, String.valueOf(max));
return this;
} | [
"public",
"Statistics",
"columnMaxValue",
"(",
"String",
"columnName",
",",
"Number",
"max",
")",
"{",
"this",
".",
"columnStats",
".",
"computeIfAbsent",
"(",
"columnName",
",",
"column",
"->",
"new",
"HashMap",
"<>",
"(",
")",
")",
".",
"put",
"(",
"MAX_... | Sets the maximum value statistic for the given column. | [
"Sets",
"the",
"maximum",
"value",
"statistic",
"for",
"the",
"given",
"column",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L131-L136 | train | Sets the maximum value of the specified column. | [
30522,
2270,
6747,
5930,
17848,
10175,
5657,
1006,
5164,
5930,
18442,
1010,
2193,
4098,
1007,
1063,
2023,
1012,
7753,
29336,
2015,
1012,
24134,
10128,
7875,
5054,
2102,
1006,
5930,
18442,
1010,
5930,
1011,
1028,
2047,
23325,
2863,
2361,
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-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.createAll | public static WatchMonitor createAll(URL url, Watcher watcher){
try {
return createAll(Paths.get(url.toURI()), watcher);
} catch (URISyntaxException e) {
throw new WatchException(e);
}
} | java | public static WatchMonitor createAll(URL url, Watcher watcher){
try {
return createAll(Paths.get(url.toURI()), watcher);
} catch (URISyntaxException e) {
throw new WatchException(e);
}
} | [
"public",
"static",
"WatchMonitor",
"createAll",
"(",
"URL",
"url",
",",
"Watcher",
"watcher",
")",
"{",
"try",
"{",
"return",
"createAll",
"(",
"Paths",
".",
"get",
"(",
"url",
".",
"toURI",
"(",
")",
")",
",",
"watcher",
")",
";",
"}",
"catch",
"("... | 创建并初始化监听,监听所有事件
@param url URL
@param watcher {@link Watcher}
@return {@link WatchMonitor} | [
"创建并初始化监听,监听所有事件"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L204-L210 | train | Creates a WatchMonitor for a given URL. | [
30522,
2270,
10763,
3422,
8202,
15660,
3443,
8095,
1006,
24471,
2140,
24471,
2140,
1010,
3422,
2121,
3422,
2121,
1007,
1063,
3046,
1063,
2709,
3443,
8095,
1006,
10425,
1012,
2131,
1006,
24471,
2140,
1012,
2778,
2072,
1006,
1007,
1007,
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/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingBase.java | GraphAlgorithmWrappingBase.canMergeConfigurationWith | protected boolean canMergeConfigurationWith(GraphAlgorithmWrappingBase other) {
Preconditions.checkNotNull(other);
return this.getClass().equals(other.getClass());
} | java | protected boolean canMergeConfigurationWith(GraphAlgorithmWrappingBase other) {
Preconditions.checkNotNull(other);
return this.getClass().equals(other.getClass());
} | [
"protected",
"boolean",
"canMergeConfigurationWith",
"(",
"GraphAlgorithmWrappingBase",
"other",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"other",
")",
";",
"return",
"this",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getClass",
"(... | First test whether the algorithm configurations can be merged before the
call to {@link #mergeConfiguration}.
@param other the algorithm with which to compare configuration
@return true if and only if configuration can be merged and the
algorithm's output can be reused
@see #mergeConfiguration(GraphAlgorithmWrappingBase) | [
"First",
"test",
"whether",
"the",
"algorithm",
"configurations",
"can",
"be",
"merged",
"before",
"the",
"call",
"to",
"{",
"@link",
"#mergeConfiguration",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/utils/proxy/GraphAlgorithmWrappingBase.java#L88-L92 | train | Checks if this algorithm can merge the given configuration with the given algorithm. | [
30522,
5123,
22017,
20898,
2064,
5017,
3351,
8663,
8873,
27390,
3370,
24415,
1006,
10629,
2389,
20255,
8939,
2213,
13088,
29098,
2075,
15058,
2060,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
2060,
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/lang/Validator.java | Validator.isUpperCase | public static boolean isUpperCase(CharSequence value) {
return StrUtil.isAllCharMatch(value, new cn.hutool.core.lang.Matcher<Character>() {
@Override
public boolean match(Character t) {
return Character.isUpperCase(t);
}
});
} | java | public static boolean isUpperCase(CharSequence value) {
return StrUtil.isAllCharMatch(value, new cn.hutool.core.lang.Matcher<Character>() {
@Override
public boolean match(Character t) {
return Character.isUpperCase(t);
}
});
} | [
"public",
"static",
"boolean",
"isUpperCase",
"(",
"CharSequence",
"value",
")",
"{",
"return",
"StrUtil",
".",
"isAllCharMatch",
"(",
"value",
",",
"new",
"cn",
".",
"hutool",
".",
"core",
".",
"lang",
".",
"Matcher",
"<",
"Character",
">",
"(",
")",
"{... | 判断字符串是否全部为大写字母
@param value 值
@return 是否全部为大写字母
@since 3.3.0 | [
"判断字符串是否全部为大写字母"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L467-L474 | train | Returns true if the specified char sequence is uppercase. | [
30522,
2270,
10763,
22017,
20898,
2003,
29547,
18992,
3366,
1006,
25869,
3366,
4226,
5897,
3643,
1007,
1063,
2709,
2358,
22134,
4014,
1012,
18061,
3363,
7507,
17830,
10649,
1006,
3643,
1010,
2047,
27166,
1012,
12570,
13669,
1012,
4563,
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... |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.schedule | public String schedule(String pattern, Task task) {
String id = UUID.randomUUID().toString();
schedule(id, pattern, task);
return id;
} | java | public String schedule(String pattern, Task task) {
String id = UUID.randomUUID().toString();
schedule(id, pattern, task);
return id;
} | [
"public",
"String",
"schedule",
"(",
"String",
"pattern",
",",
"Task",
"task",
")",
"{",
"String",
"id",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"schedule",
"(",
"id",
",",
"pattern",
",",
"task",
")",
";",
"return",... | 新增Task,使用随机UUID
@param pattern {@link CronPattern}对应的String表达式
@param task {@link Task}
@return ID | [
"新增Task,使用随机UUID"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L217-L221 | train | Creates a unique id for a task that will be scheduled to run. | [
30522,
2270,
5164,
6134,
1006,
5164,
5418,
1010,
4708,
4708,
1007,
1063,
5164,
8909,
1027,
1057,
21272,
1012,
6721,
2226,
21272,
1006,
1007,
1012,
2000,
3367,
4892,
1006,
1007,
1025,
6134,
1006,
8909,
1010,
5418,
1010,
4708,
1007,
1025,
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... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/meta/Column.java | Column.init | public void init(String tableName, ResultSet columnMetaRs) throws SQLException {
this.tableName = tableName;
this.name = columnMetaRs.getString("COLUMN_NAME");
this.type = columnMetaRs.getInt("DATA_TYPE");
this.size = columnMetaRs.getInt("COLUMN_SIZE");
this.isNullable = columnMetaRs.getBoolean("NULLABLE");
this.comment = columnMetaRs.getString("REMARKS");
} | java | public void init(String tableName, ResultSet columnMetaRs) throws SQLException {
this.tableName = tableName;
this.name = columnMetaRs.getString("COLUMN_NAME");
this.type = columnMetaRs.getInt("DATA_TYPE");
this.size = columnMetaRs.getInt("COLUMN_SIZE");
this.isNullable = columnMetaRs.getBoolean("NULLABLE");
this.comment = columnMetaRs.getString("REMARKS");
} | [
"public",
"void",
"init",
"(",
"String",
"tableName",
",",
"ResultSet",
"columnMetaRs",
")",
"throws",
"SQLException",
"{",
"this",
".",
"tableName",
"=",
"tableName",
";",
"this",
".",
"name",
"=",
"columnMetaRs",
".",
"getString",
"(",
"\"COLUMN_NAME\"",
")"... | 初始化
@param tableName 表名
@param columnMetaRs 列的meta ResultSet
@throws SQLException SQL执行异常 | [
"初始化"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/meta/Column.java#L73-L81 | train | Initialize the object with the data from the ResultSet. | [
30522,
2270,
11675,
1999,
4183,
1006,
5164,
2795,
18442,
1010,
3463,
3388,
5930,
11368,
11650,
1007,
11618,
29296,
10288,
24422,
1063,
2023,
1012,
2795,
18442,
1027,
2795,
18442,
1025,
2023,
1012,
2171,
1027,
5930,
11368,
11650,
1012,
4152,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.save | public void save(DataOutputStream out) throws Exception
{
TextUtility.writeString(model_header, out);
TextUtility.writeString(root, out);
out.writeInt(use_distance ? 1 : 0);
out.writeInt(use_valency ? 1 : 0);
out.writeInt(use_cluster ? 1 : 0);
W1.save(out);
W2.save(out);
E.save(out);
b1.save(out);
saved.save(out);
forms_alphabet.save(out);
postags_alphabet.save(out);
deprels_alphabet.save(out);
save_map(precomputation_id_encoder, out);
if (use_cluster)
{
cluster4_types_alphabet.save(out);
cluster6_types_alphabet.save(out);
cluster_types_alphabet.save(out);
save_map(form_to_cluster4, out);
save_map(form_to_cluster6 , out);
save_map(form_to_cluster , out);
}
} | java | public void save(DataOutputStream out) throws Exception
{
TextUtility.writeString(model_header, out);
TextUtility.writeString(root, out);
out.writeInt(use_distance ? 1 : 0);
out.writeInt(use_valency ? 1 : 0);
out.writeInt(use_cluster ? 1 : 0);
W1.save(out);
W2.save(out);
E.save(out);
b1.save(out);
saved.save(out);
forms_alphabet.save(out);
postags_alphabet.save(out);
deprels_alphabet.save(out);
save_map(precomputation_id_encoder, out);
if (use_cluster)
{
cluster4_types_alphabet.save(out);
cluster6_types_alphabet.save(out);
cluster_types_alphabet.save(out);
save_map(form_to_cluster4, out);
save_map(form_to_cluster6 , out);
save_map(form_to_cluster , out);
}
} | [
"public",
"void",
"save",
"(",
"DataOutputStream",
"out",
")",
"throws",
"Exception",
"{",
"TextUtility",
".",
"writeString",
"(",
"model_header",
",",
"out",
")",
";",
"TextUtility",
".",
"writeString",
"(",
"root",
",",
"out",
")",
";",
"out",
".",
"writ... | 保存到磁盘
@param out
@throws Exception | [
"保存到磁盘"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L200-L231 | train | Save the content of this CRA to the specified output stream. | [
30522,
2270,
11675,
3828,
1006,
2951,
5833,
18780,
21422,
2041,
1007,
11618,
6453,
1063,
3793,
21823,
18605,
1012,
7009,
18886,
3070,
1006,
2944,
1035,
20346,
1010,
2041,
1007,
1025,
3793,
21823,
18605,
1012,
7009,
18886,
3070,
1006,
7117,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HexUtil.java | HexUtil.encodeHexStr | public static String encodeHexStr(String data, Charset charset) {
return encodeHexStr(StrUtil.bytes(data, charset), true);
} | java | public static String encodeHexStr(String data, Charset charset) {
return encodeHexStr(StrUtil.bytes(data, charset), true);
} | [
"public",
"static",
"String",
"encodeHexStr",
"(",
"String",
"data",
",",
"Charset",
"charset",
")",
"{",
"return",
"encodeHexStr",
"(",
"StrUtil",
".",
"bytes",
"(",
"data",
",",
"charset",
")",
",",
"true",
")",
";",
"}"
] | 将字节数组转换为十六进制字符串,结果为小写
@param data 被编码的字符串
@param charset 编码
@return 十六进制String | [
"将字节数组转换为十六进制字符串,结果为小写"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L99-L101 | train | Encode a String in hexadecimal format. | [
30522,
2270,
10763,
5164,
4372,
16044,
5369,
2595,
3367,
2099,
1006,
5164,
2951,
1010,
25869,
13462,
25869,
13462,
1007,
1063,
2709,
4372,
16044,
5369,
2595,
3367,
2099,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2951,
1010,
25869,
13462,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java | YarnShuffleService.initRecoveryDb | protected File initRecoveryDb(String dbName) {
Preconditions.checkNotNull(_recoveryPath,
"recovery path should not be null if NM recovery is enabled");
File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName);
if (recoveryFile.exists()) {
return recoveryFile;
}
// db doesn't exist in recovery path go check local dirs for it
String[] localDirs = _conf.getTrimmedStrings("yarn.nodemanager.local-dirs");
for (String dir : localDirs) {
File f = new File(new Path(dir).toUri().getPath(), dbName);
if (f.exists()) {
// If the recovery path is set then either NM recovery is enabled or another recovery
// DB has been initialized. If NM recovery is enabled and had set the recovery path
// make sure to move all DBs to the recovery path from the old NM local dirs.
// If another DB was initialized first just make sure all the DBs are in the same
// location.
Path newLoc = new Path(_recoveryPath, dbName);
Path copyFrom = new Path(f.toURI());
if (!newLoc.equals(copyFrom)) {
logger.info("Moving " + copyFrom + " to: " + newLoc);
try {
// The move here needs to handle moving non-empty directories across NFS mounts
FileSystem fs = FileSystem.getLocal(_conf);
fs.rename(copyFrom, newLoc);
} catch (Exception e) {
// Fail to move recovery file to new path, just continue on with new DB location
logger.error("Failed to move recovery file {} to the path {}",
dbName, _recoveryPath.toString(), e);
}
}
return new File(newLoc.toUri().getPath());
}
}
return new File(_recoveryPath.toUri().getPath(), dbName);
} | java | protected File initRecoveryDb(String dbName) {
Preconditions.checkNotNull(_recoveryPath,
"recovery path should not be null if NM recovery is enabled");
File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName);
if (recoveryFile.exists()) {
return recoveryFile;
}
// db doesn't exist in recovery path go check local dirs for it
String[] localDirs = _conf.getTrimmedStrings("yarn.nodemanager.local-dirs");
for (String dir : localDirs) {
File f = new File(new Path(dir).toUri().getPath(), dbName);
if (f.exists()) {
// If the recovery path is set then either NM recovery is enabled or another recovery
// DB has been initialized. If NM recovery is enabled and had set the recovery path
// make sure to move all DBs to the recovery path from the old NM local dirs.
// If another DB was initialized first just make sure all the DBs are in the same
// location.
Path newLoc = new Path(_recoveryPath, dbName);
Path copyFrom = new Path(f.toURI());
if (!newLoc.equals(copyFrom)) {
logger.info("Moving " + copyFrom + " to: " + newLoc);
try {
// The move here needs to handle moving non-empty directories across NFS mounts
FileSystem fs = FileSystem.getLocal(_conf);
fs.rename(copyFrom, newLoc);
} catch (Exception e) {
// Fail to move recovery file to new path, just continue on with new DB location
logger.error("Failed to move recovery file {} to the path {}",
dbName, _recoveryPath.toString(), e);
}
}
return new File(newLoc.toUri().getPath());
}
}
return new File(_recoveryPath.toUri().getPath(), dbName);
} | [
"protected",
"File",
"initRecoveryDb",
"(",
"String",
"dbName",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"_recoveryPath",
",",
"\"recovery path should not be null if NM recovery is enabled\"",
")",
";",
"File",
"recoveryFile",
"=",
"new",
"File",
"(",
"_reco... | Figure out the recovery path and handle moving the DB if YARN NM recovery gets enabled
and DB exists in the local dir of NM by old version of shuffle service. | [
"Figure",
"out",
"the",
"recovery",
"path",
"and",
"handle",
"moving",
"the",
"DB",
"if",
"YARN",
"NM",
"recovery",
"gets",
"enabled",
"and",
"DB",
"exists",
"in",
"the",
"local",
"dir",
"of",
"NM",
"by",
"old",
"version",
"of",
"shuffle",
"service",
"."... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L363-L401 | train | Initialize the DB in the recovery path. | [
30522,
5123,
5371,
1999,
4183,
2890,
3597,
27900,
18939,
1006,
5164,
16962,
18442,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
17048,
11231,
3363,
1006,
1035,
7233,
15069,
1010,
1000,
7233,
4130,
2323,
2025,
2022,
19701,
2065,
13221,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java | CsvUtil.getWriter | public static CsvWriter getWriter(String filePath, Charset charset, boolean isAppend) {
return new CsvWriter(filePath, charset, isAppend);
} | java | public static CsvWriter getWriter(String filePath, Charset charset, boolean isAppend) {
return new CsvWriter(filePath, charset, isAppend);
} | [
"public",
"static",
"CsvWriter",
"getWriter",
"(",
"String",
"filePath",
",",
"Charset",
"charset",
",",
"boolean",
"isAppend",
")",
"{",
"return",
"new",
"CsvWriter",
"(",
"filePath",
",",
"charset",
",",
"isAppend",
")",
";",
"}"
] | 获取CSV生成器(写出器),使用默认配置
@param filePath File CSV文件路径
@param charset 编码
@param isAppend 是否追加 | [
"获取CSV生成器(写出器),使用默认配置"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvUtil.java#L63-L65 | train | Returns a writer for a CSV file. | [
30522,
2270,
10763,
20116,
2615,
15994,
2131,
15994,
1006,
5164,
5371,
15069,
1010,
25869,
13462,
25869,
13462,
1010,
22017,
20898,
18061,
21512,
4859,
1007,
1063,
2709,
2047,
20116,
2615,
15994,
30524,
18061,
21512,
4859,
1007,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java | Repackager.repackage | public void repackage(File destination, Libraries libraries) throws IOException {
repackage(destination, libraries, null);
} | java | public void repackage(File destination, Libraries libraries) throws IOException {
repackage(destination, libraries, null);
} | [
"public",
"void",
"repackage",
"(",
"File",
"destination",
",",
"Libraries",
"libraries",
")",
"throws",
"IOException",
"{",
"repackage",
"(",
"destination",
",",
"libraries",
",",
"null",
")",
";",
"}"
] | Repackage to the given destination so that it can be launched using '
{@literal java -jar}'.
@param destination the destination file (may be the same as the source)
@param libraries the libraries required to run the archive
@throws IOException if the file cannot be repackaged | [
"Repackage",
"to",
"the",
"given",
"destination",
"so",
"that",
"it",
"can",
"be",
"launched",
"using",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java#L158-L160 | train | Repackage the given destination file with the given libraries. | [
30522,
2270,
11675,
16360,
8684,
4270,
1006,
5371,
7688,
1010,
8860,
8860,
1007,
11618,
22834,
10288,
24422,
1063,
16360,
8684,
4270,
1006,
7688,
1010,
8860,
1010,
19701,
1007,
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,
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.fromCollection | public static <K, VV, EV> Graph<K, VV, EV> fromCollection(Collection<Vertex<K, VV>> vertices,
Collection<Edge<K, EV>> edges, ExecutionEnvironment context) {
return fromDataSet(context.fromCollection(vertices),
context.fromCollection(edges), context);
} | java | public static <K, VV, EV> Graph<K, VV, EV> fromCollection(Collection<Vertex<K, VV>> vertices,
Collection<Edge<K, EV>> edges, ExecutionEnvironment context) {
return fromDataSet(context.fromCollection(vertices),
context.fromCollection(edges), context);
} | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromCollection",
"(",
"Collection",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"vertices",
",",
"Collection",
"<",
"Edge",
"<",
"K",
",",
... | Creates a graph from a Collection of vertices and a Collection of edges.
@param vertices a Collection of vertices.
@param edges a Collection of edges.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"Collection",
"of",
"vertices",
"and",
"a",
"Collection",
"of",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L114-L119 | train | Creates a graph from a collection of vertices and a collection of edges. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
23408,
1028,
2013,
26895,
18491,
1006,
3074,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
18984,
1010,
3074,
1026,
334... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/core/memory/MemorySegment.java | MemorySegment.swapBytes | public final void swapBytes(byte[] tempBuffer, MemorySegment seg2, int offset1, int offset2, int len) {
if ((offset1 | offset2 | len | (tempBuffer.length - len)) >= 0) {
final long thisPos = this.address + offset1;
final long otherPos = seg2.address + offset2;
if (thisPos <= this.addressLimit - len && otherPos <= seg2.addressLimit - len) {
// this -> temp buffer
UNSAFE.copyMemory(this.heapMemory, thisPos, tempBuffer, BYTE_ARRAY_BASE_OFFSET, len);
// other -> this
UNSAFE.copyMemory(seg2.heapMemory, otherPos, this.heapMemory, thisPos, len);
// temp buffer -> other
UNSAFE.copyMemory(tempBuffer, BYTE_ARRAY_BASE_OFFSET, seg2.heapMemory, otherPos, len);
return;
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (seg2.address > seg2.addressLimit) {
throw new IllegalStateException("other memory segment has been freed.");
}
}
// index is in fact invalid
throw new IndexOutOfBoundsException(
String.format("offset1=%d, offset2=%d, len=%d, bufferSize=%d, address1=%d, address2=%d",
offset1, offset2, len, tempBuffer.length, this.address, seg2.address));
} | java | public final void swapBytes(byte[] tempBuffer, MemorySegment seg2, int offset1, int offset2, int len) {
if ((offset1 | offset2 | len | (tempBuffer.length - len)) >= 0) {
final long thisPos = this.address + offset1;
final long otherPos = seg2.address + offset2;
if (thisPos <= this.addressLimit - len && otherPos <= seg2.addressLimit - len) {
// this -> temp buffer
UNSAFE.copyMemory(this.heapMemory, thisPos, tempBuffer, BYTE_ARRAY_BASE_OFFSET, len);
// other -> this
UNSAFE.copyMemory(seg2.heapMemory, otherPos, this.heapMemory, thisPos, len);
// temp buffer -> other
UNSAFE.copyMemory(tempBuffer, BYTE_ARRAY_BASE_OFFSET, seg2.heapMemory, otherPos, len);
return;
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (seg2.address > seg2.addressLimit) {
throw new IllegalStateException("other memory segment has been freed.");
}
}
// index is in fact invalid
throw new IndexOutOfBoundsException(
String.format("offset1=%d, offset2=%d, len=%d, bufferSize=%d, address1=%d, address2=%d",
offset1, offset2, len, tempBuffer.length, this.address, seg2.address));
} | [
"public",
"final",
"void",
"swapBytes",
"(",
"byte",
"[",
"]",
"tempBuffer",
",",
"MemorySegment",
"seg2",
",",
"int",
"offset1",
",",
"int",
"offset2",
",",
"int",
"len",
")",
"{",
"if",
"(",
"(",
"offset1",
"|",
"offset2",
"|",
"len",
"|",
"(",
"te... | Swaps bytes between two memory segments, using the given auxiliary buffer.
@param tempBuffer The auxiliary buffer in which to put data during triangle swap.
@param seg2 Segment to swap bytes with
@param offset1 Offset of this segment to start swapping
@param offset2 Offset of seg2 to start swapping
@param len Length of the swapped memory region | [
"Swaps",
"bytes",
"between",
"two",
"memory",
"segments",
"using",
"the",
"given",
"auxiliary",
"buffer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1367-L1395 | train | Swap the bytes of this memory segment with the bytes of the given temp buffer. | [
30522,
2270,
2345,
11675,
19948,
3762,
4570,
1006,
24880,
1031,
1033,
8915,
8737,
8569,
12494,
1010,
3638,
3366,
21693,
4765,
7367,
2290,
2475,
1010,
20014,
16396,
2487,
1010,
20014,
16396,
2475,
1010,
20014,
18798,
1007,
1063,
2065,
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-http/src/main/java/cn/hutool/http/HttpBase.java | HttpBase.header | public String header(Header name) {
if(null == name) {
return null;
}
return header(name.toString());
} | java | public String header(Header name) {
if(null == name) {
return null;
}
return header(name.toString());
} | [
"public",
"String",
"header",
"(",
"Header",
"name",
")",
"{",
"if",
"(",
"null",
"==",
"name",
")",
"{",
"return",
"null",
";",
"}",
"return",
"header",
"(",
"name",
".",
"toString",
"(",
")",
")",
";",
"}"
] | 根据name获取头信息
@param name Header名
@return Header值 | [
"根据name获取头信息"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L74-L79 | train | Returns the value of the specified header. | [
30522,
2270,
5164,
20346,
1006,
20346,
2171,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2171,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
20346,
1006,
2171,
1012,
2000,
3367,
4892,
1006,
1007,
1007,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optBoolean | public boolean optBoolean(String name, boolean fallback) {
Object object = opt(name);
Boolean result = JSON.toBoolean(object);
return result != null ? result : fallback;
} | java | public boolean optBoolean(String name, boolean fallback) {
Object object = opt(name);
Boolean result = JSON.toBoolean(object);
return result != null ? result : fallback;
} | [
"public",
"boolean",
"optBoolean",
"(",
"String",
"name",
",",
"boolean",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Boolean",
"result",
"=",
"JSON",
".",
"toBoolean",
"(",
"object",
")",
";",
"return",
"result",
"!=",
... | Returns the value mapped by {@code name} if it exists and is a boolean or can be
coerced to a boolean. Returns {@code fallback} otherwise.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L424-L428 | train | Get the optional boolean value associated with a name. | [
30522,
2270,
22017,
20898,
23569,
5092,
9890,
2319,
1006,
5164,
2171,
1010,
22017,
20898,
2991,
5963,
1007,
1063,
4874,
4874,
1027,
23569,
1006,
2171,
1007,
1025,
22017,
20898,
2765,
1027,
1046,
3385,
1012,
2000,
5092,
9890,
2319,
1006,
487... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/operators/DataSink.java | DataSink.sortLocalOutput | @Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(String fieldExpression, Order order) {
int numFields;
int[] fields;
Order[] orders;
// compute flat field positions for (nested) sorting fields
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(fieldExpression, this.type);
fields = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(fieldExpression, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
numFields = fields.length;
orders = new Order[numFields];
Arrays.fill(orders, order);
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = fields;
this.sortOrders = orders;
} else {
// append sorting info to existing info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + numFields;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength);
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength);
for (int i = 0; i < numFields; i++) {
this.sortKeyPositions[oldLength + i] = fields[i];
this.sortOrders[oldLength + i] = orders[i];
}
}
return this;
} | java | @Deprecated
@PublicEvolving
public DataSink<T> sortLocalOutput(String fieldExpression, Order order) {
int numFields;
int[] fields;
Order[] orders;
// compute flat field positions for (nested) sorting fields
Keys.ExpressionKeys<T> ek = new Keys.ExpressionKeys<>(fieldExpression, this.type);
fields = ek.computeLogicalKeyPositions();
if (!Keys.ExpressionKeys.isSortKey(fieldExpression, this.type)) {
throw new InvalidProgramException("Selected sort key is not a sortable type");
}
numFields = fields.length;
orders = new Order[numFields];
Arrays.fill(orders, order);
if (this.sortKeyPositions == null) {
// set sorting info
this.sortKeyPositions = fields;
this.sortOrders = orders;
} else {
// append sorting info to existing info
int oldLength = this.sortKeyPositions.length;
int newLength = oldLength + numFields;
this.sortKeyPositions = Arrays.copyOf(this.sortKeyPositions, newLength);
this.sortOrders = Arrays.copyOf(this.sortOrders, newLength);
for (int i = 0; i < numFields; i++) {
this.sortKeyPositions[oldLength + i] = fields[i];
this.sortOrders[oldLength + i] = orders[i];
}
}
return this;
} | [
"@",
"Deprecated",
"@",
"PublicEvolving",
"public",
"DataSink",
"<",
"T",
">",
"sortLocalOutput",
"(",
"String",
"fieldExpression",
",",
"Order",
"order",
")",
"{",
"int",
"numFields",
";",
"int",
"[",
"]",
"fields",
";",
"Order",
"[",
"]",
"orders",
";",
... | Sorts each local partition of a data set on the field(s) specified by the field expression
in the specified {@link Order} before it is emitted by the output format.
<p><b>Note: Non-composite types can only be sorted on the full element which is specified by
a wildcard expression ("*" or "_").</b>
<p>Data sets of composite types (Tuple or Pojo) can be sorted on multiple fields in different orders
by chaining {@link #sortLocalOutput(String, Order)} calls.
@param fieldExpression The field expression for the field(s) on which the data set is locally sorted.
@param order The Order in which the specified field(s) are locally sorted.
@return This data sink operator with specified output order.
@see Order
@deprecated Use {@link DataSet#sortPartition(String, Order)} instead | [
"Sorts",
"each",
"local",
"partition",
"of",
"a",
"data",
"set",
"on",
"the",
"field",
"(",
"s",
")",
"specified",
"by",
"the",
"field",
"expression",
"in",
"the",
"specified",
"{",
"@link",
"Order",
"}",
"before",
"it",
"is",
"emitted",
"by",
"the",
"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L178-L215 | train | This method is used to sort the data sink by field expression. | [
30522,
1030,
2139,
28139,
12921,
1030,
2270,
6777,
4747,
6455,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4066,
4135,
9289,
5833,
18780,
1006,
5164,
2492,
10288,
20110,
3258,
1010,
2344,
2344,
1007,
1063,
20014,
16371,
2213,
15155,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/XMLTokener.java | XMLTokener.nextEntity | public Object nextEntity(char ampersand) throws JSONException {
StringBuilder sb = new StringBuilder();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
break;
} else {
throw syntaxError("Missing ';' in XML entity: &" + sb);
}
}
String string = sb.toString();
Object object = entity.get(string);
return object != null ? object : ampersand + string + ";";
} | java | public Object nextEntity(char ampersand) throws JSONException {
StringBuilder sb = new StringBuilder();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
break;
} else {
throw syntaxError("Missing ';' in XML entity: &" + sb);
}
}
String string = sb.toString();
Object object = entity.get(string);
return object != null ? object : ampersand + string + ";";
} | [
"public",
"Object",
"nextEntity",
"(",
"char",
"ampersand",
")",
"throws",
"JSONException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"char",
"c",
"=",
"next",
"(",
")",
";",
"if",
"(",
"C... | Return the next entity. These entities are translated to Characters: <code>& ' > < "</code>.
@param ampersand An ampersand character.
@return A Character or an entity String if the entity is not recognized.
@throws JSONException If missing ';' in XML entity. | [
"Return",
"the",
"next",
"entity",
".",
"These",
"entities",
"are",
"translated",
"to",
"Characters",
":",
"<code",
">",
"&",
";",
">",
";",
"<",
";",
""",
";",
"<",
"/",
"code",
">",
"."
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/XMLTokener.java#L98-L113 | train | Returns the next entity in the XML. | [
30522,
2270,
4874,
2279,
4765,
3012,
1006,
25869,
23713,
2545,
5685,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
5164,
8569,
23891,
2099,
24829,
1027,
2047,
5164,
8569,
23891,
2099,
1006,
1007,
1025,
2005,
1006,
1025,
1025,
1007,
1063,
258... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/windowing/TopSpeedWindowing.java | TopSpeedWindowing.main | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
env.getConfig().setGlobalJobParameters(params);
@SuppressWarnings({"rawtypes", "serial"})
DataStream<Tuple4<Integer, Integer, Double, Long>> carData;
if (params.has("input")) {
carData = env.readTextFile(params.get("input")).map(new ParseCarData());
} else {
System.out.println("Executing TopSpeedWindowing example with default input data set.");
System.out.println("Use --input to specify file input.");
carData = env.addSource(CarSource.create(2));
}
int evictionSec = 10;
double triggerMeters = 50;
DataStream<Tuple4<Integer, Integer, Double, Long>> topSpeeds = carData
.assignTimestampsAndWatermarks(new CarTimestamp())
.keyBy(0)
.window(GlobalWindows.create())
.evictor(TimeEvictor.of(Time.of(evictionSec, TimeUnit.SECONDS)))
.trigger(DeltaTrigger.of(triggerMeters,
new DeltaFunction<Tuple4<Integer, Integer, Double, Long>>() {
private static final long serialVersionUID = 1L;
@Override
public double getDelta(
Tuple4<Integer, Integer, Double, Long> oldDataPoint,
Tuple4<Integer, Integer, Double, Long> newDataPoint) {
return newDataPoint.f2 - oldDataPoint.f2;
}
}, carData.getType().createSerializer(env.getConfig())))
.maxBy(1);
if (params.has("output")) {
topSpeeds.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
topSpeeds.print();
}
env.execute("CarTopSpeedWindowingExample");
} | java | public static void main(String[] args) throws Exception {
final ParameterTool params = ParameterTool.fromArgs(args);
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime);
env.getConfig().setGlobalJobParameters(params);
@SuppressWarnings({"rawtypes", "serial"})
DataStream<Tuple4<Integer, Integer, Double, Long>> carData;
if (params.has("input")) {
carData = env.readTextFile(params.get("input")).map(new ParseCarData());
} else {
System.out.println("Executing TopSpeedWindowing example with default input data set.");
System.out.println("Use --input to specify file input.");
carData = env.addSource(CarSource.create(2));
}
int evictionSec = 10;
double triggerMeters = 50;
DataStream<Tuple4<Integer, Integer, Double, Long>> topSpeeds = carData
.assignTimestampsAndWatermarks(new CarTimestamp())
.keyBy(0)
.window(GlobalWindows.create())
.evictor(TimeEvictor.of(Time.of(evictionSec, TimeUnit.SECONDS)))
.trigger(DeltaTrigger.of(triggerMeters,
new DeltaFunction<Tuple4<Integer, Integer, Double, Long>>() {
private static final long serialVersionUID = 1L;
@Override
public double getDelta(
Tuple4<Integer, Integer, Double, Long> oldDataPoint,
Tuple4<Integer, Integer, Double, Long> newDataPoint) {
return newDataPoint.f2 - oldDataPoint.f2;
}
}, carData.getType().createSerializer(env.getConfig())))
.maxBy(1);
if (params.has("output")) {
topSpeeds.writeAsText(params.get("output"));
} else {
System.out.println("Printing result to stdout. Use --output to specify output path.");
topSpeeds.print();
}
env.execute("CarTopSpeedWindowingExample");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"ParameterTool",
"params",
"=",
"ParameterTool",
".",
"fromArgs",
"(",
"args",
")",
";",
"final",
"StreamExecutionEnvironment",
"env",
"=",
"StreamEx... | ************************************************************************* | [
"*************************************************************************"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/windowing/TopSpeedWindowing.java#L51-L97 | train | Main method to run the TopSpeedWindowing example. | [
30522,
2270,
10763,
11675,
2364,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
11618,
6453,
1063,
2345,
16381,
3406,
4747,
11498,
5244,
1027,
16381,
3406,
4747,
1012,
2013,
2906,
5620,
1006,
12098,
5620,
1007,
1025,
2345,
5460,
10288,
8586,
13... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/oauth/TokenManager.java | TokenManager.getJwt | private synchronized Jwt getJwt(ICacheStrategy cacheStrategy, Jwt.Key key) {
Jwt result = cacheStrategy.getCachedJwt(key);
if(result == null) {
//cache an empty JWT first.
result = new Jwt(key);
cacheStrategy.cacheJwt(key, result);
}
return result;
} | java | private synchronized Jwt getJwt(ICacheStrategy cacheStrategy, Jwt.Key key) {
Jwt result = cacheStrategy.getCachedJwt(key);
if(result == null) {
//cache an empty JWT first.
result = new Jwt(key);
cacheStrategy.cacheJwt(key, result);
}
return result;
} | [
"private",
"synchronized",
"Jwt",
"getJwt",
"(",
"ICacheStrategy",
"cacheStrategy",
",",
"Jwt",
".",
"Key",
"key",
")",
"{",
"Jwt",
"result",
"=",
"cacheStrategy",
".",
"getCachedJwt",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"/... | cache jwt if not exist | [
"cache",
"jwt",
"if",
"not",
"exist"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/TokenManager.java#L87-L95 | train | Gets the JWT from the cache. | [
30522,
2797,
25549,
1046,
26677,
2131,
3501,
26677,
1006,
24582,
15395,
20528,
2618,
6292,
17053,
20528,
2618,
6292,
1010,
1046,
26677,
1012,
3145,
3145,
1007,
1063,
1046,
26677,
2765,
1027,
17053,
20528,
2618,
6292,
1012,
2131,
3540,
7690,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/DataStream.java | DataStream.windowAll | @PublicEvolving
public <W extends Window> AllWindowedStream<T, W> windowAll(WindowAssigner<? super T, W> assigner) {
return new AllWindowedStream<>(this, assigner);
} | java | @PublicEvolving
public <W extends Window> AllWindowedStream<T, W> windowAll(WindowAssigner<? super T, W> assigner) {
return new AllWindowedStream<>(this, assigner);
} | [
"@",
"PublicEvolving",
"public",
"<",
"W",
"extends",
"Window",
">",
"AllWindowedStream",
"<",
"T",
",",
"W",
">",
"windowAll",
"(",
"WindowAssigner",
"<",
"?",
"super",
"T",
",",
"W",
">",
"assigner",
")",
"{",
"return",
"new",
"AllWindowedStream",
"<>",
... | Windows this data stream to a {@code AllWindowedStream}, which evaluates windows
over a non key grouped stream. Elements are put into windows by a
{@link org.apache.flink.streaming.api.windowing.assigners.WindowAssigner}. The grouping of
elements is done by window.
<p>A {@link org.apache.flink.streaming.api.windowing.triggers.Trigger} can be defined to specify
when windows are evaluated. However, {@code WindowAssigners} have a default {@code Trigger}
that is used if a {@code Trigger} is not specified.
<p>Note: This operation is inherently non-parallel since all elements have to pass through
the same operator instance.
@param assigner The {@code WindowAssigner} that assigns elements to windows.
@return The trigger windows data stream. | [
"Windows",
"this",
"data",
"stream",
"to",
"a",
"{",
"@code",
"AllWindowedStream",
"}",
"which",
"evaluates",
"windows",
"over",
"a",
"non",
"key",
"grouped",
"stream",
".",
"Elements",
"are",
"put",
"into",
"windows",
"by",
"a",
"{",
"@link",
"org",
".",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L815-L818 | train | Returns a stream consisting of all the elements of this stream and all of the elements of the stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1059,
8908,
3332,
1028,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
1059,
1028,
3332,
8095,
1006,
3332,
12054,
23773,
2121,
1026,
1029,
3565,
1056,
1010,
1059,
1028,
23911,
2121,
1007,
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... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/HadoopReduceCombineFunction.java | HadoopReduceCombineFunction.writeObject | private void writeObject(final ObjectOutputStream out) throws IOException {
out.writeObject(reducer.getClass());
out.writeObject(combiner.getClass());
jobConf.write(out);
} | java | private void writeObject(final ObjectOutputStream out) throws IOException {
out.writeObject(reducer.getClass());
out.writeObject(combiner.getClass());
jobConf.write(out);
} | [
"private",
"void",
"writeObject",
"(",
"final",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeObject",
"(",
"reducer",
".",
"getClass",
"(",
")",
")",
";",
"out",
".",
"writeObject",
"(",
"combiner",
".",
"getClass",
"(",
... | Custom serialization methods.
@see <a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html">http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html</a> | [
"Custom",
"serialization",
"methods",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/HadoopReduceCombineFunction.java#L147-L152 | train | Write the object. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
2345,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
16429,
20614,
1006,
5547,
2099,
1012,
2131,
26266,
1006,
1007,
1007,
1025,
2041,
1012,
4339,
16429,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/interactions/Actions.java | Actions.clickAndHold | public Actions clickAndHold() {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerDown(LEFT.asArg()));
} | java | public Actions clickAndHold() {
if (isBuildingActions()) {
action.addAction(new ClickAndHoldAction(jsonMouse, null));
}
return tick(defaultMouse.createPointerDown(LEFT.asArg()));
} | [
"public",
"Actions",
"clickAndHold",
"(",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"ClickAndHoldAction",
"(",
"jsonMouse",
",",
"null",
")",
")",
";",
"}",
"return",
"tick",
"(",
"defaultMouse",
... | Clicks (without releasing) at the current mouse location.
@return A self reference. | [
"Clicks",
"(",
"without",
"releasing",
")",
"at",
"the",
"current",
"mouse",
"location",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L244-L250 | train | Click and hold. | [
30522,
2270,
4506,
11562,
5685,
12640,
1006,
1007,
1063,
2065,
1006,
2003,
25820,
18908,
8496,
1006,
1007,
1007,
1063,
2895,
1012,
5587,
18908,
3258,
1006,
2047,
11562,
5685,
12640,
18908,
3258,
1006,
30524,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/dialect/DialectFactory.java | DialectFactory.internalNewDialect | private static Dialect internalNewDialect(String driverName) {
if (StrUtil.isNotBlank(driverName)) {
if (DRIVER_MYSQL.equalsIgnoreCase(driverName) || DRIVER_MYSQL_V6.equalsIgnoreCase(driverName)) {
return new MysqlDialect();
} else if (DRIVER_ORACLE.equalsIgnoreCase(driverName) || DRIVER_ORACLE_OLD.equalsIgnoreCase(driverName)) {
return new OracleDialect();
} else if (DRIVER_SQLLITE3.equalsIgnoreCase(driverName)) {
return new Sqlite3Dialect();
} else if (DRIVER_POSTGRESQL.equalsIgnoreCase(driverName)) {
return new PostgresqlDialect();
} else if (DRIVER_H2.equalsIgnoreCase(driverName)) {
return new H2Dialect();
} else if (DRIVER_SQLSERVER.equalsIgnoreCase(driverName)) {
return new SqlServer2012Dialect();
}
}
// 无法识别可支持的数据库类型默认使用ANSI方言,可兼容大部分SQL语句
return new AnsiSqlDialect();
} | java | private static Dialect internalNewDialect(String driverName) {
if (StrUtil.isNotBlank(driverName)) {
if (DRIVER_MYSQL.equalsIgnoreCase(driverName) || DRIVER_MYSQL_V6.equalsIgnoreCase(driverName)) {
return new MysqlDialect();
} else if (DRIVER_ORACLE.equalsIgnoreCase(driverName) || DRIVER_ORACLE_OLD.equalsIgnoreCase(driverName)) {
return new OracleDialect();
} else if (DRIVER_SQLLITE3.equalsIgnoreCase(driverName)) {
return new Sqlite3Dialect();
} else if (DRIVER_POSTGRESQL.equalsIgnoreCase(driverName)) {
return new PostgresqlDialect();
} else if (DRIVER_H2.equalsIgnoreCase(driverName)) {
return new H2Dialect();
} else if (DRIVER_SQLSERVER.equalsIgnoreCase(driverName)) {
return new SqlServer2012Dialect();
}
}
// 无法识别可支持的数据库类型默认使用ANSI方言,可兼容大部分SQL语句
return new AnsiSqlDialect();
} | [
"private",
"static",
"Dialect",
"internalNewDialect",
"(",
"String",
"driverName",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"driverName",
")",
")",
"{",
"if",
"(",
"DRIVER_MYSQL",
".",
"equalsIgnoreCase",
"(",
"driverName",
")",
"||",
"DRIVER_MY... | 根据驱动名创建方言<br>
驱动名是不分区大小写完全匹配的
@param driverName JDBC驱动类名
@return 方言 | [
"根据驱动名创建方言<br",
">",
"驱动名是不分区大小写完全匹配的"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/dialect/DialectFactory.java#L83-L101 | train | Creates a new Dialect instance for the given driver name. | [
30522,
2797,
10763,
9329,
4722,
2638,
21724,
4818,
22471,
1006,
5164,
4062,
18442,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
4062,
18442,
1007,
1007,
1063,
2065,
1006,
4062,
1035,
2026,
2015,
4160,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java | HttpServerUpgradeHandler.createUpgradeResponse | private static FullHttpResponse createUpgradeResponse(CharSequence upgradeProtocol) {
DefaultFullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, SWITCHING_PROTOCOLS,
Unpooled.EMPTY_BUFFER, false);
res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE);
res.headers().add(HttpHeaderNames.UPGRADE, upgradeProtocol);
return res;
} | java | private static FullHttpResponse createUpgradeResponse(CharSequence upgradeProtocol) {
DefaultFullHttpResponse res = new DefaultFullHttpResponse(HTTP_1_1, SWITCHING_PROTOCOLS,
Unpooled.EMPTY_BUFFER, false);
res.headers().add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE);
res.headers().add(HttpHeaderNames.UPGRADE, upgradeProtocol);
return res;
} | [
"private",
"static",
"FullHttpResponse",
"createUpgradeResponse",
"(",
"CharSequence",
"upgradeProtocol",
")",
"{",
"DefaultFullHttpResponse",
"res",
"=",
"new",
"DefaultFullHttpResponse",
"(",
"HTTP_1_1",
",",
"SWITCHING_PROTOCOLS",
",",
"Unpooled",
".",
"EMPTY_BUFFER",
... | Creates the 101 Switching Protocols response message. | [
"Creates",
"the",
"101",
"Switching",
"Protocols",
"response",
"message",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandler.java#L355-L361 | train | Creates a new HTTP response with the upgrade protocol and the content. | [
30522,
2797,
10763,
2440,
11039,
25856,
6072,
26029,
3366,
3443,
6279,
24170,
6072,
26029,
3366,
1006,
25869,
3366,
4226,
5897,
12200,
21572,
3406,
25778,
1007,
1063,
12398,
3993,
2140,
11039,
25856,
6072,
26029,
3366,
24501,
1027,
2047,
1239... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-log/src/main/java/cn/hutool/log/LogFactory.java | LogFactory.doCreate | private static LogFactory doCreate() {
try {
return new Slf4jLogFactory(true);
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new Log4j2LogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new Log4jLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new ApacheCommonsLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new TinyLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new JbossLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
// 未找到任何可支持的日志库时判断依据:当JDK Logging的配置文件位于classpath中,使用JDK Logging,否则使用Console
final URL url = ResourceUtil.getResource("logging.properties");
return (null != url) ? new JdkLogFactory() : new ConsoleLogFactory();
} | java | private static LogFactory doCreate() {
try {
return new Slf4jLogFactory(true);
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new Log4j2LogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new Log4jLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new ApacheCommonsLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new TinyLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
try {
return new JbossLogFactory();
} catch (NoClassDefFoundError e) {
// ignore
}
// 未找到任何可支持的日志库时判断依据:当JDK Logging的配置文件位于classpath中,使用JDK Logging,否则使用Console
final URL url = ResourceUtil.getResource("logging.properties");
return (null != url) ? new JdkLogFactory() : new ConsoleLogFactory();
} | [
"private",
"static",
"LogFactory",
"doCreate",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"Slf4jLogFactory",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
"// ignore\r",
"}",
"try",
"{",
"return",
"new",
"Log4j2LogFactory"... | 决定日志实现
<p>
依次按照顺序检查日志库的jar是否被引入,如果未引入任何日志库,则检查ClassPath下的logging.properties,存在则使用JdkLogFactory,否则使用ConsoleLogFactory
@see Slf4jLogFactory
@see Log4j2LogFactory
@see Log4jLogFactory
@see ApacheCommonsLogFactory
@see TinyLogFactory
@see JbossLogFactory
@see ConsoleLogFactory
@see JdkLogFactory
@return 日志实现类 | [
"决定日志实现",
"<p",
">",
"依次按照顺序检查日志库的jar是否被引入,如果未引入任何日志库,则检查ClassPath下的logging",
".",
"properties,存在则使用JdkLogFactory,否则使用ConsoleLogFactory"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/LogFactory.java#L226-L261 | train | Creates a new instance of the LogFactory class. | [
30522,
2797,
10763,
8833,
21450,
9986,
29313,
1006,
1007,
1063,
3046,
1063,
2709,
2047,
22889,
2546,
2549,
3501,
21197,
21450,
1006,
2995,
1007,
1025,
1065,
4608,
1006,
2053,
26266,
3207,
4246,
28819,
2121,
29165,
1041,
1007,
1063,
1013,
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-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.setFontStyle | public static Font setFontStyle(Font font, short color, short fontSize, String fontName) {
if(color > 0) {
font.setColor(color);
}
if(fontSize > 0) {
font.setFontHeightInPoints(fontSize);
}
if(StrUtil.isNotBlank(fontName)) {
font.setFontName(fontName);
}
return font;
} | java | public static Font setFontStyle(Font font, short color, short fontSize, String fontName) {
if(color > 0) {
font.setColor(color);
}
if(fontSize > 0) {
font.setFontHeightInPoints(fontSize);
}
if(StrUtil.isNotBlank(fontName)) {
font.setFontName(fontName);
}
return font;
} | [
"public",
"static",
"Font",
"setFontStyle",
"(",
"Font",
"font",
",",
"short",
"color",
",",
"short",
"fontSize",
",",
"String",
"fontName",
")",
"{",
"if",
"(",
"color",
">",
"0",
")",
"{",
"font",
".",
"setColor",
"(",
"color",
")",
";",
"}",
"if",... | 设置字体样式
@param font 字体{@link Font}
@param color 字体颜色
@param fontSize 字体大小
@param fontName 字体名称,可以为null使用默认字体
@return {@link Font} | [
"设置字体样式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L134-L145 | train | Sets the font style. | [
30522,
2270,
10763,
15489,
2275,
14876,
7666,
27983,
1006,
15489,
15489,
1010,
2460,
3609,
1010,
2460,
15489,
5332,
4371,
1010,
5164,
15489,
18442,
1007,
1063,
2065,
1006,
3609,
1028,
1014,
1007,
1063,
15489,
1012,
2275,
18717,
1006,
3609,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/deployment/TaskDeploymentDescriptor.java | TaskDeploymentDescriptor.getSerializedJobInformation | @Nullable
public SerializedValue<JobInformation> getSerializedJobInformation() {
if (serializedJobInformation instanceof NonOffloaded) {
NonOffloaded<JobInformation> jobInformation =
(NonOffloaded<JobInformation>) serializedJobInformation;
return jobInformation.serializedValue;
} else {
throw new IllegalStateException(
"Trying to work with offloaded serialized job information.");
}
} | java | @Nullable
public SerializedValue<JobInformation> getSerializedJobInformation() {
if (serializedJobInformation instanceof NonOffloaded) {
NonOffloaded<JobInformation> jobInformation =
(NonOffloaded<JobInformation>) serializedJobInformation;
return jobInformation.serializedValue;
} else {
throw new IllegalStateException(
"Trying to work with offloaded serialized job information.");
}
} | [
"@",
"Nullable",
"public",
"SerializedValue",
"<",
"JobInformation",
">",
"getSerializedJobInformation",
"(",
")",
"{",
"if",
"(",
"serializedJobInformation",
"instanceof",
"NonOffloaded",
")",
"{",
"NonOffloaded",
"<",
"JobInformation",
">",
"jobInformation",
"=",
"(... | Return the sub task's serialized job information.
@return serialized job information (may be <tt>null</tt> before a call to {@link
#loadBigData(PermanentBlobService)}). | [
"Return",
"the",
"sub",
"task",
"s",
"serialized",
"job",
"information",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/deployment/TaskDeploymentDescriptor.java#L191-L201 | train | Returns the serialized job information. | [
30522,
1030,
19701,
3085,
2270,
27289,
10175,
5657,
1026,
3105,
2378,
14192,
3370,
1028,
4152,
11610,
28931,
5558,
8428,
14192,
3370,
1006,
1007,
1063,
2065,
1006,
27289,
5558,
8428,
14192,
3370,
6013,
11253,
2512,
7245,
17468,
1007,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java | ResultPartitionMetrics.refreshAndGetMax | int refreshAndGetMax() {
int max = 0;
for (ResultSubpartition part : partition.getAllPartitions()) {
int size = part.unsynchronizedGetNumberOfQueuedBuffers();
max = Math.max(max, size);
}
return max;
} | java | int refreshAndGetMax() {
int max = 0;
for (ResultSubpartition part : partition.getAllPartitions()) {
int size = part.unsynchronizedGetNumberOfQueuedBuffers();
max = Math.max(max, size);
}
return max;
} | [
"int",
"refreshAndGetMax",
"(",
")",
"{",
"int",
"max",
"=",
"0",
";",
"for",
"(",
"ResultSubpartition",
"part",
":",
"partition",
".",
"getAllPartitions",
"(",
")",
")",
"{",
"int",
"size",
"=",
"part",
".",
"unsynchronizedGetNumberOfQueuedBuffers",
"(",
")... | Iterates over all sub-partitions and collects the maximum number of queued buffers in a
sub-partition in a best-effort way.
@return maximum number of queued buffers per sub-partition | [
"Iterates",
"over",
"all",
"sub",
"-",
"partitions",
"and",
"collects",
"the",
"maximum",
"number",
"of",
"queued",
"buffers",
"in",
"a",
"sub",
"-",
"partition",
"in",
"a",
"best",
"-",
"effort",
"way",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java#L88-L97 | train | Refresh the max number of queued buffers in the result sub - partitions. | [
30522,
20014,
25416,
21898,
5685,
18150,
17848,
1006,
1007,
1063,
20014,
4098,
1027,
1014,
1025,
2005,
1006,
3463,
12083,
19362,
3775,
3508,
2112,
1024,
13571,
1012,
2131,
8095,
19362,
3775,
9285,
1006,
1007,
1007,
1063,
20014,
2946,
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-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.digest | public byte[] digest(String data, String charset) {
return digest(StrUtil.bytes(data, charset));
} | java | public byte[] digest(String data, String charset) {
return digest(StrUtil.bytes(data, charset));
} | [
"public",
"byte",
"[",
"]",
"digest",
"(",
"String",
"data",
",",
"String",
"charset",
")",
"{",
"return",
"digest",
"(",
"StrUtil",
".",
"bytes",
"(",
"data",
",",
"charset",
")",
")",
";",
"}"
] | 生成文件摘要
@param data 被摘要数据
@param charset 编码
@return 摘要 | [
"生成文件摘要"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L103-L105 | train | Computes the digest of the given string. | [
30522,
2270,
24880,
1031,
1033,
17886,
1006,
5164,
2951,
1010,
5164,
25869,
13462,
1007,
1063,
2709,
17886,
1006,
2358,
22134,
4014,
1012,
27507,
1006,
2951,
1010,
25869,
13462,
1007,
1007,
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,
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/operators/UnsortedGrouping.java | UnsortedGrouping.sum | public AggregateOperator<T> sum (int field) {
return this.aggregate (Aggregations.SUM, field, Utils.getCallLocationName());
} | java | public AggregateOperator<T> sum (int field) {
return this.aggregate (Aggregations.SUM, field, Utils.getCallLocationName());
} | [
"public",
"AggregateOperator",
"<",
"T",
">",
"sum",
"(",
"int",
"field",
")",
"{",
"return",
"this",
".",
"aggregate",
"(",
"Aggregations",
".",
"SUM",
",",
"field",
",",
"Utils",
".",
"getCallLocationName",
"(",
")",
")",
";",
"}"
] | Syntactic sugar for aggregate (SUM, field).
@param field The index of the Tuple field on which the aggregation function is applied.
@return An AggregateOperator that represents the summed DataSet.
@see org.apache.flink.api.java.operators.AggregateOperator | [
"Syntactic",
"sugar",
"for",
"aggregate",
"(",
"SUM",
"field",
")",
".",
"@param",
"field",
"The",
"index",
"of",
"the",
"Tuple",
"field",
"on",
"which",
"the",
"aggregation",
"function",
"is",
"applied",
".",
"@return",
"An",
"AggregateOperator",
"that",
"r... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/UnsortedGrouping.java#L103-L105 | train | Create an aggregate that aggregates the results of a query on the specified field using the sum function. | [
30522,
2270,
9572,
25918,
8844,
1026,
1056,
1028,
7680,
1006,
20014,
2492,
1007,
1063,
2709,
2023,
1012,
9572,
1006,
28041,
2015,
1012,
7680,
1010,
2492,
1010,
21183,
12146,
1012,
2131,
9289,
7174,
10719,
18442,
1006,
1007,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/concurrent/SingleThreadEventExecutor.java | SingleThreadEventExecutor.interruptThread | protected void interruptThread() {
Thread currentThread = thread;
if (currentThread == null) {
interrupted = true;
} else {
currentThread.interrupt();
}
} | java | protected void interruptThread() {
Thread currentThread = thread;
if (currentThread == null) {
interrupted = true;
} else {
currentThread.interrupt();
}
} | [
"protected",
"void",
"interruptThread",
"(",
")",
"{",
"Thread",
"currentThread",
"=",
"thread",
";",
"if",
"(",
"currentThread",
"==",
"null",
")",
"{",
"interrupted",
"=",
"true",
";",
"}",
"else",
"{",
"currentThread",
".",
"interrupt",
"(",
")",
";",
... | Interrupt the current running {@link Thread}. | [
"Interrupt",
"the",
"current",
"running",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L191-L198 | train | Interrupt the current thread. | [
30522,
5123,
11675,
17938,
2705,
16416,
2094,
1006,
1007,
1063,
11689,
2783,
2705,
16416,
2094,
1027,
11689,
1025,
2065,
1006,
2783,
2705,
16416,
2094,
1027,
1027,
19701,
1007,
1063,
7153,
1027,
2995,
1025,
1065,
2842,
1063,
2783,
2705,
164... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/StreamProjection.java | StreamProjection.projectTuple1 | public <T0> SingleOutputStreamOperator<Tuple1<T0>> projectTuple1() {
TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType());
TupleTypeInfo<Tuple1<T0>> tType = new TupleTypeInfo<Tuple1<T0>>(fTypes);
return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple1<T0>>(
fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig())));
} | java | public <T0> SingleOutputStreamOperator<Tuple1<T0>> projectTuple1() {
TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType());
TupleTypeInfo<Tuple1<T0>> tType = new TupleTypeInfo<Tuple1<T0>>(fTypes);
return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple1<T0>>(
fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig())));
} | [
"public",
"<",
"T0",
">",
"SingleOutputStreamOperator",
"<",
"Tuple1",
"<",
"T0",
">",
">",
"projectTuple1",
"(",
")",
"{",
"TypeInformation",
"<",
"?",
">",
"[",
"]",
"fTypes",
"=",
"extractFieldTypes",
"(",
"fieldIndexes",
",",
"dataStream",
".",
"getType"... | Projects a {@link Tuple} {@link DataStream} to the previously selected fields.
@return The projected DataStream.
@see Tuple
@see DataStream | [
"Projects",
"a",
"{",
"@link",
"Tuple",
"}",
"{",
"@link",
"DataStream",
"}",
"to",
"the",
"previously",
"selected",
"fields",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java#L133-L139 | train | Project a tuple1 to a SingleOutputStreamOperator | [
30522,
2270,
1026,
1056,
2692,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
10722,
10814,
2487,
1026,
1056,
2692,
1028,
1028,
2622,
8525,
10814,
2487,
1006,
1007,
1063,
2828,
2378,
14192,
3370,
1026,
1029,
1028,
1031,
1033,
3027,
1886... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/webservices/client/WebServiceTemplateBuilder.java | WebServiceTemplateBuilder.configure | public <T extends WebServiceTemplate> T configure(T webServiceTemplate) {
Assert.notNull(webServiceTemplate, "WebServiceTemplate must not be null");
configureMessageSenders(webServiceTemplate);
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
applyCustomizers(webServiceTemplate, this.internalCustomizers);
map.from(this.marshaller).to(webServiceTemplate::setMarshaller);
map.from(this.unmarshaller).to(webServiceTemplate::setUnmarshaller);
map.from(this.destinationProvider).to(webServiceTemplate::setDestinationProvider);
map.from(this.transformerFactoryClass)
.to(webServiceTemplate::setTransformerFactoryClass);
map.from(this.messageFactory).to(webServiceTemplate::setMessageFactory);
if (!CollectionUtils.isEmpty(this.interceptors)) {
Set<ClientInterceptor> merged = new LinkedHashSet<>(this.interceptors);
if (webServiceTemplate.getInterceptors() != null) {
merged.addAll(Arrays.asList(webServiceTemplate.getInterceptors()));
}
webServiceTemplate.setInterceptors(merged.toArray(new ClientInterceptor[0]));
}
applyCustomizers(webServiceTemplate, this.customizers);
return webServiceTemplate;
} | java | public <T extends WebServiceTemplate> T configure(T webServiceTemplate) {
Assert.notNull(webServiceTemplate, "WebServiceTemplate must not be null");
configureMessageSenders(webServiceTemplate);
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
applyCustomizers(webServiceTemplate, this.internalCustomizers);
map.from(this.marshaller).to(webServiceTemplate::setMarshaller);
map.from(this.unmarshaller).to(webServiceTemplate::setUnmarshaller);
map.from(this.destinationProvider).to(webServiceTemplate::setDestinationProvider);
map.from(this.transformerFactoryClass)
.to(webServiceTemplate::setTransformerFactoryClass);
map.from(this.messageFactory).to(webServiceTemplate::setMessageFactory);
if (!CollectionUtils.isEmpty(this.interceptors)) {
Set<ClientInterceptor> merged = new LinkedHashSet<>(this.interceptors);
if (webServiceTemplate.getInterceptors() != null) {
merged.addAll(Arrays.asList(webServiceTemplate.getInterceptors()));
}
webServiceTemplate.setInterceptors(merged.toArray(new ClientInterceptor[0]));
}
applyCustomizers(webServiceTemplate, this.customizers);
return webServiceTemplate;
} | [
"public",
"<",
"T",
"extends",
"WebServiceTemplate",
">",
"T",
"configure",
"(",
"T",
"webServiceTemplate",
")",
"{",
"Assert",
".",
"notNull",
"(",
"webServiceTemplate",
",",
"\"WebServiceTemplate must not be null\"",
")",
";",
"configureMessageSenders",
"(",
"webSer... | Configure the provided {@link WebServiceTemplate} instance using this builder.
@param <T> the type of web service template
@param webServiceTemplate the {@link WebServiceTemplate} to configure
@return the web service template instance
@see #build()
@see #build(Class) | [
"Configure",
"the",
"provided",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/webservices/client/WebServiceTemplateBuilder.java#L500-L520 | train | Configure the given web service template. | [
30522,
2270,
1026,
1056,
8908,
4773,
8043,
7903,
12870,
8737,
13806,
1028,
1056,
9530,
8873,
27390,
2063,
1006,
1056,
4773,
8043,
7903,
12870,
8737,
13806,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
4773,
8043,
7903,
12870,
8737,
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/util/ReflectUtil.java | ReflectUtil.invoke | public static <T> T invoke(Object obj, String methodName, Object... args) throws UtilException {
final Method method = getMethodOfObj(obj, methodName, args);
if (null == method) {
throw new UtilException(StrUtil.format("No such method: [{}]", methodName));
}
return invoke(obj, method, args);
} | java | public static <T> T invoke(Object obj, String methodName, Object... args) throws UtilException {
final Method method = getMethodOfObj(obj, methodName, args);
if (null == method) {
throw new UtilException(StrUtil.format("No such method: [{}]", methodName));
}
return invoke(obj, method, args);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invoke",
"(",
"Object",
"obj",
",",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"UtilException",
"{",
"final",
"Method",
"method",
"=",
"getMethodOfObj",
"(",
"obj",
",",
"methodName",
",",
... | 执行对象中指定方法
@param <T> 返回对象类型
@param obj 方法所在对象
@param methodName 方法名
@param args 参数列表
@return 执行结果
@throws UtilException IllegalAccessException包装
@since 3.1.2 | [
"执行对象中指定方法"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L806-L812 | train | Invoke a method on the specified object. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1999,
6767,
3489,
1006,
4874,
27885,
3501,
1010,
5164,
4118,
18442,
1010,
4874,
1012,
1012,
1012,
12098,
5620,
1007,
11618,
21183,
9463,
2595,
24422,
1063,
2345,
4118,
4118,
1027,
2131,
11368,
680... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 | core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSorterSpillMerger.java | UnsafeSorterSpillMerger.addSpillIfNotEmpty | public void addSpillIfNotEmpty(UnsafeSorterIterator spillReader) throws IOException {
if (spillReader.hasNext()) {
// We only add the spillReader to the priorityQueue if it is not empty. We do this to
// make sure the hasNext method of UnsafeSorterIterator returned by getSortedIterator
// does not return wrong result because hasNext will return true
// at least priorityQueue.size() times. If we allow n spillReaders in the
// priorityQueue, we will have n extra empty records in the result of UnsafeSorterIterator.
spillReader.loadNext();
priorityQueue.add(spillReader);
numRecords += spillReader.getNumRecords();
}
} | java | public void addSpillIfNotEmpty(UnsafeSorterIterator spillReader) throws IOException {
if (spillReader.hasNext()) {
// We only add the spillReader to the priorityQueue if it is not empty. We do this to
// make sure the hasNext method of UnsafeSorterIterator returned by getSortedIterator
// does not return wrong result because hasNext will return true
// at least priorityQueue.size() times. If we allow n spillReaders in the
// priorityQueue, we will have n extra empty records in the result of UnsafeSorterIterator.
spillReader.loadNext();
priorityQueue.add(spillReader);
numRecords += spillReader.getNumRecords();
}
} | [
"public",
"void",
"addSpillIfNotEmpty",
"(",
"UnsafeSorterIterator",
"spillReader",
")",
"throws",
"IOException",
"{",
"if",
"(",
"spillReader",
".",
"hasNext",
"(",
")",
")",
"{",
"// We only add the spillReader to the priorityQueue if it is not empty. We do this to",
"// ma... | Add an UnsafeSorterIterator to this merger | [
"Add",
"an",
"UnsafeSorterIterator",
"to",
"this",
"merger"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSorterSpillMerger.java#L50-L61 | train | Add a UnsafeSorterIterator to the priorityQueue if it is not empty. | [
30522,
2270,
11675,
9909,
8197,
6894,
2546,
22074,
27718,
2100,
1006,
25135,
21748,
3334,
21646,
8844,
14437,
16416,
4063,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
14437,
16416,
4063,
1012,
8440,
10288,
2102,
1006,
1007,
1007,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/config/MasterSlaveServersConfig.java | MasterSlaveServersConfig.addSlaveAddress | public MasterSlaveServersConfig addSlaveAddress(String... addresses) {
for (String address : addresses) {
slaveAddresses.add(URIBuilder.create(address));
}
return this;
} | java | public MasterSlaveServersConfig addSlaveAddress(String... addresses) {
for (String address : addresses) {
slaveAddresses.add(URIBuilder.create(address));
}
return this;
} | [
"public",
"MasterSlaveServersConfig",
"addSlaveAddress",
"(",
"String",
"...",
"addresses",
")",
"{",
"for",
"(",
"String",
"address",
":",
"addresses",
")",
"{",
"slaveAddresses",
".",
"add",
"(",
"URIBuilder",
".",
"create",
"(",
"address",
")",
")",
";",
... | Add Redis slave server address. Use follow format -- host:port
@param addresses of Redis
@return config | [
"Add",
"Redis",
"slave",
"server",
"address",
".",
"Use",
"follow",
"format",
"--",
"host",
":",
"port"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/MasterSlaveServersConfig.java#L87-L92 | train | Add a slave address to the configuration. | [
30522,
2270,
5972,
14973,
6810,
2099,
14028,
8663,
8873,
2290,
9909,
14973,
13775,
16200,
4757,
1006,
5164,
1012,
1012,
1012,
11596,
1007,
1063,
2005,
1006,
5164,
4769,
1024,
11596,
1007,
1063,
6658,
4215,
16200,
11393,
2015,
1012,
5587,
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/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIServiceUtils.java | CLIServiceUtils.patternToRegex | public static String patternToRegex(String pattern) {
if (pattern == null) {
return ".*";
} else {
StringBuilder result = new StringBuilder(pattern.length());
boolean escaped = false;
for (int i = 0, len = pattern.length(); i < len; i++) {
char c = pattern.charAt(i);
if (escaped) {
if (c != SEARCH_STRING_ESCAPE) {
escaped = false;
}
result.append(c);
} else {
if (c == SEARCH_STRING_ESCAPE) {
escaped = true;
continue;
} else if (c == '%') {
result.append(".*");
} else if (c == '_') {
result.append('.');
} else {
result.append(Character.toLowerCase(c));
}
}
}
return result.toString();
}
} | java | public static String patternToRegex(String pattern) {
if (pattern == null) {
return ".*";
} else {
StringBuilder result = new StringBuilder(pattern.length());
boolean escaped = false;
for (int i = 0, len = pattern.length(); i < len; i++) {
char c = pattern.charAt(i);
if (escaped) {
if (c != SEARCH_STRING_ESCAPE) {
escaped = false;
}
result.append(c);
} else {
if (c == SEARCH_STRING_ESCAPE) {
escaped = true;
continue;
} else if (c == '%') {
result.append(".*");
} else if (c == '_') {
result.append('.');
} else {
result.append(Character.toLowerCase(c));
}
}
}
return result.toString();
}
} | [
"public",
"static",
"String",
"patternToRegex",
"(",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"return",
"\".*\"",
";",
"}",
"else",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
"pattern",
".",
"lengt... | Convert a SQL search pattern into an equivalent Java Regex.
@param pattern input which may contain '%' or '_' wildcard characters, or
these characters escaped using {@code getSearchStringEscape()}.
@return replace %/_ with regex search characters, also handle escaped
characters. | [
"Convert",
"a",
"SQL",
"search",
"pattern",
"into",
"an",
"equivalent",
"Java",
"Regex",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIServiceUtils.java#L45-L74 | train | Convert a string to a regex pattern. | [
30522,
2270,
10763,
5164,
5418,
19277,
3351,
2595,
1006,
5164,
5418,
1007,
1063,
2065,
1006,
5418,
1027,
1027,
19701,
1007,
1063,
2709,
1000,
1012,
1008,
1000,
1025,
1065,
2842,
1063,
5164,
8569,
23891,
2099,
2765,
1027,
2047,
5164,
8569,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/convert/Convert.java | Convert.toNumber | public static Number toNumber(Object value, Number defaultValue) {
return convert(Number.class, value, defaultValue);
} | java | public static Number toNumber(Object value, Number defaultValue) {
return convert(Number.class, value, defaultValue);
} | [
"public",
"static",
"Number",
"toNumber",
"(",
"Object",
"value",
",",
"Number",
"defaultValue",
")",
"{",
"return",
"convert",
"(",
"Number",
".",
"class",
",",
"value",
",",
"defaultValue",
")",
";",
"}"
] | 转换为Number<br>
如果给定的值为空,或者转换失败,返回默认值<br>
转换失败不会报错
@param value 被转换的值
@param defaultValue 转换错误时的默认值
@return 结果 | [
"转换为Number<br",
">",
"如果给定的值为空,或者转换失败,返回默认值<br",
">",
"转换失败不会报错"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L185-L187 | train | Converts value to Number. | [
30522,
2270,
10763,
2193,
10228,
29440,
1006,
4874,
3643,
1010,
2193,
12398,
10175,
5657,
1007,
1063,
2709,
10463,
1006,
2193,
1012,
2465,
1010,
3643,
1010,
12398,
10175,
5657,
1007,
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,
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/iterator/RocksStatesPerKeyGroupMergeIterator.java | RocksStatesPerKeyGroupMergeIterator.next | public void next() {
newKeyGroup = false;
newKVState = false;
final RocksIteratorWrapper rocksIterator = currentSubIterator.getIterator();
rocksIterator.next();
byte[] oldKey = currentSubIterator.getCurrentKey();
if (rocksIterator.isValid()) {
currentSubIterator.setCurrentKey(rocksIterator.key());
if (isDifferentKeyGroup(oldKey, currentSubIterator.getCurrentKey())) {
heap.offer(currentSubIterator);
currentSubIterator = heap.remove();
newKVState = currentSubIterator.getIterator() != rocksIterator;
detectNewKeyGroup(oldKey);
}
} else {
IOUtils.closeQuietly(rocksIterator);
if (heap.isEmpty()) {
currentSubIterator = null;
valid = false;
} else {
currentSubIterator = heap.remove();
newKVState = true;
detectNewKeyGroup(oldKey);
}
}
} | java | public void next() {
newKeyGroup = false;
newKVState = false;
final RocksIteratorWrapper rocksIterator = currentSubIterator.getIterator();
rocksIterator.next();
byte[] oldKey = currentSubIterator.getCurrentKey();
if (rocksIterator.isValid()) {
currentSubIterator.setCurrentKey(rocksIterator.key());
if (isDifferentKeyGroup(oldKey, currentSubIterator.getCurrentKey())) {
heap.offer(currentSubIterator);
currentSubIterator = heap.remove();
newKVState = currentSubIterator.getIterator() != rocksIterator;
detectNewKeyGroup(oldKey);
}
} else {
IOUtils.closeQuietly(rocksIterator);
if (heap.isEmpty()) {
currentSubIterator = null;
valid = false;
} else {
currentSubIterator = heap.remove();
newKVState = true;
detectNewKeyGroup(oldKey);
}
}
} | [
"public",
"void",
"next",
"(",
")",
"{",
"newKeyGroup",
"=",
"false",
";",
"newKVState",
"=",
"false",
";",
"final",
"RocksIteratorWrapper",
"rocksIterator",
"=",
"currentSubIterator",
".",
"getIterator",
"(",
")",
";",
"rocksIterator",
".",
"next",
"(",
")",
... | Advances the iterator. Should only be called if {@link #isValid()} returned true.
Valid flag can only change after calling {@link #next()}. | [
"Advances",
"the",
"iterator",
".",
"Should",
"only",
"be",
"called",
"if",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/iterator/RocksStatesPerKeyGroupMergeIterator.java#L86-L116 | train | Move to the next key. | [
30522,
2270,
11675,
2279,
1006,
1007,
1063,
2047,
14839,
17058,
1027,
6270,
1025,
2047,
2243,
15088,
12259,
1027,
6270,
1025,
2345,
5749,
21646,
8844,
13088,
29098,
2121,
5749,
21646,
8844,
1027,
14731,
12083,
21646,
8844,
1012,
2131,
21646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/DictionaryUtil.java | DictionaryUtil.sortDictionary | public static boolean sortDictionary(String path)
{
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
TreeMap<String, String> map = new TreeMap<String, String>();
String line;
while ((line = br.readLine()) != null)
{
String[] param = line.split("\\s");
map.put(param[0], line);
}
br.close();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, String> entry : map.entrySet())
{
bw.write(entry.getValue());
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
return true;
} | java | public static boolean sortDictionary(String path)
{
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(IOUtil.newInputStream(path), "UTF-8"));
TreeMap<String, String> map = new TreeMap<String, String>();
String line;
while ((line = br.readLine()) != null)
{
String[] param = line.split("\\s");
map.put(param[0], line);
}
br.close();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
for (Map.Entry<String, String> entry : map.entrySet())
{
bw.write(entry.getValue());
bw.newLine();
}
bw.close();
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"sortDictionary",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"IOUtil",
".",
"newInputStream",
"(",
"path",
")",
",",
"\"UTF-8\"",
")",
... | 给某个字典排序
@param path
@return | [
"给某个字典排序"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/util/DictionaryUtil.java#L30-L60 | train | Sort dictionary. | [
30522,
2270,
10763,
22017,
20898,
4066,
29201,
3258,
5649,
1006,
5164,
4130,
1007,
1063,
3046,
1063,
17698,
2098,
16416,
4063,
7987,
1027,
2047,
17698,
2098,
16416,
4063,
1006,
2047,
20407,
25379,
16416,
4063,
1006,
22834,
21823,
2140,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.ls | public List<String> ls(String path, final Filter<LsEntry> filter) {
final List<String> fileNames = new ArrayList<>();
try {
channel.ls(path, new LsEntrySelector() {
@Override
public int select(LsEntry entry) {
String fileName = entry.getFilename();
if (false == StrUtil.equals(".", fileName) && false == StrUtil.equals("..", fileName)) {
if (null == filter || filter.accept(entry)) {
fileNames.add(entry.getFilename());
}
}
return CONTINUE;
}
});
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return fileNames;
} | java | public List<String> ls(String path, final Filter<LsEntry> filter) {
final List<String> fileNames = new ArrayList<>();
try {
channel.ls(path, new LsEntrySelector() {
@Override
public int select(LsEntry entry) {
String fileName = entry.getFilename();
if (false == StrUtil.equals(".", fileName) && false == StrUtil.equals("..", fileName)) {
if (null == filter || filter.accept(entry)) {
fileNames.add(entry.getFilename());
}
}
return CONTINUE;
}
});
} catch (SftpException e) {
throw new JschRuntimeException(e);
}
return fileNames;
} | [
"public",
"List",
"<",
"String",
">",
"ls",
"(",
"String",
"path",
",",
"final",
"Filter",
"<",
"LsEntry",
">",
"filter",
")",
"{",
"final",
"List",
"<",
"String",
">",
"fileNames",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"channel",... | 遍历某个目录下所有文件或目录,不会递归遍历
@param path 遍历某个目录下所有文件或目录
@param filter 文件或目录过滤器,可以实现过滤器返回自己需要的文件或目录名列表
@return 目录或文件名列表
@since 4.0.5 | [
"遍历某个目录下所有文件或目录,不会递归遍历"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L239-L258 | train | Returns a list of filenames from the specified path. | [
30522,
2270,
2862,
1026,
5164,
1028,
1048,
2015,
1006,
5164,
4130,
1010,
2345,
11307,
1026,
1048,
5054,
11129,
1028,
11307,
1007,
1063,
2345,
2862,
1026,
5164,
1028,
5371,
18442,
2015,
1027,
2047,
9140,
9863,
1026,
1028,
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... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getParamMap | public static Map<String, String> getParamMap(ServletRequest request) {
Map<String, String> params = new HashMap<String, String>();
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA));
}
return params;
} | java | public static Map<String, String> getParamMap(ServletRequest request) {
Map<String, String> params = new HashMap<String, String>();
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA));
}
return params;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getParamMap",
"(",
"ServletRequest",
"request",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",... | 获得所有请求参数
@param request 请求对象{@link ServletRequest}
@return Map | [
"获得所有请求参数"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L73-L79 | train | Returns a map of parameters from the servlet request. | [
30522,
2270,
10763,
4949,
1026,
5164,
1010,
5164,
1028,
2131,
28689,
14760,
2361,
1006,
14262,
2615,
7485,
2890,
15500,
5227,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
11498,
5244,
1027,
2047,
23325,
2863,
2361,
1026,
5164,
1010,
5164... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.