repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
sequencelengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
sequencelengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/creation/CreationShanksAgentCapability.java
CreationShanksAgentCapability.removeAgent
public static void removeAgent(ShanksSimulation sim, String agentID) throws ShanksException { sim.logger.info("Stoppable not fount. Attempting direct stop..."); sim.unregisterShanksAgent(agentID); sim.logger.info("Agent " + agentID + " stopped."); }
java
public static void removeAgent(ShanksSimulation sim, String agentID) throws ShanksException { sim.logger.info("Stoppable not fount. Attempting direct stop..."); sim.unregisterShanksAgent(agentID); sim.logger.info("Agent " + agentID + " stopped."); }
[ "public", "static", "void", "removeAgent", "(", "ShanksSimulation", "sim", ",", "String", "agentID", ")", "throws", "ShanksException", "{", "sim", ".", "logger", ".", "info", "(", "\"Stoppable not fount. Attempting direct stop...\"", ")", ";", "sim", ".", "unregisterShanksAgent", "(", "agentID", ")", ";", "sim", ".", "logger", ".", "info", "(", "\"Agent \"", "+", "agentID", "+", "\" stopped.\"", ")", ";", "}" ]
"Removes" an agent with the given name from the simulation Be careful: what this actually do is to stop the agent execution. @param sim -The Shanks Simulation @param agentID - The name of the agent to remove @throws ShanksException An UnkownAgentException if the Agent ID is not found on the simulation.
[ "Removes", "an", "agent", "with", "the", "given", "name", "from", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/creation/CreationShanksAgentCapability.java#L73-L78
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java
PreprocessorContext.setGlobalVariable
@Nonnull public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) { assertNotNull("Variable name is null", name); final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalizedName.isEmpty()) { throw makeException("Name is empty", null); } assertNotNull("Value is null", value); if (mapVariableNameToSpecialVarProcessor.containsKey(normalizedName)) { mapVariableNameToSpecialVarProcessor.get(normalizedName).setVariable(normalizedName, value, this); } else { if (isVerbose()) { final String valueAsStr = value.toString(); if (globalVarTable.containsKey(normalizedName)) { logForVerbose("Replacing global variable [" + normalizedName + '=' + valueAsStr + ']'); } else { logForVerbose("Defining new global variable [" + normalizedName + '=' + valueAsStr + ']'); } } globalVarTable.put(normalizedName, value); } return this; }
java
@Nonnull public PreprocessorContext setGlobalVariable(@Nonnull final String name, @Nonnull final Value value) { assertNotNull("Variable name is null", name); final String normalizedName = assertNotNull(PreprocessorUtils.normalizeVariableName(name)); if (normalizedName.isEmpty()) { throw makeException("Name is empty", null); } assertNotNull("Value is null", value); if (mapVariableNameToSpecialVarProcessor.containsKey(normalizedName)) { mapVariableNameToSpecialVarProcessor.get(normalizedName).setVariable(normalizedName, value, this); } else { if (isVerbose()) { final String valueAsStr = value.toString(); if (globalVarTable.containsKey(normalizedName)) { logForVerbose("Replacing global variable [" + normalizedName + '=' + valueAsStr + ']'); } else { logForVerbose("Defining new global variable [" + normalizedName + '=' + valueAsStr + ']'); } } globalVarTable.put(normalizedName, value); } return this; }
[ "@", "Nonnull", "public", "PreprocessorContext", "setGlobalVariable", "(", "@", "Nonnull", "final", "String", "name", ",", "@", "Nonnull", "final", "Value", "value", ")", "{", "assertNotNull", "(", "\"Variable name is null\"", ",", "name", ")", ";", "final", "String", "normalizedName", "=", "assertNotNull", "(", "PreprocessorUtils", ".", "normalizeVariableName", "(", "name", ")", ")", ";", "if", "(", "normalizedName", ".", "isEmpty", "(", ")", ")", "{", "throw", "makeException", "(", "\"Name is empty\"", ",", "null", ")", ";", "}", "assertNotNull", "(", "\"Value is null\"", ",", "value", ")", ";", "if", "(", "mapVariableNameToSpecialVarProcessor", ".", "containsKey", "(", "normalizedName", ")", ")", "{", "mapVariableNameToSpecialVarProcessor", ".", "get", "(", "normalizedName", ")", ".", "setVariable", "(", "normalizedName", ",", "value", ",", "this", ")", ";", "}", "else", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "final", "String", "valueAsStr", "=", "value", ".", "toString", "(", ")", ";", "if", "(", "globalVarTable", ".", "containsKey", "(", "normalizedName", ")", ")", "{", "logForVerbose", "(", "\"Replacing global variable [\"", "+", "normalizedName", "+", "'", "'", "+", "valueAsStr", "+", "'", "'", ")", ";", "}", "else", "{", "logForVerbose", "(", "\"Defining new global variable [\"", "+", "normalizedName", "+", "'", "'", "+", "valueAsStr", "+", "'", "'", ")", ";", "}", "}", "globalVarTable", ".", "put", "(", "normalizedName", ",", "value", ")", ";", "}", "return", "this", ";", "}" ]
Set a global variable value @param name the variable name, it must not be null and will be normalized to the supported format @param value the variable value, it must not be null @return this preprocessor context
[ "Set", "a", "global", "variable", "value" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L587-L613
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java
SpaceResource.updateSpaceACLs
public void updateSpaceACLs(String spaceID, Map<String, AclType> spaceACLs, String storeID) throws ResourceException { try { StorageProvider storage = storageProviderFactory.getStorageProvider( storeID); if (null != spaceACLs) { storage.setSpaceACLs(spaceID, spaceACLs); } } catch (NotFoundException e) { throw new ResourceNotFoundException("update space ACLs for", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("update space ACLs for", spaceID, e); } }
java
public void updateSpaceACLs(String spaceID, Map<String, AclType> spaceACLs, String storeID) throws ResourceException { try { StorageProvider storage = storageProviderFactory.getStorageProvider( storeID); if (null != spaceACLs) { storage.setSpaceACLs(spaceID, spaceACLs); } } catch (NotFoundException e) { throw new ResourceNotFoundException("update space ACLs for", spaceID, e); } catch (Exception e) { storageProviderFactory.expireStorageProvider(storeID); throw new ResourceException("update space ACLs for", spaceID, e); } }
[ "public", "void", "updateSpaceACLs", "(", "String", "spaceID", ",", "Map", "<", "String", ",", "AclType", ">", "spaceACLs", ",", "String", "storeID", ")", "throws", "ResourceException", "{", "try", "{", "StorageProvider", "storage", "=", "storageProviderFactory", ".", "getStorageProvider", "(", "storeID", ")", ";", "if", "(", "null", "!=", "spaceACLs", ")", "{", "storage", ".", "setSpaceACLs", "(", "spaceID", ",", "spaceACLs", ")", ";", "}", "}", "catch", "(", "NotFoundException", "e", ")", "{", "throw", "new", "ResourceNotFoundException", "(", "\"update space ACLs for\"", ",", "spaceID", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "storageProviderFactory", ".", "expireStorageProvider", "(", "storeID", ")", ";", "throw", "new", "ResourceException", "(", "\"update space ACLs for\"", ",", "spaceID", ",", "e", ")", ";", "}", "}" ]
Updates the ACLs of a space. @param spaceID @param spaceACLs @param storeID
[ "Updates", "the", "ACLs", "of", "a", "space", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceResource.java#L221-L237
OpenTSDB/opentsdb
src/tools/CliUtils.java
CliUtils.toBytes
static byte[] toBytes(final String s) { try { return (byte[]) toBytes.invoke(null, s); } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } }
java
static byte[] toBytes(final String s) { try { return (byte[]) toBytes.invoke(null, s); } catch (Exception e) { throw new RuntimeException("toBytes=" + toBytes, e); } }
[ "static", "byte", "[", "]", "toBytes", "(", "final", "String", "s", ")", "{", "try", "{", "return", "(", "byte", "[", "]", ")", "toBytes", ".", "invoke", "(", "null", ",", "s", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"toBytes=\"", "+", "toBytes", ",", "e", ")", ";", "}", "}" ]
Invokes the reflected {@code UniqueId.toBytes()} method with the given string using the UniqueId character set. @param s The string to convert to a byte array @return The byte array @throws RuntimeException if reflection failed
[ "Invokes", "the", "reflected", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/CliUtils.java#L245-L251
EdwardRaff/JSAT
JSAT/src/jsat/linear/EigenValueDecomposition.java
EigenValueDecomposition.columnOpTransform
private static void columnOpTransform(Matrix M, int low, int high, int n, double q, double p, int shift) { double z; for (int i = low; i <= high; i++) { z = M.get(i, n+shift); M.set(i, n+shift, q * z + p * M.get(i, n)); M.set(i, n, q * M.get(i, n) - p * z); } }
java
private static void columnOpTransform(Matrix M, int low, int high, int n, double q, double p, int shift) { double z; for (int i = low; i <= high; i++) { z = M.get(i, n+shift); M.set(i, n+shift, q * z + p * M.get(i, n)); M.set(i, n, q * M.get(i, n) - p * z); } }
[ "private", "static", "void", "columnOpTransform", "(", "Matrix", "M", ",", "int", "low", ",", "int", "high", ",", "int", "n", ",", "double", "q", ",", "double", "p", ",", "int", "shift", ")", "{", "double", "z", ";", "for", "(", "int", "i", "=", "low", ";", "i", "<=", "high", ";", "i", "++", ")", "{", "z", "=", "M", ".", "get", "(", "i", ",", "n", "+", "shift", ")", ";", "M", ".", "set", "(", "i", ",", "n", "+", "shift", ",", "q", "*", "z", "+", "p", "*", "M", ".", "get", "(", "i", ",", "n", ")", ")", ";", "M", ".", "set", "(", "i", ",", "n", ",", "q", "*", "M", ".", "get", "(", "i", ",", "n", ")", "-", "p", "*", "z", ")", ";", "}", "}" ]
Updates the columns of the matrix M such that <br><br> <code><br> for (int i = low; i <= high; i++)<br> {<br> &nbsp;&nbsp; z = M[i][n+shift];<br> &nbsp;&nbsp; M[i][n+shift] = q * z + p * M[i][n];<br> &nbsp;&nbsp; M[i][n] = q * M[i][n] - p * z;<br> }<br> </code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param n the column to alter, and the preceding column will be altered as well @param q first constant @param p second constant @param shift the direction to perform the computation. Either 1 for after the current column, or -1 for before the current column.
[ "Updates", "the", "columns", "of", "the", "matrix", "M", "such", "that", "<br", ">", "<br", ">", "<code", ">", "<br", ">", "for", "(", "int", "i", "=", "low", ";", "i", "<", "=", "high", ";", "i", "++", ")", "<br", ">", "{", "<br", ">", "&nbsp", ";", "&nbsp", ";", "z", "=", "M", "[", "i", "]", "[", "n", "+", "shift", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "i", "]", "[", "n", "+", "shift", "]", "=", "q", "*", "z", "+", "p", "*", "M", "[", "i", "]", "[", "n", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "i", "]", "[", "n", "]", "=", "q", "*", "M", "[", "i", "]", "[", "n", "]", "-", "p", "*", "z", ";", "<br", ">", "}", "<br", ">", "<", "/", "code", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L780-L789
patka/cassandra-migration
cassandra-migration/src/main/java/org/cognitor/cassandra/migration/Database.java
Database.logMigration
private void logMigration(DbMigration migration, boolean wasSuccessful) { BoundStatement boundStatement = logMigrationStatement.bind(wasSuccessful, migration.getVersion(), migration.getScriptName(), migration.getMigrationScript(), new Date()); session.execute(boundStatement); }
java
private void logMigration(DbMigration migration, boolean wasSuccessful) { BoundStatement boundStatement = logMigrationStatement.bind(wasSuccessful, migration.getVersion(), migration.getScriptName(), migration.getMigrationScript(), new Date()); session.execute(boundStatement); }
[ "private", "void", "logMigration", "(", "DbMigration", "migration", ",", "boolean", "wasSuccessful", ")", "{", "BoundStatement", "boundStatement", "=", "logMigrationStatement", ".", "bind", "(", "wasSuccessful", ",", "migration", ".", "getVersion", "(", ")", ",", "migration", ".", "getScriptName", "(", ")", ",", "migration", ".", "getMigrationScript", "(", ")", ",", "new", "Date", "(", ")", ")", ";", "session", ".", "execute", "(", "boundStatement", ")", ";", "}" ]
Inserts the result of the migration into the migration table @param migration the migration that was executed @param wasSuccessful indicates if the migration was successful or not
[ "Inserts", "the", "result", "of", "the", "migration", "into", "the", "migration", "table" ]
train
https://github.com/patka/cassandra-migration/blob/c61840c23b17a18df704d136909c26ff46bd5c77/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/Database.java#L219-L223
stagemonitor/stagemonitor
stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/prometheus/StagemonitorPrometheusCollector.java
StagemonitorPrometheusCollector.fromTimer
private MetricFamilySamples fromTimer(List<Map.Entry<MetricName, Timer>> histogramsWithSameName) { final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, "_seconds"); for (Map.Entry<MetricName, Timer> entry : histogramsWithSameName) { addSummaryMetric(summaryMetricFamily, entry.getKey(), entry.getValue().getSnapshot(), SECONDS_IN_NANOS, entry.getValue().getCount()); } return summaryMetricFamily; }
java
private MetricFamilySamples fromTimer(List<Map.Entry<MetricName, Timer>> histogramsWithSameName) { final SummaryMetricFamily summaryMetricFamily = getSummaryMetricFamily(histogramsWithSameName, "_seconds"); for (Map.Entry<MetricName, Timer> entry : histogramsWithSameName) { addSummaryMetric(summaryMetricFamily, entry.getKey(), entry.getValue().getSnapshot(), SECONDS_IN_NANOS, entry.getValue().getCount()); } return summaryMetricFamily; }
[ "private", "MetricFamilySamples", "fromTimer", "(", "List", "<", "Map", ".", "Entry", "<", "MetricName", ",", "Timer", ">", ">", "histogramsWithSameName", ")", "{", "final", "SummaryMetricFamily", "summaryMetricFamily", "=", "getSummaryMetricFamily", "(", "histogramsWithSameName", ",", "\"_seconds\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "MetricName", ",", "Timer", ">", "entry", ":", "histogramsWithSameName", ")", "{", "addSummaryMetric", "(", "summaryMetricFamily", ",", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ".", "getSnapshot", "(", ")", ",", "SECONDS_IN_NANOS", ",", "entry", ".", "getValue", "(", ")", ".", "getCount", "(", ")", ")", ";", "}", "return", "summaryMetricFamily", ";", "}" ]
Export dropwizard Timer as a histogram. Use TIME_UNIT as time unit.
[ "Export", "dropwizard", "Timer", "as", "a", "histogram", ".", "Use", "TIME_UNIT", "as", "time", "unit", "." ]
train
https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/prometheus/StagemonitorPrometheusCollector.java#L127-L133
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/OneSelect.java
OneSelect.addLinkFromSelectPart
public void addLinkFromSelectPart(final String _linkFrom) throws CacheReloadException { this.fromSelect = new LinkFromSelect(_linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); }
java
public void addLinkFromSelectPart(final String _linkFrom) throws CacheReloadException { this.fromSelect = new LinkFromSelect(_linkFrom, getQuery().isCacheEnabled() ? getQuery().getKey() : null); }
[ "public", "void", "addLinkFromSelectPart", "(", "final", "String", "_linkFrom", ")", "throws", "CacheReloadException", "{", "this", ".", "fromSelect", "=", "new", "LinkFromSelect", "(", "_linkFrom", ",", "getQuery", "(", ")", ".", "isCacheEnabled", "(", ")", "?", "getQuery", "(", ")", ".", "getKey", "(", ")", ":", "null", ")", ";", "}" ]
Add the name of the type and attribute the link comes from, evaluated from an <code>linkTo[TYPENAME#ATTRIBUTENAME]</code> part of an select statement. @param _linkFrom name of the attribute the link comes from @throws CacheReloadException on erro
[ "Add", "the", "name", "of", "the", "type", "and", "attribute", "the", "link", "comes", "from", "evaluated", "from", "an", "<code", ">", "linkTo", "[", "TYPENAME#ATTRIBUTENAME", "]", "<", "/", "code", ">", "part", "of", "an", "select", "statement", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/OneSelect.java#L390-L394
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java
DataStoreUtil.makeDBIDStorage
public static WritableDBIDDataStore makeDBIDStorage(DBIDs ids, int hints) { return DataStoreFactory.FACTORY.makeDBIDStorage(ids, hints); }
java
public static WritableDBIDDataStore makeDBIDStorage(DBIDs ids, int hints) { return DataStoreFactory.FACTORY.makeDBIDStorage(ids, hints); }
[ "public", "static", "WritableDBIDDataStore", "makeDBIDStorage", "(", "DBIDs", "ids", ",", "int", "hints", ")", "{", "return", "DataStoreFactory", ".", "FACTORY", ".", "makeDBIDStorage", "(", "ids", ",", "hints", ")", ";", "}" ]
Make a new storage, to associate the given ids with an object of class dataclass. @param ids DBIDs to store data for @param hints Hints for the storage manager @return new data store
[ "Make", "a", "new", "storage", "to", "associate", "the", "given", "ids", "with", "an", "object", "of", "class", "dataclass", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java#L75-L77
ksclarke/vertx-pairtree
src/main/java/info/freelibrary/pairtree/fs/FsPairtree.java
FsPairtree.checkPrefix
private void checkPrefix(final Future<Boolean> aFuture) { final String prefixFilePath = getPrefixFilePath(); myFileSystem.exists(prefixFilePath, result -> { if (result.succeeded()) { if (hasPrefix()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_035, prefixFilePath); } if (result.result()) { aFuture.complete(result.result()); } else { aFuture.fail(new PairtreeException(MessageCodes.PT_013, prefixFilePath)); } } else { LOGGER.debug(MessageCodes.PT_DEBUG_009, prefixFilePath); if (result.result()) { aFuture.fail(new PairtreeException(MessageCodes.PT_014, prefixFilePath)); } else { aFuture.complete(!result.result()); } } } else { aFuture.fail(result.cause()); } }); }
java
private void checkPrefix(final Future<Boolean> aFuture) { final String prefixFilePath = getPrefixFilePath(); myFileSystem.exists(prefixFilePath, result -> { if (result.succeeded()) { if (hasPrefix()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MessageCodes.PT_DEBUG_035, prefixFilePath); } if (result.result()) { aFuture.complete(result.result()); } else { aFuture.fail(new PairtreeException(MessageCodes.PT_013, prefixFilePath)); } } else { LOGGER.debug(MessageCodes.PT_DEBUG_009, prefixFilePath); if (result.result()) { aFuture.fail(new PairtreeException(MessageCodes.PT_014, prefixFilePath)); } else { aFuture.complete(!result.result()); } } } else { aFuture.fail(result.cause()); } }); }
[ "private", "void", "checkPrefix", "(", "final", "Future", "<", "Boolean", ">", "aFuture", ")", "{", "final", "String", "prefixFilePath", "=", "getPrefixFilePath", "(", ")", ";", "myFileSystem", ".", "exists", "(", "prefixFilePath", ",", "result", "->", "{", "if", "(", "result", ".", "succeeded", "(", ")", ")", "{", "if", "(", "hasPrefix", "(", ")", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "MessageCodes", ".", "PT_DEBUG_035", ",", "prefixFilePath", ")", ";", "}", "if", "(", "result", ".", "result", "(", ")", ")", "{", "aFuture", ".", "complete", "(", "result", ".", "result", "(", ")", ")", ";", "}", "else", "{", "aFuture", ".", "fail", "(", "new", "PairtreeException", "(", "MessageCodes", ".", "PT_013", ",", "prefixFilePath", ")", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "debug", "(", "MessageCodes", ".", "PT_DEBUG_009", ",", "prefixFilePath", ")", ";", "if", "(", "result", ".", "result", "(", ")", ")", "{", "aFuture", ".", "fail", "(", "new", "PairtreeException", "(", "MessageCodes", ".", "PT_014", ",", "prefixFilePath", ")", ")", ";", "}", "else", "{", "aFuture", ".", "complete", "(", "!", "result", ".", "result", "(", ")", ")", ";", "}", "}", "}", "else", "{", "aFuture", ".", "fail", "(", "result", ".", "cause", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
Checks whether a Pairtree prefix file exists. @param aFuture The result of an action that may, or may not, have occurred yet.
[ "Checks", "whether", "a", "Pairtree", "prefix", "file", "exists", "." ]
train
https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/fs/FsPairtree.java#L204-L232
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java
SqlGeneratorDefaultImpl.getPreparedDeleteStatement
public SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld) { return new SqlDeleteByQuery(m_platform, cld, query, logger); }
java
public SqlStatement getPreparedDeleteStatement(Query query, ClassDescriptor cld) { return new SqlDeleteByQuery(m_platform, cld, query, logger); }
[ "public", "SqlStatement", "getPreparedDeleteStatement", "(", "Query", "query", ",", "ClassDescriptor", "cld", ")", "{", "return", "new", "SqlDeleteByQuery", "(", "m_platform", ",", "cld", ",", "query", ",", "logger", ")", ";", "}" ]
generate a prepared DELETE-Statement according to query @param query the Query @param cld the ClassDescriptor
[ "generate", "a", "prepared", "DELETE", "-", "Statement", "according", "to", "query" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L557-L560
sporniket/core
sporniket-core-strings/src/main/java/com/sporniket/strings/QuickDiff.java
QuickDiff.outputReportLine
private void outputReportLine(List<String> report, MessageFormat template, String[] textLines, int currentLine) { Object[] _args = { currentLine, textLines[currentLine] }; report.add(template.format(_args)); }
java
private void outputReportLine(List<String> report, MessageFormat template, String[] textLines, int currentLine) { Object[] _args = { currentLine, textLines[currentLine] }; report.add(template.format(_args)); }
[ "private", "void", "outputReportLine", "(", "List", "<", "String", ">", "report", ",", "MessageFormat", "template", ",", "String", "[", "]", "textLines", ",", "int", "currentLine", ")", "{", "Object", "[", "]", "_args", "=", "{", "currentLine", ",", "textLines", "[", "currentLine", "]", "}", ";", "report", ".", "add", "(", "template", ".", "format", "(", "_args", ")", ")", ";", "}" ]
Add a report line the designated line. @param report The report buffer. @param template The template to use (to distinguish between text on left and text on right). @param textLines The source text as an array of lines. @param currentLine The line to output.
[ "Add", "a", "report", "line", "the", "designated", "line", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-strings/src/main/java/com/sporniket/strings/QuickDiff.java#L253-L260
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleWebhooks.java
ModuleWebhooks.fetchOne
public CMAWebhook fetchOne(String spaceId, String webhookId) { assertNotNull(spaceId, "spaceId"); assertNotNull(webhookId, "webhookId"); return service.fetchOne(spaceId, webhookId).blockingFirst(); }
java
public CMAWebhook fetchOne(String spaceId, String webhookId) { assertNotNull(spaceId, "spaceId"); assertNotNull(webhookId, "webhookId"); return service.fetchOne(spaceId, webhookId).blockingFirst(); }
[ "public", "CMAWebhook", "fetchOne", "(", "String", "spaceId", ",", "String", "webhookId", ")", "{", "assertNotNull", "(", "spaceId", ",", "\"spaceId\"", ")", ";", "assertNotNull", "(", "webhookId", ",", "\"webhookId\"", ")", ";", "return", "service", ".", "fetchOne", "(", "spaceId", ",", "webhookId", ")", ".", "blockingFirst", "(", ")", ";", "}" ]
Retrieve exactly one webhook, whose id you know. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)} and will ignore {@link CMAClient.Builder#setEnvironmentId(String)}. @param spaceId The id of the space to be hosting this webhook. @param webhookId The id of the webhook to be returned. @return The webhook found, or null, if no such webhook is available. @throws IllegalArgumentException if spaceId is null. @throws IllegalArgumentException if webhookId is null.
[ "Retrieve", "exactly", "one", "webhook", "whose", "id", "you", "know", ".", "<p", ">", "This", "method", "will", "override", "the", "configuration", "specified", "through", "{", "@link", "CMAClient", ".", "Builder#setSpaceId", "(", "String", ")", "}", "and", "will", "ignore", "{", "@link", "CMAClient", ".", "Builder#setEnvironmentId", "(", "String", ")", "}", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleWebhooks.java#L244-L249
apache/reef
lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/utils/DefinedRuntimesSerializer.java
DefinedRuntimesSerializer.toBytes
public byte[] toBytes(final DefinedRuntimes definedRuntimes){ final DatumWriter<DefinedRuntimes> configurationWriter = new SpecificDatumWriter<>(DefinedRuntimes.class); try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder binaryEncoder = EncoderFactory.get().binaryEncoder(out, null); configurationWriter.write(definedRuntimes, binaryEncoder); binaryEncoder.flush(); out.flush(); return out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize DefinedRuntimes", e); } }
java
public byte[] toBytes(final DefinedRuntimes definedRuntimes){ final DatumWriter<DefinedRuntimes> configurationWriter = new SpecificDatumWriter<>(DefinedRuntimes.class); try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) { final BinaryEncoder binaryEncoder = EncoderFactory.get().binaryEncoder(out, null); configurationWriter.write(definedRuntimes, binaryEncoder); binaryEncoder.flush(); out.flush(); return out.toByteArray(); } catch (final IOException e) { throw new RuntimeException("Unable to serialize DefinedRuntimes", e); } }
[ "public", "byte", "[", "]", "toBytes", "(", "final", "DefinedRuntimes", "definedRuntimes", ")", "{", "final", "DatumWriter", "<", "DefinedRuntimes", ">", "configurationWriter", "=", "new", "SpecificDatumWriter", "<>", "(", "DefinedRuntimes", ".", "class", ")", ";", "try", "(", "final", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ")", "{", "final", "BinaryEncoder", "binaryEncoder", "=", "EncoderFactory", ".", "get", "(", ")", ".", "binaryEncoder", "(", "out", ",", "null", ")", ";", "configurationWriter", ".", "write", "(", "definedRuntimes", ",", "binaryEncoder", ")", ";", "binaryEncoder", ".", "flush", "(", ")", ";", "out", ".", "flush", "(", ")", ";", "return", "out", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to serialize DefinedRuntimes\"", ",", "e", ")", ";", "}", "}" ]
Serializes DefinedRuntimes. @param definedRuntimes the Avro object to toString @return Serialized avro string
[ "Serializes", "DefinedRuntimes", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/utils/DefinedRuntimesSerializer.java#L44-L56
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java
BaseMessagingEngineImpl.alterLocalizationPoint
final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) { String thisMethodName = "alterLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } try { _localizer.alterLocalizationPoint(dest,lp); } catch (Exception e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
java
final void alterLocalizationPoint(BaseDestination dest,LWMConfig lp) { String thisMethodName = "alterLocalizationPoint"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, lp); } try { _localizer.alterLocalizationPoint(dest,lp); } catch (Exception e) { SibTr.exception(tc, e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName); } }
[ "final", "void", "alterLocalizationPoint", "(", "BaseDestination", "dest", ",", "LWMConfig", "lp", ")", "{", "String", "thisMethodName", "=", "\"alterLocalizationPoint\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "thisMethodName", ",", "lp", ")", ";", "}", "try", "{", "_localizer", ".", "alterLocalizationPoint", "(", "dest", ",", "lp", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "thisMethodName", ")", ";", "}", "}" ]
Pass the request to alter a localization point onto the localizer object. @param lp localization point definition
[ "Pass", "the", "request", "to", "alter", "a", "localization", "point", "onto", "the", "localizer", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1495-L1512
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java
PathBuilder.cubicTo
public PathBuilder cubicTo(Point2d cp1, Point2d cp2, Point2d ep) { add(new CubicTo(cp1, cp2, ep)); return this; }
java
public PathBuilder cubicTo(Point2d cp1, Point2d cp2, Point2d ep) { add(new CubicTo(cp1, cp2, ep)); return this; }
[ "public", "PathBuilder", "cubicTo", "(", "Point2d", "cp1", ",", "Point2d", "cp2", ",", "Point2d", "ep", ")", "{", "add", "(", "new", "CubicTo", "(", "cp1", ",", "cp2", ",", "ep", ")", ")", ";", "return", "this", ";", "}" ]
Make a cubic curve in the path, with two control points. @param cp1 the first control point @param cp2 the second control point @param ep the end point of the curve @return a reference to this builder
[ "Make", "a", "cubic", "curve", "in", "the", "path", "with", "two", "control", "points", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java#L124-L127
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateUUID
public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException { if (false == isUUID(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateUUID(T value, String errorMsg) throws ValidateException { if (false == isUUID(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateUUID", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isUUID", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg", ")", ";", "}", "return", "value", ";", "}" ]
验证是否为UUID<br> 包括带横线标准格式和不带横线的简单模式 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为UUID<br", ">", "包括带横线标准格式和不带横线的简单模式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L1002-L1007
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.getConcatenated
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE [] aHeadArray, @Nullable final ELEMENTTYPE aTail, @Nonnull final Class <ELEMENTTYPE> aClass) { if (isEmpty (aHeadArray)) return newArraySingleElement (aTail, aClass); // Start concatenating final ELEMENTTYPE [] ret = newArray (aClass, aHeadArray.length + 1); System.arraycopy (aHeadArray, 0, ret, 0, aHeadArray.length); ret[aHeadArray.length] = aTail; return ret; }
java
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> ELEMENTTYPE [] getConcatenated (@Nullable final ELEMENTTYPE [] aHeadArray, @Nullable final ELEMENTTYPE aTail, @Nonnull final Class <ELEMENTTYPE> aClass) { if (isEmpty (aHeadArray)) return newArraySingleElement (aTail, aClass); // Start concatenating final ELEMENTTYPE [] ret = newArray (aClass, aHeadArray.length + 1); System.arraycopy (aHeadArray, 0, ret, 0, aHeadArray.length); ret[aHeadArray.length] = aTail; return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "<", "ELEMENTTYPE", ">", "ELEMENTTYPE", "[", "]", "getConcatenated", "(", "@", "Nullable", "final", "ELEMENTTYPE", "[", "]", "aHeadArray", ",", "@", "Nullable", "final", "ELEMENTTYPE", "aTail", ",", "@", "Nonnull", "final", "Class", "<", "ELEMENTTYPE", ">", "aClass", ")", "{", "if", "(", "isEmpty", "(", "aHeadArray", ")", ")", "return", "newArraySingleElement", "(", "aTail", ",", "aClass", ")", ";", "// Start concatenating", "final", "ELEMENTTYPE", "[", "]", "ret", "=", "newArray", "(", "aClass", ",", "aHeadArray", ".", "length", "+", "1", ")", ";", "System", ".", "arraycopy", "(", "aHeadArray", ",", "0", ",", "ret", ",", "0", ",", "aHeadArray", ".", "length", ")", ";", "ret", "[", "aHeadArray", ".", "length", "]", "=", "aTail", ";", "return", "ret", ";", "}" ]
Get a new array that combines the passed array and the tail element. The tail element will be the last element of the created array. @param <ELEMENTTYPE> Array element type @param aHeadArray The head array. May be <code>null</code>. @param aTail The last element of the result array. If this element is <code>null</code> it will be inserted as such into the array! @param aClass The element class. Must be present, because in case both elements are <code>null</code> there would be no way to create a new array. May not be <code>null</code>. @return <code>null</code> if both array parameters are <code>null</code> - a non-<code>null</code> array with all elements in the correct order otherwise.
[ "Get", "a", "new", "array", "that", "combines", "the", "passed", "array", "and", "the", "tail", "element", ".", "The", "tail", "element", "will", "be", "the", "last", "element", "of", "the", "created", "array", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L1996-L2010
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java
CertificatesInner.createOrUpdateAsync
public Observable<IntegrationAccountCertificateInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String certificateName, IntegrationAccountCertificateInner certificate) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName, certificate).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountCertificateInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String certificateName, IntegrationAccountCertificateInner certificate) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName, certificate).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() { @Override public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountCertificateInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "certificateName", ",", "IntegrationAccountCertificateInner", "certificate", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "certificateName", ",", "certificate", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", ",", "IntegrationAccountCertificateInner", ">", "(", ")", "{", "@", "Override", "public", "IntegrationAccountCertificateInner", "call", "(", "ServiceResponse", "<", "IntegrationAccountCertificateInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an integration account certificate. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param certificateName The integration account certificate name. @param certificate The integration account certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountCertificateInner object
[ "Creates", "or", "updates", "an", "integration", "account", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L465-L472
rhuss/jolokia
agent/core/src/main/java/org/jolokia/backend/MBeanServerExecutorLocal.java
MBeanServerExecutorLocal.handleRequest
public <R extends JmxRequest> Object handleRequest(JsonRequestHandler<R> pRequestHandler, R pJmxReq) throws MBeanException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, NotChangedException { AttributeNotFoundException attrException = null; InstanceNotFoundException objNotFoundException = null; for (MBeanServerConnection conn : getMBeanServers()) { try { return pRequestHandler.handleRequest(conn, pJmxReq); } catch (InstanceNotFoundException exp) { // Remember exceptions for later use objNotFoundException = exp; } catch (AttributeNotFoundException exp) { attrException = exp; } catch (IOException exp) { throw new IllegalStateException("I/O Error while dispatching",exp); } } if (attrException != null) { throw attrException; } // Must be there, otherwise we would not have left the loop throw objNotFoundException; }
java
public <R extends JmxRequest> Object handleRequest(JsonRequestHandler<R> pRequestHandler, R pJmxReq) throws MBeanException, ReflectionException, AttributeNotFoundException, InstanceNotFoundException, NotChangedException { AttributeNotFoundException attrException = null; InstanceNotFoundException objNotFoundException = null; for (MBeanServerConnection conn : getMBeanServers()) { try { return pRequestHandler.handleRequest(conn, pJmxReq); } catch (InstanceNotFoundException exp) { // Remember exceptions for later use objNotFoundException = exp; } catch (AttributeNotFoundException exp) { attrException = exp; } catch (IOException exp) { throw new IllegalStateException("I/O Error while dispatching",exp); } } if (attrException != null) { throw attrException; } // Must be there, otherwise we would not have left the loop throw objNotFoundException; }
[ "public", "<", "R", "extends", "JmxRequest", ">", "Object", "handleRequest", "(", "JsonRequestHandler", "<", "R", ">", "pRequestHandler", ",", "R", "pJmxReq", ")", "throws", "MBeanException", ",", "ReflectionException", ",", "AttributeNotFoundException", ",", "InstanceNotFoundException", ",", "NotChangedException", "{", "AttributeNotFoundException", "attrException", "=", "null", ";", "InstanceNotFoundException", "objNotFoundException", "=", "null", ";", "for", "(", "MBeanServerConnection", "conn", ":", "getMBeanServers", "(", ")", ")", "{", "try", "{", "return", "pRequestHandler", ".", "handleRequest", "(", "conn", ",", "pJmxReq", ")", ";", "}", "catch", "(", "InstanceNotFoundException", "exp", ")", "{", "// Remember exceptions for later use", "objNotFoundException", "=", "exp", ";", "}", "catch", "(", "AttributeNotFoundException", "exp", ")", "{", "attrException", "=", "exp", ";", "}", "catch", "(", "IOException", "exp", ")", "{", "throw", "new", "IllegalStateException", "(", "\"I/O Error while dispatching\"", ",", "exp", ")", ";", "}", "}", "if", "(", "attrException", "!=", "null", ")", "{", "throw", "attrException", ";", "}", "// Must be there, otherwise we would not have left the loop", "throw", "objNotFoundException", ";", "}" ]
Handle a single request @param pRequestHandler the handler which can deal with this request @param pJmxReq the request to execute @return the return value @throws MBeanException @throws ReflectionException @throws AttributeNotFoundException @throws InstanceNotFoundException
[ "Handle", "a", "single", "request" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/MBeanServerExecutorLocal.java#L102-L124
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.makeConstructorDoc
protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new ConstructorDocImpl(this, meth, treePath); methodMap.put(meth, result); } }
java
protected void makeConstructorDoc(MethodSymbol meth, TreePath treePath) { ConstructorDocImpl result = (ConstructorDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new ConstructorDocImpl(this, meth, treePath); methodMap.put(meth, result); } }
[ "protected", "void", "makeConstructorDoc", "(", "MethodSymbol", "meth", ",", "TreePath", "treePath", ")", "{", "ConstructorDocImpl", "result", "=", "(", "ConstructorDocImpl", ")", "methodMap", ".", "get", "(", "meth", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "if", "(", "treePath", "!=", "null", ")", "result", ".", "setTreePath", "(", "treePath", ")", ";", "}", "else", "{", "result", "=", "new", "ConstructorDocImpl", "(", "this", ",", "meth", ",", "treePath", ")", ";", "methodMap", ".", "put", "(", "meth", ",", "result", ")", ";", "}", "}" ]
Create the ConstructorDoc for a MethodSymbol. Should be called only on symbols representing constructors.
[ "Create", "the", "ConstructorDoc", "for", "a", "MethodSymbol", ".", "Should", "be", "called", "only", "on", "symbols", "representing", "constructors", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L688-L696
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java
ImageLoader.loadImage
public static BufferedImage loadImage(String fileName, int imageType){ BufferedImage img = loadImage(fileName); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
java
public static BufferedImage loadImage(String fileName, int imageType){ BufferedImage img = loadImage(fileName); if(img.getType() != imageType){ img = BufferedImageFactory.get(img, imageType); } return img; }
[ "public", "static", "BufferedImage", "loadImage", "(", "String", "fileName", ",", "int", "imageType", ")", "{", "BufferedImage", "img", "=", "loadImage", "(", "fileName", ")", ";", "if", "(", "img", ".", "getType", "(", ")", "!=", "imageType", ")", "{", "img", "=", "BufferedImageFactory", ".", "get", "(", "img", ",", "imageType", ")", ";", "}", "return", "img", ";", "}" ]
Tries to load Image from file and converts it to the desired image type if needed. <br> See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available image types. @param fileName path to the image file @param imageType of the resulting BufferedImage @return loaded Image. @throws ImageLoaderException if no image could be loaded from the file. @since 1.0
[ "Tries", "to", "load", "Image", "from", "file", "and", "converts", "it", "to", "the", "desired", "image", "type", "if", "needed", ".", "<br", ">", "See", "{", "@link", "BufferedImage#BufferedImage", "(", "int", "int", "int", ")", "}", "for", "details", "on", "the", "available", "image", "types", "." ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L143-L149
NoraUi/NoraUi
src/main/java/com/github/noraui/data/CommonDataProvider.java
CommonDataProvider.writeWarningResult
public void writeWarningResult(int line, String value) { logger.debug("Write Warning result => line:{} value:{}", line, value); writeValue(resultColumnName, line, value); }
java
public void writeWarningResult(int line, String value) { logger.debug("Write Warning result => line:{} value:{}", line, value); writeValue(resultColumnName, line, value); }
[ "public", "void", "writeWarningResult", "(", "int", "line", ",", "String", "value", ")", "{", "logger", ".", "debug", "(", "\"Write Warning result => line:{} value:{}\"", ",", "line", ",", "value", ")", ";", "writeValue", "(", "resultColumnName", ",", "line", ",", "value", ")", ";", "}" ]
Writes a warning result @param line The line number @param value The value
[ "Writes", "a", "warning", "result" ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/data/CommonDataProvider.java#L167-L170
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java
DfuServiceInitiator.setZip
public DfuServiceInitiator setZip(@RawRes final int rawResId) { return init(null, null, rawResId, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP); }
java
public DfuServiceInitiator setZip(@RawRes final int rawResId) { return init(null, null, rawResId, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP); }
[ "public", "DfuServiceInitiator", "setZip", "(", "@", "RawRes", "final", "int", "rawResId", ")", "{", "return", "init", "(", "null", ",", "null", ",", "rawResId", ",", "DfuBaseService", ".", "TYPE_AUTO", ",", "DfuBaseService", ".", "MIME_TYPE_ZIP", ")", ";", "}" ]
Sets the resource ID of the Distribution packet (ZIP) or the a ZIP file matching the deprecated naming convention. The file should be in the /res/raw folder. @param rawResId file's resource ID @return the builder @see #setZip(Uri) @see #setZip(String)
[ "Sets", "the", "resource", "ID", "of", "the", "Distribution", "packet", "(", "ZIP", ")", "or", "the", "a", "ZIP", "file", "matching", "the", "deprecated", "naming", "convention", ".", "The", "file", "should", "be", "in", "the", "/", "res", "/", "raw", "folder", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L591-L593
jianlins/FastContext
src/main/java/edu/utah/bmi/nlp/fastcontext/uima/FastContext_General_AE.java
FastContext_General_AE.getTypeDefinitions
@Deprecated public static HashMap<String, TypeDefinition> getTypeDefinitions(String ruleStr, boolean caseInsensitive) { return new FastContextUIMA(ruleStr, caseInsensitive).getTypeDefinitions(); }
java
@Deprecated public static HashMap<String, TypeDefinition> getTypeDefinitions(String ruleStr, boolean caseInsensitive) { return new FastContextUIMA(ruleStr, caseInsensitive).getTypeDefinitions(); }
[ "@", "Deprecated", "public", "static", "HashMap", "<", "String", ",", "TypeDefinition", ">", "getTypeDefinitions", "(", "String", "ruleStr", ",", "boolean", "caseInsensitive", ")", "{", "return", "new", "FastContextUIMA", "(", "ruleStr", ",", "caseInsensitive", ")", ".", "getTypeDefinitions", "(", ")", ";", "}" ]
Because implement a reinforced interface method (static is not reinforced), this is deprecated, just to enable back-compatibility. @param ruleStr Rule file path or rule content string @param caseInsensitive whether to parse the rule in case-insensitive manner @return Type name--Type definition map
[ "Because", "implement", "a", "reinforced", "interface", "method", "(", "static", "is", "not", "reinforced", ")", "this", "is", "deprecated", "just", "to", "enable", "back", "-", "compatibility", "." ]
train
https://github.com/jianlins/FastContext/blob/e3f7cfa7e6eb69bbeb49a51021d8ec5613654fc8/src/main/java/edu/utah/bmi/nlp/fastcontext/uima/FastContext_General_AE.java#L345-L348
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.getToleranceDistance
public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); double longitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getLeftCoordinate(), latLngBoundingBox.getRightCoordinate()); double latitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getDownCoordinate(), latLngBoundingBox.getUpCoordinate()); double distance = Math.max(longitudeDistance, latitudeDistance); return distance; }
java
public static double getToleranceDistance(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); double longitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getLeftCoordinate(), latLngBoundingBox.getRightCoordinate()); double latitudeDistance = SphericalUtil.computeDistanceBetween(latLngBoundingBox.getDownCoordinate(), latLngBoundingBox.getUpCoordinate()); double distance = Math.max(longitudeDistance, latitudeDistance); return distance; }
[ "public", "static", "double", "getToleranceDistance", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "LatLngBoundingBox", "latLngBoundingBox", "=", "buildClickLatLngBoundingBox", "(", "latLng", ",", "view", ",", "map", ",", "screenClickPercentage", ")", ";", "double", "longitudeDistance", "=", "SphericalUtil", ".", "computeDistanceBetween", "(", "latLngBoundingBox", ".", "getLeftCoordinate", "(", ")", ",", "latLngBoundingBox", ".", "getRightCoordinate", "(", ")", ")", ";", "double", "latitudeDistance", "=", "SphericalUtil", ".", "computeDistanceBetween", "(", "latLngBoundingBox", ".", "getDownCoordinate", "(", ")", ",", "latLngBoundingBox", ".", "getUpCoordinate", "(", ")", ")", ";", "double", "distance", "=", "Math", ".", "max", "(", "longitudeDistance", ",", "latitudeDistance", ")", ";", "return", "distance", ";", "}" ]
Get the allowable tolerance distance in meters from the click location on the map view and map with the screen percentage tolerance. @param latLng click location @param view map view @param map map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return tolerance distance in meters
[ "Get", "the", "allowable", "tolerance", "distance", "in", "meters", "from", "the", "click", "location", "on", "the", "map", "view", "and", "map", "with", "the", "screen", "percentage", "tolerance", "." ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L162-L172
qiniu/java-sdk
src/main/java/com/qiniu/storage/BucketManager.java
BucketManager.changeType
public Response changeType(String bucket, String key, StorageType type) throws QiniuException { String resource = encodedEntry(bucket, key); String path = String.format("/chtype/%s/type/%d", resource, type.ordinal()); return rsPost(bucket, path, null); }
java
public Response changeType(String bucket, String key, StorageType type) throws QiniuException { String resource = encodedEntry(bucket, key); String path = String.format("/chtype/%s/type/%d", resource, type.ordinal()); return rsPost(bucket, path, null); }
[ "public", "Response", "changeType", "(", "String", "bucket", ",", "String", "key", ",", "StorageType", "type", ")", "throws", "QiniuException", "{", "String", "resource", "=", "encodedEntry", "(", "bucket", ",", "key", ")", ";", "String", "path", "=", "String", ".", "format", "(", "\"/chtype/%s/type/%d\"", ",", "resource", ",", "type", ".", "ordinal", "(", ")", ")", ";", "return", "rsPost", "(", "bucket", ",", "path", ",", "null", ")", ";", "}" ]
修改文件的类型(普通存储或低频存储) @param bucket 空间名称 @param key 文件名称 @param type type=0 表示普通存储,type=1 表示低频存存储 @throws QiniuException
[ "修改文件的类型(普通存储或低频存储)" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L309-L314
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.findByC_ERC
@Override public CPOption findByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPOptionException { CPOption cpOption = fetchByC_ERC(companyId, externalReferenceCode); if (cpOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", externalReferenceCode="); msg.append(externalReferenceCode); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPOptionException(msg.toString()); } return cpOption; }
java
@Override public CPOption findByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPOptionException { CPOption cpOption = fetchByC_ERC(companyId, externalReferenceCode); if (cpOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", externalReferenceCode="); msg.append(externalReferenceCode); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPOptionException(msg.toString()); } return cpOption; }
[ "@", "Override", "public", "CPOption", "findByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "throws", "NoSuchCPOptionException", "{", "CPOption", "cpOption", "=", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCode", ")", ";", "if", "(", "cpOption", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"companyId=\"", ")", ";", "msg", ".", "append", "(", "companyId", ")", ";", "msg", ".", "append", "(", "\", externalReferenceCode=\"", ")", ";", "msg", ".", "append", "(", "externalReferenceCode", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchCPOptionException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "cpOption", ";", "}" ]
Returns the cp option where companyId = &#63; and externalReferenceCode = &#63; or throws a {@link NoSuchCPOptionException} if it could not be found. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching cp option @throws NoSuchCPOptionException if a matching cp option could not be found
[ "Returns", "the", "cp", "option", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPOptionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2239-L2265
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java
YamlOrchestrationMasterSlaveDataSourceFactory.createDataSource
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile); return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration()); }
java
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final File yamlFile) throws SQLException, IOException { YamlOrchestrationMasterSlaveRuleConfiguration config = unmarshal(yamlFile); return createDataSource(dataSourceMap, config.getMasterSlaveRule(), config.getProps(), config.getOrchestration()); }
[ "public", "static", "DataSource", "createDataSource", "(", "final", "Map", "<", "String", ",", "DataSource", ">", "dataSourceMap", ",", "final", "File", "yamlFile", ")", "throws", "SQLException", ",", "IOException", "{", "YamlOrchestrationMasterSlaveRuleConfiguration", "config", "=", "unmarshal", "(", "yamlFile", ")", ";", "return", "createDataSource", "(", "dataSourceMap", ",", "config", ".", "getMasterSlaveRule", "(", ")", ",", "config", ".", "getProps", "(", ")", ",", "config", ".", "getOrchestration", "(", ")", ")", ";", "}" ]
Create master-slave data source. @param dataSourceMap data source map @param yamlFile YAML file for master-slave rule configuration without data sources @return master-slave data source @throws SQLException SQL exception @throws IOException IO exception
[ "Create", "master", "-", "slave", "data", "source", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/yaml/YamlOrchestrationMasterSlaveDataSourceFactory.java#L74-L77
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.addVideoFrameUrl
public void addVideoFrameUrl(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) { addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).toBlocking().single().body(); }
java
public void addVideoFrameUrl(String teamName, String reviewId, String contentType, List<VideoFrameBodyItem> videoFrameBody, AddVideoFrameUrlOptionalParameter addVideoFrameUrlOptionalParameter) { addVideoFrameUrlWithServiceResponseAsync(teamName, reviewId, contentType, videoFrameBody, addVideoFrameUrlOptionalParameter).toBlocking().single().body(); }
[ "public", "void", "addVideoFrameUrl", "(", "String", "teamName", ",", "String", "reviewId", ",", "String", "contentType", ",", "List", "<", "VideoFrameBodyItem", ">", "videoFrameBody", ",", "AddVideoFrameUrlOptionalParameter", "addVideoFrameUrlOptionalParameter", ")", "{", "addVideoFrameUrlWithServiceResponseAsync", "(", "teamName", ",", "reviewId", ",", "contentType", ",", "videoFrameBody", ",", "addVideoFrameUrlOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Use this method to add frames for a video review.Timescale: This parameter is a factor which is used to convert the timestamp on a frame into milliseconds. Timescale is provided in the output of the Content Moderator video media processor on the Azure Media Services platform.Timescale in the Video Moderation output is Ticks/Second. @param teamName Your team name. @param reviewId Id of the review. @param contentType The content type. @param videoFrameBody Body for add video frames API @param addVideoFrameUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Use", "this", "method", "to", "add", "frames", "for", "a", "video", "review", ".", "Timescale", ":", "This", "parameter", "is", "a", "factor", "which", "is", "used", "to", "convert", "the", "timestamp", "on", "a", "frame", "into", "milliseconds", ".", "Timescale", "is", "provided", "in", "the", "output", "of", "the", "Content", "Moderator", "video", "media", "processor", "on", "the", "Azure", "Media", "Services", "platform", ".", "Timescale", "in", "the", "Video", "Moderation", "output", "is", "Ticks", "/", "Second", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L2181-L2183
zeromq/jeromq
src/main/java/org/zeromq/ZProxy.java
ZProxy.newZProxy
@Deprecated public static ZProxy newZProxy(ZContext ctx, String name, SelectorCreator selector, Proxy sockets, String motdelafin, Object... args) { return newZProxy(ctx, name, sockets, motdelafin, args); }
java
@Deprecated public static ZProxy newZProxy(ZContext ctx, String name, SelectorCreator selector, Proxy sockets, String motdelafin, Object... args) { return newZProxy(ctx, name, sockets, motdelafin, args); }
[ "@", "Deprecated", "public", "static", "ZProxy", "newZProxy", "(", "ZContext", "ctx", ",", "String", "name", ",", "SelectorCreator", "selector", ",", "Proxy", "sockets", ",", "String", "motdelafin", ",", "Object", "...", "args", ")", "{", "return", "newZProxy", "(", "ctx", ",", "name", ",", "sockets", ",", "motdelafin", ",", "args", ")", ";", "}" ]
Creates a new proxy in a ZeroMQ way. This proxy will be less efficient than the {@link #newZProxy(ZContext, String, org.zeromq.ZProxy.Proxy, String, Object...) low-level one}. @param ctx the context used for the proxy. Possibly null, in this case a new context will be created and automatically destroyed afterwards. @param name the name of the proxy. Possibly null. @param selector the creator of the selector used for the internal polling. Not null. @param sockets the sockets creator of the proxy. Not null. @param motdelafin the final word used to mark the end of the proxy. Null to disable this mechanism. @param args an optional array of arguments that will be passed at the creation. @return the created proxy. @deprecated use {@link #newZProxy(ZContext, String, Proxy, String, Object...)} instead.
[ "Creates", "a", "new", "proxy", "in", "a", "ZeroMQ", "way", ".", "This", "proxy", "will", "be", "less", "efficient", "than", "the", "{", "@link", "#newZProxy", "(", "ZContext", "String", "org", ".", "zeromq", ".", "ZProxy", ".", "Proxy", "String", "Object", "...", ")", "low", "-", "level", "one", "}", "." ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZProxy.java#L239-L244
knowm/Yank
src/main/java/org/knowm/yank/Yank.java
Yank.queryColumnSQLKey
public static <T> List<T> queryColumnSQLKey( String poolName, String sqlKey, String columnName, Class<T> columnType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return queryColumn(poolName, sql, columnName, columnType, params); } }
java
public static <T> List<T> queryColumnSQLKey( String poolName, String sqlKey, String columnName, Class<T> columnType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return queryColumn(poolName, sql, columnName, columnType, params); } }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "queryColumnSQLKey", "(", "String", "poolName", ",", "String", "sqlKey", ",", "String", "columnName", ",", "Class", "<", "T", ">", "columnType", ",", "Object", "[", "]", "params", ")", "throws", "SQLStatementNotFoundException", ",", "YankSQLException", "{", "String", "sql", "=", "YANK_POOL_MANAGER", ".", "getMergedSqlProperties", "(", ")", ".", "getProperty", "(", "sqlKey", ")", ";", "if", "(", "sql", "==", "null", "||", "sql", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "throw", "new", "SQLStatementNotFoundException", "(", ")", ";", "}", "else", "{", "return", "queryColumn", "(", "poolName", ",", "sql", ",", "columnName", ",", "columnType", ",", "params", ")", ";", "}", "}" ]
Return a List of Objects from a single table column given a SQL Key using an SQL statement matching the sqlKey String in a properties file loaded via Yank.addSQLStatements(...). @param poolName The name of the connection pool to query against @param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement value @param params The replacement parameters @param columnType The Class of the desired return Objects matching the table @return The Column as a List @throws SQLStatementNotFoundException if an SQL statement could not be found for the given sqlKey String
[ "Return", "a", "List", "of", "Objects", "from", "a", "single", "table", "column", "given", "a", "SQL", "Key", "using", "an", "SQL", "statement", "matching", "the", "sqlKey", "String", "in", "a", "properties", "file", "loaded", "via", "Yank", ".", "addSQLStatements", "(", "...", ")", "." ]
train
https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L543-L553
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java
Helpers.encloseWithKey
public static String encloseWithKey(String key, Selector selector) { return String.format("{%s}", withKey(key, selector)); }
java
public static String encloseWithKey(String key, Selector selector) { return String.format("{%s}", withKey(key, selector)); }
[ "public", "static", "String", "encloseWithKey", "(", "String", "key", ",", "Selector", "selector", ")", "{", "return", "String", ".", "format", "(", "\"{%s}\"", ",", "withKey", "(", "key", ",", "selector", ")", ")", ";", "}" ]
<P> Returns the string form of a JSON object with the specified key mapping to a JSON object enclosing the selector. </P> <pre> {@code Selector selector = eq("year", 2017); System.out.println(selector.toString()); // Output: "year": {"$eq" : 2017} System.out.println(SelectorUtils.encloseWithKey("selector", selector)); // Output: {"selector": {"year": {"$eq": 2017}}} } </pre> @param key key to use for the selector (usually "selector" or "partial_filter_selector") @param selector the selector to enclose @return the string form of the selector enclosed in a JSON object with the specified key
[ "<P", ">", "Returns", "the", "string", "form", "of", "a", "JSON", "object", "with", "the", "specified", "key", "mapping", "to", "a", "JSON", "object", "enclosing", "the", "selector", ".", "<", "/", "P", ">", "<pre", ">", "{", "@code", "Selector", "selector", "=", "eq", "(", "year", "2017", ")", ";", "System", ".", "out", ".", "println", "(", "selector", ".", "toString", "()", ")", ";", "//", "Output", ":", "year", ":", "{", "$eq", ":", "2017", "}", "System", ".", "out", ".", "println", "(", "SelectorUtils", ".", "encloseWithKey", "(", "selector", "selector", "))", ";", "//", "Output", ":", "{", "selector", ":", "{", "year", ":", "{", "$eq", ":", "2017", "}}}", "}", "<", "/", "pre", ">" ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/query/Helpers.java#L167-L169
abel533/EasyXls
src/main/java/com/github/abel533/easyxls/common/XlsUtil.java
XlsUtil.list2Xls
public static boolean list2Xls(List<?> list, String xmlPath, OutputStream outputStream) throws Exception { try { ExcelConfig config = getEasyExcel(xmlPath); return list2Xls(config, list, outputStream); } catch (Exception e1) { return false; } }
java
public static boolean list2Xls(List<?> list, String xmlPath, OutputStream outputStream) throws Exception { try { ExcelConfig config = getEasyExcel(xmlPath); return list2Xls(config, list, outputStream); } catch (Exception e1) { return false; } }
[ "public", "static", "boolean", "list2Xls", "(", "List", "<", "?", ">", "list", ",", "String", "xmlPath", ",", "OutputStream", "outputStream", ")", "throws", "Exception", "{", "try", "{", "ExcelConfig", "config", "=", "getEasyExcel", "(", "xmlPath", ")", ";", "return", "list2Xls", "(", "config", ",", "list", ",", "outputStream", ")", ";", "}", "catch", "(", "Exception", "e1", ")", "{", "return", "false", ";", "}", "}" ]
导出list对象到excel @param list 导出的list @param xmlPath xml完整路径 @param outputStream 输出流 @return 处理结果,true成功,false失败 @throws Exception
[ "导出list对象到excel" ]
train
https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/common/XlsUtil.java#L338-L345
fengwenyi/JavaLib
bak/HttpsClientUtil.java
HttpsClientUtil.doPost
public static String doPost(String url, Map<String, String> header, String param) throws KeyManagementException, NoSuchAlgorithmException, IOException { String result = null; HttpClient httpClient = new SSLClient(); httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, Constant.DEFAULT_CONN_TIMEOUT); httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, Constant.DEFAULT_READ_TIMEOUT); HttpPost httpPost = new HttpPost(url); Iterator iterator; if (header != null) { Set<String> keys = header.keySet(); iterator = keys.iterator(); while(iterator.hasNext()) { String key = (String)iterator.next(); httpPost.setHeader(key, header.get(key)); } } httpPost.setEntity(new StringEntity(param, Constant.DEFAULT_CHARSET)); HttpResponse response = httpClient.execute(httpPost); if (response != null) { HttpEntity resEntity = response.getEntity(); if (resEntity != null) { result = EntityUtils.toString(resEntity, Constant.DEFAULT_CHARSET); } } return result; }
java
public static String doPost(String url, Map<String, String> header, String param) throws KeyManagementException, NoSuchAlgorithmException, IOException { String result = null; HttpClient httpClient = new SSLClient(); httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, Constant.DEFAULT_CONN_TIMEOUT); httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, Constant.DEFAULT_READ_TIMEOUT); HttpPost httpPost = new HttpPost(url); Iterator iterator; if (header != null) { Set<String> keys = header.keySet(); iterator = keys.iterator(); while(iterator.hasNext()) { String key = (String)iterator.next(); httpPost.setHeader(key, header.get(key)); } } httpPost.setEntity(new StringEntity(param, Constant.DEFAULT_CHARSET)); HttpResponse response = httpClient.execute(httpPost); if (response != null) { HttpEntity resEntity = response.getEntity(); if (resEntity != null) { result = EntityUtils.toString(resEntity, Constant.DEFAULT_CHARSET); } } return result; }
[ "public", "static", "String", "doPost", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "header", ",", "String", "param", ")", "throws", "KeyManagementException", ",", "NoSuchAlgorithmException", ",", "IOException", "{", "String", "result", "=", "null", ";", "HttpClient", "httpClient", "=", "new", "SSLClient", "(", ")", ";", "httpClient", ".", "getParams", "(", ")", ".", "setParameter", "(", "CoreConnectionPNames", ".", "CONNECTION_TIMEOUT", ",", "Constant", ".", "DEFAULT_CONN_TIMEOUT", ")", ";", "httpClient", ".", "getParams", "(", ")", ".", "setParameter", "(", "CoreConnectionPNames", ".", "SO_TIMEOUT", ",", "Constant", ".", "DEFAULT_READ_TIMEOUT", ")", ";", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "url", ")", ";", "Iterator", "iterator", ";", "if", "(", "header", "!=", "null", ")", "{", "Set", "<", "String", ">", "keys", "=", "header", ".", "keySet", "(", ")", ";", "iterator", "=", "keys", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "String", "key", "=", "(", "String", ")", "iterator", ".", "next", "(", ")", ";", "httpPost", ".", "setHeader", "(", "key", ",", "header", ".", "get", "(", "key", ")", ")", ";", "}", "}", "httpPost", ".", "setEntity", "(", "new", "StringEntity", "(", "param", ",", "Constant", ".", "DEFAULT_CHARSET", ")", ")", ";", "HttpResponse", "response", "=", "httpClient", ".", "execute", "(", "httpPost", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "HttpEntity", "resEntity", "=", "response", ".", "getEntity", "(", ")", ";", "if", "(", "resEntity", "!=", "null", ")", "{", "result", "=", "EntityUtils", ".", "toString", "(", "resEntity", ",", "Constant", ".", "DEFAULT_CHARSET", ")", ";", "}", "}", "return", "result", ";", "}" ]
POST方式向Http(s)提交数据并获取返回结果 @param url URL @param header Header @param param 参数(String) @return 服务器数据 @throws KeyManagementException [ellipsis] @throws NoSuchAlgorithmException [ellipsis] @throws IOException [ellipsis]
[ "POST方式向Http", "(", "s", ")", "提交数据并获取返回结果" ]
train
https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/bak/HttpsClientUtil.java#L91-L122
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getImplementation
public static final <T> T getImplementation(ClassLoader loader, Class<T> type, Class<?>[] paramsType, Collection<?> paramsValue, String className) { try { if (!CLASS_CACHE.containsKey(className)) { final Class<?> clazz = loader.loadClass(className); CLASS_CACHE.put(className, clazz); } final Class<?> clazz = CLASS_CACHE.get(className); final Constructor<?> constructor = UtilReflection.getCompatibleConstructor(clazz, paramsType); UtilReflection.setAccessible(constructor, true); return type.cast(constructor.newInstance(paramsValue.toArray())); } catch (final InstantiationException | IllegalArgumentException | InvocationTargetException exception) { throw new LionEngineException(exception, ERROR_CLASS_INSTANCE + className); } catch (final NoSuchMethodException | IllegalAccessException exception) { throw new LionEngineException(exception, ERROR_CLASS_CONSTRUCTOR + className); } catch (final ClassNotFoundException exception) { throw new LionEngineException(exception, ERROR_CLASS_PRESENCE + className); } }
java
public static final <T> T getImplementation(ClassLoader loader, Class<T> type, Class<?>[] paramsType, Collection<?> paramsValue, String className) { try { if (!CLASS_CACHE.containsKey(className)) { final Class<?> clazz = loader.loadClass(className); CLASS_CACHE.put(className, clazz); } final Class<?> clazz = CLASS_CACHE.get(className); final Constructor<?> constructor = UtilReflection.getCompatibleConstructor(clazz, paramsType); UtilReflection.setAccessible(constructor, true); return type.cast(constructor.newInstance(paramsValue.toArray())); } catch (final InstantiationException | IllegalArgumentException | InvocationTargetException exception) { throw new LionEngineException(exception, ERROR_CLASS_INSTANCE + className); } catch (final NoSuchMethodException | IllegalAccessException exception) { throw new LionEngineException(exception, ERROR_CLASS_CONSTRUCTOR + className); } catch (final ClassNotFoundException exception) { throw new LionEngineException(exception, ERROR_CLASS_PRESENCE + className); } }
[ "public", "static", "final", "<", "T", ">", "T", "getImplementation", "(", "ClassLoader", "loader", ",", "Class", "<", "T", ">", "type", ",", "Class", "<", "?", ">", "[", "]", "paramsType", ",", "Collection", "<", "?", ">", "paramsValue", ",", "String", "className", ")", "{", "try", "{", "if", "(", "!", "CLASS_CACHE", ".", "containsKey", "(", "className", ")", ")", "{", "final", "Class", "<", "?", ">", "clazz", "=", "loader", ".", "loadClass", "(", "className", ")", ";", "CLASS_CACHE", ".", "put", "(", "className", ",", "clazz", ")", ";", "}", "final", "Class", "<", "?", ">", "clazz", "=", "CLASS_CACHE", ".", "get", "(", "className", ")", ";", "final", "Constructor", "<", "?", ">", "constructor", "=", "UtilReflection", ".", "getCompatibleConstructor", "(", "clazz", ",", "paramsType", ")", ";", "UtilReflection", ".", "setAccessible", "(", "constructor", ",", "true", ")", ";", "return", "type", ".", "cast", "(", "constructor", ".", "newInstance", "(", "paramsValue", ".", "toArray", "(", ")", ")", ")", ";", "}", "catch", "(", "final", "InstantiationException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "exception", ")", "{", "throw", "new", "LionEngineException", "(", "exception", ",", "ERROR_CLASS_INSTANCE", "+", "className", ")", ";", "}", "catch", "(", "final", "NoSuchMethodException", "|", "IllegalAccessException", "exception", ")", "{", "throw", "new", "LionEngineException", "(", "exception", ",", "ERROR_CLASS_CONSTRUCTOR", "+", "className", ")", ";", "}", "catch", "(", "final", "ClassNotFoundException", "exception", ")", "{", "throw", "new", "LionEngineException", "(", "exception", ",", "ERROR_CLASS_PRESENCE", "+", "className", ")", ";", "}", "}" ]
Get the class implementation from its name by using a custom constructor. @param <T> The instance type. @param loader The class loader to use. @param type The class type. @param paramsType The parameters type. @param paramsValue The parameters value. @param className The class name. @return The typed class instance. @throws LionEngineException If invalid class.
[ "Get", "the", "class", "implementation", "from", "its", "name", "by", "using", "a", "custom", "constructor", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L387-L418
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/util/V1Util.java
V1Util.copyStream
public static void copyStream(Reader input, Writer output, int buffersize) throws IOException, IllegalArgumentException { if (buffersize < 1) { throw new IllegalArgumentException( "buffersize must be greater than 0"); } char[] buffer = new char[buffersize]; int n; while ((n = input.read(buffer)) >= 0) { output.write(buffer, 0, n); } }
java
public static void copyStream(Reader input, Writer output, int buffersize) throws IOException, IllegalArgumentException { if (buffersize < 1) { throw new IllegalArgumentException( "buffersize must be greater than 0"); } char[] buffer = new char[buffersize]; int n; while ((n = input.read(buffer)) >= 0) { output.write(buffer, 0, n); } }
[ "public", "static", "void", "copyStream", "(", "Reader", "input", ",", "Writer", "output", ",", "int", "buffersize", ")", "throws", "IOException", ",", "IllegalArgumentException", "{", "if", "(", "buffersize", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"buffersize must be greater than 0\"", ")", ";", "}", "char", "[", "]", "buffer", "=", "new", "char", "[", "buffersize", "]", ";", "int", "n", ";", "while", "(", "(", "n", "=", "input", ".", "read", "(", "buffer", ")", ")", ">=", "0", ")", "{", "output", ".", "write", "(", "buffer", ",", "0", ",", "n", ")", ";", "}", "}" ]
Coping data(character type) from {@code input} reader to {@code output} writer. @param input input source of data. @param output destination of data. @param buffersize size of buffer with is using for data copy. @throws IOException if any errors occur during copying process. @throws IllegalArgumentException if {@code buffersize} less then 1.
[ "Coping", "data", "(", "character", "type", ")", "from", "{", "@code", "input", "}", "reader", "to", "{", "@code", "output", "}", "writer", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/util/V1Util.java#L65-L76
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java
ByteArrayUtil.readUnsignedShort
public static int readUnsignedShort(byte[] array, int offset) { // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; return ((b0 << 8) + (b1 << 0)); }
java
public static int readUnsignedShort(byte[] array, int offset) { // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; return ((b0 << 8) + (b1 << 0)); }
[ "public", "static", "int", "readUnsignedShort", "(", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "// First make integers to resolve signed vs. unsigned issues.", "int", "b0", "=", "array", "[", "offset", "+", "0", "]", "&", "0xFF", ";", "int", "b1", "=", "array", "[", "offset", "+", "1", "]", "&", "0xFF", ";", "return", "(", "(", "b0", "<<", "8", ")", "+", "(", "b1", "<<", "0", ")", ")", ";", "}" ]
Read an unsigned short from the byte array at the given offset. @param array Array to read from @param offset Offset to read at @return short
[ "Read", "an", "unsigned", "short", "from", "the", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L193-L198
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java
UserDataHelpers.readUserData
public static Properties readUserData( String rawProperties, File outputDirectory ) throws IOException { Properties result = new Properties(); StringReader reader = new StringReader( rawProperties ); result.load( reader ); return processUserData( result, outputDirectory ); }
java
public static Properties readUserData( String rawProperties, File outputDirectory ) throws IOException { Properties result = new Properties(); StringReader reader = new StringReader( rawProperties ); result.load( reader ); return processUserData( result, outputDirectory ); }
[ "public", "static", "Properties", "readUserData", "(", "String", "rawProperties", ",", "File", "outputDirectory", ")", "throws", "IOException", "{", "Properties", "result", "=", "new", "Properties", "(", ")", ";", "StringReader", "reader", "=", "new", "StringReader", "(", "rawProperties", ")", ";", "result", ".", "load", "(", "reader", ")", ";", "return", "processUserData", "(", "result", ",", "outputDirectory", ")", ";", "}" ]
Reads user data from a string and processes with with #{@link UserDataHelpers#processUserData(Properties, File)}. @param rawProperties the user data as a string @param outputDirectory a directory into which files should be written <p> If null, files sent with {@link #ENCODE_FILE_CONTENT_PREFIX} will not be written. </p> @return a non-null object @throws IOException if something went wrong
[ "Reads", "user", "data", "from", "a", "string", "and", "processes", "with", "with", "#", "{", "@link", "UserDataHelpers#processUserData", "(", "Properties", "File", ")", "}", ".", "@param", "rawProperties", "the", "user", "data", "as", "a", "string", "@param", "outputDirectory", "a", "directory", "into", "which", "files", "should", "be", "written", "<p", ">", "If", "null", "files", "sent", "with", "{", "@link", "#ENCODE_FILE_CONTENT_PREFIX", "}", "will", "not", "be", "written", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/userdata/UserDataHelpers.java#L166-L173
r0adkll/Slidr
library/src/main/java/com/r0adkll/slidr/util/ViewDragHelper.java
ViewDragHelper.smoothSlideViewTo
public boolean smoothSlideViewTo(View child, int finalLeft, int finalTop) { mCapturedView = child; mActivePointerId = INVALID_POINTER; boolean continueSliding = forceSettleCapturedViewAt(finalLeft, finalTop, 0, 0); if (!continueSliding && mDragState == STATE_IDLE && mCapturedView != null) { // If we're in an IDLE state to begin with and aren't moving anywhere, we // end up having a non-null capturedView with an IDLE dragState mCapturedView = null; } return continueSliding; }
java
public boolean smoothSlideViewTo(View child, int finalLeft, int finalTop) { mCapturedView = child; mActivePointerId = INVALID_POINTER; boolean continueSliding = forceSettleCapturedViewAt(finalLeft, finalTop, 0, 0); if (!continueSliding && mDragState == STATE_IDLE && mCapturedView != null) { // If we're in an IDLE state to begin with and aren't moving anywhere, we // end up having a non-null capturedView with an IDLE dragState mCapturedView = null; } return continueSliding; }
[ "public", "boolean", "smoothSlideViewTo", "(", "View", "child", ",", "int", "finalLeft", ",", "int", "finalTop", ")", "{", "mCapturedView", "=", "child", ";", "mActivePointerId", "=", "INVALID_POINTER", ";", "boolean", "continueSliding", "=", "forceSettleCapturedViewAt", "(", "finalLeft", ",", "finalTop", ",", "0", ",", "0", ")", ";", "if", "(", "!", "continueSliding", "&&", "mDragState", "==", "STATE_IDLE", "&&", "mCapturedView", "!=", "null", ")", "{", "// If we're in an IDLE state to begin with and aren't moving anywhere, we", "// end up having a non-null capturedView with an IDLE dragState", "mCapturedView", "=", "null", ";", "}", "return", "continueSliding", ";", "}" ]
Animate the view <code>child</code> to the given (left, top) position. If this method returns true, the caller should invoke {@link #continueSettling(boolean)} on each subsequent frame to continue the motion until it returns false. If this method returns false there is no further work to do to complete the movement. <p> <p>This operation does not count as a capture event, though {@link #getCapturedView()} will still report the sliding view while the slide is in progress.</p> @param child Child view to capture and animate @param finalLeft Final left position of child @param finalTop Final top position of child @return true if animation should continue through {@link #continueSettling(boolean)} calls
[ "Animate", "the", "view", "<code", ">", "child<", "/", "code", ">", "to", "the", "given", "(", "left", "top", ")", "position", ".", "If", "this", "method", "returns", "true", "the", "caller", "should", "invoke", "{", "@link", "#continueSettling", "(", "boolean", ")", "}", "on", "each", "subsequent", "frame", "to", "continue", "the", "motion", "until", "it", "returns", "false", ".", "If", "this", "method", "returns", "false", "there", "is", "no", "further", "work", "to", "do", "to", "complete", "the", "movement", ".", "<p", ">", "<p", ">", "This", "operation", "does", "not", "count", "as", "a", "capture", "event", "though", "{", "@link", "#getCapturedView", "()", "}", "will", "still", "report", "the", "sliding", "view", "while", "the", "slide", "is", "in", "progress", ".", "<", "/", "p", ">" ]
train
https://github.com/r0adkll/Slidr/blob/737db115eb68435764648fbd905b1dea4b52f039/library/src/main/java/com/r0adkll/slidr/util/ViewDragHelper.java#L501-L511
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.setColumn
public void setColumn(int j, double value) { VectorIterator it = iteratorOfColumn(j); while (it.hasNext()) { it.next(); it.set(value); } }
java
public void setColumn(int j, double value) { VectorIterator it = iteratorOfColumn(j); while (it.hasNext()) { it.next(); it.set(value); } }
[ "public", "void", "setColumn", "(", "int", "j", ",", "double", "value", ")", "{", "VectorIterator", "it", "=", "iteratorOfColumn", "(", "j", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "it", ".", "next", "(", ")", ";", "it", ".", "set", "(", "value", ")", ";", "}", "}" ]
<p> Sets all elements of the specified column of this matrix to given {@code value}. </p> @param j the column index @param value the element's new value
[ "<p", ">", "Sets", "all", "elements", "of", "the", "specified", "column", "of", "this", "matrix", "to", "given", "{", "@code", "value", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L458-L465
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/MetricReportReporter.java
MetricReportReporter.serializeGauge
protected List<Metric> serializeGauge(String name, Gauge gauge) { List<Metric> metrics = Lists.newArrayList(); try { metrics.add(new Metric(name, Double.parseDouble(gauge.getValue().toString()))); } catch(NumberFormatException exception) { LOGGER.info("Failed to serialize gauge metric. Not compatible with double value.", exception); } return metrics; }
java
protected List<Metric> serializeGauge(String name, Gauge gauge) { List<Metric> metrics = Lists.newArrayList(); try { metrics.add(new Metric(name, Double.parseDouble(gauge.getValue().toString()))); } catch(NumberFormatException exception) { LOGGER.info("Failed to serialize gauge metric. Not compatible with double value.", exception); } return metrics; }
[ "protected", "List", "<", "Metric", ">", "serializeGauge", "(", "String", "name", ",", "Gauge", "gauge", ")", "{", "List", "<", "Metric", ">", "metrics", "=", "Lists", ".", "newArrayList", "(", ")", ";", "try", "{", "metrics", ".", "add", "(", "new", "Metric", "(", "name", ",", "Double", ".", "parseDouble", "(", "gauge", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "exception", ")", "{", "LOGGER", ".", "info", "(", "\"Failed to serialize gauge metric. Not compatible with double value.\"", ",", "exception", ")", ";", "}", "return", "metrics", ";", "}" ]
Extracts metrics from {@link com.codahale.metrics.Gauge}. @param name name of the {@link com.codahale.metrics.Gauge}. @param gauge instance of {@link com.codahale.metrics.Gauge} to serialize. @return a list of {@link org.apache.gobblin.metrics.Metric}.
[ "Extracts", "metrics", "from", "{", "@link", "com", ".", "codahale", ".", "metrics", ".", "Gauge", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/MetricReportReporter.java#L161-L169
molgenis/molgenis
molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java
DataServiceTokenService.generateAndStoreToken
@Override @Transactional @RunAsSystem public String generateAndStoreToken(String username, String description) { User user = dataService.query(USER, User.class).eq(USERNAME, username).findOne(); if (user == null) { throw new IllegalArgumentException(format("Unknown username [%s]", username)); } String token = tokenGenerator.generateToken(); Token molgenisToken = tokenFactory.create(); molgenisToken.setUser(user); molgenisToken.setToken(token); molgenisToken.setDescription(description); molgenisToken.setExpirationDate(now().plus(2, HOURS)); dataService.add(TOKEN, molgenisToken); return token; }
java
@Override @Transactional @RunAsSystem public String generateAndStoreToken(String username, String description) { User user = dataService.query(USER, User.class).eq(USERNAME, username).findOne(); if (user == null) { throw new IllegalArgumentException(format("Unknown username [%s]", username)); } String token = tokenGenerator.generateToken(); Token molgenisToken = tokenFactory.create(); molgenisToken.setUser(user); molgenisToken.setToken(token); molgenisToken.setDescription(description); molgenisToken.setExpirationDate(now().plus(2, HOURS)); dataService.add(TOKEN, molgenisToken); return token; }
[ "@", "Override", "@", "Transactional", "@", "RunAsSystem", "public", "String", "generateAndStoreToken", "(", "String", "username", ",", "String", "description", ")", "{", "User", "user", "=", "dataService", ".", "query", "(", "USER", ",", "User", ".", "class", ")", ".", "eq", "(", "USERNAME", ",", "username", ")", ".", "findOne", "(", ")", ";", "if", "(", "user", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Unknown username [%s]\"", ",", "username", ")", ")", ";", "}", "String", "token", "=", "tokenGenerator", ".", "generateToken", "(", ")", ";", "Token", "molgenisToken", "=", "tokenFactory", ".", "create", "(", ")", ";", "molgenisToken", ".", "setUser", "(", "user", ")", ";", "molgenisToken", ".", "setToken", "(", "token", ")", ";", "molgenisToken", ".", "setDescription", "(", "description", ")", ";", "molgenisToken", ".", "setExpirationDate", "(", "now", "(", ")", ".", "plus", "(", "2", ",", "HOURS", ")", ")", ";", "dataService", ".", "add", "(", "TOKEN", ",", "molgenisToken", ")", ";", "return", "token", ";", "}" ]
Generates a token and associates it with a user. <p>Token expires in 2 hours @param username username @param description token description @return token
[ "Generates", "a", "token", "and", "associates", "it", "with", "a", "user", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java#L64-L83
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/query/impl/getters/SuffixModifierUtils.java
SuffixModifierUtils.getModifierSuffix
public static String getModifierSuffix(String fullName, String baseName) { if (fullName.equals(baseName)) { return null; } int indexOfOpeningBracket = fullName.indexOf(MODIFIER_OPENING_TOKEN); return fullName.substring(indexOfOpeningBracket, fullName.length()); }
java
public static String getModifierSuffix(String fullName, String baseName) { if (fullName.equals(baseName)) { return null; } int indexOfOpeningBracket = fullName.indexOf(MODIFIER_OPENING_TOKEN); return fullName.substring(indexOfOpeningBracket, fullName.length()); }
[ "public", "static", "String", "getModifierSuffix", "(", "String", "fullName", ",", "String", "baseName", ")", "{", "if", "(", "fullName", ".", "equals", "(", "baseName", ")", ")", "{", "return", "null", ";", "}", "int", "indexOfOpeningBracket", "=", "fullName", ".", "indexOf", "(", "MODIFIER_OPENING_TOKEN", ")", ";", "return", "fullName", ".", "substring", "(", "indexOfOpeningBracket", ",", "fullName", ".", "length", "(", ")", ")", ";", "}" ]
Get modifier suffix if fullName contains any otherwise returns null. In contains no validation of input parameters as it assumes the validation has been already done by {@link #removeModifierSuffix(String)} @param fullName @param baseName as returned by {@link #removeModifierSuffix(String)} @return modifier suffix or null if no suffix is present
[ "Get", "modifier", "suffix", "if", "fullName", "contains", "any", "otherwise", "returns", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/getters/SuffixModifierUtils.java#L74-L80
FINRAOS/DataGenerator
dg-core/src/main/java/org/finra/datagenerator/writer/JsonWriter.java
JsonWriter.getJsonFormatted
public JSONObject getJsonFormatted(Map<String, String> dataMap) { JSONObject oneRowJson = new JSONObject(); for (int i = 0; i < outTemplate.length; i++) { oneRowJson.put(outTemplate[i], dataMap.get(outTemplate[i])); } return oneRowJson; }
java
public JSONObject getJsonFormatted(Map<String, String> dataMap) { JSONObject oneRowJson = new JSONObject(); for (int i = 0; i < outTemplate.length; i++) { oneRowJson.put(outTemplate[i], dataMap.get(outTemplate[i])); } return oneRowJson; }
[ "public", "JSONObject", "getJsonFormatted", "(", "Map", "<", "String", ",", "String", ">", "dataMap", ")", "{", "JSONObject", "oneRowJson", "=", "new", "JSONObject", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "outTemplate", ".", "length", ";", "i", "++", ")", "{", "oneRowJson", ".", "put", "(", "outTemplate", "[", "i", "]", ",", "dataMap", ".", "get", "(", "outTemplate", "[", "i", "]", ")", ")", ";", "}", "return", "oneRowJson", ";", "}" ]
Given an array of variable names, returns a JsonObject of values. @param dataMap an map containing variable names and their corresponding values names. @return a json object of values
[ "Given", "an", "array", "of", "variable", "names", "returns", "a", "JsonObject", "of", "values", "." ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/writer/JsonWriter.java#L80-L89
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.pearsonCorrelation
public static double pearsonCorrelation(double[] x, double[] y) { double result; double sum_sq_x = 0, sum_sq_y = 0; double mean_x = x[0], mean_y = y[0]; double sum_coproduct = 0; for(int i=2; i<x.length+1;++i) { double w = (i - 1)*1.0/i; double delta_x = x[i-1] - mean_x; double delta_y = y[i-1] - mean_y; sum_sq_x += delta_x * delta_x*w; sum_sq_y += delta_y * delta_y*w; sum_coproduct += delta_x * delta_y*w; mean_x += delta_x / i; mean_y += delta_y / i; } double pop_sd_x = Math.sqrt(sum_sq_x/x.length); double pop_sd_y = Math.sqrt(sum_sq_y/y.length); double cov_x_y = sum_coproduct / x.length; double denom = pop_sd_x*pop_sd_y; if(denom == 0.0) return 0.0; result = cov_x_y/denom; return result; }
java
public static double pearsonCorrelation(double[] x, double[] y) { double result; double sum_sq_x = 0, sum_sq_y = 0; double mean_x = x[0], mean_y = y[0]; double sum_coproduct = 0; for(int i=2; i<x.length+1;++i) { double w = (i - 1)*1.0/i; double delta_x = x[i-1] - mean_x; double delta_y = y[i-1] - mean_y; sum_sq_x += delta_x * delta_x*w; sum_sq_y += delta_y * delta_y*w; sum_coproduct += delta_x * delta_y*w; mean_x += delta_x / i; mean_y += delta_y / i; } double pop_sd_x = Math.sqrt(sum_sq_x/x.length); double pop_sd_y = Math.sqrt(sum_sq_y/y.length); double cov_x_y = sum_coproduct / x.length; double denom = pop_sd_x*pop_sd_y; if(denom == 0.0) return 0.0; result = cov_x_y/denom; return result; }
[ "public", "static", "double", "pearsonCorrelation", "(", "double", "[", "]", "x", ",", "double", "[", "]", "y", ")", "{", "double", "result", ";", "double", "sum_sq_x", "=", "0", ",", "sum_sq_y", "=", "0", ";", "double", "mean_x", "=", "x", "[", "0", "]", ",", "mean_y", "=", "y", "[", "0", "]", ";", "double", "sum_coproduct", "=", "0", ";", "for", "(", "int", "i", "=", "2", ";", "i", "<", "x", ".", "length", "+", "1", ";", "++", "i", ")", "{", "double", "w", "=", "(", "i", "-", "1", ")", "*", "1.0", "/", "i", ";", "double", "delta_x", "=", "x", "[", "i", "-", "1", "]", "-", "mean_x", ";", "double", "delta_y", "=", "y", "[", "i", "-", "1", "]", "-", "mean_y", ";", "sum_sq_x", "+=", "delta_x", "*", "delta_x", "*", "w", ";", "sum_sq_y", "+=", "delta_y", "*", "delta_y", "*", "w", ";", "sum_coproduct", "+=", "delta_x", "*", "delta_y", "*", "w", ";", "mean_x", "+=", "delta_x", "/", "i", ";", "mean_y", "+=", "delta_y", "/", "i", ";", "}", "double", "pop_sd_x", "=", "Math", ".", "sqrt", "(", "sum_sq_x", "/", "x", ".", "length", ")", ";", "double", "pop_sd_y", "=", "Math", ".", "sqrt", "(", "sum_sq_y", "/", "y", ".", "length", ")", ";", "double", "cov_x_y", "=", "sum_coproduct", "/", "x", ".", "length", ";", "double", "denom", "=", "pop_sd_x", "*", "pop_sd_y", ";", "if", "(", "denom", "==", "0.0", ")", "return", "0.0", ";", "result", "=", "cov_x_y", "/", "denom", ";", "return", "result", ";", "}" ]
Direct computation of Pearson product-moment correlation coefficient. Note that if x and y are involved in several computations of pearsonCorrelation, it is perhaps more advisable to first standardize x and y, then compute innerProduct(x,y)/(x.length-1).
[ "Direct", "computation", "of", "Pearson", "product", "-", "moment", "correlation", "coefficient", ".", "Note", "that", "if", "x", "and", "y", "are", "involved", "in", "several", "computations", "of", "pearsonCorrelation", "it", "is", "perhaps", "more", "advisable", "to", "first", "standardize", "x", "and", "y", "then", "compute", "innerProduct", "(", "x", "y", ")", "/", "(", "x", ".", "length", "-", "1", ")", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1450-L1473
pravega/pravega
controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java
TransactionMetrics.createTransactionFailed
public void createTransactionFailed(String scope, String streamName) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION_FAILED, 1, streamTags(scope, streamName)); }
java
public void createTransactionFailed(String scope, String streamName) { DYNAMIC_LOGGER.incCounterValue(globalMetricName(CREATE_TRANSACTION_FAILED), 1); DYNAMIC_LOGGER.incCounterValue(CREATE_TRANSACTION_FAILED, 1, streamTags(scope, streamName)); }
[ "public", "void", "createTransactionFailed", "(", "String", "scope", ",", "String", "streamName", ")", "{", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "globalMetricName", "(", "CREATE_TRANSACTION_FAILED", ")", ",", "1", ")", ";", "DYNAMIC_LOGGER", ".", "incCounterValue", "(", "CREATE_TRANSACTION_FAILED", ",", "1", ",", "streamTags", "(", "scope", ",", "streamName", ")", ")", ";", "}" ]
This method increments the global and Stream-related counters of failed Transaction create operations. @param scope Scope. @param streamName Name of the Stream.
[ "This", "method", "increments", "the", "global", "and", "Stream", "-", "related", "counters", "of", "failed", "Transaction", "create", "operations", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L58-L61
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckSingleton
public static Singleton getAndCheckSingleton(EntityDataModel entityDataModel, String singletonName) { Singleton singleton = entityDataModel.getEntityContainer().getSingleton(singletonName); if (singleton == null) { throw new ODataSystemException("Singleton not found in the entity data model: " + singletonName); } return singleton; }
java
public static Singleton getAndCheckSingleton(EntityDataModel entityDataModel, String singletonName) { Singleton singleton = entityDataModel.getEntityContainer().getSingleton(singletonName); if (singleton == null) { throw new ODataSystemException("Singleton not found in the entity data model: " + singletonName); } return singleton; }
[ "public", "static", "Singleton", "getAndCheckSingleton", "(", "EntityDataModel", "entityDataModel", ",", "String", "singletonName", ")", "{", "Singleton", "singleton", "=", "entityDataModel", ".", "getEntityContainer", "(", ")", ".", "getSingleton", "(", "singletonName", ")", ";", "if", "(", "singleton", "==", "null", ")", "{", "throw", "new", "ODataSystemException", "(", "\"Singleton not found in the entity data model: \"", "+", "singletonName", ")", ";", "}", "return", "singleton", ";", "}" ]
Gets the singleton with the specified name, throws an exception if no singleton with the specified name exists. @param entityDataModel The entity data model. @param singletonName The name of the singleton. @return The singleton. @throws ODataSystemException If the entity data model does not contain a singleton with the specified name.
[ "Gets", "the", "singleton", "with", "the", "specified", "name", "throws", "an", "exception", "if", "no", "singleton", "with", "the", "specified", "name", "exists", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L582-L588
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java
Checksum.getChecksum
public static String getChecksum(String algorithm, byte[] bytes) { final MessageDigest digest = getMessageDigest(algorithm); final byte[] b = digest.digest(bytes); return getHex(b); }
java
public static String getChecksum(String algorithm, byte[] bytes) { final MessageDigest digest = getMessageDigest(algorithm); final byte[] b = digest.digest(bytes); return getHex(b); }
[ "public", "static", "String", "getChecksum", "(", "String", "algorithm", ",", "byte", "[", "]", "bytes", ")", "{", "final", "MessageDigest", "digest", "=", "getMessageDigest", "(", "algorithm", ")", ";", "final", "byte", "[", "]", "b", "=", "digest", ".", "digest", "(", "bytes", ")", ";", "return", "getHex", "(", "b", ")", ";", "}" ]
Calculates the MD5 checksum of a specified bytes. @param algorithm the algorithm to use (md5, sha1, etc.) to calculate the message digest @param bytes the bytes to generate the MD5 checksum @return the hex representation of the MD5 hash
[ "Calculates", "the", "MD5", "checksum", "of", "a", "specified", "bytes", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Checksum.java#L146-L150
Sciss/abc4j
abc/src/main/java/abc/parser/AbcGrammar.java
AbcGrammar.BracketedVoice
Rule BracketedVoice() { return Sequence('[', ZeroOrMore(WSP()), FirstOf(SingleVoice(), BracedVoice(), ParenVoice()), OneOrMore(Sequence(BarStaves(), FirstOf(SingleVoice(), BracedVoice(), ParenVoice()))), ZeroOrMore(WSP()), ']') .label(BracketedVoice); }
java
Rule BracketedVoice() { return Sequence('[', ZeroOrMore(WSP()), FirstOf(SingleVoice(), BracedVoice(), ParenVoice()), OneOrMore(Sequence(BarStaves(), FirstOf(SingleVoice(), BracedVoice(), ParenVoice()))), ZeroOrMore(WSP()), ']') .label(BracketedVoice); }
[ "Rule", "BracketedVoice", "(", ")", "{", "return", "Sequence", "(", "'", "'", ",", "ZeroOrMore", "(", "WSP", "(", ")", ")", ",", "FirstOf", "(", "SingleVoice", "(", ")", ",", "BracedVoice", "(", ")", ",", "ParenVoice", "(", ")", ")", ",", "OneOrMore", "(", "Sequence", "(", "BarStaves", "(", ")", ",", "FirstOf", "(", "SingleVoice", "(", ")", ",", "BracedVoice", "(", ")", ",", "ParenVoice", "(", ")", ")", ")", ")", ",", "ZeroOrMore", "(", "WSP", "(", ")", ")", ",", "'", "'", ")", ".", "label", "(", "BracketedVoice", ")", ";", "}" ]
bracketed-voice ::= "[" *WSP (single-voice / braced-voice / paren-voice) 1*(bar-staves (single-voice / braced-voice / paren-voice)) *WSP "]" <p> staves joined by bracket
[ "bracketed", "-", "voice", "::", "=", "[", "*", "WSP", "(", "single", "-", "voice", "/", "braced", "-", "voice", "/", "paren", "-", "voice", ")", "1", "*", "(", "bar", "-", "staves", "(", "single", "-", "voice", "/", "braced", "-", "voice", "/", "paren", "-", "voice", "))", "*", "WSP", "]", "<p", ">", "staves", "joined", "by", "bracket" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2113-L2121
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/api/core/data/CqlDuration.java
CqlDuration.from
public static CqlDuration from(@NonNull String input) { boolean isNegative = input.startsWith("-"); String source = isNegative ? input.substring(1) : input; if (source.startsWith("P")) { if (source.endsWith("W")) { return parseIso8601WeekFormat(isNegative, source); } if (source.contains("-")) { return parseIso8601AlternativeFormat(isNegative, source); } return parseIso8601Format(isNegative, source); } return parseStandardFormat(isNegative, source); }
java
public static CqlDuration from(@NonNull String input) { boolean isNegative = input.startsWith("-"); String source = isNegative ? input.substring(1) : input; if (source.startsWith("P")) { if (source.endsWith("W")) { return parseIso8601WeekFormat(isNegative, source); } if (source.contains("-")) { return parseIso8601AlternativeFormat(isNegative, source); } return parseIso8601Format(isNegative, source); } return parseStandardFormat(isNegative, source); }
[ "public", "static", "CqlDuration", "from", "(", "@", "NonNull", "String", "input", ")", "{", "boolean", "isNegative", "=", "input", ".", "startsWith", "(", "\"-\"", ")", ";", "String", "source", "=", "isNegative", "?", "input", ".", "substring", "(", "1", ")", ":", "input", ";", "if", "(", "source", ".", "startsWith", "(", "\"P\"", ")", ")", "{", "if", "(", "source", ".", "endsWith", "(", "\"W\"", ")", ")", "{", "return", "parseIso8601WeekFormat", "(", "isNegative", ",", "source", ")", ";", "}", "if", "(", "source", ".", "contains", "(", "\"-\"", ")", ")", "{", "return", "parseIso8601AlternativeFormat", "(", "isNegative", ",", "source", ")", ";", "}", "return", "parseIso8601Format", "(", "isNegative", ",", "source", ")", ";", "}", "return", "parseStandardFormat", "(", "isNegative", ",", "source", ")", ";", "}" ]
Converts a <code>String</code> into a duration. <p>The accepted formats are: <ul> <li>multiple digits followed by a time unit like: 12h30m where the time unit can be: <ul> <li>{@code y}: years <li>{@code m}: months <li>{@code w}: weeks <li>{@code d}: days <li>{@code h}: hours <li>{@code m}: minutes <li>{@code s}: seconds <li>{@code ms}: milliseconds <li>{@code us} or {@code µs}: microseconds <li>{@code ns}: nanoseconds </ul> <li>ISO 8601 format: P[n]Y[n]M[n]DT[n]H[n]M[n]S or P[n]W <li>ISO 8601 alternative format: P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss] </ul> @param input the <code>String</code> to convert
[ "Converts", "a", "<code", ">", "String<", "/", "code", ">", "into", "a", "duration", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/data/CqlDuration.java#L134-L148
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.notEmpty
public <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (chars.length() == 0) { fail(String.format(message, values)); } return chars; }
java
public <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (chars.length() == 0) { fail(String.format(message, values)); } return chars; }
[ "public", "<", "T", "extends", "CharSequence", ">", "T", "notEmpty", "(", "final", "T", "chars", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "chars", "==", "null", ")", "{", "failNull", "(", "String", ".", "format", "(", "message", ",", "values", ")", ")", ";", "}", "if", "(", "chars", ".", "length", "(", ")", "==", "0", ")", "{", "fail", "(", "String", ".", "format", "(", "message", ",", "values", ")", ")", ";", "}", "return", "chars", ";", "}" ]
<p>Validate that the specified argument character sequence is neither {@code null} nor a length of zero (no characters); otherwise throwing an exception with the specified message. </p> <pre>Validate.notEmpty(myString, "The string must not be empty");</pre> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated character sequence (never {@code null} method for chaining) @throws NullPointerValidationException if the character sequence is {@code null} @throws IllegalArgumentException if the character sequence is empty @see #notEmpty(CharSequence)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "is", "neither", "{", "@code", "null", "}", "nor", "a", "length", "of", "zero", "(", "no", "characters", ")", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", "notEmpty", "(", "myString", "The", "string", "must", "not", "be", "empty", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L719-L727
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java
FoxHttpRequestBuilder.registerFoxHttpInterceptor
public FoxHttpRequestBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException { foxHttpRequest.getFoxHttpClient().register(interceptorType, foxHttpInterceptor); return this; }
java
public FoxHttpRequestBuilder registerFoxHttpInterceptor(FoxHttpInterceptorType interceptorType, FoxHttpInterceptor foxHttpInterceptor) throws FoxHttpException { foxHttpRequest.getFoxHttpClient().register(interceptorType, foxHttpInterceptor); return this; }
[ "public", "FoxHttpRequestBuilder", "registerFoxHttpInterceptor", "(", "FoxHttpInterceptorType", "interceptorType", ",", "FoxHttpInterceptor", "foxHttpInterceptor", ")", "throws", "FoxHttpException", "{", "foxHttpRequest", ".", "getFoxHttpClient", "(", ")", ".", "register", "(", "interceptorType", ",", "foxHttpInterceptor", ")", ";", "return", "this", ";", "}" ]
Register an interceptor @param interceptorType Type of the interceptor @param foxHttpInterceptor Interceptor instance @return FoxHttpClientBuilder (this) @throws FoxHttpException Throws an exception if the interceptor does not match the type
[ "Register", "an", "interceptor" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpRequestBuilder.java#L239-L242
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/DomUtils.java
DomUtils.getAttributeValue
static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; } else { return attribute.getValue(); } }
java
static String getAttributeValue(Element element, String name) { Attr attribute = element.getAttributeNode(name); if (attribute == null) { return null; } else { return attribute.getValue(); } }
[ "static", "String", "getAttributeValue", "(", "Element", "element", ",", "String", "name", ")", "{", "Attr", "attribute", "=", "element", ".", "getAttributeNode", "(", "name", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "attribute", ".", "getValue", "(", ")", ";", "}", "}" ]
<p>Retutns the value of the named attribute of the given element. If there is no such attribute, returns null.</p> @param element element @param name name @return value
[ "<p", ">", "Retutns", "the", "value", "of", "the", "named", "attribute", "of", "the", "given", "element", ".", "If", "there", "is", "no", "such", "attribute", "returns", "null", ".", "<", "/", "p", ">" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/DomUtils.java#L185-L192
knowm/XChange
xchange-bitso/src/main/java/org/knowm/xchange/bitso/service/BitsoAccountService.java
BitsoAccountService.requestDepositAddress
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { final BitsoDepositAddress response = getBitsoBitcoinDepositAddress(); return response.getDepositAddress(); }
java
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { final BitsoDepositAddress response = getBitsoBitcoinDepositAddress(); return response.getDepositAddress(); }
[ "@", "Override", "public", "String", "requestDepositAddress", "(", "Currency", "currency", ",", "String", "...", "arguments", ")", "throws", "IOException", "{", "final", "BitsoDepositAddress", "response", "=", "getBitsoBitcoinDepositAddress", "(", ")", ";", "return", "response", ".", "getDepositAddress", "(", ")", ";", "}" ]
This returns the currently set deposit address. It will not generate a new address (ie. repeated calls will return the same address).
[ "This", "returns", "the", "currently", "set", "deposit", "address", ".", "It", "will", "not", "generate", "a", "new", "address", "(", "ie", ".", "repeated", "calls", "will", "return", "the", "same", "address", ")", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitso/src/main/java/org/knowm/xchange/bitso/service/BitsoAccountService.java#L53-L58
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_dsRecord_GET
public ArrayList<Long> serviceName_dsRecord_GET(String serviceName, OvhKeyFlagEnum flags, OvhKeyStatusEnum status) throws IOException { String qPath = "/domain/{serviceName}/dsRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "flags", flags); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<Long> serviceName_dsRecord_GET(String serviceName, OvhKeyFlagEnum flags, OvhKeyStatusEnum status) throws IOException { String qPath = "/domain/{serviceName}/dsRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "flags", flags); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_dsRecord_GET", "(", "String", "serviceName", ",", "OvhKeyFlagEnum", "flags", ",", "OvhKeyStatusEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/dsRecord\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"flags\"", ",", "flags", ")", ";", "query", "(", "sb", ",", "\"status\"", ",", "status", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
List of domain's DS Records REST: GET /domain/{serviceName}/dsRecord @param status [required] Filter the value of status property (=) @param flags [required] Filter the value of flags property (=) @param serviceName [required] The internal name of your domain
[ "List", "of", "domain", "s", "DS", "Records" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1420-L1427
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java
StructureDiagramGenerator.countAlignedBonds
private static int countAlignedBonds(IAtomContainer mol) { final double ref = Math.toRadians(30); final double diff = Math.toRadians(1); int count = 0; for (IBond bond : mol.bonds()) { Point2d beg = bond.getBegin().getPoint2d(); Point2d end = bond.getEnd().getPoint2d(); if (beg.x > end.x) { Point2d tmp = beg; beg = end; end = tmp; } Vector2d vec = new Vector2d(end.x - beg.x, end.y - beg.y); double angle = Math.atan2(vec.y, vec.x); if (Math.abs(angle) - ref < diff) { count++; } } return count; }
java
private static int countAlignedBonds(IAtomContainer mol) { final double ref = Math.toRadians(30); final double diff = Math.toRadians(1); int count = 0; for (IBond bond : mol.bonds()) { Point2d beg = bond.getBegin().getPoint2d(); Point2d end = bond.getEnd().getPoint2d(); if (beg.x > end.x) { Point2d tmp = beg; beg = end; end = tmp; } Vector2d vec = new Vector2d(end.x - beg.x, end.y - beg.y); double angle = Math.atan2(vec.y, vec.x); if (Math.abs(angle) - ref < diff) { count++; } } return count; }
[ "private", "static", "int", "countAlignedBonds", "(", "IAtomContainer", "mol", ")", "{", "final", "double", "ref", "=", "Math", ".", "toRadians", "(", "30", ")", ";", "final", "double", "diff", "=", "Math", ".", "toRadians", "(", "1", ")", ";", "int", "count", "=", "0", ";", "for", "(", "IBond", "bond", ":", "mol", ".", "bonds", "(", ")", ")", "{", "Point2d", "beg", "=", "bond", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ";", "Point2d", "end", "=", "bond", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ";", "if", "(", "beg", ".", "x", ">", "end", ".", "x", ")", "{", "Point2d", "tmp", "=", "beg", ";", "beg", "=", "end", ";", "end", "=", "tmp", ";", "}", "Vector2d", "vec", "=", "new", "Vector2d", "(", "end", ".", "x", "-", "beg", ".", "x", ",", "end", ".", "y", "-", "beg", ".", "y", ")", ";", "double", "angle", "=", "Math", ".", "atan2", "(", "vec", ".", "y", ",", "vec", ".", "x", ")", ";", "if", "(", "Math", ".", "abs", "(", "angle", ")", "-", "ref", "<", "diff", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
Count the number of bonds aligned to 30 degrees. @param mol molecule @return number of aligned bonds
[ "Count", "the", "number", "of", "bonds", "aligned", "to", "30", "degrees", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java#L1010-L1030
Hygieia/Hygieia
collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/DefaultJiraClient.java
DefaultJiraClient.processEpicData
protected static void processEpicData(Feature feature, Epic epic) { feature.setsEpicID(epic.getId()); feature.setsEpicIsDeleted("false"); feature.setsEpicName(epic.getName()); feature.setsEpicNumber(epic.getNumber()); feature.setsEpicType(""); feature.setsEpicAssetState(epic.getStatus()); feature.setsEpicBeginDate(epic.getBeginDate()); feature.setsEpicChangeDate(epic.getChangeDate()); feature.setsEpicEndDate(epic.getEndDate()); feature.setsEpicUrl(epic.getUrl()); }
java
protected static void processEpicData(Feature feature, Epic epic) { feature.setsEpicID(epic.getId()); feature.setsEpicIsDeleted("false"); feature.setsEpicName(epic.getName()); feature.setsEpicNumber(epic.getNumber()); feature.setsEpicType(""); feature.setsEpicAssetState(epic.getStatus()); feature.setsEpicBeginDate(epic.getBeginDate()); feature.setsEpicChangeDate(epic.getChangeDate()); feature.setsEpicEndDate(epic.getEndDate()); feature.setsEpicUrl(epic.getUrl()); }
[ "protected", "static", "void", "processEpicData", "(", "Feature", "feature", ",", "Epic", "epic", ")", "{", "feature", ".", "setsEpicID", "(", "epic", ".", "getId", "(", ")", ")", ";", "feature", ".", "setsEpicIsDeleted", "(", "\"false\"", ")", ";", "feature", ".", "setsEpicName", "(", "epic", ".", "getName", "(", ")", ")", ";", "feature", ".", "setsEpicNumber", "(", "epic", ".", "getNumber", "(", ")", ")", ";", "feature", ".", "setsEpicType", "(", "\"\"", ")", ";", "feature", ".", "setsEpicAssetState", "(", "epic", ".", "getStatus", "(", ")", ")", ";", "feature", ".", "setsEpicBeginDate", "(", "epic", ".", "getBeginDate", "(", ")", ")", ";", "feature", ".", "setsEpicChangeDate", "(", "epic", ".", "getChangeDate", "(", ")", ")", ";", "feature", ".", "setsEpicEndDate", "(", "epic", ".", "getEndDate", "(", ")", ")", ";", "feature", ".", "setsEpicUrl", "(", "epic", ".", "getUrl", "(", ")", ")", ";", "}" ]
Process Epic data for a feature, updating the passed in feature @param feature @param epic
[ "Process", "Epic", "data", "for", "a", "feature", "updating", "the", "passed", "in", "feature" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/jira/src/main/java/com/capitalone/dashboard/collector/DefaultJiraClient.java#L538-L549
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.toleranceDistance
public static double toleranceDistance(int zoom, int pixels) { double tileSize = tileSizeWithZoom(zoom); double tolerance = tileSize / pixels; return tolerance; }
java
public static double toleranceDistance(int zoom, int pixels) { double tileSize = tileSizeWithZoom(zoom); double tolerance = tileSize / pixels; return tolerance; }
[ "public", "static", "double", "toleranceDistance", "(", "int", "zoom", ",", "int", "pixels", ")", "{", "double", "tileSize", "=", "tileSizeWithZoom", "(", "zoom", ")", ";", "double", "tolerance", "=", "tileSize", "/", "pixels", ";", "return", "tolerance", ";", "}" ]
Get the tolerance distance in meters for the zoom level and pixels length @param zoom zoom level @param pixels pixel length @return tolerance distance in meters @since 2.0.0
[ "Get", "the", "tolerance", "distance", "in", "meters", "for", "the", "zoom", "level", "and", "pixels", "length" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L735-L739
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java
PackageSummaryBuilder.buildErrorSummary
public void buildErrorSummary(XMLNode node, Content summaryContentTree) { String errorTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Error_Summary"), configuration.getText("doclet.errors")); List<String> errorTableHeader = Arrays.asList(configuration.getText("doclet.Error"), configuration.getText("doclet.Description")); Set<TypeElement> ierrors = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getErrors(packageElement)) : configuration.typeElementCatalog.errors(packageElement); SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, configuration.javafx); if (!errors.isEmpty()) { packageWriter.addClassesSummary(errors, configuration.getText("doclet.Error_Summary"), errorTableSummary, errorTableHeader, summaryContentTree); } }
java
public void buildErrorSummary(XMLNode node, Content summaryContentTree) { String errorTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Error_Summary"), configuration.getText("doclet.errors")); List<String> errorTableHeader = Arrays.asList(configuration.getText("doclet.Error"), configuration.getText("doclet.Description")); Set<TypeElement> ierrors = utils.isSpecified(packageElement) ? utils.getTypeElementsAsSortedSet(utils.getErrors(packageElement)) : configuration.typeElementCatalog.errors(packageElement); SortedSet<TypeElement> errors = utils.filterOutPrivateClasses(ierrors, configuration.javafx); if (!errors.isEmpty()) { packageWriter.addClassesSummary(errors, configuration.getText("doclet.Error_Summary"), errorTableSummary, errorTableHeader, summaryContentTree); } }
[ "public", "void", "buildErrorSummary", "(", "XMLNode", "node", ",", "Content", "summaryContentTree", ")", "{", "String", "errorTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Error_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.errors\"", ")", ")", ";", "List", "<", "String", ">", "errorTableHeader", "=", "Arrays", ".", "asList", "(", "configuration", ".", "getText", "(", "\"doclet.Error\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.Description\"", ")", ")", ";", "Set", "<", "TypeElement", ">", "ierrors", "=", "utils", ".", "isSpecified", "(", "packageElement", ")", "?", "utils", ".", "getTypeElementsAsSortedSet", "(", "utils", ".", "getErrors", "(", "packageElement", ")", ")", ":", "configuration", ".", "typeElementCatalog", ".", "errors", "(", "packageElement", ")", ";", "SortedSet", "<", "TypeElement", ">", "errors", "=", "utils", ".", "filterOutPrivateClasses", "(", "ierrors", ",", "configuration", ".", "javafx", ")", ";", "if", "(", "!", "errors", ".", "isEmpty", "(", ")", ")", "{", "packageWriter", ".", "addClassesSummary", "(", "errors", ",", "configuration", ".", "getText", "(", "\"doclet.Error_Summary\"", ")", ",", "errorTableSummary", ",", "errorTableHeader", ",", "summaryContentTree", ")", ";", "}", "}" ]
Build the summary for the errors in this package. @param node the XML element that specifies which components to document @param summaryContentTree the summary tree to which the error summary will be added
[ "Build", "the", "summary", "for", "the", "errors", "in", "this", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L279-L296
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java
AccountOperations.listNodeAgentSkus
public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException { return listNodeAgentSkus(detailLevel, null); }
java
public PagedList<NodeAgentSku> listNodeAgentSkus(DetailLevel detailLevel) throws BatchErrorException, IOException { return listNodeAgentSkus(detailLevel, null); }
[ "public", "PagedList", "<", "NodeAgentSku", ">", "listNodeAgentSkus", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listNodeAgentSkus", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the node agent SKU values supported by the Batch service. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link NodeAgentSku} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "node", "agent", "SKU", "values", "supported", "by", "the", "Batch", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/AccountOperations.java#L73-L75
JavaMoney/jsr354-api
src/main/java/javax/money/convert/MonetaryConversions.java
MonetaryConversions.getConversion
public static CurrencyConversion getConversion(CurrencyUnit termCurrency, String... providers){ Objects.requireNonNull(providers); Objects.requireNonNull(termCurrency); if(providers.length == 0){ return getMonetaryConversionsSpi().getConversion( ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(getDefaultConversionProviderChain()) .build()); } return getMonetaryConversionsSpi().getConversion( ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build()); }
java
public static CurrencyConversion getConversion(CurrencyUnit termCurrency, String... providers){ Objects.requireNonNull(providers); Objects.requireNonNull(termCurrency); if(providers.length == 0){ return getMonetaryConversionsSpi().getConversion( ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(getDefaultConversionProviderChain()) .build()); } return getMonetaryConversionsSpi().getConversion( ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build()); }
[ "public", "static", "CurrencyConversion", "getConversion", "(", "CurrencyUnit", "termCurrency", ",", "String", "...", "providers", ")", "{", "Objects", ".", "requireNonNull", "(", "providers", ")", ";", "Objects", ".", "requireNonNull", "(", "termCurrency", ")", ";", "if", "(", "providers", ".", "length", "==", "0", ")", "{", "return", "getMonetaryConversionsSpi", "(", ")", ".", "getConversion", "(", "ConversionQueryBuilder", ".", "of", "(", ")", ".", "setTermCurrency", "(", "termCurrency", ")", ".", "setProviderNames", "(", "getDefaultConversionProviderChain", "(", ")", ")", ".", "build", "(", ")", ")", ";", "}", "return", "getMonetaryConversionsSpi", "(", ")", ".", "getConversion", "(", "ConversionQueryBuilder", ".", "of", "(", ")", ".", "setTermCurrency", "(", "termCurrency", ")", ".", "setProviderNames", "(", "providers", ")", ".", "build", "(", ")", ")", ";", "}" ]
Access an instance of {@link CurrencyConversion} for the given providers. Use {@link #getConversionProviderNames()} to check, which are available. @param termCurrency the terminating or target currency, not {@code null} @param providers Additional providers, for building a provider chain @return the exchange rate type if this instance. @throws IllegalArgumentException if no such {@link ExchangeRateProvider} is available.
[ "Access", "an", "instance", "of", "{", "@link", "CurrencyConversion", "}", "for", "the", "given", "providers", ".", "Use", "{", "@link", "#getConversionProviderNames", "()", "}", "to", "check", "which", "are", "available", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/MonetaryConversions.java#L87-L97
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_record_POST
public OvhRecord zone_zoneName_record_POST(String zoneName, OvhNamedResolutionFieldTypeEnum fieldType, String subDomain, String target, Long ttl) throws IOException { String qPath = "/domain/zone/{zoneName}/record"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "fieldType", fieldType); addBody(o, "subDomain", subDomain); addBody(o, "target", target); addBody(o, "ttl", ttl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRecord.class); }
java
public OvhRecord zone_zoneName_record_POST(String zoneName, OvhNamedResolutionFieldTypeEnum fieldType, String subDomain, String target, Long ttl) throws IOException { String qPath = "/domain/zone/{zoneName}/record"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "fieldType", fieldType); addBody(o, "subDomain", subDomain); addBody(o, "target", target); addBody(o, "ttl", ttl); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRecord.class); }
[ "public", "OvhRecord", "zone_zoneName_record_POST", "(", "String", "zoneName", ",", "OvhNamedResolutionFieldTypeEnum", "fieldType", ",", "String", "subDomain", ",", "String", "target", ",", "Long", "ttl", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/record\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zoneName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"fieldType\"", ",", "fieldType", ")", ";", "addBody", "(", "o", ",", "\"subDomain\"", ",", "subDomain", ")", ";", "addBody", "(", "o", ",", "\"target\"", ",", "target", ")", ";", "addBody", "(", "o", ",", "\"ttl\"", ",", "ttl", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhRecord", ".", "class", ")", ";", "}" ]
Create a new DNS record (Don't forget to refresh the zone) REST: POST /domain/zone/{zoneName}/record @param target [required] Resource record target @param fieldType [required] Resource record Name @param subDomain [required] Resource record subdomain @param ttl [required] Resource record ttl @param zoneName [required] The internal name of your zone
[ "Create", "a", "new", "DNS", "record", "(", "Don", "t", "forget", "to", "refresh", "the", "zone", ")" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L949-L959
kennycason/kumo
kumo-core/src/main/java/com/kennycason/kumo/WordCloud.java
WordCloud.writeToStream
public void writeToStream(final String format, final OutputStream outputStream) { try { LOGGER.debug("Writing WordCloud image data to output stream"); ImageIO.write(bufferedImage, format, outputStream); LOGGER.debug("Done writing WordCloud image data to output stream"); } catch (final IOException e) { LOGGER.error(e.getMessage(), e); throw new KumoException("Could not write wordcloud to outputstream due to an IOException", e); } }
java
public void writeToStream(final String format, final OutputStream outputStream) { try { LOGGER.debug("Writing WordCloud image data to output stream"); ImageIO.write(bufferedImage, format, outputStream); LOGGER.debug("Done writing WordCloud image data to output stream"); } catch (final IOException e) { LOGGER.error(e.getMessage(), e); throw new KumoException("Could not write wordcloud to outputstream due to an IOException", e); } }
[ "public", "void", "writeToStream", "(", "final", "String", "format", ",", "final", "OutputStream", "outputStream", ")", "{", "try", "{", "LOGGER", ".", "debug", "(", "\"Writing WordCloud image data to output stream\"", ")", ";", "ImageIO", ".", "write", "(", "bufferedImage", ",", "format", ",", "outputStream", ")", ";", "LOGGER", ".", "debug", "(", "\"Done writing WordCloud image data to output stream\"", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "throw", "new", "KumoException", "(", "\"Could not write wordcloud to outputstream due to an IOException\"", ",", "e", ")", ";", "}", "}" ]
Write wordcloud image data to stream in the given format @param format the image format @param outputStream the output stream to write image data to
[ "Write", "wordcloud", "image", "data", "to", "stream", "in", "the", "given", "format" ]
train
https://github.com/kennycason/kumo/blob/bc577f468f162dbaf61c327a2d4f1989c61c57a0/kumo-core/src/main/java/com/kennycason/kumo/WordCloud.java#L131-L141
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addIntent
public UUID addIntent(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) { return addIntentWithServiceResponseAsync(appId, versionId, addIntentOptionalParameter).toBlocking().single().body(); }
java
public UUID addIntent(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) { return addIntentWithServiceResponseAsync(appId, versionId, addIntentOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "addIntent", "(", "UUID", "appId", ",", "String", "versionId", ",", "AddIntentOptionalParameter", "addIntentOptionalParameter", ")", "{", "return", "addIntentWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "addIntentOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Adds an intent classifier to the application. @param appId The application ID. @param versionId The version ID. @param addIntentOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Adds", "an", "intent", "classifier", "to", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L583-L585
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java
EndpointUtils.getDiscoveryServiceUrls
public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) { boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls(); if (shouldUseDns) { return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer); } return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka()); }
java
public static List<String> getDiscoveryServiceUrls(EurekaClientConfig clientConfig, String zone, ServiceUrlRandomizer randomizer) { boolean shouldUseDns = clientConfig.shouldUseDnsForFetchingServiceUrls(); if (shouldUseDns) { return getServiceUrlsFromDNS(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka(), randomizer); } return getServiceUrlsFromConfig(clientConfig, zone, clientConfig.shouldPreferSameZoneEureka()); }
[ "public", "static", "List", "<", "String", ">", "getDiscoveryServiceUrls", "(", "EurekaClientConfig", "clientConfig", ",", "String", "zone", ",", "ServiceUrlRandomizer", "randomizer", ")", "{", "boolean", "shouldUseDns", "=", "clientConfig", ".", "shouldUseDnsForFetchingServiceUrls", "(", ")", ";", "if", "(", "shouldUseDns", ")", "{", "return", "getServiceUrlsFromDNS", "(", "clientConfig", ",", "zone", ",", "clientConfig", ".", "shouldPreferSameZoneEureka", "(", ")", ",", "randomizer", ")", ";", "}", "return", "getServiceUrlsFromConfig", "(", "clientConfig", ",", "zone", ",", "clientConfig", ".", "shouldPreferSameZoneEureka", "(", ")", ")", ";", "}" ]
Get the list of all eureka service urls for the eureka client to talk to. @param clientConfig the clientConfig to use @param zone the zone in which the client resides @param randomizer a randomizer to randomized returned urls, if loading from dns @return The list of all eureka service urls for the eureka client to talk to.
[ "Get", "the", "list", "of", "all", "eureka", "service", "urls", "for", "the", "eureka", "client", "to", "talk", "to", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/endpoint/EndpointUtils.java#L74-L80
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gt
public PropertyConstraint gt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue)); }
java
public PropertyConstraint gt(String propertyName, Comparable propertyValue) { return new ParameterizedPropertyConstraint(propertyName, gt(propertyValue)); }
[ "public", "PropertyConstraint", "gt", "(", "String", "propertyName", ",", "Comparable", "propertyValue", ")", "{", "return", "new", "ParameterizedPropertyConstraint", "(", "propertyName", ",", "gt", "(", "propertyValue", ")", ")", ";", "}" ]
Apply a "greater than" constraint to a bean property. @param propertyName The first property @param propertyValue The constraint value @return The constraint
[ "Apply", "a", "greater", "than", "constraint", "to", "a", "bean", "property", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L691-L693
mpetazzoni/ttorrent
common/src/main/java/com/turn/ttorrent/common/TorrentCreator.java
TorrentCreator.hashFile
private static String hashFile(final File file, final int pieceSize) throws InterruptedException, IOException { return hashFiles(Collections.singletonList(file), pieceSize); }
java
private static String hashFile(final File file, final int pieceSize) throws InterruptedException, IOException { return hashFiles(Collections.singletonList(file), pieceSize); }
[ "private", "static", "String", "hashFile", "(", "final", "File", "file", ",", "final", "int", "pieceSize", ")", "throws", "InterruptedException", ",", "IOException", "{", "return", "hashFiles", "(", "Collections", ".", "singletonList", "(", "file", ")", ",", "pieceSize", ")", ";", "}" ]
Return the concatenation of the SHA-1 hashes of a file's pieces. <p> Hashes the given file piece by piece using the default Torrent piece length (see {@link #DEFAULT_PIECE_LENGTH}) and returns the concatenation of these hashes, as a string. </p> <p> This is used for creating Torrent meta-info structures from a file. </p> @param file The file to hash.
[ "Return", "the", "concatenation", "of", "the", "SHA", "-", "1", "hashes", "of", "a", "file", "s", "pieces", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/common/src/main/java/com/turn/ttorrent/common/TorrentCreator.java#L252-L255
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/AbstractPlanNode.java
AbstractPlanNode.isOutputOrdered
public boolean isOutputOrdered (List<AbstractExpression> sortExpressions, List<SortDirectionType> sortDirections) { assert(sortExpressions.size() == sortDirections.size()); if (m_children.size() == 1) { return m_children.get(0).isOutputOrdered(sortExpressions, sortDirections); } return false; }
java
public boolean isOutputOrdered (List<AbstractExpression> sortExpressions, List<SortDirectionType> sortDirections) { assert(sortExpressions.size() == sortDirections.size()); if (m_children.size() == 1) { return m_children.get(0).isOutputOrdered(sortExpressions, sortDirections); } return false; }
[ "public", "boolean", "isOutputOrdered", "(", "List", "<", "AbstractExpression", ">", "sortExpressions", ",", "List", "<", "SortDirectionType", ">", "sortDirections", ")", "{", "assert", "(", "sortExpressions", ".", "size", "(", ")", "==", "sortDirections", ".", "size", "(", ")", ")", ";", "if", "(", "m_children", ".", "size", "(", ")", "==", "1", ")", "{", "return", "m_children", ".", "get", "(", "0", ")", ".", "isOutputOrdered", "(", "sortExpressions", ",", "sortDirections", ")", ";", "}", "return", "false", ";", "}" ]
Does the plan guarantee a result sorted according to the required sort order. The default implementation delegates the question to its child if there is only one child. @param sortExpressions list of ordering columns expressions @param sortDirections list of corresponding sort orders @return TRUE if the node's output table is ordered. FALSE otherwise
[ "Does", "the", "plan", "guarantee", "a", "result", "sorted", "according", "to", "the", "required", "sort", "order", ".", "The", "default", "implementation", "delegates", "the", "question", "to", "its", "child", "if", "there", "is", "only", "one", "child", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/AbstractPlanNode.java#L385-L391
Impetus/Kundera
src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java
DefaultCouchbaseDataHandler.iterateAndPopulateJsonObject
private JsonObject iterateAndPopulateJsonObject(Object entity, Iterator<Attribute> iterator, String tableName) { JsonObject obj = JsonObject.create(); while (iterator.hasNext()) { Attribute attribute = iterator.next(); Field field = (Field) attribute.getJavaMember(); Object value = PropertyAccessorHelper.getObject(entity, field); obj.put(((AbstractAttribute) attribute).getJPAColumnName(), value); } obj.put(CouchbaseConstants.KUNDERA_ENTITY, tableName); return obj; }
java
private JsonObject iterateAndPopulateJsonObject(Object entity, Iterator<Attribute> iterator, String tableName) { JsonObject obj = JsonObject.create(); while (iterator.hasNext()) { Attribute attribute = iterator.next(); Field field = (Field) attribute.getJavaMember(); Object value = PropertyAccessorHelper.getObject(entity, field); obj.put(((AbstractAttribute) attribute).getJPAColumnName(), value); } obj.put(CouchbaseConstants.KUNDERA_ENTITY, tableName); return obj; }
[ "private", "JsonObject", "iterateAndPopulateJsonObject", "(", "Object", "entity", ",", "Iterator", "<", "Attribute", ">", "iterator", ",", "String", "tableName", ")", "{", "JsonObject", "obj", "=", "JsonObject", ".", "create", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Attribute", "attribute", "=", "iterator", ".", "next", "(", ")", ";", "Field", "field", "=", "(", "Field", ")", "attribute", ".", "getJavaMember", "(", ")", ";", "Object", "value", "=", "PropertyAccessorHelper", ".", "getObject", "(", "entity", ",", "field", ")", ";", "obj", ".", "put", "(", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getJPAColumnName", "(", ")", ",", "value", ")", ";", "}", "obj", ".", "put", "(", "CouchbaseConstants", ".", "KUNDERA_ENTITY", ",", "tableName", ")", ";", "return", "obj", ";", "}" ]
Iterate and populate json object. @param entity the entity @param iterator the iterator @return the json object
[ "Iterate", "and", "populate", "json", "object", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/DefaultCouchbaseDataHandler.java#L108-L121
stickfigure/batchfb
src/main/java/com/googlecode/batchfb/impl/ErrorDetectingWrapper.java
ErrorDetectingWrapper.throwPageMigratedException
private void throwPageMigratedException(String msg, int code, int subcode, String userTitle, String userMsg) { // This SUCKS ASS. Messages look like: // (#21) Page ID 114267748588304 was migrated to page ID 111013272313096. Please update your API calls to the new ID Matcher matcher = ID_PATTERN.matcher(msg); long oldId = this.extractNextId(matcher, msg); long newId = this.extractNextId(matcher, msg); throw new PageMigratedException(msg, code, subcode, userTitle, userMsg, oldId, newId); }
java
private void throwPageMigratedException(String msg, int code, int subcode, String userTitle, String userMsg) { // This SUCKS ASS. Messages look like: // (#21) Page ID 114267748588304 was migrated to page ID 111013272313096. Please update your API calls to the new ID Matcher matcher = ID_PATTERN.matcher(msg); long oldId = this.extractNextId(matcher, msg); long newId = this.extractNextId(matcher, msg); throw new PageMigratedException(msg, code, subcode, userTitle, userMsg, oldId, newId); }
[ "private", "void", "throwPageMigratedException", "(", "String", "msg", ",", "int", "code", ",", "int", "subcode", ",", "String", "userTitle", ",", "String", "userMsg", ")", "{", "// This SUCKS ASS. Messages look like:\r", "// (#21) Page ID 114267748588304 was migrated to page ID 111013272313096. Please update your API calls to the new ID\r", "Matcher", "matcher", "=", "ID_PATTERN", ".", "matcher", "(", "msg", ")", ";", "long", "oldId", "=", "this", ".", "extractNextId", "(", "matcher", ",", "msg", ")", ";", "long", "newId", "=", "this", ".", "extractNextId", "(", "matcher", ",", "msg", ")", ";", "throw", "new", "PageMigratedException", "(", "msg", ",", "code", ",", "subcode", ",", "userTitle", ",", "userMsg", ",", "oldId", ",", "newId", ")", ";", "}" ]
Builds the proper exception and throws it. @throws PageMigratedException always
[ "Builds", "the", "proper", "exception", "and", "throws", "it", "." ]
train
https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/impl/ErrorDetectingWrapper.java#L138-L148
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/controller/AbstractPropertyEditor.java
AbstractPropertyEditor.checkRestrictions
protected void checkRestrictions(R value, D bean) { Integer max = this.maxCardinalities.get(value.getClass()); if (max != null) { if (max == 0) { throw new IllegalBioPAXArgumentException("Cardinality 0 restriction violated"); } else { assert multipleCardinality; Set values = this.getValueFromBean(bean); if (values.size() >= max) { throw new IllegalBioPAXArgumentException("Cardinality " + max + " restriction violated"); } } } }
java
protected void checkRestrictions(R value, D bean) { Integer max = this.maxCardinalities.get(value.getClass()); if (max != null) { if (max == 0) { throw new IllegalBioPAXArgumentException("Cardinality 0 restriction violated"); } else { assert multipleCardinality; Set values = this.getValueFromBean(bean); if (values.size() >= max) { throw new IllegalBioPAXArgumentException("Cardinality " + max + " restriction violated"); } } } }
[ "protected", "void", "checkRestrictions", "(", "R", "value", ",", "D", "bean", ")", "{", "Integer", "max", "=", "this", ".", "maxCardinalities", ".", "get", "(", "value", ".", "getClass", "(", ")", ")", ";", "if", "(", "max", "!=", "null", ")", "{", "if", "(", "max", "==", "0", ")", "{", "throw", "new", "IllegalBioPAXArgumentException", "(", "\"Cardinality 0 restriction violated\"", ")", ";", "}", "else", "{", "assert", "multipleCardinality", ";", "Set", "values", "=", "this", ".", "getValueFromBean", "(", "bean", ")", ";", "if", "(", "values", ".", "size", "(", ")", ">=", "max", ")", "{", "throw", "new", "IllegalBioPAXArgumentException", "(", "\"Cardinality \"", "+", "max", "+", "\" restriction violated\"", ")", ";", "}", "}", "}", "}" ]
Checks if the <em>bean</em> and the <em>value</em> are consistent with the cardinality rules of the model. This method is important for validations. @param value Value that is related to the object @param bean Object that is related to the value
[ "Checks", "if", "the", "<em", ">", "bean<", "/", "em", ">", "and", "the", "<em", ">", "value<", "/", "em", ">", "are", "consistent", "with", "the", "cardinality", "rules", "of", "the", "model", ".", "This", "method", "is", "important", "for", "validations", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/AbstractPropertyEditor.java#L479-L497
knightliao/apollo
src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java
DateUtils.isOverlay
public static boolean isOverlay(String date1StartStr, String date1EndStr, String date2StartStr, String date2EndStr, String patten) { Date date1Start = DateUtils.parseDate(date1StartStr, patten); Date date1End = DateUtils.parseDate(date1EndStr, patten); Date date2Start = DateUtils.parseDate(date2StartStr, patten); Date date2End = DateUtils.parseDate(date2EndStr, patten); return isOverlay(date1Start, date1End, date2Start, date2End); }
java
public static boolean isOverlay(String date1StartStr, String date1EndStr, String date2StartStr, String date2EndStr, String patten) { Date date1Start = DateUtils.parseDate(date1StartStr, patten); Date date1End = DateUtils.parseDate(date1EndStr, patten); Date date2Start = DateUtils.parseDate(date2StartStr, patten); Date date2End = DateUtils.parseDate(date2EndStr, patten); return isOverlay(date1Start, date1End, date2Start, date2End); }
[ "public", "static", "boolean", "isOverlay", "(", "String", "date1StartStr", ",", "String", "date1EndStr", ",", "String", "date2StartStr", ",", "String", "date2EndStr", ",", "String", "patten", ")", "{", "Date", "date1Start", "=", "DateUtils", ".", "parseDate", "(", "date1StartStr", ",", "patten", ")", ";", "Date", "date1End", "=", "DateUtils", ".", "parseDate", "(", "date1EndStr", ",", "patten", ")", ";", "Date", "date2Start", "=", "DateUtils", ".", "parseDate", "(", "date2StartStr", ",", "patten", ")", ";", "Date", "date2End", "=", "DateUtils", ".", "parseDate", "(", "date2EndStr", ",", "patten", ")", ";", "return", "isOverlay", "(", "date1Start", ",", "date1End", ",", "date2Start", ",", "date2End", ")", ";", "}" ]
校验两段时间是否有重合 @param date1StartStr 时间段1开始 @param date1EndStr 时间段1结束 @param date2StartStr 时间段2开始 @param date2EndStr 时间段2结束 @param patten @return <p/> <code>true</code>:有重合 <p/> <code>false</code>:无重合
[ "校验两段时间是否有重合" ]
train
https://github.com/knightliao/apollo/blob/d7a283659fa3e67af6375db8969b2d065a8ce6eb/src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java#L1151-L1158
Mthwate/DatLib
src/main/java/com/mthwate/datlib/HashUtils.java
HashUtils.sha256Hex
public static String sha256Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha256Hex(data.getBytes(charset)); }
java
public static String sha256Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha256Hex(data.getBytes(charset)); }
[ "public", "static", "String", "sha256Hex", "(", "String", "data", ",", "Charset", "charset", ")", "throws", "NoSuchAlgorithmException", "{", "return", "sha256Hex", "(", "data", ".", "getBytes", "(", "charset", ")", ")", ";", "}" ]
Hashes a string using the SHA-256 algorithm. Returns a hexadecimal result. @since 1.1 @param data the string to hash @param charset the charset of the string @return the hexadecimal SHA-256 hash of the string @throws NoSuchAlgorithmException the algorithm is not supported by existing providers
[ "Hashes", "a", "string", "using", "the", "SHA", "-", "256", "algorithm", ".", "Returns", "a", "hexadecimal", "result", "." ]
train
https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L434-L436
bwaldvogel/liblinear-java
src/main/java/de/bwaldvogel/liblinear/Train.java
Train.readProblem
public static Problem readProblem(File file, double bias) throws IOException, InvalidInputDataException { try (InputStream inputStream = new FileInputStream(file)) { return readProblem(inputStream, bias); } }
java
public static Problem readProblem(File file, double bias) throws IOException, InvalidInputDataException { try (InputStream inputStream = new FileInputStream(file)) { return readProblem(inputStream, bias); } }
[ "public", "static", "Problem", "readProblem", "(", "File", "file", ",", "double", "bias", ")", "throws", "IOException", ",", "InvalidInputDataException", "{", "try", "(", "InputStream", "inputStream", "=", "new", "FileInputStream", "(", "file", ")", ")", "{", "return", "readProblem", "(", "inputStream", ",", "bias", ")", ";", "}", "}" ]
reads a problem from LibSVM format @param file the SVM file @throws IOException obviously in case of any I/O exception ;) @throws InvalidInputDataException if the input file is not correctly formatted
[ "reads", "a", "problem", "from", "LibSVM", "format" ]
train
https://github.com/bwaldvogel/liblinear-java/blob/02b228c23a1e3490ba1f703813b09153c8901c2e/src/main/java/de/bwaldvogel/liblinear/Train.java#L269-L273
jbundle/jbundle
thin/opt/chat/src/main/java/org/jbundle/thin/opt/chat/ChatScreen.java
ChatScreen.doAction
public boolean doAction(String strAction, int iOptions) { if (SEND.equalsIgnoreCase(strAction)) { String strMessage = m_tfTextIn.getText(); m_tfTextIn.setText(Constants.BLANK); Map<String,Object> properties = new Hashtable<String,Object>(); properties.put(MESSAGE_PARAM, strMessage); BaseMessage message = new MapMessage(new BaseMessageHeader(CHAT_TYPE, MessageConstants.INTRANET_QUEUE, null, null), properties); this.getBaseApplet().getApplication().getMessageManager().sendMessage(message); return true; } return super.doAction(strAction, iOptions); }
java
public boolean doAction(String strAction, int iOptions) { if (SEND.equalsIgnoreCase(strAction)) { String strMessage = m_tfTextIn.getText(); m_tfTextIn.setText(Constants.BLANK); Map<String,Object> properties = new Hashtable<String,Object>(); properties.put(MESSAGE_PARAM, strMessage); BaseMessage message = new MapMessage(new BaseMessageHeader(CHAT_TYPE, MessageConstants.INTRANET_QUEUE, null, null), properties); this.getBaseApplet().getApplication().getMessageManager().sendMessage(message); return true; } return super.doAction(strAction, iOptions); }
[ "public", "boolean", "doAction", "(", "String", "strAction", ",", "int", "iOptions", ")", "{", "if", "(", "SEND", ".", "equalsIgnoreCase", "(", "strAction", ")", ")", "{", "String", "strMessage", "=", "m_tfTextIn", ".", "getText", "(", ")", ";", "m_tfTextIn", ".", "setText", "(", "Constants", ".", "BLANK", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "properties", ".", "put", "(", "MESSAGE_PARAM", ",", "strMessage", ")", ";", "BaseMessage", "message", "=", "new", "MapMessage", "(", "new", "BaseMessageHeader", "(", "CHAT_TYPE", ",", "MessageConstants", ".", "INTRANET_QUEUE", ",", "null", ",", "null", ")", ",", "properties", ")", ";", "this", ".", "getBaseApplet", "(", ")", ".", "getApplication", "(", ")", ".", "getMessageManager", "(", ")", ".", "sendMessage", "(", "message", ")", ";", "return", "true", ";", "}", "return", "super", ".", "doAction", "(", "strAction", ",", "iOptions", ")", ";", "}" ]
Process this action. @param strAction The action to process. By default, this method handles RESET, SUBMIT, and DELETE.
[ "Process", "this", "action", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/chat/src/main/java/org/jbundle/thin/opt/chat/ChatScreen.java#L161-L175
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java
StitchingFromMotion2D.resizeStitchImage
public void resizeStitchImage( int widthStitch, int heightStitch , IT newToOldStitch ) { // copy the old image into the new one workImage.reshape(widthStitch,heightStitch); GImageMiscOps.fill(workImage, 0); if( newToOldStitch != null ) { PixelTransform<Point2D_F32> newToOld = converter.convertPixel(newToOldStitch,null); distorter.setModel(newToOld); distorter.apply(stitchedImage, workImage); // update the transforms IT tmp = (IT)worldToCurr.createInstance(); newToOldStitch.concat(worldToInit, tmp); worldToInit.set(tmp); computeCurrToInit_PixelTran(); } else { int overlapWidth = Math.min(widthStitch,stitchedImage.width); int overlapHeight = Math.min(heightStitch,stitchedImage.height); GImageMiscOps.copy(0,0,0,0,overlapWidth,overlapHeight,stitchedImage,workImage); } stitchedImage.reshape(widthStitch,heightStitch); I tmp = stitchedImage; stitchedImage = workImage; workImage = tmp; this.widthStitch = widthStitch; this.heightStitch = heightStitch; }
java
public void resizeStitchImage( int widthStitch, int heightStitch , IT newToOldStitch ) { // copy the old image into the new one workImage.reshape(widthStitch,heightStitch); GImageMiscOps.fill(workImage, 0); if( newToOldStitch != null ) { PixelTransform<Point2D_F32> newToOld = converter.convertPixel(newToOldStitch,null); distorter.setModel(newToOld); distorter.apply(stitchedImage, workImage); // update the transforms IT tmp = (IT)worldToCurr.createInstance(); newToOldStitch.concat(worldToInit, tmp); worldToInit.set(tmp); computeCurrToInit_PixelTran(); } else { int overlapWidth = Math.min(widthStitch,stitchedImage.width); int overlapHeight = Math.min(heightStitch,stitchedImage.height); GImageMiscOps.copy(0,0,0,0,overlapWidth,overlapHeight,stitchedImage,workImage); } stitchedImage.reshape(widthStitch,heightStitch); I tmp = stitchedImage; stitchedImage = workImage; workImage = tmp; this.widthStitch = widthStitch; this.heightStitch = heightStitch; }
[ "public", "void", "resizeStitchImage", "(", "int", "widthStitch", ",", "int", "heightStitch", ",", "IT", "newToOldStitch", ")", "{", "// copy the old image into the new one", "workImage", ".", "reshape", "(", "widthStitch", ",", "heightStitch", ")", ";", "GImageMiscOps", ".", "fill", "(", "workImage", ",", "0", ")", ";", "if", "(", "newToOldStitch", "!=", "null", ")", "{", "PixelTransform", "<", "Point2D_F32", ">", "newToOld", "=", "converter", ".", "convertPixel", "(", "newToOldStitch", ",", "null", ")", ";", "distorter", ".", "setModel", "(", "newToOld", ")", ";", "distorter", ".", "apply", "(", "stitchedImage", ",", "workImage", ")", ";", "// update the transforms", "IT", "tmp", "=", "(", "IT", ")", "worldToCurr", ".", "createInstance", "(", ")", ";", "newToOldStitch", ".", "concat", "(", "worldToInit", ",", "tmp", ")", ";", "worldToInit", ".", "set", "(", "tmp", ")", ";", "computeCurrToInit_PixelTran", "(", ")", ";", "}", "else", "{", "int", "overlapWidth", "=", "Math", ".", "min", "(", "widthStitch", ",", "stitchedImage", ".", "width", ")", ";", "int", "overlapHeight", "=", "Math", ".", "min", "(", "heightStitch", ",", "stitchedImage", ".", "height", ")", ";", "GImageMiscOps", ".", "copy", "(", "0", ",", "0", ",", "0", ",", "0", ",", "overlapWidth", ",", "overlapHeight", ",", "stitchedImage", ",", "workImage", ")", ";", "}", "stitchedImage", ".", "reshape", "(", "widthStitch", ",", "heightStitch", ")", ";", "I", "tmp", "=", "stitchedImage", ";", "stitchedImage", "=", "workImage", ";", "workImage", "=", "tmp", ";", "this", ".", "widthStitch", "=", "widthStitch", ";", "this", ".", "heightStitch", "=", "heightStitch", ";", "}" ]
Resizes the stitch image. If no transform is provided then the old stitch region is simply places on top of the new one and copied. Pixels which do not exist in the old image are filled with zero. @param widthStitch The new width of the stitch image. @param heightStitch The new height of the stitch image. @param newToOldStitch (Optional) Transform from new stitch image pixels to old stick pixels. Can be null.
[ "Resizes", "the", "stitch", "image", ".", "If", "no", "transform", "is", "provided", "then", "the", "old", "stitch", "region", "is", "simply", "places", "on", "top", "of", "the", "new", "one", "and", "copied", ".", "Pixels", "which", "do", "not", "exist", "in", "the", "old", "image", "are", "filled", "with", "zero", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java#L264-L292
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java
StyleCache.setFeatureStyle
public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureRow featureRow) { return StyleUtils.setFeatureStyle(polylineOptions, featureStyleExtension, featureRow, density); }
java
public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureRow featureRow) { return StyleUtils.setFeatureStyle(polylineOptions, featureStyleExtension, featureRow, density); }
[ "public", "boolean", "setFeatureStyle", "(", "PolylineOptions", "polylineOptions", ",", "FeatureRow", "featureRow", ")", "{", "return", "StyleUtils", ".", "setFeatureStyle", "(", "polylineOptions", ",", "featureStyleExtension", ",", "featureRow", ",", "density", ")", ";", "}" ]
Set the feature row style into the polyline options @param polylineOptions polyline options @param featureRow feature row @return true if style was set into the polyline options
[ "Set", "the", "feature", "row", "style", "into", "the", "polyline", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L229-L231
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.unbindInstanceFromSecurityGroup
public void unbindInstanceFromSecurityGroup(String instanceId, String securityGroupId) { this.unbindInstanceFromSecurityGroup(new UnbindSecurityGroupRequest() .withInstanceId(instanceId).withSecurityGroupId(securityGroupId)); }
java
public void unbindInstanceFromSecurityGroup(String instanceId, String securityGroupId) { this.unbindInstanceFromSecurityGroup(new UnbindSecurityGroupRequest() .withInstanceId(instanceId).withSecurityGroupId(securityGroupId)); }
[ "public", "void", "unbindInstanceFromSecurityGroup", "(", "String", "instanceId", ",", "String", "securityGroupId", ")", "{", "this", ".", "unbindInstanceFromSecurityGroup", "(", "new", "UnbindSecurityGroupRequest", "(", ")", ".", "withInstanceId", "(", "instanceId", ")", ".", "withSecurityGroupId", "(", "securityGroupId", ")", ")", ";", "}" ]
Unbinding the instance from securitygroup. @param instanceId The id of the instance. @param securityGroupId The id of the securitygroup.
[ "Unbinding", "the", "instance", "from", "securitygroup", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L740-L743
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
36
Edit dataset card