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/bigram/WordNatureDependencyModel.java | WordNatureDependencyModel.getEdge | public Edge getEdge(Node from, Node to)
{
// 首先尝试词+词
Attribute attribute = get(from.compiledWord, to.compiledWord);
if (attribute == null) attribute = get(from.compiledWord, WordNatureWeightModelMaker.wrapTag(to.label));
if (attribute == null) attribute = get(WordNatureWeightModelMaker.wrapTag(from.label), to.compiledWord);
if (attribute == null) attribute = get(WordNatureWeightModelMaker.wrapTag(from.label), WordNatureWeightModelMaker.wrapTag(to.label));
if (attribute == null)
{
attribute = Attribute.NULL;
}
if (HanLP.Config.DEBUG)
{
System.out.println(from + " 到 " + to + " : " + attribute);
}
return new Edge(from.id, to.id, attribute.dependencyRelation[0], attribute.p[0]);
} | java | public Edge getEdge(Node from, Node to)
{
// 首先尝试词+词
Attribute attribute = get(from.compiledWord, to.compiledWord);
if (attribute == null) attribute = get(from.compiledWord, WordNatureWeightModelMaker.wrapTag(to.label));
if (attribute == null) attribute = get(WordNatureWeightModelMaker.wrapTag(from.label), to.compiledWord);
if (attribute == null) attribute = get(WordNatureWeightModelMaker.wrapTag(from.label), WordNatureWeightModelMaker.wrapTag(to.label));
if (attribute == null)
{
attribute = Attribute.NULL;
}
if (HanLP.Config.DEBUG)
{
System.out.println(from + " 到 " + to + " : " + attribute);
}
return new Edge(from.id, to.id, attribute.dependencyRelation[0], attribute.p[0]);
} | [
"public",
"Edge",
"getEdge",
"(",
"Node",
"from",
",",
"Node",
"to",
")",
"{",
"// 首先尝试词+词",
"Attribute",
"attribute",
"=",
"get",
"(",
"from",
".",
"compiledWord",
",",
"to",
".",
"compiledWord",
")",
";",
"if",
"(",
"attribute",
"==",
"null",
")",
"a... | 打分
@param from
@param to
@return | [
"打分"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/bigram/WordNatureDependencyModel.java#L171-L187 | train | Get edge from two nodes. | [
30522,
2270,
3341,
2131,
24225,
1006,
13045,
2013,
1010,
13045,
2000,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
1009,
100,
17961,
17961,
1027,
2131,
1006,
2013,
1012,
9227,
18351,
1010,
2000,
1012,
9227,
18351,
1007,
1025,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java | AbstractNioChannel.newDirectBuffer | protected final ByteBuf newDirectBuffer(ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.safeRelease(buf);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
ByteBuf directBuf = alloc.directBuffer(readableBytes);
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf != null) {
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
// Allocating and deallocating an unpooled direct buffer is very expensive; give up.
return buf;
} | java | protected final ByteBuf newDirectBuffer(ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.safeRelease(buf);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
ByteBuf directBuf = alloc.directBuffer(readableBytes);
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf != null) {
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(buf);
return directBuf;
}
// Allocating and deallocating an unpooled direct buffer is very expensive; give up.
return buf;
} | [
"protected",
"final",
"ByteBuf",
"newDirectBuffer",
"(",
"ByteBuf",
"buf",
")",
"{",
"final",
"int",
"readableBytes",
"=",
"buf",
".",
"readableBytes",
"(",
")",
";",
"if",
"(",
"readableBytes",
"==",
"0",
")",
"{",
"ReferenceCountUtil",
".",
"safeRelease",
... | Returns an off-heap copy of the specified {@link ByteBuf}, and releases the original one.
Note that this method does not create an off-heap copy if the allocation / deallocation cost is too high,
but just returns the original {@link ByteBuf}.. | [
"Returns",
"an",
"off",
"-",
"heap",
"copy",
"of",
"the",
"specified",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/nio/AbstractNioChannel.java#L439-L463 | train | Creates a direct buffer for the specified byte buffer. | [
30522,
5123,
2345,
24880,
8569,
2546,
2047,
4305,
2890,
6593,
8569,
12494,
1006,
24880,
8569,
2546,
20934,
2546,
1007,
1063,
2345,
20014,
3191,
3085,
3762,
4570,
1027,
20934,
2546,
1012,
3191,
3085,
3762,
4570,
1006,
1007,
1025,
2065,
1006,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.newSingleThreadExecutor | public static InstrumentedExecutorService newSingleThreadExecutor(
ThreadFactory threadFactory, MetricRegistry registry) {
return new InstrumentedExecutorService(Executors.newSingleThreadExecutor(threadFactory), registry);
} | java | public static InstrumentedExecutorService newSingleThreadExecutor(
ThreadFactory threadFactory, MetricRegistry registry) {
return new InstrumentedExecutorService(Executors.newSingleThreadExecutor(threadFactory), registry);
} | [
"public",
"static",
"InstrumentedExecutorService",
"newSingleThreadExecutor",
"(",
"ThreadFactory",
"threadFactory",
",",
"MetricRegistry",
"registry",
")",
"{",
"return",
"new",
"InstrumentedExecutorService",
"(",
"Executors",
".",
"newSingleThreadExecutor",
"(",
"threadFact... | Creates an InstrumentedExecutor that uses a single worker thread operating
off an unbounded queue, and uses the provided ThreadFactory to
create a new thread when needed. Unlike the otherwise
equivalent {@code newFixedThreadPool(1, threadFactory)} the
returned executor is guaranteed not to be reconfigurable to use
additional threads.
@param threadFactory the factory to use when creating new threads
@param registry the {@link MetricRegistry} that will contain the metrics.
@return the newly created single-threaded Executor
@throws NullPointerException if threadFactory is null
@see Executors#newSingleThreadExecutor(ThreadFactory) | [
"Creates",
"an",
"InstrumentedExecutor",
"that",
"uses",
"a",
"single",
"worker",
"thread",
"operating",
"off",
"an",
"unbounded",
"queue",
"and",
"uses",
"the",
"provided",
"ThreadFactory",
"to",
"create",
"a",
"new",
"thread",
"when",
"needed",
".",
"Unlike",
... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L211-L214 | train | Create a new single thread executor. | [
30522,
2270,
10763,
6602,
14728,
2595,
8586,
16161,
22573,
2099,
7903,
2063,
2739,
2075,
7485,
28362,
9648,
2595,
8586,
16161,
2099,
1006,
11689,
21450,
11689,
21450,
1010,
12046,
2890,
24063,
2854,
15584,
1007,
1063,
2709,
2047,
6602,
14728,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/IterativeStream.java | IterativeStream.withFeedbackType | public <F> ConnectedIterativeStreams<T, F> withFeedbackType(TypeHint<F> feedbackTypeHint) {
return withFeedbackType(TypeInformation.of(feedbackTypeHint));
} | java | public <F> ConnectedIterativeStreams<T, F> withFeedbackType(TypeHint<F> feedbackTypeHint) {
return withFeedbackType(TypeInformation.of(feedbackTypeHint));
} | [
"public",
"<",
"F",
">",
"ConnectedIterativeStreams",
"<",
"T",
",",
"F",
">",
"withFeedbackType",
"(",
"TypeHint",
"<",
"F",
">",
"feedbackTypeHint",
")",
"{",
"return",
"withFeedbackType",
"(",
"TypeInformation",
".",
"of",
"(",
"feedbackTypeHint",
")",
")",... | Changes the feedback type of the iteration and allows the user to apply
co-transformations on the input and feedback stream, as in a
{@link ConnectedStreams}.
<p>For type safety the user needs to define the feedback type
@param feedbackTypeHint
Class of the elements in the feedback stream.
@return A {@link ConnectedIterativeStreams}. | [
"Changes",
"the",
"feedback",
"type",
"of",
"the",
"iteration",
"and",
"allows",
"the",
"user",
"to",
"apply",
"co",
"-",
"transformations",
"on",
"the",
"input",
"and",
"feedback",
"stream",
"as",
"in",
"a",
"{",
"@link",
"ConnectedStreams",
"}",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/IterativeStream.java#L108-L110 | train | Sets the feedback type of the connected iterators. | [
30522,
2270,
1026,
1042,
1028,
4198,
21646,
8082,
21422,
2015,
1026,
1056,
1010,
1042,
1028,
2007,
7959,
2098,
5963,
13874,
1006,
2828,
10606,
2102,
1026,
1042,
1028,
12247,
13874,
10606,
2102,
1007,
1063,
2709,
2007,
7959,
2098,
5963,
1387... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/misc/HighwayHash.java | HighwayHash.update | public void update(long a0, long a1, long a2, long a3) {
if (done) {
throw new IllegalStateException("Can compute a hash only once per instance");
}
v1[0] += mul0[0] + a0;
v1[1] += mul0[1] + a1;
v1[2] += mul0[2] + a2;
v1[3] += mul0[3] + a3;
for (int i = 0; i < 4; ++i) {
mul0[i] ^= (v1[i] & 0xffffffffL) * (v0[i] >>> 32);
v0[i] += mul1[i];
mul1[i] ^= (v0[i] & 0xffffffffL) * (v1[i] >>> 32);
}
v0[0] += zipperMerge0(v1[1], v1[0]);
v0[1] += zipperMerge1(v1[1], v1[0]);
v0[2] += zipperMerge0(v1[3], v1[2]);
v0[3] += zipperMerge1(v1[3], v1[2]);
v1[0] += zipperMerge0(v0[1], v0[0]);
v1[1] += zipperMerge1(v0[1], v0[0]);
v1[2] += zipperMerge0(v0[3], v0[2]);
v1[3] += zipperMerge1(v0[3], v0[2]);
} | java | public void update(long a0, long a1, long a2, long a3) {
if (done) {
throw new IllegalStateException("Can compute a hash only once per instance");
}
v1[0] += mul0[0] + a0;
v1[1] += mul0[1] + a1;
v1[2] += mul0[2] + a2;
v1[3] += mul0[3] + a3;
for (int i = 0; i < 4; ++i) {
mul0[i] ^= (v1[i] & 0xffffffffL) * (v0[i] >>> 32);
v0[i] += mul1[i];
mul1[i] ^= (v0[i] & 0xffffffffL) * (v1[i] >>> 32);
}
v0[0] += zipperMerge0(v1[1], v1[0]);
v0[1] += zipperMerge1(v1[1], v1[0]);
v0[2] += zipperMerge0(v1[3], v1[2]);
v0[3] += zipperMerge1(v1[3], v1[2]);
v1[0] += zipperMerge0(v0[1], v0[0]);
v1[1] += zipperMerge1(v0[1], v0[0]);
v1[2] += zipperMerge0(v0[3], v0[2]);
v1[3] += zipperMerge1(v0[3], v0[2]);
} | [
"public",
"void",
"update",
"(",
"long",
"a0",
",",
"long",
"a1",
",",
"long",
"a2",
",",
"long",
"a3",
")",
"{",
"if",
"(",
"done",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can compute a hash only once per instance\"",
")",
";",
"}",
"v1... | Updates the hash with 32 bytes of data given as 4 longs. This function is
more efficient than updatePacket when you can use it.
@param a0 first 8 bytes in little endian 64-bit long
@param a1 next 8 bytes in little endian 64-bit long
@param a2 next 8 bytes in little endian 64-bit long
@param a3 last 8 bytes in little endian 64-bit long | [
"Updates",
"the",
"hash",
"with",
"32",
"bytes",
"of",
"data",
"given",
"as",
"4",
"longs",
".",
"This",
"function",
"is",
"more",
"efficient",
"than",
"updatePacket",
"when",
"you",
"can",
"use",
"it",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L78-L99 | train | Update the hash table with the given values. | [
30522,
2270,
11675,
10651,
1006,
2146,
1037,
2692,
1010,
2146,
17350,
1010,
2146,
22441,
1010,
2146,
1037,
2509,
1007,
1063,
2065,
1006,
2589,
30524,
2064,
24134,
1037,
23325,
2069,
2320,
2566,
6013,
1000,
1007,
1025,
1065,
1058,
2487,
1031... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java | MutableHashTable.open | public void open(final MutableObjectIterator<BT> buildSide, final MutableObjectIterator<PT> probeSide,
boolean buildOuterJoin) throws IOException {
this.buildSideOuterJoin = buildOuterJoin;
// sanity checks
if (!this.closed.compareAndSet(true, false)) {
throw new IllegalStateException("Hash Join cannot be opened, because it is currently not closed.");
}
// grab the write behind buffers first
for (int i = this.numWriteBehindBuffers; i > 0; --i) {
this.writeBehindBuffers.add(this.availableMemory.remove(this.availableMemory.size() - 1));
}
// open builds the initial table by consuming the build-side input
this.currentRecursionDepth = 0;
buildInitialTable(buildSide);
// the first prober is the probe-side input
this.probeIterator = new ProbeIterator<PT>(probeSide, this.probeSideSerializer.createInstance());
// the bucket iterator can remain constant over the time
this.bucketIterator = new HashBucketIterator<BT, PT>(this.buildSideSerializer, this.recordComparator, probedSet, buildOuterJoin);
} | java | public void open(final MutableObjectIterator<BT> buildSide, final MutableObjectIterator<PT> probeSide,
boolean buildOuterJoin) throws IOException {
this.buildSideOuterJoin = buildOuterJoin;
// sanity checks
if (!this.closed.compareAndSet(true, false)) {
throw new IllegalStateException("Hash Join cannot be opened, because it is currently not closed.");
}
// grab the write behind buffers first
for (int i = this.numWriteBehindBuffers; i > 0; --i) {
this.writeBehindBuffers.add(this.availableMemory.remove(this.availableMemory.size() - 1));
}
// open builds the initial table by consuming the build-side input
this.currentRecursionDepth = 0;
buildInitialTable(buildSide);
// the first prober is the probe-side input
this.probeIterator = new ProbeIterator<PT>(probeSide, this.probeSideSerializer.createInstance());
// the bucket iterator can remain constant over the time
this.bucketIterator = new HashBucketIterator<BT, PT>(this.buildSideSerializer, this.recordComparator, probedSet, buildOuterJoin);
} | [
"public",
"void",
"open",
"(",
"final",
"MutableObjectIterator",
"<",
"BT",
">",
"buildSide",
",",
"final",
"MutableObjectIterator",
"<",
"PT",
">",
"probeSide",
",",
"boolean",
"buildOuterJoin",
")",
"throws",
"IOException",
"{",
"this",
".",
"buildSideOuterJoin"... | Opens the hash join. This method reads the build-side input and constructs the initial
hash table, gradually spilling partitions that do not fit into memory.
@param buildSide Build side input.
@param probeSide Probe side input.
@param buildOuterJoin Whether outer join on build side.
@throws IOException Thrown, if an I/O problem occurs while spilling a partition. | [
"Opens",
"the",
"hash",
"join",
".",
"This",
"method",
"reads",
"the",
"build",
"-",
"side",
"input",
"and",
"constructs",
"the",
"initial",
"hash",
"table",
"gradually",
"spilling",
"partitions",
"that",
"do",
"not",
"fit",
"into",
"memory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/MutableHashTable.java#L471-L494 | train | Opens the hash join. | [
30522,
2270,
11675,
2330,
1006,
2345,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
18411,
1028,
16473,
5178,
1010,
2345,
14163,
10880,
16429,
20614,
21646,
8844,
1026,
13866,
1028,
15113,
7363,
1010,
22017,
20898,
3857,
5833,
2121,
5558,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java | SparseVector.multiply_constant | void multiply_constant(double x)
{
for (Map.Entry<Integer, Double> entry : entrySet())
{
entry.setValue(entry.getValue() * x);
}
} | java | void multiply_constant(double x)
{
for (Map.Entry<Integer, Double> entry : entrySet())
{
entry.setValue(entry.getValue() * x);
}
} | [
"void",
"multiply_constant",
"(",
"double",
"x",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Double",
">",
"entry",
":",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"setValue",
"(",
"entry",
".",
"getValue",
"(",
")",
"*",
"x... | Multiply each value of avector by a constant value. | [
"Multiply",
"each",
"value",
"of",
"avector",
"by",
"a",
"constant",
"value",
"."
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/SparseVector.java#L66-L72 | train | Multiplies the value of all the attributes of the CIS object by a constant value. | [
30522,
11675,
4800,
22086,
1035,
5377,
1006,
3313,
1060,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
16109,
1010,
3313,
1028,
4443,
1024,
4443,
13462,
1006,
1007,
1007,
1063,
4443,
1012,
2275,
10175,
5657,
1006,
4443,
1012,
2131,
10175,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.unset | public synchronized void unset(String name) {
String[] names = null;
if (!isDeprecated(name)) {
names = getAlternativeNames(name);
if(names == null) {
names = new String[]{name};
}
}
else {
names = handleDeprecation(deprecationContext.get(), name);
}
for(String n: names) {
getOverlay().remove(n);
getProps().remove(n);
}
} | java | public synchronized void unset(String name) {
String[] names = null;
if (!isDeprecated(name)) {
names = getAlternativeNames(name);
if(names == null) {
names = new String[]{name};
}
}
else {
names = handleDeprecation(deprecationContext.get(), name);
}
for(String n: names) {
getOverlay().remove(n);
getProps().remove(n);
}
} | [
"public",
"synchronized",
"void",
"unset",
"(",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"names",
"=",
"null",
";",
"if",
"(",
"!",
"isDeprecated",
"(",
"name",
")",
")",
"{",
"names",
"=",
"getAlternativeNames",
"(",
"name",
")",
";",
"if",
"... | Unset a previously set property. | [
"Unset",
"a",
"previously",
"set",
"property",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1283-L1299 | train | Unsets the property with the given name. | [
30522,
2270,
25549,
11675,
4895,
13462,
1006,
5164,
2171,
1007,
1063,
5164,
1031,
1033,
3415,
1027,
19701,
1025,
2065,
1006,
999,
2003,
3207,
28139,
12921,
1006,
2171,
1007,
1007,
1063,
3415,
1027,
2131,
2389,
16451,
8082,
18442,
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... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/serialization/SimpleStringSchema.java | SimpleStringSchema.writeObject | private void writeObject (ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeUTF(charset.name());
} | java | private void writeObject (ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeUTF(charset.name());
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"out",
".",
"writeUTF",
"(",
"charset",
".",
"name",
"(",
")",
")",
";",
"}"
] | ------------------------------------------------------------------------ | [
"------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/serialization/SimpleStringSchema.java#L97-L100 | train | Write the object. | [
30522,
2797,
11675,
4339,
16429,
20614,
1006,
4874,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
2041,
1012,
12398,
26373,
16429,
20614,
1006,
1007,
1025,
2041,
1012,
4339,
4904,
2546,
1006,
25869,
13462,
1012,
2171,
1006... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getPackagePath | public static String getPackagePath(Class<?> clazz) {
return getPackage(clazz).replace(StrUtil.C_DOT, StrUtil.C_SLASH);
} | java | public static String getPackagePath(Class<?> clazz) {
return getPackage(clazz).replace(StrUtil.C_DOT, StrUtil.C_SLASH);
} | [
"public",
"static",
"String",
"getPackagePath",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"getPackage",
"(",
"clazz",
")",
".",
"replace",
"(",
"StrUtil",
".",
"C_DOT",
",",
"StrUtil",
".",
"C_SLASH",
")",
";",
"}"
] | 获得给定类所在包的路径<br>
例如:<br>
com.xiaoleilu.hutool.util.ClassUtil =》 com/xiaoleilu/hutool/util
@param clazz 类
@return 包名 | [
"获得给定类所在包的路径<br",
">",
"例如:<br",
">",
"com",
".",
"xiaoleilu",
".",
"hutool",
".",
"util",
".",
"ClassUtil",
"=",
"》",
"com",
"/",
"xiaoleilu",
"/",
"hutool",
"/",
"util"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L966-L968 | train | Gets the package path for the given class. | [
30522,
2270,
10763,
5164,
2131,
23947,
4270,
15069,
1006,
2465,
1026,
1029,
1028,
18856,
10936,
2480,
1007,
1063,
2709,
2131,
23947,
4270,
1006,
18856,
10936,
2480,
1007,
1012,
5672,
1006,
2358,
22134,
4014,
1012,
1039,
1035,
11089,
1010,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
alibaba/canal | client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java | AbstractResource.lastModified | @Override
public long lastModified() throws IOException {
long lastModified = getFileForLastModifiedCheck().lastModified();
if (lastModified == 0L) {
throw new FileNotFoundException(
getDescription() + " cannot be resolved in the file system for resolving its last-modified timestamp");
}
return lastModified;
} | java | @Override
public long lastModified() throws IOException {
long lastModified = getFileForLastModifiedCheck().lastModified();
if (lastModified == 0L) {
throw new FileNotFoundException(
getDescription() + " cannot be resolved in the file system for resolving its last-modified timestamp");
}
return lastModified;
} | [
"@",
"Override",
"public",
"long",
"lastModified",
"(",
")",
"throws",
"IOException",
"{",
"long",
"lastModified",
"=",
"getFileForLastModifiedCheck",
"(",
")",
".",
"lastModified",
"(",
")",
";",
"if",
"(",
"lastModified",
"==",
"0L",
")",
"{",
"throw",
"ne... | This implementation checks the timestamp of the underlying File, if
available.
@see #getFileForLastModifiedCheck() | [
"This",
"implementation",
"checks",
"the",
"timestamp",
"of",
"the",
"underlying",
"File",
"if",
"available",
"."
] | 8f088cddc0755f4350c5aaae95c6e4002d90a40f | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/AbstractResource.java#L130-L138 | train | Returns the last - modified timestamp of the file. | [
30522,
1030,
2058,
15637,
2270,
2146,
2197,
5302,
4305,
10451,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2146,
2197,
5302,
4305,
10451,
1027,
2131,
8873,
2571,
29278,
8523,
21246,
7716,
7810,
5403,
3600,
1006,
1007,
1012,
2197,
5302,
43... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/item/SimpleItem.java | SimpleItem.combine | public void combine(SimpleItem other)
{
for (Map.Entry<String, Integer> entry : other.labelMap.entrySet())
{
addLabel(entry.getKey(), entry.getValue());
}
} | java | public void combine(SimpleItem other)
{
for (Map.Entry<String, Integer> entry : other.labelMap.entrySet())
{
addLabel(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"combine",
"(",
"SimpleItem",
"other",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
"entry",
":",
"other",
".",
"labelMap",
".",
"entrySet",
"(",
")",
")",
"{",
"addLabel",
"(",
"entry",
".",
"getKe... | 合并两个条目,两者的标签map会合并
@param other | [
"合并两个条目,两者的标签map会合并"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/item/SimpleItem.java#L133-L139 | train | Combine two URIs. | [
30522,
2270,
11675,
11506,
1006,
3722,
4221,
2213,
2060,
1007,
1063,
2005,
1006,
4949,
1012,
4443,
1026,
5164,
1010,
16109,
1028,
4443,
1024,
2060,
1012,
3830,
2863,
2361,
1012,
4443,
13462,
1006,
1007,
1007,
1063,
5587,
20470,
2884,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.wrap | public static Float[] wrap(float... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Float[0];
}
final Float[] array = new Float[length];
for (int i = 0; i < length; i++) {
array[i] = Float.valueOf(values[i]);
}
return array;
} | java | public static Float[] wrap(float... values) {
if (null == values) {
return null;
}
final int length = values.length;
if (0 == length) {
return new Float[0];
}
final Float[] array = new Float[length];
for (int i = 0; i < length; i++) {
array[i] = Float.valueOf(values[i]);
}
return array;
} | [
"public",
"static",
"Float",
"[",
"]",
"wrap",
"(",
"float",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
")",
"{",
"return",
"null",
";",
"}",
"final",
"int",
"length",
"=",
"values",
".",
"length",
";",
"if",
"(",
"0",
"==",
"l... | 将原始类型数组包装为包装类型
@param values 原始类型数组
@return 包装类型数组 | [
"将原始类型数组包装为包装类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1619-L1633 | train | Wraps the specified float array in a single array. | [
30522,
2270,
10763,
14257,
1031,
1033,
10236,
1006,
14257,
1012,
1012,
1012,
5300,
1007,
1063,
2065,
1006,
19701,
1027,
1027,
5300,
1007,
1063,
2709,
19701,
1025,
1065,
2345,
20014,
3091,
1027,
5300,
1012,
3091,
1025,
2065,
1006,
1014,
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-java/src/main/java/org/apache/flink/api/java/functions/SelectByMinFunction.java | SelectByMinFunction.reduce | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public T reduce(T value1, T value2) throws Exception {
for (int position : fields) {
// Save position of compared key
// Get both values - both implement comparable
Comparable comparable1 = value1.getFieldNotNull(position);
Comparable comparable2 = value2.getFieldNotNull(position);
// Compare values
int comp = comparable1.compareTo(comparable2);
// If comp is smaller than 0 comparable 1 is smaller.
// Return the smaller value.
if (comp < 0) {
return value1;
} else if (comp > 0) {
return value2;
}
}
return value1;
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public T reduce(T value1, T value2) throws Exception {
for (int position : fields) {
// Save position of compared key
// Get both values - both implement comparable
Comparable comparable1 = value1.getFieldNotNull(position);
Comparable comparable2 = value2.getFieldNotNull(position);
// Compare values
int comp = comparable1.compareTo(comparable2);
// If comp is smaller than 0 comparable 1 is smaller.
// Return the smaller value.
if (comp < 0) {
return value1;
} else if (comp > 0) {
return value2;
}
}
return value1;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"public",
"T",
"reduce",
"(",
"T",
"value1",
",",
"T",
"value2",
")",
"throws",
"Exception",
"{",
"for",
"(",
"int",
"position",
":",
"fields",
")",
"{",
... | Reduce implementation, returns smaller tuple or value1 if both tuples are
equal. Comparison highly depends on the order and amount of fields chosen
as indices. All given fields (at construction time) are checked in the same
order as defined (at construction time). If both tuples are equal in one
index, the next index is compared. Or if no next index is available value1
is returned.
The tuple which has a smaller value at one index will be returned. | [
"Reduce",
"implementation",
"returns",
"smaller",
"tuple",
"or",
"value1",
"if",
"both",
"tuples",
"are",
"equal",
".",
"Comparison",
"highly",
"depends",
"on",
"the",
"order",
"and",
"amount",
"of",
"fields",
"chosen",
"as",
"indices",
".",
"All",
"given",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/functions/SelectByMinFunction.java#L73-L94 | train | Reduce two objects. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1063,
1000,
4895,
5403,
18141,
1000,
1010,
1000,
6315,
13874,
2015,
1000,
1065,
1007,
1030,
2058,
15637,
2270,
1056,
5547,
1006,
1056,
3643,
2487,
1010,
1056,
3643,
2475,
1007,
11618,
6453,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpResponse.java | HttpResponse.init | private HttpResponse init() throws HttpException {
try {
this.status = httpConnection.responseCode();
this.in = (this.status < HttpStatus.HTTP_BAD_REQUEST) ? httpConnection.getInputStream() : httpConnection.getErrorStream();
} catch (IOException e) {
if (e instanceof FileNotFoundException) {
// 服务器无返回内容,忽略之
} else {
throw new HttpException(e);
}
}
try {
this.headers = httpConnection.headers();
} catch (IllegalArgumentException e) {
StaticLog.warn(e, e.getMessage());
}
final Charset charset = httpConnection.getCharset();
this.charsetFromResponse = charset;
if (null != charset) {
this.charset = charset;
}
if (null == this.in) {
// 在一些情况下,返回的流为null,此时提供状态码说明
this.in = new ByteArrayInputStream(StrUtil.format("Error request, response status: {}", this.status).getBytes());
} else if (isGzip() && false == (in instanceof GZIPInputStream)) {
try {
in = new GZIPInputStream(in);
} catch (IOException e) {
// 在类似于Head等方法中无body返回,此时GZIPInputStream构造会出现错误,在此忽略此错误读取普通数据
// ignore
}
} else if (isDeflate() && false == (in instanceof DeflaterInputStream)) {
//Accept-Encoding: defalte
in = new DeflaterInputStream(in);
}
// 同步情况下强制同步
return this.isAsync ? this : forceSync();
} | java | private HttpResponse init() throws HttpException {
try {
this.status = httpConnection.responseCode();
this.in = (this.status < HttpStatus.HTTP_BAD_REQUEST) ? httpConnection.getInputStream() : httpConnection.getErrorStream();
} catch (IOException e) {
if (e instanceof FileNotFoundException) {
// 服务器无返回内容,忽略之
} else {
throw new HttpException(e);
}
}
try {
this.headers = httpConnection.headers();
} catch (IllegalArgumentException e) {
StaticLog.warn(e, e.getMessage());
}
final Charset charset = httpConnection.getCharset();
this.charsetFromResponse = charset;
if (null != charset) {
this.charset = charset;
}
if (null == this.in) {
// 在一些情况下,返回的流为null,此时提供状态码说明
this.in = new ByteArrayInputStream(StrUtil.format("Error request, response status: {}", this.status).getBytes());
} else if (isGzip() && false == (in instanceof GZIPInputStream)) {
try {
in = new GZIPInputStream(in);
} catch (IOException e) {
// 在类似于Head等方法中无body返回,此时GZIPInputStream构造会出现错误,在此忽略此错误读取普通数据
// ignore
}
} else if (isDeflate() && false == (in instanceof DeflaterInputStream)) {
//Accept-Encoding: defalte
in = new DeflaterInputStream(in);
}
// 同步情况下强制同步
return this.isAsync ? this : forceSync();
} | [
"private",
"HttpResponse",
"init",
"(",
")",
"throws",
"HttpException",
"{",
"try",
"{",
"this",
".",
"status",
"=",
"httpConnection",
".",
"responseCode",
"(",
")",
";",
"this",
".",
"in",
"=",
"(",
"this",
".",
"status",
"<",
"HttpStatus",
".",
"HTTP_B... | 初始化Http响应<br>
初始化包括:
<pre>
1、读取Http状态
2、读取头信息
3、持有Http流,并不关闭流
</pre>
@return this
@throws HttpException IO异常 | [
"初始化Http响应<br",
">",
"初始化包括:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpResponse.java#L344-L384 | train | Initializes the response object. | [
30522,
2797,
8299,
6072,
26029,
3366,
1999,
4183,
1006,
1007,
11618,
8299,
10288,
24422,
1063,
3046,
1063,
2023,
1012,
3570,
1027,
8299,
8663,
2638,
7542,
1012,
3433,
16044,
1006,
1007,
1025,
2023,
1012,
1999,
1027,
1006,
2023,
1012,
3570,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/operators/ReduceOperator.java | ReduceOperator.translateSelectorFunctionReducer | private static <T, K> org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateSelectorFunctionReducer(
SelectorFunctionKeys<T, ?> rawKeys,
ReduceFunction<T> function,
TypeInformation<T> inputType,
String name,
Operator<T> input,
int parallelism,
CombineHint hint) {
@SuppressWarnings("unchecked")
final SelectorFunctionKeys<T, K> keys = (SelectorFunctionKeys<T, K>) rawKeys;
TypeInformation<Tuple2<K, T>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, T>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingReduceOperator<T, K> reducer = new PlanUnwrappingReduceOperator<>(function, keys, name, inputType, typeInfoWithKey);
reducer.setInput(keyedInput);
reducer.setParallelism(parallelism);
reducer.setCombineHint(hint);
return KeyFunctions.appendKeyRemover(reducer, keys);
} | java | private static <T, K> org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateSelectorFunctionReducer(
SelectorFunctionKeys<T, ?> rawKeys,
ReduceFunction<T> function,
TypeInformation<T> inputType,
String name,
Operator<T> input,
int parallelism,
CombineHint hint) {
@SuppressWarnings("unchecked")
final SelectorFunctionKeys<T, K> keys = (SelectorFunctionKeys<T, K>) rawKeys;
TypeInformation<Tuple2<K, T>> typeInfoWithKey = KeyFunctions.createTypeWithKey(keys);
Operator<Tuple2<K, T>> keyedInput = KeyFunctions.appendKeyExtractor(input, keys);
PlanUnwrappingReduceOperator<T, K> reducer = new PlanUnwrappingReduceOperator<>(function, keys, name, inputType, typeInfoWithKey);
reducer.setInput(keyedInput);
reducer.setParallelism(parallelism);
reducer.setCombineHint(hint);
return KeyFunctions.appendKeyRemover(reducer, keys);
} | [
"private",
"static",
"<",
"T",
",",
"K",
">",
"org",
".",
"apache",
".",
"flink",
".",
"api",
".",
"common",
".",
"operators",
".",
"SingleInputOperator",
"<",
"?",
",",
"T",
",",
"?",
">",
"translateSelectorFunctionReducer",
"(",
"SelectorFunctionKeys",
"... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/ReduceOperator.java#L177-L197 | train | Translate a selector function reducer into a single input operator. | [
30522,
2797,
10763,
1026,
1056,
1010,
1047,
1028,
8917,
1012,
15895,
1012,
13109,
19839,
1012,
17928,
1012,
2691,
1012,
9224,
1012,
2309,
2378,
18780,
25918,
8844,
1026,
1029,
1010,
1056,
1010,
1029,
1028,
16315,
12260,
16761,
11263,
27989,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java | BatchTask.initOutputs | protected void initOutputs() throws Exception {
this.chainedTasks = new ArrayList<ChainedDriver<?, ?>>();
this.eventualOutputs = new ArrayList<RecordWriter<?>>();
ClassLoader userCodeClassLoader = getUserCodeClassLoader();
this.accumulatorMap = getEnvironment().getAccumulatorRegistry().getUserMap();
this.output = initOutputs(this, userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs,
this.getExecutionConfig(), this.accumulatorMap);
} | java | protected void initOutputs() throws Exception {
this.chainedTasks = new ArrayList<ChainedDriver<?, ?>>();
this.eventualOutputs = new ArrayList<RecordWriter<?>>();
ClassLoader userCodeClassLoader = getUserCodeClassLoader();
this.accumulatorMap = getEnvironment().getAccumulatorRegistry().getUserMap();
this.output = initOutputs(this, userCodeClassLoader, this.config, this.chainedTasks, this.eventualOutputs,
this.getExecutionConfig(), this.accumulatorMap);
} | [
"protected",
"void",
"initOutputs",
"(",
")",
"throws",
"Exception",
"{",
"this",
".",
"chainedTasks",
"=",
"new",
"ArrayList",
"<",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
">",
"(",
")",
";",
"this",
".",
"eventualOutputs",
"=",
"new",
"ArrayList",
"<... | Creates a writer for each output. Creates an OutputCollector which forwards its input to all writers.
The output collector applies the configured shipping strategies for each writer. | [
"Creates",
"a",
"writer",
"for",
"each",
"output",
".",
"Creates",
"an",
"OutputCollector",
"which",
"forwards",
"its",
"input",
"to",
"all",
"writers",
".",
"The",
"output",
"collector",
"applies",
"the",
"configured",
"shipping",
"strategies",
"for",
"each",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1021-L1031 | train | Initialize the output list. | [
30522,
5123,
11675,
1999,
9956,
4904,
18780,
2015,
1006,
1007,
11618,
6453,
1063,
2023,
1012,
22075,
10230,
5705,
1027,
2047,
9140,
9863,
1026,
22075,
23663,
2099,
1026,
1029,
1010,
1029,
1028,
1028,
1006,
1007,
1025,
2023,
1012,
9523,
5833... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/seg/Segment.java | Segment.simpleAtomSegment | protected static List<AtomNode> simpleAtomSegment(char[] charArray, int start, int end)
{
List<AtomNode> atomNodeList = new LinkedList<AtomNode>();
atomNodeList.add(new AtomNode(new String(charArray, start, end - start), CharType.CT_LETTER));
return atomNodeList;
} | java | protected static List<AtomNode> simpleAtomSegment(char[] charArray, int start, int end)
{
List<AtomNode> atomNodeList = new LinkedList<AtomNode>();
atomNodeList.add(new AtomNode(new String(charArray, start, end - start), CharType.CT_LETTER));
return atomNodeList;
} | [
"protected",
"static",
"List",
"<",
"AtomNode",
">",
"simpleAtomSegment",
"(",
"char",
"[",
"]",
"charArray",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"List",
"<",
"AtomNode",
">",
"atomNodeList",
"=",
"new",
"LinkedList",
"<",
"AtomNode",
">",
... | 简易原子分词,将所有字放到一起作为一个词
@param charArray
@param start
@param end
@return | [
"简易原子分词,将所有字放到一起作为一个词"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L143-L148 | train | Simple atom segment. | [
30522,
5123,
10763,
2862,
1026,
13787,
3630,
3207,
1028,
3722,
10610,
5244,
13910,
3672,
1006,
25869,
1031,
1033,
25869,
2906,
9447,
1010,
20014,
2707,
1010,
20014,
2203,
1007,
1063,
2862,
1026,
13787,
3630,
3207,
1028,
13787,
3630,
9247,
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-cep/src/main/java/org/apache/flink/cep/PatternStream.java | PatternStream.select | public <L, R> SingleOutputStreamOperator<R> select(
final OutputTag<L> timedOutPartialMatchesTag,
final PatternTimeoutFunction<T, L> patternTimeoutFunction,
final PatternSelectFunction<T, R> patternSelectFunction) {
final TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
patternSelectFunction,
PatternSelectFunction.class,
0,
1,
TypeExtractor.NO_INDEX,
builder.getInputType(),
null,
false);
return select(
timedOutPartialMatchesTag,
patternTimeoutFunction,
rightTypeInfo,
patternSelectFunction);
} | java | public <L, R> SingleOutputStreamOperator<R> select(
final OutputTag<L> timedOutPartialMatchesTag,
final PatternTimeoutFunction<T, L> patternTimeoutFunction,
final PatternSelectFunction<T, R> patternSelectFunction) {
final TypeInformation<R> rightTypeInfo = TypeExtractor.getUnaryOperatorReturnType(
patternSelectFunction,
PatternSelectFunction.class,
0,
1,
TypeExtractor.NO_INDEX,
builder.getInputType(),
null,
false);
return select(
timedOutPartialMatchesTag,
patternTimeoutFunction,
rightTypeInfo,
patternSelectFunction);
} | [
"public",
"<",
"L",
",",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"select",
"(",
"final",
"OutputTag",
"<",
"L",
">",
"timedOutPartialMatchesTag",
",",
"final",
"PatternTimeoutFunction",
"<",
"T",
",",
"L",
">",
"patternTimeoutFunction",
",",
"fi... | Applies a select function to the detected pattern sequence. For each pattern sequence the
provided {@link PatternSelectFunction} is called. The pattern select function can produce
exactly one resulting element.
<p>Applies a timeout function to a partial pattern sequence which has timed out. For each
partial pattern sequence the provided {@link PatternTimeoutFunction} is called. The pattern
timeout function can produce exactly one resulting element.
<p>You can get the stream of timed-out data resulting from the
{@link SingleOutputStreamOperator#getSideOutput(OutputTag)} on the
{@link SingleOutputStreamOperator} resulting from the select operation
with the same {@link OutputTag}.
@param timedOutPartialMatchesTag {@link OutputTag} that identifies side output with timed out patterns
@param patternTimeoutFunction The pattern timeout function which is called for each partial
pattern sequence which has timed out.
@param patternSelectFunction The pattern select function which is called for each detected
pattern sequence.
@param <L> Type of the resulting timeout elements
@param <R> Type of the resulting elements
@return {@link DataStream} which contains the resulting elements with the resulting timeout
elements in a side output. | [
"Applies",
"a",
"select",
"function",
"to",
"the",
"detected",
"pattern",
"sequence",
".",
"For",
"each",
"pattern",
"sequence",
"the",
"provided",
"{",
"@link",
"PatternSelectFunction",
"}",
"is",
"called",
".",
"The",
"pattern",
"select",
"function",
"can",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L192-L212 | train | Selects a single output stream from a single input tag. | [
30522,
2270,
1026,
1048,
1010,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
7276,
1006,
2345,
6434,
15900,
1026,
1048,
1028,
22313,
5833,
19362,
20925,
18900,
8376,
15900,
1010,
2345,
5418,
7292,
5833,
11263,
27989,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java | SuffixDictionary.entrySet | public Set<Map.Entry<String, Integer>> entrySet()
{
Set<Map.Entry<String, Integer>> treeSet = new LinkedHashSet<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
treeSet.add(new AbstractMap.SimpleEntry<String, Integer>(reverse(entry.getKey()), entry.getValue()));
}
return treeSet;
} | java | public Set<Map.Entry<String, Integer>> entrySet()
{
Set<Map.Entry<String, Integer>> treeSet = new LinkedHashSet<Map.Entry<String, Integer>>();
for (Map.Entry<String, Integer> entry : trie.entrySet())
{
treeSet.add(new AbstractMap.SimpleEntry<String, Integer>(reverse(entry.getKey()), entry.getValue()));
}
return treeSet;
} | [
"public",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"entrySet",
"(",
")",
"{",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Integer",
">",
">",
"treeSet",
"=",
"new",
"LinkedHashSet",
"<",
"Map",
".",
"Entry... | 键值对
@return | [
"键值对"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/SuffixDictionary.java#L104-L113 | train | Get a Set of Entry objects from the map. | [
30522,
2270,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
16109,
1028,
1028,
4443,
13462,
1006,
1007,
1063,
2275,
1026,
4949,
1012,
4443,
1026,
5164,
1010,
16109,
1028,
1028,
3628,
3388,
1027,
2047,
5799,
14949,
7898,
3388,
1026,
4949,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
netty/netty | transport/src/main/java/io/netty/channel/PendingWriteQueue.java | PendingWriteQueue.removeAndWriteAll | public ChannelFuture removeAndWriteAll() {
assert ctx.executor().inEventLoop();
if (isEmpty()) {
return null;
}
ChannelPromise p = ctx.newPromise();
PromiseCombiner combiner = new PromiseCombiner(ctx.executor());
try {
// It is possible for some of the written promises to trigger more writes. The new writes
// will "revive" the queue, so we need to write them up until the queue is empty.
for (PendingWrite write = head; write != null; write = head) {
head = tail = null;
size = 0;
bytes = 0;
while (write != null) {
PendingWrite next = write.next;
Object msg = write.msg;
ChannelPromise promise = write.promise;
recycle(write, false);
if (!(promise instanceof VoidChannelPromise)) {
combiner.add(promise);
}
ctx.write(msg, promise);
write = next;
}
}
combiner.finish(p);
} catch (Throwable cause) {
p.setFailure(cause);
}
assertEmpty();
return p;
} | java | public ChannelFuture removeAndWriteAll() {
assert ctx.executor().inEventLoop();
if (isEmpty()) {
return null;
}
ChannelPromise p = ctx.newPromise();
PromiseCombiner combiner = new PromiseCombiner(ctx.executor());
try {
// It is possible for some of the written promises to trigger more writes. The new writes
// will "revive" the queue, so we need to write them up until the queue is empty.
for (PendingWrite write = head; write != null; write = head) {
head = tail = null;
size = 0;
bytes = 0;
while (write != null) {
PendingWrite next = write.next;
Object msg = write.msg;
ChannelPromise promise = write.promise;
recycle(write, false);
if (!(promise instanceof VoidChannelPromise)) {
combiner.add(promise);
}
ctx.write(msg, promise);
write = next;
}
}
combiner.finish(p);
} catch (Throwable cause) {
p.setFailure(cause);
}
assertEmpty();
return p;
} | [
"public",
"ChannelFuture",
"removeAndWriteAll",
"(",
")",
"{",
"assert",
"ctx",
".",
"executor",
"(",
")",
".",
"inEventLoop",
"(",
")",
";",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"ChannelPromise",
"p",
"=",
"ctx",
".",
... | Remove all pending write operation and performs them via
{@link ChannelHandlerContext#write(Object, ChannelPromise)}.
@return {@link ChannelFuture} if something was written and {@code null}
if the {@link PendingWriteQueue} is empty. | [
"Remove",
"all",
"pending",
"write",
"operation",
"and",
"performs",
"them",
"via",
"{",
"@link",
"ChannelHandlerContext#write",
"(",
"Object",
"ChannelPromise",
")",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/PendingWriteQueue.java#L125-L160 | train | Removes all pending writes from the queue and writes them to the channel. | [
30522,
2270,
3149,
11263,
11244,
6366,
5685,
26373,
8095,
1006,
1007,
1063,
20865,
14931,
2595,
1012,
4654,
8586,
16161,
2099,
1006,
1007,
1012,
1999,
18697,
3372,
4135,
7361,
1006,
1007,
1025,
2065,
1006,
2003,
6633,
13876,
2100,
1006,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.cleanEmpty | public static boolean cleanEmpty(File directory) throws IORuntimeException {
if (directory == null || directory.exists() == false || false == directory.isDirectory()) {
return true;
}
final File[] files = directory.listFiles();
if(ArrayUtil.isEmpty(files)) {
//空文件夹则删除之
directory.delete();
}
for (File childFile : files) {
clean(childFile);
}
return true;
} | java | public static boolean cleanEmpty(File directory) throws IORuntimeException {
if (directory == null || directory.exists() == false || false == directory.isDirectory()) {
return true;
}
final File[] files = directory.listFiles();
if(ArrayUtil.isEmpty(files)) {
//空文件夹则删除之
directory.delete();
}
for (File childFile : files) {
clean(childFile);
}
return true;
} | [
"public",
"static",
"boolean",
"cleanEmpty",
"(",
"File",
"directory",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"directory",
"==",
"null",
"||",
"directory",
".",
"exists",
"(",
")",
"==",
"false",
"||",
"false",
"==",
"directory",
".",
"isDirect... | 清理空文件夹<br>
此方法用于递归删除空的文件夹,不删除文件<br>
如果传入的文件夹本身就是空的,删除这个文件夹
@param directory 文件夹
@return 成功与否
@throws IORuntimeException IO异常
@since 4.5.5 | [
"清理空文件夹<br",
">",
"此方法用于递归删除空的文件夹,不删除文件<br",
">",
"如果传入的文件夹本身就是空的,删除这个文件夹"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L813-L827 | train | Clean empty directory. | [
30522,
2270,
10763,
22017,
20898,
4550,
6633,
13876,
2100,
1006,
5371,
14176,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
14176,
1027,
1027,
19701,
1064,
1064,
14176,
1012,
6526,
1006,
1007,
1027,
1027,
6270,
1064,
1064,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java | Binder.bind | public <T> BindResult<T> bind(ConfigurationPropertyName name, Bindable<T> target,
BindHandler handler) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(target, "Target must not be null");
handler = (handler != null) ? handler : BindHandler.DEFAULT;
Context context = new Context();
T bound = bind(name, target, handler, context, false);
return BindResult.of(bound);
} | java | public <T> BindResult<T> bind(ConfigurationPropertyName name, Bindable<T> target,
BindHandler handler) {
Assert.notNull(name, "Name must not be null");
Assert.notNull(target, "Target must not be null");
handler = (handler != null) ? handler : BindHandler.DEFAULT;
Context context = new Context();
T bound = bind(name, target, handler, context, false);
return BindResult.of(bound);
} | [
"public",
"<",
"T",
">",
"BindResult",
"<",
"T",
">",
"bind",
"(",
"ConfigurationPropertyName",
"name",
",",
"Bindable",
"<",
"T",
">",
"target",
",",
"BindHandler",
"handler",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"Name must not be null\""... | Bind the specified target {@link Bindable} using this binder's
{@link ConfigurationPropertySource property sources}.
@param name the configuration property name to bind
@param target the target bindable
@param handler the bind handler (may be {@code null})
@param <T> the bound type
@return the binding result (never {@code null}) | [
"Bind",
"the",
"specified",
"target",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java#L203-L211 | train | Binds the given target to the given configuration property name using the given handler. | [
30522,
2270,
1026,
1056,
1028,
14187,
6072,
11314,
1026,
1056,
1028,
14187,
1006,
9563,
21572,
4842,
25680,
14074,
2171,
1010,
14187,
3085,
1026,
1056,
1028,
4539,
1010,
14187,
11774,
3917,
28213,
1007,
1063,
20865,
1012,
2025,
11231,
3363,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/seg/NShort/Path/NShortPath.java | NShortPath.initNShortPath | private void initNShortPath(Graph inGraph, int nValueKind)
{
graph = inGraph;
N = nValueKind;
// 获取顶点的数目
vertexCount = inGraph.vertexes.length;
fromArray = new CQueue[vertexCount - 1][]; // 不包含起点
weightArray = new double[vertexCount - 1][];
//每个节点的最小堆
for (int i = 0; i < vertexCount - 1; i++)
{
fromArray[i] = new CQueue[nValueKind];
weightArray[i] = new double[nValueKind];
for (int j = 0; j < nValueKind; j++)
fromArray[i][j] = new CQueue();
}
} | java | private void initNShortPath(Graph inGraph, int nValueKind)
{
graph = inGraph;
N = nValueKind;
// 获取顶点的数目
vertexCount = inGraph.vertexes.length;
fromArray = new CQueue[vertexCount - 1][]; // 不包含起点
weightArray = new double[vertexCount - 1][];
//每个节点的最小堆
for (int i = 0; i < vertexCount - 1; i++)
{
fromArray[i] = new CQueue[nValueKind];
weightArray[i] = new double[nValueKind];
for (int j = 0; j < nValueKind; j++)
fromArray[i][j] = new CQueue();
}
} | [
"private",
"void",
"initNShortPath",
"(",
"Graph",
"inGraph",
",",
"int",
"nValueKind",
")",
"{",
"graph",
"=",
"inGraph",
";",
"N",
"=",
"nValueKind",
";",
"// 获取顶点的数目",
"vertexCount",
"=",
"inGraph",
".",
"vertexes",
".",
"length",
";",
"fromArray",
"=",
... | 初始化,主要分配内存
@param inGraph 输入图
@param nValueKind 希望的N值 | [
"初始化,主要分配内存"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java#L63-L83 | train | init N short path | [
30522,
2797,
11675,
1999,
4183,
3619,
27794,
15069,
1006,
10629,
13749,
24342,
1010,
20014,
1050,
10175,
5657,
18824,
1007,
1063,
10629,
30524,
1031,
19449,
3597,
16671,
1011,
1015,
1033,
1031,
1033,
1025,
1013,
1013,
1744,
100,
100,
100,
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-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java | WorkbookUtil.createBook | public static Workbook createBook(InputStream in, String password, boolean closeAfterRead) {
try {
return WorkbookFactory.create(IoUtil.toMarkSupportStream(in), password);
} catch (Exception e) {
throw new POIException(e);
} finally {
if (closeAfterRead) {
IoUtil.close(in);
}
}
} | java | public static Workbook createBook(InputStream in, String password, boolean closeAfterRead) {
try {
return WorkbookFactory.create(IoUtil.toMarkSupportStream(in), password);
} catch (Exception e) {
throw new POIException(e);
} finally {
if (closeAfterRead) {
IoUtil.close(in);
}
}
} | [
"public",
"static",
"Workbook",
"createBook",
"(",
"InputStream",
"in",
",",
"String",
"password",
",",
"boolean",
"closeAfterRead",
")",
"{",
"try",
"{",
"return",
"WorkbookFactory",
".",
"create",
"(",
"IoUtil",
".",
"toMarkSupportStream",
"(",
"in",
")",
",... | 创建或加载工作簿
@param in Excel输入流
@param password 密码
@param closeAfterRead 读取结束是否关闭流
@return {@link Workbook}
@since 4.0.3 | [
"创建或加载工作簿"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L86-L96 | train | Creates a new book from an input stream. | [
30522,
2270,
10763,
2147,
8654,
3443,
8654,
1006,
20407,
25379,
1999,
1010,
5164,
20786,
1010,
22017,
20898,
2485,
10354,
3334,
16416,
2094,
1007,
1063,
3046,
1063,
2709,
2147,
8654,
21450,
1012,
3443,
1006,
22834,
21823,
2140,
1012,
3419,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/taskexecutor/slot/TaskSlotTable.java | TaskSlotTable.markSlotInactive | public boolean markSlotInactive(AllocationID allocationId, Time slotTimeout) throws SlotNotFoundException {
checkInit();
TaskSlot taskSlot = getTaskSlot(allocationId);
if (taskSlot != null) {
if (taskSlot.markInactive()) {
// register a timeout to free the slot
timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit());
return true;
} else {
return false;
}
} else {
throw new SlotNotFoundException(allocationId);
}
} | java | public boolean markSlotInactive(AllocationID allocationId, Time slotTimeout) throws SlotNotFoundException {
checkInit();
TaskSlot taskSlot = getTaskSlot(allocationId);
if (taskSlot != null) {
if (taskSlot.markInactive()) {
// register a timeout to free the slot
timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit());
return true;
} else {
return false;
}
} else {
throw new SlotNotFoundException(allocationId);
}
} | [
"public",
"boolean",
"markSlotInactive",
"(",
"AllocationID",
"allocationId",
",",
"Time",
"slotTimeout",
")",
"throws",
"SlotNotFoundException",
"{",
"checkInit",
"(",
")",
";",
"TaskSlot",
"taskSlot",
"=",
"getTaskSlot",
"(",
"allocationId",
")",
";",
"if",
"(",... | Marks the slot under the given allocation id as inactive. If the slot could not be found,
then a {@link SlotNotFoundException} is thrown.
@param allocationId to identify the task slot to mark as inactive
@param slotTimeout until the slot times out
@throws SlotNotFoundException if the slot could not be found for the given allocation id
@return True if the slot could be marked inactive | [
"Marks",
"the",
"slot",
"under",
"the",
"given",
"allocation",
"id",
"as",
"inactive",
".",
"If",
"the",
"slot",
"could",
"not",
"be",
"found",
"then",
"a",
"{",
"@link",
"SlotNotFoundException",
"}",
"is",
"thrown",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L259-L276 | train | Mark the slot inactive. | [
30522,
2270,
22017,
20898,
6017,
10994,
3981,
15277,
1006,
16169,
3593,
16169,
3593,
1010,
2051,
10453,
7292,
5833,
1007,
11618,
10453,
17048,
14876,
8630,
10288,
24422,
1063,
4638,
5498,
2102,
1006,
1007,
1025,
8518,
10994,
8518,
10994,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notEmpty | public static Object[] notEmpty(Object[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | java | public static Object[] notEmpty(Object[] array, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return array;
} | [
"public",
"static",
"Object",
"[",
"]",
"notEmpty",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"array",
")"... | 断言给定数组是否包含元素,数组必须不为 {@code null} 且至少包含一个元素
<pre class="code">
Assert.notEmpty(array, "The array must have elements");
</pre>
@param array 被检查的数组
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@return 被检查的数组
@throws IllegalArgumentException if the object array is {@code null} or has no elements | [
"断言给定数组是否包含元素,数组必须不为",
"{",
"@code",
"null",
"}",
"且至少包含一个元素"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L278-L283 | train | Returns an empty array if the array is empty. | [
30522,
2270,
10763,
4874,
1031,
1033,
3602,
27718,
2100,
1006,
4874,
1031,
1033,
9140,
1010,
5164,
7561,
5244,
13512,
6633,
15725,
1010,
4874,
1012,
1012,
1012,
11498,
5244,
1007,
11618,
6206,
2906,
22850,
15781,
2595,
24422,
1063,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.filter | public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
return MapUtil.filter(map, editor);
} | java | public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
return MapUtil.filter(map, editor);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"filter",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Editor",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"editor",
")",
"{",
"return",
"MapUtil",
".",
"fil... | 过滤<br>
过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:
<pre>
1、过滤出需要的对象,如果返回null表示这个元素对象抛弃
2、修改元素对象,返回集合中为修改后的对象
</pre>
@param <K> Key类型
@param <V> Value类型
@param map Map
@param editor 编辑器接口
@return 过滤后的Map
@see MapUtil#filter(Map, Editor) | [
"过滤<br",
">",
"过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1268-L1270 | train | Filter the given map by applying the given editor to each entry in the map. | [
30522,
2270,
10763,
1026,
1047,
1010,
1058,
1028,
4949,
1026,
1047,
1010,
1058,
1028,
11307,
1006,
4949,
1026,
1047,
1010,
1058,
1028,
4949,
1010,
3559,
1026,
4443,
1026,
1047,
1010,
1058,
1028,
1028,
3559,
1007,
1063,
2709,
4949,
21823,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java | JobMaster.acknowledgeCheckpoint | @Override
public void acknowledgeCheckpoint(
final JobID jobID,
final ExecutionAttemptID executionAttemptID,
final long checkpointId,
final CheckpointMetrics checkpointMetrics,
final TaskStateSnapshot checkpointState) {
final CheckpointCoordinator checkpointCoordinator = executionGraph.getCheckpointCoordinator();
final AcknowledgeCheckpoint ackMessage = new AcknowledgeCheckpoint(
jobID,
executionAttemptID,
checkpointId,
checkpointMetrics,
checkpointState);
if (checkpointCoordinator != null) {
getRpcService().execute(() -> {
try {
checkpointCoordinator.receiveAcknowledgeMessage(ackMessage);
} catch (Throwable t) {
log.warn("Error while processing checkpoint acknowledgement message", t);
}
});
} else {
String errorMessage = "Received AcknowledgeCheckpoint message for job {} with no CheckpointCoordinator";
if (executionGraph.getState() == JobStatus.RUNNING) {
log.error(errorMessage, jobGraph.getJobID());
} else {
log.debug(errorMessage, jobGraph.getJobID());
}
}
} | java | @Override
public void acknowledgeCheckpoint(
final JobID jobID,
final ExecutionAttemptID executionAttemptID,
final long checkpointId,
final CheckpointMetrics checkpointMetrics,
final TaskStateSnapshot checkpointState) {
final CheckpointCoordinator checkpointCoordinator = executionGraph.getCheckpointCoordinator();
final AcknowledgeCheckpoint ackMessage = new AcknowledgeCheckpoint(
jobID,
executionAttemptID,
checkpointId,
checkpointMetrics,
checkpointState);
if (checkpointCoordinator != null) {
getRpcService().execute(() -> {
try {
checkpointCoordinator.receiveAcknowledgeMessage(ackMessage);
} catch (Throwable t) {
log.warn("Error while processing checkpoint acknowledgement message", t);
}
});
} else {
String errorMessage = "Received AcknowledgeCheckpoint message for job {} with no CheckpointCoordinator";
if (executionGraph.getState() == JobStatus.RUNNING) {
log.error(errorMessage, jobGraph.getJobID());
} else {
log.debug(errorMessage, jobGraph.getJobID());
}
}
} | [
"@",
"Override",
"public",
"void",
"acknowledgeCheckpoint",
"(",
"final",
"JobID",
"jobID",
",",
"final",
"ExecutionAttemptID",
"executionAttemptID",
",",
"final",
"long",
"checkpointId",
",",
"final",
"CheckpointMetrics",
"checkpointMetrics",
",",
"final",
"TaskStateSn... | TODO: This method needs a leader session ID | [
"TODO",
":",
"This",
"method",
"needs",
"a",
"leader",
"session",
"ID"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java#L496-L528 | train | Acknowledges a checkpoint. | [
30522,
1030,
2058,
15637,
2270,
11675,
13399,
5403,
3600,
8400,
1006,
2345,
3105,
3593,
3105,
3593,
1010,
2345,
7781,
19321,
6633,
13876,
3593,
7781,
19321,
6633,
13876,
3593,
1010,
2345,
2146,
26520,
3593,
1010,
2345,
26520,
12589,
2015,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java | NeuralNetworkParser.get_valency_features | void get_valency_features(final Context ctx,
final List<Integer> nr_left_children,
final List<Integer> nr_right_children,
List<Integer> features)
{
if (!use_valency)
{
return;
}
int lvc = 8;
int rvc = 8;
if (ctx.S0 >= 0)
{
lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S0)];
rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S0)];
if (lvc == 10)
{
lvc = 7;
}
if (rvc == 10)
{
rvc = 7;
}
}
features.add(lvc + kValencyInFeaturespace);
features.add(rvc + kValencyInFeaturespace);
lvc = 8;
rvc = 8;
if (ctx.S1 >= 0)
{
lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S1)];
rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S1)];
if (lvc == 10)
{
lvc = 7;
}
if (rvc == 10)
{
rvc = 7;
}
}
features.add(lvc + kValencyInFeaturespace);
features.add(rvc + kValencyInFeaturespace);
} | java | void get_valency_features(final Context ctx,
final List<Integer> nr_left_children,
final List<Integer> nr_right_children,
List<Integer> features)
{
if (!use_valency)
{
return;
}
int lvc = 8;
int rvc = 8;
if (ctx.S0 >= 0)
{
lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S0)];
rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S0)];
if (lvc == 10)
{
lvc = 7;
}
if (rvc == 10)
{
rvc = 7;
}
}
features.add(lvc + kValencyInFeaturespace);
features.add(rvc + kValencyInFeaturespace);
lvc = 8;
rvc = 8;
if (ctx.S1 >= 0)
{
lvc = math.binned_1_2_3_4_5_6_10[nr_left_children.get(ctx.S1)];
rvc = math.binned_1_2_3_4_5_6_10[nr_right_children.get(ctx.S1)];
if (lvc == 10)
{
lvc = 7;
}
if (rvc == 10)
{
rvc = 7;
}
}
features.add(lvc + kValencyInFeaturespace);
features.add(rvc + kValencyInFeaturespace);
} | [
"void",
"get_valency_features",
"(",
"final",
"Context",
"ctx",
",",
"final",
"List",
"<",
"Integer",
">",
"nr_left_children",
",",
"final",
"List",
"<",
"Integer",
">",
"nr_right_children",
",",
"List",
"<",
"Integer",
">",
"features",
")",
"{",
"if",
"(",
... | 获取(S0和S1的)配价特征
@param ctx 上下文
@param nr_left_children 左孩子数量列表
@param nr_right_children 右孩子数量列表
@param features 输出特征 | [
"获取",
"(",
"S0和S1的",
")",
"配价特征"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/NeuralNetworkParser.java#L761-L806 | train | Get the valency features. | [
30522,
11675,
2131,
1035,
10380,
9407,
1035,
2838,
1006,
2345,
6123,
14931,
2595,
1010,
2345,
2862,
1026,
16109,
1028,
17212,
1035,
2187,
1035,
2336,
1010,
2345,
2862,
1026,
16109,
1028,
17212,
1035,
2157,
1035,
2336,
1010,
2862,
1026,
1610... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/SpdySessionHandler.java | SpdySessionHandler.updateInitialReceiveWindowSize | private void updateInitialReceiveWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialReceiveWindowSize;
initialReceiveWindowSize = newInitialWindowSize;
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
} | java | private void updateInitialReceiveWindowSize(int newInitialWindowSize) {
int deltaWindowSize = newInitialWindowSize - initialReceiveWindowSize;
initialReceiveWindowSize = newInitialWindowSize;
spdySession.updateAllReceiveWindowSizes(deltaWindowSize);
} | [
"private",
"void",
"updateInitialReceiveWindowSize",
"(",
"int",
"newInitialWindowSize",
")",
"{",
"int",
"deltaWindowSize",
"=",
"newInitialWindowSize",
"-",
"initialReceiveWindowSize",
";",
"initialReceiveWindowSize",
"=",
"newInitialWindowSize",
";",
"spdySession",
".",
... | need to synchronize to prevent new streams from being created while updating active streams | [
"need",
"to",
"synchronize",
"to",
"prevent",
"new",
"streams",
"from",
"being",
"created",
"while",
"updating",
"active",
"streams"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java#L706-L710 | train | Update the initial receive window size. | [
30522,
2797,
11675,
10651,
5498,
20925,
2890,
3401,
3512,
11101,
15568,
4697,
1006,
20014,
2047,
5498,
20925,
11101,
15568,
4697,
1007,
1063,
20014,
7160,
11101,
15568,
4697,
1027,
2047,
5498,
20925,
11101,
15568,
4697,
1011,
3988,
2890,
3401... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/CipherSuiteConverter.java | CipherSuiteConverter.toOpenSsl | static String toOpenSsl(String javaCipherSuite, boolean boringSSL) {
String converted = j2o.get(javaCipherSuite);
if (converted != null) {
return converted;
}
return cacheFromJava(javaCipherSuite, boringSSL);
} | java | static String toOpenSsl(String javaCipherSuite, boolean boringSSL) {
String converted = j2o.get(javaCipherSuite);
if (converted != null) {
return converted;
}
return cacheFromJava(javaCipherSuite, boringSSL);
} | [
"static",
"String",
"toOpenSsl",
"(",
"String",
"javaCipherSuite",
",",
"boolean",
"boringSSL",
")",
"{",
"String",
"converted",
"=",
"j2o",
".",
"get",
"(",
"javaCipherSuite",
")",
";",
"if",
"(",
"converted",
"!=",
"null",
")",
"{",
"return",
"converted",
... | Converts the specified Java cipher suite to its corresponding OpenSSL cipher suite name.
@return {@code null} if the conversion has failed | [
"Converts",
"the",
"specified",
"Java",
"cipher",
"suite",
"to",
"its",
"corresponding",
"OpenSSL",
"cipher",
"suite",
"name",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L153-L159 | train | Converts a javaCipherSuite to an open SSL string. | [
30522,
10763,
5164,
2205,
11837,
4757,
2140,
1006,
5164,
9262,
6895,
27921,
28880,
2063,
1010,
22017,
20898,
11771,
4757,
2140,
1007,
1063,
5164,
4991,
1027,
1046,
2475,
2080,
1012,
2131,
1006,
9262,
6895,
27921,
28880,
2063,
1007,
1025,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.nearest | public List<Map.Entry<K, Float>> nearest(K key)
{
return nearest(key, 10);
} | java | public List<Map.Entry<K, Float>> nearest(K key)
{
return nearest(key, 10);
} | [
"public",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"Float",
">",
">",
"nearest",
"(",
"K",
"key",
")",
"{",
"return",
"nearest",
"(",
"key",
",",
"10",
")",
";",
"}"
] | 查询与词语最相似的词语
@param key 词语
@return 键值对列表, 键是相似词语, 值是相似度, 按相似度降序排列 | [
"查询与词语最相似的词语"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L160-L163 | train | Returns the nearest record set entry for the given key. | [
30522,
2270,
2862,
1026,
4949,
1012,
4443,
1026,
1047,
1010,
14257,
1028,
1028,
7205,
1006,
1047,
3145,
1007,
1063,
2709,
7205,
1006,
3145,
1010,
2184,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java | SmtpRequests.vrfy | public static SmtpRequest vrfy(CharSequence user) {
return new DefaultSmtpRequest(SmtpCommand.VRFY, ObjectUtil.checkNotNull(user, "user"));
} | java | public static SmtpRequest vrfy(CharSequence user) {
return new DefaultSmtpRequest(SmtpCommand.VRFY, ObjectUtil.checkNotNull(user, "user"));
} | [
"public",
"static",
"SmtpRequest",
"vrfy",
"(",
"CharSequence",
"user",
")",
"{",
"return",
"new",
"DefaultSmtpRequest",
"(",
"SmtpCommand",
".",
"VRFY",
",",
"ObjectUtil",
".",
"checkNotNull",
"(",
"user",
",",
"\"user\"",
")",
")",
";",
"}"
] | Creates a {@code VRFY} request. | [
"Creates",
"a",
"{"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpRequests.java#L131-L133 | train | Create a new VRFY request. | [
30522,
2270,
10763,
30524,
1012,
27830,
12031,
1010,
4874,
21823,
2140,
1012,
4638,
17048,
11231,
3363,
1006,
5310,
1010,
1000,
5310,
1000,
1007,
1007,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.reduce | @PublicEvolving
public <R> SingleOutputStreamOperator<R> reduce(
ReduceFunction<T> reduceFunction,
AllWindowFunction<T, R, W> function) {
TypeInformation<T> inType = input.getType();
TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, inType);
return reduce(reduceFunction, function, resultType);
} | java | @PublicEvolving
public <R> SingleOutputStreamOperator<R> reduce(
ReduceFunction<T> reduceFunction,
AllWindowFunction<T, R, W> function) {
TypeInformation<T> inType = input.getType();
TypeInformation<R> resultType = getAllWindowFunctionReturnType(function, inType);
return reduce(reduceFunction, function, resultType);
} | [
"@",
"PublicEvolving",
"public",
"<",
"R",
">",
"SingleOutputStreamOperator",
"<",
"R",
">",
"reduce",
"(",
"ReduceFunction",
"<",
"T",
">",
"reduceFunction",
",",
"AllWindowFunction",
"<",
"T",
",",
"R",
",",
"W",
">",
"function",
")",
"{",
"TypeInformation... | 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>Arriving data is incrementally aggregated using the given reducer.
@param reduceFunction The reduce function that is used for incremental aggregation.
@param function The window function.
@return The data stream that is the result of applying the window function to the window. | [
"Applies",
"the",
"given",
"window",
"function",
"to",
"each",
"window",
".",
"The",
"window",
"function",
"is",
"called",
"for",
"each",
"evaluation",
"of",
"the",
"window",
"for",
"each",
"key",
"individually",
".",
"The",
"output",
"of",
"the",
"window",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L232-L241 | train | Returns a new stream that combines the results of applying the given reduce function and all window functions. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
1026,
1054,
1028,
2309,
5833,
18780,
21422,
25918,
8844,
1026,
1054,
1028,
5547,
1006,
5547,
11263,
27989,
1026,
1056,
1028,
5547,
11263,
27989,
1010,
2035,
11101,
5004,
11263,
27989,
1026,
1056,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java | DoubleArrayTrie.save | public boolean save(DataOutputStream out)
{
try
{
out.writeInt(size);
for (int i = 0; i < size; i++)
{
out.writeInt(base[i]);
out.writeInt(check[i]);
}
}
catch (Exception e)
{
return false;
}
return true;
} | java | public boolean save(DataOutputStream out)
{
try
{
out.writeInt(size);
for (int i = 0; i < size; i++)
{
out.writeInt(base[i]);
out.writeInt(check[i]);
}
}
catch (Exception e)
{
return false;
}
return true;
} | [
"public",
"boolean",
"save",
"(",
"DataOutputStream",
"out",
")",
"{",
"try",
"{",
"out",
".",
"writeInt",
"(",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"out",
".",
"writeInt",
"(",
"b... | 将base和check保存下来
@param out
@return | [
"将base和check保存下来"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/DoubleArrayTrie.java#L478-L495 | train | Save the result of this object to the specified output stream. | [
30522,
2270,
22017,
20898,
3828,
1006,
2951,
5833,
18780,
21422,
2041,
1007,
1063,
3046,
1063,
2041,
1012,
4339,
18447,
1006,
2946,
1007,
1025,
2005,
1006,
20014,
1045,
1027,
1014,
1025,
1045,
1026,
2946,
1025,
1045,
1009,
1009,
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/dictionary/py/String2PinyinConverter.java | String2PinyinConverter.convert2Array | public static Pinyin[] convert2Array(String complexText, boolean removeTone)
{
return PinyinUtil.convertList2Array(convert(complexText, removeTone));
} | java | public static Pinyin[] convert2Array(String complexText, boolean removeTone)
{
return PinyinUtil.convertList2Array(convert(complexText, removeTone));
} | [
"public",
"static",
"Pinyin",
"[",
"]",
"convert2Array",
"(",
"String",
"complexText",
",",
"boolean",
"removeTone",
")",
"{",
"return",
"PinyinUtil",
".",
"convertList2Array",
"(",
"convert",
"(",
"complexText",
",",
"removeTone",
")",
")",
";",
"}"
] | 将拼音文本转化为完整的拼音,支持汉英混合的杂乱文本,注意如果混用拼音和输入法头的话,并不会有多高的准确率,声调也不会准的
@param complexText
@return | [
"将拼音文本转化为完整的拼音,支持汉英混合的杂乱文本,注意如果混用拼音和输入法头的话,并不会有多高的准确率,声调也不会准的"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/String2PinyinConverter.java#L59-L62 | train | Convert a string to an array of Pinyin objects. | [
30522,
2270,
10763,
9973,
1031,
1033,
10463,
2475,
2906,
9447,
1006,
5164,
3375,
18209,
1010,
22017,
20898,
6366,
5524,
1007,
1063,
2709,
9973,
21823,
2140,
1012,
10463,
9863,
2475,
2906,
9447,
1006,
10463,
1006,
3375,
18209,
1010,
6366,
55... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java | ExecutionGraph.computeAllPriorAllocationIds | private Set<AllocationID> computeAllPriorAllocationIds() {
HashSet<AllocationID> allPreviousAllocationIds = new HashSet<>(getNumberOfExecutionJobVertices());
for (ExecutionVertex executionVertex : getAllExecutionVertices()) {
AllocationID latestPriorAllocation = executionVertex.getLatestPriorAllocation();
if (latestPriorAllocation != null) {
allPreviousAllocationIds.add(latestPriorAllocation);
}
}
return allPreviousAllocationIds;
} | java | private Set<AllocationID> computeAllPriorAllocationIds() {
HashSet<AllocationID> allPreviousAllocationIds = new HashSet<>(getNumberOfExecutionJobVertices());
for (ExecutionVertex executionVertex : getAllExecutionVertices()) {
AllocationID latestPriorAllocation = executionVertex.getLatestPriorAllocation();
if (latestPriorAllocation != null) {
allPreviousAllocationIds.add(latestPriorAllocation);
}
}
return allPreviousAllocationIds;
} | [
"private",
"Set",
"<",
"AllocationID",
">",
"computeAllPriorAllocationIds",
"(",
")",
"{",
"HashSet",
"<",
"AllocationID",
">",
"allPreviousAllocationIds",
"=",
"new",
"HashSet",
"<>",
"(",
"getNumberOfExecutionJobVertices",
"(",
")",
")",
";",
"for",
"(",
"Execut... | Computes and returns a set with the prior allocation ids from all execution vertices in the graph. | [
"Computes",
"and",
"returns",
"a",
"set",
"with",
"the",
"prior",
"allocation",
"ids",
"from",
"all",
"execution",
"vertices",
"in",
"the",
"graph",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1686-L1695 | train | Compute all the allocation IDs that are prior to the execution vertices. | [
30522,
2797,
2275,
1026,
16169,
3593,
1028,
24134,
8095,
18098,
25346,
8095,
23909,
9821,
1006,
1007,
1063,
23325,
13462,
1026,
16169,
3593,
1028,
2035,
28139,
24918,
8095,
23909,
9821,
1027,
2047,
23325,
13462,
1026,
1028,
1006,
2131,
19172,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/DualInputPlanNode.java | DualInputPlanNode.accept | @Override
public void accept(Visitor<PlanNode> visitor) {
if (visitor.preVisit(this)) {
this.input1.getSource().accept(visitor);
this.input2.getSource().accept(visitor);
for (Channel broadcastInput : getBroadcastInputs()) {
broadcastInput.getSource().accept(visitor);
}
visitor.postVisit(this);
}
} | java | @Override
public void accept(Visitor<PlanNode> visitor) {
if (visitor.preVisit(this)) {
this.input1.getSource().accept(visitor);
this.input2.getSource().accept(visitor);
for (Channel broadcastInput : getBroadcastInputs()) {
broadcastInput.getSource().accept(visitor);
}
visitor.postVisit(this);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"Visitor",
"<",
"PlanNode",
">",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"preVisit",
"(",
"this",
")",
")",
"{",
"this",
".",
"input1",
".",
"getSource",
"(",
")",
".",
"accept",
"(",
"visitor... | -------------------------------------------------------------------------------------------- | [
"--------------------------------------------------------------------------------------------"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/DualInputPlanNode.java#L160-L172 | train | Visit this node. | [
30522,
1030,
2058,
15637,
2270,
11675,
5138,
1006,
10367,
1026,
2933,
3630,
3207,
1028,
10367,
1007,
1063,
2065,
1006,
10367,
1012,
3653,
11365,
4183,
1006,
2023,
1007,
1007,
1063,
2023,
1012,
7953,
2487,
1012,
4152,
8162,
3401,
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... |
looly/hutool | hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java | NioServer.doListen | private void doListen() throws IOException {
while (0 != this.selector.select()) {
// 返回已选择键的集合
final Iterator<SelectionKey> keyIter = selector.selectedKeys().iterator();
while (keyIter.hasNext()) {
handle(keyIter.next());
keyIter.remove();
}
}
} | java | private void doListen() throws IOException {
while (0 != this.selector.select()) {
// 返回已选择键的集合
final Iterator<SelectionKey> keyIter = selector.selectedKeys().iterator();
while (keyIter.hasNext()) {
handle(keyIter.next());
keyIter.remove();
}
}
} | [
"private",
"void",
"doListen",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"0",
"!=",
"this",
".",
"selector",
".",
"select",
"(",
")",
")",
"{",
"// 返回已选择键的集合\r",
"final",
"Iterator",
"<",
"SelectionKey",
">",
"keyIter",
"=",
"selector",
".",
... | 开始监听
@throws IOException IO异常 | [
"开始监听"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-socket/src/main/java/cn/hutool/socket/nio/NioServer.java#L81-L90 | train | Listen for events. | [
30522,
2797,
11675,
2079,
9863,
2368,
1006,
1007,
11618,
22834,
10288,
24422,
1063,
2096,
1006,
1014,
999,
1027,
2023,
1012,
27000,
1012,
7276,
1006,
1007,
1007,
1063,
1013,
1013,
100,
100,
100,
100,
100,
100,
1916,
100,
1792,
2345,
2009,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.trigger | @PublicEvolving
public AllWindowedStream<T, W> trigger(Trigger<? super T, ? super W> trigger) {
if (windowAssigner instanceof MergingWindowAssigner && !trigger.canMerge()) {
throw new UnsupportedOperationException("A merging window assigner cannot be used with a trigger that does not support merging.");
}
this.trigger = trigger;
return this;
} | java | @PublicEvolving
public AllWindowedStream<T, W> trigger(Trigger<? super T, ? super W> trigger) {
if (windowAssigner instanceof MergingWindowAssigner && !trigger.canMerge()) {
throw new UnsupportedOperationException("A merging window assigner cannot be used with a trigger that does not support merging.");
}
this.trigger = trigger;
return this;
} | [
"@",
"PublicEvolving",
"public",
"AllWindowedStream",
"<",
"T",
",",
"W",
">",
"trigger",
"(",
"Trigger",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"W",
">",
"trigger",
")",
"{",
"if",
"(",
"windowAssigner",
"instanceof",
"MergingWindowAssigner",
"&&",
"!... | Sets the {@code Trigger} that should be used to trigger window emission. | [
"Sets",
"the",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/AllWindowedStream.java#L126-L134 | train | Sets the trigger for this stream. | [
30522,
1030,
2270,
6777,
4747,
6455,
2270,
2035,
11101,
15096,
21422,
1026,
1056,
1010,
1059,
1028,
9495,
1006,
9495,
1026,
1029,
3565,
1056,
1010,
1029,
3565,
1059,
1028,
9495,
1007,
1063,
2065,
1006,
3332,
12054,
23773,
2121,
6013,
11253,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/TableSchema.java | TableSchema.getFieldName | public Optional<String> getFieldName(int fieldIndex) {
if (fieldIndex < 0 || fieldIndex >= fieldNames.length) {
return Optional.empty();
}
return Optional.of(fieldNames[fieldIndex]);
} | java | public Optional<String> getFieldName(int fieldIndex) {
if (fieldIndex < 0 || fieldIndex >= fieldNames.length) {
return Optional.empty();
}
return Optional.of(fieldNames[fieldIndex]);
} | [
"public",
"Optional",
"<",
"String",
">",
"getFieldName",
"(",
"int",
"fieldIndex",
")",
"{",
"if",
"(",
"fieldIndex",
"<",
"0",
"||",
"fieldIndex",
">=",
"fieldNames",
".",
"length",
")",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"r... | Returns the specified name for the given field index.
@param fieldIndex the index of the field | [
"Returns",
"the",
"specified",
"name",
"for",
"the",
"given",
"field",
"index",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java#L147-L152 | train | Gets the name of the field at the given index. | [
30522,
2270,
11887,
1026,
5164,
1028,
2131,
3790,
18442,
1006,
20014,
2492,
22254,
10288,
1007,
1063,
2065,
1006,
2492,
22254,
10288,
1026,
1014,
1064,
1064,
2492,
22254,
10288,
1028,
1027,
2492,
18442,
2015,
1012,
3091,
1007,
1063,
2709,
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-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.colNameToIndex | public static int colNameToIndex(String colName) {
int length = colName.length();
char c;
int index = -1;
for (int i = 0; i < length; i++) {
c = Character.toUpperCase(colName.charAt(i));
if (Character.isDigit(c)) {
break;// 确定指定的char值是否为数字
}
index = (index + 1) * 26 + (int) c - 'A';
}
return index;
} | java | public static int colNameToIndex(String colName) {
int length = colName.length();
char c;
int index = -1;
for (int i = 0; i < length; i++) {
c = Character.toUpperCase(colName.charAt(i));
if (Character.isDigit(c)) {
break;// 确定指定的char值是否为数字
}
index = (index + 1) * 26 + (int) c - 'A';
}
return index;
} | [
"public",
"static",
"int",
"colNameToIndex",
"(",
"String",
"colName",
")",
"{",
"int",
"length",
"=",
"colName",
".",
"length",
"(",
")",
";",
"char",
"c",
";",
"int",
"index",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | 根据表元的列名转换为列号
@param colName 列名, 从A开始
@return A1->0; B1->1...AA1->26
@since 4.1.20 | [
"根据表元的列名转换为列号"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L560-L572 | train | Converts a column name to a column name index. | [
30522,
2270,
10763,
20014,
8902,
18442,
3406,
22254,
10288,
1006,
5164,
8902,
18442,
1007,
1063,
20014,
3091,
1027,
8902,
18442,
1012,
3091,
1006,
1007,
1025,
25869,
1039,
1025,
20014,
5950,
1027,
1011,
1015,
1025,
2005,
1006,
20014,
1045,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.touch | public static File touch(String fullFilePath) throws IORuntimeException {
if (fullFilePath == null) {
return null;
}
return touch(file(fullFilePath));
} | java | public static File touch(String fullFilePath) throws IORuntimeException {
if (fullFilePath == null) {
return null;
}
return touch(file(fullFilePath));
} | [
"public",
"static",
"File",
"touch",
"(",
"String",
"fullFilePath",
")",
"throws",
"IORuntimeException",
"{",
"if",
"(",
"fullFilePath",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"touch",
"(",
"file",
"(",
"fullFilePath",
")",
")",
";",... | 创建文件及其父目录,如果这个文件存在,直接返回这个文件<br>
此方法不对File对象类型做判断,如果File不存在,无法判断其类型
@param fullFilePath 文件的全路径,使用POSIX风格
@return 文件,若路径为null,返回null
@throws IORuntimeException IO异常 | [
"创建文件及其父目录,如果这个文件存在,直接返回这个文件<br",
">",
"此方法不对File对象类型做判断,如果File不存在,无法判断其类型"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L595-L600 | train | Creates a new file with the specified path and creates a new file with the specified name. | [
30522,
2270,
10763,
5371,
3543,
1006,
5164,
2440,
8873,
2571,
15069,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2065,
1006,
2440,
8873,
2571,
15069,
1027,
1027,
19701,
1007,
1063,
2709,
19701,
1025,
1065,
2709,
3543,
1006,
5371,
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 | common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java | SingleThreadEventExecutor.runAllTasksFrom | protected final boolean runAllTasksFrom(Queue<Runnable> taskQueue) {
Runnable task = pollTaskFrom(taskQueue);
if (task == null) {
return false;
}
for (;;) {
safeExecute(task);
task = pollTaskFrom(taskQueue);
if (task == null) {
return true;
}
}
} | java | protected final boolean runAllTasksFrom(Queue<Runnable> taskQueue) {
Runnable task = pollTaskFrom(taskQueue);
if (task == null) {
return false;
}
for (;;) {
safeExecute(task);
task = pollTaskFrom(taskQueue);
if (task == null) {
return true;
}
}
} | [
"protected",
"final",
"boolean",
"runAllTasksFrom",
"(",
"Queue",
"<",
"Runnable",
">",
"taskQueue",
")",
"{",
"Runnable",
"task",
"=",
"pollTaskFrom",
"(",
"taskQueue",
")",
";",
"if",
"(",
"task",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"f... | Runs all tasks from the passed {@code taskQueue}.
@param taskQueue To poll and execute all tasks.
@return {@code true} if at least one task was executed. | [
"Runs",
"all",
"tasks",
"from",
"the",
"passed",
"{",
"@code",
"taskQueue",
"}",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L375-L387 | train | Run all tasks from the given queue. | [
30522,
5123,
2345,
22017,
20898,
2448,
8095,
10230,
5705,
19699,
5358,
1006,
24240,
1026,
2448,
22966,
1028,
4708,
4226,
5657,
1007,
1063,
2448,
22966,
4708,
1027,
8554,
10230,
2243,
19699,
5358,
1006,
4708,
4226,
5657,
1007,
1025,
2065,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java | JSONStringer.close | JSONStringer close(Scope empty, Scope nonempty, String closeBracket)
throws JSONException {
Scope context = peek();
if (context != nonempty && context != empty) {
throw new JSONException("Nesting problem");
}
this.stack.remove(this.stack.size() - 1);
if (context == nonempty) {
newline();
}
this.out.append(closeBracket);
return this;
} | java | JSONStringer close(Scope empty, Scope nonempty, String closeBracket)
throws JSONException {
Scope context = peek();
if (context != nonempty && context != empty) {
throw new JSONException("Nesting problem");
}
this.stack.remove(this.stack.size() - 1);
if (context == nonempty) {
newline();
}
this.out.append(closeBracket);
return this;
} | [
"JSONStringer",
"close",
"(",
"Scope",
"empty",
",",
"Scope",
"nonempty",
",",
"String",
"closeBracket",
")",
"throws",
"JSONException",
"{",
"Scope",
"context",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"context",
"!=",
"nonempty",
"&&",
"context",
"!=",
"em... | Closes the current scope by appending any necessary whitespace and the given
bracket.
@param empty any necessary whitespace
@param nonempty the current scope
@param closeBracket the close bracket
@return the JSON stringer
@throws JSONException if processing of json failed | [
"Closes",
"the",
"current",
"scope",
"by",
"appending",
"any",
"necessary",
"whitespace",
"and",
"the",
"given",
"bracket",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONStringer.java#L194-L207 | train | Close a scope. | [
30522,
1046,
23345,
18886,
11392,
2485,
1006,
9531,
4064,
1010,
9531,
3904,
27718,
2100,
1010,
5164,
2485,
10024,
19869,
2102,
1007,
11618,
1046,
3385,
10288,
24422,
1063,
9531,
6123,
1027,
19043,
1006,
1007,
1025,
2065,
1006,
6123,
999,
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-core/src/main/java/org/apache/flink/api/common/distributions/CommonRangeBoundaries.java | CommonRangeBoundaries.binarySearch | private int binarySearch(T record) {
int low = 0;
int high = this.boundaries.length - 1;
typeComparator.extractKeys(record, keys, 0);
while (low <= high) {
final int mid = (low + high) >>> 1;
final int result = compareKeys(flatComparators, keys, this.boundaries[mid]);
if (result > 0) {
low = mid + 1;
} else if (result < 0) {
high = mid - 1;
} else {
return mid;
}
}
// key not found, but the low index is the target
// bucket, since the boundaries are the upper bound
return low;
} | java | private int binarySearch(T record) {
int low = 0;
int high = this.boundaries.length - 1;
typeComparator.extractKeys(record, keys, 0);
while (low <= high) {
final int mid = (low + high) >>> 1;
final int result = compareKeys(flatComparators, keys, this.boundaries[mid]);
if (result > 0) {
low = mid + 1;
} else if (result < 0) {
high = mid - 1;
} else {
return mid;
}
}
// key not found, but the low index is the target
// bucket, since the boundaries are the upper bound
return low;
} | [
"private",
"int",
"binarySearch",
"(",
"T",
"record",
")",
"{",
"int",
"low",
"=",
"0",
";",
"int",
"high",
"=",
"this",
".",
"boundaries",
".",
"length",
"-",
"1",
";",
"typeComparator",
".",
"extractKeys",
"(",
"record",
",",
"keys",
",",
"0",
")",... | Search the range index of input record. | [
"Search",
"the",
"range",
"index",
"of",
"input",
"record",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/distributions/CommonRangeBoundaries.java#L43-L63 | train | Searches for the key in the record in the flat comparators. | [
30522,
2797,
20014,
12441,
17310,
11140,
1006,
1056,
2501,
1007,
1063,
20014,
2659,
1027,
1014,
1025,
20014,
2152,
1027,
2023,
1012,
7372,
1012,
3091,
1011,
1015,
1025,
2828,
9006,
28689,
4263,
1012,
14817,
14839,
2015,
1006,
2501,
1010,
63... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.createImage | public static void createImage(String str, Font font, Color backgroundColor, Color fontColor, ImageOutputStream out) throws IORuntimeException {
// 获取font的样式应用在str上的整个矩形
Rectangle2D r = font.getStringBounds(str, new FontRenderContext(AffineTransform.getScaleInstance(1, 1), false, false));
int unitHeight = (int) Math.floor(r.getHeight());// 获取单个字符的高度
// 获取整个str用了font样式的宽度这里用四舍五入后+1保证宽度绝对能容纳这个字符串作为图片的宽度
int width = (int) Math.round(r.getWidth()) + 1;
int height = unitHeight + 3;// 把单个字符的高度+3保证高度绝对能容纳字符串作为图片的高度
// 创建图片
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
Graphics g = image.getGraphics();
g.setColor(backgroundColor);
g.fillRect(0, 0, width, height);// 先用背景色填充整张图片,也就是背景
g.setColor(fontColor);
g.setFont(font);// 设置画笔字体
g.drawString(str, 0, font.getSize());// 画出字符串
g.dispose();
writePng(image, out);
} | java | public static void createImage(String str, Font font, Color backgroundColor, Color fontColor, ImageOutputStream out) throws IORuntimeException {
// 获取font的样式应用在str上的整个矩形
Rectangle2D r = font.getStringBounds(str, new FontRenderContext(AffineTransform.getScaleInstance(1, 1), false, false));
int unitHeight = (int) Math.floor(r.getHeight());// 获取单个字符的高度
// 获取整个str用了font样式的宽度这里用四舍五入后+1保证宽度绝对能容纳这个字符串作为图片的宽度
int width = (int) Math.round(r.getWidth()) + 1;
int height = unitHeight + 3;// 把单个字符的高度+3保证高度绝对能容纳字符串作为图片的高度
// 创建图片
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
Graphics g = image.getGraphics();
g.setColor(backgroundColor);
g.fillRect(0, 0, width, height);// 先用背景色填充整张图片,也就是背景
g.setColor(fontColor);
g.setFont(font);// 设置画笔字体
g.drawString(str, 0, font.getSize());// 画出字符串
g.dispose();
writePng(image, out);
} | [
"public",
"static",
"void",
"createImage",
"(",
"String",
"str",
",",
"Font",
"font",
",",
"Color",
"backgroundColor",
",",
"Color",
"fontColor",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"// 获取font的样式应用在str上的整个矩形\r",
"Rectangle2D",
... | 根据文字创建PNG图片
@param str 文字
@param font 字体{@link Font}
@param backgroundColor 背景颜色
@param fontColor 字体颜色
@param out 图片输出地
@throws IORuntimeException IO异常 | [
"根据文字创建PNG图片"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1269-L1286 | train | Create an image from a string using a font. | [
30522,
2270,
10763,
11675,
3443,
9581,
3351,
1006,
5164,
2358,
2099,
1010,
15489,
15489,
1010,
3609,
4281,
18717,
1010,
3609,
15489,
18717,
1010,
3746,
5833,
18780,
21422,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
1013,
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-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getLong | public long getLong(String key, long defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToLong(o, defaultValue);
} | java | public long getLong(String key, long defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToLong(o, defaultValue);
} | [
"public",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getRawValue",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"convertToLong",
"(... | Returns the value associated with the given key as a long.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"long",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L278-L285 | train | Returns the long value for the given key. The defaultValue is returned if the key does not exist or if the value is not a long value. | [
30522,
2270,
2146,
2131,
10052,
1006,
5164,
3145,
1010,
2146,
12398,
10175,
5657,
1007,
1063,
4874,
1051,
1027,
2131,
2527,
2860,
10175,
5657,
1006,
3145,
1007,
1025,
2065,
1006,
1051,
1027,
1027,
19701,
1007,
1063,
2709,
12398,
10175,
5657... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/IoUtil.java | IoUtil.copy | public static long copy(InputStream in, OutputStream out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | java | public static long copy(InputStream in, OutputStream out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | 拷贝流,使用默认Buffer大小
@param in 输入流
@param out 输出流
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"拷贝流,使用默认Buffer大小"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L133-L135 | train | Copy the contents of the input stream to the output stream using the default buffer size. | [
30522,
2270,
10763,
2146,
6100,
1006,
20407,
25379,
1999,
1010,
27852,
25379,
2041,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
6100,
1006,
1999,
1010,
2041,
1010,
12398,
1035,
17698,
1035,
2946,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java | ExpectedConditions.frameToBeAvailableAndSwitchToIt | public static ExpectedCondition<WebDriver> frameToBeAvailableAndSwitchToIt(final By locator) {
return new ExpectedCondition<WebDriver>() {
@Override
public WebDriver apply(WebDriver driver) {
try {
return driver.switchTo().frame(driver.findElement(locator));
} catch (NoSuchFrameException e) {
return null;
}
}
@Override
public String toString() {
return "frame to be available: " + locator;
}
};
} | java | public static ExpectedCondition<WebDriver> frameToBeAvailableAndSwitchToIt(final By locator) {
return new ExpectedCondition<WebDriver>() {
@Override
public WebDriver apply(WebDriver driver) {
try {
return driver.switchTo().frame(driver.findElement(locator));
} catch (NoSuchFrameException e) {
return null;
}
}
@Override
public String toString() {
return "frame to be available: " + locator;
}
};
} | [
"public",
"static",
"ExpectedCondition",
"<",
"WebDriver",
">",
"frameToBeAvailableAndSwitchToIt",
"(",
"final",
"By",
"locator",
")",
"{",
"return",
"new",
"ExpectedCondition",
"<",
"WebDriver",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WebDriver",
"apply",... | An expectation for checking whether the given frame is available to switch to. <p> If the frame
is available it switches the given driver to the specified frame.
@param locator used to find the frame
@return WebDriver instance after frame has been switched | [
"An",
"expectation",
"for",
"checking",
"whether",
"the",
"given",
"frame",
"is",
"available",
"to",
"switch",
"to",
".",
"<p",
">",
"If",
"the",
"frame",
"is",
"available",
"it",
"switches",
"the",
"given",
"driver",
"to",
"the",
"specified",
"frame",
"."... | 7af172729f17b20269c8ca4ea6f788db48616535 | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java#L496-L512 | train | An expectation for checking that a frame is available on the page. | [
30522,
2270,
10763,
3517,
8663,
20562,
1026,
4773,
23663,
2099,
1028,
4853,
3406,
4783,
12462,
11733,
3468,
29560,
9148,
10649,
3406,
4183,
1006,
2345,
2011,
8840,
11266,
2953,
1007,
1063,
2709,
2047,
3517,
8663,
20562,
1026,
4773,
23663,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java | ThreadUtil.newNamedThreadFactory | public static ThreadFactory newNamedThreadFactory(String prefix, ThreadGroup threadGroup, boolean isDeamon) {
return new NamedThreadFactory(prefix, threadGroup, isDeamon);
} | java | public static ThreadFactory newNamedThreadFactory(String prefix, ThreadGroup threadGroup, boolean isDeamon) {
return new NamedThreadFactory(prefix, threadGroup, isDeamon);
} | [
"public",
"static",
"ThreadFactory",
"newNamedThreadFactory",
"(",
"String",
"prefix",
",",
"ThreadGroup",
"threadGroup",
",",
"boolean",
"isDeamon",
")",
"{",
"return",
"new",
"NamedThreadFactory",
"(",
"prefix",
",",
"threadGroup",
",",
"isDeamon",
")",
";",
"}"... | 创建线程工厂
@param prefix 线程名前缀
@param threadGroup 线程组,可以为null
@param isDeamon 是否守护线程
@since 4.0.0 | [
"创建线程工厂"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L407-L409 | train | Creates a thread factory that creates threads that use the specified thread group. | [
30522,
2270,
10763,
11689,
21450,
2047,
18442,
11927,
28362,
4215,
21450,
1006,
5164,
17576,
1010,
11689,
17058,
11689,
17058,
1010,
22017,
20898,
2003,
3207,
22591,
2078,
1007,
1063,
2709,
2047,
2315,
2705,
16416,
20952,
18908,
10253,
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-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java | RMatGraph.setNoise | public RMatGraph<T> setNoise(boolean noiseEnabled, float noise) {
Preconditions.checkArgument(noise >= 0.0f && noise <= 2.0f,
"RMat parameter noise must be non-negative and less than or equal to 2.0");
this.noiseEnabled = noiseEnabled;
this.noise = noise;
return this;
} | java | public RMatGraph<T> setNoise(boolean noiseEnabled, float noise) {
Preconditions.checkArgument(noise >= 0.0f && noise <= 2.0f,
"RMat parameter noise must be non-negative and less than or equal to 2.0");
this.noiseEnabled = noiseEnabled;
this.noise = noise;
return this;
} | [
"public",
"RMatGraph",
"<",
"T",
">",
"setNoise",
"(",
"boolean",
"noiseEnabled",
",",
"float",
"noise",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"noise",
">=",
"0.0f",
"&&",
"noise",
"<=",
"2.0f",
",",
"\"RMat parameter noise must be non-negative and... | Enable and configure noise. Each edge is generated independently, but
when noise is enabled the parameters A, B, and C are randomly increased
or decreased, then normalized, by a fraction of the noise factor during
the computation of each bit.
@param noiseEnabled whether to enable noise perturbation
@param noise strength of noise perturbation
@return this | [
"Enable",
"and",
"configure",
"noise",
".",
"Each",
"edge",
"is",
"generated",
"independently",
"but",
"when",
"noise",
"is",
"enabled",
"the",
"parameters",
"A",
"B",
"and",
"C",
"are",
"randomly",
"increased",
"or",
"decreased",
"then",
"normalized",
"by",
... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java#L133-L141 | train | Sets the noise value. | [
30522,
2270,
28549,
4017,
14413,
1026,
1056,
1028,
2275,
3630,
5562,
1006,
22017,
20898,
5005,
8189,
23242,
1010,
14257,
5005,
1007,
1063,
3653,
8663,
20562,
2015,
1012,
4638,
2906,
22850,
4765,
1006,
5005,
1028,
1027,
1014,
1012,
1014,
254... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/LocalCachedMapOptions.java | LocalCachedMapOptions.maxIdle | public LocalCachedMapOptions<K, V> maxIdle(long maxIdle, TimeUnit timeUnit) {
return maxIdle(timeUnit.toMillis(maxIdle));
} | java | public LocalCachedMapOptions<K, V> maxIdle(long maxIdle, TimeUnit timeUnit) {
return maxIdle(timeUnit.toMillis(maxIdle));
} | [
"public",
"LocalCachedMapOptions",
"<",
"K",
",",
"V",
">",
"maxIdle",
"(",
"long",
"maxIdle",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"maxIdle",
"(",
"timeUnit",
".",
"toMillis",
"(",
"maxIdle",
")",
")",
";",
"}"
] | Sets max idle time for each map entry in local cache.
If value equals to <code>0</code> then timeout is not applied
@param maxIdle - max idle time
@param timeUnit - time unit
@return LocalCachedMapOptions instance | [
"Sets",
"max",
"idle",
"time",
"for",
"each",
"map",
"entry",
"in",
"local",
"cache",
".",
"If",
"value",
"equals",
"to",
"<code",
">",
"0<",
"/",
"code",
">",
"then",
"timeout",
"is",
"not",
"applied"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/LocalCachedMapOptions.java#L268-L270 | train | Returns a cache options that limits the maximum number of idle entries in the cache. | [
30522,
2270,
2334,
3540,
7690,
2863,
16340,
9285,
1026,
1047,
1010,
1058,
1028,
21510,
10362,
1006,
2146,
21510,
10362,
1010,
2051,
19496,
2102,
2051,
19496,
2102,
1007,
1063,
2709,
21510,
10362,
1006,
2051,
19496,
2102,
1012,
3419,
8591,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java | BinaryRowSerializer.checkSkipWriteForFixLengthPart | private int checkSkipWriteForFixLengthPart(AbstractPagedOutputView out) throws IOException {
// skip if there is no enough size.
int available = out.getSegmentSize() - out.getCurrentPositionInSegment();
if (available < getSerializedRowFixedPartLength()) {
out.advance();
return available;
}
return 0;
} | java | private int checkSkipWriteForFixLengthPart(AbstractPagedOutputView out) throws IOException {
// skip if there is no enough size.
int available = out.getSegmentSize() - out.getCurrentPositionInSegment();
if (available < getSerializedRowFixedPartLength()) {
out.advance();
return available;
}
return 0;
} | [
"private",
"int",
"checkSkipWriteForFixLengthPart",
"(",
"AbstractPagedOutputView",
"out",
")",
"throws",
"IOException",
"{",
"// skip if there is no enough size.",
"int",
"available",
"=",
"out",
".",
"getSegmentSize",
"(",
")",
"-",
"out",
".",
"getCurrentPositionInSegm... | We need skip bytes to write when the remain bytes of current segment is not
enough to write binary row fixed part.
See {@link BinaryRow}. | [
"We",
"need",
"skip",
"bytes",
"to",
"write",
"when",
"the",
"remain",
"bytes",
"of",
"current",
"segment",
"is",
"not",
"enough",
"to",
"write",
"binary",
"row",
"fixed",
"part",
".",
"See",
"{"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/typeutils/BinaryRowSerializer.java#L284-L292 | train | Check if we need to skip the write for the fixed length part. | [
30522,
2797,
20014,
14148,
3211,
28400,
17625,
29278,
8873,
2595,
7770,
13512,
22269,
8445,
1006,
10061,
13704,
26797,
25856,
4904,
8584,
2041,
1007,
11618,
22834,
10288,
24422,
1063,
1013,
1013,
13558,
2065,
2045,
2003,
30524,
2131,
10841,
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-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.getPath | public static String getPath(String uriStr) {
URI uri = null;
try {
uri = new URI(uriStr);
} catch (URISyntaxException e) {
throw new UtilException(e);
}
return uri.getPath();
} | java | public static String getPath(String uriStr) {
URI uri = null;
try {
uri = new URI(uriStr);
} catch (URISyntaxException e) {
throw new UtilException(e);
}
return uri.getPath();
} | [
"public",
"static",
"String",
"getPath",
"(",
"String",
"uriStr",
")",
"{",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"uri",
"=",
"new",
"URI",
"(",
"uriStr",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"UtilEx... | 获得path部分<br>
@param uriStr URI路径
@return path
@exception UtilException 包装URISyntaxException | [
"获得path部分<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L391-L399 | train | Returns the path of the given URI. | [
30522,
2270,
10763,
5164,
2131,
15069,
1006,
5164,
24471,
2923,
2099,
1007,
1063,
24471,
2072,
24471,
2072,
1027,
19701,
1025,
3046,
1063,
24471,
2072,
1027,
2047,
24471,
2072,
1006,
24471,
2923,
2099,
1007,
1025,
1065,
4608,
1006,
24471,
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... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java | Sentence.toWordArray | public String[] toWordArray()
{
List<Word> wordList = toSimpleWordList();
String[] wordArray = new String[wordList.size()];
Iterator<Word> iterator = wordList.iterator();
for (int i = 0; i < wordArray.length; i++)
{
wordArray[i] = iterator.next().value;
}
return wordArray;
} | java | public String[] toWordArray()
{
List<Word> wordList = toSimpleWordList();
String[] wordArray = new String[wordList.size()];
Iterator<Word> iterator = wordList.iterator();
for (int i = 0; i < wordArray.length; i++)
{
wordArray[i] = iterator.next().value;
}
return wordArray;
} | [
"public",
"String",
"[",
"]",
"toWordArray",
"(",
")",
"{",
"List",
"<",
"Word",
">",
"wordList",
"=",
"toSimpleWordList",
"(",
")",
";",
"String",
"[",
"]",
"wordArray",
"=",
"new",
"String",
"[",
"wordList",
".",
"size",
"(",
")",
"]",
";",
"Iterat... | 获取所有单词构成的数组
@return | [
"获取所有单词构成的数组"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/document/sentence/Sentence.java#L418-L428 | train | To word array. | [
30522,
2270,
5164,
1031,
1033,
15805,
8551,
2906,
9447,
1006,
1007,
1063,
2862,
1026,
2773,
1028,
2773,
9863,
1027,
2000,
5332,
23344,
18351,
9863,
1006,
1007,
1025,
5164,
1031,
1033,
2773,
2906,
9447,
1027,
2047,
5164,
1031,
2773,
9863,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/web/reactive/error/DefaultErrorWebExceptionHandler.java | DefaultErrorWebExceptionHandler.renderErrorResponse | protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL);
Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
return ServerResponse.status(getHttpStatus(error))
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(BodyInserters.fromObject(error));
} | java | protected Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL);
Map<String, Object> error = getErrorAttributes(request, includeStackTrace);
return ServerResponse.status(getHttpStatus(error))
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(BodyInserters.fromObject(error));
} | [
"protected",
"Mono",
"<",
"ServerResponse",
">",
"renderErrorResponse",
"(",
"ServerRequest",
"request",
")",
"{",
"boolean",
"includeStackTrace",
"=",
"isIncludeStackTrace",
"(",
"request",
",",
"MediaType",
".",
"ALL",
")",
";",
"Map",
"<",
"String",
",",
"Obj... | Render the error information as a JSON payload.
@param request the current request
@return a {@code Publisher} of the HTTP response | [
"Render",
"the",
"error",
"information",
"as",
"a",
"JSON",
"payload",
"."
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java#L134-L140 | train | Render an error response. | [
30522,
5123,
18847,
1026,
8241,
6072,
26029,
3366,
1028,
17552,
2121,
29165,
6072,
26029,
3366,
1006,
8241,
2890,
15500,
5227,
1007,
1063,
22017,
20898,
2950,
2696,
3600,
6494,
3401,
1027,
2003,
2378,
20464,
22087,
2696,
3600,
6494,
3401,
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... |
networknt/light-4j | http-url/src/main/java/com/networknt/url/HttpURL.java | HttpURL.encodePath | public static String encodePath(String path) {
// Any characters that are not one of the following are
// percent-encoded (including spaces):
// a-z A-Z 0-9 . - _ ~ ! $ & ' ( ) * + , ; = : @ / %
if (StringUtils.isBlank(path)) {
return path;
}
StringBuilder sb = new StringBuilder();
for (char ch : path.toCharArray()) {
// Space to plus sign
if (ch == ' ') {
sb.append("%20");
// Valid: keep it as is.
} else if (CharUtils.isAsciiAlphanumeric(ch)
|| ".-_~!$&'()*+,;=:@/%".indexOf(ch) != -1) {
sb.append(ch);
// Invalid: encode it
} else {
byte[] bytes;
bytes = Character.toString(ch).getBytes(StandardCharsets.UTF_8);
for (byte b : bytes) {
sb.append('%');
int upper = (((int) b) >> 4) & 0xf;
sb.append(Integer.toHexString(
upper).toUpperCase(Locale.US));
int lower = ((int) b) & 0xf;
sb.append(Integer.toHexString(
lower).toUpperCase(Locale.US));
}
}
}
return sb.toString();
} | java | public static String encodePath(String path) {
// Any characters that are not one of the following are
// percent-encoded (including spaces):
// a-z A-Z 0-9 . - _ ~ ! $ & ' ( ) * + , ; = : @ / %
if (StringUtils.isBlank(path)) {
return path;
}
StringBuilder sb = new StringBuilder();
for (char ch : path.toCharArray()) {
// Space to plus sign
if (ch == ' ') {
sb.append("%20");
// Valid: keep it as is.
} else if (CharUtils.isAsciiAlphanumeric(ch)
|| ".-_~!$&'()*+,;=:@/%".indexOf(ch) != -1) {
sb.append(ch);
// Invalid: encode it
} else {
byte[] bytes;
bytes = Character.toString(ch).getBytes(StandardCharsets.UTF_8);
for (byte b : bytes) {
sb.append('%');
int upper = (((int) b) >> 4) & 0xf;
sb.append(Integer.toHexString(
upper).toUpperCase(Locale.US));
int lower = ((int) b) & 0xf;
sb.append(Integer.toHexString(
lower).toUpperCase(Locale.US));
}
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"encodePath",
"(",
"String",
"path",
")",
"{",
"// Any characters that are not one of the following are",
"// percent-encoded (including spaces):",
"// a-z A-Z 0-9 . - _ ~ ! $ & ' ( ) * + , ; = : @ / %",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(... | <p>URL-Encodes a URL path. The entire string supplied is assumed
to be a URL path. Unsafe characters are percent-encoded using UTF-8
(as specified by W3C standard).
@param path path portion of a URL
@return encoded path
@since 1.7.0 | [
"<p",
">",
"URL",
"-",
"Encodes",
"a",
"URL",
"path",
".",
"The",
"entire",
"string",
"supplied",
"is",
"assumed",
"to",
"be",
"a",
"URL",
"path",
".",
"Unsafe",
"characters",
"are",
"percent",
"-",
"encoded",
"using",
"UTF",
"-",
"8",
"(",
"as",
"sp... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L428-L460 | train | Encode path. | [
30522,
2270,
10763,
5164,
4372,
16044,
15069,
1006,
5164,
4130,
1007,
1063,
1013,
1013,
2151,
3494,
2008,
2024,
2025,
2028,
1997,
1996,
2206,
2024,
1013,
1013,
3867,
1011,
12359,
1006,
2164,
7258,
1007,
1024,
1013,
1013,
1037,
1011,
1062,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeFromStream | public static File writeFromStream(InputStream in, File dest) throws IORuntimeException {
return FileWriter.create(dest).writeFromStream(in);
} | java | public static File writeFromStream(InputStream in, File dest) throws IORuntimeException {
return FileWriter.create(dest).writeFromStream(in);
} | [
"public",
"static",
"File",
"writeFromStream",
"(",
"InputStream",
"in",
",",
"File",
"dest",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"dest",
")",
".",
"writeFromStream",
"(",
"in",
")",
";",
"}"
] | 将流的内容写入文件<br>
@param dest 目标文件
@param in 输入流
@return dest
@throws IORuntimeException IO异常 | [
"将流的内容写入文件<br",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3153-L3155 | train | Write from stream to file. | [
30522,
2270,
10763,
5371,
4339,
19699,
22225,
25379,
1006,
20407,
25379,
1999,
1010,
5371,
4078,
2102,
1007,
11618,
22834,
15532,
7292,
10288,
24422,
1063,
2709,
5371,
15994,
1012,
3443,
1006,
4078,
2102,
1007,
1012,
4339,
19699,
22225,
25379... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/WeightedFairQueueByteDistributor.java | WeightedFairQueueByteDistributor.numChildren | int numChildren(int streamId) {
State state = state(streamId);
return state == null ? 0 : state.children.size();
} | java | int numChildren(int streamId) {
State state = state(streamId);
return state == null ? 0 : state.children.size();
} | [
"int",
"numChildren",
"(",
"int",
"streamId",
")",
"{",
"State",
"state",
"=",
"state",
"(",
"streamId",
")",
";",
"return",
"state",
"==",
"null",
"?",
"0",
":",
"state",
".",
"children",
".",
"size",
"(",
")",
";",
"}"
] | For testing only! | [
"For",
"testing",
"only!"
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/WeightedFairQueueByteDistributor.java#L367-L370 | train | Returns number of children of a given stream. | [
30522,
20014,
16371,
12458,
19466,
16200,
2078,
1006,
20014,
5460,
3593,
1007,
1063,
2110,
2110,
1027,
2110,
1006,
5460,
3593,
1007,
1025,
2709,
2110,
1027,
1027,
19701,
1029,
1014,
1024,
2110,
1012,
2336,
1012,
2946,
1006,
1007,
1025,
1065... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java | SlotSharingGroupAssignment.releaseSimpleSlot | void releaseSimpleSlot(SimpleSlot simpleSlot) {
synchronized (lock) {
// try to transition to the CANCELED state. That state marks
// that the releasing is in progress
if (simpleSlot.markCancelled()) {
// sanity checks
if (simpleSlot.isAlive()) {
throw new IllegalStateException("slot is still alive");
}
// check whether the slot is already released
if (simpleSlot.markReleased()) {
LOG.debug("Release simple slot {}.", simpleSlot);
AbstractID groupID = simpleSlot.getGroupID();
SharedSlot parent = simpleSlot.getParent();
// if we have a group ID, then our parent slot is tracked here
if (groupID != null && !allSlots.contains(parent)) {
throw new IllegalArgumentException("Slot was not associated with this SlotSharingGroup before.");
}
int parentRemaining = parent.removeDisposedChildSlot(simpleSlot);
if (parentRemaining > 0) {
// the parent shared slot is still alive. make sure we make it
// available again to the group of the just released slot
if (groupID != null) {
// if we have a group ID, then our parent becomes available
// for that group again. otherwise, the slot is part of a
// co-location group and nothing becomes immediately available
Map<ResourceID, List<SharedSlot>> slotsForJid = availableSlotsPerJid.get(groupID);
// sanity check
if (slotsForJid == null) {
throw new IllegalStateException("Trying to return a slot for group " + groupID +
" when available slots indicated that all slots were available.");
}
putIntoMultiMap(slotsForJid, parent.getTaskManagerID(), parent);
}
} else {
// the parent shared slot is now empty and can be released
parent.markCancelled();
internalDisposeEmptySharedSlot(parent);
}
}
}
}
} | java | void releaseSimpleSlot(SimpleSlot simpleSlot) {
synchronized (lock) {
// try to transition to the CANCELED state. That state marks
// that the releasing is in progress
if (simpleSlot.markCancelled()) {
// sanity checks
if (simpleSlot.isAlive()) {
throw new IllegalStateException("slot is still alive");
}
// check whether the slot is already released
if (simpleSlot.markReleased()) {
LOG.debug("Release simple slot {}.", simpleSlot);
AbstractID groupID = simpleSlot.getGroupID();
SharedSlot parent = simpleSlot.getParent();
// if we have a group ID, then our parent slot is tracked here
if (groupID != null && !allSlots.contains(parent)) {
throw new IllegalArgumentException("Slot was not associated with this SlotSharingGroup before.");
}
int parentRemaining = parent.removeDisposedChildSlot(simpleSlot);
if (parentRemaining > 0) {
// the parent shared slot is still alive. make sure we make it
// available again to the group of the just released slot
if (groupID != null) {
// if we have a group ID, then our parent becomes available
// for that group again. otherwise, the slot is part of a
// co-location group and nothing becomes immediately available
Map<ResourceID, List<SharedSlot>> slotsForJid = availableSlotsPerJid.get(groupID);
// sanity check
if (slotsForJid == null) {
throw new IllegalStateException("Trying to return a slot for group " + groupID +
" when available slots indicated that all slots were available.");
}
putIntoMultiMap(slotsForJid, parent.getTaskManagerID(), parent);
}
} else {
// the parent shared slot is now empty and can be released
parent.markCancelled();
internalDisposeEmptySharedSlot(parent);
}
}
}
}
} | [
"void",
"releaseSimpleSlot",
"(",
"SimpleSlot",
"simpleSlot",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"// try to transition to the CANCELED state. That state marks",
"// that the releasing is in progress",
"if",
"(",
"simpleSlot",
".",
"markCancelled",
"(",
")",
")... | Releases the simple slot from the assignment group.
@param simpleSlot The SimpleSlot to be released | [
"Releases",
"the",
"simple",
"slot",
"from",
"the",
"assignment",
"group",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L457-L509 | train | Releases a slot from the slot sharing group. | [
30522,
11675,
7085,
5714,
21112,
10994,
1006,
3722,
14540,
4140,
3722,
14540,
4140,
1007,
1063,
25549,
1006,
5843,
1007,
1063,
1013,
1013,
3046,
2000,
6653,
2000,
1996,
13261,
2110,
1012,
2008,
2110,
6017,
1013,
1013,
2008,
1996,
8287,
2003... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/comparator/CompareUtil.java | CompareUtil.compare | public static <T extends Comparable<? super T>> int compare(T c1, T c2, boolean isNullGreater) {
if (c1 == c2) {
return 0;
} else if (c1 == null) {
return isNullGreater ? 1 : -1;
} else if (c2 == null) {
return isNullGreater ? -1 : 1;
}
return c1.compareTo(c2);
} | java | public static <T extends Comparable<? super T>> int compare(T c1, T c2, boolean isNullGreater) {
if (c1 == c2) {
return 0;
} else if (c1 == null) {
return isNullGreater ? 1 : -1;
} else if (c2 == null) {
return isNullGreater ? -1 : 1;
}
return c1.compareTo(c2);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"int",
"compare",
"(",
"T",
"c1",
",",
"T",
"c2",
",",
"boolean",
"isNullGreater",
")",
"{",
"if",
"(",
"c1",
"==",
"c2",
")",
"{",
"return",
"0",
";",
"}",
... | {@code null}安全的对象比较
@param <T> 被比较对象类型(必须实现Comparable接口)
@param c1 对象1,可以为{@code null}
@param c2 对象2,可以为{@code null}
@param isNullGreater 当被比较对象为null时是否排在前面
@return 比较结果,如果c1 < c2,返回数小于0,c1==c2返回0,c1 > c2 大于0
@see java.util.Comparator#compare(Object, Object) | [
"{",
"@code",
"null",
"}",
"安全的对象比较"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/comparator/CompareUtil.java#L28-L37 | train | Compare two Comparable objects. | [
30522,
2270,
10763,
1026,
1056,
8908,
12435,
1026,
1029,
3565,
1056,
1028,
1028,
20014,
12826,
1006,
1056,
27723,
1010,
1056,
29248,
1010,
22017,
20898,
3475,
18083,
17603,
24932,
1007,
1063,
2065,
1006,
27723,
1027,
1027,
29248,
1007,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/factories/TableFactoryUtil.java | TableFactoryUtil.findAndCreateTableSink | public static <T> TableSink<T> findAndCreateTableSink(Descriptor descriptor) {
Map<String, String> properties = descriptor.toProperties();
TableSink tableSink;
try {
tableSink = TableFactoryService
.find(TableSinkFactory.class, properties)
.createTableSink(properties);
} catch (Throwable t) {
throw new TableException("findAndCreateTableSink failed.", t);
}
return tableSink;
} | java | public static <T> TableSink<T> findAndCreateTableSink(Descriptor descriptor) {
Map<String, String> properties = descriptor.toProperties();
TableSink tableSink;
try {
tableSink = TableFactoryService
.find(TableSinkFactory.class, properties)
.createTableSink(properties);
} catch (Throwable t) {
throw new TableException("findAndCreateTableSink failed.", t);
}
return tableSink;
} | [
"public",
"static",
"<",
"T",
">",
"TableSink",
"<",
"T",
">",
"findAndCreateTableSink",
"(",
"Descriptor",
"descriptor",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"descriptor",
".",
"toProperties",
"(",
")",
";",
"TableSink",
... | Returns a table sink matching the descriptor. | [
"Returns",
"a",
"table",
"sink",
"matching",
"the",
"descriptor",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/factories/TableFactoryUtil.java#L65-L78 | train | Find and create a table sink. | [
30522,
2270,
10763,
1026,
1056,
1028,
7251,
19839,
1026,
1056,
1028,
2424,
5685,
16748,
3686,
10880,
11493,
2243,
1006,
4078,
23235,
2953,
4078,
23235,
2953,
1007,
1063,
4949,
1026,
5164,
1010,
5164,
1028,
5144,
1027,
4078,
23235,
2953,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DbUtil.java | DbUtil.newSqlRunner | @Deprecated
public static SqlRunner newSqlRunner(DataSource ds, Dialect dialect) {
return SqlRunner.create(ds, dialect);
} | java | @Deprecated
public static SqlRunner newSqlRunner(DataSource ds, Dialect dialect) {
return SqlRunner.create(ds, dialect);
} | [
"@",
"Deprecated",
"public",
"static",
"SqlRunner",
"newSqlRunner",
"(",
"DataSource",
"ds",
",",
"Dialect",
"dialect",
")",
"{",
"return",
"SqlRunner",
".",
"create",
"(",
"ds",
",",
"dialect",
")",
";",
"}"
] | 实例化一个新的SQL运行对象
@param ds 数据源
@param dialect SQL方言
@return SQL执行类
@deprecated 请使用 {@link #use(DataSource, Dialect)} | [
"实例化一个新的SQL运行对象"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L95-L98 | train | Create a new instance of a sql runner. | [
30522,
1030,
2139,
28139,
12921,
2270,
10763,
29296,
23195,
2739,
4160,
20974,
4609,
3678,
1006,
2951,
6499,
3126,
3401,
16233,
1010,
9329,
9329,
1007,
1063,
2709,
29296,
23195,
1012,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/LexerEngineFactory.java | LexerEngineFactory.newInstance | public static LexerEngine newInstance(final DatabaseType dbType, final String sql) {
switch (dbType) {
case H2:
return new LexerEngine(new H2Lexer(sql));
case MySQL:
return new LexerEngine(new MySQLLexer(sql));
case Oracle:
return new LexerEngine(new OracleLexer(sql));
case SQLServer:
return new LexerEngine(new SQLServerLexer(sql));
case PostgreSQL:
return new LexerEngine(new PostgreSQLLexer(sql));
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | java | public static LexerEngine newInstance(final DatabaseType dbType, final String sql) {
switch (dbType) {
case H2:
return new LexerEngine(new H2Lexer(sql));
case MySQL:
return new LexerEngine(new MySQLLexer(sql));
case Oracle:
return new LexerEngine(new OracleLexer(sql));
case SQLServer:
return new LexerEngine(new SQLServerLexer(sql));
case PostgreSQL:
return new LexerEngine(new PostgreSQLLexer(sql));
default:
throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
}
} | [
"public",
"static",
"LexerEngine",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"String",
"sql",
")",
"{",
"switch",
"(",
"dbType",
")",
"{",
"case",
"H2",
":",
"return",
"new",
"LexerEngine",
"(",
"new",
"H2Lexer",
"(",
"sql",
")",... | Create lexical analysis engine instance.
@param dbType database type
@param sql SQL
@return lexical analysis engine instance | [
"Create",
"lexical",
"analysis",
"engine",
"instance",
"."
] | f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/lexer/LexerEngineFactory.java#L44-L59 | train | Create lexer engine instance. | [
30522,
2270,
10763,
17244,
7869,
3070,
3170,
2047,
7076,
26897,
1006,
2345,
7809,
13874,
16962,
13874,
1010,
2345,
5164,
29296,
1007,
1063,
6942,
1006,
16962,
13874,
1007,
1063,
2553,
1044,
2475,
1024,
2709,
2047,
17244,
7869,
3070,
3170,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java | Execution.notifyCheckpointComplete | public void notifyCheckpointComplete(long checkpointId, long timestamp) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
taskManagerGateway.notifyCheckpointComplete(attemptId, getVertex().getJobId(), checkpointId, timestamp);
} else {
LOG.debug("The execution has no slot assigned. This indicates that the execution is " +
"no longer running.");
}
} | java | public void notifyCheckpointComplete(long checkpointId, long timestamp) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
taskManagerGateway.notifyCheckpointComplete(attemptId, getVertex().getJobId(), checkpointId, timestamp);
} else {
LOG.debug("The execution has no slot assigned. This indicates that the execution is " +
"no longer running.");
}
} | [
"public",
"void",
"notifyCheckpointComplete",
"(",
"long",
"checkpointId",
",",
"long",
"timestamp",
")",
"{",
"final",
"LogicalSlot",
"slot",
"=",
"assignedResource",
";",
"if",
"(",
"slot",
"!=",
"null",
")",
"{",
"final",
"TaskManagerGateway",
"taskManagerGatew... | Notify the task of this execution about a completed checkpoint.
@param checkpointId of the completed checkpoint
@param timestamp of the completed checkpoint | [
"Notify",
"the",
"task",
"of",
"this",
"execution",
"about",
"a",
"completed",
"checkpoint",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/Execution.java#L848-L859 | train | Notifies the task manager that a checkpoint has completed. | [
30522,
2270,
11675,
2025,
8757,
5403,
3600,
8400,
9006,
10814,
2618,
1006,
2146,
26520,
3593,
1010,
2146,
2335,
15464,
2361,
1007,
1063,
2345,
11177,
14540,
4140,
10453,
1027,
4137,
6072,
8162,
3401,
1025,
2065,
1006,
10453,
999,
1027,
1970... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.copy | public static Object copy(Object src, int srcPos, Object dest, int destPos, int length) {
System.arraycopy(src, srcPos, dest, destPos, length);
return dest;
} | java | public static Object copy(Object src, int srcPos, Object dest, int destPos, int length) {
System.arraycopy(src, srcPos, dest, destPos, length);
return dest;
} | [
"public",
"static",
"Object",
"copy",
"(",
"Object",
"src",
",",
"int",
"srcPos",
",",
"Object",
"dest",
",",
"int",
"destPos",
",",
"int",
"length",
")",
"{",
"System",
".",
"arraycopy",
"(",
"src",
",",
"srcPos",
",",
"dest",
",",
"destPos",
",",
"... | 包装 {@link System#arraycopy(Object, int, Object, int, int)}<br>
数组复制
@param src 源数组
@param srcPos 源数组开始位置
@param dest 目标数组
@param destPos 目标数组开始位置
@param length 拷贝数组长度
@return 目标数组
@since 3.0.6 | [
"包装",
"{",
"@link",
"System#arraycopy",
"(",
"Object",
"int",
"Object",
"int",
"int",
")",
"}",
"<br",
">",
"数组复制"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L573-L576 | train | Copies the contents of the array src to the array dest. | [
30522,
2270,
10763,
4874,
6100,
1006,
4874,
5034,
2278,
1010,
20014,
5034,
21906,
2891,
1010,
4874,
4078,
2102,
1010,
20014,
4078,
25856,
2891,
1010,
20014,
3091,
1007,
1063,
2291,
1012,
9140,
3597,
7685,
1006,
5034,
2278,
1010,
5034,
21906... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/metrics/web/reactive/client/WebClientExchangeTags.java | WebClientExchangeTags.clientName | public static Tag clientName(ClientRequest request) {
String host = request.url().getHost();
if (host == null) {
return CLIENT_NAME_NONE;
}
return Tag.of("clientName", host);
} | java | public static Tag clientName(ClientRequest request) {
String host = request.url().getHost();
if (host == null) {
return CLIENT_NAME_NONE;
}
return Tag.of("clientName", host);
} | [
"public",
"static",
"Tag",
"clientName",
"(",
"ClientRequest",
"request",
")",
"{",
"String",
"host",
"=",
"request",
".",
"url",
"(",
")",
".",
"getHost",
"(",
")",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"return",
"CLIENT_NAME_NONE",
";",
"}"... | Create a {@code clientName} {@code Tag} derived from the
{@link java.net.URI#getHost host} of the {@link ClientRequest#url() URL} of the
given {@code request}.
@param request the request
@return the clientName tag | [
"Create",
"a",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/WebClientExchangeTags.java#L120-L126 | train | Gets the client name. | [
30522,
2270,
10763,
6415,
7396,
18442,
1006,
7396,
2890,
15500,
5227,
1007,
1063,
5164,
3677,
1027,
5227,
1012,
24471,
2140,
1006,
1007,
1012,
2131,
15006,
2102,
1006,
1007,
1025,
2065,
1006,
3677,
1027,
1027,
19701,
1007,
1063,
2709,
7396,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/Sign.java | Sign.verify | public boolean verify(byte[] data, byte[] sign) {
lock.lock();
try {
signature.initVerify(this.publicKey);
signature.update(data);
return signature.verify(sign);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | java | public boolean verify(byte[] data, byte[] sign) {
lock.lock();
try {
signature.initVerify(this.publicKey);
signature.update(data);
return signature.verify(sign);
} catch (Exception e) {
throw new CryptoException(e);
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"verify",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"sign",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"signature",
".",
"initVerify",
"(",
"this",
".",
"publicKey",
")",
";",
"signature",
".",
"updat... | 用公钥检验数字签名的合法性
@param data 数据
@param sign 签名
@return 是否验证通过 | [
"用公钥检验数字签名的合法性"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/Sign.java#L195-L206 | train | Verifies the signature of the data. | [
30522,
2270,
22017,
20898,
20410,
1006,
24880,
1031,
1033,
2951,
1010,
24880,
1031,
1033,
3696,
1007,
30524,
1012,
10651,
1006,
2951,
1007,
1025,
2709,
8085,
1012,
20410,
1006,
3696,
1007,
1025,
1065,
4608,
1006,
6453,
1041,
1007,
1063,
546... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateIpv4 | public static <T extends CharSequence> T validateIpv4(T value, String errorMsg) throws ValidateException {
if (false == isIpv4(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validateIpv4(T value, String errorMsg) throws ValidateException {
if (false == isIpv4(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validateIpv4",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isIpv4",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"Va... | 验证是否为IPV4地址
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常 | [
"验证是否为IPV4地址"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L809-L814 | train | Validate an IPv4 address. | [
30522,
2270,
10763,
1026,
1056,
8908,
25869,
3366,
4226,
5897,
1028,
1056,
9398,
3686,
11514,
2615,
2549,
1006,
1056,
3643,
1010,
5164,
7561,
5244,
2290,
1007,
11618,
9398,
3686,
10288,
24422,
1063,
2065,
1006,
6270,
1027,
1027,
2003,
11514... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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 | handler/src/main/java/com/networknt/handler/Handler.java | Handler.next | public static void next(HttpServerExchange httpServerExchange, HttpHandler next) throws Exception {
if (next != null) {
next.handleRequest(httpServerExchange);
} else {
next(httpServerExchange);
}
} | java | public static void next(HttpServerExchange httpServerExchange, HttpHandler next) throws Exception {
if (next != null) {
next.handleRequest(httpServerExchange);
} else {
next(httpServerExchange);
}
} | [
"public",
"static",
"void",
"next",
"(",
"HttpServerExchange",
"httpServerExchange",
",",
"HttpHandler",
"next",
")",
"throws",
"Exception",
"{",
"if",
"(",
"next",
"!=",
"null",
")",
"{",
"next",
".",
"handleRequest",
"(",
"httpServerExchange",
")",
";",
"}",... | Go to the next handler if the given next is none null. Reason for this is for
middleware to provide their instance next if it exists. Since if it exists,
the server hasn't been able to find the handler.yml.
@param httpServerExchange
The current requests server exchange.
@param next
The next HttpHandler to go to if it's not null.
@throws Exception exception | [
"Go",
"to",
"the",
"next",
"handler",
"if",
"the",
"given",
"next",
"is",
"none",
"null",
".",
"Reason",
"for",
"this",
"is",
"for",
"middleware",
"to",
"provide",
"their",
"instance",
"next",
"if",
"it",
"exists",
".",
"Since",
"if",
"it",
"exists",
"... | 2a60257c60663684c8f6dc8b5ea3cf184e534db6 | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L224-L230 | train | Handle the next request. | [
30522,
2270,
10763,
11675,
2279,
1006,
16770,
2121,
28943,
2595,
22305,
2063,
16770,
2121,
28943,
2595,
22305,
2063,
1010,
8299,
11774,
3917,
2279,
1007,
11618,
6453,
1063,
2065,
1006,
2279,
999,
1027,
19701,
1007,
1063,
2279,
1012,
28213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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.encodeCopy | private static void encodeCopy(ByteBuf out, int offset, int length) {
while (length >= 68) {
encodeCopyWithOffset(out, offset, 64);
length -= 64;
}
if (length > 64) {
encodeCopyWithOffset(out, offset, 60);
length -= 60;
}
encodeCopyWithOffset(out, offset, length);
} | java | private static void encodeCopy(ByteBuf out, int offset, int length) {
while (length >= 68) {
encodeCopyWithOffset(out, offset, 64);
length -= 64;
}
if (length > 64) {
encodeCopyWithOffset(out, offset, 60);
length -= 60;
}
encodeCopyWithOffset(out, offset, length);
} | [
"private",
"static",
"void",
"encodeCopy",
"(",
"ByteBuf",
"out",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"while",
"(",
"length",
">=",
"68",
")",
"{",
"encodeCopyWithOffset",
"(",
"out",
",",
"offset",
",",
"64",
")",
";",
"length",
"-="... | Encodes a series of copies, each at most 64 bytes in length.
@param out The output buffer to write the copy pointer to
@param offset The offset at which the original instance lies
@param length The length of the original instance | [
"Encodes",
"a",
"series",
"of",
"copies",
"each",
"at",
"most",
"64",
"bytes",
"in",
"length",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L256-L268 | train | EncodeCopy method. | [
30522,
2797,
10763,
11675,
4372,
16044,
3597,
7685,
1006,
24880,
8569,
2546,
2041,
1010,
20014,
16396,
1010,
20014,
3091,
1007,
1063,
2096,
1006,
3091,
1028,
1027,
30524,
4185,
1025,
1065,
2065,
1006,
3091,
1028,
4185,
1007,
1063,
4372,
160... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/crf/CRFTagger.java | CRFTagger.train | public void train(String templFile, String trainFile, String modelFile,
int maxitr, int freq, double eta, double C, int threadNum, int shrinkingSize,
Encoder.Algorithm algorithm) throws IOException
{
Encoder encoder = new Encoder();
if (!encoder.learn(templFile, trainFile, modelFile,
true, maxitr, freq, eta, C, threadNum, shrinkingSize, algorithm))
{
throw new IOException("fail to learn model");
}
convert(modelFile);
} | java | public void train(String templFile, String trainFile, String modelFile,
int maxitr, int freq, double eta, double C, int threadNum, int shrinkingSize,
Encoder.Algorithm algorithm) throws IOException
{
Encoder encoder = new Encoder();
if (!encoder.learn(templFile, trainFile, modelFile,
true, maxitr, freq, eta, C, threadNum, shrinkingSize, algorithm))
{
throw new IOException("fail to learn model");
}
convert(modelFile);
} | [
"public",
"void",
"train",
"(",
"String",
"templFile",
",",
"String",
"trainFile",
",",
"String",
"modelFile",
",",
"int",
"maxitr",
",",
"int",
"freq",
",",
"double",
"eta",
",",
"double",
"C",
",",
"int",
"threadNum",
",",
"int",
"shrinkingSize",
",",
... | 训练
@param templFile 模板文件
@param trainFile 训练文件
@param modelFile 模型文件
@param maxitr 最大迭代次数
@param freq 特征最低频次
@param eta 收敛阈值
@param C cost-factor
@param threadNum 线程数
@param shrinkingSize
@param algorithm 训练算法
@return | [
"训练"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/CRFTagger.java#L59-L70 | train | Train a single tag set from a templ file and a model file. | [
30522,
2270,
11675,
3345,
1006,
5164,
8915,
8737,
10270,
9463,
1010,
5164,
3345,
8873,
2571,
1010,
5164,
2944,
8873,
2571,
1010,
20014,
21510,
16344,
1010,
20014,
10424,
2063,
4160,
1010,
3313,
27859,
1010,
3313,
1039,
1010,
20014,
11689,
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-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionHashCode | public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
return reflectionHashCode(object, ArrayUtil.toArray(excludeFields, String.class));
} | java | public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
return reflectionHashCode(object, ArrayUtil.toArray(excludeFields, String.class));
} | [
"public",
"static",
"int",
"reflectionHashCode",
"(",
"final",
"Object",
"object",
",",
"final",
"Collection",
"<",
"String",
">",
"excludeFields",
")",
"{",
"return",
"reflectionHashCode",
"(",
"object",
",",
"ArrayUtil",
".",
"toArray",
"(",
"excludeFields",
"... | <p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
This constructor uses two hard coded choices for the constants needed to build a hash code.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included. If no fields are found to include
in the hash code, the result of this method will be constant.
</p>
@param object
the Object to create a <code>hashCode</code> for
@param excludeFields
Collection of String field names to exclude from use in calculation of hash code
@return int hash code
@throws IllegalArgumentException
if the object is <code>null</code> | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"{",
"@code",
"object",
"}",
".",
"<",
"/",
"p",
">"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L418-L420 | train | Get the hashCode of the object using reflection. | [
30522,
2270,
10763,
20014,
9185,
14949,
16257,
10244,
1006,
2345,
4874,
4874,
1010,
2345,
3074,
1026,
5164,
1028,
23329,
15155,
1007,
1063,
2709,
9185,
14949,
16257,
10244,
1006,
4874,
1010,
9140,
21823,
2140,
1012,
2000,
2906,
9447,
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-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/MultipartProperties.java | MultipartProperties.createMultipartConfig | public MultipartConfigElement createMultipartConfig() {
MultipartConfigFactory factory = new MultipartConfigFactory();
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);
map.from(this.location).whenHasText().to(factory::setLocation);
map.from(this.maxRequestSize).to(factory::setMaxRequestSize);
map.from(this.maxFileSize).to(factory::setMaxFileSize);
return factory.createMultipartConfig();
} | java | public MultipartConfigElement createMultipartConfig() {
MultipartConfigFactory factory = new MultipartConfigFactory();
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);
map.from(this.location).whenHasText().to(factory::setLocation);
map.from(this.maxRequestSize).to(factory::setMaxRequestSize);
map.from(this.maxFileSize).to(factory::setMaxFileSize);
return factory.createMultipartConfig();
} | [
"public",
"MultipartConfigElement",
"createMultipartConfig",
"(",
")",
"{",
"MultipartConfigFactory",
"factory",
"=",
"new",
"MultipartConfigFactory",
"(",
")",
";",
"PropertyMapper",
"map",
"=",
"PropertyMapper",
".",
"get",
"(",
")",
".",
"alwaysApplyingWhenNonNull",
... | Create a new {@link MultipartConfigElement} using the properties.
@return a new {@link MultipartConfigElement} configured using there properties | [
"Create",
"a",
"new",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/servlet/MultipartProperties.java#L134-L142 | train | Creates a MultipartConfigElement. | [
30522,
2270,
4800,
19362,
13535,
2239,
8873,
12439,
13665,
3443,
12274,
7096,
11514,
8445,
8663,
8873,
2290,
1006,
1007,
1063,
4800,
19362,
13535,
2239,
8873,
25708,
18908,
10253,
4713,
1027,
2047,
4800,
19362,
13535,
2239,
8873,
25708,
18908... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebApplicationContext.java | AnnotationConfigServletWebApplicationContext.register | @Override
public final void register(Class<?>... annotatedClasses) {
Assert.notEmpty(annotatedClasses,
"At least one annotated class must be specified");
this.annotatedClasses.addAll(Arrays.asList(annotatedClasses));
} | java | @Override
public final void register(Class<?>... annotatedClasses) {
Assert.notEmpty(annotatedClasses,
"At least one annotated class must be specified");
this.annotatedClasses.addAll(Arrays.asList(annotatedClasses));
} | [
"@",
"Override",
"public",
"final",
"void",
"register",
"(",
"Class",
"<",
"?",
">",
"...",
"annotatedClasses",
")",
"{",
"Assert",
".",
"notEmpty",
"(",
"annotatedClasses",
",",
"\"At least one annotated class must be specified\"",
")",
";",
"this",
".",
"annotat... | Register one or more annotated classes to be processed. Note that
{@link #refresh()} must be called in order for the context to fully process the new
class.
<p>
Calls to {@code #register} are idempotent; adding the same annotated class more
than once has no additional effect.
@param annotatedClasses one or more annotated classes, e.g. {@code @Configuration}
classes
@see #scan(String...)
@see #refresh() | [
"Register",
"one",
"or",
"more",
"annotated",
"classes",
"to",
"be",
"processed",
".",
"Note",
"that",
"{"
] | 0b27f7c70e164b2b1a96477f1d9c1acba56790c1 | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/AnnotationConfigServletWebApplicationContext.java#L178-L183 | train | Registers the specified annotated classes. | [
30522,
1030,
2058,
15637,
2270,
2345,
11675,
4236,
1006,
2465,
1026,
1029,
1028,
1012,
1012,
1012,
5754,
17287,
3064,
26266,
2229,
1007,
1063,
20865,
1012,
3602,
27718,
2100,
1006,
5754,
17287,
3064,
26266,
2229,
1010,
1000,
2012,
2560,
202... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/internal/InternalWindowProcessFunction.java | InternalWindowProcessFunction.open | public void open(Context<K, W> ctx) throws Exception {
this.ctx = ctx;
this.windowAssigner.open(ctx);
} | java | public void open(Context<K, W> ctx) throws Exception {
this.ctx = ctx;
this.windowAssigner.open(ctx);
} | [
"public",
"void",
"open",
"(",
"Context",
"<",
"K",
",",
"W",
">",
"ctx",
")",
"throws",
"Exception",
"{",
"this",
".",
"ctx",
"=",
"ctx",
";",
"this",
".",
"windowAssigner",
".",
"open",
"(",
"ctx",
")",
";",
"}"
] | Initialization method for the function. It is called before the actual working methods. | [
"Initialization",
"method",
"for",
"the",
"function",
".",
"It",
"is",
"called",
"before",
"the",
"actual",
"working",
"methods",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/internal/InternalWindowProcessFunction.java#L58-L61 | train | Opens the context. | [
30522,
2270,
11675,
2330,
1006,
6123,
1026,
1047,
1010,
1059,
1028,
14931,
2595,
1007,
11618,
6453,
1063,
2023,
1012,
14931,
2595,
1027,
14931,
2595,
1025,
2023,
1012,
3332,
12054,
23773,
2121,
1012,
2330,
1006,
14931,
2595,
1007,
1025,
106... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/collection/trie/datrie/Utf8CharacterMapping.java | Utf8CharacterMapping.toIdList | @Override
public int[] toIdList(int codePoint)
{
int count;
if (codePoint < 0x80)
count = 1;
else if (codePoint < 0x800)
count = 2;
else if (codePoint < 0x10000)
count = 3;
else if (codePoint < 0x200000)
count = 4;
else if (codePoint < 0x4000000)
count = 5;
else if (codePoint <= 0x7fffffff)
count = 6;
else
return EMPTYLIST;
int[] r = new int[count];
switch (count)
{ /* note: code falls through cases! */
case 6:
r[5] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x4000000;
case 5:
r[4] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x200000;
case 4:
r[3] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x10000;
case 3:
r[2] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x800;
case 2:
r[1] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0xc0;
case 1:
r[0] = (char) codePoint;
}
return r;
} | java | @Override
public int[] toIdList(int codePoint)
{
int count;
if (codePoint < 0x80)
count = 1;
else if (codePoint < 0x800)
count = 2;
else if (codePoint < 0x10000)
count = 3;
else if (codePoint < 0x200000)
count = 4;
else if (codePoint < 0x4000000)
count = 5;
else if (codePoint <= 0x7fffffff)
count = 6;
else
return EMPTYLIST;
int[] r = new int[count];
switch (count)
{ /* note: code falls through cases! */
case 6:
r[5] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x4000000;
case 5:
r[4] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x200000;
case 4:
r[3] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x10000;
case 3:
r[2] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0x800;
case 2:
r[1] = (char) (0x80 | (codePoint & 0x3f));
codePoint = codePoint >> 6;
codePoint |= 0xc0;
case 1:
r[0] = (char) codePoint;
}
return r;
} | [
"@",
"Override",
"public",
"int",
"[",
"]",
"toIdList",
"(",
"int",
"codePoint",
")",
"{",
"int",
"count",
";",
"if",
"(",
"codePoint",
"<",
"0x80",
")",
"count",
"=",
"1",
";",
"else",
"if",
"(",
"codePoint",
"<",
"0x800",
")",
"count",
"=",
"2",
... | codes ported from iconv lib in utf8.h utf8_codepointtomb | [
"codes",
"ported",
"from",
"iconv",
"lib",
"in",
"utf8",
".",
"h",
"utf8_codepointtomb"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/Utf8CharacterMapping.java#L55-L100 | train | Override toIdList to return an array of int for a single code point. | [
30522,
1030,
2058,
15637,
2270,
20014,
1031,
1033,
2000,
3593,
9863,
1006,
20014,
3642,
8400,
1007,
1063,
20014,
4175,
1025,
2065,
1006,
3642,
8400,
1026,
1014,
2595,
17914,
1007,
4175,
1027,
1015,
1025,
2842,
2065,
1006,
3642,
8400,
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-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointSerializers.java | SavepointSerializers.getSerializer | @SuppressWarnings("unchecked")
public static SavepointSerializer<?> getSerializer(int version) {
SavepointSerializer<?> serializer = SERIALIZERS.get(version);
if (serializer != null) {
return serializer;
} else {
throw new IllegalArgumentException("Cannot restore savepoint version " + version + ".");
}
} | java | @SuppressWarnings("unchecked")
public static SavepointSerializer<?> getSerializer(int version) {
SavepointSerializer<?> serializer = SERIALIZERS.get(version);
if (serializer != null) {
return serializer;
} else {
throw new IllegalArgumentException("Cannot restore savepoint version " + version + ".");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"SavepointSerializer",
"<",
"?",
">",
"getSerializer",
"(",
"int",
"version",
")",
"{",
"SavepointSerializer",
"<",
"?",
">",
"serializer",
"=",
"SERIALIZERS",
".",
"get",
"(",
"version",
... | Returns the {@link SavepointSerializer} for the given savepoint version.
@param version Savepoint version to get serializer for
@return Savepoint for the given version
@throws IllegalArgumentException If unknown savepoint version | [
"Returns",
"the",
"{",
"@link",
"SavepointSerializer",
"}",
"for",
"the",
"given",
"savepoint",
"version",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/savepoint/SavepointSerializers.java#L74-L82 | train | Get the serializer for the given version. | [
30522,
1030,
16081,
9028,
5582,
2015,
1006,
1000,
4895,
5403,
18141,
1000,
1007,
2270,
10763,
3828,
26521,
11610,
28863,
1026,
1029,
1028,
4152,
11610,
28863,
1006,
20014,
2544,
1007,
1063,
3828,
26521,
11610,
28863,
1026,
1029,
1028,
7642,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java | Sftp.cd | @Override
public boolean cd(String directory) {
if (StrUtil.isBlank(directory)) {
// 当前目录
return true;
}
try {
channel.cd(directory.replaceAll("\\\\", "/"));
return true;
} catch (SftpException e) {
return false;
}
} | java | @Override
public boolean cd(String directory) {
if (StrUtil.isBlank(directory)) {
// 当前目录
return true;
}
try {
channel.cd(directory.replaceAll("\\\\", "/"));
return true;
} catch (SftpException e) {
return false;
}
} | [
"@",
"Override",
"public",
"boolean",
"cd",
"(",
"String",
"directory",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"directory",
")",
")",
"{",
"// 当前目录\r",
"return",
"true",
";",
"}",
"try",
"{",
"channel",
".",
"cd",
"(",
"directory",
".",
... | 打开指定目录,如果指定路径非目录或不存在返回false
@param directory directory
@return 是否打开目录 | [
"打开指定目录,如果指定路径非目录或不存在返回false"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/Sftp.java#L276-L288 | train | Opens a remote file descriptor. | [
30522,
1030,
2058,
15637,
2270,
22017,
20898,
3729,
1006,
5164,
14176,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
14176,
1007,
1007,
1063,
1013,
1013,
100,
1776,
1918,
100,
2709,
2995,
1025,
1065,
3046,
1063,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.fromArgs | public static ParameterTool fromArgs(String[] args) {
final Map<String, String> map = new HashMap<>(args.length / 2);
int i = 0;
while (i < args.length) {
final String key;
if (args[i].startsWith("--")) {
key = args[i].substring(2);
} else if (args[i].startsWith("-")) {
key = args[i].substring(1);
} else {
throw new IllegalArgumentException(
String.format("Error parsing arguments '%s' on '%s'. Please prefix keys with -- or -.",
Arrays.toString(args), args[i]));
}
if (key.isEmpty()) {
throw new IllegalArgumentException(
"The input " + Arrays.toString(args) + " contains an empty argument");
}
i += 1; // try to find the value
if (i >= args.length) {
map.put(key, NO_VALUE_KEY);
} else if (NumberUtils.isNumber(args[i])) {
map.put(key, args[i]);
i += 1;
} else if (args[i].startsWith("--") || args[i].startsWith("-")) {
// the argument cannot be a negative number because we checked earlier
// -> the next argument is a parameter name
map.put(key, NO_VALUE_KEY);
} else {
map.put(key, args[i]);
i += 1;
}
}
return fromMap(map);
} | java | public static ParameterTool fromArgs(String[] args) {
final Map<String, String> map = new HashMap<>(args.length / 2);
int i = 0;
while (i < args.length) {
final String key;
if (args[i].startsWith("--")) {
key = args[i].substring(2);
} else if (args[i].startsWith("-")) {
key = args[i].substring(1);
} else {
throw new IllegalArgumentException(
String.format("Error parsing arguments '%s' on '%s'. Please prefix keys with -- or -.",
Arrays.toString(args), args[i]));
}
if (key.isEmpty()) {
throw new IllegalArgumentException(
"The input " + Arrays.toString(args) + " contains an empty argument");
}
i += 1; // try to find the value
if (i >= args.length) {
map.put(key, NO_VALUE_KEY);
} else if (NumberUtils.isNumber(args[i])) {
map.put(key, args[i]);
i += 1;
} else if (args[i].startsWith("--") || args[i].startsWith("-")) {
// the argument cannot be a negative number because we checked earlier
// -> the next argument is a parameter name
map.put(key, NO_VALUE_KEY);
} else {
map.put(key, args[i]);
i += 1;
}
}
return fromMap(map);
} | [
"public",
"static",
"ParameterTool",
"fromArgs",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
"args",
".",
"length",
"/",
"2",
")",
";",
"int",
"i",
"=",
"0",... | Returns {@link ParameterTool} for the given arguments. The arguments are keys followed by values.
Keys have to start with '-' or '--'
<p><strong>Example arguments:</strong>
--key1 value1 --key2 value2 -key3 value3
@param args Input array arguments
@return A {@link ParameterTool} | [
"Returns",
"{",
"@link",
"ParameterTool",
"}",
"for",
"the",
"given",
"arguments",
".",
"The",
"arguments",
"are",
"keys",
"followed",
"by",
"values",
".",
"Keys",
"have",
"to",
"start",
"with",
"-",
"or",
"--"
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L70-L110 | train | Parses the arguments and returns a ParameterTool object. | [
30522,
2270,
10763,
16381,
3406,
4747,
2013,
2906,
5620,
1006,
5164,
1031,
1033,
12098,
5620,
1007,
1063,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
4949,
1027,
2047,
23325,
2863,
2361,
1026,
1028,
1006,
12098,
5620,
1012,
3091,
1013,
1016,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/FixedLengthRowBasedKeyValueBatch.java | FixedLengthRowBasedKeyValueBatch.rowIterator | @Override
public org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> rowIterator() {
return new org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow>() {
private final UnsafeRow key = new UnsafeRow(keySchema.length());
private final UnsafeRow value = new UnsafeRow(valueSchema.length());
private long offsetInPage = 0;
private int recordsInPage = 0;
private boolean initialized = false;
private void init() {
if (page != null) {
offsetInPage = page.getBaseOffset();
recordsInPage = numRows;
}
initialized = true;
}
@Override
public boolean next() {
if (!initialized) init();
//searching for the next non empty page is records is now zero
if (recordsInPage == 0) {
freeCurrentPage();
return false;
}
key.pointTo(base, offsetInPage, klen);
value.pointTo(base, offsetInPage + klen, vlen);
offsetInPage += recordLength;
recordsInPage -= 1;
return true;
}
@Override
public UnsafeRow getKey() {
return key;
}
@Override
public UnsafeRow getValue() {
return value;
}
@Override
public void close() {
// do nothing
}
private void freeCurrentPage() {
if (page != null) {
freePage(page);
page = null;
}
}
};
} | java | @Override
public org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow> rowIterator() {
return new org.apache.spark.unsafe.KVIterator<UnsafeRow, UnsafeRow>() {
private final UnsafeRow key = new UnsafeRow(keySchema.length());
private final UnsafeRow value = new UnsafeRow(valueSchema.length());
private long offsetInPage = 0;
private int recordsInPage = 0;
private boolean initialized = false;
private void init() {
if (page != null) {
offsetInPage = page.getBaseOffset();
recordsInPage = numRows;
}
initialized = true;
}
@Override
public boolean next() {
if (!initialized) init();
//searching for the next non empty page is records is now zero
if (recordsInPage == 0) {
freeCurrentPage();
return false;
}
key.pointTo(base, offsetInPage, klen);
value.pointTo(base, offsetInPage + klen, vlen);
offsetInPage += recordLength;
recordsInPage -= 1;
return true;
}
@Override
public UnsafeRow getKey() {
return key;
}
@Override
public UnsafeRow getValue() {
return value;
}
@Override
public void close() {
// do nothing
}
private void freeCurrentPage() {
if (page != null) {
freePage(page);
page = null;
}
}
};
} | [
"@",
"Override",
"public",
"org",
".",
"apache",
".",
"spark",
".",
"unsafe",
".",
"KVIterator",
"<",
"UnsafeRow",
",",
"UnsafeRow",
">",
"rowIterator",
"(",
")",
"{",
"return",
"new",
"org",
".",
"apache",
".",
"spark",
".",
"unsafe",
".",
"KVIterator",... | Returns an iterator to go through all rows | [
"Returns",
"an",
"iterator",
"to",
"go",
"through",
"all",
"rows"
] | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java#L105-L163 | train | Returns an iterator over the rows of this table. | [
30522,
1030,
2058,
15637,
2270,
8917,
1012,
15895,
1012,
12125,
1012,
25135,
1012,
24888,
21646,
8844,
1026,
25135,
10524,
1010,
25135,
10524,
1028,
5216,
21646,
8844,
1006,
1007,
1063,
2709,
2047,
8917,
1012,
15895,
1012,
12125,
1012,
25135,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java | Statistics.toProperties | @Override
public final Map<String, String> toProperties() {
final DescriptorProperties properties = new DescriptorProperties();
properties.putProperties(internalProperties);
properties.putInt(STATISTICS_PROPERTY_VERSION, 1);
List<Map<String, String>> namedStats = new ArrayList<>();
for (Map.Entry<String, Map<String, String>> entry : columnStats.entrySet()) {
Map<String, String> columnStat = entry.getValue();
columnStat.put(NAME, entry.getKey());
namedStats.add(columnStat);
}
properties.putIndexedVariableProperties(STATISTICS_COLUMNS, namedStats);
return properties.asMap();
} | java | @Override
public final Map<String, String> toProperties() {
final DescriptorProperties properties = new DescriptorProperties();
properties.putProperties(internalProperties);
properties.putInt(STATISTICS_PROPERTY_VERSION, 1);
List<Map<String, String>> namedStats = new ArrayList<>();
for (Map.Entry<String, Map<String, String>> entry : columnStats.entrySet()) {
Map<String, String> columnStat = entry.getValue();
columnStat.put(NAME, entry.getKey());
namedStats.add(columnStat);
}
properties.putIndexedVariableProperties(STATISTICS_COLUMNS, namedStats);
return properties.asMap();
} | [
"@",
"Override",
"public",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"toProperties",
"(",
")",
"{",
"final",
"DescriptorProperties",
"properties",
"=",
"new",
"DescriptorProperties",
"(",
")",
";",
"properties",
".",
"putProperties",
"(",
"internalPrope... | Converts this descriptor into a set of properties. | [
"Converts",
"this",
"descriptor",
"into",
"a",
"set",
"of",
"properties",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L151-L167 | train | Returns a map of properties that can be used to write the descriptor to the output stream. | [
30522,
1030,
2058,
15637,
2270,
2345,
4949,
1026,
5164,
1010,
5164,
1028,
2327,
18981,
8743,
3111,
1006,
1007,
1063,
2345,
4078,
23235,
2953,
21572,
4842,
7368,
5144,
1027,
2047,
4078,
23235,
2953,
21572,
4842,
7368,
1006,
1007,
1025,
5144,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManagerLocation.java | TaskManagerLocation.getHostName | public static String getHostName(InetAddress inetAddress) {
String hostName;
String fqdnHostName = getFqdnHostName(inetAddress);
if (fqdnHostName.equals(inetAddress.getHostAddress())) {
// this happens when the name lookup fails, either due to an exception,
// or because no hostname can be found for the address
// take IP textual representation
hostName = fqdnHostName;
LOG.warn("No hostname could be resolved for the IP address {}, using IP address as host name. "
+ "Local input split assignment (such as for HDFS files) may be impacted.", inetAddress.getHostAddress());
} else {
hostName = NetUtils.getHostnameFromFQDN(fqdnHostName);
}
return hostName;
} | java | public static String getHostName(InetAddress inetAddress) {
String hostName;
String fqdnHostName = getFqdnHostName(inetAddress);
if (fqdnHostName.equals(inetAddress.getHostAddress())) {
// this happens when the name lookup fails, either due to an exception,
// or because no hostname can be found for the address
// take IP textual representation
hostName = fqdnHostName;
LOG.warn("No hostname could be resolved for the IP address {}, using IP address as host name. "
+ "Local input split assignment (such as for HDFS files) may be impacted.", inetAddress.getHostAddress());
} else {
hostName = NetUtils.getHostnameFromFQDN(fqdnHostName);
}
return hostName;
} | [
"public",
"static",
"String",
"getHostName",
"(",
"InetAddress",
"inetAddress",
")",
"{",
"String",
"hostName",
";",
"String",
"fqdnHostName",
"=",
"getFqdnHostName",
"(",
"inetAddress",
")",
";",
"if",
"(",
"fqdnHostName",
".",
"equals",
"(",
"inetAddress",
"."... | Gets the hostname of the TaskManager based on the network address.
@param inetAddress the network address that the TaskManager binds its sockets to
@return hostname of the TaskManager | [
"Gets",
"the",
"hostname",
"of",
"the",
"TaskManager",
"based",
"on",
"the",
"network",
"address",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManagerLocation.java#L193-L209 | train | Get the hostname of the IP address | [
30522,
2270,
10763,
5164,
2131,
15006,
2102,
18442,
1006,
1999,
12928,
14141,
8303,
1999,
12928,
14141,
8303,
1007,
1063,
5164,
3677,
18442,
1025,
5164,
1042,
4160,
2094,
25311,
14122,
18442,
1027,
2131,
2546,
4160,
2094,
25311,
14122,
18442,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/expressions/RexNodeConverter.java | RexNodeConverter.valueAsCalendar | private static Calendar valueAsCalendar(Object value) {
Date date = (Date) value;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
} | java | private static Calendar valueAsCalendar(Object value) {
Date date = (Date) value;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
} | [
"private",
"static",
"Calendar",
"valueAsCalendar",
"(",
"Object",
"value",
")",
"{",
"Date",
"date",
"=",
"(",
"Date",
")",
"value",
";",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
"... | Convert a Date value to a Calendar. Calcite's fromCalendarField functions use the
Calendar.get methods, so the raw values of the individual fields are preserved when
converted to the String formats.
@return get the Calendar value | [
"Convert",
"a",
"Date",
"value",
"to",
"a",
"Calendar",
".",
"Calcite",
"s",
"fromCalendarField",
"functions",
"use",
"the",
"Calendar",
".",
"get",
"methods",
"so",
"the",
"raw",
"values",
"of",
"the",
"individual",
"fields",
"are",
"preserved",
"when",
"co... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/expressions/RexNodeConverter.java#L234-L239 | train | Convert value to Calendar. | [
30522,
2797,
10763,
8094,
3643,
3022,
9289,
10497,
2906,
1006,
4874,
3643,
1007,
1063,
3058,
3058,
1027,
1006,
3058,
1007,
3643,
1025,
8094,
10250,
1027,
8094,
1012,
2131,
7076,
26897,
1006,
1007,
1025,
10250,
1012,
2275,
7292,
1006,
3058,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/misc/HighwayHash.java | HighwayHash.hash128 | public static long[] hash128(
byte[] data, int offset, int length, long[] key) {
HighwayHash h = new HighwayHash(key);
h.processAll(data, offset, length);
return h.finalize128();
} | java | public static long[] hash128(
byte[] data, int offset, int length, long[] key) {
HighwayHash h = new HighwayHash(key);
h.processAll(data, offset, length);
return h.finalize128();
} | [
"public",
"static",
"long",
"[",
"]",
"hash128",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"long",
"[",
"]",
"key",
")",
"{",
"HighwayHash",
"h",
"=",
"new",
"HighwayHash",
"(",
"key",
")",
";",
"h",
".",
"pr... | NOTE: The 128-bit HighwayHash algorithm is not yet frozen and subject to change.
@param data array with data bytes
@param offset position of first byte of data to read from
@param length number of bytes from data to read
@param key array of size 4 with the key to initialize the hash with
@return array of size 2 containing 128-bit hash for the given data | [
"NOTE",
":",
"The",
"128",
"-",
"bit",
"HighwayHash",
"algorithm",
"is",
"not",
"yet",
"frozen",
"and",
"subject",
"to",
"change",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/misc/HighwayHash.java#L305-L310 | train | Hash 128 - bit bytes. | [
30522,
2270,
10763,
2146,
1031,
1033,
23325,
12521,
2620,
1006,
24880,
1031,
1033,
2951,
1010,
20014,
16396,
1010,
20014,
3091,
1010,
2146,
1031,
1033,
3145,
1007,
1063,
3307,
14949,
2232,
1044,
1027,
2047,
3307,
14949,
2232,
1006,
3145,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/spark | common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java | LevelDB.db | DB db() {
DB _db = this._db.get();
if (_db == null) {
throw new IllegalStateException("DB is closed.");
}
return _db;
} | java | DB db() {
DB _db = this._db.get();
if (_db == null) {
throw new IllegalStateException("DB is closed.");
}
return _db;
} | [
"DB",
"db",
"(",
")",
"{",
"DB",
"_db",
"=",
"this",
".",
"_db",
".",
"get",
"(",
")",
";",
"if",
"(",
"_db",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"DB is closed.\"",
")",
";",
"}",
"return",
"_db",
";",
"}"
] | Try to avoid use-after close since that has the tendency of crashing the JVM. This doesn't
prevent methods that retrieved the instance from using it after close, but hopefully will
catch most cases; otherwise, we'll need some kind of locking. | [
"Try",
"to",
"avoid",
"use",
"-",
"after",
"close",
"since",
"that",
"has",
"the",
"tendency",
"of",
"crashing",
"the",
"JVM",
".",
"This",
"doesn",
"t",
"prevent",
"methods",
"that",
"retrieved",
"the",
"instance",
"from",
"using",
"it",
"after",
"close",... | 25ee0474f47d9c30d6f553a7892d9549f91071cf | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java#L264-L270 | train | Get the DB object. | [
30522,
16962,
16962,
1006,
1007,
1063,
16962,
1035,
16962,
1027,
2023,
1012,
1035,
16962,
1012,
2131,
1006,
1007,
1025,
2065,
1006,
1035,
16962,
1027,
1027,
19701,
1007,
1063,
5466,
2047,
6206,
9153,
17389,
2595,
24422,
1006,
1000,
16962,
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... |
redisson/redisson | redisson/src/main/java/org/redisson/config/Config.java | Config.fromYAML | public static Config fromYAML(InputStream inputStream) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromYAML(inputStream, Config.class);
} | java | public static Config fromYAML(InputStream inputStream) throws IOException {
ConfigSupport support = new ConfigSupport();
return support.fromYAML(inputStream, Config.class);
} | [
"public",
"static",
"Config",
"fromYAML",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"ConfigSupport",
"support",
"=",
"new",
"ConfigSupport",
"(",
")",
";",
"return",
"support",
".",
"fromYAML",
"(",
"inputStream",
",",
"Config",
".",
... | Read config object stored in YAML format from <code>InputStream</code>
@param inputStream object
@return config
@throws IOException error | [
"Read",
"config",
"object",
"stored",
"in",
"YAML",
"format",
"from",
"<code",
">",
"InputStream<",
"/",
"code",
">"
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/Config.java#L651-L654 | train | Creates a Config object from a YAML input stream. | [
30522,
2270,
10763,
9530,
8873,
2290,
2013,
14852,
2140,
1006,
20407,
25379,
20407,
25379,
1007,
11618,
22834,
10288,
24422,
1063,
9530,
8873,
5620,
6279,
6442,
2490,
1027,
2047,
9530,
8873,
5620,
6279,
6442,
1006,
1007,
1025,
2709,
2490,
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-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java | SqlValidatorImpl.registerQuery | private void registerQuery(
SqlValidatorScope parentScope,
SqlValidatorScope usingScope,
SqlNode node,
SqlNode enclosingNode,
String alias,
boolean forceNullable,
boolean checkUpdate) {
Objects.requireNonNull(node);
Objects.requireNonNull(enclosingNode);
Preconditions.checkArgument(usingScope == null || alias != null);
SqlCall call;
List<SqlNode> operands;
switch (node.getKind()) {
case SELECT:
final SqlSelect select = (SqlSelect) node;
final SelectNamespace selectNs =
createSelectNamespace(select, enclosingNode);
registerNamespace(usingScope, alias, selectNs, forceNullable);
final SqlValidatorScope windowParentScope =
(usingScope != null) ? usingScope : parentScope;
SelectScope selectScope =
new SelectScope(parentScope, windowParentScope, select);
scopes.put(select, selectScope);
// Start by registering the WHERE clause
whereScopes.put(select, selectScope);
registerOperandSubQueries(
selectScope,
select,
SqlSelect.WHERE_OPERAND);
// Register FROM with the inherited scope 'parentScope', not
// 'selectScope', otherwise tables in the FROM clause would be
// able to see each other.
final SqlNode from = select.getFrom();
if (from != null) {
final SqlNode newFrom =
registerFrom(
parentScope,
selectScope,
true,
from,
from,
null,
null,
false,
false);
if (newFrom != from) {
select.setFrom(newFrom);
}
}
// If this is an aggregating query, the SELECT list and HAVING
// clause use a different scope, where you can only reference
// columns which are in the GROUP BY clause.
SqlValidatorScope aggScope = selectScope;
if (isAggregate(select)) {
aggScope =
new AggregatingSelectScope(selectScope, select, false);
selectScopes.put(select, aggScope);
} else {
selectScopes.put(select, selectScope);
}
if (select.getGroup() != null) {
GroupByScope groupByScope =
new GroupByScope(selectScope, select.getGroup(), select);
groupByScopes.put(select, groupByScope);
registerSubQueries(groupByScope, select.getGroup());
}
registerOperandSubQueries(
aggScope,
select,
SqlSelect.HAVING_OPERAND);
registerSubQueries(aggScope, select.getSelectList());
final SqlNodeList orderList = select.getOrderList();
if (orderList != null) {
// If the query is 'SELECT DISTINCT', restrict the columns
// available to the ORDER BY clause.
if (select.isDistinct()) {
aggScope =
new AggregatingSelectScope(selectScope, select, true);
}
OrderByScope orderScope =
new OrderByScope(aggScope, orderList, select);
orderScopes.put(select, orderScope);
registerSubQueries(orderScope, orderList);
if (!isAggregate(select)) {
// Since this is not an aggregating query,
// there cannot be any aggregates in the ORDER BY clause.
SqlNode agg = aggFinder.findAgg(orderList);
if (agg != null) {
throw newValidationError(agg, RESOURCE.aggregateIllegalInOrderBy());
}
}
}
break;
case INTERSECT:
validateFeature(RESOURCE.sQLFeature_F302(), node.getParserPosition());
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case EXCEPT:
validateFeature(RESOURCE.sQLFeature_E071_03(), node.getParserPosition());
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case UNION:
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case WITH:
registerWith(parentScope, usingScope, (SqlWith) node, enclosingNode,
alias, forceNullable, checkUpdate);
break;
case VALUES:
call = (SqlCall) node;
scopes.put(call, parentScope);
final TableConstructorNamespace tableConstructorNamespace =
new TableConstructorNamespace(
this,
call,
parentScope,
enclosingNode);
registerNamespace(
usingScope,
alias,
tableConstructorNamespace,
forceNullable);
operands = call.getOperandList();
for (int i = 0; i < operands.size(); ++i) {
assert operands.get(i).getKind() == SqlKind.ROW;
// FIXME jvs 9-Feb-2005: Correlation should
// be illegal in these sub-queries. Same goes for
// any non-lateral SELECT in the FROM list.
registerOperandSubQueries(parentScope, call, i);
}
break;
case INSERT:
SqlInsert insertCall = (SqlInsert) node;
InsertNamespace insertNs =
new InsertNamespace(
this,
insertCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, insertNs, forceNullable);
registerQuery(
parentScope,
usingScope,
insertCall.getSource(),
enclosingNode,
null,
false);
break;
case DELETE:
SqlDelete deleteCall = (SqlDelete) node;
DeleteNamespace deleteNs =
new DeleteNamespace(
this,
deleteCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, deleteNs, forceNullable);
registerQuery(
parentScope,
usingScope,
deleteCall.getSourceSelect(),
enclosingNode,
null,
false);
break;
case UPDATE:
if (checkUpdate) {
validateFeature(RESOURCE.sQLFeature_E101_03(),
node.getParserPosition());
}
SqlUpdate updateCall = (SqlUpdate) node;
UpdateNamespace updateNs =
new UpdateNamespace(
this,
updateCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, updateNs, forceNullable);
registerQuery(
parentScope,
usingScope,
updateCall.getSourceSelect(),
enclosingNode,
null,
false);
break;
case MERGE:
validateFeature(RESOURCE.sQLFeature_F312(), node.getParserPosition());
SqlMerge mergeCall = (SqlMerge) node;
MergeNamespace mergeNs =
new MergeNamespace(
this,
mergeCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, mergeNs, forceNullable);
registerQuery(
parentScope,
usingScope,
mergeCall.getSourceSelect(),
enclosingNode,
null,
false);
// update call can reference either the source table reference
// or the target table, so set its parent scope to the merge's
// source select; when validating the update, skip the feature
// validation check
if (mergeCall.getUpdateCall() != null) {
registerQuery(
whereScopes.get(mergeCall.getSourceSelect()),
null,
mergeCall.getUpdateCall(),
enclosingNode,
null,
false,
false);
}
if (mergeCall.getInsertCall() != null) {
registerQuery(
parentScope,
null,
mergeCall.getInsertCall(),
enclosingNode,
null,
false);
}
break;
case UNNEST:
call = (SqlCall) node;
final UnnestNamespace unnestNs =
new UnnestNamespace(this, call, parentScope, enclosingNode);
registerNamespace(
usingScope,
alias,
unnestNs,
forceNullable);
registerOperandSubQueries(parentScope, call, 0);
scopes.put(node, parentScope);
break;
case OTHER_FUNCTION:
call = (SqlCall) node;
ProcedureNamespace procNs =
new ProcedureNamespace(
this,
parentScope,
call,
enclosingNode);
registerNamespace(
usingScope,
alias,
procNs,
forceNullable);
registerSubQueries(parentScope, call);
break;
case MULTISET_QUERY_CONSTRUCTOR:
case MULTISET_VALUE_CONSTRUCTOR:
validateFeature(RESOURCE.sQLFeature_S271(), node.getParserPosition());
call = (SqlCall) node;
CollectScope cs = new CollectScope(parentScope, usingScope, call);
final CollectNamespace tableConstructorNs =
new CollectNamespace(call, cs, enclosingNode);
final String alias2 = deriveAlias(node, nextGeneratedId++);
registerNamespace(
usingScope,
alias2,
tableConstructorNs,
forceNullable);
operands = call.getOperandList();
for (int i = 0; i < operands.size(); i++) {
registerOperandSubQueries(parentScope, call, i);
}
break;
default:
throw Util.unexpected(node.getKind());
}
} | java | private void registerQuery(
SqlValidatorScope parentScope,
SqlValidatorScope usingScope,
SqlNode node,
SqlNode enclosingNode,
String alias,
boolean forceNullable,
boolean checkUpdate) {
Objects.requireNonNull(node);
Objects.requireNonNull(enclosingNode);
Preconditions.checkArgument(usingScope == null || alias != null);
SqlCall call;
List<SqlNode> operands;
switch (node.getKind()) {
case SELECT:
final SqlSelect select = (SqlSelect) node;
final SelectNamespace selectNs =
createSelectNamespace(select, enclosingNode);
registerNamespace(usingScope, alias, selectNs, forceNullable);
final SqlValidatorScope windowParentScope =
(usingScope != null) ? usingScope : parentScope;
SelectScope selectScope =
new SelectScope(parentScope, windowParentScope, select);
scopes.put(select, selectScope);
// Start by registering the WHERE clause
whereScopes.put(select, selectScope);
registerOperandSubQueries(
selectScope,
select,
SqlSelect.WHERE_OPERAND);
// Register FROM with the inherited scope 'parentScope', not
// 'selectScope', otherwise tables in the FROM clause would be
// able to see each other.
final SqlNode from = select.getFrom();
if (from != null) {
final SqlNode newFrom =
registerFrom(
parentScope,
selectScope,
true,
from,
from,
null,
null,
false,
false);
if (newFrom != from) {
select.setFrom(newFrom);
}
}
// If this is an aggregating query, the SELECT list and HAVING
// clause use a different scope, where you can only reference
// columns which are in the GROUP BY clause.
SqlValidatorScope aggScope = selectScope;
if (isAggregate(select)) {
aggScope =
new AggregatingSelectScope(selectScope, select, false);
selectScopes.put(select, aggScope);
} else {
selectScopes.put(select, selectScope);
}
if (select.getGroup() != null) {
GroupByScope groupByScope =
new GroupByScope(selectScope, select.getGroup(), select);
groupByScopes.put(select, groupByScope);
registerSubQueries(groupByScope, select.getGroup());
}
registerOperandSubQueries(
aggScope,
select,
SqlSelect.HAVING_OPERAND);
registerSubQueries(aggScope, select.getSelectList());
final SqlNodeList orderList = select.getOrderList();
if (orderList != null) {
// If the query is 'SELECT DISTINCT', restrict the columns
// available to the ORDER BY clause.
if (select.isDistinct()) {
aggScope =
new AggregatingSelectScope(selectScope, select, true);
}
OrderByScope orderScope =
new OrderByScope(aggScope, orderList, select);
orderScopes.put(select, orderScope);
registerSubQueries(orderScope, orderList);
if (!isAggregate(select)) {
// Since this is not an aggregating query,
// there cannot be any aggregates in the ORDER BY clause.
SqlNode agg = aggFinder.findAgg(orderList);
if (agg != null) {
throw newValidationError(agg, RESOURCE.aggregateIllegalInOrderBy());
}
}
}
break;
case INTERSECT:
validateFeature(RESOURCE.sQLFeature_F302(), node.getParserPosition());
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case EXCEPT:
validateFeature(RESOURCE.sQLFeature_E071_03(), node.getParserPosition());
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case UNION:
registerSetop(
parentScope,
usingScope,
node,
node,
alias,
forceNullable);
break;
case WITH:
registerWith(parentScope, usingScope, (SqlWith) node, enclosingNode,
alias, forceNullable, checkUpdate);
break;
case VALUES:
call = (SqlCall) node;
scopes.put(call, parentScope);
final TableConstructorNamespace tableConstructorNamespace =
new TableConstructorNamespace(
this,
call,
parentScope,
enclosingNode);
registerNamespace(
usingScope,
alias,
tableConstructorNamespace,
forceNullable);
operands = call.getOperandList();
for (int i = 0; i < operands.size(); ++i) {
assert operands.get(i).getKind() == SqlKind.ROW;
// FIXME jvs 9-Feb-2005: Correlation should
// be illegal in these sub-queries. Same goes for
// any non-lateral SELECT in the FROM list.
registerOperandSubQueries(parentScope, call, i);
}
break;
case INSERT:
SqlInsert insertCall = (SqlInsert) node;
InsertNamespace insertNs =
new InsertNamespace(
this,
insertCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, insertNs, forceNullable);
registerQuery(
parentScope,
usingScope,
insertCall.getSource(),
enclosingNode,
null,
false);
break;
case DELETE:
SqlDelete deleteCall = (SqlDelete) node;
DeleteNamespace deleteNs =
new DeleteNamespace(
this,
deleteCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, deleteNs, forceNullable);
registerQuery(
parentScope,
usingScope,
deleteCall.getSourceSelect(),
enclosingNode,
null,
false);
break;
case UPDATE:
if (checkUpdate) {
validateFeature(RESOURCE.sQLFeature_E101_03(),
node.getParserPosition());
}
SqlUpdate updateCall = (SqlUpdate) node;
UpdateNamespace updateNs =
new UpdateNamespace(
this,
updateCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, updateNs, forceNullable);
registerQuery(
parentScope,
usingScope,
updateCall.getSourceSelect(),
enclosingNode,
null,
false);
break;
case MERGE:
validateFeature(RESOURCE.sQLFeature_F312(), node.getParserPosition());
SqlMerge mergeCall = (SqlMerge) node;
MergeNamespace mergeNs =
new MergeNamespace(
this,
mergeCall,
enclosingNode,
parentScope);
registerNamespace(usingScope, null, mergeNs, forceNullable);
registerQuery(
parentScope,
usingScope,
mergeCall.getSourceSelect(),
enclosingNode,
null,
false);
// update call can reference either the source table reference
// or the target table, so set its parent scope to the merge's
// source select; when validating the update, skip the feature
// validation check
if (mergeCall.getUpdateCall() != null) {
registerQuery(
whereScopes.get(mergeCall.getSourceSelect()),
null,
mergeCall.getUpdateCall(),
enclosingNode,
null,
false,
false);
}
if (mergeCall.getInsertCall() != null) {
registerQuery(
parentScope,
null,
mergeCall.getInsertCall(),
enclosingNode,
null,
false);
}
break;
case UNNEST:
call = (SqlCall) node;
final UnnestNamespace unnestNs =
new UnnestNamespace(this, call, parentScope, enclosingNode);
registerNamespace(
usingScope,
alias,
unnestNs,
forceNullable);
registerOperandSubQueries(parentScope, call, 0);
scopes.put(node, parentScope);
break;
case OTHER_FUNCTION:
call = (SqlCall) node;
ProcedureNamespace procNs =
new ProcedureNamespace(
this,
parentScope,
call,
enclosingNode);
registerNamespace(
usingScope,
alias,
procNs,
forceNullable);
registerSubQueries(parentScope, call);
break;
case MULTISET_QUERY_CONSTRUCTOR:
case MULTISET_VALUE_CONSTRUCTOR:
validateFeature(RESOURCE.sQLFeature_S271(), node.getParserPosition());
call = (SqlCall) node;
CollectScope cs = new CollectScope(parentScope, usingScope, call);
final CollectNamespace tableConstructorNs =
new CollectNamespace(call, cs, enclosingNode);
final String alias2 = deriveAlias(node, nextGeneratedId++);
registerNamespace(
usingScope,
alias2,
tableConstructorNs,
forceNullable);
operands = call.getOperandList();
for (int i = 0; i < operands.size(); i++) {
registerOperandSubQueries(parentScope, call, i);
}
break;
default:
throw Util.unexpected(node.getKind());
}
} | [
"private",
"void",
"registerQuery",
"(",
"SqlValidatorScope",
"parentScope",
",",
"SqlValidatorScope",
"usingScope",
",",
"SqlNode",
"node",
",",
"SqlNode",
"enclosingNode",
",",
"String",
"alias",
",",
"boolean",
"forceNullable",
",",
"boolean",
"checkUpdate",
")",
... | Registers a query in a parent scope.
@param parentScope Parent scope which this scope turns to in order to
resolve objects
@param usingScope Scope whose child list this scope should add itself to
@param node Query node
@param alias Name of this query within its parent. Must be specified
if usingScope != null
@param checkUpdate if true, validate that the update feature is supported
if validating the update statement | [
"Registers",
"a",
"query",
"in",
"a",
"parent",
"scope",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L2371-L2685 | train | Register a query with the appropriate scope. | [
30522,
2797,
11675,
4236,
4226,
2854,
1006,
29296,
10175,
8524,
6591,
16186,
3008,
16186,
1010,
29296,
10175,
8524,
6591,
16186,
2478,
26127,
1010,
29296,
3630,
3207,
13045,
1010,
29296,
3630,
3207,
4372,
20464,
18606,
3630,
3207,
1010,
5164,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/DbUtil.java | DbUtil.setShowSqlGlobal | public static void setShowSqlGlobal(Setting setting) {
// 初始化SQL显示
final boolean isShowSql = Convert.toBool(setting.remove("showSql"), false);
final boolean isFormatSql = Convert.toBool(setting.remove("formatSql"), false);
final boolean isShowParams = Convert.toBool(setting.remove("showParams"), false);
String sqlLevelStr = setting.remove("sqlLevel");
if (null != sqlLevelStr) {
sqlLevelStr = sqlLevelStr.toUpperCase();
}
final Level level = Convert.toEnum(Level.class, sqlLevelStr, Level.DEBUG);
log.debug("Show sql: [{}], format sql: [{}], show params: [{}], level: [{}]", isShowSql, isFormatSql, isShowParams, level);
setShowSqlGlobal(isShowSql, isFormatSql, isShowParams, level);
} | java | public static void setShowSqlGlobal(Setting setting) {
// 初始化SQL显示
final boolean isShowSql = Convert.toBool(setting.remove("showSql"), false);
final boolean isFormatSql = Convert.toBool(setting.remove("formatSql"), false);
final boolean isShowParams = Convert.toBool(setting.remove("showParams"), false);
String sqlLevelStr = setting.remove("sqlLevel");
if (null != sqlLevelStr) {
sqlLevelStr = sqlLevelStr.toUpperCase();
}
final Level level = Convert.toEnum(Level.class, sqlLevelStr, Level.DEBUG);
log.debug("Show sql: [{}], format sql: [{}], show params: [{}], level: [{}]", isShowSql, isFormatSql, isShowParams, level);
setShowSqlGlobal(isShowSql, isFormatSql, isShowParams, level);
} | [
"public",
"static",
"void",
"setShowSqlGlobal",
"(",
"Setting",
"setting",
")",
"{",
"// 初始化SQL显示\r",
"final",
"boolean",
"isShowSql",
"=",
"Convert",
".",
"toBool",
"(",
"setting",
".",
"remove",
"(",
"\"showSql\"",
")",
",",
"false",
")",
";",
"final",
"bo... | 从配置文件中读取SQL打印选项
@param setting 配置文件
@since 4.1.7 | [
"从配置文件中读取SQL打印选项"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DbUtil.java#L236-L248 | train | Sets the showSql global setting. | [
30522,
2270,
10763,
11675,
4520,
14406,
2015,
4160,
2140,
23296,
16429,
2389,
1006,
4292,
4292,
1007,
1063,
1013,
1013,
100,
100,
100,
29296,
100,
1923,
2345,
22017,
20898,
26354,
14406,
2015,
4160,
2140,
1027,
10463,
1012,
2000,
5092,
4747... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java | SqlLikeUtils.sqlToRegexSimilar | static String sqlToRegexSimilar(
String sqlPattern,
char escapeChar) {
similarEscapeRuleChecking(sqlPattern, escapeChar);
boolean insideCharacterEnumeration = false;
final StringBuilder javaPattern =
new StringBuilder(sqlPattern.length() * 2);
final int len = sqlPattern.length();
for (int i = 0; i < len; i++) {
char c = sqlPattern.charAt(i);
if (c == escapeChar) {
if (i == (len - 1)) {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
char nextChar = sqlPattern.charAt(i + 1);
if (SQL_SIMILAR_SPECIALS.indexOf(nextChar) >= 0) {
// special character, use \ to replace the escape char.
if (JAVA_REGEX_SPECIALS.indexOf(nextChar) >= 0) {
javaPattern.append('\\');
}
javaPattern.append(nextChar);
} else if (nextChar == escapeChar) {
javaPattern.append(nextChar);
} else {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
i++; // we already process the next char.
} else {
switch (c) {
case '_':
javaPattern.append('.');
break;
case '%':
javaPattern.append("(?s:.*)");
break;
case '[':
javaPattern.append('[');
insideCharacterEnumeration = true;
i = sqlSimilarRewriteCharEnumeration(
sqlPattern,
javaPattern,
i,
escapeChar);
break;
case ']':
if (!insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, i);
}
insideCharacterEnumeration = false;
javaPattern.append(']');
break;
case '\\':
javaPattern.append("\\\\");
break;
case '$':
// $ is special character in java regex, but regular in
// SQL regex.
javaPattern.append("\\$");
break;
default:
javaPattern.append(c);
}
}
}
if (insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, len);
}
return javaPattern.toString();
} | java | static String sqlToRegexSimilar(
String sqlPattern,
char escapeChar) {
similarEscapeRuleChecking(sqlPattern, escapeChar);
boolean insideCharacterEnumeration = false;
final StringBuilder javaPattern =
new StringBuilder(sqlPattern.length() * 2);
final int len = sqlPattern.length();
for (int i = 0; i < len; i++) {
char c = sqlPattern.charAt(i);
if (c == escapeChar) {
if (i == (len - 1)) {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
char nextChar = sqlPattern.charAt(i + 1);
if (SQL_SIMILAR_SPECIALS.indexOf(nextChar) >= 0) {
// special character, use \ to replace the escape char.
if (JAVA_REGEX_SPECIALS.indexOf(nextChar) >= 0) {
javaPattern.append('\\');
}
javaPattern.append(nextChar);
} else if (nextChar == escapeChar) {
javaPattern.append(nextChar);
} else {
// It should never reach here after the escape rule
// checking.
throw invalidEscapeSequence(sqlPattern, i);
}
i++; // we already process the next char.
} else {
switch (c) {
case '_':
javaPattern.append('.');
break;
case '%':
javaPattern.append("(?s:.*)");
break;
case '[':
javaPattern.append('[');
insideCharacterEnumeration = true;
i = sqlSimilarRewriteCharEnumeration(
sqlPattern,
javaPattern,
i,
escapeChar);
break;
case ']':
if (!insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, i);
}
insideCharacterEnumeration = false;
javaPattern.append(']');
break;
case '\\':
javaPattern.append("\\\\");
break;
case '$':
// $ is special character in java regex, but regular in
// SQL regex.
javaPattern.append("\\$");
break;
default:
javaPattern.append(c);
}
}
}
if (insideCharacterEnumeration) {
throw invalidRegularExpression(sqlPattern, len);
}
return javaPattern.toString();
} | [
"static",
"String",
"sqlToRegexSimilar",
"(",
"String",
"sqlPattern",
",",
"char",
"escapeChar",
")",
"{",
"similarEscapeRuleChecking",
"(",
"sqlPattern",
",",
"escapeChar",
")",
";",
"boolean",
"insideCharacterEnumeration",
"=",
"false",
";",
"final",
"StringBuilder"... | Translates SQL SIMILAR pattern to Java regex pattern. | [
"Translates",
"SQL",
"SIMILAR",
"pattern",
"to",
"Java",
"regex",
"pattern",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlLikeUtils.java#L231-L306 | train | Converts SQL pattern to regular expression similar. | [
30522,
10763,
5164,
29296,
19277,
3351,
2595,
5332,
4328,
8017,
1006,
5164,
29296,
4502,
12079,
2078,
1010,
25869,
4019,
7507,
2099,
1007,
1063,
2714,
2229,
19464,
6820,
2571,
5403,
23177,
1006,
29296,
4502,
12079,
2078,
1010,
4019,
7507,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/util/LinkedOptionalMap.java | LinkedOptionalMap.unwrapOptionals | public LinkedHashMap<K, V> unwrapOptionals() {
final LinkedHashMap<K, V> unwrapped = new LinkedHashMap<>(underlyingMap.size());
for (Entry<String, KeyValue<K, V>> entry : underlyingMap.entrySet()) {
String namedKey = entry.getKey();
KeyValue<K, V> kv = entry.getValue();
if (kv.key == null) {
throw new IllegalStateException("Missing key '" + namedKey + "'");
}
if (kv.value == null) {
throw new IllegalStateException("Missing value for the key '" + namedKey + "'");
}
unwrapped.put(kv.key, kv.value);
}
return unwrapped;
} | java | public LinkedHashMap<K, V> unwrapOptionals() {
final LinkedHashMap<K, V> unwrapped = new LinkedHashMap<>(underlyingMap.size());
for (Entry<String, KeyValue<K, V>> entry : underlyingMap.entrySet()) {
String namedKey = entry.getKey();
KeyValue<K, V> kv = entry.getValue();
if (kv.key == null) {
throw new IllegalStateException("Missing key '" + namedKey + "'");
}
if (kv.value == null) {
throw new IllegalStateException("Missing value for the key '" + namedKey + "'");
}
unwrapped.put(kv.key, kv.value);
}
return unwrapped;
} | [
"public",
"LinkedHashMap",
"<",
"K",
",",
"V",
">",
"unwrapOptionals",
"(",
")",
"{",
"final",
"LinkedHashMap",
"<",
"K",
",",
"V",
">",
"unwrapped",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
"underlyingMap",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
... | Assuming all the entries of this map are present (keys and values) this method would return
a map with these key and values, stripped from their Optional wrappers.
NOTE: please note that if any of the key or values are absent this method would throw an {@link IllegalStateException}. | [
"Assuming",
"all",
"the",
"entries",
"of",
"this",
"map",
"are",
"present",
"(",
"keys",
"and",
"values",
")",
"this",
"method",
"would",
"return",
"a",
"map",
"with",
"these",
"key",
"and",
"values",
"stripped",
"from",
"their",
"Optional",
"wrappers",
".... | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/LinkedOptionalMap.java#L180-L195 | train | Unwraps the options of the map. | [
30522,
2270,
5799,
14949,
22444,
2361,
1026,
1047,
1010,
1058,
1028,
4895,
13088,
9331,
7361,
3508,
9777,
1006,
1007,
1063,
2345,
5799,
14949,
22444,
2361,
1026,
1047,
1010,
1058,
1028,
4895,
13088,
29098,
2098,
1027,
2047,
5799,
14949,
224... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/seg/DictionaryBasedSegment.java | DictionaryBasedSegment.posTag | protected void posTag(char[] charArray, int[] wordNet, Nature[] natureArray)
{
if (config.speechTagging)
{
for (int i = 0; i < natureArray.length; )
{
if (natureArray[i] == null)
{
int j = i + 1;
for (; j < natureArray.length; ++j)
{
if (natureArray[j] != null) break;
}
List<AtomNode> atomNodeList = quickAtomSegment(charArray, i, j);
for (AtomNode atomNode : atomNodeList)
{
if (atomNode.sWord.length() >= wordNet[i])
{
wordNet[i] = atomNode.sWord.length();
natureArray[i] = atomNode.getNature();
i += wordNet[i];
}
}
i = j;
}
else
{
++i;
}
}
}
} | java | protected void posTag(char[] charArray, int[] wordNet, Nature[] natureArray)
{
if (config.speechTagging)
{
for (int i = 0; i < natureArray.length; )
{
if (natureArray[i] == null)
{
int j = i + 1;
for (; j < natureArray.length; ++j)
{
if (natureArray[j] != null) break;
}
List<AtomNode> atomNodeList = quickAtomSegment(charArray, i, j);
for (AtomNode atomNode : atomNodeList)
{
if (atomNode.sWord.length() >= wordNet[i])
{
wordNet[i] = atomNode.sWord.length();
natureArray[i] = atomNode.getNature();
i += wordNet[i];
}
}
i = j;
}
else
{
++i;
}
}
}
} | [
"protected",
"void",
"posTag",
"(",
"char",
"[",
"]",
"charArray",
",",
"int",
"[",
"]",
"wordNet",
",",
"Nature",
"[",
"]",
"natureArray",
")",
"{",
"if",
"(",
"config",
".",
"speechTagging",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | 词性标注
@param charArray 字符数组
@param wordNet 词语长度
@param natureArray 输出词性 | [
"词性标注"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/DictionaryBasedSegment.java#L46-L77 | train | posTag Method. | [
30522,
5123,
11675,
2695,
8490,
1006,
25869,
1031,
1033,
25869,
2906,
9447,
1010,
20014,
1031,
1033,
2773,
7159,
1010,
3267,
1031,
1033,
3267,
2906,
9447,
1007,
1063,
2065,
1006,
9530,
8873,
2290,
1012,
4613,
15900,
4726,
1007,
1063,
2005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.file | public static File file(File parent, String path) {
if (StrUtil.isBlank(path)) {
throw new NullPointerException("File path is blank!");
}
return checkSlip(parent, new File(parent, path));
} | java | public static File file(File parent, String path) {
if (StrUtil.isBlank(path)) {
throw new NullPointerException("File path is blank!");
}
return checkSlip(parent, new File(parent, path));
} | [
"public",
"static",
"File",
"file",
"(",
"File",
"parent",
",",
"String",
"path",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"path",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"File path is blank!\"",
")",
";",
"}",
"return",
... | 创建File对象<br>
此方法会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/
@param parent 父文件对象
@param path 文件路径
@return File | [
"创建File对象<br",
">",
"此方法会检查slip漏洞,漏洞说明见http",
":",
"//",
"blog",
".",
"nsfocus",
".",
"net",
"/",
"zip",
"-",
"slip",
"-",
"2",
"/"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L341-L346 | train | Creates a new file from the given parent file and path. | [
30522,
2270,
10763,
5371,
5371,
1006,
5371,
6687,
1010,
5164,
4130,
1007,
1063,
2065,
1006,
2358,
22134,
4014,
1012,
2003,
28522,
8950,
1006,
4130,
1007,
1007,
1063,
5466,
2047,
19701,
8400,
7869,
2595,
24422,
1006,
1000,
5371,
4130,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/utility/ByteUtil.java | ByteUtil.bytesHighFirstToInt | public static int bytesHighFirstToInt(byte[] bytes, int start)
{
int num = bytes[start + 3] & 0xFF;
num |= ((bytes[start + 2] << 8) & 0xFF00);
num |= ((bytes[start + 1] << 16) & 0xFF0000);
num |= ((bytes[start] << 24) & 0xFF000000);
return num;
} | java | public static int bytesHighFirstToInt(byte[] bytes, int start)
{
int num = bytes[start + 3] & 0xFF;
num |= ((bytes[start + 2] << 8) & 0xFF00);
num |= ((bytes[start + 1] << 16) & 0xFF0000);
num |= ((bytes[start] << 24) & 0xFF000000);
return num;
} | [
"public",
"static",
"int",
"bytesHighFirstToInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"start",
")",
"{",
"int",
"num",
"=",
"bytes",
"[",
"start",
"+",
"3",
"]",
"&",
"0xFF",
";",
"num",
"|=",
"(",
"(",
"bytes",
"[",
"start",
"+",
"2",
"]... | 字节数组和整型的转换,高位在前,适用于读取writeInt的数据
@param bytes 字节数组
@return 整型 | [
"字节数组和整型的转换,高位在前,适用于读取writeInt的数据"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/utility/ByteUtil.java#L237-L244 | train | Get the high - first int from the bytes array. | [
30522,
2270,
10763,
20014,
27507,
4048,
5603,
8873,
12096,
3406,
18447,
1006,
24880,
1031,
1033,
27507,
1010,
20014,
2707,
1007,
1063,
20014,
16371,
2213,
1027,
27507,
1031,
2707,
1009,
1017,
1033,
1004,
1014,
2595,
4246,
1025,
16371,
2213,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/api/MapOptions.java | MapOptions.writer | public MapOptions<K, V> writer(MapWriter<K, V> writer) {
this.writer = writer;
return this;
} | java | public MapOptions<K, V> writer(MapWriter<K, V> writer) {
this.writer = writer;
return this;
} | [
"public",
"MapOptions",
"<",
"K",
",",
"V",
">",
"writer",
"(",
"MapWriter",
"<",
"K",
",",
"V",
">",
"writer",
")",
"{",
"this",
".",
"writer",
"=",
"writer",
";",
"return",
"this",
";",
"}"
] | Sets {@link MapWriter} object.
@param writer object
@return MapOptions instance | [
"Sets",
"{",
"@link",
"MapWriter",
"}",
"object",
"."
] | d3acc0249b2d5d658d36d99e2c808ce49332ea44 | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/MapOptions.java#L85-L88 | train | Sets the map writer. | [
30522,
2270,
4949,
7361,
9285,
1026,
1047,
1010,
1058,
1028,
3213,
1006,
4949,
15994,
1026,
1047,
1010,
1058,
1028,
3213,
1007,
1063,
2023,
1012,
3213,
1027,
3213,
1025,
2709,
2023,
1025,
1065,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassLoaderUtil.java | ClassLoaderUtil.loadPrimitiveClass | public static Class<?> loadPrimitiveClass(String name) {
Class<?> result = null;
if (StrUtil.isNotBlank(name)) {
name = name.trim();
if (name.length() <= 8) {
result = primitiveTypeNameMap.get(name);
}
}
return result;
} | java | public static Class<?> loadPrimitiveClass(String name) {
Class<?> result = null;
if (StrUtil.isNotBlank(name)) {
name = name.trim();
if (name.length() <= 8) {
result = primitiveTypeNameMap.get(name);
}
}
return result;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"loadPrimitiveClass",
"(",
"String",
"name",
")",
"{",
"Class",
"<",
"?",
">",
"result",
"=",
"null",
";",
"if",
"(",
"StrUtil",
".",
"isNotBlank",
"(",
"name",
")",
")",
"{",
"name",
"=",
"name",
".",
"t... | 加载原始类型的类。包括原始类型、原始类型数组和void
@param name 原始类型名,比如 int
@return 原始类型类 | [
"加载原始类型的类。包括原始类型、原始类型数组和void"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassLoaderUtil.java#L200-L209 | train | Loads a primitive class from the system. | [
30522,
2270,
10763,
2465,
1026,
1029,
1028,
7170,
18098,
27605,
6024,
26266,
1006,
5164,
2171,
1007,
1063,
2465,
1026,
1029,
1028,
2765,
1027,
19701,
1025,
2065,
1006,
2358,
22134,
4014,
1012,
3475,
4140,
28522,
8950,
1006,
30524,
102,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
apache/flink | flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java | DelimitedInputFormat.configure | @Override
public void configure(Configuration parameters) {
super.configure(parameters);
// the if() clauses are to prevent the configure() method from
// overwriting the values set by the setters
if (Arrays.equals(delimiter, new byte[] {'\n'})) {
String delimString = parameters.getString(RECORD_DELIMITER, null);
if (delimString != null) {
setDelimiter(delimString);
}
}
// set the number of samples
if (numLineSamples == NUM_SAMPLES_UNDEFINED) {
String samplesString = parameters.getString(NUM_STATISTICS_SAMPLES, null);
if (samplesString != null) {
try {
setNumLineSamples(Integer.parseInt(samplesString));
} catch (NumberFormatException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid value for number of samples to take: " + samplesString + ". Skipping sampling.");
}
setNumLineSamples(0);
}
}
}
} | java | @Override
public void configure(Configuration parameters) {
super.configure(parameters);
// the if() clauses are to prevent the configure() method from
// overwriting the values set by the setters
if (Arrays.equals(delimiter, new byte[] {'\n'})) {
String delimString = parameters.getString(RECORD_DELIMITER, null);
if (delimString != null) {
setDelimiter(delimString);
}
}
// set the number of samples
if (numLineSamples == NUM_SAMPLES_UNDEFINED) {
String samplesString = parameters.getString(NUM_STATISTICS_SAMPLES, null);
if (samplesString != null) {
try {
setNumLineSamples(Integer.parseInt(samplesString));
} catch (NumberFormatException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid value for number of samples to take: " + samplesString + ". Skipping sampling.");
}
setNumLineSamples(0);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"Configuration",
"parameters",
")",
"{",
"super",
".",
"configure",
"(",
"parameters",
")",
";",
"// the if() clauses are to prevent the configure() method from",
"// overwriting the values set by the setters",
"if",
"(",
... | Configures this input format by reading the path to the file from the configuration and the string that
defines the record delimiter.
@param parameters The configuration object to read the parameters from. | [
"Configures",
"this",
"input",
"format",
"by",
"reading",
"the",
"path",
"to",
"the",
"file",
"from",
"the",
"configuration",
"and",
"the",
"string",
"that",
"defines",
"the",
"record",
"delimiter",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java#L311-L339 | train | Override the configure method to set the values in the configuration. | [
30522,
1030,
2058,
15637,
2270,
11675,
9530,
8873,
27390,
2063,
1006,
9563,
11709,
1007,
1063,
3565,
1012,
9530,
8873,
27390,
2063,
1006,
11709,
1007,
1025,
1013,
1013,
1996,
2065,
1006,
1007,
24059,
2024,
2000,
4652,
1996,
9530,
8873,
2739... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-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/seg/common/CWSEvaluator.java | CWSEvaluator.evaluate | public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile);
BufferedWriter bw = IOUtil.newBufferedWriter(outputPath);
for (String line : lineIterator)
{
List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替
int i = 0;
for (Term term : termList)
{
bw.write(term.word);
if (++i != termList.size())
bw.write(" ");
}
bw.newLine();
}
bw.close();
CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath);
return result;
} | java | public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile);
BufferedWriter bw = IOUtil.newBufferedWriter(outputPath);
for (String line : lineIterator)
{
List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替
int i = 0;
for (Term term : termList)
{
bw.write(term.word);
if (++i != termList.size())
bw.write(" ");
}
bw.newLine();
}
bw.close();
CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath);
return result;
} | [
"public",
"static",
"CWSEvaluator",
".",
"Result",
"evaluate",
"(",
"Segment",
"segment",
",",
"String",
"outputPath",
",",
"String",
"goldFile",
",",
"String",
"dictPath",
")",
"throws",
"IOException",
"{",
"IOUtil",
".",
"LineIterator",
"lineIterator",
"=",
"n... | 标准化评测分词器
@param segment 分词器
@param outputPath 分词预测输出文件
@param goldFile 测试集segmented file
@param dictPath 训练集单词列表
@return 一个储存准确率的结构
@throws IOException | [
"标准化评测分词器"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/CWSEvaluator.java#L191-L210 | train | Evaluate a CWSECTYPE file. | [
30522,
2270,
10763,
19296,
3366,
10175,
6692,
4263,
1012,
2765,
16157,
1006,
6903,
6903,
1010,
5164,
6434,
15069,
1010,
5164,
2751,
8873,
2571,
1010,
5164,
4487,
6593,
15069,
1007,
11618,
22834,
10288,
24422,
1063,
22834,
21823,
2140,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.