repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java
ODataLocal.addRecord
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException { """ Add the record content in file. @param iContent The content to write @return The record offset. @throws IOException """ if (iContent.length == 0) // AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE return -1; final int recordSize = iContent.length + RECORD_FIX_SIZE; acquireExclusiveLock(); try { final long[] newFilePosition = getFreeSpace(recordSize); writeRecord(newFilePosition, iRid.clusterId, iRid.clusterPosition, iContent); return getAbsolutePosition(newFilePosition); } finally { releaseExclusiveLock(); } }
java
public long addRecord(final ORecordId iRid, final byte[] iContent) throws IOException { if (iContent.length == 0) // AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE return -1; final int recordSize = iContent.length + RECORD_FIX_SIZE; acquireExclusiveLock(); try { final long[] newFilePosition = getFreeSpace(recordSize); writeRecord(newFilePosition, iRid.clusterId, iRid.clusterPosition, iContent); return getAbsolutePosition(newFilePosition); } finally { releaseExclusiveLock(); } }
[ "public", "long", "addRecord", "(", "final", "ORecordId", "iRid", ",", "final", "byte", "[", "]", "iContent", ")", "throws", "IOException", "{", "if", "(", "iContent", ".", "length", "==", "0", ")", "// AVOID UNUSEFUL CREATION OF EMPTY RECORD: IT WILL BE CREATED AT FIRST UPDATE\r", "return", "-", "1", ";", "final", "int", "recordSize", "=", "iContent", ".", "length", "+", "RECORD_FIX_SIZE", ";", "acquireExclusiveLock", "(", ")", ";", "try", "{", "final", "long", "[", "]", "newFilePosition", "=", "getFreeSpace", "(", "recordSize", ")", ";", "writeRecord", "(", "newFilePosition", ",", "iRid", ".", "clusterId", ",", "iRid", ".", "clusterPosition", ",", "iContent", ")", ";", "return", "getAbsolutePosition", "(", "newFilePosition", ")", ";", "}", "finally", "{", "releaseExclusiveLock", "(", ")", ";", "}", "}" ]
Add the record content in file. @param iContent The content to write @return The record offset. @throws IOException
[ "Add", "the", "record", "content", "in", "file", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocal.java#L187-L205
telly/groundy
library/src/main/java/com/telly/groundy/util/DownloadUtils.java
DownloadUtils.getDownloadListenerForTask
public static DownloadProgressListener getDownloadListenerForTask(final GroundyTask groundyTask) { """ Returns a progress listener that will post progress to the specified groundyTask. @param groundyTask the groundyTask to post progress to. Cannot be null. @return a progress listener """ return new DownloadProgressListener() { @Override public void onProgress(String url, int progress) { groundyTask.updateProgress(progress); } }; }
java
public static DownloadProgressListener getDownloadListenerForTask(final GroundyTask groundyTask) { return new DownloadProgressListener() { @Override public void onProgress(String url, int progress) { groundyTask.updateProgress(progress); } }; }
[ "public", "static", "DownloadProgressListener", "getDownloadListenerForTask", "(", "final", "GroundyTask", "groundyTask", ")", "{", "return", "new", "DownloadProgressListener", "(", ")", "{", "@", "Override", "public", "void", "onProgress", "(", "String", "url", ",", "int", "progress", ")", "{", "groundyTask", ".", "updateProgress", "(", "progress", ")", ";", "}", "}", ";", "}" ]
Returns a progress listener that will post progress to the specified groundyTask. @param groundyTask the groundyTask to post progress to. Cannot be null. @return a progress listener
[ "Returns", "a", "progress", "listener", "that", "will", "post", "progress", "to", "the", "specified", "groundyTask", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/util/DownloadUtils.java#L102-L109
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getFromIDCaseInsensitiveOrDefault
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrDefault (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sID, @Nullable final ENUMTYPE eDefault) { """ Get the enum value with the passed string ID case insensitive @param <ENUMTYPE> The enum type @param aClass The enum class @param sID The ID to search @param eDefault The default value to be returned, if the ID was not found. @return The default parameter if no enum item with the given ID is present. """ ValueEnforcer.notNull (aClass, "Class"); if (sID == null) return eDefault; return findFirst (aClass, x -> x.getID ().equalsIgnoreCase (sID), eDefault); }
java
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrDefault (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sID, @Nullable final ENUMTYPE eDefault) { ValueEnforcer.notNull (aClass, "Class"); if (sID == null) return eDefault; return findFirst (aClass, x -> x.getID ().equalsIgnoreCase (sID), eDefault); }
[ "@", "Nullable", "public", "static", "<", "ENUMTYPE", "extends", "Enum", "<", "ENUMTYPE", ">", "&", "IHasID", "<", "String", ">", ">", "ENUMTYPE", "getFromIDCaseInsensitiveOrDefault", "(", "@", "Nonnull", "final", "Class", "<", "ENUMTYPE", ">", "aClass", ",", "@", "Nullable", "final", "String", "sID", ",", "@", "Nullable", "final", "ENUMTYPE", "eDefault", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClass", ",", "\"Class\"", ")", ";", "if", "(", "sID", "==", "null", ")", "return", "eDefault", ";", "return", "findFirst", "(", "aClass", ",", "x", "->", "x", ".", "getID", "(", ")", ".", "equalsIgnoreCase", "(", "sID", ")", ",", "eDefault", ")", ";", "}" ]
Get the enum value with the passed string ID case insensitive @param <ENUMTYPE> The enum type @param aClass The enum class @param sID The ID to search @param eDefault The default value to be returned, if the ID was not found. @return The default parameter if no enum item with the given ID is present.
[ "Get", "the", "enum", "value", "with", "the", "passed", "string", "ID", "case", "insensitive" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L192-L202
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java
SinglePerturbationNeighbourhood.canRemove
private boolean canRemove(SubsetSolution solution, Set<Integer> deleteCandidates) { """ Check if it is allowed to remove one more item from the selection. @param solution solution for which moves are generated @param deleteCandidates set of candidate IDs to be deleted @return <code>true</code> if it is allowed to remove an item from the selection """ return !deleteCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()-1); }
java
private boolean canRemove(SubsetSolution solution, Set<Integer> deleteCandidates){ return !deleteCandidates.isEmpty() && isValidSubsetSize(solution.getNumSelectedIDs()-1); }
[ "private", "boolean", "canRemove", "(", "SubsetSolution", "solution", ",", "Set", "<", "Integer", ">", "deleteCandidates", ")", "{", "return", "!", "deleteCandidates", ".", "isEmpty", "(", ")", "&&", "isValidSubsetSize", "(", "solution", ".", "getNumSelectedIDs", "(", ")", "-", "1", ")", ";", "}" ]
Check if it is allowed to remove one more item from the selection. @param solution solution for which moves are generated @param deleteCandidates set of candidate IDs to be deleted @return <code>true</code> if it is allowed to remove an item from the selection
[ "Check", "if", "it", "is", "allowed", "to", "remove", "one", "more", "item", "from", "the", "selection", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L233-L236
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/SaddlePointExpansion.java
SaddlePointExpansion.getDeviancePart
public static double getDeviancePart(double x, double mu) { """ A part of the deviance portion of the saddle point approximation. <p> References: <ol> <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial Probabilities.". <a target="_blank" href="http://www.herine.net/stat/papers/dbinom.pdf"> http://www.herine.net/stat/papers/dbinom.pdf</a></li> </ol> </p> @param x the x value. @param mu the average. @return a part of the deviance. """ double ret; if (FastMath.abs(x - mu) < 0.1 * (x + mu)) { double d = x - mu; double v = d / (x + mu); double s1 = v * d; double s = Double.NaN; double ej = 2.0 * x * v; v = v * v; int j = 1; while (s1 != s) { s = s1; ej *= v; s1 = s + ej / ((j * 2) + 1); ++j; } ret = s1; } else { ret = x * FastMath.log(x / mu) + mu - x; } return ret; }
java
public static double getDeviancePart(double x, double mu) { double ret; if (FastMath.abs(x - mu) < 0.1 * (x + mu)) { double d = x - mu; double v = d / (x + mu); double s1 = v * d; double s = Double.NaN; double ej = 2.0 * x * v; v = v * v; int j = 1; while (s1 != s) { s = s1; ej *= v; s1 = s + ej / ((j * 2) + 1); ++j; } ret = s1; } else { ret = x * FastMath.log(x / mu) + mu - x; } return ret; }
[ "public", "static", "double", "getDeviancePart", "(", "double", "x", ",", "double", "mu", ")", "{", "double", "ret", ";", "if", "(", "FastMath", ".", "abs", "(", "x", "-", "mu", ")", "<", "0.1", "*", "(", "x", "+", "mu", ")", ")", "{", "double", "d", "=", "x", "-", "mu", ";", "double", "v", "=", "d", "/", "(", "x", "+", "mu", ")", ";", "double", "s1", "=", "v", "*", "d", ";", "double", "s", "=", "Double", ".", "NaN", ";", "double", "ej", "=", "2.0", "*", "x", "*", "v", ";", "v", "=", "v", "*", "v", ";", "int", "j", "=", "1", ";", "while", "(", "s1", "!=", "s", ")", "{", "s", "=", "s1", ";", "ej", "*=", "v", ";", "s1", "=", "s", "+", "ej", "/", "(", "(", "j", "*", "2", ")", "+", "1", ")", ";", "++", "j", ";", "}", "ret", "=", "s1", ";", "}", "else", "{", "ret", "=", "x", "*", "FastMath", ".", "log", "(", "x", "/", "mu", ")", "+", "mu", "-", "x", ";", "}", "return", "ret", ";", "}" ]
A part of the deviance portion of the saddle point approximation. <p> References: <ol> <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial Probabilities.". <a target="_blank" href="http://www.herine.net/stat/papers/dbinom.pdf"> http://www.herine.net/stat/papers/dbinom.pdf</a></li> </ol> </p> @param x the x value. @param mu the average. @return a part of the deviance.
[ "A", "part", "of", "the", "deviance", "portion", "of", "the", "saddle", "point", "approximation", ".", "<p", ">", "References", ":", "<ol", ">", "<li", ">", "Catherine", "Loader", "(", "2000", ")", ".", "Fast", "and", "Accurate", "Computation", "of", "Binomial", "Probabilities", ".", ".", "<a", "target", "=", "_blank", "href", "=", "http", ":", "//", "www", ".", "herine", ".", "net", "/", "stat", "/", "papers", "/", "dbinom", ".", "pdf", ">", "http", ":", "//", "www", ".", "herine", ".", "net", "/", "stat", "/", "papers", "/", "dbinom", ".", "pdf<", "/", "a", ">", "<", "/", "li", ">", "<", "/", "ol", ">", "<", "/", "p", ">" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/SaddlePointExpansion.java#L145-L166
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java
PascalTemplate.setValue
public void setValue(String fieldName, String value) { """ Sets template values. @param fieldName (i.e. workshopname, workshopdate) """ int index = getFieldIndex(fieldName); assert(index != -1); values[index] = value; }
java
public void setValue(String fieldName, String value) { int index = getFieldIndex(fieldName); assert(index != -1); values[index] = value; }
[ "public", "void", "setValue", "(", "String", "fieldName", ",", "String", "value", ")", "{", "int", "index", "=", "getFieldIndex", "(", "fieldName", ")", ";", "assert", "(", "index", "!=", "-", "1", ")", ";", "values", "[", "index", "]", "=", "value", ";", "}" ]
Sets template values. @param fieldName (i.e. workshopname, workshopdate)
[ "Sets", "template", "values", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/pascal/PascalTemplate.java#L149-L153
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
ComponentFinder.findParent
public static Component findParent(final Component childComponent, final Class<? extends Component> parentClass, final boolean byClassname) { """ Finds the first parent of the given childComponent from the given parentClass and a flag if the search shell be continued with the class name if the search with the given parentClass returns null. @param childComponent the child component @param parentClass the parent class @param byClassname the flag to search by classname if the search with given parentClass returns null. @return the component """ Component parent = childComponent.getParent(); while (parent != null) { if (parent.getClass().equals(parentClass)) { break; } parent = parent.getParent(); } if ((parent == null) && byClassname) { return findParentByClassname(childComponent, parentClass); } return parent; }
java
public static Component findParent(final Component childComponent, final Class<? extends Component> parentClass, final boolean byClassname) { Component parent = childComponent.getParent(); while (parent != null) { if (parent.getClass().equals(parentClass)) { break; } parent = parent.getParent(); } if ((parent == null) && byClassname) { return findParentByClassname(childComponent, parentClass); } return parent; }
[ "public", "static", "Component", "findParent", "(", "final", "Component", "childComponent", ",", "final", "Class", "<", "?", "extends", "Component", ">", "parentClass", ",", "final", "boolean", "byClassname", ")", "{", "Component", "parent", "=", "childComponent", ".", "getParent", "(", ")", ";", "while", "(", "parent", "!=", "null", ")", "{", "if", "(", "parent", ".", "getClass", "(", ")", ".", "equals", "(", "parentClass", ")", ")", "{", "break", ";", "}", "parent", "=", "parent", ".", "getParent", "(", ")", ";", "}", "if", "(", "(", "parent", "==", "null", ")", "&&", "byClassname", ")", "{", "return", "findParentByClassname", "(", "childComponent", ",", "parentClass", ")", ";", "}", "return", "parent", ";", "}" ]
Finds the first parent of the given childComponent from the given parentClass and a flag if the search shell be continued with the class name if the search with the given parentClass returns null. @param childComponent the child component @param parentClass the parent class @param byClassname the flag to search by classname if the search with given parentClass returns null. @return the component
[ "Finds", "the", "first", "parent", "of", "the", "given", "childComponent", "from", "the", "given", "parentClass", "and", "a", "flag", "if", "the", "search", "shell", "be", "continued", "with", "the", "class", "name", "if", "the", "search", "with", "the", "given", "parentClass", "returns", "null", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L112-L129
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java
HttpHeaders.setContentDispositionFormData
public void setContentDispositionFormData(String name, String filename) { """ Set the (new) value of the {@code Content-Disposition} header for {@code form-data}. @param name the control name @param filename the filename (may be {@code null}) """ Assert.notNull(name, "'name' must not be null"); StringBuilder builder = new StringBuilder("form-data; name=\""); builder.append(name).append('\"'); if (filename != null) { builder.append("; filename=\""); builder.append(filename).append('\"'); } set(CONTENT_DISPOSITION, builder.toString()); }
java
public void setContentDispositionFormData(String name, String filename) { Assert.notNull(name, "'name' must not be null"); StringBuilder builder = new StringBuilder("form-data; name=\""); builder.append(name).append('\"'); if (filename != null) { builder.append("; filename=\""); builder.append(filename).append('\"'); } set(CONTENT_DISPOSITION, builder.toString()); }
[ "public", "void", "setContentDispositionFormData", "(", "String", "name", ",", "String", "filename", ")", "{", "Assert", ".", "notNull", "(", "name", ",", "\"'name' must not be null\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "\"form-data; name=\\\"\"", ")", ";", "builder", ".", "append", "(", "name", ")", ".", "append", "(", "'", "'", ")", ";", "if", "(", "filename", "!=", "null", ")", "{", "builder", ".", "append", "(", "\"; filename=\\\"\"", ")", ";", "builder", ".", "append", "(", "filename", ")", ".", "append", "(", "'", "'", ")", ";", "}", "set", "(", "CONTENT_DISPOSITION", ",", "builder", ".", "toString", "(", ")", ")", ";", "}" ]
Set the (new) value of the {@code Content-Disposition} header for {@code form-data}. @param name the control name @param filename the filename (may be {@code null})
[ "Set", "the", "(", "new", ")", "value", "of", "the", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L568-L577
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/CmsSelectBox.java
CmsSelectBox.setItems
public void setItems(Map<String, String> items) { """ Sets the items using a map from option values to label texts.<p> @param items the map containing the select options """ clearItems(); m_items = items; for (Map.Entry<String, String> entry : items.entrySet()) { addOption(entry.getKey(), entry.getValue()); } }
java
public void setItems(Map<String, String> items) { clearItems(); m_items = items; for (Map.Entry<String, String> entry : items.entrySet()) { addOption(entry.getKey(), entry.getValue()); } }
[ "public", "void", "setItems", "(", "Map", "<", "String", ",", "String", ">", "items", ")", "{", "clearItems", "(", ")", ";", "m_items", "=", "items", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "items", ".", "entrySet", "(", ")", ")", "{", "addOption", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Sets the items using a map from option values to label texts.<p> @param items the map containing the select options
[ "Sets", "the", "items", "using", "a", "map", "from", "option", "values", "to", "label", "texts", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/CmsSelectBox.java#L267-L274
zaproxy/zaproxy
src/org/parosproxy/paros/db/DbUtils.java
DbUtils.hasIndex
public static boolean hasIndex(final Connection connection, final String tableName, final String indexName) throws SQLException { """ Tells whether the table {@code tableName} has an index with the given {@code indexName}, or not. @param connection the connection to the database @param tableName the name of the table that may have the index @param indexName the name of the index that will be checked @return {@code true} if the table {@code tableName} has the index {@code indexName}, {@code false} otherwise. @throws SQLException if an error occurred while checking if the table has the index """ boolean hasIndex = false; ResultSet rs = null; try { rs = connection.getMetaData().getIndexInfo(null, null, tableName, false, false); while (rs.next()) { if (indexName.equals(rs.getString("INDEX_NAME"))) { hasIndex = true; break; } } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasIndex; }
java
public static boolean hasIndex(final Connection connection, final String tableName, final String indexName) throws SQLException { boolean hasIndex = false; ResultSet rs = null; try { rs = connection.getMetaData().getIndexInfo(null, null, tableName, false, false); while (rs.next()) { if (indexName.equals(rs.getString("INDEX_NAME"))) { hasIndex = true; break; } } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasIndex; }
[ "public", "static", "boolean", "hasIndex", "(", "final", "Connection", "connection", ",", "final", "String", "tableName", ",", "final", "String", "indexName", ")", "throws", "SQLException", "{", "boolean", "hasIndex", "=", "false", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "rs", "=", "connection", ".", "getMetaData", "(", ")", ".", "getIndexInfo", "(", "null", ",", "null", ",", "tableName", ",", "false", ",", "false", ")", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "if", "(", "indexName", ".", "equals", "(", "rs", ".", "getString", "(", "\"INDEX_NAME\"", ")", ")", ")", "{", "hasIndex", "=", "true", ";", "break", ";", "}", "}", "}", "finally", "{", "try", "{", "if", "(", "rs", "!=", "null", ")", "{", "rs", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}", "return", "hasIndex", ";", "}" ]
Tells whether the table {@code tableName} has an index with the given {@code indexName}, or not. @param connection the connection to the database @param tableName the name of the table that may have the index @param indexName the name of the index that will be checked @return {@code true} if the table {@code tableName} has the index {@code indexName}, {@code false} otherwise. @throws SQLException if an error occurred while checking if the table has the index
[ "Tells", "whether", "the", "table", "{", "@code", "tableName", "}", "has", "an", "index", "with", "the", "given", "{", "@code", "indexName", "}", "or", "not", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/DbUtils.java#L128-L153
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java
ConfigUtils.hasNonEmptyPath
public static boolean hasNonEmptyPath(Config config, String key) { """ Check if the given <code>key</code> exists in <code>config</code> and it is not null or empty Uses {@link StringUtils#isNotBlank(CharSequence)} @param config which may have the key @param key to look for in the config @return True if key exits and not null or empty. False otherwise """ return config.hasPath(key) && StringUtils.isNotBlank(config.getString(key)); }
java
public static boolean hasNonEmptyPath(Config config, String key) { return config.hasPath(key) && StringUtils.isNotBlank(config.getString(key)); }
[ "public", "static", "boolean", "hasNonEmptyPath", "(", "Config", "config", ",", "String", "key", ")", "{", "return", "config", ".", "hasPath", "(", "key", ")", "&&", "StringUtils", ".", "isNotBlank", "(", "config", ".", "getString", "(", "key", ")", ")", ";", "}" ]
Check if the given <code>key</code> exists in <code>config</code> and it is not null or empty Uses {@link StringUtils#isNotBlank(CharSequence)} @param config which may have the key @param key to look for in the config @return True if key exits and not null or empty. False otherwise
[ "Check", "if", "the", "given", "<code", ">", "key<", "/", "code", ">", "exists", "in", "<code", ">", "config<", "/", "code", ">", "and", "it", "is", "not", "null", "or", "empty", "Uses", "{", "@link", "StringUtils#isNotBlank", "(", "CharSequence", ")", "}", "@param", "config", "which", "may", "have", "the", "key", "@param", "key", "to", "look", "for", "in", "the", "config" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L474-L476
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.bindScriptBundle
@Override public void bindScriptBundle(final IScriptBundle scriptBundle, final GVRMain gvrMain, boolean bindToMainScene) throws IOException, GVRScriptException { """ Binds a script bundle to a {@link GVRScene} object. @param scriptBundle The script bundle. @param gvrMain The {@link GVRMain} to bind to. @param bindToMainScene If {@code true}, also bind it to the main scene on the event {@link GVRMain#onAfterInit}. @throws IOException if script bundle file cannot be read. @throws GVRScriptException if script processing error occurs. """ // Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set. bindHelper((GVRScriptBundle)scriptBundle, null, BIND_MASK_GVRSCRIPT | BIND_MASK_GVRACTIVITY); if (bindToMainScene) { final IScriptEvents bindToSceneListener = new GVREventListeners.ScriptEvents() { GVRScene mainScene = null; @Override public void onInit(GVRContext gvrContext) throws Throwable { mainScene = gvrContext.getMainScene(); } @Override public void onAfterInit() { try { bindScriptBundleToScene((GVRScriptBundle)scriptBundle, mainScene); } catch (IOException e) { mGvrContext.logError(e.getMessage(), this); } catch (GVRScriptException e) { mGvrContext.logError(e.getMessage(), this); } finally { // Remove the listener itself gvrMain.getEventReceiver().removeListener(this); } } }; // Add listener to bind to main scene when event "onAfterInit" is received gvrMain.getEventReceiver().addListener(bindToSceneListener); } }
java
@Override public void bindScriptBundle(final IScriptBundle scriptBundle, final GVRMain gvrMain, boolean bindToMainScene) throws IOException, GVRScriptException { // Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set. bindHelper((GVRScriptBundle)scriptBundle, null, BIND_MASK_GVRSCRIPT | BIND_MASK_GVRACTIVITY); if (bindToMainScene) { final IScriptEvents bindToSceneListener = new GVREventListeners.ScriptEvents() { GVRScene mainScene = null; @Override public void onInit(GVRContext gvrContext) throws Throwable { mainScene = gvrContext.getMainScene(); } @Override public void onAfterInit() { try { bindScriptBundleToScene((GVRScriptBundle)scriptBundle, mainScene); } catch (IOException e) { mGvrContext.logError(e.getMessage(), this); } catch (GVRScriptException e) { mGvrContext.logError(e.getMessage(), this); } finally { // Remove the listener itself gvrMain.getEventReceiver().removeListener(this); } } }; // Add listener to bind to main scene when event "onAfterInit" is received gvrMain.getEventReceiver().addListener(bindToSceneListener); } }
[ "@", "Override", "public", "void", "bindScriptBundle", "(", "final", "IScriptBundle", "scriptBundle", ",", "final", "GVRMain", "gvrMain", ",", "boolean", "bindToMainScene", ")", "throws", "IOException", ",", "GVRScriptException", "{", "// Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set.", "bindHelper", "(", "(", "GVRScriptBundle", ")", "scriptBundle", ",", "null", ",", "BIND_MASK_GVRSCRIPT", "|", "BIND_MASK_GVRACTIVITY", ")", ";", "if", "(", "bindToMainScene", ")", "{", "final", "IScriptEvents", "bindToSceneListener", "=", "new", "GVREventListeners", ".", "ScriptEvents", "(", ")", "{", "GVRScene", "mainScene", "=", "null", ";", "@", "Override", "public", "void", "onInit", "(", "GVRContext", "gvrContext", ")", "throws", "Throwable", "{", "mainScene", "=", "gvrContext", ".", "getMainScene", "(", ")", ";", "}", "@", "Override", "public", "void", "onAfterInit", "(", ")", "{", "try", "{", "bindScriptBundleToScene", "(", "(", "GVRScriptBundle", ")", "scriptBundle", ",", "mainScene", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "mGvrContext", ".", "logError", "(", "e", ".", "getMessage", "(", ")", ",", "this", ")", ";", "}", "catch", "(", "GVRScriptException", "e", ")", "{", "mGvrContext", ".", "logError", "(", "e", ".", "getMessage", "(", ")", ",", "this", ")", ";", "}", "finally", "{", "// Remove the listener itself", "gvrMain", ".", "getEventReceiver", "(", ")", ".", "removeListener", "(", "this", ")", ";", "}", "}", "}", ";", "// Add listener to bind to main scene when event \"onAfterInit\" is received", "gvrMain", ".", "getEventReceiver", "(", ")", ".", "addListener", "(", "bindToSceneListener", ")", ";", "}", "}" ]
Binds a script bundle to a {@link GVRScene} object. @param scriptBundle The script bundle. @param gvrMain The {@link GVRMain} to bind to. @param bindToMainScene If {@code true}, also bind it to the main scene on the event {@link GVRMain#onAfterInit}. @throws IOException if script bundle file cannot be read. @throws GVRScriptException if script processing error occurs.
[ "Binds", "a", "script", "bundle", "to", "a", "{", "@link", "GVRScene", "}", "object", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L269-L302
lazy-koala/java-toolkit
fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java
ThreadTask.addTaskRunOnce
public void addTaskRunOnce(int startDelayTime, Runnable runnable) { """ 运行一次的指定任务 <p>Function: addTaskRunOnce</p> <p>Description: </p> @param startDelayTime 延迟时间(s) @param runnable @author [email protected] @date 2016年10月8日 下午3:00:51 @version 1.0 """ scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS); }
java
public void addTaskRunOnce(int startDelayTime, Runnable runnable) { scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS); }
[ "public", "void", "addTaskRunOnce", "(", "int", "startDelayTime", ",", "Runnable", "runnable", ")", "{", "scheduledExecutorService", ".", "schedule", "(", "runnable", ",", "startDelayTime", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}" ]
运行一次的指定任务 <p>Function: addTaskRunOnce</p> <p>Description: </p> @param startDelayTime 延迟时间(s) @param runnable @author [email protected] @date 2016年10月8日 下午3:00:51 @version 1.0
[ "运行一次的指定任务", "<p", ">", "Function", ":", "addTaskRunOnce<", "/", "p", ">", "<p", ">", "Description", ":", "<", "/", "p", ">" ]
train
https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java#L141-L143
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/ActionsConfig.java
ActionsConfig.exports
private static void exports(Xml node, ActionRef action) { """ Export the action. @param node The xml node (must not be <code>null</code>). @param action The action to export (must not be <code>null</code>). @throws LionEngineException If unable to write node. """ final Xml nodeAction = node.createChild(NODE_ACTION); nodeAction.writeString(ATT_PATH, action.getPath()); for (final ActionRef ref : action.getRefs()) { exports(nodeAction, ref); } }
java
private static void exports(Xml node, ActionRef action) { final Xml nodeAction = node.createChild(NODE_ACTION); nodeAction.writeString(ATT_PATH, action.getPath()); for (final ActionRef ref : action.getRefs()) { exports(nodeAction, ref); } }
[ "private", "static", "void", "exports", "(", "Xml", "node", ",", "ActionRef", "action", ")", "{", "final", "Xml", "nodeAction", "=", "node", ".", "createChild", "(", "NODE_ACTION", ")", ";", "nodeAction", ".", "writeString", "(", "ATT_PATH", ",", "action", ".", "getPath", "(", ")", ")", ";", "for", "(", "final", "ActionRef", "ref", ":", "action", ".", "getRefs", "(", ")", ")", "{", "exports", "(", "nodeAction", ",", "ref", ")", ";", "}", "}" ]
Export the action. @param node The xml node (must not be <code>null</code>). @param action The action to export (must not be <code>null</code>). @throws LionEngineException If unable to write node.
[ "Export", "the", "action", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/ActionsConfig.java#L139-L148
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.requestOidRemove
protected void requestOidRemove (String name, OidList list, int oid) { """ Calls by derived instances when an oid remover method was called. """ // if we're on the authoritative server, we update the set immediately boolean applyImmediately = isAuthoritative(); if (applyImmediately) { list.remove(oid); } // dispatch an object removed event postEvent(new ObjectRemovedEvent(_oid, name, oid).setAlreadyApplied(applyImmediately)); }
java
protected void requestOidRemove (String name, OidList list, int oid) { // if we're on the authoritative server, we update the set immediately boolean applyImmediately = isAuthoritative(); if (applyImmediately) { list.remove(oid); } // dispatch an object removed event postEvent(new ObjectRemovedEvent(_oid, name, oid).setAlreadyApplied(applyImmediately)); }
[ "protected", "void", "requestOidRemove", "(", "String", "name", ",", "OidList", "list", ",", "int", "oid", ")", "{", "// if we're on the authoritative server, we update the set immediately", "boolean", "applyImmediately", "=", "isAuthoritative", "(", ")", ";", "if", "(", "applyImmediately", ")", "{", "list", ".", "remove", "(", "oid", ")", ";", "}", "// dispatch an object removed event", "postEvent", "(", "new", "ObjectRemovedEvent", "(", "_oid", ",", "name", ",", "oid", ")", ".", "setAlreadyApplied", "(", "applyImmediately", ")", ")", ";", "}" ]
Calls by derived instances when an oid remover method was called.
[ "Calls", "by", "derived", "instances", "when", "an", "oid", "remover", "method", "was", "called", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L864-L873
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java
DocumentSubscriptions.dropConnection
public void dropConnection(String name, String database) { """ Force server to close current client subscription connection to the server @param name Subscription name @param database Database to use """ RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase())); DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name); requestExecutor.execute(command); }
java
public void dropConnection(String name, String database) { RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase())); DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name); requestExecutor.execute(command); }
[ "public", "void", "dropConnection", "(", "String", "name", ",", "String", "database", ")", "{", "RequestExecutor", "requestExecutor", "=", "_store", ".", "getRequestExecutor", "(", "ObjectUtils", ".", "firstNonNull", "(", "database", ",", "_store", ".", "getDatabase", "(", ")", ")", ")", ";", "DropSubscriptionConnectionCommand", "command", "=", "new", "DropSubscriptionConnectionCommand", "(", "name", ")", ";", "requestExecutor", ".", "execute", "(", "command", ")", ";", "}" ]
Force server to close current client subscription connection to the server @param name Subscription name @param database Database to use
[ "Force", "server", "to", "close", "current", "client", "subscription", "connection", "to", "the", "server" ]
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L436-L441
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.createEnumType
public EnumType createEnumType(String name, Node source, JSType elementsType) { """ Creates an enum type. @param name The human-readable name associated with the enum, or null if unknown. """ return new EnumType(this, name, source, elementsType); }
java
public EnumType createEnumType(String name, Node source, JSType elementsType) { return new EnumType(this, name, source, elementsType); }
[ "public", "EnumType", "createEnumType", "(", "String", "name", ",", "Node", "source", ",", "JSType", "elementsType", ")", "{", "return", "new", "EnumType", "(", "this", ",", "name", ",", "source", ",", "elementsType", ")", ";", "}" ]
Creates an enum type. @param name The human-readable name associated with the enum, or null if unknown.
[ "Creates", "an", "enum", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1547-L1549
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataComplementOfImpl_CustomFieldSerializer.java
OWLDataComplementOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataComplementOfImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataComplementOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDataComplementOfImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataComplementOfImpl_CustomFieldSerializer.java#L69-L72
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/MarkedElement.java
MarkedElement.markupAtom
public static MarkedElement markupAtom(IRenderingElement elem, IAtom atom) { """ Markup a atom with the class 'atom' and optionally the ids/classes from it's properties. @param elem rendering element @param atom atom @return the marked element """ if (elem == null) return null; MarkedElement tagElem = markupChemObj(elem, atom); tagElem.aggClass("atom"); return tagElem; }
java
public static MarkedElement markupAtom(IRenderingElement elem, IAtom atom) { if (elem == null) return null; MarkedElement tagElem = markupChemObj(elem, atom); tagElem.aggClass("atom"); return tagElem; }
[ "public", "static", "MarkedElement", "markupAtom", "(", "IRenderingElement", "elem", ",", "IAtom", "atom", ")", "{", "if", "(", "elem", "==", "null", ")", "return", "null", ";", "MarkedElement", "tagElem", "=", "markupChemObj", "(", "elem", ",", "atom", ")", ";", "tagElem", ".", "aggClass", "(", "\"atom\"", ")", ";", "return", "tagElem", ";", "}" ]
Markup a atom with the class 'atom' and optionally the ids/classes from it's properties. @param elem rendering element @param atom atom @return the marked element
[ "Markup", "a", "atom", "with", "the", "class", "atom", "and", "optionally", "the", "ids", "/", "classes", "from", "it", "s", "properties", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/MarkedElement.java#L166-L172
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/ClientCommsDiagnosticModule.java
ClientCommsDiagnosticModule.dumpClientConversation
private void dumpClientConversation(IncidentStream is, Conversation conv) throws SIException { """ This method dumps the particulars of a particular client conversation. @param is @param conv @throws SIException of the getResolvedUserId() call fails. """ // Get the conversation state ClientConversationState convState = (ClientConversationState) conv.getAttachment(); SICoreConnection siConn = convState.getSICoreConnection(); if (siConn == null) { is.writeLine(" ** No SICoreConnection in ConversationState **", "(Conversation is initializing?)"); } else { is.writeLine(" Connected using: ", convState.getCommsConnection()); is.writeLine(" Connected to ME: ", siConn.getMeName() + " [" + siConn.getMeUuid() + "]"); is.writeLine(" Resolved UserId: ", siConn.getResolvedUserid()); is.writeLine(" ME is version ", siConn.getApiLevelDescription()); // Get the proxy queue group ProxyQueueConversationGroupImpl pqgroup = (ProxyQueueConversationGroupImpl) convState.getProxyQueueConversationGroup(); if (pqgroup == null) { is.writeLine(" Number of proxy queues found", "0"); } else { Map map = pqgroup.getProxyQueues(); // Clone it Map idToProxyQueueMap = (Map) ((HashMap) map).clone(); is.writeLine(" Number of proxy queues found", idToProxyQueueMap.size()); for (Iterator i2 = idToProxyQueueMap.values().iterator(); i2.hasNext();) { ProxyQueue pq = (ProxyQueue) i2.next(); is.writeLine(" ", pq); } } // Lets also introspect the details of the conversation state is.introspectAndWriteLine("Introspection of the conversation state:", convState); } }
java
private void dumpClientConversation(IncidentStream is, Conversation conv) throws SIException { // Get the conversation state ClientConversationState convState = (ClientConversationState) conv.getAttachment(); SICoreConnection siConn = convState.getSICoreConnection(); if (siConn == null) { is.writeLine(" ** No SICoreConnection in ConversationState **", "(Conversation is initializing?)"); } else { is.writeLine(" Connected using: ", convState.getCommsConnection()); is.writeLine(" Connected to ME: ", siConn.getMeName() + " [" + siConn.getMeUuid() + "]"); is.writeLine(" Resolved UserId: ", siConn.getResolvedUserid()); is.writeLine(" ME is version ", siConn.getApiLevelDescription()); // Get the proxy queue group ProxyQueueConversationGroupImpl pqgroup = (ProxyQueueConversationGroupImpl) convState.getProxyQueueConversationGroup(); if (pqgroup == null) { is.writeLine(" Number of proxy queues found", "0"); } else { Map map = pqgroup.getProxyQueues(); // Clone it Map idToProxyQueueMap = (Map) ((HashMap) map).clone(); is.writeLine(" Number of proxy queues found", idToProxyQueueMap.size()); for (Iterator i2 = idToProxyQueueMap.values().iterator(); i2.hasNext();) { ProxyQueue pq = (ProxyQueue) i2.next(); is.writeLine(" ", pq); } } // Lets also introspect the details of the conversation state is.introspectAndWriteLine("Introspection of the conversation state:", convState); } }
[ "private", "void", "dumpClientConversation", "(", "IncidentStream", "is", ",", "Conversation", "conv", ")", "throws", "SIException", "{", "// Get the conversation state", "ClientConversationState", "convState", "=", "(", "ClientConversationState", ")", "conv", ".", "getAttachment", "(", ")", ";", "SICoreConnection", "siConn", "=", "convState", ".", "getSICoreConnection", "(", ")", ";", "if", "(", "siConn", "==", "null", ")", "{", "is", ".", "writeLine", "(", "\" ** No SICoreConnection in ConversationState **\"", ",", "\"(Conversation is initializing?)\"", ")", ";", "}", "else", "{", "is", ".", "writeLine", "(", "\" Connected using: \"", ",", "convState", ".", "getCommsConnection", "(", ")", ")", ";", "is", ".", "writeLine", "(", "\" Connected to ME: \"", ",", "siConn", ".", "getMeName", "(", ")", "+", "\" [\"", "+", "siConn", ".", "getMeUuid", "(", ")", "+", "\"]\"", ")", ";", "is", ".", "writeLine", "(", "\" Resolved UserId: \"", ",", "siConn", ".", "getResolvedUserid", "(", ")", ")", ";", "is", ".", "writeLine", "(", "\" ME is version \"", ",", "siConn", ".", "getApiLevelDescription", "(", ")", ")", ";", "// Get the proxy queue group", "ProxyQueueConversationGroupImpl", "pqgroup", "=", "(", "ProxyQueueConversationGroupImpl", ")", "convState", ".", "getProxyQueueConversationGroup", "(", ")", ";", "if", "(", "pqgroup", "==", "null", ")", "{", "is", ".", "writeLine", "(", "\" Number of proxy queues found\"", ",", "\"0\"", ")", ";", "}", "else", "{", "Map", "map", "=", "pqgroup", ".", "getProxyQueues", "(", ")", ";", "// Clone it", "Map", "idToProxyQueueMap", "=", "(", "Map", ")", "(", "(", "HashMap", ")", "map", ")", ".", "clone", "(", ")", ";", "is", ".", "writeLine", "(", "\" Number of proxy queues found\"", ",", "idToProxyQueueMap", ".", "size", "(", ")", ")", ";", "for", "(", "Iterator", "i2", "=", "idToProxyQueueMap", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "i2", ".", "hasNext", "(", ")", ";", ")", "{", "ProxyQueue", "pq", "=", "(", "ProxyQueue", ")", "i2", ".", "next", "(", ")", ";", "is", ".", "writeLine", "(", "\" \"", ",", "pq", ")", ";", "}", "}", "// Lets also introspect the details of the conversation state", "is", ".", "introspectAndWriteLine", "(", "\"Introspection of the conversation state:\"", ",", "convState", ")", ";", "}", "}" ]
This method dumps the particulars of a particular client conversation. @param is @param conv @throws SIException of the getResolvedUserId() call fails.
[ "This", "method", "dumps", "the", "particulars", "of", "a", "particular", "client", "conversation", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/ClientCommsDiagnosticModule.java#L144-L187
rsocket/rsocket-java
rsocket-core/src/main/java/io/rsocket/util/DefaultPayload.java
DefaultPayload.create
public static Payload create(CharSequence data, @Nullable CharSequence metadata) { """ Static factory method for a text payload. Mainly looks better than "new DefaultPayload(data, metadata)" @param data the data of the payload. @param metadata the metadata for the payload. @return a payload. """ return create( StandardCharsets.UTF_8.encode(CharBuffer.wrap(data)), metadata == null ? null : StandardCharsets.UTF_8.encode(CharBuffer.wrap(metadata))); }
java
public static Payload create(CharSequence data, @Nullable CharSequence metadata) { return create( StandardCharsets.UTF_8.encode(CharBuffer.wrap(data)), metadata == null ? null : StandardCharsets.UTF_8.encode(CharBuffer.wrap(metadata))); }
[ "public", "static", "Payload", "create", "(", "CharSequence", "data", ",", "@", "Nullable", "CharSequence", "metadata", ")", "{", "return", "create", "(", "StandardCharsets", ".", "UTF_8", ".", "encode", "(", "CharBuffer", ".", "wrap", "(", "data", ")", ")", ",", "metadata", "==", "null", "?", "null", ":", "StandardCharsets", ".", "UTF_8", ".", "encode", "(", "CharBuffer", ".", "wrap", "(", "metadata", ")", ")", ")", ";", "}" ]
Static factory method for a text payload. Mainly looks better than "new DefaultPayload(data, metadata)" @param data the data of the payload. @param metadata the metadata for the payload. @return a payload.
[ "Static", "factory", "method", "for", "a", "text", "payload", ".", "Mainly", "looks", "better", "than", "new", "DefaultPayload", "(", "data", "metadata", ")" ]
train
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-core/src/main/java/io/rsocket/util/DefaultPayload.java#L61-L65
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/Assert.java
Assert.assertTree
public static void assertTree(int rootType, String preorder, Tree tree) { """ Asserts a parse tree. @param rootType the type of the root of the tree. @param preorder the preorder traversal of the tree. @param tree an ANTLR tree to assert on. """ assertNotNull("tree should be non-null", tree); assertPreordered(null, preorder, tree); assertEquals("Comparing root type", rootType, tree.getType()); }
java
public static void assertTree(int rootType, String preorder, Tree tree) { assertNotNull("tree should be non-null", tree); assertPreordered(null, preorder, tree); assertEquals("Comparing root type", rootType, tree.getType()); }
[ "public", "static", "void", "assertTree", "(", "int", "rootType", ",", "String", "preorder", ",", "Tree", "tree", ")", "{", "assertNotNull", "(", "\"tree should be non-null\"", ",", "tree", ")", ";", "assertPreordered", "(", "null", ",", "preorder", ",", "tree", ")", ";", "assertEquals", "(", "\"Comparing root type\"", ",", "rootType", ",", "tree", ".", "getType", "(", ")", ")", ";", "}" ]
Asserts a parse tree. @param rootType the type of the root of the tree. @param preorder the preorder traversal of the tree. @param tree an ANTLR tree to assert on.
[ "Asserts", "a", "parse", "tree", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L242-L247
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java
GobblinMetricsRegistry.putIfAbsent
public GobblinMetrics putIfAbsent(String id, GobblinMetrics gobblinMetrics) { """ Associate a {@link GobblinMetrics} instance with a given ID if the ID is not already associated with a {@link GobblinMetrics} instance. @param id the given {@link GobblinMetrics} ID @param gobblinMetrics the {@link GobblinMetrics} instance to be associated with the given ID @return the previous {@link GobblinMetrics} instance associated with the ID or {@code null} if there's no previous {@link GobblinMetrics} instance associated with the ID """ return this.metricsCache.asMap().putIfAbsent(id, gobblinMetrics); }
java
public GobblinMetrics putIfAbsent(String id, GobblinMetrics gobblinMetrics) { return this.metricsCache.asMap().putIfAbsent(id, gobblinMetrics); }
[ "public", "GobblinMetrics", "putIfAbsent", "(", "String", "id", ",", "GobblinMetrics", "gobblinMetrics", ")", "{", "return", "this", ".", "metricsCache", ".", "asMap", "(", ")", ".", "putIfAbsent", "(", "id", ",", "gobblinMetrics", ")", ";", "}" ]
Associate a {@link GobblinMetrics} instance with a given ID if the ID is not already associated with a {@link GobblinMetrics} instance. @param id the given {@link GobblinMetrics} ID @param gobblinMetrics the {@link GobblinMetrics} instance to be associated with the given ID @return the previous {@link GobblinMetrics} instance associated with the ID or {@code null} if there's no previous {@link GobblinMetrics} instance associated with the ID
[ "Associate", "a", "{", "@link", "GobblinMetrics", "}", "instance", "with", "a", "given", "ID", "if", "the", "ID", "is", "not", "already", "associated", "with", "a", "{", "@link", "GobblinMetrics", "}", "instance", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java#L64-L66
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java
Math.copySign
public static double copySign(double magnitude, double sign) { """ Returns the first floating-point argument with the sign of the second floating-point argument. Note that unlike the {@link StrictMath#copySign(double, double) StrictMath.copySign} method, this method does not require NaN {@code sign} arguments to be treated as positive values; implementations are permitted to treat some NaN arguments as positive and other NaN arguments as negative to allow greater performance. @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}. @since 1.6 """ return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) & (DoubleConsts.SIGN_BIT_MASK)) | (Double.doubleToRawLongBits(magnitude) & (DoubleConsts.EXP_BIT_MASK | DoubleConsts.SIGNIF_BIT_MASK))); }
java
public static double copySign(double magnitude, double sign) { return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) & (DoubleConsts.SIGN_BIT_MASK)) | (Double.doubleToRawLongBits(magnitude) & (DoubleConsts.EXP_BIT_MASK | DoubleConsts.SIGNIF_BIT_MASK))); }
[ "public", "static", "double", "copySign", "(", "double", "magnitude", ",", "double", "sign", ")", "{", "return", "Double", ".", "longBitsToDouble", "(", "(", "Double", ".", "doubleToRawLongBits", "(", "sign", ")", "&", "(", "DoubleConsts", ".", "SIGN_BIT_MASK", ")", ")", "|", "(", "Double", ".", "doubleToRawLongBits", "(", "magnitude", ")", "&", "(", "DoubleConsts", ".", "EXP_BIT_MASK", "|", "DoubleConsts", ".", "SIGNIF_BIT_MASK", ")", ")", ")", ";", "}" ]
Returns the first floating-point argument with the sign of the second floating-point argument. Note that unlike the {@link StrictMath#copySign(double, double) StrictMath.copySign} method, this method does not require NaN {@code sign} arguments to be treated as positive values; implementations are permitted to treat some NaN arguments as positive and other NaN arguments as negative to allow greater performance. @param magnitude the parameter providing the magnitude of the result @param sign the parameter providing the sign of the result @return a value with the magnitude of {@code magnitude} and the sign of {@code sign}. @since 1.6
[ "Returns", "the", "first", "floating", "-", "point", "argument", "with", "the", "sign", "of", "the", "second", "floating", "-", "point", "argument", ".", "Note", "that", "unlike", "the", "{", "@link", "StrictMath#copySign", "(", "double", "double", ")", "StrictMath", ".", "copySign", "}", "method", "this", "method", "does", "not", "require", "NaN", "{", "@code", "sign", "}", "arguments", "to", "be", "treated", "as", "positive", "values", ";", "implementations", "are", "permitted", "to", "treat", "some", "NaN", "arguments", "as", "positive", "and", "other", "NaN", "arguments", "as", "negative", "to", "allow", "greater", "performance", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1770-L1776
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java
VariantMetadataManager.loadPedigree
public VariantMetadata loadPedigree(List<Pedigree> pedigrees, String studyId) { """ Load a list of pedrigree objects into a given study (from its study ID). @param pedigrees List of Pedigree objects to load @param studyId Study ID related to that pedigrees @return Variant metadata object """ VariantMetadata variantMetadata = null; for(Pedigree pedigree: pedigrees) { variantMetadata = loadPedigree(pedigree, studyId); } return variantMetadata; }
java
public VariantMetadata loadPedigree(List<Pedigree> pedigrees, String studyId) { VariantMetadata variantMetadata = null; for(Pedigree pedigree: pedigrees) { variantMetadata = loadPedigree(pedigree, studyId); } return variantMetadata; }
[ "public", "VariantMetadata", "loadPedigree", "(", "List", "<", "Pedigree", ">", "pedigrees", ",", "String", "studyId", ")", "{", "VariantMetadata", "variantMetadata", "=", "null", ";", "for", "(", "Pedigree", "pedigree", ":", "pedigrees", ")", "{", "variantMetadata", "=", "loadPedigree", "(", "pedigree", ",", "studyId", ")", ";", "}", "return", "variantMetadata", ";", "}" ]
Load a list of pedrigree objects into a given study (from its study ID). @param pedigrees List of Pedigree objects to load @param studyId Study ID related to that pedigrees @return Variant metadata object
[ "Load", "a", "list", "of", "pedrigree", "objects", "into", "a", "given", "study", "(", "from", "its", "study", "ID", ")", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L525-L531
stephanrauh/AngularFaces
AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/flavors/kendo/puiBody/PuiBody.java
PuiBody.getValueToRender
public static Object getValueToRender(FacesContext context, UIComponent component) { """ This method has been copied from the PrimeFaces 5 project. Algorithm works as follows; - If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors terminates jsf lifecycle - Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned @param context FacesContext instance @param component UIComponent instance whose value will be returned @return End text """ if (component instanceof ValueHolder) { if (component instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) component; Object submittedValue = input.getSubmittedValue(); ConfigContainer config = RequestContext.getCurrentInstance().getApplicationContext().getConfig(); if (config.isInterpretEmptyStringAsNull() && submittedValue == null && context.isValidationFailed() && !input.isValid()) { return null; } else if (submittedValue != null) { return submittedValue; } } ValueHolder valueHolder = (ValueHolder) component; Object value = valueHolder.getValue(); return value; } // component it not a value holder return null; }
java
public static Object getValueToRender(FacesContext context, UIComponent component) { if (component instanceof ValueHolder) { if (component instanceof EditableValueHolder) { EditableValueHolder input = (EditableValueHolder) component; Object submittedValue = input.getSubmittedValue(); ConfigContainer config = RequestContext.getCurrentInstance().getApplicationContext().getConfig(); if (config.isInterpretEmptyStringAsNull() && submittedValue == null && context.isValidationFailed() && !input.isValid()) { return null; } else if (submittedValue != null) { return submittedValue; } } ValueHolder valueHolder = (ValueHolder) component; Object value = valueHolder.getValue(); return value; } // component it not a value holder return null; }
[ "public", "static", "Object", "getValueToRender", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "{", "if", "(", "component", "instanceof", "ValueHolder", ")", "{", "if", "(", "component", "instanceof", "EditableValueHolder", ")", "{", "EditableValueHolder", "input", "=", "(", "EditableValueHolder", ")", "component", ";", "Object", "submittedValue", "=", "input", ".", "getSubmittedValue", "(", ")", ";", "ConfigContainer", "config", "=", "RequestContext", ".", "getCurrentInstance", "(", ")", ".", "getApplicationContext", "(", ")", ".", "getConfig", "(", ")", ";", "if", "(", "config", ".", "isInterpretEmptyStringAsNull", "(", ")", "&&", "submittedValue", "==", "null", "&&", "context", ".", "isValidationFailed", "(", ")", "&&", "!", "input", ".", "isValid", "(", ")", ")", "{", "return", "null", ";", "}", "else", "if", "(", "submittedValue", "!=", "null", ")", "{", "return", "submittedValue", ";", "}", "}", "ValueHolder", "valueHolder", "=", "(", "ValueHolder", ")", "component", ";", "Object", "value", "=", "valueHolder", ".", "getValue", "(", ")", ";", "return", "value", ";", "}", "// component it not a value holder", "return", "null", ";", "}" ]
This method has been copied from the PrimeFaces 5 project. Algorithm works as follows; - If it's an input component, submitted value is checked first since it'd be the value to be used in case validation errors terminates jsf lifecycle - Finally the value of the component is retrieved from backing bean and if there's a converter, converted value is returned @param context FacesContext instance @param component UIComponent instance whose value will be returned @return End text
[ "This", "method", "has", "been", "copied", "from", "the", "PrimeFaces", "5", "project", "." ]
train
https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/incubator/AngularFaces-widgets/src/main/java/de/beyondjava/angularFaces/flavors/kendo/puiBody/PuiBody.java#L141-L163
wisdom-framework/wisdom
core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java
CryptoServiceSingleton.decryptAESWithCBC
@Override public String decryptAESWithCBC(String value, String privateKey, String salt, String iv) { """ Decrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key must have a length of 16 bytes, the salt and initialization vector must be valid hexadecimal Strings. @param value An encrypted String encoded using Base64. @param privateKey The private key @param salt The salt (hexadecimal String) @param iv The initialization vector (hexadecimal String) @return The decrypted String """ SecretKey key = generateAESKey(privateKey, salt); byte[] decrypted = doFinal(Cipher.DECRYPT_MODE, key, iv, decodeBase64(value)); return new String(decrypted, UTF_8); }
java
@Override public String decryptAESWithCBC(String value, String privateKey, String salt, String iv) { SecretKey key = generateAESKey(privateKey, salt); byte[] decrypted = doFinal(Cipher.DECRYPT_MODE, key, iv, decodeBase64(value)); return new String(decrypted, UTF_8); }
[ "@", "Override", "public", "String", "decryptAESWithCBC", "(", "String", "value", ",", "String", "privateKey", ",", "String", "salt", ",", "String", "iv", ")", "{", "SecretKey", "key", "=", "generateAESKey", "(", "privateKey", ",", "salt", ")", ";", "byte", "[", "]", "decrypted", "=", "doFinal", "(", "Cipher", ".", "DECRYPT_MODE", ",", "key", ",", "iv", ",", "decodeBase64", "(", "value", ")", ")", ";", "return", "new", "String", "(", "decrypted", ",", "UTF_8", ")", ";", "}" ]
Decrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The private key must have a length of 16 bytes, the salt and initialization vector must be valid hexadecimal Strings. @param value An encrypted String encoded using Base64. @param privateKey The private key @param salt The salt (hexadecimal String) @param iv The initialization vector (hexadecimal String) @return The decrypted String
[ "Decrypt", "a", "String", "with", "the", "AES", "encryption", "advanced", "using", "AES", "/", "CBC", "/", "PKCS5Padding", ".", "Unlike", "the", "regular", "encode", "/", "decode", "AES", "method", "using", "ECB", "(", "Electronic", "Codebook", ")", "it", "uses", "Cipher", "-", "block", "chaining", "(", "CBC", ")", ".", "The", "private", "key", "must", "have", "a", "length", "of", "16", "bytes", "the", "salt", "and", "initialization", "vector", "must", "be", "valid", "hexadecimal", "Strings", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L169-L174
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.choiceMethod
private List<InterfaceInfo> choiceMethod(List<XsdGroup> groupElements, List<XsdElement> directElements, String className, int interfaceIndex, String apiName, String groupName) { """ Generates an interface based on a {@link XsdChoice} element. @param groupElements The contained groupElements. @param directElements The direct elements of the {@link XsdChoice} element. @param className The name of the class that contains the {@link XsdChoice} element. @param interfaceIndex The current interface index. @param apiName The name of the generated fluent interface. @param groupName The name of the group in which this {@link XsdChoice} element is contained, if any. @return A {@link List} of {@link InterfaceInfo} objects containing relevant interface information. """ List<InterfaceInfo> interfaceInfoList = new ArrayList<>(); String interfaceName; if (groupName != null){ interfaceName = firstToUpper(groupName + CHOICE_SUFFIX); } else { interfaceName = className + CHOICE_SUFFIX + interfaceIndex; } if (createdInterfaces.containsKey(interfaceName)){ interfaceInfoList.add(createdInterfaces.get(interfaceName)); return interfaceInfoList; } return createChoiceInterface(groupElements, directElements, interfaceName, className, groupName, interfaceIndex, apiName); }
java
private List<InterfaceInfo> choiceMethod(List<XsdGroup> groupElements, List<XsdElement> directElements, String className, int interfaceIndex, String apiName, String groupName){ List<InterfaceInfo> interfaceInfoList = new ArrayList<>(); String interfaceName; if (groupName != null){ interfaceName = firstToUpper(groupName + CHOICE_SUFFIX); } else { interfaceName = className + CHOICE_SUFFIX + interfaceIndex; } if (createdInterfaces.containsKey(interfaceName)){ interfaceInfoList.add(createdInterfaces.get(interfaceName)); return interfaceInfoList; } return createChoiceInterface(groupElements, directElements, interfaceName, className, groupName, interfaceIndex, apiName); }
[ "private", "List", "<", "InterfaceInfo", ">", "choiceMethod", "(", "List", "<", "XsdGroup", ">", "groupElements", ",", "List", "<", "XsdElement", ">", "directElements", ",", "String", "className", ",", "int", "interfaceIndex", ",", "String", "apiName", ",", "String", "groupName", ")", "{", "List", "<", "InterfaceInfo", ">", "interfaceInfoList", "=", "new", "ArrayList", "<>", "(", ")", ";", "String", "interfaceName", ";", "if", "(", "groupName", "!=", "null", ")", "{", "interfaceName", "=", "firstToUpper", "(", "groupName", "+", "CHOICE_SUFFIX", ")", ";", "}", "else", "{", "interfaceName", "=", "className", "+", "CHOICE_SUFFIX", "+", "interfaceIndex", ";", "}", "if", "(", "createdInterfaces", ".", "containsKey", "(", "interfaceName", ")", ")", "{", "interfaceInfoList", ".", "add", "(", "createdInterfaces", ".", "get", "(", "interfaceName", ")", ")", ";", "return", "interfaceInfoList", ";", "}", "return", "createChoiceInterface", "(", "groupElements", ",", "directElements", ",", "interfaceName", ",", "className", ",", "groupName", ",", "interfaceIndex", ",", "apiName", ")", ";", "}" ]
Generates an interface based on a {@link XsdChoice} element. @param groupElements The contained groupElements. @param directElements The direct elements of the {@link XsdChoice} element. @param className The name of the class that contains the {@link XsdChoice} element. @param interfaceIndex The current interface index. @param apiName The name of the generated fluent interface. @param groupName The name of the group in which this {@link XsdChoice} element is contained, if any. @return A {@link List} of {@link InterfaceInfo} objects containing relevant interface information.
[ "Generates", "an", "interface", "based", "on", "a", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L664-L680
wiselenium/wiselenium
wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java
Wiselenium.findElement
public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { """ Finds the first element within the search context using the given mechanism. <br/> Throws a NoSuchElementException if the element couldn't be found. <br/> @param clazz The class of the element. @param by The locating mechanism to use. @param searchContext The search context. @return The element. @since 0.3.0 """ WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); }
java
public static <E> E findElement(Class<E> clazz, By by, SearchContext searchContext) { WebElement webElement = searchContext.findElement(by); return decorateElement(clazz, webElement); }
[ "public", "static", "<", "E", ">", "E", "findElement", "(", "Class", "<", "E", ">", "clazz", ",", "By", "by", ",", "SearchContext", "searchContext", ")", "{", "WebElement", "webElement", "=", "searchContext", ".", "findElement", "(", "by", ")", ";", "return", "decorateElement", "(", "clazz", ",", "webElement", ")", ";", "}" ]
Finds the first element within the search context using the given mechanism. <br/> Throws a NoSuchElementException if the element couldn't be found. <br/> @param clazz The class of the element. @param by The locating mechanism to use. @param searchContext The search context. @return The element. @since 0.3.0
[ "Finds", "the", "first", "element", "within", "the", "search", "context", "using", "the", "given", "mechanism", ".", "<br", "/", ">", "Throws", "a", "NoSuchElementException", "if", "the", "element", "couldn", "t", "be", "found", ".", "<br", "/", ">" ]
train
https://github.com/wiselenium/wiselenium/blob/15de6484d8f516b3d02391d3bd6a56a03e632706/wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java#L54-L57
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
ToolsAwt.getRasterBuffer
public static BufferedImage getRasterBuffer(BufferedImage image, double fr, double fg, double fb) { """ Get raster buffer from data. @param image The image buffer. @param fr The factor red. @param fg The factor green. @param fb The factor blue. @return The rastered image. """ final BufferedImage raster = createImage(image.getWidth(), image.getHeight(), image.getTransparency()); for (int i = 0; i < raster.getWidth(); i++) { for (int j = 0; j < raster.getHeight(); j++) { raster.setRGB(i, j, UtilColor.multiplyRgb(image.getRGB(i, j), fr, fg, fb)); } } return raster; }
java
public static BufferedImage getRasterBuffer(BufferedImage image, double fr, double fg, double fb) { final BufferedImage raster = createImage(image.getWidth(), image.getHeight(), image.getTransparency()); for (int i = 0; i < raster.getWidth(); i++) { for (int j = 0; j < raster.getHeight(); j++) { raster.setRGB(i, j, UtilColor.multiplyRgb(image.getRGB(i, j), fr, fg, fb)); } } return raster; }
[ "public", "static", "BufferedImage", "getRasterBuffer", "(", "BufferedImage", "image", ",", "double", "fr", ",", "double", "fg", ",", "double", "fb", ")", "{", "final", "BufferedImage", "raster", "=", "createImage", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "image", ".", "getTransparency", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "raster", ".", "getWidth", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "raster", ".", "getHeight", "(", ")", ";", "j", "++", ")", "{", "raster", ".", "setRGB", "(", "i", ",", "j", ",", "UtilColor", ".", "multiplyRgb", "(", "image", ".", "getRGB", "(", "i", ",", "j", ")", ",", "fr", ",", "fg", ",", "fb", ")", ")", ";", "}", "}", "return", "raster", ";", "}" ]
Get raster buffer from data. @param image The image buffer. @param fr The factor red. @param fg The factor green. @param fb The factor blue. @return The rastered image.
[ "Get", "raster", "buffer", "from", "data", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L346-L357
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.getXtextKey
private static String getXtextKey(String preferenceContainerID, String preferenceName) { """ Create a preference key according to the Xtext option block standards. @param preferenceContainerID the identifier of the generator's preference container. @param preferenceName the name of the preference. @return the key. """ return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID + PreferenceConstants.SEPARATOR + preferenceName; }
java
private static String getXtextKey(String preferenceContainerID, String preferenceName) { return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID + PreferenceConstants.SEPARATOR + preferenceName; }
[ "private", "static", "String", "getXtextKey", "(", "String", "preferenceContainerID", ",", "String", "preferenceName", ")", "{", "return", "GENERATOR_PREFERENCE_TAG", "+", "PreferenceConstants", ".", "SEPARATOR", "+", "preferenceContainerID", "+", "PreferenceConstants", ".", "SEPARATOR", "+", "preferenceName", ";", "}" ]
Create a preference key according to the Xtext option block standards. @param preferenceContainerID the identifier of the generator's preference container. @param preferenceName the name of the preference. @return the key.
[ "Create", "a", "preference", "key", "according", "to", "the", "Xtext", "option", "block", "standards", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L100-L103
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java
PDF417HighLevelEncoder.determineConsecutiveBinaryCount
private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding) throws WriterException { """ Determines the number of consecutive characters that are encodable using binary compaction. @param msg the message @param startpos the start position within the message @param encoding the charset used to convert the message to a byte array @return the requested character count """ CharsetEncoder encoder = encoding.newEncoder(); int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; while (numericCount < 13 && isDigit(ch)) { numericCount++; //textCount++; int i = idx + numericCount; if (i >= len) { break; } ch = msg.charAt(i); } if (numericCount >= 13) { return idx - startpos; } ch = msg.charAt(idx); if (!encoder.canEncode(ch)) { throw new WriterException("Non-encodable character detected: " + ch + " (Unicode: " + (int) ch + ')'); } idx++; } return idx - startpos; }
java
private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding) throws WriterException { CharsetEncoder encoder = encoding.newEncoder(); int len = msg.length(); int idx = startpos; while (idx < len) { char ch = msg.charAt(idx); int numericCount = 0; while (numericCount < 13 && isDigit(ch)) { numericCount++; //textCount++; int i = idx + numericCount; if (i >= len) { break; } ch = msg.charAt(i); } if (numericCount >= 13) { return idx - startpos; } ch = msg.charAt(idx); if (!encoder.canEncode(ch)) { throw new WriterException("Non-encodable character detected: " + ch + " (Unicode: " + (int) ch + ')'); } idx++; } return idx - startpos; }
[ "private", "static", "int", "determineConsecutiveBinaryCount", "(", "String", "msg", ",", "int", "startpos", ",", "Charset", "encoding", ")", "throws", "WriterException", "{", "CharsetEncoder", "encoder", "=", "encoding", ".", "newEncoder", "(", ")", ";", "int", "len", "=", "msg", ".", "length", "(", ")", ";", "int", "idx", "=", "startpos", ";", "while", "(", "idx", "<", "len", ")", "{", "char", "ch", "=", "msg", ".", "charAt", "(", "idx", ")", ";", "int", "numericCount", "=", "0", ";", "while", "(", "numericCount", "<", "13", "&&", "isDigit", "(", "ch", ")", ")", "{", "numericCount", "++", ";", "//textCount++;", "int", "i", "=", "idx", "+", "numericCount", ";", "if", "(", "i", ">=", "len", ")", "{", "break", ";", "}", "ch", "=", "msg", ".", "charAt", "(", "i", ")", ";", "}", "if", "(", "numericCount", ">=", "13", ")", "{", "return", "idx", "-", "startpos", ";", "}", "ch", "=", "msg", ".", "charAt", "(", "idx", ")", ";", "if", "(", "!", "encoder", ".", "canEncode", "(", "ch", ")", ")", "{", "throw", "new", "WriterException", "(", "\"Non-encodable character detected: \"", "+", "ch", "+", "\" (Unicode: \"", "+", "(", "int", ")", "ch", "+", "'", "'", ")", ";", "}", "idx", "++", ";", "}", "return", "idx", "-", "startpos", ";", "}" ]
Determines the number of consecutive characters that are encodable using binary compaction. @param msg the message @param startpos the start position within the message @param encoding the charset used to convert the message to a byte array @return the requested character count
[ "Determines", "the", "number", "of", "consecutive", "characters", "that", "are", "encodable", "using", "binary", "compaction", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java#L537-L566
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.buildExpression
@Nonnull private Expression buildExpression( String str ) { """ Create an expression from the given atomic string. @param str the expression like a number, color, variable, string, etc @return the expression """ switch( str.charAt( 0 ) ) { case '@': return new VariableExpression( reader, str ); case '-': if( str.startsWith( "-@" ) ) { return new FunctionExpression( reader, "-", new Operation( reader, buildExpression( str.substring( 1 ) ), (char)0 ) ); } //$FALL-THROUGH$ default: return new ValueExpression( reader, str ); } }
java
@Nonnull private Expression buildExpression( String str ) { switch( str.charAt( 0 ) ) { case '@': return new VariableExpression( reader, str ); case '-': if( str.startsWith( "-@" ) ) { return new FunctionExpression( reader, "-", new Operation( reader, buildExpression( str.substring( 1 ) ), (char)0 ) ); } //$FALL-THROUGH$ default: return new ValueExpression( reader, str ); } }
[ "@", "Nonnull", "private", "Expression", "buildExpression", "(", "String", "str", ")", "{", "switch", "(", "str", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ":", "return", "new", "VariableExpression", "(", "reader", ",", "str", ")", ";", "case", "'", "'", ":", "if", "(", "str", ".", "startsWith", "(", "\"-@\"", ")", ")", "{", "return", "new", "FunctionExpression", "(", "reader", ",", "\"-\"", ",", "new", "Operation", "(", "reader", ",", "buildExpression", "(", "str", ".", "substring", "(", "1", ")", ")", ",", "(", "char", ")", "0", ")", ")", ";", "}", "//$FALL-THROUGH$", "default", ":", "return", "new", "ValueExpression", "(", "reader", ",", "str", ")", ";", "}", "}" ]
Create an expression from the given atomic string. @param str the expression like a number, color, variable, string, etc @return the expression
[ "Create", "an", "expression", "from", "the", "given", "atomic", "string", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1154-L1167
cverges/expect4j
src/main/java/expect4j/ConsumerImpl.java
ConsumerImpl.notifyBufferChange
protected void notifyBufferChange(char[] newData, int numChars) { """ Notifies all registered BufferChangeLogger instances of a change. @param newData the buffer that contains the new data being added @param numChars the number of valid characters in the buffer """ synchronized(bufferChangeLoggers) { Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator(); while (iterator.hasNext()) { iterator.next().bufferChanged(newData, numChars); } } }
java
protected void notifyBufferChange(char[] newData, int numChars) { synchronized(bufferChangeLoggers) { Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator(); while (iterator.hasNext()) { iterator.next().bufferChanged(newData, numChars); } } }
[ "protected", "void", "notifyBufferChange", "(", "char", "[", "]", "newData", ",", "int", "numChars", ")", "{", "synchronized", "(", "bufferChangeLoggers", ")", "{", "Iterator", "<", "BufferChangeLogger", ">", "iterator", "=", "bufferChangeLoggers", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "iterator", ".", "next", "(", ")", ".", "bufferChanged", "(", "newData", ",", "numChars", ")", ";", "}", "}", "}" ]
Notifies all registered BufferChangeLogger instances of a change. @param newData the buffer that contains the new data being added @param numChars the number of valid characters in the buffer
[ "Notifies", "all", "registered", "BufferChangeLogger", "instances", "of", "a", "change", "." ]
train
https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/ConsumerImpl.java#L175-L182
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.getRmsd
private static double getRmsd(Atom[] catmp1, Atom[] catmp2) throws StructureException { """ Calculate the RMSD for two sets of atoms. Rotates the 2nd atom set so make sure this does not cause problems later @param catmp1 @return """ Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2)); Calc.transform(catmp2, trans); // if ( showAlig) { // StructureAlignmentJmol jmol = new StructureAlignmentJmol(); // jmol.setTitle("AFPCHainer: getRmsd" + rmsd); // // Chain c1 = new ChainImpl(); // c1.setName("A"); // for ( Atom a : catmp1){ // c1.addGroup(a.getParent()); // } // // Chain c2 = new ChainImpl(); // c2.setName("B"); // for ( Atom a : catmp2){ // c2.addGroup(a.getParent()); // } // // Structure fake = new StructureImpl(); // fake.setPDBCode("AFPCHainer: getRmsd" + rmsd); // List<Chain> model1 = new ArrayList<Chain>(); // model1.add(c1); // List<Chain> model2 = new ArrayList<Chain>(); // model2.add(c2); // fake.addModel(model1); // fake.addModel(model2); // fake.setNmr(true); // // jmol.setStructure(fake); // jmol.evalString("select *; backbone 0.4; wireframe off; spacefill off; " + // "select not protein and not solvent; spacefill on;"); // jmol.evalString("select */1 ; color red; model 1; "); // // // now show both models again. // jmol.evalString("model 0;"); // } return Calc.rmsd(catmp1,catmp2); }
java
private static double getRmsd(Atom[] catmp1, Atom[] catmp2) throws StructureException{ Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2)); Calc.transform(catmp2, trans); // if ( showAlig) { // StructureAlignmentJmol jmol = new StructureAlignmentJmol(); // jmol.setTitle("AFPCHainer: getRmsd" + rmsd); // // Chain c1 = new ChainImpl(); // c1.setName("A"); // for ( Atom a : catmp1){ // c1.addGroup(a.getParent()); // } // // Chain c2 = new ChainImpl(); // c2.setName("B"); // for ( Atom a : catmp2){ // c2.addGroup(a.getParent()); // } // // Structure fake = new StructureImpl(); // fake.setPDBCode("AFPCHainer: getRmsd" + rmsd); // List<Chain> model1 = new ArrayList<Chain>(); // model1.add(c1); // List<Chain> model2 = new ArrayList<Chain>(); // model2.add(c2); // fake.addModel(model1); // fake.addModel(model2); // fake.setNmr(true); // // jmol.setStructure(fake); // jmol.evalString("select *; backbone 0.4; wireframe off; spacefill off; " + // "select not protein and not solvent; spacefill on;"); // jmol.evalString("select */1 ; color red; model 1; "); // // // now show both models again. // jmol.evalString("model 0;"); // } return Calc.rmsd(catmp1,catmp2); }
[ "private", "static", "double", "getRmsd", "(", "Atom", "[", "]", "catmp1", ",", "Atom", "[", "]", "catmp2", ")", "throws", "StructureException", "{", "Matrix4d", "trans", "=", "SuperPositions", ".", "superpose", "(", "Calc", ".", "atomsToPoints", "(", "catmp1", ")", ",", "Calc", ".", "atomsToPoints", "(", "catmp2", ")", ")", ";", "Calc", ".", "transform", "(", "catmp2", ",", "trans", ")", ";", "// if ( showAlig) {", "// StructureAlignmentJmol jmol = new StructureAlignmentJmol();", "// jmol.setTitle(\"AFPCHainer: getRmsd\" + rmsd);", "//", "// Chain c1 = new ChainImpl();", "// c1.setName(\"A\");", "// for ( Atom a : catmp1){", "// c1.addGroup(a.getParent());", "// }", "//", "// Chain c2 = new ChainImpl();", "// c2.setName(\"B\");", "// for ( Atom a : catmp2){", "// c2.addGroup(a.getParent());", "// }", "//", "// Structure fake = new StructureImpl();", "// fake.setPDBCode(\"AFPCHainer: getRmsd\" + rmsd);", "// List<Chain> model1 = new ArrayList<Chain>();", "// model1.add(c1);", "// List<Chain> model2 = new ArrayList<Chain>();", "// model2.add(c2);", "// fake.addModel(model1);", "// fake.addModel(model2);", "// fake.setNmr(true);", "//", "// jmol.setStructure(fake);", "// jmol.evalString(\"select *; backbone 0.4; wireframe off; spacefill off; \" +", "// \"select not protein and not solvent; spacefill on;\");", "// jmol.evalString(\"select */1 ; color red; model 1; \");", "//", "// // now show both models again.", "// jmol.evalString(\"model 0;\");", "// }", "return", "Calc", ".", "rmsd", "(", "catmp1", ",", "catmp2", ")", ";", "}" ]
Calculate the RMSD for two sets of atoms. Rotates the 2nd atom set so make sure this does not cause problems later @param catmp1 @return
[ "Calculate", "the", "RMSD", "for", "two", "sets", "of", "atoms", ".", "Rotates", "the", "2nd", "atom", "set", "so", "make", "sure", "this", "does", "not", "cause", "problems", "later" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L701-L744
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java
H2Headers.decodeFragment
private static String decodeFragment(WsByteBuffer buffer) throws CompressionException { """ Decode a Fragment of the Header. Fragment in this case refers to the bytes that represent the integer length and octets length of either the Name or Value of a Header. For instance, in the case of the Name, the fragment is +---+---+-----------------------+ | H | Name Length (7+) | +---+---------------------------+ | Name String (Length octets) | +---+---------------------------+ @param buffer Contains all bytes that will be decoded into this <HeaderField> @return String representation of the fragment. Stored as either the key or value of this <HeaderField> @throws CompressionException """ String decodedResult = null; try { byte currentByte = buffer.get(); //Reset back position to decode the integer length of this segment. buffer.position(buffer.position() - 1); boolean huffman = (HpackUtils.getBit(currentByte, 7) == 1); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Decoding using huffman encoding: " + huffman); } //HUFFMAN and NOHUFFMAN ByteFormatTypes have the same //integer decoding bits (N=7). Therefore, either enum value //is valid for the integer representation decoder. int fragmentLength = IntegerRepresentation.decode(buffer, ByteFormatType.HUFFMAN); byte[] bytes = new byte[fragmentLength]; //Transfer bytes from the buffer into byte array. buffer.get(bytes); if (huffman && bytes.length > 0) { HuffmanDecoder decoder = new HuffmanDecoder(); bytes = decoder.convertHuffmanToAscii(bytes); } decodedResult = new String(bytes, Charset.forName(HpackConstants.HPACK_CHAR_SET)); } catch (Exception e) { throw new CompressionException("Received an invalid header block fragment"); } return decodedResult; }
java
private static String decodeFragment(WsByteBuffer buffer) throws CompressionException { String decodedResult = null; try { byte currentByte = buffer.get(); //Reset back position to decode the integer length of this segment. buffer.position(buffer.position() - 1); boolean huffman = (HpackUtils.getBit(currentByte, 7) == 1); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Decoding using huffman encoding: " + huffman); } //HUFFMAN and NOHUFFMAN ByteFormatTypes have the same //integer decoding bits (N=7). Therefore, either enum value //is valid for the integer representation decoder. int fragmentLength = IntegerRepresentation.decode(buffer, ByteFormatType.HUFFMAN); byte[] bytes = new byte[fragmentLength]; //Transfer bytes from the buffer into byte array. buffer.get(bytes); if (huffman && bytes.length > 0) { HuffmanDecoder decoder = new HuffmanDecoder(); bytes = decoder.convertHuffmanToAscii(bytes); } decodedResult = new String(bytes, Charset.forName(HpackConstants.HPACK_CHAR_SET)); } catch (Exception e) { throw new CompressionException("Received an invalid header block fragment"); } return decodedResult; }
[ "private", "static", "String", "decodeFragment", "(", "WsByteBuffer", "buffer", ")", "throws", "CompressionException", "{", "String", "decodedResult", "=", "null", ";", "try", "{", "byte", "currentByte", "=", "buffer", ".", "get", "(", ")", ";", "//Reset back position to decode the integer length of this segment.", "buffer", ".", "position", "(", "buffer", ".", "position", "(", ")", "-", "1", ")", ";", "boolean", "huffman", "=", "(", "HpackUtils", ".", "getBit", "(", "currentByte", ",", "7", ")", "==", "1", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Decoding using huffman encoding: \"", "+", "huffman", ")", ";", "}", "//HUFFMAN and NOHUFFMAN ByteFormatTypes have the same", "//integer decoding bits (N=7). Therefore, either enum value", "//is valid for the integer representation decoder.", "int", "fragmentLength", "=", "IntegerRepresentation", ".", "decode", "(", "buffer", ",", "ByteFormatType", ".", "HUFFMAN", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "fragmentLength", "]", ";", "//Transfer bytes from the buffer into byte array.", "buffer", ".", "get", "(", "bytes", ")", ";", "if", "(", "huffman", "&&", "bytes", ".", "length", ">", "0", ")", "{", "HuffmanDecoder", "decoder", "=", "new", "HuffmanDecoder", "(", ")", ";", "bytes", "=", "decoder", ".", "convertHuffmanToAscii", "(", "bytes", ")", ";", "}", "decodedResult", "=", "new", "String", "(", "bytes", ",", "Charset", ".", "forName", "(", "HpackConstants", ".", "HPACK_CHAR_SET", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "CompressionException", "(", "\"Received an invalid header block fragment\"", ")", ";", "}", "return", "decodedResult", ";", "}" ]
Decode a Fragment of the Header. Fragment in this case refers to the bytes that represent the integer length and octets length of either the Name or Value of a Header. For instance, in the case of the Name, the fragment is +---+---+-----------------------+ | H | Name Length (7+) | +---+---------------------------+ | Name String (Length octets) | +---+---------------------------+ @param buffer Contains all bytes that will be decoded into this <HeaderField> @return String representation of the fragment. Stored as either the key or value of this <HeaderField> @throws CompressionException
[ "Decode", "a", "Fragment", "of", "the", "Header", ".", "Fragment", "in", "this", "case", "refers", "to", "the", "bytes", "that", "represent", "the", "integer", "length", "and", "octets", "length", "of", "either", "the", "Name", "or", "Value", "of", "a", "Header", ".", "For", "instance", "in", "the", "case", "of", "the", "Name", "the", "fragment", "is" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/hpack/H2Headers.java#L283-L317
kiegroup/drools
kie-ci/src/main/java/org/kie/api/builder/helper/KieModuleDeploymentHelperImpl.java
KieModuleDeploymentHelperImpl.getPomText
private static String getPomText(ReleaseId releaseId, ReleaseId... dependencies) { """ Create the pom that will be placed in the KJar. @param releaseId The release (deployment) id. @param dependencies The list of dependendencies to be added to the pom @return A string representation of the pom. """ String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <groupId>" + releaseId.getGroupId() + "</groupId>\n" + " <artifactId>" + releaseId.getArtifactId() + "</artifactId>\n" + " <version>" + releaseId.getVersion() + "</version>\n" + "\n"; if (dependencies != null && dependencies.length > 0) { pom += "<dependencies>\n"; for (ReleaseId dep : dependencies) { pom += "<dependency>\n"; pom += " <groupId>" + dep.getGroupId() + "</groupId>\n"; pom += " <artifactId>" + dep.getArtifactId() + "</artifactId>\n"; pom += " <version>" + dep.getVersion() + "</version>\n"; pom += "</dependency>\n"; } pom += "</dependencies>\n"; } pom += "</project>"; return pom; }
java
private static String getPomText(ReleaseId releaseId, ReleaseId... dependencies) { String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <groupId>" + releaseId.getGroupId() + "</groupId>\n" + " <artifactId>" + releaseId.getArtifactId() + "</artifactId>\n" + " <version>" + releaseId.getVersion() + "</version>\n" + "\n"; if (dependencies != null && dependencies.length > 0) { pom += "<dependencies>\n"; for (ReleaseId dep : dependencies) { pom += "<dependency>\n"; pom += " <groupId>" + dep.getGroupId() + "</groupId>\n"; pom += " <artifactId>" + dep.getArtifactId() + "</artifactId>\n"; pom += " <version>" + dep.getVersion() + "</version>\n"; pom += "</dependency>\n"; } pom += "</dependencies>\n"; } pom += "</project>"; return pom; }
[ "private", "static", "String", "getPomText", "(", "ReleaseId", "releaseId", ",", "ReleaseId", "...", "dependencies", ")", "{", "String", "pom", "=", "\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"", "+", "\"<project xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n\"", "+", "\" xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\\\">\\n\"", "+", "\" <modelVersion>4.0.0</modelVersion>\\n\"", "+", "\"\\n\"", "+", "\" <groupId>\"", "+", "releaseId", ".", "getGroupId", "(", ")", "+", "\"</groupId>\\n\"", "+", "\" <artifactId>\"", "+", "releaseId", ".", "getArtifactId", "(", ")", "+", "\"</artifactId>\\n\"", "+", "\" <version>\"", "+", "releaseId", ".", "getVersion", "(", ")", "+", "\"</version>\\n\"", "+", "\"\\n\"", ";", "if", "(", "dependencies", "!=", "null", "&&", "dependencies", ".", "length", ">", "0", ")", "{", "pom", "+=", "\"<dependencies>\\n\"", ";", "for", "(", "ReleaseId", "dep", ":", "dependencies", ")", "{", "pom", "+=", "\"<dependency>\\n\"", ";", "pom", "+=", "\" <groupId>\"", "+", "dep", ".", "getGroupId", "(", ")", "+", "\"</groupId>\\n\"", ";", "pom", "+=", "\" <artifactId>\"", "+", "dep", ".", "getArtifactId", "(", ")", "+", "\"</artifactId>\\n\"", ";", "pom", "+=", "\" <version>\"", "+", "dep", ".", "getVersion", "(", ")", "+", "\"</version>\\n\"", ";", "pom", "+=", "\"</dependency>\\n\"", ";", "}", "pom", "+=", "\"</dependencies>\\n\"", ";", "}", "pom", "+=", "\"</project>\"", ";", "return", "pom", ";", "}" ]
Create the pom that will be placed in the KJar. @param releaseId The release (deployment) id. @param dependencies The list of dependendencies to be added to the pom @return A string representation of the pom.
[ "Create", "the", "pom", "that", "will", "be", "placed", "in", "the", "KJar", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-ci/src/main/java/org/kie/api/builder/helper/KieModuleDeploymentHelperImpl.java#L365-L390
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java
GSAConfiguration.addBroadcastSetForSumFunction
public void addBroadcastSetForSumFunction(String name, DataSet<?> data) { """ Adds a data set as a broadcast set to the sum function. @param name The name under which the broadcast data is available in the sum function. @param data The data set to be broadcast. """ this.bcVarsSum.add(new Tuple2<>(name, data)); }
java
public void addBroadcastSetForSumFunction(String name, DataSet<?> data) { this.bcVarsSum.add(new Tuple2<>(name, data)); }
[ "public", "void", "addBroadcastSetForSumFunction", "(", "String", "name", ",", "DataSet", "<", "?", ">", "data", ")", "{", "this", ".", "bcVarsSum", ".", "add", "(", "new", "Tuple2", "<>", "(", "name", ",", "data", ")", ")", ";", "}" ]
Adds a data set as a broadcast set to the sum function. @param name The name under which the broadcast data is available in the sum function. @param data The data set to be broadcast.
[ "Adds", "a", "data", "set", "as", "a", "broadcast", "set", "to", "the", "sum", "function", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java#L70-L72
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ConverterConfiguration.java
ConverterConfiguration.getRelationshipLinksField
public Field getRelationshipLinksField(Class<?> clazz, String relationshipName) { """ Returns relationship links field. @param clazz {@link Class} class holding relationship @param relationshipName {@link String} name of the relationship @return {@link Field} field """ return relationshipLinksFieldMap.get(clazz).get(relationshipName); }
java
public Field getRelationshipLinksField(Class<?> clazz, String relationshipName) { return relationshipLinksFieldMap.get(clazz).get(relationshipName); }
[ "public", "Field", "getRelationshipLinksField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "relationshipName", ")", "{", "return", "relationshipLinksFieldMap", ".", "get", "(", "clazz", ")", ".", "get", "(", "relationshipName", ")", ";", "}" ]
Returns relationship links field. @param clazz {@link Class} class holding relationship @param relationshipName {@link String} name of the relationship @return {@link Field} field
[ "Returns", "relationship", "links", "field", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ConverterConfiguration.java#L354-L356
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java
MarkLogicRepositoryConnection.prepareTupleQuery
@Override public MarkLogicTupleQuery prepareTupleQuery(String queryString) throws RepositoryException, MalformedQueryException { """ overload for prepareTupleQuery @param queryString @return MarkLogicTupleQuery @throws RepositoryException @throws MalformedQueryException """ return prepareTupleQuery(QueryLanguage.SPARQL, queryString); }
java
@Override public MarkLogicTupleQuery prepareTupleQuery(String queryString) throws RepositoryException, MalformedQueryException { return prepareTupleQuery(QueryLanguage.SPARQL, queryString); }
[ "@", "Override", "public", "MarkLogicTupleQuery", "prepareTupleQuery", "(", "String", "queryString", ")", "throws", "RepositoryException", ",", "MalformedQueryException", "{", "return", "prepareTupleQuery", "(", "QueryLanguage", ".", "SPARQL", ",", "queryString", ")", ";", "}" ]
overload for prepareTupleQuery @param queryString @return MarkLogicTupleQuery @throws RepositoryException @throws MalformedQueryException
[ "overload", "for", "prepareTupleQuery" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L223-L226
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java
ContentSpecUtilities.fixFailedContentSpec
public static String fixFailedContentSpec(final ContentSpecWrapper contentSpec, final String validText, final boolean includeChecksum) { """ Fixes a failed Content Spec so that the ID and CHECKSUM are included. This is primarily an issue when creating new content specs and they are initially invalid. @param contentSpec The content spec to fix. @param validText The content specs latest valid text. @param includeChecksum If the checksum should be included in the output. @return The fixed failed content spec string. """ return fixFailedContentSpec(contentSpec.getId(), contentSpec.getFailed(), validText, includeChecksum); }
java
public static String fixFailedContentSpec(final ContentSpecWrapper contentSpec, final String validText, final boolean includeChecksum) { return fixFailedContentSpec(contentSpec.getId(), contentSpec.getFailed(), validText, includeChecksum); }
[ "public", "static", "String", "fixFailedContentSpec", "(", "final", "ContentSpecWrapper", "contentSpec", ",", "final", "String", "validText", ",", "final", "boolean", "includeChecksum", ")", "{", "return", "fixFailedContentSpec", "(", "contentSpec", ".", "getId", "(", ")", ",", "contentSpec", ".", "getFailed", "(", ")", ",", "validText", ",", "includeChecksum", ")", ";", "}" ]
Fixes a failed Content Spec so that the ID and CHECKSUM are included. This is primarily an issue when creating new content specs and they are initially invalid. @param contentSpec The content spec to fix. @param validText The content specs latest valid text. @param includeChecksum If the checksum should be included in the output. @return The fixed failed content spec string.
[ "Fixes", "a", "failed", "Content", "Spec", "so", "that", "the", "ID", "and", "CHECKSUM", "are", "included", ".", "This", "is", "primarily", "an", "issue", "when", "creating", "new", "content", "specs", "and", "they", "are", "initially", "invalid", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/ContentSpecUtilities.java#L169-L171
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.getValueForMethodArgument
@SuppressWarnings( { """ Obtains a value for the given method argument. @param resolutionContext The resolution context @param context The bean context @param methodIndex The method index @param argIndex The argument index @return The value """"unused", "unchecked"}) @Internal protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex) { MethodInjectionPoint injectionPoint = methodInjectionPoints.get(methodIndex); Argument argument = injectionPoint.getArguments()[argIndex]; BeanResolutionContext.Path path = resolutionContext.getPath(); path.pushMethodArgumentResolve(this, injectionPoint, argument); if (context instanceof ApplicationContext) { // can't use orElseThrow here due to compiler bug try { String valueAnnStr = argument.getAnnotationMetadata().getValue(Value.class, String.class).orElse(null); Class argumentType = argument.getType(); if (isInnerConfiguration(argumentType)) { Qualifier qualifier = resolveQualifier(resolutionContext, argument, true); return ((DefaultBeanContext) context).getBean(resolutionContext, argumentType, qualifier); } else { String argumentName = argument.getName(); String valString = resolvePropertyValueName(resolutionContext, injectionPoint.getAnnotationMetadata(), argument, valueAnnStr); ApplicationContext applicationContext = (ApplicationContext) context; ArgumentConversionContext conversionContext = ConversionContext.of(argument); Optional value = resolveValue(applicationContext, conversionContext, valueAnnStr != null, valString); if (argumentType == Optional.class) { return resolveOptionalObject(value); } else { if (value.isPresent()) { return value.get(); } else { if (argument.isDeclaredAnnotationPresent(Nullable.class)) { return null; } throw new DependencyInjectionException(resolutionContext, injectionPoint, conversionContext, valString); } } } } finally { path.pop(); } } else { path.pop(); throw new DependencyInjectionException(resolutionContext, argument, "BeanContext must support property resolution"); } }
java
@SuppressWarnings({"unused", "unchecked"}) @Internal protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex) { MethodInjectionPoint injectionPoint = methodInjectionPoints.get(methodIndex); Argument argument = injectionPoint.getArguments()[argIndex]; BeanResolutionContext.Path path = resolutionContext.getPath(); path.pushMethodArgumentResolve(this, injectionPoint, argument); if (context instanceof ApplicationContext) { // can't use orElseThrow here due to compiler bug try { String valueAnnStr = argument.getAnnotationMetadata().getValue(Value.class, String.class).orElse(null); Class argumentType = argument.getType(); if (isInnerConfiguration(argumentType)) { Qualifier qualifier = resolveQualifier(resolutionContext, argument, true); return ((DefaultBeanContext) context).getBean(resolutionContext, argumentType, qualifier); } else { String argumentName = argument.getName(); String valString = resolvePropertyValueName(resolutionContext, injectionPoint.getAnnotationMetadata(), argument, valueAnnStr); ApplicationContext applicationContext = (ApplicationContext) context; ArgumentConversionContext conversionContext = ConversionContext.of(argument); Optional value = resolveValue(applicationContext, conversionContext, valueAnnStr != null, valString); if (argumentType == Optional.class) { return resolveOptionalObject(value); } else { if (value.isPresent()) { return value.get(); } else { if (argument.isDeclaredAnnotationPresent(Nullable.class)) { return null; } throw new DependencyInjectionException(resolutionContext, injectionPoint, conversionContext, valString); } } } } finally { path.pop(); } } else { path.pop(); throw new DependencyInjectionException(resolutionContext, argument, "BeanContext must support property resolution"); } }
[ "@", "SuppressWarnings", "(", "{", "\"unused\"", ",", "\"unchecked\"", "}", ")", "@", "Internal", "protected", "final", "Object", "getValueForMethodArgument", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ",", "int", "methodIndex", ",", "int", "argIndex", ")", "{", "MethodInjectionPoint", "injectionPoint", "=", "methodInjectionPoints", ".", "get", "(", "methodIndex", ")", ";", "Argument", "argument", "=", "injectionPoint", ".", "getArguments", "(", ")", "[", "argIndex", "]", ";", "BeanResolutionContext", ".", "Path", "path", "=", "resolutionContext", ".", "getPath", "(", ")", ";", "path", ".", "pushMethodArgumentResolve", "(", "this", ",", "injectionPoint", ",", "argument", ")", ";", "if", "(", "context", "instanceof", "ApplicationContext", ")", "{", "// can't use orElseThrow here due to compiler bug", "try", "{", "String", "valueAnnStr", "=", "argument", ".", "getAnnotationMetadata", "(", ")", ".", "getValue", "(", "Value", ".", "class", ",", "String", ".", "class", ")", ".", "orElse", "(", "null", ")", ";", "Class", "argumentType", "=", "argument", ".", "getType", "(", ")", ";", "if", "(", "isInnerConfiguration", "(", "argumentType", ")", ")", "{", "Qualifier", "qualifier", "=", "resolveQualifier", "(", "resolutionContext", ",", "argument", ",", "true", ")", ";", "return", "(", "(", "DefaultBeanContext", ")", "context", ")", ".", "getBean", "(", "resolutionContext", ",", "argumentType", ",", "qualifier", ")", ";", "}", "else", "{", "String", "argumentName", "=", "argument", ".", "getName", "(", ")", ";", "String", "valString", "=", "resolvePropertyValueName", "(", "resolutionContext", ",", "injectionPoint", ".", "getAnnotationMetadata", "(", ")", ",", "argument", ",", "valueAnnStr", ")", ";", "ApplicationContext", "applicationContext", "=", "(", "ApplicationContext", ")", "context", ";", "ArgumentConversionContext", "conversionContext", "=", "ConversionContext", ".", "of", "(", "argument", ")", ";", "Optional", "value", "=", "resolveValue", "(", "applicationContext", ",", "conversionContext", ",", "valueAnnStr", "!=", "null", ",", "valString", ")", ";", "if", "(", "argumentType", "==", "Optional", ".", "class", ")", "{", "return", "resolveOptionalObject", "(", "value", ")", ";", "}", "else", "{", "if", "(", "value", ".", "isPresent", "(", ")", ")", "{", "return", "value", ".", "get", "(", ")", ";", "}", "else", "{", "if", "(", "argument", ".", "isDeclaredAnnotationPresent", "(", "Nullable", ".", "class", ")", ")", "{", "return", "null", ";", "}", "throw", "new", "DependencyInjectionException", "(", "resolutionContext", ",", "injectionPoint", ",", "conversionContext", ",", "valString", ")", ";", "}", "}", "}", "}", "finally", "{", "path", ".", "pop", "(", ")", ";", "}", "}", "else", "{", "path", ".", "pop", "(", ")", ";", "throw", "new", "DependencyInjectionException", "(", "resolutionContext", ",", "argument", ",", "\"BeanContext must support property resolution\"", ")", ";", "}", "}" ]
Obtains a value for the given method argument. @param resolutionContext The resolution context @param context The bean context @param methodIndex The method index @param argIndex The argument index @return The value
[ "Obtains", "a", "value", "for", "the", "given", "method", "argument", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L740-L784
maxirosson/jdroid-android
jdroid-android-core/src/main/java/com/jdroid/android/images/BitmapUtils.java
BitmapUtils.toBitmap
public static Bitmap toBitmap(Uri uri, Integer maxWidth, Integer maxHeight) { """ Gets a {@link Bitmap} from a {@link Uri}. Resizes the image to a determined width and height. @param uri The {@link Uri} from which the image is obtained. @param maxWidth The maximum width of the image used to scale it. If null, the image won't be scaled @param maxHeight The maximum height of the image used to scale it. If null, the image won't be scaled @return {@link Bitmap} The resized image. """ try { Context context = AbstractApplication.get(); // First decode with inJustDecodeBounds=true to check dimensions Options options = new Options(); options.inJustDecodeBounds = true; InputStream openInputStream = context.getContentResolver().openInputStream(uri); BitmapFactory.decodeStream(openInputStream, null, options); openInputStream.close(); // Calculate inSampleSize if ((maxWidth != null) && (maxHeight != null)) { float scale = Math.min(maxWidth.floatValue() / options.outWidth, maxHeight.floatValue() / options.outHeight); options.inSampleSize = Math.round(1 / scale); } // Decode bitmap with inSampleSize set openInputStream = context.getContentResolver().openInputStream(uri); options.inJustDecodeBounds = false; Bitmap result = BitmapFactory.decodeStream(openInputStream, null, options); openInputStream.close(); return result; } catch (Exception e) { LOGGER.error(e.getMessage(), e); return null; } }
java
public static Bitmap toBitmap(Uri uri, Integer maxWidth, Integer maxHeight) { try { Context context = AbstractApplication.get(); // First decode with inJustDecodeBounds=true to check dimensions Options options = new Options(); options.inJustDecodeBounds = true; InputStream openInputStream = context.getContentResolver().openInputStream(uri); BitmapFactory.decodeStream(openInputStream, null, options); openInputStream.close(); // Calculate inSampleSize if ((maxWidth != null) && (maxHeight != null)) { float scale = Math.min(maxWidth.floatValue() / options.outWidth, maxHeight.floatValue() / options.outHeight); options.inSampleSize = Math.round(1 / scale); } // Decode bitmap with inSampleSize set openInputStream = context.getContentResolver().openInputStream(uri); options.inJustDecodeBounds = false; Bitmap result = BitmapFactory.decodeStream(openInputStream, null, options); openInputStream.close(); return result; } catch (Exception e) { LOGGER.error(e.getMessage(), e); return null; } }
[ "public", "static", "Bitmap", "toBitmap", "(", "Uri", "uri", ",", "Integer", "maxWidth", ",", "Integer", "maxHeight", ")", "{", "try", "{", "Context", "context", "=", "AbstractApplication", ".", "get", "(", ")", ";", "// First decode with inJustDecodeBounds=true to check dimensions", "Options", "options", "=", "new", "Options", "(", ")", ";", "options", ".", "inJustDecodeBounds", "=", "true", ";", "InputStream", "openInputStream", "=", "context", ".", "getContentResolver", "(", ")", ".", "openInputStream", "(", "uri", ")", ";", "BitmapFactory", ".", "decodeStream", "(", "openInputStream", ",", "null", ",", "options", ")", ";", "openInputStream", ".", "close", "(", ")", ";", "// Calculate inSampleSize", "if", "(", "(", "maxWidth", "!=", "null", ")", "&&", "(", "maxHeight", "!=", "null", ")", ")", "{", "float", "scale", "=", "Math", ".", "min", "(", "maxWidth", ".", "floatValue", "(", ")", "/", "options", ".", "outWidth", ",", "maxHeight", ".", "floatValue", "(", ")", "/", "options", ".", "outHeight", ")", ";", "options", ".", "inSampleSize", "=", "Math", ".", "round", "(", "1", "/", "scale", ")", ";", "}", "// Decode bitmap with inSampleSize set", "openInputStream", "=", "context", ".", "getContentResolver", "(", ")", ".", "openInputStream", "(", "uri", ")", ";", "options", ".", "inJustDecodeBounds", "=", "false", ";", "Bitmap", "result", "=", "BitmapFactory", ".", "decodeStream", "(", "openInputStream", ",", "null", ",", "options", ")", ";", "openInputStream", ".", "close", "(", ")", ";", "return", "result", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Gets a {@link Bitmap} from a {@link Uri}. Resizes the image to a determined width and height. @param uri The {@link Uri} from which the image is obtained. @param maxWidth The maximum width of the image used to scale it. If null, the image won't be scaled @param maxHeight The maximum height of the image used to scale it. If null, the image won't be scaled @return {@link Bitmap} The resized image.
[ "Gets", "a", "{", "@link", "Bitmap", "}", "from", "a", "{", "@link", "Uri", "}", ".", "Resizes", "the", "image", "to", "a", "determined", "width", "and", "height", "." ]
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/images/BitmapUtils.java#L54-L82
berkesa/datatree
src/main/java/io/datatree/Tree.java
Tree.putList
public Tree putList(String path, boolean putIfAbsent) { """ Associates the specified List (~= JSON array) container with the specified path. If the structure previously contained a mapping for the path, the old value is replaced. Sample code:<br> <br> Tree node = new Tree();<br> <br> Tree list1 = node.putList("a.b.c");<br> list1.add(1).add(2).add(3);<br> <br> Tree list2 = node.putList("a.b.c", true);<br> list2.add(4).add(5).add(6);<br> <br> The "list2" contains 1, 2, 3, 4, 5 and 6. @param path path with which the specified List is to be associated @param putIfAbsent if true and the specified key is not already associated with a value associates it with the given value and returns the new List, else returns the previous List @return Tree of the new List """ return putObjectInternal(path, new LinkedList<Object>(), putIfAbsent); }
java
public Tree putList(String path, boolean putIfAbsent) { return putObjectInternal(path, new LinkedList<Object>(), putIfAbsent); }
[ "public", "Tree", "putList", "(", "String", "path", ",", "boolean", "putIfAbsent", ")", "{", "return", "putObjectInternal", "(", "path", ",", "new", "LinkedList", "<", "Object", ">", "(", ")", ",", "putIfAbsent", ")", ";", "}" ]
Associates the specified List (~= JSON array) container with the specified path. If the structure previously contained a mapping for the path, the old value is replaced. Sample code:<br> <br> Tree node = new Tree();<br> <br> Tree list1 = node.putList("a.b.c");<br> list1.add(1).add(2).add(3);<br> <br> Tree list2 = node.putList("a.b.c", true);<br> list2.add(4).add(5).add(6);<br> <br> The "list2" contains 1, 2, 3, 4, 5 and 6. @param path path with which the specified List is to be associated @param putIfAbsent if true and the specified key is not already associated with a value associates it with the given value and returns the new List, else returns the previous List @return Tree of the new List
[ "Associates", "the", "specified", "List", "(", "~", "=", "JSON", "array", ")", "container", "with", "the", "specified", "path", ".", "If", "the", "structure", "previously", "contained", "a", "mapping", "for", "the", "path", "the", "old", "value", "is", "replaced", ".", "Sample", "code", ":", "<br", ">", "<br", ">", "Tree", "node", "=", "new", "Tree", "()", ";", "<br", ">", "<br", ">", "Tree", "list1", "=", "node", ".", "putList", "(", "a", ".", "b", ".", "c", ")", ";", "<br", ">", "list1", ".", "add", "(", "1", ")", ".", "add", "(", "2", ")", ".", "add", "(", "3", ")", ";", "<br", ">", "<br", ">", "Tree", "list2", "=", "node", ".", "putList", "(", "a", ".", "b", ".", "c", "true", ")", ";", "<br", ">", "list2", ".", "add", "(", "4", ")", ".", "add", "(", "5", ")", ".", "add", "(", "6", ")", ";", "<br", ">", "<br", ">", "The", "list2", "contains", "1", "2", "3", "4", "5", "and", "6", "." ]
train
https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2078-L2080
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuModuleLoadData
public static int cuModuleLoadData(CUmodule module, String string) { """ A wrapper function for {@link #cuModuleLoadData(CUmodule, byte[])} that converts the given string into a zero-terminated byte array. @param module The module @param string The data. May not be <code>null</code>. @return The return code from <code>cuModuleLoadData</code> @see #cuModuleLoadData(CUmodule, byte[]) """ byte bytes[] = string.getBytes(); byte image[] = Arrays.copyOf(bytes, bytes.length+1); return cuModuleLoadData(module, image); }
java
public static int cuModuleLoadData(CUmodule module, String string) { byte bytes[] = string.getBytes(); byte image[] = Arrays.copyOf(bytes, bytes.length+1); return cuModuleLoadData(module, image); }
[ "public", "static", "int", "cuModuleLoadData", "(", "CUmodule", "module", ",", "String", "string", ")", "{", "byte", "bytes", "[", "]", "=", "string", ".", "getBytes", "(", ")", ";", "byte", "image", "[", "]", "=", "Arrays", ".", "copyOf", "(", "bytes", ",", "bytes", ".", "length", "+", "1", ")", ";", "return", "cuModuleLoadData", "(", "module", ",", "image", ")", ";", "}" ]
A wrapper function for {@link #cuModuleLoadData(CUmodule, byte[])} that converts the given string into a zero-terminated byte array. @param module The module @param string The data. May not be <code>null</code>. @return The return code from <code>cuModuleLoadData</code> @see #cuModuleLoadData(CUmodule, byte[])
[ "A", "wrapper", "function", "for", "{", "@link", "#cuModuleLoadData", "(", "CUmodule", "byte", "[]", ")", "}", "that", "converts", "the", "given", "string", "into", "a", "zero", "-", "terminated", "byte", "array", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L434-L439
pwittchen/prefser
library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java
Prefser.observe
public <T> Observable<T> observe(@NonNull String key, @NonNull Class<T> classOfT, T defaultValue) { """ Gets value from SharedPreferences with a given key and type as a RxJava Observable, which can be subscribed. If value is not found, we can return defaultValue. @param key key of the preference @param classOfT class of T (e.g. String.class) @param defaultValue default value of the preference (e.g. "" or "undefined") @param <T> return type of the preference (e.g. String) @return Observable value from SharedPreferences associated with given key or default value """ Preconditions.checkNotNull(key, KEY_IS_NULL); Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL); return observe(key, TypeToken.fromClass(classOfT), defaultValue); }
java
public <T> Observable<T> observe(@NonNull String key, @NonNull Class<T> classOfT, T defaultValue) { Preconditions.checkNotNull(key, KEY_IS_NULL); Preconditions.checkNotNull(classOfT, CLASS_OF_T_IS_NULL); return observe(key, TypeToken.fromClass(classOfT), defaultValue); }
[ "public", "<", "T", ">", "Observable", "<", "T", ">", "observe", "(", "@", "NonNull", "String", "key", ",", "@", "NonNull", "Class", "<", "T", ">", "classOfT", ",", "T", "defaultValue", ")", "{", "Preconditions", ".", "checkNotNull", "(", "key", ",", "KEY_IS_NULL", ")", ";", "Preconditions", ".", "checkNotNull", "(", "classOfT", ",", "CLASS_OF_T_IS_NULL", ")", ";", "return", "observe", "(", "key", ",", "TypeToken", ".", "fromClass", "(", "classOfT", ")", ",", "defaultValue", ")", ";", "}" ]
Gets value from SharedPreferences with a given key and type as a RxJava Observable, which can be subscribed. If value is not found, we can return defaultValue. @param key key of the preference @param classOfT class of T (e.g. String.class) @param defaultValue default value of the preference (e.g. "" or "undefined") @param <T> return type of the preference (e.g. String) @return Observable value from SharedPreferences associated with given key or default value
[ "Gets", "value", "from", "SharedPreferences", "with", "a", "given", "key", "and", "type", "as", "a", "RxJava", "Observable", "which", "can", "be", "subscribed", ".", "If", "value", "is", "not", "found", "we", "can", "return", "defaultValue", "." ]
train
https://github.com/pwittchen/prefser/blob/7dc7f980eeb71fd5617f8c749050c2400e4fbb2f/library/src/main/java/com/github/pwittchen/prefser/library/rx2/Prefser.java#L185-L191
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
EscapedFunctions2.sqlspace
public static void sqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { """ space translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens """ singleArgumentFunctionCall(buf, "repeat(' ',", "space", parsedArgs); }
java
public static void sqlspace(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { singleArgumentFunctionCall(buf, "repeat(' ',", "space", parsedArgs); }
[ "public", "static", "void", "sqlspace", "(", "StringBuilder", "buf", ",", "List", "<", "?", "extends", "CharSequence", ">", "parsedArgs", ")", "throws", "SQLException", "{", "singleArgumentFunctionCall", "(", "buf", ",", "\"repeat(' ',\"", ",", "\"space\"", ",", "parsedArgs", ")", ";", "}" ]
space translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens
[ "space", "translation" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L293-L295
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.beginCreateOrUpdateAsync
public Observable<P2SVpnGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { """ Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @param p2SVpnGatewayParameters Parameters supplied to create or Update a virtual wan p2s vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnGatewayInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnGatewayInner> beginCreateOrUpdateAsync(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnGatewayInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "P2SVpnGatewayInner", "p2SVpnGatewayParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ",", "p2SVpnGatewayParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", ",", "P2SVpnGatewayInner", ">", "(", ")", "{", "@", "Override", "public", "P2SVpnGatewayInner", "call", "(", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @param p2SVpnGatewayParameters Parameters supplied to create or Update a virtual wan p2s vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the P2SVpnGatewayInner object
[ "Creates", "a", "virtual", "wan", "p2s", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java#L325-L332
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java
Fourier.verticalInverseTransform
public static ColorImg verticalInverseTransform(ColorImg target, ComplexImg fourier, int channel) { """ Executes column wise inverse Fourier transforms of the specified {@link ComplexImg}. A 1-dimensional Fourier transform is done for each column of the ComplexImg. The resulting transforms will be stored in the specified channel of the specified target {@link ColorImg}. If target is null, a new ColorImg is created. @param target image of which one channel is to be transformed @param fourier the image that will be transformed @param channel the channel to which the results are stored @return the specified target or a new {@link ColorImg} if target was null @throws IllegalArgumentException if the specified channel is out of range ([0..3]) or is alpha (3) but the specified image does not have an alpha channel """ Dimension dim = fourier.getDimension(); // if no target was specified create a new one if(target == null) { target = new ColorImg(dim, channel==ColorImg.channel_a); } // continue sanity checks sanityCheckInverse_target(target, dim, channel); // now do the transforms try( NativeRealArray col = new NativeRealArray(target.getHeight()); NativeRealArray fft_r = new NativeRealArray(col.length); NativeRealArray fft_i = new NativeRealArray(col.length); ){ ComplexValuedSampler complexIn = getSamplerForShiftedComplexImg(fourier); ColorPixel px = target.getPixel(); for(int x = 0; x < target.getWidth(); x++){ for(int y = 0; y < target.getHeight(); y++){ fft_r.set(y, complexIn.getValueAt(false, x,y)); fft_i.set(y, complexIn.getValueAt(true, x,y)); } FFTW_Guru.execute_split_c2r(fft_r, fft_i, col, target.getHeight()); for(int y = 0; y < target.getHeight(); y++){ px.setPosition(x, y); px.setValue(channel, col.get(y)); } } } double scaling = 1.0/target.getHeight(); ArrayUtils.scaleArray(target.getData()[channel], scaling); return target; }
java
public static ColorImg verticalInverseTransform(ColorImg target, ComplexImg fourier, int channel) { Dimension dim = fourier.getDimension(); // if no target was specified create a new one if(target == null) { target = new ColorImg(dim, channel==ColorImg.channel_a); } // continue sanity checks sanityCheckInverse_target(target, dim, channel); // now do the transforms try( NativeRealArray col = new NativeRealArray(target.getHeight()); NativeRealArray fft_r = new NativeRealArray(col.length); NativeRealArray fft_i = new NativeRealArray(col.length); ){ ComplexValuedSampler complexIn = getSamplerForShiftedComplexImg(fourier); ColorPixel px = target.getPixel(); for(int x = 0; x < target.getWidth(); x++){ for(int y = 0; y < target.getHeight(); y++){ fft_r.set(y, complexIn.getValueAt(false, x,y)); fft_i.set(y, complexIn.getValueAt(true, x,y)); } FFTW_Guru.execute_split_c2r(fft_r, fft_i, col, target.getHeight()); for(int y = 0; y < target.getHeight(); y++){ px.setPosition(x, y); px.setValue(channel, col.get(y)); } } } double scaling = 1.0/target.getHeight(); ArrayUtils.scaleArray(target.getData()[channel], scaling); return target; }
[ "public", "static", "ColorImg", "verticalInverseTransform", "(", "ColorImg", "target", ",", "ComplexImg", "fourier", ",", "int", "channel", ")", "{", "Dimension", "dim", "=", "fourier", ".", "getDimension", "(", ")", ";", "// if no target was specified create a new one", "if", "(", "target", "==", "null", ")", "{", "target", "=", "new", "ColorImg", "(", "dim", ",", "channel", "==", "ColorImg", ".", "channel_a", ")", ";", "}", "// continue sanity checks", "sanityCheckInverse_target", "(", "target", ",", "dim", ",", "channel", ")", ";", "// now do the transforms", "try", "(", "NativeRealArray", "col", "=", "new", "NativeRealArray", "(", "target", ".", "getHeight", "(", ")", ")", ";", "NativeRealArray", "fft_r", "=", "new", "NativeRealArray", "(", "col", ".", "length", ")", ";", "NativeRealArray", "fft_i", "=", "new", "NativeRealArray", "(", "col", ".", "length", ")", ";", ")", "{", "ComplexValuedSampler", "complexIn", "=", "getSamplerForShiftedComplexImg", "(", "fourier", ")", ";", "ColorPixel", "px", "=", "target", ".", "getPixel", "(", ")", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<", "target", ".", "getWidth", "(", ")", ";", "x", "++", ")", "{", "for", "(", "int", "y", "=", "0", ";", "y", "<", "target", ".", "getHeight", "(", ")", ";", "y", "++", ")", "{", "fft_r", ".", "set", "(", "y", ",", "complexIn", ".", "getValueAt", "(", "false", ",", "x", ",", "y", ")", ")", ";", "fft_i", ".", "set", "(", "y", ",", "complexIn", ".", "getValueAt", "(", "true", ",", "x", ",", "y", ")", ")", ";", "}", "FFTW_Guru", ".", "execute_split_c2r", "(", "fft_r", ",", "fft_i", ",", "col", ",", "target", ".", "getHeight", "(", ")", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "target", ".", "getHeight", "(", ")", ";", "y", "++", ")", "{", "px", ".", "setPosition", "(", "x", ",", "y", ")", ";", "px", ".", "setValue", "(", "channel", ",", "col", ".", "get", "(", "y", ")", ")", ";", "}", "}", "}", "double", "scaling", "=", "1.0", "/", "target", ".", "getHeight", "(", ")", ";", "ArrayUtils", ".", "scaleArray", "(", "target", ".", "getData", "(", ")", "[", "channel", "]", ",", "scaling", ")", ";", "return", "target", ";", "}" ]
Executes column wise inverse Fourier transforms of the specified {@link ComplexImg}. A 1-dimensional Fourier transform is done for each column of the ComplexImg. The resulting transforms will be stored in the specified channel of the specified target {@link ColorImg}. If target is null, a new ColorImg is created. @param target image of which one channel is to be transformed @param fourier the image that will be transformed @param channel the channel to which the results are stored @return the specified target or a new {@link ColorImg} if target was null @throws IllegalArgumentException if the specified channel is out of range ([0..3]) or is alpha (3) but the specified image does not have an alpha channel
[ "Executes", "column", "wise", "inverse", "Fourier", "transforms", "of", "the", "specified", "{", "@link", "ComplexImg", "}", ".", "A", "1", "-", "dimensional", "Fourier", "transform", "is", "done", "for", "each", "column", "of", "the", "ComplexImg", ".", "The", "resulting", "transforms", "will", "be", "stored", "in", "the", "specified", "channel", "of", "the", "specified", "target", "{", "@link", "ColorImg", "}", ".", "If", "target", "is", "null", "a", "new", "ColorImg", "is", "created", ".", "@param", "target", "image", "of", "which", "one", "channel", "is", "to", "be", "transformed", "@param", "fourier", "the", "image", "that", "will", "be", "transformed", "@param", "channel", "the", "channel", "to", "which", "the", "results", "are", "stored", "@return", "the", "specified", "target", "or", "a", "new", "{", "@link", "ColorImg", "}", "if", "target", "was", "null" ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/Fourier.java#L394-L425
outbrain/ob1k
ob1k-core/src/main/java/com/outbrain/ob1k/server/netty/HttpStaticFileServerHandler.java
HttpStaticFileServerHandler.setContentTypeHeader
private void setContentTypeHeader(final HttpResponse response, final URLConnection connection) { """ Sets the content type header for the HTTP Response @param response HTTP response @param connection connection to extract content type """ response.headers().set(CONTENT_TYPE, mimeTypesMap.getContentType(connection.getURL().getPath())); }
java
private void setContentTypeHeader(final HttpResponse response, final URLConnection connection) { response.headers().set(CONTENT_TYPE, mimeTypesMap.getContentType(connection.getURL().getPath())); }
[ "private", "void", "setContentTypeHeader", "(", "final", "HttpResponse", "response", ",", "final", "URLConnection", "connection", ")", "{", "response", ".", "headers", "(", ")", ".", "set", "(", "CONTENT_TYPE", ",", "mimeTypesMap", ".", "getContentType", "(", "connection", ".", "getURL", "(", ")", ".", "getPath", "(", ")", ")", ")", ";", "}" ]
Sets the content type header for the HTTP Response @param response HTTP response @param connection connection to extract content type
[ "Sets", "the", "content", "type", "header", "for", "the", "HTTP", "Response" ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-core/src/main/java/com/outbrain/ob1k/server/netty/HttpStaticFileServerHandler.java#L247-L249
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java
EndpointUser.withUserAttributes
public EndpointUser withUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { """ Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param userAttributes Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @return Returns a reference to this object so that method calls can be chained together. """ setUserAttributes(userAttributes); return this; }
java
public EndpointUser withUserAttributes(java.util.Map<String, java.util.List<String>> userAttributes) { setUserAttributes(userAttributes); return this; }
[ "public", "EndpointUser", "withUserAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "userAttributes", ")", "{", "setUserAttributes", "(", "userAttributes", ")", ";", "return", "this", ";", "}" ]
Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @param userAttributes Custom attributes that describe the user by associating a name with an array of values. For example, an attribute named "interests" might have the following values: ["science", "politics", "travel"]. You can use these attributes as selection criteria when you create segments. The Amazon Pinpoint console can't display attribute names that include the following characters: hash/pound sign (#), colon (:), question mark (?), backslash (\), and forward slash (/). For this reason, you should avoid using these characters in the names of custom attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "Custom", "attributes", "that", "describe", "the", "user", "by", "associating", "a", "name", "with", "an", "array", "of", "values", ".", "For", "example", "an", "attribute", "named", "interests", "might", "have", "the", "following", "values", ":", "[", "science", "politics", "travel", "]", ".", "You", "can", "use", "these", "attributes", "as", "selection", "criteria", "when", "you", "create", "segments", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointUser.java#L107-L110
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_pendingChanges_GET
public ArrayList<OvhPendingChanges> serviceName_pendingChanges_GET(String serviceName) throws IOException { """ List the pending changes on your Load Balancer configuration, per zone REST: GET /ipLoadbalancing/{serviceName}/pendingChanges @param serviceName [required] The internal name of your IP load balancing """ String qPath = "/ipLoadbalancing/{serviceName}/pendingChanges"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
java
public ArrayList<OvhPendingChanges> serviceName_pendingChanges_GET(String serviceName) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/pendingChanges"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
[ "public", "ArrayList", "<", "OvhPendingChanges", ">", "serviceName_pendingChanges_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/pendingChanges\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t9", ")", ";", "}" ]
List the pending changes on your Load Balancer configuration, per zone REST: GET /ipLoadbalancing/{serviceName}/pendingChanges @param serviceName [required] The internal name of your IP load balancing
[ "List", "the", "pending", "changes", "on", "your", "Load", "Balancer", "configuration", "per", "zone" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1228-L1233
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.findElement
public WebElement findElement(final By by, final Predicate<WebElement> condition) { """ Finds the first element. Uses the internal {@link WebElementFinder}, which tries to apply the specified {@code condition} until it times out. @param by the {@link By} used to locate the element @param condition a condition the found element must meet @return the element """ return wef.by(by).condition(condition).find(); }
java
public WebElement findElement(final By by, final Predicate<WebElement> condition) { return wef.by(by).condition(condition).find(); }
[ "public", "WebElement", "findElement", "(", "final", "By", "by", ",", "final", "Predicate", "<", "WebElement", ">", "condition", ")", "{", "return", "wef", ".", "by", "(", "by", ")", ".", "condition", "(", "condition", ")", ".", "find", "(", ")", ";", "}" ]
Finds the first element. Uses the internal {@link WebElementFinder}, which tries to apply the specified {@code condition} until it times out. @param by the {@link By} used to locate the element @param condition a condition the found element must meet @return the element
[ "Finds", "the", "first", "element", ".", "Uses", "the", "internal", "{", "@link", "WebElementFinder", "}", "which", "tries", "to", "apply", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L186-L188
grails/grails-core
grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java
DefaultGrailsPluginManager.isDependentOn
private boolean isDependentOn(GrailsPlugin plugin, GrailsPlugin dependency) { """ Checks whether the first plugin is dependant on the second plugin. @param plugin The plugin to check @param dependency The plugin which the first argument may be dependant on @return true if it is """ for (String name : plugin.getDependencyNames()) { String requiredVersion = plugin.getDependentVersion(name); if (name.equals(dependency.getName()) && GrailsVersionUtils.isValidVersion(dependency.getVersion(), requiredVersion)) return true; } return false; }
java
private boolean isDependentOn(GrailsPlugin plugin, GrailsPlugin dependency) { for (String name : plugin.getDependencyNames()) { String requiredVersion = plugin.getDependentVersion(name); if (name.equals(dependency.getName()) && GrailsVersionUtils.isValidVersion(dependency.getVersion(), requiredVersion)) return true; } return false; }
[ "private", "boolean", "isDependentOn", "(", "GrailsPlugin", "plugin", ",", "GrailsPlugin", "dependency", ")", "{", "for", "(", "String", "name", ":", "plugin", ".", "getDependencyNames", "(", ")", ")", "{", "String", "requiredVersion", "=", "plugin", ".", "getDependentVersion", "(", "name", ")", ";", "if", "(", "name", ".", "equals", "(", "dependency", ".", "getName", "(", ")", ")", "&&", "GrailsVersionUtils", ".", "isValidVersion", "(", "dependency", ".", "getVersion", "(", ")", ",", "requiredVersion", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks whether the first plugin is dependant on the second plugin. @param plugin The plugin to check @param dependency The plugin which the first argument may be dependant on @return true if it is
[ "Checks", "whether", "the", "first", "plugin", "is", "dependant", "on", "the", "second", "plugin", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java#L561-L570
cloudinary/cloudinary_java
cloudinary-core/src/main/java/com/cloudinary/Api.java
Api.updateResourcesAccessModeByTag
public ApiResponse updateResourcesAccessModeByTag(String accessMode, String tag, Map options) throws Exception { """ Update access mode of one or more resources by tag @param accessMode The new access mode, "public" or "authenticated" @param tag The tag by which to filter applicable resources @param options additional options <ul> <li>resource_type - (default "image") - the type of resources to modify</li> <li>max_results - optional - the maximum resources to process in a single invocation</li> <li>next_cursor - optional - provided by a previous call to the method</li> </ul> @return a map of the returned values <ul> <li>updated - an array of resources</li> <li>next_cursor - optional - provided if more resources can be processed</li> </ul> @throws ApiException an API exception """ return updateResourcesAccessMode(accessMode, "tag", tag, options); }
java
public ApiResponse updateResourcesAccessModeByTag(String accessMode, String tag, Map options) throws Exception { return updateResourcesAccessMode(accessMode, "tag", tag, options); }
[ "public", "ApiResponse", "updateResourcesAccessModeByTag", "(", "String", "accessMode", ",", "String", "tag", ",", "Map", "options", ")", "throws", "Exception", "{", "return", "updateResourcesAccessMode", "(", "accessMode", ",", "\"tag\"", ",", "tag", ",", "options", ")", ";", "}" ]
Update access mode of one or more resources by tag @param accessMode The new access mode, "public" or "authenticated" @param tag The tag by which to filter applicable resources @param options additional options <ul> <li>resource_type - (default "image") - the type of resources to modify</li> <li>max_results - optional - the maximum resources to process in a single invocation</li> <li>next_cursor - optional - provided by a previous call to the method</li> </ul> @return a map of the returned values <ul> <li>updated - an array of resources</li> <li>next_cursor - optional - provided if more resources can be processed</li> </ul> @throws ApiException an API exception
[ "Update", "access", "mode", "of", "one", "or", "more", "resources", "by", "tag" ]
train
https://github.com/cloudinary/cloudinary_java/blob/58ee1823180da2dea6a2eb7e5cf00d5a760f8aef/cloudinary-core/src/main/java/com/cloudinary/Api.java#L518-L520
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.initSession
public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Uri data) { """ <p>Initialises a session with the Branch API.</p> @param callback A {@link BranchUniversalReferralInitListener} instance that will be called following successful (or unsuccessful) initialisation of the session with the Branch API. @param isReferrable A {@link Boolean} value indicating whether this initialisation session should be considered as potentially referrable or not. By default, a user is only referrable if initSession results in a fresh install. Overriding this gives you control of who is referrable. @param data A {@link Uri} variable containing the details of the source link that led to this initialisation action. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful. """ return initSession(callback, isReferrable, data, null); }
java
public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Uri data) { return initSession(callback, isReferrable, data, null); }
[ "public", "boolean", "initSession", "(", "BranchUniversalReferralInitListener", "callback", ",", "boolean", "isReferrable", ",", "Uri", "data", ")", "{", "return", "initSession", "(", "callback", ",", "isReferrable", ",", "data", ",", "null", ")", ";", "}" ]
<p>Initialises a session with the Branch API.</p> @param callback A {@link BranchUniversalReferralInitListener} instance that will be called following successful (or unsuccessful) initialisation of the session with the Branch API. @param isReferrable A {@link Boolean} value indicating whether this initialisation session should be considered as potentially referrable or not. By default, a user is only referrable if initSession results in a fresh install. Overriding this gives you control of who is referrable. @param data A {@link Uri} variable containing the details of the source link that led to this initialisation action. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful.
[ "<p", ">", "Initialises", "a", "session", "with", "the", "Branch", "API", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1204-L1206
OSSIndex/heuristic-version
src/main/java/net/ossindex/version/VersionFactory.java
VersionFactory.getRange
public IVersionRange getRange(String[] versions) throws InvalidRangeException { """ Join this set of ranges together. This could result in a set, or in a logical range. """ if (versions == null) { return null; } IVersionRange results = null; for (String version : versions) { IVersionRange range = getRange(version); if (results == null) { results = range; } else { results = new OrRange(results, range); } } return results; }
java
public IVersionRange getRange(String[] versions) throws InvalidRangeException { if (versions == null) { return null; } IVersionRange results = null; for (String version : versions) { IVersionRange range = getRange(version); if (results == null) { results = range; } else { results = new OrRange(results, range); } } return results; }
[ "public", "IVersionRange", "getRange", "(", "String", "[", "]", "versions", ")", "throws", "InvalidRangeException", "{", "if", "(", "versions", "==", "null", ")", "{", "return", "null", ";", "}", "IVersionRange", "results", "=", "null", ";", "for", "(", "String", "version", ":", "versions", ")", "{", "IVersionRange", "range", "=", "getRange", "(", "version", ")", ";", "if", "(", "results", "==", "null", ")", "{", "results", "=", "range", ";", "}", "else", "{", "results", "=", "new", "OrRange", "(", "results", ",", "range", ")", ";", "}", "}", "return", "results", ";", "}" ]
Join this set of ranges together. This could result in a set, or in a logical range.
[ "Join", "this", "set", "of", "ranges", "together", ".", "This", "could", "result", "in", "a", "set", "or", "in", "a", "logical", "range", "." ]
train
https://github.com/OSSIndex/heuristic-version/blob/9fe33a49d74acec54ddb91de9a3c3cd2f98fba40/src/main/java/net/ossindex/version/VersionFactory.java#L200-L216
paypal/SeLion
client/src/main/java/com/paypal/selion/platform/html/Table.java
Table.uncheckCheckboxInCell
public void uncheckCheckboxInCell(int row, int column) { """ Untick a checkbox in a cell of a table indicated by the input row and column indices. @param row int number of row for cell @param column int number of column for cell """ String checkboxLocator = getXPathBase() + "tr[" + row + "]/td[" + column + "]/input"; CheckBox cb = new CheckBox(checkboxLocator); cb.uncheck(); }
java
public void uncheckCheckboxInCell(int row, int column) { String checkboxLocator = getXPathBase() + "tr[" + row + "]/td[" + column + "]/input"; CheckBox cb = new CheckBox(checkboxLocator); cb.uncheck(); }
[ "public", "void", "uncheckCheckboxInCell", "(", "int", "row", ",", "int", "column", ")", "{", "String", "checkboxLocator", "=", "getXPathBase", "(", ")", "+", "\"tr[\"", "+", "row", "+", "\"]/td[\"", "+", "column", "+", "\"]/input\"", ";", "CheckBox", "cb", "=", "new", "CheckBox", "(", "checkboxLocator", ")", ";", "cb", ".", "uncheck", "(", ")", ";", "}" ]
Untick a checkbox in a cell of a table indicated by the input row and column indices. @param row int number of row for cell @param column int number of column for cell
[ "Untick", "a", "checkbox", "in", "a", "cell", "of", "a", "table", "indicated", "by", "the", "input", "row", "and", "column", "indices", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/html/Table.java#L324-L328
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java
DynamicRegistrationBean.setInitParameters
public void setInitParameters(Map<String, String> initParameters) { """ Set init-parameters for this registration. Calling this method will replace any existing init-parameters. @param initParameters the init parameters @see #getInitParameters @see #addInitParameter """ Assert.notNull(initParameters, "InitParameters must not be null"); this.initParameters = new LinkedHashMap<>(initParameters); }
java
public void setInitParameters(Map<String, String> initParameters) { Assert.notNull(initParameters, "InitParameters must not be null"); this.initParameters = new LinkedHashMap<>(initParameters); }
[ "public", "void", "setInitParameters", "(", "Map", "<", "String", ",", "String", ">", "initParameters", ")", "{", "Assert", ".", "notNull", "(", "initParameters", ",", "\"InitParameters must not be null\"", ")", ";", "this", ".", "initParameters", "=", "new", "LinkedHashMap", "<>", "(", "initParameters", ")", ";", "}" ]
Set init-parameters for this registration. Calling this method will replace any existing init-parameters. @param initParameters the init parameters @see #getInitParameters @see #addInitParameter
[ "Set", "init", "-", "parameters", "for", "this", "registration", ".", "Calling", "this", "method", "will", "replace", "any", "existing", "init", "-", "parameters", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java#L84-L87
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.resetBitmapRangeAndCardinalityChange
@Deprecated public static int resetBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) { """ reset bits at start, start+1,..., end-1 and report the cardinality change @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive) @return cardinality change """ int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end); resetBitmapRange(bitmap, start,end); int cardafter = cardinalityInBitmapWordRange(bitmap, start, end); return cardafter - cardbefore; }
java
@Deprecated public static int resetBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) { int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end); resetBitmapRange(bitmap, start,end); int cardafter = cardinalityInBitmapWordRange(bitmap, start, end); return cardafter - cardbefore; }
[ "@", "Deprecated", "public", "static", "int", "resetBitmapRangeAndCardinalityChange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "int", "cardbefore", "=", "cardinalityInBitmapWordRange", "(", "bitmap", ",", "start", ",", "end", ")", ";", "resetBitmapRange", "(", "bitmap", ",", "start", ",", "end", ")", ";", "int", "cardafter", "=", "cardinalityInBitmapWordRange", "(", "bitmap", ",", "start", ",", "end", ")", ";", "return", "cardafter", "-", "cardbefore", ";", "}" ]
reset bits at start, start+1,..., end-1 and report the cardinality change @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive) @return cardinality change
[ "reset", "bits", "at", "start", "start", "+", "1", "...", "end", "-", "1", "and", "report", "the", "cardinality", "change" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L563-L569
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java
DomainHostExcludeRegistry.getVersionIgnoreData
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) { """ Gets the host-ignore data for a slave host running the given version. @param major the kernel management API major version @param minor the kernel management API minor version @param micro the kernel management API micro version @return the host-ignore data, or {@code null} if there is no matching registration """ VersionExcludeData result = registry.get(new VersionKey(major, minor, micro)); if (result == null) { result = registry.get(new VersionKey(major, minor, null)); } return result; }
java
VersionExcludeData getVersionIgnoreData(int major, int minor, int micro) { VersionExcludeData result = registry.get(new VersionKey(major, minor, micro)); if (result == null) { result = registry.get(new VersionKey(major, minor, null)); } return result; }
[ "VersionExcludeData", "getVersionIgnoreData", "(", "int", "major", ",", "int", "minor", ",", "int", "micro", ")", "{", "VersionExcludeData", "result", "=", "registry", ".", "get", "(", "new", "VersionKey", "(", "major", ",", "minor", ",", "micro", ")", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "registry", ".", "get", "(", "new", "VersionKey", "(", "major", ",", "minor", ",", "null", ")", ")", ";", "}", "return", "result", ";", "}" ]
Gets the host-ignore data for a slave host running the given version. @param major the kernel management API major version @param minor the kernel management API minor version @param micro the kernel management API micro version @return the host-ignore data, or {@code null} if there is no matching registration
[ "Gets", "the", "host", "-", "ignore", "data", "for", "a", "slave", "host", "running", "the", "given", "version", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/mgmt/DomainHostExcludeRegistry.java#L144-L150
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java
WebhookCluster.newBuilder
public WebhookClientBuilder newBuilder(long id, String token) { """ Creates a new {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilder} with the defined default settings of this cluster. @param id The webhook id @param token The webhook token @throws java.lang.IllegalArgumentException If the token is {@code null}, empty or contains blanks @return The WebhookClientBuilder with default settings @see net.dv8tion.jda.webhook.WebhookClientBuilder#WebhookClientBuilder(long, String) new WebhookClientBuilder(long, String) """ WebhookClientBuilder builder = new WebhookClientBuilder(id, token); builder.setExecutorService(defaultPool) .setHttpClient(defaultHttpClient) .setThreadFactory(threadFactory) .setDaemon(isDaemon); if (defaultHttpClientBuilder != null) builder.setHttpClientBuilder(defaultHttpClientBuilder); return builder; }
java
public WebhookClientBuilder newBuilder(long id, String token) { WebhookClientBuilder builder = new WebhookClientBuilder(id, token); builder.setExecutorService(defaultPool) .setHttpClient(defaultHttpClient) .setThreadFactory(threadFactory) .setDaemon(isDaemon); if (defaultHttpClientBuilder != null) builder.setHttpClientBuilder(defaultHttpClientBuilder); return builder; }
[ "public", "WebhookClientBuilder", "newBuilder", "(", "long", "id", ",", "String", "token", ")", "{", "WebhookClientBuilder", "builder", "=", "new", "WebhookClientBuilder", "(", "id", ",", "token", ")", ";", "builder", ".", "setExecutorService", "(", "defaultPool", ")", ".", "setHttpClient", "(", "defaultHttpClient", ")", ".", "setThreadFactory", "(", "threadFactory", ")", ".", "setDaemon", "(", "isDaemon", ")", ";", "if", "(", "defaultHttpClientBuilder", "!=", "null", ")", "builder", ".", "setHttpClientBuilder", "(", "defaultHttpClientBuilder", ")", ";", "return", "builder", ";", "}" ]
Creates a new {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilder} with the defined default settings of this cluster. @param id The webhook id @param token The webhook token @throws java.lang.IllegalArgumentException If the token is {@code null}, empty or contains blanks @return The WebhookClientBuilder with default settings @see net.dv8tion.jda.webhook.WebhookClientBuilder#WebhookClientBuilder(long, String) new WebhookClientBuilder(long, String)
[ "Creates", "a", "new", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "webhook", ".", "WebhookClientBuilder", "WebhookClientBuilder", "}", "with", "the", "defined", "default", "settings", "of", "this", "cluster", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L325-L335
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsSessionUtil.java
AdWordsSessionUtil.getClientCustomerId
public static long getClientCustomerId(AdWordsSession session) { """ Get client customer ID from the adwords session, and convert it to Long type. @param session the AdWords session @return the client customer ID in the AdWords session, or VIRTUAL_CID if absent """ String accountIdStr = session.getClientCustomerId(); // clientCustomerId might be absent from AdWordsSession, e.g., for // ReportDefinitionService.getReportFields() and CustomerService.getCustomers(). // In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined. if (accountIdStr == null) { return VIRTUAL_CID; } try { return Long.parseLong(accountIdStr.replace("-", "")); } catch (NumberFormatException e) { throw new RateLimiterException("Encountered invalid CID: " + accountIdStr, e); } }
java
public static long getClientCustomerId(AdWordsSession session) { String accountIdStr = session.getClientCustomerId(); // clientCustomerId might be absent from AdWordsSession, e.g., for // ReportDefinitionService.getReportFields() and CustomerService.getCustomers(). // In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined. if (accountIdStr == null) { return VIRTUAL_CID; } try { return Long.parseLong(accountIdStr.replace("-", "")); } catch (NumberFormatException e) { throw new RateLimiterException("Encountered invalid CID: " + accountIdStr, e); } }
[ "public", "static", "long", "getClientCustomerId", "(", "AdWordsSession", "session", ")", "{", "String", "accountIdStr", "=", "session", ".", "getClientCustomerId", "(", ")", ";", "// clientCustomerId might be absent from AdWordsSession, e.g., for", "// ReportDefinitionService.getReportFields() and CustomerService.getCustomers().", "// In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined.", "if", "(", "accountIdStr", "==", "null", ")", "{", "return", "VIRTUAL_CID", ";", "}", "try", "{", "return", "Long", ".", "parseLong", "(", "accountIdStr", ".", "replace", "(", "\"-\"", ",", "\"\"", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "RateLimiterException", "(", "\"Encountered invalid CID: \"", "+", "accountIdStr", ",", "e", ")", ";", "}", "}" ]
Get client customer ID from the adwords session, and convert it to Long type. @param session the AdWords session @return the client customer ID in the AdWords session, or VIRTUAL_CID if absent
[ "Get", "client", "customer", "ID", "from", "the", "adwords", "session", "and", "convert", "it", "to", "Long", "type", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsSessionUtil.java#L31-L46
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/TransportErrorCode.java
TransportErrorCode.fromHttp
public static TransportErrorCode fromHttp(int code) { """ Get a transport error code from the given HTTP error code. @param code The HTTP error code, must be between 400 and 599 inclusive. @return The transport error code. @throws IllegalArgumentException if the HTTP code was not between 400 and 599. """ TransportErrorCode builtIn = HTTP_ERROR_CODE_MAP.get(code); if (builtIn == null) { if (code > 599 || code < 100) { throw new IllegalArgumentException("Invalid http status code: " + code); } else if (code < 400) { throw new IllegalArgumentException("Invalid http error code: " + code); } else { return new TransportErrorCode(code, 4000 + code, "Unknown error code"); } } else { return builtIn; } }
java
public static TransportErrorCode fromHttp(int code) { TransportErrorCode builtIn = HTTP_ERROR_CODE_MAP.get(code); if (builtIn == null) { if (code > 599 || code < 100) { throw new IllegalArgumentException("Invalid http status code: " + code); } else if (code < 400) { throw new IllegalArgumentException("Invalid http error code: " + code); } else { return new TransportErrorCode(code, 4000 + code, "Unknown error code"); } } else { return builtIn; } }
[ "public", "static", "TransportErrorCode", "fromHttp", "(", "int", "code", ")", "{", "TransportErrorCode", "builtIn", "=", "HTTP_ERROR_CODE_MAP", ".", "get", "(", "code", ")", ";", "if", "(", "builtIn", "==", "null", ")", "{", "if", "(", "code", ">", "599", "||", "code", "<", "100", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid http status code: \"", "+", "code", ")", ";", "}", "else", "if", "(", "code", "<", "400", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid http error code: \"", "+", "code", ")", ";", "}", "else", "{", "return", "new", "TransportErrorCode", "(", "code", ",", "4000", "+", "code", ",", "\"Unknown error code\"", ")", ";", "}", "}", "else", "{", "return", "builtIn", ";", "}", "}" ]
Get a transport error code from the given HTTP error code. @param code The HTTP error code, must be between 400 and 599 inclusive. @return The transport error code. @throws IllegalArgumentException if the HTTP code was not between 400 and 599.
[ "Get", "a", "transport", "error", "code", "from", "the", "given", "HTTP", "error", "code", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/TransportErrorCode.java#L142-L155
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/junit/JUnitXMLPerPageListener.java
JUnitXMLPerPageListener.generateResultXml
protected String generateResultXml(String testName, Throwable exception, double executionTime) { """ Creates XML string describing test outcome. @param testName name of test. @param exception exception from test @param executionTime execution time in seconds @return XML description of test result """ int errors = 0; int failures = 0; String failureXml = ""; if (exception != null) { failureXml = "<failure type=\"" + exception.getClass().getName() + "\" message=\"" + getMessage(exception) + "\"></failure>"; if (exception instanceof AssertionError) failures = 1; else errors = 1; } return "<testsuite errors=\"" + errors + "\" skipped=\"0\" tests=\"1\" time=\"" + executionTime + "\" failures=\"" + failures + "\" name=\"" + testName + "\">" + "<properties></properties>" + "<testcase classname=\"" + testName + "\" time=\"" + executionTime + "\" name=\"" + testName + "\">" + failureXml + "</testcase>" + "</testsuite>"; }
java
protected String generateResultXml(String testName, Throwable exception, double executionTime) { int errors = 0; int failures = 0; String failureXml = ""; if (exception != null) { failureXml = "<failure type=\"" + exception.getClass().getName() + "\" message=\"" + getMessage(exception) + "\"></failure>"; if (exception instanceof AssertionError) failures = 1; else errors = 1; } return "<testsuite errors=\"" + errors + "\" skipped=\"0\" tests=\"1\" time=\"" + executionTime + "\" failures=\"" + failures + "\" name=\"" + testName + "\">" + "<properties></properties>" + "<testcase classname=\"" + testName + "\" time=\"" + executionTime + "\" name=\"" + testName + "\">" + failureXml + "</testcase>" + "</testsuite>"; }
[ "protected", "String", "generateResultXml", "(", "String", "testName", ",", "Throwable", "exception", ",", "double", "executionTime", ")", "{", "int", "errors", "=", "0", ";", "int", "failures", "=", "0", ";", "String", "failureXml", "=", "\"\"", ";", "if", "(", "exception", "!=", "null", ")", "{", "failureXml", "=", "\"<failure type=\\\"\"", "+", "exception", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"\\\" message=\\\"\"", "+", "getMessage", "(", "exception", ")", "+", "\"\\\"></failure>\"", ";", "if", "(", "exception", "instanceof", "AssertionError", ")", "failures", "=", "1", ";", "else", "errors", "=", "1", ";", "}", "return", "\"<testsuite errors=\\\"\"", "+", "errors", "+", "\"\\\" skipped=\\\"0\\\" tests=\\\"1\\\" time=\\\"\"", "+", "executionTime", "+", "\"\\\" failures=\\\"\"", "+", "failures", "+", "\"\\\" name=\\\"\"", "+", "testName", "+", "\"\\\">\"", "+", "\"<properties></properties>\"", "+", "\"<testcase classname=\\\"\"", "+", "testName", "+", "\"\\\" time=\\\"\"", "+", "executionTime", "+", "\"\\\" name=\\\"\"", "+", "testName", "+", "\"\\\">\"", "+", "failureXml", "+", "\"</testcase>\"", "+", "\"</testsuite>\"", ";", "}" ]
Creates XML string describing test outcome. @param testName name of test. @param exception exception from test @param executionTime execution time in seconds @return XML description of test result
[ "Creates", "XML", "string", "describing", "test", "outcome", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/junit/JUnitXMLPerPageListener.java#L86-L106
haifengl/smile
graph/src/main/java/smile/graph/AdjacencyMatrix.java
AdjacencyMatrix.bfs
private void bfs(int v, int[] cc, int id) { """ Breadth-first search connected components of graph. @param v the start vertex. @param cc the array to store the connected component id of vertices. @param id the current component id. """ cc[v] = id; Queue<Integer> queue = new LinkedList<>(); queue.offer(v); while (!queue.isEmpty()) { int t = queue.poll(); for (int i = 0; i < n; i++) { if (graph[t][i] != 0.0 && cc[i] == -1) { queue.offer(i); cc[i] = id; } } } }
java
private void bfs(int v, int[] cc, int id) { cc[v] = id; Queue<Integer> queue = new LinkedList<>(); queue.offer(v); while (!queue.isEmpty()) { int t = queue.poll(); for (int i = 0; i < n; i++) { if (graph[t][i] != 0.0 && cc[i] == -1) { queue.offer(i); cc[i] = id; } } } }
[ "private", "void", "bfs", "(", "int", "v", ",", "int", "[", "]", "cc", ",", "int", "id", ")", "{", "cc", "[", "v", "]", "=", "id", ";", "Queue", "<", "Integer", ">", "queue", "=", "new", "LinkedList", "<>", "(", ")", ";", "queue", ".", "offer", "(", "v", ")", ";", "while", "(", "!", "queue", ".", "isEmpty", "(", ")", ")", "{", "int", "t", "=", "queue", ".", "poll", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "graph", "[", "t", "]", "[", "i", "]", "!=", "0.0", "&&", "cc", "[", "i", "]", "==", "-", "1", ")", "{", "queue", ".", "offer", "(", "i", ")", ";", "cc", "[", "i", "]", "=", "id", ";", "}", "}", "}", "}" ]
Breadth-first search connected components of graph. @param v the start vertex. @param cc the array to store the connected component id of vertices. @param id the current component id.
[ "Breadth", "-", "first", "search", "connected", "components", "of", "graph", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyMatrix.java#L414-L427
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java
HttpUtil.setKeepAlive
public static void setKeepAlive(HttpHeaders h, HttpVersion httpVersion, boolean keepAlive) { """ Sets the value of the {@code "Connection"} header depending on the protocol version of the specified message. This getMethod sets or removes the {@code "Connection"} header depending on what the default keep alive mode of the message's protocol version is, as specified by {@link HttpVersion#isKeepAliveDefault()}. <ul> <li>If the connection is kept alive by default: <ul> <li>set to {@code "close"} if {@code keepAlive} is {@code false}.</li> <li>remove otherwise.</li> </ul></li> <li>If the connection is closed by default: <ul> <li>set to {@code "keep-alive"} if {@code keepAlive} is {@code true}.</li> <li>remove otherwise.</li> </ul></li> </ul> """ if (httpVersion.isKeepAliveDefault()) { if (keepAlive) { h.remove(HttpHeaderNames.CONNECTION); } else { h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } } else { if (keepAlive) { h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); } else { h.remove(HttpHeaderNames.CONNECTION); } } }
java
public static void setKeepAlive(HttpHeaders h, HttpVersion httpVersion, boolean keepAlive) { if (httpVersion.isKeepAliveDefault()) { if (keepAlive) { h.remove(HttpHeaderNames.CONNECTION); } else { h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); } } else { if (keepAlive) { h.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); } else { h.remove(HttpHeaderNames.CONNECTION); } } }
[ "public", "static", "void", "setKeepAlive", "(", "HttpHeaders", "h", ",", "HttpVersion", "httpVersion", ",", "boolean", "keepAlive", ")", "{", "if", "(", "httpVersion", ".", "isKeepAliveDefault", "(", ")", ")", "{", "if", "(", "keepAlive", ")", "{", "h", ".", "remove", "(", "HttpHeaderNames", ".", "CONNECTION", ")", ";", "}", "else", "{", "h", ".", "set", "(", "HttpHeaderNames", ".", "CONNECTION", ",", "HttpHeaderValues", ".", "CLOSE", ")", ";", "}", "}", "else", "{", "if", "(", "keepAlive", ")", "{", "h", ".", "set", "(", "HttpHeaderNames", ".", "CONNECTION", ",", "HttpHeaderValues", ".", "KEEP_ALIVE", ")", ";", "}", "else", "{", "h", ".", "remove", "(", "HttpHeaderNames", ".", "CONNECTION", ")", ";", "}", "}", "}" ]
Sets the value of the {@code "Connection"} header depending on the protocol version of the specified message. This getMethod sets or removes the {@code "Connection"} header depending on what the default keep alive mode of the message's protocol version is, as specified by {@link HttpVersion#isKeepAliveDefault()}. <ul> <li>If the connection is kept alive by default: <ul> <li>set to {@code "close"} if {@code keepAlive} is {@code false}.</li> <li>remove otherwise.</li> </ul></li> <li>If the connection is closed by default: <ul> <li>set to {@code "keep-alive"} if {@code keepAlive} is {@code true}.</li> <li>remove otherwise.</li> </ul></li> </ul>
[ "Sets", "the", "value", "of", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L116-L130
box/box-java-sdk
src/main/java/com/box/sdk/BoxLegalHoldPolicy.java
BoxLegalHoldPolicy.getAll
public static Iterable<BoxLegalHoldPolicy.Info> getAll( final BoxAPIConnection api, String policyName, int limit, String ... fields) { """ Retrieves a list of Legal Hold Policies that belong to your Enterprise as an Iterable. @param api api the API connection to be used by the resource. @param policyName case insensitive prefix-match filter on Policy name. @param limit the limit of retrieved entries per page. @param fields the optional fields to retrieve. @return the Iterable of Legal Hold Policies in your Enterprise that match the filter parameters. """ QueryStringBuilder builder = new QueryStringBuilder(); if (policyName != null) { builder.appendParam("policy_name", policyName); } if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxLegalHoldPolicy.Info>(api, ALL_LEGAL_HOLD_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxLegalHoldPolicy.Info factory(JsonObject jsonObject) { BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, jsonObject.get("id").asString()); return policy.new Info(jsonObject); } }; }
java
public static Iterable<BoxLegalHoldPolicy.Info> getAll( final BoxAPIConnection api, String policyName, int limit, String ... fields) { QueryStringBuilder builder = new QueryStringBuilder(); if (policyName != null) { builder.appendParam("policy_name", policyName); } if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<BoxLegalHoldPolicy.Info>(api, ALL_LEGAL_HOLD_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxLegalHoldPolicy.Info factory(JsonObject jsonObject) { BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, jsonObject.get("id").asString()); return policy.new Info(jsonObject); } }; }
[ "public", "static", "Iterable", "<", "BoxLegalHoldPolicy", ".", "Info", ">", "getAll", "(", "final", "BoxAPIConnection", "api", ",", "String", "policyName", ",", "int", "limit", ",", "String", "...", "fields", ")", "{", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuilder", "(", ")", ";", "if", "(", "policyName", "!=", "null", ")", "{", "builder", ".", "appendParam", "(", "\"policy_name\"", ",", "policyName", ")", ";", "}", "if", "(", "fields", ".", "length", ">", "0", ")", "{", "builder", ".", "appendParam", "(", "\"fields\"", ",", "fields", ")", ";", "}", "return", "new", "BoxResourceIterable", "<", "BoxLegalHoldPolicy", ".", "Info", ">", "(", "api", ",", "ALL_LEGAL_HOLD_URL_TEMPLATE", ".", "buildWithQuery", "(", "api", ".", "getBaseURL", "(", ")", ",", "builder", ".", "toString", "(", ")", ")", ",", "limit", ")", "{", "@", "Override", "protected", "BoxLegalHoldPolicy", ".", "Info", "factory", "(", "JsonObject", "jsonObject", ")", "{", "BoxLegalHoldPolicy", "policy", "=", "new", "BoxLegalHoldPolicy", "(", "api", ",", "jsonObject", ".", "get", "(", "\"id\"", ")", ".", "asString", "(", ")", ")", ";", "return", "policy", ".", "new", "Info", "(", "jsonObject", ")", ";", "}", "}", ";", "}" ]
Retrieves a list of Legal Hold Policies that belong to your Enterprise as an Iterable. @param api api the API connection to be used by the resource. @param policyName case insensitive prefix-match filter on Policy name. @param limit the limit of retrieved entries per page. @param fields the optional fields to retrieve. @return the Iterable of Legal Hold Policies in your Enterprise that match the filter parameters.
[ "Retrieves", "a", "list", "of", "Legal", "Hold", "Policies", "that", "belong", "to", "your", "Enterprise", "as", "an", "Iterable", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxLegalHoldPolicy.java#L173-L192
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/Table.java
Table.addHeading
public Table addHeading(Object o,String attributes) { """ /* Add a new heading Cell in the current row. Adds to the table after this call and before next call to newRow, newCell or newHeader are added to the cell. @return This table for call chaining """ addHeading(o); cell.attribute(attributes); return this; }
java
public Table addHeading(Object o,String attributes) { addHeading(o); cell.attribute(attributes); return this; }
[ "public", "Table", "addHeading", "(", "Object", "o", ",", "String", "attributes", ")", "{", "addHeading", "(", "o", ")", ";", "cell", ".", "attribute", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
/* Add a new heading Cell in the current row. Adds to the table after this call and before next call to newRow, newCell or newHeader are added to the cell. @return This table for call chaining
[ "/", "*", "Add", "a", "new", "heading", "Cell", "in", "the", "current", "row", ".", "Adds", "to", "the", "table", "after", "this", "call", "and", "before", "next", "call", "to", "newRow", "newCell", "or", "newHeader", "are", "added", "to", "the", "cell", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Table.java#L214-L219
facebook/fresco
animated-base/src/main/java/com/facebook/imagepipeline/animated/factory/AnimatedImageFactoryImpl.java
AnimatedImageFactoryImpl.decodeGif
public CloseableImage decodeGif( final EncodedImage encodedImage, final ImageDecodeOptions options, final Bitmap.Config bitmapConfig) { """ Decodes a GIF into a CloseableImage. @param encodedImage encoded image (native byte array holding the encoded bytes and meta data) @param options the options for the decode @param bitmapConfig the Bitmap.Config used to generate the output bitmaps @return a {@link CloseableImage} for the GIF image """ if (sGifAnimatedImageDecoder == null) { throw new UnsupportedOperationException("To encode animated gif please add the dependency " + "to the animated-gif module"); } final CloseableReference<PooledByteBuffer> bytesRef = encodedImage.getByteBufferRef(); Preconditions.checkNotNull(bytesRef); try { final PooledByteBuffer input = bytesRef.get(); AnimatedImage gifImage; if (input.getByteBuffer() != null) { gifImage = sGifAnimatedImageDecoder.decode(input.getByteBuffer()); } else { gifImage = sGifAnimatedImageDecoder.decode(input.getNativePtr(), input.size()); } return getCloseableImage(options, gifImage, bitmapConfig); } finally { CloseableReference.closeSafely(bytesRef); } }
java
public CloseableImage decodeGif( final EncodedImage encodedImage, final ImageDecodeOptions options, final Bitmap.Config bitmapConfig) { if (sGifAnimatedImageDecoder == null) { throw new UnsupportedOperationException("To encode animated gif please add the dependency " + "to the animated-gif module"); } final CloseableReference<PooledByteBuffer> bytesRef = encodedImage.getByteBufferRef(); Preconditions.checkNotNull(bytesRef); try { final PooledByteBuffer input = bytesRef.get(); AnimatedImage gifImage; if (input.getByteBuffer() != null) { gifImage = sGifAnimatedImageDecoder.decode(input.getByteBuffer()); } else { gifImage = sGifAnimatedImageDecoder.decode(input.getNativePtr(), input.size()); } return getCloseableImage(options, gifImage, bitmapConfig); } finally { CloseableReference.closeSafely(bytesRef); } }
[ "public", "CloseableImage", "decodeGif", "(", "final", "EncodedImage", "encodedImage", ",", "final", "ImageDecodeOptions", "options", ",", "final", "Bitmap", ".", "Config", "bitmapConfig", ")", "{", "if", "(", "sGifAnimatedImageDecoder", "==", "null", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"To encode animated gif please add the dependency \"", "+", "\"to the animated-gif module\"", ")", ";", "}", "final", "CloseableReference", "<", "PooledByteBuffer", ">", "bytesRef", "=", "encodedImage", ".", "getByteBufferRef", "(", ")", ";", "Preconditions", ".", "checkNotNull", "(", "bytesRef", ")", ";", "try", "{", "final", "PooledByteBuffer", "input", "=", "bytesRef", ".", "get", "(", ")", ";", "AnimatedImage", "gifImage", ";", "if", "(", "input", ".", "getByteBuffer", "(", ")", "!=", "null", ")", "{", "gifImage", "=", "sGifAnimatedImageDecoder", ".", "decode", "(", "input", ".", "getByteBuffer", "(", ")", ")", ";", "}", "else", "{", "gifImage", "=", "sGifAnimatedImageDecoder", ".", "decode", "(", "input", ".", "getNativePtr", "(", ")", ",", "input", ".", "size", "(", ")", ")", ";", "}", "return", "getCloseableImage", "(", "options", ",", "gifImage", ",", "bitmapConfig", ")", ";", "}", "finally", "{", "CloseableReference", ".", "closeSafely", "(", "bytesRef", ")", ";", "}", "}" ]
Decodes a GIF into a CloseableImage. @param encodedImage encoded image (native byte array holding the encoded bytes and meta data) @param options the options for the decode @param bitmapConfig the Bitmap.Config used to generate the output bitmaps @return a {@link CloseableImage} for the GIF image
[ "Decodes", "a", "GIF", "into", "a", "CloseableImage", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/animated-base/src/main/java/com/facebook/imagepipeline/animated/factory/AnimatedImageFactoryImpl.java#L72-L94
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/socket/SnifferSocketImplFactory.java
SnifferSocketImplFactory.uninstall
public static void uninstall() throws IOException { """ Restores previously saved {@link SocketImplFactory} and sets it as a default @see #install() @throws IOException if failed to install {@link SnifferSocketImplFactory} @since 3.1 """ try { Field factoryField = Socket.class.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(null, previousSocketImplFactory); } catch (IllegalAccessException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } catch (NoSuchFieldException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } }
java
public static void uninstall() throws IOException { try { Field factoryField = Socket.class.getDeclaredField("factory"); factoryField.setAccessible(true); factoryField.set(null, previousSocketImplFactory); } catch (IllegalAccessException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } catch (NoSuchFieldException e) { throw new IOException("Failed to initialize SnifferSocketImplFactory", e); } }
[ "public", "static", "void", "uninstall", "(", ")", "throws", "IOException", "{", "try", "{", "Field", "factoryField", "=", "Socket", ".", "class", ".", "getDeclaredField", "(", "\"factory\"", ")", ";", "factoryField", ".", "setAccessible", "(", "true", ")", ";", "factoryField", ".", "set", "(", "null", ",", "previousSocketImplFactory", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Failed to initialize SnifferSocketImplFactory\"", ",", "e", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Failed to initialize SnifferSocketImplFactory\"", ",", "e", ")", ";", "}", "}" ]
Restores previously saved {@link SocketImplFactory} and sets it as a default @see #install() @throws IOException if failed to install {@link SnifferSocketImplFactory} @since 3.1
[ "Restores", "previously", "saved", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/socket/SnifferSocketImplFactory.java#L53-L63
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java
AlignedBox3f.setFromCorners
@Override public void setFromCorners(Point3D p1, Point3D p2) { """ Change the frame of the box. @param p1 is the coordinate of the first corner. @param p2 is the coordinate of the second corner. """ setFromCorners( p1.getX(), p1.getY(), p1.getZ(), p2.getX(), p2.getY(), p2.getZ()); }
java
@Override public void setFromCorners(Point3D p1, Point3D p2) { setFromCorners( p1.getX(), p1.getY(), p1.getZ(), p2.getX(), p2.getY(), p2.getZ()); }
[ "@", "Override", "public", "void", "setFromCorners", "(", "Point3D", "p1", ",", "Point3D", "p2", ")", "{", "setFromCorners", "(", "p1", ".", "getX", "(", ")", ",", "p1", ".", "getY", "(", ")", ",", "p1", ".", "getZ", "(", ")", ",", "p2", ".", "getX", "(", ")", ",", "p2", ".", "getY", "(", ")", ",", "p2", ".", "getZ", "(", ")", ")", ";", "}" ]
Change the frame of the box. @param p1 is the coordinate of the first corner. @param p2 is the coordinate of the second corner.
[ "Change", "the", "frame", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L284-L289
frostwire/frostwire-jlibtorrent
src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java
TorrentHandle.moveStorage
public void moveStorage(String savePath, MoveFlags flags) { """ Moves the file(s) that this torrent are currently seeding from or downloading to. If the given {@code savePath} is not located on the same drive as the original save path, the files will be copied to the new drive and removed from their original location. This will block all other disk IO, and other torrents download and upload rates may drop while copying the file. <p> Since disk IO is performed in a separate thread, this operation is also asynchronous. Once the operation completes, the {@link com.frostwire.jlibtorrent.alerts.StorageMovedAlert} is generated, with the new path as the message. If the move fails for some reason, {@link com.frostwire.jlibtorrent.alerts.StorageMovedFailedAlert} generated instead, containing the error message. <p> The {@code flags} argument determines the behavior of the copying/moving of the files in the torrent. <p> Files that have been renamed to have absolute paths are not moved by this function. Keep in mind that files that don't belong to the torrent but are stored in the torrent's directory may be moved as well. This goes for files that have been renamed to absolute paths that still end up inside the save path. @param savePath the new save path @param flags the move behavior flags """ th.move_storage(savePath, flags.swig()); }
java
public void moveStorage(String savePath, MoveFlags flags) { th.move_storage(savePath, flags.swig()); }
[ "public", "void", "moveStorage", "(", "String", "savePath", ",", "MoveFlags", "flags", ")", "{", "th", ".", "move_storage", "(", "savePath", ",", "flags", ".", "swig", "(", ")", ")", ";", "}" ]
Moves the file(s) that this torrent are currently seeding from or downloading to. If the given {@code savePath} is not located on the same drive as the original save path, the files will be copied to the new drive and removed from their original location. This will block all other disk IO, and other torrents download and upload rates may drop while copying the file. <p> Since disk IO is performed in a separate thread, this operation is also asynchronous. Once the operation completes, the {@link com.frostwire.jlibtorrent.alerts.StorageMovedAlert} is generated, with the new path as the message. If the move fails for some reason, {@link com.frostwire.jlibtorrent.alerts.StorageMovedFailedAlert} generated instead, containing the error message. <p> The {@code flags} argument determines the behavior of the copying/moving of the files in the torrent. <p> Files that have been renamed to have absolute paths are not moved by this function. Keep in mind that files that don't belong to the torrent but are stored in the torrent's directory may be moved as well. This goes for files that have been renamed to absolute paths that still end up inside the save path. @param savePath the new save path @param flags the move behavior flags
[ "Moves", "the", "file", "(", "s", ")", "that", "this", "torrent", "are", "currently", "seeding", "from", "or", "downloading", "to", ".", "If", "the", "given", "{", "@code", "savePath", "}", "is", "not", "located", "on", "the", "same", "drive", "as", "the", "original", "save", "path", "the", "files", "will", "be", "copied", "to", "the", "new", "drive", "and", "removed", "from", "their", "original", "location", ".", "This", "will", "block", "all", "other", "disk", "IO", "and", "other", "torrents", "download", "and", "upload", "rates", "may", "drop", "while", "copying", "the", "file", ".", "<p", ">", "Since", "disk", "IO", "is", "performed", "in", "a", "separate", "thread", "this", "operation", "is", "also", "asynchronous", ".", "Once", "the", "operation", "completes", "the", "{", "@link", "com", ".", "frostwire", ".", "jlibtorrent", ".", "alerts", ".", "StorageMovedAlert", "}", "is", "generated", "with", "the", "new", "path", "as", "the", "message", ".", "If", "the", "move", "fails", "for", "some", "reason", "{", "@link", "com", ".", "frostwire", ".", "jlibtorrent", ".", "alerts", ".", "StorageMovedFailedAlert", "}", "generated", "instead", "containing", "the", "error", "message", ".", "<p", ">", "The", "{", "@code", "flags", "}", "argument", "determines", "the", "behavior", "of", "the", "copying", "/", "moving", "of", "the", "files", "in", "the", "torrent", ".", "<p", ">", "Files", "that", "have", "been", "renamed", "to", "have", "absolute", "paths", "are", "not", "moved", "by", "this", "function", ".", "Keep", "in", "mind", "that", "files", "that", "don", "t", "belong", "to", "the", "torrent", "but", "are", "stored", "in", "the", "torrent", "s", "directory", "may", "be", "moved", "as", "well", ".", "This", "goes", "for", "files", "that", "have", "been", "renamed", "to", "absolute", "paths", "that", "still", "end", "up", "inside", "the", "save", "path", "." ]
train
https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java#L1323-L1325
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/holder/ImageHolder.java
ImageHolder.decideIcon
public Drawable decideIcon(Context ctx, int iconColor, boolean tint, int paddingDp) { """ this only handles Drawables @param ctx @param iconColor @param tint @return """ Drawable icon = getIcon(); if (mIIcon != null) { icon = new IconicsDrawable(ctx, mIIcon).color(iconColor).sizeDp(24).paddingDp(paddingDp); } else if (getIconRes() != -1) { icon = AppCompatResources.getDrawable(ctx, getIconRes()); } else if (getUri() != null) { try { InputStream inputStream = ctx.getContentResolver().openInputStream(getUri()); icon = Drawable.createFromStream(inputStream, getUri().toString()); } catch (FileNotFoundException e) { //no need to handle this } } //if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;) if (icon != null && tint && mIIcon == null) { icon = icon.mutate(); icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); } return icon; }
java
public Drawable decideIcon(Context ctx, int iconColor, boolean tint, int paddingDp) { Drawable icon = getIcon(); if (mIIcon != null) { icon = new IconicsDrawable(ctx, mIIcon).color(iconColor).sizeDp(24).paddingDp(paddingDp); } else if (getIconRes() != -1) { icon = AppCompatResources.getDrawable(ctx, getIconRes()); } else if (getUri() != null) { try { InputStream inputStream = ctx.getContentResolver().openInputStream(getUri()); icon = Drawable.createFromStream(inputStream, getUri().toString()); } catch (FileNotFoundException e) { //no need to handle this } } //if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;) if (icon != null && tint && mIIcon == null) { icon = icon.mutate(); icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN); } return icon; }
[ "public", "Drawable", "decideIcon", "(", "Context", "ctx", ",", "int", "iconColor", ",", "boolean", "tint", ",", "int", "paddingDp", ")", "{", "Drawable", "icon", "=", "getIcon", "(", ")", ";", "if", "(", "mIIcon", "!=", "null", ")", "{", "icon", "=", "new", "IconicsDrawable", "(", "ctx", ",", "mIIcon", ")", ".", "color", "(", "iconColor", ")", ".", "sizeDp", "(", "24", ")", ".", "paddingDp", "(", "paddingDp", ")", ";", "}", "else", "if", "(", "getIconRes", "(", ")", "!=", "-", "1", ")", "{", "icon", "=", "AppCompatResources", ".", "getDrawable", "(", "ctx", ",", "getIconRes", "(", ")", ")", ";", "}", "else", "if", "(", "getUri", "(", ")", "!=", "null", ")", "{", "try", "{", "InputStream", "inputStream", "=", "ctx", ".", "getContentResolver", "(", ")", ".", "openInputStream", "(", "getUri", "(", ")", ")", ";", "icon", "=", "Drawable", ".", "createFromStream", "(", "inputStream", ",", "getUri", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "//no need to handle this", "}", "}", "//if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;)", "if", "(", "icon", "!=", "null", "&&", "tint", "&&", "mIIcon", "==", "null", ")", "{", "icon", "=", "icon", ".", "mutate", "(", ")", ";", "icon", ".", "setColorFilter", "(", "iconColor", ",", "PorterDuff", ".", "Mode", ".", "SRC_IN", ")", ";", "}", "return", "icon", ";", "}" ]
this only handles Drawables @param ctx @param iconColor @param tint @return
[ "this", "only", "handles", "Drawables" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/holder/ImageHolder.java#L97-L120
wisdom-framework/wisdom
framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java
CacheUtils.fromFile
public static Result fromFile(File file, Context context, ApplicationConfiguration configuration, Crypto crypto) { """ Computes the result to sent the given file. Cache headers are automatically set by this method. @param file the file to send to the client @param context the context @param configuration the application configuration @param crypto the crypto service @return the result, it can be a NOT_MODIFIED if the file was not modified since the last request, or an OK result with the cache headers set. """ long lastModified = file.lastModified(); String etag = computeEtag(lastModified, configuration, crypto); if (isNotModified(context, lastModified, etag)) { return new Result(Status.NOT_MODIFIED); } else { Result result = Results.ok(file); addLastModified(result, lastModified); addCacheControlAndEtagToResult(result, etag, configuration); return result; } }
java
public static Result fromFile(File file, Context context, ApplicationConfiguration configuration, Crypto crypto) { long lastModified = file.lastModified(); String etag = computeEtag(lastModified, configuration, crypto); if (isNotModified(context, lastModified, etag)) { return new Result(Status.NOT_MODIFIED); } else { Result result = Results.ok(file); addLastModified(result, lastModified); addCacheControlAndEtagToResult(result, etag, configuration); return result; } }
[ "public", "static", "Result", "fromFile", "(", "File", "file", ",", "Context", "context", ",", "ApplicationConfiguration", "configuration", ",", "Crypto", "crypto", ")", "{", "long", "lastModified", "=", "file", ".", "lastModified", "(", ")", ";", "String", "etag", "=", "computeEtag", "(", "lastModified", ",", "configuration", ",", "crypto", ")", ";", "if", "(", "isNotModified", "(", "context", ",", "lastModified", ",", "etag", ")", ")", "{", "return", "new", "Result", "(", "Status", ".", "NOT_MODIFIED", ")", ";", "}", "else", "{", "Result", "result", "=", "Results", ".", "ok", "(", "file", ")", ";", "addLastModified", "(", "result", ",", "lastModified", ")", ";", "addCacheControlAndEtagToResult", "(", "result", ",", "etag", ",", "configuration", ")", ";", "return", "result", ";", "}", "}" ]
Computes the result to sent the given file. Cache headers are automatically set by this method. @param file the file to send to the client @param context the context @param configuration the application configuration @param crypto the crypto service @return the result, it can be a NOT_MODIFIED if the file was not modified since the last request, or an OK result with the cache headers set.
[ "Computes", "the", "result", "to", "sent", "the", "given", "file", ".", "Cache", "headers", "are", "automatically", "set", "by", "this", "method", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/CacheUtils.java#L156-L167
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java
CharOperation.lastIndexOf
public static final int lastIndexOf(char toBeFound, char[] array) { """ Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array. Answers -1 if no occurrence of this character is found. <br> <br> For example: <ol> <li> <pre> toBeFound = 'c' array = { ' a', 'b', 'c', 'd' , 'c', 'e' } result =&gt; 4 </pre> </li> <li> <pre> toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result =&gt; -1 </pre> </li> </ol> @param toBeFound the character to search @param array the array to be searched @return the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array, -1 otherwise @throws NullPointerException if array is null """ for (int i = array.length; --i >= 0;) { if (toBeFound == array[i]) { return i; } } return -1; }
java
public static final int lastIndexOf(char toBeFound, char[] array) { for (int i = array.length; --i >= 0;) { if (toBeFound == array[i]) { return i; } } return -1; }
[ "public", "static", "final", "int", "lastIndexOf", "(", "char", "toBeFound", ",", "char", "[", "]", "array", ")", "{", "for", "(", "int", "i", "=", "array", ".", "length", ";", "--", "i", ">=", "0", ";", ")", "{", "if", "(", "toBeFound", "==", "array", "[", "i", "]", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Answers the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array. Answers -1 if no occurrence of this character is found. <br> <br> For example: <ol> <li> <pre> toBeFound = 'c' array = { ' a', 'b', 'c', 'd' , 'c', 'e' } result =&gt; 4 </pre> </li> <li> <pre> toBeFound = 'e' array = { ' a', 'b', 'c', 'd' } result =&gt; -1 </pre> </li> </ol> @param toBeFound the character to search @param array the array to be searched @return the last index in the array for which the corresponding character is equal to toBeFound starting from the end of the array, -1 otherwise @throws NullPointerException if array is null
[ "Answers", "the", "last", "index", "in", "the", "array", "for", "which", "the", "corresponding", "character", "is", "equal", "to", "toBeFound", "starting", "from", "the", "end", "of", "the", "array", ".", "Answers", "-", "1", "if", "no", "occurrence", "of", "this", "character", "is", "found", ".", "<br", ">", "<br", ">", "For", "example", ":", "<ol", ">", "<li", ">" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L2419-L2429
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/UpdateDescription.java
UpdateDescription.toUpdateDocument
public BsonDocument toUpdateDocument() { """ Convert this update description to an update document. @return an update document with the appropriate $set and $unset documents. """ final List<BsonElement> unsets = new ArrayList<>(); for (final String removedField : this.removedFields) { unsets.add(new BsonElement(removedField, new BsonBoolean(true))); } final BsonDocument updateDocument = new BsonDocument(); if (this.updatedFields.size() > 0) { updateDocument.append("$set", this.updatedFields); } if (unsets.size() > 0) { updateDocument.append("$unset", new BsonDocument(unsets)); } return updateDocument; }
java
public BsonDocument toUpdateDocument() { final List<BsonElement> unsets = new ArrayList<>(); for (final String removedField : this.removedFields) { unsets.add(new BsonElement(removedField, new BsonBoolean(true))); } final BsonDocument updateDocument = new BsonDocument(); if (this.updatedFields.size() > 0) { updateDocument.append("$set", this.updatedFields); } if (unsets.size() > 0) { updateDocument.append("$unset", new BsonDocument(unsets)); } return updateDocument; }
[ "public", "BsonDocument", "toUpdateDocument", "(", ")", "{", "final", "List", "<", "BsonElement", ">", "unsets", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "String", "removedField", ":", "this", ".", "removedFields", ")", "{", "unsets", ".", "add", "(", "new", "BsonElement", "(", "removedField", ",", "new", "BsonBoolean", "(", "true", ")", ")", ")", ";", "}", "final", "BsonDocument", "updateDocument", "=", "new", "BsonDocument", "(", ")", ";", "if", "(", "this", ".", "updatedFields", ".", "size", "(", ")", ">", "0", ")", "{", "updateDocument", ".", "append", "(", "\"$set\"", ",", "this", ".", "updatedFields", ")", ";", "}", "if", "(", "unsets", ".", "size", "(", ")", ">", "0", ")", "{", "updateDocument", ".", "append", "(", "\"$unset\"", ",", "new", "BsonDocument", "(", "unsets", ")", ")", ";", "}", "return", "updateDocument", ";", "}" ]
Convert this update description to an update document. @return an update document with the appropriate $set and $unset documents.
[ "Convert", "this", "update", "description", "to", "an", "update", "document", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/UpdateDescription.java#L84-L100
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.notifyChildRangeChanged
@UiThread public void notifyChildRangeChanged(int parentPosition, int childPositionStart, int itemCount) { """ Notify any registered observers that the parent at {@code parentPosition} has {@code itemCount} children starting at {@code childPositionStart} that have changed. <p> This is an item change event, not a structural change event. It indicates that any The parent at {@code childPositionStart} retains the same identity. reflection of the set of {@code itemCount} children starting at {@code childPositionStart} are out of date and should be updated. @param parentPosition Position of the parent who has a child that has changed @param childPositionStart Position of the first child that has changed @param itemCount number of children changed """ P parent = mParentList.get(parentPosition); int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(parent); if (parentWrapper.isExpanded()) { int flatChildPosition = flatParentPosition + childPositionStart + 1; for (int i = 0; i < itemCount; i++) { ExpandableWrapper<P, C> child = parentWrapper.getWrappedChildList().get(childPositionStart + i); mFlatItemList.set(flatChildPosition + i, child); } notifyItemRangeChanged(flatChildPosition, itemCount); } }
java
@UiThread public void notifyChildRangeChanged(int parentPosition, int childPositionStart, int itemCount) { P parent = mParentList.get(parentPosition); int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(parent); if (parentWrapper.isExpanded()) { int flatChildPosition = flatParentPosition + childPositionStart + 1; for (int i = 0; i < itemCount; i++) { ExpandableWrapper<P, C> child = parentWrapper.getWrappedChildList().get(childPositionStart + i); mFlatItemList.set(flatChildPosition + i, child); } notifyItemRangeChanged(flatChildPosition, itemCount); } }
[ "@", "UiThread", "public", "void", "notifyChildRangeChanged", "(", "int", "parentPosition", ",", "int", "childPositionStart", ",", "int", "itemCount", ")", "{", "P", "parent", "=", "mParentList", ".", "get", "(", "parentPosition", ")", ";", "int", "flatParentPosition", "=", "getFlatParentPosition", "(", "parentPosition", ")", ";", "ExpandableWrapper", "<", "P", ",", "C", ">", "parentWrapper", "=", "mFlatItemList", ".", "get", "(", "flatParentPosition", ")", ";", "parentWrapper", ".", "setParent", "(", "parent", ")", ";", "if", "(", "parentWrapper", ".", "isExpanded", "(", ")", ")", "{", "int", "flatChildPosition", "=", "flatParentPosition", "+", "childPositionStart", "+", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "itemCount", ";", "i", "++", ")", "{", "ExpandableWrapper", "<", "P", ",", "C", ">", "child", "=", "parentWrapper", ".", "getWrappedChildList", "(", ")", ".", "get", "(", "childPositionStart", "+", "i", ")", ";", "mFlatItemList", ".", "set", "(", "flatChildPosition", "+", "i", ",", "child", ")", ";", "}", "notifyItemRangeChanged", "(", "flatChildPosition", ",", "itemCount", ")", ";", "}", "}" ]
Notify any registered observers that the parent at {@code parentPosition} has {@code itemCount} children starting at {@code childPositionStart} that have changed. <p> This is an item change event, not a structural change event. It indicates that any The parent at {@code childPositionStart} retains the same identity. reflection of the set of {@code itemCount} children starting at {@code childPositionStart} are out of date and should be updated. @param parentPosition Position of the parent who has a child that has changed @param childPositionStart Position of the first child that has changed @param itemCount number of children changed
[ "Notify", "any", "registered", "observers", "that", "the", "parent", "at", "{", "@code", "parentPosition", "}", "has", "{", "@code", "itemCount", "}", "children", "starting", "at", "{", "@code", "childPositionStart", "}", "that", "have", "changed", ".", "<p", ">", "This", "is", "an", "item", "change", "event", "not", "a", "structural", "change", "event", ".", "It", "indicates", "that", "any", "The", "parent", "at", "{", "@code", "childPositionStart", "}", "retains", "the", "same", "identity", ".", "reflection", "of", "the", "set", "of", "{", "@code", "itemCount", "}", "children", "starting", "at", "{", "@code", "childPositionStart", "}", "are", "out", "of", "date", "and", "should", "be", "updated", "." ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1268-L1283
dbracewell/hermes
hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java
WordNet.getSenses
public List<Sense> getSenses(String surfaceForm) { """ Gets senses. @param surfaceForm the surface form @return the senses """ return getSenses(surfaceForm, POS.ANY, Hermes.defaultLanguage()); }
java
public List<Sense> getSenses(String surfaceForm) { return getSenses(surfaceForm, POS.ANY, Hermes.defaultLanguage()); }
[ "public", "List", "<", "Sense", ">", "getSenses", "(", "String", "surfaceForm", ")", "{", "return", "getSenses", "(", "surfaceForm", ",", "POS", ".", "ANY", ",", "Hermes", ".", "defaultLanguage", "(", ")", ")", ";", "}" ]
Gets senses. @param surfaceForm the surface form @return the senses
[ "Gets", "senses", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java#L481-L483
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java
Scheduler.scheduleRecurring
public void scheduleRecurring(Runnable runnable, Date firstTime, long period) { """ Schedule runnable to run a given interval @param runnable the runnable to @param firstTime @param period """ timer.scheduleAtFixedRate(toTimerTask(runnable), firstTime, period); }
java
public void scheduleRecurring(Runnable runnable, Date firstTime, long period) { timer.scheduleAtFixedRate(toTimerTask(runnable), firstTime, period); }
[ "public", "void", "scheduleRecurring", "(", "Runnable", "runnable", ",", "Date", "firstTime", ",", "long", "period", ")", "{", "timer", ".", "scheduleAtFixedRate", "(", "toTimerTask", "(", "runnable", ")", ",", "firstTime", ",", "period", ")", ";", "}" ]
Schedule runnable to run a given interval @param runnable the runnable to @param firstTime @param period
[ "Schedule", "runnable", "to", "run", "a", "given", "interval" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L188-L192
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.getOperation
public final Operation getOperation(String projectId, String zone, String operationId) { """ Gets the specified operation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String operationId = ""; Operation response = clusterManagerClient.getOperation(projectId, zone, operationId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param operationId Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ GetOperationRequest request = GetOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); return getOperation(request); }
java
public final Operation getOperation(String projectId, String zone, String operationId) { GetOperationRequest request = GetOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); return getOperation(request); }
[ "public", "final", "Operation", "getOperation", "(", "String", "projectId", ",", "String", "zone", ",", "String", "operationId", ")", "{", "GetOperationRequest", "request", "=", "GetOperationRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setZone", "(", "zone", ")", ".", "setOperationId", "(", "operationId", ")", ".", "build", "(", ")", ";", "return", "getOperation", "(", "request", ")", ";", "}" ]
Gets the specified operation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String operationId = ""; Operation response = clusterManagerClient.getOperation(projectId, zone, operationId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param operationId Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "the", "specified", "operation", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1478-L1487
micronaut-projects/micronaut-core
discovery-client/src/main/java/io/micronaut/discovery/client/DiscoveryClientConfiguration.java
DiscoveryClientConfiguration.setZones
public void setZones(Map<String, List<URL>> zones) { """ Configures Discovery servers in other zones. @param zones The zones """ if (zones != null) { this.otherZones = zones.entrySet() .stream() .flatMap((Function<Map.Entry<String, List<URL>>, Stream<ServiceInstance>>) entry -> entry.getValue() .stream() .map(uriMapper()) .map(uri -> ServiceInstance.builder(getServiceID(), uri) .zone(entry.getKey()) .build() )) .collect(Collectors.toList()); } }
java
public void setZones(Map<String, List<URL>> zones) { if (zones != null) { this.otherZones = zones.entrySet() .stream() .flatMap((Function<Map.Entry<String, List<URL>>, Stream<ServiceInstance>>) entry -> entry.getValue() .stream() .map(uriMapper()) .map(uri -> ServiceInstance.builder(getServiceID(), uri) .zone(entry.getKey()) .build() )) .collect(Collectors.toList()); } }
[ "public", "void", "setZones", "(", "Map", "<", "String", ",", "List", "<", "URL", ">", ">", "zones", ")", "{", "if", "(", "zones", "!=", "null", ")", "{", "this", ".", "otherZones", "=", "zones", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "(", "Function", "<", "Map", ".", "Entry", "<", "String", ",", "List", "<", "URL", ">", ">", ",", "Stream", "<", "ServiceInstance", ">", ">", ")", "entry", "->", "entry", ".", "getValue", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "uriMapper", "(", ")", ")", ".", "map", "(", "uri", "->", "ServiceInstance", ".", "builder", "(", "getServiceID", "(", ")", ",", "uri", ")", ".", "zone", "(", "entry", ".", "getKey", "(", ")", ")", ".", "build", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}", "}" ]
Configures Discovery servers in other zones. @param zones The zones
[ "Configures", "Discovery", "servers", "in", "other", "zones", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/discovery-client/src/main/java/io/micronaut/discovery/client/DiscoveryClientConfiguration.java#L155-L170
ttddyy/datasource-proxy
src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java
DefaultJsonQueryLogEntryCreator.writeQuerySizeEntry
protected void writeQuerySizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { """ Write query size as json. <p>default: "querySize":1, @param sb StringBuilder to write @param execInfo execution info @param queryInfoList query info list """ sb.append("\"querySize\":"); sb.append(queryInfoList.size()); sb.append(", "); }
java
protected void writeQuerySizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) { sb.append("\"querySize\":"); sb.append(queryInfoList.size()); sb.append(", "); }
[ "protected", "void", "writeQuerySizeEntry", "(", "StringBuilder", "sb", ",", "ExecutionInfo", "execInfo", ",", "List", "<", "QueryInfo", ">", "queryInfoList", ")", "{", "sb", ".", "append", "(", "\"\\\"querySize\\\":\"", ")", ";", "sb", ".", "append", "(", "queryInfoList", ".", "size", "(", ")", ")", ";", "sb", ".", "append", "(", "\", \"", ")", ";", "}" ]
Write query size as json. <p>default: "querySize":1, @param sb StringBuilder to write @param execInfo execution info @param queryInfoList query info list
[ "Write", "query", "size", "as", "json", "." ]
train
https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L167-L171
sdl/Testy
src/main/java/com/sdl/selenium/extjs6/form/DateField.java
DateField.setDate
private boolean setDate(String day, String month, String year) { """ example new DataField().setDate("19", "05", "2013") @param day String 'dd' @param month String 'MMM' @param year String 'yyyy' @return true if is selected date, false when DataField doesn't exist """ String fullDate = RetryUtils.retry(4, () -> monthYearButton.getText()).trim(); if (!fullDate.contains(month) || !fullDate.contains(year)) { monthYearButton.click(); if (!yearAndMonth.ready()) { monthYearButton.click(); } goToYear(year, fullDate); WebLink monthEl = new WebLink(monthContainer).setText(month, SearchType.EQUALS).setInfoMessage("month " + month); monthEl.click(); selectOkButton.click(); } WebLocator dayEl = new WebLocator(dayContainer).setText(day, SearchType.EQUALS).setVisibility(true).setInfoMessage("day " + day); Utils.sleep(50); return dayEl.click(); }
java
private boolean setDate(String day, String month, String year) { String fullDate = RetryUtils.retry(4, () -> monthYearButton.getText()).trim(); if (!fullDate.contains(month) || !fullDate.contains(year)) { monthYearButton.click(); if (!yearAndMonth.ready()) { monthYearButton.click(); } goToYear(year, fullDate); WebLink monthEl = new WebLink(monthContainer).setText(month, SearchType.EQUALS).setInfoMessage("month " + month); monthEl.click(); selectOkButton.click(); } WebLocator dayEl = new WebLocator(dayContainer).setText(day, SearchType.EQUALS).setVisibility(true).setInfoMessage("day " + day); Utils.sleep(50); return dayEl.click(); }
[ "private", "boolean", "setDate", "(", "String", "day", ",", "String", "month", ",", "String", "year", ")", "{", "String", "fullDate", "=", "RetryUtils", ".", "retry", "(", "4", ",", "(", ")", "->", "monthYearButton", ".", "getText", "(", ")", ")", ".", "trim", "(", ")", ";", "if", "(", "!", "fullDate", ".", "contains", "(", "month", ")", "||", "!", "fullDate", ".", "contains", "(", "year", ")", ")", "{", "monthYearButton", ".", "click", "(", ")", ";", "if", "(", "!", "yearAndMonth", ".", "ready", "(", ")", ")", "{", "monthYearButton", ".", "click", "(", ")", ";", "}", "goToYear", "(", "year", ",", "fullDate", ")", ";", "WebLink", "monthEl", "=", "new", "WebLink", "(", "monthContainer", ")", ".", "setText", "(", "month", ",", "SearchType", ".", "EQUALS", ")", ".", "setInfoMessage", "(", "\"month \"", "+", "month", ")", ";", "monthEl", ".", "click", "(", ")", ";", "selectOkButton", ".", "click", "(", ")", ";", "}", "WebLocator", "dayEl", "=", "new", "WebLocator", "(", "dayContainer", ")", ".", "setText", "(", "day", ",", "SearchType", ".", "EQUALS", ")", ".", "setVisibility", "(", "true", ")", ".", "setInfoMessage", "(", "\"day \"", "+", "day", ")", ";", "Utils", ".", "sleep", "(", "50", ")", ";", "return", "dayEl", ".", "click", "(", ")", ";", "}" ]
example new DataField().setDate("19", "05", "2013") @param day String 'dd' @param month String 'MMM' @param year String 'yyyy' @return true if is selected date, false when DataField doesn't exist
[ "example", "new", "DataField", "()", ".", "setDate", "(", "19", "05", "2013", ")" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs6/form/DateField.java#L63-L78
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeCalendarHours
private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException { """ Write calendar hours. @param parentCalendar parent calendar instance @param record calendar hours instance @throws IOException """ m_buffer.setLength(0); int recordNumber; if (!parentCalendar.isDerived()) { recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER; } else { recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER; } DateRange range1 = record.getRange(0); if (range1 == null) { range1 = DateRange.EMPTY_RANGE; } DateRange range2 = record.getRange(1); if (range2 == null) { range2 = DateRange.EMPTY_RANGE; } DateRange range3 = record.getRange(2); if (range3 == null) { range3 = DateRange.EMPTY_RANGE; } m_buffer.append(recordNumber); m_buffer.append(m_delimiter); m_buffer.append(format(record.getDay())); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getEnd()))); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
java
private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException { m_buffer.setLength(0); int recordNumber; if (!parentCalendar.isDerived()) { recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER; } else { recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER; } DateRange range1 = record.getRange(0); if (range1 == null) { range1 = DateRange.EMPTY_RANGE; } DateRange range2 = record.getRange(1); if (range2 == null) { range2 = DateRange.EMPTY_RANGE; } DateRange range3 = record.getRange(2); if (range3 == null) { range3 = DateRange.EMPTY_RANGE; } m_buffer.append(recordNumber); m_buffer.append(m_delimiter); m_buffer.append(format(record.getDay())); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getEnd()))); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
[ "private", "void", "writeCalendarHours", "(", "ProjectCalendar", "parentCalendar", ",", "ProjectCalendarHours", "record", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "int", "recordNumber", ";", "if", "(", "!", "parentCalendar", ".", "isDerived", "(", ")", ")", "{", "recordNumber", "=", "MPXConstants", ".", "BASE_CALENDAR_HOURS_RECORD_NUMBER", ";", "}", "else", "{", "recordNumber", "=", "MPXConstants", ".", "RESOURCE_CALENDAR_HOURS_RECORD_NUMBER", ";", "}", "DateRange", "range1", "=", "record", ".", "getRange", "(", "0", ")", ";", "if", "(", "range1", "==", "null", ")", "{", "range1", "=", "DateRange", ".", "EMPTY_RANGE", ";", "}", "DateRange", "range2", "=", "record", ".", "getRange", "(", "1", ")", ";", "if", "(", "range2", "==", "null", ")", "{", "range2", "=", "DateRange", ".", "EMPTY_RANGE", ";", "}", "DateRange", "range3", "=", "record", ".", "getRange", "(", "2", ")", ";", "if", "(", "range3", "==", "null", ")", "{", "range3", "=", "DateRange", ".", "EMPTY_RANGE", ";", "}", "m_buffer", ".", "append", "(", "recordNumber", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "record", ".", "getDay", "(", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range1", ".", "getStart", "(", ")", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range1", ".", "getEnd", "(", ")", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range2", ".", "getStart", "(", ")", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range2", ".", "getEnd", "(", ")", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range3", ".", "getStart", "(", ")", ")", ")", ")", ";", "m_buffer", ".", "append", "(", "m_delimiter", ")", ";", "m_buffer", ".", "append", "(", "format", "(", "formatTime", "(", "range3", ".", "getEnd", "(", ")", ")", ")", ")", ";", "stripTrailingDelimiters", "(", "m_buffer", ")", ";", "m_buffer", ".", "append", "(", "MPXConstants", ".", "EOL", ")", ";", "m_writer", ".", "write", "(", "m_buffer", ".", "toString", "(", ")", ")", ";", "}" ]
Write calendar hours. @param parentCalendar parent calendar instance @param record calendar hours instance @throws IOException
[ "Write", "calendar", "hours", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L394-L446
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java
AFPChainCoordManager.getLegendPosition
public Point getLegendPosition(int lineNr, int chainNr) { """ provide the coordinates for where to draw the legend for line X and if it is chain 1 or 2 @param lineNr which line is this for @param chainNr is it chain 0 or 1 @return get the point where to draw the legend """ int x = DEFAULT_X_SPACE ; int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE; y += chainNr * DEFAULT_LINE_SEPARATION; Point p = new Point(x,y); return p; }
java
public Point getLegendPosition(int lineNr, int chainNr) { int x = DEFAULT_X_SPACE ; int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE; y += chainNr * DEFAULT_LINE_SEPARATION; Point p = new Point(x,y); return p; }
[ "public", "Point", "getLegendPosition", "(", "int", "lineNr", ",", "int", "chainNr", ")", "{", "int", "x", "=", "DEFAULT_X_SPACE", ";", "int", "y", "=", "lineNr", "*", "DEFAULT_Y_STEP", "+", "DEFAULT_Y_SPACE", ";", "y", "+=", "chainNr", "*", "DEFAULT_LINE_SEPARATION", ";", "Point", "p", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "return", "p", ";", "}" ]
provide the coordinates for where to draw the legend for line X and if it is chain 1 or 2 @param lineNr which line is this for @param chainNr is it chain 0 or 1 @return get the point where to draw the legend
[ "provide", "the", "coordinates", "for", "where", "to", "draw", "the", "legend", "for", "line", "X", "and", "if", "it", "is", "chain", "1", "or", "2" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/AFPChainCoordManager.java#L192-L201
craftercms/commons
utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java
PGPUtils.decryptData
protected static void decryptData(final PGPPrivateKey privateKey, final PGPPublicKeyEncryptedData data, final BcKeyFingerprintCalculator calculator, final OutputStream targetStream) throws PGPException, IOException { """ Performs the decryption of the given data. @param privateKey PGP Private Key to decrypt @param data encrypted data @param calculator instance of {@link BcKeyFingerprintCalculator} @param targetStream stream to receive the decrypted data @throws PGPException if the decryption process fails @throws IOException if the stream write operation fails """ PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder().setProvider (PROVIDER).setContentProvider(PROVIDER).build(privateKey); InputStream content = data.getDataStream(decryptorFactory); PGPObjectFactory plainFactory = new PGPObjectFactory(content, calculator); Object message = plainFactory.nextObject(); if(message instanceof PGPCompressedData) { PGPCompressedData compressedData = (PGPCompressedData) message; PGPObjectFactory compressedFactory = new PGPObjectFactory(compressedData.getDataStream(), calculator); message = compressedFactory.nextObject(); } if(message instanceof PGPLiteralData) { PGPLiteralData literalData = (PGPLiteralData) message; try(InputStream literalStream = literalData.getInputStream()) { IOUtils.copy(literalStream, targetStream); } } else if(message instanceof PGPOnePassSignatureList) { throw new PGPException("Encrypted message contains a signed message - not literal data."); } else { throw new PGPException("Message is not a simple encrypted file - type unknown."); } if(data.isIntegrityProtected() && !data.verify()) { throw new PGPException("Message failed integrity check"); } }
java
protected static void decryptData(final PGPPrivateKey privateKey, final PGPPublicKeyEncryptedData data, final BcKeyFingerprintCalculator calculator, final OutputStream targetStream) throws PGPException, IOException { PublicKeyDataDecryptorFactory decryptorFactory = new JcePublicKeyDataDecryptorFactoryBuilder().setProvider (PROVIDER).setContentProvider(PROVIDER).build(privateKey); InputStream content = data.getDataStream(decryptorFactory); PGPObjectFactory plainFactory = new PGPObjectFactory(content, calculator); Object message = plainFactory.nextObject(); if(message instanceof PGPCompressedData) { PGPCompressedData compressedData = (PGPCompressedData) message; PGPObjectFactory compressedFactory = new PGPObjectFactory(compressedData.getDataStream(), calculator); message = compressedFactory.nextObject(); } if(message instanceof PGPLiteralData) { PGPLiteralData literalData = (PGPLiteralData) message; try(InputStream literalStream = literalData.getInputStream()) { IOUtils.copy(literalStream, targetStream); } } else if(message instanceof PGPOnePassSignatureList) { throw new PGPException("Encrypted message contains a signed message - not literal data."); } else { throw new PGPException("Message is not a simple encrypted file - type unknown."); } if(data.isIntegrityProtected() && !data.verify()) { throw new PGPException("Message failed integrity check"); } }
[ "protected", "static", "void", "decryptData", "(", "final", "PGPPrivateKey", "privateKey", ",", "final", "PGPPublicKeyEncryptedData", "data", ",", "final", "BcKeyFingerprintCalculator", "calculator", ",", "final", "OutputStream", "targetStream", ")", "throws", "PGPException", ",", "IOException", "{", "PublicKeyDataDecryptorFactory", "decryptorFactory", "=", "new", "JcePublicKeyDataDecryptorFactoryBuilder", "(", ")", ".", "setProvider", "(", "PROVIDER", ")", ".", "setContentProvider", "(", "PROVIDER", ")", ".", "build", "(", "privateKey", ")", ";", "InputStream", "content", "=", "data", ".", "getDataStream", "(", "decryptorFactory", ")", ";", "PGPObjectFactory", "plainFactory", "=", "new", "PGPObjectFactory", "(", "content", ",", "calculator", ")", ";", "Object", "message", "=", "plainFactory", ".", "nextObject", "(", ")", ";", "if", "(", "message", "instanceof", "PGPCompressedData", ")", "{", "PGPCompressedData", "compressedData", "=", "(", "PGPCompressedData", ")", "message", ";", "PGPObjectFactory", "compressedFactory", "=", "new", "PGPObjectFactory", "(", "compressedData", ".", "getDataStream", "(", ")", ",", "calculator", ")", ";", "message", "=", "compressedFactory", ".", "nextObject", "(", ")", ";", "}", "if", "(", "message", "instanceof", "PGPLiteralData", ")", "{", "PGPLiteralData", "literalData", "=", "(", "PGPLiteralData", ")", "message", ";", "try", "(", "InputStream", "literalStream", "=", "literalData", ".", "getInputStream", "(", ")", ")", "{", "IOUtils", ".", "copy", "(", "literalStream", ",", "targetStream", ")", ";", "}", "}", "else", "if", "(", "message", "instanceof", "PGPOnePassSignatureList", ")", "{", "throw", "new", "PGPException", "(", "\"Encrypted message contains a signed message - not literal data.\"", ")", ";", "}", "else", "{", "throw", "new", "PGPException", "(", "\"Message is not a simple encrypted file - type unknown.\"", ")", ";", "}", "if", "(", "data", ".", "isIntegrityProtected", "(", ")", "&&", "!", "data", ".", "verify", "(", ")", ")", "{", "throw", "new", "PGPException", "(", "\"Message failed integrity check\"", ")", ";", "}", "}" ]
Performs the decryption of the given data. @param privateKey PGP Private Key to decrypt @param data encrypted data @param calculator instance of {@link BcKeyFingerprintCalculator} @param targetStream stream to receive the decrypted data @throws PGPException if the decryption process fails @throws IOException if the stream write operation fails
[ "Performs", "the", "decryption", "of", "the", "given", "data", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java#L250-L282
banq/jdonframework
src/main/java/com/jdon/container/access/UserTargetMetaDefFactory.java
UserTargetMetaDefFactory.createTargetMetaRequest
public void createTargetMetaRequest(TargetMetaDef targetMetaDef, ContextHolder holder) { """ create a targetMetaRequest instance. @param containerWrapper @param targetMetaDef @param request @return """ ContainerWrapper containerWrapper = servletContainerFinder.findContainer(holder.getAppContextHolder()); // get HttpSessionVisitorFactoryImp VisitorFactory visitorFactory = (VisitorFactory) containerWrapper.lookup(ComponentKeys.VISITOR_FACTORY); // ComponentVisitor is HttpSessionComponentVisitor ComponentVisitor cm = visitorFactory.createtVisitor(holder.getSessionHolder(), targetMetaDef); TargetMetaRequest targetMetaRequest = new TargetMetaRequest(targetMetaDef, cm); targetMetaRequestsHolder.setTargetMetaRequest(targetMetaRequest); }
java
public void createTargetMetaRequest(TargetMetaDef targetMetaDef, ContextHolder holder) { ContainerWrapper containerWrapper = servletContainerFinder.findContainer(holder.getAppContextHolder()); // get HttpSessionVisitorFactoryImp VisitorFactory visitorFactory = (VisitorFactory) containerWrapper.lookup(ComponentKeys.VISITOR_FACTORY); // ComponentVisitor is HttpSessionComponentVisitor ComponentVisitor cm = visitorFactory.createtVisitor(holder.getSessionHolder(), targetMetaDef); TargetMetaRequest targetMetaRequest = new TargetMetaRequest(targetMetaDef, cm); targetMetaRequestsHolder.setTargetMetaRequest(targetMetaRequest); }
[ "public", "void", "createTargetMetaRequest", "(", "TargetMetaDef", "targetMetaDef", ",", "ContextHolder", "holder", ")", "{", "ContainerWrapper", "containerWrapper", "=", "servletContainerFinder", ".", "findContainer", "(", "holder", ".", "getAppContextHolder", "(", ")", ")", ";", "// get HttpSessionVisitorFactoryImp\r", "VisitorFactory", "visitorFactory", "=", "(", "VisitorFactory", ")", "containerWrapper", ".", "lookup", "(", "ComponentKeys", ".", "VISITOR_FACTORY", ")", ";", "// ComponentVisitor is HttpSessionComponentVisitor\r", "ComponentVisitor", "cm", "=", "visitorFactory", ".", "createtVisitor", "(", "holder", ".", "getSessionHolder", "(", ")", ",", "targetMetaDef", ")", ";", "TargetMetaRequest", "targetMetaRequest", "=", "new", "TargetMetaRequest", "(", "targetMetaDef", ",", "cm", ")", ";", "targetMetaRequestsHolder", ".", "setTargetMetaRequest", "(", "targetMetaRequest", ")", ";", "}" ]
create a targetMetaRequest instance. @param containerWrapper @param targetMetaDef @param request @return
[ "create", "a", "targetMetaRequest", "instance", "." ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/access/UserTargetMetaDefFactory.java#L60-L68
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java
LayoutService.saveLayout
@Override public void saveLayout(LayoutIdentifier layout, String content) { """ Saves a layout with the specified name and content. @param layout The layout identifier. @param content The layout content. """ propertyService.saveValue(getPropertyName(layout.shared), layout.name, layout.shared, content); }
java
@Override public void saveLayout(LayoutIdentifier layout, String content) { propertyService.saveValue(getPropertyName(layout.shared), layout.name, layout.shared, content); }
[ "@", "Override", "public", "void", "saveLayout", "(", "LayoutIdentifier", "layout", ",", "String", "content", ")", "{", "propertyService", ".", "saveValue", "(", "getPropertyName", "(", "layout", ".", "shared", ")", ",", "layout", ".", "name", ",", "layout", ".", "shared", ",", "content", ")", ";", "}" ]
Saves a layout with the specified name and content. @param layout The layout identifier. @param content The layout content.
[ "Saves", "a", "layout", "with", "the", "specified", "name", "and", "content", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/LayoutService.java#L79-L82
Chorus-bdd/Chorus
interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/properties/PropertyOperations.java
PropertyOperations.splitKeyAndGroup
public GroupedPropertyLoader splitKeyAndGroup(final String keyDelimiter) { """ Split the key into 2 and use the first token to group <pre> For keys in the form: Properties() group.key1=value1 group.key2=value2 group2.key2=value2 group2.key3=value3 create a GroupedPropertyLoader to load one Properties map for each of the groups, stripping the group name from property keys e.g. group1 = Properties() key1=value1 key2=value2 group2 = Properties() key2 = value2 key3 = value3 Where the delimiter does not exist in the source key, the group "" will be used. </pre> @param keyDelimiter """ return group(new BiFunction<String, String, Tuple3<String, String, String>>() { public Tuple3<String, String, String> apply(String key, String value) { String[] keyTokens = key.split(keyDelimiter, 2); if ( keyTokens.length == 1) { keyTokens = new String[] {"", keyTokens[0]}; } return Tuple3.tuple3(keyTokens[0], keyTokens[1], value); } }); }
java
public GroupedPropertyLoader splitKeyAndGroup(final String keyDelimiter) { return group(new BiFunction<String, String, Tuple3<String, String, String>>() { public Tuple3<String, String, String> apply(String key, String value) { String[] keyTokens = key.split(keyDelimiter, 2); if ( keyTokens.length == 1) { keyTokens = new String[] {"", keyTokens[0]}; } return Tuple3.tuple3(keyTokens[0], keyTokens[1], value); } }); }
[ "public", "GroupedPropertyLoader", "splitKeyAndGroup", "(", "final", "String", "keyDelimiter", ")", "{", "return", "group", "(", "new", "BiFunction", "<", "String", ",", "String", ",", "Tuple3", "<", "String", ",", "String", ",", "String", ">", ">", "(", ")", "{", "public", "Tuple3", "<", "String", ",", "String", ",", "String", ">", "apply", "(", "String", "key", ",", "String", "value", ")", "{", "String", "[", "]", "keyTokens", "=", "key", ".", "split", "(", "keyDelimiter", ",", "2", ")", ";", "if", "(", "keyTokens", ".", "length", "==", "1", ")", "{", "keyTokens", "=", "new", "String", "[", "]", "{", "\"\"", ",", "keyTokens", "[", "0", "]", "}", ";", "}", "return", "Tuple3", ".", "tuple3", "(", "keyTokens", "[", "0", "]", ",", "keyTokens", "[", "1", "]", ",", "value", ")", ";", "}", "}", ")", ";", "}" ]
Split the key into 2 and use the first token to group <pre> For keys in the form: Properties() group.key1=value1 group.key2=value2 group2.key2=value2 group2.key3=value3 create a GroupedPropertyLoader to load one Properties map for each of the groups, stripping the group name from property keys e.g. group1 = Properties() key1=value1 key2=value2 group2 = Properties() key2 = value2 key3 = value3 Where the delimiter does not exist in the source key, the group "" will be used. </pre> @param keyDelimiter
[ "Split", "the", "key", "into", "2", "and", "use", "the", "first", "token", "to", "group" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/properties/PropertyOperations.java#L165-L175
datoin/http-requests
src/main/java/org/datoin/net/http/Request.java
Request.setContent
public Request setContent(InputStream stream, ContentType contentType) { """ set request content from input stream with given content type @param stream : teh input stream to be used as http content @param contentType : type of content set in header @return modified Request object with http content entity set """ entity = new InputStreamEntity(stream, contentType); return this; }
java
public Request setContent(InputStream stream, ContentType contentType) { entity = new InputStreamEntity(stream, contentType); return this; }
[ "public", "Request", "setContent", "(", "InputStream", "stream", ",", "ContentType", "contentType", ")", "{", "entity", "=", "new", "InputStreamEntity", "(", "stream", ",", "contentType", ")", ";", "return", "this", ";", "}" ]
set request content from input stream with given content type @param stream : teh input stream to be used as http content @param contentType : type of content set in header @return modified Request object with http content entity set
[ "set", "request", "content", "from", "input", "stream", "with", "given", "content", "type" ]
train
https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L411-L414
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java
CollectionExtensions.removeAll
@SafeVarargs public static <T> boolean removeAll(Collection<? super T> collection, T... elements) { """ Removes all of the specified elements from the specified collection. @param collection the collection from which the {@code elements} are to be removed. May not be <code>null</code>. @param elements the elements be remove from the {@code collection}. May not be <code>null</code> but may contain <code>null</code> entries if the {@code collection} allows that. @return <code>true</code> if the collection changed as a result of the call @since 2.4 """ return collection.removeAll(Arrays.asList(elements)); }
java
@SafeVarargs public static <T> boolean removeAll(Collection<? super T> collection, T... elements) { return collection.removeAll(Arrays.asList(elements)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "boolean", "removeAll", "(", "Collection", "<", "?", "super", "T", ">", "collection", ",", "T", "...", "elements", ")", "{", "return", "collection", ".", "removeAll", "(", "Arrays", ".", "asList", "(", "elements", ")", ")", ";", "}" ]
Removes all of the specified elements from the specified collection. @param collection the collection from which the {@code elements} are to be removed. May not be <code>null</code>. @param elements the elements be remove from the {@code collection}. May not be <code>null</code> but may contain <code>null</code> entries if the {@code collection} allows that. @return <code>true</code> if the collection changed as a result of the call @since 2.4
[ "Removes", "all", "of", "the", "specified", "elements", "from", "the", "specified", "collection", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L284-L287
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java
ContainerGroupsInner.updateAsync
public Observable<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName, Resource resource) { """ Update container groups. Updates container group tags with specified values. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param resource The container group resource with just the tags to be updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerGroupInner object """ return updateWithServiceResponseAsync(resourceGroupName, containerGroupName, resource).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
java
public Observable<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName, Resource resource) { return updateWithServiceResponseAsync(resourceGroupName, containerGroupName, resource).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() { @Override public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerGroupInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "Resource", "resource", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "resource", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ContainerGroupInner", ">", ",", "ContainerGroupInner", ">", "(", ")", "{", "@", "Override", "public", "ContainerGroupInner", "call", "(", "ServiceResponse", "<", "ContainerGroupInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Update container groups. Updates container group tags with specified values. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param resource The container group resource with just the tags to be updated. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerGroupInner object
[ "Update", "container", "groups", ".", "Updates", "container", "group", "tags", "with", "specified", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L650-L657
SonarOpenCommunity/sonar-cxx
cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxIssuesReportSensor.java
CxxIssuesReportSensor.saveUniqueViolation
public void saveUniqueViolation(SensorContext sensorContext, CxxReportIssue issue) { """ Saves code violation only if it wasn't already saved @param sensorContext @param issue """ if (uniqueIssues.add(issue)) { saveViolation(sensorContext, issue); } }
java
public void saveUniqueViolation(SensorContext sensorContext, CxxReportIssue issue) { if (uniqueIssues.add(issue)) { saveViolation(sensorContext, issue); } }
[ "public", "void", "saveUniqueViolation", "(", "SensorContext", "sensorContext", ",", "CxxReportIssue", "issue", ")", "{", "if", "(", "uniqueIssues", ".", "add", "(", "issue", ")", ")", "{", "saveViolation", "(", "sensorContext", ",", "issue", ")", ";", "}", "}" ]
Saves code violation only if it wasn't already saved @param sensorContext @param issue
[ "Saves", "code", "violation", "only", "if", "it", "wasn", "t", "already", "saved" ]
train
https://github.com/SonarOpenCommunity/sonar-cxx/blob/7e7a3a44d6d86382a0434652a798f8235503c9b8/cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxIssuesReportSensor.java#L130-L134
adyliu/jafka
src/main/java/io/jafka/log/LogManager.java
LogManager.deleteSegments
private int deleteSegments(Log log, List<LogSegment> segments) { """ Attemps to delete all provided segments from a log and returns how many it was able to """ int total = 0; for (LogSegment segment : segments) { boolean deleted = false; try { try { segment.getMessageSet().close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } if (!segment.getFile().delete()) { deleted = true; } else { total += 1; } } finally { logger.warn(String.format("DELETE_LOG[%s] %s => %s", log.name, segment.getFile().getAbsolutePath(), deleted)); } } return total; }
java
private int deleteSegments(Log log, List<LogSegment> segments) { int total = 0; for (LogSegment segment : segments) { boolean deleted = false; try { try { segment.getMessageSet().close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } if (!segment.getFile().delete()) { deleted = true; } else { total += 1; } } finally { logger.warn(String.format("DELETE_LOG[%s] %s => %s", log.name, segment.getFile().getAbsolutePath(), deleted)); } } return total; }
[ "private", "int", "deleteSegments", "(", "Log", "log", ",", "List", "<", "LogSegment", ">", "segments", ")", "{", "int", "total", "=", "0", ";", "for", "(", "LogSegment", "segment", ":", "segments", ")", "{", "boolean", "deleted", "=", "false", ";", "try", "{", "try", "{", "segment", ".", "getMessageSet", "(", ")", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "if", "(", "!", "segment", ".", "getFile", "(", ")", ".", "delete", "(", ")", ")", "{", "deleted", "=", "true", ";", "}", "else", "{", "total", "+=", "1", ";", "}", "}", "finally", "{", "logger", ".", "warn", "(", "String", ".", "format", "(", "\"DELETE_LOG[%s] %s => %s\"", ",", "log", ".", "name", ",", "segment", ".", "getFile", "(", ")", ".", "getAbsolutePath", "(", ")", ",", "deleted", ")", ")", ";", "}", "}", "return", "total", ";", "}" ]
Attemps to delete all provided segments from a log and returns how many it was able to
[ "Attemps", "to", "delete", "all", "provided", "segments", "from", "a", "log", "and", "returns", "how", "many", "it", "was", "able", "to" ]
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/log/LogManager.java#L310-L331
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceGetter.java
V1InstanceGetter.secondaryWorkitems
public Collection<SecondaryWorkitem> secondaryWorkitems( SecondaryWorkitemFilter filter) { """ Get secondary workitems (tasks and tests) filtered by the criteria specified in the passed in filter. @param filter Limit the items returned. If null, then all items returned. @return Collection of items as specified in the filter. """ return get(SecondaryWorkitem.class, (filter != null) ? filter : new SecondaryWorkitemFilter()); }
java
public Collection<SecondaryWorkitem> secondaryWorkitems( SecondaryWorkitemFilter filter) { return get(SecondaryWorkitem.class, (filter != null) ? filter : new SecondaryWorkitemFilter()); }
[ "public", "Collection", "<", "SecondaryWorkitem", ">", "secondaryWorkitems", "(", "SecondaryWorkitemFilter", "filter", ")", "{", "return", "get", "(", "SecondaryWorkitem", ".", "class", ",", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "SecondaryWorkitemFilter", "(", ")", ")", ";", "}" ]
Get secondary workitems (tasks and tests) filtered by the criteria specified in the passed in filter. @param filter Limit the items returned. If null, then all items returned. @return Collection of items as specified in the filter.
[ "Get", "secondary", "workitems", "(", "tasks", "and", "tests", ")", "filtered", "by", "the", "criteria", "specified", "in", "the", "passed", "in", "filter", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L169-L172
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/runtime/Micronaut.java
Micronaut.handleStartupException
protected void handleStartupException(Environment environment, Throwable exception) { """ Default handling of startup exceptions. @param environment The environment @param exception The exception @throws ApplicationStartupException If the server cannot be shutdown with an appropriate exist code """ Function<Throwable, Integer> exitCodeMapper = exitHandlers.computeIfAbsent(exception.getClass(), exceptionType -> (throwable -> 1)); Integer code = exitCodeMapper.apply(exception); if (code > 0) { if (!environment.getActiveNames().contains(Environment.TEST)) { if (LOG.isErrorEnabled()) { LOG.error("Error starting Micronaut server: " + exception.getMessage(), exception); } System.exit(code); } } throw new ApplicationStartupException("Error starting Micronaut server: " + exception.getMessage(), exception); }
java
protected void handleStartupException(Environment environment, Throwable exception) { Function<Throwable, Integer> exitCodeMapper = exitHandlers.computeIfAbsent(exception.getClass(), exceptionType -> (throwable -> 1)); Integer code = exitCodeMapper.apply(exception); if (code > 0) { if (!environment.getActiveNames().contains(Environment.TEST)) { if (LOG.isErrorEnabled()) { LOG.error("Error starting Micronaut server: " + exception.getMessage(), exception); } System.exit(code); } } throw new ApplicationStartupException("Error starting Micronaut server: " + exception.getMessage(), exception); }
[ "protected", "void", "handleStartupException", "(", "Environment", "environment", ",", "Throwable", "exception", ")", "{", "Function", "<", "Throwable", ",", "Integer", ">", "exitCodeMapper", "=", "exitHandlers", ".", "computeIfAbsent", "(", "exception", ".", "getClass", "(", ")", ",", "exceptionType", "->", "(", "throwable", "->", "1", ")", ")", ";", "Integer", "code", "=", "exitCodeMapper", ".", "apply", "(", "exception", ")", ";", "if", "(", "code", ">", "0", ")", "{", "if", "(", "!", "environment", ".", "getActiveNames", "(", ")", ".", "contains", "(", "Environment", ".", "TEST", ")", ")", "{", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "LOG", ".", "error", "(", "\"Error starting Micronaut server: \"", "+", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "}", "System", ".", "exit", "(", "code", ")", ";", "}", "}", "throw", "new", "ApplicationStartupException", "(", "\"Error starting Micronaut server: \"", "+", "exception", ".", "getMessage", "(", ")", ",", "exception", ")", ";", "}" ]
Default handling of startup exceptions. @param environment The environment @param exception The exception @throws ApplicationStartupException If the server cannot be shutdown with an appropriate exist code
[ "Default", "handling", "of", "startup", "exceptions", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/runtime/Micronaut.java#L298-L310
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/GaussianAffinityMatrixBuilder.java
GaussianAffinityMatrixBuilder.computeH
protected static double computeH(final int i, double[] dist_i, double[] pij_i, double mbeta) { """ Compute H (observed perplexity) for row i, and the row pij_i. @param i Current point i (entry i will be ignored) @param dist_i Distance matrix row (input) @param pij_i Row pij[i] (output) @param mbeta {@code -1. / (2 * sigma * sigma)} @return Observed perplexity """ double sumP = 0.; // Skip point "i", break loop in two: for(int j = 0; j < i; j++) { sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta)); } for(int j = i + 1; j < dist_i.length; j++) { sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta)); } if(!(sumP > 0)) { // All pij are zero. Bad news. return Double.NEGATIVE_INFINITY; } final double s = 1. / sumP; // Scaling factor double sum = 0.; // While we could skip pi[i], it should be 0 anyway. for(int j = 0; j < dist_i.length; j++) { sum += dist_i[j] * (pij_i[j] *= s); } return FastMath.log(sumP) - mbeta * sum; }
java
protected static double computeH(final int i, double[] dist_i, double[] pij_i, double mbeta) { double sumP = 0.; // Skip point "i", break loop in two: for(int j = 0; j < i; j++) { sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta)); } for(int j = i + 1; j < dist_i.length; j++) { sumP += (pij_i[j] = FastMath.exp(dist_i[j] * mbeta)); } if(!(sumP > 0)) { // All pij are zero. Bad news. return Double.NEGATIVE_INFINITY; } final double s = 1. / sumP; // Scaling factor double sum = 0.; // While we could skip pi[i], it should be 0 anyway. for(int j = 0; j < dist_i.length; j++) { sum += dist_i[j] * (pij_i[j] *= s); } return FastMath.log(sumP) - mbeta * sum; }
[ "protected", "static", "double", "computeH", "(", "final", "int", "i", ",", "double", "[", "]", "dist_i", ",", "double", "[", "]", "pij_i", ",", "double", "mbeta", ")", "{", "double", "sumP", "=", "0.", ";", "// Skip point \"i\", break loop in two:", "for", "(", "int", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "sumP", "+=", "(", "pij_i", "[", "j", "]", "=", "FastMath", ".", "exp", "(", "dist_i", "[", "j", "]", "*", "mbeta", ")", ")", ";", "}", "for", "(", "int", "j", "=", "i", "+", "1", ";", "j", "<", "dist_i", ".", "length", ";", "j", "++", ")", "{", "sumP", "+=", "(", "pij_i", "[", "j", "]", "=", "FastMath", ".", "exp", "(", "dist_i", "[", "j", "]", "*", "mbeta", ")", ")", ";", "}", "if", "(", "!", "(", "sumP", ">", "0", ")", ")", "{", "// All pij are zero. Bad news.", "return", "Double", ".", "NEGATIVE_INFINITY", ";", "}", "final", "double", "s", "=", "1.", "/", "sumP", ";", "// Scaling factor", "double", "sum", "=", "0.", ";", "// While we could skip pi[i], it should be 0 anyway.", "for", "(", "int", "j", "=", "0", ";", "j", "<", "dist_i", ".", "length", ";", "j", "++", ")", "{", "sum", "+=", "dist_i", "[", "j", "]", "*", "(", "pij_i", "[", "j", "]", "*=", "s", ")", ";", "}", "return", "FastMath", ".", "log", "(", "sumP", ")", "-", "mbeta", "*", "sum", ";", "}" ]
Compute H (observed perplexity) for row i, and the row pij_i. @param i Current point i (entry i will be ignored) @param dist_i Distance matrix row (input) @param pij_i Row pij[i] (output) @param mbeta {@code -1. / (2 * sigma * sigma)} @return Observed perplexity
[ "Compute", "H", "(", "observed", "perplexity", ")", "for", "row", "i", "and", "the", "row", "pij_i", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/GaussianAffinityMatrixBuilder.java#L197-L217
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java
MediaServicesInner.createAsync
public Observable<MediaServiceInner> createAsync(String resourceGroupName, String mediaServiceName, MediaServiceInner parameters) { """ Creates a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param parameters Media Service properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MediaServiceInner object """ return createWithServiceResponseAsync(resourceGroupName, mediaServiceName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
java
public Observable<MediaServiceInner> createAsync(String resourceGroupName, String mediaServiceName, MediaServiceInner parameters) { return createWithServiceResponseAsync(resourceGroupName, mediaServiceName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() { @Override public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "MediaServiceInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "mediaServiceName", ",", "MediaServiceInner", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "mediaServiceName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "MediaServiceInner", ">", ",", "MediaServiceInner", ">", "(", ")", "{", "@", "Override", "public", "MediaServiceInner", "call", "(", "ServiceResponse", "<", "MediaServiceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param parameters Media Service properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the MediaServiceInner object
[ "Creates", "a", "Media", "Service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L400-L407
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/ArgusService.java
ArgusService.getInstance
public static ArgusService getInstance(String endpoint, int maxConn, int connTimeout, int connRequestTimeout) throws IOException { """ Returns a new instance of the Argus service. @param endpoint The HTTP endpoint for Argus. @param maxConn The number of maximum connections. Must be greater than 0. @param connTimeout The connection timeout in milliseconds. Must be greater than 0. @param connRequestTimeout The connection request timeout in milliseconds. Must be greater than 0. @return A new instance of the Argus service. @throws IOException If the service cannot be initialized due a configuration error such as a malformed URL for example. """ ArgusHttpClient client = new ArgusHttpClient(endpoint, maxConn, connTimeout, connRequestTimeout); return new ArgusService(client); }
java
public static ArgusService getInstance(String endpoint, int maxConn, int connTimeout, int connRequestTimeout) throws IOException { ArgusHttpClient client = new ArgusHttpClient(endpoint, maxConn, connTimeout, connRequestTimeout); return new ArgusService(client); }
[ "public", "static", "ArgusService", "getInstance", "(", "String", "endpoint", ",", "int", "maxConn", ",", "int", "connTimeout", ",", "int", "connRequestTimeout", ")", "throws", "IOException", "{", "ArgusHttpClient", "client", "=", "new", "ArgusHttpClient", "(", "endpoint", ",", "maxConn", ",", "connTimeout", ",", "connRequestTimeout", ")", ";", "return", "new", "ArgusService", "(", "client", ")", ";", "}" ]
Returns a new instance of the Argus service. @param endpoint The HTTP endpoint for Argus. @param maxConn The number of maximum connections. Must be greater than 0. @param connTimeout The connection timeout in milliseconds. Must be greater than 0. @param connRequestTimeout The connection request timeout in milliseconds. Must be greater than 0. @return A new instance of the Argus service. @throws IOException If the service cannot be initialized due a configuration error such as a malformed URL for example.
[ "Returns", "a", "new", "instance", "of", "the", "Argus", "service", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/ArgusService.java#L103-L107