repo stringclasses 11 values | path stringlengths 41 234 | func_name stringlengths 5 78 | original_string stringlengths 71 14.1k | language stringclasses 1 value | code stringlengths 71 14.1k | code_tokens listlengths 22 2.65k | docstring stringlengths 2 5.35k | docstring_tokens listlengths 1 369 | sha stringclasses 11 values | url stringlengths 129 339 | partition stringclasses 1 value | summary stringlengths 7 175 | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/crf/crfpp/EncoderFeatureIndex.java | EncoderFeatureIndex.openTagSet | private boolean openTagSet(String filename)
{
int max_size = 0;
InputStreamReader isr = null;
y_.clear();
try
{
isr = new InputStreamReader(IOUtil.newInputStream(filename), "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null)
{
if (line.length() == 0)
{
continue;
}
char firstChar = line.charAt(0);
if (firstChar == '\0' || firstChar == ' ' || firstChar == '\t')
{
continue;
}
String[] cols = line.split("[\t ]", -1);
if (max_size == 0)
{
max_size = cols.length;
}
if (max_size != cols.length)
{
String msg = "inconsistent column size: " + max_size +
" " + cols.length + " " + filename;
throw new RuntimeException(msg);
}
xsize_ = cols.length - 1;
if (y_.indexOf(cols[max_size - 1]) == -1)
{
y_.add(cols[max_size - 1]);
}
}
Collections.sort(y_);
br.close();
}
catch (Exception e)
{
if (isr != null)
{
try
{
isr.close();
}
catch (Exception e2)
{
}
}
e.printStackTrace();
System.err.println("Error reading " + filename);
return false;
}
return true;
} | java | private boolean openTagSet(String filename)
{
int max_size = 0;
InputStreamReader isr = null;
y_.clear();
try
{
isr = new InputStreamReader(IOUtil.newInputStream(filename), "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null)
{
if (line.length() == 0)
{
continue;
}
char firstChar = line.charAt(0);
if (firstChar == '\0' || firstChar == ' ' || firstChar == '\t')
{
continue;
}
String[] cols = line.split("[\t ]", -1);
if (max_size == 0)
{
max_size = cols.length;
}
if (max_size != cols.length)
{
String msg = "inconsistent column size: " + max_size +
" " + cols.length + " " + filename;
throw new RuntimeException(msg);
}
xsize_ = cols.length - 1;
if (y_.indexOf(cols[max_size - 1]) == -1)
{
y_.add(cols[max_size - 1]);
}
}
Collections.sort(y_);
br.close();
}
catch (Exception e)
{
if (isr != null)
{
try
{
isr.close();
}
catch (Exception e2)
{
}
}
e.printStackTrace();
System.err.println("Error reading " + filename);
return false;
}
return true;
} | [
"private",
"boolean",
"openTagSet",
"(",
"String",
"filename",
")",
"{",
"int",
"max_size",
"=",
"0",
";",
"InputStreamReader",
"isr",
"=",
"null",
";",
"y_",
".",
"clear",
"(",
")",
";",
"try",
"{",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"IOUtil",... | 读取训练文件中的标注集
@param filename
@return | [
"读取训练文件中的标注集"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/EncoderFeatureIndex.java#L129-L187 | train | This method is called to set the openTagSet method of the class. | [
30522,
2797,
22017,
20898,
2330,
15900,
13462,
1006,
5164,
5371,
18442,
1007,
1063,
20014,
4098,
1035,
2946,
1027,
1014,
1025,
20407,
25379,
16416,
4063,
2003,
2099,
1027,
19701,
1025,
1061,
1035,
1012,
3154,
1006,
1007,
1025,
3046,
1063,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java | HttpTunnelPayload.assignTo | public void assignTo(HttpOutputMessage message) throws IOException {
Assert.notNull(message, "Message must not be null");
HttpHeaders headers = message.getHeaders();
headers.setContentLength(this.data.remaining());
headers.add(SEQ_HEADER, Long.toString(getSequence()));
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
WritableByteChannel body = Channels.newChannel(message.getBody());
while (this.data.hasRemaining()) {
body.write(this.data);
}
body.close();
} | java | public void assignTo(HttpOutputMessage message) throws IOException {
Assert.notNull(message, "Message must not be null");
HttpHeaders headers = message.getHeaders();
headers.setContentLength(this.data.remaining());
headers.add(SEQ_HEADER, Long.toString(getSequence()));
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
WritableByteChannel body = Channels.newChannel(message.getBody());
while (this.data.hasRemaining()) {
body.write(this.data);
}
body.close();
} | [
"public",
"void",
"assignTo",
"(",
"HttpOutputMessage",
"message",
")",
"throws",
"IOException",
"{",
"Assert",
".",
"notNull",
"(",
"message",
",",
"\"Message must not be null\"",
")",
";",
"HttpHeaders",
"headers",
"=",
"message",
".",
"getHeaders",
"(",
")",
... | Assign this payload to the given {@link HttpOutputMessage}.
@param message the message to assign this payload to
@throws IOException in case of I/O errors | [
"Assign",
"this",
"payload",
"to",
"the",
"given",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/payload/HttpTunnelPayload.java#L81-L92 | train | Assigns this message to the given message. | [
30522,
2270,
11675,
23911,
3406,
1006,
8299,
5833,
18780,
7834,
3736,
3351,
4471,
1007,
11618,
22834,
10288,
24422,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
4471,
1010,
1000,
4471,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
8299,
4974,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java | CliFrontend.handleError | private static int handleError(Throwable t) {
LOG.error("Error while running the command.", t);
System.err.println();
System.err.println("------------------------------------------------------------");
System.err.println(" The program finished with the following exception:");
System.err.println();
if (t.getCause() instanceof InvalidProgramException) {
System.err.println(t.getCause().getMessage());
StackTraceElement[] trace = t.getCause().getStackTrace();
for (StackTraceElement ele: trace) {
System.err.println("\t" + ele);
if (ele.getMethodName().equals("main")) {
break;
}
}
} else {
t.printStackTrace();
}
return 1;
} | java | private static int handleError(Throwable t) {
LOG.error("Error while running the command.", t);
System.err.println();
System.err.println("------------------------------------------------------------");
System.err.println(" The program finished with the following exception:");
System.err.println();
if (t.getCause() instanceof InvalidProgramException) {
System.err.println(t.getCause().getMessage());
StackTraceElement[] trace = t.getCause().getStackTrace();
for (StackTraceElement ele: trace) {
System.err.println("\t" + ele);
if (ele.getMethodName().equals("main")) {
break;
}
}
} else {
t.printStackTrace();
}
return 1;
} | [
"private",
"static",
"int",
"handleError",
"(",
"Throwable",
"t",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Error while running the command.\"",
",",
"t",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
")",
";",
"System",
".",
"err",
".",
"println",
"... | Displays an exception message.
@param t The exception to display.
@return The return code for the process. | [
"Displays",
"an",
"exception",
"message",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L849-L870 | train | Handle an exception. | [
30522,
2797,
10763,
20014,
5047,
2121,
29165,
1006,
5466,
3085,
1056,
1007,
1063,
8833,
1012,
7561,
1006,
1000,
7561,
2096,
2770,
1996,
3094,
1012,
1000,
1010,
1056,
1007,
1025,
2291,
1012,
9413,
2099,
1012,
6140,
19666,
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... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java | SlotManager.registerTaskManager | public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) {
checkInit();
LOG.debug("Registering TaskManager {} under {} at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID());
// we identify task managers by their instance id
if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) {
reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport);
} else {
// first register the TaskManager
ArrayList<SlotID> reportedSlots = new ArrayList<>();
for (SlotStatus slotStatus : initialSlotReport) {
reportedSlots.add(slotStatus.getSlotID());
}
TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration(
taskExecutorConnection,
reportedSlots);
taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration);
// next register the new slots
for (SlotStatus slotStatus : initialSlotReport) {
registerSlot(
slotStatus.getSlotID(),
slotStatus.getAllocationID(),
slotStatus.getJobID(),
slotStatus.getResourceProfile(),
taskExecutorConnection);
}
}
} | java | public void registerTaskManager(final TaskExecutorConnection taskExecutorConnection, SlotReport initialSlotReport) {
checkInit();
LOG.debug("Registering TaskManager {} under {} at the SlotManager.", taskExecutorConnection.getResourceID(), taskExecutorConnection.getInstanceID());
// we identify task managers by their instance id
if (taskManagerRegistrations.containsKey(taskExecutorConnection.getInstanceID())) {
reportSlotStatus(taskExecutorConnection.getInstanceID(), initialSlotReport);
} else {
// first register the TaskManager
ArrayList<SlotID> reportedSlots = new ArrayList<>();
for (SlotStatus slotStatus : initialSlotReport) {
reportedSlots.add(slotStatus.getSlotID());
}
TaskManagerRegistration taskManagerRegistration = new TaskManagerRegistration(
taskExecutorConnection,
reportedSlots);
taskManagerRegistrations.put(taskExecutorConnection.getInstanceID(), taskManagerRegistration);
// next register the new slots
for (SlotStatus slotStatus : initialSlotReport) {
registerSlot(
slotStatus.getSlotID(),
slotStatus.getAllocationID(),
slotStatus.getJobID(),
slotStatus.getResourceProfile(),
taskExecutorConnection);
}
}
} | [
"public",
"void",
"registerTaskManager",
"(",
"final",
"TaskExecutorConnection",
"taskExecutorConnection",
",",
"SlotReport",
"initialSlotReport",
")",
"{",
"checkInit",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Registering TaskManager {} under {} at the SlotManager.\"",
... | Registers a new task manager at the slot manager. This will make the task managers slots
known and, thus, available for allocation.
@param taskExecutorConnection for the new task manager
@param initialSlotReport for the new task manager | [
"Registers",
"a",
"new",
"task",
"manager",
"at",
"the",
"slot",
"manager",
".",
"This",
"will",
"make",
"the",
"task",
"managers",
"slots",
"known",
"and",
"thus",
"available",
"for",
"allocation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManager.java#L341-L374 | train | Registers a TaskManager at the SlotManager. | [
30522,
2270,
11675,
4236,
10230,
22287,
5162,
4590,
1006,
2345,
4708,
10288,
8586,
16161,
29566,
10087,
7542,
4708,
10288,
8586,
16161,
29566,
10087,
7542,
1010,
10453,
2890,
6442,
20381,
10994,
2890,
6442,
1007,
1063,
4638,
5498,
2102,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java | SpringApplication.getBeanDefinitionRegistry | private BeanDefinitionRegistry getBeanDefinitionRegistry(ApplicationContext context) {
if (context instanceof BeanDefinitionRegistry) {
return (BeanDefinitionRegistry) context;
}
if (context instanceof AbstractApplicationContext) {
return (BeanDefinitionRegistry) ((AbstractApplicationContext) context)
.getBeanFactory();
}
throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
} | java | private BeanDefinitionRegistry getBeanDefinitionRegistry(ApplicationContext context) {
if (context instanceof BeanDefinitionRegistry) {
return (BeanDefinitionRegistry) context;
}
if (context instanceof AbstractApplicationContext) {
return (BeanDefinitionRegistry) ((AbstractApplicationContext) context)
.getBeanFactory();
}
throw new IllegalStateException("Could not locate BeanDefinitionRegistry");
} | [
"private",
"BeanDefinitionRegistry",
"getBeanDefinitionRegistry",
"(",
"ApplicationContext",
"context",
")",
"{",
"if",
"(",
"context",
"instanceof",
"BeanDefinitionRegistry",
")",
"{",
"return",
"(",
"BeanDefinitionRegistry",
")",
"context",
";",
"}",
"if",
"(",
"con... | Get the bean definition registry.
@param context the application context
@return the BeanDefinitionRegistry if it can be determined | [
"Get",
"the",
"bean",
"definition",
"registry",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L754-L763 | train | Get the BeanDefinitionRegistry from the given application context. | [
30522,
2797,
14068,
3207,
16294,
22753,
2890,
24063,
2854,
2131,
4783,
5685,
12879,
5498,
3508,
2890,
24063,
2854,
1006,
4646,
8663,
18209,
6123,
1007,
1063,
2065,
1006,
6123,
6013,
11253,
14068,
3207,
16294,
22753,
2890,
24063,
2854,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.print | @PublicEvolving
public DataStreamSink<T> print(String sinkIdentifier) {
PrintSinkFunction<T> printFunction = new PrintSinkFunction<>(sinkIdentifier, false);
return addSink(printFunction).name("Print to Std. Out");
} | java | @PublicEvolving
public DataStreamSink<T> print(String sinkIdentifier) {
PrintSinkFunction<T> printFunction = new PrintSinkFunction<>(sinkIdentifier, false);
return addSink(printFunction).name("Print to Std. Out");
} | [
"@",
"PublicEvolving",
"public",
"DataStreamSink",
"<",
"T",
">",
"print",
"(",
"String",
"sinkIdentifier",
")",
"{",
"PrintSinkFunction",
"<",
"T",
">",
"printFunction",
"=",
"new",
"PrintSinkFunction",
"<>",
"(",
"sinkIdentifier",
",",
"false",
")",
";",
"re... | Writes a DataStream to the standard output stream (stdout).
<p>For each element of the DataStream the result of {@link Object#toString()} is written.
<p>NOTE: This will print to stdout on the machine where the code is executed, i.e. the Flink
worker.
@param sinkIdentifier The string to prefix the output with.
@return The closed DataStream. | [
"Writes",
"a",
"DataStream",
"to",
"the",
"standard",
"output",
"stream",
"(",
"stdout",
")",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L989-L993 | train | Print to Std. Out | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2951,
21422,
11493,
2243,
1026,
1056,
1028,
6140,
1006,
5164,
7752,
5178,
16778,
8873,
2121,
1007,
1063,
11204,
19839,
11263,
27989,
1026,
1056,
1028,
6140,
11263,
27989,
1027,
2047,
11204,
19839,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Schema.java | Schema.schema | public Schema schema(TableSchema schema) {
tableSchema.clear();
lastField = null;
for (int i = 0; i < schema.getFieldCount(); i++) {
field(schema.getFieldName(i).get(), schema.getFieldType(i).get());
}
return this;
} | java | public Schema schema(TableSchema schema) {
tableSchema.clear();
lastField = null;
for (int i = 0; i < schema.getFieldCount(); i++) {
field(schema.getFieldName(i).get(), schema.getFieldType(i).get());
}
return this;
} | [
"public",
"Schema",
"schema",
"(",
"TableSchema",
"schema",
")",
"{",
"tableSchema",
".",
"clear",
"(",
")",
";",
"lastField",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"schema",
".",
"getFieldCount",
"(",
")",
";",
"i",
"+... | Sets the schema with field names and the types. Required.
<p>This method overwrites existing fields added with {@link #field(String, TypeInformation)}.
@param schema the table schema | [
"Sets",
"the",
"schema",
"with",
"field",
"names",
"and",
"the",
"types",
".",
"Required",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Schema.java#L59-L66 | train | Sets the schema. | [
30522,
2270,
8040,
28433,
8040,
28433,
1006,
7251,
5403,
2863,
8040,
28433,
1007,
1063,
7251,
5403,
2863,
1012,
3154,
1006,
1007,
1025,
2197,
3790,
1027,
19701,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
8040,
28433,
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/entrypoint/ClusterEntrypoint.java | ClusterEntrypoint.runClusterEntrypoint | public static void runClusterEntrypoint(ClusterEntrypoint clusterEntrypoint) {
final String clusterEntrypointName = clusterEntrypoint.getClass().getSimpleName();
try {
clusterEntrypoint.startCluster();
} catch (ClusterEntrypointException e) {
LOG.error(String.format("Could not start cluster entrypoint %s.", clusterEntrypointName), e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
}
clusterEntrypoint.getTerminationFuture().whenComplete((applicationStatus, throwable) -> {
final int returnCode;
if (throwable != null) {
returnCode = RUNTIME_FAILURE_RETURN_CODE;
} else {
returnCode = applicationStatus.processExitCode();
}
LOG.info("Terminating cluster entrypoint process {} with exit code {}.", clusterEntrypointName, returnCode, throwable);
System.exit(returnCode);
});
} | java | public static void runClusterEntrypoint(ClusterEntrypoint clusterEntrypoint) {
final String clusterEntrypointName = clusterEntrypoint.getClass().getSimpleName();
try {
clusterEntrypoint.startCluster();
} catch (ClusterEntrypointException e) {
LOG.error(String.format("Could not start cluster entrypoint %s.", clusterEntrypointName), e);
System.exit(STARTUP_FAILURE_RETURN_CODE);
}
clusterEntrypoint.getTerminationFuture().whenComplete((applicationStatus, throwable) -> {
final int returnCode;
if (throwable != null) {
returnCode = RUNTIME_FAILURE_RETURN_CODE;
} else {
returnCode = applicationStatus.processExitCode();
}
LOG.info("Terminating cluster entrypoint process {} with exit code {}.", clusterEntrypointName, returnCode, throwable);
System.exit(returnCode);
});
} | [
"public",
"static",
"void",
"runClusterEntrypoint",
"(",
"ClusterEntrypoint",
"clusterEntrypoint",
")",
"{",
"final",
"String",
"clusterEntrypointName",
"=",
"clusterEntrypoint",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
";",
"try",
"{",
"clusterEnt... | -------------------------------------------------- | [
"--------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java#L499-L521 | train | Run a cluster entrypoint. | [
30522,
2270,
10763,
11675,
2448,
20464,
19966,
7869,
3372,
2854,
8400,
1006,
9324,
4765,
2854,
8400,
9324,
4765,
2854,
8400,
1007,
1063,
2345,
5164,
9324,
4765,
2854,
8400,
18442,
1027,
9324,
4765,
2854,
8400,
1012,
2131,
26266,
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-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java | NFA.extractCurrentMatches | private Map<String, List<EventId>> extractCurrentMatches(
final SharedBufferAccessor<T> sharedBufferAccessor,
final ComputationState computationState) throws Exception {
if (computationState.getPreviousBufferEntry() == null) {
return new HashMap<>();
}
List<Map<String, List<EventId>>> paths = sharedBufferAccessor.extractPatterns(
computationState.getPreviousBufferEntry(),
computationState.getVersion());
if (paths.isEmpty()) {
return new HashMap<>();
}
// for a given computation state, we cannot have more than one matching patterns.
Preconditions.checkState(paths.size() == 1);
return paths.get(0);
} | java | private Map<String, List<EventId>> extractCurrentMatches(
final SharedBufferAccessor<T> sharedBufferAccessor,
final ComputationState computationState) throws Exception {
if (computationState.getPreviousBufferEntry() == null) {
return new HashMap<>();
}
List<Map<String, List<EventId>>> paths = sharedBufferAccessor.extractPatterns(
computationState.getPreviousBufferEntry(),
computationState.getVersion());
if (paths.isEmpty()) {
return new HashMap<>();
}
// for a given computation state, we cannot have more than one matching patterns.
Preconditions.checkState(paths.size() == 1);
return paths.get(0);
} | [
"private",
"Map",
"<",
"String",
",",
"List",
"<",
"EventId",
">",
">",
"extractCurrentMatches",
"(",
"final",
"SharedBufferAccessor",
"<",
"T",
">",
"sharedBufferAccessor",
",",
"final",
"ComputationState",
"computationState",
")",
"throws",
"Exception",
"{",
"if... | Extracts all the sequences of events from the start to the given computation state. An event
sequence is returned as a map which contains the events and the names of the states to which
the events were mapped.
@param sharedBufferAccessor The accessor to {@link SharedBuffer} from which to extract the matches
@param computationState The end computation state of the extracted event sequences
@return Collection of event sequences which end in the given computation state
@throws Exception Thrown if the system cannot access the state. | [
"Extracts",
"all",
"the",
"sequences",
"of",
"events",
"from",
"the",
"start",
"to",
"the",
"given",
"computation",
"state",
".",
"An",
"event",
"sequence",
"is",
"returned",
"as",
"a",
"map",
"which",
"contains",
"the",
"events",
"and",
"the",
"names",
"o... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/NFA.java#L765-L783 | train | Extract the current matches from the given computation state. | [
30522,
2797,
4949,
1026,
5164,
1010,
2862,
1026,
2724,
3593,
1028,
1028,
14817,
10841,
14343,
3372,
18900,
8376,
1006,
2345,
4207,
8569,
12494,
6305,
9623,
21748,
1026,
1056,
1028,
4207,
8569,
12494,
6305,
9623,
21748,
1010,
2345,
30524,
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-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java | MessageSerializer.serializeRequest | public static <REQ extends MessageBody> ByteBuf serializeRequest(
final ByteBufAllocator alloc,
final long requestId,
final REQ request) {
Preconditions.checkNotNull(request);
return writePayload(alloc, requestId, MessageType.REQUEST, request.serialize());
} | java | public static <REQ extends MessageBody> ByteBuf serializeRequest(
final ByteBufAllocator alloc,
final long requestId,
final REQ request) {
Preconditions.checkNotNull(request);
return writePayload(alloc, requestId, MessageType.REQUEST, request.serialize());
} | [
"public",
"static",
"<",
"REQ",
"extends",
"MessageBody",
">",
"ByteBuf",
"serializeRequest",
"(",
"final",
"ByteBufAllocator",
"alloc",
",",
"final",
"long",
"requestId",
",",
"final",
"REQ",
"request",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"requ... | Serializes the request sent to the
{@link org.apache.flink.queryablestate.network.AbstractServerBase}.
@param alloc The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
@param requestId The id of the request to which the message refers to.
@param request The request to be serialized.
@return A {@link ByteBuf} containing the serialized message. | [
"Serializes",
"the",
"request",
"sent",
"to",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"queryablestate",
".",
"network",
".",
"AbstractServerBase",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L91-L97 | train | Serializes a request message. | [
30522,
2270,
10763,
1026,
2128,
4160,
8908,
4471,
23684,
1028,
24880,
8569,
2546,
7642,
17629,
2063,
15500,
1006,
2345,
24880,
8569,
13976,
24755,
4263,
2035,
10085,
1010,
2345,
2146,
5227,
3593,
1010,
2345,
2128,
4160,
5227,
1007,
1063,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.pointTo | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
assert numFields >= 0 : "numFields (" + numFields + ") should >= 0";
assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8";
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
} | java | public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
assert numFields >= 0 : "numFields (" + numFields + ") should >= 0";
assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8";
this.baseObject = baseObject;
this.baseOffset = baseOffset;
this.sizeInBytes = sizeInBytes;
} | [
"public",
"void",
"pointTo",
"(",
"Object",
"baseObject",
",",
"long",
"baseOffset",
",",
"int",
"sizeInBytes",
")",
"{",
"assert",
"numFields",
">=",
"0",
":",
"\"numFields (\"",
"+",
"numFields",
"+",
"\") should >= 0\"",
";",
"assert",
"sizeInBytes",
"%",
"... | Update this UnsafeRow to point to different backing data.
@param baseObject the base object
@param baseOffset the offset within the base object
@param sizeInBytes the size of this row's backing data, in bytes | [
"Update",
"this",
"UnsafeRow",
"to",
"point",
"to",
"different",
"backing",
"data",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L166-L172 | train | Point to the base object and size in bytes. | [
30522,
2270,
11675,
2391,
3406,
1006,
4874,
2918,
16429,
20614,
1010,
2146,
2918,
27475,
3388,
1010,
20014,
2946,
2378,
3762,
4570,
1007,
1063,
20865,
16371,
2213,
15155,
1028,
1027,
1014,
1024,
1000,
16371,
2213,
15155,
1006,
1000,
1009,
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-core/src/main/java/org/apache/flink/api/common/operators/SingleInputOperator.java | SingleInputOperator.getOperatorInfo | @Override
@SuppressWarnings("unchecked")
public UnaryOperatorInformation<IN, OUT> getOperatorInfo() {
return (UnaryOperatorInformation<IN, OUT>) this.operatorInfo;
} | java | @Override
@SuppressWarnings("unchecked")
public UnaryOperatorInformation<IN, OUT> getOperatorInfo() {
return (UnaryOperatorInformation<IN, OUT>) this.operatorInfo;
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"UnaryOperatorInformation",
"<",
"IN",
",",
"OUT",
">",
"getOperatorInfo",
"(",
")",
"{",
"return",
"(",
"UnaryOperatorInformation",
"<",
"IN",
",",
"OUT",
">",
")",
"this",
".",
... | Gets the information about the operators input/output types. | [
"Gets",
"the",
"information",
"about",
"the",
"operators",
"input",
"/",
"output",
"types",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/SingleInputOperator.java#L81-L85 | train | Get the operator information. | [
30522,
1030,
2058,
15637,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
14477,
2854,
25918,
8844,
2378,
14192,
3370,
1026,
1999,
1010,
2041,
1028,
2131,
25918,
8844,
2378,
14876,
1006,
1007,
1063,
2709,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/server/ThreadWithGarbageCleanup.java | ThreadWithGarbageCleanup.cacheThreadLocalRawStore | public void cacheThreadLocalRawStore() {
Long threadId = this.getId();
RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore();
if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) {
LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " +
this.getName() + " to threadRawStoreMap for future cleanup.");
threadRawStoreMap.put(threadId, threadLocalRawStore);
}
} | java | public void cacheThreadLocalRawStore() {
Long threadId = this.getId();
RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore();
if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) {
LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " +
this.getName() + " to threadRawStoreMap for future cleanup.");
threadRawStoreMap.put(threadId, threadLocalRawStore);
}
} | [
"public",
"void",
"cacheThreadLocalRawStore",
"(",
")",
"{",
"Long",
"threadId",
"=",
"this",
".",
"getId",
"(",
")",
";",
"RawStore",
"threadLocalRawStore",
"=",
"HiveMetaStore",
".",
"HMSHandler",
".",
"getRawStore",
"(",
")",
";",
"if",
"(",
"threadLocalRaw... | Cache the ThreadLocal RawStore object. Called from the corresponding thread. | [
"Cache",
"the",
"ThreadLocal",
"RawStore",
"object",
".",
"Called",
"from",
"the",
"corresponding",
"thread",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/server/ThreadWithGarbageCleanup.java#L68-L76 | train | Cache the thread local RawStore for future cleanup. | [
30522,
2270,
11675,
17053,
2705,
16416,
19422,
24755,
20974,
10376,
23809,
2063,
1006,
1007,
1063,
2146,
11689,
3593,
1027,
2023,
1012,
2131,
3593,
1006,
1007,
1025,
6315,
23809,
2063,
11689,
4135,
9289,
2527,
9333,
19277,
1027,
26736,
11368,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.report | @Override
public void report() {
// we do not need to lock here, because the dropwizard registry is
// internally a concurrent map
@SuppressWarnings("rawtypes")
final SortedMap<String, com.codahale.metrics.Gauge> gauges = registry.getGauges();
final SortedMap<String, com.codahale.metrics.Counter> counters = registry.getCounters();
final SortedMap<String, com.codahale.metrics.Histogram> histograms = registry.getHistograms();
final SortedMap<String, com.codahale.metrics.Meter> meters = registry.getMeters();
final SortedMap<String, com.codahale.metrics.Timer> timers = registry.getTimers();
this.reporter.report(gauges, counters, histograms, meters, timers);
} | java | @Override
public void report() {
// we do not need to lock here, because the dropwizard registry is
// internally a concurrent map
@SuppressWarnings("rawtypes")
final SortedMap<String, com.codahale.metrics.Gauge> gauges = registry.getGauges();
final SortedMap<String, com.codahale.metrics.Counter> counters = registry.getCounters();
final SortedMap<String, com.codahale.metrics.Histogram> histograms = registry.getHistograms();
final SortedMap<String, com.codahale.metrics.Meter> meters = registry.getMeters();
final SortedMap<String, com.codahale.metrics.Timer> timers = registry.getTimers();
this.reporter.report(gauges, counters, histograms, meters, timers);
} | [
"@",
"Override",
"public",
"void",
"report",
"(",
")",
"{",
"// we do not need to lock here, because the dropwizard registry is",
"// internally a concurrent map",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"final",
"SortedMap",
"<",
"String",
",",
"com",
".",
"co... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-dropwizard/src/main/java/org/apache/flink/dropwizard/ScheduledDropwizardReporter.java#L220-L232 | train | This method is called by the dropwizard registry to report the metrics. | [
30522,
1030,
2058,
15637,
2270,
11675,
3189,
1006,
1007,
1063,
1013,
1013,
2057,
2079,
2025,
2342,
2000,
5843,
2182,
1010,
2138,
1996,
4530,
9148,
26154,
15584,
2003,
1013,
1013,
16058,
1037,
16483,
4949,
1030,
16081,
9028,
5582,
2015,
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-captcha/src/main/java/cn/hutool/captcha/ShearCaptcha.java | ShearCaptcha.shearY | private void shearY(Graphics g, int w1, int h1, Color color) {
int period = RandomUtil.randomInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++) {
double d = (double) (period >> 1) * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap) {
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
} | java | private void shearY(Graphics g, int w1, int h1, Color color) {
int period = RandomUtil.randomInt(40) + 10; // 50;
boolean borderGap = true;
int frames = 20;
int phase = 7;
for (int i = 0; i < w1; i++) {
double d = (double) (period >> 1) * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
g.copyArea(i, 0, 1, h1, 0, (int) d);
if (borderGap) {
g.setColor(color);
g.drawLine(i, (int) d, i, 0);
g.drawLine(i, (int) d + h1, i, h1);
}
}
} | [
"private",
"void",
"shearY",
"(",
"Graphics",
"g",
",",
"int",
"w1",
",",
"int",
"h1",
",",
"Color",
"color",
")",
"{",
"int",
"period",
"=",
"RandomUtil",
".",
"randomInt",
"(",
"40",
")",
"+",
"10",
";",
"// 50;\r",
"boolean",
"borderGap",
"=",
"tr... | X坐标扭曲
@param g {@link Graphics}
@param w1 w1
@param h1 h1
@param color 颜色 | [
"X坐标扭曲"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/ShearCaptcha.java#L150-L168 | train | Shear the Y axis. | [
30522,
2797,
11675,
18330,
2100,
1006,
8389,
1043,
1010,
20014,
1059,
2487,
1010,
20014,
1044,
2487,
1010,
3609,
3609,
1007,
1063,
20014,
2558,
1027,
6721,
21823,
2140,
1012,
6721,
18447,
1006,
2871,
1007,
1009,
2184,
1025,
1013,
1013,
2753... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/dataformat/BinaryString.java | BinaryString.splitByWholeSeparatorPreserveAllTokens | public BinaryString[] splitByWholeSeparatorPreserveAllTokens(BinaryString separator) {
ensureMaterialized();
final int len = sizeInBytes;
if (len == 0) {
return EMPTY_STRING_ARRAY;
}
if (separator == null || EMPTY_UTF8.equals(separator)) {
// Split on whitespace.
return splitByWholeSeparatorPreserveAllTokens(fromString(" "));
}
separator.ensureMaterialized();
final int separatorLength = separator.sizeInBytes;
final ArrayList<BinaryString> substrings = new ArrayList<>();
int beg = 0;
int end = 0;
while (end < len) {
end = SegmentsUtil.find(
segments, offset + beg, sizeInBytes - beg,
separator.segments, separator.offset, separator.sizeInBytes) - offset;
if (end > -1) {
if (end > beg) {
// The following is OK, because String.substring( beg, end ) excludes
// the character at the position 'end'.
substrings.add(BinaryString.fromAddress(segments, offset + beg, end - beg));
// Set the starting point for the next search.
// The following is equivalent to beg = end + (separatorLength - 1) + 1,
// which is the right calculation:
beg = end + separatorLength;
} else {
// We found a consecutive occurrence of the separator.
substrings.add(EMPTY_UTF8);
beg = end + separatorLength;
}
} else {
// String.substring( beg ) goes from 'beg' to the end of the String.
substrings.add(BinaryString.fromAddress(segments, offset + beg, sizeInBytes - beg));
end = len;
}
}
return substrings.toArray(new BinaryString[0]);
} | java | public BinaryString[] splitByWholeSeparatorPreserveAllTokens(BinaryString separator) {
ensureMaterialized();
final int len = sizeInBytes;
if (len == 0) {
return EMPTY_STRING_ARRAY;
}
if (separator == null || EMPTY_UTF8.equals(separator)) {
// Split on whitespace.
return splitByWholeSeparatorPreserveAllTokens(fromString(" "));
}
separator.ensureMaterialized();
final int separatorLength = separator.sizeInBytes;
final ArrayList<BinaryString> substrings = new ArrayList<>();
int beg = 0;
int end = 0;
while (end < len) {
end = SegmentsUtil.find(
segments, offset + beg, sizeInBytes - beg,
separator.segments, separator.offset, separator.sizeInBytes) - offset;
if (end > -1) {
if (end > beg) {
// The following is OK, because String.substring( beg, end ) excludes
// the character at the position 'end'.
substrings.add(BinaryString.fromAddress(segments, offset + beg, end - beg));
// Set the starting point for the next search.
// The following is equivalent to beg = end + (separatorLength - 1) + 1,
// which is the right calculation:
beg = end + separatorLength;
} else {
// We found a consecutive occurrence of the separator.
substrings.add(EMPTY_UTF8);
beg = end + separatorLength;
}
} else {
// String.substring( beg ) goes from 'beg' to the end of the String.
substrings.add(BinaryString.fromAddress(segments, offset + beg, sizeInBytes - beg));
end = len;
}
}
return substrings.toArray(new BinaryString[0]);
} | [
"public",
"BinaryString",
"[",
"]",
"splitByWholeSeparatorPreserveAllTokens",
"(",
"BinaryString",
"separator",
")",
"{",
"ensureMaterialized",
"(",
")",
";",
"final",
"int",
"len",
"=",
"sizeInBytes",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"EMP... | <p>Splits the provided text into an array, separator string specified. </p>
<p>The separator is not included in the returned String array.
Adjacent separators are treated as separators for empty tokens.</p>
<p>A {@code null} separator splits on whitespace.</p>
<pre>
"".splitByWholeSeparatorPreserveAllTokens(*) = []
"ab de fg".splitByWholeSeparatorPreserveAllTokens(null) = ["ab", "de", "fg"]
"ab de fg".splitByWholeSeparatorPreserveAllTokens(null) = ["ab", "", "", "de", "fg"]
"ab:cd:ef".splitByWholeSeparatorPreserveAllTokens(":") = ["ab", "cd", "ef"]
"ab-!-cd-!-ef".splitByWholeSeparatorPreserveAllTokens("-!-") = ["ab", "cd", "ef"]
</pre>
<p>Note: return BinaryStrings is reuse MemorySegments from this.</p>
@param separator String containing the String to be used as a delimiter,
{@code null} splits on whitespace
@return an array of parsed Strings, {@code null} if null String was input
@since 2.4 | [
"<p",
">",
"Splits",
"the",
"provided",
"text",
"into",
"an",
"array",
"separator",
"string",
"specified",
".",
"<",
"/",
"p",
">"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L1751-L1799 | train | Splits this string by the given separator ignoring whitespace and ignoring consecutive occurrences of the separator. | [
30522,
2270,
12441,
3367,
4892,
1031,
1033,
3975,
3762,
2860,
19990,
13699,
25879,
2953,
28994,
2121,
3726,
8095,
18715,
6132,
1006,
12441,
3367,
4892,
19802,
25879,
2953,
1007,
1063,
5676,
8585,
14482,
3550,
1006,
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... |
SeleniumHQ/selenium | java/server/src/org/openqa/grid/common/RegistrationRequest.java | RegistrationRequest.validate | public void validate() throws GridConfigurationException {
// validations occur here in the getters called on the configuration.
try {
configuration.getHubHost();
configuration.getHubPort();
} catch (RuntimeException e) {
throw new GridConfigurationException(e.getMessage());
}
} | java | public void validate() throws GridConfigurationException {
// validations occur here in the getters called on the configuration.
try {
configuration.getHubHost();
configuration.getHubPort();
} catch (RuntimeException e) {
throw new GridConfigurationException(e.getMessage());
}
} | [
"public",
"void",
"validate",
"(",
")",
"throws",
"GridConfigurationException",
"{",
"// validations occur here in the getters called on the configuration.",
"try",
"{",
"configuration",
".",
"getHubHost",
"(",
")",
";",
"configuration",
".",
"getHubPort",
"(",
")",
";",
... | Validate the current setting and throw a config exception is an invalid setup is detected.
@throws GridConfigurationException grid configuration | [
"Validate",
"the",
"current",
"setting",
"and",
"throw",
"a",
"config",
"exception",
"is",
"an",
"invalid",
"setup",
"is",
"detected",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/common/RegistrationRequest.java#L225-L233 | train | Validate the configuration. | [
30522,
2270,
11675,
9398,
3686,
1006,
1007,
11618,
8370,
8663,
8873,
27390,
3370,
10288,
24422,
1063,
1013,
1013,
27354,
2015,
5258,
2182,
1999,
1996,
2131,
7747,
2170,
2006,
1996,
9563,
1012,
3046,
1063,
9563,
1012,
2131,
6979,
23706,
1412... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Config.java | Config.fromJSON | public static Config fromJSON(String content) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromJSON(content, Config.class);
} | java | public static Config fromJSON(String content) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromJSON(content, Config.class);
} | [
"public",
"static",
"Config",
"fromJSON",
"(",
"String",
"content",
")",
"throws",
"IOException",
"{",
"ConfigSupport",
"support",
"=",
"new",
"ConfigSupport",
"(",
")",
";",
"return",
"support",
".",
"fromJSON",
"(",
"content",
",",
"Config",
".",
"class",
... | Read config object stored in JSON format from <code>String</code>
@param content of config
@return config
@throws IOException error | [
"Read",
"config",
"object",
"stored",
"in",
"JSON",
"format",
"from",
"<code",
">",
"String<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/Config.java#L556-L559 | train | Creates a Config object from a JSON string. | [
30522,
2270,
10763,
9530,
8873,
2290,
2013,
22578,
2239,
1006,
5164,
4180,
1007,
11618,
22834,
10288,
24422,
1063,
9530,
8873,
5620,
6279,
6442,
2490,
1027,
2047,
9530,
8873,
5620,
6279,
6442,
1006,
1007,
1025,
2709,
2490,
1012,
2013,
22578... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/cors/CorsConfigBuilder.java | CorsConfigBuilder.preflightResponseHeader | public <T> CorsConfigBuilder preflightResponseHeader(final CharSequence name, final Callable<T> valueGenerator) {
preflightHeaders.put(name, valueGenerator);
return this;
} | java | public <T> CorsConfigBuilder preflightResponseHeader(final CharSequence name, final Callable<T> valueGenerator) {
preflightHeaders.put(name, valueGenerator);
return this;
} | [
"public",
"<",
"T",
">",
"CorsConfigBuilder",
"preflightResponseHeader",
"(",
"final",
"CharSequence",
"name",
",",
"final",
"Callable",
"<",
"T",
">",
"valueGenerator",
")",
"{",
"preflightHeaders",
".",
"put",
"(",
"name",
",",
"valueGenerator",
")",
";",
"r... | Returns HTTP response headers that should be added to a CORS preflight response.
An intermediary like a load balancer might require that a CORS preflight request
have certain headers set. This enables such headers to be added.
Some values must be dynamically created when the HTTP response is created, for
example the 'Date' response header. This can be accomplished by using a Callable
which will have its 'call' method invoked when the HTTP response is created.
@param name the name of the HTTP header.
@param valueGenerator a Callable which will be invoked at HTTP response creation.
@param <T> the type of the value that the Callable can return.
@return {@link CorsConfigBuilder} to support method chaining. | [
"Returns",
"HTTP",
"response",
"headers",
"that",
"should",
"be",
"added",
"to",
"a",
"CORS",
"preflight",
"response",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfigBuilder.java#L323-L326 | train | Add a preflight response header. | [
30522,
2270,
1026,
1056,
1028,
2522,
2869,
8663,
8873,
18259,
19231,
4063,
3653,
28968,
6072,
26029,
3366,
4974,
2121,
1006,
2345,
25869,
3366,
4226,
5897,
2171,
1010,
2345,
2655,
3085,
1026,
1056,
1028,
3643,
6914,
6906,
4263,
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/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.nearest | public List<Map.Entry<K, Float>> nearest(K key, int size)
{
Vector vector = storage.get(key);
if (vector == null)
{
return Collections.emptyList();
}
return nearest(key, vector, size);
} | java | public List<Map.Entry<K, Float>> nearest(K key, int size)
{
Vector vector = storage.get(key);
if (vector == null)
{
return Collections.emptyList();
}
return nearest(key, vector, size);
} | [
"public",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"Float",
">",
">",
"nearest",
"(",
"K",
"key",
",",
"int",
"size",
")",
"{",
"Vector",
"vector",
"=",
"storage",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"vector",
"==",
"null",
")"... | 查询与key最相似的元素
@param key 键
@param size topN个
@return 键值对列表, 键是相似词语, 值是相似度, 按相似度降序排列 | [
"查询与key最相似的元素"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L78-L86 | train | Returns the nearest set of attributes of the specified key to the specified size. | [
30522,
2270,
2862,
1026,
4949,
1012,
4443,
1026,
1047,
1010,
14257,
1028,
1028,
7205,
1006,
1047,
3145,
1010,
20014,
2946,
1007,
1063,
9207,
9207,
1027,
5527,
1012,
2131,
1006,
3145,
1007,
1025,
2065,
1006,
9207,
1027,
1027,
19701,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/dartsclone/details/BitVector.java | BitVector.set | void set(int id, boolean bit)
{
if (bit)
{
_units.set(id / UNIT_SIZE, _units.get(id / UNIT_SIZE)
| 1 << (id % UNIT_SIZE));
}
} | java | void set(int id, boolean bit)
{
if (bit)
{
_units.set(id / UNIT_SIZE, _units.get(id / UNIT_SIZE)
| 1 << (id % UNIT_SIZE));
}
} | [
"void",
"set",
"(",
"int",
"id",
",",
"boolean",
"bit",
")",
"{",
"if",
"(",
"bit",
")",
"{",
"_units",
".",
"set",
"(",
"id",
"/",
"UNIT_SIZE",
",",
"_units",
".",
"get",
"(",
"id",
"/",
"UNIT_SIZE",
")",
"|",
"1",
"<<",
"(",
"id",
"%",
"UNI... | 设置某一位的比特
@param id 位
@param bit 比特 | [
"设置某一位的比特"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/dartsclone/details/BitVector.java#L28-L35 | train | set a single unit or a single unit group | [
30522,
11675,
2275,
1006,
20014,
8909,
1010,
22017,
20898,
2978,
1007,
1063,
2065,
1006,
2978,
1007,
1063,
1035,
3197,
30524,
1015,
1026,
1026,
1006,
8909,
1003,
3131,
1035,
2946,
1007,
1007,
1025,
1065,
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-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java | MailUtil.sendHtml | public static void sendHtml(Collection<String> tos, String subject, String content, File... files) {
send(tos, subject, content, true, files);
} | java | public static void sendHtml(Collection<String> tos, String subject, String content, File... files) {
send(tos, subject, content, true, files);
} | [
"public",
"static",
"void",
"sendHtml",
"(",
"Collection",
"<",
"String",
">",
"tos",
",",
"String",
"subject",
",",
"String",
"content",
",",
"File",
"...",
"files",
")",
"{",
"send",
"(",
"tos",
",",
"subject",
",",
"content",
",",
"true",
",",
"file... | 使用配置文件中设置的账户发送HTML邮件,发送给多人
@param tos 收件人列表
@param subject 标题
@param content 正文
@param files 附件列表
@since 3.2.0 | [
"使用配置文件中设置的账户发送HTML邮件,发送给多人"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L98-L100 | train | Send HTML to a collection of strings. | [
30522,
2270,
10763,
11675,
4604,
11039,
19968,
1006,
3074,
1026,
5164,
1028,
2000,
2015,
1010,
5164,
3395,
1010,
5164,
4180,
1010,
5371,
1012,
1012,
1012,
6764,
1007,
1063,
4604,
1006,
2000,
2015,
1010,
3395,
1010,
4180,
1010,
2995,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.resize | public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) {
T[] newArray = newArray(componentType, newSize);
if (isNotEmpty(buffer)) {
System.arraycopy(buffer, 0, newArray, 0, Math.min(buffer.length, newSize));
}
return newArray;
} | java | public static <T> T[] resize(T[] buffer, int newSize, Class<?> componentType) {
T[] newArray = newArray(componentType, newSize);
if (isNotEmpty(buffer)) {
System.arraycopy(buffer, 0, newArray, 0, Math.min(buffer.length, newSize));
}
return newArray;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"resize",
"(",
"T",
"[",
"]",
"buffer",
",",
"int",
"newSize",
",",
"Class",
"<",
"?",
">",
"componentType",
")",
"{",
"T",
"[",
"]",
"newArray",
"=",
"newArray",
"(",
"componentType",
",",
"newSize... | 生成一个新的重新设置大小的数组<br>
调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断
@param <T> 数组元素类型
@param buffer 原数组
@param newSize 新的数组大小
@param componentType 数组元素类型
@return 调整后的新数组 | [
"生成一个新的重新设置大小的数组<br",
">",
"调整大小后拷贝原数组到新数组下。扩大则占位前N个位置,缩小则截断"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L506-L512 | train | Resize the given array to the given size. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
24501,
4697,
1006,
1056,
1031,
1033,
17698,
1010,
20014,
2739,
4697,
1010,
30524,
6922,
13874,
1010,
2739,
4697,
1007,
1025,
2065,
1006,
3475,
12184,
27718,
2100,
1006,
17698,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java | LogBuffer.getLong48 | public final long getLong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (buf[position + 5]) << 40);
} | java | public final long getLong48(final int pos) {
final int position = origin + pos;
if (pos + 5 >= limit || pos < 0) throw new IllegalArgumentException("limit excceed: "
+ (pos < 0 ? pos : (pos + 5)));
byte[] buf = buffer;
return ((long) (0xff & buf[position])) | ((long) (0xff & buf[position + 1]) << 8)
| ((long) (0xff & buf[position + 2]) << 16) | ((long) (0xff & buf[position + 3]) << 24)
| ((long) (0xff & buf[position + 4]) << 32) | ((long) (buf[position + 5]) << 40);
} | [
"public",
"final",
"long",
"getLong48",
"(",
"final",
"int",
"pos",
")",
"{",
"final",
"int",
"position",
"=",
"origin",
"+",
"pos",
";",
"if",
"(",
"pos",
"+",
"5",
">=",
"limit",
"||",
"pos",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Return 48-bit signed long from buffer. (little-endian)
@see mysql-5.1.60/include/my_global.h - sint6korr | [
"Return",
"48",
"-",
"bit",
"signed",
"long",
"from",
"buffer",
".",
"(",
"little",
"-",
"endian",
")"
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/LogBuffer.java#L649-L659 | train | Gets a long from the buffer at the given position in the buffer as an long. | [
30522,
2270,
2345,
2146,
2131,
10052,
18139,
1006,
2345,
20014,
13433,
2015,
1007,
1063,
2345,
20014,
2597,
1027,
4761,
1009,
13433,
2015,
1025,
2065,
1006,
13433,
2015,
1009,
1019,
1028,
1027,
5787,
1064,
1064,
13433,
2015,
1026,
1014,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslUtils.java | SslUtils.toSSLHandshakeException | static SSLHandshakeException toSSLHandshakeException(Throwable e) {
if (e instanceof SSLHandshakeException) {
return (SSLHandshakeException) e;
}
return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
} | java | static SSLHandshakeException toSSLHandshakeException(Throwable e) {
if (e instanceof SSLHandshakeException) {
return (SSLHandshakeException) e;
}
return (SSLHandshakeException) new SSLHandshakeException(e.getMessage()).initCause(e);
} | [
"static",
"SSLHandshakeException",
"toSSLHandshakeException",
"(",
"Throwable",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"SSLHandshakeException",
")",
"{",
"return",
"(",
"SSLHandshakeException",
")",
"e",
";",
"}",
"return",
"(",
"SSLHandshakeException",
")",
... | Converts the given exception to a {@link SSLHandshakeException}, if it isn't already. | [
"Converts",
"the",
"given",
"exception",
"to",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslUtils.java#L161-L167 | train | Converts a Throwable to an SSLHandshakeException. | [
30522,
10763,
7020,
2140,
11774,
7377,
20553,
2595,
24422,
10055,
2140,
11774,
7377,
20553,
2595,
24422,
1006,
5466,
3085,
1041,
1007,
1063,
2065,
1006,
1041,
6013,
11253,
7020,
2140,
11774,
7377,
20553,
2595,
24422,
1007,
1063,
2709,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java | SpdySession.activeStreams | Map<Integer, StreamState> activeStreams() {
Map<Integer, StreamState> streams = new TreeMap<Integer, StreamState>(streamComparator);
streams.putAll(activeStreams);
return streams;
} | java | Map<Integer, StreamState> activeStreams() {
Map<Integer, StreamState> streams = new TreeMap<Integer, StreamState>(streamComparator);
streams.putAll(activeStreams);
return streams;
} | [
"Map",
"<",
"Integer",
",",
"StreamState",
">",
"activeStreams",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"StreamState",
">",
"streams",
"=",
"new",
"TreeMap",
"<",
"Integer",
",",
"StreamState",
">",
"(",
"streamComparator",
")",
";",
"streams",
".",
... | Stream-IDs should be iterated in priority order | [
"Stream",
"-",
"IDs",
"should",
"be",
"iterated",
"in",
"priority",
"order"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java#L61-L65 | train | Returns a map of all the active streams. | [
30522,
4949,
1026,
16109,
1010,
9199,
12259,
1028,
3161,
21422,
2015,
1006,
1007,
1063,
4949,
1026,
16109,
1010,
9199,
12259,
1028,
9199,
1027,
2047,
3392,
2863,
2361,
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,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java | DataSetUtils.partitionByRange | public static <T> PartitionOperator<T> partitionByRange(DataSet<T> input, DataDistribution distribution, int... fields) {
return new PartitionOperator<>(input, PartitionOperatorBase.PartitionMethod.RANGE, new Keys.ExpressionKeys<>(fields, input.getType(), false), distribution, Utils.getCallLocationName());
} | java | public static <T> PartitionOperator<T> partitionByRange(DataSet<T> input, DataDistribution distribution, int... fields) {
return new PartitionOperator<>(input, PartitionOperatorBase.PartitionMethod.RANGE, new Keys.ExpressionKeys<>(fields, input.getType(), false), distribution, Utils.getCallLocationName());
} | [
"public",
"static",
"<",
"T",
">",
"PartitionOperator",
"<",
"T",
">",
"partitionByRange",
"(",
"DataSet",
"<",
"T",
">",
"input",
",",
"DataDistribution",
"distribution",
",",
"int",
"...",
"fields",
")",
"{",
"return",
"new",
"PartitionOperator",
"<>",
"("... | Range-partitions a DataSet on the specified tuple field positions. | [
"Range",
"-",
"partitions",
"a",
"DataSet",
"on",
"the",
"specified",
"tuple",
"field",
"positions",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L273-L275 | train | Partitions a DataSet by a range of fields. | [
30522,
2270,
10763,
1026,
1056,
1028,
13571,
25918,
8844,
1026,
1056,
1028,
13571,
3762,
24388,
2063,
1006,
2951,
13462,
1026,
1056,
1028,
7953,
1010,
2951,
10521,
18886,
29446,
4353,
1010,
20014,
1012,
1012,
1012,
4249,
1007,
1063,
2709,
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... |
netty/netty | common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java | NativeLibraryLoader.loadFirstAvailable | public static void loadFirstAvailable(ClassLoader loader, String... names) {
List<Throwable> suppressed = new ArrayList<Throwable>();
for (String name : names) {
try {
load(name, loader);
return;
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Unable to load the library '{}', trying next name...", name, t);
}
}
IllegalArgumentException iae =
new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
ThrowableUtil.addSuppressedAndClear(iae, suppressed);
throw iae;
} | java | public static void loadFirstAvailable(ClassLoader loader, String... names) {
List<Throwable> suppressed = new ArrayList<Throwable>();
for (String name : names) {
try {
load(name, loader);
return;
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Unable to load the library '{}', trying next name...", name, t);
}
}
IllegalArgumentException iae =
new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
ThrowableUtil.addSuppressedAndClear(iae, suppressed);
throw iae;
} | [
"public",
"static",
"void",
"loadFirstAvailable",
"(",
"ClassLoader",
"loader",
",",
"String",
"...",
"names",
")",
"{",
"List",
"<",
"Throwable",
">",
"suppressed",
"=",
"new",
"ArrayList",
"<",
"Throwable",
">",
"(",
")",
";",
"for",
"(",
"String",
"name... | Loads the first available library in the collection with the specified
{@link ClassLoader}.
@throws IllegalArgumentException
if none of the given libraries load successfully. | [
"Loads",
"the",
"first",
"available",
"library",
"in",
"the",
"collection",
"with",
"the",
"specified",
"{",
"@link",
"ClassLoader",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java#L92-L107 | train | Load the first available libraries. | [
30522,
2270,
10763,
11675,
7170,
8873,
12096,
12462,
11733,
3468,
1006,
2465,
11066,
2121,
7170,
2121,
1010,
5164,
1012,
1012,
1012,
3415,
1007,
1063,
2862,
1026,
5466,
3085,
1028,
13712,
1027,
2047,
9140,
9863,
1026,
5466,
3085,
1028,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java | MutablePropertySources.assertLegalRelativeAddition | protected void assertLegalRelativeAddition(String relativePropertySourceName, PropertySource<?> propertySource) {
String newPropertySourceName = propertySource.getName();
if (relativePropertySourceName.equals(newPropertySourceName)) {
throw new IllegalArgumentException(
"PropertySource named '" + newPropertySourceName + "' cannot be added relative to itself");
}
} | java | protected void assertLegalRelativeAddition(String relativePropertySourceName, PropertySource<?> propertySource) {
String newPropertySourceName = propertySource.getName();
if (relativePropertySourceName.equals(newPropertySourceName)) {
throw new IllegalArgumentException(
"PropertySource named '" + newPropertySourceName + "' cannot be added relative to itself");
}
} | [
"protected",
"void",
"assertLegalRelativeAddition",
"(",
"String",
"relativePropertySourceName",
",",
"PropertySource",
"<",
"?",
">",
"propertySource",
")",
"{",
"String",
"newPropertySourceName",
"=",
"propertySource",
".",
"getName",
"(",
")",
";",
"if",
"(",
"re... | Ensure that the given property source is not being added relative to itself. | [
"Ensure",
"that",
"the",
"given",
"property",
"source",
"is",
"not",
"being",
"added",
"relative",
"to",
"itself",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L184-L190 | train | Assert that a property source is legal relative to itself. | [
30522,
5123,
11675,
20865,
23115,
2389,
16570,
8082,
4215,
20562,
1006,
5164,
5816,
21572,
4842,
3723,
6499,
3126,
27524,
14074,
1010,
3200,
6499,
3126,
3401,
1026,
1029,
1028,
3200,
6499,
3126,
3401,
1007,
1063,
5164,
2047,
21572,
4842,
37... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.mapStatus | public int mapStatus(Status status) {
String code = getUniformValue(status.getCode());
if (code != null) {
return this.statusMapping.entrySet().stream()
.filter((entry) -> code.equals(getUniformValue(entry.getKey())))
.map(Map.Entry::getValue).findFirst()
.orElse(WebEndpointResponse.STATUS_OK);
}
return WebEndpointResponse.STATUS_OK;
} | java | public int mapStatus(Status status) {
String code = getUniformValue(status.getCode());
if (code != null) {
return this.statusMapping.entrySet().stream()
.filter((entry) -> code.equals(getUniformValue(entry.getKey())))
.map(Map.Entry::getValue).findFirst()
.orElse(WebEndpointResponse.STATUS_OK);
}
return WebEndpointResponse.STATUS_OK;
} | [
"public",
"int",
"mapStatus",
"(",
"Status",
"status",
")",
"{",
"String",
"code",
"=",
"getUniformValue",
"(",
"status",
".",
"getCode",
"(",
")",
")",
";",
"if",
"(",
"code",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"statusMapping",
".",
"entry... | Map the specified {@link Status} to an HTTP status code.
@param status the health {@link Status}
@return the corresponding HTTP status code | [
"Map",
"the",
"specified",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L102-L111 | train | Maps the status code to the status code. | [
30522,
2270,
20014,
7341,
29336,
2271,
1006,
3570,
3570,
1007,
1063,
5164,
3642,
1027,
2131,
19496,
14192,
10175,
5657,
1006,
3570,
1012,
2131,
16044,
1006,
1007,
1007,
1025,
2065,
1006,
3642,
999,
1027,
19701,
1007,
1063,
2709,
2023,
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/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.copyUTF8String | private UTF8String copyUTF8String(int start, int end) {
int len = end - start + 1;
byte[] newBytes = new byte[len];
copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len);
return UTF8String.fromBytes(newBytes);
} | java | private UTF8String copyUTF8String(int start, int end) {
int len = end - start + 1;
byte[] newBytes = new byte[len];
copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len);
return UTF8String.fromBytes(newBytes);
} | [
"private",
"UTF8String",
"copyUTF8String",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"len",
"=",
"end",
"-",
"start",
"+",
"1",
";",
"byte",
"[",
"]",
"newBytes",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"copyMemory",
"(",
"base",
"... | Copy the bytes from the current UTF8String, and make a new UTF8String.
@param start the start position of the current UTF8String in bytes.
@param end the end position of the current UTF8String in bytes.
@return a new UTF8String in the position of [start, end] of current UTF8String bytes. | [
"Copy",
"the",
"bytes",
"from",
"the",
"current",
"UTF8String",
"and",
"make",
"a",
"new",
"UTF8String",
"."
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L525-L530 | train | Copy a UTF8String from the given range of bytes. | [
30522,
2797,
21183,
2546,
2620,
3367,
4892,
6100,
4904,
2546,
2620,
3367,
4892,
1006,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
20014,
18798,
1027,
2203,
1011,
2707,
1009,
1015,
1025,
24880,
1031,
1033,
2047,
3762,
4570,
1027,
2047,
24880... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/HttpResponse.java | HttpResponse.getFileNameFromDisposition | private String getFileNameFromDisposition() {
String fileName = null;
final String desposition = header(Header.CONTENT_DISPOSITION);
if (StrUtil.isNotBlank(desposition)) {
fileName = ReUtil.get("filename=\"(.*?)\"", desposition, 1);
if (StrUtil.isBlank(fileName)) {
fileName = StrUtil.subAfter(desposition, "filename=", true);
}
}
return fileName;
} | java | private String getFileNameFromDisposition() {
String fileName = null;
final String desposition = header(Header.CONTENT_DISPOSITION);
if (StrUtil.isNotBlank(desposition)) {
fileName = ReUtil.get("filename=\"(.*?)\"", desposition, 1);
if (StrUtil.isBlank(fileName)) {
fileName = StrUtil.subAfter(desposition, "filename=", true);
}
}
return fileName;
} | [
"private",
"String",
"getFileNameFromDisposition",
"(",
")",
"{",
"String",
"fileName",
"=",
"null",
";",
"final",
"String",
"desposition",
"=",
"header",
"(",
"Header",
".",
"CONTENT_DISPOSITION",
")",
";",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"despo... | 从Content-Disposition头中获取文件名
@return 文件名,empty表示无 | [
"从Content",
"-",
"Disposition头中获取文件名"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L449-L459 | train | Gets the filename from disposition header. | [
30522,
2797,
5164,
2131,
8873,
20844,
4168,
19699,
5358,
10521,
26994,
1006,
1007,
1063,
5164,
5371,
18442,
1027,
19701,
1025,
2345,
5164,
4078,
26994,
1027,
20346,
1006,
20346,
1012,
4180,
1035,
22137,
1007,
1025,
2065,
1006,
2358,
22134,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/GraphCsvReader.java | GraphCsvReader.vertexTypes | @SuppressWarnings({ "serial", "unchecked" })
public <K, VV> Graph<K, VV, NullValue> vertexTypes(Class<K> vertexKey, Class<VV> vertexValue) {
if (edgeReader == null) {
throw new RuntimeException("The edge input file cannot be null!");
}
DataSet<Edge<K, NullValue>> edges = edgeReader
.types(vertexKey, vertexKey)
.name(GraphCsvReader.class.getName())
.map(new Tuple2ToEdgeMap<>())
.name("To Edge");
// the vertex value can be provided by an input file or a user-defined mapper
if (vertexReader != null) {
DataSet<Vertex<K, VV>> vertices = vertexReader
.types(vertexKey, vertexValue)
.name(GraphCsvReader.class.getName())
.map(new Tuple2ToVertexMap<>())
.name("Type conversion");
return Graph.fromDataSet(vertices, edges, executionContext);
}
else if (mapper != null) {
return Graph.fromDataSet(edges, (MapFunction<K, VV>) mapper, executionContext);
}
else {
throw new RuntimeException("Vertex values have to be specified through a vertices input file"
+ "or a user-defined map function.");
}
} | java | @SuppressWarnings({ "serial", "unchecked" })
public <K, VV> Graph<K, VV, NullValue> vertexTypes(Class<K> vertexKey, Class<VV> vertexValue) {
if (edgeReader == null) {
throw new RuntimeException("The edge input file cannot be null!");
}
DataSet<Edge<K, NullValue>> edges = edgeReader
.types(vertexKey, vertexKey)
.name(GraphCsvReader.class.getName())
.map(new Tuple2ToEdgeMap<>())
.name("To Edge");
// the vertex value can be provided by an input file or a user-defined mapper
if (vertexReader != null) {
DataSet<Vertex<K, VV>> vertices = vertexReader
.types(vertexKey, vertexValue)
.name(GraphCsvReader.class.getName())
.map(new Tuple2ToVertexMap<>())
.name("Type conversion");
return Graph.fromDataSet(vertices, edges, executionContext);
}
else if (mapper != null) {
return Graph.fromDataSet(edges, (MapFunction<K, VV>) mapper, executionContext);
}
else {
throw new RuntimeException("Vertex values have to be specified through a vertices input file"
+ "or a user-defined map function.");
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"serial\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"K",
",",
"VV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"NullValue",
">",
"vertexTypes",
"(",
"Class",
"<",
"K",
">",
"vertexKey",
",",
"Class",
"<",
"VV"... | Creates a Graph from CSV input without edge values.
The vertex values are specified through a vertices input file or a user-defined map function.
If no vertices input file is provided, the vertex IDs are automatically created from the edges
input file.
@param vertexKey the type of the vertex IDs
@param vertexValue the type of the vertex values
@return a Graph where the vertex IDs and vertex values. | [
"Creates",
"a",
"Graph",
"from",
"CSV",
"input",
"without",
"edge",
"values",
".",
"The",
"vertex",
"values",
"are",
"specified",
"through",
"a",
"vertices",
"input",
"file",
"or",
"a",
"user",
"-",
"defined",
"map",
"function",
".",
"If",
"no",
"vertices"... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/GraphCsvReader.java#L176-L206 | train | Returns a Graph from CSV input file containing the vertex types of the given vertex key and vertex value. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
7642,
1000,
1010,
1000,
4895,
5403,
18141,
1000,
1065,
1007,
2270,
1026,
1047,
1010,
1058,
2615,
1028,
10629,
1026,
1047,
1010,
1058,
2615,
1010,
19701,
10175,
5657,
1028,
19449,
13874... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java | ShardingEncryptorEngine.getEncryptTableNames | public Collection<String> getEncryptTableNames() {
Set<String> result = new LinkedHashSet<>();
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
result.addAll(each.getEncryptTableNames());
}
return result;
} | java | public Collection<String> getEncryptTableNames() {
Set<String> result = new LinkedHashSet<>();
for (ShardingEncryptorStrategy each : shardingEncryptorStrategies.values()) {
result.addAll(each.getEncryptTableNames());
}
return result;
} | [
"public",
"Collection",
"<",
"String",
">",
"getEncryptTableNames",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
"ShardingEncryptorStrategy",
"each",
":",
"shardingEncryptorStrategies",
".",
... | Get encrypt table names.
@return encrypt table names | [
"Get",
"encrypt",
"table",
"names",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorEngine.java#L119-L125 | train | Get the list of table names for encrypting | [
30522,
2270,
3074,
1026,
5164,
1028,
2131,
2368,
26775,
22571,
5946,
3468,
18442,
2015,
1006,
1007,
1063,
2275,
1026,
5164,
1028,
2765,
1027,
2047,
5799,
14949,
7898,
3388,
1026,
1028,
1006,
1007,
1025,
2005,
1006,
21146,
17080,
25997,
2677... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/concurrent/FutureUtils.java | FutureUtils.thenComposeAsyncIfNotDone | public static <IN, OUT> CompletableFuture<OUT> thenComposeAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
Function<? super IN, ? extends CompletionStage<OUT>> composeFun) {
return completableFuture.isDone() ?
completableFuture.thenCompose(composeFun) :
completableFuture.thenComposeAsync(composeFun, executor);
} | java | public static <IN, OUT> CompletableFuture<OUT> thenComposeAsyncIfNotDone(
CompletableFuture<IN> completableFuture,
Executor executor,
Function<? super IN, ? extends CompletionStage<OUT>> composeFun) {
return completableFuture.isDone() ?
completableFuture.thenCompose(composeFun) :
completableFuture.thenComposeAsync(composeFun, executor);
} | [
"public",
"static",
"<",
"IN",
",",
"OUT",
">",
"CompletableFuture",
"<",
"OUT",
">",
"thenComposeAsyncIfNotDone",
"(",
"CompletableFuture",
"<",
"IN",
">",
"completableFuture",
",",
"Executor",
"executor",
",",
"Function",
"<",
"?",
"super",
"IN",
",",
"?",
... | This function takes a {@link CompletableFuture} and a function to compose with this future. If the input future
is already done, this function returns {@link CompletableFuture#thenCompose(Function)}. Otherwise, the return
value is {@link CompletableFuture#thenComposeAsync(Function, Executor)} with the given executor.
@param completableFuture the completable future for which we want to compose.
@param executor the executor to run the compose function if the future is not yet done.
@param composeFun the function to compose.
@param <IN> type of the input future.
@param <OUT> type of the output future.
@return a completable future that is a composition of the input future and the function. | [
"This",
"function",
"takes",
"a",
"{",
"@link",
"CompletableFuture",
"}",
"and",
"a",
"function",
"to",
"compose",
"with",
"this",
"future",
".",
"If",
"the",
"input",
"future",
"is",
"already",
"done",
"this",
"function",
"returns",
"{",
"@link",
"Completab... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L858-L865 | train | A CompletableFuture that is asynchronously completed if the given CompletableFuture is not done. | [
30522,
2270,
10763,
1026,
1999,
1010,
2041,
1028,
4012,
10814,
10880,
11263,
11244,
1026,
2041,
1028,
2059,
9006,
20688,
3022,
6038,
6895,
2546,
17048,
5280,
2063,
1006,
4012,
10814,
10880,
11263,
11244,
1026,
1999,
1028,
4012,
10814,
10880,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/PendingWriteQueue.java | PendingWriteQueue.remove | public ChannelPromise remove() {
assert ctx.executor().inEventLoop();
PendingWrite write = head;
if (write == null) {
return null;
}
ChannelPromise promise = write.promise;
ReferenceCountUtil.safeRelease(write.msg);
recycle(write, true);
return promise;
} | java | public ChannelPromise remove() {
assert ctx.executor().inEventLoop();
PendingWrite write = head;
if (write == null) {
return null;
}
ChannelPromise promise = write.promise;
ReferenceCountUtil.safeRelease(write.msg);
recycle(write, true);
return promise;
} | [
"public",
"ChannelPromise",
"remove",
"(",
")",
"{",
"assert",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"(",
")",
";",
"PendingWrite",
"write",
"=",
"head",
";",
"if",
"(",
"write",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Ch... | Removes a pending write operation and release it's message via {@link ReferenceCountUtil#safeRelease(Object)}.
@return {@link ChannelPromise} of the pending write or {@code null} if the queue is empty. | [
"Removes",
"a",
"pending",
"write",
"operation",
"and",
"release",
"it",
"s",
"message",
"via",
"{",
"@link",
"ReferenceCountUtil#safeRelease",
"(",
"Object",
")",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/PendingWriteQueue.java#L238-L248 | train | Remove the current entry from the cache. | [
30522,
2270,
3149,
21572,
28732,
6366,
1006,
1007,
1063,
20865,
14931,
2595,
1012,
4654,
8586,
16161,
2099,
1006,
1007,
1012,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
14223,
26373,
4339,
1027,
2132,
1025,
2065,
1006,
4339,
1027,
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-json/src/main/java/cn/hutool/json/JSONStrFormater.java | JSONStrFormater.format | public static String format(String json) {
final StringBuffer result = new StringBuffer();
Character wrapChar = null;
boolean isEscapeMode = false;
int length = json.length();
int number = 0;
char key = 0;
for (int i = 0; i < length; i++) {
key = json.charAt(i);
if('"' == key || '\'' == key) {
if(null == wrapChar) {
//字符串模式开始
wrapChar = key;
}else if(isEscapeMode) {
//在字符串模式下的转义
isEscapeMode = false;
}else if(wrapChar.equals(key)){
//字符串包装结束
wrapChar = null;
}
result.append(key);
continue;
}else if('\\' == key) {
if(null != wrapChar) {
//字符串模式下转义有效
isEscapeMode = !isEscapeMode;
result.append(key);
continue;
}else {
result.append(key);
}
}
if(null != wrapChar) {
//字符串模式
result.append(key);
continue;
}
//如果当前字符是前方括号、前花括号做如下处理:
if ((key == '[') || (key == '{')) {
//如果前面还有字符,并且字符为“:”,打印:换行和缩进字符字符串。
if ((i - 1 > 0) && (json.charAt(i - 1) == ':')) {
result.append(NEW_LINE);
result.append(indent(number));
}
result.append(key);
//前方括号、前花括号,的后面必须换行。打印:换行。
result.append(NEW_LINE);
//每出现一次前方括号、前花括号;缩进次数增加一次。打印:新行缩进。
number++;
result.append(indent(number));
continue;
}
// 3、如果当前字符是后方括号、后花括号做如下处理:
if ((key == ']') || (key == '}')) {
// (1)后方括号、后花括号,的前面必须换行。打印:换行。
result.append(NEW_LINE);
// (2)每出现一次后方括号、后花括号;缩进次数减少一次。打印:缩进。
number--;
result.append(indent(number));
// (3)打印:当前字符。
result.append(key);
// (4)如果当前字符后面还有字符,并且字符不为“,”,打印:换行。
if (((i + 1) < length) && (json.charAt(i + 1) != ',')) {
result.append(NEW_LINE);
}
// (5)继续下一次循环。
continue;
}
// 4、如果当前字符是逗号。逗号后面换行,并缩进,不改变缩进次数。
if ((key == ',')) {
result.append(key);
result.append(NEW_LINE);
result.append(indent(number));
continue;
}
// 5、打印:当前字符。
result.append(key);
}
return result.toString();
} | java | public static String format(String json) {
final StringBuffer result = new StringBuffer();
Character wrapChar = null;
boolean isEscapeMode = false;
int length = json.length();
int number = 0;
char key = 0;
for (int i = 0; i < length; i++) {
key = json.charAt(i);
if('"' == key || '\'' == key) {
if(null == wrapChar) {
//字符串模式开始
wrapChar = key;
}else if(isEscapeMode) {
//在字符串模式下的转义
isEscapeMode = false;
}else if(wrapChar.equals(key)){
//字符串包装结束
wrapChar = null;
}
result.append(key);
continue;
}else if('\\' == key) {
if(null != wrapChar) {
//字符串模式下转义有效
isEscapeMode = !isEscapeMode;
result.append(key);
continue;
}else {
result.append(key);
}
}
if(null != wrapChar) {
//字符串模式
result.append(key);
continue;
}
//如果当前字符是前方括号、前花括号做如下处理:
if ((key == '[') || (key == '{')) {
//如果前面还有字符,并且字符为“:”,打印:换行和缩进字符字符串。
if ((i - 1 > 0) && (json.charAt(i - 1) == ':')) {
result.append(NEW_LINE);
result.append(indent(number));
}
result.append(key);
//前方括号、前花括号,的后面必须换行。打印:换行。
result.append(NEW_LINE);
//每出现一次前方括号、前花括号;缩进次数增加一次。打印:新行缩进。
number++;
result.append(indent(number));
continue;
}
// 3、如果当前字符是后方括号、后花括号做如下处理:
if ((key == ']') || (key == '}')) {
// (1)后方括号、后花括号,的前面必须换行。打印:换行。
result.append(NEW_LINE);
// (2)每出现一次后方括号、后花括号;缩进次数减少一次。打印:缩进。
number--;
result.append(indent(number));
// (3)打印:当前字符。
result.append(key);
// (4)如果当前字符后面还有字符,并且字符不为“,”,打印:换行。
if (((i + 1) < length) && (json.charAt(i + 1) != ',')) {
result.append(NEW_LINE);
}
// (5)继续下一次循环。
continue;
}
// 4、如果当前字符是逗号。逗号后面换行,并缩进,不改变缩进次数。
if ((key == ',')) {
result.append(key);
result.append(NEW_LINE);
result.append(indent(number));
continue;
}
// 5、打印:当前字符。
result.append(key);
}
return result.toString();
} | [
"public",
"static",
"String",
"format",
"(",
"String",
"json",
")",
"{",
"final",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Character",
"wrapChar",
"=",
"null",
";",
"boolean",
"isEscapeMode",
"=",
"false",
";",
"int",
"length",
... | 返回格式化JSON字符串。
@param json 未格式化的JSON字符串。
@return 格式化的JSON字符串。 | [
"返回格式化JSON字符串。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONStrFormater.java#L25-L112 | train | Format a JSON string. | [
30522,
2270,
10763,
5164,
4289,
1006,
5164,
30524,
1007,
1025,
2839,
10236,
7507,
2099,
1027,
19701,
1025,
22017,
20898,
2003,
2229,
19464,
5302,
3207,
1027,
6270,
1025,
20014,
3091,
1027,
1046,
3385,
1012,
3091,
1006,
1007,
1025,
20014,
21... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java | ResultPartitionMetrics.registerQueueLengthMetrics | public static void registerQueueLengthMetrics(MetricGroup group, ResultPartition partition) {
ResultPartitionMetrics metrics = new ResultPartitionMetrics(partition);
group.gauge("totalQueueLen", metrics.getTotalQueueLenGauge());
group.gauge("minQueueLen", metrics.getMinQueueLenGauge());
group.gauge("maxQueueLen", metrics.getMaxQueueLenGauge());
group.gauge("avgQueueLen", metrics.getAvgQueueLenGauge());
} | java | public static void registerQueueLengthMetrics(MetricGroup group, ResultPartition partition) {
ResultPartitionMetrics metrics = new ResultPartitionMetrics(partition);
group.gauge("totalQueueLen", metrics.getTotalQueueLenGauge());
group.gauge("minQueueLen", metrics.getMinQueueLenGauge());
group.gauge("maxQueueLen", metrics.getMaxQueueLenGauge());
group.gauge("avgQueueLen", metrics.getAvgQueueLenGauge());
} | [
"public",
"static",
"void",
"registerQueueLengthMetrics",
"(",
"MetricGroup",
"group",
",",
"ResultPartition",
"partition",
")",
"{",
"ResultPartitionMetrics",
"metrics",
"=",
"new",
"ResultPartitionMetrics",
"(",
"partition",
")",
";",
"group",
".",
"gauge",
"(",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartitionMetrics.java#L161-L168 | train | Register Queue Length Metrics. | [
30522,
2270,
10763,
11675,
4236,
4226,
16284,
13159,
2705,
12589,
2015,
1006,
12046,
17058,
2177,
1010,
2765,
19362,
3775,
3508,
13571,
1007,
1063,
2765,
19362,
3775,
3508,
12589,
2015,
12046,
2015,
1027,
2047,
2765,
19362,
3775,
3508,
12589,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ArrayUtil.java | ArrayUtil.containsAny | @SuppressWarnings("unchecked")
public static <T> boolean containsAny(T[] array, T... values) {
for (T value : values) {
if(contains(array, value)) {
return true;
}
}
return false;
} | java | @SuppressWarnings("unchecked")
public static <T> boolean containsAny(T[] array, T... values) {
for (T value : values) {
if(contains(array, value)) {
return true;
}
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"boolean",
"containsAny",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"...",
"values",
")",
"{",
"for",
"(",
"T",
"value",
":",
"values",
")",
"{",
"if",
"(",
"contains... | 数组中是否包含指定元素中的任意一个
@param <T> 数组元素类型
@param array 数组
@param values 被检查的多个元素
@return 是否包含指定元素中的任意一个
@since 4.1.20 | [
"数组中是否包含指定元素中的任意一个"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L970-L978 | train | Returns true if any of the specified values in the array is contained in any of the specified values. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
22017,
20898,
3397,
19092,
1006,
1056,
1031,
1033,
9140,
1010,
1056,
1012,
1012,
1012,
5300,
1007,
1063,
2005,
1006,
1056,
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/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.copyTo | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
final byte[] thisHeapRef = this.heapMemory;
final byte[] otherHeapRef = target.heapMemory;
final long thisPointer = this.address + offset;
final long otherPointer = target.address + targetOffset;
if ((numBytes | offset | targetOffset) >= 0 &&
thisPointer <= this.addressLimit - numBytes && otherPointer <= target.addressLimit - numBytes) {
UNSAFE.copyMemory(thisHeapRef, thisPointer, otherHeapRef, otherPointer, numBytes);
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (target.address > target.addressLimit) {
throw new IllegalStateException("target memory segment has been freed.");
}
else {
throw new IndexOutOfBoundsException(
String.format("offset=%d, targetOffset=%d, numBytes=%d, address=%d, targetAddress=%d",
offset, targetOffset, numBytes, this.address, target.address));
}
} | java | public final void copyTo(int offset, MemorySegment target, int targetOffset, int numBytes) {
final byte[] thisHeapRef = this.heapMemory;
final byte[] otherHeapRef = target.heapMemory;
final long thisPointer = this.address + offset;
final long otherPointer = target.address + targetOffset;
if ((numBytes | offset | targetOffset) >= 0 &&
thisPointer <= this.addressLimit - numBytes && otherPointer <= target.addressLimit - numBytes) {
UNSAFE.copyMemory(thisHeapRef, thisPointer, otherHeapRef, otherPointer, numBytes);
}
else if (this.address > this.addressLimit) {
throw new IllegalStateException("this memory segment has been freed.");
}
else if (target.address > target.addressLimit) {
throw new IllegalStateException("target memory segment has been freed.");
}
else {
throw new IndexOutOfBoundsException(
String.format("offset=%d, targetOffset=%d, numBytes=%d, address=%d, targetAddress=%d",
offset, targetOffset, numBytes, this.address, target.address));
}
} | [
"public",
"final",
"void",
"copyTo",
"(",
"int",
"offset",
",",
"MemorySegment",
"target",
",",
"int",
"targetOffset",
",",
"int",
"numBytes",
")",
"{",
"final",
"byte",
"[",
"]",
"thisHeapRef",
"=",
"this",
".",
"heapMemory",
";",
"final",
"byte",
"[",
... | Bulk copy method. Copies {@code numBytes} bytes from this memory segment, starting at position
{@code offset} to the target memory segment. The bytes will be put into the target segment
starting at position {@code targetOffset}.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The memory segment to copy the bytes to.
@param targetOffset The position in the target memory segment to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If either of the offsets is invalid, or the source segment does not
contain the given number of bytes (starting from offset), or the target segment does
not have enough space for the bytes (counting from targetOffset). | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"from",
"this",
"memory",
"segment",
"starting",
"at",
"position",
"{",
"@code",
"offset",
"}",
"to",
"the",
"target",
"memory",
"segment",
".",
"The",
"bytes",
"will",
"be",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1250-L1271 | train | Copies the given memory segment to the given target memory segment. | [
30522,
2270,
2345,
11675,
6100,
3406,
1006,
20014,
16396,
1010,
3638,
3366,
21693,
4765,
4539,
1010,
20014,
4539,
27475,
3388,
1010,
20014,
15903,
17250,
2015,
1007,
1063,
2345,
24880,
1031,
1033,
2023,
20192,
28139,
2546,
1027,
2023,
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/template/engine/beetl/BeetlUtil.java | BeetlUtil.getFileTemplate | public static Template getFileTemplate(String dir, String templateFileName) {
return getTemplate(createFileGroupTemplate(dir), templateFileName);
} | java | public static Template getFileTemplate(String dir, String templateFileName) {
return getTemplate(createFileGroupTemplate(dir), templateFileName);
} | [
"public",
"static",
"Template",
"getFileTemplate",
"(",
"String",
"dir",
",",
"String",
"templateFileName",
")",
"{",
"return",
"getTemplate",
"(",
"createFileGroupTemplate",
"(",
"dir",
")",
",",
"templateFileName",
")",
";",
"}"
] | 获得本地文件模板
@param dir 目录绝对路径
@param templateFileName 模板内容
@return 模板
@since 3.2.0 | [
"获得本地文件模板"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L169-L171 | train | Gets the file template from the given directory and template file name. | [
30522,
2270,
10763,
23561,
2131,
8873,
25890,
8737,
13806,
1006,
5164,
16101,
1010,
5164,
23561,
8873,
20844,
4168,
1007,
1063,
2709,
2131,
18532,
15725,
1006,
3443,
8873,
23115,
22107,
18532,
15725,
1006,
16101,
1007,
1010,
23561,
8873,
2084... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.createMap | public static <K, V> Map<K, V> createMap(Class<?> mapType) {
return MapUtil.createMap(mapType);
} | java | public static <K, V> Map<K, V> createMap(Class<?> mapType) {
return MapUtil.createMap(mapType);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"createMap",
"(",
"Class",
"<",
"?",
">",
"mapType",
")",
"{",
"return",
"MapUtil",
".",
"createMap",
"(",
"mapType",
")",
";",
"}"
] | 创建Map<br>
传入抽象Map{@link AbstractMap}和{@link Map}类将默认创建{@link HashMap}
@param <K> map键类型
@param <V> map值类型
@param mapType map类型
@return {@link Map}实例
@see MapUtil#createMap(Class) | [
"创建Map<br",
">",
"传入抽象Map",
"{",
"@link",
"AbstractMap",
"}",
"和",
"{",
"@link",
"Map",
"}",
"类将默认创建",
"{",
"@link",
"HashMap",
"}"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L784-L786 | train | Creates a map of the given type. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1047,
1010,
1058,
1028,
3443,
2863,
2361,
1006,
2465,
1026,
1029,
1028,
4949,
13874,
1007,
1063,
2709,
4949,
21823,
2140,
1012,
3443,
2863,
2361,
1006,
4949,
13874,
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-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.schedule | public Scheduler schedule(String id, String pattern, Task task) {
return schedule(id, new CronPattern(pattern), task);
} | java | public Scheduler schedule(String id, String pattern, Task task) {
return schedule(id, new CronPattern(pattern), task);
} | [
"public",
"Scheduler",
"schedule",
"(",
"String",
"id",
",",
"String",
"pattern",
",",
"Task",
"task",
")",
"{",
"return",
"schedule",
"(",
"id",
",",
"new",
"CronPattern",
"(",
"pattern",
")",
",",
"task",
")",
";",
"}"
] | 新增Task
@param id ID,为每一个Task定义一个ID
@param pattern {@link CronPattern}对应的String表达式
@param task {@link Task}
@return this | [
"新增Task"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L243-L245 | train | Schedule a task for the given task id and pattern. | [
30522,
2270,
6134,
2099,
6134,
1006,
5164,
8909,
1010,
5164,
5418,
1010,
4708,
4708,
1007,
1063,
2709,
6134,
1006,
8909,
1010,
2047,
13675,
2239,
4502,
12079,
2078,
1006,
5418,
1007,
1010,
4708,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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/slotpool/SlotSharingManager.java | SlotSharingManager.getUnresolvedRootSlot | @Nullable
MultiTaskSlot getUnresolvedRootSlot(AbstractID groupId) {
for (MultiTaskSlot multiTaskSlot : unresolvedRootSlots.values()) {
if (!multiTaskSlot.contains(groupId)) {
return multiTaskSlot;
}
}
return null;
} | java | @Nullable
MultiTaskSlot getUnresolvedRootSlot(AbstractID groupId) {
for (MultiTaskSlot multiTaskSlot : unresolvedRootSlots.values()) {
if (!multiTaskSlot.contains(groupId)) {
return multiTaskSlot;
}
}
return null;
} | [
"@",
"Nullable",
"MultiTaskSlot",
"getUnresolvedRootSlot",
"(",
"AbstractID",
"groupId",
")",
"{",
"for",
"(",
"MultiTaskSlot",
"multiTaskSlot",
":",
"unresolvedRootSlots",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"multiTaskSlot",
".",
"contains",
"(",... | Gets an unresolved slot which does not yet contain the given groupId. An unresolved
slot is a slot whose underlying allocated slot has not been allocated yet.
@param groupId which the returned slot must not contain
@return the unresolved slot or null if there was no root slot with free capacities | [
"Gets",
"an",
"unresolved",
"slot",
"which",
"does",
"not",
"yet",
"contain",
"the",
"given",
"groupId",
".",
"An",
"unresolved",
"slot",
"is",
"a",
"slot",
"whose",
"underlying",
"allocated",
"slot",
"has",
"not",
"been",
"allocated",
"yet",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java#L203-L212 | train | Returns the unresolved root slot for the given group ID. | [
30522,
1030,
19701,
3085,
4800,
10230,
5705,
10994,
2131,
4609,
6072,
16116,
3217,
12868,
10994,
1006,
10061,
3593,
2177,
3593,
1007,
1063,
2005,
1006,
4800,
10230,
5705,
10994,
4800,
10230,
5705,
10994,
1024,
4895,
6072,
16116,
3217,
12868,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/fs/FileSystem.java | FileSystem.loadFileSystemFactories | private static List<FileSystemFactory> loadFileSystemFactories(
Collection<Supplier<Iterator<FileSystemFactory>>> factoryIteratorsSuppliers) {
final ArrayList<FileSystemFactory> list = new ArrayList<>();
// by default, we always have the local file system factory
list.add(new LocalFileSystemFactory());
LOG.debug("Loading extension file systems via services");
for (Supplier<Iterator<FileSystemFactory>> factoryIteratorsSupplier : factoryIteratorsSuppliers) {
try {
addAllFactoriesToList(factoryIteratorsSupplier.get(), list);
} catch (Throwable t) {
// catching Throwable here to handle various forms of class loading
// and initialization errors
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
LOG.error("Failed to load additional file systems via services", t);
}
}
return Collections.unmodifiableList(list);
} | java | private static List<FileSystemFactory> loadFileSystemFactories(
Collection<Supplier<Iterator<FileSystemFactory>>> factoryIteratorsSuppliers) {
final ArrayList<FileSystemFactory> list = new ArrayList<>();
// by default, we always have the local file system factory
list.add(new LocalFileSystemFactory());
LOG.debug("Loading extension file systems via services");
for (Supplier<Iterator<FileSystemFactory>> factoryIteratorsSupplier : factoryIteratorsSuppliers) {
try {
addAllFactoriesToList(factoryIteratorsSupplier.get(), list);
} catch (Throwable t) {
// catching Throwable here to handle various forms of class loading
// and initialization errors
ExceptionUtils.rethrowIfFatalErrorOrOOM(t);
LOG.error("Failed to load additional file systems via services", t);
}
}
return Collections.unmodifiableList(list);
} | [
"private",
"static",
"List",
"<",
"FileSystemFactory",
">",
"loadFileSystemFactories",
"(",
"Collection",
"<",
"Supplier",
"<",
"Iterator",
"<",
"FileSystemFactory",
">",
">",
">",
"factoryIteratorsSuppliers",
")",
"{",
"final",
"ArrayList",
"<",
"FileSystemFactory",
... | Loads the factories for the file systems directly supported by Flink.
Aside from the {@link LocalFileSystem}, these file systems are loaded
via Java's service framework.
@return A map from the file system scheme to corresponding file system factory. | [
"Loads",
"the",
"factories",
"for",
"the",
"file",
"systems",
"directly",
"supported",
"by",
"Flink",
".",
"Aside",
"from",
"the",
"{",
"@link",
"LocalFileSystem",
"}",
"these",
"file",
"systems",
"are",
"loaded",
"via",
"Java",
"s",
"service",
"framework",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/fs/FileSystem.java#L987-L1009 | train | Load the file system factories from the given collection of supplier. | [
30522,
2797,
10763,
2862,
1026,
6764,
27268,
6633,
21450,
1028,
7170,
8873,
4244,
27268,
6633,
7011,
16761,
3111,
1006,
3074,
1026,
17024,
1026,
2009,
6906,
4263,
1026,
6764,
27268,
6633,
21450,
1028,
1028,
1028,
4713,
21646,
18926,
6342,
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... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/type/TypeConverters.java | TypeConverters.createInternalTypeFromTypeInfo | public static InternalType createInternalTypeFromTypeInfo(TypeInformation typeInfo) {
InternalType type = TYPE_INFO_TO_INTERNAL_TYPE.get(typeInfo);
if (type != null) {
return type;
}
if (typeInfo instanceof CompositeType) {
CompositeType compositeType = (CompositeType) typeInfo;
return InternalTypes.createRowType(
Stream.iterate(0, x -> x + 1).limit(compositeType.getArity())
.map((Function<Integer, TypeInformation>) compositeType::getTypeAt)
.map(TypeConverters::createInternalTypeFromTypeInfo)
.toArray(InternalType[]::new),
compositeType.getFieldNames()
);
} else if (typeInfo instanceof DecimalTypeInfo) {
DecimalTypeInfo decimalType = (DecimalTypeInfo) typeInfo;
return InternalTypes.createDecimalType(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof PrimitiveArrayTypeInfo) {
PrimitiveArrayTypeInfo arrayType = (PrimitiveArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentType()));
} else if (typeInfo instanceof BasicArrayTypeInfo) {
BasicArrayTypeInfo arrayType = (BasicArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentInfo()));
} else if (typeInfo instanceof ObjectArrayTypeInfo) {
ObjectArrayTypeInfo arrayType = (ObjectArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentInfo()));
} else if (typeInfo instanceof MapTypeInfo) {
MapTypeInfo mapType = (MapTypeInfo) typeInfo;
return InternalTypes.createMapType(
createInternalTypeFromTypeInfo(mapType.getKeyTypeInfo()),
createInternalTypeFromTypeInfo(mapType.getValueTypeInfo()));
} else if (typeInfo instanceof BinaryMapTypeInfo) {
BinaryMapTypeInfo mapType = (BinaryMapTypeInfo) typeInfo;
return InternalTypes.createMapType(
mapType.getKeyType(), mapType.getValueType());
} else if (typeInfo instanceof BinaryArrayTypeInfo) {
BinaryArrayTypeInfo arrayType = (BinaryArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(arrayType.getElementType());
} else if (typeInfo instanceof BigDecimalTypeInfo) {
BigDecimalTypeInfo decimalType = (BigDecimalTypeInfo) typeInfo;
return new DecimalType(decimalType.precision(), decimalType.scale());
} else {
return InternalTypes.createGenericType(typeInfo);
}
} | java | public static InternalType createInternalTypeFromTypeInfo(TypeInformation typeInfo) {
InternalType type = TYPE_INFO_TO_INTERNAL_TYPE.get(typeInfo);
if (type != null) {
return type;
}
if (typeInfo instanceof CompositeType) {
CompositeType compositeType = (CompositeType) typeInfo;
return InternalTypes.createRowType(
Stream.iterate(0, x -> x + 1).limit(compositeType.getArity())
.map((Function<Integer, TypeInformation>) compositeType::getTypeAt)
.map(TypeConverters::createInternalTypeFromTypeInfo)
.toArray(InternalType[]::new),
compositeType.getFieldNames()
);
} else if (typeInfo instanceof DecimalTypeInfo) {
DecimalTypeInfo decimalType = (DecimalTypeInfo) typeInfo;
return InternalTypes.createDecimalType(decimalType.precision(), decimalType.scale());
} else if (typeInfo instanceof PrimitiveArrayTypeInfo) {
PrimitiveArrayTypeInfo arrayType = (PrimitiveArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentType()));
} else if (typeInfo instanceof BasicArrayTypeInfo) {
BasicArrayTypeInfo arrayType = (BasicArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentInfo()));
} else if (typeInfo instanceof ObjectArrayTypeInfo) {
ObjectArrayTypeInfo arrayType = (ObjectArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(
createInternalTypeFromTypeInfo(arrayType.getComponentInfo()));
} else if (typeInfo instanceof MapTypeInfo) {
MapTypeInfo mapType = (MapTypeInfo) typeInfo;
return InternalTypes.createMapType(
createInternalTypeFromTypeInfo(mapType.getKeyTypeInfo()),
createInternalTypeFromTypeInfo(mapType.getValueTypeInfo()));
} else if (typeInfo instanceof BinaryMapTypeInfo) {
BinaryMapTypeInfo mapType = (BinaryMapTypeInfo) typeInfo;
return InternalTypes.createMapType(
mapType.getKeyType(), mapType.getValueType());
} else if (typeInfo instanceof BinaryArrayTypeInfo) {
BinaryArrayTypeInfo arrayType = (BinaryArrayTypeInfo) typeInfo;
return InternalTypes.createArrayType(arrayType.getElementType());
} else if (typeInfo instanceof BigDecimalTypeInfo) {
BigDecimalTypeInfo decimalType = (BigDecimalTypeInfo) typeInfo;
return new DecimalType(decimalType.precision(), decimalType.scale());
} else {
return InternalTypes.createGenericType(typeInfo);
}
} | [
"public",
"static",
"InternalType",
"createInternalTypeFromTypeInfo",
"(",
"TypeInformation",
"typeInfo",
")",
"{",
"InternalType",
"type",
"=",
"TYPE_INFO_TO_INTERNAL_TYPE",
".",
"get",
"(",
"typeInfo",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"return... | Create a {@link InternalType} from a {@link TypeInformation}.
<p>Note: Information may be lost. For example, after Pojo is converted to InternalType,
we no longer know that it is a Pojo and only think it is a Row.
<p>Eg:
{@link BasicTypeInfo#STRING_TYPE_INFO} => {@link InternalTypes#STRING}.
{@link BasicTypeInfo#BIG_DEC_TYPE_INFO} => {@link DecimalType}.
{@link RowTypeInfo} => {@link RowType}.
{@link PojoTypeInfo} (CompositeType) => {@link RowType}.
{@link TupleTypeInfo} (CompositeType) => {@link RowType}. | [
"Create",
"a",
"{",
"@link",
"InternalType",
"}",
"from",
"a",
"{",
"@link",
"TypeInformation",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/type/TypeConverters.java#L137-L185 | train | Creates an internal type from the given type information. | [
30522,
2270,
10763,
4722,
13874,
3443,
18447,
11795,
2389,
13874,
19699,
5358,
13874,
2378,
14876,
1006,
2828,
2378,
14192,
3370,
2828,
2378,
14876,
1007,
1063,
4722,
13874,
2828,
1027,
2828,
1035,
18558,
1035,
2000,
1035,
4722,
1035,
2828,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/spdy/SpdyCodecUtil.java | SpdyCodecUtil.getUnsignedInt | static int getUnsignedInt(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0x7F) << 24 |
(buf.getByte(offset + 1) & 0xFF) << 16 |
(buf.getByte(offset + 2) & 0xFF) << 8 |
buf.getByte(offset + 3) & 0xFF;
} | java | static int getUnsignedInt(ByteBuf buf, int offset) {
return (buf.getByte(offset) & 0x7F) << 24 |
(buf.getByte(offset + 1) & 0xFF) << 16 |
(buf.getByte(offset + 2) & 0xFF) << 8 |
buf.getByte(offset + 3) & 0xFF;
} | [
"static",
"int",
"getUnsignedInt",
"(",
"ByteBuf",
"buf",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"buf",
".",
"getByte",
"(",
"offset",
")",
"&",
"0x7F",
")",
"<<",
"24",
"|",
"(",
"buf",
".",
"getByte",
"(",
"offset",
"+",
"1",
")",
"&",
... | Reads a big-endian (31-bit) integer from the buffer. | [
"Reads",
"a",
"big",
"-",
"endian",
"(",
"31",
"-",
"bit",
")",
"integer",
"from",
"the",
"buffer",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java#L260-L265 | train | Get an unsigned int from the buffer. | [
30522,
10763,
20014,
2131,
30524,
1012,
2131,
3762,
2618,
1006,
16396,
1007,
1004,
1014,
2595,
2581,
2546,
1007,
1026,
1026,
2484,
1064,
1006,
20934,
2546,
1012,
2131,
3762,
2618,
1006,
16396,
1009,
1015,
1007,
1004,
1014,
2595,
4246,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java | DataSourceProperties.determineUsername | public String determineUsername() {
if (StringUtils.hasText(this.username)) {
return this.username;
}
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
return "sa";
}
return null;
} | java | public String determineUsername() {
if (StringUtils.hasText(this.username)) {
return this.username;
}
if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) {
return "sa";
}
return null;
} | [
"public",
"String",
"determineUsername",
"(",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"this",
".",
"username",
")",
")",
"{",
"return",
"this",
".",
"username",
";",
"}",
"if",
"(",
"EmbeddedDatabaseConnection",
".",
"isEmbedded",
"(",
"de... | Determine the username to use based on this configuration and the environment.
@return the username to use
@since 1.4.0 | [
"Determine",
"the",
"username",
"to",
"use",
"based",
"on",
"this",
"configuration",
"and",
"the",
"environment",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java#L329-L337 | train | Determine the username to use for the database connection. | [
30522,
2270,
5164,
5646,
20330,
18442,
1006,
1007,
1063,
2065,
1006,
5164,
21823,
4877,
1012,
24748,
18413,
1006,
2023,
1012,
5310,
18442,
1007,
1007,
1063,
2709,
2023,
1012,
5310,
18442,
1025,
1065,
2065,
1006,
11157,
2850,
2696,
15058,
86... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java | Http2Settings.pushEnabled | public Boolean pushEnabled() {
Long value = get(SETTINGS_ENABLE_PUSH);
if (value == null) {
return null;
}
return TRUE.equals(value);
} | java | public Boolean pushEnabled() {
Long value = get(SETTINGS_ENABLE_PUSH);
if (value == null) {
return null;
}
return TRUE.equals(value);
} | [
"public",
"Boolean",
"pushEnabled",
"(",
")",
"{",
"Long",
"value",
"=",
"get",
"(",
"SETTINGS_ENABLE_PUSH",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"TRUE",
".",
"equals",
"(",
"value",
")",
";",
"}... | Gets the {@code SETTINGS_ENABLE_PUSH} value. If unavailable, returns {@code null}. | [
"Gets",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java#L99-L105 | train | Gets the value of the SETTINGS_ENABLE_PUSH property. | [
30522,
2270,
22017,
20898,
5245,
8189,
23242,
1006,
1007,
1063,
2146,
3643,
1027,
2131,
1006,
10906,
1035,
9585,
1035,
5245,
1007,
1025,
2065,
1006,
3643,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
2995,
1012,
19635,
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-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java | KvStateSerializer.deserializeValue | public static <T> T deserializeValue(byte[] serializedValue, TypeSerializer<T> serializer) throws IOException {
if (serializedValue == null) {
return null;
} else {
final DataInputDeserializer deser = new DataInputDeserializer(
serializedValue, 0, serializedValue.length);
final T value = serializer.deserialize(deser);
if (deser.available() > 0) {
throw new IOException(
"Unconsumed bytes in the deserialized value. " +
"This indicates a mismatch in the value serializers " +
"used by the KvState instance and this access.");
}
return value;
}
} | java | public static <T> T deserializeValue(byte[] serializedValue, TypeSerializer<T> serializer) throws IOException {
if (serializedValue == null) {
return null;
} else {
final DataInputDeserializer deser = new DataInputDeserializer(
serializedValue, 0, serializedValue.length);
final T value = serializer.deserialize(deser);
if (deser.available() > 0) {
throw new IOException(
"Unconsumed bytes in the deserialized value. " +
"This indicates a mismatch in the value serializers " +
"used by the KvState instance and this access.");
}
return value;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"deserializeValue",
"(",
"byte",
"[",
"]",
"serializedValue",
",",
"TypeSerializer",
"<",
"T",
">",
"serializer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"serializedValue",
"==",
"null",
")",
"{",
"return",
"nu... | Deserializes the value with the given serializer.
@param serializedValue Serialized value of type T
@param serializer Serializer for T
@param <T> Type of the value
@return Deserialized value or <code>null</code> if the serialized value
is <code>null</code>
@throws IOException On failure during deserialization | [
"Deserializes",
"the",
"value",
"with",
"the",
"given",
"serializer",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java#L145-L160 | train | Deserialize a value from a byte array. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
4078,
11610,
3669,
4371,
10175,
5657,
1006,
24880,
1031,
1033,
27289,
10175,
5657,
1010,
4127,
11610,
28863,
1026,
1056,
1028,
7642,
17629,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
27289,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/Holder.java | Holder.of | public static <T> Holder<T> of(T value) throws NullPointerException{
if(null == value){
throw new NullPointerException("Holder can not hold a null value!");
}
return new Holder<>(value);
} | java | public static <T> Holder<T> of(T value) throws NullPointerException{
if(null == value){
throw new NullPointerException("Holder can not hold a null value!");
}
return new Holder<>(value);
} | [
"public",
"static",
"<",
"T",
">",
"Holder",
"<",
"T",
">",
"of",
"(",
"T",
"value",
")",
"throws",
"NullPointerException",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Holder can not hold a null value!\"",
... | 新建Holder类,持有指定值,当值为空时抛出空指针异常
@param <T> 被持有的对象类型
@param value 值,不能为空
@return Holder | [
"新建Holder类,持有指定值,当值为空时抛出空指针异常"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Holder.java#L21-L26 | train | Creates a new holder instance with the specified value. | [
30522,
2270,
10763,
1026,
1056,
1028,
9111,
1026,
1056,
1028,
1997,
1006,
1056,
3643,
1007,
11618,
19701,
8400,
7869,
2595,
24422,
1063,
2065,
1006,
19701,
1027,
1027,
3643,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/AllWindowedStream.java | AllWindowedStream.allowedLateness | @PublicEvolving
public AllWindowedStream<T, W> allowedLateness(Time lateness) {
final long millis = lateness.toMilliseconds();
checkArgument(millis >= 0, "The allowed lateness cannot be negative.");
this.allowedLateness = millis;
return this;
} | java | @PublicEvolving
public AllWindowedStream<T, W> allowedLateness(Time lateness) {
final long millis = lateness.toMilliseconds();
checkArgument(millis >= 0, "The allowed lateness cannot be negative.");
this.allowedLateness = millis;
return this;
} | [
"@",
"PublicEvolving",
"public",
"AllWindowedStream",
"<",
"T",
",",
"W",
">",
"allowedLateness",
"(",
"Time",
"lateness",
")",
"{",
"final",
"long",
"millis",
"=",
"lateness",
".",
"toMilliseconds",
"(",
")",
";",
"checkArgument",
"(",
"millis",
">=",
"0",
... | Sets the time by which elements are allowed to be late. Elements that
arrive behind the watermark by more than the specified time will be dropped.
By default, the allowed lateness is {@code 0L}.
<p>Setting an allowed lateness is only valid for event-time windows. | [
"Sets",
"the",
"time",
"by",
"which",
"elements",
"are",
"allowed",
"to",
"be",
"late",
".",
"Elements",
"that",
"arrive",
"behind",
"the",
"watermark",
"by",
"more",
"than",
"the",
"specified",
"time",
"will",
"be",
"dropped",
".",
"By",
"default",
"the",... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L143-L150 | train | Sets the allowed lateness. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
1059,
1028,
3039,
13806,
2791,
1006,
2051,
2397,
2791,
1007,
1063,
2345,
2146,
4971,
2483,
1027,
2397,
2791,
1012,
3419,
8591,
5562,
8663,
5104,
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... |
networknt/light-4j | config/src/main/java/com/networknt/config/ConfigInjection.java | ConfigInjection.getInjectValue | public static Object getInjectValue(String string) {
Matcher m = pattern.matcher(string);
StringBuffer sb = new StringBuffer();
// Parse the content inside pattern "${}" when this pattern is found
while (m.find()) {
// Get parsing result
Object value = getValue(m.group(1));
// Return directly when the parsing result don't need to be casted to String
if (!(value instanceof String)) {
return value;
}
m.appendReplacement(sb, (String) value);
}
return m.appendTail(sb).toString();
} | java | public static Object getInjectValue(String string) {
Matcher m = pattern.matcher(string);
StringBuffer sb = new StringBuffer();
// Parse the content inside pattern "${}" when this pattern is found
while (m.find()) {
// Get parsing result
Object value = getValue(m.group(1));
// Return directly when the parsing result don't need to be casted to String
if (!(value instanceof String)) {
return value;
}
m.appendReplacement(sb, (String) value);
}
return m.appendTail(sb).toString();
} | [
"public",
"static",
"Object",
"getInjectValue",
"(",
"String",
"string",
")",
"{",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"string",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"// Parse the content inside pattern \"${... | Method used to generate the values from environment variables or "values.yaml" | [
"Method",
"used",
"to",
"generate",
"the",
"values",
"from",
"environment",
"variables",
"or",
"values",
".",
"yaml"
] | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/config/src/main/java/com/networknt/config/ConfigInjection.java#L61-L75 | train | Get the object value from a string. | [
30522,
2270,
10763,
4874,
2131,
2378,
20614,
10175,
5657,
1006,
5164,
5164,
1007,
1063,
2674,
2121,
1049,
1027,
5418,
1012,
2674,
2121,
1006,
5164,
1007,
1025,
5164,
8569,
12494,
24829,
1027,
2047,
5164,
8569,
12494,
1006,
1007,
1025,
1013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/SegmentsUtil.java | SegmentsUtil.setByte | public static void setByte(MemorySegment[] segments, int offset, byte value) {
if (inFirstSegment(segments, offset, 1)) {
segments[0].put(offset, value);
} else {
setByteMultiSegments(segments, offset, value);
}
} | java | public static void setByte(MemorySegment[] segments, int offset, byte value) {
if (inFirstSegment(segments, offset, 1)) {
segments[0].put(offset, value);
} else {
setByteMultiSegments(segments, offset, value);
}
} | [
"public",
"static",
"void",
"setByte",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
",",
"byte",
"value",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"1",
")",
")",
"{",
"segments",
"[",
"0",
"]",
... | set byte from segments.
@param segments target segments.
@param offset value offset. | [
"set",
"byte",
"from",
"segments",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L597-L603 | train | set byte from segments. | [
30522,
2270,
10763,
11675,
2275,
3762,
2618,
1006,
3638,
3366,
21693,
4765,
1031,
1033,
9214,
1010,
20014,
16396,
1010,
24880,
3643,
1007,
1063,
2065,
1006,
1999,
8873,
12096,
3366,
21693,
4765,
1006,
9214,
1010,
16396,
1010,
1015,
1007,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java | RSA.generatePublicKey | public static PublicKey generatePublicKey(BigInteger modulus, BigInteger publicExponent) {
return SecureUtil.generatePublicKey(ALGORITHM_RSA.getValue(), new RSAPublicKeySpec(modulus, publicExponent));
} | java | public static PublicKey generatePublicKey(BigInteger modulus, BigInteger publicExponent) {
return SecureUtil.generatePublicKey(ALGORITHM_RSA.getValue(), new RSAPublicKeySpec(modulus, publicExponent));
} | [
"public",
"static",
"PublicKey",
"generatePublicKey",
"(",
"BigInteger",
"modulus",
",",
"BigInteger",
"publicExponent",
")",
"{",
"return",
"SecureUtil",
".",
"generatePublicKey",
"(",
"ALGORITHM_RSA",
".",
"getValue",
"(",
")",
",",
"new",
"RSAPublicKeySpec",
"(",... | 生成RSA公钥
@param modulus N特征值
@param publicExponent e特征值
@return {@link PublicKey} | [
"生成RSA公钥"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java#L53-L55 | train | Generates a public key from the given modulus and public exponent. | [
30522,
2270,
10763,
2270,
14839,
9699,
14289,
16558,
6799,
3240,
1006,
2502,
18447,
26320,
16913,
11627,
1010,
2502,
18447,
26320,
2270,
10288,
29513,
3372,
1007,
1063,
2709,
5851,
21823,
2140,
1012,
9699,
14289,
16558,
6799,
3240,
1006,
9896... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.getAllLogsForSession | public synchronized SessionLogs getAllLogsForSession(SessionId sessionId) {
SessionLogs sessionLogs = new SessionLogs();
if (perSessionDriverEntries.containsKey(sessionId)) {
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
for (String logType : typeToEntriesMap.keySet()) {
sessionLogs.addLog(logType, typeToEntriesMap.get(logType));
}
perSessionDriverEntries.remove(sessionId);
}
return sessionLogs;
} | java | public synchronized SessionLogs getAllLogsForSession(SessionId sessionId) {
SessionLogs sessionLogs = new SessionLogs();
if (perSessionDriverEntries.containsKey(sessionId)) {
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
for (String logType : typeToEntriesMap.keySet()) {
sessionLogs.addLog(logType, typeToEntriesMap.get(logType));
}
perSessionDriverEntries.remove(sessionId);
}
return sessionLogs;
} | [
"public",
"synchronized",
"SessionLogs",
"getAllLogsForSession",
"(",
"SessionId",
"sessionId",
")",
"{",
"SessionLogs",
"sessionLogs",
"=",
"new",
"SessionLogs",
"(",
")",
";",
"if",
"(",
"perSessionDriverEntries",
".",
"containsKey",
"(",
"sessionId",
")",
")",
... | Gets all logs for a session.
@param sessionId The id of the session.
@return The logs for the session, ordered after log types in a session logs object. | [
"Gets",
"all",
"logs",
"for",
"a",
"session",
"."
] | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L201-L211 | train | Gets all logs for a session. | [
30522,
2270,
25549,
5219,
21197,
2015,
2131,
8095,
21197,
22747,
5668,
7971,
3258,
1006,
5219,
3593,
5219,
3593,
1007,
1063,
5219,
21197,
2015,
5219,
21197,
2015,
1027,
2047,
5219,
21197,
2015,
1006,
1007,
1025,
2065,
1006,
2566,
8583,
1099... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/BaseHybridHashTable.java | BaseHybridHashTable.close | public void close() {
// make sure that we close only once
if (!this.closed.compareAndSet(false, true)) {
return;
}
// clear the current probe side channel, if there is one
if (this.currentSpilledProbeSide != null) {
try {
this.currentSpilledProbeSide.getChannel().closeAndDelete();
} catch (Throwable t) {
LOG.warn("Could not close and delete the temp file for the current spilled partition probe side.", t);
}
}
// clear the memory in the partitions
clearPartitions();
// return the write-behind buffers
for (int i = 0; i < this.buildSpillRetBufferNumbers; i++) {
try {
this.availableMemory.add(this.buildSpillReturnBuffers.take());
} catch (InterruptedException iex) {
throw new RuntimeException("Hashtable closing was interrupted");
}
}
this.buildSpillRetBufferNumbers = 0;
} | java | public void close() {
// make sure that we close only once
if (!this.closed.compareAndSet(false, true)) {
return;
}
// clear the current probe side channel, if there is one
if (this.currentSpilledProbeSide != null) {
try {
this.currentSpilledProbeSide.getChannel().closeAndDelete();
} catch (Throwable t) {
LOG.warn("Could not close and delete the temp file for the current spilled partition probe side.", t);
}
}
// clear the memory in the partitions
clearPartitions();
// return the write-behind buffers
for (int i = 0; i < this.buildSpillRetBufferNumbers; i++) {
try {
this.availableMemory.add(this.buildSpillReturnBuffers.take());
} catch (InterruptedException iex) {
throw new RuntimeException("Hashtable closing was interrupted");
}
}
this.buildSpillRetBufferNumbers = 0;
} | [
"public",
"void",
"close",
"(",
")",
"{",
"// make sure that we close only once",
"if",
"(",
"!",
"this",
".",
"closed",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"return",
";",
"}",
"// clear the current probe side channel, if there is one",
... | Closes the hash table. This effectively releases all internal structures and closes all
open files and removes them. The call to this method is valid both as a cleanup after the
complete inputs were properly processed, and as an cancellation call, which cleans up
all resources that are currently held by the hash join. | [
"Closes",
"the",
"hash",
"table",
".",
"This",
"effectively",
"releases",
"all",
"internal",
"structures",
"and",
"closes",
"all",
"open",
"files",
"and",
"removes",
"them",
".",
"The",
"call",
"to",
"this",
"method",
"is",
"valid",
"both",
"as",
"a",
"cle... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/BaseHybridHashTable.java#L441-L468 | train | Closes the hashtable. | [
30522,
2270,
11675,
2485,
1006,
1007,
1063,
1013,
1013,
2191,
2469,
2008,
2057,
2485,
2069,
2320,
2065,
1006,
999,
2023,
1012,
2701,
1012,
12826,
29560,
3388,
1006,
6270,
1010,
2995,
1007,
1007,
1063,
2709,
1025,
1065,
1013,
1013,
3154,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java | UploadFile.write | public File write(String destPath) throws IOException {
if(data != null || tempFile != null) {
return write(FileUtil.touch(destPath));
}
return null;
} | java | public File write(String destPath) throws IOException {
if(data != null || tempFile != null) {
return write(FileUtil.touch(destPath));
}
return null;
} | [
"public",
"File",
"write",
"(",
"String",
"destPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"data",
"!=",
"null",
"||",
"tempFile",
"!=",
"null",
")",
"{",
"return",
"write",
"(",
"FileUtil",
".",
"touch",
"(",
"destPath",
")",
")",
";",
"}",
... | 将上传的文件写入指定的目标文件路径,自动创建文件<br>
写入后原临时文件会被删除
@param destPath 目标文件路径
@return 目标文件
@throws IOException | [
"将上传的文件写入指定的目标文件路径,自动创建文件<br",
">",
"写入后原临时文件会被删除"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/UploadFile.java#L73-L78 | train | Write the data to the file at the specified destination path. | [
30522,
2270,
5371,
4339,
1006,
5164,
4078,
25856,
8988,
1007,
11618,
22834,
10288,
24422,
1063,
2065,
1006,
2951,
999,
1027,
19701,
1064,
1064,
8915,
8737,
8873,
2571,
999,
1027,
19701,
1007,
1063,
2709,
4339,
1006,
5371,
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... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java | Bzip2BitWriter.writeBoolean | void writeBoolean(ByteBuf out, final boolean value) {
int bitCount = this.bitCount + 1;
long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L);
if (bitCount == 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer = 0;
bitCount = 0;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | java | void writeBoolean(ByteBuf out, final boolean value) {
int bitCount = this.bitCount + 1;
long bitBuffer = this.bitBuffer | (value ? 1L << 64 - bitCount : 0L);
if (bitCount == 32) {
out.writeInt((int) (bitBuffer >>> 32));
bitBuffer = 0;
bitCount = 0;
}
this.bitBuffer = bitBuffer;
this.bitCount = bitCount;
} | [
"void",
"writeBoolean",
"(",
"ByteBuf",
"out",
",",
"final",
"boolean",
"value",
")",
"{",
"int",
"bitCount",
"=",
"this",
".",
"bitCount",
"+",
"1",
";",
"long",
"bitBuffer",
"=",
"this",
".",
"bitBuffer",
"|",
"(",
"value",
"?",
"1L",
"<<",
"64",
"... | Writes a single bit to the output {@link ByteBuf}.
@param value The bit to write | [
"Writes",
"a",
"single",
"bit",
"to",
"the",
"output",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitWriter.java#L62-L73 | train | Write boolean. | [
30522,
11675,
4339,
5092,
9890,
2319,
1006,
24880,
8569,
2546,
2041,
1010,
2345,
30524,
1025,
2146,
2978,
8569,
12494,
1027,
2023,
1012,
2978,
8569,
12494,
1064,
1006,
3643,
1029,
1015,
2140,
1026,
1026,
4185,
1011,
2978,
3597,
16671,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/InternalJSONUtil.java | InternalJSONUtil.formatDate | private static String formatDate(Object dateObj, String format) {
if (StrUtil.isNotBlank(format)) {
final Date date = (dateObj instanceof Date) ? (Date)dateObj : ((Calendar)dateObj).getTime();
//用户定义了日期格式
return DateUtil.format(date, format);
}
//默认使用时间戳
return String.valueOf((dateObj instanceof Date) ? ((Date)dateObj).getTime() : ((Calendar)dateObj).getTimeInMillis());
} | java | private static String formatDate(Object dateObj, String format) {
if (StrUtil.isNotBlank(format)) {
final Date date = (dateObj instanceof Date) ? (Date)dateObj : ((Calendar)dateObj).getTime();
//用户定义了日期格式
return DateUtil.format(date, format);
}
//默认使用时间戳
return String.valueOf((dateObj instanceof Date) ? ((Date)dateObj).getTime() : ((Calendar)dateObj).getTimeInMillis());
} | [
"private",
"static",
"String",
"formatDate",
"(",
"Object",
"dateObj",
",",
"String",
"format",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"format",
")",
")",
"{",
"final",
"Date",
"date",
"=",
"(",
"dateObj",
"instanceof",
"Date",
")",
"?",... | 按照给定格式格式化日期,格式为空时返回时间戳字符串
@param dateObj Date或者Calendar对象
@param format 格式
@return 日期字符串 | [
"按照给定格式格式化日期,格式为空时返回时间戳字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/InternalJSONUtil.java#L231-L240 | train | Format a date object to a string. | [
30522,
2797,
10763,
5164,
4289,
13701,
1006,
4874,
3058,
16429,
3501,
1010,
5164,
4289,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
4289,
1007,
1007,
1063,
2345,
3058,
3058,
1027,
1006,
3058,
16429,
3501,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/functions/source/ContinuousFileMonitoringFunction.java | ContinuousFileMonitoringFunction.listEligibleFiles | private Map<Path, FileStatus> listEligibleFiles(FileSystem fileSystem, Path path) throws IOException {
final FileStatus[] statuses;
try {
statuses = fileSystem.listStatus(path);
} catch (IOException e) {
// we may run into an IOException if files are moved while listing their status
// delay the check for eligible files in this case
return Collections.emptyMap();
}
if (statuses == null) {
LOG.warn("Path does not exist: {}", path);
return Collections.emptyMap();
} else {
Map<Path, FileStatus> files = new HashMap<>();
// handle the new files
for (FileStatus status : statuses) {
if (!status.isDir()) {
Path filePath = status.getPath();
long modificationTime = status.getModificationTime();
if (!shouldIgnore(filePath, modificationTime)) {
files.put(filePath, status);
}
} else if (format.getNestedFileEnumeration() && format.acceptFile(status)){
files.putAll(listEligibleFiles(fileSystem, status.getPath()));
}
}
return files;
}
} | java | private Map<Path, FileStatus> listEligibleFiles(FileSystem fileSystem, Path path) throws IOException {
final FileStatus[] statuses;
try {
statuses = fileSystem.listStatus(path);
} catch (IOException e) {
// we may run into an IOException if files are moved while listing their status
// delay the check for eligible files in this case
return Collections.emptyMap();
}
if (statuses == null) {
LOG.warn("Path does not exist: {}", path);
return Collections.emptyMap();
} else {
Map<Path, FileStatus> files = new HashMap<>();
// handle the new files
for (FileStatus status : statuses) {
if (!status.isDir()) {
Path filePath = status.getPath();
long modificationTime = status.getModificationTime();
if (!shouldIgnore(filePath, modificationTime)) {
files.put(filePath, status);
}
} else if (format.getNestedFileEnumeration() && format.acceptFile(status)){
files.putAll(listEligibleFiles(fileSystem, status.getPath()));
}
}
return files;
}
} | [
"private",
"Map",
"<",
"Path",
",",
"FileStatus",
">",
"listEligibleFiles",
"(",
"FileSystem",
"fileSystem",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"final",
"FileStatus",
"[",
"]",
"statuses",
";",
"try",
"{",
"statuses",
"=",
"fileSystem",
... | Returns the paths of the files not yet processed.
@param fileSystem The filesystem where the monitored directory resides. | [
"Returns",
"the",
"paths",
"of",
"the",
"files",
"not",
"yet",
"processed",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileMonitoringFunction.java#L291-L321 | train | List eligible files. | [
30522,
2797,
4949,
1026,
4130,
1010,
6764,
29336,
2271,
1028,
2862,
20806,
18507,
8873,
4244,
1006,
6764,
27268,
6633,
6764,
27268,
6633,
1010,
4130,
4130,
1007,
11618,
22834,
10288,
24422,
1063,
2345,
6764,
29336,
2271,
1031,
1033,
3570,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java | ScatterGatherIteration.createResult | @Override
public DataSet<Vertex<K, VV>> createResult() {
if (this.initialVertices == null) {
throw new IllegalStateException("The input data set has not been set.");
}
// prepare some type information
TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0);
TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType);
// create a graph
Graph<K, VV, EV> graph =
Graph.fromDataSet(initialVertices, edgesWithValue, initialVertices.getExecutionEnvironment());
// check whether the numVertices option is set and, if so, compute the total number of vertices
// and set it within the scatter and gather functions
DataSet<LongValue> numberOfVertices = null;
if (this.configuration != null && this.configuration.isOptNumVertices()) {
try {
numberOfVertices = GraphUtils.count(this.initialVertices);
} catch (Exception e) {
e.printStackTrace();
}
}
if (this.configuration != null) {
scatterFunction.setDirection(this.configuration.getDirection());
} else {
scatterFunction.setDirection(EdgeDirection.OUT);
}
// retrieve the direction in which the updates are made and in which the messages are sent
EdgeDirection messagingDirection = scatterFunction.getDirection();
// check whether the degrees option is set and, if so, compute the in and the out degrees and
// add them to the vertex value
if (this.configuration != null && this.configuration.isOptDegrees()) {
return createResultVerticesWithDegrees(graph, messagingDirection, messageTypeInfo, numberOfVertices);
} else {
return createResultSimpleVertex(messagingDirection, messageTypeInfo, numberOfVertices);
}
} | java | @Override
public DataSet<Vertex<K, VV>> createResult() {
if (this.initialVertices == null) {
throw new IllegalStateException("The input data set has not been set.");
}
// prepare some type information
TypeInformation<K> keyType = ((TupleTypeInfo<?>) initialVertices.getType()).getTypeAt(0);
TypeInformation<Tuple2<K, Message>> messageTypeInfo = new TupleTypeInfo<>(keyType, messageType);
// create a graph
Graph<K, VV, EV> graph =
Graph.fromDataSet(initialVertices, edgesWithValue, initialVertices.getExecutionEnvironment());
// check whether the numVertices option is set and, if so, compute the total number of vertices
// and set it within the scatter and gather functions
DataSet<LongValue> numberOfVertices = null;
if (this.configuration != null && this.configuration.isOptNumVertices()) {
try {
numberOfVertices = GraphUtils.count(this.initialVertices);
} catch (Exception e) {
e.printStackTrace();
}
}
if (this.configuration != null) {
scatterFunction.setDirection(this.configuration.getDirection());
} else {
scatterFunction.setDirection(EdgeDirection.OUT);
}
// retrieve the direction in which the updates are made and in which the messages are sent
EdgeDirection messagingDirection = scatterFunction.getDirection();
// check whether the degrees option is set and, if so, compute the in and the out degrees and
// add them to the vertex value
if (this.configuration != null && this.configuration.isOptDegrees()) {
return createResultVerticesWithDegrees(graph, messagingDirection, messageTypeInfo, numberOfVertices);
} else {
return createResultSimpleVertex(messagingDirection, messageTypeInfo, numberOfVertices);
}
} | [
"@",
"Override",
"public",
"DataSet",
"<",
"Vertex",
"<",
"K",
",",
"VV",
">",
">",
"createResult",
"(",
")",
"{",
"if",
"(",
"this",
".",
"initialVertices",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The input data set has not ... | Creates the operator that represents this scatter-gather graph computation.
@return The operator that represents this scatter-gather graph computation. | [
"Creates",
"the",
"operator",
"that",
"represents",
"this",
"scatter",
"-",
"gather",
"graph",
"computation",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherIteration.java#L137-L179 | train | Creates the result data set. | [
30522,
1030,
2058,
15637,
2270,
2951,
13462,
1026,
19449,
1026,
1047,
1010,
1058,
2615,
1028,
1028,
3443,
6072,
11314,
1006,
1007,
1063,
2065,
1006,
2023,
1012,
3988,
16874,
23522,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
1738... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.indexOfNonWhiteSpace | public static int indexOfNonWhiteSpace(CharSequence seq, int offset) {
for (; offset < seq.length(); ++offset) {
if (!Character.isWhitespace(seq.charAt(offset))) {
return offset;
}
}
return -1;
} | java | public static int indexOfNonWhiteSpace(CharSequence seq, int offset) {
for (; offset < seq.length(); ++offset) {
if (!Character.isWhitespace(seq.charAt(offset))) {
return offset;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOfNonWhiteSpace",
"(",
"CharSequence",
"seq",
",",
"int",
"offset",
")",
"{",
"for",
"(",
";",
"offset",
"<",
"seq",
".",
"length",
"(",
")",
";",
"++",
"offset",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isWhitespac... | Find the index of the first non-white space character in {@code s} starting at {@code offset}.
@param seq The string to search.
@param offset The offset to start searching at.
@return the index of the first non-white space character or <{@code 0} if none was found. | [
"Find",
"the",
"index",
"of",
"the",
"first",
"non",
"-",
"white",
"space",
"character",
"in",
"{",
"@code",
"s",
"}",
"starting",
"at",
"{",
"@code",
"offset",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L546-L553 | train | Gets the index of the first non - whitespace character in the sequence. | [
30522,
2270,
10763,
20014,
5950,
11253,
8540,
2860,
16584,
2229,
15327,
1006,
25869,
3366,
4226,
5897,
7367,
4160,
1010,
20014,
16396,
1007,
1063,
2005,
1006,
1025,
16396,
1026,
7367,
4160,
1012,
3091,
1006,
1007,
1025,
1009,
1009,
16396,
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/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java | Bzip2BitReader.readBits | int readBits(final int count) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32 )");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer;
if (bitCount < count) {
long readData;
int offset;
switch (in.readableBytes()) {
case 1: {
readData = in.readUnsignedByte();
offset = 8;
break;
}
case 2: {
readData = in.readUnsignedShort();
offset = 16;
break;
}
case 3: {
readData = in.readUnsignedMedium();
offset = 24;
break;
}
default: {
readData = in.readUnsignedInt();
offset = 32;
break;
}
}
bitBuffer = bitBuffer << offset | readData;
bitCount += offset;
this.bitBuffer = bitBuffer;
}
this.bitCount = bitCount -= count;
return (int) (bitBuffer >>> bitCount & (count != 32 ? (1 << count) - 1 : 0xFFFFFFFFL));
} | java | int readBits(final int count) {
if (count < 0 || count > 32) {
throw new IllegalArgumentException("count: " + count + " (expected: 0-32 )");
}
int bitCount = this.bitCount;
long bitBuffer = this.bitBuffer;
if (bitCount < count) {
long readData;
int offset;
switch (in.readableBytes()) {
case 1: {
readData = in.readUnsignedByte();
offset = 8;
break;
}
case 2: {
readData = in.readUnsignedShort();
offset = 16;
break;
}
case 3: {
readData = in.readUnsignedMedium();
offset = 24;
break;
}
default: {
readData = in.readUnsignedInt();
offset = 32;
break;
}
}
bitBuffer = bitBuffer << offset | readData;
bitCount += offset;
this.bitBuffer = bitBuffer;
}
this.bitCount = bitCount -= count;
return (int) (bitBuffer >>> bitCount & (count != 32 ? (1 << count) - 1 : 0xFFFFFFFFL));
} | [
"int",
"readBits",
"(",
"final",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"<",
"0",
"||",
"count",
">",
"32",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count: \"",
"+",
"count",
"+",
"\" (expected: 0-32 )\"",
")",
";",
"}",
"int"... | Reads up to 32 bits from the {@link ByteBuf}.
@param count The number of bits to read (maximum {@code 32} as a size of {@code int})
@return The bits requested, right-aligned within the integer | [
"Reads",
"up",
"to",
"32",
"bits",
"from",
"the",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java#L58-L98 | train | Read bits from the input stream. | [
30522,
20014,
3191,
16313,
2015,
1006,
2345,
20014,
4175,
1007,
1063,
2065,
1006,
4175,
1026,
1014,
1064,
1064,
4175,
30524,
5466,
2047,
6206,
2906,
22850,
15781,
2595,
24422,
1006,
1000,
4175,
1024,
1000,
1009,
4175,
1009,
1000,
1006,
3517... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/tokenizer/pipe/LexicalAnalyzerPipeline.java | LexicalAnalyzerPipeline.getAnalyzer | public LexicalAnalyzer getAnalyzer()
{
for (Pipe<List<IWord>, List<IWord>> pipe : this)
{
if (pipe instanceof LexicalAnalyzerPipe)
{
return ((LexicalAnalyzerPipe) pipe).analyzer;
}
}
return null;
} | java | public LexicalAnalyzer getAnalyzer()
{
for (Pipe<List<IWord>, List<IWord>> pipe : this)
{
if (pipe instanceof LexicalAnalyzerPipe)
{
return ((LexicalAnalyzerPipe) pipe).analyzer;
}
}
return null;
} | [
"public",
"LexicalAnalyzer",
"getAnalyzer",
"(",
")",
"{",
"for",
"(",
"Pipe",
"<",
"List",
"<",
"IWord",
">",
",",
"List",
"<",
"IWord",
">",
">",
"pipe",
":",
"this",
")",
"{",
"if",
"(",
"pipe",
"instanceof",
"LexicalAnalyzerPipe",
")",
"{",
"return... | 获取代理的词法分析器
@return | [
"获取代理的词法分析器"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/pipe/LexicalAnalyzerPipeline.java#L67-L77 | train | Get the analyzer for this language. | [
30522,
2270,
16105,
25015,
12032,
2100,
6290,
2131,
27953,
2100,
6290,
1006,
1007,
1063,
2005,
1006,
8667,
1026,
2862,
1026,
1045,
18351,
1028,
1010,
2862,
1026,
1045,
18351,
1028,
1028,
8667,
1024,
2023,
1007,
1063,
2065,
1006,
8667,
6013,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ExceptionProxy.java | ExceptionProxy.reportError | public void reportError(Throwable t) {
// set the exception, if it is the first (and the exception is non null)
if (t != null && exception.compareAndSet(null, t) && toInterrupt != null) {
toInterrupt.interrupt();
}
} | java | public void reportError(Throwable t) {
// set the exception, if it is the first (and the exception is non null)
if (t != null && exception.compareAndSet(null, t) && toInterrupt != null) {
toInterrupt.interrupt();
}
} | [
"public",
"void",
"reportError",
"(",
"Throwable",
"t",
")",
"{",
"// set the exception, if it is the first (and the exception is non null)",
"if",
"(",
"t",
"!=",
"null",
"&&",
"exception",
".",
"compareAndSet",
"(",
"null",
",",
"t",
")",
"&&",
"toInterrupt",
"!="... | Sets the exception and interrupts the target thread,
if no other exception has occurred so far.
<p>The exception is only set (and the interruption is only triggered),
if no other exception was set before.
@param t The exception that occurred | [
"Sets",
"the",
"exception",
"and",
"interrupts",
"the",
"target",
"thread",
"if",
"no",
"other",
"exception",
"has",
"occurred",
"so",
"far",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ExceptionProxy.java#L102-L107 | train | Sets the exception. | [
30522,
2270,
11675,
6398,
29165,
1006,
5466,
3085,
1056,
1007,
1063,
1013,
1013,
2275,
1996,
6453,
1010,
2065,
2009,
2003,
1996,
2034,
1006,
1998,
1996,
6453,
2003,
2512,
19701,
1007,
2065,
1006,
1056,
999,
1027,
19701,
1004,
1004,
6453,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.fromTupleDataSet | public static <K, EV> Graph<K, NullValue, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, context);
} | java | public static <K, EV> Graph<K, NullValue, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, context);
} | [
"public",
"static",
"<",
"K",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"NullValue",
",",
"EV",
">",
"fromTupleDataSet",
"(",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"K",
",",
"EV",
">",
">",
"edges",
",",
"ExecutionEnvironment",
"context",
")",
"{",
... | Creates a graph from a DataSet of Tuple3 objects for edges.
<p>The first field of the Tuple3 object will become the source ID,
the second field will become the target ID, and the third field will become
the edge value.
<p>Vertices are created automatically and their values are set to NullValue.
@param edges a DataSet of Tuple3 representing the edges.
@param context the flink execution environment.
@return the newly created graph. | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple3",
"objects",
"for",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L295-L303 | train | Creates a graph from a DataSet of Tuple3 objects. | [
30522,
2270,
10763,
1026,
1047,
1010,
23408,
1028,
10629,
1026,
1047,
1010,
19701,
10175,
5657,
1010,
23408,
1028,
2013,
8525,
21132,
6790,
13462,
1006,
2951,
13462,
1026,
10722,
10814,
2509,
1026,
1047,
1010,
1047,
1010,
23408,
1028,
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... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.mapToXml | public static Document mapToXml(Map<?, ?> data, String rootName) {
final Document doc = createXml();
final Element root = appendChild(doc, rootName);
mapToXml(doc, root, data);
return doc;
} | java | public static Document mapToXml(Map<?, ?> data, String rootName) {
final Document doc = createXml();
final Element root = appendChild(doc, rootName);
mapToXml(doc, root, data);
return doc;
} | [
"public",
"static",
"Document",
"mapToXml",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"data",
",",
"String",
"rootName",
")",
"{",
"final",
"Document",
"doc",
"=",
"createXml",
"(",
")",
";",
"final",
"Element",
"root",
"=",
"appendChild",
"(",
"doc",
",",
... | 将Map转换为XML
@param data Map类型数据
@return XML
@since 4.0.9 | [
"将Map转换为XML"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L750-L756 | train | Converts a Map of data into an XML document. | [
30522,
2270,
10763,
6254,
4949,
3406,
2595,
19968,
1006,
4949,
1026,
1029,
1010,
1029,
1028,
2951,
1010,
5164,
7117,
18442,
1007,
1063,
2345,
6254,
9986,
1027,
3443,
2595,
19968,
1006,
1007,
1025,
2345,
5783,
7117,
1027,
10439,
10497,
19339... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/WorkbookUtil.java | WorkbookUtil.createSXSSFBook | public static SXSSFWorkbook createSXSSFBook(File excelFile, String password) {
return toSXSSFBook(createBook(excelFile, password));
} | java | public static SXSSFWorkbook createSXSSFBook(File excelFile, String password) {
return toSXSSFBook(createBook(excelFile, password));
} | [
"public",
"static",
"SXSSFWorkbook",
"createSXSSFBook",
"(",
"File",
"excelFile",
",",
"String",
"password",
")",
"{",
"return",
"toSXSSFBook",
"(",
"createBook",
"(",
"excelFile",
",",
"password",
")",
")",
";",
"}"
] | 创建或加载SXSSFWorkbook工作簿,只读模式
@param excelFile Excel文件
@param password Excel工作簿密码,如果无密码传{@code null}
@return {@link SXSSFWorkbook}
@since 4.1.13 | [
"创建或加载SXSSFWorkbook工作簿,只读模式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L145-L147 | train | Creates a SXSSFWorkbook from an Excel file. | [
30522,
2270,
10763,
1055,
2595,
4757,
2546,
6198,
8654,
9005,
2595,
4757,
26337,
14659,
1006,
5371,
24970,
8873,
2571,
1010,
5164,
20786,
1007,
1063,
2709,
2000,
2015,
2595,
4757,
26337,
14659,
1006,
3443,
8654,
1006,
24970,
8873,
2571,
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... |
apache/flink | flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandler.java | HistoryServerStaticFileServerHandler.respondWithFile | private void respondWithFile(ChannelHandlerContext ctx, HttpRequest request, String requestPath)
throws IOException, ParseException {
// make sure we request the "index.html" in case there is a directory request
if (requestPath.endsWith("/")) {
requestPath = requestPath + "index.html";
}
if (!requestPath.contains(".")) { // we assume that the path ends in either .html or .js
requestPath = requestPath + ".json";
}
// convert to absolute path
final File file = new File(rootPath, requestPath);
if (!file.exists()) {
// file does not exist. Try to load it with the classloader
ClassLoader cl = HistoryServerStaticFileServerHandler.class.getClassLoader();
try (InputStream resourceStream = cl.getResourceAsStream("web" + requestPath)) {
boolean success = false;
try {
if (resourceStream != null) {
URL root = cl.getResource("web");
URL requested = cl.getResource("web" + requestPath);
if (root != null && requested != null) {
URI rootURI = new URI(root.getPath()).normalize();
URI requestedURI = new URI(requested.getPath()).normalize();
// Check that we don't load anything from outside of the
// expected scope.
if (!rootURI.relativize(requestedURI).equals(requestedURI)) {
LOG.debug("Loading missing file from classloader: {}", requestPath);
// ensure that directory to file exists.
file.getParentFile().mkdirs();
Files.copy(resourceStream, file.toPath());
success = true;
}
}
}
} catch (Throwable t) {
LOG.error("error while responding", t);
} finally {
if (!success) {
LOG.debug("Unable to load requested file {} from classloader", requestPath);
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
}
}
}
if (!file.exists() || file.isHidden() || file.isDirectory() || !file.isFile()) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
if (!file.getCanonicalFile().toPath().startsWith(rootPath.toPath())) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
// cache validation
final String ifModifiedSince = request.headers().get(IF_MODIFIED_SINCE);
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
SimpleDateFormat dateFormatter = new SimpleDateFormat(StaticFileServerHandler.HTTP_DATE_FORMAT, Locale.US);
Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince);
// Only compare up to the second because the datetime format we send to the client
// does not have milliseconds
long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000;
long fileLastModifiedSeconds = file.lastModified() / 1000;
if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) {
if (LOG.isDebugEnabled()) {
LOG.debug("Responding 'NOT MODIFIED' for file '" + file.getAbsolutePath() + '\'');
}
StaticFileServerHandler.sendNotModified(ctx);
return;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Responding with file '" + file.getAbsolutePath() + '\'');
}
// Don't need to close this manually. Netty's DefaultFileRegion will take care of it.
final RandomAccessFile raf;
try {
raf = new RandomAccessFile(file, "r");
} catch (FileNotFoundException e) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
try {
long fileLength = raf.length();
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
StaticFileServerHandler.setContentTypeHeader(response, file);
// the job overview should be updated as soon as possible
if (!requestPath.equals("/joboverview.json")) {
StaticFileServerHandler.setDateAndCacheHeaders(response, file);
}
if (HttpHeaders.isKeepAlive(request)) {
response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
}
HttpHeaders.setContentLength(response, fileLength);
// write the initial line and the header.
ctx.write(response);
// write the content.
ChannelFuture lastContentFuture;
if (ctx.pipeline().get(SslHandler.class) == null) {
ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise());
lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);
} else {
lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength, 8192)),
ctx.newProgressivePromise());
// HttpChunkedInput will write the end marker (LastHttpContent) for us.
}
// close the connection, if no keep-alive is needed
if (!HttpHeaders.isKeepAlive(request)) {
lastContentFuture.addListener(ChannelFutureListener.CLOSE);
}
} catch (Exception e) {
raf.close();
LOG.error("Failed to serve file.", e);
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("Internal server error."),
INTERNAL_SERVER_ERROR,
Collections.emptyMap());
}
} | java | private void respondWithFile(ChannelHandlerContext ctx, HttpRequest request, String requestPath)
throws IOException, ParseException {
// make sure we request the "index.html" in case there is a directory request
if (requestPath.endsWith("/")) {
requestPath = requestPath + "index.html";
}
if (!requestPath.contains(".")) { // we assume that the path ends in either .html or .js
requestPath = requestPath + ".json";
}
// convert to absolute path
final File file = new File(rootPath, requestPath);
if (!file.exists()) {
// file does not exist. Try to load it with the classloader
ClassLoader cl = HistoryServerStaticFileServerHandler.class.getClassLoader();
try (InputStream resourceStream = cl.getResourceAsStream("web" + requestPath)) {
boolean success = false;
try {
if (resourceStream != null) {
URL root = cl.getResource("web");
URL requested = cl.getResource("web" + requestPath);
if (root != null && requested != null) {
URI rootURI = new URI(root.getPath()).normalize();
URI requestedURI = new URI(requested.getPath()).normalize();
// Check that we don't load anything from outside of the
// expected scope.
if (!rootURI.relativize(requestedURI).equals(requestedURI)) {
LOG.debug("Loading missing file from classloader: {}", requestPath);
// ensure that directory to file exists.
file.getParentFile().mkdirs();
Files.copy(resourceStream, file.toPath());
success = true;
}
}
}
} catch (Throwable t) {
LOG.error("error while responding", t);
} finally {
if (!success) {
LOG.debug("Unable to load requested file {} from classloader", requestPath);
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
}
}
}
if (!file.exists() || file.isHidden() || file.isDirectory() || !file.isFile()) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
if (!file.getCanonicalFile().toPath().startsWith(rootPath.toPath())) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
// cache validation
final String ifModifiedSince = request.headers().get(IF_MODIFIED_SINCE);
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
SimpleDateFormat dateFormatter = new SimpleDateFormat(StaticFileServerHandler.HTTP_DATE_FORMAT, Locale.US);
Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince);
// Only compare up to the second because the datetime format we send to the client
// does not have milliseconds
long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000;
long fileLastModifiedSeconds = file.lastModified() / 1000;
if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) {
if (LOG.isDebugEnabled()) {
LOG.debug("Responding 'NOT MODIFIED' for file '" + file.getAbsolutePath() + '\'');
}
StaticFileServerHandler.sendNotModified(ctx);
return;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Responding with file '" + file.getAbsolutePath() + '\'');
}
// Don't need to close this manually. Netty's DefaultFileRegion will take care of it.
final RandomAccessFile raf;
try {
raf = new RandomAccessFile(file, "r");
} catch (FileNotFoundException e) {
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("File not found."),
NOT_FOUND,
Collections.emptyMap());
return;
}
try {
long fileLength = raf.length();
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
StaticFileServerHandler.setContentTypeHeader(response, file);
// the job overview should be updated as soon as possible
if (!requestPath.equals("/joboverview.json")) {
StaticFileServerHandler.setDateAndCacheHeaders(response, file);
}
if (HttpHeaders.isKeepAlive(request)) {
response.headers().set(CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
}
HttpHeaders.setContentLength(response, fileLength);
// write the initial line and the header.
ctx.write(response);
// write the content.
ChannelFuture lastContentFuture;
if (ctx.pipeline().get(SslHandler.class) == null) {
ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise());
lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);
} else {
lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new ChunkedFile(raf, 0, fileLength, 8192)),
ctx.newProgressivePromise());
// HttpChunkedInput will write the end marker (LastHttpContent) for us.
}
// close the connection, if no keep-alive is needed
if (!HttpHeaders.isKeepAlive(request)) {
lastContentFuture.addListener(ChannelFutureListener.CLOSE);
}
} catch (Exception e) {
raf.close();
LOG.error("Failed to serve file.", e);
HandlerUtils.sendErrorResponse(
ctx,
request,
new ErrorResponseBody("Internal server error."),
INTERNAL_SERVER_ERROR,
Collections.emptyMap());
}
} | [
"private",
"void",
"respondWithFile",
"(",
"ChannelHandlerContext",
"ctx",
",",
"HttpRequest",
"request",
",",
"String",
"requestPath",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"// make sure we request the \"index.html\" in case there is a directory request",
"... | Response when running with leading JobManager. | [
"Response",
"when",
"running",
"with",
"leading",
"JobManager",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServerStaticFileServerHandler.java#L115-L275 | train | respond with file | [
30522,
2797,
11675,
6869,
24415,
8873,
2571,
1006,
3149,
11774,
3917,
8663,
18209,
14931,
2595,
1010,
8299,
2890,
15500,
5227,
1010,
5164,
5227,
15069,
1007,
11618,
22834,
10288,
24422,
1010,
11968,
19763,
2595,
24422,
1063,
1013,
1013,
2191,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.join | public static <T> String join(Iterator<T> iterator, CharSequence conjunction, String prefix, String suffix) {
if (null == iterator) {
return null;
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
T item;
while (iterator.hasNext()) {
if (isFirst) {
isFirst = false;
} else {
sb.append(conjunction);
}
item = iterator.next();
if (ArrayUtil.isArray(item)) {
sb.append(ArrayUtil.join(ArrayUtil.wrap(item), conjunction, prefix, suffix));
} else if (item instanceof Iterable<?>) {
sb.append(join((Iterable<?>) item, conjunction, prefix, suffix));
} else if (item instanceof Iterator<?>) {
sb.append(join((Iterator<?>) item, conjunction, prefix, suffix));
} else {
sb.append(StrUtil.wrap(String.valueOf(item), prefix, suffix));
}
}
return sb.toString();
} | java | public static <T> String join(Iterator<T> iterator, CharSequence conjunction, String prefix, String suffix) {
if (null == iterator) {
return null;
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
T item;
while (iterator.hasNext()) {
if (isFirst) {
isFirst = false;
} else {
sb.append(conjunction);
}
item = iterator.next();
if (ArrayUtil.isArray(item)) {
sb.append(ArrayUtil.join(ArrayUtil.wrap(item), conjunction, prefix, suffix));
} else if (item instanceof Iterable<?>) {
sb.append(join((Iterable<?>) item, conjunction, prefix, suffix));
} else if (item instanceof Iterator<?>) {
sb.append(join((Iterator<?>) item, conjunction, prefix, suffix));
} else {
sb.append(StrUtil.wrap(String.valueOf(item), prefix, suffix));
}
}
return sb.toString();
} | [
"public",
"static",
"<",
"T",
">",
"String",
"join",
"(",
"Iterator",
"<",
"T",
">",
"iterator",
",",
"CharSequence",
"conjunction",
",",
"String",
"prefix",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"null",
"==",
"iterator",
")",
"{",
"return",
"n... | 以 conjunction 为分隔符将集合转换为字符串<br>
如果集合元素为数组、{@link Iterable}或{@link Iterator},则递归组合其为字符串
@param <T> 集合元素类型
@param iterator 集合
@param conjunction 分隔符
@param prefix 每个元素添加的前缀,null表示不添加
@param suffix 每个元素添加的后缀,null表示不添加
@return 连接后的字符串
@since 4.0.10 | [
"以",
"conjunction",
"为分隔符将集合转换为字符串<br",
">",
"如果集合元素为数组、",
"{",
"@link",
"Iterable",
"}",
"或",
"{",
"@link",
"Iterator",
"}",
",则递归组合其为字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L312-L339 | train | Returns a string containing the contents of the given iterator joined with the given conjunction character sequence. | [
30522,
2270,
10763,
1026,
1056,
1028,
30524,
4263,
1010,
25869,
3366,
4226,
5897,
9595,
1010,
5164,
17576,
1010,
5164,
16809,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
2009,
6906,
4263,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
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... |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/ColumnOperationUtils.java | ColumnOperationUtils.addOrReplaceColumns | public static List<Expression> addOrReplaceColumns(List<String> inputFields, List<Expression> newExpressions) {
LinkedHashMap<String, Expression> finalFields = new LinkedHashMap<>();
inputFields.forEach(field -> finalFields.put(field, new UnresolvedReferenceExpression(field)));
newExpressions.forEach(expr -> {
String name = extractName(expr).orElse(expr.toString());
finalFields.put(name, expr);
});
return new ArrayList<>(finalFields.values());
} | java | public static List<Expression> addOrReplaceColumns(List<String> inputFields, List<Expression> newExpressions) {
LinkedHashMap<String, Expression> finalFields = new LinkedHashMap<>();
inputFields.forEach(field -> finalFields.put(field, new UnresolvedReferenceExpression(field)));
newExpressions.forEach(expr -> {
String name = extractName(expr).orElse(expr.toString());
finalFields.put(name, expr);
});
return new ArrayList<>(finalFields.values());
} | [
"public",
"static",
"List",
"<",
"Expression",
">",
"addOrReplaceColumns",
"(",
"List",
"<",
"String",
">",
"inputFields",
",",
"List",
"<",
"Expression",
">",
"newExpressions",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"Expression",
">",
"finalFields",
"... | Creates a projection list that adds new or replaces existing (if a column with corresponding name already exists)
columns.
<p><b>NOTE:</b> Resulting expression are still unresolved.
@param inputFields names of current columns
@param newExpressions new columns to add
@return projection expressions | [
"Creates",
"a",
"projection",
"list",
"that",
"adds",
"new",
"or",
"replaces",
"existing",
"(",
"if",
"a",
"column",
"with",
"corresponding",
"name",
"already",
"exists",
")",
"columns",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/ColumnOperationUtils.java#L79-L89 | train | Add or replace columns. | [
30522,
2270,
10763,
2862,
1026,
3670,
1028,
5587,
2953,
2890,
24759,
10732,
25778,
2819,
3619,
1006,
2862,
1026,
5164,
1028,
7953,
15155,
1010,
2862,
1026,
3670,
1028,
2047,
10288,
20110,
8496,
1007,
1063,
5799,
14949,
22444,
2361,
1026,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java | WindowedStream.process | @Internal
public <R> SingleOutputStreamOperator<R> process(ProcessWindowFunction<T, R, K, W> function, TypeInformation<R> resultType) {
function = input.getExecutionEnvironment().clean(function);
return apply(new InternalIterableProcessWindowFunction<>(function), resultType, function);
} | java | @Internal
public <R> SingleOutputStreamOperator<R> process(ProcessWindowFunction<T, R, K, W> function, TypeInformation<R> resultType) {
function = input.getExecutionEnvironment().clean(function);
return apply(new InternalIterableProcessWindowFunction<>(function), resultType, function);
} | [
"@",
"Internal",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"process",
"(",
"ProcessWindowFunction",
"<",
"T",
",",
"R",
",",
"K",
",",
"W",
">",
"function",
",",
"TypeInformation",
"<",
"R",
">",
"resultType",
")",
"{",
"funct... | Applies the given window function to each window. The window function is called for each
evaluation of the window for each key individually. The output of the window function is
interpreted as a regular non-windowed stream.
<p>Note that this function requires that all data in the windows is buffered until the window
is evaluated, as the function provides no means of incremental aggregation.
@param function The window function.
@param resultType Type information for the result type of the window function
@return The data stream that is the result of applying the window function to the window. | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"window",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/WindowedStream.java#L1071-L1075 | train | Process window function. | [
30522,
1030,
4722,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
2832,
1006,
2832,
11101,
5004,
11263,
27989,
1026,
1056,
1010,
1054,
1010,
1047,
1010,
1059,
1028,
3853,
1010,
2828,
2378,
14192,
3370,
1026... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java | StringValueArray.write | @Override
public void write(DataOutputView out) throws IOException {
out.writeInt(length);
out.writeInt(position);
out.write(data, 0, position);
} | java | @Override
public void write(DataOutputView out) throws IOException {
out.writeInt(length);
out.writeInt(position);
out.write(data, 0, position);
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"DataOutputView",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeInt",
"(",
"length",
")",
";",
"out",
".",
"writeInt",
"(",
"position",
")",
";",
"out",
".",
"write",
"(",
"data",
",",
"0",... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/StringValueArray.java#L245-L251 | train | Write the data in the sequence of bytes. | [
30522,
1030,
2058,
15637,
2270,
11675,
4339,
1006,
2951,
5833,
18780,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
4339,
18447,
1006,
3091,
1007,
1025,
2041,
1012,
4339,
18447,
1006,
2597,
1007,
1025,
2041,
1012,
4339,
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/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java | BatchPreparedStatementExecutor.init | public void init(final SQLRouteResult routeResult) throws SQLException {
setSqlStatement(routeResult.getSqlStatement());
getExecuteGroups().addAll(obtainExecuteGroups(routeUnits));
} | java | public void init(final SQLRouteResult routeResult) throws SQLException {
setSqlStatement(routeResult.getSqlStatement());
getExecuteGroups().addAll(obtainExecuteGroups(routeUnits));
} | [
"public",
"void",
"init",
"(",
"final",
"SQLRouteResult",
"routeResult",
")",
"throws",
"SQLException",
"{",
"setSqlStatement",
"(",
"routeResult",
".",
"getSqlStatement",
"(",
")",
")",
";",
"getExecuteGroups",
"(",
")",
".",
"addAll",
"(",
"obtainExecuteGroups",... | Initialize executor.
@param routeResult route result
@throws SQLException SQL exception | [
"Initialize",
"executor",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/BatchPreparedStatementExecutor.java#L77-L80 | train | Initialize the class. | [
30522,
2270,
11675,
1999,
4183,
1006,
2345,
29296,
22494,
3334,
2229,
11314,
2799,
6072,
11314,
1007,
11618,
29296,
10288,
24422,
1063,
4520,
4160,
4877,
12259,
3672,
1006,
2799,
6072,
11314,
1012,
4152,
4160,
4877,
12259,
3672,
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... |
netty/netty | codec/src/main/java/io/netty/handler/codec/compression/Snappy.java | Snappy.readPreamble | private static int readPreamble(ByteBuf in) {
int length = 0;
int byteIndex = 0;
while (in.isReadable()) {
int current = in.readUnsignedByte();
length |= (current & 0x7f) << byteIndex++ * 7;
if ((current & 0x80) == 0) {
return length;
}
if (byteIndex >= 4) {
throw new DecompressionException("Preamble is greater than 4 bytes");
}
}
return 0;
} | java | private static int readPreamble(ByteBuf in) {
int length = 0;
int byteIndex = 0;
while (in.isReadable()) {
int current = in.readUnsignedByte();
length |= (current & 0x7f) << byteIndex++ * 7;
if ((current & 0x80) == 0) {
return length;
}
if (byteIndex >= 4) {
throw new DecompressionException("Preamble is greater than 4 bytes");
}
}
return 0;
} | [
"private",
"static",
"int",
"readPreamble",
"(",
"ByteBuf",
"in",
")",
"{",
"int",
"length",
"=",
"0",
";",
"int",
"byteIndex",
"=",
"0",
";",
"while",
"(",
"in",
".",
"isReadable",
"(",
")",
")",
"{",
"int",
"current",
"=",
"in",
".",
"readUnsignedB... | Reads the length varint (a series of bytes, where the lower 7 bits
are data and the upper bit is a flag to indicate more bytes to be
read).
@param in The input buffer to read the preamble from
@return The calculated length based on the input buffer, or 0 if
no preamble is able to be calculated | [
"Reads",
"the",
"length",
"varint",
"(",
"a",
"series",
"of",
"bytes",
"where",
"the",
"lower",
"7",
"bits",
"are",
"data",
"and",
"the",
"upper",
"bit",
"is",
"a",
"flag",
"to",
"indicate",
"more",
"bytes",
"to",
"be",
"read",
")",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L363-L379 | train | Read the entire page of a record header. | [
30522,
2797,
10763,
20014,
3191,
28139,
3286,
3468,
1006,
24880,
8569,
2546,
1999,
1007,
1063,
20014,
3091,
1027,
1014,
1025,
20014,
24880,
22254,
10288,
1027,
1014,
1025,
2096,
1006,
1999,
1012,
2003,
16416,
20782,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java | ServerCookieEncoder.dedup | private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) {
boolean[] isLastInstance = new boolean[encoded.size()];
for (int idx : nameToLastIndex.values()) {
isLastInstance[idx] = true;
}
List<String> dedupd = new ArrayList<String>(nameToLastIndex.size());
for (int i = 0, n = encoded.size(); i < n; i++) {
if (isLastInstance[i]) {
dedupd.add(encoded.get(i));
}
}
return dedupd;
} | java | private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) {
boolean[] isLastInstance = new boolean[encoded.size()];
for (int idx : nameToLastIndex.values()) {
isLastInstance[idx] = true;
}
List<String> dedupd = new ArrayList<String>(nameToLastIndex.size());
for (int i = 0, n = encoded.size(); i < n; i++) {
if (isLastInstance[i]) {
dedupd.add(encoded.get(i));
}
}
return dedupd;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"dedup",
"(",
"List",
"<",
"String",
">",
"encoded",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"nameToLastIndex",
")",
"{",
"boolean",
"[",
"]",
"isLastInstance",
"=",
"new",
"boolean",
"[",
"encoded... | Deduplicate a list of encoded cookies by keeping only the last instance with a given name.
@param encoded The list of encoded cookies.
@param nameToLastIndex A map from cookie name to index of last cookie instance.
@return The encoded list with all but the last instance of a named cookie. | [
"Deduplicate",
"a",
"list",
"of",
"encoded",
"cookies",
"by",
"keeping",
"only",
"the",
"last",
"instance",
"with",
"a",
"given",
"name",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java#L137-L149 | train | deduces a list of strings from the encoded list to the last index. | [
30522,
2797,
10763,
2862,
1026,
5164,
1028,
2139,
8566,
2361,
1006,
2862,
1026,
5164,
1028,
12359,
1010,
4949,
1026,
5164,
1010,
16109,
1028,
2171,
3406,
8523,
7629,
3207,
2595,
1007,
1063,
22017,
20898,
1031,
1033,
25340,
16643,
23808,
665... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/resource/ClassPathResource.java | ClassPathResource.normalizePath | private String normalizePath(String path) {
// 标准化路径
path = FileUtil.normalize(path);
path = StrUtil.removePrefix(path, StrUtil.SLASH);
Assert.isFalse(FileUtil.isAbsolutePath(path), "Path [{}] must be a relative path !", path);
return path;
} | java | private String normalizePath(String path) {
// 标准化路径
path = FileUtil.normalize(path);
path = StrUtil.removePrefix(path, StrUtil.SLASH);
Assert.isFalse(FileUtil.isAbsolutePath(path), "Path [{}] must be a relative path !", path);
return path;
} | [
"private",
"String",
"normalizePath",
"(",
"String",
"path",
")",
"{",
"// 标准化路径\r",
"path",
"=",
"FileUtil",
".",
"normalize",
"(",
"path",
")",
";",
"path",
"=",
"StrUtil",
".",
"removePrefix",
"(",
"path",
",",
"StrUtil",
".",
"SLASH",
")",
";",
"Asse... | 标准化Path格式
@param path Path
@return 标准化后的path | [
"标准化Path格式"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ClassPathResource.java#L136-L143 | train | Normalize a relative path. | [
30522,
2797,
5164,
3671,
4697,
15069,
1006,
5164,
4130,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
4130,
1027,
5371,
21823,
2140,
1012,
3671,
4697,
1006,
4130,
1007,
1025,
4130,
1027,
2358,
22134,
4014,
1012,
6366,
28139,
8873,
2595... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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.rotate | public Img rotate(int degree) {
final BufferedImage image = getValidSrcImg();
int width = image.getWidth(null);
int height = image.getHeight(null);
final Rectangle rectangle = calcRotatedSize(width, height, degree);
final BufferedImage targetImg = new BufferedImage(rectangle.width, rectangle.height, getTypeInt());
Graphics2D graphics2d = targetImg.createGraphics();
// 抗锯齿
graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
// 从中心旋转
graphics2d.translate((rectangle.width - width) / 2, (rectangle.height - height) / 2);
graphics2d.rotate(Math.toRadians(degree), width / 2, height / 2);
graphics2d.drawImage(image, 0, 0, null);
graphics2d.dispose();
this.targetImage = targetImg;
return this;
} | java | public Img rotate(int degree) {
final BufferedImage image = getValidSrcImg();
int width = image.getWidth(null);
int height = image.getHeight(null);
final Rectangle rectangle = calcRotatedSize(width, height, degree);
final BufferedImage targetImg = new BufferedImage(rectangle.width, rectangle.height, getTypeInt());
Graphics2D graphics2d = targetImg.createGraphics();
// 抗锯齿
graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
// 从中心旋转
graphics2d.translate((rectangle.width - width) / 2, (rectangle.height - height) / 2);
graphics2d.rotate(Math.toRadians(degree), width / 2, height / 2);
graphics2d.drawImage(image, 0, 0, null);
graphics2d.dispose();
this.targetImage = targetImg;
return this;
} | [
"public",
"Img",
"rotate",
"(",
"int",
"degree",
")",
"{",
"final",
"BufferedImage",
"image",
"=",
"getValidSrcImg",
"(",
")",
";",
"int",
"width",
"=",
"image",
".",
"getWidth",
"(",
"null",
")",
";",
"int",
"height",
"=",
"image",
".",
"getHeight",
"... | 旋转图片为指定角度<br>
来自:http://blog.51cto.com/cping1982/130066
@param degree 旋转角度
@return 旋转后的图片
@since 3.2.2 | [
"旋转图片为指定角度<br",
">",
"来自:http",
":",
"//",
"blog",
".",
"51cto",
".",
"com",
"/",
"cping1982",
"/",
"130066"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L466-L482 | train | Rotate the image. | [
30522,
2270,
10047,
2290,
24357,
1006,
20014,
3014,
1007,
1063,
2345,
17698,
2098,
9581,
3351,
3746,
1027,
2131,
10175,
9821,
11890,
5714,
2290,
30524,
1012,
2131,
26036,
13900,
1006,
19701,
1007,
1025,
2345,
28667,
23395,
28667,
23395,
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-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.union | @SafeVarargs
public final DataStream<T> union(DataStream<T>... streams) {
List<StreamTransformation<T>> unionedTransforms = new ArrayList<>();
unionedTransforms.add(this.transformation);
for (DataStream<T> newStream : streams) {
if (!getType().equals(newStream.getType())) {
throw new IllegalArgumentException("Cannot union streams of different types: "
+ getType() + " and " + newStream.getType());
}
unionedTransforms.add(newStream.getTransformation());
}
return new DataStream<>(this.environment, new UnionTransformation<>(unionedTransforms));
} | java | @SafeVarargs
public final DataStream<T> union(DataStream<T>... streams) {
List<StreamTransformation<T>> unionedTransforms = new ArrayList<>();
unionedTransforms.add(this.transformation);
for (DataStream<T> newStream : streams) {
if (!getType().equals(newStream.getType())) {
throw new IllegalArgumentException("Cannot union streams of different types: "
+ getType() + " and " + newStream.getType());
}
unionedTransforms.add(newStream.getTransformation());
}
return new DataStream<>(this.environment, new UnionTransformation<>(unionedTransforms));
} | [
"@",
"SafeVarargs",
"public",
"final",
"DataStream",
"<",
"T",
">",
"union",
"(",
"DataStream",
"<",
"T",
">",
"...",
"streams",
")",
"{",
"List",
"<",
"StreamTransformation",
"<",
"T",
">>",
"unionedTransforms",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | Creates a new {@link DataStream} by merging {@link DataStream} outputs of
the same type with each other. The DataStreams merged using this operator
will be transformed simultaneously.
@param streams
The DataStreams to union output with.
@return The {@link DataStream}. | [
"Creates",
"a",
"new",
"{",
"@link",
"DataStream",
"}",
"by",
"merging",
"{",
"@link",
"DataStream",
"}",
"outputs",
"of",
"the",
"same",
"type",
"with",
"each",
"other",
".",
"The",
"DataStreams",
"merged",
"using",
"this",
"operator",
"will",
"be",
"tran... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L211-L225 | train | Returns a new DataStream that is the union of this DataStream with the given DataStreams. | [
30522,
1030,
3647,
24516,
10623,
2015,
2270,
2345,
2951,
21422,
1026,
1056,
1028,
2586,
1006,
2951,
21422,
1026,
1056,
1028,
1012,
1012,
1012,
9199,
1007,
1063,
2862,
1026,
5460,
6494,
3619,
14192,
3370,
1026,
1056,
1028,
1028,
2586,
2098,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/QueryStringDecoder.java | QueryStringDecoder.parameters | public Map<String, List<String>> parameters() {
if (params == null) {
params = decodeParams(uri, pathEndIdx(), charset, maxParams);
}
return params;
} | java | public Map<String, List<String>> parameters() {
if (params == null) {
params = decodeParams(uri, pathEndIdx(), charset, maxParams);
}
return params;
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"parameters",
"(",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"params",
"=",
"decodeParams",
"(",
"uri",
",",
"pathEndIdx",
"(",
")",
",",
"charset",
",",
"maxParams",
... | Returns the decoded key-value parameter pairs of the URI. | [
"Returns",
"the",
"decoded",
"key",
"-",
"value",
"parameter",
"pairs",
"of",
"the",
"URI",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/QueryStringDecoder.java#L178-L183 | train | Get the parameters for this request. | [
30522,
2270,
4949,
1026,
5164,
1010,
2862,
1026,
5164,
1028,
1028,
11709,
1006,
1007,
1063,
2065,
1006,
11498,
5244,
1027,
1027,
19701,
1007,
1063,
11498,
5244,
1027,
21933,
3207,
28689,
5244,
1006,
24471,
2072,
1010,
4130,
10497,
3593,
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... |
apache/flink | flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java | HadoopInputs.createHadoopInput | public static <K, V> HadoopInputFormat<K, V> createHadoopInput(org.apache.hadoop.mapred.InputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, JobConf job) {
return new HadoopInputFormat<>(mapredInputFormat, key, value, job);
} | java | public static <K, V> HadoopInputFormat<K, V> createHadoopInput(org.apache.hadoop.mapred.InputFormat<K, V> mapredInputFormat, Class<K> key, Class<V> value, JobConf job) {
return new HadoopInputFormat<>(mapredInputFormat, key, value, job);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HadoopInputFormat",
"<",
"K",
",",
"V",
">",
"createHadoopInput",
"(",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"InputFormat",
"<",
"K",
",",
"V",
">",
"mapredInputFormat",
",",
"Class",
"<"... | Creates a Flink {@link InputFormat} that wraps the given Hadoop {@link org.apache.hadoop.mapred.InputFormat}.
@return A Flink InputFormat that wraps the Hadoop InputFormat. | [
"Creates",
"a",
"Flink",
"{",
"@link",
"InputFormat",
"}",
"that",
"wraps",
"the",
"given",
"Hadoop",
"{",
"@link",
"org",
".",
"apache",
".",
"hadoop",
".",
"mapred",
".",
"InputFormat",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/HadoopInputs.java#L80-L82 | train | Create a new HadoopInputFormat instance. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
2018,
18589,
2378,
18780,
14192,
4017,
1026,
1047,
1010,
1058,
1028,
3443,
16102,
18589,
2378,
18780,
1006,
8917,
1012,
15895,
1012,
2018,
18589,
1012,
4949,
5596,
1012,
7953,
14192,
4017,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.isJsonObj | public static boolean isJsonObj(String str) {
if (StrUtil.isBlank(str)) {
return false;
}
return StrUtil.isWrap(str.trim(), '{', '}');
} | java | public static boolean isJsonObj(String str) {
if (StrUtil.isBlank(str)) {
return false;
}
return StrUtil.isWrap(str.trim(), '{', '}');
} | [
"public",
"static",
"boolean",
"isJsonObj",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"str",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"StrUtil",
".",
"isWrap",
"(",
"str",
".",
"trim",
"(",
")",
",",
"'... | 是否为JSONObject字符串,首尾都为大括号或中括号判定为JSON字符串
@param str 字符串
@return 是否为JSON字符串
@since 3.3.0 | [
"是否为JSONObject字符串,首尾都为大括号或中括号判定为JSON字符串"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L654-L659 | train | Checks if the given string is a JSON object. | [
30522,
2270,
10763,
22017,
20898,
2003,
22578,
17175,
2497,
3501,
1006,
5164,
2358,
2099,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
2358,
2099,
1007,
1007,
1063,
2709,
6270,
1025,
1065,
2709,
2358,
22134,
401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/slotpool/SlotPoolImpl.java | SlotPoolImpl.clear | private void clear() {
availableSlots.clear();
allocatedSlots.clear();
pendingRequests.clear();
waitingForResourceManager.clear();
registeredTaskManagers.clear();
} | java | private void clear() {
availableSlots.clear();
allocatedSlots.clear();
pendingRequests.clear();
waitingForResourceManager.clear();
registeredTaskManagers.clear();
} | [
"private",
"void",
"clear",
"(",
")",
"{",
"availableSlots",
".",
"clear",
"(",
")",
";",
"allocatedSlots",
".",
"clear",
"(",
")",
";",
"pendingRequests",
".",
"clear",
"(",
")",
";",
"waitingForResourceManager",
".",
"clear",
"(",
")",
";",
"registeredTa... | Clear the internal state of the SlotPool. | [
"Clear",
"the",
"internal",
"state",
"of",
"the",
"SlotPool",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L796-L802 | train | Clear all the resources. | [
30522,
2797,
11675,
3154,
1006,
1007,
1063,
2800,
14540,
12868,
1012,
3154,
1006,
1007,
1025,
11095,
14540,
12868,
1012,
3154,
1006,
1007,
1025,
14223,
2890,
15500,
2015,
1012,
3154,
1006,
1007,
1025,
3403,
29278,
6072,
8162,
3401,
24805,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java | CheckpointStatsTracker.reportRestoredCheckpoint | void reportRestoredCheckpoint(RestoredCheckpointStats restored) {
checkNotNull(restored, "Restored checkpoint");
statsReadWriteLock.lock();
try {
counts.incrementRestoredCheckpoints();
latestRestoredCheckpoint = restored;
dirty = true;
} finally {
statsReadWriteLock.unlock();
}
} | java | void reportRestoredCheckpoint(RestoredCheckpointStats restored) {
checkNotNull(restored, "Restored checkpoint");
statsReadWriteLock.lock();
try {
counts.incrementRestoredCheckpoints();
latestRestoredCheckpoint = restored;
dirty = true;
} finally {
statsReadWriteLock.unlock();
}
} | [
"void",
"reportRestoredCheckpoint",
"(",
"RestoredCheckpointStats",
"restored",
")",
"{",
"checkNotNull",
"(",
"restored",
",",
"\"Restored checkpoint\"",
")",
";",
"statsReadWriteLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"counts",
".",
"incrementRestoredCheckpoi... | Callback when a checkpoint is restored.
@param restored The restored checkpoint stats. | [
"Callback",
"when",
"a",
"checkpoint",
"is",
"restored",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointStatsTracker.java#L227-L239 | train | Reports a restored checkpoint. | [
30522,
11675,
3189,
28533,
19574,
5403,
3600,
8400,
1006,
5854,
5403,
3600,
26521,
29336,
2015,
5854,
1007,
1063,
4638,
17048,
11231,
3363,
1006,
5854,
1010,
1000,
5854,
26520,
1000,
1007,
1025,
26319,
16416,
2094,
26373,
7878,
1012,
5843,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/multipart/HttpPostStandardRequestDecoder.java | HttpPostStandardRequestDecoder.hasNext | @Override
public boolean hasNext() {
checkDestroyed();
if (currentStatus == MultiPartStatus.EPILOGUE) {
// OK except if end of list
if (bodyListHttpDataRank >= bodyListHttpData.size()) {
throw new EndOfDataDecoderException();
}
}
return !bodyListHttpData.isEmpty() && bodyListHttpDataRank < bodyListHttpData.size();
} | java | @Override
public boolean hasNext() {
checkDestroyed();
if (currentStatus == MultiPartStatus.EPILOGUE) {
// OK except if end of list
if (bodyListHttpDataRank >= bodyListHttpData.size()) {
throw new EndOfDataDecoderException();
}
}
return !bodyListHttpData.isEmpty() && bodyListHttpDataRank < bodyListHttpData.size();
} | [
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"checkDestroyed",
"(",
")",
";",
"if",
"(",
"currentStatus",
"==",
"MultiPartStatus",
".",
"EPILOGUE",
")",
"{",
"// OK except if end of list",
"if",
"(",
"bodyListHttpDataRank",
">=",
"bodyListHttpDa... | True if at current getStatus, there is an available decoded
InterfaceHttpData from the Body.
This getMethod works for chunked and not chunked request.
@return True if at current getStatus, there is a decoded InterfaceHttpData
@throws EndOfDataDecoderException
No more data will be available | [
"True",
"if",
"at",
"current",
"getStatus",
"there",
"is",
"an",
"available",
"decoded",
"InterfaceHttpData",
"from",
"the",
"Body",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostStandardRequestDecoder.java#L306-L317 | train | Returns true if the MultiPart has more data. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
8440,
10288,
2102,
1006,
1007,
1063,
4638,
6155,
13181,
20821,
1006,
1007,
1025,
2065,
1006,
14731,
29336,
2271,
1027,
1027,
4800,
26950,
29336,
2271,
1012,
24297,
1007,
1063,
1013,
1013,
7929,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-system/src/main/java/cn/hutool/system/SystemUtil.java | SystemUtil.get | public static String get(String name, boolean quiet) {
try {
return System.getProperty(name);
} catch (SecurityException e) {
if (false == quiet) {
Console.error("Caught a SecurityException reading the system property '{}'; the SystemUtil property value will default to null.", name);
}
return null;
}
} | java | public static String get(String name, boolean quiet) {
try {
return System.getProperty(name);
} catch (SecurityException e) {
if (false == quiet) {
Console.error("Caught a SecurityException reading the system property '{}'; the SystemUtil property value will default to null.", name);
}
return null;
}
} | [
"public",
"static",
"String",
"get",
"(",
"String",
"name",
",",
"boolean",
"quiet",
")",
"{",
"try",
"{",
"return",
"System",
".",
"getProperty",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"if",
"(",
"false",
"==",
... | 取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回 <code>null</code>。
@param name 属性名
@param quiet 安静模式,不将出错信息打在<code>System.err</code>中
@return 属性值或<code>null</code> | [
"取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回",
"<code",
">",
"null<",
"/",
"code",
">",
"。"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L118-L127 | train | Gets the value of the specified system property. | [
30522,
2270,
10763,
5164,
2131,
1006,
5164,
2171,
1010,
22017,
20898,
4251,
1007,
1063,
3046,
1063,
2709,
2291,
1012,
2131,
21572,
4842,
3723,
1006,
2171,
1007,
1025,
1065,
4608,
1006,
3036,
10288,
24422,
1041,
1007,
1063,
2065,
1006,
6270,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/codec/Rot.java | Rot.decodeChar | private static char decodeChar(char c, int offset, boolean isDecodeNumber) {
int temp = c;
// if converting numbers is enabled
if (isDecodeNumber) {
if (temp >= CHAR0 && temp <= CHAR9) {
temp -= CHAR0;
temp = temp - offset;
while (temp < 0) {
temp += 10;
}
temp += CHAR0;
}
}
// A == 65, Z == 90
if (temp >= ACHAR && temp <= ZCHAR) {
temp -= ACHAR;
temp = temp - offset;
while (temp < 0) {
temp = 26 + temp;
}
temp += ACHAR;
} else if (temp >= aCHAR && temp <= zCHAR) {
temp -= aCHAR;
temp = temp - offset;
if (temp < 0)
temp = 26 + temp;
temp += aCHAR;
}
return (char) temp;
} | java | private static char decodeChar(char c, int offset, boolean isDecodeNumber) {
int temp = c;
// if converting numbers is enabled
if (isDecodeNumber) {
if (temp >= CHAR0 && temp <= CHAR9) {
temp -= CHAR0;
temp = temp - offset;
while (temp < 0) {
temp += 10;
}
temp += CHAR0;
}
}
// A == 65, Z == 90
if (temp >= ACHAR && temp <= ZCHAR) {
temp -= ACHAR;
temp = temp - offset;
while (temp < 0) {
temp = 26 + temp;
}
temp += ACHAR;
} else if (temp >= aCHAR && temp <= zCHAR) {
temp -= aCHAR;
temp = temp - offset;
if (temp < 0)
temp = 26 + temp;
temp += aCHAR;
}
return (char) temp;
} | [
"private",
"static",
"char",
"decodeChar",
"(",
"char",
"c",
",",
"int",
"offset",
",",
"boolean",
"isDecodeNumber",
")",
"{",
"int",
"temp",
"=",
"c",
";",
"// if converting numbers is enabled\r",
"if",
"(",
"isDecodeNumber",
")",
"{",
"if",
"(",
"temp",
">... | 编码字符
@param c 字符
@param offset 位移
@param isDecodeNumber 是否编码数字
@return 编码后的字符串 | [
"编码字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Rot.java#L138-L171 | train | Decodes a character from UTF - 8 using the offset parameter. | [
30522,
2797,
10763,
25869,
21933,
3207,
7507,
2099,
1006,
25869,
1039,
1010,
20014,
16396,
1010,
22017,
20898,
2003,
3207,
16044,
19172,
5677,
1007,
1063,
20014,
8915,
8737,
1027,
1039,
1025,
1013,
1013,
2065,
16401,
3616,
2003,
9124,
2065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java | BucketingSink.closePartFilesByTime | private void closePartFilesByTime(long currentProcessingTime) throws Exception {
synchronized (state.bucketStates) {
for (Map.Entry<String, BucketState<T>> entry : state.bucketStates.entrySet()) {
if ((entry.getValue().lastWrittenToTime < currentProcessingTime - inactiveBucketThreshold)
|| (entry.getValue().creationTime < currentProcessingTime - batchRolloverInterval)) {
LOG.debug("BucketingSink {} closing bucket due to inactivity of over {} ms.",
getRuntimeContext().getIndexOfThisSubtask(), inactiveBucketThreshold);
closeCurrentPartFile(entry.getValue());
}
}
}
} | java | private void closePartFilesByTime(long currentProcessingTime) throws Exception {
synchronized (state.bucketStates) {
for (Map.Entry<String, BucketState<T>> entry : state.bucketStates.entrySet()) {
if ((entry.getValue().lastWrittenToTime < currentProcessingTime - inactiveBucketThreshold)
|| (entry.getValue().creationTime < currentProcessingTime - batchRolloverInterval)) {
LOG.debug("BucketingSink {} closing bucket due to inactivity of over {} ms.",
getRuntimeContext().getIndexOfThisSubtask(), inactiveBucketThreshold);
closeCurrentPartFile(entry.getValue());
}
}
}
} | [
"private",
"void",
"closePartFilesByTime",
"(",
"long",
"currentProcessingTime",
")",
"throws",
"Exception",
"{",
"synchronized",
"(",
"state",
".",
"bucketStates",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"BucketState",
"<",
"T",
">",
... | Checks for inactive buckets, and closes them. Buckets are considered inactive if they have not been
written to for a period greater than {@code inactiveBucketThreshold} ms. Buckets are also closed if they are
older than {@code batchRolloverInterval} ms. This enables in-progress files to be moved to the pending state
and be finalised on the next checkpoint. | [
"Checks",
"for",
"inactive",
"buckets",
"and",
"closes",
"them",
".",
"Buckets",
"are",
"considered",
"inactive",
"if",
"they",
"have",
"not",
"been",
"written",
"to",
"for",
"a",
"period",
"greater",
"than",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/bucketing/BucketingSink.java#L517-L529 | train | Close all part files that have been written to the file system by the given processing time. | [
30522,
2797,
11675,
2485,
19362,
24475,
9463,
14478,
7292,
1006,
2146,
2783,
21572,
9623,
7741,
7292,
1007,
11618,
6453,
1063,
25549,
1006,
2110,
1012,
13610,
9153,
4570,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
5164,
1010,
13610,
91... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/cache/DistributedCache.java | DistributedCache.getFile | public File getFile(String name) {
if (name == null) {
throw new NullPointerException("name must not be null");
}
Future<Path> future = cacheCopyTasks.get(name);
if (future == null) {
throw new IllegalArgumentException("File with name '" + name + "' is not available." +
" Did you forget to register the file?");
}
try {
final Path path = future.get();
URI tmp = path.makeQualified(path.getFileSystem()).toUri();
return new File(tmp);
}
catch (ExecutionException e) {
throw new RuntimeException("An error occurred while copying the file.", e.getCause());
}
catch (Exception e) {
throw new RuntimeException("Error while getting the file registered under '" + name +
"' from the distributed cache", e);
}
} | java | public File getFile(String name) {
if (name == null) {
throw new NullPointerException("name must not be null");
}
Future<Path> future = cacheCopyTasks.get(name);
if (future == null) {
throw new IllegalArgumentException("File with name '" + name + "' is not available." +
" Did you forget to register the file?");
}
try {
final Path path = future.get();
URI tmp = path.makeQualified(path.getFileSystem()).toUri();
return new File(tmp);
}
catch (ExecutionException e) {
throw new RuntimeException("An error occurred while copying the file.", e.getCause());
}
catch (Exception e) {
throw new RuntimeException("Error while getting the file registered under '" + name +
"' from the distributed cache", e);
}
} | [
"public",
"File",
"getFile",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name must not be null\"",
")",
";",
"}",
"Future",
"<",
"Path",
">",
"future",
"=",
"cacheCopyTasks",
"... | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/cache/DistributedCache.java#L103-L126 | train | Gets the file with the given name from the distributed cache. | [
30522,
2270,
5371,
2131,
8873,
2571,
1006,
5164,
2171,
1007,
1063,
2065,
1006,
2171,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
2171,
2442,
2025,
2022,
19701,
1000,
1007,
1025,
1065,
2925,
1026,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.writeAsCsv | public DataSink<T> writeAsCsv(String filePath, WriteMode writeMode) {
return internalWriteAsCsv(new Path(filePath), CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER, writeMode);
} | java | public DataSink<T> writeAsCsv(String filePath, WriteMode writeMode) {
return internalWriteAsCsv(new Path(filePath), CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER, writeMode);
} | [
"public",
"DataSink",
"<",
"T",
">",
"writeAsCsv",
"(",
"String",
"filePath",
",",
"WriteMode",
"writeMode",
")",
"{",
"return",
"internalWriteAsCsv",
"(",
"new",
"Path",
"(",
"filePath",
")",
",",
"CsvOutputFormat",
".",
"DEFAULT_LINE_DELIMITER",
",",
"CsvOutpu... | Writes a {@link Tuple} DataSet as CSV file(s) to the specified location.
<p><b>Note: Only a Tuple DataSet can written as a CSV file.</b>
<p>For each Tuple field the result of {@link Object#toString()} is written.
Tuple fields are separated by the default field delimiter {@code "comma" (,)}.
<p>Tuples are are separated by the newline character ({@code \n}).
@param filePath The path pointing to the location the CSV file is written to.
@param writeMode The behavior regarding existing files. Options are NO_OVERWRITE and OVERWRITE.
@return The DataSink that writes the DataSet.
@see Tuple
@see CsvOutputFormat
@see DataSet#writeAsText(String) Output files and directories | [
"Writes",
"a",
"{",
"@link",
"Tuple",
"}",
"DataSet",
"as",
"CSV",
"file",
"(",
"s",
")",
"to",
"the",
"specified",
"location",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L1586-L1588 | train | Write data sink to file using default line delimiter and field delimiter. | [
30522,
2270,
2951,
11493,
2243,
1026,
1056,
1028,
4339,
3022,
6169,
2615,
1006,
5164,
5371,
15069,
1010,
4339,
5302,
3207,
4339,
5302,
3207,
1007,
1063,
2709,
4722,
26373,
3022,
6169,
2615,
1006,
2047,
4130,
1006,
5371,
15069,
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... |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/SettingLoader.java | SettingLoader.store | private void store(PrintWriter writer) throws IOException {
for (Entry<String, LinkedHashMap<String, String>> groupEntry : this.groupedMap.entrySet()) {
writer.println(StrUtil.format("{}{}{}", CharUtil.BRACKET_START, groupEntry.getKey(), CharUtil.BRACKET_END));
for (Entry<String, String> entry : groupEntry.getValue().entrySet()) {
writer.println(StrUtil.format("{} {} {}", entry.getKey(), ASSIGN_FLAG, entry.getValue()));
}
}
} | java | private void store(PrintWriter writer) throws IOException {
for (Entry<String, LinkedHashMap<String, String>> groupEntry : this.groupedMap.entrySet()) {
writer.println(StrUtil.format("{}{}{}", CharUtil.BRACKET_START, groupEntry.getKey(), CharUtil.BRACKET_END));
for (Entry<String, String> entry : groupEntry.getValue().entrySet()) {
writer.println(StrUtil.format("{} {} {}", entry.getKey(), ASSIGN_FLAG, entry.getValue()));
}
}
} | [
"private",
"void",
"store",
"(",
"PrintWriter",
"writer",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
">",
"groupEntry",
":",
"this",
".",
"groupedMap",
".",
"entrySet",
"(... | 存储到Writer
@param writer Writer
@throws IOException IO异常 | [
"存储到Writer"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/SettingLoader.java#L180-L187 | train | Store the data in the output stream. | [
30522,
2797,
11675,
3573,
1006,
6140,
15994,
3213,
1007,
11618,
22834,
10288,
24422,
1063,
2005,
1006,
4443,
1026,
5164,
1010,
5799,
14949,
22444,
2361,
1026,
5164,
1010,
5164,
1028,
1028,
2177,
4765,
2854,
1024,
2023,
1012,
15131,
2863,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.noNullElements | public static <T> T[] noNullElements(T[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.hasNull(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | java | public static <T> T[] noNullElements(T[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.hasNull(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"noNullElements",
"(",
"T",
"[",
"]",
"array",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ArrayUtil",
".",
"hasNull",
"(",... | 断言给定数组是否不包含{@code null}元素,如果数组为空或 {@code null}将被认为不包含
<pre class="code">
Assert.noNullElements(array, "The array must have non-null elements");
</pre>
@param <T> 数组元素类型
@param array 被检查的数组
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 被检查的数组
@throws IllegalArgumentException if the object array contains a {@code null} element | [
"断言给定数组是否不包含",
"{",
"@code",
"null",
"}",
"元素,如果数组为空或",
"{",
"@code",
"null",
"}",
"将被认为不包含"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L314-L319 | train | Returns an array containing all null elements. | [
30522,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2512,
18083,
12260,
8163,
1006,
1056,
1031,
1033,
9140,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
6206,
2906,
22850,
15781,
25... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/util/ConfigurationParserUtils.java | ConfigurationParserUtils.getSlot | public static int getSlot(Configuration configuration) {
int slots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
// we need this because many configs have been written with a "-1" entry
if (slots == -1) {
slots = 1;
}
ConfigurationParserUtils.checkConfigParameter(slots >= 1, slots, TaskManagerOptions.NUM_TASK_SLOTS.key(),
"Number of task slots must be at least one.");
return slots;
} | java | public static int getSlot(Configuration configuration) {
int slots = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS, 1);
// we need this because many configs have been written with a "-1" entry
if (slots == -1) {
slots = 1;
}
ConfigurationParserUtils.checkConfigParameter(slots >= 1, slots, TaskManagerOptions.NUM_TASK_SLOTS.key(),
"Number of task slots must be at least one.");
return slots;
} | [
"public",
"static",
"int",
"getSlot",
"(",
"Configuration",
"configuration",
")",
"{",
"int",
"slots",
"=",
"configuration",
".",
"getInteger",
"(",
"TaskManagerOptions",
".",
"NUM_TASK_SLOTS",
",",
"1",
")",
";",
"// we need this because many configs have been written ... | Parses the configuration to get the number of slots and validates the value.
@param configuration configuration object
@return the number of slots in task manager | [
"Parses",
"the",
"configuration",
"to",
"get",
"the",
"number",
"of",
"slots",
"and",
"validates",
"the",
"value",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ConfigurationParserUtils.java#L103-L114 | train | Get the number of slots from the configuration. | [
30522,
2270,
10763,
20014,
4152,
10994,
1006,
9563,
9563,
1007,
1063,
20014,
19832,
1027,
9563,
1012,
2131,
18447,
26320,
1006,
4708,
24805,
4590,
7361,
9285,
1012,
16371,
2213,
1035,
4708,
1035,
19832,
1010,
1015,
1007,
1025,
1013,
1013,
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... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java | TaskSchedulerBuilder.additionalCustomizers | public TaskSchedulerBuilder additionalCustomizers(
TaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return additionalCustomizers(Arrays.asList(customizers));
} | java | public TaskSchedulerBuilder additionalCustomizers(
TaskSchedulerCustomizer... customizers) {
Assert.notNull(customizers, "Customizers must not be null");
return additionalCustomizers(Arrays.asList(customizers));
} | [
"public",
"TaskSchedulerBuilder",
"additionalCustomizers",
"(",
"TaskSchedulerCustomizer",
"...",
"customizers",
")",
"{",
"Assert",
".",
"notNull",
"(",
"customizers",
",",
"\"Customizers must not be null\"",
")",
";",
"return",
"additionalCustomizers",
"(",
"Arrays",
".... | Add {@link TaskSchedulerCustomizer taskSchedulerCustomizers} that should be applied
to the {@link ThreadPoolTaskScheduler}. Customizers are applied in the order that
they were added after builder configuration has been applied.
@param customizers the customizers to add
@return a new builder instance
@see #customizers(TaskSchedulerCustomizer...) | [
"Add",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java#L158-L162 | train | Add additional customizers to the task scheduler. | [
30522,
2270,
8518,
7690,
9307,
15185,
19231,
4063,
3176,
7874,
20389,
17629,
2015,
1006,
8518,
7690,
9307,
29006,
20389,
17629,
1012,
1012,
1012,
7661,
17629,
2015,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
1006,
7661,
17629,
2015,
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... |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java | WebSocketServerHandshaker.handshake | public final ChannelFuture handshake(final Channel channel, HttpRequest req,
final HttpHeaders responseHeaders, final ChannelPromise promise) {
if (req instanceof FullHttpRequest) {
return handshake(channel, (FullHttpRequest) req, responseHeaders, promise);
}
if (logger.isDebugEnabled()) {
logger.debug("{} WebSocket version {} server handshake", channel, version());
}
ChannelPipeline p = channel.pipeline();
ChannelHandlerContext ctx = p.context(HttpRequestDecoder.class);
if (ctx == null) {
// this means the user use a HttpServerCodec
ctx = p.context(HttpServerCodec.class);
if (ctx == null) {
promise.setFailure(
new IllegalStateException("No HttpDecoder and no HttpServerCodec in the pipeline"));
return promise;
}
}
// Add aggregator and ensure we feed the HttpRequest so it is aggregated. A limit o 8192 should be more then
// enough for the websockets handshake payload.
//
// TODO: Make handshake work without HttpObjectAggregator at all.
String aggregatorName = "httpAggregator";
p.addAfter(ctx.name(), aggregatorName, new HttpObjectAggregator(8192));
p.addAfter(aggregatorName, "handshaker", new SimpleChannelInboundHandler<FullHttpRequest>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) throws Exception {
// Remove ourself and do the actual handshake
ctx.pipeline().remove(this);
handshake(channel, msg, responseHeaders, promise);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// Remove ourself and fail the handshake promise.
ctx.pipeline().remove(this);
promise.tryFailure(cause);
ctx.fireExceptionCaught(cause);
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
// Fail promise if Channel was closed
promise.tryFailure(CLOSED_CHANNEL_EXCEPTION);
ctx.fireChannelInactive();
}
});
try {
ctx.fireChannelRead(ReferenceCountUtil.retain(req));
} catch (Throwable cause) {
promise.setFailure(cause);
}
return promise;
} | java | public final ChannelFuture handshake(final Channel channel, HttpRequest req,
final HttpHeaders responseHeaders, final ChannelPromise promise) {
if (req instanceof FullHttpRequest) {
return handshake(channel, (FullHttpRequest) req, responseHeaders, promise);
}
if (logger.isDebugEnabled()) {
logger.debug("{} WebSocket version {} server handshake", channel, version());
}
ChannelPipeline p = channel.pipeline();
ChannelHandlerContext ctx = p.context(HttpRequestDecoder.class);
if (ctx == null) {
// this means the user use a HttpServerCodec
ctx = p.context(HttpServerCodec.class);
if (ctx == null) {
promise.setFailure(
new IllegalStateException("No HttpDecoder and no HttpServerCodec in the pipeline"));
return promise;
}
}
// Add aggregator and ensure we feed the HttpRequest so it is aggregated. A limit o 8192 should be more then
// enough for the websockets handshake payload.
//
// TODO: Make handshake work without HttpObjectAggregator at all.
String aggregatorName = "httpAggregator";
p.addAfter(ctx.name(), aggregatorName, new HttpObjectAggregator(8192));
p.addAfter(aggregatorName, "handshaker", new SimpleChannelInboundHandler<FullHttpRequest>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) throws Exception {
// Remove ourself and do the actual handshake
ctx.pipeline().remove(this);
handshake(channel, msg, responseHeaders, promise);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
// Remove ourself and fail the handshake promise.
ctx.pipeline().remove(this);
promise.tryFailure(cause);
ctx.fireExceptionCaught(cause);
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
// Fail promise if Channel was closed
promise.tryFailure(CLOSED_CHANNEL_EXCEPTION);
ctx.fireChannelInactive();
}
});
try {
ctx.fireChannelRead(ReferenceCountUtil.retain(req));
} catch (Throwable cause) {
promise.setFailure(cause);
}
return promise;
} | [
"public",
"final",
"ChannelFuture",
"handshake",
"(",
"final",
"Channel",
"channel",
",",
"HttpRequest",
"req",
",",
"final",
"HttpHeaders",
"responseHeaders",
",",
"final",
"ChannelPromise",
"promise",
")",
"{",
"if",
"(",
"req",
"instanceof",
"FullHttpRequest",
... | Performs the opening handshake
When call this method you <strong>MUST NOT</strong> retain the {@link HttpRequest} which is passed in.
@param channel
Channel
@param req
HTTP Request
@param responseHeaders
Extra headers to add to the handshake response or {@code null} if no extra headers should be added
@param promise
the {@link ChannelPromise} to be notified when the opening handshake is done
@return future
the {@link ChannelFuture} which is notified when the opening handshake is done | [
"Performs",
"the",
"opening",
"handshake"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java#L240-L295 | train | Handshake the WebSocket. | [
30522,
2270,
2345,
3149,
11263,
11244,
2398,
20459,
2063,
1006,
2345,
3149,
3149,
1010,
8299,
2890,
15500,
2128,
4160,
1010,
2345,
8299,
4974,
2545,
3433,
4974,
2545,
1010,
2345,
3149,
21572,
28732,
4872,
1007,
1063,
2065,
1006,
2128,
4160,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/NumberChineseFormater.java | NumberChineseFormater.toChinese | private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000!");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // 在从低位往高位循环时,记录上一位数字是不是 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// 高位已无数据
break;
}
int digit = temp % 10;
if (digit == 0) { // 取到的数字为 0
if (false == lastIsZero) {
// 前一个数字不是 0,则在当前汉字串前加“零”字;
chineseStr = "零" + chineseStr;
}
lastIsZero = true;
} else { // 取到的数字不是 0
chineseStr = numArray[digit] + units[i] + chineseStr;
lastIsZero = false;
}
temp = temp / 10;
}
return chineseStr;
} | java | private static String toChinese(int amountPart, boolean isUseTraditional) {
// if (amountPart < 0 || amountPart > 10000) {
// throw new IllegalArgumentException("Number must 0 < num < 10000!");
// }
String[] numArray = isUseTraditional ? traditionalDigits : simpleDigits;
String[] units = isUseTraditional ? traditionalUnits : simpleUnits;
int temp = amountPart;
String chineseStr = "";
boolean lastIsZero = true; // 在从低位往高位循环时,记录上一位数字是不是 0
for (int i = 0; temp > 0; i++) {
if (temp == 0) {
// 高位已无数据
break;
}
int digit = temp % 10;
if (digit == 0) { // 取到的数字为 0
if (false == lastIsZero) {
// 前一个数字不是 0,则在当前汉字串前加“零”字;
chineseStr = "零" + chineseStr;
}
lastIsZero = true;
} else { // 取到的数字不是 0
chineseStr = numArray[digit] + units[i] + chineseStr;
lastIsZero = false;
}
temp = temp / 10;
}
return chineseStr;
} | [
"private",
"static",
"String",
"toChinese",
"(",
"int",
"amountPart",
",",
"boolean",
"isUseTraditional",
")",
"{",
"//\t\tif (amountPart < 0 || amountPart > 10000) {",
"//\t\t\tthrow new IllegalArgumentException(\"Number must 0 < num < 10000!\");",
"//\t\t}",
"String",
"[",
"]",
... | 把一个 0~9999 之间的整数转换为汉字的字符串,如果是 0 则返回 ""
@param amountPart 数字部分
@param isUseTraditional 是否使用繁体单位
@return 转换后的汉字 | [
"把一个",
"0~9999",
"之间的整数转换为汉字的字符串,如果是",
"0",
"则返回"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormater.java#L140-L171 | train | Converts a number of digits to chinese. | [
30522,
2797,
10763,
5164,
2000,
17231,
6810,
1006,
20014,
3815,
19362,
2102,
1010,
22017,
20898,
2003,
8557,
6494,
27064,
1007,
1063,
1013,
1013,
2065,
1006,
3815,
19362,
2102,
1026,
1014,
1064,
1064,
3815,
19362,
2102,
1028,
6694,
2692,
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/XmlUtil.java | XmlUtil.cleanInvalid | public static String cleanInvalid(String xmlContent) {
if (xmlContent == null) {
return null;
}
return xmlContent.replaceAll(INVALID_REGEX, "");
} | java | public static String cleanInvalid(String xmlContent) {
if (xmlContent == null) {
return null;
}
return xmlContent.replaceAll(INVALID_REGEX, "");
} | [
"public",
"static",
"String",
"cleanInvalid",
"(",
"String",
"xmlContent",
")",
"{",
"if",
"(",
"xmlContent",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"xmlContent",
".",
"replaceAll",
"(",
"INVALID_REGEX",
",",
"\"\"",
")",
";",
"}"
] | 去除XML文本中的无效字符
@param xmlContent XML文本
@return 当传入为null时返回null | [
"去除XML文本中的无效字符"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L431-L436 | train | Clean invalid characters in xmlContent. | [
30522,
2270,
10763,
5164,
4550,
2378,
10175,
3593,
1006,
5164,
20950,
8663,
6528,
2102,
1007,
1063,
2065,
1006,
20950,
8663,
6528,
2102,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
20950,
8663,
6528,
2102,
1012,
5672,
8095... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ExcelPicUtil.java | ExcelPicUtil.getPicMapXls | private static Map<String, PictureData> getPicMapXls(HSSFWorkbook workbook, int sheetIndex) {
final Map<String, PictureData> picMap = new HashMap<>();
final List<HSSFPictureData> pictures = workbook.getAllPictures();
if (CollectionUtil.isNotEmpty(pictures)) {
final HSSFSheet sheet = workbook.getSheetAt(sheetIndex);
HSSFClientAnchor anchor;
int pictureIndex;
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
if (shape instanceof HSSFPicture) {
pictureIndex = ((HSSFPicture) shape).getPictureIndex() - 1;
anchor = (HSSFClientAnchor) shape.getAnchor();
picMap.put(StrUtil.format("{}_{}", anchor.getRow1(), anchor.getCol1()), pictures.get(pictureIndex));
}
}
}
return picMap;
} | java | private static Map<String, PictureData> getPicMapXls(HSSFWorkbook workbook, int sheetIndex) {
final Map<String, PictureData> picMap = new HashMap<>();
final List<HSSFPictureData> pictures = workbook.getAllPictures();
if (CollectionUtil.isNotEmpty(pictures)) {
final HSSFSheet sheet = workbook.getSheetAt(sheetIndex);
HSSFClientAnchor anchor;
int pictureIndex;
for (HSSFShape shape : sheet.getDrawingPatriarch().getChildren()) {
if (shape instanceof HSSFPicture) {
pictureIndex = ((HSSFPicture) shape).getPictureIndex() - 1;
anchor = (HSSFClientAnchor) shape.getAnchor();
picMap.put(StrUtil.format("{}_{}", anchor.getRow1(), anchor.getCol1()), pictures.get(pictureIndex));
}
}
}
return picMap;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"PictureData",
">",
"getPicMapXls",
"(",
"HSSFWorkbook",
"workbook",
",",
"int",
"sheetIndex",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"PictureData",
">",
"picMap",
"=",
"new",
"HashMap",
"<>",
"(",
")"... | 获取XLS工作簿指定sheet中图片列表
@param workbook 工作簿{@link Workbook}
@param sheetIndex sheet的索引
@return 图片映射,键格式:行_列,值:{@link PictureData} | [
"获取XLS工作簿指定sheet中图片列表"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelPicUtil.java#L64-L80 | train | Gets the picture map for a given sheet index. | [
30522,
2797,
10763,
4949,
1026,
5164,
1010,
15885,
6790,
1028,
2131,
24330,
2863,
2361,
2595,
4877,
1006,
26236,
22747,
6198,
8654,
2147,
8654,
1010,
20014,
7123,
22254,
10288,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
15885,
6790,
1028,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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/ArrayUtil.java | ArrayUtil.newArray | @SuppressWarnings("unchecked")
public static <T> T[] newArray(Class<?> componentType, int newSize) {
return (T[]) Array.newInstance(componentType, newSize);
} | java | @SuppressWarnings("unchecked")
public static <T> T[] newArray(Class<?> componentType, int newSize) {
return (T[]) Array.newInstance(componentType, newSize);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"newArray",
"(",
"Class",
"<",
"?",
">",
"componentType",
",",
"int",
"newSize",
")",
"{",
"return",
"(",
"T",
"[",
"]",
")",
"Array",
".",
"newInst... | 新建一个空数组
@param <T> 数组元素类型
@param componentType 元素类型
@param newSize 大小
@return 空数组 | [
"新建一个空数组"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L293-L296 | train | Creates an array of the specified type with the specified size. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
1026,
1056,
1028,
1056,
1031,
1033,
2047,
2906,
9447,
1006,
2465,
1026,
1029,
1028,
6922,
13874,
1010,
20014,
2739,
4697,
1007,
1063,
2709,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.