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
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java
AbstractInvokable.triggerCheckpointOnBarrier
public void triggerCheckpointOnBarrier(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, CheckpointMetrics checkpointMetrics) throws Exception { throw new UnsupportedOperationException(String.format("triggerCheckpointOnBarrier not supported by %s", this.getClass().getName())); }
java
public void triggerCheckpointOnBarrier(CheckpointMetaData checkpointMetaData, CheckpointOptions checkpointOptions, CheckpointMetrics checkpointMetrics) throws Exception { throw new UnsupportedOperationException(String.format("triggerCheckpointOnBarrier not supported by %s", this.getClass().getName())); }
[ "public", "void", "triggerCheckpointOnBarrier", "(", "CheckpointMetaData", "checkpointMetaData", ",", "CheckpointOptions", "checkpointOptions", ",", "CheckpointMetrics", "checkpointMetrics", ")", "throws", "Exception", "{", "throw", "new", "UnsupportedOperationException", "(", ...
This method is called when a checkpoint is triggered as a result of receiving checkpoint barriers on all input streams. @param checkpointMetaData Meta data for about this checkpoint @param checkpointOptions Options for performing this checkpoint @param checkpointMetrics Metrics about this checkpoint @throws Exception Exceptions thrown as the result of triggering a checkpoint are forwarded.
[ "This", "method", "is", "called", "when", "a", "checkpoint", "is", "triggered", "as", "a", "result", "of", "receiving", "checkpoint", "barriers", "on", "all", "input", "streams", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java#L225-L227
train
Trigger a checkpoint on barrier.
[ 30522, 2270, 11675, 9495, 5403, 3600, 8400, 2239, 8237, 16252, 1006, 26520, 11368, 8447, 2696, 26520, 11368, 8447, 2696, 1010, 26520, 7361, 9285, 26520, 7361, 9285, 1010, 26520, 12589, 2015, 26520, 12589, 2015, 1007, 11618, 6453, 1063, 5466, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getPaths
public List<int[]> getPaths(int index) { assert (index <= N && index >= 0); Stack<PathNode> stack = new Stack<PathNode>(); int curNode = vertexCount - 1, curIndex = index; QueueElement element; PathNode node; int[] aPath; List<int[]> result = new ArrayList<int[]>(); element = fromArray[curNode - 1][curIndex].GetFirst(); while (element != null) { // ---------- 通过压栈得到路径 ----------- stack.push(new PathNode(curNode, curIndex)); stack.push(new PathNode(element.from, element.index)); curNode = element.from; while (curNode != 0) { element = fromArray[element.from - 1][element.index].GetFirst(); // System.out.println(element.from + " " + element.index); stack.push(new PathNode(element.from, element.index)); curNode = element.from; } // -------------- 输出路径 -------------- PathNode[] nArray = new PathNode[stack.size()]; for (int i = 0; i < stack.size(); ++i) { nArray[i] = stack.get(stack.size() - i - 1); } aPath = new int[nArray.length]; for (int i = 0; i < aPath.length; i++) aPath[i] = nArray[i].from; result.add(aPath); // -------------- 出栈以检查是否还有其它路径 -------------- do { node = stack.pop(); curNode = node.from; curIndex = node.index; } while (curNode < 1 || (stack.size() != 0 && !fromArray[curNode - 1][curIndex].CanGetNext())); element = fromArray[curNode - 1][curIndex].GetNext(); } return result; }
java
public List<int[]> getPaths(int index) { assert (index <= N && index >= 0); Stack<PathNode> stack = new Stack<PathNode>(); int curNode = vertexCount - 1, curIndex = index; QueueElement element; PathNode node; int[] aPath; List<int[]> result = new ArrayList<int[]>(); element = fromArray[curNode - 1][curIndex].GetFirst(); while (element != null) { // ---------- 通过压栈得到路径 ----------- stack.push(new PathNode(curNode, curIndex)); stack.push(new PathNode(element.from, element.index)); curNode = element.from; while (curNode != 0) { element = fromArray[element.from - 1][element.index].GetFirst(); // System.out.println(element.from + " " + element.index); stack.push(new PathNode(element.from, element.index)); curNode = element.from; } // -------------- 输出路径 -------------- PathNode[] nArray = new PathNode[stack.size()]; for (int i = 0; i < stack.size(); ++i) { nArray[i] = stack.get(stack.size() - i - 1); } aPath = new int[nArray.length]; for (int i = 0; i < aPath.length; i++) aPath[i] = nArray[i].from; result.add(aPath); // -------------- 出栈以检查是否还有其它路径 -------------- do { node = stack.pop(); curNode = node.from; curIndex = node.index; } while (curNode < 1 || (stack.size() != 0 && !fromArray[curNode - 1][curIndex].CanGetNext())); element = fromArray[curNode - 1][curIndex].GetNext(); } return result; }
[ "public", "List", "<", "int", "[", "]", ">", "getPaths", "(", "int", "index", ")", "{", "assert", "(", "index", "<=", "N", "&&", "index", ">=", "0", ")", ";", "Stack", "<", "PathNode", ">", "stack", "=", "new", "Stack", "<", "PathNode", ">", "(",...
获取前index+1短的路径 @param index index = 0 : 最短的路径; index = 1 : 次短的路径, 依此类推。index <= this.N @return
[ "获取前index", "+", "1短的路径" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java#L173-L226
train
Gets the paths of a single page.
[ 30522, 2270, 2862, 1026, 20014, 1031, 1033, 1028, 2131, 15069, 2015, 1006, 30524, 1006, 1007, 1025, 20014, 12731, 19139, 3207, 1027, 19449, 3597, 16671, 1011, 1015, 1010, 12731, 6657, 3207, 2595, 1027, 5950, 1025, 24240, 12260, 3672, 5783, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/wrapper/HadoopTupleUnwrappingIterator.java
HadoopTupleUnwrappingIterator.set
@Override public void set(final Iterator<Tuple2<KEY, VALUE>> iterator) { this.iterator = iterator; if (this.hasNext()) { final Tuple2<KEY, VALUE> tuple = iterator.next(); this.curKey = keySerializer.copy(tuple.f0); this.firstValue = tuple.f1; this.atFirst = true; } else { this.atFirst = false; } }
java
@Override public void set(final Iterator<Tuple2<KEY, VALUE>> iterator) { this.iterator = iterator; if (this.hasNext()) { final Tuple2<KEY, VALUE> tuple = iterator.next(); this.curKey = keySerializer.copy(tuple.f0); this.firstValue = tuple.f1; this.atFirst = true; } else { this.atFirst = false; } }
[ "@", "Override", "public", "void", "set", "(", "final", "Iterator", "<", "Tuple2", "<", "KEY", ",", "VALUE", ">", ">", "iterator", ")", "{", "this", ".", "iterator", "=", "iterator", ";", "if", "(", "this", ".", "hasNext", "(", ")", ")", "{", "fina...
Set the Flink iterator to wrap. @param iterator The Flink iterator to wrap.
[ "Set", "the", "Flink", "iterator", "to", "wrap", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/hadoopcompatibility/mapred/wrapper/HadoopTupleUnwrappingIterator.java#L54-L65
train
Sets the iterator.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2275, 1006, 2345, 2009, 6906, 4263, 1026, 10722, 10814, 2475, 1026, 3145, 1010, 3643, 1028, 1028, 2009, 6906, 4263, 1007, 1063, 2023, 1012, 2009, 6906, 4263, 1027, 2009, 6906, 4263, 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...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java
JoinOperatorSetsBase.where
public <K> JoinOperatorSetsPredicateBase where(KeySelector<I1, K> keySelector) { TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType()); return new JoinOperatorSetsPredicateBase(new Keys.SelectorFunctionKeys<>(keySelector, input1.getType(), keyType)); }
java
public <K> JoinOperatorSetsPredicateBase where(KeySelector<I1, K> keySelector) { TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType()); return new JoinOperatorSetsPredicateBase(new Keys.SelectorFunctionKeys<>(keySelector, input1.getType(), keyType)); }
[ "public", "<", "K", ">", "JoinOperatorSetsPredicateBase", "where", "(", "KeySelector", "<", "I1", ",", "K", ">", "keySelector", ")", "{", "TypeInformation", "<", "K", ">", "keyType", "=", "TypeExtractor", ".", "getKeySelectorTypes", "(", "keySelector", ",", "i...
Continues a Join transformation and defines a {@link KeySelector} function for the first join {@link DataSet}. <p>The KeySelector function is called for each element of the first DataSet and extracts a single key value on which the DataSet is joined. @param keySelector The KeySelector function which extracts the key values from the DataSet on which it is joined. @return An incomplete Join transformation. Call {@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(int...)} or {@link org.apache.flink.api.java.operators.join.JoinOperatorSetsBase.JoinOperatorSetsPredicateBase#equalTo(KeySelector)} to continue the Join. @see KeySelector @see DataSet
[ "Continues", "a", "Join", "transformation", "and", "defines", "a", "{", "@link", "KeySelector", "}", "function", "for", "the", "first", "join", "{", "@link", "DataSet", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/join/JoinOperatorSetsBase.java#L128-L131
train
Create a new JoinOperatorSetsPredicateBase that will accept the given key selector.
[ 30522, 2270, 1026, 1047, 1028, 3693, 25918, 18926, 8454, 28139, 16467, 15058, 2073, 1006, 6309, 12260, 16761, 1026, 1045, 2487, 1010, 1047, 1028, 6309, 12260, 16761, 1007, 1063, 2828, 2378, 14192, 3370, 1026, 1047, 1028, 3145, 13874, 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/util/NumberUtil.java
NumberUtil.appendRange
public static Collection<Integer> appendRange(int start, int stop, int step, Collection<Integer> values) { if (start < stop) { step = Math.abs(step); } else if (start > stop) { step = -Math.abs(step); } else {// start == end values.add(start); return values; } for (int i = start; (step > 0) ? i <= stop : i >= stop; i += step) { values.add(i); } return values; }
java
public static Collection<Integer> appendRange(int start, int stop, int step, Collection<Integer> values) { if (start < stop) { step = Math.abs(step); } else if (start > stop) { step = -Math.abs(step); } else {// start == end values.add(start); return values; } for (int i = start; (step > 0) ? i <= stop : i >= stop; i += step) { values.add(i); } return values; }
[ "public", "static", "Collection", "<", "Integer", ">", "appendRange", "(", "int", "start", ",", "int", "stop", ",", "int", "step", ",", "Collection", "<", "Integer", ">", "values", ")", "{", "if", "(", "start", "<", "stop", ")", "{", "step", "=", "Ma...
将给定范围内的整数添加到已有集合中 @param start 开始(包含) @param stop 结束(包含) @param step 步进 @param values 集合 @return 集合
[ "将给定范围内的整数添加到已有集合中" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1356-L1370
train
Appends the range of integer values to the given collection of integers.
[ 30522, 2270, 10763, 3074, 1026, 16109, 1028, 10439, 19524, 15465, 1006, 20014, 2707, 1010, 20014, 2644, 1010, 20014, 3357, 1010, 3074, 1026, 16109, 1028, 5300, 1007, 1063, 2065, 1006, 2707, 1026, 2644, 1007, 1063, 3357, 1027, 8785, 1012, 14...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ClassScaner.java
ClassScaner.scanPackageByAnnotation
public static Set<Class<?>> scanPackageByAnnotation(String packageName, final Class<? extends Annotation> annotationClass) { return scanPackage(packageName, new Filter<Class<?>>() { @Override public boolean accept(Class<?> clazz) { return clazz.isAnnotationPresent(annotationClass); } }); }
java
public static Set<Class<?>> scanPackageByAnnotation(String packageName, final Class<? extends Annotation> annotationClass) { return scanPackage(packageName, new Filter<Class<?>>() { @Override public boolean accept(Class<?> clazz) { return clazz.isAnnotationPresent(annotationClass); } }); }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "scanPackageByAnnotation", "(", "String", "packageName", ",", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotationClass", ")", "{", "return", "scanPackage", "(", "packageName", ",", ...
扫描指定包路径下所有包含指定注解的类 @param packageName 包路径 @param annotationClass 注解类 @return 类集合
[ "扫描指定包路径下所有包含指定注解的类" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/ClassScaner.java#L58-L65
train
Scans a package for classes annotated with the given annotation.
[ 30522, 2270, 10763, 2275, 1026, 2465, 1026, 1029, 1028, 1028, 13594, 23947, 4270, 3762, 11639, 17287, 3508, 1006, 5164, 7427, 18442, 1010, 2345, 2465, 1026, 1029, 8908, 5754, 17287, 3508, 1028, 5754, 17287, 3508, 26266, 1007, 1063, 2709, 13...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java
DataSink.setResources
private DataSink<T> setResources(ResourceSpec resources) { Preconditions.checkNotNull(resources, "The resources must be not null."); Preconditions.checkArgument(resources.isValid(), "The values in resources must be not less than 0."); this.minResources = resources; this.preferredResources = resources; return this; }
java
private DataSink<T> setResources(ResourceSpec resources) { Preconditions.checkNotNull(resources, "The resources must be not null."); Preconditions.checkArgument(resources.isValid(), "The values in resources must be not less than 0."); this.minResources = resources; this.preferredResources = resources; return this; }
[ "private", "DataSink", "<", "T", ">", "setResources", "(", "ResourceSpec", "resources", ")", "{", "Preconditions", ".", "checkNotNull", "(", "resources", ",", "\"The resources must be not null.\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "resources", "...
Sets the resources for this data sink, and the minimum and preferred resources are the same by default. @param resources The resources for this data sink. @return The data sink with set minimum and preferred resources.
[ "Sets", "the", "resources", "for", "this", "data", "sink", "and", "the", "minimum", "and", "preferred", "resources", "are", "the", "same", "by", "default", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java#L350-L358
train
Sets the resources.
[ 30522, 2797, 2951, 11493, 2243, 1026, 1056, 1028, 2275, 6072, 8162, 9623, 1006, 4219, 5051, 2278, 4219, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 4219, 1010, 1000, 1996, 4219, 2442, 2022, 2025, 19701, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.splitMultipartHeader
private static String[] splitMultipartHeader(String sb) { ArrayList<String> headers = new ArrayList<String>(1); int nameStart; int nameEnd; int colonEnd; int valueStart; int valueEnd; nameStart = HttpPostBodyUtil.findNonWhitespace(sb, 0); for (nameEnd = nameStart; nameEnd < sb.length(); nameEnd++) { char ch = sb.charAt(nameEnd); if (ch == ':' || Character.isWhitespace(ch)) { break; } } for (colonEnd = nameEnd; colonEnd < sb.length(); colonEnd++) { if (sb.charAt(colonEnd) == ':') { colonEnd++; break; } } valueStart = HttpPostBodyUtil.findNonWhitespace(sb, colonEnd); valueEnd = HttpPostBodyUtil.findEndOfString(sb); headers.add(sb.substring(nameStart, nameEnd)); String svalue = (valueStart >= valueEnd) ? StringUtil.EMPTY_STRING : sb.substring(valueStart, valueEnd); String[] values; if (svalue.indexOf(';') >= 0) { values = splitMultipartHeaderValues(svalue); } else { values = svalue.split(","); } for (String value : values) { headers.add(value.trim()); } String[] array = new String[headers.size()]; for (int i = 0; i < headers.size(); i++) { array[i] = headers.get(i); } return array; }
java
private static String[] splitMultipartHeader(String sb) { ArrayList<String> headers = new ArrayList<String>(1); int nameStart; int nameEnd; int colonEnd; int valueStart; int valueEnd; nameStart = HttpPostBodyUtil.findNonWhitespace(sb, 0); for (nameEnd = nameStart; nameEnd < sb.length(); nameEnd++) { char ch = sb.charAt(nameEnd); if (ch == ':' || Character.isWhitespace(ch)) { break; } } for (colonEnd = nameEnd; colonEnd < sb.length(); colonEnd++) { if (sb.charAt(colonEnd) == ':') { colonEnd++; break; } } valueStart = HttpPostBodyUtil.findNonWhitespace(sb, colonEnd); valueEnd = HttpPostBodyUtil.findEndOfString(sb); headers.add(sb.substring(nameStart, nameEnd)); String svalue = (valueStart >= valueEnd) ? StringUtil.EMPTY_STRING : sb.substring(valueStart, valueEnd); String[] values; if (svalue.indexOf(';') >= 0) { values = splitMultipartHeaderValues(svalue); } else { values = svalue.split(","); } for (String value : values) { headers.add(value.trim()); } String[] array = new String[headers.size()]; for (int i = 0; i < headers.size(); i++) { array[i] = headers.get(i); } return array; }
[ "private", "static", "String", "[", "]", "splitMultipartHeader", "(", "String", "sb", ")", "{", "ArrayList", "<", "String", ">", "headers", "=", "new", "ArrayList", "<", "String", ">", "(", "1", ")", ";", "int", "nameStart", ";", "int", "nameEnd", ";", ...
Split one header in Multipart @return an array of String where rank 0 is the name of the header, follows by several values that were separated by ';' or ','
[ "Split", "one", "header", "in", "Multipart" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1447-L1485
train
Split multipart header.
[ 30522, 2797, 10763, 5164, 1031, 1033, 3975, 12274, 7096, 11514, 22425, 13775, 2121, 1006, 5164, 24829, 1007, 1063, 9140, 9863, 1026, 5164, 1028, 20346, 2015, 1027, 2047, 9140, 9863, 1026, 5164, 1028, 1006, 1015, 1007, 1025, 20014, 3415, 755...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setLong
@PublicEvolving public void setLong(ConfigOption<Long> key, long value) { setValueInternal(key.key(), value); }
java
@PublicEvolving public void setLong(ConfigOption<Long> key, long value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setLong", "(", "ConfigOption", "<", "Long", ">", "key", ",", "long", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L338-L341
train
Sets the value associated with the given key.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 11675, 2275, 10052, 1006, 9530, 8873, 3995, 16790, 1026, 2146, 1028, 3145, 1010, 2146, 3643, 1007, 1063, 2275, 10175, 5657, 18447, 11795, 2389, 1006, 3145, 1012, 3145, 1006, 1007, 1010, 3643, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.readLine
private static String readLine(ByteBuf undecodedChunk, Charset charset) { if (!undecodedChunk.hasArray()) { return readLineStandard(undecodedChunk, charset); } SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk); int readerIndex = undecodedChunk.readerIndex(); try { ByteBuf line = buffer(64); while (sao.pos < sao.limit) { byte nextByte = sao.bytes[sao.pos++]; if (nextByte == HttpConstants.CR) { if (sao.pos < sao.limit) { nextByte = sao.bytes[sao.pos++]; if (nextByte == HttpConstants.LF) { sao.setReadPosition(0); return line.toString(charset); } else { // Write CR (not followed by LF) sao.pos--; line.writeByte(HttpConstants.CR); } } else { line.writeByte(nextByte); } } else if (nextByte == HttpConstants.LF) { sao.setReadPosition(0); return line.toString(charset); } else { line.writeByte(nextByte); } } } catch (IndexOutOfBoundsException e) { undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(e); } undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); }
java
private static String readLine(ByteBuf undecodedChunk, Charset charset) { if (!undecodedChunk.hasArray()) { return readLineStandard(undecodedChunk, charset); } SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk); int readerIndex = undecodedChunk.readerIndex(); try { ByteBuf line = buffer(64); while (sao.pos < sao.limit) { byte nextByte = sao.bytes[sao.pos++]; if (nextByte == HttpConstants.CR) { if (sao.pos < sao.limit) { nextByte = sao.bytes[sao.pos++]; if (nextByte == HttpConstants.LF) { sao.setReadPosition(0); return line.toString(charset); } else { // Write CR (not followed by LF) sao.pos--; line.writeByte(HttpConstants.CR); } } else { line.writeByte(nextByte); } } else if (nextByte == HttpConstants.LF) { sao.setReadPosition(0); return line.toString(charset); } else { line.writeByte(nextByte); } } } catch (IndexOutOfBoundsException e) { undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(e); } undecodedChunk.readerIndex(readerIndex); throw new NotEnoughDataDecoderException(); }
[ "private", "static", "String", "readLine", "(", "ByteBuf", "undecodedChunk", ",", "Charset", "charset", ")", "{", "if", "(", "!", "undecodedChunk", ".", "hasArray", "(", ")", ")", "{", "return", "readLineStandard", "(", "undecodedChunk", ",", "charset", ")", ...
Read one line up to the CRLF or LF @return the String from one line @throws NotEnoughDataDecoderException Need more chunks and reset the {@code readerIndex} to the previous value
[ "Read", "one", "line", "up", "to", "the", "CRLF", "or", "LF" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1031-L1069
train
Read a line from the given byte buffer.
[ 30522, 2797, 10763, 5164, 3191, 4179, 1006, 24880, 8569, 2546, 6151, 8586, 10244, 16409, 17157, 2243, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2065, 1006, 999, 6151, 8586, 10244, 16409, 17157, 2243, 1012, 2038, 2906, 9447, 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-setting/src/main/java/cn/hutool/setting/profile/Profile.java
Profile.getSetting
public Setting getSetting(String name) { String nameForProfile = fixNameForProfile(name); Setting setting = settingMap.get(nameForProfile); if (null == setting) { setting = new Setting(nameForProfile, this.charset, this.useVar); settingMap.put(nameForProfile, setting); } return setting; }
java
public Setting getSetting(String name) { String nameForProfile = fixNameForProfile(name); Setting setting = settingMap.get(nameForProfile); if (null == setting) { setting = new Setting(nameForProfile, this.charset, this.useVar); settingMap.put(nameForProfile, setting); } return setting; }
[ "public", "Setting", "getSetting", "(", "String", "name", ")", "{", "String", "nameForProfile", "=", "fixNameForProfile", "(", "name", ")", ";", "Setting", "setting", "=", "settingMap", ".", "get", "(", "nameForProfile", ")", ";", "if", "(", "null", "==", ...
获取当前环境下的配置文件 @param name 文件名,如果没有扩展名,默认为.setting @return 当前环境下配置文件
[ "获取当前环境下的配置文件" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/profile/Profile.java#L79-L87
train
Gets a setting by name.
[ 30522, 2270, 4292, 4152, 18319, 3070, 1006, 5164, 2171, 1007, 1063, 5164, 2171, 29278, 21572, 8873, 2571, 1027, 8081, 18442, 29278, 21572, 8873, 2571, 1006, 2171, 1007, 1025, 4292, 4292, 1027, 4292, 2863, 2361, 1012, 2131, 1006, 2171, 29278...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.read
public static FastByteArrayOutputStream read(ReadableByteChannel channel) throws IORuntimeException { final FastByteArrayOutputStream out = new FastByteArrayOutputStream(); copy(channel, Channels.newChannel(out)); return out; }
java
public static FastByteArrayOutputStream read(ReadableByteChannel channel) throws IORuntimeException { final FastByteArrayOutputStream out = new FastByteArrayOutputStream(); copy(channel, Channels.newChannel(out)); return out; }
[ "public", "static", "FastByteArrayOutputStream", "read", "(", "ReadableByteChannel", "channel", ")", "throws", "IORuntimeException", "{", "final", "FastByteArrayOutputStream", "out", "=", "new", "FastByteArrayOutputStream", "(", ")", ";", "copy", "(", "channel", ",", ...
从流中读取内容,读到输出流中 @param channel 可读通道,读取完毕后并不关闭通道 @return 输出流 @throws IORuntimeException IO异常
[ "从流中读取内容,读到输出流中" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L448-L452
train
Reads a sequence of bytes from the specified channel.
[ 30522, 2270, 10763, 3435, 3762, 27058, 11335, 29337, 25856, 16446, 25379, 3191, 1006, 3191, 3085, 3762, 15007, 20147, 2140, 3149, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2345, 3435, 3762, 27058, 11335, 29337, 25856, 16446, 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...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.toLong
public Long toLong() { ensureMaterialized(); if (sizeInBytes == 0) { return null; } int size = segments[0].size(); SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size); int totalOffset = 0; byte b = segmentAndOffset.value(); final boolean negative = b == '-'; if (negative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (sizeInBytes == 1) { return null; } } long result = 0; final byte separator = '.'; final int radix = 10; final long stopValue = Long.MIN_VALUE / radix; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b == separator) { // We allow decimals and will return a truncated integral in that case. // Therefore we won't throw an exception here (checking the fractional // part happens below.) break; } int digit; if (b >= '0' && b <= '9') { digit = b - '0'; } else { return null; } // We are going to process the new digit and accumulate the result. However, before // doing this, if the result is already smaller than the // stopValue(Long.MIN_VALUE / radix), then result * 10 will definitely be smaller // than minValue, and we can stop. if (result < stopValue) { return null; } result = result * radix - digit; // Since the previous result is less than or equal to // stopValue(Long.MIN_VALUE / radix), we can just use `result > 0` to check overflow. // If result overflows, we should stop. if (result > 0) { return null; } } // This is the case when we've encountered a decimal separator. The fractional // part will not change the number, but we will verify that the fractional part // is well formed. while (totalOffset < sizeInBytes) { byte currentByte = segmentAndOffset.value(); if (currentByte < '0' || currentByte > '9') { return null; } totalOffset++; segmentAndOffset.nextByte(size); } if (!negative) { result = -result; if (result < 0) { return null; } } return result; }
java
public Long toLong() { ensureMaterialized(); if (sizeInBytes == 0) { return null; } int size = segments[0].size(); SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size); int totalOffset = 0; byte b = segmentAndOffset.value(); final boolean negative = b == '-'; if (negative || b == '+') { segmentAndOffset.nextByte(size); totalOffset++; if (sizeInBytes == 1) { return null; } } long result = 0; final byte separator = '.'; final int radix = 10; final long stopValue = Long.MIN_VALUE / radix; while (totalOffset < this.sizeInBytes) { b = segmentAndOffset.value(); totalOffset++; segmentAndOffset.nextByte(size); if (b == separator) { // We allow decimals and will return a truncated integral in that case. // Therefore we won't throw an exception here (checking the fractional // part happens below.) break; } int digit; if (b >= '0' && b <= '9') { digit = b - '0'; } else { return null; } // We are going to process the new digit and accumulate the result. However, before // doing this, if the result is already smaller than the // stopValue(Long.MIN_VALUE / radix), then result * 10 will definitely be smaller // than minValue, and we can stop. if (result < stopValue) { return null; } result = result * radix - digit; // Since the previous result is less than or equal to // stopValue(Long.MIN_VALUE / radix), we can just use `result > 0` to check overflow. // If result overflows, we should stop. if (result > 0) { return null; } } // This is the case when we've encountered a decimal separator. The fractional // part will not change the number, but we will verify that the fractional part // is well formed. while (totalOffset < sizeInBytes) { byte currentByte = segmentAndOffset.value(); if (currentByte < '0' || currentByte > '9') { return null; } totalOffset++; segmentAndOffset.nextByte(size); } if (!negative) { result = -result; if (result < 0) { return null; } } return result; }
[ "public", "Long", "toLong", "(", ")", "{", "ensureMaterialized", "(", ")", ";", "if", "(", "sizeInBytes", "==", "0", ")", "{", "return", "null", ";", "}", "int", "size", "=", "segments", "[", "0", "]", ".", "size", "(", ")", ";", "SegmentAndOffset", ...
Parses this BinaryString to Long. <p>Note that, in this method we accumulate the result in negative format, and convert it to positive format at the end, if this string is not started with '-'. This is because min value is bigger than max value in digits, e.g. Long.MAX_VALUE is '9223372036854775807' and Long.MIN_VALUE is '-9223372036854775808'. <p>This code is mostly copied from LazyLong.parseLong in Hive. @return Long value if the parsing was successful else null.
[ "Parses", "this", "BinaryString", "to", "Long", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L1261-L1338
train
Returns the value of this Long in the range [ 0 size ).
[ 30522, 2270, 2146, 2000, 10052, 1006, 1007, 1063, 5676, 8585, 14482, 3550, 1006, 1007, 1025, 2065, 1006, 2946, 2378, 3762, 4570, 1027, 1027, 1014, 1007, 1063, 2709, 19701, 1025, 1065, 20014, 2946, 1027, 9214, 1031, 1014, 1033, 1012, 2946, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/grouping/WindowsGrouping.java
WindowsGrouping.reset
public void reset() { nextWindow = null; watermark = Long.MIN_VALUE; triggerWindowStartIndex = 0; emptyWindowTriggered = true; resetBuffer(); }
java
public void reset() { nextWindow = null; watermark = Long.MIN_VALUE; triggerWindowStartIndex = 0; emptyWindowTriggered = true; resetBuffer(); }
[ "public", "void", "reset", "(", ")", "{", "nextWindow", "=", "null", ";", "watermark", "=", "Long", ".", "MIN_VALUE", ";", "triggerWindowStartIndex", "=", "0", ";", "emptyWindowTriggered", "=", "true", ";", "resetBuffer", "(", ")", ";", "}" ]
Reset for next group.
[ "Reset", "for", "next", "group", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/window/grouping/WindowsGrouping.java#L95-L101
train
Resets the internal state of the internal data structures.
[ 30522, 2270, 11675, 25141, 1006, 1007, 1063, 2279, 11101, 5004, 1027, 19701, 1025, 2300, 10665, 1027, 2146, 1012, 8117, 1035, 3643, 1025, 9495, 11101, 15568, 7559, 7629, 3207, 2595, 1027, 1014, 1025, 4064, 11101, 5004, 18886, 13327, 2098, 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-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java
PythonDualInputSender.sendBuffer2
public int sendBuffer2(SingleElementPushBackIterator<IN2> input) throws IOException { if (serializer2 == null) { IN2 value = input.next(); serializer2 = getSerializer(value); input.pushBack(value); } return sendBuffer(input, serializer2); }
java
public int sendBuffer2(SingleElementPushBackIterator<IN2> input) throws IOException { if (serializer2 == null) { IN2 value = input.next(); serializer2 = getSerializer(value); input.pushBack(value); } return sendBuffer(input, serializer2); }
[ "public", "int", "sendBuffer2", "(", "SingleElementPushBackIterator", "<", "IN2", ">", "input", ")", "throws", "IOException", "{", "if", "(", "serializer2", "==", "null", ")", "{", "IN2", "value", "=", "input", ".", "next", "(", ")", ";", "serializer2", "=...
Extracts records from an iterator and writes them to the memory-mapped file. This method assumes that all values in the iterator are of the same type. This method does NOT take care of synchronization. The caller must guarantee that the file may be written to before calling this method. @param input iterator containing records @return size of the written buffer @throws IOException
[ "Extracts", "records", "from", "an", "iterator", "and", "writes", "them", "to", "the", "memory", "-", "mapped", "file", ".", "This", "method", "assumes", "that", "all", "values", "in", "the", "iterator", "are", "of", "the", "same", "type", ".", "This", "...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java#L69-L76
train
Send the buffer 2.
[ 30522, 2270, 20014, 4604, 8569, 12494, 2475, 1006, 2309, 12260, 3672, 12207, 2232, 5963, 21646, 8844, 1026, 1999, 2475, 1028, 7953, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 7642, 17629, 2475, 1027, 1027, 19701, 1007, 1063, 1999, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/generated/CompileUtils.java
CompileUtils.addLineNumber
private static String addLineNumber(String code) { String[] lines = code.split("\n"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < lines.length; i++) { builder.append("/* ").append(i + 1).append(" */").append(lines[i]).append("\n"); } return builder.toString(); }
java
private static String addLineNumber(String code) { String[] lines = code.split("\n"); StringBuilder builder = new StringBuilder(); for (int i = 0; i < lines.length; i++) { builder.append("/* ").append(i + 1).append(" */").append(lines[i]).append("\n"); } return builder.toString(); }
[ "private", "static", "String", "addLineNumber", "(", "String", "code", ")", "{", "String", "[", "]", "lines", "=", "code", ".", "split", "(", "\"\\n\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", ...
To output more information when an error occurs. Generally, when cook fails, it shows which line is wrong. This line number starts at 1.
[ "To", "output", "more", "information", "when", "an", "error", "occurs", ".", "Generally", "when", "cook", "fails", "it", "shows", "which", "line", "is", "wrong", ".", "This", "line", "number", "starts", "at", "1", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/generated/CompileUtils.java#L96-L103
train
Add line number to the code.
[ 30522, 2797, 10763, 5164, 5587, 4179, 19172, 5677, 1006, 5164, 3642, 1007, 1063, 5164, 1031, 1033, 3210, 1027, 3642, 1012, 3975, 1006, 1000, 1032, 1050, 1000, 1007, 1025, 5164, 8569, 23891, 2099, 12508, 1027, 2047, 5164, 8569, 23891, 2099, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java
AbstractBinaryExternalMerger.getMergingIterator
public BinaryMergeIterator<Entry> getMergingIterator( List<ChannelWithMeta> channelIDs, List<FileIOChannel> openChannels) throws IOException { // create one iterator per channel id if (LOG.isDebugEnabled()) { LOG.debug("Performing merge of " + channelIDs.size() + " sorted streams."); } final List<MutableObjectIterator<Entry>> iterators = new ArrayList<>(channelIDs.size() + 1); for (ChannelWithMeta channel : channelIDs) { AbstractChannelReaderInputView view = FileChannelUtil.createInputView( ioManager, channel, openChannels, compressionEnable, compressionCodecFactory, compressionBlockSize, pageSize); iterators.add(channelReaderInputViewIterator(view)); } return new BinaryMergeIterator<>( iterators, mergeReusedEntries(channelIDs.size()), mergeComparator()); }
java
public BinaryMergeIterator<Entry> getMergingIterator( List<ChannelWithMeta> channelIDs, List<FileIOChannel> openChannels) throws IOException { // create one iterator per channel id if (LOG.isDebugEnabled()) { LOG.debug("Performing merge of " + channelIDs.size() + " sorted streams."); } final List<MutableObjectIterator<Entry>> iterators = new ArrayList<>(channelIDs.size() + 1); for (ChannelWithMeta channel : channelIDs) { AbstractChannelReaderInputView view = FileChannelUtil.createInputView( ioManager, channel, openChannels, compressionEnable, compressionCodecFactory, compressionBlockSize, pageSize); iterators.add(channelReaderInputViewIterator(view)); } return new BinaryMergeIterator<>( iterators, mergeReusedEntries(channelIDs.size()), mergeComparator()); }
[ "public", "BinaryMergeIterator", "<", "Entry", ">", "getMergingIterator", "(", "List", "<", "ChannelWithMeta", ">", "channelIDs", ",", "List", "<", "FileIOChannel", ">", "openChannels", ")", "throws", "IOException", "{", "// create one iterator per channel id", "if", ...
Returns an iterator that iterates over the merged result from all given channels. @param channelIDs The channels that are to be merged and returned. @return An iterator over the merged records of the input channels. @throws IOException Thrown, if the readers encounter an I/O problem.
[ "Returns", "an", "iterator", "that", "iterates", "over", "the", "merged", "result", "from", "all", "given", "channels", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java#L90-L110
train
Returns an iterator over the entries in the specified channel ids.
[ 30522, 2270, 12441, 5017, 3351, 21646, 8844, 1026, 4443, 1028, 2131, 5017, 4726, 21646, 8844, 1006, 2862, 1026, 3149, 24415, 11368, 2050, 1028, 3149, 9821, 1010, 2862, 1026, 5371, 3695, 26058, 1028, 2330, 26058, 2015, 1007, 11618, 22834, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java
ThreadExecutorMap.apply
public static Executor apply(final Executor executor, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(executor, "executor"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Executor() { @Override public void execute(final Runnable command) { executor.execute(apply(command, eventExecutor)); } }; }
java
public static Executor apply(final Executor executor, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(executor, "executor"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new Executor() { @Override public void execute(final Runnable command) { executor.execute(apply(command, eventExecutor)); } }; }
[ "public", "static", "Executor", "apply", "(", "final", "Executor", "executor", ",", "final", "EventExecutor", "eventExecutor", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "executor", ",", "\"executor\"", ")", ";", "ObjectUtil", ".", "checkNotNull", "(", "e...
Decorate the given {@link Executor} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution.
[ "Decorate", "the", "given", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L51-L60
train
Create an Executor that will execute the given Runnable on the given EventExecutor.
[ 30522, 2270, 10763, 4654, 8586, 16161, 2099, 6611, 1006, 2345, 4654, 8586, 16161, 2099, 4654, 8586, 16161, 2099, 1010, 2345, 2724, 10288, 8586, 16161, 2099, 2724, 10288, 8586, 16161, 2099, 1007, 1063, 4874, 21823, 2140, 1012, 4638, 17048, 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/concurrent/FutureUtils.java
FutureUtils.whenCompleteAsyncIfNotDone
public static <IN> CompletableFuture<IN> whenCompleteAsyncIfNotDone( CompletableFuture<IN> completableFuture, Executor executor, BiConsumer<? super IN, ? super Throwable> whenCompleteFun) { return completableFuture.isDone() ? completableFuture.whenComplete(whenCompleteFun) : completableFuture.whenCompleteAsync(whenCompleteFun, executor); }
java
public static <IN> CompletableFuture<IN> whenCompleteAsyncIfNotDone( CompletableFuture<IN> completableFuture, Executor executor, BiConsumer<? super IN, ? super Throwable> whenCompleteFun) { return completableFuture.isDone() ? completableFuture.whenComplete(whenCompleteFun) : completableFuture.whenCompleteAsync(whenCompleteFun, executor); }
[ "public", "static", "<", "IN", ">", "CompletableFuture", "<", "IN", ">", "whenCompleteAsyncIfNotDone", "(", "CompletableFuture", "<", "IN", ">", "completableFuture", ",", "Executor", "executor", ",", "BiConsumer", "<", "?", "super", "IN", ",", "?", "super", "T...
This function takes a {@link CompletableFuture} and a bi-consumer to call on completion of this future. If the input future is already done, this function returns {@link CompletableFuture#whenComplete(BiConsumer)}. Otherwise, the return value is {@link CompletableFuture#whenCompleteAsync(BiConsumer, Executor)} with the given executor. @param completableFuture the completable future for which we want to call #whenComplete. @param executor the executor to run the whenComplete function if the future is not yet done. @param whenCompleteFun the bi-consumer function to call when the future is completed. @param <IN> type of the input future. @return the new completion stage.
[ "This", "function", "takes", "a", "{", "@link", "CompletableFuture", "}", "and", "a", "bi", "-", "consumer", "to", "call", "on", "completion", "of", "this", "future", ".", "If", "the", "input", "future", "is", "already", "done", "this", "function", "return...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L879-L886
train
When the given CompletableFuture is completed asynchronously or if it is not done it will be completed with the given executor.
[ 30522, 2270, 10763, 30524, 12273, 10128, 17048, 5280, 2063, 1006, 4012, 10814, 10880, 11263, 11244, 1026, 1999, 1028, 4012, 10814, 10880, 11263, 11244, 1010, 4654, 8586, 16161, 2099, 4654, 8586, 16161, 2099, 1010, 12170, 8663, 23545, 2099, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java
TextRankKeyword.getTermAndRank
public Map<String, Float> getTermAndRank(List<Term> termList) { List<String> wordList = new ArrayList<String>(termList.size()); for (Term t : termList) { if (shouldInclude(t)) { wordList.add(t.word); } } // System.out.println(wordList); Map<String, Set<String>> words = new TreeMap<String, Set<String>>(); Queue<String> que = new LinkedList<String>(); for (String w : wordList) { if (!words.containsKey(w)) { words.put(w, new TreeSet<String>()); } // 复杂度O(n-1) if (que.size() >= 5) { que.poll(); } for (String qWord : que) { if (w.equals(qWord)) { continue; } //既然是邻居,那么关系是相互的,遍历一遍即可 words.get(w).add(qWord); words.get(qWord).add(w); } que.offer(w); } // System.out.println(words); Map<String, Float> score = new HashMap<String, Float>(); //依据TF来设置初值 for (Map.Entry<String, Set<String>> entry : words.entrySet()) { score.put(entry.getKey(), sigMoid(entry.getValue().size())); } for (int i = 0; i < max_iter; ++i) { Map<String, Float> m = new HashMap<String, Float>(); float max_diff = 0; for (Map.Entry<String, Set<String>> entry : words.entrySet()) { String key = entry.getKey(); Set<String> value = entry.getValue(); m.put(key, 1 - d); for (String element : value) { int size = words.get(element).size(); if (key.equals(element) || size == 0) continue; m.put(key, m.get(key) + d / size * (score.get(element) == null ? 0 : score.get(element))); } max_diff = Math.max(max_diff, Math.abs(m.get(key) - (score.get(key) == null ? 0 : score.get(key)))); } score = m; if (max_diff <= min_diff) break; } return score; }
java
public Map<String, Float> getTermAndRank(List<Term> termList) { List<String> wordList = new ArrayList<String>(termList.size()); for (Term t : termList) { if (shouldInclude(t)) { wordList.add(t.word); } } // System.out.println(wordList); Map<String, Set<String>> words = new TreeMap<String, Set<String>>(); Queue<String> que = new LinkedList<String>(); for (String w : wordList) { if (!words.containsKey(w)) { words.put(w, new TreeSet<String>()); } // 复杂度O(n-1) if (que.size() >= 5) { que.poll(); } for (String qWord : que) { if (w.equals(qWord)) { continue; } //既然是邻居,那么关系是相互的,遍历一遍即可 words.get(w).add(qWord); words.get(qWord).add(w); } que.offer(w); } // System.out.println(words); Map<String, Float> score = new HashMap<String, Float>(); //依据TF来设置初值 for (Map.Entry<String, Set<String>> entry : words.entrySet()) { score.put(entry.getKey(), sigMoid(entry.getValue().size())); } for (int i = 0; i < max_iter; ++i) { Map<String, Float> m = new HashMap<String, Float>(); float max_diff = 0; for (Map.Entry<String, Set<String>> entry : words.entrySet()) { String key = entry.getKey(); Set<String> value = entry.getValue(); m.put(key, 1 - d); for (String element : value) { int size = words.get(element).size(); if (key.equals(element) || size == 0) continue; m.put(key, m.get(key) + d / size * (score.get(element) == null ? 0 : score.get(element))); } max_diff = Math.max(max_diff, Math.abs(m.get(key) - (score.get(key) == null ? 0 : score.get(key)))); } score = m; if (max_diff <= min_diff) break; } return score; }
[ "public", "Map", "<", "String", ",", "Float", ">", "getTermAndRank", "(", "List", "<", "Term", ">", "termList", ")", "{", "List", "<", "String", ">", "wordList", "=", "new", "ArrayList", "<", "String", ">", "(", "termList", ".", "size", "(", ")", ")"...
使用已经分好的词来计算rank @param termList @return
[ "使用已经分好的词来计算rank" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankKeyword.java#L113-L178
train
Get the term and rank.
[ 30522, 2270, 4949, 1026, 5164, 1010, 14257, 1028, 2131, 3334, 2386, 24914, 2243, 1006, 2862, 1026, 2744, 1028, 2744, 9863, 1007, 1063, 2862, 1026, 5164, 1028, 2773, 9863, 1027, 2047, 9140, 9863, 1026, 5164, 1028, 1006, 2744, 9863, 1012, 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-json/src/main/java/cn/hutool/json/JSONArray.java
JSONArray.init
private void init(JSONTokener x) { if (x.nextClean() != '[') { throw x.syntaxError("A JSONArray text must start with '['"); } if (x.nextClean() != ']') { x.back(); for (;;) { if (x.nextClean() == ',') { x.back(); this.rawList.add(JSONNull.NULL); } else { x.back(); this.rawList.add(x.nextValue()); } switch (x.nextClean()) { case ',': if (x.nextClean() == ']') { return; } x.back(); break; case ']': return; default: throw x.syntaxError("Expected a ',' or ']'"); } } } }
java
private void init(JSONTokener x) { if (x.nextClean() != '[') { throw x.syntaxError("A JSONArray text must start with '['"); } if (x.nextClean() != ']') { x.back(); for (;;) { if (x.nextClean() == ',') { x.back(); this.rawList.add(JSONNull.NULL); } else { x.back(); this.rawList.add(x.nextValue()); } switch (x.nextClean()) { case ',': if (x.nextClean() == ']') { return; } x.back(); break; case ']': return; default: throw x.syntaxError("Expected a ',' or ']'"); } } } }
[ "private", "void", "init", "(", "JSONTokener", "x", ")", "{", "if", "(", "x", ".", "nextClean", "(", ")", "!=", "'", "'", ")", "{", "throw", "x", ".", "syntaxError", "(", "\"A JSONArray text must start with '['\"", ")", ";", "}", "if", "(", "x", ".", ...
初始化 @param x {@link JSONTokener}
[ "初始化" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONArray.java#L597-L625
train
Initializes the JSONArray object with the contents of the specified JSONTokener object.
[ 30522, 2797, 11675, 1999, 4183, 1006, 1046, 3385, 18715, 24454, 1060, 1007, 1063, 2065, 1006, 1060, 1012, 2279, 14321, 2319, 1006, 1007, 999, 1027, 1005, 1031, 1005, 1007, 1063, 5466, 1060, 1012, 20231, 2121, 29165, 1006, 1000, 1037, 1046, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java
WatchMonitor.create
public static WatchMonitor create(Path path, WatchEvent.Kind<?>... events){ return create(path, 0, events); }
java
public static WatchMonitor create(Path path, WatchEvent.Kind<?>... events){ return create(path, 0, events); }
[ "public", "static", "WatchMonitor", "create", "(", "Path", "path", ",", "WatchEvent", ".", "Kind", "<", "?", ">", "...", "events", ")", "{", "return", "create", "(", "path", ",", "0", ",", "events", ")", ";", "}" ]
创建并初始化监听 @param path 路径 @param events 监听事件列表 @return 监听对象
[ "创建并初始化监听" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L172-L174
train
Creates a new watch monitor that will watch the given path for events.
[ 30522, 2270, 10763, 3422, 8202, 15660, 3443, 1006, 4130, 4130, 1010, 3422, 18697, 3372, 1012, 2785, 1026, 1029, 1028, 1012, 1012, 1012, 2824, 1007, 1063, 2709, 3443, 1006, 4130, 1010, 1014, 1010, 2824, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/logging/DeferredLog.java
DeferredLog.replay
public static Log replay(Log source, Log destination) { if (source instanceof DeferredLog) { ((DeferredLog) source).replayTo(destination); } return destination; }
java
public static Log replay(Log source, Log destination) { if (source instanceof DeferredLog) { ((DeferredLog) source).replayTo(destination); } return destination; }
[ "public", "static", "Log", "replay", "(", "Log", "source", ",", "Log", "destination", ")", "{", "if", "(", "source", "instanceof", "DeferredLog", ")", "{", "(", "(", "DeferredLog", ")", "source", ")", ".", "replayTo", "(", "destination", ")", ";", "}", ...
Replay from a source log to a destination log when the source is deferred. @param source the source logger @param destination the destination logger @return the destination
[ "Replay", "from", "a", "source", "log", "to", "a", "destination", "log", "when", "the", "source", "is", "deferred", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java#L210-L215
train
Replays the source log to the destination log.
[ 30522, 2270, 10763, 8833, 15712, 1006, 8833, 3120, 1010, 8833, 7688, 1007, 1063, 2065, 1006, 3120, 6013, 11253, 13366, 28849, 19422, 8649, 1007, 1063, 1006, 1006, 13366, 28849, 19422, 8649, 1007, 3120, 1007, 1012, 15712, 3406, 1006, 7688, 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
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java
OpenSslSessionContext.setTicketKeys
public void setTicketKeys(OpenSslSessionTicketKey... keys) { ObjectUtil.checkNotNull(keys, "keys"); SessionTicketKey[] ticketKeys = new SessionTicketKey[keys.length]; for (int i = 0; i < ticketKeys.length; i++) { ticketKeys[i] = keys[i].key; } Lock writerLock = context.ctxLock.writeLock(); writerLock.lock(); try { SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET); SSLContext.setSessionTicketKeys(context.ctx, ticketKeys); } finally { writerLock.unlock(); } }
java
public void setTicketKeys(OpenSslSessionTicketKey... keys) { ObjectUtil.checkNotNull(keys, "keys"); SessionTicketKey[] ticketKeys = new SessionTicketKey[keys.length]; for (int i = 0; i < ticketKeys.length; i++) { ticketKeys[i] = keys[i].key; } Lock writerLock = context.ctxLock.writeLock(); writerLock.lock(); try { SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET); SSLContext.setSessionTicketKeys(context.ctx, ticketKeys); } finally { writerLock.unlock(); } }
[ "public", "void", "setTicketKeys", "(", "OpenSslSessionTicketKey", "...", "keys", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "keys", ",", "\"keys\"", ")", ";", "SessionTicketKey", "[", "]", "ticketKeys", "=", "new", "SessionTicketKey", "[", "keys", ".", ...
Sets the SSL session ticket keys of this context.
[ "Sets", "the", "SSL", "session", "ticket", "keys", "of", "this", "context", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java#L100-L114
train
Set the session ticket keys.
[ 30522, 2270, 11675, 2275, 26348, 3388, 14839, 2015, 1006, 7480, 14540, 8583, 10992, 26348, 3388, 14839, 1012, 1012, 1012, 6309, 1007, 1063, 4874, 21823, 2140, 1012, 4638, 17048, 11231, 3363, 1006, 6309, 1010, 1000, 6309, 1000, 1007, 1025, 5...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpBase.java
HttpBase.header
public T header(String name, String value, boolean isOverride) { if(null != name && null != value){ final List<String> values = headers.get(name.trim()); if(isOverride || CollectionUtil.isEmpty(values)) { final ArrayList<String> valueList = new ArrayList<String>(); valueList.add(value); headers.put(name.trim(), valueList); }else { values.add(value.trim()); } } return (T) this; }
java
public T header(String name, String value, boolean isOverride) { if(null != name && null != value){ final List<String> values = headers.get(name.trim()); if(isOverride || CollectionUtil.isEmpty(values)) { final ArrayList<String> valueList = new ArrayList<String>(); valueList.add(value); headers.put(name.trim(), valueList); }else { values.add(value.trim()); } } return (T) this; }
[ "public", "T", "header", "(", "String", "name", ",", "String", "value", ",", "boolean", "isOverride", ")", "{", "if", "(", "null", "!=", "name", "&&", "null", "!=", "value", ")", "{", "final", "List", "<", "String", ">", "values", "=", "headers", "."...
设置一个header<br> 如果覆盖模式,则替换之前的值,否则加入到值列表中 @param name Header名 @param value Header值 @param isOverride 是否覆盖已有值 @return T 本身
[ "设置一个header<br", ">", "如果覆盖模式,则替换之前的值,否则加入到值列表中" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L89-L101
train
Adds a header to the response.
[ 30522, 2270, 1056, 20346, 1006, 5164, 2171, 1010, 5164, 3643, 1010, 22017, 20898, 11163, 6299, 15637, 1007, 1063, 2065, 1006, 19701, 999, 1027, 2171, 1004, 1004, 19701, 999, 1027, 3643, 1007, 1063, 2345, 2862, 1026, 5164, 1028, 5300, 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-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java
ConnectionUtils.findAddressUsingStrategy
private static InetAddress findAddressUsingStrategy(AddressDetectionState strategy, InetSocketAddress targetAddress, boolean logging) throws IOException { // try LOCAL_HOST strategy independent of the network interfaces if (strategy == AddressDetectionState.LOCAL_HOST) { InetAddress localhostName; try { localhostName = InetAddress.getLocalHost(); } catch (UnknownHostException uhe) { LOG.warn("Could not resolve local hostname to an IP address: {}", uhe.getMessage()); return null; } if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); // Here, we are not calling tryLocalHostBeforeReturning() because it is the LOCAL_HOST strategy return localhostName; } else { return null; } } final InetAddress address = targetAddress.getAddress(); if (address == null) { return null; } final byte[] targetAddressBytes = address.getAddress(); // for each network interface Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface netInterface = e.nextElement(); // for each address of the network interface Enumeration<InetAddress> ee = netInterface.getInetAddresses(); while (ee.hasMoreElements()) { InetAddress interfaceAddress = ee.nextElement(); switch (strategy) { case ADDRESS: if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); } } break; case FAST_CONNECT: case SLOW_CONNECT: LOG.debug("Trying to connect to {} from local address {} with timeout {}", targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); } break; case HEURISTIC: if (LOG.isDebugEnabled()) { LOG.debug("Choosing InetAddress.getLocalHost() address as a heuristic."); } return InetAddress.getLocalHost(); default: throw new RuntimeException("Unsupported strategy: " + strategy); } } // end for each address of the interface } // end for each interface return null; }
java
private static InetAddress findAddressUsingStrategy(AddressDetectionState strategy, InetSocketAddress targetAddress, boolean logging) throws IOException { // try LOCAL_HOST strategy independent of the network interfaces if (strategy == AddressDetectionState.LOCAL_HOST) { InetAddress localhostName; try { localhostName = InetAddress.getLocalHost(); } catch (UnknownHostException uhe) { LOG.warn("Could not resolve local hostname to an IP address: {}", uhe.getMessage()); return null; } if (tryToConnect(localhostName, targetAddress, strategy.getTimeout(), logging)) { LOG.debug("Using InetAddress.getLocalHost() immediately for the connecting address"); // Here, we are not calling tryLocalHostBeforeReturning() because it is the LOCAL_HOST strategy return localhostName; } else { return null; } } final InetAddress address = targetAddress.getAddress(); if (address == null) { return null; } final byte[] targetAddressBytes = address.getAddress(); // for each network interface Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface netInterface = e.nextElement(); // for each address of the network interface Enumeration<InetAddress> ee = netInterface.getInetAddresses(); while (ee.hasMoreElements()) { InetAddress interfaceAddress = ee.nextElement(); switch (strategy) { case ADDRESS: if (hasCommonPrefix(targetAddressBytes, interfaceAddress.getAddress())) { LOG.debug("Target address {} and local address {} share prefix - trying to connect.", targetAddress, interfaceAddress); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); } } break; case FAST_CONNECT: case SLOW_CONNECT: LOG.debug("Trying to connect to {} from local address {} with timeout {}", targetAddress, interfaceAddress, strategy.getTimeout()); if (tryToConnect(interfaceAddress, targetAddress, strategy.getTimeout(), logging)) { return tryLocalHostBeforeReturning(interfaceAddress, targetAddress, logging); } break; case HEURISTIC: if (LOG.isDebugEnabled()) { LOG.debug("Choosing InetAddress.getLocalHost() address as a heuristic."); } return InetAddress.getLocalHost(); default: throw new RuntimeException("Unsupported strategy: " + strategy); } } // end for each address of the interface } // end for each interface return null; }
[ "private", "static", "InetAddress", "findAddressUsingStrategy", "(", "AddressDetectionState", "strategy", ",", "InetSocketAddress", "targetAddress", ",", "boolean", "logging", ")", "throws", "IOException", "{", "// try LOCAL_HOST strategy independent of the network interfaces", "...
Try to find a local address which allows as to connect to the targetAddress using the given strategy. @param strategy Depending on the strategy, the method will enumerate all interfaces, trying to connect to the target address @param targetAddress The address we try to connect to @param logging Boolean indicating the logging verbosity @return null if we could not find an address using this strategy, otherwise, the local address. @throws IOException
[ "Try", "to", "find", "a", "local", "address", "which", "allows", "as", "to", "connect", "to", "the", "targetAddress", "using", "the", "given", "strategy", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java#L219-L294
train
Find the address using the given strategy and target address.
[ 30522, 2797, 10763, 1999, 12928, 14141, 8303, 2424, 4215, 16200, 4757, 18161, 20528, 2618, 6292, 1006, 4769, 3207, 26557, 9285, 12259, 5656, 1010, 1999, 8454, 7432, 12928, 14141, 8303, 4539, 4215, 16200, 4757, 1010, 22017, 20898, 15899, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java
FutureUtils.retryWithDelay
public static <T> CompletableFuture<T> retryWithDelay( final Supplier<CompletableFuture<T>> operation, final int retries, final Time retryDelay, final ScheduledExecutor scheduledExecutor) { return retryWithDelay( operation, retries, retryDelay, (throwable) -> true, scheduledExecutor); }
java
public static <T> CompletableFuture<T> retryWithDelay( final Supplier<CompletableFuture<T>> operation, final int retries, final Time retryDelay, final ScheduledExecutor scheduledExecutor) { return retryWithDelay( operation, retries, retryDelay, (throwable) -> true, scheduledExecutor); }
[ "public", "static", "<", "T", ">", "CompletableFuture", "<", "T", ">", "retryWithDelay", "(", "final", "Supplier", "<", "CompletableFuture", "<", "T", ">", ">", "operation", ",", "final", "int", "retries", ",", "final", "Time", "retryDelay", ",", "final", ...
Retry the given operation with the given delay in between failures. @param operation to retry @param retries number of retries @param retryDelay delay between retries @param scheduledExecutor executor to be used for the retry operation @param <T> type of the result @return Future which retries the given operation a given amount of times and delays the retry in case of failures
[ "Retry", "the", "given", "operation", "with", "the", "given", "delay", "in", "between", "failures", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L175-L186
train
Retry with delay.
[ 30522, 2270, 10763, 1026, 1056, 1028, 4012, 10814, 10880, 11263, 11244, 1026, 1056, 1028, 2128, 11129, 24415, 9247, 4710, 1006, 2345, 17024, 1026, 4012, 10814, 10880, 11263, 11244, 1026, 1056, 1028, 1028, 3169, 1010, 2345, 20014, 2128, 21011,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java
HttpResponseStatus.valueOf
public static HttpResponseStatus valueOf(int code, String reasonPhrase) { HttpResponseStatus responseStatus = valueOf0(code); return responseStatus != null && responseStatus.reasonPhrase().contentEquals(reasonPhrase) ? responseStatus : new HttpResponseStatus(code, reasonPhrase); }
java
public static HttpResponseStatus valueOf(int code, String reasonPhrase) { HttpResponseStatus responseStatus = valueOf0(code); return responseStatus != null && responseStatus.reasonPhrase().contentEquals(reasonPhrase) ? responseStatus : new HttpResponseStatus(code, reasonPhrase); }
[ "public", "static", "HttpResponseStatus", "valueOf", "(", "int", "code", ",", "String", "reasonPhrase", ")", "{", "HttpResponseStatus", "responseStatus", "=", "valueOf0", "(", "code", ")", ";", "return", "responseStatus", "!=", "null", "&&", "responseStatus", ".",...
Returns the {@link HttpResponseStatus} represented by the specified {@code code} and {@code reasonPhrase}. If the specified code is a standard HTTP status {@code code} and {@code reasonPhrase}, a cached instance will be returned. Otherwise, a new instance will be returned. @param code The response code value. @param reasonPhrase The response code reason phrase. @return the {@link HttpResponseStatus} represented by the specified {@code code} and {@code reasonPhrase}.
[ "Returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java#L464-L468
train
Gets a new instance of the class with the specified HTTP status code and reason phrase.
[ 30522, 2270, 10763, 8299, 6072, 26029, 8583, 29336, 2271, 3643, 11253, 1006, 20014, 3642, 1010, 5164, 3114, 8458, 23797, 1007, 1063, 8299, 6072, 26029, 8583, 29336, 2271, 10960, 29336, 2271, 1027, 3643, 11253, 2692, 1006, 3642, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.filter
public static <T> Collection<T> filter(Collection<T> collection, Filter<T> filter) { if (null == collection || null == filter) { return collection; } Collection<T> collection2 = ObjectUtil.clone(collection); try { collection2.clear(); } catch (UnsupportedOperationException e) { // 克隆后的对象不支持清空,说明为不可变集合对象,使用默认的ArrayList保存结果 collection2 = new ArrayList<>(); } for (T t : collection) { if (filter.accept(t)) { collection2.add(t); } } return collection2; }
java
public static <T> Collection<T> filter(Collection<T> collection, Filter<T> filter) { if (null == collection || null == filter) { return collection; } Collection<T> collection2 = ObjectUtil.clone(collection); try { collection2.clear(); } catch (UnsupportedOperationException e) { // 克隆后的对象不支持清空,说明为不可变集合对象,使用默认的ArrayList保存结果 collection2 = new ArrayList<>(); } for (T t : collection) { if (filter.accept(t)) { collection2.add(t); } } return collection2; }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "filter", "(", "Collection", "<", "T", ">", "collection", ",", "Filter", "<", "T", ">", "filter", ")", "{", "if", "(", "null", "==", "collection", "||", "null", "==", "filter", ")", "{...
过滤<br> 过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能: <pre> 1、过滤出需要的对象,{@link Filter#accept(Object)}方法返回true的对象将被加入结果集合中 </pre> @param <T> 集合元素类型 @param collection 集合 @param filter 过滤器 @return 过滤后的数组 @since 3.1.0
[ "过滤<br", ">", "过滤过程通过传入的Filter实现来过滤返回需要的元素内容,这个Filter实现可以实现以下功能:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1004-L1023
train
Returns a new collection with all the items in the given collection that match the criteria specified in the given filter.
[ 30522, 2270, 10763, 1026, 1056, 1028, 3074, 1026, 1056, 1028, 11307, 1006, 3074, 1026, 1056, 1028, 3074, 1010, 11307, 1026, 1056, 1028, 11307, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 3074, 1064, 1064, 19701, 1027, 1027, 11307, 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-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java
StreamingFileSink.forBulkFormat
public static <IN> StreamingFileSink.BulkFormatBuilder<IN, String> forBulkFormat( final Path basePath, final BulkWriter.Factory<IN> writerFactory) { return new StreamingFileSink.BulkFormatBuilder<>(basePath, writerFactory, new DateTimeBucketAssigner<>()); }
java
public static <IN> StreamingFileSink.BulkFormatBuilder<IN, String> forBulkFormat( final Path basePath, final BulkWriter.Factory<IN> writerFactory) { return new StreamingFileSink.BulkFormatBuilder<>(basePath, writerFactory, new DateTimeBucketAssigner<>()); }
[ "public", "static", "<", "IN", ">", "StreamingFileSink", ".", "BulkFormatBuilder", "<", "IN", ",", "String", ">", "forBulkFormat", "(", "final", "Path", "basePath", ",", "final", "BulkWriter", ".", "Factory", "<", "IN", ">", "writerFactory", ")", "{", "retur...
Creates the builder for a {@link StreamingFileSink} with row-encoding format. @param basePath the base path where all the buckets are going to be created as sub-directories. @param writerFactory the {@link BulkWriter.Factory} to be used when writing elements in the buckets. @param <IN> the type of incoming elements @return The builder where the remaining of the configuration parameters for the sink can be configured. In order to instantiate the sink, call {@link RowFormatBuilder#build()} after specifying the desired parameters.
[ "Creates", "the", "builder", "for", "a", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/filesystem/StreamingFileSink.java#L165-L168
train
Create a bulk format builder.
[ 30522, 2270, 10763, 1026, 1999, 1028, 11058, 8873, 4244, 19839, 1012, 9625, 14192, 4017, 8569, 23891, 2099, 1026, 1999, 1010, 5164, 1028, 2005, 8569, 13687, 14192, 4017, 1006, 2345, 4130, 2918, 15069, 1010, 2345, 9625, 15994, 1012, 4713, 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-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java
WindowOperator.deleteCleanupTimer
protected void deleteCleanupTimer(W window) { long cleanupTime = cleanupTime(window); if (cleanupTime == Long.MAX_VALUE) { // no need to clean up because we didn't set one return; } if (windowAssigner.isEventTime()) { triggerContext.deleteEventTimeTimer(cleanupTime); } else { triggerContext.deleteProcessingTimeTimer(cleanupTime); } }
java
protected void deleteCleanupTimer(W window) { long cleanupTime = cleanupTime(window); if (cleanupTime == Long.MAX_VALUE) { // no need to clean up because we didn't set one return; } if (windowAssigner.isEventTime()) { triggerContext.deleteEventTimeTimer(cleanupTime); } else { triggerContext.deleteProcessingTimeTimer(cleanupTime); } }
[ "protected", "void", "deleteCleanupTimer", "(", "W", "window", ")", "{", "long", "cleanupTime", "=", "cleanupTime", "(", "window", ")", ";", "if", "(", "cleanupTime", "==", "Long", ".", "MAX_VALUE", ")", "{", "// no need to clean up because we didn't set one", "re...
Deletes the cleanup timer set for the contents of the provided window. @param window the window whose state to discard
[ "Deletes", "the", "cleanup", "timer", "set", "for", "the", "contents", "of", "the", "provided", "window", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperator.java#L614-L625
train
Delete the cleanup timer for the given window.
[ 30522, 5123, 11675, 3972, 12870, 14321, 24076, 13876, 14428, 2099, 1006, 1059, 3332, 1007, 1063, 2146, 27686, 7292, 1027, 27686, 7292, 1006, 3332, 1007, 1025, 2065, 1006, 27686, 7292, 1027, 1027, 2146, 1012, 4098, 1035, 3643, 1007, 1063, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java
ServiceOperations.stopQuietly
public static Exception stopQuietly(Service service) { try { stop(service); } catch (Exception e) { LOG.warn("When stopping the service " + service.getName() + " : " + e, e); return e; } return null; }
java
public static Exception stopQuietly(Service service) { try { stop(service); } catch (Exception e) { LOG.warn("When stopping the service " + service.getName() + " : " + e, e); return e; } return null; }
[ "public", "static", "Exception", "stopQuietly", "(", "Service", "service", ")", "{", "try", "{", "stop", "(", "service", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "\"When stopping the service \"", "+", "service", "."...
Stop a service; if it is null do nothing. Exceptions are caught and logged at warn level. (but not Throwables). This operation is intended to be used in cleanup operations @param service a service; may be null @return any exception that was caught; null if none was.
[ "Stop", "a", "service", ";", "if", "it", "is", "null", "do", "nothing", ".", "Exceptions", "are", "caught", "and", "logged", "at", "warn", "level", ".", "(", "but", "not", "Throwables", ")", ".", "This", "operation", "is", "intended", "to", "be", "used...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/ServiceOperations.java#L129-L139
train
Stop the service and return an exception if it fails.
[ 30522, 2270, 10763, 6453, 2644, 15549, 3388, 2135, 1006, 2326, 2326, 1007, 1063, 3046, 1063, 2644, 1006, 2326, 1007, 1025, 1065, 4608, 1006, 6453, 1041, 1007, 1063, 8833, 1012, 11582, 1006, 1000, 2043, 7458, 1996, 2326, 1000, 1009, 2326, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java
SessionLogsToFileRepository.getLogRecords
public List<LogRecord> getLogRecords(SessionId sessionId) throws IOException { LogFile logFile = sessionToLogFileMap.get(sessionId); if (logFile == null) { return new ArrayList<>(); } List<LogRecord> logRecords = new ArrayList<>(); try { logFile.openLogReader(); ObjectInputStream logObjInStream = logFile.getLogReader(); LogRecord tmpLogRecord; while (null != (tmpLogRecord = (LogRecord) logObjInStream .readObject())) { logRecords.add(tmpLogRecord); } } catch (IOException | ClassNotFoundException ex) { logFile.closeLogReader(); return logRecords; } logFile.closeLogReader(); return logRecords; }
java
public List<LogRecord> getLogRecords(SessionId sessionId) throws IOException { LogFile logFile = sessionToLogFileMap.get(sessionId); if (logFile == null) { return new ArrayList<>(); } List<LogRecord> logRecords = new ArrayList<>(); try { logFile.openLogReader(); ObjectInputStream logObjInStream = logFile.getLogReader(); LogRecord tmpLogRecord; while (null != (tmpLogRecord = (LogRecord) logObjInStream .readObject())) { logRecords.add(tmpLogRecord); } } catch (IOException | ClassNotFoundException ex) { logFile.closeLogReader(); return logRecords; } logFile.closeLogReader(); return logRecords; }
[ "public", "List", "<", "LogRecord", ">", "getLogRecords", "(", "SessionId", "sessionId", ")", "throws", "IOException", "{", "LogFile", "logFile", "=", "sessionToLogFileMap", ".", "get", "(", "sessionId", ")", ";", "if", "(", "logFile", "==", "null", ")", "{"...
This returns the log records storied in the corresponding log file. This does *NOT* clear the log records in the file. @param sessionId session-id for which the file logs needs to be returned. @return A List of LogRecord objects, which can be <i>null</i>. @throws IOException IO exception can occur with reading the log file
[ "This", "returns", "the", "log", "records", "storied", "in", "the", "corresponding", "log", "file", ".", "This", "does", "*", "NOT", "*", "clear", "the", "log", "records", "in", "the", "file", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/SessionLogsToFileRepository.java#L91-L112
train
Gets the log records for the given session.
[ 30522, 2270, 2862, 1026, 8833, 2890, 27108, 2094, 1028, 2131, 21197, 2890, 27108, 5104, 1006, 5219, 3593, 5219, 3593, 1007, 11618, 22834, 10288, 24422, 1063, 8833, 8873, 30524, 21197, 8873, 16930, 9331, 1012, 2131, 1006, 5219, 3593, 1007, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/NetUtil.java
NetUtil.sysctlGetInt
private static Integer sysctlGetInt(String sysctlKey) throws IOException { Process process = new ProcessBuilder("sysctl", sysctlKey).start(); try { InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); if (line.startsWith(sysctlKey)) { for (int i = line.length() - 1; i > sysctlKey.length(); --i) { if (!Character.isDigit(line.charAt(i))) { return Integer.valueOf(line.substring(i + 1, line.length())); } } } return null; } finally { br.close(); } } finally { if (process != null) { process.destroy(); } } }
java
private static Integer sysctlGetInt(String sysctlKey) throws IOException { Process process = new ProcessBuilder("sysctl", sysctlKey).start(); try { InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); if (line.startsWith(sysctlKey)) { for (int i = line.length() - 1; i > sysctlKey.length(); --i) { if (!Character.isDigit(line.charAt(i))) { return Integer.valueOf(line.substring(i + 1, line.length())); } } } return null; } finally { br.close(); } } finally { if (process != null) { process.destroy(); } } }
[ "private", "static", "Integer", "sysctlGetInt", "(", "String", "sysctlKey", ")", "throws", "IOException", "{", "Process", "process", "=", "new", "ProcessBuilder", "(", "\"sysctl\"", ",", "sysctlKey", ")", ".", "start", "(", ")", ";", "try", "{", "InputStream",...
This will execute <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> with the {@code sysctlKey} which is expected to return the numeric value for for {@code sysctlKey}. @param sysctlKey The key which the return value corresponds to. @return The <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> value for {@code sysctlKey}.
[ "This", "will", "execute", "<a", "href", "=", "https", ":", "//", "www", ".", "freebsd", ".", "org", "/", "cgi", "/", "man", ".", "cgi?sysctl", "(", "8", ")", ">", "sysctl<", "/", "a", ">", "with", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L315-L339
train
Get Integer from sysctl
[ 30522, 2797, 10763, 16109, 25353, 11020, 19646, 18150, 18447, 1006, 5164, 25353, 11020, 19646, 14839, 1007, 11618, 22834, 10288, 24422, 1063, 2832, 2832, 1027, 2047, 2832, 8569, 23891, 2099, 1006, 1000, 25353, 11020, 19646, 1000, 1010, 25353, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java
LongHashPartition.get
public MatchIterator get(long key, int hashCode) { int bucket = hashCode & numBucketsMask; int bucketOffset = bucket << 4; MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits]; int segOffset = bucketOffset & segmentSizeMask; while (true) { long address = segment.getLong(segOffset + 8); if (address != INVALID_ADDRESS) { if (segment.getLong(segOffset) == key) { return valueIter(address); } else { bucket = (bucket + 1) & numBucketsMask; if (segOffset + 16 < segmentSize) { segOffset += 16; } else { bucketOffset = bucket << 4; segOffset = bucketOffset & segmentSizeMask; segment = buckets[bucketOffset >>> segmentSizeBits]; } } } else { return valueIter(INVALID_ADDRESS); } } }
java
public MatchIterator get(long key, int hashCode) { int bucket = hashCode & numBucketsMask; int bucketOffset = bucket << 4; MemorySegment segment = buckets[bucketOffset >>> segmentSizeBits]; int segOffset = bucketOffset & segmentSizeMask; while (true) { long address = segment.getLong(segOffset + 8); if (address != INVALID_ADDRESS) { if (segment.getLong(segOffset) == key) { return valueIter(address); } else { bucket = (bucket + 1) & numBucketsMask; if (segOffset + 16 < segmentSize) { segOffset += 16; } else { bucketOffset = bucket << 4; segOffset = bucketOffset & segmentSizeMask; segment = buckets[bucketOffset >>> segmentSizeBits]; } } } else { return valueIter(INVALID_ADDRESS); } } }
[ "public", "MatchIterator", "get", "(", "long", "key", ",", "int", "hashCode", ")", "{", "int", "bucket", "=", "hashCode", "&", "numBucketsMask", ";", "int", "bucketOffset", "=", "bucket", "<<", "4", ";", "MemorySegment", "segment", "=", "buckets", "[", "bu...
Returns an iterator for all the values for the given key, or null if no value found.
[ "Returns", "an", "iterator", "for", "all", "the", "values", "for", "the", "given", "key", "or", "null", "if", "no", "value", "found", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/hashtable/LongHashPartition.java#L255-L281
train
Returns the iterator for the given key and hashCode.
[ 30522, 2270, 2674, 21646, 8844, 2131, 1006, 2146, 3145, 1010, 20014, 23325, 16044, 1007, 1063, 20014, 13610, 1027, 23325, 16044, 1004, 15903, 12722, 8454, 9335, 2243, 1025, 20014, 13610, 27475, 3388, 1027, 13610, 1026, 1026, 1018, 1025, 3638,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.keyOrValueIsAbsent
private static <K, V> boolean keyOrValueIsAbsent(Entry<String, KeyValue<K, V>> entry) { KeyValue<K, V> kv = entry.getValue(); return kv.key == null || kv.value == null; }
java
private static <K, V> boolean keyOrValueIsAbsent(Entry<String, KeyValue<K, V>> entry) { KeyValue<K, V> kv = entry.getValue(); return kv.key == null || kv.value == null; }
[ "private", "static", "<", "K", ",", "V", ">", "boolean", "keyOrValueIsAbsent", "(", "Entry", "<", "String", ",", "KeyValue", "<", "K", ",", "V", ">", ">", "entry", ")", "{", "KeyValue", "<", "K", ",", "V", ">", "kv", "=", "entry", ".", "getValue", ...
--------------------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/LinkedOptionalMap.java#L208-L211
train
Checks if the key or value is absent.
[ 30522, 2797, 10763, 1026, 1047, 1010, 1058, 1028, 22017, 20898, 3145, 2953, 10175, 5657, 14268, 5910, 4765, 1006, 4443, 1026, 5164, 1010, 3145, 10175, 5657, 1026, 1047, 1010, 1058, 1028, 1028, 4443, 1007, 1063, 3145, 10175, 5657, 1026, 1047...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java
Bzip2BlockDecompressor.decodeHuffmanData
boolean decodeHuffmanData(final Bzip2HuffmanStageDecoder huffmanDecoder) { final Bzip2BitReader reader = this.reader; final byte[] bwtBlock = this.bwtBlock; final byte[] huffmanSymbolMap = this.huffmanSymbolMap; final int streamBlockSize = this.bwtBlock.length; final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol; final int[] bwtByteCounts = this.bwtByteCounts; final Bzip2MoveToFrontTable symbolMTF = this.symbolMTF; int bwtBlockLength = this.bwtBlockLength; int repeatCount = this.repeatCount; int repeatIncrement = this.repeatIncrement; int mtfValue = this.mtfValue; for (;;) { if (!reader.hasReadableBits(HUFFMAN_DECODE_MAX_CODE_LENGTH)) { this.bwtBlockLength = bwtBlockLength; this.repeatCount = repeatCount; this.repeatIncrement = repeatIncrement; this.mtfValue = mtfValue; return false; } final int nextSymbol = huffmanDecoder.nextSymbol(); if (nextSymbol == HUFFMAN_SYMBOL_RUNA) { repeatCount += repeatIncrement; repeatIncrement <<= 1; } else if (nextSymbol == HUFFMAN_SYMBOL_RUNB) { repeatCount += repeatIncrement << 1; repeatIncrement <<= 1; } else { if (repeatCount > 0) { if (bwtBlockLength + repeatCount > streamBlockSize) { throw new DecompressionException("block exceeds declared block size"); } final byte nextByte = huffmanSymbolMap[mtfValue]; bwtByteCounts[nextByte & 0xff] += repeatCount; while (--repeatCount >= 0) { bwtBlock[bwtBlockLength++] = nextByte; } repeatCount = 0; repeatIncrement = 1; } if (nextSymbol == huffmanEndOfBlockSymbol) { break; } if (bwtBlockLength >= streamBlockSize) { throw new DecompressionException("block exceeds declared block size"); } mtfValue = symbolMTF.indexToFront(nextSymbol - 1) & 0xff; final byte nextByte = huffmanSymbolMap[mtfValue]; bwtByteCounts[nextByte & 0xff]++; bwtBlock[bwtBlockLength++] = nextByte; } } this.bwtBlockLength = bwtBlockLength; initialiseInverseBWT(); return true; }
java
boolean decodeHuffmanData(final Bzip2HuffmanStageDecoder huffmanDecoder) { final Bzip2BitReader reader = this.reader; final byte[] bwtBlock = this.bwtBlock; final byte[] huffmanSymbolMap = this.huffmanSymbolMap; final int streamBlockSize = this.bwtBlock.length; final int huffmanEndOfBlockSymbol = this.huffmanEndOfBlockSymbol; final int[] bwtByteCounts = this.bwtByteCounts; final Bzip2MoveToFrontTable symbolMTF = this.symbolMTF; int bwtBlockLength = this.bwtBlockLength; int repeatCount = this.repeatCount; int repeatIncrement = this.repeatIncrement; int mtfValue = this.mtfValue; for (;;) { if (!reader.hasReadableBits(HUFFMAN_DECODE_MAX_CODE_LENGTH)) { this.bwtBlockLength = bwtBlockLength; this.repeatCount = repeatCount; this.repeatIncrement = repeatIncrement; this.mtfValue = mtfValue; return false; } final int nextSymbol = huffmanDecoder.nextSymbol(); if (nextSymbol == HUFFMAN_SYMBOL_RUNA) { repeatCount += repeatIncrement; repeatIncrement <<= 1; } else if (nextSymbol == HUFFMAN_SYMBOL_RUNB) { repeatCount += repeatIncrement << 1; repeatIncrement <<= 1; } else { if (repeatCount > 0) { if (bwtBlockLength + repeatCount > streamBlockSize) { throw new DecompressionException("block exceeds declared block size"); } final byte nextByte = huffmanSymbolMap[mtfValue]; bwtByteCounts[nextByte & 0xff] += repeatCount; while (--repeatCount >= 0) { bwtBlock[bwtBlockLength++] = nextByte; } repeatCount = 0; repeatIncrement = 1; } if (nextSymbol == huffmanEndOfBlockSymbol) { break; } if (bwtBlockLength >= streamBlockSize) { throw new DecompressionException("block exceeds declared block size"); } mtfValue = symbolMTF.indexToFront(nextSymbol - 1) & 0xff; final byte nextByte = huffmanSymbolMap[mtfValue]; bwtByteCounts[nextByte & 0xff]++; bwtBlock[bwtBlockLength++] = nextByte; } } this.bwtBlockLength = bwtBlockLength; initialiseInverseBWT(); return true; }
[ "boolean", "decodeHuffmanData", "(", "final", "Bzip2HuffmanStageDecoder", "huffmanDecoder", ")", "{", "final", "Bzip2BitReader", "reader", "=", "this", ".", "reader", ";", "final", "byte", "[", "]", "bwtBlock", "=", "this", ".", "bwtBlock", ";", "final", "byte",...
Reads the Huffman encoded data from the input stream, performs Run-Length Decoding and applies the Move To Front transform to reconstruct the Burrows-Wheeler Transform array.
[ "Reads", "the", "Huffman", "encoded", "data", "from", "the", "input", "stream", "performs", "Run", "-", "Length", "Decoding", "and", "applies", "the", "Move", "To", "Front", "transform", "to", "reconstruct", "the", "Burrows", "-", "Wheeler", "Transform", "arra...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockDecompressor.java#L171-L234
train
Decode the Huffman data.
[ 30522, 22017, 20898, 21933, 25383, 16093, 16715, 13832, 2696, 1006, 2345, 1038, 5831, 2361, 2475, 6979, 4246, 15154, 26702, 3207, 16044, 2099, 21301, 2386, 3207, 16044, 2099, 1007, 1063, 2345, 1038, 5831, 2361, 2475, 16313, 16416, 4063, 8068,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java
TextSimilarity.longestCommonSubstring
private static String longestCommonSubstring(String strA, String strB) { char[] chars_strA = strA.toCharArray(); char[] chars_strB = strB.toCharArray(); int m = chars_strA.length; int n = chars_strB.length; // 初始化矩阵数据,matrix[0][0]的值为0, 如果字符数组chars_strA和chars_strB的对应位相同,则matrix[i][j]的值为左上角的值加1, 否则,matrix[i][j]的值等于左上方最近两个位置的较大值, 矩阵中其余各点的值为0. int[][] matrix = new int[m + 1][n + 1]; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if (chars_strA[i - 1] == chars_strB[j - 1]) { matrix[i][j] = matrix[i - 1][j - 1] + 1; } else { matrix[i][j] = Math.max(matrix[i][j - 1], matrix[i - 1][j]); } } } // 矩阵中,如果matrix[m][n]的值不等于matrix[m-1][n]的值也不等于matrix[m][n-1]的值, 则matrix[m][n]对应的字符为相似字符元,并将其存入result数组中。 char[] result = new char[matrix[m][n]]; int currentIndex = result.length - 1; while (matrix[m][n] != 0) { if (matrix[m][n] == matrix[m][n - 1]) { n--; } else if (matrix[m][n] == matrix[m - 1][n]) { m--; } else { result[currentIndex] = chars_strA[m - 1]; currentIndex--; n--; m--; } } return new String(result); }
java
private static String longestCommonSubstring(String strA, String strB) { char[] chars_strA = strA.toCharArray(); char[] chars_strB = strB.toCharArray(); int m = chars_strA.length; int n = chars_strB.length; // 初始化矩阵数据,matrix[0][0]的值为0, 如果字符数组chars_strA和chars_strB的对应位相同,则matrix[i][j]的值为左上角的值加1, 否则,matrix[i][j]的值等于左上方最近两个位置的较大值, 矩阵中其余各点的值为0. int[][] matrix = new int[m + 1][n + 1]; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if (chars_strA[i - 1] == chars_strB[j - 1]) { matrix[i][j] = matrix[i - 1][j - 1] + 1; } else { matrix[i][j] = Math.max(matrix[i][j - 1], matrix[i - 1][j]); } } } // 矩阵中,如果matrix[m][n]的值不等于matrix[m-1][n]的值也不等于matrix[m][n-1]的值, 则matrix[m][n]对应的字符为相似字符元,并将其存入result数组中。 char[] result = new char[matrix[m][n]]; int currentIndex = result.length - 1; while (matrix[m][n] != 0) { if (matrix[m][n] == matrix[m][n - 1]) { n--; } else if (matrix[m][n] == matrix[m - 1][n]) { m--; } else { result[currentIndex] = chars_strA[m - 1]; currentIndex--; n--; m--; } } return new String(result); }
[ "private", "static", "String", "longestCommonSubstring", "(", "String", "strA", ",", "String", "strB", ")", "{", "char", "[", "]", "chars_strA", "=", "strA", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "chars_strB", "=", "strB", ".", "toCharArray"...
求公共子串,采用动态规划算法。 其不要求所求得的字符在所给的字符串中是连续的。 @param strA 字符串1 @param strB 字符串2 @return 公共子串
[ "求公共子串,采用动态规划算法。", "其不要求所求得的字符在所给的字符串中是连续的。" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/TextSimilarity.java#L86-L120
train
Returns the longest common substring of the two strings.
[ 30522, 2797, 10763, 5164, 6493, 9006, 16563, 12083, 3367, 4892, 1006, 5164, 2358, 2527, 1010, 5164, 2358, 15185, 1007, 1063, 25869, 1031, 1033, 25869, 2015, 1035, 2358, 2527, 1027, 2358, 2527, 1012, 2000, 7507, 19848, 9447, 1006, 1007, 1025...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java
IOUtil.saveTxt
public static boolean saveTxt(String path, String content) { try { FileChannel fc = new FileOutputStream(path).getChannel(); fc.write(ByteBuffer.wrap(content.getBytes())); fc.close(); } catch (Exception e) { logger.throwing("IOUtil", "saveTxt", e); logger.warning("IOUtil saveTxt 到" + path + "失败" + e.toString()); return false; } return true; }
java
public static boolean saveTxt(String path, String content) { try { FileChannel fc = new FileOutputStream(path).getChannel(); fc.write(ByteBuffer.wrap(content.getBytes())); fc.close(); } catch (Exception e) { logger.throwing("IOUtil", "saveTxt", e); logger.warning("IOUtil saveTxt 到" + path + "失败" + e.toString()); return false; } return true; }
[ "public", "static", "boolean", "saveTxt", "(", "String", "path", ",", "String", "content", ")", "{", "try", "{", "FileChannel", "fc", "=", "new", "FileOutputStream", "(", "path", ")", ".", "getChannel", "(", ")", ";", "fc", ".", "write", "(", "ByteBuffer...
快速保存 @param path @param content @return
[ "快速保存" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/io/IOUtil.java#L135-L150
train
SaveTxt 到 path
[ 30522, 2270, 10763, 22017, 20898, 3828, 2102, 18413, 1006, 5164, 4130, 1010, 5164, 4180, 1007, 1063, 3046, 1063, 5371, 26058, 4429, 1027, 2047, 5371, 5833, 18780, 21422, 1006, 4130, 1007, 1012, 2131, 26058, 1006, 1007, 1025, 4429, 1012, 433...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.fillBuffer
private boolean fillBuffer(int offset) throws IOException { int maxReadLength = this.readBuffer.length - offset; // special case for reading the whole split. if (this.splitLength == FileInputFormat.READ_WHOLE_SPLIT_FLAG) { int read = this.stream.read(this.readBuffer, offset, maxReadLength); if (read == -1) { this.stream.close(); this.stream = null; return false; } else { this.readPos = offset; this.limit = read; return true; } } // else .. int toRead; if (this.splitLength > 0) { // if we have more data, read that toRead = this.splitLength > maxReadLength ? maxReadLength : (int) this.splitLength; } else { // if we have exhausted our split, we need to complete the current record, or read one // more across the next split. // the reason is that the next split will skip over the beginning until it finds the first // delimiter, discarding it as an incomplete chunk of data that belongs to the last record in the // previous split. toRead = maxReadLength; this.overLimit = true; } int read = this.stream.read(this.readBuffer, offset, toRead); if (read == -1) { this.stream.close(); this.stream = null; return false; } else { this.splitLength -= read; this.readPos = offset; // position from where to start reading this.limit = read + offset; // number of valid bytes in the read buffer return true; } }
java
private boolean fillBuffer(int offset) throws IOException { int maxReadLength = this.readBuffer.length - offset; // special case for reading the whole split. if (this.splitLength == FileInputFormat.READ_WHOLE_SPLIT_FLAG) { int read = this.stream.read(this.readBuffer, offset, maxReadLength); if (read == -1) { this.stream.close(); this.stream = null; return false; } else { this.readPos = offset; this.limit = read; return true; } } // else .. int toRead; if (this.splitLength > 0) { // if we have more data, read that toRead = this.splitLength > maxReadLength ? maxReadLength : (int) this.splitLength; } else { // if we have exhausted our split, we need to complete the current record, or read one // more across the next split. // the reason is that the next split will skip over the beginning until it finds the first // delimiter, discarding it as an incomplete chunk of data that belongs to the last record in the // previous split. toRead = maxReadLength; this.overLimit = true; } int read = this.stream.read(this.readBuffer, offset, toRead); if (read == -1) { this.stream.close(); this.stream = null; return false; } else { this.splitLength -= read; this.readPos = offset; // position from where to start reading this.limit = read + offset; // number of valid bytes in the read buffer return true; } }
[ "private", "boolean", "fillBuffer", "(", "int", "offset", ")", "throws", "IOException", "{", "int", "maxReadLength", "=", "this", ".", "readBuffer", ".", "length", "-", "offset", ";", "// special case for reading the whole split.", "if", "(", "this", ".", "splitLe...
Fills the read buffer with bytes read from the file starting from an offset.
[ "Fills", "the", "read", "buffer", "with", "bytes", "read", "from", "the", "file", "starting", "from", "an", "offset", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/DelimitedInputFormat.java#L663-L707
train
Fills the read buffer with the bytes from the given offset.
[ 30522, 2797, 22017, 20898, 6039, 8569, 12494, 1006, 20014, 16396, 1007, 11618, 22834, 10288, 24422, 1063, 20014, 4098, 16416, 10362, 3070, 2705, 1027, 2023, 1012, 3191, 8569, 12494, 1012, 3091, 1011, 16396, 1025, 1013, 1013, 2569, 2553, 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...
apache/flink
flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopInputFormatBase.java
HadoopInputFormatBase.writeObject
private void writeObject(ObjectOutputStream out) throws IOException { super.write(out); out.writeUTF(mapredInputFormat.getClass().getName()); out.writeUTF(keyClass.getName()); out.writeUTF(valueClass.getName()); jobConf.write(out); }
java
private void writeObject(ObjectOutputStream out) throws IOException { super.write(out); out.writeUTF(mapredInputFormat.getClass().getName()); out.writeUTF(keyClass.getName()); out.writeUTF(valueClass.getName()); jobConf.write(out); }
[ "private", "void", "writeObject", "(", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "super", ".", "write", "(", "out", ")", ";", "out", ".", "writeUTF", "(", "mapredInputFormat", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-hadoop-compatibility/src/main/java/org/apache/flink/api/java/hadoop/mapred/HadoopInputFormatBase.java#L260-L266
train
Write the object to the stream.
[ 30522, 2797, 11675, 4339, 16429, 20614, 1006, 4874, 5833, 18780, 21422, 2041, 1007, 11618, 22834, 10288, 24422, 1063, 3565, 1012, 4339, 1006, 2041, 1007, 1025, 2041, 1012, 4339, 4904, 2546, 1006, 4949, 5596, 2378, 18780, 14192, 4017, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getLong
public static Long getLong(Map<?, ?> map, Object key) { return get(map, key, Long.class); }
java
public static Long getLong(Map<?, ?> map, Object key) { return get(map, key, Long.class); }
[ "public", "static", "Long", "getLong", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Long", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为Long @param map Map @param key 键 @return 值 @since 4.0.6
[ "获取Map指定key的值,并转换为Long" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L840-L842
train
Gets the long value from the map.
[ 30522, 2270, 10763, 2146, 2131, 10052, 1006, 4949, 1026, 1029, 1010, 1029, 1028, 4949, 1010, 4874, 3145, 1007, 1063, 2709, 2131, 1006, 4949, 1010, 3145, 1010, 2146, 1012, 2465, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java
SharedBuffer.upsertEntry
void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) { this.entryCache.put(nodeId, entry); }
java
void upsertEntry(NodeId nodeId, Lockable<SharedBufferNode> entry) { this.entryCache.put(nodeId, entry); }
[ "void", "upsertEntry", "(", "NodeId", "nodeId", ",", "Lockable", "<", "SharedBufferNode", ">", "entry", ")", "{", "this", ".", "entryCache", ".", "put", "(", "nodeId", ",", "entry", ")", ";", "}" ]
Inserts or updates a shareBufferNode in cache. @param nodeId id of the event @param entry SharedBufferNode
[ "Inserts", "or", "updates", "a", "shareBufferNode", "in", "cache", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBuffer.java#L172-L174
train
Upsert a shared buffer entry in the cache.
[ 30522, 11675, 11139, 8743, 4765, 2854, 1006, 13045, 3593, 13045, 3593, 1010, 5843, 3085, 1026, 4207, 8569, 12494, 3630, 3207, 1028, 4443, 1007, 1063, 2023, 1012, 4443, 3540, 5403, 1012, 2404, 1006, 13045, 3593, 1010, 4443, 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-core/src/main/java/org/apache/flink/util/FileUtils.java
FileUtils.getRandomFilename
public static String getRandomFilename(final String prefix) { final Random rnd = new Random(); final StringBuilder stringBuilder = new StringBuilder(prefix); for (int i = 0; i < RANDOM_FILE_NAME_LENGTH; i++) { stringBuilder.append(ALPHABET[rnd.nextInt(ALPHABET.length)]); } return stringBuilder.toString(); }
java
public static String getRandomFilename(final String prefix) { final Random rnd = new Random(); final StringBuilder stringBuilder = new StringBuilder(prefix); for (int i = 0; i < RANDOM_FILE_NAME_LENGTH; i++) { stringBuilder.append(ALPHABET[rnd.nextInt(ALPHABET.length)]); } return stringBuilder.toString(); }
[ "public", "static", "String", "getRandomFilename", "(", "final", "String", "prefix", ")", "{", "final", "Random", "rnd", "=", "new", "Random", "(", ")", ";", "final", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", "prefix", ")", ";", "fo...
Constructs a random filename with the given prefix and a random part generated from hex characters. @param prefix the prefix to the filename to be constructed @return the generated random filename with the given prefix
[ "Constructs", "a", "random", "filename", "with", "the", "given", "prefix", "and", "a", "random", "part", "generated", "from", "hex", "characters", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L90-L99
train
Get a random filename.
[ 30522, 2270, 10763, 5164, 2131, 13033, 5358, 8873, 20844, 4168, 1006, 2345, 5164, 17576, 1007, 1063, 2345, 6721, 29300, 2094, 1027, 2047, 6721, 1006, 1007, 1025, 2345, 5164, 8569, 23891, 2099, 5164, 8569, 23891, 2099, 1027, 2047, 5164, 8569...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.getDefaultValues
public static Object[] getDefaultValues(Class<?>... classes) { final Object[] values = new Object[classes.length]; for (int i = 0; i < classes.length; i++) { values[i] = getDefaultValue(classes[i]); } return values; }
java
public static Object[] getDefaultValues(Class<?>... classes) { final Object[] values = new Object[classes.length]; for (int i = 0; i < classes.length; i++) { values[i] = getDefaultValue(classes[i]); } return values; }
[ "public", "static", "Object", "[", "]", "getDefaultValues", "(", "Class", "<", "?", ">", "...", "classes", ")", "{", "final", "Object", "[", "]", "values", "=", "new", "Object", "[", "classes", ".", "length", "]", ";", "for", "(", "int", "i", "=", ...
获得默认值列表 @param classes 值类型 @return 默认值列表 @since 3.0.9
[ "获得默认值列表" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L1014-L1020
train
Gets the default values for the given classes.
[ 30522, 2270, 10763, 4874, 1031, 1033, 2131, 3207, 7011, 11314, 10175, 15808, 1006, 2465, 1026, 1029, 1028, 1012, 1012, 1012, 4280, 1007, 1063, 2345, 4874, 1031, 1033, 5300, 1027, 2047, 4874, 1031, 4280, 1012, 3091, 1033, 1025, 2005, 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...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/remote/http/HttpRequest.java
HttpRequest.addQueryParameter
public HttpRequest addQueryParameter(String name, String value) { queryParameters.put( Objects.requireNonNull(name, "Name must be set"), Objects.requireNonNull(value, "Value must be set")); return this; }
java
public HttpRequest addQueryParameter(String name, String value) { queryParameters.put( Objects.requireNonNull(name, "Name must be set"), Objects.requireNonNull(value, "Value must be set")); return this; }
[ "public", "HttpRequest", "addQueryParameter", "(", "String", "name", ",", "String", "value", ")", "{", "queryParameters", ".", "put", "(", "Objects", ".", "requireNonNull", "(", "name", ",", "\"Name must be set\"", ")", ",", "Objects", ".", "requireNonNull", "("...
Set a query parameter, adding to existing values if present. The implementation will ensure that the name and value are properly encoded.
[ "Set", "a", "query", "parameter", "adding", "to", "existing", "values", "if", "present", ".", "The", "implementation", "will", "ensure", "that", "the", "name", "and", "value", "are", "properly", "encoded", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/http/HttpRequest.java#L61-L66
train
Add a query parameter to the request.
[ 30522, 2270, 8299, 2890, 15500, 5587, 4226, 2854, 28689, 22828, 1006, 5164, 2171, 1010, 5164, 3643, 1007, 1063, 23032, 28689, 22828, 2015, 1012, 2404, 1006, 5200, 1012, 5478, 8540, 11231, 3363, 1006, 2171, 1010, 1000, 2171, 2442, 2022, 2275...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/java/typeutils/TupleTypeInfo.java
TupleTypeInfo.getBasicTupleTypeInfo
@PublicEvolving public static <X extends Tuple> TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes) { if (basicTypes == null || basicTypes.length == 0) { throw new IllegalArgumentException(); } TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length]; for (int i = 0; i < infos.length; i++) { Class<?> type = basicTypes[i]; if (type == null) { throw new IllegalArgumentException("Type at position " + i + " is null."); } TypeInformation<?> info = BasicTypeInfo.getInfoFor(type); if (info == null) { throw new IllegalArgumentException("Type at position " + i + " is not a basic type."); } infos[i] = info; } @SuppressWarnings("unchecked") TupleTypeInfo<X> tupleInfo = (TupleTypeInfo<X>) new TupleTypeInfo<Tuple>(infos); return tupleInfo; }
java
@PublicEvolving public static <X extends Tuple> TupleTypeInfo<X> getBasicTupleTypeInfo(Class<?>... basicTypes) { if (basicTypes == null || basicTypes.length == 0) { throw new IllegalArgumentException(); } TypeInformation<?>[] infos = new TypeInformation<?>[basicTypes.length]; for (int i = 0; i < infos.length; i++) { Class<?> type = basicTypes[i]; if (type == null) { throw new IllegalArgumentException("Type at position " + i + " is null."); } TypeInformation<?> info = BasicTypeInfo.getInfoFor(type); if (info == null) { throw new IllegalArgumentException("Type at position " + i + " is not a basic type."); } infos[i] = info; } @SuppressWarnings("unchecked") TupleTypeInfo<X> tupleInfo = (TupleTypeInfo<X>) new TupleTypeInfo<Tuple>(infos); return tupleInfo; }
[ "@", "PublicEvolving", "public", "static", "<", "X", "extends", "Tuple", ">", "TupleTypeInfo", "<", "X", ">", "getBasicTupleTypeInfo", "(", "Class", "<", "?", ">", "...", "basicTypes", ")", "{", "if", "(", "basicTypes", "==", "null", "||", "basicTypes", "....
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TupleTypeInfo.java#L216-L239
train
Gets the TupleTypeInfo for the given basic types.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 10763, 1026, 1060, 8908, 10722, 10814, 1028, 10722, 10814, 13874, 2378, 14876, 1026, 1060, 1028, 2131, 22083, 2594, 8525, 10814, 13874, 2378, 14876, 1006, 2465, 1026, 1029, 1028, 1012, 1012, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java
OpenSslX509KeyManagerFactory.newKeyless
public static OpenSslX509KeyManagerFactory newKeyless(File chain) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { return newKeyless(SslContext.toX509Certificates(chain)); }
java
public static OpenSslX509KeyManagerFactory newKeyless(File chain) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { return newKeyless(SslContext.toX509Certificates(chain)); }
[ "public", "static", "OpenSslX509KeyManagerFactory", "newKeyless", "(", "File", "chain", ")", "throws", "CertificateException", ",", "IOException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", ",", "UnrecoverableKeyException", "{", "return", "newKeyless", "(", ...
See {@link OpenSslX509KeyManagerFactory#newEngineBased(X509Certificate[], String)}.
[ "See", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L265-L269
train
Create a new OpenSslX509KeyManagerFactory for a file containing a certificate chain.
[ 30522, 2270, 10763, 7480, 14540, 2595, 12376, 2683, 14839, 24805, 4590, 21450, 2047, 14839, 3238, 1006, 5371, 4677, 1007, 11618, 8196, 10288, 24422, 1010, 22834, 10288, 24422, 1010, 6309, 19277, 10288, 24422, 1010, 16839, 10875, 2389, 20255, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getPublicMethods
public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods) { return ReflectUtil.getPublicMethods(clazz, excludeMethods); }
java
public static List<Method> getPublicMethods(Class<?> clazz, Method... excludeMethods) { return ReflectUtil.getPublicMethods(clazz, excludeMethods); }
[ "public", "static", "List", "<", "Method", ">", "getPublicMethods", "(", "Class", "<", "?", ">", "clazz", ",", "Method", "...", "excludeMethods", ")", "{", "return", "ReflectUtil", ".", "getPublicMethods", "(", "clazz", ",", "excludeMethods", ")", ";", "}" ]
获得指定类过滤后的Public方法列表 @param clazz 查找方法的类 @param excludeMethods 不包括的方法 @return 过滤后的方法列表
[ "获得指定类过滤后的Public方法列表" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L270-L272
train
Get a list of public methods of a class including those that are not excluded from the result.
[ 30522, 2270, 10763, 2862, 1026, 4118, 1028, 2131, 14289, 16558, 2594, 11368, 6806, 5104, 1006, 2465, 1026, 1029, 1028, 18856, 10936, 2480, 1010, 4118, 1012, 1012, 1012, 23329, 11368, 6806, 5104, 1007, 1063, 2709, 8339, 21823, 2140, 1012, 21...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionStatus.java
SpdySessionStatus.valueOf
public static SpdySessionStatus valueOf(int code) { switch (code) { case 0: return OK; case 1: return PROTOCOL_ERROR; case 2: return INTERNAL_ERROR; } return new SpdySessionStatus(code, "UNKNOWN (" + code + ')'); }
java
public static SpdySessionStatus valueOf(int code) { switch (code) { case 0: return OK; case 1: return PROTOCOL_ERROR; case 2: return INTERNAL_ERROR; } return new SpdySessionStatus(code, "UNKNOWN (" + code + ')'); }
[ "public", "static", "SpdySessionStatus", "valueOf", "(", "int", "code", ")", "{", "switch", "(", "code", ")", "{", "case", "0", ":", "return", "OK", ";", "case", "1", ":", "return", "PROTOCOL_ERROR", ";", "case", "2", ":", "return", "INTERNAL_ERROR", ";"...
Returns the {@link SpdySessionStatus} represented by the specified code. If the specified code is a defined SPDY status code, a cached instance will be returned. Otherwise, a new instance will be returned.
[ "Returns", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionStatus.java#L46-L57
train
Gets the status object for a specific session code.
[ 30522, 2270, 10763, 23772, 23274, 28231, 9153, 5809, 3643, 11253, 1006, 20014, 3642, 1007, 1063, 6942, 1006, 3642, 1007, 1063, 2553, 1014, 1024, 2709, 7929, 1025, 2553, 1015, 1024, 2709, 8778, 1035, 7561, 1025, 2553, 1016, 1024, 2709, 4722,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/trigram/CharacterBasedGenerativeModel.java
CharacterBasedGenerativeModel.train
public void train() { double tl1 = 0.0; double tl2 = 0.0; double tl3 = 0.0; for (String key : tf.d.keySet()) { if (key.length() != 6) continue; // tri samples char[][] now = new char[][] { {key.charAt(0), key.charAt(1)}, {key.charAt(2), key.charAt(3)}, {key.charAt(4), key.charAt(5)}, }; double c3 = div(tf.get(now) - 1, tf.get(now[0], now[1]) - 1); double c2 = div(tf.get(now[1], now[2]) - 1, tf.get(now[1]) - 1); double c1 = div(tf.get(now[2]) - 1, tf.getsum() - 1); if (c3 >= c1 && c3 >= c2) tl3 += tf.get(key.toCharArray()); else if (c2 >= c1 && c2 >= c3) tl2 += tf.get(key.toCharArray()); else if (c1 >= c2 && c1 >= c3) tl1 += tf.get(key.toCharArray()); } l1 = div(tl1, tl1 + tl2 + tl3); l2 = div(tl2, tl1 + tl2 + tl3); l3 = div(tl3, tl1 + tl2 + tl3); }
java
public void train() { double tl1 = 0.0; double tl2 = 0.0; double tl3 = 0.0; for (String key : tf.d.keySet()) { if (key.length() != 6) continue; // tri samples char[][] now = new char[][] { {key.charAt(0), key.charAt(1)}, {key.charAt(2), key.charAt(3)}, {key.charAt(4), key.charAt(5)}, }; double c3 = div(tf.get(now) - 1, tf.get(now[0], now[1]) - 1); double c2 = div(tf.get(now[1], now[2]) - 1, tf.get(now[1]) - 1); double c1 = div(tf.get(now[2]) - 1, tf.getsum() - 1); if (c3 >= c1 && c3 >= c2) tl3 += tf.get(key.toCharArray()); else if (c2 >= c1 && c2 >= c3) tl2 += tf.get(key.toCharArray()); else if (c1 >= c2 && c1 >= c3) tl1 += tf.get(key.toCharArray()); } l1 = div(tl1, tl1 + tl2 + tl3); l2 = div(tl2, tl1 + tl2 + tl3); l3 = div(tl3, tl1 + tl2 + tl3); }
[ "public", "void", "train", "(", ")", "{", "double", "tl1", "=", "0.0", ";", "double", "tl2", "=", "0.0", ";", "double", "tl3", "=", "0.0", ";", "for", "(", "String", "key", ":", "tf", ".", "d", ".", "keySet", "(", ")", ")", "{", "if", "(", "k...
观测结束,开始训练
[ "观测结束,开始训练" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/trigram/CharacterBasedGenerativeModel.java#L117-L145
train
Train the sequence of the tca file.
[ 30522, 2270, 11675, 3345, 1006, 1007, 1063, 3313, 1056, 2140, 2487, 1027, 1014, 1012, 1014, 1025, 3313, 1056, 2140, 2475, 1027, 1014, 1012, 1014, 1025, 3313, 1056, 2140, 2509, 1027, 1014, 1012, 1014, 1025, 2005, 1006, 5164, 3145, 1024, 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-java/src/main/java/org/apache/flink/api/java/operators/PartitionOperator.java
PartitionOperator.translateToDataFlow
protected org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateToDataFlow(Operator<T> input) { String name = "Partition at " + partitionLocationName; // distinguish between partition types if (pMethod == PartitionMethod.REBALANCE) { UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType()); PartitionOperatorBase<T> rebalancedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, name); rebalancedInput.setInput(input); rebalancedInput.setParallelism(getParallelism()); return rebalancedInput; } else if (pMethod == PartitionMethod.HASH || pMethod == PartitionMethod.CUSTOM || pMethod == PartitionMethod.RANGE) { if (pKeys instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = pKeys.computeLogicalKeyPositions(); UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType()); PartitionOperatorBase<T> partitionedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, logicalKeyPositions, name); partitionedInput.setInput(input); partitionedInput.setParallelism(getParallelism()); partitionedInput.setDistribution(distribution); partitionedInput.setCustomPartitioner(customPartitioner); partitionedInput.setOrdering(computeOrdering(pKeys, orders)); return partitionedInput; } else if (pKeys instanceof Keys.SelectorFunctionKeys) { @SuppressWarnings("unchecked") Keys.SelectorFunctionKeys<T, ?> selectorKeys = (Keys.SelectorFunctionKeys<T, ?>) pKeys; return translateSelectorFunctionPartitioner(selectorKeys, pMethod, name, input, getParallelism(), customPartitioner, orders); } else { throw new UnsupportedOperationException("Unrecognized key type."); } } else { throw new UnsupportedOperationException("Unsupported partitioning method: " + pMethod.name()); } }
java
protected org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateToDataFlow(Operator<T> input) { String name = "Partition at " + partitionLocationName; // distinguish between partition types if (pMethod == PartitionMethod.REBALANCE) { UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType()); PartitionOperatorBase<T> rebalancedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, name); rebalancedInput.setInput(input); rebalancedInput.setParallelism(getParallelism()); return rebalancedInput; } else if (pMethod == PartitionMethod.HASH || pMethod == PartitionMethod.CUSTOM || pMethod == PartitionMethod.RANGE) { if (pKeys instanceof Keys.ExpressionKeys) { int[] logicalKeyPositions = pKeys.computeLogicalKeyPositions(); UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType()); PartitionOperatorBase<T> partitionedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, logicalKeyPositions, name); partitionedInput.setInput(input); partitionedInput.setParallelism(getParallelism()); partitionedInput.setDistribution(distribution); partitionedInput.setCustomPartitioner(customPartitioner); partitionedInput.setOrdering(computeOrdering(pKeys, orders)); return partitionedInput; } else if (pKeys instanceof Keys.SelectorFunctionKeys) { @SuppressWarnings("unchecked") Keys.SelectorFunctionKeys<T, ?> selectorKeys = (Keys.SelectorFunctionKeys<T, ?>) pKeys; return translateSelectorFunctionPartitioner(selectorKeys, pMethod, name, input, getParallelism(), customPartitioner, orders); } else { throw new UnsupportedOperationException("Unrecognized key type."); } } else { throw new UnsupportedOperationException("Unsupported partitioning method: " + pMethod.name()); } }
[ "protected", "org", ".", "apache", ".", "flink", ".", "api", ".", "common", ".", "operators", ".", "SingleInputOperator", "<", "?", ",", "T", ",", "?", ">", "translateToDataFlow", "(", "Operator", "<", "T", ">", "input", ")", "{", "String", "name", "="...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/PartitionOperator.java#L139-L183
train
Translate the input operator to a data flow.
[ 30522, 5123, 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, 17637, 3406, 2850, 2696, 12314, 1006, 6872, 1026, 1056, 1028, 7953, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java
StreamProjection.projectTuple4
public <T0, T1, T2, T3> SingleOutputStreamOperator<Tuple4<T0, T1, T2, T3>> projectTuple4() { TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType()); TupleTypeInfo<Tuple4<T0, T1, T2, T3>> tType = new TupleTypeInfo<Tuple4<T0, T1, T2, T3>>(fTypes); return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple4<T0, T1, T2, T3>>(fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig()))); }
java
public <T0, T1, T2, T3> SingleOutputStreamOperator<Tuple4<T0, T1, T2, T3>> projectTuple4() { TypeInformation<?>[] fTypes = extractFieldTypes(fieldIndexes, dataStream.getType()); TupleTypeInfo<Tuple4<T0, T1, T2, T3>> tType = new TupleTypeInfo<Tuple4<T0, T1, T2, T3>>(fTypes); return dataStream.transform("Projection", tType, new StreamProject<IN, Tuple4<T0, T1, T2, T3>>(fieldIndexes, tType.createSerializer(dataStream.getExecutionConfig()))); }
[ "public", "<", "T0", ",", "T1", ",", "T2", ",", "T3", ">", "SingleOutputStreamOperator", "<", "Tuple4", "<", "T0", ",", "T1", ",", "T2", ",", "T3", ">", ">", "projectTuple4", "(", ")", "{", "TypeInformation", "<", "?", ">", "[", "]", "fTypes", "=",...
Projects a {@link Tuple} {@link DataStream} to the previously selected fields. @return The projected DataStream. @see Tuple @see DataStream
[ "Projects", "a", "{", "@link", "Tuple", "}", "{", "@link", "DataStream", "}", "to", "the", "previously", "selected", "fields", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/StreamProjection.java#L176-L181
train
Project a tuple of data stream into a single output stream.
[ 30522, 2270, 1026, 1056, 2692, 1010, 1056, 2487, 1010, 1056, 2475, 1010, 1056, 2509, 1028, 2309, 5833, 18780, 21422, 25918, 8844, 1026, 10722, 10814, 2549, 1026, 1056, 2692, 1010, 1056, 2487, 1010, 1056, 2475, 1010, 1056, 2509, 1028, 1028, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
utility/src/main/java/com/networknt/utility/CharUtils.java
CharUtils.unicodeEscaped
public static String unicodeEscaped(final Character ch) { if (ch == null) { return null; } return unicodeEscaped(ch.charValue()); }
java
public static String unicodeEscaped(final Character ch) { if (ch == null) { return null; } return unicodeEscaped(ch.charValue()); }
[ "public", "static", "String", "unicodeEscaped", "(", "final", "Character", "ch", ")", "{", "if", "(", "ch", "==", "null", ")", "{", "return", "null", ";", "}", "return", "unicodeEscaped", "(", "ch", ".", "charValue", "(", ")", ")", ";", "}" ]
<p>Converts the string to the Unicode format '\u0020'.</p> <p>This format is the Java source code format.</p> <p>If {@code null} is passed in, {@code null} will be returned.</p> <pre> CharUtils.unicodeEscaped(null) = null CharUtils.unicodeEscaped(' ') = "\u0020" CharUtils.unicodeEscaped('A') = "\u0041" </pre> @param ch the character to convert, may be null @return the escaped Unicode string, null if null input
[ "<p", ">", "Converts", "the", "string", "to", "the", "Unicode", "format", "\\", "u0020", ".", "<", "/", "p", ">" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CharUtils.java#L318-L323
train
Unicode escaped.
[ 30522, 2270, 10763, 5164, 27260, 2229, 19464, 2094, 1006, 2345, 2839, 10381, 1007, 1063, 2065, 1006, 10381, 1027, 1027, 19701, 1007, 1063, 2709, 19701, 1025, 1065, 2709, 27260, 2229, 19464, 2094, 1006, 10381, 1012, 25869, 10175, 5657, 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-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.insert
public int[] insert(Connection conn, Entity... records) throws SQLException { checkConn(conn); if(ArrayUtil.isEmpty(records)){ return new int[]{0}; } //单条单独处理 if(1 == records.length) { return new int[] { insert(conn, records[0])}; } PreparedStatement ps = null; try { ps = dialect.psForInsertBatch(conn, records); return ps.executeBatch(); } finally { DbUtil.close(ps); } }
java
public int[] insert(Connection conn, Entity... records) throws SQLException { checkConn(conn); if(ArrayUtil.isEmpty(records)){ return new int[]{0}; } //单条单独处理 if(1 == records.length) { return new int[] { insert(conn, records[0])}; } PreparedStatement ps = null; try { ps = dialect.psForInsertBatch(conn, records); return ps.executeBatch(); } finally { DbUtil.close(ps); } }
[ "public", "int", "[", "]", "insert", "(", "Connection", "conn", ",", "Entity", "...", "records", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "records", ")", ")", "{", "return", "n...
批量插入数据<br> 批量插入必须严格保持Entity的结构一致,不一致会导致插入数据出现不可预知的结果<br> 此方法不会关闭Connection @param conn 数据库连接 @param records 记录列表,记录KV必须严格一致 @return 插入行数 @throws SQLException SQL执行异常
[ "批量插入数据<br", ">", "批量插入必须严格保持Entity的结构一致,不一致会导致插入数据出现不可预知的结果<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L155-L173
train
Insert records into the database.
[ 30522, 2270, 20014, 1031, 1033, 19274, 1006, 4434, 9530, 2078, 1010, 9178, 1012, 1012, 1012, 2636, 1007, 11618, 29296, 10288, 24422, 1063, 4638, 8663, 2078, 1006, 9530, 2078, 1007, 1025, 2065, 1006, 9140, 21823, 2140, 1012, 2003, 6633, 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...
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringValueUtils.java
StringValueUtils.toLowerCase
public static void toLowerCase(StringValue string) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { chars[i] = Character.toLowerCase(chars[i]); } }
java
public static void toLowerCase(StringValue string) { final char[] chars = string.getCharArray(); final int len = string.length(); for (int i = 0; i < len; i++) { chars[i] = Character.toLowerCase(chars[i]); } }
[ "public", "static", "void", "toLowerCase", "(", "StringValue", "string", ")", "{", "final", "char", "[", "]", "chars", "=", "string", ".", "getCharArray", "(", ")", ";", "final", "int", "len", "=", "string", ".", "length", "(", ")", ";", "for", "(", ...
Converts the given <code>StringValue</code> into a lower case variant. @param string The string to convert to lower case.
[ "Converts", "the", "given", "<code", ">", "StringValue<", "/", "code", ">", "into", "a", "lower", "case", "variant", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringValueUtils.java#L42-L49
train
Converts the given string to lower case.
[ 30522, 2270, 10763, 11675, 2000, 27663, 18992, 3366, 1006, 5164, 10175, 5657, 5164, 1007, 1063, 2345, 25869, 1031, 1033, 25869, 2015, 1027, 5164, 1012, 2131, 7507, 19848, 9447, 1006, 1007, 1025, 2345, 20014, 18798, 1027, 5164, 1012, 3091, 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/resourcemanager/ResourceManager.java
ResourceManager.registerJobManager
@Override public CompletableFuture<RegistrationResponse> registerJobManager( final JobMasterId jobMasterId, final ResourceID jobManagerResourceId, final String jobManagerAddress, final JobID jobId, final Time timeout) { checkNotNull(jobMasterId); checkNotNull(jobManagerResourceId); checkNotNull(jobManagerAddress); checkNotNull(jobId); if (!jobLeaderIdService.containsJob(jobId)) { try { jobLeaderIdService.addJob(jobId); } catch (Exception e) { ResourceManagerException exception = new ResourceManagerException("Could not add the job " + jobId + " to the job id leader service.", e); onFatalError(exception); log.error("Could not add job {} to job leader id service.", jobId, e); return FutureUtils.completedExceptionally(exception); } } log.info("Registering job manager {}@{} for job {}.", jobMasterId, jobManagerAddress, jobId); CompletableFuture<JobMasterId> jobMasterIdFuture; try { jobMasterIdFuture = jobLeaderIdService.getLeaderId(jobId); } catch (Exception e) { // we cannot check the job leader id so let's fail // TODO: Maybe it's also ok to skip this check in case that we cannot check the leader id ResourceManagerException exception = new ResourceManagerException("Cannot obtain the " + "job leader id future to verify the correct job leader.", e); onFatalError(exception); log.debug("Could not obtain the job leader id future to verify the correct job leader."); return FutureUtils.completedExceptionally(exception); } CompletableFuture<JobMasterGateway> jobMasterGatewayFuture = getRpcService().connect(jobManagerAddress, jobMasterId, JobMasterGateway.class); CompletableFuture<RegistrationResponse> registrationResponseFuture = jobMasterGatewayFuture.thenCombineAsync( jobMasterIdFuture, (JobMasterGateway jobMasterGateway, JobMasterId leadingJobMasterId) -> { if (Objects.equals(leadingJobMasterId, jobMasterId)) { return registerJobMasterInternal( jobMasterGateway, jobId, jobManagerAddress, jobManagerResourceId); } else { final String declineMessage = String.format( "The leading JobMaster id %s did not match the received JobMaster id %s. " + "This indicates that a JobMaster leader change has happened.", leadingJobMasterId, jobMasterId); log.debug(declineMessage); return new RegistrationResponse.Decline(declineMessage); } }, getMainThreadExecutor()); // handle exceptions which might have occurred in one of the futures inputs of combine return registrationResponseFuture.handleAsync( (RegistrationResponse registrationResponse, Throwable throwable) -> { if (throwable != null) { if (log.isDebugEnabled()) { log.debug("Registration of job manager {}@{} failed.", jobMasterId, jobManagerAddress, throwable); } else { log.info("Registration of job manager {}@{} failed.", jobMasterId, jobManagerAddress); } return new RegistrationResponse.Decline(throwable.getMessage()); } else { return registrationResponse; } }, getRpcService().getExecutor()); }
java
@Override public CompletableFuture<RegistrationResponse> registerJobManager( final JobMasterId jobMasterId, final ResourceID jobManagerResourceId, final String jobManagerAddress, final JobID jobId, final Time timeout) { checkNotNull(jobMasterId); checkNotNull(jobManagerResourceId); checkNotNull(jobManagerAddress); checkNotNull(jobId); if (!jobLeaderIdService.containsJob(jobId)) { try { jobLeaderIdService.addJob(jobId); } catch (Exception e) { ResourceManagerException exception = new ResourceManagerException("Could not add the job " + jobId + " to the job id leader service.", e); onFatalError(exception); log.error("Could not add job {} to job leader id service.", jobId, e); return FutureUtils.completedExceptionally(exception); } } log.info("Registering job manager {}@{} for job {}.", jobMasterId, jobManagerAddress, jobId); CompletableFuture<JobMasterId> jobMasterIdFuture; try { jobMasterIdFuture = jobLeaderIdService.getLeaderId(jobId); } catch (Exception e) { // we cannot check the job leader id so let's fail // TODO: Maybe it's also ok to skip this check in case that we cannot check the leader id ResourceManagerException exception = new ResourceManagerException("Cannot obtain the " + "job leader id future to verify the correct job leader.", e); onFatalError(exception); log.debug("Could not obtain the job leader id future to verify the correct job leader."); return FutureUtils.completedExceptionally(exception); } CompletableFuture<JobMasterGateway> jobMasterGatewayFuture = getRpcService().connect(jobManagerAddress, jobMasterId, JobMasterGateway.class); CompletableFuture<RegistrationResponse> registrationResponseFuture = jobMasterGatewayFuture.thenCombineAsync( jobMasterIdFuture, (JobMasterGateway jobMasterGateway, JobMasterId leadingJobMasterId) -> { if (Objects.equals(leadingJobMasterId, jobMasterId)) { return registerJobMasterInternal( jobMasterGateway, jobId, jobManagerAddress, jobManagerResourceId); } else { final String declineMessage = String.format( "The leading JobMaster id %s did not match the received JobMaster id %s. " + "This indicates that a JobMaster leader change has happened.", leadingJobMasterId, jobMasterId); log.debug(declineMessage); return new RegistrationResponse.Decline(declineMessage); } }, getMainThreadExecutor()); // handle exceptions which might have occurred in one of the futures inputs of combine return registrationResponseFuture.handleAsync( (RegistrationResponse registrationResponse, Throwable throwable) -> { if (throwable != null) { if (log.isDebugEnabled()) { log.debug("Registration of job manager {}@{} failed.", jobMasterId, jobManagerAddress, throwable); } else { log.info("Registration of job manager {}@{} failed.", jobMasterId, jobManagerAddress); } return new RegistrationResponse.Decline(throwable.getMessage()); } else { return registrationResponse; } }, getRpcService().getExecutor()); }
[ "@", "Override", "public", "CompletableFuture", "<", "RegistrationResponse", ">", "registerJobManager", "(", "final", "JobMasterId", "jobMasterId", ",", "final", "ResourceID", "jobManagerResourceId", ",", "final", "String", "jobManagerAddress", ",", "final", "JobID", "j...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L279-L363
train
Registers a job manager with the job leader id service.
[ 30522, 1030, 2058, 15637, 2270, 4012, 10814, 10880, 11263, 11244, 1026, 8819, 6072, 26029, 3366, 1028, 4236, 5558, 25526, 5162, 4590, 1006, 2345, 3105, 8706, 3593, 3105, 8706, 3593, 1010, 2345, 7692, 3593, 3105, 24805, 4590, 6072, 8162, 340...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.registerExecutor
public void registerExecutor( String appId, String execId, ExecutorShuffleInfo executorInfo) { AppExecId fullId = new AppExecId(appId, execId); logger.info("Registered executor {} with {}", fullId, executorInfo); if (!knownManagers.contains(executorInfo.shuffleManager)) { throw new UnsupportedOperationException( "Unsupported shuffle manager of executor: " + executorInfo); } try { if (db != null) { byte[] key = dbAppExecKey(fullId); byte[] value = mapper.writeValueAsString(executorInfo).getBytes(StandardCharsets.UTF_8); db.put(key, value); } } catch (Exception e) { logger.error("Error saving registered executors", e); } executors.put(fullId, executorInfo); }
java
public void registerExecutor( String appId, String execId, ExecutorShuffleInfo executorInfo) { AppExecId fullId = new AppExecId(appId, execId); logger.info("Registered executor {} with {}", fullId, executorInfo); if (!knownManagers.contains(executorInfo.shuffleManager)) { throw new UnsupportedOperationException( "Unsupported shuffle manager of executor: " + executorInfo); } try { if (db != null) { byte[] key = dbAppExecKey(fullId); byte[] value = mapper.writeValueAsString(executorInfo).getBytes(StandardCharsets.UTF_8); db.put(key, value); } } catch (Exception e) { logger.error("Error saving registered executors", e); } executors.put(fullId, executorInfo); }
[ "public", "void", "registerExecutor", "(", "String", "appId", ",", "String", "execId", ",", "ExecutorShuffleInfo", "executorInfo", ")", "{", "AppExecId", "fullId", "=", "new", "AppExecId", "(", "appId", ",", "execId", ")", ";", "logger", ".", "info", "(", "\...
Registers a new Executor with all the configuration we need to find its shuffle files.
[ "Registers", "a", "new", "Executor", "with", "all", "the", "configuration", "we", "need", "to", "find", "its", "shuffle", "files", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L142-L162
train
Register an executor with the application.
[ 30522, 2270, 11675, 4236, 10288, 8586, 16161, 2099, 1006, 5164, 10439, 3593, 1010, 5164, 4654, 8586, 3593, 1010, 4654, 8586, 16161, 2869, 6979, 18142, 2378, 14876, 4654, 8586, 16161, 6657, 14876, 30524, 5068, 4654, 8586, 16161, 2099, 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-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java
CronPatternUtil.matchedDates
public static List<Date> matchedDates(String patternStr, Date start, int count, boolean isMatchSecond) { return matchedDates(patternStr, start, DateUtil.endOfYear(start), count, isMatchSecond); }
java
public static List<Date> matchedDates(String patternStr, Date start, int count, boolean isMatchSecond) { return matchedDates(patternStr, start, DateUtil.endOfYear(start), count, isMatchSecond); }
[ "public", "static", "List", "<", "Date", ">", "matchedDates", "(", "String", "patternStr", ",", "Date", "start", ",", "int", "count", ",", "boolean", "isMatchSecond", ")", "{", "return", "matchedDates", "(", "patternStr", ",", "start", ",", "DateUtil", ".", ...
列举指定日期之后(到开始日期对应年年底)内所有匹配表达式的日期 @param patternStr 表达式字符串 @param start 起始时间 @param count 列举数量 @param isMatchSecond 是否匹配秒 @return 日期列表
[ "列举指定日期之后(到开始日期对应年年底)内所有匹配表达式的日期" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java#L28-L30
train
Returns a list of dates that match the given pattern string.
[ 30522, 2270, 10763, 2862, 1026, 3058, 1028, 10349, 27122, 1006, 5164, 7060, 16344, 1010, 3058, 2707, 1010, 20014, 4175, 1010, 22017, 20898, 2003, 18900, 18069, 8586, 15422, 1007, 1063, 2709, 10349, 27122, 1006, 7060, 16344, 1010, 2707, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.addTransitionPath
private void addTransitionPath(MDAGNode originNode, String str) { if (!str.isEmpty()) { MDAGNode currentNode = originNode; int charCount = str.length(); //Loop through the characters in str, iteratevely adding // a _transition path corresponding to it from originNode for (int i = 0; i < charCount; i++, transitionCount++) { char currentChar = str.charAt(i); boolean isLastChar = (i == charCount - 1); currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar); charTreeSet.add(currentChar); } ///// } else originNode.setAcceptStateStatus(true); }
java
private void addTransitionPath(MDAGNode originNode, String str) { if (!str.isEmpty()) { MDAGNode currentNode = originNode; int charCount = str.length(); //Loop through the characters in str, iteratevely adding // a _transition path corresponding to it from originNode for (int i = 0; i < charCount; i++, transitionCount++) { char currentChar = str.charAt(i); boolean isLastChar = (i == charCount - 1); currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar); charTreeSet.add(currentChar); } ///// } else originNode.setAcceptStateStatus(true); }
[ "private", "void", "addTransitionPath", "(", "MDAGNode", "originNode", ",", "String", "str", ")", "{", "if", "(", "!", "str", ".", "isEmpty", "(", ")", ")", "{", "MDAGNode", "currentNode", "=", "originNode", ";", "int", "charCount", "=", "str", ".", "len...
给节点添加一个转移路径<br> Adds a _transition path starting from a specific node in the MDAG. @param originNode the MDAGNode which will serve as the start point of the to-be-created _transition path @param str the String to be used to create a new _transition path from {@code originNode}
[ "给节点添加一个转移路径<br", ">", "Adds", "a", "_transition", "path", "starting", "from", "a", "specific", "node", "in", "the", "MDAG", "." ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L574-L595
train
Add a _transition path to the MDAGNode.
[ 30522, 2797, 11675, 30524, 9108, 8490, 3630, 3207, 2783, 3630, 3207, 1027, 4761, 3630, 3207, 1025, 20014, 25869, 3597, 16671, 1027, 2358, 2099, 1012, 3091, 1006, 1007, 1025, 1013, 1013, 7077, 2083, 1996, 3494, 1999, 2358, 2099, 1010, 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...
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java
CellUtil.getOrCreateCell
public static Cell getOrCreateCell(Row row, int cellIndex) { Cell cell = row.getCell(cellIndex); if (null == cell) { cell = row.createCell(cellIndex); } return cell; }
java
public static Cell getOrCreateCell(Row row, int cellIndex) { Cell cell = row.getCell(cellIndex); if (null == cell) { cell = row.createCell(cellIndex); } return cell; }
[ "public", "static", "Cell", "getOrCreateCell", "(", "Row", "row", ",", "int", "cellIndex", ")", "{", "Cell", "cell", "=", "row", ".", "getCell", "(", "cellIndex", ")", ";", "if", "(", "null", "==", "cell", ")", "{", "cell", "=", "row", ".", "createCe...
获取已有行或创建新行 @param row Excel表的行 @param cellIndex 列号 @return {@link Row} @since 4.0.2
[ "获取已有行或创建新行" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L165-L171
train
Gets the cell with the specified index or creates one if it does not exist.
[ 30522, 2270, 10763, 3526, 2131, 2953, 16748, 3686, 29109, 2140, 1006, 5216, 5216, 1010, 20014, 3526, 22254, 10288, 1007, 1063, 3526, 3526, 1027, 5216, 1012, 2131, 29109, 2140, 1006, 3526, 22254, 10288, 1007, 1025, 2065, 1006, 19701, 1027, 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-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java
NFAStateNameHandler.getOriginalNameFromInternal
public static String getOriginalNameFromInternal(String internalName) { Preconditions.checkNotNull(internalName); return internalName.split(STATE_NAME_DELIM)[0]; }
java
public static String getOriginalNameFromInternal(String internalName) { Preconditions.checkNotNull(internalName); return internalName.split(STATE_NAME_DELIM)[0]; }
[ "public", "static", "String", "getOriginalNameFromInternal", "(", "String", "internalName", ")", "{", "Preconditions", ".", "checkNotNull", "(", "internalName", ")", ";", "return", "internalName", ".", "split", "(", "STATE_NAME_DELIM", ")", "[", "0", "]", ";", "...
Implements the reverse process of the {@link #getUniqueInternalName(String)}. @param internalName The name to be decoded. @return The original, user-specified name for the state.
[ "Implements", "the", "reverse", "process", "of", "the", "{", "@link", "#getUniqueInternalName", "(", "String", ")", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/compiler/NFAStateNameHandler.java#L43-L46
train
Returns the original name of the state from the given internal name.
[ 30522, 2270, 10763, 5164, 2131, 10050, 24965, 18442, 19699, 20936, 10111, 12789, 2140, 1006, 5164, 4722, 18442, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 4722, 18442, 1007, 1025, 2709, 4722, 18442, 1012, 3975,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/Vertex.java
Vertex.newPlaceInstance
public static Vertex newPlaceInstance(String realWord, int frequency) { return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, frequency)); }
java
public static Vertex newPlaceInstance(String realWord, int frequency) { return new Vertex(Predefine.TAG_PLACE, realWord, new CoreDictionary.Attribute(Nature.ns, frequency)); }
[ "public", "static", "Vertex", "newPlaceInstance", "(", "String", "realWord", ",", "int", "frequency", ")", "{", "return", "new", "Vertex", "(", "Predefine", ".", "TAG_PLACE", ",", "realWord", ",", "new", "CoreDictionary", ".", "Attribute", "(", "Nature", ".", ...
创建一个地名实例 @param realWord @param frequency @return
[ "创建一个地名实例" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/Vertex.java#L421-L424
train
Create a place vertex.
[ 30522, 2270, 10763, 19449, 2047, 24759, 10732, 7076, 26897, 1006, 5164, 2613, 18351, 1010, 20014, 6075, 1007, 1063, 2709, 2047, 19449, 1006, 3653, 3207, 23460, 1012, 6415, 1035, 2173, 1010, 2613, 18351, 1010, 2047, 4563, 29201, 3258, 5649, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/clusterframework/ContaineredTaskManagerParameters.java
ContaineredTaskManagerParameters.calculateCutoffMB
public static long calculateCutoffMB(Configuration config, long containerMemoryMB) { Preconditions.checkArgument(containerMemoryMB > 0); // (1) check cutoff ratio final float memoryCutoffRatio = config.getFloat( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO); if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given=" + memoryCutoffRatio); } // (2) check min cutoff value final int minCutoff = config.getInteger( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN); if (minCutoff >= containerMemoryMB) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff + "' is larger than the total container memory " + containerMemoryMB); } // (3) check between heap and off-heap long cutoff = (long) (containerMemoryMB * memoryCutoffRatio); if (cutoff < minCutoff) { cutoff = minCutoff; } return cutoff; }
java
public static long calculateCutoffMB(Configuration config, long containerMemoryMB) { Preconditions.checkArgument(containerMemoryMB > 0); // (1) check cutoff ratio final float memoryCutoffRatio = config.getFloat( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO); if (memoryCutoffRatio >= 1 || memoryCutoffRatio <= 0) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_RATIO.key() + "' must be between 0 and 1. Value given=" + memoryCutoffRatio); } // (2) check min cutoff value final int minCutoff = config.getInteger( ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN); if (minCutoff >= containerMemoryMB) { throw new IllegalArgumentException("The configuration value '" + ResourceManagerOptions.CONTAINERIZED_HEAP_CUTOFF_MIN.key() + "'='" + minCutoff + "' is larger than the total container memory " + containerMemoryMB); } // (3) check between heap and off-heap long cutoff = (long) (containerMemoryMB * memoryCutoffRatio); if (cutoff < minCutoff) { cutoff = minCutoff; } return cutoff; }
[ "public", "static", "long", "calculateCutoffMB", "(", "Configuration", "config", ",", "long", "containerMemoryMB", ")", "{", "Preconditions", ".", "checkArgument", "(", "containerMemoryMB", ">", "0", ")", ";", "// (1) check cutoff ratio", "final", "float", "memoryCuto...
Calcuate cutoff memory size used by container, it will throw an {@link IllegalArgumentException} if the config is invalid or return the cutoff value if valid. @param config The Flink configuration. @param containerMemoryMB The size of the complete container, in megabytes. @return cutoff memory size used by container.
[ "Calcuate", "cutoff", "memory", "size", "used", "by", "container", "it", "will", "throw", "an", "{", "@link", "IllegalArgumentException", "}", "if", "the", "config", "is", "invalid", "or", "return", "the", "cutoff", "value", "if", "valid", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/ContaineredTaskManagerParameters.java#L114-L143
train
Calculate cutoff for the given configuration.
[ 30522, 2270, 10763, 2146, 18422, 12690, 7245, 14905, 1006, 9563, 9530, 8873, 2290, 1010, 2146, 11661, 4168, 5302, 2854, 14905, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 11661, 4168, 5302, 2854, 14905, 1028, 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/lang/Validator.java
Validator.validateEmail
public static <T extends CharSequence> T validateEmail(T value, String errorMsg) throws ValidateException { if (false == isEmail(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateEmail(T value, String errorMsg) throws ValidateException { if (false == isEmail(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateEmail", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isEmail", "(", "value", ")", ")", "{", "throw", "new", "...
验证是否为可用邮箱地址 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为可用邮箱地址" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L651-L656
train
Validate a CharSequence value to ensure that it is an email address.
[ 30522, 2270, 10763, 1026, 1056, 8908, 25869, 3366, 4226, 5897, 1028, 1056, 9398, 3686, 14545, 4014, 1006, 1056, 3643, 1010, 5164, 7561, 5244, 2290, 1007, 11618, 9398, 3686, 10288, 24422, 1063, 2065, 1006, 6270, 1027, 1027, 2003, 14545, 4014...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/io/TextInputFormat.java
TextInputFormat.readRecord
@Override public String readRecord(String reusable, byte[] bytes, int offset, int numBytes) throws IOException { //Check if \n is used as delimiter and the end of this line is a \r, then remove \r from the line if (this.getDelimiter() != null && this.getDelimiter().length == 1 && this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1 && bytes[offset + numBytes - 1] == CARRIAGE_RETURN){ numBytes -= 1; } return new String(bytes, offset, numBytes, this.charsetName); }
java
@Override public String readRecord(String reusable, byte[] bytes, int offset, int numBytes) throws IOException { //Check if \n is used as delimiter and the end of this line is a \r, then remove \r from the line if (this.getDelimiter() != null && this.getDelimiter().length == 1 && this.getDelimiter()[0] == NEW_LINE && offset + numBytes >= 1 && bytes[offset + numBytes - 1] == CARRIAGE_RETURN){ numBytes -= 1; } return new String(bytes, offset, numBytes, this.charsetName); }
[ "@", "Override", "public", "String", "readRecord", "(", "String", "reusable", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "numBytes", ")", "throws", "IOException", "{", "//Check if \\n is used as delimiter and the end of this line is a \\r, then re...
--------------------------------------------------------------------------------------------
[ "--------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/io/TextInputFormat.java#L86-L96
train
Read a record from the input stream.
[ 30522, 1030, 2058, 15637, 2270, 5164, 3191, 2890, 27108, 2094, 1006, 5164, 2128, 10383, 3468, 1010, 24880, 1031, 1033, 27507, 1010, 20014, 16396, 1010, 20014, 15903, 17250, 2015, 1007, 11618, 22834, 10288, 24422, 1063, 1013, 1013, 4638, 2065,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java
FileInputFormat.extractFileExtension
protected static String extractFileExtension(String fileName) { checkNotNull(fileName); int lastPeriodIndex = fileName.lastIndexOf('.'); if (lastPeriodIndex < 0){ return null; } else { return fileName.substring(lastPeriodIndex + 1); } }
java
protected static String extractFileExtension(String fileName) { checkNotNull(fileName); int lastPeriodIndex = fileName.lastIndexOf('.'); if (lastPeriodIndex < 0){ return null; } else { return fileName.substring(lastPeriodIndex + 1); } }
[ "protected", "static", "String", "extractFileExtension", "(", "String", "fileName", ")", "{", "checkNotNull", "(", "fileName", ")", ";", "int", "lastPeriodIndex", "=", "fileName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastPeriodIndex", "<", ...
Returns the extension of a file name (!= a path). @return the extension of the file name or {@code null} if there is no extension.
[ "Returns", "the", "extension", "of", "a", "file", "name", "(", "!", "=", "a", "path", ")", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L156-L164
train
Extract file extension from a file name.
[ 30522, 5123, 10763, 5164, 14817, 8873, 10559, 18413, 6132, 3258, 1006, 5164, 5371, 18442, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 5371, 18442, 1007, 1025, 20014, 2197, 4842, 3695, 8718, 3207, 2595, 1027, 5371, 18442, 1012, 2197, 22254, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java
Wrapper.wrap
public Collection<String> wrap(Collection<String> fields){ if(CollectionUtil.isEmpty(fields)) { return fields; } return Arrays.asList(wrap(fields.toArray(new String[fields.size()]))); }
java
public Collection<String> wrap(Collection<String> fields){ if(CollectionUtil.isEmpty(fields)) { return fields; } return Arrays.asList(wrap(fields.toArray(new String[fields.size()]))); }
[ "public", "Collection", "<", "String", ">", "wrap", "(", "Collection", "<", "String", ">", "fields", ")", "{", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "fields", ")", ")", "{", "return", "fields", ";", "}", "return", "Arrays", ".", "asList", "...
包装字段名<br> 有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突 @param fields 字段名 @return 包装后的字段名
[ "包装字段名<br", ">", "有时字段与SQL的某些关键字冲突,导致SQL出错,因此需要将字段名用单引号或者反引号包装起来,避免冲突" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Wrapper.java#L138-L144
train
Wrap a collection of strings into a collection of strings.
[ 30522, 2270, 3074, 1026, 5164, 1028, 10236, 1006, 3074, 1026, 5164, 1028, 4249, 1007, 1063, 2065, 1006, 3074, 21823, 2140, 1012, 2003, 6633, 13876, 2100, 1006, 4249, 1007, 1007, 1063, 2709, 4249, 1025, 1065, 2709, 27448, 1012, 2004, 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...
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosArtifactServer.java
MesosArtifactServer.addFile
public synchronized URL addFile(File localFile, String remoteFile) throws IOException, MalformedURLException { return addPath(new Path(localFile.toURI()), new Path(remoteFile)); }
java
public synchronized URL addFile(File localFile, String remoteFile) throws IOException, MalformedURLException { return addPath(new Path(localFile.toURI()), new Path(remoteFile)); }
[ "public", "synchronized", "URL", "addFile", "(", "File", "localFile", ",", "String", "remoteFile", ")", "throws", "IOException", ",", "MalformedURLException", "{", "return", "addPath", "(", "new", "Path", "(", "localFile", ".", "toURI", "(", ")", ")", ",", "...
Adds a file to the artifact server. @param localFile the local file to serve. @param remoteFile the remote path with which to locate the file. @return the fully-qualified remote path to the file. @throws MalformedURLException if the remote path is invalid.
[ "Adds", "a", "file", "to", "the", "artifact", "server", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosArtifactServer.java#L198-L200
train
Add a file to the remote file system.
[ 30522, 2270, 25549, 24471, 2140, 5587, 8873, 2571, 1006, 5371, 2334, 8873, 2571, 1010, 5164, 6556, 8873, 2571, 1007, 11618, 22834, 10288, 24422, 1010, 15451, 29021, 3126, 2571, 2595, 24422, 1063, 2709, 5587, 15069, 1006, 2047, 4130, 1006, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.moveToElement
public Actions moveToElement(WebElement target) { if (isBuildingActions()) { action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target)); } return moveInTicks(target, 0, 0); }
java
public Actions moveToElement(WebElement target) { if (isBuildingActions()) { action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target)); } return moveInTicks(target, 0, 0); }
[ "public", "Actions", "moveToElement", "(", "WebElement", "target", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "MoveMouseAction", "(", "jsonMouse", ",", "(", "Locatable", ")", "target", ")", ")", ";...
Moves the mouse to the middle of the element. The element is scrolled into view and its location is calculated using getBoundingClientRect. @param target element to move to. @return A self reference.
[ "Moves", "the", "mouse", "to", "the", "middle", "of", "the", "element", ".", "The", "element", "is", "scrolled", "into", "view", "and", "its", "location", "is", "calculated", "using", "getBoundingClientRect", "." ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L358-L364
train
Move the mouse to the specified element.
[ 30522, 2270, 4506, 2693, 3406, 12260, 3672, 1006, 4773, 12260, 3672, 4539, 1007, 1063, 2065, 1006, 2003, 25820, 18908, 8496, 1006, 1007, 1007, 1063, 2895, 1012, 5587, 18908, 3258, 1006, 2047, 2693, 27711, 5243, 7542, 1006, 1046, 3385, 27711...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getFloat
@PublicEvolving public float getFloat(ConfigOption<Float> configOption, float overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToFloat(o, configOption.defaultValue()); }
java
@PublicEvolving public float getFloat(ConfigOption<Float> configOption, float overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToFloat(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "float", "getFloat", "(", "ConfigOption", "<", "Float", ">", "configOption", ",", "float", "overrideDefault", ")", "{", "Object", "o", "=", "getRawValueFromOption", "(", "configOption", ")", ";", "if", "(", "o", "==", "null", ...
Returns the value associated with the given config option as a float. If no value is mapped under any key of the option, it returns the specified default instead of the option's default value. @param configOption The configuration option @param overrideDefault The value to return if no value was mapper for any key of the option @return the configured value associated with the given config option, or the overrideDefault
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "a", "float", ".", "If", "no", "value", "is", "mapped", "under", "any", "key", "of", "the", "option", "it", "returns", "the", "specified", "default", "instead", "of"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L456-L463
train
Returns the value associated with the given config option as a float.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 14257, 2131, 10258, 16503, 1006, 9530, 8873, 3995, 16790, 1026, 14257, 1028, 9530, 8873, 3995, 16790, 1010, 14257, 2058, 15637, 3207, 7011, 11314, 1007, 1063, 4874, 1051, 1027, 2131, 2527, 2860, 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/text/csv/CsvParser.java
CsvParser.nextRow
public CsvRow nextRow() throws IORuntimeException { long startingLineNo; List<String> currentFields; int fieldCount; while (false == finished) { startingLineNo = ++lineNo; currentFields = readLine(); if(null == currentFields) { break; } fieldCount = currentFields.size(); // 末尾 if (fieldCount == 0) { break; } // 跳过空行 if (config.skipEmptyRows && fieldCount == 1 && currentFields.get(0).isEmpty()) { continue; } // 检查每行的字段数是否一致 if (config.errorOnDifferentFieldCount) { if (firstLineFieldCount == -1) { firstLineFieldCount = fieldCount; } else if (fieldCount != firstLineFieldCount) { throw new IORuntimeException(String.format("Line %d has %d fields, but first line has %d fields", lineNo, fieldCount, firstLineFieldCount)); } } // 记录最大字段数 if (fieldCount > maxFieldCount) { maxFieldCount = fieldCount; } //初始化标题 if (config.containsHeader && null == header) { initHeader(currentFields); // 作为标题行后,此行跳过,下一行做为第一行 continue; } return new CsvRow(startingLineNo, null == header ? null : header.headerMap, currentFields); } return null; }
java
public CsvRow nextRow() throws IORuntimeException { long startingLineNo; List<String> currentFields; int fieldCount; while (false == finished) { startingLineNo = ++lineNo; currentFields = readLine(); if(null == currentFields) { break; } fieldCount = currentFields.size(); // 末尾 if (fieldCount == 0) { break; } // 跳过空行 if (config.skipEmptyRows && fieldCount == 1 && currentFields.get(0).isEmpty()) { continue; } // 检查每行的字段数是否一致 if (config.errorOnDifferentFieldCount) { if (firstLineFieldCount == -1) { firstLineFieldCount = fieldCount; } else if (fieldCount != firstLineFieldCount) { throw new IORuntimeException(String.format("Line %d has %d fields, but first line has %d fields", lineNo, fieldCount, firstLineFieldCount)); } } // 记录最大字段数 if (fieldCount > maxFieldCount) { maxFieldCount = fieldCount; } //初始化标题 if (config.containsHeader && null == header) { initHeader(currentFields); // 作为标题行后,此行跳过,下一行做为第一行 continue; } return new CsvRow(startingLineNo, null == header ? null : header.headerMap, currentFields); } return null; }
[ "public", "CsvRow", "nextRow", "(", ")", "throws", "IORuntimeException", "{", "long", "startingLineNo", ";", "List", "<", "String", ">", "currentFields", ";", "int", "fieldCount", ";", "while", "(", "false", "==", "finished", ")", "{", "startingLineNo", "=", ...
读取下一行数据 @return CsvRow @throws IORuntimeException IO读取异常
[ "读取下一行数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/csv/CsvParser.java#L90-L136
train
Returns the next row.
[ 30522, 2270, 20116, 19716, 5004, 2279, 10524, 1006, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2146, 3225, 4179, 3630, 1025, 2862, 1026, 5164, 1028, 2783, 15155, 1025, 20014, 2492, 3597, 16671, 1025, 2096, 1006, 6270, 1027, 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-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java
SqlBuilder.on
public SqlBuilder on(LogicalOperator logicalOperator, Condition... conditions) { if (ArrayUtil.isNotEmpty(conditions)) { if (null != wrapper) { // 包装字段名 conditions = wrapper.wrap(conditions); } on(buildCondition(logicalOperator, conditions)); } return this; }
java
public SqlBuilder on(LogicalOperator logicalOperator, Condition... conditions) { if (ArrayUtil.isNotEmpty(conditions)) { if (null != wrapper) { // 包装字段名 conditions = wrapper.wrap(conditions); } on(buildCondition(logicalOperator, conditions)); } return this; }
[ "public", "SqlBuilder", "on", "(", "LogicalOperator", "logicalOperator", ",", "Condition", "...", "conditions", ")", "{", "if", "(", "ArrayUtil", ".", "isNotEmpty", "(", "conditions", ")", ")", "{", "if", "(", "null", "!=", "wrapper", ")", "{", "// 包装字段名\r",...
配合JOIN的 ON语句,多表关联的条件语句<br> 只支持单一的逻辑运算符(例如多个条件之间) @param logicalOperator 逻辑运算符 @param conditions 条件 @return 自己
[ "配合JOIN的", "ON语句,多表关联的条件语句<br", ">", "只支持单一的逻辑运算符(例如多个条件之间)" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L463-L473
train
Creates a INNER JOIN statement with the specified conditions.
[ 30522, 2270, 29296, 8569, 23891, 2099, 2006, 1006, 11177, 25918, 8844, 11177, 25918, 8844, 1010, 4650, 1012, 1012, 1012, 3785, 1007, 1063, 2065, 1006, 9140, 21823, 2140, 1012, 3475, 12184, 27718, 2100, 1006, 3785, 1007, 1007, 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/util/HashUtil.java
HashUtil.sdbmHash
public static int sdbmHash(String str) { int hash = 0; for (int i = 0; i < str.length(); i++) { hash = str.charAt(i) + (hash << 6) + (hash << 16) - hash; } return hash & 0x7FFFFFFF; }
java
public static int sdbmHash(String str) { int hash = 0; for (int i = 0; i < str.length(); i++) { hash = str.charAt(i) + (hash << 6) + (hash << 16) - hash; } return hash & 0x7FFFFFFF; }
[ "public", "static", "int", "sdbmHash", "(", "String", "str", ")", "{", "int", "hash", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "hash", "=", "str", ".", "charAt",...
SDBM算法 @param str 字符串 @return hash值
[ "SDBM算法" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HashUtil.java#L298-L306
train
Returns the hash code of the specified string.
[ 30522, 2270, 10763, 20014, 17371, 25526, 14949, 2232, 1006, 5164, 2358, 2099, 30524, 2358, 2099, 1012, 25869, 4017, 1006, 1045, 1007, 1009, 1006, 23325, 1026, 1026, 1020, 1007, 1009, 1006, 23325, 1026, 1026, 2385, 1007, 1011, 23325, 1025, 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/date/format/FastDateFormat.java
FastDateFormat.getTimeInstance
public static FastDateFormat getTimeInstance(final int style, final Locale locale) { return cache.getTimeInstance(style, null, locale); }
java
public static FastDateFormat getTimeInstance(final int style, final Locale locale) { return cache.getTimeInstance(style, null, locale); }
[ "public", "static", "FastDateFormat", "getTimeInstance", "(", "final", "int", "style", ",", "final", "Locale", "locale", ")", "{", "return", "cache", ".", "getTimeInstance", "(", "style", ",", "null", ",", "locale", ")", ";", "}" ]
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style time style: FULL, LONG, MEDIUM, or SHORT @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L182-L184
train
Gets the time instance.
[ 30522, 2270, 10763, 3435, 13701, 14192, 4017, 2131, 7292, 7076, 26897, 1006, 2345, 20014, 2806, 1010, 30524, 1010, 19701, 1010, 2334, 2063, 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, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/MutableDoubleArrayTrieInteger.java
MutableDoubleArrayTrieInteger.expandArray
private void expandArray(int maxSize) { int curSize = getBaseArraySize(); if (curSize > maxSize) { return; } if (maxSize >= LEAF_BIT) { throw new RuntimeException("Double Array Trie size exceeds absolute threshold"); } for (int i = curSize; i <= maxSize; ++i) { this.base.append(0); this.check.append(0); addFreeLink(i); } }
java
private void expandArray(int maxSize) { int curSize = getBaseArraySize(); if (curSize > maxSize) { return; } if (maxSize >= LEAF_BIT) { throw new RuntimeException("Double Array Trie size exceeds absolute threshold"); } for (int i = curSize; i <= maxSize; ++i) { this.base.append(0); this.check.append(0); addFreeLink(i); } }
[ "private", "void", "expandArray", "(", "int", "maxSize", ")", "{", "int", "curSize", "=", "getBaseArraySize", "(", ")", ";", "if", "(", "curSize", ">", "maxSize", ")", "{", "return", ";", "}", "if", "(", "maxSize", ">=", "LEAF_BIT", ")", "{", "throw", ...
动态数组扩容 @param maxSize 需要的容量
[ "动态数组扩容" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/datrie/MutableDoubleArrayTrieInteger.java#L224-L241
train
Expands the array to a given size.
[ 30522, 2797, 11675, 7818, 2906, 9447, 1006, 20014, 30524, 1007, 1025, 2065, 1006, 12731, 2869, 4697, 1028, 4098, 5332, 4371, 1007, 1063, 2709, 1025, 1065, 2065, 1006, 4098, 5332, 4371, 1028, 1027, 7053, 1035, 2978, 1007, 1063, 5466, 2047, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowSchemaConverter.java
CsvRowSchemaConverter.convert
public static CsvSchema convert(RowTypeInfo rowType) { final Builder builder = new CsvSchema.Builder(); final String[] fields = rowType.getFieldNames(); final TypeInformation<?>[] types = rowType.getFieldTypes(); for (int i = 0; i < rowType.getArity(); i++) { builder.addColumn(new Column(i, fields[i], convertType(fields[i], types[i]))); } return builder.build(); }
java
public static CsvSchema convert(RowTypeInfo rowType) { final Builder builder = new CsvSchema.Builder(); final String[] fields = rowType.getFieldNames(); final TypeInformation<?>[] types = rowType.getFieldTypes(); for (int i = 0; i < rowType.getArity(); i++) { builder.addColumn(new Column(i, fields[i], convertType(fields[i], types[i]))); } return builder.build(); }
[ "public", "static", "CsvSchema", "convert", "(", "RowTypeInfo", "rowType", ")", "{", "final", "Builder", "builder", "=", "new", "CsvSchema", ".", "Builder", "(", ")", ";", "final", "String", "[", "]", "fields", "=", "rowType", ".", "getFieldNames", "(", ")...
Convert {@link RowTypeInfo} to {@link CsvSchema}.
[ "Convert", "{" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowSchemaConverter.java#L84-L92
train
Convert a row type to a CSV schema.
[ 30522, 2270, 10763, 20116, 15088, 5403, 2863, 10463, 1006, 5216, 13874, 2378, 14876, 5216, 13874, 1007, 1063, 2345, 12508, 12508, 1027, 2047, 20116, 15088, 5403, 2863, 1012, 12508, 1006, 1007, 1025, 2345, 5164, 1031, 1033, 4249, 1027, 5216, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/rest/handler/legacy/files/StaticFileServerHandler.java
StaticFileServerHandler.respondAsLeader
@Override protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, T gateway) throws Exception { final HttpRequest request = routedRequest.getRequest(); final String requestPath; // make sure we request the "index.html" in case there is a directory request if (routedRequest.getPath().endsWith("/")) { requestPath = routedRequest.getPath() + "index.html"; } // in case the files being accessed are logs or stdout files, find appropriate paths. else if (routedRequest.getPath().equals("/jobmanager/log") || routedRequest.getPath().equals("/jobmanager/stdout")) { requestPath = ""; } else { requestPath = routedRequest.getPath(); } respondToRequest(channelHandlerContext, request, requestPath); }
java
@Override protected void respondAsLeader(ChannelHandlerContext channelHandlerContext, RoutedRequest routedRequest, T gateway) throws Exception { final HttpRequest request = routedRequest.getRequest(); final String requestPath; // make sure we request the "index.html" in case there is a directory request if (routedRequest.getPath().endsWith("/")) { requestPath = routedRequest.getPath() + "index.html"; } // in case the files being accessed are logs or stdout files, find appropriate paths. else if (routedRequest.getPath().equals("/jobmanager/log") || routedRequest.getPath().equals("/jobmanager/stdout")) { requestPath = ""; } else { requestPath = routedRequest.getPath(); } respondToRequest(channelHandlerContext, request, requestPath); }
[ "@", "Override", "protected", "void", "respondAsLeader", "(", "ChannelHandlerContext", "channelHandlerContext", ",", "RoutedRequest", "routedRequest", ",", "T", "gateway", ")", "throws", "Exception", "{", "final", "HttpRequest", "request", "=", "routedRequest", ".", "...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/files/StaticFileServerHandler.java#L125-L142
train
respond as leader.
[ 30522, 1030, 2058, 15637, 5123, 11675, 6869, 3022, 19000, 1006, 3149, 11774, 3917, 8663, 18209, 3149, 11774, 3917, 8663, 18209, 1010, 19578, 2890, 15500, 19578, 2890, 15500, 1010, 1056, 11909, 1007, 11618, 6453, 1063, 2345, 8299, 2890, 15500,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/com/thoughtworks/selenium/HttpCommandProcessor.java
HttpCommandProcessor.getOutputStreamWriter
protected Writer getOutputStreamWriter(HttpURLConnection conn) throws IOException { return new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), UTF_8)); }
java
protected Writer getOutputStreamWriter(HttpURLConnection conn) throws IOException { return new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), UTF_8)); }
[ "protected", "Writer", "getOutputStreamWriter", "(", "HttpURLConnection", "conn", ")", "throws", "IOException", "{", "return", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "conn", ".", "getOutputStream", "(", ")", ",", "UTF_8", ")", ")", ";", ...
for testing
[ "for", "testing" ]
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/com/thoughtworks/selenium/HttpCommandProcessor.java#L152-L154
train
Get the output stream writer.
[ 30522, 5123, 3213, 2131, 5833, 18780, 21422, 15994, 1006, 8299, 3126, 22499, 10087, 7542, 9530, 2078, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 2047, 17698, 2098, 15994, 1006, 2047, 27852, 25379, 15994, 1006, 9530, 2078, 1012, 2131, 5833,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java
EventSerializer.isEvent
public static boolean isEvent(Buffer buffer, Class<?> eventClass) throws IOException { return !buffer.isBuffer() && isEvent(buffer.getNioBufferReadable(), eventClass); }
java
public static boolean isEvent(Buffer buffer, Class<?> eventClass) throws IOException { return !buffer.isBuffer() && isEvent(buffer.getNioBufferReadable(), eventClass); }
[ "public", "static", "boolean", "isEvent", "(", "Buffer", "buffer", ",", "Class", "<", "?", ">", "eventClass", ")", "throws", "IOException", "{", "return", "!", "buffer", ".", "isBuffer", "(", ")", "&&", "isEvent", "(", "buffer", ".", "getNioBufferReadable", ...
Identifies whether the given buffer encodes the given event. Custom events are not supported. @param buffer the buffer to peak into @param eventClass the expected class of the event type @return whether the event class of the <tt>buffer</tt> matches the given <tt>eventClass</tt>
[ "Identifies", "whether", "the", "given", "buffer", "encodes", "the", "given", "event", ".", "Custom", "events", "are", "not", "supported", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/EventSerializer.java#L306-L308
train
Checks if the given buffer is a buffer of the given class and is an instance of the given class.
[ 30522, 2270, 10763, 22017, 20898, 2003, 18697, 3372, 1006, 17698, 17698, 1010, 2465, 1026, 1029, 1028, 2724, 26266, 1007, 11618, 22834, 10288, 24422, 1063, 2709, 999, 17698, 1012, 2003, 8569, 12494, 1006, 1007, 1004, 1004, 2003, 18697, 3372, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/cookie/ClientCookieEncoder.java
ClientCookieEncoder.encode
public String encode(String name, String value) { return encode(new DefaultCookie(name, value)); }
java
public String encode(String name, String value) { return encode(new DefaultCookie(name, value)); }
[ "public", "String", "encode", "(", "String", "name", ",", "String", "value", ")", "{", "return", "encode", "(", "new", "DefaultCookie", "(", "name", ",", "value", ")", ")", ";", "}" ]
Encodes the specified cookie into a Cookie header value. @param name the cookie name @param value the cookie value @return a Rfc6265 style Cookie header value
[ "Encodes", "the", "specified", "cookie", "into", "a", "Cookie", "header", "value", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ClientCookieEncoder.java#L74-L76
train
Encode a cookie.
[ 30522, 2270, 5164, 4372, 16044, 1006, 5164, 2171, 1010, 5164, 3643, 1007, 1063, 2709, 4372, 16044, 1006, 2047, 12398, 3597, 23212, 2063, 1006, 2171, 1010, 3643, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java
MysqlEventParser.buildMysqlConnection
private MysqlConnection buildMysqlConnection(AuthenticationInfo runningInfo) { MysqlConnection connection = new MysqlConnection(runningInfo.getAddress(), runningInfo.getUsername(), runningInfo.getPassword(), connectionCharsetNumber, runningInfo.getDefaultDatabaseName()); connection.getConnector().setReceiveBufferSize(receiveBufferSize); connection.getConnector().setSendBufferSize(sendBufferSize); connection.getConnector().setSoTimeout(defaultConnectionTimeoutInSeconds * 1000); connection.setCharset(connectionCharset); connection.setReceivedBinlogBytes(receivedBinlogBytes); // 随机生成slaveId if (this.slaveId <= 0) { this.slaveId = generateUniqueServerId(); } connection.setSlaveId(this.slaveId); return connection; }
java
private MysqlConnection buildMysqlConnection(AuthenticationInfo runningInfo) { MysqlConnection connection = new MysqlConnection(runningInfo.getAddress(), runningInfo.getUsername(), runningInfo.getPassword(), connectionCharsetNumber, runningInfo.getDefaultDatabaseName()); connection.getConnector().setReceiveBufferSize(receiveBufferSize); connection.getConnector().setSendBufferSize(sendBufferSize); connection.getConnector().setSoTimeout(defaultConnectionTimeoutInSeconds * 1000); connection.setCharset(connectionCharset); connection.setReceivedBinlogBytes(receivedBinlogBytes); // 随机生成slaveId if (this.slaveId <= 0) { this.slaveId = generateUniqueServerId(); } connection.setSlaveId(this.slaveId); return connection; }
[ "private", "MysqlConnection", "buildMysqlConnection", "(", "AuthenticationInfo", "runningInfo", ")", "{", "MysqlConnection", "connection", "=", "new", "MysqlConnection", "(", "runningInfo", ".", "getAddress", "(", ")", ",", "runningInfo", ".", "getUsername", "(", ")",...
=================== helper method =================
[ "===================", "helper", "method", "=================" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java#L313-L330
train
Build a MysqlConnection object.
[ 30522, 2797, 2026, 2015, 4160, 22499, 10087, 7542, 3857, 8029, 2015, 4160, 22499, 10087, 7542, 1006, 27280, 2378, 14876, 2770, 2378, 14876, 1007, 1063, 2026, 2015, 4160, 22499, 10087, 7542, 4434, 1027, 2047, 2026, 2015, 4160, 22499, 10087, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
HiveAuthFactory.loginFromSpnegoKeytabAndReturnUGI
public static UserGroupInformation loginFromSpnegoKeytabAndReturnUGI(HiveConf hiveConf) throws IOException { String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL); String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB); if (principal.isEmpty() || keyTabFile.isEmpty()) { throw new IOException("HiveServer2 SPNEGO principal or keytab is not correctly configured"); } else { return UserGroupInformation.loginUserFromKeytabAndReturnUGI(SecurityUtil.getServerPrincipal(principal, "0.0.0.0"), keyTabFile); } }
java
public static UserGroupInformation loginFromSpnegoKeytabAndReturnUGI(HiveConf hiveConf) throws IOException { String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL); String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_KEYTAB); if (principal.isEmpty() || keyTabFile.isEmpty()) { throw new IOException("HiveServer2 SPNEGO principal or keytab is not correctly configured"); } else { return UserGroupInformation.loginUserFromKeytabAndReturnUGI(SecurityUtil.getServerPrincipal(principal, "0.0.0.0"), keyTabFile); } }
[ "public", "static", "UserGroupInformation", "loginFromSpnegoKeytabAndReturnUGI", "(", "HiveConf", "hiveConf", ")", "throws", "IOException", "{", "String", "principal", "=", "hiveConf", ".", "getVar", "(", "ConfVars", ".", "HIVE_SERVER2_SPNEGO_PRINCIPAL", ")", ";", "Stri...
Perform SPNEGO login using the hadoop shim API if the configuration is available
[ "Perform", "SPNEGO", "login", "using", "the", "hadoop", "shim", "API", "if", "the", "configuration", "is", "available" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java#L237-L246
train
login from SPNEGO principal and keytab and return the UserGroupInformation object
[ 30522, 2270, 10763, 5310, 17058, 2378, 14192, 3370, 8833, 2378, 19699, 22225, 2361, 2638, 3995, 14839, 2696, 12733, 13465, 14287, 15916, 2072, 1006, 26736, 8663, 2546, 26736, 8663, 2546, 1007, 11618, 22834, 10288, 24422, 1063, 5164, 4054, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.toBigInteger
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) { return convert(BigInteger.class, value, defaultValue); }
java
public static BigInteger toBigInteger(Object value, BigInteger defaultValue) { return convert(BigInteger.class, value, defaultValue); }
[ "public", "static", "BigInteger", "toBigInteger", "(", "Object", "value", ",", "BigInteger", "defaultValue", ")", "{", "return", "convert", "(", "BigInteger", ".", "class", ",", "value", ",", "defaultValue", ")", ";", "}" ]
转换为BigInteger<br> 如果给定的值为空,或者转换失败,返回默认值<br> 转换失败不会报错 @param value 被转换的值 @param defaultValue 转换错误时的默认值 @return 结果
[ "转换为BigInteger<br", ">", "如果给定的值为空,或者转换失败,返回默认值<br", ">", "转换失败不会报错" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L396-L398
train
Converts value of type BigInteger to BigInteger default value is returned.
[ 30522, 2270, 10763, 2502, 18447, 26320, 2000, 5638, 11528, 2618, 4590, 1006, 4874, 3643, 1010, 2502, 18447, 26320, 12398, 10175, 5657, 1007, 1063, 2709, 10463, 1006, 2502, 18447, 26320, 1012, 2465, 1010, 3643, 1010, 12398, 10175, 5657, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kafka-0.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java
KafkaConsumerThread.setOffsetsToCommit
void setOffsetsToCommit( Map<TopicPartition, OffsetAndMetadata> offsetsToCommit, @Nonnull KafkaCommitCallback commitCallback) { // record the work to be committed by the main consumer thread and make sure the consumer notices that if (nextOffsetsToCommit.getAndSet(Tuple2.of(offsetsToCommit, commitCallback)) != null) { log.warn("Committing offsets to Kafka takes longer than the checkpoint interval. " + "Skipping commit of previous offsets because newer complete checkpoint offsets are available. " + "This does not compromise Flink's checkpoint integrity."); } // if the consumer is blocked in a poll() or handover operation, wake it up to commit soon handover.wakeupProducer(); synchronized (consumerReassignmentLock) { if (consumer != null) { consumer.wakeup(); } else { // the consumer is currently isolated for partition reassignment; // set this flag so that the wakeup state is restored once the reassignment is complete hasBufferedWakeup = true; } } }
java
void setOffsetsToCommit( Map<TopicPartition, OffsetAndMetadata> offsetsToCommit, @Nonnull KafkaCommitCallback commitCallback) { // record the work to be committed by the main consumer thread and make sure the consumer notices that if (nextOffsetsToCommit.getAndSet(Tuple2.of(offsetsToCommit, commitCallback)) != null) { log.warn("Committing offsets to Kafka takes longer than the checkpoint interval. " + "Skipping commit of previous offsets because newer complete checkpoint offsets are available. " + "This does not compromise Flink's checkpoint integrity."); } // if the consumer is blocked in a poll() or handover operation, wake it up to commit soon handover.wakeupProducer(); synchronized (consumerReassignmentLock) { if (consumer != null) { consumer.wakeup(); } else { // the consumer is currently isolated for partition reassignment; // set this flag so that the wakeup state is restored once the reassignment is complete hasBufferedWakeup = true; } } }
[ "void", "setOffsetsToCommit", "(", "Map", "<", "TopicPartition", ",", "OffsetAndMetadata", ">", "offsetsToCommit", ",", "@", "Nonnull", "KafkaCommitCallback", "commitCallback", ")", "{", "// record the work to be committed by the main consumer thread and make sure the consumer noti...
Tells this thread to commit a set of offsets. This method does not block, the committing operation will happen asynchronously. <p>Only one commit operation may be pending at any time. If the committing takes longer than the frequency with which this method is called, then some commits may be skipped due to being superseded by newer ones. @param offsetsToCommit The offsets to commit @param commitCallback callback when Kafka commit completes
[ "Tells", "this", "thread", "to", "commit", "a", "set", "of", "offsets", ".", "This", "method", "does", "not", "block", "the", "committing", "operation", "will", "happen", "asynchronously", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-0.9/src/main/java/org/apache/flink/streaming/connectors/kafka/internal/KafkaConsumerThread.java#L352-L375
train
Sets the offsets to be committed by the consumer.
[ 30522, 11675, 2275, 27475, 8454, 3406, 9006, 22930, 1006, 4949, 1026, 8476, 19362, 3775, 3508, 1010, 16396, 5685, 11368, 8447, 2696, 1028, 16396, 16033, 9006, 22930, 1010, 1030, 2512, 11231, 3363, 10556, 24316, 22684, 7382, 4183, 9289, 20850,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java
SpringApplication.setDefaultProperties
public void setDefaultProperties(Properties defaultProperties) { this.defaultProperties = new HashMap<>(); for (Object key : Collections.list(defaultProperties.propertyNames())) { this.defaultProperties.put((String) key, defaultProperties.get(key)); } }
java
public void setDefaultProperties(Properties defaultProperties) { this.defaultProperties = new HashMap<>(); for (Object key : Collections.list(defaultProperties.propertyNames())) { this.defaultProperties.put((String) key, defaultProperties.get(key)); } }
[ "public", "void", "setDefaultProperties", "(", "Properties", "defaultProperties", ")", "{", "this", ".", "defaultProperties", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Object", "key", ":", "Collections", ".", "list", "(", "defaultProperties", "....
Convenient alternative to {@link #setDefaultProperties(Map)}. @param defaultProperties some {@link Properties}
[ "Convenient", "alternative", "to", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java#L1077-L1082
train
Sets the default properties.
[ 30522, 2270, 11675, 2275, 3207, 7011, 11314, 21572, 4842, 7368, 1006, 5144, 12398, 21572, 4842, 7368, 1007, 1063, 2023, 1012, 12398, 21572, 4842, 7368, 1027, 2047, 23325, 2863, 2361, 1026, 1028, 1006, 1007, 1025, 2005, 1006, 4874, 3145, 102...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java
ExceptionUtils.stringifyException
public static String stringifyException(final Throwable e) { if (e == null) { return STRINGIFIED_NULL_EXCEPTION; } try { StringWriter stm = new StringWriter(); PrintWriter wrt = new PrintWriter(stm); e.printStackTrace(wrt); wrt.close(); return stm.toString(); } catch (Throwable t) { return e.getClass().getName() + " (error while printing stack trace)"; } }
java
public static String stringifyException(final Throwable e) { if (e == null) { return STRINGIFIED_NULL_EXCEPTION; } try { StringWriter stm = new StringWriter(); PrintWriter wrt = new PrintWriter(stm); e.printStackTrace(wrt); wrt.close(); return stm.toString(); } catch (Throwable t) { return e.getClass().getName() + " (error while printing stack trace)"; } }
[ "public", "static", "String", "stringifyException", "(", "final", "Throwable", "e", ")", "{", "if", "(", "e", "==", "null", ")", "{", "return", "STRINGIFIED_NULL_EXCEPTION", ";", "}", "try", "{", "StringWriter", "stm", "=", "new", "StringWriter", "(", ")", ...
Makes a string representation of the exception's stack trace, or "(null)", if the exception is null. <p>This method makes a best effort and never fails. @param e The exception to stringify. @return A string with exception name and call stack.
[ "Makes", "a", "string", "representation", "of", "the", "exception", "s", "stack", "trace", "or", "(", "null", ")", "if", "the", "exception", "is", "null", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ExceptionUtils.java#L60-L75
train
Returns a String representation of the given exception.
[ 30522, 2270, 10763, 5164, 5164, 8757, 10288, 24422, 1006, 2345, 5466, 3085, 1041, 1007, 1063, 2065, 1006, 1041, 1027, 1027, 19701, 1007, 1063, 2709, 5164, 7810, 1035, 19701, 1035, 6453, 1025, 1065, 3046, 1063, 5164, 15994, 2358, 2213, 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...
netty/netty
transport/src/main/java/io/netty/channel/DefaultChannelConfig.java
DefaultChannelConfig.getMaxMessagesPerRead
@Override @Deprecated public int getMaxMessagesPerRead() { try { MaxMessagesRecvByteBufAllocator allocator = getRecvByteBufAllocator(); return allocator.maxMessagesPerRead(); } catch (ClassCastException e) { throw new IllegalStateException("getRecvByteBufAllocator() must return an object of type " + "MaxMessagesRecvByteBufAllocator", e); } }
java
@Override @Deprecated public int getMaxMessagesPerRead() { try { MaxMessagesRecvByteBufAllocator allocator = getRecvByteBufAllocator(); return allocator.maxMessagesPerRead(); } catch (ClassCastException e) { throw new IllegalStateException("getRecvByteBufAllocator() must return an object of type " + "MaxMessagesRecvByteBufAllocator", e); } }
[ "@", "Override", "@", "Deprecated", "public", "int", "getMaxMessagesPerRead", "(", ")", "{", "try", "{", "MaxMessagesRecvByteBufAllocator", "allocator", "=", "getRecvByteBufAllocator", "(", ")", ";", "return", "allocator", ".", "maxMessagesPerRead", "(", ")", ";", ...
{@inheritDoc} <p> @throws IllegalStateException if {@link #getRecvByteBufAllocator()} does not return an object of type {@link MaxMessagesRecvByteBufAllocator}.
[ "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java#L225-L235
train
Get the maximum number of messages that can be used for a read of a message.
[ 30522, 1030, 2058, 15637, 1030, 2139, 28139, 12921, 2270, 20014, 2131, 17848, 7834, 3736, 8449, 4842, 16416, 2094, 1006, 1007, 1063, 3046, 1063, 4098, 7834, 3736, 8449, 2890, 2278, 26493, 17250, 8569, 13976, 24755, 4263, 2035, 24755, 4263, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/CharsetUtil.java
CharsetUtil.decoder
public static CharsetDecoder decoder(Charset charset) { checkNotNull(charset, "charset"); Map<Charset, CharsetDecoder> map = InternalThreadLocalMap.get().charsetDecoderCache(); CharsetDecoder d = map.get(charset); if (d != null) { d.reset().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); return d; } d = decoder(charset, CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); map.put(charset, d); return d; }
java
public static CharsetDecoder decoder(Charset charset) { checkNotNull(charset, "charset"); Map<Charset, CharsetDecoder> map = InternalThreadLocalMap.get().charsetDecoderCache(); CharsetDecoder d = map.get(charset); if (d != null) { d.reset().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE); return d; } d = decoder(charset, CodingErrorAction.REPLACE, CodingErrorAction.REPLACE); map.put(charset, d); return d; }
[ "public", "static", "CharsetDecoder", "decoder", "(", "Charset", "charset", ")", "{", "checkNotNull", "(", "charset", ",", "\"charset\"", ")", ";", "Map", "<", "Charset", ",", "CharsetDecoder", ">", "map", "=", "InternalThreadLocalMap", ".", "get", "(", ")", ...
Returns a cached thread-local {@link CharsetDecoder} for the specified {@link Charset}. @param charset The specified charset @return The decoder for the specified {@code charset}
[ "Returns", "a", "cached", "thread", "-", "local", "{", "@link", "CharsetDecoder", "}", "for", "the", "specified", "{", "@link", "Charset", "}", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/CharsetUtil.java#L169-L182
train
Gets the charset decoder.
[ 30522, 2270, 10763, 25869, 13462, 3207, 16044, 2099, 21933, 4063, 1006, 25869, 13462, 25869, 13462, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 25869, 13462, 1010, 1000, 25869, 13462, 1000, 1007, 1025, 4949, 1026, 25869, 13462, 1010, 25869, 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/restart/RestartStrategyFactory.java
RestartStrategyFactory.createRestartStrategyFactory
public static RestartStrategyFactory createRestartStrategyFactory(Configuration configuration) throws Exception { String restartStrategyName = configuration.getString(ConfigConstants.RESTART_STRATEGY, null); if (restartStrategyName == null) { // support deprecated ConfigConstants values final int numberExecutionRetries = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, ConfigConstants.DEFAULT_EXECUTION_RETRIES); String pauseString = configuration.getString(AkkaOptions.WATCH_HEARTBEAT_PAUSE); String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY, pauseString); long delay; try { delay = Duration.apply(delayString).toMillis(); } catch (NumberFormatException nfe) { if (delayString.equals(pauseString)) { throw new Exception("Invalid config value for " + AkkaOptions.WATCH_HEARTBEAT_PAUSE.key() + ": " + pauseString + ". Value must be a valid duration (such as '10 s' or '1 min')"); } else { throw new Exception("Invalid config value for " + ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString + ". Value must be a valid duration (such as '100 milli' or '10 s')"); } } if (numberExecutionRetries > 0 && delay >= 0) { return new FixedDelayRestartStrategy.FixedDelayRestartStrategyFactory(numberExecutionRetries, delay); } else { return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory(); } } switch (restartStrategyName.toLowerCase()) { case "none": case "off": case "disable": return NoRestartStrategy.createFactory(configuration); case "fixeddelay": case "fixed-delay": return FixedDelayRestartStrategy.createFactory(configuration); case "failurerate": case "failure-rate": return FailureRateRestartStrategy.createFactory(configuration); default: try { Class<?> clazz = Class.forName(restartStrategyName); if (clazz != null) { Method method = clazz.getMethod(CREATE_METHOD, Configuration.class); if (method != null) { Object result = method.invoke(null, configuration); if (result != null) { return (RestartStrategyFactory) result; } } } } catch (ClassNotFoundException cnfe) { LOG.warn("Could not find restart strategy class {}.", restartStrategyName); } catch (NoSuchMethodException nsme) { LOG.warn("Class {} does not has static method {}.", restartStrategyName, CREATE_METHOD); } catch (InvocationTargetException ite) { LOG.warn("Cannot call static method {} from class {}.", CREATE_METHOD, restartStrategyName); } catch (IllegalAccessException iae) { LOG.warn("Illegal access while calling method {} from class {}.", CREATE_METHOD, restartStrategyName); } // fallback in case of an error return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory(); } }
java
public static RestartStrategyFactory createRestartStrategyFactory(Configuration configuration) throws Exception { String restartStrategyName = configuration.getString(ConfigConstants.RESTART_STRATEGY, null); if (restartStrategyName == null) { // support deprecated ConfigConstants values final int numberExecutionRetries = configuration.getInteger(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_ATTEMPTS, ConfigConstants.DEFAULT_EXECUTION_RETRIES); String pauseString = configuration.getString(AkkaOptions.WATCH_HEARTBEAT_PAUSE); String delayString = configuration.getString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY, pauseString); long delay; try { delay = Duration.apply(delayString).toMillis(); } catch (NumberFormatException nfe) { if (delayString.equals(pauseString)) { throw new Exception("Invalid config value for " + AkkaOptions.WATCH_HEARTBEAT_PAUSE.key() + ": " + pauseString + ". Value must be a valid duration (such as '10 s' or '1 min')"); } else { throw new Exception("Invalid config value for " + ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY + ": " + delayString + ". Value must be a valid duration (such as '100 milli' or '10 s')"); } } if (numberExecutionRetries > 0 && delay >= 0) { return new FixedDelayRestartStrategy.FixedDelayRestartStrategyFactory(numberExecutionRetries, delay); } else { return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory(); } } switch (restartStrategyName.toLowerCase()) { case "none": case "off": case "disable": return NoRestartStrategy.createFactory(configuration); case "fixeddelay": case "fixed-delay": return FixedDelayRestartStrategy.createFactory(configuration); case "failurerate": case "failure-rate": return FailureRateRestartStrategy.createFactory(configuration); default: try { Class<?> clazz = Class.forName(restartStrategyName); if (clazz != null) { Method method = clazz.getMethod(CREATE_METHOD, Configuration.class); if (method != null) { Object result = method.invoke(null, configuration); if (result != null) { return (RestartStrategyFactory) result; } } } } catch (ClassNotFoundException cnfe) { LOG.warn("Could not find restart strategy class {}.", restartStrategyName); } catch (NoSuchMethodException nsme) { LOG.warn("Class {} does not has static method {}.", restartStrategyName, CREATE_METHOD); } catch (InvocationTargetException ite) { LOG.warn("Cannot call static method {} from class {}.", CREATE_METHOD, restartStrategyName); } catch (IllegalAccessException iae) { LOG.warn("Illegal access while calling method {} from class {}.", CREATE_METHOD, restartStrategyName); } // fallback in case of an error return new NoOrFixedIfCheckpointingEnabledRestartStrategyFactory(); } }
[ "public", "static", "RestartStrategyFactory", "createRestartStrategyFactory", "(", "Configuration", "configuration", ")", "throws", "Exception", "{", "String", "restartStrategyName", "=", "configuration", ".", "getString", "(", "ConfigConstants", ".", "RESTART_STRATEGY", ",...
Creates a {@link RestartStrategy} instance from the given {@link Configuration}. @return RestartStrategy instance @throws Exception which indicates that the RestartStrategy could not be instantiated.
[ "Creates", "a", "{", "@link", "RestartStrategy", "}", "instance", "from", "the", "given", "{", "@link", "Configuration", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/RestartStrategyFactory.java#L84-L157
train
Creates a RestartStrategyFactory based on the configuration.
[ 30522, 2270, 10763, 23818, 20528, 2618, 6292, 21450, 3443, 28533, 20591, 6494, 2618, 6292, 21450, 1006, 9563, 9563, 1007, 11618, 6453, 1063, 5164, 23818, 20528, 2618, 6292, 18442, 1027, 9563, 1012, 4152, 18886, 3070, 1006, 9530, 8873, 18195, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setBoolean
@PublicEvolving public void setBoolean(ConfigOption<Boolean> key, boolean value) { setValueInternal(key.key(), value); }
java
@PublicEvolving public void setBoolean(ConfigOption<Boolean> key, boolean value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setBoolean", "(", "ConfigOption", "<", "Boolean", ">", "key", ",", "boolean", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L412-L415
train
Sets the value of the configuration option as a boolean.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 11675, 2275, 5092, 9890, 2319, 1006, 9530, 8873, 3995, 16790, 1026, 22017, 20898, 1028, 3145, 1010, 22017, 20898, 3643, 1007, 1063, 2275, 10175, 5657, 18447, 11795, 2389, 1006, 3145, 1012, 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...
networknt/light-4j
http-url/src/main/java/com/networknt/url/HttpURL.java
HttpURL.isPortDefault
public boolean isPortDefault() { return (PROTOCOL_HTTPS.equalsIgnoreCase(protocol) && port == DEFAULT_HTTPS_PORT) || (PROTOCOL_HTTP.equalsIgnoreCase(protocol) && port == DEFAULT_HTTP_PORT); }
java
public boolean isPortDefault() { return (PROTOCOL_HTTPS.equalsIgnoreCase(protocol) && port == DEFAULT_HTTPS_PORT) || (PROTOCOL_HTTP.equalsIgnoreCase(protocol) && port == DEFAULT_HTTP_PORT); }
[ "public", "boolean", "isPortDefault", "(", ")", "{", "return", "(", "PROTOCOL_HTTPS", ".", "equalsIgnoreCase", "(", "protocol", ")", "&&", "port", "==", "DEFAULT_HTTPS_PORT", ")", "||", "(", "PROTOCOL_HTTP", ".", "equalsIgnoreCase", "(", "protocol", ")", "&&", ...
Whether this URL uses the default port for the protocol. The default port is 80 for "http" protocol, and 443 for "https". Other protocols are not supported and this method will always return false for them. @return <code>true</code> if the URL is using the default port. @since 1.8.0
[ "Whether", "this", "URL", "uses", "the", "default", "port", "for", "the", "protocol", ".", "The", "default", "port", "is", "80", "for", "http", "protocol", "and", "443", "for", "https", ".", "Other", "protocols", "are", "not", "supported", "and", "this", ...
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L399-L404
train
Returns true if the port is the default port.
[ 30522, 2270, 22017, 20898, 2003, 6442, 3207, 7011, 11314, 1006, 1007, 1063, 2709, 1006, 8778, 1035, 16770, 1012, 19635, 23773, 5686, 18382, 1006, 8778, 1007, 1004, 1004, 3417, 1027, 1027, 12398, 1035, 16770, 1035, 3417, 1007, 1064, 1064, 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-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java
KeyGroupRangeOffsets.getIntersection
public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) { Preconditions.checkNotNull(keyGroupRange); KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange); long[] subOffsets = new long[intersection.getNumberOfKeyGroups()]; if(subOffsets.length > 0) { System.arraycopy( offsets, computeKeyGroupIndex(intersection.getStartKeyGroup()), subOffsets, 0, subOffsets.length); } return new KeyGroupRangeOffsets(intersection, subOffsets); }
java
public KeyGroupRangeOffsets getIntersection(KeyGroupRange keyGroupRange) { Preconditions.checkNotNull(keyGroupRange); KeyGroupRange intersection = this.keyGroupRange.getIntersection(keyGroupRange); long[] subOffsets = new long[intersection.getNumberOfKeyGroups()]; if(subOffsets.length > 0) { System.arraycopy( offsets, computeKeyGroupIndex(intersection.getStartKeyGroup()), subOffsets, 0, subOffsets.length); } return new KeyGroupRangeOffsets(intersection, subOffsets); }
[ "public", "KeyGroupRangeOffsets", "getIntersection", "(", "KeyGroupRange", "keyGroupRange", ")", "{", "Preconditions", ".", "checkNotNull", "(", "keyGroupRange", ")", ";", "KeyGroupRange", "intersection", "=", "this", ".", "keyGroupRange", ".", "getIntersection", "(", ...
Returns a key-group range with offsets which is the intersection of the internal key-group range with the given key-group range. @param keyGroupRange Key-group range to intersect with the internal key-group range. @return The key-group range with offsets for the intersection of the internal key-group range with the given key-group range.
[ "Returns", "a", "key", "-", "group", "range", "with", "offsets", "which", "is", "the", "intersection", "of", "the", "internal", "key", "-", "group", "range", "with", "the", "given", "key", "-", "group", "range", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/KeyGroupRangeOffsets.java#L115-L128
train
Gets the intersection of this key group range and the given key group range.
[ 30522, 2270, 3145, 17058, 24388, 8780, 21807, 8454, 2131, 18447, 2545, 18491, 1006, 3145, 17058, 24388, 2063, 3145, 17058, 24388, 2063, 1007, 1063, 3653, 8663, 20562, 2015, 1012, 4638, 17048, 11231, 3363, 1006, 3145, 17058, 24388, 2063, 1007,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getDouble
@PublicEvolving public double getDouble(ConfigOption<Double> configOption, double overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToDouble(o, configOption.defaultValue()); }
java
@PublicEvolving public double getDouble(ConfigOption<Double> configOption, double overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToDouble(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "double", "getDouble", "(", "ConfigOption", "<", "Double", ">", "configOption", ",", "double", "overrideDefault", ")", "{", "Object", "o", "=", "getRawValueFromOption", "(", "configOption", ")", ";", "if", "(", "o", "==", "null...
Returns the value associated with the given config option as a {@code double}. If no value is mapped under any key of the option, it returns the specified default instead of the option's default value. @param configOption The configuration option @param overrideDefault The value to return if no value was mapper for any key of the option @return the configured value associated with the given config option, or the overrideDefault
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "a", "{", "@code", "double", "}", ".", "If", "no", "value", "is", "mapped", "under", "any", "key", "of", "the", "option", "it", "returns", "the", "specified", "def...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L530-L537
train
Returns the value associated with the given config option as a double.
[ 30522, 1030, 2270, 6777, 4747, 6455, 2270, 3313, 2131, 26797, 3468, 1006, 9530, 8873, 3995, 16790, 1026, 3313, 1028, 9530, 8873, 3995, 16790, 1010, 3313, 2058, 15637, 3207, 7011, 11314, 1007, 1063, 4874, 1051, 1027, 2131, 2527, 2860, 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-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonSingleInputSender.java
PythonSingleInputSender.sendBuffer
public int sendBuffer(SingleElementPushBackIterator<IN> input) throws IOException { if (serializer == null) { IN value = input.next(); serializer = getSerializer(value); input.pushBack(value); } return sendBuffer(input, serializer); }
java
public int sendBuffer(SingleElementPushBackIterator<IN> input) throws IOException { if (serializer == null) { IN value = input.next(); serializer = getSerializer(value); input.pushBack(value); } return sendBuffer(input, serializer); }
[ "public", "int", "sendBuffer", "(", "SingleElementPushBackIterator", "<", "IN", ">", "input", ")", "throws", "IOException", "{", "if", "(", "serializer", "==", "null", ")", "{", "IN", "value", "=", "input", ".", "next", "(", ")", ";", "serializer", "=", ...
Extracts records from an iterator and writes them to the memory-mapped file. This method assumes that all values in the iterator are of the same type. This method does NOT take care of synchronization. The caller must guarantee that the file may be written to before calling this method. @param input iterator containing records @return size of the written buffer @throws IOException
[ "Extracts", "records", "from", "an", "iterator", "and", "writes", "them", "to", "the", "memory", "-", "mapped", "file", ".", "This", "method", "assumes", "that", "all", "values", "in", "the", "iterator", "are", "of", "the", "same", "type", ".", "This", "...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonSingleInputSender.java#L49-L56
train
Send a single element iterator to the client.
[ 30522, 2270, 20014, 4604, 8569, 12494, 1006, 2309, 12260, 3672, 12207, 2232, 5963, 21646, 8844, 1026, 1999, 1028, 7953, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 7642, 17629, 1027, 1027, 19701, 1007, 1063, 1999, 3643, 1027, 7953, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/InstrumentedExecutorService.java
InstrumentedExecutorService.execute
@Override public void execute(@Nonnull Runnable runnable) { submitted.mark(); try { delegate.execute(new InstrumentedRunnable(runnable)); } catch (RejectedExecutionException e) { rejected.mark(); throw e; } }
java
@Override public void execute(@Nonnull Runnable runnable) { submitted.mark(); try { delegate.execute(new InstrumentedRunnable(runnable)); } catch (RejectedExecutionException e) { rejected.mark(); throw e; } }
[ "@", "Override", "public", "void", "execute", "(", "@", "Nonnull", "Runnable", "runnable", ")", "{", "submitted", ".", "mark", "(", ")", ";", "try", "{", "delegate", ".", "execute", "(", "new", "InstrumentedRunnable", "(", "runnable", ")", ")", ";", "}",...
{@inheritDoc}
[ "{" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutorService.java#L74-L83
train
Execute a Runnable.
[ 30522, 1030, 2058, 15637, 2270, 11675, 15389, 1006, 1030, 2512, 11231, 3363, 2448, 22966, 2448, 22966, 1007, 1063, 7864, 1012, 2928, 1006, 1007, 1025, 3046, 1063, 11849, 1012, 15389, 1006, 2047, 6602, 2098, 15532, 22966, 1006, 2448, 22966, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.getAttributes
public static BasicFileAttributes getAttributes(Path path, boolean isFollowLinks) throws IORuntimeException { if (null == path) { return null; } final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS }; try { return Files.readAttributes(path, BasicFileAttributes.class, options); } catch (IOException e) { throw new IORuntimeException(e); } }
java
public static BasicFileAttributes getAttributes(Path path, boolean isFollowLinks) throws IORuntimeException { if (null == path) { return null; } final LinkOption[] options = isFollowLinks ? new LinkOption[0] : new LinkOption[] { LinkOption.NOFOLLOW_LINKS }; try { return Files.readAttributes(path, BasicFileAttributes.class, options); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "public", "static", "BasicFileAttributes", "getAttributes", "(", "Path", "path", ",", "boolean", "isFollowLinks", ")", "throws", "IORuntimeException", "{", "if", "(", "null", "==", "path", ")", "{", "return", "null", ";", "}", "final", "LinkOption", "[", "]", ...
获取文件属性 @param path 文件路径{@link Path} @param isFollowLinks 是否跟踪到软链对应的真实路径 @return {@link BasicFileAttributes} @throws IORuntimeException IO异常 @since 3.1.0
[ "获取文件属性" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1871-L1882
train
Gets the attributes of a file or directory.
[ 30522, 2270, 10763, 3937, 8873, 19738, 4779, 3089, 8569, 4570, 2131, 19321, 3089, 8569, 4570, 1006, 4130, 4130, 1010, 22017, 20898, 2003, 14876, 7174, 13668, 19839, 2015, 1007, 11618, 22834, 15532, 7292, 10288, 24422, 1063, 2065, 1006, 19701,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java
AbstractEpollStreamChannel.doWriteMultiple
private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception { final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite(); IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.maxBytes(maxBytesPerGatheringWrite); in.forEachFlushedMessage(array); if (array.count() >= 1) { // TODO: Handle the case where cnt == 1 specially. return writeBytesMultiple(in, array); } // cnt == 0, which means the outbound buffer contained empty buffers only. in.removeBytes(0); return 0; }
java
private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception { final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite(); IovArray array = ((EpollEventLoop) eventLoop()).cleanIovArray(); array.maxBytes(maxBytesPerGatheringWrite); in.forEachFlushedMessage(array); if (array.count() >= 1) { // TODO: Handle the case where cnt == 1 specially. return writeBytesMultiple(in, array); } // cnt == 0, which means the outbound buffer contained empty buffers only. in.removeBytes(0); return 0; }
[ "private", "int", "doWriteMultiple", "(", "ChannelOutboundBuffer", "in", ")", "throws", "Exception", "{", "final", "long", "maxBytesPerGatheringWrite", "=", "config", "(", ")", ".", "getMaxBytesPerGatheringWrite", "(", ")", ";", "IovArray", "array", "=", "(", "(",...
Attempt to write multiple {@link ByteBuf} objects. @param in the collection which contains objects to write. @return The value that should be decremented from the write quantum which starts at {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: <ul> <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) is encountered</li> <li>1 - if a single call to write data was made to the OS</li> <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no data was accepted</li> </ul> @throws Exception If an I/O error occurs.
[ "Attempt", "to", "write", "multiple", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L511-L524
train
Write multiple messages.
[ 30522, 2797, 20014, 23268, 17625, 12274, 7096, 11514, 2571, 1006, 3149, 5833, 15494, 8569, 12494, 1999, 1007, 11618, 6453, 1063, 2345, 2146, 4098, 3762, 4570, 4842, 20697, 22658, 26373, 1027, 9530, 8873, 2290, 1006, 1007, 1012, 2131, 17848, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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
consul/src/main/java/com/networknt/consul/ConsulUtils.java
ConsulUtils.buildService
public static ConsulService buildService(URL url) { ConsulService service = new ConsulService(); service.setAddress(url.getHost()); service.setId(ConsulUtils.convertConsulSerivceId(url)); service.setName(url.getPath()); service.setPort(url.getPort()); List<String> tags = new ArrayList<String>(); String env = url.getParameter(Constants.TAG_ENVIRONMENT); if(env != null) tags.add(env); service.setTags(tags); return service; }
java
public static ConsulService buildService(URL url) { ConsulService service = new ConsulService(); service.setAddress(url.getHost()); service.setId(ConsulUtils.convertConsulSerivceId(url)); service.setName(url.getPath()); service.setPort(url.getPort()); List<String> tags = new ArrayList<String>(); String env = url.getParameter(Constants.TAG_ENVIRONMENT); if(env != null) tags.add(env); service.setTags(tags); return service; }
[ "public", "static", "ConsulService", "buildService", "(", "URL", "url", ")", "{", "ConsulService", "service", "=", "new", "ConsulService", "(", ")", ";", "service", ".", "setAddress", "(", "url", ".", "getHost", "(", ")", ")", ";", "service", ".", "setId",...
build consul service from url @param url a URL object @return ConsulService consul service
[ "build", "consul", "service", "from", "url" ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/consul/src/main/java/com/networknt/consul/ConsulUtils.java#L54-L66
train
Build a ConsulService from a URL
[ 30522, 2270, 10763, 11801, 8043, 7903, 2063, 16473, 2121, 7903, 2063, 1006, 24471, 2140, 24471, 2140, 1007, 1063, 11801, 8043, 7903, 2063, 2326, 1027, 2047, 11801, 8043, 7903, 2063, 1006, 1007, 1025, 2326, 1012, 2275, 4215, 16200, 4757, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
SlotSharingManager.createRootSlot
@Nonnull MultiTaskSlot createRootSlot( SlotRequestId slotRequestId, CompletableFuture<? extends SlotContext> slotContextFuture, SlotRequestId allocatedSlotRequestId) { final MultiTaskSlot rootMultiTaskSlot = new MultiTaskSlot( slotRequestId, slotContextFuture, allocatedSlotRequestId); LOG.debug("Create multi task slot [{}] in slot [{}].", slotRequestId, allocatedSlotRequestId); allTaskSlots.put(slotRequestId, rootMultiTaskSlot); unresolvedRootSlots.put(slotRequestId, rootMultiTaskSlot); // add the root node to the set of resolved root nodes once the SlotContext future has // been completed and we know the slot's TaskManagerLocation slotContextFuture.whenComplete( (SlotContext slotContext, Throwable throwable) -> { if (slotContext != null) { final MultiTaskSlot resolvedRootNode = unresolvedRootSlots.remove(slotRequestId); if (resolvedRootNode != null) { final AllocationID allocationId = slotContext.getAllocationId(); LOG.trace("Fulfill multi task slot [{}] with slot [{}].", slotRequestId, allocationId); final Map<AllocationID, MultiTaskSlot> innerMap = resolvedRootSlots.computeIfAbsent( slotContext.getTaskManagerLocation(), taskManagerLocation -> new HashMap<>(4)); MultiTaskSlot previousValue = innerMap.put(allocationId, resolvedRootNode); Preconditions.checkState(previousValue == null); } } else { rootMultiTaskSlot.release(throwable); } }); return rootMultiTaskSlot; }
java
@Nonnull MultiTaskSlot createRootSlot( SlotRequestId slotRequestId, CompletableFuture<? extends SlotContext> slotContextFuture, SlotRequestId allocatedSlotRequestId) { final MultiTaskSlot rootMultiTaskSlot = new MultiTaskSlot( slotRequestId, slotContextFuture, allocatedSlotRequestId); LOG.debug("Create multi task slot [{}] in slot [{}].", slotRequestId, allocatedSlotRequestId); allTaskSlots.put(slotRequestId, rootMultiTaskSlot); unresolvedRootSlots.put(slotRequestId, rootMultiTaskSlot); // add the root node to the set of resolved root nodes once the SlotContext future has // been completed and we know the slot's TaskManagerLocation slotContextFuture.whenComplete( (SlotContext slotContext, Throwable throwable) -> { if (slotContext != null) { final MultiTaskSlot resolvedRootNode = unresolvedRootSlots.remove(slotRequestId); if (resolvedRootNode != null) { final AllocationID allocationId = slotContext.getAllocationId(); LOG.trace("Fulfill multi task slot [{}] with slot [{}].", slotRequestId, allocationId); final Map<AllocationID, MultiTaskSlot> innerMap = resolvedRootSlots.computeIfAbsent( slotContext.getTaskManagerLocation(), taskManagerLocation -> new HashMap<>(4)); MultiTaskSlot previousValue = innerMap.put(allocationId, resolvedRootNode); Preconditions.checkState(previousValue == null); } } else { rootMultiTaskSlot.release(throwable); } }); return rootMultiTaskSlot; }
[ "@", "Nonnull", "MultiTaskSlot", "createRootSlot", "(", "SlotRequestId", "slotRequestId", ",", "CompletableFuture", "<", "?", "extends", "SlotContext", ">", "slotContextFuture", ",", "SlotRequestId", "allocatedSlotRequestId", ")", "{", "final", "MultiTaskSlot", "rootMulti...
Creates a new root slot with the given {@link SlotRequestId}, {@link SlotContext} future and the {@link SlotRequestId} of the allocated slot. @param slotRequestId of the root slot @param slotContextFuture with which we create the root slot @param allocatedSlotRequestId slot request id of the underlying allocated slot which can be used to cancel the pending slot request or release the allocated slot @return New root slot
[ "Creates", "a", "new", "root", "slot", "with", "the", "given", "{", "@link", "SlotRequestId", "}", "{", "@link", "SlotContext", "}", "future", "and", "the", "{", "@link", "SlotRequestId", "}", "of", "the", "allocated", "slot", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java#L137-L177
train
Create a new root slot.
[ 30522, 1030, 2512, 11231, 3363, 4800, 10230, 5705, 10994, 3443, 3217, 12868, 10994, 1006, 10453, 2890, 15500, 3593, 10453, 2890, 15500, 3593, 1010, 4012, 10814, 10880, 11263, 11244, 1026, 1029, 8908, 10453, 8663, 18209, 1028, 10453, 8663, 182...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...