repo
stringclasses
11 values
path
stringlengths
41
214
func_name
stringlengths
7
82
original_string
stringlengths
77
11.9k
language
stringclasses
1 value
code
stringlengths
77
11.9k
code_tokens
listlengths
22
1.57k
docstring
stringlengths
2
2.27k
docstring_tokens
listlengths
1
352
sha
stringclasses
11 values
url
stringlengths
129
319
partition
stringclasses
1 value
summary
stringlengths
7
191
input_ids
listlengths
502
502
token_type_ids
listlengths
502
502
attention_mask
listlengths
502
502
labels
listlengths
502
502
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/operators/CompilerHints.java
CompilerHints.addUniqueField
public void addUniqueField(int field) { if (this.uniqueFields == null) { this.uniqueFields = new HashSet<FieldSet>(); } this.uniqueFields.add(new FieldSet(field)); }
java
public void addUniqueField(int field) { if (this.uniqueFields == null) { this.uniqueFields = new HashSet<FieldSet>(); } this.uniqueFields.add(new FieldSet(field)); }
[ "public", "void", "addUniqueField", "(", "int", "field", ")", "{", "if", "(", "this", ".", "uniqueFields", "==", "null", ")", "{", "this", ".", "uniqueFields", "=", "new", "HashSet", "<", "FieldSet", ">", "(", ")", ";", "}", "this", ".", "uniqueFields"...
Adds a field as having only unique values. @param field The field with unique values.
[ "Adds", "a", "field", "as", "having", "only", "unique", "values", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/operators/CompilerHints.java#L131-L136
train
Adds a unique field to the entity.
[ 30522, 2270, 11675, 5587, 19496, 4226, 3790, 1006, 20014, 2492, 1007, 1063, 2065, 1006, 2023, 1012, 4310, 15155, 1027, 1027, 19701, 1007, 1063, 2023, 1012, 4310, 15155, 1027, 2047, 23325, 13462, 1026, 4249, 3388, 1028, 1006, 1007, 1025, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.round
public Img round(double arc) { final BufferedImage srcImage = getValidSrcImg(); final int width = srcImage.getWidth(); final int height = srcImage.getHeight(); // 通过弧度占比计算弧度 arc = NumberUtil.mul(arc, Math.min(width, height)); final BufferedImage targetImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = targetImage.createGraphics(); g2.setComposite(AlphaComposite.Src); // 抗锯齿 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.fill(new RoundRectangle2D.Double(0, 0, width, height, arc, arc)); g2.setComposite(AlphaComposite.SrcAtop); g2.drawImage(srcImage, 0, 0, null); g2.dispose(); this.targetImage = targetImage; return this; }
java
public Img round(double arc) { final BufferedImage srcImage = getValidSrcImg(); final int width = srcImage.getWidth(); final int height = srcImage.getHeight(); // 通过弧度占比计算弧度 arc = NumberUtil.mul(arc, Math.min(width, height)); final BufferedImage targetImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = targetImage.createGraphics(); g2.setComposite(AlphaComposite.Src); // 抗锯齿 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.fill(new RoundRectangle2D.Double(0, 0, width, height, arc, arc)); g2.setComposite(AlphaComposite.SrcAtop); g2.drawImage(srcImage, 0, 0, null); g2.dispose(); this.targetImage = targetImage; return this; }
[ "public", "Img", "round", "(", "double", "arc", ")", "{", "final", "BufferedImage", "srcImage", "=", "getValidSrcImg", "(", ")", ";", "final", "int", "width", "=", "srcImage", ".", "getWidth", "(", ")", ";", "final", "int", "height", "=", "srcImage", "."...
图片圆角处理 @param arc 圆角弧度,0~1,为长宽占比 @return this @since 4.5.3
[ "图片圆角处理" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L344-L363
train
Returns a new image with the specified round value.
[ 30522, 2270, 10047, 2290, 2461, 1006, 3313, 8115, 1007, 1063, 2345, 17698, 2098, 9581, 3351, 5034, 6895, 26860, 1027, 2131, 10175, 9821, 11890, 5714, 2290, 1006, 1007, 1025, 2345, 20014, 9381, 1027, 5034, 6895, 26860, 1012, 2131, 9148, 1192...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java
CLIService.closeOperation
@Override public void closeOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().closeOperation(opHandle); LOG.debug(opHandle + ": closeOperation"); }
java
@Override public void closeOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().closeOperation(opHandle); LOG.debug(opHandle + ": closeOperation"); }
[ "@", "Override", "public", "void", "closeOperation", "(", "OperationHandle", "opHandle", ")", "throws", "HiveSQLException", "{", "sessionManager", ".", "getOperationManager", "(", ")", ".", "getOperation", "(", "opHandle", ")", ".", "getParentSession", "(", ")", "...
/* (non-Javadoc) @see org.apache.hive.service.cli.ICLIService#closeOperation(org.apache.hive.service.cli.OperationHandle)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/CLIService.java#L421-L427
train
Close an operation.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2485, 25918, 3370, 1006, 3169, 11774, 2571, 6728, 11774, 2571, 1007, 11618, 26736, 2015, 4160, 2571, 2595, 24422, 1063, 5219, 24805, 4590, 1012, 2131, 25918, 3370, 24805, 4590, 1006, 1007, 1012, 2131, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java
Util.parseDate
public static Date parseDate(String datetimeStr) { if (StringUtils.isEmpty(datetimeStr)) { return null; } datetimeStr = datetimeStr.trim(); if (datetimeStr.contains("-")) { if (datetimeStr.contains(":")) { datetimeStr = datetimeStr.replace(" ", "T"); } } else if (datetimeStr.contains(":")) { datetimeStr = "T" + datetimeStr; } DateTime dateTime = new DateTime(datetimeStr, dateTimeZone); return dateTime.toDate(); }
java
public static Date parseDate(String datetimeStr) { if (StringUtils.isEmpty(datetimeStr)) { return null; } datetimeStr = datetimeStr.trim(); if (datetimeStr.contains("-")) { if (datetimeStr.contains(":")) { datetimeStr = datetimeStr.replace(" ", "T"); } } else if (datetimeStr.contains(":")) { datetimeStr = "T" + datetimeStr; } DateTime dateTime = new DateTime(datetimeStr, dateTimeZone); return dateTime.toDate(); }
[ "public", "static", "Date", "parseDate", "(", "String", "datetimeStr", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "datetimeStr", ")", ")", "{", "return", "null", ";", "}", "datetimeStr", "=", "datetimeStr", ".", "trim", "(", ")", ";", "if",...
通用日期时间字符解析 @param datetimeStr 日期时间字符串 @return Date
[ "通用日期时间字符解析" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/Util.java#L190-L206
train
Parse a date from a string.
[ 30522, 2270, 10763, 3058, 11968, 6924, 3686, 1006, 5164, 3058, 7292, 3367, 2099, 1007, 1063, 2065, 1006, 5164, 21823, 4877, 1012, 2003, 6633, 13876, 2100, 1006, 3058, 7292, 3367, 2099, 1007, 1007, 1063, 2709, 19701, 1025, 1065, 3058, 7292, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/nosql/mongo/MongoDS.java
MongoDS.createCredentail
private MongoCredential createCredentail(String group) { final Setting setting = this.setting; if(null == setting) { return null; } final String user = setting.getStr("user", group, setting.getStr("user")); final String pass = setting.getStr("pass", group, setting.getStr("pass")); final String database = setting.getStr("database", group, setting.getStr("database")); return createCredentail(user, database, pass); }
java
private MongoCredential createCredentail(String group) { final Setting setting = this.setting; if(null == setting) { return null; } final String user = setting.getStr("user", group, setting.getStr("user")); final String pass = setting.getStr("pass", group, setting.getStr("pass")); final String database = setting.getStr("database", group, setting.getStr("database")); return createCredentail(user, database, pass); }
[ "private", "MongoCredential", "createCredentail", "(", "String", "group", ")", "{", "final", "Setting", "setting", "=", "this", ".", "setting", ";", "if", "(", "null", "==", "setting", ")", "{", "return", "null", ";", "}", "final", "String", "user", "=", ...
创建{@link MongoCredential},用于服务端验证<br> 此方法会首先读取指定分组下的属性,用户没有定义则读取空分组下的属性 @param group 分组 @return {@link MongoCredential},如果用户未指定用户名密码返回null @since 4.1.20
[ "创建", "{", "@link", "MongoCredential", "}", ",用于服务端验证<br", ">", "此方法会首先读取指定分组下的属性,用户没有定义则读取空分组下的属性" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L295-L304
train
Create a credential for the specified group.
[ 30522, 2797, 12256, 3995, 16748, 16454, 4818, 3443, 16748, 16454, 12502, 1006, 5164, 2177, 1007, 1063, 2345, 4292, 4292, 1027, 2023, 1012, 4292, 1025, 2065, 1006, 19701, 1027, 1027, 4292, 1007, 1063, 2709, 19701, 1025, 1065, 2345, 5164, 531...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed, AlgorithmParameterSpec... params) { algorithm = getAlgorithmAfterWith(algorithm); final KeyPairGenerator keyPairGen = getKeyPairGenerator(algorithm); // 密钥模(modulus )长度初始化定义 if (keySize > 0) { // key长度适配修正 if ("EC".equalsIgnoreCase(algorithm) && keySize > 256) { // 对于EC算法,密钥长度有限制,在此使用默认256 keySize = 256; } if (null != seed) { keyPairGen.initialize(keySize, new SecureRandom(seed)); } else { keyPairGen.initialize(keySize); } } // 自定义初始化参数 if (ArrayUtil.isNotEmpty(params)) { for (AlgorithmParameterSpec param : params) { if (null == param) { continue; } try { if (null != seed) { keyPairGen.initialize(param, new SecureRandom(seed)); } else { keyPairGen.initialize(param); } } catch (InvalidAlgorithmParameterException e) { throw new CryptoException(e); } } } return keyPairGen.generateKeyPair(); }
java
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed, AlgorithmParameterSpec... params) { algorithm = getAlgorithmAfterWith(algorithm); final KeyPairGenerator keyPairGen = getKeyPairGenerator(algorithm); // 密钥模(modulus )长度初始化定义 if (keySize > 0) { // key长度适配修正 if ("EC".equalsIgnoreCase(algorithm) && keySize > 256) { // 对于EC算法,密钥长度有限制,在此使用默认256 keySize = 256; } if (null != seed) { keyPairGen.initialize(keySize, new SecureRandom(seed)); } else { keyPairGen.initialize(keySize); } } // 自定义初始化参数 if (ArrayUtil.isNotEmpty(params)) { for (AlgorithmParameterSpec param : params) { if (null == param) { continue; } try { if (null != seed) { keyPairGen.initialize(param, new SecureRandom(seed)); } else { keyPairGen.initialize(param); } } catch (InvalidAlgorithmParameterException e) { throw new CryptoException(e); } } } return keyPairGen.generateKeyPair(); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "int", "keySize", ",", "byte", "[", "]", "seed", ",", "AlgorithmParameterSpec", "...", "params", ")", "{", "algorithm", "=", "getAlgorithmAfterWith", "(", "algorithm", ")", ";", ...
生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param keySize 密钥模(modulus )长度 @param seed 种子 @param params {@link AlgorithmParameterSpec} @return {@link KeyPair} @since 4.3.3
[ "生成用于非对称加密的公钥和私钥<br", ">", "密钥对生成算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyPairGenerator" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L393-L429
train
Creates a new RSA key pair using the specified parameters.
[ 30522, 2270, 10763, 3145, 4502, 4313, 9699, 14839, 4502, 4313, 1006, 5164, 9896, 1010, 20014, 6309, 4697, 1010, 24880, 1031, 1033, 6534, 1010, 9896, 28689, 22828, 13102, 8586, 1012, 1012, 1012, 11498, 5244, 1007, 1063, 9896, 1027, 2131, 238...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TaskEventDispatcher.java
TaskEventDispatcher.registerPartition
public void registerPartition(ResultPartitionID partitionId) { checkNotNull(partitionId); synchronized (registeredHandlers) { LOG.debug("registering {}", partitionId); if (registeredHandlers.put(partitionId, new TaskEventHandler()) != null) { throw new IllegalStateException( "Partition " + partitionId + " already registered at task event dispatcher."); } } }
java
public void registerPartition(ResultPartitionID partitionId) { checkNotNull(partitionId); synchronized (registeredHandlers) { LOG.debug("registering {}", partitionId); if (registeredHandlers.put(partitionId, new TaskEventHandler()) != null) { throw new IllegalStateException( "Partition " + partitionId + " already registered at task event dispatcher."); } } }
[ "public", "void", "registerPartition", "(", "ResultPartitionID", "partitionId", ")", "{", "checkNotNull", "(", "partitionId", ")", ";", "synchronized", "(", "registeredHandlers", ")", "{", "LOG", ".", "debug", "(", "\"registering {}\"", ",", "partitionId", ")", ";...
Registers the given partition for incoming task events allowing calls to {@link #subscribeToEvent(ResultPartitionID, EventListener, Class)}. @param partitionId the partition ID
[ "Registers", "the", "given", "partition", "for", "incoming", "task", "events", "allowing", "calls", "to", "{", "@link", "#subscribeToEvent", "(", "ResultPartitionID", "EventListener", "Class", ")", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/TaskEventDispatcher.java#L55-L65
train
Registers a new partition with the dispatcher.
[ 30522, 2270, 11675, 4236, 19362, 3775, 3508, 1006, 2765, 19362, 3775, 3508, 3593, 13571, 3593, 1007, 1063, 4638, 17048, 11231, 3363, 1006, 13571, 3593, 1007, 1025, 25549, 1006, 5068, 11774, 12910, 1007, 1063, 8833, 1012, 2139, 8569, 2290, 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-gelly/src/main/java/org/apache/flink/graph/types/valuearray/DoubleValueArray.java
DoubleValueArray.initialize
private void initialize(int bytes) { int capacity = bytes / ELEMENT_LENGTH_IN_BYTES; Preconditions.checkArgument(capacity > 0, "Requested array with zero capacity"); Preconditions.checkArgument(capacity <= MAX_ARRAY_SIZE, "Requested capacity exceeds limit of " + MAX_ARRAY_SIZE); data = new double[capacity]; }
java
private void initialize(int bytes) { int capacity = bytes / ELEMENT_LENGTH_IN_BYTES; Preconditions.checkArgument(capacity > 0, "Requested array with zero capacity"); Preconditions.checkArgument(capacity <= MAX_ARRAY_SIZE, "Requested capacity exceeds limit of " + MAX_ARRAY_SIZE); data = new double[capacity]; }
[ "private", "void", "initialize", "(", "int", "bytes", ")", "{", "int", "capacity", "=", "bytes", "/", "ELEMENT_LENGTH_IN_BYTES", ";", "Preconditions", ".", "checkArgument", "(", "capacity", ">", "0", ",", "\"Requested array with zero capacity\"", ")", ";", "Precon...
Initializes the array with the provided number of bytes. @param bytes initial size of the encapsulated array in bytes
[ "Initializes", "the", "array", "with", "the", "provided", "number", "of", "bytes", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/types/valuearray/DoubleValueArray.java#L86-L93
train
Initializes the array with the given number of bytes.
[ 30522, 2797, 11675, 3988, 4697, 1006, 20014, 27507, 1007, 1063, 20014, 3977, 1027, 27507, 1013, 5783, 1035, 3091, 1035, 1999, 1035, 27507, 1025, 3653, 8663, 20562, 2015, 1012, 4638, 2906, 22850, 4765, 1006, 3977, 1028, 1014, 1010, 1000, 730...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.sendHtml
public static void sendHtml(String to, String subject, String content, File... files) { send(to, subject, content, true, files); }
java
public static void sendHtml(String to, String subject, String content, File... files) { send(to, subject, content, true, files); }
[ "public", "static", "void", "sendHtml", "(", "String", "to", ",", "String", "subject", ",", "String", "content", ",", "File", "...", "files", ")", "{", "send", "(", "to", ",", "subject", ",", "content", ",", "true", ",", "files", ")", ";", "}" ]
使用配置文件中设置的账户发送HTML邮件,发送给单个或多个收件人<br> 多个收件人可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param to 收件人 @param subject 标题 @param content 正文 @param files 附件列表 @since 3.2.0
[ "使用配置文件中设置的账户发送HTML邮件,发送给单个或多个收件人<br", ">", "多个收件人可以使用逗号“", "”分隔,也可以通过分号“", ";", "”分隔" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L42-L44
train
Sends an HTML message to a recipient.
[ 30522, 2270, 10763, 11675, 4604, 11039, 19968, 1006, 5164, 2000, 1010, 5164, 3395, 1010, 5164, 4180, 1010, 5371, 1012, 1012, 1012, 6764, 1007, 1063, 4604, 1006, 2000, 1010, 3395, 1010, 4180, 1010, 2995, 1010, 6764, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java
InputGateMetrics.refreshAndGetAvg
float refreshAndGetAvg() { long total = 0; int count = 0; for (InputChannel channel : inputGate.getInputChannels().values()) { if (channel instanceof RemoteInputChannel) { RemoteInputChannel rc = (RemoteInputChannel) channel; int size = rc.unsynchronizedGetNumberOfQueuedBuffers(); total += size; ++count; } } return count == 0 ? 0 : total / (float) count; }
java
float refreshAndGetAvg() { long total = 0; int count = 0; for (InputChannel channel : inputGate.getInputChannels().values()) { if (channel instanceof RemoteInputChannel) { RemoteInputChannel rc = (RemoteInputChannel) channel; int size = rc.unsynchronizedGetNumberOfQueuedBuffers(); total += size; ++count; } } return count == 0 ? 0 : total / (float) count; }
[ "float", "refreshAndGetAvg", "(", ")", "{", "long", "total", "=", "0", ";", "int", "count", "=", "0", ";", "for", "(", "InputChannel", "channel", ":", "inputGate", ".", "getInputChannels", "(", ")", ".", "values", "(", ")", ")", "{", "if", "(", "chan...
Iterates over all input channels and collects the average number of queued buffers in a channel in a best-effort way. @return average number of queued buffers per channel
[ "Iterates", "over", "all", "input", "channels", "and", "collects", "the", "average", "number", "of", "queued", "buffers", "in", "a", "channel", "in", "a", "best", "-", "effort", "way", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputGateMetrics.java#L118-L133
train
This method is used to refresh the input gate and return the average number of queued buffers in the input gate.
[ 30522, 14257, 25416, 21898, 5685, 18150, 11431, 2290, 1006, 1007, 1063, 2146, 2561, 1027, 1014, 1025, 20014, 4175, 1027, 1014, 1025, 2005, 1006, 7953, 26058, 3149, 1024, 7953, 5867, 1012, 2131, 2378, 18780, 26058, 2015, 1006, 1007, 1012, 53...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.setAccessible
public static Method setAccessible(Method method) { if (null != method && false == method.isAccessible()) { method.setAccessible(true); } return method; }
java
public static Method setAccessible(Method method) { if (null != method && false == method.isAccessible()) { method.setAccessible(true); } return method; }
[ "public", "static", "Method", "setAccessible", "(", "Method", "method", ")", "{", "if", "(", "null", "!=", "method", "&&", "false", "==", "method", ".", "isAccessible", "(", ")", ")", "{", "method", ".", "setAccessible", "(", "true", ")", ";", "}", "re...
设置方法为可访问 @param method 方法 @return 方法
[ "设置方法为可访问" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L858-L863
train
Sets the accessible flag on the given method.
[ 30522, 2270, 10763, 4118, 2275, 6305, 9623, 19307, 1006, 4118, 4118, 1007, 1063, 2065, 1006, 19701, 999, 1027, 4118, 1004, 1004, 6270, 1027, 1027, 4118, 1012, 18061, 9468, 7971, 7028, 1006, 1007, 1007, 1063, 4118, 1012, 2275, 6305, 9623, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/util/MutableIOMetrics.java
MutableIOMetrics.addIOMetrics
public void addIOMetrics(AccessExecution attempt, @Nullable MetricFetcher fetcher, String jobID, String taskID) { if (attempt.getState().isTerminal()) { IOMetrics ioMetrics = attempt.getIOMetrics(); if (ioMetrics != null) { // execAttempt is already finished, use final metrics stored in ExecutionGraph this.numBytesIn += ioMetrics.getNumBytesIn(); this.numBytesOut += ioMetrics.getNumBytesOut(); this.numRecordsIn += ioMetrics.getNumRecordsIn(); this.numRecordsOut += ioMetrics.getNumRecordsOut(); } } else { // execAttempt is still running, use MetricQueryService instead if (fetcher != null) { fetcher.update(); MetricStore.ComponentMetricStore metrics = fetcher.getMetricStore() .getSubtaskMetricStore(jobID, taskID, attempt.getParallelSubtaskIndex()); if (metrics != null) { /** * We want to keep track of missing metrics to be able to make a difference between 0 as a value * and a missing value. * In case a metric is missing for a parallel instance of a task, we set the complete flag as * false. */ if (metrics.getMetric(MetricNames.IO_NUM_BYTES_IN) == null){ this.numBytesInComplete = false; } else { this.numBytesIn += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_BYTES_IN)); } if (metrics.getMetric(MetricNames.IO_NUM_BYTES_OUT) == null){ this.numBytesOutComplete = false; } else { this.numBytesOut += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_BYTES_OUT)); } if (metrics.getMetric(MetricNames.IO_NUM_RECORDS_IN) == null){ this.numRecordsInComplete = false; } else { this.numRecordsIn += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_RECORDS_IN)); } if (metrics.getMetric(MetricNames.IO_NUM_RECORDS_OUT) == null){ this.numRecordsOutComplete = false; } else { this.numRecordsOut += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_RECORDS_OUT)); } } else { this.numBytesInComplete = false; this.numBytesOutComplete = false; this.numRecordsInComplete = false; this.numRecordsOutComplete = false; } } } }
java
public void addIOMetrics(AccessExecution attempt, @Nullable MetricFetcher fetcher, String jobID, String taskID) { if (attempt.getState().isTerminal()) { IOMetrics ioMetrics = attempt.getIOMetrics(); if (ioMetrics != null) { // execAttempt is already finished, use final metrics stored in ExecutionGraph this.numBytesIn += ioMetrics.getNumBytesIn(); this.numBytesOut += ioMetrics.getNumBytesOut(); this.numRecordsIn += ioMetrics.getNumRecordsIn(); this.numRecordsOut += ioMetrics.getNumRecordsOut(); } } else { // execAttempt is still running, use MetricQueryService instead if (fetcher != null) { fetcher.update(); MetricStore.ComponentMetricStore metrics = fetcher.getMetricStore() .getSubtaskMetricStore(jobID, taskID, attempt.getParallelSubtaskIndex()); if (metrics != null) { /** * We want to keep track of missing metrics to be able to make a difference between 0 as a value * and a missing value. * In case a metric is missing for a parallel instance of a task, we set the complete flag as * false. */ if (metrics.getMetric(MetricNames.IO_NUM_BYTES_IN) == null){ this.numBytesInComplete = false; } else { this.numBytesIn += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_BYTES_IN)); } if (metrics.getMetric(MetricNames.IO_NUM_BYTES_OUT) == null){ this.numBytesOutComplete = false; } else { this.numBytesOut += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_BYTES_OUT)); } if (metrics.getMetric(MetricNames.IO_NUM_RECORDS_IN) == null){ this.numRecordsInComplete = false; } else { this.numRecordsIn += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_RECORDS_IN)); } if (metrics.getMetric(MetricNames.IO_NUM_RECORDS_OUT) == null){ this.numRecordsOutComplete = false; } else { this.numRecordsOut += Long.valueOf(metrics.getMetric(MetricNames.IO_NUM_RECORDS_OUT)); } } else { this.numBytesInComplete = false; this.numBytesOutComplete = false; this.numRecordsInComplete = false; this.numRecordsOutComplete = false; } } } }
[ "public", "void", "addIOMetrics", "(", "AccessExecution", "attempt", ",", "@", "Nullable", "MetricFetcher", "fetcher", ",", "String", "jobID", ",", "String", "taskID", ")", "{", "if", "(", "attempt", ".", "getState", "(", ")", ".", "isTerminal", "(", ")", ...
Adds the IO metrics for the given attempt to this object. If the {@link AccessExecution} is in a terminal state the contained {@link IOMetrics} object is added. Otherwise the given {@link MetricFetcher} is used to retrieve the required metrics. @param attempt Attempt whose IO metrics should be added @param fetcher MetricFetcher to retrieve metrics for running jobs @param jobID JobID to which the attempt belongs @param taskID TaskID to which the attempt belongs
[ "Adds", "the", "IO", "metrics", "for", "the", "given", "attempt", "to", "this", "object", ".", "If", "the", "{", "@link", "AccessExecution", "}", "is", "in", "a", "terminal", "state", "the", "contained", "{", "@link", "IOMetrics", "}", "object", "is", "a...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/MutableIOMetrics.java#L78-L135
train
Add IO metrics to the execution graph.
[ 30522, 2270, 11675, 5587, 18994, 3388, 30524, 1012, 4152, 12259, 1006, 1007, 1012, 21541, 2121, 22311, 2140, 1006, 1007, 1007, 1063, 22834, 12589, 2015, 22834, 12589, 2015, 1027, 3535, 1012, 2131, 18994, 3388, 7277, 2015, 1006, 1007, 1025, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/operators/TwoInputUdfOperator.java
TwoInputUdfOperator.returns
public O returns(Class<OUT> typeClass) { requireNonNull(typeClass, "type class must not be null"); try { return returns(TypeInformation.of(typeClass)); } catch (InvalidTypesException e) { throw new InvalidTypesException("Cannot infer the type information from the class alone." + "This is most likely because the class represents a generic type. In that case," + "please use the 'returns(TypeHint)' method instead.", e); } }
java
public O returns(Class<OUT> typeClass) { requireNonNull(typeClass, "type class must not be null"); try { return returns(TypeInformation.of(typeClass)); } catch (InvalidTypesException e) { throw new InvalidTypesException("Cannot infer the type information from the class alone." + "This is most likely because the class represents a generic type. In that case," + "please use the 'returns(TypeHint)' method instead.", e); } }
[ "public", "O", "returns", "(", "Class", "<", "OUT", ">", "typeClass", ")", "{", "requireNonNull", "(", "typeClass", ",", "\"type class must not be null\"", ")", ";", "try", "{", "return", "returns", "(", "TypeInformation", ".", "of", "(", "typeClass", ")", "...
Adds a type information hint about the return type of this operator. This method can be used in cases where Flink cannot determine automatically what the produced type of a function is. That can be the case if the function uses generic type variables in the return type that cannot be inferred from the input type. <p>Classes can be used as type hints for non-generic types (classes without generic parameters), but not for generic types like for example Tuples. For those generic types, please use the {@link #returns(TypeHint)} method. <p>Use this method the following way: <pre>{@code DataSet<String[]> result = data1.join(data2).where("id").equalTo("fieldX") .with(new JoinFunctionWithNonInferrableReturnType()) .returns(String[].class); }</pre> @param typeClass The class of the returned data type. @return This operator with the type information corresponding to the given type class.
[ "Adds", "a", "type", "information", "hint", "about", "the", "return", "type", "of", "this", "operator", ".", "This", "method", "can", "be", "used", "in", "cases", "where", "Flink", "cannot", "determine", "automatically", "what", "the", "produced", "type", "o...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/operators/TwoInputUdfOperator.java#L267-L278
train
Returns the object of the given type class.
[ 30522, 2270, 1051, 5651, 1006, 2465, 1026, 2041, 1028, 2828, 26266, 1007, 1063, 5478, 8540, 11231, 3363, 1006, 2828, 26266, 1010, 1000, 2828, 2465, 2442, 2025, 2022, 19701, 1000, 1007, 1025, 3046, 1063, 2709, 5651, 1006, 2828, 2378, 14192, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/ConfigurationParserUtils.java
ConfigurationParserUtils.getMemoryType
public static MemoryType getMemoryType(Configuration configuration) { // check whether we use heap or off-heap memory final MemoryType memType; if (configuration.getBoolean(TaskManagerOptions.MEMORY_OFF_HEAP)) { memType = MemoryType.OFF_HEAP; } else { memType = MemoryType.HEAP; } return memType; }
java
public static MemoryType getMemoryType(Configuration configuration) { // check whether we use heap or off-heap memory final MemoryType memType; if (configuration.getBoolean(TaskManagerOptions.MEMORY_OFF_HEAP)) { memType = MemoryType.OFF_HEAP; } else { memType = MemoryType.HEAP; } return memType; }
[ "public", "static", "MemoryType", "getMemoryType", "(", "Configuration", "configuration", ")", "{", "// check whether we use heap or off-heap memory", "final", "MemoryType", "memType", ";", "if", "(", "configuration", ".", "getBoolean", "(", "TaskManagerOptions", ".", "ME...
Parses the configuration to get the type of memory. @param configuration configuration object @return type of memory
[ "Parses", "the", "configuration", "to", "get", "the", "type", "of", "memory", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ConfigurationParserUtils.java#L86-L95
train
Get the memory type from the configuration.
[ 30522, 2270, 10763, 3638, 13874, 2131, 4168, 5302, 2854, 13874, 1006, 9563, 9563, 1007, 1063, 1013, 1013, 4638, 3251, 2057, 2224, 16721, 2030, 2125, 1011, 16721, 3638, 2345, 3638, 13874, 2033, 20492, 18863, 1025, 2065, 1006, 9563, 1012, 213...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.insertOrUpdate
public int insertOrUpdate(Connection conn, Entity record, String... keys) throws SQLException { final Entity where = record.filter(keys); if(MapUtil.isNotEmpty(where) && count(conn, where) > 0) { return update(conn, record, where); }else { return insert(conn, record); } }
java
public int insertOrUpdate(Connection conn, Entity record, String... keys) throws SQLException { final Entity where = record.filter(keys); if(MapUtil.isNotEmpty(where) && count(conn, where) > 0) { return update(conn, record, where); }else { return insert(conn, record); } }
[ "public", "int", "insertOrUpdate", "(", "Connection", "conn", ",", "Entity", "record", ",", "String", "...", "keys", ")", "throws", "SQLException", "{", "final", "Entity", "where", "=", "record", ".", "filter", "(", "keys", ")", ";", "if", "(", "MapUtil", ...
插入数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param record 记录 @param keys 需要检查唯一性的字段 @return 插入行数 @throws SQLException SQL执行异常
[ "插入数据<br", ">", "此方法不会关闭Connection" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L121-L128
train
Insert or update an entity in the database or return an error code.
[ 30522, 2270, 20014, 19274, 2953, 6279, 13701, 1006, 4434, 9530, 2078, 1010, 9178, 2501, 1010, 5164, 1012, 1012, 1012, 6309, 1007, 11618, 29296, 10288, 24422, 1063, 2345, 9178, 2073, 1027, 2501, 1012, 11307, 1006, 6309, 1007, 1025, 2065, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.pressImage
public static void pressImage(Image srcImage, ImageOutputStream destImageStream, Image pressImg, int x, int y, float alpha) throws IORuntimeException { writeJpg(pressImage(srcImage, pressImg, x, y, alpha), destImageStream); }
java
public static void pressImage(Image srcImage, ImageOutputStream destImageStream, Image pressImg, int x, int y, float alpha) throws IORuntimeException { writeJpg(pressImage(srcImage, pressImg, x, y, alpha), destImageStream); }
[ "public", "static", "void", "pressImage", "(", "Image", "srcImage", ",", "ImageOutputStream", "destImageStream", ",", "Image", "pressImg", ",", "int", "x", ",", "int", "y", ",", "float", "alpha", ")", "throws", "IORuntimeException", "{", "writeJpg", "(", "pres...
给图片添加图片水印<br> 此方法并不关闭流 @param srcImage 源图像流 @param destImageStream 目标图像流 @param pressImg 水印图片,可以使用{@link ImageIO#read(File)}方法读取文件 @param x 修正值。 默认在中间,偏移量相对于中间偏移 @param y 修正值。 默认在中间,偏移量相对于中间偏移 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @throws IORuntimeException IO异常
[ "给图片添加图片水印<br", ">", "此方法并不关闭流" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L957-L959
train
Press image to the destination image stream.
[ 30522, 2270, 10763, 11675, 2811, 9581, 3351, 1006, 3746, 5034, 6895, 26860, 1010, 3746, 5833, 18780, 21422, 4078, 3775, 26860, 21422, 1010, 3746, 2811, 5714, 2290, 1010, 20014, 1060, 1010, 20014, 1061, 1010, 14257, 6541, 1007, 11618, 22834, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java
PredicateUtils.findTableName
public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) { if (!(sqlStatement instanceof SelectStatement)) { return Optional.of(sqlStatement.getTables().getSingleTableName()); } SelectStatement currentSelectStatement = (SelectStatement) sqlStatement; while (null != currentSelectStatement.getParentStatement()) { currentSelectStatement = currentSelectStatement.getParentStatement(); Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData); if (tableName.isPresent()) { return tableName; } } return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData); }
java
public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) { if (!(sqlStatement instanceof SelectStatement)) { return Optional.of(sqlStatement.getTables().getSingleTableName()); } SelectStatement currentSelectStatement = (SelectStatement) sqlStatement; while (null != currentSelectStatement.getParentStatement()) { currentSelectStatement = currentSelectStatement.getParentStatement(); Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData); if (tableName.isPresent()) { return tableName; } } return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData); }
[ "public", "static", "Optional", "<", "String", ">", "findTableName", "(", "final", "PredicateSegment", "predicateSegment", ",", "final", "SQLStatement", "sqlStatement", ",", "final", "ShardingTableMetaData", "shardingTableMetaData", ")", "{", "if", "(", "!", "(", "s...
TODO hongjun: find table from parent select statement, should find table in subquery level only
[ "TODO", "hongjun", ":", "find", "table", "from", "parent", "select", "statement", "should", "find", "table", "in", "subquery", "level", "only" ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dml/PredicateUtils.java#L58-L71
train
Find table name.
[ 30522, 2270, 10763, 11887, 1026, 5164, 1028, 2424, 10880, 18442, 1006, 2345, 3653, 16467, 3366, 21693, 4765, 3653, 16467, 3366, 21693, 4765, 1010, 2345, 29296, 9153, 18532, 4765, 29296, 9153, 18532, 4765, 1010, 2345, 21146, 17080, 3070, 10880...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
ConditionMessage.of
public static ConditionMessage of(String message, Object... args) { if (ObjectUtils.isEmpty(args)) { return new ConditionMessage(message); } return new ConditionMessage(String.format(message, args)); }
java
public static ConditionMessage of(String message, Object... args) { if (ObjectUtils.isEmpty(args)) { return new ConditionMessage(message); } return new ConditionMessage(String.format(message, args)); }
[ "public", "static", "ConditionMessage", "of", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "if", "(", "ObjectUtils", ".", "isEmpty", "(", "args", ")", ")", "{", "return", "new", "ConditionMessage", "(", "message", ")", ";", "}", "ret...
Factory method to create a new {@link ConditionMessage} with a specific message. @param message the source message (may be a format string if {@code args} are specified) @param args format arguments for the message @return a new {@link ConditionMessage} instance
[ "Factory", "method", "to", "create", "a", "new", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java#L148-L153
train
Create a new condition message with the given message and arguments.
[ 30522, 2270, 10763, 4650, 7834, 3736, 3351, 1997, 1006, 5164, 4471, 1010, 4874, 1012, 1012, 1012, 12098, 5620, 1007, 1063, 2065, 1006, 4874, 21823, 4877, 1012, 2003, 6633, 13876, 2100, 1006, 12098, 5620, 1007, 1007, 1063, 2709, 2047, 4650, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AbstractDb.java
AbstractDb.executeBatch
public int[] executeBatch(String sql, Object[]... paramsBatch) throws SQLException { Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.executeBatch(conn, sql, paramsBatch); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
java
public int[] executeBatch(String sql, Object[]... paramsBatch) throws SQLException { Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.executeBatch(conn, sql, paramsBatch); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
[ "public", "int", "[", "]", "executeBatch", "(", "String", "sql", ",", "Object", "[", "]", "...", "paramsBatch", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "this", ".", "getConnection", "(", ")", ...
批量执行非查询语句 @param sql SQL @param paramsBatch 批量的参数 @return 每个SQL执行影响的行数 @throws SQLException SQL执行异常
[ "批量执行非查询语句" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L206-L216
train
Executes a SQL statement with a batch of parameters.
[ 30522, 2270, 20014, 1031, 1033, 15389, 14479, 2818, 1006, 5164, 29296, 1010, 4874, 1031, 1033, 1012, 1012, 1012, 11498, 5244, 14479, 2818, 1007, 11618, 29296, 10288, 24422, 1063, 4434, 9530, 2078, 1027, 19701, 1025, 3046, 1063, 9530, 2078, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.isBetween
public static boolean isBetween(Number value, Number min, Number max) { Assert.notNull(value); Assert.notNull(min); Assert.notNull(max); final double doubleValue = value.doubleValue(); return (doubleValue >= min.doubleValue()) && (doubleValue <= max.doubleValue()); }
java
public static boolean isBetween(Number value, Number min, Number max) { Assert.notNull(value); Assert.notNull(min); Assert.notNull(max); final double doubleValue = value.doubleValue(); return (doubleValue >= min.doubleValue()) && (doubleValue <= max.doubleValue()); }
[ "public", "static", "boolean", "isBetween", "(", "Number", "value", ",", "Number", "min", ",", "Number", "max", ")", "{", "Assert", ".", "notNull", "(", "value", ")", ";", "Assert", ".", "notNull", "(", "min", ")", ";", "Assert", ".", "notNull", "(", ...
检查给定的数字是否在指定范围内 @param value 值 @param min 最小值(包含) @param max 最大值(包含) @return 是否满足 @since 4.1.10
[ "检查给定的数字是否在指定范围内" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1046-L1052
train
Checks if the given value is between the given min and max numbers.
[ 30522, 2270, 10763, 22017, 20898, 2003, 20915, 28394, 2078, 1006, 2193, 3643, 1010, 2193, 8117, 1010, 2193, 4098, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 3643, 1007, 1025, 20865, 1012, 2025, 11231, 3363, 1006, 30524, 10175, 5657, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.round
public static BigDecimal round(String numberStr, int scale, RoundingMode roundingMode) { Assert.notBlank(numberStr); if (scale < 0) { scale = 0; } return round(toBigDecimal(numberStr), scale, roundingMode); }
java
public static BigDecimal round(String numberStr, int scale, RoundingMode roundingMode) { Assert.notBlank(numberStr); if (scale < 0) { scale = 0; } return round(toBigDecimal(numberStr), scale, roundingMode); }
[ "public", "static", "BigDecimal", "round", "(", "String", "numberStr", ",", "int", "scale", ",", "RoundingMode", "roundingMode", ")", "{", "Assert", ".", "notBlank", "(", "numberStr", ")", ";", "if", "(", "scale", "<", "0", ")", "{", "scale", "=", "0", ...
保留固定位数小数<br> 例如保留四位小数:123.456789 =》 123.4567 @param numberStr 数字值的字符串表现形式 @param scale 保留小数位数,如果传入小于0,则默认0 @param roundingMode 保留小数的模式 {@link RoundingMode},如果传入null则默认四舍五入 @return 新值
[ "保留固定位数小数<br", ">", "例如保留四位小数:123", ".", "456789", "=", "》", "123", ".", "4567" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L856-L862
train
Round to the specified scale.
[ 30522, 2270, 10763, 2502, 3207, 6895, 9067, 2461, 1006, 5164, 3616, 16344, 1010, 20014, 4094, 1010, 26939, 5302, 3207, 26939, 5302, 3207, 1007, 1063, 20865, 1012, 2025, 28522, 8950, 1006, 3616, 16344, 1007, 1025, 2065, 1006, 4094, 1026, 101...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java
EnumUtil.fromString
public static <T extends Enum<T>> T fromString(Class<T> enumClass, String value) { return Enum.valueOf(enumClass, value); }
java
public static <T extends Enum<T>> T fromString(Class<T> enumClass, String value) { return Enum.valueOf(enumClass, value); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "fromString", "(", "Class", "<", "T", ">", "enumClass", ",", "String", "value", ")", "{", "return", "Enum", ".", "valueOf", "(", "enumClass", ",", "value", ")", ";", "}" ]
字符串转枚举,调用{@link Enum#valueOf(Class, String)} @param <T> 枚举类型泛型 @param enumClass 枚举类 @param value 值 @return 枚举值 @since 4.1.13
[ "字符串转枚举,调用", "{", "@link", "Enum#valueOf", "(", "Class", "String", ")", "}" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/EnumUtil.java#L62-L64
train
Creates an enum value from a string.
[ 30522, 2270, 10763, 1026, 1056, 8908, 4372, 2819, 1026, 1056, 1028, 1028, 1056, 2013, 3367, 4892, 1006, 2465, 1026, 1056, 1028, 4372, 2819, 26266, 1010, 5164, 3643, 1007, 1063, 2709, 4372, 2819, 1012, 3643, 11253, 1006, 4372, 2819, 26266, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java
SensitiveUtil.getFindedAllSensitive
public static List<String> getFindedAllSensitive(Object bean, boolean isDensityMatch, boolean isGreedMatch){ return getFindedAllSensitive(JSONUtil.toJsonStr(bean), isDensityMatch, isGreedMatch); }
java
public static List<String> getFindedAllSensitive(Object bean, boolean isDensityMatch, boolean isGreedMatch){ return getFindedAllSensitive(JSONUtil.toJsonStr(bean), isDensityMatch, isGreedMatch); }
[ "public", "static", "List", "<", "String", ">", "getFindedAllSensitive", "(", "Object", "bean", ",", "boolean", "isDensityMatch", ",", "boolean", "isGreedMatch", ")", "{", "return", "getFindedAllSensitive", "(", "JSONUtil", ".", "toJsonStr", "(", "bean", ")", ",...
查找敏感词,返回找到的所有敏感词<br> 密集匹配原则:假如关键词有 ab,b,文本是abab,将匹配 [ab,b,ab]<br> 贪婪匹配(最长匹配)原则:假如关键字a,ab,最长匹配将匹配[a, ab] @param bean 对象,会被转为JSON @param isDensityMatch 是否使用密集匹配原则 @param isGreedMatch 是否使用贪婪匹配(最长匹配)原则 @return 敏感词
[ "查找敏感词,返回找到的所有敏感词<br", ">", "密集匹配原则:假如关键词有", "ab", "b,文本是abab,将匹配", "[", "ab", "b", "ab", "]", "<br", ">", "贪婪匹配(最长匹配)原则:假如关键字a", "ab,最长匹配将匹配", "[", "a", "ab", "]" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-dfa/src/main/java/cn/hutool/dfa/SensitiveUtil.java#L158-L160
train
Gets the matched all sensitive strings of the given object.
[ 30522, 2270, 10763, 2862, 1026, 5164, 1028, 2131, 16294, 5732, 8095, 5054, 28032, 3512, 1006, 4874, 14068, 1010, 22017, 20898, 2003, 4181, 17759, 18900, 2818, 1010, 22017, 20898, 2003, 28637, 22117, 4017, 2818, 1007, 1063, 2709, 2131, 16294, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/filecache/FileCache.java
FileCache.shutdown
public void shutdown() { synchronized (lock) { // first shutdown the thread pool ScheduledExecutorService es = this.executorService; if (es != null) { es.shutdown(); try { es.awaitTermination(cleanupInterval, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // may happen } } entries.clear(); jobRefHolders.clear(); // clean up the all storage directories for (File dir : storageDirectories) { try { FileUtils.deleteDirectory(dir); LOG.info("removed file cache directory {}", dir.getAbsolutePath()); } catch (IOException e) { LOG.error("File cache could not properly clean up storage directory: {}", dir.getAbsolutePath(), e); } } // Remove shutdown hook to prevent resource leaks ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG); } }
java
public void shutdown() { synchronized (lock) { // first shutdown the thread pool ScheduledExecutorService es = this.executorService; if (es != null) { es.shutdown(); try { es.awaitTermination(cleanupInterval, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // may happen } } entries.clear(); jobRefHolders.clear(); // clean up the all storage directories for (File dir : storageDirectories) { try { FileUtils.deleteDirectory(dir); LOG.info("removed file cache directory {}", dir.getAbsolutePath()); } catch (IOException e) { LOG.error("File cache could not properly clean up storage directory: {}", dir.getAbsolutePath(), e); } } // Remove shutdown hook to prevent resource leaks ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG); } }
[ "public", "void", "shutdown", "(", ")", "{", "synchronized", "(", "lock", ")", "{", "// first shutdown the thread pool", "ScheduledExecutorService", "es", "=", "this", ".", "executorService", ";", "if", "(", "es", "!=", "null", ")", "{", "es", ".", "shutdown",...
Shuts down the file cache by cancelling all.
[ "Shuts", "down", "the", "file", "cache", "by", "cancelling", "all", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/filecache/FileCache.java#L132-L163
train
Shutdown the cache.
[ 30522, 2270, 11675, 3844, 7698, 1006, 1007, 1063, 25549, 1006, 5843, 1007, 1063, 1013, 1013, 2034, 3844, 7698, 1996, 11689, 4770, 5115, 10288, 8586, 16161, 22573, 2099, 7903, 2063, 9686, 1027, 2023, 1012, 4654, 8586, 16161, 22573, 2099, 790...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/operators/InternalTimerServiceImpl.java
InternalTimerServiceImpl.restoreTimersForKeyGroup
@SuppressWarnings("unchecked") public void restoreTimersForKeyGroup(InternalTimersSnapshot<?, ?> restoredSnapshot, int keyGroupIdx) { this.restoredTimersSnapshot = (InternalTimersSnapshot<K, N>) restoredSnapshot; TypeSerializer<K> restoredKeySerializer = restoredTimersSnapshot.getKeySerializerSnapshot().restoreSerializer(); if (this.keyDeserializer != null && !this.keyDeserializer.equals(restoredKeySerializer)) { throw new IllegalArgumentException("Tried to restore timers for the same service with different key serializers."); } this.keyDeserializer = restoredKeySerializer; TypeSerializer<N> restoredNamespaceSerializer = restoredTimersSnapshot.getNamespaceSerializerSnapshot().restoreSerializer(); if (this.namespaceDeserializer != null && !this.namespaceDeserializer.equals(restoredNamespaceSerializer)) { throw new IllegalArgumentException("Tried to restore timers for the same service with different namespace serializers."); } this.namespaceDeserializer = restoredNamespaceSerializer; checkArgument(localKeyGroupRange.contains(keyGroupIdx), "Key Group " + keyGroupIdx + " does not belong to the local range."); // restore the event time timers eventTimeTimersQueue.addAll(restoredTimersSnapshot.getEventTimeTimers()); // restore the processing time timers processingTimeTimersQueue.addAll(restoredTimersSnapshot.getProcessingTimeTimers()); }
java
@SuppressWarnings("unchecked") public void restoreTimersForKeyGroup(InternalTimersSnapshot<?, ?> restoredSnapshot, int keyGroupIdx) { this.restoredTimersSnapshot = (InternalTimersSnapshot<K, N>) restoredSnapshot; TypeSerializer<K> restoredKeySerializer = restoredTimersSnapshot.getKeySerializerSnapshot().restoreSerializer(); if (this.keyDeserializer != null && !this.keyDeserializer.equals(restoredKeySerializer)) { throw new IllegalArgumentException("Tried to restore timers for the same service with different key serializers."); } this.keyDeserializer = restoredKeySerializer; TypeSerializer<N> restoredNamespaceSerializer = restoredTimersSnapshot.getNamespaceSerializerSnapshot().restoreSerializer(); if (this.namespaceDeserializer != null && !this.namespaceDeserializer.equals(restoredNamespaceSerializer)) { throw new IllegalArgumentException("Tried to restore timers for the same service with different namespace serializers."); } this.namespaceDeserializer = restoredNamespaceSerializer; checkArgument(localKeyGroupRange.contains(keyGroupIdx), "Key Group " + keyGroupIdx + " does not belong to the local range."); // restore the event time timers eventTimeTimersQueue.addAll(restoredTimersSnapshot.getEventTimeTimers()); // restore the processing time timers processingTimeTimersQueue.addAll(restoredTimersSnapshot.getProcessingTimeTimers()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "restoreTimersForKeyGroup", "(", "InternalTimersSnapshot", "<", "?", ",", "?", ">", "restoredSnapshot", ",", "int", "keyGroupIdx", ")", "{", "this", ".", "restoredTimersSnapshot", "=", "(", "Int...
Restore the timers (both processing and event time ones) for a given {@code keyGroupIdx}. @param restoredSnapshot the restored snapshot containing the key-group's timers, and the serializers that were used to write them @param keyGroupIdx the id of the key-group to be put in the snapshot.
[ "Restore", "the", "timers", "(", "both", "processing", "and", "event", "time", "ones", ")", "for", "a", "given", "{", "@code", "keyGroupIdx", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerServiceImpl.java#L288-L312
train
Restores the timers for the given key group.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 11675, 9239, 7292, 2869, 29278, 14839, 17058, 1006, 4722, 7292, 2869, 2015, 2532, 4523, 12326, 1026, 1029, 1010, 1029, 1028, 5854, 2015, 2532, 4523, 1232...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java
TaskSchedulerBuilder.threadNamePrefix
public TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix) { return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod, threadNamePrefix, this.customizers); }
java
public TaskSchedulerBuilder threadNamePrefix(String threadNamePrefix) { return new TaskSchedulerBuilder(this.poolSize, this.awaitTermination, this.awaitTerminationPeriod, threadNamePrefix, this.customizers); }
[ "public", "TaskSchedulerBuilder", "threadNamePrefix", "(", "String", "threadNamePrefix", ")", "{", "return", "new", "TaskSchedulerBuilder", "(", "this", ".", "poolSize", ",", "this", ".", "awaitTermination", ",", "this", ".", "awaitTerminationPeriod", ",", "threadName...
Set the prefix to use for the names of newly created threads. @param threadNamePrefix the thread name prefix to set @return a new builder instance
[ "Set", "the", "prefix", "to", "use", "for", "the", "names", "of", "newly", "created", "threads", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskSchedulerBuilder.java#L114-L117
train
Returns a new TaskSchedulerBuilder with the specified thread name prefix.
[ 30522, 2270, 8518, 7690, 9307, 15185, 19231, 4063, 11689, 18442, 28139, 8873, 2595, 1006, 5164, 11689, 18442, 28139, 8873, 2595, 1007, 1063, 2709, 2047, 8518, 7690, 9307, 15185, 19231, 4063, 1006, 2023, 1012, 12679, 4697, 1010, 2023, 1012, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java
RestTemplateBuilder.additionalMessageConverters
public RestTemplateBuilder additionalMessageConverters( HttpMessageConverter<?>... messageConverters) { Assert.notNull(messageConverters, "MessageConverters must not be null"); return additionalMessageConverters(Arrays.asList(messageConverters)); }
java
public RestTemplateBuilder additionalMessageConverters( HttpMessageConverter<?>... messageConverters) { Assert.notNull(messageConverters, "MessageConverters must not be null"); return additionalMessageConverters(Arrays.asList(messageConverters)); }
[ "public", "RestTemplateBuilder", "additionalMessageConverters", "(", "HttpMessageConverter", "<", "?", ">", "...", "messageConverters", ")", "{", "Assert", ".", "notNull", "(", "messageConverters", ",", "\"MessageConverters must not be null\"", ")", ";", "return", "additi...
Add additional {@link HttpMessageConverter HttpMessageConverters} that should be used with the {@link RestTemplate}. Any converters configured on the builder will replace RestTemplate's default converters. @param messageConverters the converters to add @return a new builder instance @see #messageConverters(HttpMessageConverter...)
[ "Add", "additional", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java#L197-L201
train
Add additional message converters to the rest template.
[ 30522, 2270, 2717, 18532, 15725, 8569, 23891, 2099, 3176, 7834, 3736, 3351, 8663, 16874, 2545, 1006, 8299, 7834, 3736, 3351, 8663, 16874, 2121, 1026, 1029, 1028, 1012, 1012, 1012, 4471, 8663, 16874, 2545, 1007, 1063, 20865, 1012, 2025, 1123...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java
Utils.obtainTokenForHBase
private static void obtainTokenForHBase(Credentials credentials, Configuration conf) throws IOException { if (UserGroupInformation.isSecurityEnabled()) { LOG.info("Attempting to obtain Kerberos security token for HBase"); try { // ---- // Intended call: HBaseConfiguration.addHbaseResources(conf); Class .forName("org.apache.hadoop.hbase.HBaseConfiguration") .getMethod("addHbaseResources", Configuration.class) .invoke(null, conf); // ---- LOG.info("HBase security setting: {}", conf.get("hbase.security.authentication")); if (!"kerberos".equals(conf.get("hbase.security.authentication"))) { LOG.info("HBase has not been configured to use Kerberos."); return; } LOG.info("Obtaining Kerberos security token for HBase"); // ---- // Intended call: Token<AuthenticationTokenIdentifier> token = TokenUtil.obtainToken(conf); Token<?> token = (Token<?>) Class .forName("org.apache.hadoop.hbase.security.token.TokenUtil") .getMethod("obtainToken", Configuration.class) .invoke(null, conf); // ---- if (token == null) { LOG.error("No Kerberos security token for HBase available"); return; } credentials.addToken(token.getService(), token); LOG.info("Added HBase Kerberos security token to credentials."); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { LOG.info("HBase is not available (not packaged with this application): {} : \"{}\".", e.getClass().getSimpleName(), e.getMessage()); } } }
java
private static void obtainTokenForHBase(Credentials credentials, Configuration conf) throws IOException { if (UserGroupInformation.isSecurityEnabled()) { LOG.info("Attempting to obtain Kerberos security token for HBase"); try { // ---- // Intended call: HBaseConfiguration.addHbaseResources(conf); Class .forName("org.apache.hadoop.hbase.HBaseConfiguration") .getMethod("addHbaseResources", Configuration.class) .invoke(null, conf); // ---- LOG.info("HBase security setting: {}", conf.get("hbase.security.authentication")); if (!"kerberos".equals(conf.get("hbase.security.authentication"))) { LOG.info("HBase has not been configured to use Kerberos."); return; } LOG.info("Obtaining Kerberos security token for HBase"); // ---- // Intended call: Token<AuthenticationTokenIdentifier> token = TokenUtil.obtainToken(conf); Token<?> token = (Token<?>) Class .forName("org.apache.hadoop.hbase.security.token.TokenUtil") .getMethod("obtainToken", Configuration.class) .invoke(null, conf); // ---- if (token == null) { LOG.error("No Kerberos security token for HBase available"); return; } credentials.addToken(token.getService(), token); LOG.info("Added HBase Kerberos security token to credentials."); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { LOG.info("HBase is not available (not packaged with this application): {} : \"{}\".", e.getClass().getSimpleName(), e.getMessage()); } } }
[ "private", "static", "void", "obtainTokenForHBase", "(", "Credentials", "credentials", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "if", "(", "UserGroupInformation", ".", "isSecurityEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "\"A...
Obtain Kerberos security token for HBase.
[ "Obtain", "Kerberos", "security", "token", "for", "HBase", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-yarn/src/main/java/org/apache/flink/yarn/Utils.java#L262-L305
train
Obtain the Kerberos security token for HBase.
[ 30522, 2797, 10763, 11675, 6855, 18715, 2368, 29278, 2232, 15058, 1006, 22496, 22496, 1010, 9563, 9530, 2546, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 5310, 17058, 2378, 14192, 3370, 1012, 26354, 8586, 25137, 8189, 23242, 1006, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java
AbstractLexicalAnalyzer.combineWithCustomDictionary
protected static List<CoreDictionary.Attribute> combineWithCustomDictionary(List<String> vertexList) { String[] wordNet = new String[vertexList.size()]; vertexList.toArray(wordNet); CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[wordNet.length]; // DAT合并 DoubleArrayTrie<CoreDictionary.Attribute> dat = CustomDictionary.dat; int length = wordNet.length; for (int i = 0; i < length; ++i) { int state = 1; state = dat.transition(wordNet[i], state); if (state > 0) { int to = i + 1; int end = to; CoreDictionary.Attribute value = dat.output(state); for (; to < length; ++to) { state = dat.transition(wordNet[to], state); if (state < 0) break; CoreDictionary.Attribute output = dat.output(state); if (output != null) { value = output; end = to + 1; } } if (value != null) { combineWords(wordNet, i, end, attributeArray, value); i = end - 1; } } } // BinTrie合并 if (CustomDictionary.trie != null) { for (int i = 0; i < length; ++i) { if (wordNet[i] == null) continue; BaseNode<CoreDictionary.Attribute> state = CustomDictionary.trie.transition(wordNet[i], 0); if (state != null) { int to = i + 1; int end = to; CoreDictionary.Attribute value = state.getValue(); for (; to < length; ++to) { if (wordNet[to] == null) continue; state = state.transition(wordNet[to], 0); if (state == null) break; if (state.getValue() != null) { value = state.getValue(); end = to + 1; } } if (value != null) { combineWords(wordNet, i, end, attributeArray, value); i = end - 1; } } } } vertexList.clear(); List<CoreDictionary.Attribute> attributeList = new LinkedList<CoreDictionary.Attribute>(); for (int i = 0; i < wordNet.length; i++) { if (wordNet[i] != null) { vertexList.add(wordNet[i]); attributeList.add(attributeArray[i]); } } return attributeList; }
java
protected static List<CoreDictionary.Attribute> combineWithCustomDictionary(List<String> vertexList) { String[] wordNet = new String[vertexList.size()]; vertexList.toArray(wordNet); CoreDictionary.Attribute[] attributeArray = new CoreDictionary.Attribute[wordNet.length]; // DAT合并 DoubleArrayTrie<CoreDictionary.Attribute> dat = CustomDictionary.dat; int length = wordNet.length; for (int i = 0; i < length; ++i) { int state = 1; state = dat.transition(wordNet[i], state); if (state > 0) { int to = i + 1; int end = to; CoreDictionary.Attribute value = dat.output(state); for (; to < length; ++to) { state = dat.transition(wordNet[to], state); if (state < 0) break; CoreDictionary.Attribute output = dat.output(state); if (output != null) { value = output; end = to + 1; } } if (value != null) { combineWords(wordNet, i, end, attributeArray, value); i = end - 1; } } } // BinTrie合并 if (CustomDictionary.trie != null) { for (int i = 0; i < length; ++i) { if (wordNet[i] == null) continue; BaseNode<CoreDictionary.Attribute> state = CustomDictionary.trie.transition(wordNet[i], 0); if (state != null) { int to = i + 1; int end = to; CoreDictionary.Attribute value = state.getValue(); for (; to < length; ++to) { if (wordNet[to] == null) continue; state = state.transition(wordNet[to], 0); if (state == null) break; if (state.getValue() != null) { value = state.getValue(); end = to + 1; } } if (value != null) { combineWords(wordNet, i, end, attributeArray, value); i = end - 1; } } } } vertexList.clear(); List<CoreDictionary.Attribute> attributeList = new LinkedList<CoreDictionary.Attribute>(); for (int i = 0; i < wordNet.length; i++) { if (wordNet[i] != null) { vertexList.add(wordNet[i]); attributeList.add(attributeArray[i]); } } return attributeList; }
[ "protected", "static", "List", "<", "CoreDictionary", ".", "Attribute", ">", "combineWithCustomDictionary", "(", "List", "<", "String", ">", "vertexList", ")", "{", "String", "[", "]", "wordNet", "=", "new", "String", "[", "vertexList", ".", "size", "(", ")"...
使用用户词典合并粗分结果 @param vertexList 粗分结果 @return 合并后的结果
[ "使用用户词典合并粗分结果" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L623-L700
train
Combine with custom dictionary.
[ 30522, 5123, 10763, 2862, 1026, 4563, 29201, 3258, 5649, 1012, 17961, 1028, 11506, 24415, 7874, 20389, 29201, 3258, 5649, 1006, 2862, 1026, 5164, 1028, 19449, 9863, 1007, 1063, 5164, 1031, 1033, 2773, 7159, 1027, 2047, 5164, 1031, 19449, 98...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.scanPackageBySuper
public static Set<Class<?>> scanPackageBySuper(String packageName, final Class<?> superClass) { return ClassScaner.scanPackageBySuper(packageName, superClass); }
java
public static Set<Class<?>> scanPackageBySuper(String packageName, final Class<?> superClass) { return ClassScaner.scanPackageBySuper(packageName, superClass); }
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "scanPackageBySuper", "(", "String", "packageName", ",", "final", "Class", "<", "?", ">", "superClass", ")", "{", "return", "ClassScaner", ".", "scanPackageBySuper", "(", "packageName", ",", "super...
扫描指定包路径下所有指定类或接口的子类或实现类 @param packageName 包路径 @param superClass 父类或接口 @return 类集合 @see ClassScaner#scanPackageBySuper(String, Class)
[ "扫描指定包路径下所有指定类或接口的子类或实现类" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L192-L194
train
Scan package by super.
[ 30522, 2270, 10763, 2275, 1026, 2465, 1026, 1029, 1028, 1028, 13594, 23947, 4270, 3762, 6342, 4842, 1006, 5164, 7427, 18442, 1010, 2345, 2465, 1026, 1029, 1028, 3565, 26266, 1007, 1063, 2709, 2465, 29378, 2121, 1012, 13594, 23947, 4270, 376...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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...
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.normalizeParams
public static String normalizeParams(String paramPart, Charset charset) { final StrBuilder builder = StrBuilder.create(paramPart.length() + 16); final int len = paramPart.length(); String name = null; int pos = 0; // 未处理字符开始位置 char c; // 当前字符 int i; // 当前字符位置 for (i = 0; i < len; i++) { c = paramPart.charAt(i); if (c == '=') { // 键值对的分界点 if (null == name) { // 只有=前未定义name时被当作键值分界符,否则做为普通字符 name = (pos == i) ? StrUtil.EMPTY : paramPart.substring(pos, i); pos = i + 1; } } else if (c == '&') { // 参数对的分界点 if (pos != i) { if (null == name) { // 对于像&a&这类无参数值的字符串,我们将name为a的值设为"" name = paramPart.substring(pos, i); builder.append(URLUtil.encodeQuery(name, charset)).append('='); } else { builder.append(URLUtil.encodeQuery(name, charset)).append('=').append(URLUtil.encodeQuery(paramPart.substring(pos, i), charset)).append('&'); } name = null; } pos = i + 1; } } // 结尾处理 if (null != name) { builder.append(URLUtil.encodeQuery(name, charset)).append('='); } if (pos != i) { if (null == name) { builder.append('='); } builder.append(URLUtil.encodeQuery(paramPart.substring(pos, i), charset)); } int lastIndex = builder.length() - 1; if ('&' == builder.charAt(lastIndex)) { builder.delTo(lastIndex); } return builder.toString(); }
java
public static String normalizeParams(String paramPart, Charset charset) { final StrBuilder builder = StrBuilder.create(paramPart.length() + 16); final int len = paramPart.length(); String name = null; int pos = 0; // 未处理字符开始位置 char c; // 当前字符 int i; // 当前字符位置 for (i = 0; i < len; i++) { c = paramPart.charAt(i); if (c == '=') { // 键值对的分界点 if (null == name) { // 只有=前未定义name时被当作键值分界符,否则做为普通字符 name = (pos == i) ? StrUtil.EMPTY : paramPart.substring(pos, i); pos = i + 1; } } else if (c == '&') { // 参数对的分界点 if (pos != i) { if (null == name) { // 对于像&a&这类无参数值的字符串,我们将name为a的值设为"" name = paramPart.substring(pos, i); builder.append(URLUtil.encodeQuery(name, charset)).append('='); } else { builder.append(URLUtil.encodeQuery(name, charset)).append('=').append(URLUtil.encodeQuery(paramPart.substring(pos, i), charset)).append('&'); } name = null; } pos = i + 1; } } // 结尾处理 if (null != name) { builder.append(URLUtil.encodeQuery(name, charset)).append('='); } if (pos != i) { if (null == name) { builder.append('='); } builder.append(URLUtil.encodeQuery(paramPart.substring(pos, i), charset)); } int lastIndex = builder.length() - 1; if ('&' == builder.charAt(lastIndex)) { builder.delTo(lastIndex); } return builder.toString(); }
[ "public", "static", "String", "normalizeParams", "(", "String", "paramPart", ",", "Charset", "charset", ")", "{", "final", "StrBuilder", "builder", "=", "StrBuilder", ".", "create", "(", "paramPart", ".", "length", "(", ")", "+", "16", ")", ";", "final", "...
标准化参数字符串,即URL中?后的部分 @param paramPart 参数字符串 @param charset 编码 @return 标准化的参数字符串 @since 4.5.2
[ "标准化参数字符串,即URL中?后的部分" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L469-L515
train
Normalize the parameters.
[ 30522, 2270, 10763, 5164, 3671, 4697, 28689, 5244, 1006, 5164, 11498, 8737, 8445, 1010, 25869, 13462, 25869, 13462, 1007, 1063, 2345, 2358, 15185, 19231, 4063, 12508, 1027, 2358, 15185, 19231, 4063, 1012, 3443, 1006, 11498, 8737, 8445, 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-http/src/main/java/cn/hutool/http/HttpBase.java
HttpBase.header
public String header(String name) { final List<String> values = headerList(name); if(CollectionUtil.isEmpty(values)) { return null; } return values.get(0); }
java
public String header(String name) { final List<String> values = headerList(name); if(CollectionUtil.isEmpty(values)) { return null; } return values.get(0); }
[ "public", "String", "header", "(", "String", "name", ")", "{", "final", "List", "<", "String", ">", "values", "=", "headerList", "(", "name", ")", ";", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "values", ")", ")", "{", "return", "null", ";", ...
根据name获取头信息<br> 根据RFC2616规范,header的name不区分大小写 @param name Header名 @return Header值
[ "根据name获取头信息<br", ">", "根据RFC2616规范,header的name不区分大小写" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpBase.java#L46-L52
train
Gets the value of a header.
[ 30522, 2270, 5164, 20346, 1006, 5164, 2171, 1007, 1063, 2345, 2862, 1026, 5164, 1028, 5300, 1027, 20346, 9863, 1006, 2171, 1007, 1025, 2065, 1006, 3074, 21823, 2140, 1012, 2003, 6633, 13876, 2100, 1006, 5300, 1007, 1007, 1063, 2709, 19701, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.addIntHeader
@Deprecated public static void addIntHeader(HttpMessage message, String name, int value) { message.headers().add(name, value); }
java
@Deprecated public static void addIntHeader(HttpMessage message, String name, int value) { message.headers().add(name, value); }
[ "@", "Deprecated", "public", "static", "void", "addIntHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "int", "value", ")", "{", "message", ".", "headers", "(", ")", ".", "add", "(", "name", ",", "value", ")", ";", "}" ]
@deprecated Use {@link #add(CharSequence, Iterable)} instead. @see #addIntHeader(HttpMessage, CharSequence, int)
[ "@deprecated", "Use", "{", "@link", "#add", "(", "CharSequence", "Iterable", ")", "}", "instead", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L806-L809
train
Add a header with an int value.
[ 30522, 1030, 2139, 28139, 12921, 2270, 10763, 11675, 5587, 18447, 4974, 2121, 1006, 8299, 7834, 3736, 3351, 4471, 1010, 5164, 2171, 1010, 20014, 3643, 1007, 1063, 4471, 1012, 20346, 2015, 1006, 1007, 1012, 5587, 1006, 2171, 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...
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java
SqlBuilder.select
public SqlBuilder select(boolean isDistinct, String... fields) { return select(isDistinct, Arrays.asList(fields)); }
java
public SqlBuilder select(boolean isDistinct, String... fields) { return select(isDistinct, Arrays.asList(fields)); }
[ "public", "SqlBuilder", "select", "(", "boolean", "isDistinct", ",", "String", "...", "fields", ")", "{", "return", "select", "(", "isDistinct", ",", "Arrays", ".", "asList", "(", "fields", ")", ")", ";", "}" ]
查询 @param isDistinct 是否添加DISTINCT关键字(查询唯一结果) @param fields 查询的字段 @return 自己
[ "查询" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L214-L216
train
Create a SELECT statement with the specified fields.
[ 30522, 2270, 29296, 8569, 23891, 2099, 7276, 1006, 22017, 20898, 2003, 10521, 7629, 6593, 1010, 5164, 1012, 1012, 1012, 4249, 1007, 1063, 2709, 7276, 1006, 2003, 10521, 7629, 6593, 1010, 27448, 1012, 2004, 9863, 1006, 4249, 1007, 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/map/MapUtil.java
MapUtil.filter
public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) { if(null == map || null == editor) { return map; } final Map<K, V> map2 = ObjectUtil.clone(map); if (isEmpty(map2)) { return map2; } map2.clear(); Entry<K, V> modified; for (Entry<K, V> entry : map.entrySet()) { modified = editor.edit(entry); if (null != modified) { map2.put(modified.getKey(), modified.getValue()); } } return map2; }
java
public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) { if(null == map || null == editor) { return map; } final Map<K, V> map2 = ObjectUtil.clone(map); if (isEmpty(map2)) { return map2; } map2.clear(); Entry<K, V> modified; for (Entry<K, V> entry : map.entrySet()) { modified = editor.edit(entry); if (null != modified) { map2.put(modified.getKey(), modified.getValue()); } } return map2; }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "filter", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Editor", "<", "Entry", "<", "K", ",", "V", ">", ">", "editor", ")", "{", "if", "(", "null", "==", "ma...
过滤<br> 过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能: <pre> 1、过滤出需要的对象,如果返回null表示这个元素对象抛弃 2、修改元素对象,返回集合中为修改后的对象 </pre> @param <K> Key类型 @param <V> Value类型 @param map Map @param editor 编辑器接口 @return 过滤后的Map
[ "过滤<br", ">", "过滤过程通过传入的Editor实现来返回需要的元素内容,这个Editor实现可以实现以下功能:" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L490-L509
train
Returns a shallow copy of the given map with the contents of the specified editor.
[ 30522, 2270, 10763, 1026, 1047, 1010, 1058, 1028, 4949, 1026, 1047, 1010, 1058, 1028, 11307, 1006, 4949, 1026, 1047, 1010, 1058, 1028, 4949, 1010, 3559, 1026, 4443, 1026, 1047, 1010, 1058, 1028, 1028, 3559, 1007, 1063, 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...
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java
TableFactoryService.filterByContext
private static <T> List<TableFactory> filterByContext( Class<T> factoryClass, Map<String, String> properties, List<TableFactory> foundFactories, List<TableFactory> classFactories) { List<TableFactory> matchingFactories = classFactories.stream().filter(factory -> { Map<String, String> requestedContext = normalizeContext(factory); Map<String, String> plainContext = new HashMap<>(requestedContext); // we remove the version for now until we have the first backwards compatibility case // with the version we can provide mappings in case the format changes plainContext.remove(CONNECTOR_PROPERTY_VERSION); plainContext.remove(FORMAT_PROPERTY_VERSION); plainContext.remove(METADATA_PROPERTY_VERSION); plainContext.remove(STATISTICS_PROPERTY_VERSION); plainContext.remove(CATALOG_PROPERTY_VERSION); // check if required context is met return plainContext.keySet().stream().allMatch(e -> properties.containsKey(e) && properties.get(e).equals(plainContext.get(e))); }).collect(Collectors.toList()); if (matchingFactories.isEmpty()) { throw new NoMatchingTableFactoryException( "No context matches.", factoryClass, foundFactories, properties); } return matchingFactories; }
java
private static <T> List<TableFactory> filterByContext( Class<T> factoryClass, Map<String, String> properties, List<TableFactory> foundFactories, List<TableFactory> classFactories) { List<TableFactory> matchingFactories = classFactories.stream().filter(factory -> { Map<String, String> requestedContext = normalizeContext(factory); Map<String, String> plainContext = new HashMap<>(requestedContext); // we remove the version for now until we have the first backwards compatibility case // with the version we can provide mappings in case the format changes plainContext.remove(CONNECTOR_PROPERTY_VERSION); plainContext.remove(FORMAT_PROPERTY_VERSION); plainContext.remove(METADATA_PROPERTY_VERSION); plainContext.remove(STATISTICS_PROPERTY_VERSION); plainContext.remove(CATALOG_PROPERTY_VERSION); // check if required context is met return plainContext.keySet().stream().allMatch(e -> properties.containsKey(e) && properties.get(e).equals(plainContext.get(e))); }).collect(Collectors.toList()); if (matchingFactories.isEmpty()) { throw new NoMatchingTableFactoryException( "No context matches.", factoryClass, foundFactories, properties); } return matchingFactories; }
[ "private", "static", "<", "T", ">", "List", "<", "TableFactory", ">", "filterByContext", "(", "Class", "<", "T", ">", "factoryClass", ",", "Map", "<", "String", ",", "String", ">", "properties", ",", "List", "<", "TableFactory", ">", "foundFactories", ",",...
Filters for factories with matching context. @return all matching factories
[ "Filters", "for", "factories", "with", "matching", "context", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L197-L228
train
Filter by context.
[ 30522, 2797, 10763, 1026, 1056, 1028, 2862, 1026, 2795, 21450, 1028, 11307, 3762, 8663, 18209, 1006, 2465, 1026, 1056, 1028, 4713, 26266, 1010, 4949, 1026, 5164, 1010, 5164, 1028, 5144, 1010, 2862, 1026, 2795, 21450, 1028, 2179, 7011, 16761...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/TypeUtil.java
TypeUtil.hasTypeVeriable
public static boolean hasTypeVeriable(Type... types) { for (Type type : types) { if(type instanceof TypeVariable) { return true; } } return false; }
java
public static boolean hasTypeVeriable(Type... types) { for (Type type : types) { if(type instanceof TypeVariable) { return true; } } return false; }
[ "public", "static", "boolean", "hasTypeVeriable", "(", "Type", "...", "types", ")", "{", "for", "(", "Type", "type", ":", "types", ")", "{", "if", "(", "type", "instanceof", "TypeVariable", ")", "{", "return", "true", ";", "}", "}", "return", "false", ...
指定泛型数组中是否含有泛型变量 @param types 泛型数组 @return 是否含有泛型变量 @since 4.5.7
[ "指定泛型数组中是否含有泛型变量" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/TypeUtil.java#L351-L358
train
Checks if the given types are veriable.
[ 30522, 2270, 10763, 22017, 20898, 27151, 5051, 6299, 19210, 1006, 2828, 1012, 1012, 1012, 4127, 1007, 1063, 2005, 1006, 2828, 2828, 1024, 4127, 1007, 1063, 2065, 1006, 2828, 6013, 11253, 2828, 10755, 19210, 1007, 1063, 2709, 2995, 1025, 106...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
ZooKeeperUtils.createSubmittedJobGraphs
public static ZooKeeperSubmittedJobGraphStore createSubmittedJobGraphs( CuratorFramework client, Configuration configuration) throws Exception { checkNotNull(configuration, "Configuration"); RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage = createFileSystemStateStorage(configuration, "submittedJobGraph"); // ZooKeeper submitted jobs root dir String zooKeeperSubmittedJobsPath = configuration.getString(HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH); // Ensure that the job graphs path exists client.newNamespaceAwareEnsurePath(zooKeeperSubmittedJobsPath) .ensure(client.getZookeeperClient()); // All operations will have the path as root CuratorFramework facade = client.usingNamespace(client.getNamespace() + zooKeeperSubmittedJobsPath); final String zooKeeperFullSubmittedJobsPath = client.getNamespace() + zooKeeperSubmittedJobsPath; final ZooKeeperStateHandleStore<SubmittedJobGraph> zooKeeperStateHandleStore = new ZooKeeperStateHandleStore<>(facade, stateStorage); final PathChildrenCache pathCache = new PathChildrenCache(facade, "/", false); return new ZooKeeperSubmittedJobGraphStore( zooKeeperFullSubmittedJobsPath, zooKeeperStateHandleStore, pathCache); }
java
public static ZooKeeperSubmittedJobGraphStore createSubmittedJobGraphs( CuratorFramework client, Configuration configuration) throws Exception { checkNotNull(configuration, "Configuration"); RetrievableStateStorageHelper<SubmittedJobGraph> stateStorage = createFileSystemStateStorage(configuration, "submittedJobGraph"); // ZooKeeper submitted jobs root dir String zooKeeperSubmittedJobsPath = configuration.getString(HighAvailabilityOptions.HA_ZOOKEEPER_JOBGRAPHS_PATH); // Ensure that the job graphs path exists client.newNamespaceAwareEnsurePath(zooKeeperSubmittedJobsPath) .ensure(client.getZookeeperClient()); // All operations will have the path as root CuratorFramework facade = client.usingNamespace(client.getNamespace() + zooKeeperSubmittedJobsPath); final String zooKeeperFullSubmittedJobsPath = client.getNamespace() + zooKeeperSubmittedJobsPath; final ZooKeeperStateHandleStore<SubmittedJobGraph> zooKeeperStateHandleStore = new ZooKeeperStateHandleStore<>(facade, stateStorage); final PathChildrenCache pathCache = new PathChildrenCache(facade, "/", false); return new ZooKeeperSubmittedJobGraphStore( zooKeeperFullSubmittedJobsPath, zooKeeperStateHandleStore, pathCache); }
[ "public", "static", "ZooKeeperSubmittedJobGraphStore", "createSubmittedJobGraphs", "(", "CuratorFramework", "client", ",", "Configuration", "configuration", ")", "throws", "Exception", "{", "checkNotNull", "(", "configuration", ",", "\"Configuration\"", ")", ";", "Retrievab...
Creates a {@link ZooKeeperSubmittedJobGraphStore} instance. @param client The {@link CuratorFramework} ZooKeeper client to use @param configuration {@link Configuration} object @return {@link ZooKeeperSubmittedJobGraphStore} instance @throws Exception if the submitted job graph store cannot be created
[ "Creates", "a", "{", "@link", "ZooKeeperSubmittedJobGraphStore", "}", "instance", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L237-L265
train
Create a ZooKeeperSubmittedJobGraphStore with the given configuration.
[ 30522, 2270, 10763, 9201, 24764, 12083, 22930, 3064, 5558, 2497, 27341, 19277, 9005, 12083, 22930, 3064, 5558, 2497, 27341, 1006, 13023, 15643, 6198, 7396, 1010, 9563, 9563, 1007, 11618, 6453, 1063, 4638, 17048, 11231, 3363, 1006, 9563, 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/dictionary/py/PinyinDictionary.java
PinyinDictionary.load
static boolean load(String path) { if (loadDat(path)) return true; // 从文本中载入并且尝试生成dat StringDictionary dictionary = new StringDictionary("="); if (!dictionary.load(path)) return false; TreeMap<String, Pinyin[]> map = new TreeMap<String, Pinyin[]>(); for (Map.Entry<String, String> entry : dictionary.entrySet()) { String[] args = entry.getValue().split(","); Pinyin[] pinyinValue = new Pinyin[args.length]; for (int i = 0; i < pinyinValue.length; ++i) { try { Pinyin pinyin = Pinyin.valueOf(args[i]); pinyinValue[i] = pinyin; } catch (IllegalArgumentException e) { logger.severe("读取拼音词典" + path + "失败,问题出在【" + entry + "】,异常是" + e); return false; } } map.put(entry.getKey(), pinyinValue); } trie.build(map); logger.info("正在缓存双数组" + path); saveDat(path, trie, map.entrySet()); return true; }
java
static boolean load(String path) { if (loadDat(path)) return true; // 从文本中载入并且尝试生成dat StringDictionary dictionary = new StringDictionary("="); if (!dictionary.load(path)) return false; TreeMap<String, Pinyin[]> map = new TreeMap<String, Pinyin[]>(); for (Map.Entry<String, String> entry : dictionary.entrySet()) { String[] args = entry.getValue().split(","); Pinyin[] pinyinValue = new Pinyin[args.length]; for (int i = 0; i < pinyinValue.length; ++i) { try { Pinyin pinyin = Pinyin.valueOf(args[i]); pinyinValue[i] = pinyin; } catch (IllegalArgumentException e) { logger.severe("读取拼音词典" + path + "失败,问题出在【" + entry + "】,异常是" + e); return false; } } map.put(entry.getKey(), pinyinValue); } trie.build(map); logger.info("正在缓存双数组" + path); saveDat(path, trie, map.entrySet()); return true; }
[ "static", "boolean", "load", "(", "String", "path", ")", "{", "if", "(", "loadDat", "(", "path", ")", ")", "return", "true", ";", "// 从文本中载入并且尝试生成dat", "StringDictionary", "dictionary", "=", "new", "StringDictionary", "(", "\"=\"", ")", ";", "if", "(", "!"...
读取词典 @param path @return
[ "读取词典" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/py/PinyinDictionary.java#L56-L86
train
Load a data file.
[ 30522, 10763, 22017, 20898, 7170, 1006, 5164, 4130, 1007, 1063, 2065, 1006, 7170, 2850, 2102, 1006, 4130, 1007, 1007, 2709, 2995, 1025, 1013, 1013, 100, 1861, 1876, 1746, 100, 100, 100, 100, 100, 100, 1910, 1854, 23755, 5164, 29201, 3258,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraPojoOutputFormat.java
CassandraPojoOutputFormat.open
@Override public void open(int taskNumber, int numTasks) { this.session = cluster.connect(); MappingManager mappingManager = new MappingManager(session); this.mapper = mappingManager.mapper(outputClass); if (mapperOptions != null) { Mapper.Option[] optionsArray = mapperOptions.getMapperOptions(); if (optionsArray != null) { mapper.setDefaultSaveOptions(optionsArray); } } this.callback = new FutureCallback<Void>() { @Override public void onSuccess(Void ignored) { onWriteSuccess(); } @Override public void onFailure(Throwable t) { onWriteFailure(t); } }; }
java
@Override public void open(int taskNumber, int numTasks) { this.session = cluster.connect(); MappingManager mappingManager = new MappingManager(session); this.mapper = mappingManager.mapper(outputClass); if (mapperOptions != null) { Mapper.Option[] optionsArray = mapperOptions.getMapperOptions(); if (optionsArray != null) { mapper.setDefaultSaveOptions(optionsArray); } } this.callback = new FutureCallback<Void>() { @Override public void onSuccess(Void ignored) { onWriteSuccess(); } @Override public void onFailure(Throwable t) { onWriteFailure(t); } }; }
[ "@", "Override", "public", "void", "open", "(", "int", "taskNumber", ",", "int", "numTasks", ")", "{", "this", ".", "session", "=", "cluster", ".", "connect", "(", ")", ";", "MappingManager", "mappingManager", "=", "new", "MappingManager", "(", "session", ...
Opens a Session to Cassandra and initializes the prepared statement. @param taskNumber The number of the parallel instance.
[ "Opens", "a", "Session", "to", "Cassandra", "and", "initializes", "the", "prepared", "statement", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/batch/connectors/cassandra/CassandraPojoOutputFormat.java#L81-L103
train
Open the cluster and create a mapping manager.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2330, 1006, 20014, 4708, 19172, 5677, 1010, 20014, 16371, 20492, 19895, 2015, 1007, 1063, 2023, 1012, 5219, 1027, 9324, 1012, 7532, 1006, 1007, 1025, 12375, 24805, 4590, 12375, 24805, 4590, 1027, 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...
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContext.java
SslContext.newClientContext
@Deprecated public static SslContext newClientContext(SslProvider provider, File certChainFile) throws SSLException { return newClientContext(provider, certChainFile, null); }
java
@Deprecated public static SslContext newClientContext(SslProvider provider, File certChainFile) throws SSLException { return newClientContext(provider, certChainFile, null); }
[ "@", "Deprecated", "public", "static", "SslContext", "newClientContext", "(", "SslProvider", "provider", ",", "File", "certChainFile", ")", "throws", "SSLException", "{", "return", "newClientContext", "(", "provider", ",", "certChainFile", ",", "null", ")", ";", "...
Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @param certChainFile an X.509 certificate chain file in PEM format. {@code null} to use the system default @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder}
[ "Creates", "a", "new", "client", "-", "side", "{", "@link", "SslContext", "}", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L586-L589
train
Create a new SslContext using the specified provider and certChainFile.
[ 30522, 1030, 2139, 28139, 12921, 2270, 10763, 7020, 22499, 10111, 18413, 2047, 20464, 11638, 8663, 18209, 1006, 7020, 14277, 12298, 18688, 10802, 1010, 5371, 8292, 5339, 24925, 2078, 8873, 2571, 1007, 11618, 7020, 2571, 2595, 24422, 1063, 270...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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.addStrings
public final void addStrings(Collection<String> strCollection) { if (sourceNode != null) { String previousString = ""; //Add all the Strings in strCollection to the MDAG. for (String currentString : strCollection) { int mpsIndex = calculateMinimizationProcessingStartIndex(previousString, currentString); //If the _transition path of the previousString needs to be examined for minimization or //equivalence class representation after a certain point, call replaceOrRegister to do so. if (mpsIndex != -1) { String transitionSubstring = previousString.substring(0, mpsIndex); String minimizationProcessingSubString = previousString.substring(mpsIndex); replaceOrRegister(sourceNode.transition(transitionSubstring), minimizationProcessingSubString); } ///// addStringInternal(currentString); previousString = currentString; } ///// //Since we delay the minimization of the previously-added String //until after we read the next one, we need to have a seperate //statement to minimize the absolute last String. replaceOrRegister(sourceNode, previousString); } else { unSimplify(); addStrings(strCollection); } }
java
public final void addStrings(Collection<String> strCollection) { if (sourceNode != null) { String previousString = ""; //Add all the Strings in strCollection to the MDAG. for (String currentString : strCollection) { int mpsIndex = calculateMinimizationProcessingStartIndex(previousString, currentString); //If the _transition path of the previousString needs to be examined for minimization or //equivalence class representation after a certain point, call replaceOrRegister to do so. if (mpsIndex != -1) { String transitionSubstring = previousString.substring(0, mpsIndex); String minimizationProcessingSubString = previousString.substring(mpsIndex); replaceOrRegister(sourceNode.transition(transitionSubstring), minimizationProcessingSubString); } ///// addStringInternal(currentString); previousString = currentString; } ///// //Since we delay the minimization of the previously-added String //until after we read the next one, we need to have a seperate //statement to minimize the absolute last String. replaceOrRegister(sourceNode, previousString); } else { unSimplify(); addStrings(strCollection); } }
[ "public", "final", "void", "addStrings", "(", "Collection", "<", "String", ">", "strCollection", ")", "{", "if", "(", "sourceNode", "!=", "null", ")", "{", "String", "previousString", "=", "\"\"", ";", "//Add all the Strings in strCollection to the MDAG.", "for", ...
Adds a Collection of Strings to the MDAG. @param strCollection a {@link java.util.Collection} containing Strings to be added to the MDAG
[ "Adds", "a", "Collection", "of", "Strings", "to", "the", "MDAG", "." ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L246-L283
train
Add a Collection of Strings to the MDAG.
[ 30522, 2270, 2345, 11675, 9909, 18886, 3070, 2015, 1006, 3074, 1026, 5164, 1028, 2358, 29566, 6216, 7542, 1007, 1063, 2065, 1006, 3120, 3630, 3207, 999, 1027, 19701, 1007, 1063, 5164, 3025, 3367, 4892, 1027, 1000, 1000, 1025, 1013, 1013, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityTemplate.java
VelocityTemplate.loadEncoding
private void loadEncoding() { final String charset = (String) Velocity.getProperty(Velocity.INPUT_ENCODING); this.charset = StrUtil.isEmpty(charset) ? CharsetUtil.UTF_8 : charset; }
java
private void loadEncoding() { final String charset = (String) Velocity.getProperty(Velocity.INPUT_ENCODING); this.charset = StrUtil.isEmpty(charset) ? CharsetUtil.UTF_8 : charset; }
[ "private", "void", "loadEncoding", "(", ")", "{", "final", "String", "charset", "=", "(", "String", ")", "Velocity", ".", "getProperty", "(", "Velocity", ".", "INPUT_ENCODING", ")", ";", "this", ".", "charset", "=", "StrUtil", ".", "isEmpty", "(", "charset...
加载可用的Velocity中预定义的编码
[ "加载可用的Velocity中预定义的编码" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityTemplate.java#L77-L80
train
Loads the encoding from Velocity. properties.
[ 30522, 2797, 11675, 7170, 2368, 3597, 4667, 1006, 1007, 1063, 2345, 5164, 25869, 13462, 1027, 1006, 5164, 1007, 10146, 1012, 2131, 21572, 4842, 3723, 1006, 10146, 1012, 7953, 1035, 17181, 1007, 1025, 2023, 1012, 25869, 13462, 1027, 2358, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/PinyinUtil.java
PinyinUtil.getPinYin
public static String getPinYin(String chinese) { final StrBuilder result = StrUtil.strBuilder(); String strTemp = null; int len = chinese.length(); for (int j = 0; j < len; j++) { strTemp = chinese.substring(j, j + 1); int ascii = getChsAscii(strTemp); if (ascii > 0) { //非汉字 result.append((char)ascii); } else { for (int i = pinyinValue.length - 1; i >= 0; i--) { if (pinyinValue[i] <= ascii) { result.append(pinyinStr[i]); break; } } } } return result.toString(); }
java
public static String getPinYin(String chinese) { final StrBuilder result = StrUtil.strBuilder(); String strTemp = null; int len = chinese.length(); for (int j = 0; j < len; j++) { strTemp = chinese.substring(j, j + 1); int ascii = getChsAscii(strTemp); if (ascii > 0) { //非汉字 result.append((char)ascii); } else { for (int i = pinyinValue.length - 1; i >= 0; i--) { if (pinyinValue[i] <= ascii) { result.append(pinyinStr[i]); break; } } } } return result.toString(); }
[ "public", "static", "String", "getPinYin", "(", "String", "chinese", ")", "{", "final", "StrBuilder", "result", "=", "StrUtil", ".", "strBuilder", "(", ")", ";", "String", "strTemp", "=", "null", ";", "int", "len", "=", "chinese", ".", "length", "(", ")"...
汉字转拼音 <hr> example : 张三 zhangsan @param chinese 汉字 @return 对应的拼音 @since 4.0.11
[ "汉字转拼音", "<hr", ">", "example", ":", "张三", "zhangsan" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/PinyinUtil.java#L156-L176
train
Gets the pinyin string.
[ 30522, 2270, 10763, 5164, 2131, 8091, 25811, 1006, 5164, 2822, 1007, 1063, 2345, 2358, 15185, 19231, 4063, 2765, 1027, 2358, 22134, 4014, 1012, 2358, 15185, 19231, 4063, 1006, 1007, 1025, 5164, 2358, 19731, 8737, 1027, 19701, 1025, 20014, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/State.java
State.shift
boolean shift(State source) { if (!source.can_shift()) { return false; } this.copy(source); stack.add(this.buffer); refresh_stack_information(); ++this.buffer; this.last_action = ActionFactory.make_shift(); this.previous = source; return true; }
java
boolean shift(State source) { if (!source.can_shift()) { return false; } this.copy(source); stack.add(this.buffer); refresh_stack_information(); ++this.buffer; this.last_action = ActionFactory.make_shift(); this.previous = source; return true; }
[ "boolean", "shift", "(", "State", "source", ")", "{", "if", "(", "!", "source", ".", "can_shift", "(", ")", ")", "{", "return", "false", ";", "}", "this", ".", "copy", "(", "source", ")", ";", "stack", ".", "add", "(", "this", ".", "buffer", ")",...
不建立依存关系,只转移句法分析的焦点,即原来的右焦点词变为新的左焦点词(本状态),依此类推。 @param source 右焦点词 @return 是否shift成功
[ "不建立依存关系,只转移句法分析的焦点,即原来的右焦点词变为新的左焦点词(本状态),依此类推。" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/State.java#L174-L189
train
Shifts the state to the next entry in the sequence.
[ 30522, 22017, 20898, 5670, 1006, 2110, 3120, 1007, 1063, 2065, 1006, 999, 3120, 1012, 2064, 1035, 5670, 1006, 1007, 1007, 1063, 2709, 6270, 1025, 1065, 2023, 1012, 6100, 1006, 3120, 1007, 1025, 9991, 1012, 5587, 1006, 2023, 1012, 17698, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/expression/BasicExpressionParser.java
BasicExpressionParser.parse
public SQLExpression parse(final SQLStatement sqlStatement) { int beginPosition = lexerEngine.getCurrentToken().getEndPosition(); SQLExpression result = parseExpression(sqlStatement); if (result instanceof SQLPropertyExpression) { setTableToken(sqlStatement, beginPosition, (SQLPropertyExpression) result); } return result; }
java
public SQLExpression parse(final SQLStatement sqlStatement) { int beginPosition = lexerEngine.getCurrentToken().getEndPosition(); SQLExpression result = parseExpression(sqlStatement); if (result instanceof SQLPropertyExpression) { setTableToken(sqlStatement, beginPosition, (SQLPropertyExpression) result); } return result; }
[ "public", "SQLExpression", "parse", "(", "final", "SQLStatement", "sqlStatement", ")", "{", "int", "beginPosition", "=", "lexerEngine", ".", "getCurrentToken", "(", ")", ".", "getEndPosition", "(", ")", ";", "SQLExpression", "result", "=", "parseExpression", "(", ...
Parse expression. @param sqlStatement SQL statement @return expression
[ "Parse", "expression", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/expression/BasicExpressionParser.java#L54-L61
train
Parse a SQL expression.
[ 30522, 2270, 29296, 10288, 20110, 3258, 11968, 3366, 1006, 2345, 29296, 9153, 18532, 4765, 29296, 9153, 18532, 4765, 1007, 1063, 20014, 4088, 26994, 1027, 17244, 7869, 3070, 3170, 1012, 2131, 10841, 14343, 3372, 18715, 2368, 1006, 1007, 1012,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonWindowedStream.java
PythonWindowedStream.reduce
@SuppressWarnings("unchecked") public PythonSingleOutputStreamOperator reduce(ReduceFunction<PyObject> fun) throws IOException { return new PythonSingleOutputStreamOperator(stream.reduce(new PythonReduceFunction(fun))); }
java
@SuppressWarnings("unchecked") public PythonSingleOutputStreamOperator reduce(ReduceFunction<PyObject> fun) throws IOException { return new PythonSingleOutputStreamOperator(stream.reduce(new PythonReduceFunction(fun))); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "PythonSingleOutputStreamOperator", "reduce", "(", "ReduceFunction", "<", "PyObject", ">", "fun", ")", "throws", "IOException", "{", "return", "new", "PythonSingleOutputStreamOperator", "(", "stream", ".", ...
A thin wrapper layer over {@link WindowedStream#reduce(org.apache.flink.api.common.functions.ReduceFunction)}. @param fun The reduce function. @return The data stream that is the result of applying the reduce function to the window.
[ "A", "thin", "wrapper", "layer", "over", "{", "@link", "WindowedStream#reduce", "(", "org", ".", "apache", ".", "flink", ".", "api", ".", "common", ".", "functions", ".", "ReduceFunction", ")", "}", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonWindowedStream.java#L56-L59
train
Reduce the stream using the given reduce function.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 18750, 7741, 2571, 5833, 18780, 21422, 25918, 8844, 5547, 1006, 5547, 11263, 27989, 1026, 1052, 7677, 2497, 20614, 1028, 4569, 1007, 11618, 22834, 10288, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.quoteForBatchScript
static String quoteForBatchScript(String arg) { boolean needsQuotes = false; for (int i = 0; i < arg.length(); i++) { int c = arg.codePointAt(i); if (Character.isWhitespace(c) || c == '"' || c == '=' || c == ',' || c == ';') { needsQuotes = true; break; } } if (!needsQuotes) { return arg; } StringBuilder quoted = new StringBuilder(); quoted.append("\""); for (int i = 0; i < arg.length(); i++) { int cp = arg.codePointAt(i); switch (cp) { case '"': quoted.append('"'); break; default: break; } quoted.appendCodePoint(cp); } if (arg.codePointAt(arg.length() - 1) == '\\') { quoted.append("\\"); } quoted.append("\""); return quoted.toString(); }
java
static String quoteForBatchScript(String arg) { boolean needsQuotes = false; for (int i = 0; i < arg.length(); i++) { int c = arg.codePointAt(i); if (Character.isWhitespace(c) || c == '"' || c == '=' || c == ',' || c == ';') { needsQuotes = true; break; } } if (!needsQuotes) { return arg; } StringBuilder quoted = new StringBuilder(); quoted.append("\""); for (int i = 0; i < arg.length(); i++) { int cp = arg.codePointAt(i); switch (cp) { case '"': quoted.append('"'); break; default: break; } quoted.appendCodePoint(cp); } if (arg.codePointAt(arg.length() - 1) == '\\') { quoted.append("\\"); } quoted.append("\""); return quoted.toString(); }
[ "static", "String", "quoteForBatchScript", "(", "String", "arg", ")", "{", "boolean", "needsQuotes", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arg", ".", "length", "(", ")", ";", "i", "++", ")", "{", "int", "c", "=", "a...
Quote a command argument for a command to be run by a Windows batch script, if the argument needs quoting. Arguments only seem to need quotes in batch scripts if they have certain special characters, some of which need extra (and different) escaping. For example: original single argument: ab="cde fgh" quoted: "ab^=""cde fgh"""
[ "Quote", "a", "command", "argument", "for", "a", "command", "to", "be", "run", "by", "a", "Windows", "batch", "script", "if", "the", "argument", "needs", "quoting", ".", "Arguments", "only", "seem", "to", "need", "quotes", "in", "batch", "scripts", "if", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L241-L273
train
Quote for batch script.
[ 30522, 10763, 5164, 14686, 29278, 14479, 18069, 23235, 1006, 5164, 12098, 2290, 1007, 1063, 22017, 20898, 3791, 28940, 12184, 2015, 1027, 6270, 1025, 2005, 1006, 20014, 1045, 1027, 1014, 1025, 1045, 1026, 12098, 2290, 1012, 3091, 1006, 1007, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/util/NetUtils.java
NetUtils.ipAddressToUrlString
public static String ipAddressToUrlString(InetAddress address) { if (address == null) { throw new NullPointerException("address is null"); } else if (address instanceof Inet4Address) { return address.getHostAddress(); } else if (address instanceof Inet6Address) { return getIPv6UrlRepresentation((Inet6Address) address); } else { throw new IllegalArgumentException("Unrecognized type of InetAddress: " + address); } }
java
public static String ipAddressToUrlString(InetAddress address) { if (address == null) { throw new NullPointerException("address is null"); } else if (address instanceof Inet4Address) { return address.getHostAddress(); } else if (address instanceof Inet6Address) { return getIPv6UrlRepresentation((Inet6Address) address); } else { throw new IllegalArgumentException("Unrecognized type of InetAddress: " + address); } }
[ "public", "static", "String", "ipAddressToUrlString", "(", "InetAddress", "address", ")", "{", "if", "(", "address", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"address is null\"", ")", ";", "}", "else", "if", "(", "address", "insta...
Encodes an IP address properly as a URL string. This method makes sure that IPv6 addresses have the proper formatting to be included in URLs. @param address The IP address to encode. @return The proper URL string encoded IP address.
[ "Encodes", "an", "IP", "address", "properly", "as", "a", "URL", "string", ".", "This", "method", "makes", "sure", "that", "IPv6", "addresses", "have", "the", "proper", "formatting", "to", "be", "included", "in", "URLs", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L178-L191
train
Convert an InetAddress to a URL string.
[ 30522, 2270, 10763, 5164, 25249, 16200, 4757, 21163, 4877, 18886, 3070, 1006, 1999, 12928, 14141, 8303, 4769, 1007, 1063, 2065, 1006, 4769, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 19701, 8400, 7869, 2595, 24422, 1006, 1000, 4769, 2003, 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
transport/src/main/java/io/netty/channel/DefaultChannelConfig.java
DefaultChannelConfig.setRecvByteBufAllocator
private void setRecvByteBufAllocator(RecvByteBufAllocator allocator, ChannelMetadata metadata) { if (allocator instanceof MaxMessagesRecvByteBufAllocator) { ((MaxMessagesRecvByteBufAllocator) allocator).maxMessagesPerRead(metadata.defaultMaxMessagesPerRead()); } else if (allocator == null) { throw new NullPointerException("allocator"); } setRecvByteBufAllocator(allocator); }
java
private void setRecvByteBufAllocator(RecvByteBufAllocator allocator, ChannelMetadata metadata) { if (allocator instanceof MaxMessagesRecvByteBufAllocator) { ((MaxMessagesRecvByteBufAllocator) allocator).maxMessagesPerRead(metadata.defaultMaxMessagesPerRead()); } else if (allocator == null) { throw new NullPointerException("allocator"); } setRecvByteBufAllocator(allocator); }
[ "private", "void", "setRecvByteBufAllocator", "(", "RecvByteBufAllocator", "allocator", ",", "ChannelMetadata", "metadata", ")", "{", "if", "(", "allocator", "instanceof", "MaxMessagesRecvByteBufAllocator", ")", "{", "(", "(", "MaxMessagesRecvByteBufAllocator", ")", "allo...
Set the {@link RecvByteBufAllocator} which is used for the channel to allocate receive buffers. @param allocator the allocator to set. @param metadata Used to set the {@link ChannelMetadata#defaultMaxMessagesPerRead()} if {@code allocator} is of type {@link MaxMessagesRecvByteBufAllocator}.
[ "Set", "the", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/DefaultChannelConfig.java#L307-L314
train
Set the receive buffer allocator.
[ 30522, 2797, 11675, 2275, 2890, 2278, 26493, 17250, 8569, 13976, 24755, 4263, 1006, 28667, 26493, 17250, 8569, 13976, 24755, 4263, 2035, 24755, 4263, 1010, 3149, 11368, 8447, 2696, 27425, 1007, 1063, 2065, 1006, 2035, 24755, 4263, 6013, 11253...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.copy
public static Object copy(Object src, Object dest, int length) { System.arraycopy(src, 0, dest, 0, length); return dest; }
java
public static Object copy(Object src, Object dest, int length) { System.arraycopy(src, 0, dest, 0, length); return dest; }
[ "public", "static", "Object", "copy", "(", "Object", "src", ",", "Object", "dest", ",", "int", "length", ")", "{", "System", ".", "arraycopy", "(", "src", ",", "0", ",", "dest", ",", "0", ",", "length", ")", ";", "return", "dest", ";", "}" ]
包装 {@link System#arraycopy(Object, int, Object, int, int)}<br> 数组复制,缘数组和目标数组都是从位置0开始复制 @param src 源数组 @param dest 目标数组 @param length 拷贝数组长度 @return 目标数组 @since 3.0.6
[ "包装", "{", "@link", "System#arraycopy", "(", "Object", "int", "Object", "int", "int", ")", "}", "<br", ">", "数组复制,缘数组和目标数组都是从位置0开始复制" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L588-L591
train
Copies the contents of src to dest.
[ 30522, 2270, 10763, 4874, 6100, 1006, 4874, 5034, 2278, 1010, 4874, 4078, 2102, 1010, 20014, 3091, 1007, 1063, 2291, 1012, 9140, 3597, 7685, 1006, 5034, 2278, 1010, 1014, 1010, 4078, 2102, 1010, 1014, 1010, 3091, 1007, 1025, 2709, 4078, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.insert
@SuppressWarnings("unchecked") public static <T> Object insert(Object array, int index, T... newElements) { if (isEmpty(newElements)) { return array; } if(isEmpty(array)) { return newElements; } final int len = length(array); if (index < 0) { index = (index % len) + len; } final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length); System.arraycopy(array, 0, result, 0, Math.min(len, index)); System.arraycopy(newElements, 0, result, index, newElements.length); if (index < len) { System.arraycopy(array, index, result, index + newElements.length, len - index); } return result; }
java
@SuppressWarnings("unchecked") public static <T> Object insert(Object array, int index, T... newElements) { if (isEmpty(newElements)) { return array; } if(isEmpty(array)) { return newElements; } final int len = length(array); if (index < 0) { index = (index % len) + len; } final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length); System.arraycopy(array, 0, result, 0, Math.min(len, index)); System.arraycopy(newElements, 0, result, index, newElements.length); if (index < len) { System.arraycopy(array, index, result, index + newElements.length, len - index); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Object", "insert", "(", "Object", "array", ",", "int", "index", ",", "T", "...", "newElements", ")", "{", "if", "(", "isEmpty", "(", "newElements", ")", ")", "{", "...
将新元素插入到到已有数组中的某个位置<br> 添加新元素会生成一个新的数组,不影响原数组<br> 如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充 @param <T> 数组元素类型 @param array 已有数组 @param index 插入位置,此位置为对应此位置元素之前的空档 @param newElements 新元素 @return 新数组 @since 4.0.8
[ "将新元素插入到到已有数组中的某个位置<br", ">", "添加新元素会生成一个新的数组,不影响原数组<br", ">", "如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L473-L494
train
Inserts the specified elements into the specified array at the specified index.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1056, 1028, 4874, 19274, 1006, 4874, 9140, 1010, 20014, 5950, 1010, 1056, 1012, 1012, 1012, 2047, 12260, 8163, 1007, 1063, 2065, 1006, 2003,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/util/KMeansDataGenerator.java
KMeansDataGenerator.main
public static void main(String[] args) throws IOException { // check parameter count if (args.length < 2) { System.out.println("KMeansDataGenerator -points <num> -k <num clusters> [-output <output-path>] [-stddev <relative stddev>] [-range <centroid range>] [-seed <seed>]"); System.exit(1); } // parse parameters final ParameterTool params = ParameterTool.fromArgs(args); final int numDataPoints = params.getInt("points"); final int k = params.getInt("k"); final String outDir = params.get("output", System.getProperty("java.io.tmpdir")); final double stddev = params.getDouble("stddev", RELATIVE_STDDEV); final double range = params.getDouble("range", DEFAULT_VALUE_RANGE); final long firstSeed = params.getLong("seed", DEFAULT_SEED); final double absoluteStdDev = stddev * range; final Random random = new Random(firstSeed); // the means around which data points are distributed final double[][] means = uniformRandomCenters(random, k, DIMENSIONALITY, range); // write the points out BufferedWriter pointsOut = null; try { pointsOut = new BufferedWriter(new FileWriter(new File(outDir + "/" + POINTS_FILE))); StringBuilder buffer = new StringBuilder(); double[] point = new double[DIMENSIONALITY]; int nextCentroid = 0; for (int i = 1; i <= numDataPoints; i++) { // generate a point for the current centroid double[] centroid = means[nextCentroid]; for (int d = 0; d < DIMENSIONALITY; d++) { point[d] = (random.nextGaussian() * absoluteStdDev) + centroid[d]; } writePoint(point, buffer, pointsOut); nextCentroid = (nextCentroid + 1) % k; } } finally { if (pointsOut != null) { pointsOut.close(); } } // write the uniformly distributed centers to a file BufferedWriter centersOut = null; try { centersOut = new BufferedWriter(new FileWriter(new File(outDir + "/" + CENTERS_FILE))); StringBuilder buffer = new StringBuilder(); double[][] centers = uniformRandomCenters(random, k, DIMENSIONALITY, range); for (int i = 0; i < k; i++) { writeCenter(i + 1, centers[i], buffer, centersOut); } } finally { if (centersOut != null) { centersOut.close(); } } System.out.println("Wrote " + numDataPoints + " data points to " + outDir + "/" + POINTS_FILE); System.out.println("Wrote " + k + " cluster centers to " + outDir + "/" + CENTERS_FILE); }
java
public static void main(String[] args) throws IOException { // check parameter count if (args.length < 2) { System.out.println("KMeansDataGenerator -points <num> -k <num clusters> [-output <output-path>] [-stddev <relative stddev>] [-range <centroid range>] [-seed <seed>]"); System.exit(1); } // parse parameters final ParameterTool params = ParameterTool.fromArgs(args); final int numDataPoints = params.getInt("points"); final int k = params.getInt("k"); final String outDir = params.get("output", System.getProperty("java.io.tmpdir")); final double stddev = params.getDouble("stddev", RELATIVE_STDDEV); final double range = params.getDouble("range", DEFAULT_VALUE_RANGE); final long firstSeed = params.getLong("seed", DEFAULT_SEED); final double absoluteStdDev = stddev * range; final Random random = new Random(firstSeed); // the means around which data points are distributed final double[][] means = uniformRandomCenters(random, k, DIMENSIONALITY, range); // write the points out BufferedWriter pointsOut = null; try { pointsOut = new BufferedWriter(new FileWriter(new File(outDir + "/" + POINTS_FILE))); StringBuilder buffer = new StringBuilder(); double[] point = new double[DIMENSIONALITY]; int nextCentroid = 0; for (int i = 1; i <= numDataPoints; i++) { // generate a point for the current centroid double[] centroid = means[nextCentroid]; for (int d = 0; d < DIMENSIONALITY; d++) { point[d] = (random.nextGaussian() * absoluteStdDev) + centroid[d]; } writePoint(point, buffer, pointsOut); nextCentroid = (nextCentroid + 1) % k; } } finally { if (pointsOut != null) { pointsOut.close(); } } // write the uniformly distributed centers to a file BufferedWriter centersOut = null; try { centersOut = new BufferedWriter(new FileWriter(new File(outDir + "/" + CENTERS_FILE))); StringBuilder buffer = new StringBuilder(); double[][] centers = uniformRandomCenters(random, k, DIMENSIONALITY, range); for (int i = 0; i < k; i++) { writeCenter(i + 1, centers[i], buffer, centersOut); } } finally { if (centersOut != null) { centersOut.close(); } } System.out.println("Wrote " + numDataPoints + " data points to " + outDir + "/" + POINTS_FILE); System.out.println("Wrote " + k + " cluster centers to " + outDir + "/" + CENTERS_FILE); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "// check parameter count", "if", "(", "args", ".", "length", "<", "2", ")", "{", "System", ".", "out", ".", "println", "(", "\"KMeansDataGenerator -point...
Main method to generate data for the {@link KMeans} example program. <p>The generator creates to files: <ul> <li><code>&lt; output-path &gt;/points</code> for the data points <li><code>&lt; output-path &gt;/centers</code> for the cluster centers </ul> @param args <ol> <li>Int: Number of data points <li>Int: Number of cluster centers <li><b>Optional</b> String: Output path, default value is {tmp.dir} <li><b>Optional</b> Double: Standard deviation of data points <li><b>Optional</b> Double: Value range of cluster centers <li><b>Optional</b> Long: Random seed </ol> @throws IOException
[ "Main", "method", "to", "generate", "data", "for", "the", "{", "@link", "KMeans", "}", "example", "program", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/util/KMeansDataGenerator.java#L71-L140
train
Main method to generate KMeansDataGenerator.
[ 30522, 2270, 10763, 11675, 2364, 1006, 5164, 1031, 1033, 12098, 5620, 1007, 11618, 22834, 10288, 24422, 1063, 1013, 1013, 4638, 16381, 4175, 2065, 1006, 12098, 5620, 1012, 3091, 1026, 1016, 1007, 1063, 2291, 1012, 2041, 1012, 6140, 19666, 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...
redisson/redisson
redisson/src/main/java/org/redisson/config/Config.java
Config.fromJSON
public static Config fromJSON(Reader reader) throws IOException { ConfigSupport support = new ConfigSupport(); return support.fromJSON(reader, Config.class); }
java
public static Config fromJSON(Reader reader) throws IOException { ConfigSupport support = new ConfigSupport(); return support.fromJSON(reader, Config.class); }
[ "public", "static", "Config", "fromJSON", "(", "Reader", "reader", ")", "throws", "IOException", "{", "ConfigSupport", "support", "=", "new", "ConfigSupport", "(", ")", ";", "return", "support", ".", "fromJSON", "(", "reader", ",", "Config", ".", "class", ")...
Read config object stored in JSON format from <code>Reader</code> @param reader object @return config @throws IOException error
[ "Read", "config", "object", "stored", "in", "JSON", "format", "from", "<code", ">", "Reader<", "/", "code", ">" ]
d3acc0249b2d5d658d36d99e2c808ce49332ea44
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/config/Config.java#L616-L619
train
Creates a Config object from a JSON document.
[ 30522, 2270, 10763, 9530, 8873, 2290, 2013, 22578, 2239, 1006, 8068, 8068, 1007, 11618, 22834, 10288, 24422, 1063, 9530, 8873, 5620, 6279, 6442, 2490, 1027, 2047, 9530, 8873, 5620, 6279, 6442, 1006, 1007, 1025, 2709, 2490, 1012, 2013, 22578...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-core/src/main/java/org/apache/flink/types/Record.java
Record.setNull
public void setNull(long mask) { for (int i = 0; i < this.numFields; i++, mask >>>= 1) { if ((mask & 0x1) != 0) { internallySetField(i, null); } } }
java
public void setNull(long mask) { for (int i = 0; i < this.numFields; i++, mask >>>= 1) { if ((mask & 0x1) != 0) { internallySetField(i, null); } } }
[ "public", "void", "setNull", "(", "long", "mask", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "numFields", ";", "i", "++", ",", "mask", ">>>=", "1", ")", "{", "if", "(", "(", "mask", "&", "0x1", ")", "!=", "0", "...
Sets the fields to <code>null</code> using the given bit mask. The bits correspond to the individual columns: <code>(1 == nullify, 0 == keep)</code>. @param mask Bit mask, where the i-th least significant bit represents the i-th field in the record.
[ "Sets", "the", "fields", "to", "<code", ">", "null<", "/", "code", ">", "using", "the", "given", "bit", "mask", ".", "The", "bits", "correspond", "to", "the", "individual", "columns", ":", "<code", ">", "(", "1", "==", "nullify", "0", "==", "keep", "...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L508-L514
train
Sets the value of the null field.
[ 30522, 2270, 11675, 2275, 11231, 3363, 1006, 2146, 7308, 1007, 1063, 2005, 1006, 20014, 1045, 1027, 1014, 1025, 1045, 1026, 2023, 1012, 16371, 2213, 15155, 1025, 1045, 1009, 1009, 1010, 7308, 1028, 1028, 1028, 1027, 1015, 1007, 1063, 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/spark
common/network-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java
SaslClientBootstrap.doBootstrap
@Override public void doBootstrap(TransportClient client, Channel channel) { SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption()); try { byte[] payload = saslClient.firstToken(); while (!saslClient.isComplete()) { SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer()); ByteBuffer response = client.sendRpcSync(buf.nioBuffer(), conf.authRTTimeoutMs()); payload = saslClient.response(JavaUtils.bufferToArray(response)); } client.setClientId(appId); if (conf.saslEncryption()) { if (!SparkSaslServer.QOP_AUTH_CONF.equals(saslClient.getNegotiatedProperty(Sasl.QOP))) { throw new RuntimeException( new SaslException("Encryption requests by negotiated non-encrypted connection.")); } SaslEncryption.addToChannel(channel, saslClient, conf.maxSaslEncryptedBlockSize()); saslClient = null; logger.debug("Channel {} configured for encryption.", client); } } catch (IOException ioe) { throw new RuntimeException(ioe); } finally { if (saslClient != null) { try { // Once authentication is complete, the server will trust all remaining communication. saslClient.dispose(); } catch (RuntimeException e) { logger.error("Error while disposing SASL client", e); } } } }
java
@Override public void doBootstrap(TransportClient client, Channel channel) { SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption()); try { byte[] payload = saslClient.firstToken(); while (!saslClient.isComplete()) { SaslMessage msg = new SaslMessage(appId, payload); ByteBuf buf = Unpooled.buffer(msg.encodedLength() + (int) msg.body().size()); msg.encode(buf); buf.writeBytes(msg.body().nioByteBuffer()); ByteBuffer response = client.sendRpcSync(buf.nioBuffer(), conf.authRTTimeoutMs()); payload = saslClient.response(JavaUtils.bufferToArray(response)); } client.setClientId(appId); if (conf.saslEncryption()) { if (!SparkSaslServer.QOP_AUTH_CONF.equals(saslClient.getNegotiatedProperty(Sasl.QOP))) { throw new RuntimeException( new SaslException("Encryption requests by negotiated non-encrypted connection.")); } SaslEncryption.addToChannel(channel, saslClient, conf.maxSaslEncryptedBlockSize()); saslClient = null; logger.debug("Channel {} configured for encryption.", client); } } catch (IOException ioe) { throw new RuntimeException(ioe); } finally { if (saslClient != null) { try { // Once authentication is complete, the server will trust all remaining communication. saslClient.dispose(); } catch (RuntimeException e) { logger.error("Error while disposing SASL client", e); } } } }
[ "@", "Override", "public", "void", "doBootstrap", "(", "TransportClient", "client", ",", "Channel", "channel", ")", "{", "SparkSaslClient", "saslClient", "=", "new", "SparkSaslClient", "(", "appId", ",", "secretKeyHolder", ",", "conf", ".", "saslEncryption", "(", ...
Performs SASL authentication by sending a token, and then proceeding with the SASL challenge-response tokens until we either successfully authenticate or throw an exception due to mismatch.
[ "Performs", "SASL", "authentication", "by", "sending", "a", "token", "and", "then", "proceeding", "with", "the", "SASL", "challenge", "-", "response", "tokens", "until", "we", "either", "successfully", "authenticate", "or", "throw", "an", "exception", "due", "to...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslClientBootstrap.java#L58-L98
train
Bootstrap the server.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2079, 27927, 20528, 2361, 1006, 3665, 20464, 11638, 7396, 1010, 3149, 3149, 1007, 1063, 12300, 3022, 15472, 8751, 3372, 21871, 15472, 8751, 3372, 1027, 2047, 12300, 3022, 15472, 8751, 3372, 1006, 10439, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java
CommonRest.etl
@PostMapping("/etl/{type}/{key}/{task}") public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task, @RequestParam(name = "params", required = false) String params) { OuterAdapter adapter = loader.getExtension(type, key); String destination = adapter.getDestination(task); String lockKey = destination == null ? task : destination; boolean locked = etlLock.tryLock(ETL_LOCK_ZK_NODE + type + "-" + lockKey); if (!locked) { EtlResult result = new EtlResult(); result.setSucceeded(false); result.setErrorMessage(task + " 有其他进程正在导入中, 请稍后再试"); return result; } try { boolean oriSwitchStatus; if (destination != null) { oriSwitchStatus = syncSwitch.status(destination); if (oriSwitchStatus) { syncSwitch.off(destination); } } else { // task可能为destination,直接锁task oriSwitchStatus = syncSwitch.status(task); if (oriSwitchStatus) { syncSwitch.off(task); } } try { List<String> paramArray = null; if (params != null) { paramArray = Arrays.asList(params.trim().split(";")); } return adapter.etl(task, paramArray); } finally { if (destination != null && oriSwitchStatus) { syncSwitch.on(destination); } else if (destination == null && oriSwitchStatus) { syncSwitch.on(task); } } } finally { etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + lockKey); } }
java
@PostMapping("/etl/{type}/{key}/{task}") public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task, @RequestParam(name = "params", required = false) String params) { OuterAdapter adapter = loader.getExtension(type, key); String destination = adapter.getDestination(task); String lockKey = destination == null ? task : destination; boolean locked = etlLock.tryLock(ETL_LOCK_ZK_NODE + type + "-" + lockKey); if (!locked) { EtlResult result = new EtlResult(); result.setSucceeded(false); result.setErrorMessage(task + " 有其他进程正在导入中, 请稍后再试"); return result; } try { boolean oriSwitchStatus; if (destination != null) { oriSwitchStatus = syncSwitch.status(destination); if (oriSwitchStatus) { syncSwitch.off(destination); } } else { // task可能为destination,直接锁task oriSwitchStatus = syncSwitch.status(task); if (oriSwitchStatus) { syncSwitch.off(task); } } try { List<String> paramArray = null; if (params != null) { paramArray = Arrays.asList(params.trim().split(";")); } return adapter.etl(task, paramArray); } finally { if (destination != null && oriSwitchStatus) { syncSwitch.on(destination); } else if (destination == null && oriSwitchStatus) { syncSwitch.on(task); } } } finally { etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + lockKey); } }
[ "@", "PostMapping", "(", "\"/etl/{type}/{key}/{task}\"", ")", "public", "EtlResult", "etl", "(", "@", "PathVariable", "String", "type", ",", "@", "PathVariable", "String", "key", ",", "@", "PathVariable", "String", "task", ",", "@", "RequestParam", "(", "name", ...
ETL curl http://127.0.0.1:8081/etl/rdb/oracle1/mytest_user.yml -X POST @param type 类型 hbase, es @param key adapter key @param task 任务名对应配置文件名 mytest_user.yml @param params etl where条件参数, 为空全部导入
[ "ETL", "curl", "http", ":", "//", "127", ".", "0", ".", "0", ".", "1", ":", "8081", "/", "etl", "/", "rdb", "/", "oracle1", "/", "mytest_user", ".", "yml", "-", "X", "POST" ]
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/rest/CommonRest.java#L66-L111
train
ETL method.
[ 30522, 1030, 2695, 2863, 14853, 1006, 1000, 1013, 3802, 2140, 1013, 1063, 2828, 1065, 1013, 1063, 3145, 1065, 1013, 1063, 4708, 1065, 1000, 1007, 2270, 3802, 20974, 2229, 11314, 3802, 2140, 1006, 1030, 4130, 10755, 19210, 5164, 2828, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamTaskStateInitializerImpl.java
StreamTaskStateInitializerImpl.streamOperatorStateContext
@Override public StreamOperatorStateContext streamOperatorStateContext( @Nonnull OperatorID operatorID, @Nonnull String operatorClassName, @Nonnull KeyContext keyContext, @Nullable TypeSerializer<?> keySerializer, @Nonnull CloseableRegistry streamTaskCloseableRegistry, @Nonnull MetricGroup metricGroup) throws Exception { TaskInfo taskInfo = environment.getTaskInfo(); OperatorSubtaskDescriptionText operatorSubtaskDescription = new OperatorSubtaskDescriptionText( operatorID, operatorClassName, taskInfo.getIndexOfThisSubtask(), taskInfo.getNumberOfParallelSubtasks()); final String operatorIdentifierText = operatorSubtaskDescription.toString(); final PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates = taskStateManager.prioritizedOperatorState(operatorID); AbstractKeyedStateBackend<?> keyedStatedBackend = null; OperatorStateBackend operatorStateBackend = null; CloseableIterable<KeyGroupStatePartitionStreamProvider> rawKeyedStateInputs = null; CloseableIterable<StatePartitionStreamProvider> rawOperatorStateInputs = null; InternalTimeServiceManager<?> timeServiceManager; try { // -------------- Keyed State Backend -------------- keyedStatedBackend = keyedStatedBackend( keySerializer, operatorIdentifierText, prioritizedOperatorSubtaskStates, streamTaskCloseableRegistry, metricGroup); // -------------- Operator State Backend -------------- operatorStateBackend = operatorStateBackend( operatorIdentifierText, prioritizedOperatorSubtaskStates, streamTaskCloseableRegistry); // -------------- Raw State Streams -------------- rawKeyedStateInputs = rawKeyedStateInputs( prioritizedOperatorSubtaskStates.getPrioritizedRawKeyedState().iterator()); streamTaskCloseableRegistry.registerCloseable(rawKeyedStateInputs); rawOperatorStateInputs = rawOperatorStateInputs( prioritizedOperatorSubtaskStates.getPrioritizedRawOperatorState().iterator()); streamTaskCloseableRegistry.registerCloseable(rawOperatorStateInputs); // -------------- Internal Timer Service Manager -------------- timeServiceManager = internalTimeServiceManager(keyedStatedBackend, keyContext, rawKeyedStateInputs); // -------------- Preparing return value -------------- return new StreamOperatorStateContextImpl( prioritizedOperatorSubtaskStates.isRestored(), operatorStateBackend, keyedStatedBackend, timeServiceManager, rawOperatorStateInputs, rawKeyedStateInputs); } catch (Exception ex) { // cleanup if something went wrong before results got published. if (keyedStatedBackend != null) { if (streamTaskCloseableRegistry.unregisterCloseable(keyedStatedBackend)) { IOUtils.closeQuietly(keyedStatedBackend); } // release resource (e.g native resource) keyedStatedBackend.dispose(); } if (operatorStateBackend != null) { if (streamTaskCloseableRegistry.unregisterCloseable(operatorStateBackend)) { IOUtils.closeQuietly(operatorStateBackend); } operatorStateBackend.dispose(); } if (streamTaskCloseableRegistry.unregisterCloseable(rawKeyedStateInputs)) { IOUtils.closeQuietly(rawKeyedStateInputs); } if (streamTaskCloseableRegistry.unregisterCloseable(rawOperatorStateInputs)) { IOUtils.closeQuietly(rawOperatorStateInputs); } throw new Exception("Exception while creating StreamOperatorStateContext.", ex); } }
java
@Override public StreamOperatorStateContext streamOperatorStateContext( @Nonnull OperatorID operatorID, @Nonnull String operatorClassName, @Nonnull KeyContext keyContext, @Nullable TypeSerializer<?> keySerializer, @Nonnull CloseableRegistry streamTaskCloseableRegistry, @Nonnull MetricGroup metricGroup) throws Exception { TaskInfo taskInfo = environment.getTaskInfo(); OperatorSubtaskDescriptionText operatorSubtaskDescription = new OperatorSubtaskDescriptionText( operatorID, operatorClassName, taskInfo.getIndexOfThisSubtask(), taskInfo.getNumberOfParallelSubtasks()); final String operatorIdentifierText = operatorSubtaskDescription.toString(); final PrioritizedOperatorSubtaskState prioritizedOperatorSubtaskStates = taskStateManager.prioritizedOperatorState(operatorID); AbstractKeyedStateBackend<?> keyedStatedBackend = null; OperatorStateBackend operatorStateBackend = null; CloseableIterable<KeyGroupStatePartitionStreamProvider> rawKeyedStateInputs = null; CloseableIterable<StatePartitionStreamProvider> rawOperatorStateInputs = null; InternalTimeServiceManager<?> timeServiceManager; try { // -------------- Keyed State Backend -------------- keyedStatedBackend = keyedStatedBackend( keySerializer, operatorIdentifierText, prioritizedOperatorSubtaskStates, streamTaskCloseableRegistry, metricGroup); // -------------- Operator State Backend -------------- operatorStateBackend = operatorStateBackend( operatorIdentifierText, prioritizedOperatorSubtaskStates, streamTaskCloseableRegistry); // -------------- Raw State Streams -------------- rawKeyedStateInputs = rawKeyedStateInputs( prioritizedOperatorSubtaskStates.getPrioritizedRawKeyedState().iterator()); streamTaskCloseableRegistry.registerCloseable(rawKeyedStateInputs); rawOperatorStateInputs = rawOperatorStateInputs( prioritizedOperatorSubtaskStates.getPrioritizedRawOperatorState().iterator()); streamTaskCloseableRegistry.registerCloseable(rawOperatorStateInputs); // -------------- Internal Timer Service Manager -------------- timeServiceManager = internalTimeServiceManager(keyedStatedBackend, keyContext, rawKeyedStateInputs); // -------------- Preparing return value -------------- return new StreamOperatorStateContextImpl( prioritizedOperatorSubtaskStates.isRestored(), operatorStateBackend, keyedStatedBackend, timeServiceManager, rawOperatorStateInputs, rawKeyedStateInputs); } catch (Exception ex) { // cleanup if something went wrong before results got published. if (keyedStatedBackend != null) { if (streamTaskCloseableRegistry.unregisterCloseable(keyedStatedBackend)) { IOUtils.closeQuietly(keyedStatedBackend); } // release resource (e.g native resource) keyedStatedBackend.dispose(); } if (operatorStateBackend != null) { if (streamTaskCloseableRegistry.unregisterCloseable(operatorStateBackend)) { IOUtils.closeQuietly(operatorStateBackend); } operatorStateBackend.dispose(); } if (streamTaskCloseableRegistry.unregisterCloseable(rawKeyedStateInputs)) { IOUtils.closeQuietly(rawKeyedStateInputs); } if (streamTaskCloseableRegistry.unregisterCloseable(rawOperatorStateInputs)) { IOUtils.closeQuietly(rawOperatorStateInputs); } throw new Exception("Exception while creating StreamOperatorStateContext.", ex); } }
[ "@", "Override", "public", "StreamOperatorStateContext", "streamOperatorStateContext", "(", "@", "Nonnull", "OperatorID", "operatorID", ",", "@", "Nonnull", "String", "operatorClassName", ",", "@", "Nonnull", "KeyContext", "keyContext", ",", "@", "Nullable", "TypeSerial...
-----------------------------------------------------------------------------------------------------------------
[ "-----------------------------------------------------------------------------------------------------------------" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/StreamTaskStateInitializerImpl.java#L104-L197
train
This method is used to create a StreamOperatorStateContext object.
[ 30522, 1030, 2058, 15637, 2270, 5460, 25918, 18926, 12259, 8663, 18209, 5460, 25918, 30524, 3593, 6872, 3593, 1010, 1030, 2512, 11231, 3363, 5164, 6872, 26266, 18442, 1010, 1030, 2512, 11231, 3363, 3145, 8663, 18209, 3145, 8663, 18209, 1010, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java
TransportChannelHandler.acceptInboundMessage
@Override public boolean acceptInboundMessage(Object msg) throws Exception { if (msg instanceof ChunkFetchRequest) { return false; } else { return super.acceptInboundMessage(msg); } }
java
@Override public boolean acceptInboundMessage(Object msg) throws Exception { if (msg instanceof ChunkFetchRequest) { return false; } else { return super.acceptInboundMessage(msg); } }
[ "@", "Override", "public", "boolean", "acceptInboundMessage", "(", "Object", "msg", ")", "throws", "Exception", "{", "if", "(", "msg", "instanceof", "ChunkFetchRequest", ")", "{", "return", "false", ";", "}", "else", "{", "return", "super", ".", "acceptInbound...
Overwrite acceptInboundMessage to properly delegate ChunkFetchRequest messages to ChunkFetchRequestHandler.
[ "Overwrite", "acceptInboundMessage", "to", "properly", "delegate", "ChunkFetchRequest", "messages", "to", "ChunkFetchRequestHandler", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java#L125-L132
train
Override acceptInboundMessage to allow ChunkFetchRequest objects.
[ 30522, 1030, 2058, 15637, 2270, 22017, 20898, 5138, 2378, 15494, 7834, 3736, 3351, 1006, 4874, 5796, 2290, 1007, 11618, 6453, 1063, 2065, 1006, 5796, 2290, 6013, 11253, 20000, 7959, 10649, 2890, 15500, 1007, 1063, 2709, 6270, 1025, 1065, 28...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.respond
ServerResponse respond(ClientChallenge clientChallenge) throws GeneralSecurityException { SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, clientChallenge.nonce, clientChallenge.keyLength); initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey); byte[] challenge = validateChallenge(clientChallenge.nonce, clientChallenge.challenge); byte[] response = challenge(appId, clientChallenge.nonce, rawResponse(challenge)); byte[] sessionNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE); byte[] inputIv = randomBytes(conf.ivLength()); byte[] outputIv = randomBytes(conf.ivLength()); SecretKeySpec sessionKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, sessionNonce, clientChallenge.keyLength); this.sessionCipher = new TransportCipher(cryptoConf, clientChallenge.cipher, sessionKey, inputIv, outputIv); // Note the IVs are swapped in the response. return new ServerResponse(response, encrypt(sessionNonce), encrypt(outputIv), encrypt(inputIv)); }
java
ServerResponse respond(ClientChallenge clientChallenge) throws GeneralSecurityException { SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, clientChallenge.nonce, clientChallenge.keyLength); initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey); byte[] challenge = validateChallenge(clientChallenge.nonce, clientChallenge.challenge); byte[] response = challenge(appId, clientChallenge.nonce, rawResponse(challenge)); byte[] sessionNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE); byte[] inputIv = randomBytes(conf.ivLength()); byte[] outputIv = randomBytes(conf.ivLength()); SecretKeySpec sessionKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, sessionNonce, clientChallenge.keyLength); this.sessionCipher = new TransportCipher(cryptoConf, clientChallenge.cipher, sessionKey, inputIv, outputIv); // Note the IVs are swapped in the response. return new ServerResponse(response, encrypt(sessionNonce), encrypt(outputIv), encrypt(inputIv)); }
[ "ServerResponse", "respond", "(", "ClientChallenge", "clientChallenge", ")", "throws", "GeneralSecurityException", "{", "SecretKeySpec", "authKey", "=", "generateKey", "(", "clientChallenge", ".", "kdf", ",", "clientChallenge", ".", "iterations", ",", "clientChallenge", ...
Validates the client challenge, and create the encryption backend for the channel from the parameters sent by the client. @param clientChallenge The challenge from the client. @return A response to be sent to the client.
[ "Validates", "the", "client", "challenge", "and", "create", "the", "encryption", "backend", "for", "the", "channel", "from", "the", "parameters", "sent", "by", "the", "client", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L107-L127
train
respond to the server
[ 30522, 8241, 6072, 26029, 3366, 6869, 1006, 7396, 18598, 7770, 3351, 7396, 18598, 7770, 3351, 1007, 11618, 11593, 8586, 25137, 10288, 24422, 1063, 3595, 14839, 13102, 8586, 8740, 2705, 14839, 1027, 9699, 14839, 1006, 7396, 18598, 7770, 3351, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java
SM2Engine.kdf
private void kdf(ECPoint c1, byte[] encData) { final Digest digest = this.digest; int digestSize = digest.getDigestSize(); byte[] buf = new byte[Math.max(4, digestSize)]; int off = 0; Memoable memo = null; Memoable copy = null; if (digest instanceof Memoable) { addFieldElement(c1.getAffineXCoord()); addFieldElement(c1.getAffineYCoord()); memo = (Memoable) digest; copy = memo.copy(); } int ct = 0; while (off < encData.length) { if (memo != null) { memo.reset(copy); } else { addFieldElement(c1.getAffineXCoord()); addFieldElement(c1.getAffineYCoord()); } Pack.intToBigEndian(++ct, buf, 0); digest.update(buf, 0, 4); digest.doFinal(buf, 0); int xorLen = Math.min(digestSize, encData.length - off); xor(encData, buf, off, xorLen); off += xorLen; } }
java
private void kdf(ECPoint c1, byte[] encData) { final Digest digest = this.digest; int digestSize = digest.getDigestSize(); byte[] buf = new byte[Math.max(4, digestSize)]; int off = 0; Memoable memo = null; Memoable copy = null; if (digest instanceof Memoable) { addFieldElement(c1.getAffineXCoord()); addFieldElement(c1.getAffineYCoord()); memo = (Memoable) digest; copy = memo.copy(); } int ct = 0; while (off < encData.length) { if (memo != null) { memo.reset(copy); } else { addFieldElement(c1.getAffineXCoord()); addFieldElement(c1.getAffineYCoord()); } Pack.intToBigEndian(++ct, buf, 0); digest.update(buf, 0, 4); digest.doFinal(buf, 0); int xorLen = Math.min(digestSize, encData.length - off); xor(encData, buf, off, xorLen); off += xorLen; } }
[ "private", "void", "kdf", "(", "ECPoint", "c1", ",", "byte", "[", "]", "encData", ")", "{", "final", "Digest", "digest", "=", "this", ".", "digest", ";", "int", "digestSize", "=", "digest", ".", "getDigestSize", "(", ")", ";", "byte", "[", "]", "buf"...
解密数据 @param c1 c1点 @param encData 密文
[ "解密数据" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2Engine.java#L282-L316
train
Creates a new byte array containing the data of the ECPoint c1 and encData.
[ 30522, 2797, 11675, 1047, 20952, 1006, 14925, 8400, 27723, 1010, 24880, 1031, 1033, 4372, 19797, 6790, 1007, 1063, 2345, 17886, 17886, 1027, 2023, 1012, 17886, 1025, 20014, 17886, 5332, 4371, 1027, 17886, 1012, 2131, 4305, 8449, 3215, 4697, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/HanLP.java
HanLP.extractWords
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
java
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
[ "public", "static", "List", "<", "WordInfo", ">", "extractWords", "(", "String", "text", ",", "int", "size", ",", "boolean", "newWordsOnly", ")", "{", "NewWordDiscover", "discover", "=", "new", "NewWordDiscover", "(", "4", ",", "0.0f", ",", ".5f", ",", "10...
提取词语(新词发现) @param text 大文本 @param size 需要提取词语的数量 @param newWordsOnly 是否只提取词典中没有的词语 @return 一个词语列表
[ "提取词语(新词发现)" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L757-L761
train
Extract words from a text string.
[ 30522, 2270, 10763, 2862, 1026, 2773, 2378, 14876, 1028, 14817, 22104, 1006, 5164, 3793, 1010, 20014, 2946, 1010, 22017, 20898, 2047, 22104, 2239, 2135, 1007, 1063, 2047, 18351, 10521, 3597, 6299, 7523, 1027, 2047, 2047, 18351, 10521, 3597, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/ExecutionEnvironment.java
ExecutionEnvironment.fromCollection
public <X> DataSource<X> fromCollection(Collection<X> data) { if (data == null) { throw new IllegalArgumentException("The data must not be null."); } if (data.size() == 0) { throw new IllegalArgumentException("The size of the collection must not be empty."); } X firstValue = data.iterator().next(); TypeInformation<X> type = TypeExtractor.getForObject(firstValue); CollectionInputFormat.checkCollection(data, type.getTypeClass()); return new DataSource<>(this, new CollectionInputFormat<>(data, type.createSerializer(config)), type, Utils.getCallLocationName()); }
java
public <X> DataSource<X> fromCollection(Collection<X> data) { if (data == null) { throw new IllegalArgumentException("The data must not be null."); } if (data.size() == 0) { throw new IllegalArgumentException("The size of the collection must not be empty."); } X firstValue = data.iterator().next(); TypeInformation<X> type = TypeExtractor.getForObject(firstValue); CollectionInputFormat.checkCollection(data, type.getTypeClass()); return new DataSource<>(this, new CollectionInputFormat<>(data, type.createSerializer(config)), type, Utils.getCallLocationName()); }
[ "public", "<", "X", ">", "DataSource", "<", "X", ">", "fromCollection", "(", "Collection", "<", "X", ">", "data", ")", "{", "if", "(", "data", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The data must not be null.\"", ")", "...
Creates a DataSet from the given non-empty collection. The type of the data set is that of the elements in the collection. <p>The framework will try and determine the exact type from the collection elements. In case of generic elements, it may be necessary to manually supply the type information via {@link #fromCollection(Collection, TypeInformation)}. <p>Note that this operation will result in a non-parallel data source, i.e. a data source with a parallelism of one. @param data The collection of elements to create the data set from. @return A DataSet representing the given collection. @see #fromCollection(Collection, TypeInformation)
[ "Creates", "a", "DataSet", "from", "the", "given", "non", "-", "empty", "collection", ".", "The", "type", "of", "the", "data", "set", "is", "that", "of", "the", "elements", "in", "the", "collection", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L602-L615
train
Creates a data source from a collection of objects.
[ 30522, 2270, 1026, 1060, 1028, 2951, 6499, 3126, 3401, 1026, 1060, 1028, 2013, 26895, 18491, 1006, 3074, 1026, 1060, 1028, 2951, 1007, 1063, 2065, 1006, 2951, 1027, 1027, 19701, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
networknt/light-4j
handler/src/main/java/com/networknt/handler/Handler.java
Handler.registerMiddlewareHandler
private static void registerMiddlewareHandler(Object handler) { if(handler instanceof MiddlewareHandler) { // register the middleware handler if it is enabled. if(((MiddlewareHandler) handler).isEnabled()) { ((MiddlewareHandler) handler).register(); } } }
java
private static void registerMiddlewareHandler(Object handler) { if(handler instanceof MiddlewareHandler) { // register the middleware handler if it is enabled. if(((MiddlewareHandler) handler).isEnabled()) { ((MiddlewareHandler) handler).register(); } } }
[ "private", "static", "void", "registerMiddlewareHandler", "(", "Object", "handler", ")", "{", "if", "(", "handler", "instanceof", "MiddlewareHandler", ")", "{", "// register the middleware handler if it is enabled.", "if", "(", "(", "(", "MiddlewareHandler", ")", "handl...
Detect if the handler is a MiddlewareHandler instance. If yes, then register it. @param handler
[ "Detect", "if", "the", "handler", "is", "a", "MiddlewareHandler", "instance", ".", "If", "yes", "then", "register", "it", "." ]
2a60257c60663684c8f6dc8b5ea3cf184e534db6
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/handler/src/main/java/com/networknt/handler/Handler.java#L394-L401
train
Register the middleware handler if it is a MiddlewareHandler.
[ 30522, 2797, 10763, 11675, 4236, 4328, 20338, 8059, 11774, 3917, 1006, 4874, 28213, 1007, 1063, 2065, 1006, 28213, 6013, 11253, 2690, 8059, 11774, 3917, 1007, 1063, 1013, 1013, 4236, 1996, 2690, 8059, 28213, 2065, 2009, 2003, 9124, 1012, 20...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-opentracing/src/main/java/org/apache/shardingsphere/opentracing/ShardingTracer.java
ShardingTracer.init
public static void init() { String tracerClassName = System.getProperty(OPENTRACING_TRACER_CLASS_NAME); Preconditions.checkNotNull(tracerClassName, "Can not find opentracing tracer implementation class via system property `%s`", OPENTRACING_TRACER_CLASS_NAME); try { init((Tracer) Class.forName(tracerClassName).newInstance()); } catch (final ReflectiveOperationException ex) { throw new ShardingException("Initialize opentracing tracer class failure.", ex); } }
java
public static void init() { String tracerClassName = System.getProperty(OPENTRACING_TRACER_CLASS_NAME); Preconditions.checkNotNull(tracerClassName, "Can not find opentracing tracer implementation class via system property `%s`", OPENTRACING_TRACER_CLASS_NAME); try { init((Tracer) Class.forName(tracerClassName).newInstance()); } catch (final ReflectiveOperationException ex) { throw new ShardingException("Initialize opentracing tracer class failure.", ex); } }
[ "public", "static", "void", "init", "(", ")", "{", "String", "tracerClassName", "=", "System", ".", "getProperty", "(", "OPENTRACING_TRACER_CLASS_NAME", ")", ";", "Preconditions", ".", "checkNotNull", "(", "tracerClassName", ",", "\"Can not find opentracing tracer imple...
Initialize sharding tracer.
[ "Initialize", "sharding", "tracer", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-opentracing/src/main/java/org/apache/shardingsphere/opentracing/ShardingTracer.java#L41-L49
train
Initialize the session tracer.
[ 30522, 2270, 10763, 11675, 1999, 4183, 1006, 1007, 1063, 5164, 7637, 11890, 27102, 18442, 1027, 2291, 1012, 2131, 21572, 4842, 3723, 1006, 2330, 6494, 6129, 1035, 7637, 2099, 1035, 2465, 1035, 2171, 1007, 1025, 3653, 8663, 20562, 2015, 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/collection/CollUtil.java
CollUtil.sub
public static <T> List<T> sub(Collection<T> list, int start, int end, int step) { if (list == null || list.isEmpty()) { return null; } return sub(new ArrayList<T>(list), start, end, step); }
java
public static <T> List<T> sub(Collection<T> list, int start, int end, int step) { if (list == null || list.isEmpty()) { return null; } return sub(new ArrayList<T>(list), start, end, step); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "sub", "(", "Collection", "<", "T", ">", "list", ",", "int", "start", ",", "int", "end", ",", "int", "step", ")", "{", "if", "(", "list", "==", "null", "||", "list", ".", "isEmpty", "(",...
截取集合的部分 @param <T> 集合元素类型 @param list 被截取的数组 @param start 开始位置(包含) @param end 结束位置(不包含) @param step 步进 @return 截取后的数组,当开始位置超过最大时,返回空集合 @since 4.0.6
[ "截取集合的部分" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L891-L897
train
Returns a list of elements from the given list starting at the given index and ending at the given step.
[ 30522, 2270, 10763, 1026, 1056, 1028, 2862, 1026, 1056, 1028, 4942, 1006, 3074, 1026, 1056, 1028, 2862, 1010, 20014, 2707, 1010, 20014, 2203, 1010, 20014, 3357, 1007, 1063, 2065, 1006, 2862, 1027, 1027, 19701, 1064, 1064, 2862, 1012, 2003, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateModifier.java
DateModifier.modifyField
private static void modifyField(Calendar calendar, int field, ModifyType modifyType) { // Console.log("# {} {}", DateField.of(field), calendar.getActualMinimum(field)); switch (modifyType) { case TRUNCATE: calendar.set(field, DateUtil.getBeginValue(calendar, field)); break; case CEILING: calendar.set(field, DateUtil.getEndValue(calendar, field)); break; case ROUND: int min = DateUtil.getBeginValue(calendar, field); int max = DateUtil.getEndValue(calendar, field); int href; if (Calendar.DAY_OF_WEEK == field) { // 星期特殊处理,假设周一是第一天,中间的为周四 href = (min + 3) % 7; } else { href = (max - min) / 2 + 1; } int value = calendar.get(field); calendar.set(field, (value < href) ? min : max); break; } }
java
private static void modifyField(Calendar calendar, int field, ModifyType modifyType) { // Console.log("# {} {}", DateField.of(field), calendar.getActualMinimum(field)); switch (modifyType) { case TRUNCATE: calendar.set(field, DateUtil.getBeginValue(calendar, field)); break; case CEILING: calendar.set(field, DateUtil.getEndValue(calendar, field)); break; case ROUND: int min = DateUtil.getBeginValue(calendar, field); int max = DateUtil.getEndValue(calendar, field); int href; if (Calendar.DAY_OF_WEEK == field) { // 星期特殊处理,假设周一是第一天,中间的为周四 href = (min + 3) % 7; } else { href = (max - min) / 2 + 1; } int value = calendar.get(field); calendar.set(field, (value < href) ? min : max); break; } }
[ "private", "static", "void", "modifyField", "(", "Calendar", "calendar", ",", "int", "field", ",", "ModifyType", "modifyType", ")", "{", "// Console.log(\"# {} {}\", DateField.of(field), calendar.getActualMinimum(field));\r", "switch", "(", "modifyType", ")", "{", "case", ...
修改日期字段值 @param calendar {@link Calendar} @param field 字段,见{@link Calendar} @param modifyType {@link ModifyType}
[ "修改日期字段值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateModifier.java#L98-L121
train
Method to modify the specified calendar field with the specified modify type.
[ 30522, 2797, 10763, 11675, 19933, 3790, 1006, 8094, 8094, 1010, 20014, 2492, 1010, 19933, 13874, 19933, 13874, 1007, 1063, 1013, 1013, 10122, 1012, 8833, 1006, 1000, 1001, 1063, 1065, 1063, 1065, 1000, 1010, 3058, 3790, 1012, 1997, 1006, 24...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.pressImage
public static void pressImage(File srcImageFile, File destImageFile, Image pressImg, int x, int y, float alpha) { pressImage(read(srcImageFile), destImageFile, pressImg, x, y, alpha); }
java
public static void pressImage(File srcImageFile, File destImageFile, Image pressImg, int x, int y, float alpha) { pressImage(read(srcImageFile), destImageFile, pressImg, x, y, alpha); }
[ "public", "static", "void", "pressImage", "(", "File", "srcImageFile", ",", "File", "destImageFile", ",", "Image", "pressImg", ",", "int", "x", ",", "int", "y", ",", "float", "alpha", ")", "{", "pressImage", "(", "read", "(", "srcImageFile", ")", ",", "d...
给图片添加图片水印 @param srcImageFile 源图像文件 @param destImageFile 目标图像文件 @param pressImg 水印图片 @param x 修正值。 默认在中间,偏移量相对于中间偏移 @param y 修正值。 默认在中间,偏移量相对于中间偏移 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字
[ "给图片添加图片水印" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L876-L878
train
Press image from srcImageFile to destImageFile.
[ 30522, 2270, 10763, 11675, 2811, 9581, 3351, 1006, 5371, 5034, 6895, 26860, 8873, 2571, 1010, 5371, 4078, 3775, 26860, 8873, 2571, 1010, 3746, 2811, 5714, 2290, 1010, 20014, 1060, 1010, 20014, 1061, 1010, 14257, 6541, 1007, 1063, 2811, 9581...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
DateTimeUtils.parsePrecisionDateTimeLiteral
public static PrecisionTime parsePrecisionDateTimeLiteral(String s, DateFormat dateFormat, TimeZone tz, int maxPrecision) { final ParsePosition pp = new ParsePosition(0); final Calendar cal = parseDateFormat(s, dateFormat, tz, pp); if (cal == null) { return null; // Invalid date/time format } // Note: the Java SimpleDateFormat 'S' treats any number after // the decimal as milliseconds. That means 12:00:00.9 has 9 // milliseconds and 12:00:00.9999 has 9999 milliseconds. int p = 0; String secFraction = ""; if (pp.getIndex() < s.length()) { // Check to see if rest is decimal portion if (s.charAt(pp.getIndex()) != '.') { return null; } // Skip decimal sign pp.setIndex(pp.getIndex() + 1); // Parse decimal portion if (pp.getIndex() < s.length()) { secFraction = s.substring(pp.getIndex()); if (!secFraction.matches("\\d+")) { return null; } NumberFormat nf = NumberFormat.getIntegerInstance(Locale.ROOT); Number num = nf.parse(s, pp); if ((num == null) || (pp.getIndex() != s.length())) { // Invalid decimal portion return null; } // Determine precision - only support prec 3 or lower // (milliseconds) Higher precisions are quietly rounded away p = secFraction.length(); if (maxPrecision >= 0) { // If there is a maximum precision, ignore subsequent digits p = Math.min(maxPrecision, p); secFraction = secFraction.substring(0, p); } // Calculate milliseconds String millis = secFraction; if (millis.length() > 3) { millis = secFraction.substring(0, 3); } while (millis.length() < 3) { millis = millis + "0"; } int ms = Integer.valueOf(millis); cal.add(Calendar.MILLISECOND, ms); } } assert pp.getIndex() == s.length(); return new PrecisionTime(cal, secFraction, p); }
java
public static PrecisionTime parsePrecisionDateTimeLiteral(String s, DateFormat dateFormat, TimeZone tz, int maxPrecision) { final ParsePosition pp = new ParsePosition(0); final Calendar cal = parseDateFormat(s, dateFormat, tz, pp); if (cal == null) { return null; // Invalid date/time format } // Note: the Java SimpleDateFormat 'S' treats any number after // the decimal as milliseconds. That means 12:00:00.9 has 9 // milliseconds and 12:00:00.9999 has 9999 milliseconds. int p = 0; String secFraction = ""; if (pp.getIndex() < s.length()) { // Check to see if rest is decimal portion if (s.charAt(pp.getIndex()) != '.') { return null; } // Skip decimal sign pp.setIndex(pp.getIndex() + 1); // Parse decimal portion if (pp.getIndex() < s.length()) { secFraction = s.substring(pp.getIndex()); if (!secFraction.matches("\\d+")) { return null; } NumberFormat nf = NumberFormat.getIntegerInstance(Locale.ROOT); Number num = nf.parse(s, pp); if ((num == null) || (pp.getIndex() != s.length())) { // Invalid decimal portion return null; } // Determine precision - only support prec 3 or lower // (milliseconds) Higher precisions are quietly rounded away p = secFraction.length(); if (maxPrecision >= 0) { // If there is a maximum precision, ignore subsequent digits p = Math.min(maxPrecision, p); secFraction = secFraction.substring(0, p); } // Calculate milliseconds String millis = secFraction; if (millis.length() > 3) { millis = secFraction.substring(0, 3); } while (millis.length() < 3) { millis = millis + "0"; } int ms = Integer.valueOf(millis); cal.add(Calendar.MILLISECOND, ms); } } assert pp.getIndex() == s.length(); return new PrecisionTime(cal, secFraction, p); }
[ "public", "static", "PrecisionTime", "parsePrecisionDateTimeLiteral", "(", "String", "s", ",", "DateFormat", "dateFormat", ",", "TimeZone", "tz", ",", "int", "maxPrecision", ")", "{", "final", "ParsePosition", "pp", "=", "new", "ParsePosition", "(", "0", ")", ";...
Parses a string using {@link SimpleDateFormat} and a given pattern, and if present, parses a fractional seconds component. The fractional seconds component must begin with a decimal point ('.') followed by numeric digits. The precision is rounded to a maximum of 3 digits of fractional seconds precision (to obtain milliseconds). @param s string to be parsed @param dateFormat Date format @param tz time zone in which to interpret string. Defaults to the local time zone @return a {@link DateTimeUtils.PrecisionTime PrecisionTime} initialized with the parsed value, or null if parsing failed. The PrecisionTime contains a GMT Calendar and a precision.
[ "Parses", "a", "string", "using", "{", "@link", "SimpleDateFormat", "}", "and", "a", "given", "pattern", "and", "if", "present", "parses", "a", "fractional", "seconds", "component", ".", "The", "fractional", "seconds", "component", "must", "begin", "with", "a"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L218-L278
train
Parse a date time literal.
[ 30522, 2270, 10763, 11718, 7292, 11968, 3366, 28139, 28472, 13701, 7292, 22779, 7941, 1006, 5164, 1055, 1010, 3058, 14192, 4017, 3058, 14192, 4017, 1010, 2051, 15975, 1056, 2480, 1010, 20014, 4098, 28139, 28472, 1007, 1063, 2345, 11968, 3366,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/Segment.java
Segment.quickAtomSegment
protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, int end) { List<AtomNode> atomNodeList = new LinkedList<AtomNode>(); int offsetAtom = start; int preType = CharType.get(charArray[offsetAtom]); int curType; while (++offsetAtom < end) { curType = CharType.get(charArray[offsetAtom]); if (curType != preType) { // 浮点数识别 if (preType == CharType.CT_NUM && ",,..".indexOf(charArray[offsetAtom]) != -1) { if (offsetAtom+1 < end) { int nextType = CharType.get(charArray[offsetAtom+1]); if (nextType == CharType.CT_NUM) { continue; } } } atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType)); start = offsetAtom; } preType = curType; } if (offsetAtom == end) atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType)); return atomNodeList; }
java
protected static List<AtomNode> quickAtomSegment(char[] charArray, int start, int end) { List<AtomNode> atomNodeList = new LinkedList<AtomNode>(); int offsetAtom = start; int preType = CharType.get(charArray[offsetAtom]); int curType; while (++offsetAtom < end) { curType = CharType.get(charArray[offsetAtom]); if (curType != preType) { // 浮点数识别 if (preType == CharType.CT_NUM && ",,..".indexOf(charArray[offsetAtom]) != -1) { if (offsetAtom+1 < end) { int nextType = CharType.get(charArray[offsetAtom+1]); if (nextType == CharType.CT_NUM) { continue; } } } atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType)); start = offsetAtom; } preType = curType; } if (offsetAtom == end) atomNodeList.add(new AtomNode(new String(charArray, start, offsetAtom - start), preType)); return atomNodeList; }
[ "protected", "static", "List", "<", "AtomNode", ">", "quickAtomSegment", "(", "char", "[", "]", "charArray", ",", "int", "start", ",", "int", "end", ")", "{", "List", "<", "AtomNode", ">", "atomNodeList", "=", "new", "LinkedList", "<", "AtomNode", ">", "...
快速原子分词,希望用这个方法替换掉原来缓慢的方法 @param charArray @param start @param end @return
[ "快速原子分词,希望用这个方法替换掉原来缓慢的方法" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/Segment.java#L158-L190
train
quickAtomSegment This method is used to get a list of AtomNodes from a char array.
[ 30522, 5123, 10763, 2862, 1026, 13787, 3630, 3207, 1028, 4248, 10610, 5244, 13910, 3672, 1006, 25869, 1031, 1033, 25869, 2906, 9447, 1010, 20014, 2707, 1010, 20014, 2203, 1007, 1063, 2862, 1026, 13787, 3630, 30524, 2213, 1033, 1007, 1025, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/interactions/Actions.java
Actions.sendKeys
public Actions sendKeys(WebElement target, CharSequence... keys) { if (isBuildingActions()) { action.addAction(new SendKeysAction(jsonKeyboard, jsonMouse, (Locatable) target, keys)); } return focusInTicks(target).sendKeysInTicks(keys); }
java
public Actions sendKeys(WebElement target, CharSequence... keys) { if (isBuildingActions()) { action.addAction(new SendKeysAction(jsonKeyboard, jsonMouse, (Locatable) target, keys)); } return focusInTicks(target).sendKeysInTicks(keys); }
[ "public", "Actions", "sendKeys", "(", "WebElement", "target", ",", "CharSequence", "...", "keys", ")", "{", "if", "(", "isBuildingActions", "(", ")", ")", "{", "action", ".", "addAction", "(", "new", "SendKeysAction", "(", "jsonKeyboard", ",", "jsonMouse", "...
Equivalent to calling: <i>Actions.click(element).sendKeys(keysToSend).</i> This method is different from {@link WebElement#sendKeys(CharSequence...)} - see {@link #sendKeys(CharSequence...)} for details how. @see #sendKeys(java.lang.CharSequence[]) @param target element to focus on. @param keys The keys. @return A self reference. @throws IllegalArgumentException if keys is null
[ "Equivalent", "to", "calling", ":", "<i", ">", "Actions", ".", "click", "(", "element", ")", ".", "sendKeys", "(", "keysToSend", ")", ".", "<", "/", "i", ">", "This", "method", "is", "different", "from", "{", "@link", "WebElement#sendKeys", "(", "CharSeq...
7af172729f17b20269c8ca4ea6f788db48616535
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L183-L189
train
Sends the given keys to the element.
[ 30522, 2270, 4506, 4604, 14839, 2015, 1006, 4773, 12260, 3672, 4539, 1010, 25869, 3366, 4226, 5897, 1012, 1012, 1012, 6309, 1007, 1063, 2065, 1006, 2003, 25820, 18908, 8496, 1006, 1007, 1007, 1063, 2895, 1012, 5587, 18908, 3258, 1006, 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...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.file
public static File file(File directory, String... names) { Assert.notNull(directory, "directorydirectory must not be null"); if (ArrayUtil.isEmpty(names)) { return directory; } File file = directory; for (String name : names) { if (null != name) { file = file(file, name); } } return file; }
java
public static File file(File directory, String... names) { Assert.notNull(directory, "directorydirectory must not be null"); if (ArrayUtil.isEmpty(names)) { return directory; } File file = directory; for (String name : names) { if (null != name) { file = file(file, name); } } return file; }
[ "public", "static", "File", "file", "(", "File", "directory", ",", "String", "...", "names", ")", "{", "Assert", ".", "notNull", "(", "directory", ",", "\"directorydirectory must not be null\"", ")", ";", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "names", ...
通过多层目录参数创建文件<br> 此方法会检查slip漏洞,漏洞说明见http://blog.nsfocus.net/zip-slip-2/ @param directory 父目录 @param names 元素名(多层目录名) @return the file 文件 @since 4.0.6
[ "通过多层目录参数创建文件<br", ">", "此方法会检查slip漏洞,漏洞说明见http", ":", "//", "blog", ".", "nsfocus", ".", "net", "/", "zip", "-", "slip", "-", "2", "/" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L357-L370
train
Creates a new file from the specified directory and all of the named files.
[ 30522, 2270, 10763, 5371, 5371, 1006, 5371, 14176, 1010, 5164, 1012, 1012, 1012, 3415, 1007, 1063, 20865, 1012, 2025, 11231, 3363, 1006, 14176, 1010, 1000, 14176, 4305, 2890, 16761, 2100, 2442, 2025, 2022, 19701, 1000, 1007, 1025, 2065, 100...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
common/src/main/java/io/netty/util/DomainNameMappingBuilder.java
DomainNameMappingBuilder.add
public DomainNameMappingBuilder<V> add(String hostname, V output) { map.put(checkNotNull(hostname, "hostname"), checkNotNull(output, "output")); return this; }
java
public DomainNameMappingBuilder<V> add(String hostname, V output) { map.put(checkNotNull(hostname, "hostname"), checkNotNull(output, "output")); return this; }
[ "public", "DomainNameMappingBuilder", "<", "V", ">", "add", "(", "String", "hostname", ",", "V", "output", ")", "{", "map", ".", "put", "(", "checkNotNull", "(", "hostname", ",", "\"hostname\"", ")", ",", "checkNotNull", "(", "output", ",", "\"output\"", "...
Adds a mapping that maps the specified (optionally wildcard) host name to the specified output value. Null values are forbidden for both hostnames and values. <p> <a href="http://en.wikipedia.org/wiki/Wildcard_DNS_record">DNS wildcard</a> is supported as hostname. For example, you can use {@code *.netty.io} to match {@code netty.io} and {@code downloads.netty.io}. </p> @param hostname the host name (optionally wildcard) @param output the output value that will be returned by {@link DomainNameMapping#map(String)} when the specified host name matches the specified input host name
[ "Adds", "a", "mapping", "that", "maps", "the", "specified", "(", "optionally", "wildcard", ")", "host", "name", "to", "the", "specified", "output", "value", ".", "Null", "values", "are", "forbidden", "for", "both", "hostnames", "and", "values", ".", "<p", ...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/DomainNameMappingBuilder.java#L70-L73
train
Add a domain name mapping.
[ 30522, 2270, 5884, 18442, 2863, 14853, 8569, 23891, 2099, 1026, 1058, 1028, 5587, 1006, 5164, 3677, 18442, 1010, 1058, 6434, 1007, 1063, 4949, 1012, 2404, 1006, 4638, 17048, 11231, 3363, 1006, 3677, 18442, 1010, 1000, 3677, 18442, 1000, 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-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java
DataSetUtils.partitionByRange
public static <T, K extends Comparable<K>> PartitionOperator<T> partitionByRange(DataSet<T> input, DataDistribution distribution, KeySelector<T, K> keyExtractor) { final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, input.getType()); return new PartitionOperator<>(input, PartitionOperatorBase.PartitionMethod.RANGE, new Keys.SelectorFunctionKeys<>(input.clean(keyExtractor), input.getType(), keyType), distribution, Utils.getCallLocationName()); }
java
public static <T, K extends Comparable<K>> PartitionOperator<T> partitionByRange(DataSet<T> input, DataDistribution distribution, KeySelector<T, K> keyExtractor) { final TypeInformation<K> keyType = TypeExtractor.getKeySelectorTypes(keyExtractor, input.getType()); return new PartitionOperator<>(input, PartitionOperatorBase.PartitionMethod.RANGE, new Keys.SelectorFunctionKeys<>(input.clean(keyExtractor), input.getType(), keyType), distribution, Utils.getCallLocationName()); }
[ "public", "static", "<", "T", ",", "K", "extends", "Comparable", "<", "K", ">", ">", "PartitionOperator", "<", "T", ">", "partitionByRange", "(", "DataSet", "<", "T", ">", "input", ",", "DataDistribution", "distribution", ",", "KeySelector", "<", "T", ",",...
Range-partitions a DataSet using the specified key selector function.
[ "Range", "-", "partitions", "a", "DataSet", "using", "the", "specified", "key", "selector", "function", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java#L287-L290
train
Partitions a DataSet by range.
[ 30522, 2270, 10763, 1026, 1056, 1010, 1047, 8908, 12435, 1026, 1047, 1028, 1028, 13571, 25918, 8844, 1026, 1056, 1028, 13571, 3762, 24388, 2063, 1006, 2951, 13462, 1026, 1056, 1028, 7953, 1010, 2951, 10521, 18886, 29446, 4353, 1010, 6309, 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-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.getDistinctEdgeIntersection
private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
java
private DataSet<Edge<K, EV>> getDistinctEdgeIntersection(DataSet<Edge<K, EV>> edges) { return this.getEdges() .join(edges) .where(0, 1, 2) .equalTo(0, 1, 2) .with(new JoinFunction<Edge<K, EV>, Edge<K, EV>, Edge<K, EV>>() { @Override public Edge<K, EV> join(Edge<K, EV> first, Edge<K, EV> second) throws Exception { return first; } }).withForwardedFieldsFirst("*").name("Intersect edges") .distinct() .name("Edges"); }
[ "private", "DataSet", "<", "Edge", "<", "K", ",", "EV", ">", ">", "getDistinctEdgeIntersection", "(", "DataSet", "<", "Edge", "<", "K", ",", "EV", ">", ">", "edges", ")", "{", "return", "this", ".", "getEdges", "(", ")", ".", "join", "(", "edges", ...
Computes the intersection between the edge set and the given edge set. For all matching pairs, only one edge will be in the resulting data set. @param edges edges to compute intersection with @return edge set containing one edge for all matching pairs of the same edge
[ "Computes", "the", "intersection", "between", "the", "edge", "set", "and", "the", "given", "edge", "set", ".", "For", "all", "matching", "pairs", "only", "one", "edge", "will", "be", "in", "the", "resulting", "data", "set", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1665-L1678
train
Get the distinct edge intersection.
[ 30522, 2797, 2951, 13462, 1026, 3341, 1026, 1047, 1010, 23408, 1028, 1028, 2131, 10521, 7629, 10985, 3351, 18447, 2545, 18491, 1006, 2951, 13462, 1026, 3341, 1026, 1047, 1010, 23408, 1028, 1028, 7926, 1007, 1063, 2709, 2023, 1012, 2131, 242...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/AsciiString.java
AsciiString.split
public AsciiString[] split(char delim) { final List<AsciiString> res = InternalThreadLocalMap.get().arrayList(); int start = 0; final int length = length(); for (int i = start; i < length; i++) { if (charAt(i) == delim) { if (start == i) { res.add(EMPTY_STRING); } else { res.add(new AsciiString(value, start + arrayOffset(), i - start, false)); } start = i + 1; } } if (start == 0) { // If no delimiter was found in the value res.add(this); } else { if (start != length) { // Add the last element if it's not empty. res.add(new AsciiString(value, start + arrayOffset(), length - start, false)); } else { // Truncate trailing empty elements. for (int i = res.size() - 1; i >= 0; i--) { if (res.get(i).isEmpty()) { res.remove(i); } else { break; } } } } return res.toArray(new AsciiString[0]); }
java
public AsciiString[] split(char delim) { final List<AsciiString> res = InternalThreadLocalMap.get().arrayList(); int start = 0; final int length = length(); for (int i = start; i < length; i++) { if (charAt(i) == delim) { if (start == i) { res.add(EMPTY_STRING); } else { res.add(new AsciiString(value, start + arrayOffset(), i - start, false)); } start = i + 1; } } if (start == 0) { // If no delimiter was found in the value res.add(this); } else { if (start != length) { // Add the last element if it's not empty. res.add(new AsciiString(value, start + arrayOffset(), length - start, false)); } else { // Truncate trailing empty elements. for (int i = res.size() - 1; i >= 0; i--) { if (res.get(i).isEmpty()) { res.remove(i); } else { break; } } } } return res.toArray(new AsciiString[0]); }
[ "public", "AsciiString", "[", "]", "split", "(", "char", "delim", ")", "{", "final", "List", "<", "AsciiString", ">", "res", "=", "InternalThreadLocalMap", ".", "get", "(", ")", ".", "arrayList", "(", ")", ";", "int", "start", "=", "0", ";", "final", ...
Splits the specified {@link String} with the specified delimiter..
[ "Splits", "the", "specified", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1084-L1119
train
Split this string into an array of strings.
[ 30522, 2270, 2004, 6895, 2923, 4892, 1031, 1033, 3975, 1006, 25869, 3972, 5714, 1007, 1063, 2345, 2862, 1026, 2004, 6895, 2923, 4892, 1028, 24501, 1027, 4722, 2705, 16416, 19422, 24755, 19145, 2361, 1012, 2131, 1006, 1007, 1012, 9140, 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...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java
ClusterAnalyzer.refine_clusters
double refine_clusters(List<Cluster<K>> clusters) { double[] norms = new double[clusters.size()]; int offset = 0; for (Cluster cluster : clusters) { norms[offset++] = cluster.composite_vector().norm(); } double eval_cluster = 0.0; int loop_count = 0; while (loop_count++ < NUM_REFINE_LOOP) { List<int[]> items = new ArrayList<int[]>(documents_.size()); for (int i = 0; i < clusters.size(); i++) { for (int j = 0; j < clusters.get(i).documents().size(); j++) { items.add(new int[]{i, j}); } } Collections.shuffle(items); boolean changed = false; for (int[] item : items) { int cluster_id = item[0]; int item_id = item[1]; Cluster<K> cluster = clusters.get(cluster_id); Document<K> doc = cluster.documents().get(item_id); double value_base = refined_vector_value(cluster.composite_vector(), doc.feature(), -1); double norm_base_moved = Math.pow(norms[cluster_id], 2) + value_base; norm_base_moved = norm_base_moved > 0 ? Math.sqrt(norm_base_moved) : 0.0; double eval_max = -1.0; double norm_max = 0.0; int max_index = 0; for (int j = 0; j < clusters.size(); j++) { if (cluster_id == j) continue; Cluster<K> other = clusters.get(j); double value_target = refined_vector_value(other.composite_vector(), doc.feature(), 1); double norm_target_moved = Math.pow(norms[j], 2) + value_target; norm_target_moved = norm_target_moved > 0 ? Math.sqrt(norm_target_moved) : 0.0; double eval_moved = norm_base_moved + norm_target_moved - norms[cluster_id] - norms[j]; if (eval_max < eval_moved) { eval_max = eval_moved; norm_max = norm_target_moved; max_index = j; } } if (eval_max > 0) { eval_cluster += eval_max; clusters.get(max_index).add_document(doc); clusters.get(cluster_id).remove_document(item_id); norms[cluster_id] = norm_base_moved; norms[max_index] = norm_max; changed = true; } } if (!changed) break; for (Cluster<K> cluster : clusters) { cluster.refresh(); } } return eval_cluster; }
java
double refine_clusters(List<Cluster<K>> clusters) { double[] norms = new double[clusters.size()]; int offset = 0; for (Cluster cluster : clusters) { norms[offset++] = cluster.composite_vector().norm(); } double eval_cluster = 0.0; int loop_count = 0; while (loop_count++ < NUM_REFINE_LOOP) { List<int[]> items = new ArrayList<int[]>(documents_.size()); for (int i = 0; i < clusters.size(); i++) { for (int j = 0; j < clusters.get(i).documents().size(); j++) { items.add(new int[]{i, j}); } } Collections.shuffle(items); boolean changed = false; for (int[] item : items) { int cluster_id = item[0]; int item_id = item[1]; Cluster<K> cluster = clusters.get(cluster_id); Document<K> doc = cluster.documents().get(item_id); double value_base = refined_vector_value(cluster.composite_vector(), doc.feature(), -1); double norm_base_moved = Math.pow(norms[cluster_id], 2) + value_base; norm_base_moved = norm_base_moved > 0 ? Math.sqrt(norm_base_moved) : 0.0; double eval_max = -1.0; double norm_max = 0.0; int max_index = 0; for (int j = 0; j < clusters.size(); j++) { if (cluster_id == j) continue; Cluster<K> other = clusters.get(j); double value_target = refined_vector_value(other.composite_vector(), doc.feature(), 1); double norm_target_moved = Math.pow(norms[j], 2) + value_target; norm_target_moved = norm_target_moved > 0 ? Math.sqrt(norm_target_moved) : 0.0; double eval_moved = norm_base_moved + norm_target_moved - norms[cluster_id] - norms[j]; if (eval_max < eval_moved) { eval_max = eval_moved; norm_max = norm_target_moved; max_index = j; } } if (eval_max > 0) { eval_cluster += eval_max; clusters.get(max_index).add_document(doc); clusters.get(cluster_id).remove_document(item_id); norms[cluster_id] = norm_base_moved; norms[max_index] = norm_max; changed = true; } } if (!changed) break; for (Cluster<K> cluster : clusters) { cluster.refresh(); } } return eval_cluster; }
[ "double", "refine_clusters", "(", "List", "<", "Cluster", "<", "K", ">", ">", "clusters", ")", "{", "double", "[", "]", "norms", "=", "new", "double", "[", "clusters", ".", "size", "(", ")", "]", ";", "int", "offset", "=", "0", ";", "for", "(", "...
根据k-means算法迭代优化聚类 @param clusters 簇 @return 准则函数的值
[ "根据k", "-", "means算法迭代优化聚类" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/cluster/ClusterAnalyzer.java#L258-L329
train
Refines clusters.
[ 30522, 3313, 25416, 3170, 1035, 12906, 1006, 2862, 1026, 9324, 1026, 1047, 1028, 1028, 12906, 1007, 1063, 3313, 1031, 1033, 17606, 1027, 2047, 3313, 1031, 12906, 1012, 2946, 1006, 1007, 1033, 1025, 20014, 16396, 1027, 1014, 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...
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java
KafkaTableSourceBase.getKafkaConsumer
protected FlinkKafkaConsumerBase<Row> getKafkaConsumer( String topic, Properties properties, DeserializationSchema<Row> deserializationSchema) { FlinkKafkaConsumerBase<Row> kafkaConsumer = createKafkaConsumer(topic, properties, deserializationSchema); switch (startupMode) { case EARLIEST: kafkaConsumer.setStartFromEarliest(); break; case LATEST: kafkaConsumer.setStartFromLatest(); break; case GROUP_OFFSETS: kafkaConsumer.setStartFromGroupOffsets(); break; case SPECIFIC_OFFSETS: kafkaConsumer.setStartFromSpecificOffsets(specificStartupOffsets); break; } return kafkaConsumer; }
java
protected FlinkKafkaConsumerBase<Row> getKafkaConsumer( String topic, Properties properties, DeserializationSchema<Row> deserializationSchema) { FlinkKafkaConsumerBase<Row> kafkaConsumer = createKafkaConsumer(topic, properties, deserializationSchema); switch (startupMode) { case EARLIEST: kafkaConsumer.setStartFromEarliest(); break; case LATEST: kafkaConsumer.setStartFromLatest(); break; case GROUP_OFFSETS: kafkaConsumer.setStartFromGroupOffsets(); break; case SPECIFIC_OFFSETS: kafkaConsumer.setStartFromSpecificOffsets(specificStartupOffsets); break; } return kafkaConsumer; }
[ "protected", "FlinkKafkaConsumerBase", "<", "Row", ">", "getKafkaConsumer", "(", "String", "topic", ",", "Properties", "properties", ",", "DeserializationSchema", "<", "Row", ">", "deserializationSchema", ")", "{", "FlinkKafkaConsumerBase", "<", "Row", ">", "kafkaCons...
Returns a version-specific Kafka consumer with the start position configured. @param topic Kafka topic to consume. @param properties Properties for the Kafka consumer. @param deserializationSchema Deserialization schema to use for Kafka records. @return The version-specific Kafka consumer
[ "Returns", "a", "version", "-", "specific", "Kafka", "consumer", "with", "the", "start", "position", "configured", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/KafkaTableSourceBase.java#L256-L277
train
Get a Kafka consumer.
[ 30522, 5123, 13109, 19839, 2912, 24316, 22684, 3619, 17897, 28483, 3366, 1026, 5216, 1028, 2131, 2912, 24316, 22684, 3619, 17897, 2099, 1006, 5164, 8476, 1010, 5144, 5144, 1010, 4078, 11610, 22731, 22842, 2863, 1026, 5216, 1028, 4078, 11610, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java
WebSocketClientHandshaker.handshake
public final ChannelFuture handshake(Channel channel, final ChannelPromise promise) { FullHttpRequest request = newHandshakeRequest(); HttpResponseDecoder decoder = channel.pipeline().get(HttpResponseDecoder.class); if (decoder == null) { HttpClientCodec codec = channel.pipeline().get(HttpClientCodec.class); if (codec == null) { promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " + "a HttpResponseDecoder or HttpClientCodec")); return promise; } } channel.writeAndFlush(request).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { ChannelPipeline p = future.channel().pipeline(); ChannelHandlerContext ctx = p.context(HttpRequestEncoder.class); if (ctx == null) { ctx = p.context(HttpClientCodec.class); } if (ctx == null) { promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " + "a HttpRequestEncoder or HttpClientCodec")); return; } p.addAfter(ctx.name(), "ws-encoder", newWebSocketEncoder()); promise.setSuccess(); } else { promise.setFailure(future.cause()); } } }); return promise; }
java
public final ChannelFuture handshake(Channel channel, final ChannelPromise promise) { FullHttpRequest request = newHandshakeRequest(); HttpResponseDecoder decoder = channel.pipeline().get(HttpResponseDecoder.class); if (decoder == null) { HttpClientCodec codec = channel.pipeline().get(HttpClientCodec.class); if (codec == null) { promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " + "a HttpResponseDecoder or HttpClientCodec")); return promise; } } channel.writeAndFlush(request).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) { if (future.isSuccess()) { ChannelPipeline p = future.channel().pipeline(); ChannelHandlerContext ctx = p.context(HttpRequestEncoder.class); if (ctx == null) { ctx = p.context(HttpClientCodec.class); } if (ctx == null) { promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " + "a HttpRequestEncoder or HttpClientCodec")); return; } p.addAfter(ctx.name(), "ws-encoder", newWebSocketEncoder()); promise.setSuccess(); } else { promise.setFailure(future.cause()); } } }); return promise; }
[ "public", "final", "ChannelFuture", "handshake", "(", "Channel", "channel", ",", "final", "ChannelPromise", "promise", ")", "{", "FullHttpRequest", "request", "=", "newHandshakeRequest", "(", ")", ";", "HttpResponseDecoder", "decoder", "=", "channel", ".", "pipeline...
Begins the opening handshake @param channel Channel @param promise the {@link ChannelPromise} to be notified when the opening handshake is sent
[ "Begins", "the", "opening", "handshake" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L224-L260
train
Perform a HTTP handshake.
[ 30522, 2270, 2345, 3149, 11263, 11244, 2398, 20459, 2063, 1006, 3149, 3149, 1010, 2345, 3149, 21572, 28732, 4872, 1007, 1063, 2440, 11039, 25856, 2890, 15500, 5227, 1027, 2047, 11774, 7377, 5484, 2063, 15500, 1006, 1007, 1025, 8299, 6072, 2...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java
TableRule.getActualDatasourceNames
public Collection<String> getActualDatasourceNames() { Collection<String> result = new LinkedHashSet<>(actualDataNodes.size()); for (DataNode each : actualDataNodes) { result.add(each.getDataSourceName()); } return result; }
java
public Collection<String> getActualDatasourceNames() { Collection<String> result = new LinkedHashSet<>(actualDataNodes.size()); for (DataNode each : actualDataNodes) { result.add(each.getDataSourceName()); } return result; }
[ "public", "Collection", "<", "String", ">", "getActualDatasourceNames", "(", ")", "{", "Collection", "<", "String", ">", "result", "=", "new", "LinkedHashSet", "<>", "(", "actualDataNodes", ".", "size", "(", ")", ")", ";", "for", "(", "DataNode", "each", "...
Get actual data source names. @return actual data source names
[ "Get", "actual", "data", "source", "names", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/TableRule.java#L184-L190
train
Get actual datasource names.
[ 30522, 2270, 3074, 1026, 5164, 1028, 2131, 18908, 8787, 2850, 10230, 8162, 27524, 14074, 2015, 1006, 1007, 1063, 3074, 1026, 5164, 1028, 2765, 1027, 2047, 5799, 14949, 7898, 3388, 1026, 1028, 1006, 5025, 2850, 5794, 19847, 1012, 2946, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.draw
private static BufferedImage draw(BufferedImage backgroundImg, Image img, Rectangle rectangle, float alpha) { final Graphics2D g = backgroundImg.createGraphics(); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); g.drawImage(img, rectangle.x, rectangle.y, rectangle.width, rectangle.height, null); // 绘制切割后的图 g.dispose(); return backgroundImg; }
java
private static BufferedImage draw(BufferedImage backgroundImg, Image img, Rectangle rectangle, float alpha) { final Graphics2D g = backgroundImg.createGraphics(); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); g.drawImage(img, rectangle.x, rectangle.y, rectangle.width, rectangle.height, null); // 绘制切割后的图 g.dispose(); return backgroundImg; }
[ "private", "static", "BufferedImage", "draw", "(", "BufferedImage", "backgroundImg", ",", "Image", "img", ",", "Rectangle", "rectangle", ",", "float", "alpha", ")", "{", "final", "Graphics2D", "g", "=", "backgroundImg", ".", "createGraphics", "(", ")", ";", "g...
将图片绘制在背景上 @param backgroundImg 背景图片 @param img 要绘制的图片 @param rectangle 矩形对象,表示矩形区域的x,y,width,height,x,y从背景图片中心计算 @return 绘制后的背景
[ "将图片绘制在背景上" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L574-L580
train
Draw the image with the specified rectangle.
[ 30522, 2797, 10763, 17698, 2098, 9581, 3351, 4009, 1006, 17698, 2098, 9581, 3351, 4281, 5714, 2290, 1010, 3746, 10047, 2290, 1010, 28667, 23395, 28667, 23395, 1010, 14257, 6541, 1007, 1063, 2345, 8389, 2475, 2094, 1043, 1027, 4281, 5714, 22...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java
ProjectGenerator.shouldExtract
private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) { if (request.isExtract()) { return true; } // explicit name hasn't been provided for an archive and there is no extension if (isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".")) { return true; } return false; }
java
private boolean shouldExtract(ProjectGenerationRequest request, ProjectGenerationResponse response) { if (request.isExtract()) { return true; } // explicit name hasn't been provided for an archive and there is no extension if (isZipArchive(response) && request.getOutput() != null && !request.getOutput().contains(".")) { return true; } return false; }
[ "private", "boolean", "shouldExtract", "(", "ProjectGenerationRequest", "request", ",", "ProjectGenerationResponse", "response", ")", "{", "if", "(", "request", ".", "isExtract", "(", ")", ")", "{", "return", "true", ";", "}", "// explicit name hasn't been provided fo...
Detect if the project should be extracted. @param request the generation request @param response the generation response @return if the project should be extracted
[ "Detect", "if", "the", "project", "should", "be", "extracted", "." ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ProjectGenerator.java#L76-L87
train
Determines if the extract request should be performed.
[ 30522, 2797, 22017, 20898, 2323, 10288, 6494, 6593, 1006, 2622, 6914, 16754, 2890, 15500, 5227, 1010, 2622, 6914, 16754, 6072, 26029, 3366, 3433, 1007, 1063, 2065, 1006, 5227, 1012, 2003, 10288, 6494, 6593, 1006, 1007, 1007, 1063, 2709, 299...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/SummarizationData.java
SummarizationData.getVertices
public static DataSet<Vertex<Long, String>> getVertices(ExecutionEnvironment env) { List<Vertex<Long, String>> vertices = new ArrayList<>(INPUT_VERTICES.length); for (String vertex : INPUT_VERTICES) { String[] tokens = vertex.split(";"); vertices.add(new Vertex<>(Long.parseLong(tokens[0]), tokens[1])); } return env.fromCollection(vertices); }
java
public static DataSet<Vertex<Long, String>> getVertices(ExecutionEnvironment env) { List<Vertex<Long, String>> vertices = new ArrayList<>(INPUT_VERTICES.length); for (String vertex : INPUT_VERTICES) { String[] tokens = vertex.split(";"); vertices.add(new Vertex<>(Long.parseLong(tokens[0]), tokens[1])); } return env.fromCollection(vertices); }
[ "public", "static", "DataSet", "<", "Vertex", "<", "Long", ",", "String", ">", ">", "getVertices", "(", "ExecutionEnvironment", "env", ")", "{", "List", "<", "Vertex", "<", "Long", ",", "String", ">", ">", "vertices", "=", "new", "ArrayList", "<>", "(", ...
Creates a set of vertices with attached {@link String} values. @param env execution environment @return vertex data set with string values
[ "Creates", "a", "set", "of", "vertices", "with", "attached", "{", "@link", "String", "}", "values", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/data/SummarizationData.java#L123-L131
train
Get the vertices from the input DataSet.
[ 30522, 2270, 10763, 2951, 13462, 1026, 19449, 1026, 2146, 1010, 5164, 1028, 1028, 2131, 16874, 23522, 1006, 7781, 2368, 21663, 2239, 3672, 4372, 2615, 1007, 1063, 2862, 1026, 19449, 1026, 2146, 1010, 5164, 1028, 1028, 18984, 1027, 2047, 914...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
hankcs/HanLP
src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java
EditDistance.ed
public static int ed(String wrongWord, String rightWord) { final int m = wrongWord.length(); final int n = rightWord.length(); int[][] d = new int[m + 1][n + 1]; for (int j = 0; j <= n; ++j) { d[0][j] = j; } for (int i = 0; i <= m; ++i) { d[i][0] = i; } for (int i = 1; i <= m; ++i) { char ci = wrongWord.charAt(i - 1); for (int j = 1; j <= n; ++j) { char cj = rightWord.charAt(j - 1); if (ci == cj) { d[i][j] = d[i - 1][j - 1]; } else if (i > 1 && j > 1 && ci == rightWord.charAt(j - 2) && cj == wrongWord.charAt(i - 2)) { // 交错相等 d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j])); } else { // 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1)); } } } return d[m][n]; }
java
public static int ed(String wrongWord, String rightWord) { final int m = wrongWord.length(); final int n = rightWord.length(); int[][] d = new int[m + 1][n + 1]; for (int j = 0; j <= n; ++j) { d[0][j] = j; } for (int i = 0; i <= m; ++i) { d[i][0] = i; } for (int i = 1; i <= m; ++i) { char ci = wrongWord.charAt(i - 1); for (int j = 1; j <= n; ++j) { char cj = rightWord.charAt(j - 1); if (ci == cj) { d[i][j] = d[i - 1][j - 1]; } else if (i > 1 && j > 1 && ci == rightWord.charAt(j - 2) && cj == wrongWord.charAt(i - 2)) { // 交错相等 d[i][j] = 1 + Math.min(d[i - 2][j - 2], Math.min(d[i][j - 1], d[i - 1][j])); } else { // 等号右边的分别代表 将ci改成cj 错串加cj 错串删ci d[i][j] = Math.min(d[i - 1][j - 1] + 1, Math.min(d[i][j - 1] + 1, d[i - 1][j] + 1)); } } } return d[m][n]; }
[ "public", "static", "int", "ed", "(", "String", "wrongWord", ",", "String", "rightWord", ")", "{", "final", "int", "m", "=", "wrongWord", ".", "length", "(", ")", ";", "final", "int", "n", "=", "rightWord", ".", "length", "(", ")", ";", "int", "[", ...
编辑距离 @param wrongWord 串A,其实它们两个调换位置还是一样的 @param rightWord 串B @return 它们之间的距离
[ "编辑距离" ]
a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/EditDistance.java#L144-L183
train
Get the EE value of the 2 - digit CRS.
[ 30522, 2270, 10763, 20014, 3968, 1006, 5164, 3308, 18351, 1010, 5164, 2157, 18351, 1007, 1063, 2345, 20014, 1049, 1027, 3308, 18351, 1012, 3091, 1006, 1007, 1025, 2345, 20014, 1050, 1027, 2157, 18351, 1012, 3091, 1006, 1007, 1025, 20014, 10...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArrayWriter.java
BinaryArrayWriter.reset
@Override public void reset() { this.cursor = fixedSize; for (int i = 0; i < nullBitsSizeInBytes; i += 8) { segment.putLong(i, 0L); } this.segment.putInt(0, numElements); }
java
@Override public void reset() { this.cursor = fixedSize; for (int i = 0; i < nullBitsSizeInBytes; i += 8) { segment.putLong(i, 0L); } this.segment.putInt(0, numElements); }
[ "@", "Override", "public", "void", "reset", "(", ")", "{", "this", ".", "cursor", "=", "fixedSize", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nullBitsSizeInBytes", ";", "i", "+=", "8", ")", "{", "segment", ".", "putLong", "(", "i", "...
First, reset.
[ "First", "reset", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArrayWriter.java#L50-L57
train
Resets the segment to the initial state.
[ 30522, 1030, 2058, 15637, 2270, 11675, 25141, 1006, 1007, 1063, 2023, 1012, 12731, 25301, 30524, 22072, 2102, 1006, 1014, 1010, 16371, 10199, 13665, 2015, 1007, 1025, 1065, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java
RemoteInputChannel.onSenderBacklog
void onSenderBacklog(int backlog) throws IOException { int numRequestedBuffers = 0; synchronized (bufferQueue) { // Similar to notifyBufferAvailable(), make sure that we never add a buffer // after releaseAllResources() released all buffers (see above for details). if (isReleased.get()) { return; } numRequiredBuffers = backlog + initialCredit; while (bufferQueue.getAvailableBufferSize() < numRequiredBuffers && !isWaitingForFloatingBuffers) { Buffer buffer = inputGate.getBufferPool().requestBuffer(); if (buffer != null) { bufferQueue.addFloatingBuffer(buffer); numRequestedBuffers++; } else if (inputGate.getBufferProvider().addBufferListener(this)) { // If the channel has not got enough buffers, register it as listener to wait for more floating buffers. isWaitingForFloatingBuffers = true; break; } } } if (numRequestedBuffers > 0 && unannouncedCredit.getAndAdd(numRequestedBuffers) == 0) { notifyCreditAvailable(); } }
java
void onSenderBacklog(int backlog) throws IOException { int numRequestedBuffers = 0; synchronized (bufferQueue) { // Similar to notifyBufferAvailable(), make sure that we never add a buffer // after releaseAllResources() released all buffers (see above for details). if (isReleased.get()) { return; } numRequiredBuffers = backlog + initialCredit; while (bufferQueue.getAvailableBufferSize() < numRequiredBuffers && !isWaitingForFloatingBuffers) { Buffer buffer = inputGate.getBufferPool().requestBuffer(); if (buffer != null) { bufferQueue.addFloatingBuffer(buffer); numRequestedBuffers++; } else if (inputGate.getBufferProvider().addBufferListener(this)) { // If the channel has not got enough buffers, register it as listener to wait for more floating buffers. isWaitingForFloatingBuffers = true; break; } } } if (numRequestedBuffers > 0 && unannouncedCredit.getAndAdd(numRequestedBuffers) == 0) { notifyCreditAvailable(); } }
[ "void", "onSenderBacklog", "(", "int", "backlog", ")", "throws", "IOException", "{", "int", "numRequestedBuffers", "=", "0", ";", "synchronized", "(", "bufferQueue", ")", "{", "// Similar to notifyBufferAvailable(), make sure that we never add a buffer", "// after releaseAllR...
Receives the backlog from the producer's buffer response. If the number of available buffers is less than backlog + initialCredit, it will request floating buffers from the buffer pool, and then notify unannounced credits to the producer. @param backlog The number of unsent buffers in the producer's sub partition.
[ "Receives", "the", "backlog", "from", "the", "producer", "s", "buffer", "response", ".", "If", "the", "number", "of", "available", "buffers", "is", "less", "than", "backlog", "+", "initialCredit", "it", "will", "request", "floating", "buffers", "from", "the", ...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java#L470-L497
train
This method is called when the backlog is received from the input channel.
[ 30522, 11675, 2006, 5054, 4063, 5963, 21197, 1006, 20014, 2067, 21197, 1007, 11618, 22834, 10288, 24422, 1063, 20014, 16371, 2213, 2890, 15500, 2098, 8569, 12494, 2015, 1027, 1014, 1025, 25549, 1006, 17698, 4226, 5657, 1007, 1063, 1013, 1013,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
spring-projects/spring-boot
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java
InitializrService.loadServiceCapabilities
public Object loadServiceCapabilities(String serviceUrl) throws IOException { HttpGet request = new HttpGet(serviceUrl); request.setHeader( new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); CloseableHttpResponse httpResponse = execute(request, serviceUrl, "retrieve help"); validateResponse(httpResponse, serviceUrl); HttpEntity httpEntity = httpResponse.getEntity(); ContentType contentType = ContentType.getOrDefault(httpEntity); if (contentType.getMimeType().equals("text/plain")) { return getContent(httpEntity); } return parseJsonMetadata(httpEntity); }
java
public Object loadServiceCapabilities(String serviceUrl) throws IOException { HttpGet request = new HttpGet(serviceUrl); request.setHeader( new BasicHeader(HttpHeaders.ACCEPT, ACCEPT_SERVICE_CAPABILITIES)); CloseableHttpResponse httpResponse = execute(request, serviceUrl, "retrieve help"); validateResponse(httpResponse, serviceUrl); HttpEntity httpEntity = httpResponse.getEntity(); ContentType contentType = ContentType.getOrDefault(httpEntity); if (contentType.getMimeType().equals("text/plain")) { return getContent(httpEntity); } return parseJsonMetadata(httpEntity); }
[ "public", "Object", "loadServiceCapabilities", "(", "String", "serviceUrl", ")", "throws", "IOException", "{", "HttpGet", "request", "=", "new", "HttpGet", "(", "serviceUrl", ")", ";", "request", ".", "setHeader", "(", "new", "BasicHeader", "(", "HttpHeaders", "...
Loads the service capabilities of the service at the specified URL. If the service supports generating a textual representation of the capabilities, it is returned, otherwise {@link InitializrServiceMetadata} is returned. @param serviceUrl to url of the initializer service @return the service capabilities (as a String) or the {@link InitializrServiceMetadata} describing the service @throws IOException if the service capabilities cannot be loaded
[ "Loads", "the", "service", "capabilities", "of", "the", "service", "at", "the", "specified", "URL", ".", "If", "the", "service", "supports", "generating", "a", "textual", "representation", "of", "the", "capabilities", "it", "is", "returned", "otherwise", "{" ]
0b27f7c70e164b2b1a96477f1d9c1acba56790c1
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/InitializrService.java#L122-L135
train
Load service capabilities from the service url.
[ 30522, 2270, 4874, 15665, 2121, 7903, 19281, 4502, 14680, 1006, 5164, 2326, 3126, 2140, 1007, 11618, 22834, 10288, 24422, 1063, 8299, 18150, 5227, 1027, 2047, 8299, 18150, 1006, 2326, 3126, 2140, 1007, 1025, 5227, 1012, 6662, 13775, 2121, 1...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/PropertySourcesPropertyResolver.java
PropertySourcesPropertyResolver.logKeyFound
protected void logKeyFound(String key, PropertySource<?> propertySource, Object value) { if (logger.isDebugEnabled()) { logger.debug("Found key '" + key + "' in PropertySource '" + propertySource.getName() + "' with value of type " + value.getClass().getSimpleName()); } }
java
protected void logKeyFound(String key, PropertySource<?> propertySource, Object value) { if (logger.isDebugEnabled()) { logger.debug("Found key '" + key + "' in PropertySource '" + propertySource.getName() + "' with value of type " + value.getClass().getSimpleName()); } }
[ "protected", "void", "logKeyFound", "(", "String", "key", ",", "PropertySource", "<", "?", ">", "propertySource", ",", "Object", "value", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Found key '\...
Log the given key as found in the given {@link PropertySource}, resulting in the given value. <p> The default implementation writes a debug log message with key and source. As of 4.3.3, this does not log the value anymore in order to avoid accidental logging of sensitive settings. Subclasses may override this method to change the log level and/or log message, including the property's value if desired. @param key the key found @param propertySource the {@code PropertySource} that the key has been found in @param value the corresponding value @since 4.3.1
[ "Log", "the", "given", "key", "as", "found", "in", "the", "given", "{", "@link", "PropertySource", "}", "resulting", "in", "the", "given", "value", ".", "<p", ">", "The", "default", "implementation", "writes", "a", "debug", "log", "message", "with", "key",...
8f088cddc0755f4350c5aaae95c6e4002d90a40f
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/bind/PropertySourcesPropertyResolver.java#L140-L145
train
Log the key found.
[ 30522, 5123, 11675, 8833, 14839, 14876, 8630, 1006, 5164, 3145, 1010, 3200, 6499, 3126, 3401, 1026, 1029, 1028, 3200, 6499, 3126, 3401, 1010, 4874, 3643, 1007, 1063, 2065, 1006, 8833, 4590, 1012, 2003, 3207, 8569, 6914, 3085, 2094, 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-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java
MiniCluster.executeJobBlocking
@Override public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException { checkNotNull(job, "job is null"); final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job); final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose( (JobSubmissionResult ignored) -> requestJobResult(job.getJobID())); final JobResult jobResult; try { jobResult = jobResultFuture.get(); } catch (ExecutionException e) { throw new JobExecutionException(job.getJobID(), "Could not retrieve JobResult.", ExceptionUtils.stripExecutionException(e)); } try { return jobResult.toJobExecutionResult(Thread.currentThread().getContextClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new JobExecutionException(job.getJobID(), e); } }
java
@Override public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException { checkNotNull(job, "job is null"); final CompletableFuture<JobSubmissionResult> submissionFuture = submitJob(job); final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose( (JobSubmissionResult ignored) -> requestJobResult(job.getJobID())); final JobResult jobResult; try { jobResult = jobResultFuture.get(); } catch (ExecutionException e) { throw new JobExecutionException(job.getJobID(), "Could not retrieve JobResult.", ExceptionUtils.stripExecutionException(e)); } try { return jobResult.toJobExecutionResult(Thread.currentThread().getContextClassLoader()); } catch (IOException | ClassNotFoundException e) { throw new JobExecutionException(job.getJobID(), e); } }
[ "@", "Override", "public", "JobExecutionResult", "executeJobBlocking", "(", "JobGraph", "job", ")", "throws", "JobExecutionException", ",", "InterruptedException", "{", "checkNotNull", "(", "job", ",", "\"job is null\"", ")", ";", "final", "CompletableFuture", "<", "J...
This method runs a job in blocking mode. The method returns only after the job completed successfully, or after it failed terminally. @param job The Flink job to execute @return The result of the job execution @throws JobExecutionException Thrown if anything went amiss during initial job launch, or if the job terminally failed.
[ "This", "method", "runs", "a", "job", "in", "blocking", "mode", ".", "The", "method", "returns", "only", "after", "the", "job", "completed", "successfully", "or", "after", "it", "failed", "terminally", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L609-L631
train
Execute a job in blocking mode.
[ 30522, 1030, 2058, 15637, 2270, 3105, 10288, 8586, 13700, 6072, 11314, 15389, 5558, 10322, 7878, 2075, 1006, 3105, 14413, 3105, 1007, 11618, 3105, 10288, 8586, 13700, 10288, 24422, 1010, 7153, 10288, 24422, 1063, 4638, 17048, 11231, 3363, 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-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.java
JDBCInputFormat.open
@Override public void open(InputSplit inputSplit) throws IOException { try { if (inputSplit != null && parameterValues != null) { for (int i = 0; i < parameterValues[inputSplit.getSplitNumber()].length; i++) { Object param = parameterValues[inputSplit.getSplitNumber()][i]; if (param instanceof String) { statement.setString(i + 1, (String) param); } else if (param instanceof Long) { statement.setLong(i + 1, (Long) param); } else if (param instanceof Integer) { statement.setInt(i + 1, (Integer) param); } else if (param instanceof Double) { statement.setDouble(i + 1, (Double) param); } else if (param instanceof Boolean) { statement.setBoolean(i + 1, (Boolean) param); } else if (param instanceof Float) { statement.setFloat(i + 1, (Float) param); } else if (param instanceof BigDecimal) { statement.setBigDecimal(i + 1, (BigDecimal) param); } else if (param instanceof Byte) { statement.setByte(i + 1, (Byte) param); } else if (param instanceof Short) { statement.setShort(i + 1, (Short) param); } else if (param instanceof Date) { statement.setDate(i + 1, (Date) param); } else if (param instanceof Time) { statement.setTime(i + 1, (Time) param); } else if (param instanceof Timestamp) { statement.setTimestamp(i + 1, (Timestamp) param); } else if (param instanceof Array) { statement.setArray(i + 1, (Array) param); } else { //extends with other types if needed throw new IllegalArgumentException("open() failed. Parameter " + i + " of type " + param.getClass() + " is not handled (yet)."); } } if (LOG.isDebugEnabled()) { LOG.debug(String.format("Executing '%s' with parameters %s", queryTemplate, Arrays.deepToString(parameterValues[inputSplit.getSplitNumber()]))); } } resultSet = statement.executeQuery(); hasNext = resultSet.next(); } catch (SQLException se) { throw new IllegalArgumentException("open() failed." + se.getMessage(), se); } }
java
@Override public void open(InputSplit inputSplit) throws IOException { try { if (inputSplit != null && parameterValues != null) { for (int i = 0; i < parameterValues[inputSplit.getSplitNumber()].length; i++) { Object param = parameterValues[inputSplit.getSplitNumber()][i]; if (param instanceof String) { statement.setString(i + 1, (String) param); } else if (param instanceof Long) { statement.setLong(i + 1, (Long) param); } else if (param instanceof Integer) { statement.setInt(i + 1, (Integer) param); } else if (param instanceof Double) { statement.setDouble(i + 1, (Double) param); } else if (param instanceof Boolean) { statement.setBoolean(i + 1, (Boolean) param); } else if (param instanceof Float) { statement.setFloat(i + 1, (Float) param); } else if (param instanceof BigDecimal) { statement.setBigDecimal(i + 1, (BigDecimal) param); } else if (param instanceof Byte) { statement.setByte(i + 1, (Byte) param); } else if (param instanceof Short) { statement.setShort(i + 1, (Short) param); } else if (param instanceof Date) { statement.setDate(i + 1, (Date) param); } else if (param instanceof Time) { statement.setTime(i + 1, (Time) param); } else if (param instanceof Timestamp) { statement.setTimestamp(i + 1, (Timestamp) param); } else if (param instanceof Array) { statement.setArray(i + 1, (Array) param); } else { //extends with other types if needed throw new IllegalArgumentException("open() failed. Parameter " + i + " of type " + param.getClass() + " is not handled (yet)."); } } if (LOG.isDebugEnabled()) { LOG.debug(String.format("Executing '%s' with parameters %s", queryTemplate, Arrays.deepToString(parameterValues[inputSplit.getSplitNumber()]))); } } resultSet = statement.executeQuery(); hasNext = resultSet.next(); } catch (SQLException se) { throw new IllegalArgumentException("open() failed." + se.getMessage(), se); } }
[ "@", "Override", "public", "void", "open", "(", "InputSplit", "inputSplit", ")", "throws", "IOException", "{", "try", "{", "if", "(", "inputSplit", "!=", "null", "&&", "parameterValues", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i...
Connects to the source database and executes the query in a <b>parallel fashion</b> if this {@link InputFormat} is built using a parameterized query (i.e. using a {@link PreparedStatement}) and a proper {@link ParameterValuesProvider}, in a <b>non-parallel fashion</b> otherwise. @param inputSplit which is ignored if this InputFormat is executed as a non-parallel source, a "hook" to the query parameters otherwise (using its <i>splitNumber</i>) @throws IOException if there's an error during the execution of the query
[ "Connects", "to", "the", "source", "database", "and", "executes", "the", "query", "in", "a", "<b", ">", "parallel", "fashion<", "/", "b", ">", "if", "this", "{", "@link", "InputFormat", "}", "is", "built", "using", "a", "parameterized", "query", "(", "i"...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCInputFormat.java#L206-L252
train
This method is called to open the SQL statement.
[ 30522, 1030, 2058, 15637, 2270, 11675, 2330, 1006, 20407, 24759, 4183, 20407, 24759, 4183, 1007, 11618, 22834, 10288, 24422, 1063, 3046, 1063, 2065, 1006, 20407, 24759, 4183, 999, 1027, 19701, 1004, 1004, 16381, 10175, 15808, 999, 1027, 19701...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java
KvStateLocationRegistry.notifyKvStateUnregistered
public void notifyKvStateUnregistered( JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName) { KvStateLocation location = lookupTable.get(registrationName); if (location != null) { // Duplicate name if vertex IDs don't match if (!location.getJobVertexId().equals(jobVertexId)) { throw new IllegalArgumentException("Another operator (" + location.getJobVertexId() + ") registered the KvState " + "under '" + registrationName + "'."); } location.unregisterKvState(keyGroupRange); if (location.getNumRegisteredKeyGroups() == 0) { lookupTable.remove(registrationName); } } else { throw new IllegalArgumentException("Unknown registration name '" + registrationName + "'. " + "Probably registration/unregistration race."); } }
java
public void notifyKvStateUnregistered( JobVertexID jobVertexId, KeyGroupRange keyGroupRange, String registrationName) { KvStateLocation location = lookupTable.get(registrationName); if (location != null) { // Duplicate name if vertex IDs don't match if (!location.getJobVertexId().equals(jobVertexId)) { throw new IllegalArgumentException("Another operator (" + location.getJobVertexId() + ") registered the KvState " + "under '" + registrationName + "'."); } location.unregisterKvState(keyGroupRange); if (location.getNumRegisteredKeyGroups() == 0) { lookupTable.remove(registrationName); } } else { throw new IllegalArgumentException("Unknown registration name '" + registrationName + "'. " + "Probably registration/unregistration race."); } }
[ "public", "void", "notifyKvStateUnregistered", "(", "JobVertexID", "jobVertexId", ",", "KeyGroupRange", "keyGroupRange", ",", "String", "registrationName", ")", "{", "KvStateLocation", "location", "=", "lookupTable", ".", "get", "(", "registrationName", ")", ";", "if"...
Notifies the registry about an unregistered KvState instance. @param jobVertexId JobVertexID the KvState instance belongs to @param keyGroupRange Key group index the KvState instance belongs to @param registrationName Name under which the KvState has been registered @throws IllegalArgumentException If another operator registered the state instance @throws IllegalArgumentException If the registration name is not known
[ "Notifies", "the", "registry", "about", "an", "unregistered", "KvState", "instance", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java#L137-L161
train
Notifies the KvState that a KvState is unregistered.
[ 30522, 2270, 11675, 2025, 8757, 2243, 15088, 12259, 4609, 2890, 24063, 6850, 1006, 3105, 16874, 10288, 3593, 3105, 16874, 10288, 3593, 1010, 3145, 17058, 24388, 2063, 3145, 17058, 24388, 2063, 1010, 5164, 8819, 18442, 1007, 1063, 24888, 9153,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java
KinesisDataFetcher.registerNewSubscribedShardState
public int registerNewSubscribedShardState(KinesisStreamShardState newSubscribedShardState) { synchronized (checkpointLock) { subscribedShardsState.add(newSubscribedShardState); // If a registered shard has initial state that is not SENTINEL_SHARD_ENDING_SEQUENCE_NUM (will be the case // if the consumer had already finished reading a shard before we failed and restored), we determine that // this subtask has a new active shard if (!newSubscribedShardState.getLastProcessedSequenceNum().equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) { this.numberOfActiveShards.incrementAndGet(); } int shardStateIndex = subscribedShardsState.size() - 1; // track all discovered shards for watermark determination ShardWatermarkState sws = shardWatermarks.get(shardStateIndex); if (sws == null) { sws = new ShardWatermarkState(); try { sws.periodicWatermarkAssigner = InstantiationUtil.clone(periodicWatermarkAssigner); } catch (Exception e) { throw new RuntimeException("Failed to instantiate new WatermarkAssigner", e); } sws.lastUpdated = getCurrentTimeMillis(); sws.lastRecordTimestamp = Long.MIN_VALUE; shardWatermarks.put(shardStateIndex, sws); } return shardStateIndex; } }
java
public int registerNewSubscribedShardState(KinesisStreamShardState newSubscribedShardState) { synchronized (checkpointLock) { subscribedShardsState.add(newSubscribedShardState); // If a registered shard has initial state that is not SENTINEL_SHARD_ENDING_SEQUENCE_NUM (will be the case // if the consumer had already finished reading a shard before we failed and restored), we determine that // this subtask has a new active shard if (!newSubscribedShardState.getLastProcessedSequenceNum().equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) { this.numberOfActiveShards.incrementAndGet(); } int shardStateIndex = subscribedShardsState.size() - 1; // track all discovered shards for watermark determination ShardWatermarkState sws = shardWatermarks.get(shardStateIndex); if (sws == null) { sws = new ShardWatermarkState(); try { sws.periodicWatermarkAssigner = InstantiationUtil.clone(periodicWatermarkAssigner); } catch (Exception e) { throw new RuntimeException("Failed to instantiate new WatermarkAssigner", e); } sws.lastUpdated = getCurrentTimeMillis(); sws.lastRecordTimestamp = Long.MIN_VALUE; shardWatermarks.put(shardStateIndex, sws); } return shardStateIndex; } }
[ "public", "int", "registerNewSubscribedShardState", "(", "KinesisStreamShardState", "newSubscribedShardState", ")", "{", "synchronized", "(", "checkpointLock", ")", "{", "subscribedShardsState", ".", "add", "(", "newSubscribedShardState", ")", ";", "// If a registered shard h...
Register a new subscribed shard state. @param newSubscribedShardState the new shard state that this fetcher is to be subscribed to
[ "Register", "a", "new", "subscribed", "shard", "state", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L670-L699
train
Registers a new subscribed shard state.
[ 30522, 2270, 20014, 4236, 2638, 9333, 12083, 29234, 5104, 11783, 9153, 2618, 1006, 12631, 19009, 21422, 7377, 17811, 12259, 2739, 12083, 29234, 5104, 11783, 9153, 2618, 1007, 1063, 25549, 1006, 26520, 7878, 1007, 1063, 4942, 29234, 5104, 1178...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/types/ListValue.java
ListValue.set
@Override public V set(final int index, final V element) { return this.list.set(index, element); }
java
@Override public V set(final int index, final V element) { return this.list.set(index, element); }
[ "@", "Override", "public", "V", "set", "(", "final", "int", "index", ",", "final", "V", "element", ")", "{", "return", "this", ".", "list", ".", "set", "(", "index", ",", "element", ")", ";", "}" ]
/* (non-Javadoc) @see java.util.List#set(int, java.lang.Object)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/ListValue.java#L315-L318
train
Override to allow the implementation to override the implementation of the set method.
[ 30522, 1030, 2058, 15637, 2270, 1058, 2275, 1006, 2345, 20014, 5950, 1010, 2345, 1058, 5783, 1007, 1063, 2709, 2023, 1012, 2862, 1012, 2275, 1006, 5950, 1010, 5783, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InPlaceMutableHashTable.java
InPlaceMutableHashTable.insert
@Override public void insert(T record) throws IOException { if (closed) { return; } final int hashCode = MathUtils.jenkinsHash(buildSideComparator.hash(record)); final int bucket = hashCode & numBucketsMask; final int bucketSegmentIndex = bucket >>> numBucketsPerSegmentBits; // which segment contains the bucket final MemorySegment bucketSegment = bucketSegments[bucketSegmentIndex]; final int bucketOffset = (bucket & numBucketsPerSegmentMask) << bucketSizeBits; // offset of the bucket in the segment final long firstPointer = bucketSegment.getLong(bucketOffset); try { final long newFirstPointer = recordArea.appendPointerAndRecord(firstPointer, record); bucketSegment.putLong(bucketOffset, newFirstPointer); } catch (EOFException ex) { compactOrThrow(); insert(record); return; } numElements++; resizeTableIfNecessary(); }
java
@Override public void insert(T record) throws IOException { if (closed) { return; } final int hashCode = MathUtils.jenkinsHash(buildSideComparator.hash(record)); final int bucket = hashCode & numBucketsMask; final int bucketSegmentIndex = bucket >>> numBucketsPerSegmentBits; // which segment contains the bucket final MemorySegment bucketSegment = bucketSegments[bucketSegmentIndex]; final int bucketOffset = (bucket & numBucketsPerSegmentMask) << bucketSizeBits; // offset of the bucket in the segment final long firstPointer = bucketSegment.getLong(bucketOffset); try { final long newFirstPointer = recordArea.appendPointerAndRecord(firstPointer, record); bucketSegment.putLong(bucketOffset, newFirstPointer); } catch (EOFException ex) { compactOrThrow(); insert(record); return; } numElements++; resizeTableIfNecessary(); }
[ "@", "Override", "public", "void", "insert", "(", "T", "record", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "return", ";", "}", "final", "int", "hashCode", "=", "MathUtils", ".", "jenkinsHash", "(", "buildSideComparator", ".", "hash"...
Inserts the given record into the hash table. Note: this method doesn't care about whether a record with the same key is already present. @param record The record to insert. @throws IOException (EOFException specifically, if memory ran out)
[ "Inserts", "the", "given", "record", "into", "the", "hash", "table", ".", "Note", ":", "this", "method", "doesn", "t", "care", "about", "whether", "a", "record", "with", "the", "same", "key", "is", "already", "present", "." ]
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/hash/InPlaceMutableHashTable.java#L377-L401
train
Inserts the given record into the underlying MemorySegment.
[ 30522, 1030, 2058, 15637, 2270, 11675, 19274, 1006, 1056, 2501, 1007, 11618, 22834, 10288, 24422, 1063, 2065, 1006, 2701, 1007, 1063, 2709, 1025, 1065, 2345, 20014, 23325, 16044, 1027, 8785, 21823, 4877, 1012, 11098, 14949, 2232, 1006, 16473,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -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/types/Record.java
Record.unionFields
public void unionFields(Record other) { final int minFields = Math.min(this.numFields, other.numFields); final int maxFields = Math.max(this.numFields, other.numFields); final int[] offsets = this.offsets.length >= maxFields ? this.offsets : new int[maxFields]; final int[] lengths = this.lengths.length >= maxFields ? this.lengths : new int[maxFields]; if (!(this.isModified() || other.isModified())) { // handle the special (but common) case where both records have a valid binary representation differently // allocate space for the switchBuffer first final int estimatedLength = this.binaryLen + other.binaryLen; this.serializer.memory = (this.switchBuffer != null && this.switchBuffer.length >= estimatedLength) ? this.switchBuffer : new byte[estimatedLength]; this.serializer.position = 0; try { // common loop for both records for (int i = 0; i < minFields; i++) { final int thisOff = this.offsets[i]; if (thisOff == NULL_INDICATOR_OFFSET) { final int otherOff = other.offsets[i]; if (otherOff == NULL_INDICATOR_OFFSET) { offsets[i] = NULL_INDICATOR_OFFSET; } else { // take field from other record offsets[i] = this.serializer.position; this.serializer.write(other.binaryData, otherOff, other.lengths[i]); lengths[i] = other.lengths[i]; } } else { // copy field from this one offsets[i] = this.serializer.position; this.serializer.write(this.binaryData, thisOff, this.lengths[i]); lengths[i] = this.lengths[i]; } } // add the trailing fields from one record if (minFields != maxFields) { final Record sourceForRemainder = this.numFields > minFields ? this : other; int begin = -1; int end = -1; int offsetDelta = 0; // go through the offsets, find the non-null fields to account for the remaining data for (int k = minFields; k < maxFields; k++) { final int off = sourceForRemainder.offsets[k]; if (off == NULL_INDICATOR_OFFSET) { offsets[k] = NULL_INDICATOR_OFFSET; } else { end = sourceForRemainder.offsets[k]+sourceForRemainder.lengths[k]; if (begin == -1) { // first non null column in the remainder begin = sourceForRemainder.offsets[k]; offsetDelta = this.serializer.position - begin; } offsets[k] = sourceForRemainder.offsets[k] + offsetDelta; } } // copy the remaining fields directly as binary if (begin != -1) { this.serializer.write(sourceForRemainder.binaryData, begin, end - begin); } // the lengths can be copied directly if (lengths != sourceForRemainder.lengths) { System.arraycopy(sourceForRemainder.lengths, minFields, lengths, minFields, maxFields - minFields); } } } catch (Exception ioex) { throw new RuntimeException("Error creating field union of record data" + ioex.getMessage() == null ? "." : ": " + ioex.getMessage(), ioex); } } else { // the general case, where at least one of the two records has a binary representation that is not in sync. final int estimatedLength = (this.binaryLen > 0 ? this.binaryLen : this.numFields * DEFAULT_FIELD_LEN_ESTIMATE) + (other.binaryLen > 0 ? other.binaryLen : other.numFields * DEFAULT_FIELD_LEN_ESTIMATE); this.serializer.memory = (this.switchBuffer != null && this.switchBuffer.length >= estimatedLength) ? this.switchBuffer : new byte[estimatedLength]; this.serializer.position = 0; try { // common loop for both records for (int i = 0; i < minFields; i++) { final int thisOff = this.offsets[i]; if (thisOff == NULL_INDICATOR_OFFSET) { final int otherOff = other.offsets[i]; if (otherOff == NULL_INDICATOR_OFFSET) { offsets[i] = NULL_INDICATOR_OFFSET; } else if (otherOff == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from other record offsets[i] = this.serializer.position; other.writeFields[i].write(this.serializer); lengths[i] = this.serializer.position - offsets[i]; } else { // take field from other record binary offsets[i] = this.serializer.position; this.serializer.write(other.binaryData, otherOff, other.lengths[i]); lengths[i] = other.lengths[i]; } } else if (thisOff == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from this record offsets[i] = this.serializer.position; this.writeFields[i].write(this.serializer); lengths[i] = this.serializer.position - offsets[i]; } else { // copy field from this one offsets[i] = this.serializer.position; this.serializer.write(this.binaryData, thisOff, this.lengths[i]); lengths[i] = this.lengths[i]; } } // add the trailing fields from one record if (minFields != maxFields) { final Record sourceForRemainder = this.numFields > minFields ? this : other; // go through the offsets, find the non-null fields for (int k = minFields; k < maxFields; k++) { final int off = sourceForRemainder.offsets[k]; if (off == NULL_INDICATOR_OFFSET) { offsets[k] = NULL_INDICATOR_OFFSET; } else if (off == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from the source record offsets[k] = this.serializer.position; sourceForRemainder.writeFields[k].write(this.serializer); lengths[k] = this.serializer.position - offsets[k]; } else { // copy field from the source record binary offsets[k] = this.serializer.position; final int len = sourceForRemainder.lengths[k]; this.serializer.write(sourceForRemainder.binaryData, off, len); lengths[k] = len; } } } } catch (Exception ioex) { throw new RuntimeException("Error creating field union of record data" + ioex.getMessage() == null ? "." : ": " + ioex.getMessage(), ioex); } } serializeHeader(this.serializer, offsets, maxFields); // set the fields this.switchBuffer = this.binaryData; this.binaryData = serializer.memory; this.binaryLen = serializer.position; this.numFields = maxFields; this.offsets = offsets; this.lengths = lengths; this.firstModifiedPos = Integer.MAX_VALUE; // make sure that the object arrays reflect the size as well if (this.readFields == null || this.readFields.length < maxFields) { final Value[] na = new Value[maxFields]; System.arraycopy(this.readFields, 0, na, 0, this.readFields.length); this.readFields = na; } this.writeFields = (this.writeFields == null || this.writeFields.length < maxFields) ? new Value[maxFields] : this.writeFields; }
java
public void unionFields(Record other) { final int minFields = Math.min(this.numFields, other.numFields); final int maxFields = Math.max(this.numFields, other.numFields); final int[] offsets = this.offsets.length >= maxFields ? this.offsets : new int[maxFields]; final int[] lengths = this.lengths.length >= maxFields ? this.lengths : new int[maxFields]; if (!(this.isModified() || other.isModified())) { // handle the special (but common) case where both records have a valid binary representation differently // allocate space for the switchBuffer first final int estimatedLength = this.binaryLen + other.binaryLen; this.serializer.memory = (this.switchBuffer != null && this.switchBuffer.length >= estimatedLength) ? this.switchBuffer : new byte[estimatedLength]; this.serializer.position = 0; try { // common loop for both records for (int i = 0; i < minFields; i++) { final int thisOff = this.offsets[i]; if (thisOff == NULL_INDICATOR_OFFSET) { final int otherOff = other.offsets[i]; if (otherOff == NULL_INDICATOR_OFFSET) { offsets[i] = NULL_INDICATOR_OFFSET; } else { // take field from other record offsets[i] = this.serializer.position; this.serializer.write(other.binaryData, otherOff, other.lengths[i]); lengths[i] = other.lengths[i]; } } else { // copy field from this one offsets[i] = this.serializer.position; this.serializer.write(this.binaryData, thisOff, this.lengths[i]); lengths[i] = this.lengths[i]; } } // add the trailing fields from one record if (minFields != maxFields) { final Record sourceForRemainder = this.numFields > minFields ? this : other; int begin = -1; int end = -1; int offsetDelta = 0; // go through the offsets, find the non-null fields to account for the remaining data for (int k = minFields; k < maxFields; k++) { final int off = sourceForRemainder.offsets[k]; if (off == NULL_INDICATOR_OFFSET) { offsets[k] = NULL_INDICATOR_OFFSET; } else { end = sourceForRemainder.offsets[k]+sourceForRemainder.lengths[k]; if (begin == -1) { // first non null column in the remainder begin = sourceForRemainder.offsets[k]; offsetDelta = this.serializer.position - begin; } offsets[k] = sourceForRemainder.offsets[k] + offsetDelta; } } // copy the remaining fields directly as binary if (begin != -1) { this.serializer.write(sourceForRemainder.binaryData, begin, end - begin); } // the lengths can be copied directly if (lengths != sourceForRemainder.lengths) { System.arraycopy(sourceForRemainder.lengths, minFields, lengths, minFields, maxFields - minFields); } } } catch (Exception ioex) { throw new RuntimeException("Error creating field union of record data" + ioex.getMessage() == null ? "." : ": " + ioex.getMessage(), ioex); } } else { // the general case, where at least one of the two records has a binary representation that is not in sync. final int estimatedLength = (this.binaryLen > 0 ? this.binaryLen : this.numFields * DEFAULT_FIELD_LEN_ESTIMATE) + (other.binaryLen > 0 ? other.binaryLen : other.numFields * DEFAULT_FIELD_LEN_ESTIMATE); this.serializer.memory = (this.switchBuffer != null && this.switchBuffer.length >= estimatedLength) ? this.switchBuffer : new byte[estimatedLength]; this.serializer.position = 0; try { // common loop for both records for (int i = 0; i < minFields; i++) { final int thisOff = this.offsets[i]; if (thisOff == NULL_INDICATOR_OFFSET) { final int otherOff = other.offsets[i]; if (otherOff == NULL_INDICATOR_OFFSET) { offsets[i] = NULL_INDICATOR_OFFSET; } else if (otherOff == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from other record offsets[i] = this.serializer.position; other.writeFields[i].write(this.serializer); lengths[i] = this.serializer.position - offsets[i]; } else { // take field from other record binary offsets[i] = this.serializer.position; this.serializer.write(other.binaryData, otherOff, other.lengths[i]); lengths[i] = other.lengths[i]; } } else if (thisOff == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from this record offsets[i] = this.serializer.position; this.writeFields[i].write(this.serializer); lengths[i] = this.serializer.position - offsets[i]; } else { // copy field from this one offsets[i] = this.serializer.position; this.serializer.write(this.binaryData, thisOff, this.lengths[i]); lengths[i] = this.lengths[i]; } } // add the trailing fields from one record if (minFields != maxFields) { final Record sourceForRemainder = this.numFields > minFields ? this : other; // go through the offsets, find the non-null fields for (int k = minFields; k < maxFields; k++) { final int off = sourceForRemainder.offsets[k]; if (off == NULL_INDICATOR_OFFSET) { offsets[k] = NULL_INDICATOR_OFFSET; } else if (off == MODIFIED_INDICATOR_OFFSET) { // serialize modified field from the source record offsets[k] = this.serializer.position; sourceForRemainder.writeFields[k].write(this.serializer); lengths[k] = this.serializer.position - offsets[k]; } else { // copy field from the source record binary offsets[k] = this.serializer.position; final int len = sourceForRemainder.lengths[k]; this.serializer.write(sourceForRemainder.binaryData, off, len); lengths[k] = len; } } } } catch (Exception ioex) { throw new RuntimeException("Error creating field union of record data" + ioex.getMessage() == null ? "." : ": " + ioex.getMessage(), ioex); } } serializeHeader(this.serializer, offsets, maxFields); // set the fields this.switchBuffer = this.binaryData; this.binaryData = serializer.memory; this.binaryLen = serializer.position; this.numFields = maxFields; this.offsets = offsets; this.lengths = lengths; this.firstModifiedPos = Integer.MAX_VALUE; // make sure that the object arrays reflect the size as well if (this.readFields == null || this.readFields.length < maxFields) { final Value[] na = new Value[maxFields]; System.arraycopy(this.readFields, 0, na, 0, this.readFields.length); this.readFields = na; } this.writeFields = (this.writeFields == null || this.writeFields.length < maxFields) ? new Value[maxFields] : this.writeFields; }
[ "public", "void", "unionFields", "(", "Record", "other", ")", "{", "final", "int", "minFields", "=", "Math", ".", "min", "(", "this", ".", "numFields", ",", "other", ".", "numFields", ")", ";", "final", "int", "maxFields", "=", "Math", ".", "max", "(",...
Unions the other record's fields with this records fields. After the method invocation with record <code>B</code> as the parameter, this record <code>A</code> will contain at field <code>i</code>: <ul> <li>Field <code>i</code> from record <code>A</code>, if that field is within record <code>A</code>'s number of fields and is not <i>null</i>.</li> <li>Field <code>i</code> from record <code>B</code>, if that field is within record <code>B</code>'s number of fields.</li> </ul> It is not necessary that both records have the same number of fields. This record will have the number of fields of the larger of the two records. Naturally, if both <code>A</code> and <code>B</code> have field <code>i</code> set to <i>null</i>, this record will have <i>null</i> at that position. @param other The records whose fields to union with this record's fields.
[ "Unions", "the", "other", "record", "s", "fields", "with", "this", "records", "fields", ".", "After", "the", "method", "invocation", "with", "record", "<code", ">", "B<", "/", "code", ">", "as", "the", "parameter", "this", "record", "<code", ">", "A<", "...
b62db93bf63cb3bb34dd03d611a779d9e3fc61ac
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L563-L729
train
Union the fields of this record with the given record.
[ 30522, 2270, 11675, 2586, 15155, 1006, 2501, 2060, 1007, 1063, 2345, 20014, 8117, 15155, 1027, 8785, 1012, 8117, 1006, 2023, 1012, 16371, 2213, 15155, 1010, 2060, 1012, 16371, 2213, 15155, 1007, 1025, 2345, 20014, 4098, 15155, 1027, 8785, 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
transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java
AbstractEpollStreamChannel.spliceTo
public final ChannelFuture spliceTo(final AbstractEpollStreamChannel ch, final int len, final ChannelPromise promise) { if (ch.eventLoop() != eventLoop()) { throw new IllegalArgumentException("EventLoops are not the same."); } checkPositiveOrZero(len, "len"); if (ch.config().getEpollMode() != EpollMode.LEVEL_TRIGGERED || config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) { throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED); } checkNotNull(promise, "promise"); if (!isOpen()) { promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION); } else { addToSpliceQueue(new SpliceInChannelTask(ch, len, promise)); failSpliceIfClosed(promise); } return promise; }
java
public final ChannelFuture spliceTo(final AbstractEpollStreamChannel ch, final int len, final ChannelPromise promise) { if (ch.eventLoop() != eventLoop()) { throw new IllegalArgumentException("EventLoops are not the same."); } checkPositiveOrZero(len, "len"); if (ch.config().getEpollMode() != EpollMode.LEVEL_TRIGGERED || config().getEpollMode() != EpollMode.LEVEL_TRIGGERED) { throw new IllegalStateException("spliceTo() supported only when using " + EpollMode.LEVEL_TRIGGERED); } checkNotNull(promise, "promise"); if (!isOpen()) { promise.tryFailure(SPLICE_TO_CLOSED_CHANNEL_EXCEPTION); } else { addToSpliceQueue(new SpliceInChannelTask(ch, len, promise)); failSpliceIfClosed(promise); } return promise; }
[ "public", "final", "ChannelFuture", "spliceTo", "(", "final", "AbstractEpollStreamChannel", "ch", ",", "final", "int", "len", ",", "final", "ChannelPromise", "promise", ")", "{", "if", "(", "ch", ".", "eventLoop", "(", ")", "!=", "eventLoop", "(", ")", ")", ...
Splice from this {@link AbstractEpollStreamChannel} to another {@link AbstractEpollStreamChannel}. The {@code len} is the number of bytes to splice. If using {@link Integer#MAX_VALUE} it will splice until the {@link ChannelFuture} was canceled or it was failed. Please note: <ul> <li>both channels need to be registered to the same {@link EventLoop}, otherwise an {@link IllegalArgumentException} is thrown. </li> <li>{@link EpollChannelConfig#getEpollMode()} must be {@link EpollMode#LEVEL_TRIGGERED} for this and the target {@link AbstractEpollStreamChannel}</li> </ul>
[ "Splice", "from", "this", "{", "@link", "AbstractEpollStreamChannel", "}", "to", "another", "{", "@link", "AbstractEpollStreamChannel", "}", ".", "The", "{", "@code", "len", "}", "is", "the", "number", "of", "bytes", "to", "splice", ".", "If", "using", "{", ...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L162-L180
train
Splice the given channel to the given length.
[ 30522, 2270, 2345, 3149, 11263, 11244, 11867, 13231, 3406, 1006, 2345, 10061, 13699, 14511, 21422, 26058, 10381, 1010, 2345, 20014, 18798, 1010, 2345, 3149, 21572, 28732, 4872, 1007, 1063, 2065, 1006, 10381, 1012, 2724, 4135, 7361, 1006, 1007...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
netty/netty
transport/src/main/java/io/netty/channel/ChannelOption.java
ChannelOption.valueOf
@SuppressWarnings("unchecked") public static <T> ChannelOption<T> valueOf(Class<?> firstNameComponent, String secondNameComponent) { return (ChannelOption<T>) pool.valueOf(firstNameComponent, secondNameComponent); }
java
@SuppressWarnings("unchecked") public static <T> ChannelOption<T> valueOf(Class<?> firstNameComponent, String secondNameComponent) { return (ChannelOption<T>) pool.valueOf(firstNameComponent, secondNameComponent); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "ChannelOption", "<", "T", ">", "valueOf", "(", "Class", "<", "?", ">", "firstNameComponent", ",", "String", "secondNameComponent", ")", "{", "return", "(", "ChannelOption",...
Shortcut of {@link #valueOf(String) valueOf(firstNameComponent.getName() + "#" + secondNameComponent)}.
[ "Shortcut", "of", "{" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/ChannelOption.java#L53-L56
train
Get a channel option from the first name and second name.
[ 30522, 1030, 16081, 9028, 5582, 2015, 1006, 1000, 4895, 5403, 18141, 1000, 1007, 2270, 10763, 1026, 1056, 1028, 3149, 7361, 3508, 1026, 1056, 1028, 3643, 11253, 1006, 2465, 1026, 1029, 1028, 2034, 18442, 9006, 29513, 3372, 1010, 5164, 2117,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.min
public static long min(long... numberArray) { if (isEmpty(numberArray)) { throw new IllegalArgumentException("Number array must not empty !"); } long min = numberArray[0]; for (int i = 0; i < numberArray.length; i++) { if (min > numberArray[i]) { min = numberArray[i]; } } return min; }
java
public static long min(long... numberArray) { if (isEmpty(numberArray)) { throw new IllegalArgumentException("Number array must not empty !"); } long min = numberArray[0]; for (int i = 0; i < numberArray.length; i++) { if (min > numberArray[i]) { min = numberArray[i]; } } return min; }
[ "public", "static", "long", "min", "(", "long", "...", "numberArray", ")", "{", "if", "(", "isEmpty", "(", "numberArray", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Number array must not empty !\"", ")", ";", "}", "long", "min", "=", ...
取最小值 @param numberArray 数字数组 @return 最小值 @since 3.0.9
[ "取最小值" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L3287-L3298
train
Returns the smallest value of the array of longs.
[ 30522, 2270, 10763, 2146, 8117, 1006, 2146, 1012, 1012, 1012, 2193, 2906, 9447, 1007, 1063, 2065, 1006, 2003, 6633, 13876, 2100, 1006, 2193, 2906, 9447, 1007, 1007, 1063, 5466, 2047, 6206, 2906, 22850, 15781, 2595, 24422, 1006, 1000, 2193, ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.unWrap
public static char[] unWrap(Character... values) { if (null == values) { return null; } final int length = values.length; if (0 == length) { return new char[0]; } char[] array = new char[length]; for (int i = 0; i < length; i++) { array[i] = values[i].charValue(); } return array; }
java
public static char[] unWrap(Character... values) { if (null == values) { return null; } final int length = values.length; if (0 == length) { return new char[0]; } char[] array = new char[length]; for (int i = 0; i < length; i++) { array[i] = values[i].charValue(); } return array; }
[ "public", "static", "char", "[", "]", "unWrap", "(", "Character", "...", "values", ")", "{", "if", "(", "null", "==", "values", ")", "{", "return", "null", ";", "}", "final", "int", "length", "=", "values", ".", "length", ";", "if", "(", "0", "==",...
包装类数组转为原始类型数组 @param values 包装类型数组 @return 原始类型数组
[ "包装类数组转为原始类型数组" ]
bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L1509-L1523
train
Creates an array of characters that are not wrapped in a Character object.
[ 30522, 2270, 10763, 25869, 1031, 1033, 4895, 13088, 9331, 1006, 2839, 1012, 1012, 1012, 5300, 1007, 1063, 2065, 1006, 19701, 1027, 1027, 5300, 1007, 1063, 2709, 19701, 1025, 1065, 2345, 20014, 3091, 1027, 5300, 1012, 3091, 1025, 2065, 1006,...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...