repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.readExcel2List
public List<List<String>> readExcel2List(InputStream is, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { """ 读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param is 待读取Excel的数据流 @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @return 返回{@code List<List<String>>}类型的数据集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died """ try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
java
public List<List<String>> readExcel2List(InputStream is, int offsetLine, int limitLine, int sheetIndex) throws Excel4JException, IOException, InvalidFormatException { try (Workbook workbook = WorkbookFactory.create(is)) { return readExcel2ObjectsHandler(workbook, offsetLine, limitLine, sheetIndex); } }
[ "public", "List", "<", "List", "<", "String", ">", ">", "readExcel2List", "(", "InputStream", "is", ",", "int", "offsetLine", ",", "int", "limitLine", ",", "int", "sheetIndex", ")", "throws", "Excel4JException", ",", "IOException", ",", "InvalidFormatException", "{", "try", "(", "Workbook", "workbook", "=", "WorkbookFactory", ".", "create", "(", "is", ")", ")", "{", "return", "readExcel2ObjectsHandler", "(", "workbook", ",", "offsetLine", ",", "limitLine", ",", "sheetIndex", ")", ";", "}", "}" ]
读取Excel表格数据,返回{@code List[List[String]]}类型的数据集合 @param is 待读取Excel的数据流 @param offsetLine Excel表头行(默认是0) @param limitLine 最大读取行数(默认表尾) @param sheetIndex Sheet索引(默认0) @return 返回{@code List<List<String>>}类型的数据集合 @throws Excel4JException 异常 @throws IOException 异常 @throws InvalidFormatException 异常 @author Crab2Died
[ "读取Excel表格数据", "返回", "{", "@code", "List", "[", "List", "[", "String", "]]", "}", "类型的数据集合" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L339-L345
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java
ZookeeperRegistry.subscribeConfig
protected void subscribeConfig(final AbstractInterfaceConfig config, ConfigListener listener) { """ 订阅接口级配置 @param config provider/consumer config @param listener config listener """ try { if (configObserver == null) { // 初始化 configObserver = new ZookeeperConfigObserver(); } configObserver.addConfigListener(config, listener); final String configPath = buildConfigPath(rootPath, config); // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件 PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, configPath, true); pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() { @Override public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception { if (LOGGER.isDebugEnabled(config.getAppName())) { LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]"); } switch (event.getType()) { case CHILD_ADDED: //新增接口级配置 configObserver.addConfig(config, configPath, event.getData()); break; case CHILD_REMOVED: //删除接口级配置 configObserver.removeConfig(config, configPath, event.getData()); break; case CHILD_UPDATED:// 更新接口级配置 configObserver.updateConfig(config, configPath, event.getData()); break; default: break; } } }); pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); INTERFACE_CONFIG_CACHE.put(configPath, pathChildrenCache); configObserver.updateConfigAll(config, configPath, pathChildrenCache.getCurrentData()); } catch (Exception e) { throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e); } }
java
protected void subscribeConfig(final AbstractInterfaceConfig config, ConfigListener listener) { try { if (configObserver == null) { // 初始化 configObserver = new ZookeeperConfigObserver(); } configObserver.addConfigListener(config, listener); final String configPath = buildConfigPath(rootPath, config); // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件 PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, configPath, true); pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() { @Override public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception { if (LOGGER.isDebugEnabled(config.getAppName())) { LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]"); } switch (event.getType()) { case CHILD_ADDED: //新增接口级配置 configObserver.addConfig(config, configPath, event.getData()); break; case CHILD_REMOVED: //删除接口级配置 configObserver.removeConfig(config, configPath, event.getData()); break; case CHILD_UPDATED:// 更新接口级配置 configObserver.updateConfig(config, configPath, event.getData()); break; default: break; } } }); pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); INTERFACE_CONFIG_CACHE.put(configPath, pathChildrenCache); configObserver.updateConfigAll(config, configPath, pathChildrenCache.getCurrentData()); } catch (Exception e) { throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e); } }
[ "protected", "void", "subscribeConfig", "(", "final", "AbstractInterfaceConfig", "config", ",", "ConfigListener", "listener", ")", "{", "try", "{", "if", "(", "configObserver", "==", "null", ")", "{", "// 初始化", "configObserver", "=", "new", "ZookeeperConfigObserver", "(", ")", ";", "}", "configObserver", ".", "addConfigListener", "(", "config", ",", "listener", ")", ";", "final", "String", "configPath", "=", "buildConfigPath", "(", "rootPath", ",", "config", ")", ";", "// 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件", "PathChildrenCache", "pathChildrenCache", "=", "new", "PathChildrenCache", "(", "zkClient", ",", "configPath", ",", "true", ")", ";", "pathChildrenCache", ".", "getListenable", "(", ")", ".", "addListener", "(", "new", "PathChildrenCacheListener", "(", ")", "{", "@", "Override", "public", "void", "childEvent", "(", "CuratorFramework", "client1", ",", "PathChildrenCacheEvent", "event", ")", "throws", "Exception", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", "config", ".", "getAppName", "(", ")", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Receive zookeeper event: \"", "+", "\"type=[\"", "+", "event", ".", "getType", "(", ")", "+", "\"]\"", ")", ";", "}", "switch", "(", "event", ".", "getType", "(", ")", ")", "{", "case", "CHILD_ADDED", ":", "//新增接口级配置", "configObserver", ".", "addConfig", "(", "config", ",", "configPath", ",", "event", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "CHILD_REMOVED", ":", "//删除接口级配置", "configObserver", ".", "removeConfig", "(", "config", ",", "configPath", ",", "event", ".", "getData", "(", ")", ")", ";", "break", ";", "case", "CHILD_UPDATED", ":", "// 更新接口级配置", "configObserver", ".", "updateConfig", "(", "config", ",", "configPath", ",", "event", ".", "getData", "(", ")", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "}", ")", ";", "pathChildrenCache", ".", "start", "(", "PathChildrenCache", ".", "StartMode", ".", "BUILD_INITIAL_CACHE", ")", ";", "INTERFACE_CONFIG_CACHE", ".", "put", "(", "configPath", ",", "pathChildrenCache", ")", ";", "configObserver", ".", "updateConfigAll", "(", "config", ",", "configPath", ",", "pathChildrenCache", ".", "getCurrentData", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SofaRpcRuntimeException", "(", "\"Failed to subscribe provider config from zookeeperRegistry!\"", ",", "e", ")", ";", "}", "}" ]
订阅接口级配置 @param config provider/consumer config @param listener config listener
[ "订阅接口级配置" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java#L409-L445
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java
DatumWriterGenerator.encodeUnion
private void encodeUnion(GeneratorAdapter mg, TypeToken<?> outputType, Schema schema, int value, int encoder, int schemaLocal, int seenRefs) { """ Generates method body for encoding union schema. Union schema is used for representing object references that could be {@code null}. @param mg @param outputType @param schema @param value @param encoder @param schemaLocal @param seenRefs """ Label nullLabel = mg.newLabel(); Label endLabel = mg.newLabel(); mg.loadArg(value); mg.ifNull(nullLabel); // Not null, write out 0 and then encode the value encodeInt(mg, 0, encoder); mg.loadThis(); mg.loadArg(value); doCast(mg, outputType, schema.getUnionSchema(0)); mg.loadArg(encoder); mg.loadArg(schemaLocal); mg.push(0); mg.invokeVirtual(Type.getType(Schema.class), getMethod(Schema.class, "getUnionSchema", int.class)); mg.loadArg(seenRefs); mg.invokeVirtual(classType, getEncodeMethod(outputType, schema.getUnionSchema(0))); mg.goTo(endLabel); mg.mark(nullLabel); // Null, write out 1 encodeInt(mg, 1, encoder); mg.mark(endLabel); }
java
private void encodeUnion(GeneratorAdapter mg, TypeToken<?> outputType, Schema schema, int value, int encoder, int schemaLocal, int seenRefs) { Label nullLabel = mg.newLabel(); Label endLabel = mg.newLabel(); mg.loadArg(value); mg.ifNull(nullLabel); // Not null, write out 0 and then encode the value encodeInt(mg, 0, encoder); mg.loadThis(); mg.loadArg(value); doCast(mg, outputType, schema.getUnionSchema(0)); mg.loadArg(encoder); mg.loadArg(schemaLocal); mg.push(0); mg.invokeVirtual(Type.getType(Schema.class), getMethod(Schema.class, "getUnionSchema", int.class)); mg.loadArg(seenRefs); mg.invokeVirtual(classType, getEncodeMethod(outputType, schema.getUnionSchema(0))); mg.goTo(endLabel); mg.mark(nullLabel); // Null, write out 1 encodeInt(mg, 1, encoder); mg.mark(endLabel); }
[ "private", "void", "encodeUnion", "(", "GeneratorAdapter", "mg", ",", "TypeToken", "<", "?", ">", "outputType", ",", "Schema", "schema", ",", "int", "value", ",", "int", "encoder", ",", "int", "schemaLocal", ",", "int", "seenRefs", ")", "{", "Label", "nullLabel", "=", "mg", ".", "newLabel", "(", ")", ";", "Label", "endLabel", "=", "mg", ".", "newLabel", "(", ")", ";", "mg", ".", "loadArg", "(", "value", ")", ";", "mg", ".", "ifNull", "(", "nullLabel", ")", ";", "// Not null, write out 0 and then encode the value", "encodeInt", "(", "mg", ",", "0", ",", "encoder", ")", ";", "mg", ".", "loadThis", "(", ")", ";", "mg", ".", "loadArg", "(", "value", ")", ";", "doCast", "(", "mg", ",", "outputType", ",", "schema", ".", "getUnionSchema", "(", "0", ")", ")", ";", "mg", ".", "loadArg", "(", "encoder", ")", ";", "mg", ".", "loadArg", "(", "schemaLocal", ")", ";", "mg", ".", "push", "(", "0", ")", ";", "mg", ".", "invokeVirtual", "(", "Type", ".", "getType", "(", "Schema", ".", "class", ")", ",", "getMethod", "(", "Schema", ".", "class", ",", "\"getUnionSchema\"", ",", "int", ".", "class", ")", ")", ";", "mg", ".", "loadArg", "(", "seenRefs", ")", ";", "mg", ".", "invokeVirtual", "(", "classType", ",", "getEncodeMethod", "(", "outputType", ",", "schema", ".", "getUnionSchema", "(", "0", ")", ")", ")", ";", "mg", ".", "goTo", "(", "endLabel", ")", ";", "mg", ".", "mark", "(", "nullLabel", ")", ";", "// Null, write out 1", "encodeInt", "(", "mg", ",", "1", ",", "encoder", ")", ";", "mg", ".", "mark", "(", "endLabel", ")", ";", "}" ]
Generates method body for encoding union schema. Union schema is used for representing object references that could be {@code null}. @param mg @param outputType @param schema @param value @param encoder @param schemaLocal @param seenRefs
[ "Generates", "method", "body", "for", "encoding", "union", "schema", ".", "Union", "schema", "is", "used", "for", "representing", "object", "references", "that", "could", "be", "{" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java#L805-L831
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/Server.java
Server.addWebApplication
public WebApplicationContext addWebApplication(String contextPathSpec, String webApp) throws IOException { """ Add Web Application. @param contextPathSpec The context path spec. Which must be of the form / or /path/* @param webApp The Web application directory or WAR file. @return The WebApplicationContext @exception IOException """ return addWebApplication(null,contextPathSpec,webApp); }
java
public WebApplicationContext addWebApplication(String contextPathSpec, String webApp) throws IOException { return addWebApplication(null,contextPathSpec,webApp); }
[ "public", "WebApplicationContext", "addWebApplication", "(", "String", "contextPathSpec", ",", "String", "webApp", ")", "throws", "IOException", "{", "return", "addWebApplication", "(", "null", ",", "contextPathSpec", ",", "webApp", ")", ";", "}" ]
Add Web Application. @param contextPathSpec The context path spec. Which must be of the form / or /path/* @param webApp The Web application directory or WAR file. @return The WebApplicationContext @exception IOException
[ "Add", "Web", "Application", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/Server.java#L237-L242
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanResult.java
ScanResult.withItems
public ScanResult withItems(java.util.Map<String, AttributeValue>... items) { """ <p> An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setItems(java.util.Collection)} or {@link #withItems(java.util.Collection)} if you want to override the existing values. </p> @param items An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute. @return Returns a reference to this object so that method calls can be chained together. """ if (this.items == null) { setItems(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(items.length)); } for (java.util.Map<String, AttributeValue> ele : items) { this.items.add(ele); } return this; }
java
public ScanResult withItems(java.util.Map<String, AttributeValue>... items) { if (this.items == null) { setItems(new java.util.ArrayList<java.util.Map<String, AttributeValue>>(items.length)); } for (java.util.Map<String, AttributeValue> ele : items) { this.items.add(ele); } return this; }
[ "public", "ScanResult", "withItems", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", "...", "items", ")", "{", "if", "(", "this", ".", "items", "==", "null", ")", "{", "setItems", "(", "new", "java", ".", "util", ".", "ArrayList", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", ">", "(", "items", ".", "length", ")", ")", ";", "}", "for", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", "ele", ":", "items", ")", "{", "this", ".", "items", ".", "add", "(", "ele", ")", ";", "}", "return", "this", ";", "}" ]
<p> An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setItems(java.util.Collection)} or {@link #withItems(java.util.Collection)} if you want to override the existing values. </p> @param items An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "An", "array", "of", "item", "attributes", "that", "match", "the", "scan", "criteria", ".", "Each", "element", "in", "this", "array", "consists", "of", "an", "attribute", "name", "and", "the", "value", "for", "that", "attribute", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "This", "method", "appends", "the", "values", "to", "the", "existing", "list", "(", "if", "any", ")", ".", "Use", "{", "@link", "#setItems", "(", "java", ".", "util", ".", "Collection", ")", "}", "or", "{", "@link", "#withItems", "(", "java", ".", "util", ".", "Collection", ")", "}", "if", "you", "want", "to", "override", "the", "existing", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanResult.java#L142-L150
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java
AbstractConnectionManager.getConnection
public Connection getConnection() { """ gets a connection from the pool. initializePool() must've been called before calling this method. If all connections are in use, this method will block, unless maxWait has been set. @return a connection. """ Connection connection; try { if (getLogger().isDebugEnabled()) { getLogger().debug("before: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle()); } connection = dataSource.getConnection(); if (getLogger().isDebugEnabled()) { getLogger().debug("after: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle() + " giving " + connection); } } catch (Exception e) { getLogger().error("Unable to get connection " + this, e); throw new MithraDatabaseException("could not get connection", e); } if (connection == null) { throw new MithraDatabaseException("could not get connection"+this); } return connection; }
java
public Connection getConnection() { Connection connection; try { if (getLogger().isDebugEnabled()) { getLogger().debug("before: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle()); } connection = dataSource.getConnection(); if (getLogger().isDebugEnabled()) { getLogger().debug("after: active : " + connectionPool.getNumActive() + " idle: " + connectionPool.getNumIdle() + " giving " + connection); } } catch (Exception e) { getLogger().error("Unable to get connection " + this, e); throw new MithraDatabaseException("could not get connection", e); } if (connection == null) { throw new MithraDatabaseException("could not get connection"+this); } return connection; }
[ "public", "Connection", "getConnection", "(", ")", "{", "Connection", "connection", ";", "try", "{", "if", "(", "getLogger", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "getLogger", "(", ")", ".", "debug", "(", "\"before: active : \"", "+", "connectionPool", ".", "getNumActive", "(", ")", "+", "\" idle: \"", "+", "connectionPool", ".", "getNumIdle", "(", ")", ")", ";", "}", "connection", "=", "dataSource", ".", "getConnection", "(", ")", ";", "if", "(", "getLogger", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "getLogger", "(", ")", ".", "debug", "(", "\"after: active : \"", "+", "connectionPool", ".", "getNumActive", "(", ")", "+", "\" idle: \"", "+", "connectionPool", ".", "getNumIdle", "(", ")", "+", "\" giving \"", "+", "connection", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "getLogger", "(", ")", ".", "error", "(", "\"Unable to get connection \"", "+", "this", ",", "e", ")", ";", "throw", "new", "MithraDatabaseException", "(", "\"could not get connection\"", ",", "e", ")", ";", "}", "if", "(", "connection", "==", "null", ")", "{", "throw", "new", "MithraDatabaseException", "(", "\"could not get connection\"", "+", "this", ")", ";", "}", "return", "connection", ";", "}" ]
gets a connection from the pool. initializePool() must've been called before calling this method. If all connections are in use, this method will block, unless maxWait has been set. @return a connection.
[ "gets", "a", "connection", "from", "the", "pool", ".", "initializePool", "()", "must", "ve", "been", "called", "before", "calling", "this", "method", ".", "If", "all", "connections", "are", "in", "use", "this", "method", "will", "block", "unless", "maxWait", "has", "been", "set", "." ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java#L212-L238
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/output/Values.java
Values.getObject
public <V> V getObject(final String key, final Class<V> type) { """ Get a value as a string. @param key the key for looking up the value. @param type the type of the object @param <V> the type """ final Object obj = this.values.get(key); return type.cast(obj); }
java
public <V> V getObject(final String key, final Class<V> type) { final Object obj = this.values.get(key); return type.cast(obj); }
[ "public", "<", "V", ">", "V", "getObject", "(", "final", "String", "key", ",", "final", "Class", "<", "V", ">", "type", ")", "{", "final", "Object", "obj", "=", "this", ".", "values", ".", "get", "(", "key", ")", ";", "return", "type", ".", "cast", "(", "obj", ")", ";", "}" ]
Get a value as a string. @param key the key for looking up the value. @param type the type of the object @param <V> the type
[ "Get", "a", "value", "as", "a", "string", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/output/Values.java#L333-L336
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/SocketOutputStream.java
SocketOutputStream.transferToFully
public void transferToFully(FileChannel fileCh, long position, int count) throws IOException { """ Transfers data from FileChannel using {@link FileChannel#transferTo(long, long, WritableByteChannel)}. Similar to readFully(), this waits till requested amount of data is transfered. @param fileCh FileChannel to transfer data from. @param position position within the channel where the transfer begins @param count number of bytes to transfer. @throws EOFException If end of input file is reached before requested number of bytes are transfered. @throws SocketTimeoutException If this channel blocks transfer longer than timeout for this stream. @throws IOException Includes any exception thrown by {@link FileChannel#transferTo(long, long, WritableByteChannel)}. """ while (count > 0) { /* * Ideally we should wait after transferTo returns 0. But because of * a bug in JRE on Linux (http://bugs.sun.com/view_bug.do?bug_id=5103988), * which throws an exception instead of returning 0, we wait for the * channel to be writable before writing to it. If you ever see * IOException with message "Resource temporarily unavailable" * thrown here, please let us know. * * Once we move to JAVA SE 7, wait should be moved to correct place. */ waitForWritable(); int nTransfered = (int) fileCh.transferTo(position, count, getChannel()); if (nTransfered == 0) { //check if end of file is reached. if (position >= fileCh.size()) { throw new EOFException("EOF Reached. file size is " + fileCh.size() + " and " + count + " more bytes left to be " + "transfered."); } //otherwise assume the socket is full. //waitForWritable(); // see comment above. } else if (nTransfered < 0) { throw new IOException("Unexpected return of " + nTransfered + " from transferTo()"); } else { position += nTransfered; count -= nTransfered; } } }
java
public void transferToFully(FileChannel fileCh, long position, int count) throws IOException { while (count > 0) { /* * Ideally we should wait after transferTo returns 0. But because of * a bug in JRE on Linux (http://bugs.sun.com/view_bug.do?bug_id=5103988), * which throws an exception instead of returning 0, we wait for the * channel to be writable before writing to it. If you ever see * IOException with message "Resource temporarily unavailable" * thrown here, please let us know. * * Once we move to JAVA SE 7, wait should be moved to correct place. */ waitForWritable(); int nTransfered = (int) fileCh.transferTo(position, count, getChannel()); if (nTransfered == 0) { //check if end of file is reached. if (position >= fileCh.size()) { throw new EOFException("EOF Reached. file size is " + fileCh.size() + " and " + count + " more bytes left to be " + "transfered."); } //otherwise assume the socket is full. //waitForWritable(); // see comment above. } else if (nTransfered < 0) { throw new IOException("Unexpected return of " + nTransfered + " from transferTo()"); } else { position += nTransfered; count -= nTransfered; } } }
[ "public", "void", "transferToFully", "(", "FileChannel", "fileCh", ",", "long", "position", ",", "int", "count", ")", "throws", "IOException", "{", "while", "(", "count", ">", "0", ")", "{", "/* \n * Ideally we should wait after transferTo returns 0. But because of\n * a bug in JRE on Linux (http://bugs.sun.com/view_bug.do?bug_id=5103988),\n * which throws an exception instead of returning 0, we wait for the\n * channel to be writable before writing to it. If you ever see \n * IOException with message \"Resource temporarily unavailable\" \n * thrown here, please let us know.\n * \n * Once we move to JAVA SE 7, wait should be moved to correct place.\n */", "waitForWritable", "(", ")", ";", "int", "nTransfered", "=", "(", "int", ")", "fileCh", ".", "transferTo", "(", "position", ",", "count", ",", "getChannel", "(", ")", ")", ";", "if", "(", "nTransfered", "==", "0", ")", "{", "//check if end of file is reached.", "if", "(", "position", ">=", "fileCh", ".", "size", "(", ")", ")", "{", "throw", "new", "EOFException", "(", "\"EOF Reached. file size is \"", "+", "fileCh", ".", "size", "(", ")", "+", "\" and \"", "+", "count", "+", "\" more bytes left to be \"", "+", "\"transfered.\"", ")", ";", "}", "//otherwise assume the socket is full.", "//waitForWritable(); // see comment above.", "}", "else", "if", "(", "nTransfered", "<", "0", ")", "{", "throw", "new", "IOException", "(", "\"Unexpected return of \"", "+", "nTransfered", "+", "\" from transferTo()\"", ")", ";", "}", "else", "{", "position", "+=", "nTransfered", ";", "count", "-=", "nTransfered", ";", "}", "}", "}" ]
Transfers data from FileChannel using {@link FileChannel#transferTo(long, long, WritableByteChannel)}. Similar to readFully(), this waits till requested amount of data is transfered. @param fileCh FileChannel to transfer data from. @param position position within the channel where the transfer begins @param count number of bytes to transfer. @throws EOFException If end of input file is reached before requested number of bytes are transfered. @throws SocketTimeoutException If this channel blocks transfer longer than timeout for this stream. @throws IOException Includes any exception thrown by {@link FileChannel#transferTo(long, long, WritableByteChannel)}.
[ "Transfers", "data", "from", "FileChannel", "using", "{", "@link", "FileChannel#transferTo", "(", "long", "long", "WritableByteChannel", ")", "}", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/SocketOutputStream.java#L184-L218
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/data/ModificationAwareList.java
ModificationAwareList.add
@Override public void add(int location, T object) { """ /* Everything below this comment: implementation of the list interface """ list.add(location, object); onModification(); }
java
@Override public void add(int location, T object) { list.add(location, object); onModification(); }
[ "@", "Override", "public", "void", "add", "(", "int", "location", ",", "T", "object", ")", "{", "list", ".", "add", "(", "location", ",", "object", ")", ";", "onModification", "(", ")", ";", "}" ]
/* Everything below this comment: implementation of the list interface
[ "/", "*", "Everything", "below", "this", "comment", ":", "implementation", "of", "the", "list", "interface" ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/data/ModificationAwareList.java#L37-L42
Netflix/netflix-graph
src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java
NFBuildGraph.getPropertySpec
public NFPropertySpec getPropertySpec(String nodeType, String propertyName) { """ Returns the {@link NFPropertySpec} associated with the supplied node type and property name. """ NFNodeSpec nodeSpec = graphSpec.getNodeSpec(nodeType); NFPropertySpec propertySpec = nodeSpec.getPropertySpec(propertyName); return propertySpec; }
java
public NFPropertySpec getPropertySpec(String nodeType, String propertyName) { NFNodeSpec nodeSpec = graphSpec.getNodeSpec(nodeType); NFPropertySpec propertySpec = nodeSpec.getPropertySpec(propertyName); return propertySpec; }
[ "public", "NFPropertySpec", "getPropertySpec", "(", "String", "nodeType", ",", "String", "propertyName", ")", "{", "NFNodeSpec", "nodeSpec", "=", "graphSpec", ".", "getNodeSpec", "(", "nodeType", ")", ";", "NFPropertySpec", "propertySpec", "=", "nodeSpec", ".", "getPropertySpec", "(", "propertyName", ")", ";", "return", "propertySpec", ";", "}" ]
Returns the {@link NFPropertySpec} associated with the supplied node type and property name.
[ "Returns", "the", "{" ]
train
https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/build/NFBuildGraph.java#L142-L146
arquillian/arquillian-cube
kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java
KuberntesServiceUrlResourceProvider.getPath
private static String getPath(Service service, Annotation... qualifiers) { """ Find the path to use . Uses java annotations first and if not found, uses kubernetes annotations on the service object. @param service The target service. @param qualifiers The set of qualifiers. @return Returns the resolved path of '/' as a fallback. """ for (Annotation q : qualifiers) { if (q instanceof Scheme) { return ((Scheme) q).value(); } } if (service.getMetadata() != null && service.getMetadata().getAnnotations() != null) { String s = service.getMetadata().getAnnotations().get(SERVICE_SCHEME); if (s != null && s.isEmpty()) { return s; } } return DEFAULT_PATH; }
java
private static String getPath(Service service, Annotation... qualifiers) { for (Annotation q : qualifiers) { if (q instanceof Scheme) { return ((Scheme) q).value(); } } if (service.getMetadata() != null && service.getMetadata().getAnnotations() != null) { String s = service.getMetadata().getAnnotations().get(SERVICE_SCHEME); if (s != null && s.isEmpty()) { return s; } } return DEFAULT_PATH; }
[ "private", "static", "String", "getPath", "(", "Service", "service", ",", "Annotation", "...", "qualifiers", ")", "{", "for", "(", "Annotation", "q", ":", "qualifiers", ")", "{", "if", "(", "q", "instanceof", "Scheme", ")", "{", "return", "(", "(", "Scheme", ")", "q", ")", ".", "value", "(", ")", ";", "}", "}", "if", "(", "service", ".", "getMetadata", "(", ")", "!=", "null", "&&", "service", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", "!=", "null", ")", "{", "String", "s", "=", "service", ".", "getMetadata", "(", ")", ".", "getAnnotations", "(", ")", ".", "get", "(", "SERVICE_SCHEME", ")", ";", "if", "(", "s", "!=", "null", "&&", "s", ".", "isEmpty", "(", ")", ")", "{", "return", "s", ";", "}", "}", "return", "DEFAULT_PATH", ";", "}" ]
Find the path to use . Uses java annotations first and if not found, uses kubernetes annotations on the service object. @param service The target service. @param qualifiers The set of qualifiers. @return Returns the resolved path of '/' as a fallback.
[ "Find", "the", "path", "to", "use", ".", "Uses", "java", "annotations", "first", "and", "if", "not", "found", "uses", "kubernetes", "annotations", "on", "the", "service", "object", "." ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java#L212-L226
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StorageReadManager.java
StorageReadManager.executeStorageRead
private void executeStorageRead(Request request) { """ Executes the Storage Read for the given request. @param request The request. """ try { byte[] buffer = new byte[request.length]; getHandle() .thenComposeAsync(handle -> this.storage.read(handle, request.offset, buffer, 0, buffer.length, request.getTimeout()), this.executor) .thenAcceptAsync(bytesRead -> request.complete(new ByteArraySegment(buffer, 0, bytesRead)), this.executor) .whenComplete((r, ex) -> { if (ex != null) { request.fail(ex); } // Unregister the Request after every request fulfillment. finalizeRequest(request); }); } catch (Throwable ex) { if (Exceptions.mustRethrow(ex)) { throw ex; } request.fail(ex); finalizeRequest(request); } }
java
private void executeStorageRead(Request request) { try { byte[] buffer = new byte[request.length]; getHandle() .thenComposeAsync(handle -> this.storage.read(handle, request.offset, buffer, 0, buffer.length, request.getTimeout()), this.executor) .thenAcceptAsync(bytesRead -> request.complete(new ByteArraySegment(buffer, 0, bytesRead)), this.executor) .whenComplete((r, ex) -> { if (ex != null) { request.fail(ex); } // Unregister the Request after every request fulfillment. finalizeRequest(request); }); } catch (Throwable ex) { if (Exceptions.mustRethrow(ex)) { throw ex; } request.fail(ex); finalizeRequest(request); } }
[ "private", "void", "executeStorageRead", "(", "Request", "request", ")", "{", "try", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "request", ".", "length", "]", ";", "getHandle", "(", ")", ".", "thenComposeAsync", "(", "handle", "->", "this", ".", "storage", ".", "read", "(", "handle", ",", "request", ".", "offset", ",", "buffer", ",", "0", ",", "buffer", ".", "length", ",", "request", ".", "getTimeout", "(", ")", ")", ",", "this", ".", "executor", ")", ".", "thenAcceptAsync", "(", "bytesRead", "->", "request", ".", "complete", "(", "new", "ByteArraySegment", "(", "buffer", ",", "0", ",", "bytesRead", ")", ")", ",", "this", ".", "executor", ")", ".", "whenComplete", "(", "(", "r", ",", "ex", ")", "->", "{", "if", "(", "ex", "!=", "null", ")", "{", "request", ".", "fail", "(", "ex", ")", ";", "}", "// Unregister the Request after every request fulfillment.", "finalizeRequest", "(", "request", ")", ";", "}", ")", ";", "}", "catch", "(", "Throwable", "ex", ")", "{", "if", "(", "Exceptions", ".", "mustRethrow", "(", "ex", ")", ")", "{", "throw", "ex", ";", "}", "request", ".", "fail", "(", "ex", ")", ";", "finalizeRequest", "(", "request", ")", ";", "}", "}" ]
Executes the Storage Read for the given request. @param request The request.
[ "Executes", "the", "Storage", "Read", "for", "the", "given", "request", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StorageReadManager.java#L132-L154
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.moveElement
public boolean moveElement(String name, Object sourceParent, Object targetParent) { """ Move an element from on group to another. The elements name will remain the same. @param name The name of the element within the sourceParent group. @param sourceParent The original parent group of the element. @param targetParent The target parent group for the element. @return true when move was successful """ Element sourceGroup = null; Element targetGroup = null; Element element = null; if (sourceParent != null) { sourceGroup = getGroup(sourceParent); element = getElement(sourceParent, name); } if (targetParent != null) { targetGroup = getGroup(targetParent); } if (sourceGroup == null || targetGroup == null) { return false; } if (Dom.isOrHasChild(sourceGroup, element)) { Dom.removeChild(sourceGroup, element); String newId = Dom.assembleId(targetGroup.getId(), name); elementToName.remove(element.getId()); elementToName.put(newId, name); Dom.setElementAttribute(element, "id", newId); Dom.appendChild(targetGroup, element); return true; } return false; }
java
public boolean moveElement(String name, Object sourceParent, Object targetParent) { Element sourceGroup = null; Element targetGroup = null; Element element = null; if (sourceParent != null) { sourceGroup = getGroup(sourceParent); element = getElement(sourceParent, name); } if (targetParent != null) { targetGroup = getGroup(targetParent); } if (sourceGroup == null || targetGroup == null) { return false; } if (Dom.isOrHasChild(sourceGroup, element)) { Dom.removeChild(sourceGroup, element); String newId = Dom.assembleId(targetGroup.getId(), name); elementToName.remove(element.getId()); elementToName.put(newId, name); Dom.setElementAttribute(element, "id", newId); Dom.appendChild(targetGroup, element); return true; } return false; }
[ "public", "boolean", "moveElement", "(", "String", "name", ",", "Object", "sourceParent", ",", "Object", "targetParent", ")", "{", "Element", "sourceGroup", "=", "null", ";", "Element", "targetGroup", "=", "null", ";", "Element", "element", "=", "null", ";", "if", "(", "sourceParent", "!=", "null", ")", "{", "sourceGroup", "=", "getGroup", "(", "sourceParent", ")", ";", "element", "=", "getElement", "(", "sourceParent", ",", "name", ")", ";", "}", "if", "(", "targetParent", "!=", "null", ")", "{", "targetGroup", "=", "getGroup", "(", "targetParent", ")", ";", "}", "if", "(", "sourceGroup", "==", "null", "||", "targetGroup", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "Dom", ".", "isOrHasChild", "(", "sourceGroup", ",", "element", ")", ")", "{", "Dom", ".", "removeChild", "(", "sourceGroup", ",", "element", ")", ";", "String", "newId", "=", "Dom", ".", "assembleId", "(", "targetGroup", ".", "getId", "(", ")", ",", "name", ")", ";", "elementToName", ".", "remove", "(", "element", ".", "getId", "(", ")", ")", ";", "elementToName", ".", "put", "(", "newId", ",", "name", ")", ";", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"id\"", ",", "newId", ")", ";", "Dom", ".", "appendChild", "(", "targetGroup", ",", "element", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Move an element from on group to another. The elements name will remain the same. @param name The name of the element within the sourceParent group. @param sourceParent The original parent group of the element. @param targetParent The target parent group for the element. @return true when move was successful
[ "Move", "an", "element", "from", "on", "group", "to", "another", ".", "The", "elements", "name", "will", "remain", "the", "same", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L284-L308
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/HostAddress.java
HostAddress.fromParts
public static HostAddress fromParts(String host, int port) { """ Build a HostAddress instance from separate host and port values. <p> <p>Note: Non-bracketed IPv6 literals are allowed. @param host the host string to parse. Must not contain a port number. @param port a port number from [0..65535] @return if parsing was successful, a populated HostAddress object. @throws IllegalArgumentException if {@code host} contains a port number, or {@code port} is out of range. """ if (!isValidPort(port)) { throw new IllegalArgumentException("Port is invalid: " + port); } HostAddress parsedHost = fromString(host); if (parsedHost.hasPort()) { throw new IllegalArgumentException("host contains a port declaration: " + host); } return new HostAddress(parsedHost.host, port); }
java
public static HostAddress fromParts(String host, int port) { if (!isValidPort(port)) { throw new IllegalArgumentException("Port is invalid: " + port); } HostAddress parsedHost = fromString(host); if (parsedHost.hasPort()) { throw new IllegalArgumentException("host contains a port declaration: " + host); } return new HostAddress(parsedHost.host, port); }
[ "public", "static", "HostAddress", "fromParts", "(", "String", "host", ",", "int", "port", ")", "{", "if", "(", "!", "isValidPort", "(", "port", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Port is invalid: \"", "+", "port", ")", ";", "}", "HostAddress", "parsedHost", "=", "fromString", "(", "host", ")", ";", "if", "(", "parsedHost", ".", "hasPort", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"host contains a port declaration: \"", "+", "host", ")", ";", "}", "return", "new", "HostAddress", "(", "parsedHost", ".", "host", ",", "port", ")", ";", "}" ]
Build a HostAddress instance from separate host and port values. <p> <p>Note: Non-bracketed IPv6 literals are allowed. @param host the host string to parse. Must not contain a port number. @param port a port number from [0..65535] @return if parsing was successful, a populated HostAddress object. @throws IllegalArgumentException if {@code host} contains a port number, or {@code port} is out of range.
[ "Build", "a", "HostAddress", "instance", "from", "separate", "host", "and", "port", "values", ".", "<p", ">", "<p", ">", "Note", ":", "Non", "-", "bracketed", "IPv6", "literals", "are", "allowed", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/HostAddress.java#L136-L146
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuItemRenderer.java
WMenuItemRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WMenuItem. @param component the WMenuItem to paint. @param renderContext the RenderContext to paint to. """ WMenuItem item = (WMenuItem) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:menuitem"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (item.isSubmit()) { xml.appendAttribute("submit", "true"); } else { xml.appendOptionalUrlAttribute("url", item.getUrl()); xml.appendOptionalAttribute("targetWindow", item.getTargetWindow()); } xml.appendOptionalAttribute("disabled", item.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", item.isHidden(), "true"); xml.appendOptionalAttribute("selected", item.isSelected(), "true"); xml.appendOptionalAttribute("role", getRole(item)); xml.appendOptionalAttribute("cancel", item.isCancel(), "true"); xml.appendOptionalAttribute("msg", item.getMessage()); xml.appendOptionalAttribute("toolTip", item.getToolTip()); if (item.isTopLevelItem()) { xml.appendOptionalAttribute("accessKey", item.getAccessKeyAsString()); } xml.appendClose(); item.getDecoratedLabel().paint(renderContext); xml.appendEndTag("ui:menuitem"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WMenuItem item = (WMenuItem) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:menuitem"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (item.isSubmit()) { xml.appendAttribute("submit", "true"); } else { xml.appendOptionalUrlAttribute("url", item.getUrl()); xml.appendOptionalAttribute("targetWindow", item.getTargetWindow()); } xml.appendOptionalAttribute("disabled", item.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", item.isHidden(), "true"); xml.appendOptionalAttribute("selected", item.isSelected(), "true"); xml.appendOptionalAttribute("role", getRole(item)); xml.appendOptionalAttribute("cancel", item.isCancel(), "true"); xml.appendOptionalAttribute("msg", item.getMessage()); xml.appendOptionalAttribute("toolTip", item.getToolTip()); if (item.isTopLevelItem()) { xml.appendOptionalAttribute("accessKey", item.getAccessKeyAsString()); } xml.appendClose(); item.getDecoratedLabel().paint(renderContext); xml.appendEndTag("ui:menuitem"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WMenuItem", "item", "=", "(", "WMenuItem", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:menuitem\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "if", "(", "item", ".", "isSubmit", "(", ")", ")", "{", "xml", ".", "appendAttribute", "(", "\"submit\"", ",", "\"true\"", ")", ";", "}", "else", "{", "xml", ".", "appendOptionalUrlAttribute", "(", "\"url\"", ",", "item", ".", "getUrl", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"targetWindow\"", ",", "item", ".", "getTargetWindow", "(", ")", ")", ";", "}", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "item", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "item", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"selected\"", ",", "item", ".", "isSelected", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"role\"", ",", "getRole", "(", "item", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"cancel\"", ",", "item", ".", "isCancel", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"msg\"", ",", "item", ".", "getMessage", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "item", ".", "getToolTip", "(", ")", ")", ";", "if", "(", "item", ".", "isTopLevelItem", "(", ")", ")", "{", "xml", ".", "appendOptionalAttribute", "(", "\"accessKey\"", ",", "item", ".", "getAccessKeyAsString", "(", ")", ")", ";", "}", "xml", ".", "appendClose", "(", ")", ";", "item", ".", "getDecoratedLabel", "(", ")", ".", "paint", "(", "renderContext", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:menuitem\"", ")", ";", "}" ]
Paints the given WMenuItem. @param component the WMenuItem to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WMenuItem", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMenuItemRenderer.java#L50-L84
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java
SibRaConnection.createConsumerSession
@Override public ConsumerSession createConsumerSession( final SIDestinationAddress destAddr, final DestinationType destType, final SelectionCriteria criteria, final Reliability reliability, final boolean enableReadAhead, final boolean nolocal, final Reliability unrecoverableReliability, final boolean bifurcatable, final String alternateUser) throws SIConnectionDroppedException, SIConnectionUnavailableException, SIConnectionLostException, SILimitExceededException, SINotAuthorizedException, SIDestinationLockedException, SITemporaryDestinationNotFoundException, SIResourceException, SIErrorException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { """ Creates a consumer session. Checks that the connection is valid and then delegates. Wraps the <code>ConsumerSession</code> returned from the delegate in a <code>SibRaConsumerSession</code>. @param destAddr the address of the destination @param destType the destination type @param criteria the selection criteria @param reliability the reliability @param enableReadAhead flag indicating whether read ahead is enabled @param nolocal flag indicating whether local messages should be received @param unrecoverableReliability the unrecoverable reliability @param bifurcatable whether the new ConsumerSession may be bifurcated @param alternateUser the name of the user under whose authority operations of the ConsumerSession should be performed (may be null) @return the consumer session @throws SINotPossibleInCurrentConfigurationException if the delegation fails @throws SIIncorrectCallException if the delegation fails @throws SIErrorException if the delegation fails @throws SIResourceException if the delegation fails @throws SITemporaryDestinationNotFoundException if the delegation fails @throws SIDestinationLockedException if the delegation fails @throws SINotAuthorizedException if the delegation fails @throws SILimitExceededException if the delegation fails @throws SIConnectionLostException if the delegation fails @throws SIConnectionUnavailableException if the connection is not valid @throws SIConnectionDroppedException if the delegation fails """ checkValid(); final ConsumerSession session = _delegateConnection .createConsumerSession(destAddr, destType, criteria, reliability, enableReadAhead, nolocal, unrecoverableReliability, bifurcatable, alternateUser); return new SibRaConsumerSession(this, session); }
java
@Override public ConsumerSession createConsumerSession( final SIDestinationAddress destAddr, final DestinationType destType, final SelectionCriteria criteria, final Reliability reliability, final boolean enableReadAhead, final boolean nolocal, final Reliability unrecoverableReliability, final boolean bifurcatable, final String alternateUser) throws SIConnectionDroppedException, SIConnectionUnavailableException, SIConnectionLostException, SILimitExceededException, SINotAuthorizedException, SIDestinationLockedException, SITemporaryDestinationNotFoundException, SIResourceException, SIErrorException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { checkValid(); final ConsumerSession session = _delegateConnection .createConsumerSession(destAddr, destType, criteria, reliability, enableReadAhead, nolocal, unrecoverableReliability, bifurcatable, alternateUser); return new SibRaConsumerSession(this, session); }
[ "@", "Override", "public", "ConsumerSession", "createConsumerSession", "(", "final", "SIDestinationAddress", "destAddr", ",", "final", "DestinationType", "destType", ",", "final", "SelectionCriteria", "criteria", ",", "final", "Reliability", "reliability", ",", "final", "boolean", "enableReadAhead", ",", "final", "boolean", "nolocal", ",", "final", "Reliability", "unrecoverableReliability", ",", "final", "boolean", "bifurcatable", ",", "final", "String", "alternateUser", ")", "throws", "SIConnectionDroppedException", ",", "SIConnectionUnavailableException", ",", "SIConnectionLostException", ",", "SILimitExceededException", ",", "SINotAuthorizedException", ",", "SIDestinationLockedException", ",", "SITemporaryDestinationNotFoundException", ",", "SIResourceException", ",", "SIErrorException", ",", "SIIncorrectCallException", ",", "SINotPossibleInCurrentConfigurationException", "{", "checkValid", "(", ")", ";", "final", "ConsumerSession", "session", "=", "_delegateConnection", ".", "createConsumerSession", "(", "destAddr", ",", "destType", ",", "criteria", ",", "reliability", ",", "enableReadAhead", ",", "nolocal", ",", "unrecoverableReliability", ",", "bifurcatable", ",", "alternateUser", ")", ";", "return", "new", "SibRaConsumerSession", "(", "this", ",", "session", ")", ";", "}" ]
Creates a consumer session. Checks that the connection is valid and then delegates. Wraps the <code>ConsumerSession</code> returned from the delegate in a <code>SibRaConsumerSession</code>. @param destAddr the address of the destination @param destType the destination type @param criteria the selection criteria @param reliability the reliability @param enableReadAhead flag indicating whether read ahead is enabled @param nolocal flag indicating whether local messages should be received @param unrecoverableReliability the unrecoverable reliability @param bifurcatable whether the new ConsumerSession may be bifurcated @param alternateUser the name of the user under whose authority operations of the ConsumerSession should be performed (may be null) @return the consumer session @throws SINotPossibleInCurrentConfigurationException if the delegation fails @throws SIIncorrectCallException if the delegation fails @throws SIErrorException if the delegation fails @throws SIResourceException if the delegation fails @throws SITemporaryDestinationNotFoundException if the delegation fails @throws SIDestinationLockedException if the delegation fails @throws SINotAuthorizedException if the delegation fails @throws SILimitExceededException if the delegation fails @throws SIConnectionLostException if the delegation fails @throws SIConnectionUnavailableException if the connection is not valid @throws SIConnectionDroppedException if the delegation fails
[ "Creates", "a", "consumer", "session", ".", "Checks", "that", "the", "connection", "is", "valid", "and", "then", "delegates", ".", "Wraps", "the", "<code", ">", "ConsumerSession<", "/", "code", ">", "returned", "from", "the", "delegate", "in", "a", "<code", ">", "SibRaConsumerSession<", "/", "code", ">", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java#L679-L703
unbescape/unbescape
src/main/java/org/unbescape/javascript/JavaScriptEscape.java
JavaScriptEscape.unescapeJavaScript
public static void unescapeJavaScript(final char[] text, final int offset, final int len, final Writer writer) throws IOException { """ <p> Perform a JavaScript <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> JavaScript unescape of SECs, x-based, u-based and octal escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } JavaScriptEscapeUtil.unescape(text, offset, len, writer); }
java
public static void unescapeJavaScript(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } JavaScriptEscapeUtil.unescape(text, offset, len, writer); }
[ "public", "static", "void", "unescapeJavaScript", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "final", "int", "textLen", "=", "(", "text", "==", "null", "?", "0", ":", "text", ".", "length", ")", ";", "if", "(", "offset", "<", "0", "||", "offset", ">", "textLen", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid (offset, len). offset=\"", "+", "offset", "+", "\", len=\"", "+", "len", "+", "\", text.length=\"", "+", "textLen", ")", ";", "}", "if", "(", "len", "<", "0", "||", "(", "offset", "+", "len", ")", ">", "textLen", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid (offset, len). offset=\"", "+", "offset", "+", "\", len=\"", "+", "len", "+", "\", text.length=\"", "+", "textLen", ")", ";", "}", "JavaScriptEscapeUtil", ".", "unescape", "(", "text", ",", "offset", ",", "len", ",", "writer", ")", ";", "}" ]
<p> Perform a JavaScript <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> JavaScript unescape of SECs, x-based, u-based and octal escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "JavaScript", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", "are", "required", ".", "Unescape", "operations", "will", "always", "perform", "<em", ">", "complete<", "/", "em", ">", "JavaScript", "unescape", "of", "SECs", "x", "-", "based", "u", "-", "based", "and", "octal", "escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/javascript/JavaScriptEscape.java#L1065-L1086
headius/invokebinder
src/main/java/com/headius/invokebinder/Binder.java
Binder.getFieldQuiet
public MethodHandle getFieldQuiet(MethodHandles.Lookup lookup, String name) { """ Apply the chain of transforms and bind them to an object field retrieval specified using the end signature plus the given class and name. The field must match the end signature's return value and the end signature must take the target class or a subclass as its only argument. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. This version is "quiet" in that it throws an unchecked InvalidTransformException if the target method does not exist or is inaccessible. @param lookup the MethodHandles.Lookup to use to look up the field @param name the field's name @return the full handle chain, bound to the given field access """ try { return getField(lookup, name); } catch (IllegalAccessException | NoSuchFieldException e) { throw new InvalidTransformException(e); } }
java
public MethodHandle getFieldQuiet(MethodHandles.Lookup lookup, String name) { try { return getField(lookup, name); } catch (IllegalAccessException | NoSuchFieldException e) { throw new InvalidTransformException(e); } }
[ "public", "MethodHandle", "getFieldQuiet", "(", "MethodHandles", ".", "Lookup", "lookup", ",", "String", "name", ")", "{", "try", "{", "return", "getField", "(", "lookup", ",", "name", ")", ";", "}", "catch", "(", "IllegalAccessException", "|", "NoSuchFieldException", "e", ")", "{", "throw", "new", "InvalidTransformException", "(", "e", ")", ";", "}", "}" ]
Apply the chain of transforms and bind them to an object field retrieval specified using the end signature plus the given class and name. The field must match the end signature's return value and the end signature must take the target class or a subclass as its only argument. If the final handle's type does not exactly match the initial type for this Binder, an additional cast will be attempted. This version is "quiet" in that it throws an unchecked InvalidTransformException if the target method does not exist or is inaccessible. @param lookup the MethodHandles.Lookup to use to look up the field @param name the field's name @return the full handle chain, bound to the given field access
[ "Apply", "the", "chain", "of", "transforms", "and", "bind", "them", "to", "an", "object", "field", "retrieval", "specified", "using", "the", "end", "signature", "plus", "the", "given", "class", "and", "name", ".", "The", "field", "must", "match", "the", "end", "signature", "s", "return", "value", "and", "the", "end", "signature", "must", "take", "the", "target", "class", "or", "a", "subclass", "as", "its", "only", "argument", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1407-L1413
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java
Scan.addInterfaces
void addInterfaces(Deque<String> intfs, ClassFile cf) throws ConstantPoolException { """ Adds all interfaces from this class to the deque of interfaces. @param intfs the deque of interfaces @param cf the ClassFile of this class @throws ConstantPoolException if a constant pool entry cannot be found """ int count = cf.interfaces.length; for (int i = 0; i < count; i++) { intfs.addLast(cf.getInterfaceName(i)); } }
java
void addInterfaces(Deque<String> intfs, ClassFile cf) throws ConstantPoolException { int count = cf.interfaces.length; for (int i = 0; i < count; i++) { intfs.addLast(cf.getInterfaceName(i)); } }
[ "void", "addInterfaces", "(", "Deque", "<", "String", ">", "intfs", ",", "ClassFile", "cf", ")", "throws", "ConstantPoolException", "{", "int", "count", "=", "cf", ".", "interfaces", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "intfs", ".", "addLast", "(", "cf", ".", "getInterfaceName", "(", "i", ")", ")", ";", "}", "}" ]
Adds all interfaces from this class to the deque of interfaces. @param intfs the deque of interfaces @param cf the ClassFile of this class @throws ConstantPoolException if a constant pool entry cannot be found
[ "Adds", "all", "interfaces", "from", "this", "class", "to", "the", "deque", "of", "interfaces", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L294-L300
apache/incubator-shardingsphere
sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/DataSourceUtil.java
DataSourceUtil.getDataSource
public static DataSource getDataSource(final String dataSourceClassName, final Map<String, Object> dataSourceProperties) throws ReflectiveOperationException { """ Get data source. @param dataSourceClassName data source class name @param dataSourceProperties data source properties @return data source instance @throws ReflectiveOperationException reflective operation exception """ DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance(); for (Entry<String, Object> entry : dataSourceProperties.entrySet()) { callSetterMethod(result, getSetterMethodName(entry.getKey()), null == entry.getValue() ? null : entry.getValue().toString()); } return result; }
java
public static DataSource getDataSource(final String dataSourceClassName, final Map<String, Object> dataSourceProperties) throws ReflectiveOperationException { DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance(); for (Entry<String, Object> entry : dataSourceProperties.entrySet()) { callSetterMethod(result, getSetterMethodName(entry.getKey()), null == entry.getValue() ? null : entry.getValue().toString()); } return result; }
[ "public", "static", "DataSource", "getDataSource", "(", "final", "String", "dataSourceClassName", ",", "final", "Map", "<", "String", ",", "Object", ">", "dataSourceProperties", ")", "throws", "ReflectiveOperationException", "{", "DataSource", "result", "=", "(", "DataSource", ")", "Class", ".", "forName", "(", "dataSourceClassName", ")", ".", "newInstance", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "dataSourceProperties", ".", "entrySet", "(", ")", ")", "{", "callSetterMethod", "(", "result", ",", "getSetterMethodName", "(", "entry", ".", "getKey", "(", ")", ")", ",", "null", "==", "entry", ".", "getValue", "(", ")", "?", "null", ":", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Get data source. @param dataSourceClassName data source class name @param dataSourceProperties data source properties @return data source instance @throws ReflectiveOperationException reflective operation exception
[ "Get", "data", "source", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/DataSourceUtil.java#L55-L61
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java
MediaservicesInner.createOrUpdateAsync
public Observable<MediaServiceInner> createOrUpdateAsync(String resourceGroupName, String accountName, MediaServiceInner parameters) { """ Create or update a Media Services account. Creates or updates a Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MediaServiceInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
java
public Observable<MediaServiceInner> createOrUpdateAsync(String resourceGroupName, String accountName, MediaServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "MediaServiceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "MediaServiceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "MediaServiceInner", ">", ",", "MediaServiceInner", ">", "(", ")", "{", "@", "Override", "public", "MediaServiceInner", "call", "(", "ServiceResponse", "<", "MediaServiceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or update a Media Services account. Creates or updates a Media Services account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MediaServiceInner object
[ "Create", "or", "update", "a", "Media", "Services", "account", ".", "Creates", "or", "updates", "a", "Media", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/MediaservicesInner.java#L362-L369
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.fromAxisAngleDeg
public Quaterniond fromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle) { """ Set this quaternion to be a representation of the supplied axis and angle (in degrees). @param axisX the x component of the rotation axis @param axisY the y component of the rotation axis @param axisZ the z component of the rotation axis @param angle the angle in radians @return this """ return fromAxisAngleRad(axisX, axisY, axisZ, Math.toRadians(angle)); }
java
public Quaterniond fromAxisAngleDeg(double axisX, double axisY, double axisZ, double angle) { return fromAxisAngleRad(axisX, axisY, axisZ, Math.toRadians(angle)); }
[ "public", "Quaterniond", "fromAxisAngleDeg", "(", "double", "axisX", ",", "double", "axisY", ",", "double", "axisZ", ",", "double", "angle", ")", "{", "return", "fromAxisAngleRad", "(", "axisX", ",", "axisY", ",", "axisZ", ",", "Math", ".", "toRadians", "(", "angle", ")", ")", ";", "}" ]
Set this quaternion to be a representation of the supplied axis and angle (in degrees). @param axisX the x component of the rotation axis @param axisY the y component of the rotation axis @param axisZ the z component of the rotation axis @param angle the angle in radians @return this
[ "Set", "this", "quaternion", "to", "be", "a", "representation", "of", "the", "supplied", "axis", "and", "angle", "(", "in", "degrees", ")", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L704-L706
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/Server.java
Server.addWebApplications
public WebApplicationContext[] addWebApplications(String host, String webapps, String defaults, boolean extract) throws IOException { """ Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context. @param host Virtual host name or null @param webapps Directory file name or URL to look for auto webapplication. @param defaults The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. If null the default defaults file is used. If the empty string, then no defaults file is used. @param extract If true, extract war files @exception IOException """ return addWebApplications(host,webapps,defaults,extract,true); }
java
public WebApplicationContext[] addWebApplications(String host, String webapps, String defaults, boolean extract) throws IOException { return addWebApplications(host,webapps,defaults,extract,true); }
[ "public", "WebApplicationContext", "[", "]", "addWebApplications", "(", "String", "host", ",", "String", "webapps", ",", "String", "defaults", ",", "boolean", "extract", ")", "throws", "IOException", "{", "return", "addWebApplications", "(", "host", ",", "webapps", ",", "defaults", ",", "extract", ",", "true", ")", ";", "}" ]
Add Web Applications. Add auto webapplications to the server. The name of the webapp directory or war is used as the context name. If the webapp matches the rootWebApp it is added as the "/" context. @param host Virtual host name or null @param webapps Directory file name or URL to look for auto webapplication. @param defaults The defaults xml filename or URL which is loaded before any in the web app. Must respect the web.dtd. If null the default defaults file is used. If the empty string, then no defaults file is used. @param extract If true, extract war files @exception IOException
[ "Add", "Web", "Applications", ".", "Add", "auto", "webapplications", "to", "the", "server", ".", "The", "name", "of", "the", "webapp", "directory", "or", "war", "is", "used", "as", "the", "context", "name", ".", "If", "the", "webapp", "matches", "the", "rootWebApp", "it", "is", "added", "as", "the", "/", "context", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/Server.java#L331-L338
apache/reef
lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java
ProtocolSerializer.write
public byte[] write(final SpecificRecord message, final long sequence) { """ Marshall the input message to a byte array. @param message The message to be marshaled into a byte array. @param sequence The unique sequence number of the message. """ final String classId = getClassId(message.getClass()); try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { LOG.log(Level.FINEST, "Serializing message: {0}", classId); final IMessageSerializer serializer = this.nameToSerializerMap.get(classId); if (serializer != null) { serializer.serialize(outputStream, message, sequence); } return outputStream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Failure writing message: " + classId, e); } }
java
public byte[] write(final SpecificRecord message, final long sequence) { final String classId = getClassId(message.getClass()); try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { LOG.log(Level.FINEST, "Serializing message: {0}", classId); final IMessageSerializer serializer = this.nameToSerializerMap.get(classId); if (serializer != null) { serializer.serialize(outputStream, message, sequence); } return outputStream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Failure writing message: " + classId, e); } }
[ "public", "byte", "[", "]", "write", "(", "final", "SpecificRecord", "message", ",", "final", "long", "sequence", ")", "{", "final", "String", "classId", "=", "getClassId", "(", "message", ".", "getClass", "(", ")", ")", ";", "try", "(", "final", "ByteArrayOutputStream", "outputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "LOG", ".", "log", "(", "Level", ".", "FINEST", ",", "\"Serializing message: {0}\"", ",", "classId", ")", ";", "final", "IMessageSerializer", "serializer", "=", "this", ".", "nameToSerializerMap", ".", "get", "(", "classId", ")", ";", "if", "(", "serializer", "!=", "null", ")", "{", "serializer", ".", "serialize", "(", "outputStream", ",", "message", ",", "sequence", ")", ";", "}", "return", "outputStream", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failure writing message: \"", "+", "classId", ",", "e", ")", ";", "}", "}" ]
Marshall the input message to a byte array. @param message The message to be marshaled into a byte array. @param sequence The unique sequence number of the message.
[ "Marshall", "the", "input", "message", "to", "a", "byte", "array", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/ProtocolSerializer.java#L111-L128
logic-ng/LogicNG
src/main/java/org/logicng/backbones/MiniSatBackbone.java
MiniSatBackbone.isUnit
private boolean isUnit(final int lit, final MSClause clause) { """ Tests the given literal whether it is unit in the given clause. @param lit literal to test @param clause clause containing the literal @return {@code true} if the literal is unit, {@code false} otherwise """ for (int i = 0; i < clause.size(); ++i) { final int clauseLit = clause.get(i); if (lit != clauseLit && this.model.get(var(clauseLit)) != sign(clauseLit)) { return false; } } return true; }
java
private boolean isUnit(final int lit, final MSClause clause) { for (int i = 0; i < clause.size(); ++i) { final int clauseLit = clause.get(i); if (lit != clauseLit && this.model.get(var(clauseLit)) != sign(clauseLit)) { return false; } } return true; }
[ "private", "boolean", "isUnit", "(", "final", "int", "lit", ",", "final", "MSClause", "clause", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "clause", ".", "size", "(", ")", ";", "++", "i", ")", "{", "final", "int", "clauseLit", "=", "clause", ".", "get", "(", "i", ")", ";", "if", "(", "lit", "!=", "clauseLit", "&&", "this", ".", "model", ".", "get", "(", "var", "(", "clauseLit", ")", ")", "!=", "sign", "(", "clauseLit", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Tests the given literal whether it is unit in the given clause. @param lit literal to test @param clause clause containing the literal @return {@code true} if the literal is unit, {@code false} otherwise
[ "Tests", "the", "given", "literal", "whether", "it", "is", "unit", "in", "the", "given", "clause", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/MiniSatBackbone.java#L281-L289
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/MicrophoneEncoder.java
MicrophoneEncoder.getJitterFreePTS
private long getJitterFreePTS(long bufferPts, long bufferSamplesNum) { """ Ensures that each audio pts differs by a constant amount from the previous one. @param bufferPts presentation timestamp in us @param bufferSamplesNum the number of samples of the buffer's frame @return """ long correctedPts = 0; long bufferDuration = (1000000 * bufferSamplesNum) / (mEncoderCore.mSampleRate); bufferPts -= bufferDuration; // accounts for the delay of acquiring the audio buffer if (totalSamplesNum == 0) { // reset startPTS = bufferPts; totalSamplesNum = 0; } correctedPts = startPTS + (1000000 * totalSamplesNum) / (mEncoderCore.mSampleRate); if(bufferPts - correctedPts >= 2*bufferDuration) { // reset startPTS = bufferPts; totalSamplesNum = 0; correctedPts = startPTS; } totalSamplesNum += bufferSamplesNum; return correctedPts; }
java
private long getJitterFreePTS(long bufferPts, long bufferSamplesNum) { long correctedPts = 0; long bufferDuration = (1000000 * bufferSamplesNum) / (mEncoderCore.mSampleRate); bufferPts -= bufferDuration; // accounts for the delay of acquiring the audio buffer if (totalSamplesNum == 0) { // reset startPTS = bufferPts; totalSamplesNum = 0; } correctedPts = startPTS + (1000000 * totalSamplesNum) / (mEncoderCore.mSampleRate); if(bufferPts - correctedPts >= 2*bufferDuration) { // reset startPTS = bufferPts; totalSamplesNum = 0; correctedPts = startPTS; } totalSamplesNum += bufferSamplesNum; return correctedPts; }
[ "private", "long", "getJitterFreePTS", "(", "long", "bufferPts", ",", "long", "bufferSamplesNum", ")", "{", "long", "correctedPts", "=", "0", ";", "long", "bufferDuration", "=", "(", "1000000", "*", "bufferSamplesNum", ")", "/", "(", "mEncoderCore", ".", "mSampleRate", ")", ";", "bufferPts", "-=", "bufferDuration", ";", "// accounts for the delay of acquiring the audio buffer", "if", "(", "totalSamplesNum", "==", "0", ")", "{", "// reset", "startPTS", "=", "bufferPts", ";", "totalSamplesNum", "=", "0", ";", "}", "correctedPts", "=", "startPTS", "+", "(", "1000000", "*", "totalSamplesNum", ")", "/", "(", "mEncoderCore", ".", "mSampleRate", ")", ";", "if", "(", "bufferPts", "-", "correctedPts", ">=", "2", "*", "bufferDuration", ")", "{", "// reset", "startPTS", "=", "bufferPts", ";", "totalSamplesNum", "=", "0", ";", "correctedPts", "=", "startPTS", ";", "}", "totalSamplesNum", "+=", "bufferSamplesNum", ";", "return", "correctedPts", ";", "}" ]
Ensures that each audio pts differs by a constant amount from the previous one. @param bufferPts presentation timestamp in us @param bufferSamplesNum the number of samples of the buffer's frame @return
[ "Ensures", "that", "each", "audio", "pts", "differs", "by", "a", "constant", "amount", "from", "the", "previous", "one", "." ]
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/MicrophoneEncoder.java#L207-L225
alkacon/opencms-core
src/org/opencms/gwt/CmsIconUtil.java
CmsIconUtil.getResourceIconClasses
private static String getResourceIconClasses(String resourceTypeName, String fileName, boolean small) { """ Returns the CSS classes of the resource icon for the given resource type and filename.<p> Use this the resource type and filename is known.<p> @param resourceTypeName the resource type name @param fileName the filename @param small if true, get the icon classes for the small icon, else for the biggest one available @return the CSS classes """ StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS); sb.append(" ").append(getResourceTypeIconClass(resourceTypeName, small)).append(" ").append( getFileTypeIconClass(resourceTypeName, fileName, small)); return sb.toString(); }
java
private static String getResourceIconClasses(String resourceTypeName, String fileName, boolean small) { StringBuffer sb = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS); sb.append(" ").append(getResourceTypeIconClass(resourceTypeName, small)).append(" ").append( getFileTypeIconClass(resourceTypeName, fileName, small)); return sb.toString(); }
[ "private", "static", "String", "getResourceIconClasses", "(", "String", "resourceTypeName", ",", "String", "fileName", ",", "boolean", "small", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "CmsGwtConstants", ".", "TYPE_ICON_CLASS", ")", ";", "sb", ".", "append", "(", "\" \"", ")", ".", "append", "(", "getResourceTypeIconClass", "(", "resourceTypeName", ",", "small", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "getFileTypeIconClass", "(", "resourceTypeName", ",", "fileName", ",", "small", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the CSS classes of the resource icon for the given resource type and filename.<p> Use this the resource type and filename is known.<p> @param resourceTypeName the resource type name @param fileName the filename @param small if true, get the icon classes for the small icon, else for the biggest one available @return the CSS classes
[ "Returns", "the", "CSS", "classes", "of", "the", "resource", "icon", "for", "the", "given", "resource", "type", "and", "filename", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L494-L500
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java
DirectoryAgentInfo.getUnicastPort
public int getUnicastPort(boolean tcp, int defaultPort) { """ Returns the unicast port this DirectoryAgent is listening on, if this information is available in the Attributes via the dedicated tags. <br /> If the unicast port information is not available in the Attributes, returns the given port. @param tcp whether the unicast port to return must be a TCP port or not @param defaultPort the port to return if no information on the unicast port is available in the Attributes @return the unicast port this DirectoryAgent is listening on, or the given port """ if (tcp && attributes.containsTag(TCP_PORT_TAG)) return (Integer)attributes.valueFor(TCP_PORT_TAG).getValue(); return defaultPort; }
java
public int getUnicastPort(boolean tcp, int defaultPort) { if (tcp && attributes.containsTag(TCP_PORT_TAG)) return (Integer)attributes.valueFor(TCP_PORT_TAG).getValue(); return defaultPort; }
[ "public", "int", "getUnicastPort", "(", "boolean", "tcp", ",", "int", "defaultPort", ")", "{", "if", "(", "tcp", "&&", "attributes", ".", "containsTag", "(", "TCP_PORT_TAG", ")", ")", "return", "(", "Integer", ")", "attributes", ".", "valueFor", "(", "TCP_PORT_TAG", ")", ".", "getValue", "(", ")", ";", "return", "defaultPort", ";", "}" ]
Returns the unicast port this DirectoryAgent is listening on, if this information is available in the Attributes via the dedicated tags. <br /> If the unicast port information is not available in the Attributes, returns the given port. @param tcp whether the unicast port to return must be a TCP port or not @param defaultPort the port to return if no information on the unicast port is available in the Attributes @return the unicast port this DirectoryAgent is listening on, or the given port
[ "Returns", "the", "unicast", "port", "this", "DirectoryAgent", "is", "listening", "on", "if", "this", "information", "is", "available", "in", "the", "Attributes", "via", "the", "dedicated", "tags", ".", "<br", "/", ">", "If", "the", "unicast", "port", "information", "is", "not", "available", "in", "the", "Attributes", "returns", "the", "given", "port", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/DirectoryAgentInfo.java#L214-L218
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java
AbstractRegionPainter.createVerticalGradient
protected Paint createVerticalGradient(Shape s, TwoColors colors) { """ Creates a simple vertical gradient using the shape for bounds and the colors for top and bottom colors. @param s the shape to use for bounds. @param colors the colors to use for the gradient. @return the gradient. """ Rectangle2D bounds = s.getBounds2D(); float xCenter = (float) bounds.getCenterX(); float yMin = (float) bounds.getMinY(); float yMax = (float) bounds.getMaxY(); return createGradient(xCenter, yMin, xCenter, yMax, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom }); }
java
protected Paint createVerticalGradient(Shape s, TwoColors colors) { Rectangle2D bounds = s.getBounds2D(); float xCenter = (float) bounds.getCenterX(); float yMin = (float) bounds.getMinY(); float yMax = (float) bounds.getMaxY(); return createGradient(xCenter, yMin, xCenter, yMax, new float[] { 0f, 1f }, new Color[] { colors.top, colors.bottom }); }
[ "protected", "Paint", "createVerticalGradient", "(", "Shape", "s", ",", "TwoColors", "colors", ")", "{", "Rectangle2D", "bounds", "=", "s", ".", "getBounds2D", "(", ")", ";", "float", "xCenter", "=", "(", "float", ")", "bounds", ".", "getCenterX", "(", ")", ";", "float", "yMin", "=", "(", "float", ")", "bounds", ".", "getMinY", "(", ")", ";", "float", "yMax", "=", "(", "float", ")", "bounds", ".", "getMaxY", "(", ")", ";", "return", "createGradient", "(", "xCenter", ",", "yMin", ",", "xCenter", ",", "yMax", ",", "new", "float", "[", "]", "{", "0f", ",", "1f", "}", ",", "new", "Color", "[", "]", "{", "colors", ".", "top", ",", "colors", ".", "bottom", "}", ")", ";", "}" ]
Creates a simple vertical gradient using the shape for bounds and the colors for top and bottom colors. @param s the shape to use for bounds. @param colors the colors to use for the gradient. @return the gradient.
[ "Creates", "a", "simple", "vertical", "gradient", "using", "the", "shape", "for", "bounds", "and", "the", "colors", "for", "top", "and", "bottom", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L376-L383
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/system/exec/Exec.java
Exec.utilityAs
public static Execed utilityAs(String as, String... command) throws IOException { """ Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root) @param as @param command @return @throws IOException """ return utilityAs(as, Arrays.asList(command)); }
java
public static Execed utilityAs(String as, String... command) throws IOException { return utilityAs(as, Arrays.asList(command)); }
[ "public", "static", "Execed", "utilityAs", "(", "String", "as", ",", "String", "...", "command", ")", "throws", "IOException", "{", "return", "utilityAs", "(", "as", ",", "Arrays", ".", "asList", "(", "command", ")", ")", ";", "}" ]
Runs a command in "utility" mode: redirecting stderr to stdout and optionally executing as a different user (eg root) @param as @param command @return @throws IOException
[ "Runs", "a", "command", "in", "utility", "mode", ":", "redirecting", "stderr", "to", "stdout", "and", "optionally", "executing", "as", "a", "different", "user", "(", "eg", "root", ")" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/system/exec/Exec.java#L352-L355
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java
Utils.getFileNamePrefix
public static String getFileNamePrefix(ServiceModel serviceModel, CustomizationConfig customizationConfig) { """ * @param serviceModel Service model to get prefix for. * @return Prefix to use when writing model files (service and intermediate). """ if (customizationConfig.isUseUidAsFilePrefix() && serviceModel.getMetadata().getUid() != null) { return serviceModel.getMetadata().getUid(); } return String.format("%s-%s", serviceModel.getMetadata().getEndpointPrefix(), serviceModel.getMetadata().getApiVersion()); }
java
public static String getFileNamePrefix(ServiceModel serviceModel, CustomizationConfig customizationConfig) { if (customizationConfig.isUseUidAsFilePrefix() && serviceModel.getMetadata().getUid() != null) { return serviceModel.getMetadata().getUid(); } return String.format("%s-%s", serviceModel.getMetadata().getEndpointPrefix(), serviceModel.getMetadata().getApiVersion()); }
[ "public", "static", "String", "getFileNamePrefix", "(", "ServiceModel", "serviceModel", ",", "CustomizationConfig", "customizationConfig", ")", "{", "if", "(", "customizationConfig", ".", "isUseUidAsFilePrefix", "(", ")", "&&", "serviceModel", ".", "getMetadata", "(", ")", ".", "getUid", "(", ")", "!=", "null", ")", "{", "return", "serviceModel", ".", "getMetadata", "(", ")", ".", "getUid", "(", ")", ";", "}", "return", "String", ".", "format", "(", "\"%s-%s\"", ",", "serviceModel", ".", "getMetadata", "(", ")", ".", "getEndpointPrefix", "(", ")", ",", "serviceModel", ".", "getMetadata", "(", ")", ".", "getApiVersion", "(", ")", ")", ";", "}" ]
* @param serviceModel Service model to get prefix for. * @return Prefix to use when writing model files (service and intermediate).
[ "*" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java#L113-L119
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceProvider.java
CacheResourceProvider.createCore
CacheResourceCore createCore(String path, String name, int type) throws IOException { """ create a new core @param path @param type @return created core @throws IOException """ CacheResourceCore value = new CacheResourceCore(type, path, name); getCache().put(toKey(path, name), value, null, null); return value; }
java
CacheResourceCore createCore(String path, String name, int type) throws IOException { CacheResourceCore value = new CacheResourceCore(type, path, name); getCache().put(toKey(path, name), value, null, null); return value; }
[ "CacheResourceCore", "createCore", "(", "String", "path", ",", "String", "name", ",", "int", "type", ")", "throws", "IOException", "{", "CacheResourceCore", "value", "=", "new", "CacheResourceCore", "(", "type", ",", "path", ",", "name", ")", ";", "getCache", "(", ")", ".", "put", "(", "toKey", "(", "path", ",", "name", ")", ",", "value", ",", "null", ",", "null", ")", ";", "return", "value", ";", "}" ]
create a new core @param path @param type @return created core @throws IOException
[ "create", "a", "new", "core" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/cache/CacheResourceProvider.java#L153-L157
undertow-io/undertow
core/src/main/java/io/undertow/server/protocol/http/HttpContinue.java
HttpContinue.sendContinueResponse
public static void sendContinueResponse(final HttpServerExchange exchange, final IoCallback callback) { """ Sends a continuation using async IO, and calls back when it is complete. @param exchange The exchange @param callback The completion callback """ if (!exchange.isResponseChannelAvailable()) { callback.onException(exchange, null, UndertowMessages.MESSAGES.cannotSendContinueResponse()); return; } internalSendContinueResponse(exchange, callback); }
java
public static void sendContinueResponse(final HttpServerExchange exchange, final IoCallback callback) { if (!exchange.isResponseChannelAvailable()) { callback.onException(exchange, null, UndertowMessages.MESSAGES.cannotSendContinueResponse()); return; } internalSendContinueResponse(exchange, callback); }
[ "public", "static", "void", "sendContinueResponse", "(", "final", "HttpServerExchange", "exchange", ",", "final", "IoCallback", "callback", ")", "{", "if", "(", "!", "exchange", ".", "isResponseChannelAvailable", "(", ")", ")", "{", "callback", ".", "onException", "(", "exchange", ",", "null", ",", "UndertowMessages", ".", "MESSAGES", ".", "cannotSendContinueResponse", "(", ")", ")", ";", "return", ";", "}", "internalSendContinueResponse", "(", "exchange", ",", "callback", ")", ";", "}" ]
Sends a continuation using async IO, and calls back when it is complete. @param exchange The exchange @param callback The completion callback
[ "Sends", "a", "continuation", "using", "async", "IO", "and", "calls", "back", "when", "it", "is", "complete", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/protocol/http/HttpContinue.java#L101-L107
strator-dev/greenpepper
greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/AbstractJarMojo.java
AbstractJarMojo.getJarFile
protected static File getJarFile( File basedir, String finalName, String classifier ) { """ <p>getJarFile.</p> @param basedir a {@link java.io.File} object. @param finalName a {@link java.lang.String} object. @param classifier a {@link java.lang.String} object. @return a {@link java.io.File} object. """ if ( classifier == null ) { classifier = ""; } else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) ) { classifier = "-" + classifier; } return new File( basedir, finalName + classifier + ".jar" ); }
java
protected static File getJarFile( File basedir, String finalName, String classifier ) { if ( classifier == null ) { classifier = ""; } else if ( classifier.trim().length() > 0 && !classifier.startsWith( "-" ) ) { classifier = "-" + classifier; } return new File( basedir, finalName + classifier + ".jar" ); }
[ "protected", "static", "File", "getJarFile", "(", "File", "basedir", ",", "String", "finalName", ",", "String", "classifier", ")", "{", "if", "(", "classifier", "==", "null", ")", "{", "classifier", "=", "\"\"", ";", "}", "else", "if", "(", "classifier", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", "&&", "!", "classifier", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "classifier", "=", "\"-\"", "+", "classifier", ";", "}", "return", "new", "File", "(", "basedir", ",", "finalName", "+", "classifier", "+", "\".jar\"", ")", ";", "}" ]
<p>getJarFile.</p> @param basedir a {@link java.io.File} object. @param finalName a {@link java.lang.String} object. @param classifier a {@link java.lang.String} object. @return a {@link java.io.File} object.
[ "<p", ">", "getJarFile", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/AbstractJarMojo.java#L138-L150
meertensinstituut/mtas
src/main/java/mtas/search/spans/util/MtasIgnoreItem.java
MtasIgnoreItem.getMinStartPosition
public int getMinStartPosition(int docId, int position) throws IOException { """ Gets the min start position. @param docId the doc id @param position the position @return the min start position @throws IOException Signals that an I/O exception has occurred. """ if (ignoreSpans != null && docId == currentDocId) { if (position < minimumPosition) { throw new IOException( "Unexpected position, should be >= " + minimumPosition + "!"); } else { computeFullStartPositionMinimum(position); if (minFullStartPosition.containsKey(position)) { return minFullStartPosition.get(position); } else { return 0; } } } else { return 0; } }
java
public int getMinStartPosition(int docId, int position) throws IOException { if (ignoreSpans != null && docId == currentDocId) { if (position < minimumPosition) { throw new IOException( "Unexpected position, should be >= " + minimumPosition + "!"); } else { computeFullStartPositionMinimum(position); if (minFullStartPosition.containsKey(position)) { return minFullStartPosition.get(position); } else { return 0; } } } else { return 0; } }
[ "public", "int", "getMinStartPosition", "(", "int", "docId", ",", "int", "position", ")", "throws", "IOException", "{", "if", "(", "ignoreSpans", "!=", "null", "&&", "docId", "==", "currentDocId", ")", "{", "if", "(", "position", "<", "minimumPosition", ")", "{", "throw", "new", "IOException", "(", "\"Unexpected position, should be >= \"", "+", "minimumPosition", "+", "\"!\"", ")", ";", "}", "else", "{", "computeFullStartPositionMinimum", "(", "position", ")", ";", "if", "(", "minFullStartPosition", ".", "containsKey", "(", "position", ")", ")", "{", "return", "minFullStartPosition", ".", "get", "(", "position", ")", ";", "}", "else", "{", "return", "0", ";", "}", "}", "}", "else", "{", "return", "0", ";", "}", "}" ]
Gets the min start position. @param docId the doc id @param position the position @return the min start position @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "min", "start", "position", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/search/spans/util/MtasIgnoreItem.java#L118-L134
fcrepo3/fcrepo
fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/finder/policy/GenericPolicyFinderModule.java
GenericPolicyFinderModule.findPolicy
@Override public PolicyFinderResult findPolicy(EvaluationCtx context) { """ Finds a policy based on a request's context. If more than one policy matches, then this either returns an error or a new policy wrapping the multiple policies (depending on which constructor was used to construct this instance). @param context the representation of the request data @return the result of trying to find an applicable policy """ try { AbstractPolicy policy = m_policyManager.getPolicy(context); if (policy == null) { return new PolicyFinderResult(); } return new PolicyFinderResult(policy); } catch (TopLevelPolicyException tlpe) { return new PolicyFinderResult(tlpe.getStatus()); } catch (PolicyIndexException pdme) { if (logger.isDebugEnabled()) { logger.debug("problem processing policy", pdme); } List<String> codes = new ArrayList<String>(); codes.add(Status.STATUS_PROCESSING_ERROR); return new PolicyFinderResult(new Status(codes, pdme.getMessage())); } }
java
@Override public PolicyFinderResult findPolicy(EvaluationCtx context) { try { AbstractPolicy policy = m_policyManager.getPolicy(context); if (policy == null) { return new PolicyFinderResult(); } return new PolicyFinderResult(policy); } catch (TopLevelPolicyException tlpe) { return new PolicyFinderResult(tlpe.getStatus()); } catch (PolicyIndexException pdme) { if (logger.isDebugEnabled()) { logger.debug("problem processing policy", pdme); } List<String> codes = new ArrayList<String>(); codes.add(Status.STATUS_PROCESSING_ERROR); return new PolicyFinderResult(new Status(codes, pdme.getMessage())); } }
[ "@", "Override", "public", "PolicyFinderResult", "findPolicy", "(", "EvaluationCtx", "context", ")", "{", "try", "{", "AbstractPolicy", "policy", "=", "m_policyManager", ".", "getPolicy", "(", "context", ")", ";", "if", "(", "policy", "==", "null", ")", "{", "return", "new", "PolicyFinderResult", "(", ")", ";", "}", "return", "new", "PolicyFinderResult", "(", "policy", ")", ";", "}", "catch", "(", "TopLevelPolicyException", "tlpe", ")", "{", "return", "new", "PolicyFinderResult", "(", "tlpe", ".", "getStatus", "(", ")", ")", ";", "}", "catch", "(", "PolicyIndexException", "pdme", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"problem processing policy\"", ",", "pdme", ")", ";", "}", "List", "<", "String", ">", "codes", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "codes", ".", "add", "(", "Status", ".", "STATUS_PROCESSING_ERROR", ")", ";", "return", "new", "PolicyFinderResult", "(", "new", "Status", "(", "codes", ",", "pdme", ".", "getMessage", "(", ")", ")", ")", ";", "}", "}" ]
Finds a policy based on a request's context. If more than one policy matches, then this either returns an error or a new policy wrapping the multiple policies (depending on which constructor was used to construct this instance). @param context the representation of the request data @return the result of trying to find an applicable policy
[ "Finds", "a", "policy", "based", "on", "a", "request", "s", "context", ".", "If", "more", "than", "one", "policy", "matches", "then", "this", "either", "returns", "an", "error", "or", "a", "new", "policy", "wrapping", "the", "multiple", "policies", "(", "depending", "on", "which", "constructor", "was", "used", "to", "construct", "this", "instance", ")", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/finder/policy/GenericPolicyFinderModule.java#L94-L115
ansell/restlet-utils
src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java
FixedRedirectCookieAuthenticator.challenge
@Override public void challenge(final Response response, final boolean stale) { """ This method should be overridden to return a login form representation. """ this.log.debug("Calling super.challenge"); super.challenge(response, stale); }
java
@Override public void challenge(final Response response, final boolean stale) { this.log.debug("Calling super.challenge"); super.challenge(response, stale); }
[ "@", "Override", "public", "void", "challenge", "(", "final", "Response", "response", ",", "final", "boolean", "stale", ")", "{", "this", ".", "log", ".", "debug", "(", "\"Calling super.challenge\"", ")", ";", "super", ".", "challenge", "(", "response", ",", "stale", ")", ";", "}" ]
This method should be overridden to return a login form representation.
[ "This", "method", "should", "be", "overridden", "to", "return", "a", "login", "form", "representation", "." ]
train
https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L364-L369
javajazz/jazz
src/main/lombok/de/scravy/jazz/Jazz.java
Jazz.animate
public static Window animate(final String title, final int width, final int height, final Animation animation) { """ Displays an {@link Animation} in a single window. You can open multiple windows using this method. @since 1.0.0 @param title The title of the displayed window. @param width The width of the displayed window. @param height The height of the displayed window. @param animation The animation to be shown in the displayed window. @return A reference to the newly created window. """ return play(title, width, height, animation); }
java
public static Window animate(final String title, final int width, final int height, final Animation animation) { return play(title, width, height, animation); }
[ "public", "static", "Window", "animate", "(", "final", "String", "title", ",", "final", "int", "width", ",", "final", "int", "height", ",", "final", "Animation", "animation", ")", "{", "return", "play", "(", "title", ",", "width", ",", "height", ",", "animation", ")", ";", "}" ]
Displays an {@link Animation} in a single window. You can open multiple windows using this method. @since 1.0.0 @param title The title of the displayed window. @param width The width of the displayed window. @param height The height of the displayed window. @param animation The animation to be shown in the displayed window. @return A reference to the newly created window.
[ "Displays", "an", "{", "@link", "Animation", "}", "in", "a", "single", "window", "." ]
train
https://github.com/javajazz/jazz/blob/f4a1a601700442b8ec6a947f5772a96dbf5dc44b/src/main/lombok/de/scravy/jazz/Jazz.java#L253-L257
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java
IconProviderBuilder.withSide
public IconProviderBuilder withSide(EnumFacing side, Icon icon) { """ Sets the {@link Icon} to use for specific side. @param side the side @param icon the icon @return the icon provider builder """ setType(Type.SIDES); sidesIcons.put(Objects.requireNonNull(side), icon); return this; }
java
public IconProviderBuilder withSide(EnumFacing side, Icon icon) { setType(Type.SIDES); sidesIcons.put(Objects.requireNonNull(side), icon); return this; }
[ "public", "IconProviderBuilder", "withSide", "(", "EnumFacing", "side", ",", "Icon", "icon", ")", "{", "setType", "(", "Type", ".", "SIDES", ")", ";", "sidesIcons", ".", "put", "(", "Objects", ".", "requireNonNull", "(", "side", ")", ",", "icon", ")", ";", "return", "this", ";", "}" ]
Sets the {@link Icon} to use for specific side. @param side the side @param icon the icon @return the icon provider builder
[ "Sets", "the", "{", "@link", "Icon", "}", "to", "use", "for", "specific", "side", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/icon/provider/IconProviderBuilder.java#L135-L140
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java
CmsForm.defaultHandleValueChange
protected void defaultHandleValueChange(I_CmsFormField field, String newValue, boolean inhibitValidation) { """ Default handler for value change events of form fields.<p> @param field the form field for which the event has been fired @param inhibitValidation prevents validation of the edited field @param newValue the new value """ m_editedFields.add(field.getId()); I_CmsStringModel model = field.getModel(); if (model != null) { model.setValue(newValue, true); } field.setValidationStatus(I_CmsFormField.ValidationStatus.unknown); // if the user presses enter, the keypressed event is fired before the change event, // so we use a flag to keep track of whether enter was pressed. if (!m_pressedEnter) { if (!inhibitValidation) { validateField(field); } } else { validateAndSubmit(); } }
java
protected void defaultHandleValueChange(I_CmsFormField field, String newValue, boolean inhibitValidation) { m_editedFields.add(field.getId()); I_CmsStringModel model = field.getModel(); if (model != null) { model.setValue(newValue, true); } field.setValidationStatus(I_CmsFormField.ValidationStatus.unknown); // if the user presses enter, the keypressed event is fired before the change event, // so we use a flag to keep track of whether enter was pressed. if (!m_pressedEnter) { if (!inhibitValidation) { validateField(field); } } else { validateAndSubmit(); } }
[ "protected", "void", "defaultHandleValueChange", "(", "I_CmsFormField", "field", ",", "String", "newValue", ",", "boolean", "inhibitValidation", ")", "{", "m_editedFields", ".", "add", "(", "field", ".", "getId", "(", ")", ")", ";", "I_CmsStringModel", "model", "=", "field", ".", "getModel", "(", ")", ";", "if", "(", "model", "!=", "null", ")", "{", "model", ".", "setValue", "(", "newValue", ",", "true", ")", ";", "}", "field", ".", "setValidationStatus", "(", "I_CmsFormField", ".", "ValidationStatus", ".", "unknown", ")", ";", "// if the user presses enter, the keypressed event is fired before the change event,", "// so we use a flag to keep track of whether enter was pressed.", "if", "(", "!", "m_pressedEnter", ")", "{", "if", "(", "!", "inhibitValidation", ")", "{", "validateField", "(", "field", ")", ";", "}", "}", "else", "{", "validateAndSubmit", "(", ")", ";", "}", "}" ]
Default handler for value change events of form fields.<p> @param field the form field for which the event has been fired @param inhibitValidation prevents validation of the edited field @param newValue the new value
[ "Default", "handler", "for", "value", "change", "events", "of", "form", "fields", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L461-L480
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/audit_log.java
audit_log.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ audit_log_responses result = (audit_log_responses) service.get_payload_formatter().string_to_resource(audit_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.audit_log_response_array); } audit_log[] result_audit_log = new audit_log[result.audit_log_response_array.length]; for(int i = 0; i < result.audit_log_response_array.length; i++) { result_audit_log[i] = result.audit_log_response_array[i].audit_log[0]; } return result_audit_log; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { audit_log_responses result = (audit_log_responses) service.get_payload_formatter().string_to_resource(audit_log_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.audit_log_response_array); } audit_log[] result_audit_log = new audit_log[result.audit_log_response_array.length]; for(int i = 0; i < result.audit_log_response_array.length; i++) { result_audit_log[i] = result.audit_log_response_array[i].audit_log[0]; } return result_audit_log; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "audit_log_responses", "result", "=", "(", "audit_log_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "audit_log_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "audit_log_response_array", ")", ";", "}", "audit_log", "[", "]", "result_audit_log", "=", "new", "audit_log", "[", "result", ".", "audit_log_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "audit_log_response_array", ".", "length", ";", "i", "++", ")", "{", "result_audit_log", "[", "i", "]", "=", "result", ".", "audit_log_response_array", "[", "i", "]", ".", "audit_log", "[", "0", "]", ";", "}", "return", "result_audit_log", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/audit_log.java#L317-L334
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.inner
public Table inner(Table table2, boolean outer, boolean allowDuplicateColumnNames, String... col2Names) { """ Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param outer True if this join is actually an outer join, left or right or full, otherwise false. @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed* @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table """ Table joinedTable; joinedTable = joinInternal(table, table2, outer, allowDuplicateColumnNames, col2Names); return joinedTable; }
java
public Table inner(Table table2, boolean outer, boolean allowDuplicateColumnNames, String... col2Names) { Table joinedTable; joinedTable = joinInternal(table, table2, outer, allowDuplicateColumnNames, col2Names); return joinedTable; }
[ "public", "Table", "inner", "(", "Table", "table2", ",", "boolean", "outer", ",", "boolean", "allowDuplicateColumnNames", ",", "String", "...", "col2Names", ")", "{", "Table", "joinedTable", ";", "joinedTable", "=", "joinInternal", "(", "table", ",", "table2", ",", "outer", ",", "allowDuplicateColumnNames", ",", "col2Names", ")", ";", "return", "joinedTable", ";", "}" ]
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param outer True if this join is actually an outer join, left or right or full, otherwise false. @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed* @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L158-L162
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.getAttributeNode
public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { """ Retrieves an attribute node by by qualified name and namespace URI. @param nodeHandle int Handle of the node upon which to look up this attribute. @param namespaceURI The namespace URI of the attribute to retrieve, or null. @param name The local name of the attribute to retrieve. @return The attribute node handle with the specified name ( <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such attribute. """ int nsIndex = m_nsNames.stringToIndex(namespaceURI), nameIndex = m_localNames.stringToIndex(name); nodeHandle &= NODEHANDLE_MASK; nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); // If nodeHandle points to element next slot would be first attribute if (type == ELEMENT_NODE) nodeHandle++; // Iterate through Attribute Nodes while (type == ATTRIBUTE_NODE) { if ((nsIndex == (gotslot[0] << 16)) && (gotslot[3] == nameIndex)) return nodeHandle | m_docHandle; // Goto next sibling nodeHandle = gotslot[2]; nodes.readSlot(nodeHandle, gotslot); } return NULL; }
java
public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { int nsIndex = m_nsNames.stringToIndex(namespaceURI), nameIndex = m_localNames.stringToIndex(name); nodeHandle &= NODEHANDLE_MASK; nodes.readSlot(nodeHandle, gotslot); short type = (short) (gotslot[0] & 0xFFFF); // If nodeHandle points to element next slot would be first attribute if (type == ELEMENT_NODE) nodeHandle++; // Iterate through Attribute Nodes while (type == ATTRIBUTE_NODE) { if ((nsIndex == (gotslot[0] << 16)) && (gotslot[3] == nameIndex)) return nodeHandle | m_docHandle; // Goto next sibling nodeHandle = gotslot[2]; nodes.readSlot(nodeHandle, gotslot); } return NULL; }
[ "public", "int", "getAttributeNode", "(", "int", "nodeHandle", ",", "String", "namespaceURI", ",", "String", "name", ")", "{", "int", "nsIndex", "=", "m_nsNames", ".", "stringToIndex", "(", "namespaceURI", ")", ",", "nameIndex", "=", "m_localNames", ".", "stringToIndex", "(", "name", ")", ";", "nodeHandle", "&=", "NODEHANDLE_MASK", ";", "nodes", ".", "readSlot", "(", "nodeHandle", ",", "gotslot", ")", ";", "short", "type", "=", "(", "short", ")", "(", "gotslot", "[", "0", "]", "&", "0xFFFF", ")", ";", "// If nodeHandle points to element next slot would be first attribute", "if", "(", "type", "==", "ELEMENT_NODE", ")", "nodeHandle", "++", ";", "// Iterate through Attribute Nodes", "while", "(", "type", "==", "ATTRIBUTE_NODE", ")", "{", "if", "(", "(", "nsIndex", "==", "(", "gotslot", "[", "0", "]", "<<", "16", ")", ")", "&&", "(", "gotslot", "[", "3", "]", "==", "nameIndex", ")", ")", "return", "nodeHandle", "|", "m_docHandle", ";", "// Goto next sibling", "nodeHandle", "=", "gotslot", "[", "2", "]", ";", "nodes", ".", "readSlot", "(", "nodeHandle", ",", "gotslot", ")", ";", "}", "return", "NULL", ";", "}" ]
Retrieves an attribute node by by qualified name and namespace URI. @param nodeHandle int Handle of the node upon which to look up this attribute. @param namespaceURI The namespace URI of the attribute to retrieve, or null. @param name The local name of the attribute to retrieve. @return The attribute node handle with the specified name ( <code>nodeName</code>) or <code>DTM.NULL</code> if there is no such attribute.
[ "Retrieves", "an", "attribute", "node", "by", "by", "qualified", "name", "and", "namespace", "URI", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1086-L1104
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/CircuitsConfig.java
CircuitsConfig.exports
public static void exports(Media media, Collection<Media> levels, Media sheetsConfig, Media groupsConfig) { """ Export all circuits to an XML file. @param media The export output (must not be <code>null</code>). @param levels The level rips used (must not be <code>null</code>). @param sheetsConfig The sheets media (must not be <code>null</code>). @param groupsConfig The groups media (must not be <code>null</code>). @throws LionEngineException If error on export. """ Check.notNull(media); Check.notNull(levels); Check.notNull(sheetsConfig); Check.notNull(groupsConfig); final CircuitsExtractor extractor = new CircuitsExtractorImpl(); final Map<Circuit, Collection<TileRef>> circuits = extractor.getCircuits(levels, sheetsConfig, groupsConfig); exports(media, circuits); }
java
public static void exports(Media media, Collection<Media> levels, Media sheetsConfig, Media groupsConfig) { Check.notNull(media); Check.notNull(levels); Check.notNull(sheetsConfig); Check.notNull(groupsConfig); final CircuitsExtractor extractor = new CircuitsExtractorImpl(); final Map<Circuit, Collection<TileRef>> circuits = extractor.getCircuits(levels, sheetsConfig, groupsConfig); exports(media, circuits); }
[ "public", "static", "void", "exports", "(", "Media", "media", ",", "Collection", "<", "Media", ">", "levels", ",", "Media", "sheetsConfig", ",", "Media", "groupsConfig", ")", "{", "Check", ".", "notNull", "(", "media", ")", ";", "Check", ".", "notNull", "(", "levels", ")", ";", "Check", ".", "notNull", "(", "sheetsConfig", ")", ";", "Check", ".", "notNull", "(", "groupsConfig", ")", ";", "final", "CircuitsExtractor", "extractor", "=", "new", "CircuitsExtractorImpl", "(", ")", ";", "final", "Map", "<", "Circuit", ",", "Collection", "<", "TileRef", ">", ">", "circuits", "=", "extractor", ".", "getCircuits", "(", "levels", ",", "sheetsConfig", ",", "groupsConfig", ")", ";", "exports", "(", "media", ",", "circuits", ")", ";", "}" ]
Export all circuits to an XML file. @param media The export output (must not be <code>null</code>). @param levels The level rips used (must not be <code>null</code>). @param sheetsConfig The sheets media (must not be <code>null</code>). @param groupsConfig The groups media (must not be <code>null</code>). @throws LionEngineException If error on export.
[ "Export", "all", "circuits", "to", "an", "XML", "file", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/circuit/CircuitsConfig.java#L100-L110
bazaarvoice/emodb
uac-api/src/main/java/com/bazaarvoice/emodb/uac/api/UserAccessControlRequest.java
UserAccessControlRequest.setCustomRequestParameter
public void setCustomRequestParameter(String param, String... values) { """ Sets custom request parameters. Custom parameters may include new features not yet officially supported or additional parameters to existing calls not intended for widespread use. As such this method is not typically used by most clients. Furthermore, adding additional parameters may cause the request to fail. """ _customRequestParameters.putAll(param, Arrays.asList(values)); }
java
public void setCustomRequestParameter(String param, String... values) { _customRequestParameters.putAll(param, Arrays.asList(values)); }
[ "public", "void", "setCustomRequestParameter", "(", "String", "param", ",", "String", "...", "values", ")", "{", "_customRequestParameters", ".", "putAll", "(", "param", ",", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "}" ]
Sets custom request parameters. Custom parameters may include new features not yet officially supported or additional parameters to existing calls not intended for widespread use. As such this method is not typically used by most clients. Furthermore, adding additional parameters may cause the request to fail.
[ "Sets", "custom", "request", "parameters", ".", "Custom", "parameters", "may", "include", "new", "features", "not", "yet", "officially", "supported", "or", "additional", "parameters", "to", "existing", "calls", "not", "intended", "for", "widespread", "use", ".", "As", "such", "this", "method", "is", "not", "typically", "used", "by", "most", "clients", ".", "Furthermore", "adding", "additional", "parameters", "may", "cause", "the", "request", "to", "fail", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/uac-api/src/main/java/com/bazaarvoice/emodb/uac/api/UserAccessControlRequest.java#L21-L23
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/validation/NamesAreUniqueValidationHelper.java
NamesAreUniqueValidationHelper.getDuplicateNameErrorMessage
public String getDuplicateNameErrorMessage(IEObjectDescription description, EClass clusterType, EStructuralFeature feature) { """ Build the error message for duplicated names. The default implementation will provider error messages of this form: <ul> <li>Duplicate Entity 'Sample'</li> <li>Duplicate Property 'Sample' in Entity 'EntityName'</li> </ul> If the container information will be helpful to locate the error or to understand the error it will be used, otherwise only the simple format will be build. Clients may override different methods that influence the error message. @see #getNameFeature(EObject) @see #getTypeLabel(EClass) @see #getContainerForErrorMessage(EObject) @see #isContainerInformationHelpful(IEObjectDescription, String) @see #isContainerInformationHelpful(IEObjectDescription, EObject, String, EStructuralFeature) """ EObject object = description.getEObjectOrProxy(); String shortName = String.valueOf(feature != null ? object.eGet(feature) : "<unnamed>"); StringBuilder result = new StringBuilder(64); result.append("Duplicate "); result.append(getTypeLabel(clusterType)); result.append(" '"); result.append(shortName); result.append("'"); if (isContainerInformationHelpful(description, shortName)) { EObject container = getContainerForErrorMessage(object); if (container != null) { String containerTypeLabel = getTypeLabel(container.eClass()); EStructuralFeature containerNameFeature = getNameFeature(container); if (isContainerInformationHelpful(description, container, containerTypeLabel, containerNameFeature)) { result.append(" in "); result.append(containerTypeLabel); if (containerNameFeature != null) { String containerName = String.valueOf(container.eGet(containerNameFeature)); if (containerName != null) { result.append(" '"); result.append(containerName); result.append("'"); } } } } } return result.toString(); }
java
public String getDuplicateNameErrorMessage(IEObjectDescription description, EClass clusterType, EStructuralFeature feature) { EObject object = description.getEObjectOrProxy(); String shortName = String.valueOf(feature != null ? object.eGet(feature) : "<unnamed>"); StringBuilder result = new StringBuilder(64); result.append("Duplicate "); result.append(getTypeLabel(clusterType)); result.append(" '"); result.append(shortName); result.append("'"); if (isContainerInformationHelpful(description, shortName)) { EObject container = getContainerForErrorMessage(object); if (container != null) { String containerTypeLabel = getTypeLabel(container.eClass()); EStructuralFeature containerNameFeature = getNameFeature(container); if (isContainerInformationHelpful(description, container, containerTypeLabel, containerNameFeature)) { result.append(" in "); result.append(containerTypeLabel); if (containerNameFeature != null) { String containerName = String.valueOf(container.eGet(containerNameFeature)); if (containerName != null) { result.append(" '"); result.append(containerName); result.append("'"); } } } } } return result.toString(); }
[ "public", "String", "getDuplicateNameErrorMessage", "(", "IEObjectDescription", "description", ",", "EClass", "clusterType", ",", "EStructuralFeature", "feature", ")", "{", "EObject", "object", "=", "description", ".", "getEObjectOrProxy", "(", ")", ";", "String", "shortName", "=", "String", ".", "valueOf", "(", "feature", "!=", "null", "?", "object", ".", "eGet", "(", "feature", ")", ":", "\"<unnamed>\"", ")", ";", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "64", ")", ";", "result", ".", "append", "(", "\"Duplicate \"", ")", ";", "result", ".", "append", "(", "getTypeLabel", "(", "clusterType", ")", ")", ";", "result", ".", "append", "(", "\" '\"", ")", ";", "result", ".", "append", "(", "shortName", ")", ";", "result", ".", "append", "(", "\"'\"", ")", ";", "if", "(", "isContainerInformationHelpful", "(", "description", ",", "shortName", ")", ")", "{", "EObject", "container", "=", "getContainerForErrorMessage", "(", "object", ")", ";", "if", "(", "container", "!=", "null", ")", "{", "String", "containerTypeLabel", "=", "getTypeLabel", "(", "container", ".", "eClass", "(", ")", ")", ";", "EStructuralFeature", "containerNameFeature", "=", "getNameFeature", "(", "container", ")", ";", "if", "(", "isContainerInformationHelpful", "(", "description", ",", "container", ",", "containerTypeLabel", ",", "containerNameFeature", ")", ")", "{", "result", ".", "append", "(", "\" in \"", ")", ";", "result", ".", "append", "(", "containerTypeLabel", ")", ";", "if", "(", "containerNameFeature", "!=", "null", ")", "{", "String", "containerName", "=", "String", ".", "valueOf", "(", "container", ".", "eGet", "(", "containerNameFeature", ")", ")", ";", "if", "(", "containerName", "!=", "null", ")", "{", "result", ".", "append", "(", "\" '\"", ")", ";", "result", ".", "append", "(", "containerName", ")", ";", "result", ".", "append", "(", "\"'\"", ")", ";", "}", "}", "}", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Build the error message for duplicated names. The default implementation will provider error messages of this form: <ul> <li>Duplicate Entity 'Sample'</li> <li>Duplicate Property 'Sample' in Entity 'EntityName'</li> </ul> If the container information will be helpful to locate the error or to understand the error it will be used, otherwise only the simple format will be build. Clients may override different methods that influence the error message. @see #getNameFeature(EObject) @see #getTypeLabel(EClass) @see #getContainerForErrorMessage(EObject) @see #isContainerInformationHelpful(IEObjectDescription, String) @see #isContainerInformationHelpful(IEObjectDescription, EObject, String, EStructuralFeature)
[ "Build", "the", "error", "message", "for", "duplicated", "names", ".", "The", "default", "implementation", "will", "provider", "error", "messages", "of", "this", "form", ":", "<ul", ">", "<li", ">", "Duplicate", "Entity", "Sample", "<", "/", "li", ">", "<li", ">", "Duplicate", "Property", "Sample", "in", "Entity", "EntityName", "<", "/", "li", ">", "<", "/", "ul", ">", "If", "the", "container", "information", "will", "be", "helpful", "to", "locate", "the", "error", "or", "to", "understand", "the", "error", "it", "will", "be", "used", "otherwise", "only", "the", "simple", "format", "will", "be", "build", ".", "Clients", "may", "override", "different", "methods", "that", "influence", "the", "error", "message", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/validation/NamesAreUniqueValidationHelper.java#L142-L171
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.unsignedBinarySearch
public static int unsignedBinarySearch(final short[] array, final int begin, final int end, final short k) { """ Look for value k in array in the range [begin,end). If the value is found, return its index. If not, return -(i+1) where i is the index where the value would be inserted. The array is assumed to contain sorted values where shorts are interpreted as unsigned integers. @param array array where we search @param begin first index (inclusive) @param end last index (exclusive) @param k value we search for @return count """ if (USE_HYBRID_BINSEARCH) { return hybridUnsignedBinarySearch(array, begin, end, k); } else { return branchyUnsignedBinarySearch(array, begin, end, k); } }
java
public static int unsignedBinarySearch(final short[] array, final int begin, final int end, final short k) { if (USE_HYBRID_BINSEARCH) { return hybridUnsignedBinarySearch(array, begin, end, k); } else { return branchyUnsignedBinarySearch(array, begin, end, k); } }
[ "public", "static", "int", "unsignedBinarySearch", "(", "final", "short", "[", "]", "array", ",", "final", "int", "begin", ",", "final", "int", "end", ",", "final", "short", "k", ")", "{", "if", "(", "USE_HYBRID_BINSEARCH", ")", "{", "return", "hybridUnsignedBinarySearch", "(", "array", ",", "begin", ",", "end", ",", "k", ")", ";", "}", "else", "{", "return", "branchyUnsignedBinarySearch", "(", "array", ",", "begin", ",", "end", ",", "k", ")", ";", "}", "}" ]
Look for value k in array in the range [begin,end). If the value is found, return its index. If not, return -(i+1) where i is the index where the value would be inserted. The array is assumed to contain sorted values where shorts are interpreted as unsigned integers. @param array array where we search @param begin first index (inclusive) @param end last index (exclusive) @param k value we search for @return count
[ "Look", "for", "value", "k", "in", "array", "in", "the", "range", "[", "begin", "end", ")", ".", "If", "the", "value", "is", "found", "return", "its", "index", ".", "If", "not", "return", "-", "(", "i", "+", "1", ")", "where", "i", "is", "the", "index", "where", "the", "value", "would", "be", "inserted", ".", "The", "array", "is", "assumed", "to", "contain", "sorted", "values", "where", "shorts", "are", "interpreted", "as", "unsigned", "integers", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L586-L593
loldevs/riotapi
rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java
LcdsGameInvitationService.createGroupFinderLobby
public LobbyStatus createGroupFinderLobby(long queueId, String uuid) { """ Create a groupfinder lobby @param queueId The target queue @param uuid The uuid for this lobby @return The lobby status """ return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", queueId, uuid); }
java
public LobbyStatus createGroupFinderLobby(long queueId, String uuid) { return client.sendRpcAndWait(SERVICE, "createGroupFinderLobby", queueId, uuid); }
[ "public", "LobbyStatus", "createGroupFinderLobby", "(", "long", "queueId", ",", "String", "uuid", ")", "{", "return", "client", ".", "sendRpcAndWait", "(", "SERVICE", ",", "\"createGroupFinderLobby\"", ",", "queueId", ",", "uuid", ")", ";", "}" ]
Create a groupfinder lobby @param queueId The target queue @param uuid The uuid for this lobby @return The lobby status
[ "Create", "a", "groupfinder", "lobby" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/services/LcdsGameInvitationService.java#L40-L42
googleapis/google-http-java-client
google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java
XmlNamespaceDictionary.toStringOf
public String toStringOf(String elementName, Object element) { """ Shows a debug string representation of an element data object of key/value pairs. @param element element data object ({@link GenericXml}, {@link Map}, or any object with public fields) @param elementName optional XML element local name prefixed by its namespace alias -- for example {@code "atom:entry"} -- or {@code null} to make up something """ try { StringWriter writer = new StringWriter(); XmlSerializer serializer = Xml.createSerializer(); serializer.setOutput(writer); serialize(serializer, elementName, element, false); return writer.toString(); } catch (IOException e) { throw new IllegalArgumentException(e); } }
java
public String toStringOf(String elementName, Object element) { try { StringWriter writer = new StringWriter(); XmlSerializer serializer = Xml.createSerializer(); serializer.setOutput(writer); serialize(serializer, elementName, element, false); return writer.toString(); } catch (IOException e) { throw new IllegalArgumentException(e); } }
[ "public", "String", "toStringOf", "(", "String", "elementName", ",", "Object", "element", ")", "{", "try", "{", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "XmlSerializer", "serializer", "=", "Xml", ".", "createSerializer", "(", ")", ";", "serializer", ".", "setOutput", "(", "writer", ")", ";", "serialize", "(", "serializer", ",", "elementName", ",", "element", ",", "false", ")", ";", "return", "writer", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
Shows a debug string representation of an element data object of key/value pairs. @param element element data object ({@link GenericXml}, {@link Map}, or any object with public fields) @param elementName optional XML element local name prefixed by its namespace alias -- for example {@code "atom:entry"} -- or {@code null} to make up something
[ "Shows", "a", "debug", "string", "representation", "of", "an", "element", "data", "object", "of", "key", "/", "value", "pairs", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client-xml/src/main/java/com/google/api/client/xml/XmlNamespaceDictionary.java#L163-L173
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/provider/AbstractJSSEProvider.java
AbstractJSSEProvider.getTrustManagerFactoryInstance
public TrustManagerFactory getTrustManagerFactoryInstance(String trustMgr, String ctxtProvider) throws NoSuchAlgorithmException, NoSuchProviderException { """ Get the trust manager factory instance using the provided information. @see com.ibm.websphere.ssl.JSSEProvider#getTrustManagerFactoryInstance() @param trustMgr @param ctxtProvider @return TrustManagerFactory @throws NoSuchAlgorithmException @throws NoSuchProviderException """ String mgr = trustMgr; String provider = ctxtProvider; if (mgr.indexOf('|') != -1) { String[] trustManagerArray = mgr.split("\\|"); if (trustManagerArray != null && trustManagerArray.length == 2) { mgr = trustManagerArray[0]; provider = trustManagerArray[1]; } } TrustManagerFactory rc = TrustManagerFactory.getInstance(mgr, provider); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getTrustManagerFactory.getInstance(" + mgr + ", " + provider + ")" + rc); return rc; }
java
public TrustManagerFactory getTrustManagerFactoryInstance(String trustMgr, String ctxtProvider) throws NoSuchAlgorithmException, NoSuchProviderException { String mgr = trustMgr; String provider = ctxtProvider; if (mgr.indexOf('|') != -1) { String[] trustManagerArray = mgr.split("\\|"); if (trustManagerArray != null && trustManagerArray.length == 2) { mgr = trustManagerArray[0]; provider = trustManagerArray[1]; } } TrustManagerFactory rc = TrustManagerFactory.getInstance(mgr, provider); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getTrustManagerFactory.getInstance(" + mgr + ", " + provider + ")" + rc); return rc; }
[ "public", "TrustManagerFactory", "getTrustManagerFactoryInstance", "(", "String", "trustMgr", ",", "String", "ctxtProvider", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchProviderException", "{", "String", "mgr", "=", "trustMgr", ";", "String", "provider", "=", "ctxtProvider", ";", "if", "(", "mgr", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "String", "[", "]", "trustManagerArray", "=", "mgr", ".", "split", "(", "\"\\\\|\"", ")", ";", "if", "(", "trustManagerArray", "!=", "null", "&&", "trustManagerArray", ".", "length", "==", "2", ")", "{", "mgr", "=", "trustManagerArray", "[", "0", "]", ";", "provider", "=", "trustManagerArray", "[", "1", "]", ";", "}", "}", "TrustManagerFactory", "rc", "=", "TrustManagerFactory", ".", "getInstance", "(", "mgr", ",", "provider", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"getTrustManagerFactory.getInstance(\"", "+", "mgr", "+", "\", \"", "+", "provider", "+", "\")\"", "+", "rc", ")", ";", "return", "rc", ";", "}" ]
Get the trust manager factory instance using the provided information. @see com.ibm.websphere.ssl.JSSEProvider#getTrustManagerFactoryInstance() @param trustMgr @param ctxtProvider @return TrustManagerFactory @throws NoSuchAlgorithmException @throws NoSuchProviderException
[ "Get", "the", "trust", "manager", "factory", "instance", "using", "the", "provided", "information", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/provider/AbstractJSSEProvider.java#L682-L697
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/Config.java
Config.limitOrNull
private HistoryLimit limitOrNull(int pMaxEntries, long pMaxDuration) { """ The limit or null if the entry should be disabled in the history store """ return pMaxEntries != 0 || pMaxDuration != 0 ? new HistoryLimit(pMaxEntries, pMaxDuration) : null; }
java
private HistoryLimit limitOrNull(int pMaxEntries, long pMaxDuration) { return pMaxEntries != 0 || pMaxDuration != 0 ? new HistoryLimit(pMaxEntries, pMaxDuration) : null; }
[ "private", "HistoryLimit", "limitOrNull", "(", "int", "pMaxEntries", ",", "long", "pMaxDuration", ")", "{", "return", "pMaxEntries", "!=", "0", "||", "pMaxDuration", "!=", "0", "?", "new", "HistoryLimit", "(", "pMaxEntries", ",", "pMaxDuration", ")", ":", "null", ";", "}" ]
The limit or null if the entry should be disabled in the history store
[ "The", "limit", "or", "null", "if", "the", "entry", "should", "be", "disabled", "in", "the", "history", "store" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/Config.java#L128-L130
casmi/casmi
src/main/java/casmi/graphics/color/HSBColor.java
HSBColor.getComplementaryColor
public HSBColor getComplementaryColor() { """ Returns a Color object that shows a complementary color. @return a complementary Color object. """ double[] rgb = HSBColor.getRGB(hue, saturation, brightness); double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]); return new HSBColor(hsb[0], hsb[1], hsb[2]); }
java
public HSBColor getComplementaryColor() { double[] rgb = HSBColor.getRGB(hue, saturation, brightness); double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]); return new HSBColor(hsb[0], hsb[1], hsb[2]); }
[ "public", "HSBColor", "getComplementaryColor", "(", ")", "{", "double", "[", "]", "rgb", "=", "HSBColor", ".", "getRGB", "(", "hue", ",", "saturation", ",", "brightness", ")", ";", "double", "[", "]", "hsb", "=", "HSBColor", ".", "getHSB", "(", "1.0", "-", "rgb", "[", "0", "]", ",", "1.0", "-", "rgb", "[", "1", "]", ",", "1.0", "-", "rgb", "[", "2", "]", ")", ";", "return", "new", "HSBColor", "(", "hsb", "[", "0", "]", ",", "hsb", "[", "1", "]", ",", "hsb", "[", "2", "]", ")", ";", "}" ]
Returns a Color object that shows a complementary color. @return a complementary Color object.
[ "Returns", "a", "Color", "object", "that", "shows", "a", "complementary", "color", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L287-L291
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.getFullPathName
static String getFullPathName(INode inode) throws IOException { """ Return the full path name of the specified inode @param inode @return its full path name @throws IOException if the inode is invalid """ INode[] inodes = getINodeArray(inode); return getFullPathName(inodes, inodes.length-1); }
java
static String getFullPathName(INode inode) throws IOException { INode[] inodes = getINodeArray(inode); return getFullPathName(inodes, inodes.length-1); }
[ "static", "String", "getFullPathName", "(", "INode", "inode", ")", "throws", "IOException", "{", "INode", "[", "]", "inodes", "=", "getINodeArray", "(", "inode", ")", ";", "return", "getFullPathName", "(", "inodes", ",", "inodes", ".", "length", "-", "1", ")", ";", "}" ]
Return the full path name of the specified inode @param inode @return its full path name @throws IOException if the inode is invalid
[ "Return", "the", "full", "path", "name", "of", "the", "specified", "inode" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2271-L2274
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/receivers/rewrite/PropertyRewritePolicy.java
PropertyRewritePolicy.setProperties
public void setProperties(String props) { """ Set a string representing the property name/value pairs. Form: propname1=propvalue1,propname2=propvalue2 @param props """ Map hashTable = new HashMap(); StringTokenizer pairs = new StringTokenizer(props, ","); while (pairs.hasMoreTokens()) { StringTokenizer entry = new StringTokenizer(pairs.nextToken(), "="); hashTable.put(entry.nextElement().toString().trim(), entry.nextElement().toString().trim()); } synchronized(this) { properties = hashTable; } }
java
public void setProperties(String props) { Map hashTable = new HashMap(); StringTokenizer pairs = new StringTokenizer(props, ","); while (pairs.hasMoreTokens()) { StringTokenizer entry = new StringTokenizer(pairs.nextToken(), "="); hashTable.put(entry.nextElement().toString().trim(), entry.nextElement().toString().trim()); } synchronized(this) { properties = hashTable; } }
[ "public", "void", "setProperties", "(", "String", "props", ")", "{", "Map", "hashTable", "=", "new", "HashMap", "(", ")", ";", "StringTokenizer", "pairs", "=", "new", "StringTokenizer", "(", "props", ",", "\",\"", ")", ";", "while", "(", "pairs", ".", "hasMoreTokens", "(", ")", ")", "{", "StringTokenizer", "entry", "=", "new", "StringTokenizer", "(", "pairs", ".", "nextToken", "(", ")", ",", "\"=\"", ")", ";", "hashTable", ".", "put", "(", "entry", ".", "nextElement", "(", ")", ".", "toString", "(", ")", ".", "trim", "(", ")", ",", "entry", ".", "nextElement", "(", ")", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "synchronized", "(", "this", ")", "{", "properties", "=", "hashTable", ";", "}", "}" ]
Set a string representing the property name/value pairs. Form: propname1=propvalue1,propname2=propvalue2 @param props
[ "Set", "a", "string", "representing", "the", "property", "name", "/", "value", "pairs", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/receivers/rewrite/PropertyRewritePolicy.java#L45-L55
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/inputs/DatastoreShardStrategy.java
DatastoreShardStrategy.getScatterSplitPoints
private List<Range> getScatterSplitPoints(String namespace, String kind, final int numSegments) { """ Uses the scatter property to distribute ranges to segments. A random scatter property is added to 1 out of every 512 entities see: https://github.com/GoogleCloudPlatform/appengine-mapreduce/wiki/ScatterPropertyImplementation Retrieving the entities with the highest scatter values provides a random sample of entities. Because they are randomly selected, their distribution in keyspace should be the same as other entities. Looking at Keyspace, It looks something like this: |---*------*------*---*--------*-----*--------*--| Where "*" is a scatter entity and "-" is some other entity. So once sample entities are obtained them by key allows them to serve as boundaries between ranges of keyspace. """ Query query = createQuery(namespace, kind).addSort(SCATTER_RESERVED_PROPERTY).setKeysOnly(); List<Key> splitPoints = sortKeys(runQuery(query, numSegments - 1)); List<Range> result = new ArrayList<>(splitPoints.size() + 1); FilterPredicate lower = null; for (Key k : splitPoints) { result.add(new Range(lower, new FilterPredicate(KEY_RESERVED_PROPERTY, LESS_THAN, k))); lower = new FilterPredicate(KEY_RESERVED_PROPERTY, GREATER_THAN_OR_EQUAL, k); } result.add(new Range(lower, null)); logger.info("Requested " + numSegments + " segments, retrieved " + result.size()); return result; }
java
private List<Range> getScatterSplitPoints(String namespace, String kind, final int numSegments) { Query query = createQuery(namespace, kind).addSort(SCATTER_RESERVED_PROPERTY).setKeysOnly(); List<Key> splitPoints = sortKeys(runQuery(query, numSegments - 1)); List<Range> result = new ArrayList<>(splitPoints.size() + 1); FilterPredicate lower = null; for (Key k : splitPoints) { result.add(new Range(lower, new FilterPredicate(KEY_RESERVED_PROPERTY, LESS_THAN, k))); lower = new FilterPredicate(KEY_RESERVED_PROPERTY, GREATER_THAN_OR_EQUAL, k); } result.add(new Range(lower, null)); logger.info("Requested " + numSegments + " segments, retrieved " + result.size()); return result; }
[ "private", "List", "<", "Range", ">", "getScatterSplitPoints", "(", "String", "namespace", ",", "String", "kind", ",", "final", "int", "numSegments", ")", "{", "Query", "query", "=", "createQuery", "(", "namespace", ",", "kind", ")", ".", "addSort", "(", "SCATTER_RESERVED_PROPERTY", ")", ".", "setKeysOnly", "(", ")", ";", "List", "<", "Key", ">", "splitPoints", "=", "sortKeys", "(", "runQuery", "(", "query", ",", "numSegments", "-", "1", ")", ")", ";", "List", "<", "Range", ">", "result", "=", "new", "ArrayList", "<>", "(", "splitPoints", ".", "size", "(", ")", "+", "1", ")", ";", "FilterPredicate", "lower", "=", "null", ";", "for", "(", "Key", "k", ":", "splitPoints", ")", "{", "result", ".", "add", "(", "new", "Range", "(", "lower", ",", "new", "FilterPredicate", "(", "KEY_RESERVED_PROPERTY", ",", "LESS_THAN", ",", "k", ")", ")", ")", ";", "lower", "=", "new", "FilterPredicate", "(", "KEY_RESERVED_PROPERTY", ",", "GREATER_THAN_OR_EQUAL", ",", "k", ")", ";", "}", "result", ".", "add", "(", "new", "Range", "(", "lower", ",", "null", ")", ")", ";", "logger", ".", "info", "(", "\"Requested \"", "+", "numSegments", "+", "\" segments, retrieved \"", "+", "result", ".", "size", "(", ")", ")", ";", "return", "result", ";", "}" ]
Uses the scatter property to distribute ranges to segments. A random scatter property is added to 1 out of every 512 entities see: https://github.com/GoogleCloudPlatform/appengine-mapreduce/wiki/ScatterPropertyImplementation Retrieving the entities with the highest scatter values provides a random sample of entities. Because they are randomly selected, their distribution in keyspace should be the same as other entities. Looking at Keyspace, It looks something like this: |---*------*------*---*--------*-----*--------*--| Where "*" is a scatter entity and "-" is some other entity. So once sample entities are obtained them by key allows them to serve as boundaries between ranges of keyspace.
[ "Uses", "the", "scatter", "property", "to", "distribute", "ranges", "to", "segments", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/inputs/DatastoreShardStrategy.java#L258-L270
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.splitByWholeSeparatorPreserveAllTokens
public static String[] splitByWholeSeparatorPreserveAllTokens(final String str, final String separator) { """ <p>Splits the provided text into an array, separator string specified. </p> <p>The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the split use the StrTokenizer class.</p> <p>A {@code null} input String returns {@code null}. A {@code null} separator splits on whitespace.</p> <pre> StringUtils.splitByWholeSeparatorPreserveAllTokens(null, *) = null StringUtils.splitByWholeSeparatorPreserveAllTokens("", *) = [] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "", "", "de", "fg"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"] </pre> @param str the String to parse, may be null @param separator String containing the String to be used as a delimiter, {@code null} splits on whitespace @return an array of parsed Strings, {@code null} if null String was input @since 2.4 """ return splitByWholeSeparatorWorker(str, separator, -1, true); }
java
public static String[] splitByWholeSeparatorPreserveAllTokens(final String str, final String separator) { return splitByWholeSeparatorWorker(str, separator, -1, true); }
[ "public", "static", "String", "[", "]", "splitByWholeSeparatorPreserveAllTokens", "(", "final", "String", "str", ",", "final", "String", "separator", ")", "{", "return", "splitByWholeSeparatorWorker", "(", "str", ",", "separator", ",", "-", "1", ",", "true", ")", ";", "}" ]
<p>Splits the provided text into an array, separator string specified. </p> <p>The separator is not included in the returned String array. Adjacent separators are treated as separators for empty tokens. For more control over the split use the StrTokenizer class.</p> <p>A {@code null} input String returns {@code null}. A {@code null} separator splits on whitespace.</p> <pre> StringUtils.splitByWholeSeparatorPreserveAllTokens(null, *) = null StringUtils.splitByWholeSeparatorPreserveAllTokens("", *) = [] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "", "", "de", "fg"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"] </pre> @param str the String to parse, may be null @param separator String containing the String to be used as a delimiter, {@code null} splits on whitespace @return an array of parsed Strings, {@code null} if null String was input @since 2.4
[ "<p", ">", "Splits", "the", "provided", "text", "into", "an", "array", "separator", "string", "specified", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L3326-L3328
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java
HelpFormatter.printHelp
public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) { """ Print the help for <code>options</code> with the specified command line syntax. This method prints help information to System.out. @param cmdLineSyntax the syntax for this application @param header the banner to display at the beginning of the help @param options the Options instance @param footer the banner to display at the end of the help @param autoUsage whether to print an automatically generated usage statement """ printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage); }
java
public void printHelp(String cmdLineSyntax, String header, Options options, String footer, boolean autoUsage) { printHelp(getWidth(), cmdLineSyntax, header, options, footer, autoUsage); }
[ "public", "void", "printHelp", "(", "String", "cmdLineSyntax", ",", "String", "header", ",", "Options", "options", ",", "String", "footer", ",", "boolean", "autoUsage", ")", "{", "printHelp", "(", "getWidth", "(", ")", ",", "cmdLineSyntax", ",", "header", ",", "options", ",", "footer", ",", "autoUsage", ")", ";", "}" ]
Print the help for <code>options</code> with the specified command line syntax. This method prints help information to System.out. @param cmdLineSyntax the syntax for this application @param header the banner to display at the beginning of the help @param options the Options instance @param footer the banner to display at the end of the help @param autoUsage whether to print an automatically generated usage statement
[ "Print", "the", "help", "for", "<code", ">", "options<", "/", "code", ">", "with", "the", "specified", "command", "line", "syntax", ".", "This", "method", "prints", "help", "information", "to", "System", ".", "out", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L453-L456
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java
TemplateReactionWrapper.addToUpstream
protected void addToUpstream(BioPAXElement ele, org.biopax.paxtools.query.model.Graph graph) { """ Binds the given element to the upstream. @param ele Element to bind @param graph Owner graph """ AbstractNode node = (AbstractNode) graph.getGraphObject(ele); if (node == null) return; Edge edge = new EdgeL3(node, this, graph); if (isTranscription()) { if (node instanceof ControlWrapper) { ((ControlWrapper) node).setTranscription(true); } } node.getDownstreamNoInit().add(edge); this.getUpstreamNoInit().add(edge); }
java
protected void addToUpstream(BioPAXElement ele, org.biopax.paxtools.query.model.Graph graph) { AbstractNode node = (AbstractNode) graph.getGraphObject(ele); if (node == null) return; Edge edge = new EdgeL3(node, this, graph); if (isTranscription()) { if (node instanceof ControlWrapper) { ((ControlWrapper) node).setTranscription(true); } } node.getDownstreamNoInit().add(edge); this.getUpstreamNoInit().add(edge); }
[ "protected", "void", "addToUpstream", "(", "BioPAXElement", "ele", ",", "org", ".", "biopax", ".", "paxtools", ".", "query", ".", "model", ".", "Graph", "graph", ")", "{", "AbstractNode", "node", "=", "(", "AbstractNode", ")", "graph", ".", "getGraphObject", "(", "ele", ")", ";", "if", "(", "node", "==", "null", ")", "return", ";", "Edge", "edge", "=", "new", "EdgeL3", "(", "node", ",", "this", ",", "graph", ")", ";", "if", "(", "isTranscription", "(", ")", ")", "{", "if", "(", "node", "instanceof", "ControlWrapper", ")", "{", "(", "(", "ControlWrapper", ")", "node", ")", ".", "setTranscription", "(", "true", ")", ";", "}", "}", "node", ".", "getDownstreamNoInit", "(", ")", ".", "add", "(", "edge", ")", ";", "this", ".", "getUpstreamNoInit", "(", ")", ".", "add", "(", "edge", ")", ";", "}" ]
Binds the given element to the upstream. @param ele Element to bind @param graph Owner graph
[ "Binds", "the", "given", "element", "to", "the", "upstream", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/TemplateReactionWrapper.java#L94-L111
milaboratory/milib
src/main/java/com/milaboratory/core/io/util/FileIndexBuilder.java
FileIndexBuilder.createAndDestroy
public FileIndex createAndDestroy() { """ Creates {@code FileIndex} assembled by this builder. @return {@code FileIndex} assembled by this builder """ checkIfDestroyed(); destroyed = true; return new FileIndex(step, metadata, index, startingRecordNumber, lastAccessibleRecordNumber()); }
java
public FileIndex createAndDestroy() { checkIfDestroyed(); destroyed = true; return new FileIndex(step, metadata, index, startingRecordNumber, lastAccessibleRecordNumber()); }
[ "public", "FileIndex", "createAndDestroy", "(", ")", "{", "checkIfDestroyed", "(", ")", ";", "destroyed", "=", "true", ";", "return", "new", "FileIndex", "(", "step", ",", "metadata", ",", "index", ",", "startingRecordNumber", ",", "lastAccessibleRecordNumber", "(", ")", ")", ";", "}" ]
Creates {@code FileIndex} assembled by this builder. @return {@code FileIndex} assembled by this builder
[ "Creates", "{", "@code", "FileIndex", "}", "assembled", "by", "this", "builder", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/FileIndexBuilder.java#L148-L152
reapzor/FiloFirmata
src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java
Firmata.removeMessageListener
public void removeMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) { """ Remove a messageListener from the Firmata object which will stop the listener from responding to message received events over the SerialPort. @param channel DigitalChannel to remove the listener from. @param messageListener MessageListener to be removed. """ removeListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener); }
java
public void removeMessageListener(DigitalChannel channel, MessageListener<? extends Message> messageListener) { removeListener(channel.getIdentifier(), messageListener.getMessageType(), messageListener); }
[ "public", "void", "removeMessageListener", "(", "DigitalChannel", "channel", ",", "MessageListener", "<", "?", "extends", "Message", ">", "messageListener", ")", "{", "removeListener", "(", "channel", ".", "getIdentifier", "(", ")", ",", "messageListener", ".", "getMessageType", "(", ")", ",", "messageListener", ")", ";", "}" ]
Remove a messageListener from the Firmata object which will stop the listener from responding to message received events over the SerialPort. @param channel DigitalChannel to remove the listener from. @param messageListener MessageListener to be removed.
[ "Remove", "a", "messageListener", "from", "the", "Firmata", "object", "which", "will", "stop", "the", "listener", "from", "responding", "to", "message", "received", "events", "over", "the", "SerialPort", "." ]
train
https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L259-L261
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.assertNotNull
protected final void assertNotNull(String message, Object obj) { """ Throw an exception when the given object is null. @param message is the message to put in the exception. @param obj the object to test. """ if (getLog().isDebugEnabled()) { getLog().debug( "\t(" //$NON-NLS-1$ + getLogType(obj) + ") " //$NON-NLS-1$ + message + " = " //$NON-NLS-1$ + obj); } if (obj == null) { throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$ } }
java
protected final void assertNotNull(String message, Object obj) { if (getLog().isDebugEnabled()) { getLog().debug( "\t(" //$NON-NLS-1$ + getLogType(obj) + ") " //$NON-NLS-1$ + message + " = " //$NON-NLS-1$ + obj); } if (obj == null) { throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$ } }
[ "protected", "final", "void", "assertNotNull", "(", "String", "message", ",", "Object", "obj", ")", "{", "if", "(", "getLog", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"\\t(\"", "//$NON-NLS-1$", "+", "getLogType", "(", "obj", ")", "+", "\") \"", "//$NON-NLS-1$", "+", "message", "+", "\" = \"", "//$NON-NLS-1$", "+", "obj", ")", ";", "}", "if", "(", "obj", "==", "null", ")", "{", "throw", "new", "AssertionError", "(", "\"assertNotNull: \"", "+", "message", ")", ";", "//$NON-NLS-1$", "}", "}" ]
Throw an exception when the given object is null. @param message is the message to put in the exception. @param obj the object to test.
[ "Throw", "an", "exception", "when", "the", "given", "object", "is", "null", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L1081-L1094
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java
SarlBatchCompiler.setWarningSeverity
public void setWarningSeverity(String warningId, Severity severity) { """ Change the severity level of a warning. @param warningId the identifier of the warning. If {@code null} or empty, this function does nothing. @param severity the new severity. If {@code null} this function does nothing. @since 0.5 """ if (!Strings.isEmpty(warningId) && severity != null) { this.issueSeverityProvider.setSeverity(warningId, severity); } }
java
public void setWarningSeverity(String warningId, Severity severity) { if (!Strings.isEmpty(warningId) && severity != null) { this.issueSeverityProvider.setSeverity(warningId, severity); } }
[ "public", "void", "setWarningSeverity", "(", "String", "warningId", ",", "Severity", "severity", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "warningId", ")", "&&", "severity", "!=", "null", ")", "{", "this", ".", "issueSeverityProvider", ".", "setSeverity", "(", "warningId", ",", "severity", ")", ";", "}", "}" ]
Change the severity level of a warning. @param warningId the identifier of the warning. If {@code null} or empty, this function does nothing. @param severity the new severity. If {@code null} this function does nothing. @since 0.5
[ "Change", "the", "severity", "level", "of", "a", "warning", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2264-L2268
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertOnlyOneMethod
public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation) { """ Asserts only one method is annotated with annotation. @param method collection of methods to validate @param annotation annotation to propagate in exception message """ if (methods.size() > 1) { throw annotation == null ? MESSAGES.onlyOneMethodCanExist() : MESSAGES.onlyOneMethodCanExist2(annotation); } }
java
public static void assertOnlyOneMethod(final Collection<Method> methods, Class<? extends Annotation> annotation) { if (methods.size() > 1) { throw annotation == null ? MESSAGES.onlyOneMethodCanExist() : MESSAGES.onlyOneMethodCanExist2(annotation); } }
[ "public", "static", "void", "assertOnlyOneMethod", "(", "final", "Collection", "<", "Method", ">", "methods", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "if", "(", "methods", ".", "size", "(", ")", ">", "1", ")", "{", "throw", "annotation", "==", "null", "?", "MESSAGES", ".", "onlyOneMethodCanExist", "(", ")", ":", "MESSAGES", ".", "onlyOneMethodCanExist2", "(", "annotation", ")", ";", "}", "}" ]
Asserts only one method is annotated with annotation. @param method collection of methods to validate @param annotation annotation to propagate in exception message
[ "Asserts", "only", "one", "method", "is", "annotated", "with", "annotation", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L330-L336
wcm-io-caravan/caravan-hal
docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java
GenerateHalDocsJsonMojo.getAnnotation
private <T extends Annotation> T getAnnotation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> annotationType) { """ Get annotation for field. @param javaClazz QDox class @param javaField QDox field @param compileClassLoader Classloader for compile dependencies @param annotationType Annotation type @return Annotation of null if not present """ try { Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName()); Field field = clazz.getField(javaField.getName()); return field.getAnnotation(annotationType); } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException ex) { throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex); } }
java
private <T extends Annotation> T getAnnotation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader, Class<T> annotationType) { try { Class<?> clazz = compileClassLoader.loadClass(javaClazz.getFullyQualifiedName()); Field field = clazz.getField(javaField.getName()); return field.getAnnotation(annotationType); } catch (ClassNotFoundException | NoSuchFieldException | SecurityException | IllegalArgumentException ex) { throw new RuntimeException("Unable to get contanst value of field '" + javaClazz.getName() + "#" + javaField.getName() + ":\n" + ex.getMessage(), ex); } }
[ "private", "<", "T", "extends", "Annotation", ">", "T", "getAnnotation", "(", "JavaClass", "javaClazz", ",", "JavaField", "javaField", ",", "ClassLoader", "compileClassLoader", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "compileClassLoader", ".", "loadClass", "(", "javaClazz", ".", "getFullyQualifiedName", "(", ")", ")", ";", "Field", "field", "=", "clazz", ".", "getField", "(", "javaField", ".", "getName", "(", ")", ")", ";", "return", "field", ".", "getAnnotation", "(", "annotationType", ")", ";", "}", "catch", "(", "ClassNotFoundException", "|", "NoSuchFieldException", "|", "SecurityException", "|", "IllegalArgumentException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to get contanst value of field '\"", "+", "javaClazz", ".", "getName", "(", ")", "+", "\"#\"", "+", "javaField", ".", "getName", "(", ")", "+", "\":\\n\"", "+", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Get annotation for field. @param javaClazz QDox class @param javaField QDox field @param compileClassLoader Classloader for compile dependencies @param annotationType Annotation type @return Annotation of null if not present
[ "Get", "annotation", "for", "field", "." ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L349-L358
square/javapoet
src/main/java/com/squareup/javapoet/ClassName.java
ClassName.get
public static ClassName get(String packageName, String simpleName, String... simpleNames) { """ Returns a class name created from the given parts. For example, calling this with package name {@code "java.util"} and simple names {@code "Map"}, {@code "Entry"} yields {@link Map.Entry}. """ ClassName className = new ClassName(packageName, null, simpleName); for (String name : simpleNames) { className = className.nestedClass(name); } return className; }
java
public static ClassName get(String packageName, String simpleName, String... simpleNames) { ClassName className = new ClassName(packageName, null, simpleName); for (String name : simpleNames) { className = className.nestedClass(name); } return className; }
[ "public", "static", "ClassName", "get", "(", "String", "packageName", ",", "String", "simpleName", ",", "String", "...", "simpleNames", ")", "{", "ClassName", "className", "=", "new", "ClassName", "(", "packageName", ",", "null", ",", "simpleName", ")", ";", "for", "(", "String", "name", ":", "simpleNames", ")", "{", "className", "=", "className", ".", "nestedClass", "(", "name", ")", ";", "}", "return", "className", ";", "}" ]
Returns a class name created from the given parts. For example, calling this with package name {@code "java.util"} and simple names {@code "Map"}, {@code "Entry"} yields {@link Map.Entry}.
[ "Returns", "a", "class", "name", "created", "from", "the", "given", "parts", ".", "For", "example", "calling", "this", "with", "package", "name", "{" ]
train
https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/ClassName.java#L214-L220
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/entry/JournalEntry.java
JournalEntry.addArgument
public void addArgument(String key, InputStream stream) throws JournalException { """ If handed an InputStream as an argument, copy it to a temp file and store that File in the arguments map instead. If the InputStream is null, store null in the arguments map. """ checkOpen(); if (stream == null) { arguments.put(key, null); } else { try { File tempFile = JournalHelper.copyToTempFile(stream); arguments.put(key, tempFile); } catch (IOException e) { throw new JournalException(e); } } }
java
public void addArgument(String key, InputStream stream) throws JournalException { checkOpen(); if (stream == null) { arguments.put(key, null); } else { try { File tempFile = JournalHelper.copyToTempFile(stream); arguments.put(key, tempFile); } catch (IOException e) { throw new JournalException(e); } } }
[ "public", "void", "addArgument", "(", "String", "key", ",", "InputStream", "stream", ")", "throws", "JournalException", "{", "checkOpen", "(", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "arguments", ".", "put", "(", "key", ",", "null", ")", ";", "}", "else", "{", "try", "{", "File", "tempFile", "=", "JournalHelper", ".", "copyToTempFile", "(", "stream", ")", ";", "arguments", ".", "put", "(", "key", ",", "tempFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JournalException", "(", "e", ")", ";", "}", "}", "}" ]
If handed an InputStream as an argument, copy it to a temp file and store that File in the arguments map instead. If the InputStream is null, store null in the arguments map.
[ "If", "handed", "an", "InputStream", "as", "an", "argument", "copy", "it", "to", "a", "temp", "file", "and", "store", "that", "File", "in", "the", "arguments", "map", "instead", ".", "If", "the", "InputStream", "is", "null", "store", "null", "in", "the", "arguments", "map", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/entry/JournalEntry.java#L93-L106
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/easydl/AipEasyDL.java
AipEasyDL.sendImageRequest
public JSONObject sendImageRequest(String url, byte[] image, HashMap<String, Object> options) { """ easyDL通用请求方法 @param url 服务的url @param image 图片二进制数据 @param options 可选参数 @return Json返回 """ AipRequest request = new AipRequest(); preOperation(request); String content = Base64Util.encode(image); request.addBody("image", content); if (options != null) { request.addBody(options); } request.setUri(url); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_UTF8); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject sendImageRequest(String url, byte[] image, HashMap<String, Object> options) { AipRequest request = new AipRequest(); preOperation(request); String content = Base64Util.encode(image); request.addBody("image", content); if (options != null) { request.addBody(options); } request.setUri(url); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_UTF8); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "sendImageRequest", "(", "String", "url", ",", "byte", "[", "]", "image", ",", "HashMap", "<", "String", ",", "Object", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "String", "content", "=", "Base64Util", ".", "encode", "(", "image", ")", ";", "request", ".", "addBody", "(", "\"image\"", ",", "content", ")", ";", "if", "(", "options", "!=", "null", ")", "{", "request", ".", "addBody", "(", "options", ")", ";", "}", "request", ".", "setUri", "(", "url", ")", ";", "request", ".", "addHeader", "(", "Headers", ".", "CONTENT_ENCODING", ",", "HttpCharacterEncoding", ".", "ENCODE_UTF8", ")", ";", "request", ".", "addHeader", "(", "Headers", ".", "CONTENT_TYPE", ",", "HttpContentType", ".", "JSON_DATA", ")", ";", "request", ".", "setBodyFormat", "(", "EBodyFormat", ".", "RAW_JSON", ")", ";", "postOperation", "(", "request", ")", ";", "return", "requestServer", "(", "request", ")", ";", "}" ]
easyDL通用请求方法 @param url 服务的url @param image 图片二进制数据 @param options 可选参数 @return Json返回
[ "easyDL通用请求方法" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/easydl/AipEasyDL.java#L48-L63
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.checkDate
private static boolean checkDate(Calendar cal, int date, int month) { """ Check if the given date represents the given date and month. @param cal The Calendar object representing date to check. @param date The date. @param month The month. @return true if they match, false otherwise. """ return cal.get(Calendar.DATE) == date && cal.get(Calendar.MONTH) == month; }
java
private static boolean checkDate(Calendar cal, int date, int month) { return cal.get(Calendar.DATE) == date && cal.get(Calendar.MONTH) == month; }
[ "private", "static", "boolean", "checkDate", "(", "Calendar", "cal", ",", "int", "date", ",", "int", "month", ")", "{", "return", "cal", ".", "get", "(", "Calendar", ".", "DATE", ")", "==", "date", "&&", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "==", "month", ";", "}" ]
Check if the given date represents the given date and month. @param cal The Calendar object representing date to check. @param date The date. @param month The month. @return true if they match, false otherwise.
[ "Check", "if", "the", "given", "date", "represents", "the", "given", "date", "and", "month", "." ]
train
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L231-L233
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
AbstractClassEmptyMethods.visitCode
@Override public void visitCode(Code obj) { """ overrides the visitor to filter out constructors. @param obj the code to parse """ if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMethod(methodName, m.getSignature()))) { super.visitCode(obj); } }
java
@Override public void visitCode(Code obj) { if (Values.CONSTRUCTOR.equals(methodName) || Values.STATIC_INITIALIZER.equals(methodName)) { return; } Method m = getMethod(); if (m.isSynthetic()) { return; } if (!interfaceMethods.contains(new QMethod(methodName, m.getSignature()))) { super.visitCode(obj); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "if", "(", "Values", ".", "CONSTRUCTOR", ".", "equals", "(", "methodName", ")", "||", "Values", ".", "STATIC_INITIALIZER", ".", "equals", "(", "methodName", ")", ")", "{", "return", ";", "}", "Method", "m", "=", "getMethod", "(", ")", ";", "if", "(", "m", ".", "isSynthetic", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "interfaceMethods", ".", "contains", "(", "new", "QMethod", "(", "methodName", ",", "m", ".", "getSignature", "(", ")", ")", ")", ")", "{", "super", ".", "visitCode", "(", "obj", ")", ";", "}", "}" ]
overrides the visitor to filter out constructors. @param obj the code to parse
[ "overrides", "the", "visitor", "to", "filter", "out", "constructors", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java#L110-L124
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodeEANSUPP.java
BarcodeEANSUPP.placeBarcode
public Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor) { """ Places the barcode in a <CODE>PdfContentByte</CODE>. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.<p> The bars and text are written in the following colors:<p> <P><TABLE BORDER=1> <TR> <TH><P><CODE>barColor</CODE></TH> <TH><P><CODE>textColor</CODE></TH> <TH><P>Result</TH> </TR> <TR> <TD><P><CODE>null</CODE></TD> <TD><P><CODE>null</CODE></TD> <TD><P>bars and text painted with current fill color</TD> </TR> <TR> <TD><P><CODE>barColor</CODE></TD> <TD><P><CODE>null</CODE></TD> <TD><P>bars and text painted with <CODE>barColor</CODE></TD> </TR> <TR> <TD><P><CODE>null</CODE></TD> <TD><P><CODE>textColor</CODE></TD> <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD> </TR> <TR> <TD><P><CODE>barColor</CODE></TD> <TD><P><CODE>textColor</CODE></TD> <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD> </TR> </TABLE> @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed @param barColor the color of the bars. It can be <CODE>null</CODE> @param textColor the color of the text. It can be <CODE>null</CODE> @return the dimensions the barcode occupies """ if (supp.getFont() != null) supp.setBarHeight(ean.getBarHeight() + supp.getBaseline() - supp.getFont().getFontDescriptor(BaseFont.CAPHEIGHT, supp.getSize())); else supp.setBarHeight(ean.getBarHeight()); Rectangle eanR = ean.getBarcodeSize(); cb.saveState(); ean.placeBarcode(cb, barColor, textColor); cb.restoreState(); cb.saveState(); cb.concatCTM(1, 0, 0, 1, eanR.getWidth() + n, eanR.getHeight() - ean.getBarHeight()); supp.placeBarcode(cb, barColor, textColor); cb.restoreState(); return getBarcodeSize(); }
java
public Rectangle placeBarcode(PdfContentByte cb, Color barColor, Color textColor) { if (supp.getFont() != null) supp.setBarHeight(ean.getBarHeight() + supp.getBaseline() - supp.getFont().getFontDescriptor(BaseFont.CAPHEIGHT, supp.getSize())); else supp.setBarHeight(ean.getBarHeight()); Rectangle eanR = ean.getBarcodeSize(); cb.saveState(); ean.placeBarcode(cb, barColor, textColor); cb.restoreState(); cb.saveState(); cb.concatCTM(1, 0, 0, 1, eanR.getWidth() + n, eanR.getHeight() - ean.getBarHeight()); supp.placeBarcode(cb, barColor, textColor); cb.restoreState(); return getBarcodeSize(); }
[ "public", "Rectangle", "placeBarcode", "(", "PdfContentByte", "cb", ",", "Color", "barColor", ",", "Color", "textColor", ")", "{", "if", "(", "supp", ".", "getFont", "(", ")", "!=", "null", ")", "supp", ".", "setBarHeight", "(", "ean", ".", "getBarHeight", "(", ")", "+", "supp", ".", "getBaseline", "(", ")", "-", "supp", ".", "getFont", "(", ")", ".", "getFontDescriptor", "(", "BaseFont", ".", "CAPHEIGHT", ",", "supp", ".", "getSize", "(", ")", ")", ")", ";", "else", "supp", ".", "setBarHeight", "(", "ean", ".", "getBarHeight", "(", ")", ")", ";", "Rectangle", "eanR", "=", "ean", ".", "getBarcodeSize", "(", ")", ";", "cb", ".", "saveState", "(", ")", ";", "ean", ".", "placeBarcode", "(", "cb", ",", "barColor", ",", "textColor", ")", ";", "cb", ".", "restoreState", "(", ")", ";", "cb", ".", "saveState", "(", ")", ";", "cb", ".", "concatCTM", "(", "1", ",", "0", ",", "0", ",", "1", ",", "eanR", ".", "getWidth", "(", ")", "+", "n", ",", "eanR", ".", "getHeight", "(", ")", "-", "ean", ".", "getBarHeight", "(", ")", ")", ";", "supp", ".", "placeBarcode", "(", "cb", ",", "barColor", ",", "textColor", ")", ";", "cb", ".", "restoreState", "(", ")", ";", "return", "getBarcodeSize", "(", ")", ";", "}" ]
Places the barcode in a <CODE>PdfContentByte</CODE>. The barcode is always placed at coordinates (0, 0). Use the translation matrix to move it elsewhere.<p> The bars and text are written in the following colors:<p> <P><TABLE BORDER=1> <TR> <TH><P><CODE>barColor</CODE></TH> <TH><P><CODE>textColor</CODE></TH> <TH><P>Result</TH> </TR> <TR> <TD><P><CODE>null</CODE></TD> <TD><P><CODE>null</CODE></TD> <TD><P>bars and text painted with current fill color</TD> </TR> <TR> <TD><P><CODE>barColor</CODE></TD> <TD><P><CODE>null</CODE></TD> <TD><P>bars and text painted with <CODE>barColor</CODE></TD> </TR> <TR> <TD><P><CODE>null</CODE></TD> <TD><P><CODE>textColor</CODE></TD> <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD> </TR> <TR> <TD><P><CODE>barColor</CODE></TD> <TD><P><CODE>textColor</CODE></TD> <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD> </TR> </TABLE> @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed @param barColor the color of the bars. It can be <CODE>null</CODE> @param textColor the color of the text. It can be <CODE>null</CODE> @return the dimensions the barcode occupies
[ "Places", "the", "barcode", "in", "a", "<CODE", ">", "PdfContentByte<", "/", "CODE", ">", ".", "The", "barcode", "is", "always", "placed", "at", "coordinates", "(", "0", "0", ")", ".", "Use", "the", "translation", "matrix", "to", "move", "it", "elsewhere", ".", "<p", ">", "The", "bars", "and", "text", "are", "written", "in", "the", "following", "colors", ":", "<p", ">", "<P", ">", "<TABLE", "BORDER", "=", "1", ">", "<TR", ">", "<TH", ">", "<P", ">", "<CODE", ">", "barColor<", "/", "CODE", ">", "<", "/", "TH", ">", "<TH", ">", "<P", ">", "<CODE", ">", "textColor<", "/", "CODE", ">", "<", "/", "TH", ">", "<TH", ">", "<P", ">", "Result<", "/", "TH", ">", "<", "/", "TR", ">", "<TR", ">", "<TD", ">", "<P", ">", "<CODE", ">", "null<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "<CODE", ">", "null<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "bars", "and", "text", "painted", "with", "current", "fill", "color<", "/", "TD", ">", "<", "/", "TR", ">", "<TR", ">", "<TD", ">", "<P", ">", "<CODE", ">", "barColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "<CODE", ">", "null<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "bars", "and", "text", "painted", "with", "<CODE", ">", "barColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<", "/", "TR", ">", "<TR", ">", "<TD", ">", "<P", ">", "<CODE", ">", "null<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "<CODE", ">", "textColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "bars", "painted", "with", "current", "color<br", ">", "text", "painted", "with", "<CODE", ">", "textColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<", "/", "TR", ">", "<TR", ">", "<TD", ">", "<P", ">", "<CODE", ">", "barColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "<CODE", ">", "textColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<TD", ">", "<P", ">", "bars", "painted", "with", "<CODE", ">", "barColor<", "/", "CODE", ">", "<br", ">", "text", "painted", "with", "<CODE", ">", "textColor<", "/", "CODE", ">", "<", "/", "TD", ">", "<", "/", "TR", ">", "<", "/", "TABLE", ">" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodeEANSUPP.java#L129-L143
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java
JMElasticsearchIndex.sendData
public String sendData(String jsonSource, String index, String type) { """ Send data string. @param jsonSource the json source @param index the index @param type the type @return the string """ return sendData(jsonSource, index, type, null).getId(); }
java
public String sendData(String jsonSource, String index, String type) { return sendData(jsonSource, index, type, null).getId(); }
[ "public", "String", "sendData", "(", "String", "jsonSource", ",", "String", "index", ",", "String", "type", ")", "{", "return", "sendData", "(", "jsonSource", ",", "index", ",", "type", ",", "null", ")", ".", "getId", "(", ")", ";", "}" ]
Send data string. @param jsonSource the json source @param index the index @param type the type @return the string
[ "Send", "data", "string", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L248-L250
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.unGzip
public static String unGzip(byte[] buf, String charset) throws UtilException { """ Gzip解压缩处理 @param buf 压缩过的字节流 @param charset 编码 @return 解压后的字符串 @throws UtilException IO异常 """ return StrUtil.str(unGzip(buf), charset); }
java
public static String unGzip(byte[] buf, String charset) throws UtilException { return StrUtil.str(unGzip(buf), charset); }
[ "public", "static", "String", "unGzip", "(", "byte", "[", "]", "buf", ",", "String", "charset", ")", "throws", "UtilException", "{", "return", "StrUtil", ".", "str", "(", "unGzip", "(", "buf", ")", ",", "charset", ")", ";", "}" ]
Gzip解压缩处理 @param buf 压缩过的字节流 @param charset 编码 @return 解压后的字符串 @throws UtilException IO异常
[ "Gzip解压缩处理" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L567-L569
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java
OverrideService.updateResponseCode
public void updateResponseCode(int id, String responseCode) { """ Update the response code for a given enabled override @param id enabled override ID to update @param responseCode updated value of responseCode """ PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_RESPONSE_CODE + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setString(1, responseCode); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void updateResponseCode(int id, String responseCode) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_RESPONSE_CODE + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setString(1, responseCode); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "updateResponseCode", "(", "int", "id", ",", "String", "responseCode", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "String", "queryString", "=", "\"UPDATE \"", "+", "Constants", ".", "DB_TABLE_ENABLED_OVERRIDE", "+", "\" SET \"", "+", "Constants", ".", "ENABLED_OVERRIDES_RESPONSE_CODE", "+", "\"= ? \"", "+", "\" WHERE \"", "+", "Constants", ".", "GENERIC_ID", "+", "\" = ?\"", ";", "statement", "=", "sqlConnection", ".", "prepareStatement", "(", "queryString", ")", ";", "statement", ".", "setString", "(", "1", ",", "responseCode", ")", ";", "statement", ".", "setInt", "(", "2", ",", "id", ")", ";", "statement", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "statement", "!=", "null", ")", "{", "statement", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "}" ]
Update the response code for a given enabled override @param id enabled override ID to update @param responseCode updated value of responseCode
[ "Update", "the", "response", "code", "for", "a", "given", "enabled", "override" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java#L260-L281
ribot/easy-adapter
demo/src/main/java/uk/co/ribot/easyadapterdemo/PersonViewHolder.java
PersonViewHolder.onSetValues
@Override public void onSetValues(Person person, PositionInfo positionInfo) { """ Override onSetValues() to set the values of the items in the views. """ imageViewPerson.setImageResource(person.getResDrawableId()); textViewName.setText(person.getName()); textViewPhone.setText(person.getPhoneNumber()); }
java
@Override public void onSetValues(Person person, PositionInfo positionInfo) { imageViewPerson.setImageResource(person.getResDrawableId()); textViewName.setText(person.getName()); textViewPhone.setText(person.getPhoneNumber()); }
[ "@", "Override", "public", "void", "onSetValues", "(", "Person", "person", ",", "PositionInfo", "positionInfo", ")", "{", "imageViewPerson", ".", "setImageResource", "(", "person", ".", "getResDrawableId", "(", ")", ")", ";", "textViewName", ".", "setText", "(", "person", ".", "getName", "(", ")", ")", ";", "textViewPhone", ".", "setText", "(", "person", ".", "getPhoneNumber", "(", ")", ")", ";", "}" ]
Override onSetValues() to set the values of the items in the views.
[ "Override", "onSetValues", "()", "to", "set", "the", "values", "of", "the", "items", "in", "the", "views", "." ]
train
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/demo/src/main/java/uk/co/ribot/easyadapterdemo/PersonViewHolder.java#L52-L57
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java
Asn1Utils.decodeOctetString
public static short[] decodeOctetString(ByteBuffer buf) { """ Decode an ASN.1 OCTET STRING. @param buf the DER-encoded OCTET STRING @return the octets """ DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, ASN1_OCTET_STRING_TAG_NUM)) { throw new IllegalArgumentException("Expected OCTET STRING identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for OCTET STRING"); } short[] dst = new short[len]; for (int i = 0; i < len; i++) { dst[i] = (short) (0xff & buf.get()); } return dst; }
java
public static short[] decodeOctetString(ByteBuffer buf) { DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, ASN1_OCTET_STRING_TAG_NUM)) { throw new IllegalArgumentException("Expected OCTET STRING identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for OCTET STRING"); } short[] dst = new short[len]; for (int i = 0; i < len; i++) { dst[i] = (short) (0xff & buf.get()); } return dst; }
[ "public", "static", "short", "[", "]", "decodeOctetString", "(", "ByteBuffer", "buf", ")", "{", "DerId", "id", "=", "DerId", ".", "decode", "(", "buf", ")", ";", "if", "(", "!", "id", ".", "matches", "(", "DerId", ".", "TagClass", ".", "UNIVERSAL", ",", "ASN1_OCTET_STRING_TAG_NUM", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected OCTET STRING identifier, received \"", "+", "id", ")", ";", "}", "int", "len", "=", "DerUtils", ".", "decodeLength", "(", "buf", ")", ";", "if", "(", "buf", ".", "remaining", "(", ")", "<", "len", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Insufficient content for OCTET STRING\"", ")", ";", "}", "short", "[", "]", "dst", "=", "new", "short", "[", "len", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "dst", "[", "i", "]", "=", "(", "short", ")", "(", "0xff", "&", "buf", ".", "get", "(", ")", ")", ";", "}", "return", "dst", ";", "}" ]
Decode an ASN.1 OCTET STRING. @param buf the DER-encoded OCTET STRING @return the octets
[ "Decode", "an", "ASN", ".", "1", "OCTET", "STRING", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L195-L209
OnyxDevTools/onyx-database-parent
onyx-database-examples/webservice-client/java-client/src/main/java/io/swagger/client/api/PersistenceApi.java
PersistenceApi.executeQueryPostAsync
public com.squareup.okhttp.Call executeQueryPostAsync(Query query, final ApiCallback<QueryResponse> callback) throws ApiException { """ Execute Query (asynchronously) Execute query with defined criteria @param query Query defined with criteria (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = executeQueryPostValidateBeforeCall(query, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<QueryResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call executeQueryPostAsync(Query query, final ApiCallback<QueryResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = executeQueryPostValidateBeforeCall(query, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<QueryResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "executeQueryPostAsync", "(", "Query", "query", ",", "final", "ApiCallback", "<", "QueryResponse", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "executeQueryPostValidateBeforeCall", "(", "query", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "QueryResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Execute Query (asynchronously) Execute query with defined criteria @param query Query defined with criteria (required) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Execute", "Query", "(", "asynchronously", ")", "Execute", "query", "with", "defined", "criteria" ]
train
https://github.com/OnyxDevTools/onyx-database-parent/blob/474dfc273a094dbc2ca08fcc08a2858cd538c920/onyx-database-examples/webservice-client/java-client/src/main/java/io/swagger/client/api/PersistenceApi.java#L662-L687
apache/flink
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java
ConfigUtil.normalizeYaml
public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) { """ Normalizes key-value properties from Yaml in the normalized format of the Table API. """ final Map<String, String> normalized = new HashMap<>(); yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v)); final DescriptorProperties properties = new DescriptorProperties(true); properties.putProperties(normalized); return properties; }
java
public static DescriptorProperties normalizeYaml(Map<String, Object> yamlMap) { final Map<String, String> normalized = new HashMap<>(); yamlMap.forEach((k, v) -> normalizeYamlObject(normalized, k, v)); final DescriptorProperties properties = new DescriptorProperties(true); properties.putProperties(normalized); return properties; }
[ "public", "static", "DescriptorProperties", "normalizeYaml", "(", "Map", "<", "String", ",", "Object", ">", "yamlMap", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "normalized", "=", "new", "HashMap", "<>", "(", ")", ";", "yamlMap", ".", "forEach", "(", "(", "k", ",", "v", ")", "->", "normalizeYamlObject", "(", "normalized", ",", "k", ",", "v", ")", ")", ";", "final", "DescriptorProperties", "properties", "=", "new", "DescriptorProperties", "(", "true", ")", ";", "properties", ".", "putProperties", "(", "normalized", ")", ";", "return", "properties", ";", "}" ]
Normalizes key-value properties from Yaml in the normalized format of the Table API.
[ "Normalizes", "key", "-", "value", "properties", "from", "Yaml", "in", "the", "normalized", "format", "of", "the", "Table", "API", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/ConfigUtil.java#L48-L54
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.getEnum
public <TEnum extends Enum<TEnum>> TEnum getEnum(String key, Class<TEnum> enumClass, TEnum defaultValue) { """ Get the value of the property identified by the key as Enum. If {@code key} is null or there is no property for the key, {@code defaultValue} is returned. """ String name = getString(key); if (name == null) { return defaultValue; } try { return Enum.valueOf(enumClass, name); } catch (RuntimeException e) { return defaultValue; } }
java
public <TEnum extends Enum<TEnum>> TEnum getEnum(String key, Class<TEnum> enumClass, TEnum defaultValue) { String name = getString(key); if (name == null) { return defaultValue; } try { return Enum.valueOf(enumClass, name); } catch (RuntimeException e) { return defaultValue; } }
[ "public", "<", "TEnum", "extends", "Enum", "<", "TEnum", ">", ">", "TEnum", "getEnum", "(", "String", "key", ",", "Class", "<", "TEnum", ">", "enumClass", ",", "TEnum", "defaultValue", ")", "{", "String", "name", "=", "getString", "(", "key", ")", ";", "if", "(", "name", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "return", "Enum", ".", "valueOf", "(", "enumClass", ",", "name", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Get the value of the property identified by the key as Enum. If {@code key} is null or there is no property for the key, {@code defaultValue} is returned.
[ "Get", "the", "value", "of", "the", "property", "identified", "by", "the", "key", "as", "Enum", ".", "If", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L355-L372
looly/hutool
hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java
AnnotationUtil.getAnnotationValue
public static <T> T getAnnotationValue(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException { """ 获取指定注解默认值<br> 如果无指定的属性方法返回null @param <T> 注解值类型 @param annotationEle {@link AccessibleObject},可以是Class、Method、Field、Constructor、ReflectPermission @param annotationType 注解类型 @return 注解对象 @throws UtilException 调用注解中的方法时执行异常 """ return getAnnotationValue(annotationEle, annotationType, "value"); }
java
public static <T> T getAnnotationValue(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException { return getAnnotationValue(annotationEle, annotationType, "value"); }
[ "public", "static", "<", "T", ">", "T", "getAnnotationValue", "(", "AnnotatedElement", "annotationEle", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "throws", "UtilException", "{", "return", "getAnnotationValue", "(", "annotationEle", ",", "annotationType", ",", "\"value\"", ")", ";", "}" ]
获取指定注解默认值<br> 如果无指定的属性方法返回null @param <T> 注解值类型 @param annotationEle {@link AccessibleObject},可以是Class、Method、Field、Constructor、ReflectPermission @param annotationType 注解类型 @return 注解对象 @throws UtilException 调用注解中的方法时执行异常
[ "获取指定注解默认值<br", ">", "如果无指定的属性方法返回null" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L75-L77
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.createPhrase
public Phrase createPhrase(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { """ Create a Phrase, style it and add the data @param data @param stylers @return @throws VectorPrintException """ return initTextElementArray(styleHelper.style(new Phrase(Float.NaN), data, stylers), data, stylers); }
java
public Phrase createPhrase(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { return initTextElementArray(styleHelper.style(new Phrase(Float.NaN), data, stylers), data, stylers); }
[ "public", "Phrase", "createPhrase", "(", "Object", "data", ",", "Collection", "<", "?", "extends", "BaseStyler", ">", "stylers", ")", "throws", "VectorPrintException", "{", "return", "initTextElementArray", "(", "styleHelper", ".", "style", "(", "new", "Phrase", "(", "Float", ".", "NaN", ")", ",", "data", ",", "stylers", ")", ",", "data", ",", "stylers", ")", ";", "}" ]
Create a Phrase, style it and add the data @param data @param stylers @return @throws VectorPrintException
[ "Create", "a", "Phrase", "style", "it", "and", "add", "the", "data" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L213-L215
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/QueryStringBuilder.java
QueryStringBuilder.params
public @NotNull QueryStringBuilder params(@NotNull Map<String, Object> values) { """ Add map of parameters to query string. @param values Map with parameter names and values. Values will be converted to strings. If a value is an array or {@link Iterable} the value items will be added as separate parameters. @return this """ for (Map.Entry<String, Object> entry : values.entrySet()) { param(entry.getKey(), entry.getValue()); } return this; }
java
public @NotNull QueryStringBuilder params(@NotNull Map<String, Object> values) { for (Map.Entry<String, Object> entry : values.entrySet()) { param(entry.getKey(), entry.getValue()); } return this; }
[ "public", "@", "NotNull", "QueryStringBuilder", "params", "(", "@", "NotNull", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "values", ".", "entrySet", "(", ")", ")", "{", "param", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Add map of parameters to query string. @param values Map with parameter names and values. Values will be converted to strings. If a value is an array or {@link Iterable} the value items will be added as separate parameters. @return this
[ "Add", "map", "of", "parameters", "to", "query", "string", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/QueryStringBuilder.java#L78-L83
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java
HCRenderer.getAsNode
@SuppressWarnings ("unchecked") @Nullable public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { """ Convert the passed HC node to a micro node using the provided conversion settings. @param aSrcNode The node to be converted. May not be <code>null</code>. @param aConversionSettings The conversion settings to be used. May not be <code>null</code>. @return The fully created HTML node """ IHCNode aConvertNode = aSrcNode; // Special case for HCHtml - must have been done separately because the // extraction of the OOB nodes must happen before the HTML HEAD is filled if (!(aSrcNode instanceof HCHtml)) { // Determine the target node to use final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>; IHCHasChildrenMutable <?, IHCNode> aTempNode; if (bSrcNodeCanHaveChildren) { // Passed node can handle it aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode; } else { aTempNode = new HCNodeList (); aTempNode.addChild (aSrcNode); } // customize, finalize and extract resources prepareForConversion (aTempNode, aTempNode, aConversionSettings); // NOTE: no OOB extraction here, because it is unclear what would happen // to the nodes. // Select node to convert to MicroDOM - if something was extracted, use // the temp node if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1) aConvertNode = aTempNode; } final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings); return aMicroNode; }
java
@SuppressWarnings ("unchecked") @Nullable public static IMicroNode getAsNode (@Nonnull final IHCNode aSrcNode, @Nonnull final IHCConversionSettingsToNode aConversionSettings) { IHCNode aConvertNode = aSrcNode; // Special case for HCHtml - must have been done separately because the // extraction of the OOB nodes must happen before the HTML HEAD is filled if (!(aSrcNode instanceof HCHtml)) { // Determine the target node to use final boolean bSrcNodeCanHaveChildren = aSrcNode instanceof IHCHasChildrenMutable <?, ?>; IHCHasChildrenMutable <?, IHCNode> aTempNode; if (bSrcNodeCanHaveChildren) { // Passed node can handle it aTempNode = (IHCHasChildrenMutable <?, IHCNode>) aSrcNode; } else { aTempNode = new HCNodeList (); aTempNode.addChild (aSrcNode); } // customize, finalize and extract resources prepareForConversion (aTempNode, aTempNode, aConversionSettings); // NOTE: no OOB extraction here, because it is unclear what would happen // to the nodes. // Select node to convert to MicroDOM - if something was extracted, use // the temp node if (!bSrcNodeCanHaveChildren && aTempNode.getChildCount () > 1) aConvertNode = aTempNode; } final IMicroNode aMicroNode = aConvertNode.convertToMicroNode (aConversionSettings); return aMicroNode; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Nullable", "public", "static", "IMicroNode", "getAsNode", "(", "@", "Nonnull", "final", "IHCNode", "aSrcNode", ",", "@", "Nonnull", "final", "IHCConversionSettingsToNode", "aConversionSettings", ")", "{", "IHCNode", "aConvertNode", "=", "aSrcNode", ";", "// Special case for HCHtml - must have been done separately because the", "// extraction of the OOB nodes must happen before the HTML HEAD is filled", "if", "(", "!", "(", "aSrcNode", "instanceof", "HCHtml", ")", ")", "{", "// Determine the target node to use", "final", "boolean", "bSrcNodeCanHaveChildren", "=", "aSrcNode", "instanceof", "IHCHasChildrenMutable", "<", "?", ",", "?", ">", ";", "IHCHasChildrenMutable", "<", "?", ",", "IHCNode", ">", "aTempNode", ";", "if", "(", "bSrcNodeCanHaveChildren", ")", "{", "// Passed node can handle it", "aTempNode", "=", "(", "IHCHasChildrenMutable", "<", "?", ",", "IHCNode", ">", ")", "aSrcNode", ";", "}", "else", "{", "aTempNode", "=", "new", "HCNodeList", "(", ")", ";", "aTempNode", ".", "addChild", "(", "aSrcNode", ")", ";", "}", "// customize, finalize and extract resources", "prepareForConversion", "(", "aTempNode", ",", "aTempNode", ",", "aConversionSettings", ")", ";", "// NOTE: no OOB extraction here, because it is unclear what would happen", "// to the nodes.", "// Select node to convert to MicroDOM - if something was extracted, use", "// the temp node", "if", "(", "!", "bSrcNodeCanHaveChildren", "&&", "aTempNode", ".", "getChildCount", "(", ")", ">", "1", ")", "aConvertNode", "=", "aTempNode", ";", "}", "final", "IMicroNode", "aMicroNode", "=", "aConvertNode", ".", "convertToMicroNode", "(", "aConversionSettings", ")", ";", "return", "aMicroNode", ";", "}" ]
Convert the passed HC node to a micro node using the provided conversion settings. @param aSrcNode The node to be converted. May not be <code>null</code>. @param aConversionSettings The conversion settings to be used. May not be <code>null</code>. @return The fully created HTML node
[ "Convert", "the", "passed", "HC", "node", "to", "a", "micro", "node", "using", "the", "provided", "conversion", "settings", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L192-L231
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java
DatatypeFactory.newDurationYearMonth
public Duration newDurationYearMonth( final boolean isPositive, final int year, final int month) { """ <p>Create a <code>Duration</code> of type <code>xdt:yearMonthDuration</code> using the specified <code>year</code> and <code>month</code> as defined in <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthyDuration"> XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p> <p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p> @param isPositive Set to <code>false</code> to create a negative duration. When the length of the duration is zero, this parameter will be ignored. @param year Year of <code>Duration</code>. @param month Month of <code>Duration</code>. @return New <code>Duration</code> created using the specified <code>year</code> and <code>month</code>. @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. """ return newDuration(isPositive, year, month, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED); }
java
public Duration newDurationYearMonth( final boolean isPositive, final int year, final int month) { return newDuration(isPositive, year, month, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED); }
[ "public", "Duration", "newDurationYearMonth", "(", "final", "boolean", "isPositive", ",", "final", "int", "year", ",", "final", "int", "month", ")", "{", "return", "newDuration", "(", "isPositive", ",", "year", ",", "month", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ",", "DatatypeConstants", ".", "FIELD_UNDEFINED", ")", ";", "}" ]
<p>Create a <code>Duration</code> of type <code>xdt:yearMonthDuration</code> using the specified <code>year</code> and <code>month</code> as defined in <a href="http://www.w3.org/TR/xpath-datamodel#dt-yearMonthyDuration"> XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration</a>.</p> <p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p> @param isPositive Set to <code>false</code> to create a negative duration. When the length of the duration is zero, this parameter will be ignored. @param year Year of <code>Duration</code>. @param month Month of <code>Duration</code>. @return New <code>Duration</code> created using the specified <code>year</code> and <code>month</code>. @throws IllegalArgumentException If any values would create an invalid <code>Duration</code>.
[ "<p", ">", "Create", "a", "<code", ">", "Duration<", "/", "code", ">", "of", "type", "<code", ">", "xdt", ":", "yearMonthDuration<", "/", "code", ">", "using", "the", "specified", "<code", ">", "year<", "/", "code", ">", "and", "<code", ">", "month<", "/", "code", ">", "as", "defined", "in", "<a", "href", "=", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "xpath", "-", "datamodel#dt", "-", "yearMonthyDuration", ">", "XQuery", "1", ".", "0", "and", "XPath", "2", ".", "0", "Data", "Model", "xdt", ":", "yearMonthDuration<", "/", "a", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java#L653-L660
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
AbstractIoSession.notifyIdleness
public static void notifyIdleness(Iterator<? extends IoSession> sessions, long currentTime) { """ Fires a {@link IoEventType#SESSION_IDLE} event to any applicable sessions in the specified collection. @param currentTime the current time (i.e. {@link System#currentTimeMillis()}) """ IoSession s; while (sessions.hasNext()) { s = sessions.next(); notifyIdleSession(s, currentTime); } }
java
public static void notifyIdleness(Iterator<? extends IoSession> sessions, long currentTime) { IoSession s; while (sessions.hasNext()) { s = sessions.next(); notifyIdleSession(s, currentTime); } }
[ "public", "static", "void", "notifyIdleness", "(", "Iterator", "<", "?", "extends", "IoSession", ">", "sessions", ",", "long", "currentTime", ")", "{", "IoSession", "s", ";", "while", "(", "sessions", ".", "hasNext", "(", ")", ")", "{", "s", "=", "sessions", ".", "next", "(", ")", ";", "notifyIdleSession", "(", "s", ",", "currentTime", ")", ";", "}", "}" ]
Fires a {@link IoEventType#SESSION_IDLE} event to any applicable sessions in the specified collection. @param currentTime the current time (i.e. {@link System#currentTimeMillis()})
[ "Fires", "a", "{", "@link", "IoEventType#SESSION_IDLE", "}", "event", "to", "any", "applicable", "sessions", "in", "the", "specified", "collection", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java#L1199-L1205
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java
SparkUtils.writeStringToFile
public static void writeStringToFile(String path, String toWrite, Configuration hadoopConfig) throws IOException { """ Write a String to a file (on HDFS or local) in UTF-8 format @param path Path to write to @param toWrite String to write @param hadoopConfig Hadoop configuration, for example from SparkContext.hadoopConfiguration() """ FileSystem fileSystem = FileSystem.get(hadoopConfig); try (BufferedOutputStream bos = new BufferedOutputStream(fileSystem.create(new Path(path)))) { bos.write(toWrite.getBytes("UTF-8")); } }
java
public static void writeStringToFile(String path, String toWrite, Configuration hadoopConfig) throws IOException { FileSystem fileSystem = FileSystem.get(hadoopConfig); try (BufferedOutputStream bos = new BufferedOutputStream(fileSystem.create(new Path(path)))) { bos.write(toWrite.getBytes("UTF-8")); } }
[ "public", "static", "void", "writeStringToFile", "(", "String", "path", ",", "String", "toWrite", ",", "Configuration", "hadoopConfig", ")", "throws", "IOException", "{", "FileSystem", "fileSystem", "=", "FileSystem", ".", "get", "(", "hadoopConfig", ")", ";", "try", "(", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fileSystem", ".", "create", "(", "new", "Path", "(", "path", ")", ")", ")", ")", "{", "bos", ".", "write", "(", "toWrite", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "}", "}" ]
Write a String to a file (on HDFS or local) in UTF-8 format @param path Path to write to @param toWrite String to write @param hadoopConfig Hadoop configuration, for example from SparkContext.hadoopConfiguration()
[ "Write", "a", "String", "to", "a", "file", "(", "on", "HDFS", "or", "local", ")", "in", "UTF", "-", "8", "format" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L96-L101
jqno/equalsverifier
src/main/java/nl/jqno/equalsverifier/internal/prefabvalues/PrefabValues.java
PrefabValues.giveOther
public <T> T giveOther(TypeTag tag, T value) { """ Returns a prefabricated value of the specified type, that is different from the specified value. @param <T> The type of the value. @param tag A description of the desired type, including generic parameters. @param value A value that is different from the value that will be returned. @return A value that is different from {@code value}. """ Class<T> type = tag.getType(); if (value != null && !type.isAssignableFrom(value.getClass()) && !wraps(type, value.getClass())) { throw new ReflectionException("TypeTag does not match value."); } Tuple<T> tuple = giveTuple(tag); if (tuple.getRed() == null) { return null; } if (type.isArray() && arraysAreDeeplyEqual(tuple.getRed(), value)) { return tuple.getBlack(); } if (!type.isArray() && tuple.getRed().equals(value)) { return tuple.getBlack(); } return tuple.getRed(); }
java
public <T> T giveOther(TypeTag tag, T value) { Class<T> type = tag.getType(); if (value != null && !type.isAssignableFrom(value.getClass()) && !wraps(type, value.getClass())) { throw new ReflectionException("TypeTag does not match value."); } Tuple<T> tuple = giveTuple(tag); if (tuple.getRed() == null) { return null; } if (type.isArray() && arraysAreDeeplyEqual(tuple.getRed(), value)) { return tuple.getBlack(); } if (!type.isArray() && tuple.getRed().equals(value)) { return tuple.getBlack(); } return tuple.getRed(); }
[ "public", "<", "T", ">", "T", "giveOther", "(", "TypeTag", "tag", ",", "T", "value", ")", "{", "Class", "<", "T", ">", "type", "=", "tag", ".", "getType", "(", ")", ";", "if", "(", "value", "!=", "null", "&&", "!", "type", ".", "isAssignableFrom", "(", "value", ".", "getClass", "(", ")", ")", "&&", "!", "wraps", "(", "type", ",", "value", ".", "getClass", "(", ")", ")", ")", "{", "throw", "new", "ReflectionException", "(", "\"TypeTag does not match value.\"", ")", ";", "}", "Tuple", "<", "T", ">", "tuple", "=", "giveTuple", "(", "tag", ")", ";", "if", "(", "tuple", ".", "getRed", "(", ")", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "type", ".", "isArray", "(", ")", "&&", "arraysAreDeeplyEqual", "(", "tuple", ".", "getRed", "(", ")", ",", "value", ")", ")", "{", "return", "tuple", ".", "getBlack", "(", ")", ";", "}", "if", "(", "!", "type", ".", "isArray", "(", ")", "&&", "tuple", ".", "getRed", "(", ")", ".", "equals", "(", "value", ")", ")", "{", "return", "tuple", ".", "getBlack", "(", ")", ";", "}", "return", "tuple", ".", "getRed", "(", ")", ";", "}" ]
Returns a prefabricated value of the specified type, that is different from the specified value. @param <T> The type of the value. @param tag A description of the desired type, including generic parameters. @param value A value that is different from the value that will be returned. @return A value that is different from {@code value}.
[ "Returns", "a", "prefabricated", "value", "of", "the", "specified", "type", "that", "is", "different", "from", "the", "specified", "value", "." ]
train
https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/prefabvalues/PrefabValues.java#L104-L121
knowm/XChange
xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/CryptonitAdapters.java
CryptonitAdapters.adaptTicker
public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) { """ Adapts a CryptonitTicker to a Ticker Object @param cryptonitTicker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The ticker """ BigDecimal open = cryptonitTicker.getOpen(); BigDecimal last = cryptonitTicker.getLast(); BigDecimal bid = cryptonitTicker.getBid(); BigDecimal ask = cryptonitTicker.getAsk(); BigDecimal high = cryptonitTicker.getHigh(); BigDecimal low = cryptonitTicker.getLow(); BigDecimal vwap = cryptonitTicker.getVwap(); BigDecimal volume = cryptonitTicker.getVolume(); Date timestamp = new Date(cryptonitTicker.getTimestamp() * 1000L); return new Ticker.Builder() .currencyPair(currencyPair) .open(open) .last(last) .bid(bid) .ask(ask) .high(high) .low(low) .vwap(vwap) .volume(volume) .timestamp(timestamp) .build(); }
java
public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) { BigDecimal open = cryptonitTicker.getOpen(); BigDecimal last = cryptonitTicker.getLast(); BigDecimal bid = cryptonitTicker.getBid(); BigDecimal ask = cryptonitTicker.getAsk(); BigDecimal high = cryptonitTicker.getHigh(); BigDecimal low = cryptonitTicker.getLow(); BigDecimal vwap = cryptonitTicker.getVwap(); BigDecimal volume = cryptonitTicker.getVolume(); Date timestamp = new Date(cryptonitTicker.getTimestamp() * 1000L); return new Ticker.Builder() .currencyPair(currencyPair) .open(open) .last(last) .bid(bid) .ask(ask) .high(high) .low(low) .vwap(vwap) .volume(volume) .timestamp(timestamp) .build(); }
[ "public", "static", "Ticker", "adaptTicker", "(", "CryptonitTicker", "cryptonitTicker", ",", "CurrencyPair", "currencyPair", ")", "{", "BigDecimal", "open", "=", "cryptonitTicker", ".", "getOpen", "(", ")", ";", "BigDecimal", "last", "=", "cryptonitTicker", ".", "getLast", "(", ")", ";", "BigDecimal", "bid", "=", "cryptonitTicker", ".", "getBid", "(", ")", ";", "BigDecimal", "ask", "=", "cryptonitTicker", ".", "getAsk", "(", ")", ";", "BigDecimal", "high", "=", "cryptonitTicker", ".", "getHigh", "(", ")", ";", "BigDecimal", "low", "=", "cryptonitTicker", ".", "getLow", "(", ")", ";", "BigDecimal", "vwap", "=", "cryptonitTicker", ".", "getVwap", "(", ")", ";", "BigDecimal", "volume", "=", "cryptonitTicker", ".", "getVolume", "(", ")", ";", "Date", "timestamp", "=", "new", "Date", "(", "cryptonitTicker", ".", "getTimestamp", "(", ")", "*", "1000L", ")", ";", "return", "new", "Ticker", ".", "Builder", "(", ")", ".", "currencyPair", "(", "currencyPair", ")", ".", "open", "(", "open", ")", ".", "last", "(", "last", ")", ".", "bid", "(", "bid", ")", ".", "ask", "(", "ask", ")", ".", "high", "(", "high", ")", ".", "low", "(", "low", ")", ".", "vwap", "(", "vwap", ")", ".", "volume", "(", "volume", ")", ".", "timestamp", "(", "timestamp", ")", ".", "build", "(", ")", ";", "}" ]
Adapts a CryptonitTicker to a Ticker Object @param cryptonitTicker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The ticker
[ "Adapts", "a", "CryptonitTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cryptonit/src/main/java/org/knowm/xchange/cryptonit2/CryptonitAdapters.java#L162-L186
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/http/UrlConnectionHttpHandler.java
UrlConnectionHttpHandler.sendRequest
protected void sendRequest(HttpURLConnection connection, Request request) throws IOException { """ Sends a request over a given connection. @param connection The connection over which to send the request. @param request The request to send. @throws IOException If there is an error sending the request. """ // Set up the request. connection.setRequestMethod(request.method); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", request.authorization); // If a different HttpHandler is used, we won't get this header. We would need to refactor // to a delegation pattern to give the client code's HttpHandler a chance to process the // Request first, then attach our custom headers, which would likely be a breaking change. connection.setRequestProperty("Keen-Sdk", "java-" + KeenVersion.getSdkVersion()); // If the request has a body, send it. Otherwise just connect. if (request.body != null) { if (HttpMethods.GET.equals(request.method) || HttpMethods.DELETE.equals(request.method)) { throw new IllegalStateException("Trying to send a GET request with a request " + "body, which would result in sending a POST."); } connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json"); request.body.writeTo(connection.getOutputStream()); } else { connection.connect(); } }
java
protected void sendRequest(HttpURLConnection connection, Request request) throws IOException { // Set up the request. connection.setRequestMethod(request.method); connection.setRequestProperty("Accept", "application/json"); connection.setRequestProperty("Authorization", request.authorization); // If a different HttpHandler is used, we won't get this header. We would need to refactor // to a delegation pattern to give the client code's HttpHandler a chance to process the // Request first, then attach our custom headers, which would likely be a breaking change. connection.setRequestProperty("Keen-Sdk", "java-" + KeenVersion.getSdkVersion()); // If the request has a body, send it. Otherwise just connect. if (request.body != null) { if (HttpMethods.GET.equals(request.method) || HttpMethods.DELETE.equals(request.method)) { throw new IllegalStateException("Trying to send a GET request with a request " + "body, which would result in sending a POST."); } connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json"); request.body.writeTo(connection.getOutputStream()); } else { connection.connect(); } }
[ "protected", "void", "sendRequest", "(", "HttpURLConnection", "connection", ",", "Request", "request", ")", "throws", "IOException", "{", "// Set up the request.", "connection", ".", "setRequestMethod", "(", "request", ".", "method", ")", ";", "connection", ".", "setRequestProperty", "(", "\"Accept\"", ",", "\"application/json\"", ")", ";", "connection", ".", "setRequestProperty", "(", "\"Authorization\"", ",", "request", ".", "authorization", ")", ";", "// If a different HttpHandler is used, we won't get this header. We would need to refactor", "// to a delegation pattern to give the client code's HttpHandler a chance to process the", "// Request first, then attach our custom headers, which would likely be a breaking change.", "connection", ".", "setRequestProperty", "(", "\"Keen-Sdk\"", ",", "\"java-\"", "+", "KeenVersion", ".", "getSdkVersion", "(", ")", ")", ";", "// If the request has a body, send it. Otherwise just connect.", "if", "(", "request", ".", "body", "!=", "null", ")", "{", "if", "(", "HttpMethods", ".", "GET", ".", "equals", "(", "request", ".", "method", ")", "||", "HttpMethods", ".", "DELETE", ".", "equals", "(", "request", ".", "method", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Trying to send a GET request with a request \"", "+", "\"body, which would result in sending a POST.\"", ")", ";", "}", "connection", ".", "setDoOutput", "(", "true", ")", ";", "connection", ".", "setRequestProperty", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "request", ".", "body", ".", "writeTo", "(", "connection", ".", "getOutputStream", "(", ")", ")", ";", "}", "else", "{", "connection", ".", "connect", "(", ")", ";", "}", "}" ]
Sends a request over a given connection. @param connection The connection over which to send the request. @param request The request to send. @throws IOException If there is an error sending the request.
[ "Sends", "a", "request", "over", "a", "given", "connection", "." ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/http/UrlConnectionHttpHandler.java#L65-L90
to2mbn/JMCCC
jmccc-yggdrasil-authenticator/src/main/java/org/to2mbn/jmccc/auth/yggdrasil/YggdrasilAuthenticator.java
YggdrasilAuthenticator.refreshWithPassword
public synchronized void refreshWithPassword(String username, String password) throws AuthenticationException { """ Refreshes the current session manually using password. @param username the username @param password the password @throws AuthenticationException If an exception occurs during the authentication """ refreshWithPassword(username, password, null); }
java
public synchronized void refreshWithPassword(String username, String password) throws AuthenticationException { refreshWithPassword(username, password, null); }
[ "public", "synchronized", "void", "refreshWithPassword", "(", "String", "username", ",", "String", "password", ")", "throws", "AuthenticationException", "{", "refreshWithPassword", "(", "username", ",", "password", ",", "null", ")", ";", "}" ]
Refreshes the current session manually using password. @param username the username @param password the password @throws AuthenticationException If an exception occurs during the authentication
[ "Refreshes", "the", "current", "session", "manually", "using", "password", "." ]
train
https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc-yggdrasil-authenticator/src/main/java/org/to2mbn/jmccc/auth/yggdrasil/YggdrasilAuthenticator.java#L326-L328
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.prescreen
public boolean prescreen(Code code, Method method) { """ looks for methods that contain a catch block and an ATHROW opcode @param code the context object of the current code block @param method the context object of the current method @return if the class throws exceptions """ if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.get(Const.ATHROW); }
java
public boolean prescreen(Code code, Method method) { if (method.isSynthetic()) { return false; } CodeException[] ce = code.getExceptionTable(); if (CollectionUtils.isEmpty(ce)) { return false; } BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && bytecodeSet.get(Const.ATHROW); }
[ "public", "boolean", "prescreen", "(", "Code", "code", ",", "Method", "method", ")", "{", "if", "(", "method", ".", "isSynthetic", "(", ")", ")", "{", "return", "false", ";", "}", "CodeException", "[", "]", "ce", "=", "code", ".", "getExceptionTable", "(", ")", ";", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "ce", ")", ")", "{", "return", "false", ";", "}", "BitSet", "bytecodeSet", "=", "getClassContext", "(", ")", ".", "getBytecodeSet", "(", "method", ")", ";", "return", "(", "bytecodeSet", "!=", "null", ")", "&&", "bytecodeSet", ".", "get", "(", "Const", ".", "ATHROW", ")", ";", "}" ]
looks for methods that contain a catch block and an ATHROW opcode @param code the context object of the current code block @param method the context object of the current method @return if the class throws exceptions
[ "looks", "for", "methods", "that", "contain", "a", "catch", "block", "and", "an", "ATHROW", "opcode" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L123-L135
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.handleControlBrowseStatus
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { """ Method to handle a ControlBrowseStatus message from an RME @param remoteME The UUID of the RME @param browseId The unique browseId, relative to this RME @param status The status """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
java
private final void handleControlBrowseStatus(SIBUuid8 remoteME, SIBUuid12 gatheringTargetDestUuid, long browseId, int status) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "handleControlBrowseStatus", new Object[] {remoteME, gatheringTargetDestUuid, Long.valueOf(browseId), Integer.valueOf(status)}); // first we see if there is an existing AOBrowseSession AOBrowserSessionKey key = new AOBrowserSessionKey(remoteME, gatheringTargetDestUuid, browseId); AOBrowserSession session = (AOBrowserSession) browserSessionTable.get(key); if (session != null) { if (status == SIMPConstants.BROWSE_CLOSE) { session.close(); browserSessionTable.remove(key); } else if (status == SIMPConstants.BROWSE_ALIVE) { session.keepAlive(); } } else { // session == null. ignore the status message } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "handleControlBrowseStatus"); }
[ "private", "final", "void", "handleControlBrowseStatus", "(", "SIBUuid8", "remoteME", ",", "SIBUuid12", "gatheringTargetDestUuid", ",", "long", "browseId", ",", "int", "status", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"handleControlBrowseStatus\"", ",", "new", "Object", "[", "]", "{", "remoteME", ",", "gatheringTargetDestUuid", ",", "Long", ".", "valueOf", "(", "browseId", ")", ",", "Integer", ".", "valueOf", "(", "status", ")", "}", ")", ";", "// first we see if there is an existing AOBrowseSession", "AOBrowserSessionKey", "key", "=", "new", "AOBrowserSessionKey", "(", "remoteME", ",", "gatheringTargetDestUuid", ",", "browseId", ")", ";", "AOBrowserSession", "session", "=", "(", "AOBrowserSession", ")", "browserSessionTable", ".", "get", "(", "key", ")", ";", "if", "(", "session", "!=", "null", ")", "{", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_CLOSE", ")", "{", "session", ".", "close", "(", ")", ";", "browserSessionTable", ".", "remove", "(", "key", ")", ";", "}", "else", "if", "(", "status", "==", "SIMPConstants", ".", "BROWSE_ALIVE", ")", "{", "session", ".", "keepAlive", "(", ")", ";", "}", "}", "else", "{", "// session == null. ignore the status message", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"handleControlBrowseStatus\"", ")", ";", "}" ]
Method to handle a ControlBrowseStatus message from an RME @param remoteME The UUID of the RME @param browseId The unique browseId, relative to this RME @param status The status
[ "Method", "to", "handle", "a", "ControlBrowseStatus", "message", "from", "an", "RME" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1447-L1475
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesKey
public static void escapePropertiesKey(final String text, final Writer writer) throws IOException { """ <p> Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java Properties Key basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&nbsp;</tt> (<tt>U+0020</tt>), <tt>&#92;:</tt> (<tt>U+003A</tt>), <tt>&#92;=</tt> (<tt>U+003D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapePropertiesKey(String, Writer, PropertiesKeyEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs """ escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapePropertiesKey(final String text, final Writer writer) throws IOException { escapePropertiesKey(text, writer, PropertiesKeyEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapePropertiesKey", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapePropertiesKey", "(", "text", ",", "writer", ",", "PropertiesKeyEscapeLevel", ".", "LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET", ")", ";", "}" ]
<p> Perform a Java Properties Key level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java Properties Key basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&nbsp;</tt> (<tt>U+0020</tt>), <tt>&#92;:</tt> (<tt>U+003A</tt>), <tt>&#92;=</tt> (<tt>U+003D</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapePropertiesKey(String, Writer, PropertiesKeyEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "Java", "Properties", "Key", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "2<", "/", "em", ">", "means", "this", "method", "will", "escape", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "Java", "Properties", "Key", "basic", "escape", "set", ":", "<ul", ">", "<li", ">", "The", "<em", ">", "Single", "Escape", "Characters<", "/", "em", ">", ":", "<tt", ">", "&#92", ";", "t<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0009<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "n<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000A<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "f<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000C<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "r<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000D<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "&nbsp", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0020<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", ":", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "003A<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "=", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "003D<", "/", "tt", ">", ")", "and", "<tt", ">", "&#92", ";", "&#92", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "005C<", "/", "tt", ">", ")", ".", "<", "/", "li", ">", "<li", ">", "Two", "ranges", "of", "non", "-", "displayable", "control", "characters", "(", "some", "of", "which", "are", "already", "part", "of", "the", "<em", ">", "single", "escape", "characters<", "/", "em", ">", "list", ")", ":", "<tt", ">", "U", "+", "0000<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "001F<", "/", "tt", ">", "and", "<tt", ">", "U", "+", "007F<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "009F<", "/", "tt", ">", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<", "/", "li", ">", "<li", ">", "All", "non", "ASCII", "characters", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "escape", "will", "be", "performed", "by", "using", "the", "Single", "Escape", "Chars", "whenever", "possible", ".", "For", "escaped", "characters", "that", "do", "not", "have", "an", "associated", "SEC", "default", "to", "<tt", ">", "&#92", ";", "uFFFF<", "/", "tt", ">", "Hexadecimal", "Escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapePropertiesKey", "(", "String", "Writer", "PropertiesKeyEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "PropertiesKeyEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L994-L997
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/jpe/parser/handler/BaseContentHandler.java
BaseContentHandler.startNewElement
public void startNewElement(String localName, Attributes atts) { """ Compares the localname with the {@link FeatureType#getFeature()} attribute of the current {@link FeatureType} of the {@link DescribeService} If the current tag being parsed is equals to {@link FeatureType#getFeature()} then the {@link JPEContentHandler#startFeature()} and {@link JPEContentHandler#startPoint()} are thrown @param localName The current tag name being parsed @param atts Additional attributes @param atts """ String arg0 = localName; this.currentKey = arg0; if (isEndElement(arg0)) { endNewElement(); if (writerContentHandler != null) { this.currentFeatureGeoJSON = writerContentHandler.startFeature(); this.currentGeometryGeoJSON = writerContentHandler.startPoint(); } this.currentFeature = contentHandler.startFeature(); this.currentPoint = contentHandler.startPoint(); } this.currentLocalName = localName; // FIXME improve the support for attributes if (atts != null) { int length = atts.getLength(); for (int i = 0; i < length; i++) { String key = atts.getQName(i); String value = atts.getValue(i); this.currentKey = key; this.processValue(value); } } }
java
public void startNewElement(String localName, Attributes atts) { String arg0 = localName; this.currentKey = arg0; if (isEndElement(arg0)) { endNewElement(); if (writerContentHandler != null) { this.currentFeatureGeoJSON = writerContentHandler.startFeature(); this.currentGeometryGeoJSON = writerContentHandler.startPoint(); } this.currentFeature = contentHandler.startFeature(); this.currentPoint = contentHandler.startPoint(); } this.currentLocalName = localName; // FIXME improve the support for attributes if (atts != null) { int length = atts.getLength(); for (int i = 0; i < length; i++) { String key = atts.getQName(i); String value = atts.getValue(i); this.currentKey = key; this.processValue(value); } } }
[ "public", "void", "startNewElement", "(", "String", "localName", ",", "Attributes", "atts", ")", "{", "String", "arg0", "=", "localName", ";", "this", ".", "currentKey", "=", "arg0", ";", "if", "(", "isEndElement", "(", "arg0", ")", ")", "{", "endNewElement", "(", ")", ";", "if", "(", "writerContentHandler", "!=", "null", ")", "{", "this", ".", "currentFeatureGeoJSON", "=", "writerContentHandler", ".", "startFeature", "(", ")", ";", "this", ".", "currentGeometryGeoJSON", "=", "writerContentHandler", ".", "startPoint", "(", ")", ";", "}", "this", ".", "currentFeature", "=", "contentHandler", ".", "startFeature", "(", ")", ";", "this", ".", "currentPoint", "=", "contentHandler", ".", "startPoint", "(", ")", ";", "}", "this", ".", "currentLocalName", "=", "localName", ";", "// FIXME improve the support for attributes", "if", "(", "atts", "!=", "null", ")", "{", "int", "length", "=", "atts", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "String", "key", "=", "atts", ".", "getQName", "(", "i", ")", ";", "String", "value", "=", "atts", ".", "getValue", "(", "i", ")", ";", "this", ".", "currentKey", "=", "key", ";", "this", ".", "processValue", "(", "value", ")", ";", "}", "}", "}" ]
Compares the localname with the {@link FeatureType#getFeature()} attribute of the current {@link FeatureType} of the {@link DescribeService} If the current tag being parsed is equals to {@link FeatureType#getFeature()} then the {@link JPEContentHandler#startFeature()} and {@link JPEContentHandler#startPoint()} are thrown @param localName The current tag name being parsed @param atts Additional attributes @param atts
[ "Compares", "the", "localname", "with", "the", "{", "@link", "FeatureType#getFeature", "()", "}", "attribute", "of", "the", "current", "{", "@link", "FeatureType", "}", "of", "the", "{", "@link", "DescribeService", "}" ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/jpe/parser/handler/BaseContentHandler.java#L326-L352
mercadopago/dx-java
src/main/java/com/mercadopago/core/MPCache.java
MPCache.addToCache
static void addToCache(String key, MPApiResponse response) { """ Inserts an entry to the cache. @param key String with cache entry key @param response MPApiResponse object to be cached """ HashMap<String, MPApiResponse> mapCache = getMapCache(); mapCache.put(key, response); }
java
static void addToCache(String key, MPApiResponse response) { HashMap<String, MPApiResponse> mapCache = getMapCache(); mapCache.put(key, response); }
[ "static", "void", "addToCache", "(", "String", "key", ",", "MPApiResponse", "response", ")", "{", "HashMap", "<", "String", ",", "MPApiResponse", ">", "mapCache", "=", "getMapCache", "(", ")", ";", "mapCache", ".", "put", "(", "key", ",", "response", ")", ";", "}" ]
Inserts an entry to the cache. @param key String with cache entry key @param response MPApiResponse object to be cached
[ "Inserts", "an", "entry", "to", "the", "cache", "." ]
train
https://github.com/mercadopago/dx-java/blob/9df65a6bfb4db0c1fddd7699a5b109643961b03f/src/main/java/com/mercadopago/core/MPCache.java#L35-L38
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/draggable/DraggableContainment.java
DraggableContainment.setArrayParam
public void setArrayParam(Integer x1, Integer y1, Integer x2, Integer y2) { """ Set's the array parameter @param x1 First x coordinate @param y1 First y coordinate @param x2 Second x coordinate @param y2 Second y coordinate """ ArrayItemOptions<IntegerItemOptions> tempArrayParam = new ArrayItemOptions<IntegerItemOptions>(); tempArrayParam.add(new IntegerItemOptions(x1)); tempArrayParam.add(new IntegerItemOptions(y1)); tempArrayParam.add(new IntegerItemOptions(x2)); tempArrayParam.add(new IntegerItemOptions(y2)); setParam(tempArrayParam, containmentEnumParam, null, null); }
java
public void setArrayParam(Integer x1, Integer y1, Integer x2, Integer y2) { ArrayItemOptions<IntegerItemOptions> tempArrayParam = new ArrayItemOptions<IntegerItemOptions>(); tempArrayParam.add(new IntegerItemOptions(x1)); tempArrayParam.add(new IntegerItemOptions(y1)); tempArrayParam.add(new IntegerItemOptions(x2)); tempArrayParam.add(new IntegerItemOptions(y2)); setParam(tempArrayParam, containmentEnumParam, null, null); }
[ "public", "void", "setArrayParam", "(", "Integer", "x1", ",", "Integer", "y1", ",", "Integer", "x2", ",", "Integer", "y2", ")", "{", "ArrayItemOptions", "<", "IntegerItemOptions", ">", "tempArrayParam", "=", "new", "ArrayItemOptions", "<", "IntegerItemOptions", ">", "(", ")", ";", "tempArrayParam", ".", "add", "(", "new", "IntegerItemOptions", "(", "x1", ")", ")", ";", "tempArrayParam", ".", "add", "(", "new", "IntegerItemOptions", "(", "y1", ")", ")", ";", "tempArrayParam", ".", "add", "(", "new", "IntegerItemOptions", "(", "x2", ")", ")", ";", "tempArrayParam", ".", "add", "(", "new", "IntegerItemOptions", "(", "y2", ")", ")", ";", "setParam", "(", "tempArrayParam", ",", "containmentEnumParam", ",", "null", ",", "null", ")", ";", "}" ]
Set's the array parameter @param x1 First x coordinate @param y1 First y coordinate @param x2 Second x coordinate @param y2 Second y coordinate
[ "Set", "s", "the", "array", "parameter" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/draggable/DraggableContainment.java#L256-L266
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.emit
private void emit(int pos, int end, String arg) { """ Append characters from 'raw' in the range [pos, end) to the output buffer. """ while (pos < end) { char ch = format.charAt(pos); if (ch == '#') { buf.append(arg == null ? ch : arg); } else { buf.append(ch); } pos++; } }
java
private void emit(int pos, int end, String arg) { while (pos < end) { char ch = format.charAt(pos); if (ch == '#') { buf.append(arg == null ? ch : arg); } else { buf.append(ch); } pos++; } }
[ "private", "void", "emit", "(", "int", "pos", ",", "int", "end", ",", "String", "arg", ")", "{", "while", "(", "pos", "<", "end", ")", "{", "char", "ch", "=", "format", ".", "charAt", "(", "pos", ")", ";", "if", "(", "ch", "==", "'", "'", ")", "{", "buf", ".", "append", "(", "arg", "==", "null", "?", "ch", ":", "arg", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "ch", ")", ";", "}", "pos", "++", ";", "}", "}" ]
Append characters from 'raw' in the range [pos, end) to the output buffer.
[ "Append", "characters", "from", "raw", "in", "the", "range", "[", "pos", "end", ")", "to", "the", "output", "buffer", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L813-L823
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/assembly/AssemblyFiles.java
AssemblyFiles.addEntry
public void addEntry(File srcFile, File destFile) { """ Add a entry to the list of assembly files which possible should be monitored @param srcFile source file to monitor. The source file must exist. @param destFile the destination to which it is eventually copied. The destination file must be relative. """ entries.add(new Entry(srcFile,destFile)); }
java
public void addEntry(File srcFile, File destFile) { entries.add(new Entry(srcFile,destFile)); }
[ "public", "void", "addEntry", "(", "File", "srcFile", ",", "File", "destFile", ")", "{", "entries", ".", "add", "(", "new", "Entry", "(", "srcFile", ",", "destFile", ")", ")", ";", "}" ]
Add a entry to the list of assembly files which possible should be monitored @param srcFile source file to monitor. The source file must exist. @param destFile the destination to which it is eventually copied. The destination file must be relative.
[ "Add", "a", "entry", "to", "the", "list", "of", "assembly", "files", "which", "possible", "should", "be", "monitored" ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/assembly/AssemblyFiles.java#L49-L51
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java
LocaleFormatter.getFormatted
@Nonnull public static String getFormatted (@Nonnull final BigInteger aValue, @Nonnull final Locale aDisplayLocale) { """ Format the passed value according to the rules specified by the given locale. All calls to {@link BigInteger#toString()} that are displayed to the user should instead use this method. @param aValue The value to be formatted. May not be <code>null</code>. @param aDisplayLocale The locale to be used. May not be <code>null</code>. @return The formatted string. """ ValueEnforcer.notNull (aValue, "Value"); ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getIntegerInstance (aDisplayLocale).format (aValue); }
java
@Nonnull public static String getFormatted (@Nonnull final BigInteger aValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aValue, "Value"); ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getIntegerInstance (aDisplayLocale).format (aValue); }
[ "@", "Nonnull", "public", "static", "String", "getFormatted", "(", "@", "Nonnull", "final", "BigInteger", "aValue", ",", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aValue", ",", "\"Value\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aDisplayLocale", ",", "\"DisplayLocale\"", ")", ";", "return", "NumberFormat", ".", "getIntegerInstance", "(", "aDisplayLocale", ")", ".", "format", "(", "aValue", ")", ";", "}" ]
Format the passed value according to the rules specified by the given locale. All calls to {@link BigInteger#toString()} that are displayed to the user should instead use this method. @param aValue The value to be formatted. May not be <code>null</code>. @param aDisplayLocale The locale to be used. May not be <code>null</code>. @return The formatted string.
[ "Format", "the", "passed", "value", "according", "to", "the", "rules", "specified", "by", "the", "given", "locale", ".", "All", "calls", "to", "{", "@link", "BigInteger#toString", "()", "}", "that", "are", "displayed", "to", "the", "user", "should", "instead", "use", "this", "method", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L113-L120
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/TSAClientBouncyCastle.java
TSAClientBouncyCastle.getTimeStampToken
protected byte[] getTimeStampToken(byte[] imprint) throws Exception { """ Get timestamp token - Bouncy Castle request encoding / decoding layer """ byte[] respBytes = null; try { // Setup the time stamp request TimeStampRequestGenerator tsqGenerator = new TimeStampRequestGenerator(); tsqGenerator.setCertReq(true); // tsqGenerator.setReqPolicy("1.3.6.1.4.1.601.10.3.1"); BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis()); TimeStampRequest request = tsqGenerator.generate(X509ObjectIdentifiers.id_SHA1 , imprint, nonce); byte[] requestBytes = request.getEncoded(); // Call the communications layer respBytes = getTSAResponse(requestBytes); // Handle the TSA response TimeStampResponse response = new TimeStampResponse(respBytes); // validate communication level attributes (RFC 3161 PKIStatus) response.validate(request); PKIFailureInfo failure = response.getFailInfo(); int value = (failure == null) ? 0 : failure.intValue(); if (value != 0) { // @todo: Translate value of 15 error codes defined by PKIFailureInfo to string throw new Exception("Invalid TSA '" + tsaURL + "' response, code " + value); } // @todo: validate the time stap certificate chain (if we want // assure we do not sign using an invalid timestamp). // extract just the time stamp token (removes communication status info) TimeStampToken tsToken = response.getTimeStampToken(); if (tsToken == null) { throw new Exception("TSA '" + tsaURL + "' failed to return time stamp token: " + response.getStatusString()); } byte[] encoded = tsToken.getEncoded(); // Update our token size estimate for the next call (padded to be safe) this.tokSzEstimate = encoded.length + 32; return encoded; } catch (Exception e) { throw e; } catch (Throwable t) { throw new Exception("Failed to get TSA response from '" + tsaURL +"'", t); } }
java
protected byte[] getTimeStampToken(byte[] imprint) throws Exception { byte[] respBytes = null; try { // Setup the time stamp request TimeStampRequestGenerator tsqGenerator = new TimeStampRequestGenerator(); tsqGenerator.setCertReq(true); // tsqGenerator.setReqPolicy("1.3.6.1.4.1.601.10.3.1"); BigInteger nonce = BigInteger.valueOf(System.currentTimeMillis()); TimeStampRequest request = tsqGenerator.generate(X509ObjectIdentifiers.id_SHA1 , imprint, nonce); byte[] requestBytes = request.getEncoded(); // Call the communications layer respBytes = getTSAResponse(requestBytes); // Handle the TSA response TimeStampResponse response = new TimeStampResponse(respBytes); // validate communication level attributes (RFC 3161 PKIStatus) response.validate(request); PKIFailureInfo failure = response.getFailInfo(); int value = (failure == null) ? 0 : failure.intValue(); if (value != 0) { // @todo: Translate value of 15 error codes defined by PKIFailureInfo to string throw new Exception("Invalid TSA '" + tsaURL + "' response, code " + value); } // @todo: validate the time stap certificate chain (if we want // assure we do not sign using an invalid timestamp). // extract just the time stamp token (removes communication status info) TimeStampToken tsToken = response.getTimeStampToken(); if (tsToken == null) { throw new Exception("TSA '" + tsaURL + "' failed to return time stamp token: " + response.getStatusString()); } byte[] encoded = tsToken.getEncoded(); // Update our token size estimate for the next call (padded to be safe) this.tokSzEstimate = encoded.length + 32; return encoded; } catch (Exception e) { throw e; } catch (Throwable t) { throw new Exception("Failed to get TSA response from '" + tsaURL +"'", t); } }
[ "protected", "byte", "[", "]", "getTimeStampToken", "(", "byte", "[", "]", "imprint", ")", "throws", "Exception", "{", "byte", "[", "]", "respBytes", "=", "null", ";", "try", "{", "// Setup the time stamp request\r", "TimeStampRequestGenerator", "tsqGenerator", "=", "new", "TimeStampRequestGenerator", "(", ")", ";", "tsqGenerator", ".", "setCertReq", "(", "true", ")", ";", "// tsqGenerator.setReqPolicy(\"1.3.6.1.4.1.601.10.3.1\");\r", "BigInteger", "nonce", "=", "BigInteger", ".", "valueOf", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "TimeStampRequest", "request", "=", "tsqGenerator", ".", "generate", "(", "X509ObjectIdentifiers", ".", "id_SHA1", ",", "imprint", ",", "nonce", ")", ";", "byte", "[", "]", "requestBytes", "=", "request", ".", "getEncoded", "(", ")", ";", "// Call the communications layer\r", "respBytes", "=", "getTSAResponse", "(", "requestBytes", ")", ";", "// Handle the TSA response\r", "TimeStampResponse", "response", "=", "new", "TimeStampResponse", "(", "respBytes", ")", ";", "// validate communication level attributes (RFC 3161 PKIStatus)\r", "response", ".", "validate", "(", "request", ")", ";", "PKIFailureInfo", "failure", "=", "response", ".", "getFailInfo", "(", ")", ";", "int", "value", "=", "(", "failure", "==", "null", ")", "?", "0", ":", "failure", ".", "intValue", "(", ")", ";", "if", "(", "value", "!=", "0", ")", "{", "// @todo: Translate value of 15 error codes defined by PKIFailureInfo to string\r", "throw", "new", "Exception", "(", "\"Invalid TSA '\"", "+", "tsaURL", "+", "\"' response, code \"", "+", "value", ")", ";", "}", "// @todo: validate the time stap certificate chain (if we want\r", "// assure we do not sign using an invalid timestamp).\r", "// extract just the time stamp token (removes communication status info)\r", "TimeStampToken", "tsToken", "=", "response", ".", "getTimeStampToken", "(", ")", ";", "if", "(", "tsToken", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"TSA '\"", "+", "tsaURL", "+", "\"' failed to return time stamp token: \"", "+", "response", ".", "getStatusString", "(", ")", ")", ";", "}", "byte", "[", "]", "encoded", "=", "tsToken", ".", "getEncoded", "(", ")", ";", "// Update our token size estimate for the next call (padded to be safe)\r", "this", ".", "tokSzEstimate", "=", "encoded", ".", "length", "+", "32", ";", "return", "encoded", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "Exception", "(", "\"Failed to get TSA response from '\"", "+", "tsaURL", "+", "\"'\"", ",", "t", ")", ";", "}", "}" ]
Get timestamp token - Bouncy Castle request encoding / decoding layer
[ "Get", "timestamp", "token", "-", "Bouncy", "Castle", "request", "encoding", "/", "decoding", "layer" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TSAClientBouncyCastle.java#L141-L185
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsTsiHandshaker.java
AltsTsiHandshaker.createFrameProtector
@Override public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc) { """ Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created. @param maxFrameSize the requested max frame size, the callee is free to ignore. @param alloc used for allocating ByteBufs. @return a new TsiFrameProtector. """ Preconditions.checkState(!isInProgress(), "Handshake is not complete."); byte[] key = handshaker.getKey(); Preconditions.checkState(key.length == AltsChannelCrypter.getKeyLength(), "Bad key length."); return new AltsTsiFrameProtector(maxFrameSize, new AltsChannelCrypter(key, isClient), alloc); }
java
@Override public TsiFrameProtector createFrameProtector(int maxFrameSize, ByteBufAllocator alloc) { Preconditions.checkState(!isInProgress(), "Handshake is not complete."); byte[] key = handshaker.getKey(); Preconditions.checkState(key.length == AltsChannelCrypter.getKeyLength(), "Bad key length."); return new AltsTsiFrameProtector(maxFrameSize, new AltsChannelCrypter(key, isClient), alloc); }
[ "@", "Override", "public", "TsiFrameProtector", "createFrameProtector", "(", "int", "maxFrameSize", ",", "ByteBufAllocator", "alloc", ")", "{", "Preconditions", ".", "checkState", "(", "!", "isInProgress", "(", ")", ",", "\"Handshake is not complete.\"", ")", ";", "byte", "[", "]", "key", "=", "handshaker", ".", "getKey", "(", ")", ";", "Preconditions", ".", "checkState", "(", "key", ".", "length", "==", "AltsChannelCrypter", ".", "getKeyLength", "(", ")", ",", "\"Bad key length.\"", ")", ";", "return", "new", "AltsTsiFrameProtector", "(", "maxFrameSize", ",", "new", "AltsChannelCrypter", "(", "key", ",", "isClient", ")", ",", "alloc", ")", ";", "}" ]
Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created. @param maxFrameSize the requested max frame size, the callee is free to ignore. @param alloc used for allocating ByteBufs. @return a new TsiFrameProtector.
[ "Creates", "a", "frame", "protector", "from", "a", "completed", "handshake", ".", "No", "other", "methods", "may", "be", "called", "after", "the", "frame", "protector", "is", "created", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsTsiHandshaker.java#L174-L182