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
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.setFloat
public void setFloat(Enum<?> key, float value) { """ Equivalent to {@link #setFloat(String, float) setFloat}{@code (key.name(), value)}. If {@code key} is null, nothing is done. """ if (key == null) { return; } setFloat(key.name(), value); }
java
public void setFloat(Enum<?> key, float value) { if (key == null) { return; } setFloat(key.name(), value); }
[ "public", "void", "setFloat", "(", "Enum", "<", "?", ">", "key", ",", "float", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", ";", "}", "setFloat", "(", "key", ".", "name", "(", ")", ",", "value", ")", ";", "}" ]
Equivalent to {@link #setFloat(String, float) setFloat}{@code (key.name(), value)}. If {@code key} is null, nothing is done.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L640-L648
kiswanij/jk-util
src/main/java/com/jk/util/JKCollectionUtil.java
JKCollectionUtil.unifyReferences
public static Object unifyReferences(final Hashtable hash, Object object) { """ return unified reference. @param hash the hash @param object the object @return the object """ final Object itemAtHash = hash.get(object.hashCode()); if (itemAtHash == null) { hash.put(object.hashCode(), object); } else { object = itemAtHash; } return object; }
java
public static Object unifyReferences(final Hashtable hash, Object object) { final Object itemAtHash = hash.get(object.hashCode()); if (itemAtHash == null) { hash.put(object.hashCode(), object); } else { object = itemAtHash; } return object; }
[ "public", "static", "Object", "unifyReferences", "(", "final", "Hashtable", "hash", ",", "Object", "object", ")", "{", "final", "Object", "itemAtHash", "=", "hash", ".", "get", "(", "object", ".", "hashCode", "(", ")", ")", ";", "if", "(", "itemAtHash", "==", "null", ")", "{", "hash", ".", "put", "(", "object", ".", "hashCode", "(", ")", ",", "object", ")", ";", "}", "else", "{", "object", "=", "itemAtHash", ";", "}", "return", "object", ";", "}" ]
return unified reference. @param hash the hash @param object the object @return the object
[ "return", "unified", "reference", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L120-L128
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendSelectionCriteria
private void appendSelectionCriteria(TableAlias alias, PathInfo pathInfo, SelectionCriteria c, StringBuffer buf) { """ Answer the SQL-Clause for a SelectionCriteria @param c @param buf """ appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); appendParameter(c.getValue(), buf); }
java
private void appendSelectionCriteria(TableAlias alias, PathInfo pathInfo, SelectionCriteria c, StringBuffer buf) { appendColName(alias, pathInfo, c.isTranslateAttribute(), buf); buf.append(c.getClause()); appendParameter(c.getValue(), buf); }
[ "private", "void", "appendSelectionCriteria", "(", "TableAlias", "alias", ",", "PathInfo", "pathInfo", ",", "SelectionCriteria", "c", ",", "StringBuffer", "buf", ")", "{", "appendColName", "(", "alias", ",", "pathInfo", ",", "c", ".", "isTranslateAttribute", "(", ")", ",", "buf", ")", ";", "buf", ".", "append", "(", "c", ".", "getClause", "(", ")", ")", ";", "appendParameter", "(", "c", ".", "getValue", "(", ")", ",", "buf", ")", ";", "}" ]
Answer the SQL-Clause for a SelectionCriteria @param c @param buf
[ "Answer", "the", "SQL", "-", "Clause", "for", "a", "SelectionCriteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L820-L825
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.isEqual
public static boolean isEqual(String s1, String s2, int modifier) { """ Determine whether two string instance is equal based on the modifier passed in. <p/> <p> is 2 strings equal case insensitive? <code>S.isEqual(s1, s2, S.IGNORECASE)</code> </p> <p/> <p> is 2 strings equals case and space insensitive? <code>S.isEqual(s1, s2, S.IGNORECASE & S.IGNORESPACE)</code> </p> @param s1 @param s2 @param modifier @return true if s1 equals s2 """ if (s1 == s2) return true; if (null == s1) { return s2 == null; } if (null == s2) { return false; } if ((modifier & IGNORESPACE) != 0) { s1 = s1.trim(); s2 = s2.trim(); } if ((modifier & IGNORECASE) != 0) { return s1.equalsIgnoreCase(s2); } else { return s1.equals(s2); } }
java
public static boolean isEqual(String s1, String s2, int modifier) { if (s1 == s2) return true; if (null == s1) { return s2 == null; } if (null == s2) { return false; } if ((modifier & IGNORESPACE) != 0) { s1 = s1.trim(); s2 = s2.trim(); } if ((modifier & IGNORECASE) != 0) { return s1.equalsIgnoreCase(s2); } else { return s1.equals(s2); } }
[ "public", "static", "boolean", "isEqual", "(", "String", "s1", ",", "String", "s2", ",", "int", "modifier", ")", "{", "if", "(", "s1", "==", "s2", ")", "return", "true", ";", "if", "(", "null", "==", "s1", ")", "{", "return", "s2", "==", "null", ";", "}", "if", "(", "null", "==", "s2", ")", "{", "return", "false", ";", "}", "if", "(", "(", "modifier", "&", "IGNORESPACE", ")", "!=", "0", ")", "{", "s1", "=", "s1", ".", "trim", "(", ")", ";", "s2", "=", "s2", ".", "trim", "(", ")", ";", "}", "if", "(", "(", "modifier", "&", "IGNORECASE", ")", "!=", "0", ")", "{", "return", "s1", ".", "equalsIgnoreCase", "(", "s2", ")", ";", "}", "else", "{", "return", "s1", ".", "equals", "(", "s2", ")", ";", "}", "}" ]
Determine whether two string instance is equal based on the modifier passed in. <p/> <p> is 2 strings equal case insensitive? <code>S.isEqual(s1, s2, S.IGNORECASE)</code> </p> <p/> <p> is 2 strings equals case and space insensitive? <code>S.isEqual(s1, s2, S.IGNORECASE & S.IGNORESPACE)</code> </p> @param s1 @param s2 @param modifier @return true if s1 equals s2
[ "Determine", "whether", "two", "string", "instance", "is", "equal", "based", "on", "the", "modifier", "passed", "in", ".", "<p", "/", ">", "<p", ">", "is", "2", "strings", "equal", "case", "insensitive?", "<code", ">", "S", ".", "isEqual", "(", "s1", "s2", "S", ".", "IGNORECASE", ")", "<", "/", "code", ">", "<", "/", "p", ">", "<p", "/", ">", "<p", ">", "is", "2", "strings", "equals", "case", "and", "space", "insensitive?", "<code", ">", "S", ".", "isEqual", "(", "s1", "s2", "S", ".", "IGNORECASE", "&", "S", ".", "IGNORESPACE", ")", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L286-L303
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/AgreementsInner.java
AgreementsInner.getAsync
public Observable<IntegrationAccountAgreementInner> getAsync(String resourceGroupName, String integrationAccountName, String agreementName) { """ Gets an integration account agreement. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param agreementName The integration account agreement name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountAgreementInner object """ return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, agreementName).map(new Func1<ServiceResponse<IntegrationAccountAgreementInner>, IntegrationAccountAgreementInner>() { @Override public IntegrationAccountAgreementInner call(ServiceResponse<IntegrationAccountAgreementInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountAgreementInner> getAsync(String resourceGroupName, String integrationAccountName, String agreementName) { return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, agreementName).map(new Func1<ServiceResponse<IntegrationAccountAgreementInner>, IntegrationAccountAgreementInner>() { @Override public IntegrationAccountAgreementInner call(ServiceResponse<IntegrationAccountAgreementInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountAgreementInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "agreementName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "agreementName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IntegrationAccountAgreementInner", ">", ",", "IntegrationAccountAgreementInner", ">", "(", ")", "{", "@", "Override", "public", "IntegrationAccountAgreementInner", "call", "(", "ServiceResponse", "<", "IntegrationAccountAgreementInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets an integration account agreement. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param agreementName The integration account agreement name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountAgreementInner object
[ "Gets", "an", "integration", "account", "agreement", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/AgreementsInner.java#L381-L388
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java
GroovyScript2RestLoader.getScriptMetadata
@POST @Produces( { """ Get groovy script's meta-information. @param repository repository name @param workspace workspace name @param path JCR path to node that contains script @return groovy script's meta-information @response {code:json} "scriptList" : the groovy script's meta-information {code} @LevelAPI Provisional """MediaType.APPLICATION_JSON}) @Path("meta/{repository}/{workspace}/{path:.*}") public Response getScriptMetadata(@PathParam("repository") String repository, @PathParam("workspace") String workspace, @PathParam("path") String path) { Session ses = null; try { ses = sessionProviderService.getSessionProvider(null).getSession(workspace, repositoryService.getRepository(repository)); Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content"); ResourceId key = new NodeScriptKey(repository, workspace, script); ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), // groovyPublisher.isPublished(key), // script.getProperty("jcr:mimeType").getString(), // script.getProperty("jcr:lastModified").getDate().getTimeInMillis()); return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build(); } catch (PathNotFoundException e) { String msg = "Path " + path + " does not exists"; LOG.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build(); } catch (Exception e) { LOG.error(e.getMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()) .type(MediaType.TEXT_PLAIN).build(); } finally { if (ses != null) { ses.logout(); } } }
java
@POST @Produces({MediaType.APPLICATION_JSON}) @Path("meta/{repository}/{workspace}/{path:.*}") public Response getScriptMetadata(@PathParam("repository") String repository, @PathParam("workspace") String workspace, @PathParam("path") String path) { Session ses = null; try { ses = sessionProviderService.getSessionProvider(null).getSession(workspace, repositoryService.getRepository(repository)); Node script = ((Node)ses.getItem("/" + path)).getNode("jcr:content"); ResourceId key = new NodeScriptKey(repository, workspace, script); ScriptMetadata meta = new ScriptMetadata(script.getProperty("exo:autoload").getBoolean(), // groovyPublisher.isPublished(key), // script.getProperty("jcr:mimeType").getString(), // script.getProperty("jcr:lastModified").getDate().getTimeInMillis()); return Response.status(Response.Status.OK).entity(meta).type(MediaType.APPLICATION_JSON).build(); } catch (PathNotFoundException e) { String msg = "Path " + path + " does not exists"; LOG.error(msg); return Response.status(Response.Status.NOT_FOUND).entity(msg).entity(MediaType.TEXT_PLAIN).build(); } catch (Exception e) { LOG.error(e.getMessage(), e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()) .type(MediaType.TEXT_PLAIN).build(); } finally { if (ses != null) { ses.logout(); } } }
[ "@", "POST", "@", "Produces", "(", "{", "MediaType", ".", "APPLICATION_JSON", "}", ")", "@", "Path", "(", "\"meta/{repository}/{workspace}/{path:.*}\"", ")", "public", "Response", "getScriptMetadata", "(", "@", "PathParam", "(", "\"repository\"", ")", "String", "repository", ",", "@", "PathParam", "(", "\"workspace\"", ")", "String", "workspace", ",", "@", "PathParam", "(", "\"path\"", ")", "String", "path", ")", "{", "Session", "ses", "=", "null", ";", "try", "{", "ses", "=", "sessionProviderService", ".", "getSessionProvider", "(", "null", ")", ".", "getSession", "(", "workspace", ",", "repositoryService", ".", "getRepository", "(", "repository", ")", ")", ";", "Node", "script", "=", "(", "(", "Node", ")", "ses", ".", "getItem", "(", "\"/\"", "+", "path", ")", ")", ".", "getNode", "(", "\"jcr:content\"", ")", ";", "ResourceId", "key", "=", "new", "NodeScriptKey", "(", "repository", ",", "workspace", ",", "script", ")", ";", "ScriptMetadata", "meta", "=", "new", "ScriptMetadata", "(", "script", ".", "getProperty", "(", "\"exo:autoload\"", ")", ".", "getBoolean", "(", ")", ",", "//", "groovyPublisher", ".", "isPublished", "(", "key", ")", ",", "//", "script", ".", "getProperty", "(", "\"jcr:mimeType\"", ")", ".", "getString", "(", ")", ",", "//", "script", ".", "getProperty", "(", "\"jcr:lastModified\"", ")", ".", "getDate", "(", ")", ".", "getTimeInMillis", "(", ")", ")", ";", "return", "Response", ".", "status", "(", "Response", ".", "Status", ".", "OK", ")", ".", "entity", "(", "meta", ")", ".", "type", "(", "MediaType", ".", "APPLICATION_JSON", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "PathNotFoundException", "e", ")", "{", "String", "msg", "=", "\"Path \"", "+", "path", "+", "\" does not exists\"", ";", "LOG", ".", "error", "(", "msg", ")", ";", "return", "Response", ".", "status", "(", "Response", ".", "Status", ".", "NOT_FOUND", ")", ".", "entity", "(", "msg", ")", ".", "entity", "(", "MediaType", ".", "TEXT_PLAIN", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "Response", ".", "status", "(", "Response", ".", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ".", "entity", "(", "e", ".", "getMessage", "(", ")", ")", ".", "type", "(", "MediaType", ".", "TEXT_PLAIN", ")", ".", "build", "(", ")", ";", "}", "finally", "{", "if", "(", "ses", "!=", "null", ")", "{", "ses", ".", "logout", "(", ")", ";", "}", "}", "}" ]
Get groovy script's meta-information. @param repository repository name @param workspace workspace name @param path JCR path to node that contains script @return groovy script's meta-information @response {code:json} "scriptList" : the groovy script's meta-information {code} @LevelAPI Provisional
[ "Get", "groovy", "script", "s", "meta", "-", "information", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L1410-L1450
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java
Deserializer.getFiveBytesLong
static long getFiveBytesLong(byte[] buffer, int offset) { """ Converts five bytes of a byte array to an unsigned long. <p/> The byte order is big-endian. @param buffer the byte array. @param offset the offset in the array. @return the long value. """ return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16 | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); }
java
static long getFiveBytesLong(byte[] buffer, int offset) { return (buffer[offset] & 0xffL) << 32 | (buffer[offset + 1] & 0xffL) << 24 | (buffer[offset + 2] & 0xffL) << 16 | (buffer[offset + 3] & 0xffL) << 8 | (buffer[offset + 4] & 0xffL); }
[ "static", "long", "getFiveBytesLong", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ")", "{", "return", "(", "buffer", "[", "offset", "]", "&", "0xff", "L", ")", "<<", "32", "|", "(", "buffer", "[", "offset", "+", "1", "]", "&", "0xff", "L", ")", "<<", "24", "|", "(", "buffer", "[", "offset", "+", "2", "]", "&", "0xff", "L", ")", "<<", "16", "|", "(", "buffer", "[", "offset", "+", "3", "]", "&", "0xff", "L", ")", "<<", "8", "|", "(", "buffer", "[", "offset", "+", "4", "]", "&", "0xff", "L", ")", ";", "}" ]
Converts five bytes of a byte array to an unsigned long. <p/> The byte order is big-endian. @param buffer the byte array. @param offset the offset in the array. @return the long value.
[ "Converts", "five", "bytes", "of", "a", "byte", "array", "to", "an", "unsigned", "long", ".", "<p", "/", ">", "The", "byte", "order", "is", "big", "-", "endian", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java#L30-L33
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/cql/hibernate/PropertyDoesNotExistCriterion.java
PropertyDoesNotExistCriterion.toSqlString
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { """ Render the SQL fragment that corresponds to this criterion. @param criteria The local criteria @param criteriaQuery The overal criteria query @return The generated SQL fragment @throws org.hibernate.HibernateException Problem during rendering. """ String[] columns; try { columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); } catch (QueryException e) { columns = new String[0]; } // if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql return columns.length > 0 ? "FALSE" : "TRUE"; }
java
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] columns; try { columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); } catch (QueryException e) { columns = new String[0]; } // if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql return columns.length > 0 ? "FALSE" : "TRUE"; }
[ "public", "String", "toSqlString", "(", "Criteria", "criteria", ",", "CriteriaQuery", "criteriaQuery", ")", "throws", "HibernateException", "{", "String", "[", "]", "columns", ";", "try", "{", "columns", "=", "criteriaQuery", ".", "getColumnsUsingProjection", "(", "criteria", ",", "propertyName", ")", ";", "}", "catch", "(", "QueryException", "e", ")", "{", "columns", "=", "new", "String", "[", "0", "]", ";", "}", "// if there are columns that map the given property.. the property exists, so we don't need to add anything to the sql", "return", "columns", ".", "length", ">", "0", "?", "\"FALSE\"", ":", "\"TRUE\"", ";", "}" ]
Render the SQL fragment that corresponds to this criterion. @param criteria The local criteria @param criteriaQuery The overal criteria query @return The generated SQL fragment @throws org.hibernate.HibernateException Problem during rendering.
[ "Render", "the", "SQL", "fragment", "that", "corresponds", "to", "this", "criterion", "." ]
train
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/cql/hibernate/PropertyDoesNotExistCriterion.java#L61-L75
EdwardRaff/JSAT
JSAT/src/jsat/linear/EigenValueDecomposition.java
EigenValueDecomposition.rowOpTransform2
private void rowOpTransform2(Matrix M, int low, int high, double x, int k, double y, boolean notlast, double z, double r, double q) { """ Alters the rows of the matrix M according to <code><br> for (int j = low; j <= high; j++) {<br> &nbsp;&nbsp; p = M[k][j] + q * M[k + 1][j];<br> &nbsp;&nbsp; if (notlast)<br> &nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp; p = p + r * M[k + 2][j];<br> &nbsp;&nbsp;&nbsp;&nbsp; M[k + 2][j] = M[k + 2][j] - p * z;<br> &nbsp;&nbsp; }<br> &nbsp;&nbsp; M[k][j] = M[k][j] - p * x;<br> &nbsp;&nbsp; M[k + 1][j] = M[k + 1][j] - p * y;<br> } </code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param x first constant @param k this row and the row after will be altered @param y second constant @param notlast <tt>true<tt> if the 2nd row after <tt>k</tt> should be updated @param z third constant @param r fourth constant @param q fifth constant """ double p; for (int j = low; j <= high; j++) { p = M.get(k, j) + q * M.get(k + 1,j); if (notlast) { p = p + r * M.get(k + 2,j); M.set(k + 2,j, M.get(k+2, j) - p * z); } M.increment(k, j, -p*x); M.increment(k+1, j, -p*y); } }
java
private void rowOpTransform2(Matrix M, int low, int high, double x, int k, double y, boolean notlast, double z, double r, double q) { double p; for (int j = low; j <= high; j++) { p = M.get(k, j) + q * M.get(k + 1,j); if (notlast) { p = p + r * M.get(k + 2,j); M.set(k + 2,j, M.get(k+2, j) - p * z); } M.increment(k, j, -p*x); M.increment(k+1, j, -p*y); } }
[ "private", "void", "rowOpTransform2", "(", "Matrix", "M", ",", "int", "low", ",", "int", "high", ",", "double", "x", ",", "int", "k", ",", "double", "y", ",", "boolean", "notlast", ",", "double", "z", ",", "double", "r", ",", "double", "q", ")", "{", "double", "p", ";", "for", "(", "int", "j", "=", "low", ";", "j", "<=", "high", ";", "j", "++", ")", "{", "p", "=", "M", ".", "get", "(", "k", ",", "j", ")", "+", "q", "*", "M", ".", "get", "(", "k", "+", "1", ",", "j", ")", ";", "if", "(", "notlast", ")", "{", "p", "=", "p", "+", "r", "*", "M", ".", "get", "(", "k", "+", "2", ",", "j", ")", ";", "M", ".", "set", "(", "k", "+", "2", ",", "j", ",", "M", ".", "get", "(", "k", "+", "2", ",", "j", ")", "-", "p", "*", "z", ")", ";", "}", "M", ".", "increment", "(", "k", ",", "j", ",", "-", "p", "*", "x", ")", ";", "M", ".", "increment", "(", "k", "+", "1", ",", "j", ",", "-", "p", "*", "y", ")", ";", "}", "}" ]
Alters the rows of the matrix M according to <code><br> for (int j = low; j <= high; j++) {<br> &nbsp;&nbsp; p = M[k][j] + q * M[k + 1][j];<br> &nbsp;&nbsp; if (notlast)<br> &nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp; p = p + r * M[k + 2][j];<br> &nbsp;&nbsp;&nbsp;&nbsp; M[k + 2][j] = M[k + 2][j] - p * z;<br> &nbsp;&nbsp; }<br> &nbsp;&nbsp; M[k][j] = M[k][j] - p * x;<br> &nbsp;&nbsp; M[k + 1][j] = M[k + 1][j] - p * y;<br> } </code> @param M the matrix to alter @param low the starting column (inclusive) @param high the ending column (inclusive) @param x first constant @param k this row and the row after will be altered @param y second constant @param notlast <tt>true<tt> if the 2nd row after <tt>k</tt> should be updated @param z third constant @param r fourth constant @param q fifth constant
[ "Alters", "the", "rows", "of", "the", "matrix", "M", "according", "to", "<code", ">", "<br", ">", "for", "(", "int", "j", "=", "low", ";", "j", "<", "=", "high", ";", "j", "++", ")", "{", "<br", ">", "&nbsp", ";", "&nbsp", ";", "p", "=", "M", "[", "k", "]", "[", "j", "]", "+", "q", "*", "M", "[", "k", "+", "1", "]", "[", "j", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "if", "(", "notlast", ")", "<br", ">", "&nbsp", ";", "&nbsp", ";", "{", "<br", ">", "&nbsp", ";", "&nbsp", ";", "&nbsp", ";", "&nbsp", ";", "p", "=", "p", "+", "r", "*", "M", "[", "k", "+", "2", "]", "[", "j", "]", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "&nbsp", ";", "&nbsp", ";", "M", "[", "k", "+", "2", "]", "[", "j", "]", "=", "M", "[", "k", "+", "2", "]", "[", "j", "]", "-", "p", "*", "z", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "}", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "k", "]", "[", "j", "]", "=", "M", "[", "k", "]", "[", "j", "]", "-", "p", "*", "x", ";", "<br", ">", "&nbsp", ";", "&nbsp", ";", "M", "[", "k", "+", "1", "]", "[", "j", "]", "=", "M", "[", "k", "+", "1", "]", "[", "j", "]", "-", "p", "*", "y", ";", "<br", ">", "}", "<", "/", "code", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/EigenValueDecomposition.java#L887-L901
real-logic/agrona
agrona/src/main/java/org/agrona/SystemUtil.java
SystemUtil.getSizeAsInt
public static int getSizeAsInt(final String propertyName, final int defaultValue) { """ Get a size value as an int from a system property. Supports a 'g', 'm', and 'k' suffix to indicate gigabytes, megabytes, or kilobytes respectively. @param propertyName to lookup. @param defaultValue to be applied if the system property is not set. @return the int value. @throws NumberFormatException if the value is out of range or mal-formatted. """ final String propertyValue = getProperty(propertyName); if (propertyValue != null) { final long value = parseSize(propertyName, propertyValue); if (value < 0 || value > Integer.MAX_VALUE) { throw new NumberFormatException( propertyName + " must positive and less than Integer.MAX_VALUE :" + value); } return (int)value; } return defaultValue; }
java
public static int getSizeAsInt(final String propertyName, final int defaultValue) { final String propertyValue = getProperty(propertyName); if (propertyValue != null) { final long value = parseSize(propertyName, propertyValue); if (value < 0 || value > Integer.MAX_VALUE) { throw new NumberFormatException( propertyName + " must positive and less than Integer.MAX_VALUE :" + value); } return (int)value; } return defaultValue; }
[ "public", "static", "int", "getSizeAsInt", "(", "final", "String", "propertyName", ",", "final", "int", "defaultValue", ")", "{", "final", "String", "propertyValue", "=", "getProperty", "(", "propertyName", ")", ";", "if", "(", "propertyValue", "!=", "null", ")", "{", "final", "long", "value", "=", "parseSize", "(", "propertyName", ",", "propertyValue", ")", ";", "if", "(", "value", "<", "0", "||", "value", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "NumberFormatException", "(", "propertyName", "+", "\" must positive and less than Integer.MAX_VALUE :\"", "+", "value", ")", ";", "}", "return", "(", "int", ")", "value", ";", "}", "return", "defaultValue", ";", "}" ]
Get a size value as an int from a system property. Supports a 'g', 'm', and 'k' suffix to indicate gigabytes, megabytes, or kilobytes respectively. @param propertyName to lookup. @param defaultValue to be applied if the system property is not set. @return the int value. @throws NumberFormatException if the value is out of range or mal-formatted.
[ "Get", "a", "size", "value", "as", "an", "int", "from", "a", "system", "property", ".", "Supports", "a", "g", "m", "and", "k", "suffix", "to", "indicate", "gigabytes", "megabytes", "or", "kilobytes", "respectively", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/SystemUtil.java#L231-L247
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java
CirculantTracker.dense_gauss_kernel
public void dense_gauss_kernel(double sigma , GrayF64 x , GrayF64 y , GrayF64 k ) { """ Gaussian Kernel with dense sampling. Evaluates a gaussian kernel with bandwidth SIGMA for all displacements between input images X and Y, which must both be MxN. They must also be periodic (ie., pre-processed with a cosine window). The result is an MxN map of responses. @param sigma Gaussian kernel bandwidth @param x Input image @param y Input image @param k Output containing Gaussian kernel for each element in target region """ InterleavedF64 xf=tmpFourier0,yf,xyf=tmpFourier2; GrayF64 xy = tmpReal0; double yy; // find x in Fourier domain fft.forward(x, xf); double xx = imageDotProduct(x); if( x != y ) { // general case, x and y are different yf = tmpFourier1; fft.forward(y,yf); yy = imageDotProduct(y); } else { // auto-correlation of x, avoid repeating a few operations yf = xf; yy = xx; } //---- xy = invF[ F(x)*F(y) ] // cross-correlation term in Fourier domain elementMultConjB(xf,yf,xyf); // convert to spatial domain fft.inverse(xyf,xy); circshift(xy,tmpReal1); // calculate gaussian response for all positions gaussianKernel(xx, yy, tmpReal1, sigma, k); }
java
public void dense_gauss_kernel(double sigma , GrayF64 x , GrayF64 y , GrayF64 k ) { InterleavedF64 xf=tmpFourier0,yf,xyf=tmpFourier2; GrayF64 xy = tmpReal0; double yy; // find x in Fourier domain fft.forward(x, xf); double xx = imageDotProduct(x); if( x != y ) { // general case, x and y are different yf = tmpFourier1; fft.forward(y,yf); yy = imageDotProduct(y); } else { // auto-correlation of x, avoid repeating a few operations yf = xf; yy = xx; } //---- xy = invF[ F(x)*F(y) ] // cross-correlation term in Fourier domain elementMultConjB(xf,yf,xyf); // convert to spatial domain fft.inverse(xyf,xy); circshift(xy,tmpReal1); // calculate gaussian response for all positions gaussianKernel(xx, yy, tmpReal1, sigma, k); }
[ "public", "void", "dense_gauss_kernel", "(", "double", "sigma", ",", "GrayF64", "x", ",", "GrayF64", "y", ",", "GrayF64", "k", ")", "{", "InterleavedF64", "xf", "=", "tmpFourier0", ",", "yf", ",", "xyf", "=", "tmpFourier2", ";", "GrayF64", "xy", "=", "tmpReal0", ";", "double", "yy", ";", "// find x in Fourier domain", "fft", ".", "forward", "(", "x", ",", "xf", ")", ";", "double", "xx", "=", "imageDotProduct", "(", "x", ")", ";", "if", "(", "x", "!=", "y", ")", "{", "// general case, x and y are different", "yf", "=", "tmpFourier1", ";", "fft", ".", "forward", "(", "y", ",", "yf", ")", ";", "yy", "=", "imageDotProduct", "(", "y", ")", ";", "}", "else", "{", "// auto-correlation of x, avoid repeating a few operations", "yf", "=", "xf", ";", "yy", "=", "xx", ";", "}", "//---- xy = invF[ F(x)*F(y) ]", "// cross-correlation term in Fourier domain", "elementMultConjB", "(", "xf", ",", "yf", ",", "xyf", ")", ";", "// convert to spatial domain", "fft", ".", "inverse", "(", "xyf", ",", "xy", ")", ";", "circshift", "(", "xy", ",", "tmpReal1", ")", ";", "// calculate gaussian response for all positions", "gaussianKernel", "(", "xx", ",", "yy", ",", "tmpReal1", ",", "sigma", ",", "k", ")", ";", "}" ]
Gaussian Kernel with dense sampling. Evaluates a gaussian kernel with bandwidth SIGMA for all displacements between input images X and Y, which must both be MxN. They must also be periodic (ie., pre-processed with a cosine window). The result is an MxN map of responses. @param sigma Gaussian kernel bandwidth @param x Input image @param y Input image @param k Output containing Gaussian kernel for each element in target region
[ "Gaussian", "Kernel", "with", "dense", "sampling", ".", "Evaluates", "a", "gaussian", "kernel", "with", "bandwidth", "SIGMA", "for", "all", "displacements", "between", "input", "images", "X", "and", "Y", "which", "must", "both", "be", "MxN", ".", "They", "must", "also", "be", "periodic", "(", "ie", ".", "pre", "-", "processed", "with", "a", "cosine", "window", ")", ".", "The", "result", "is", "an", "MxN", "map", "of", "responses", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java#L437-L467
vkostyukov/la4j
src/main/java/org/la4j/Matrices.java
Matrices.asPlusFunction
public static MatrixFunction asPlusFunction(final double arg) { """ Creates a plus function that adds given {@code value} to it's argument. @param arg a value to be added to function's argument @return a closure object that does {@code _ + _} """ return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value + arg; } }; }
java
public static MatrixFunction asPlusFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value + arg; } }; }
[ "public", "static", "MatrixFunction", "asPlusFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "MatrixFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "int", "j", ",", "double", "value", ")", "{", "return", "value", "+", "arg", ";", "}", "}", ";", "}" ]
Creates a plus function that adds given {@code value} to it's argument. @param arg a value to be added to function's argument @return a closure object that does {@code _ + _}
[ "Creates", "a", "plus", "function", "that", "adds", "given", "{", "@code", "value", "}", "to", "it", "s", "argument", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L439-L446
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/Pipeline.java
Pipeline.process
@SneakyThrows public Corpus process(@NonNull Corpus documents) { """ Annotates documents with the annotation types defined in the pipeline. @param documents the source of documents to be annotated """ timer.start(); Broker.Builder<Document> builder = Broker.<Document>builder() .addProducer(new IterableProducer<>(documents)) .bufferSize(queueSize); Corpus corpus = documents; if (returnCorpus && corpus.getDataSetType() == DatasetType.OffHeap) { Resource tempFile = Resources.temporaryDirectory(); tempFile.deleteOnExit(); try (MultiFileWriter writer = new MultiFileWriter(tempFile, "part-", Config.get("files.partition") .asIntegerValue(numberOfThreads))) { builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed, wordsProcessed, writer), numberOfThreads) .build() .run(); } corpus = Corpus.builder().offHeap().source(CorpusFormats.JSON_OPL, tempFile).build(); } else { builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed,wordsProcessed, null), numberOfThreads) .build() .run(); } timer.stop(); totalTime += timer.elapsed(TimeUnit.NANOSECONDS); timer.reset(); return corpus; }
java
@SneakyThrows public Corpus process(@NonNull Corpus documents) { timer.start(); Broker.Builder<Document> builder = Broker.<Document>builder() .addProducer(new IterableProducer<>(documents)) .bufferSize(queueSize); Corpus corpus = documents; if (returnCorpus && corpus.getDataSetType() == DatasetType.OffHeap) { Resource tempFile = Resources.temporaryDirectory(); tempFile.deleteOnExit(); try (MultiFileWriter writer = new MultiFileWriter(tempFile, "part-", Config.get("files.partition") .asIntegerValue(numberOfThreads))) { builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed, wordsProcessed, writer), numberOfThreads) .build() .run(); } corpus = Corpus.builder().offHeap().source(CorpusFormats.JSON_OPL, tempFile).build(); } else { builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed,wordsProcessed, null), numberOfThreads) .build() .run(); } timer.stop(); totalTime += timer.elapsed(TimeUnit.NANOSECONDS); timer.reset(); return corpus; }
[ "@", "SneakyThrows", "public", "Corpus", "process", "(", "@", "NonNull", "Corpus", "documents", ")", "{", "timer", ".", "start", "(", ")", ";", "Broker", ".", "Builder", "<", "Document", ">", "builder", "=", "Broker", ".", "<", "Document", ">", "builder", "(", ")", ".", "addProducer", "(", "new", "IterableProducer", "<>", "(", "documents", ")", ")", ".", "bufferSize", "(", "queueSize", ")", ";", "Corpus", "corpus", "=", "documents", ";", "if", "(", "returnCorpus", "&&", "corpus", ".", "getDataSetType", "(", ")", "==", "DatasetType", ".", "OffHeap", ")", "{", "Resource", "tempFile", "=", "Resources", ".", "temporaryDirectory", "(", ")", ";", "tempFile", ".", "deleteOnExit", "(", ")", ";", "try", "(", "MultiFileWriter", "writer", "=", "new", "MultiFileWriter", "(", "tempFile", ",", "\"part-\"", ",", "Config", ".", "get", "(", "\"files.partition\"", ")", ".", "asIntegerValue", "(", "numberOfThreads", ")", ")", ")", "{", "builder", ".", "addConsumer", "(", "new", "AnnotateConsumer", "(", "annotationTypes", ",", "onComplete", ",", "documentsProcessed", ",", "wordsProcessed", ",", "writer", ")", ",", "numberOfThreads", ")", ".", "build", "(", ")", ".", "run", "(", ")", ";", "}", "corpus", "=", "Corpus", ".", "builder", "(", ")", ".", "offHeap", "(", ")", ".", "source", "(", "CorpusFormats", ".", "JSON_OPL", ",", "tempFile", ")", ".", "build", "(", ")", ";", "}", "else", "{", "builder", ".", "addConsumer", "(", "new", "AnnotateConsumer", "(", "annotationTypes", ",", "onComplete", ",", "documentsProcessed", ",", "wordsProcessed", ",", "null", ")", ",", "numberOfThreads", ")", ".", "build", "(", ")", ".", "run", "(", ")", ";", "}", "timer", ".", "stop", "(", ")", ";", "totalTime", "+=", "timer", ".", "elapsed", "(", "TimeUnit", ".", "NANOSECONDS", ")", ";", "timer", ".", "reset", "(", ")", ";", "return", "corpus", ";", "}" ]
Annotates documents with the annotation types defined in the pipeline. @param documents the source of documents to be annotated
[ "Annotates", "documents", "with", "the", "annotation", "types", "defined", "in", "the", "pipeline", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/Pipeline.java#L197-L229
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.addQuotes
public static final String addQuotes(String szTableNames, char charStart, char charEnd) { """ Add these quotes to this string. @param szTableNames The source string. @param charStart The starting quote. @param charEnd The ending quote. @return The new (quoted) string. """ String strFileName = szTableNames; if (charStart == -1) charStart = DBConstants.SQL_START_QUOTE; if (charEnd == -1) charEnd = DBConstants.SQL_END_QUOTE; for (int iIndex = 0; iIndex < strFileName.length(); iIndex++) { if ((strFileName.charAt(iIndex) == charStart) || (strFileName.charAt(iIndex) == charEnd)) { // If a quote is in this string, replace with a double-quote Fred's -> Fred''s strFileName = strFileName.substring(0, iIndex) + strFileName.substring(iIndex, iIndex + 1) + strFileName.substring(iIndex, iIndex + 1) + strFileName.substring(iIndex + 1, strFileName.length()); iIndex++; // Skip the second quote } } if ((charStart != ' ') && (charEnd != ' ')) strFileName = charStart + strFileName + charEnd; // Spaces in name, quotes required return strFileName; }
java
public static final String addQuotes(String szTableNames, char charStart, char charEnd) { String strFileName = szTableNames; if (charStart == -1) charStart = DBConstants.SQL_START_QUOTE; if (charEnd == -1) charEnd = DBConstants.SQL_END_QUOTE; for (int iIndex = 0; iIndex < strFileName.length(); iIndex++) { if ((strFileName.charAt(iIndex) == charStart) || (strFileName.charAt(iIndex) == charEnd)) { // If a quote is in this string, replace with a double-quote Fred's -> Fred''s strFileName = strFileName.substring(0, iIndex) + strFileName.substring(iIndex, iIndex + 1) + strFileName.substring(iIndex, iIndex + 1) + strFileName.substring(iIndex + 1, strFileName.length()); iIndex++; // Skip the second quote } } if ((charStart != ' ') && (charEnd != ' ')) strFileName = charStart + strFileName + charEnd; // Spaces in name, quotes required return strFileName; }
[ "public", "static", "final", "String", "addQuotes", "(", "String", "szTableNames", ",", "char", "charStart", ",", "char", "charEnd", ")", "{", "String", "strFileName", "=", "szTableNames", ";", "if", "(", "charStart", "==", "-", "1", ")", "charStart", "=", "DBConstants", ".", "SQL_START_QUOTE", ";", "if", "(", "charEnd", "==", "-", "1", ")", "charEnd", "=", "DBConstants", ".", "SQL_END_QUOTE", ";", "for", "(", "int", "iIndex", "=", "0", ";", "iIndex", "<", "strFileName", ".", "length", "(", ")", ";", "iIndex", "++", ")", "{", "if", "(", "(", "strFileName", ".", "charAt", "(", "iIndex", ")", "==", "charStart", ")", "||", "(", "strFileName", ".", "charAt", "(", "iIndex", ")", "==", "charEnd", ")", ")", "{", "// If a quote is in this string, replace with a double-quote Fred's -> Fred''s", "strFileName", "=", "strFileName", ".", "substring", "(", "0", ",", "iIndex", ")", "+", "strFileName", ".", "substring", "(", "iIndex", ",", "iIndex", "+", "1", ")", "+", "strFileName", ".", "substring", "(", "iIndex", ",", "iIndex", "+", "1", ")", "+", "strFileName", ".", "substring", "(", "iIndex", "+", "1", ",", "strFileName", ".", "length", "(", ")", ")", ";", "iIndex", "++", ";", "// Skip the second quote", "}", "}", "if", "(", "(", "charStart", "!=", "'", "'", ")", "&&", "(", "charEnd", "!=", "'", "'", ")", ")", "strFileName", "=", "charStart", "+", "strFileName", "+", "charEnd", ";", "// Spaces in name, quotes required", "return", "strFileName", ";", "}" ]
Add these quotes to this string. @param szTableNames The source string. @param charStart The starting quote. @param charEnd The ending quote. @return The new (quoted) string.
[ "Add", "these", "quotes", "to", "this", "string", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L330-L353
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java
ClientConfig.setFlakeIdGeneratorConfigMap
public ClientConfig setFlakeIdGeneratorConfigMap(Map<String, ClientFlakeIdGeneratorConfig> map) { """ Sets the map of {@link FlakeIdGenerator} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param map the FlakeIdGenerator configuration map to set @return this config instance """ Preconditions.isNotNull(map, "flakeIdGeneratorConfigMap"); flakeIdGeneratorConfigMap.clear(); flakeIdGeneratorConfigMap.putAll(map); for (Entry<String, ClientFlakeIdGeneratorConfig> entry : map.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public ClientConfig setFlakeIdGeneratorConfigMap(Map<String, ClientFlakeIdGeneratorConfig> map) { Preconditions.isNotNull(map, "flakeIdGeneratorConfigMap"); flakeIdGeneratorConfigMap.clear(); flakeIdGeneratorConfigMap.putAll(map); for (Entry<String, ClientFlakeIdGeneratorConfig> entry : map.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "ClientConfig", "setFlakeIdGeneratorConfigMap", "(", "Map", "<", "String", ",", "ClientFlakeIdGeneratorConfig", ">", "map", ")", "{", "Preconditions", ".", "isNotNull", "(", "map", ",", "\"flakeIdGeneratorConfigMap\"", ")", ";", "flakeIdGeneratorConfigMap", ".", "clear", "(", ")", ";", "flakeIdGeneratorConfigMap", ".", "putAll", "(", "map", ")", ";", "for", "(", "Entry", "<", "String", ",", "ClientFlakeIdGeneratorConfig", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of {@link FlakeIdGenerator} configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param map the FlakeIdGenerator configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "{", "@link", "FlakeIdGenerator", "}", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java#L505-L513
drewnoakes/metadata-extractor
Source/com/drew/metadata/TagDescriptor.java
TagDescriptor.convertBytesToVersionString
@Nullable public static String convertBytesToVersionString(@Nullable int[] components, final int majorDigits) { """ Takes a series of 4 bytes from the specified offset, and converts these to a well-known version number, where possible. <p> Two different formats are processed: <ul> <li>[30 32 31 30] -&gt; 2.10</li> <li>[0 1 0 0] -&gt; 1.00</li> </ul> @param components the four version values @param majorDigits the number of components to be @return the version as a string of form "2.10" or null if the argument cannot be converted """ if (components == null) return null; StringBuilder version = new StringBuilder(); for (int i = 0; i < 4 && i < components.length; i++) { if (i == majorDigits) version.append('.'); char c = (char)components[i]; if (c < '0') c += '0'; if (i == 0 && c == '0') continue; version.append(c); } return version.toString(); }
java
@Nullable public static String convertBytesToVersionString(@Nullable int[] components, final int majorDigits) { if (components == null) return null; StringBuilder version = new StringBuilder(); for (int i = 0; i < 4 && i < components.length; i++) { if (i == majorDigits) version.append('.'); char c = (char)components[i]; if (c < '0') c += '0'; if (i == 0 && c == '0') continue; version.append(c); } return version.toString(); }
[ "@", "Nullable", "public", "static", "String", "convertBytesToVersionString", "(", "@", "Nullable", "int", "[", "]", "components", ",", "final", "int", "majorDigits", ")", "{", "if", "(", "components", "==", "null", ")", "return", "null", ";", "StringBuilder", "version", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", "&&", "i", "<", "components", ".", "length", ";", "i", "++", ")", "{", "if", "(", "i", "==", "majorDigits", ")", "version", ".", "append", "(", "'", "'", ")", ";", "char", "c", "=", "(", "char", ")", "components", "[", "i", "]", ";", "if", "(", "c", "<", "'", "'", ")", "c", "+=", "'", "'", ";", "if", "(", "i", "==", "0", "&&", "c", "==", "'", "'", ")", "continue", ";", "version", ".", "append", "(", "c", ")", ";", "}", "return", "version", ".", "toString", "(", ")", ";", "}" ]
Takes a series of 4 bytes from the specified offset, and converts these to a well-known version number, where possible. <p> Two different formats are processed: <ul> <li>[30 32 31 30] -&gt; 2.10</li> <li>[0 1 0 0] -&gt; 1.00</li> </ul> @param components the four version values @param majorDigits the number of components to be @return the version as a string of form "2.10" or null if the argument cannot be converted
[ "Takes", "a", "series", "of", "4", "bytes", "from", "the", "specified", "offset", "and", "converts", "these", "to", "a", "well", "-", "known", "version", "number", "where", "possible", ".", "<p", ">", "Two", "different", "formats", "are", "processed", ":", "<ul", ">", "<li", ">", "[", "30", "32", "31", "30", "]", "-", "&gt", ";", "2", ".", "10<", "/", "li", ">", "<li", ">", "[", "0", "1", "0", "0", "]", "-", "&gt", ";", "1", ".", "00<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/TagDescriptor.java#L108-L125
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionATM.java
SwaptionATM.getImpliedBachelierATMOptionVolatility
public RandomVariable getImpliedBachelierATMOptionVolatility(RandomVariable optionValue, double optionMaturity, double swapAnnuity) { """ Calculates ATM Bachelier implied volatilities. @see net.finmath.functions.AnalyticFormulas#bachelierOptionImpliedVolatility(double, double, double, double, double) @param optionValue RandomVarable representing the value of the option @param optionMaturity Time to maturity. @param swapAnnuity The swap annuity as seen on valuation time. @return The Bachelier implied volatility. """ return optionValue.average().mult(Math.sqrt(2.0 * Math.PI / optionMaturity) / swapAnnuity); }
java
public RandomVariable getImpliedBachelierATMOptionVolatility(RandomVariable optionValue, double optionMaturity, double swapAnnuity){ return optionValue.average().mult(Math.sqrt(2.0 * Math.PI / optionMaturity) / swapAnnuity); }
[ "public", "RandomVariable", "getImpliedBachelierATMOptionVolatility", "(", "RandomVariable", "optionValue", ",", "double", "optionMaturity", ",", "double", "swapAnnuity", ")", "{", "return", "optionValue", ".", "average", "(", ")", ".", "mult", "(", "Math", ".", "sqrt", "(", "2.0", "*", "Math", ".", "PI", "/", "optionMaturity", ")", "/", "swapAnnuity", ")", ";", "}" ]
Calculates ATM Bachelier implied volatilities. @see net.finmath.functions.AnalyticFormulas#bachelierOptionImpliedVolatility(double, double, double, double, double) @param optionValue RandomVarable representing the value of the option @param optionMaturity Time to maturity. @param swapAnnuity The swap annuity as seen on valuation time. @return The Bachelier implied volatility.
[ "Calculates", "ATM", "Bachelier", "implied", "volatilities", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/SwaptionATM.java#L73-L75
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java
Entity.getList
public List<?> getList(PMContext ctx) throws PMException { """ Return a list of this entity instances with null from and count and the filter took from the entity container of the context @param ctx The context @return The list @throws PMException """ final EntityFilter filter = (ctx != null && this.equals(ctx.getEntity())) ? ctx.getEntityContainer().getFilter() : null; return getList(ctx, filter, null, null, null); }
java
public List<?> getList(PMContext ctx) throws PMException { final EntityFilter filter = (ctx != null && this.equals(ctx.getEntity())) ? ctx.getEntityContainer().getFilter() : null; return getList(ctx, filter, null, null, null); }
[ "public", "List", "<", "?", ">", "getList", "(", "PMContext", "ctx", ")", "throws", "PMException", "{", "final", "EntityFilter", "filter", "=", "(", "ctx", "!=", "null", "&&", "this", ".", "equals", "(", "ctx", ".", "getEntity", "(", ")", ")", ")", "?", "ctx", ".", "getEntityContainer", "(", ")", ".", "getFilter", "(", ")", ":", "null", ";", "return", "getList", "(", "ctx", ",", "filter", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Return a list of this entity instances with null from and count and the filter took from the entity container of the context @param ctx The context @return The list @throws PMException
[ "Return", "a", "list", "of", "this", "entity", "instances", "with", "null", "from", "and", "count", "and", "the", "filter", "took", "from", "the", "entity", "container", "of", "the", "context" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Entity.java#L158-L161
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/ocr/OcrClient.java
OcrClient.generalRecognition
public GeneralRecognitionResponse generalRecognition(GeneralRecognitionRequest request) { """ Gets the general recognition properties of specific image resource. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request wrapper object containing all options. @return The general recognition properties of the image resource """ checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getImage(), "Image should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PARA_GENERAL); return invokeHttpClient(internalRequest, GeneralRecognitionResponse.class); }
java
public GeneralRecognitionResponse generalRecognition(GeneralRecognitionRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getImage(), "Image should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, PARA_GENERAL); return invokeHttpClient(internalRequest, GeneralRecognitionResponse.class); }
[ "public", "GeneralRecognitionResponse", "generalRecognition", "(", "GeneralRecognitionRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getImage", "(", ")", ",", "\"Image should not be null or empty!\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "POST", ",", "request", ",", "PARA_GENERAL", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "GeneralRecognitionResponse", ".", "class", ")", ";", "}" ]
Gets the general recognition properties of specific image resource. <p> The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair. @param request The request wrapper object containing all options. @return The general recognition properties of the image resource
[ "Gets", "the", "general", "recognition", "properties", "of", "specific", "image", "resource", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/ocr/OcrClient.java#L207-L215
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.findDefaultConstructorOrThrowException
public static Constructor<?> findDefaultConstructorOrThrowException(Class<?> type) throws ConstructorNotFoundException { """ Finds and returns the default constructor. If the constructor couldn't be found this method delegates to {@link #throwExceptionWhenMultipleConstructorMatchesFound(java.lang.reflect.Constructor[])}. @param type The type where the constructor should be located. @return The found constructor. @throws ConstructorNotFoundException if too many constructors was found. """ if (type == null) { throw new IllegalArgumentException("type cannot be null"); } final Constructor<?> declaredConstructor; try { declaredConstructor = type.getDeclaredConstructor(); } catch (NoSuchMethodException e) { throw new ConstructorNotFoundException(String.format("Couldn't find a default constructor in %s.", type.getName())); } return declaredConstructor; }
java
public static Constructor<?> findDefaultConstructorOrThrowException(Class<?> type) throws ConstructorNotFoundException { if (type == null) { throw new IllegalArgumentException("type cannot be null"); } final Constructor<?> declaredConstructor; try { declaredConstructor = type.getDeclaredConstructor(); } catch (NoSuchMethodException e) { throw new ConstructorNotFoundException(String.format("Couldn't find a default constructor in %s.", type.getName())); } return declaredConstructor; }
[ "public", "static", "Constructor", "<", "?", ">", "findDefaultConstructorOrThrowException", "(", "Class", "<", "?", ">", "type", ")", "throws", "ConstructorNotFoundException", "{", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"type cannot be null\"", ")", ";", "}", "final", "Constructor", "<", "?", ">", "declaredConstructor", ";", "try", "{", "declaredConstructor", "=", "type", ".", "getDeclaredConstructor", "(", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "ConstructorNotFoundException", "(", "String", ".", "format", "(", "\"Couldn't find a default constructor in %s.\"", ",", "type", ".", "getName", "(", ")", ")", ")", ";", "}", "return", "declaredConstructor", ";", "}" ]
Finds and returns the default constructor. If the constructor couldn't be found this method delegates to {@link #throwExceptionWhenMultipleConstructorMatchesFound(java.lang.reflect.Constructor[])}. @param type The type where the constructor should be located. @return The found constructor. @throws ConstructorNotFoundException if too many constructors was found.
[ "Finds", "and", "returns", "the", "default", "constructor", ".", "If", "the", "constructor", "couldn", "t", "be", "found", "this", "method", "delegates", "to", "{", "@link", "#throwExceptionWhenMultipleConstructorMatchesFound", "(", "java", ".", "lang", ".", "reflect", ".", "Constructor", "[]", ")", "}", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1018-L1031
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.getInstance
public static Signature getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { """ Returns a Signature object that implements the specified signature algorithm. <p> A new Signature object encapsulating the SignatureSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list. @param algorithm the name of the algorithm requested. See the Signature section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @param provider the provider. @return the new Signature object. @exception NoSuchAlgorithmException if a SignatureSpi implementation for the specified algorithm is not available from the specified Provider object. @exception IllegalArgumentException if the provider is null. @see Provider @since 1.4 """ if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { // exception compatibility with existing code if (provider == null) { throw new IllegalArgumentException("missing provider"); } return getInstanceRSA(provider); } Instance instance = GetInstance.getInstance ("Signature", SignatureSpi.class, algorithm, provider); return getInstance(instance, algorithm); }
java
public static Signature getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException { if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) { // exception compatibility with existing code if (provider == null) { throw new IllegalArgumentException("missing provider"); } return getInstanceRSA(provider); } Instance instance = GetInstance.getInstance ("Signature", SignatureSpi.class, algorithm, provider); return getInstance(instance, algorithm); }
[ "public", "static", "Signature", "getInstance", "(", "String", "algorithm", ",", "Provider", "provider", ")", "throws", "NoSuchAlgorithmException", "{", "if", "(", "algorithm", ".", "equalsIgnoreCase", "(", "RSA_SIGNATURE", ")", ")", "{", "// exception compatibility with existing code", "if", "(", "provider", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"missing provider\"", ")", ";", "}", "return", "getInstanceRSA", "(", "provider", ")", ";", "}", "Instance", "instance", "=", "GetInstance", ".", "getInstance", "(", "\"Signature\"", ",", "SignatureSpi", ".", "class", ",", "algorithm", ",", "provider", ")", ";", "return", "getInstance", "(", "instance", ",", "algorithm", ")", ";", "}" ]
Returns a Signature object that implements the specified signature algorithm. <p> A new Signature object encapsulating the SignatureSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list. @param algorithm the name of the algorithm requested. See the Signature section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @param provider the provider. @return the new Signature object. @exception NoSuchAlgorithmException if a SignatureSpi implementation for the specified algorithm is not available from the specified Provider object. @exception IllegalArgumentException if the provider is null. @see Provider @since 1.4
[ "Returns", "a", "Signature", "object", "that", "implements", "the", "specified", "signature", "algorithm", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L534-L546
esigate/esigate
esigate-core/src/main/java/org/esigate/util/UriUtils.java
UriUtils.removeServer
public static URI removeServer(URI uri) { """ Removes the server information frome a {@link URI}. @param uri the {@link URI} @return a new {@link URI} with no scheme, host and port """ try { return new URI(null, null, null, -1, uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
java
public static URI removeServer(URI uri) { try { return new URI(null, null, null, -1, uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
[ "public", "static", "URI", "removeServer", "(", "URI", "uri", ")", "{", "try", "{", "return", "new", "URI", "(", "null", ",", "null", ",", "null", ",", "-", "1", ",", "uri", ".", "getPath", "(", ")", ",", "uri", ".", "getQuery", "(", ")", ",", "uri", ".", "getFragment", "(", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "InvalidUriException", "(", "e", ")", ";", "}", "}" ]
Removes the server information frome a {@link URI}. @param uri the {@link URI} @return a new {@link URI} with no scheme, host and port
[ "Removes", "the", "server", "information", "frome", "a", "{", "@link", "URI", "}", "." ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L342-L349
alkacon/opencms-core
src/org/opencms/db/generic/CmsVfsDriver.java
CmsVfsDriver.internalReadResourceState
protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException { """ Returns the resource state of the given resource.<p> @param dbc the database context @param projectId the id of the project @param resource the resource to read the resource state for @return the resource state of the given resource @throws CmsDbSqlException if something goes wrong """ CmsResourceState state = CmsResource.STATE_KEEP; Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_READ_RESOURCE_STATE"); stmt.setString(1, resource.getResourceId().toString()); res = stmt.executeQuery(); if (res.next()) { state = CmsResourceState.valueOf(res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE"))); while (res.next()) { // do nothing only move through all rows because of mssql odbc driver } } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return state; }
java
protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException { CmsResourceState state = CmsResource.STATE_KEEP; Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_READ_RESOURCE_STATE"); stmt.setString(1, resource.getResourceId().toString()); res = stmt.executeQuery(); if (res.next()) { state = CmsResourceState.valueOf(res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE"))); while (res.next()) { // do nothing only move through all rows because of mssql odbc driver } } } catch (SQLException e) { throw new CmsDbSqlException( Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, res); } return state; }
[ "protected", "CmsResourceState", "internalReadResourceState", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "projectId", ",", "CmsResource", "resource", ")", "throws", "CmsDbSqlException", "{", "CmsResourceState", "state", "=", "CmsResource", ".", "STATE_KEEP", ";", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "res", "=", "null", ";", "try", "{", "conn", "=", "m_sqlManager", ".", "getConnection", "(", "dbc", ")", ";", "stmt", "=", "m_sqlManager", ".", "getPreparedStatement", "(", "conn", ",", "projectId", ",", "\"C_READ_RESOURCE_STATE\"", ")", ";", "stmt", ".", "setString", "(", "1", ",", "resource", ".", "getResourceId", "(", ")", ".", "toString", "(", ")", ")", ";", "res", "=", "stmt", ".", "executeQuery", "(", ")", ";", "if", "(", "res", ".", "next", "(", ")", ")", "{", "state", "=", "CmsResourceState", ".", "valueOf", "(", "res", ".", "getInt", "(", "m_sqlManager", ".", "readQuery", "(", "\"C_RESOURCES_STATE\"", ")", ")", ")", ";", "while", "(", "res", ".", "next", "(", ")", ")", "{", "// do nothing only move through all rows because of mssql odbc driver", "}", "}", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "CmsDbSqlException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_GENERIC_SQL_1", ",", "CmsDbSqlException", ".", "getErrorQuery", "(", "stmt", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "m_sqlManager", ".", "closeAll", "(", "dbc", ",", "conn", ",", "stmt", ",", "res", ")", ";", "}", "return", "state", ";", "}" ]
Returns the resource state of the given resource.<p> @param dbc the database context @param projectId the id of the project @param resource the resource to read the resource state for @return the resource state of the given resource @throws CmsDbSqlException if something goes wrong
[ "Returns", "the", "resource", "state", "of", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3909-L3936
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getTileCoords
public Point getTileCoords (int x, int y) { """ Converts the supplied screen coordinates to tile coordinates. """ return MisoUtil.screenToTile(_metrics, x, y, new Point()); }
java
public Point getTileCoords (int x, int y) { return MisoUtil.screenToTile(_metrics, x, y, new Point()); }
[ "public", "Point", "getTileCoords", "(", "int", "x", ",", "int", "y", ")", "{", "return", "MisoUtil", ".", "screenToTile", "(", "_metrics", ",", "x", ",", "y", ",", "new", "Point", "(", ")", ")", ";", "}" ]
Converts the supplied screen coordinates to tile coordinates.
[ "Converts", "the", "supplied", "screen", "coordinates", "to", "tile", "coordinates", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L335-L338
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/GroupsMembersApi.java
GroupsMembersApi.getList
public Members getList(String groupId, EnumSet<JinxConstants.MemberType> memberTypes, int perPage, int page) throws JinxException { """ <br> Get a list of the members of a group. The call must be signed on behalf of a Flickr member, and the ability to see the group membership will be determined by the Flickr member's group privileges. <br> This method requires authentication with 'read' permission. @param groupId (Required) Return a list of members for this group. The group must be viewable by the Flickr member on whose behalf the API call is made. @param memberTypes (Optional) Return only these member types. If null, return all member types. (Returning super rare member type "1: narwhal" isn't supported by this API method) @param perPage number of members to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page page of results to return. If this argument is less than 1, it defaults to 1. @return members object containing metadata and a list of members. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.groups.members.getList.html">flickr.groups.members.getList</a> """ JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.groups.members.getList"); params.put("group_id", groupId); if (memberTypes != null) { StringBuilder sb = new StringBuilder(); for (JinxConstants.MemberType type : memberTypes) { sb.append(JinxUtils.memberTypeToMemberTypeId(type)).append(','); } params.put("membertypes", sb.deleteCharAt(sb.length() - 1).toString()); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Members.class); }
java
public Members getList(String groupId, EnumSet<JinxConstants.MemberType> memberTypes, int perPage, int page) throws JinxException { JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<String, String>(); params.put("method", "flickr.groups.members.getList"); params.put("group_id", groupId); if (memberTypes != null) { StringBuilder sb = new StringBuilder(); for (JinxConstants.MemberType type : memberTypes) { sb.append(JinxUtils.memberTypeToMemberTypeId(type)).append(','); } params.put("membertypes", sb.deleteCharAt(sb.length() - 1).toString()); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Members.class); }
[ "public", "Members", "getList", "(", "String", "groupId", ",", "EnumSet", "<", "JinxConstants", ".", "MemberType", ">", "memberTypes", ",", "int", "perPage", ",", "int", "page", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "groupId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.groups.members.getList\"", ")", ";", "params", ".", "put", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "memberTypes", "!=", "null", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "JinxConstants", ".", "MemberType", "type", ":", "memberTypes", ")", "{", "sb", ".", "append", "(", "JinxUtils", ".", "memberTypeToMemberTypeId", "(", "type", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "params", ".", "put", "(", "\"membertypes\"", ",", "sb", ".", "deleteCharAt", "(", "sb", ".", "length", "(", ")", "-", "1", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "perPage", ">", "0", ")", "{", "params", ".", "put", "(", "\"per_page\"", ",", "Integer", ".", "toString", "(", "perPage", ")", ")", ";", "}", "if", "(", "page", ">", "0", ")", "{", "params", ".", "put", "(", "\"page\"", ",", "Integer", ".", "toString", "(", "page", ")", ")", ";", "}", "return", "jinx", ".", "flickrGet", "(", "params", ",", "Members", ".", "class", ")", ";", "}" ]
<br> Get a list of the members of a group. The call must be signed on behalf of a Flickr member, and the ability to see the group membership will be determined by the Flickr member's group privileges. <br> This method requires authentication with 'read' permission. @param groupId (Required) Return a list of members for this group. The group must be viewable by the Flickr member on whose behalf the API call is made. @param memberTypes (Optional) Return only these member types. If null, return all member types. (Returning super rare member type "1: narwhal" isn't supported by this API method) @param perPage number of members to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page page of results to return. If this argument is less than 1, it defaults to 1. @return members object containing metadata and a list of members. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.groups.members.getList.html">flickr.groups.members.getList</a>
[ "<br", ">", "Get", "a", "list", "of", "the", "members", "of", "a", "group", ".", "The", "call", "must", "be", "signed", "on", "behalf", "of", "a", "Flickr", "member", "and", "the", "ability", "to", "see", "the", "group", "membership", "will", "be", "determined", "by", "the", "Flickr", "member", "s", "group", "privileges", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "read", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsMembersApi.java#L59-L78
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.getMethod
public static Method getMethod(Class clazz, String methodName, Class[] params) { """ Determines the method with the specified signature via reflection look-up. @param clazz The java class to search in @param methodName The method's name @param params The parameter types @return The method object or <code>null</code> if no matching method was found """ try { return clazz.getMethod(methodName, params); } catch (Exception ignored) {} return null; }
java
public static Method getMethod(Class clazz, String methodName, Class[] params) { try { return clazz.getMethod(methodName, params); } catch (Exception ignored) {} return null; }
[ "public", "static", "Method", "getMethod", "(", "Class", "clazz", ",", "String", "methodName", ",", "Class", "[", "]", "params", ")", "{", "try", "{", "return", "clazz", ".", "getMethod", "(", "methodName", ",", "params", ")", ";", "}", "catch", "(", "Exception", "ignored", ")", "{", "}", "return", "null", ";", "}" ]
Determines the method with the specified signature via reflection look-up. @param clazz The java class to search in @param methodName The method's name @param params The parameter types @return The method object or <code>null</code> if no matching method was found
[ "Determines", "the", "method", "with", "the", "specified", "signature", "via", "reflection", "look", "-", "up", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L233-L242
alkacon/opencms-core
src/org/opencms/ade/publish/CmsPublish.java
CmsPublish.relationToBean
public CmsPublishResource relationToBean(CmsRelation relation) { """ Creates a publish resource bean from the target information of a relation object.<p> @param relation the relation to use @return the publish resource bean for the relation target """ CmsPermissionInfo permissionInfo = new CmsPermissionInfo(true, false, ""); CmsPublishResource bean = new CmsPublishResource( relation.getTargetId(), relation.getTargetPath(), relation.getTargetPath(), CmsResourceTypePlain.getStaticTypeName(), CmsResourceState.STATE_UNCHANGED, permissionInfo, 0, null, null, false, null, null); bean.setBigIconClasses(CmsIconUtil.getIconClasses(CmsResourceTypePlain.getStaticTypeName(), null, false)); return bean; }
java
public CmsPublishResource relationToBean(CmsRelation relation) { CmsPermissionInfo permissionInfo = new CmsPermissionInfo(true, false, ""); CmsPublishResource bean = new CmsPublishResource( relation.getTargetId(), relation.getTargetPath(), relation.getTargetPath(), CmsResourceTypePlain.getStaticTypeName(), CmsResourceState.STATE_UNCHANGED, permissionInfo, 0, null, null, false, null, null); bean.setBigIconClasses(CmsIconUtil.getIconClasses(CmsResourceTypePlain.getStaticTypeName(), null, false)); return bean; }
[ "public", "CmsPublishResource", "relationToBean", "(", "CmsRelation", "relation", ")", "{", "CmsPermissionInfo", "permissionInfo", "=", "new", "CmsPermissionInfo", "(", "true", ",", "false", ",", "\"\"", ")", ";", "CmsPublishResource", "bean", "=", "new", "CmsPublishResource", "(", "relation", ".", "getTargetId", "(", ")", ",", "relation", ".", "getTargetPath", "(", ")", ",", "relation", ".", "getTargetPath", "(", ")", ",", "CmsResourceTypePlain", ".", "getStaticTypeName", "(", ")", ",", "CmsResourceState", ".", "STATE_UNCHANGED", ",", "permissionInfo", ",", "0", ",", "null", ",", "null", ",", "false", ",", "null", ",", "null", ")", ";", "bean", ".", "setBigIconClasses", "(", "CmsIconUtil", ".", "getIconClasses", "(", "CmsResourceTypePlain", ".", "getStaticTypeName", "(", ")", ",", "null", ",", "false", ")", ")", ";", "return", "bean", ";", "}" ]
Creates a publish resource bean from the target information of a relation object.<p> @param relation the relation to use @return the publish resource bean for the relation target
[ "Creates", "a", "publish", "resource", "bean", "from", "the", "target", "information", "of", "a", "relation", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsPublish.java#L327-L345
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/network/bridge_stats.java
bridge_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { """ <pre> converts nitro response into object and returns the object array in case of get request. </pre> """ bridge_stats[] resources = new bridge_stats[1]; bridge_response result = (bridge_response) service.get_payload_formatter().string_to_resource(bridge_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.bridge; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { bridge_stats[] resources = new bridge_stats[1]; bridge_response result = (bridge_response) service.get_payload_formatter().string_to_resource(bridge_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.bridge; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "bridge_stats", "[", "]", "resources", "=", "new", "bridge_stats", "[", "1", "]", ";", "bridge_response", "result", "=", "(", "bridge_response", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "bridge_response", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "444", ")", "{", "service", ".", "clear_session", "(", ")", ";", "}", "if", "(", "result", ".", "severity", "!=", "null", ")", "{", "if", "(", "result", ".", "severity", ".", "equals", "(", "\"ERROR\"", ")", ")", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "else", "{", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ")", ";", "}", "}", "resources", "[", "0", "]", "=", "result", ".", "bridge", ";", "return", "resources", ";", "}" ]
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/bridge_stats.java#L160-L179
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ParametersUtil.java
ParametersUtil.addParameterToParameters
public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, String thePrimitiveDatatype, String theValue) { """ Add a paratemer value to a Parameters resource @param theContext The FhirContext @param theParameters The Parameters resource @param theName The parameter name @param thePrimitiveDatatype The datatype, e.g. "string", or "uri" @param theValue The value """ Validate.notBlank(thePrimitiveDatatype, "thePrimitiveDatatype must not be null or empty"); BaseRuntimeElementDefinition<?> datatypeDef = theContext.getElementDefinition(thePrimitiveDatatype); IPrimitiveType<?> value = (IPrimitiveType<?>) datatypeDef.newInstance(); value.setValueAsString(theValue); addParameterToParameters(theContext, theParameters, theName, value); }
java
public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, String thePrimitiveDatatype, String theValue) { Validate.notBlank(thePrimitiveDatatype, "thePrimitiveDatatype must not be null or empty"); BaseRuntimeElementDefinition<?> datatypeDef = theContext.getElementDefinition(thePrimitiveDatatype); IPrimitiveType<?> value = (IPrimitiveType<?>) datatypeDef.newInstance(); value.setValueAsString(theValue); addParameterToParameters(theContext, theParameters, theName, value); }
[ "public", "static", "void", "addParameterToParameters", "(", "FhirContext", "theContext", ",", "IBaseParameters", "theParameters", ",", "String", "theName", ",", "String", "thePrimitiveDatatype", ",", "String", "theValue", ")", "{", "Validate", ".", "notBlank", "(", "thePrimitiveDatatype", ",", "\"thePrimitiveDatatype must not be null or empty\"", ")", ";", "BaseRuntimeElementDefinition", "<", "?", ">", "datatypeDef", "=", "theContext", ".", "getElementDefinition", "(", "thePrimitiveDatatype", ")", ";", "IPrimitiveType", "<", "?", ">", "value", "=", "(", "IPrimitiveType", "<", "?", ">", ")", "datatypeDef", ".", "newInstance", "(", ")", ";", "value", ".", "setValueAsString", "(", "theValue", ")", ";", "addParameterToParameters", "(", "theContext", ",", "theParameters", ",", "theName", ",", "value", ")", ";", "}" ]
Add a paratemer value to a Parameters resource @param theContext The FhirContext @param theParameters The Parameters resource @param theName The parameter name @param thePrimitiveDatatype The datatype, e.g. "string", or "uri" @param theValue The value
[ "Add", "a", "paratemer", "value", "to", "a", "Parameters", "resource" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ParametersUtil.java#L116-L124
liyiorg/weixin-popular
src/main/java/weixin/popular/api/DataCubeAPI.java
DataCubeAPI.getCardCardInfo
public static CardInfoResult getCardCardInfo(String access_token, CardInfo freeCardCube) { """ 获取免费券数据<br> 1. 该接口目前仅支持拉取免费券(优惠券、团购券、折扣券、礼品券)的卡券相关数据,暂不支持特殊票券(电影票、会议门票、景区门票、飞机票)数据。<br> 2. 查询时间区间需&lt;=62天,否则报错;<br> 3. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br> 4. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br> @param access_token access_token @param freeCardCube freeCardCube @return result """ return getCardCardInfo(access_token, JsonUtil.toJSONString(freeCardCube)); }
java
public static CardInfoResult getCardCardInfo(String access_token, CardInfo freeCardCube) { return getCardCardInfo(access_token, JsonUtil.toJSONString(freeCardCube)); }
[ "public", "static", "CardInfoResult", "getCardCardInfo", "(", "String", "access_token", ",", "CardInfo", "freeCardCube", ")", "{", "return", "getCardCardInfo", "(", "access_token", ",", "JsonUtil", ".", "toJSONString", "(", "freeCardCube", ")", ")", ";", "}" ]
获取免费券数据<br> 1. 该接口目前仅支持拉取免费券(优惠券、团购券、折扣券、礼品券)的卡券相关数据,暂不支持特殊票券(电影票、会议门票、景区门票、飞机票)数据。<br> 2. 查询时间区间需&lt;=62天,否则报错;<br> 3. 传入时间格式需严格参照示例填写如”2015-06-15”,否则报错;<br> 4. 该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br> @param access_token access_token @param freeCardCube freeCardCube @return result
[ "获取免费券数据<br", ">", "1", ".", "该接口目前仅支持拉取免费券(优惠券、团购券、折扣券、礼品券)的卡券相关数据,暂不支持特殊票券(电影票、会议门票、景区门票、飞机票)数据。<br", ">", "2", ".", "查询时间区间需&lt", ";", "=", "62天,否则报错;<br", ">", "3", ".", "传入时间格式需严格参照示例填写如”2015", "-", "06", "-", "15”,否则报错;<br", ">", "4", ".", "该接口只能拉取非当天的数据,不能拉取当天的卡券数据,否则报错。<br", ">" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/DataCubeAPI.java#L80-L82
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java
LegacyBehavior.cancelConcurrentScope
public static void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancelledScopeActivity) { """ Cancels an execution which is both concurrent and scope. This can only happen if (a) the process instance has been migrated from a previous version to a new version of the process engine See: javadoc of this class for note about concurrent scopes. @param execution the concurrent scope execution to destroy @param cancelledScopeActivity the activity that cancels the execution; it must hold that cancellingActivity's event scope is the scope the execution is responsible for """ ensureConcurrentScope(execution); LOG.debugCancelConcurrentScopeExecution(execution); execution.interrupt("Scope "+cancelledScopeActivity+" cancelled."); // <!> HACK set to event scope activity and leave activity instance execution.setActivity(cancelledScopeActivity); execution.leaveActivityInstance(); execution.interrupt("Scope "+cancelledScopeActivity+" cancelled."); execution.destroy(); }
java
public static void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancelledScopeActivity) { ensureConcurrentScope(execution); LOG.debugCancelConcurrentScopeExecution(execution); execution.interrupt("Scope "+cancelledScopeActivity+" cancelled."); // <!> HACK set to event scope activity and leave activity instance execution.setActivity(cancelledScopeActivity); execution.leaveActivityInstance(); execution.interrupt("Scope "+cancelledScopeActivity+" cancelled."); execution.destroy(); }
[ "public", "static", "void", "cancelConcurrentScope", "(", "PvmExecutionImpl", "execution", ",", "PvmActivity", "cancelledScopeActivity", ")", "{", "ensureConcurrentScope", "(", "execution", ")", ";", "LOG", ".", "debugCancelConcurrentScopeExecution", "(", "execution", ")", ";", "execution", ".", "interrupt", "(", "\"Scope \"", "+", "cancelledScopeActivity", "+", "\" cancelled.\"", ")", ";", "// <!> HACK set to event scope activity and leave activity instance", "execution", ".", "setActivity", "(", "cancelledScopeActivity", ")", ";", "execution", ".", "leaveActivityInstance", "(", ")", ";", "execution", ".", "interrupt", "(", "\"Scope \"", "+", "cancelledScopeActivity", "+", "\" cancelled.\"", ")", ";", "execution", ".", "destroy", "(", ")", ";", "}" ]
Cancels an execution which is both concurrent and scope. This can only happen if (a) the process instance has been migrated from a previous version to a new version of the process engine See: javadoc of this class for note about concurrent scopes. @param execution the concurrent scope execution to destroy @param cancelledScopeActivity the activity that cancels the execution; it must hold that cancellingActivity's event scope is the scope the execution is responsible for
[ "Cancels", "an", "execution", "which", "is", "both", "concurrent", "and", "scope", ".", "This", "can", "only", "happen", "if", "(", "a", ")", "the", "process", "instance", "has", "been", "migrated", "from", "a", "previous", "version", "to", "a", "new", "version", "of", "the", "process", "engine" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java#L115-L125
mojohaus/flatten-maven-plugin
src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java
FlattenDescriptor.setHandling
public void setHandling( PomProperty<?> property, ElementHandling handling ) { """ Generic method to set an {@link ElementHandling}. @param property is the {@link PomProperty} such as {@link PomProperty#NAME}. @param handling the new {@link ElementHandling}. """ this.name2handlingMap.put( property.getName(), handling ); }
java
public void setHandling( PomProperty<?> property, ElementHandling handling ) { this.name2handlingMap.put( property.getName(), handling ); }
[ "public", "void", "setHandling", "(", "PomProperty", "<", "?", ">", "property", ",", "ElementHandling", "handling", ")", "{", "this", ".", "name2handlingMap", ".", "put", "(", "property", ".", "getName", "(", ")", ",", "handling", ")", ";", "}" ]
Generic method to set an {@link ElementHandling}. @param property is the {@link PomProperty} such as {@link PomProperty#NAME}. @param handling the new {@link ElementHandling}.
[ "Generic", "method", "to", "set", "an", "{", "@link", "ElementHandling", "}", "." ]
train
https://github.com/mojohaus/flatten-maven-plugin/blob/df25d03a4d6c06c4de5cfd9f52dfbe72e823e403/src/main/java/org/codehaus/mojo/flatten/FlattenDescriptor.java#L89-L93
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/core/executor/ExecutorAnalyzer.java
ExecutorAnalyzer.analyzeExecutor
public static RepositoryExecutor analyzeExecutor( final ResultDescriptor descriptor, final Set<RepositoryExecutor> executors, final RepositoryExecutor defaultExecutor, final DbType connectionHint, final boolean customConverterUsed) { """ Selects appropriate executor for repository method. Custom converters most likely will cause method return type different from raw object, returned from connection. So in such case detection of connection from return type is impossible. <p> If custom converter registered: always use connection hint if available. Note that result converter could also change connection hint. <p> If no custom converter register then if connection hint contradict with result type analysis throw an error. @param descriptor result definition @param executors available executors @param defaultExecutor default executor to use @param connectionHint expected connection type hint @param customConverterUsed true when custom converter registered @return selected executor instance """ final RepositoryExecutor executorByType = selectByType(descriptor.entityType, executors); // storing recognized entity type relation to connection specific object (very helpful hint) descriptor.entityDbType = executorByType == null ? DbType.UNKNOWN : executorByType.getType(); final RepositoryExecutor executor; if (connectionHint != null) { // connection hint in priority executor = find(connectionHint, executors); check(executor != null, "Executor not found for type set in annotation %s", connectionHint); if (!customConverterUsed) { // catch silly errors validateHint(executorByType, connectionHint); } } else { // automatic detection executor = executorByType == null ? defaultExecutor : executorByType; } return executor; }
java
public static RepositoryExecutor analyzeExecutor( final ResultDescriptor descriptor, final Set<RepositoryExecutor> executors, final RepositoryExecutor defaultExecutor, final DbType connectionHint, final boolean customConverterUsed) { final RepositoryExecutor executorByType = selectByType(descriptor.entityType, executors); // storing recognized entity type relation to connection specific object (very helpful hint) descriptor.entityDbType = executorByType == null ? DbType.UNKNOWN : executorByType.getType(); final RepositoryExecutor executor; if (connectionHint != null) { // connection hint in priority executor = find(connectionHint, executors); check(executor != null, "Executor not found for type set in annotation %s", connectionHint); if (!customConverterUsed) { // catch silly errors validateHint(executorByType, connectionHint); } } else { // automatic detection executor = executorByType == null ? defaultExecutor : executorByType; } return executor; }
[ "public", "static", "RepositoryExecutor", "analyzeExecutor", "(", "final", "ResultDescriptor", "descriptor", ",", "final", "Set", "<", "RepositoryExecutor", ">", "executors", ",", "final", "RepositoryExecutor", "defaultExecutor", ",", "final", "DbType", "connectionHint", ",", "final", "boolean", "customConverterUsed", ")", "{", "final", "RepositoryExecutor", "executorByType", "=", "selectByType", "(", "descriptor", ".", "entityType", ",", "executors", ")", ";", "// storing recognized entity type relation to connection specific object (very helpful hint)", "descriptor", ".", "entityDbType", "=", "executorByType", "==", "null", "?", "DbType", ".", "UNKNOWN", ":", "executorByType", ".", "getType", "(", ")", ";", "final", "RepositoryExecutor", "executor", ";", "if", "(", "connectionHint", "!=", "null", ")", "{", "// connection hint in priority", "executor", "=", "find", "(", "connectionHint", ",", "executors", ")", ";", "check", "(", "executor", "!=", "null", ",", "\"Executor not found for type set in annotation %s\"", ",", "connectionHint", ")", ";", "if", "(", "!", "customConverterUsed", ")", "{", "// catch silly errors", "validateHint", "(", "executorByType", ",", "connectionHint", ")", ";", "}", "}", "else", "{", "// automatic detection", "executor", "=", "executorByType", "==", "null", "?", "defaultExecutor", ":", "executorByType", ";", "}", "return", "executor", ";", "}" ]
Selects appropriate executor for repository method. Custom converters most likely will cause method return type different from raw object, returned from connection. So in such case detection of connection from return type is impossible. <p> If custom converter registered: always use connection hint if available. Note that result converter could also change connection hint. <p> If no custom converter register then if connection hint contradict with result type analysis throw an error. @param descriptor result definition @param executors available executors @param defaultExecutor default executor to use @param connectionHint expected connection type hint @param customConverterUsed true when custom converter registered @return selected executor instance
[ "Selects", "appropriate", "executor", "for", "repository", "method", ".", "Custom", "converters", "most", "likely", "will", "cause", "method", "return", "type", "different", "from", "raw", "object", "returned", "from", "connection", ".", "So", "in", "such", "case", "detection", "of", "connection", "from", "return", "type", "is", "impossible", ".", "<p", ">", "If", "custom", "converter", "registered", ":", "always", "use", "connection", "hint", "if", "available", ".", "Note", "that", "result", "converter", "could", "also", "change", "connection", "hint", ".", "<p", ">", "If", "no", "custom", "converter", "register", "then", "if", "connection", "hint", "contradict", "with", "result", "type", "analysis", "throw", "an", "error", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/executor/ExecutorAnalyzer.java#L39-L63
apache/incubator-atlas
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
HiveMetaStoreBridge.getDatabaseReference
private Referenceable getDatabaseReference(String clusterName, String databaseName) throws Exception { """ Gets reference to the atlas entity for the database @param databaseName database Name @param clusterName cluster name @return Reference for database if exists, else null @throws Exception """ LOG.debug("Getting reference for database {}", databaseName); String typeName = HiveDataTypes.HIVE_DB.getName(); return getEntityReference(typeName, getDBQualifiedName(clusterName, databaseName)); }
java
private Referenceable getDatabaseReference(String clusterName, String databaseName) throws Exception { LOG.debug("Getting reference for database {}", databaseName); String typeName = HiveDataTypes.HIVE_DB.getName(); return getEntityReference(typeName, getDBQualifiedName(clusterName, databaseName)); }
[ "private", "Referenceable", "getDatabaseReference", "(", "String", "clusterName", ",", "String", "databaseName", ")", "throws", "Exception", "{", "LOG", ".", "debug", "(", "\"Getting reference for database {}\"", ",", "databaseName", ")", ";", "String", "typeName", "=", "HiveDataTypes", ".", "HIVE_DB", ".", "getName", "(", ")", ";", "return", "getEntityReference", "(", "typeName", ",", "getDBQualifiedName", "(", "clusterName", ",", "databaseName", ")", ")", ";", "}" ]
Gets reference to the atlas entity for the database @param databaseName database Name @param clusterName cluster name @return Reference for database if exists, else null @throws Exception
[ "Gets", "reference", "to", "the", "atlas", "entity", "for", "the", "database" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java#L226-L231
aalmiray/Json-lib
src/main/java/net/sf/json/JsonConfig.java
JsonConfig.unregisterJsonValueProcessor
public void unregisterJsonValueProcessor( Class beanClass, String key ) { """ Removes a JsonValueProcessor.<br> [Java -&gt; JSON] @param beanClass the class to which the property may belong @param key the name of the property which may belong to the target class """ if( beanClass != null && key != null ) { beanKeyMap.remove( beanClass, key ); } }
java
public void unregisterJsonValueProcessor( Class beanClass, String key ) { if( beanClass != null && key != null ) { beanKeyMap.remove( beanClass, key ); } }
[ "public", "void", "unregisterJsonValueProcessor", "(", "Class", "beanClass", ",", "String", "key", ")", "{", "if", "(", "beanClass", "!=", "null", "&&", "key", "!=", "null", ")", "{", "beanKeyMap", ".", "remove", "(", "beanClass", ",", "key", ")", ";", "}", "}" ]
Removes a JsonValueProcessor.<br> [Java -&gt; JSON] @param beanClass the class to which the property may belong @param key the name of the property which may belong to the target class
[ "Removes", "a", "JsonValueProcessor", ".", "<br", ">", "[", "Java", "-", "&gt", ";", "JSON", "]" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L1378-L1382
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/Grid.java
Grid.getInstance
public static Grid getInstance(URL configFile, Properties properties) throws InterruptedException { """ Retrieves the grid instance, as defined in the given configuration file. @param configFile The name of the configuration file containing the grid definition. @param properties A {@link Properties Properties} object containing the grid's properties to be injected into placeholders in the configuration file. This parameter is helpful when you want to use the same xml configuration with different properties for different instances. @return The grid instance. """ return getInstance(new UrlResource(configFile), properties); }
java
public static Grid getInstance(URL configFile, Properties properties) throws InterruptedException { return getInstance(new UrlResource(configFile), properties); }
[ "public", "static", "Grid", "getInstance", "(", "URL", "configFile", ",", "Properties", "properties", ")", "throws", "InterruptedException", "{", "return", "getInstance", "(", "new", "UrlResource", "(", "configFile", ")", ",", "properties", ")", ";", "}" ]
Retrieves the grid instance, as defined in the given configuration file. @param configFile The name of the configuration file containing the grid definition. @param properties A {@link Properties Properties} object containing the grid's properties to be injected into placeholders in the configuration file. This parameter is helpful when you want to use the same xml configuration with different properties for different instances. @return The grid instance.
[ "Retrieves", "the", "grid", "instance", "as", "defined", "in", "the", "given", "configuration", "file", "." ]
train
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/Grid.java#L100-L102
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java
AbstractMessage.toJSON
@Override public String toJSON() { """ Converts this message to its JSON string representation. @return JSON encoded data that represents this message. """ final ObjectMapper mapper = buildObjectMapperForSerialization(); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new IllegalStateException("Object cannot be parsed as JSON.", e); } }
java
@Override public String toJSON() { final ObjectMapper mapper = buildObjectMapperForSerialization(); try { return mapper.writeValueAsString(this); } catch (JsonProcessingException e) { throw new IllegalStateException("Object cannot be parsed as JSON.", e); } }
[ "@", "Override", "public", "String", "toJSON", "(", ")", "{", "final", "ObjectMapper", "mapper", "=", "buildObjectMapperForSerialization", "(", ")", ";", "try", "{", "return", "mapper", ".", "writeValueAsString", "(", "this", ")", ";", "}", "catch", "(", "JsonProcessingException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Object cannot be parsed as JSON.\"", ",", "e", ")", ";", "}", "}" ]
Converts this message to its JSON string representation. @return JSON encoded data that represents this message.
[ "Converts", "this", "message", "to", "its", "JSON", "string", "representation", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/AbstractMessage.java#L151-L159
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.optPointF
public static <P extends Enum<P>> PointF optPointF(final JSONObject json, P e, PointF fallback) { """ Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link PointF}. The values in {@code fallback} are used if either field is missing; if {@code fallback} is {@code null}, {@link Float#NaN} is used. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @param fallback Default value to return if there is no mapping @return An instance of {@code PointF} or {@code fallback} if there is no object mapping for {@code e}. """ JSONObject value = optJSONObject(json, e); PointF p = asPointF(value, fallback); return p; }
java
public static <P extends Enum<P>> PointF optPointF(final JSONObject json, P e, PointF fallback) { JSONObject value = optJSONObject(json, e); PointF p = asPointF(value, fallback); return p; }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "PointF", "optPointF", "(", "final", "JSONObject", "json", ",", "P", "e", ",", "PointF", "fallback", ")", "{", "JSONObject", "value", "=", "optJSONObject", "(", "json", ",", "e", ")", ";", "PointF", "p", "=", "asPointF", "(", "value", ",", "fallback", ")", ";", "return", "p", ";", "}" ]
Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link PointF}. The values in {@code fallback} are used if either field is missing; if {@code fallback} is {@code null}, {@link Float#NaN} is used. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @param fallback Default value to return if there is no mapping @return An instance of {@code PointF} or {@code fallback} if there is no object mapping for {@code e}.
[ "Return", "the", "value", "mapped", "by", "enum", "if", "it", "exists", "and", "is", "a", "{", "@link", "JSONObject", "}", "by", "mapping", "x", "and", "y", "members", "into", "a", "{", "@link", "PointF", "}", ".", "The", "values", "in", "{", "@code", "fallback", "}", "are", "used", "if", "either", "field", "is", "missing", ";", "if", "{", "@code", "fallback", "}", "is", "{", "@code", "null", "}", "{", "@link", "Float#NaN", "}", "is", "used", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L578-L583
berkesa/datatree
src/main/java/io/datatree/dom/TreeWriterRegistry.java
TreeWriterRegistry.setWriter
public static final void setWriter(String format, TreeWriter writer) { """ Binds the given TreeWriter instance to the specified data format. @param format name of the format (eg. "json", "xml", "csv", etc.) @param writer TreeWriter instance for generating the specified format """ String key = format.toLowerCase(); writers.put(key, writer); if (JSON.equals(key)) { cachedJsonWriter = writer; } }
java
public static final void setWriter(String format, TreeWriter writer) { String key = format.toLowerCase(); writers.put(key, writer); if (JSON.equals(key)) { cachedJsonWriter = writer; } }
[ "public", "static", "final", "void", "setWriter", "(", "String", "format", ",", "TreeWriter", "writer", ")", "{", "String", "key", "=", "format", ".", "toLowerCase", "(", ")", ";", "writers", ".", "put", "(", "key", ",", "writer", ")", ";", "if", "(", "JSON", ".", "equals", "(", "key", ")", ")", "{", "cachedJsonWriter", "=", "writer", ";", "}", "}" ]
Binds the given TreeWriter instance to the specified data format. @param format name of the format (eg. "json", "xml", "csv", etc.) @param writer TreeWriter instance for generating the specified format
[ "Binds", "the", "given", "TreeWriter", "instance", "to", "the", "specified", "data", "format", "." ]
train
https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/dom/TreeWriterRegistry.java#L65-L71
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java
VMath.setMatrix
public static void setMatrix(final double[][] m1, final int[] r, final int[] c, final double[][] m2) { """ Set a submatrix. @param m1 Original matrix @param r Array of row indices. @param c Array of column indices. @param m2 New values for m1(r(:),c(:)) """ for(int i = 0; i < r.length; i++) { final double[] row1 = m1[r[i]], row2 = m2[i]; for(int j = 0; j < c.length; j++) { row1[c[j]] = row2[j]; } } }
java
public static void setMatrix(final double[][] m1, final int[] r, final int[] c, final double[][] m2) { for(int i = 0; i < r.length; i++) { final double[] row1 = m1[r[i]], row2 = m2[i]; for(int j = 0; j < c.length; j++) { row1[c[j]] = row2[j]; } } }
[ "public", "static", "void", "setMatrix", "(", "final", "double", "[", "]", "[", "]", "m1", ",", "final", "int", "[", "]", "r", ",", "final", "int", "[", "]", "c", ",", "final", "double", "[", "]", "[", "]", "m2", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "r", ".", "length", ";", "i", "++", ")", "{", "final", "double", "[", "]", "row1", "=", "m1", "[", "r", "[", "i", "]", "]", ",", "row2", "=", "m2", "[", "i", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "c", ".", "length", ";", "j", "++", ")", "{", "row1", "[", "c", "[", "j", "]", "]", "=", "row2", "[", "j", "]", ";", "}", "}", "}" ]
Set a submatrix. @param m1 Original matrix @param r Array of row indices. @param c Array of column indices. @param m2 New values for m1(r(:),c(:))
[ "Set", "a", "submatrix", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1014-L1021
liferay/com-liferay-commerce
commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java
CommerceVirtualOrderItemPersistenceImpl.removeByUUID_G
@Override public CommerceVirtualOrderItem removeByUUID_G(String uuid, long groupId) throws NoSuchVirtualOrderItemException { """ Removes the commerce virtual order item where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce virtual order item that was removed """ CommerceVirtualOrderItem commerceVirtualOrderItem = findByUUID_G(uuid, groupId); return remove(commerceVirtualOrderItem); }
java
@Override public CommerceVirtualOrderItem removeByUUID_G(String uuid, long groupId) throws NoSuchVirtualOrderItemException { CommerceVirtualOrderItem commerceVirtualOrderItem = findByUUID_G(uuid, groupId); return remove(commerceVirtualOrderItem); }
[ "@", "Override", "public", "CommerceVirtualOrderItem", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchVirtualOrderItemException", "{", "CommerceVirtualOrderItem", "commerceVirtualOrderItem", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "return", "remove", "(", "commerceVirtualOrderItem", ")", ";", "}" ]
Removes the commerce virtual order item where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce virtual order item that was removed
[ "Removes", "the", "commerce", "virtual", "order", "item", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L817-L824
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java
CompositeInputFormat.compose
public static String compose(String op, Class<? extends InputFormat> inf, Path... path) { """ Convenience method for constructing composite formats. Given operation (op), Object class (inf), set of paths (p) return: {@code <op>(tbl(<inf>,<p1>),tbl(<inf>,<p2>),...,tbl(<inf>,<pn>)) } """ ArrayList<String> tmp = new ArrayList<String>(path.length); for (Path p : path) { tmp.add(p.toString()); } return compose(op, inf, tmp.toArray(new String[0])); }
java
public static String compose(String op, Class<? extends InputFormat> inf, Path... path) { ArrayList<String> tmp = new ArrayList<String>(path.length); for (Path p : path) { tmp.add(p.toString()); } return compose(op, inf, tmp.toArray(new String[0])); }
[ "public", "static", "String", "compose", "(", "String", "op", ",", "Class", "<", "?", "extends", "InputFormat", ">", "inf", ",", "Path", "...", "path", ")", "{", "ArrayList", "<", "String", ">", "tmp", "=", "new", "ArrayList", "<", "String", ">", "(", "path", ".", "length", ")", ";", "for", "(", "Path", "p", ":", "path", ")", "{", "tmp", ".", "add", "(", "p", ".", "toString", "(", ")", ")", ";", "}", "return", "compose", "(", "op", ",", "inf", ",", "tmp", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")", ";", "}" ]
Convenience method for constructing composite formats. Given operation (op), Object class (inf), set of paths (p) return: {@code <op>(tbl(<inf>,<p1>),tbl(<inf>,<p2>),...,tbl(<inf>,<pn>)) }
[ "Convenience", "method", "for", "constructing", "composite", "formats", ".", "Given", "operation", "(", "op", ")", "Object", "class", "(", "inf", ")", "set", "of", "paths", "(", "p", ")", "return", ":", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/CompositeInputFormat.java#L164-L171
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.write
public static void write(HttpServletResponse response, InputStream in, int bufferSize) { """ 返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param bufferSize 缓存大小 """ ServletOutputStream out = null; try { out = response.getOutputStream(); IoUtil.copy(in, out, bufferSize); } catch (IOException e) { throw new UtilException(e); } finally { IoUtil.close(out); IoUtil.close(in); } }
java
public static void write(HttpServletResponse response, InputStream in, int bufferSize) { ServletOutputStream out = null; try { out = response.getOutputStream(); IoUtil.copy(in, out, bufferSize); } catch (IOException e) { throw new UtilException(e); } finally { IoUtil.close(out); IoUtil.close(in); } }
[ "public", "static", "void", "write", "(", "HttpServletResponse", "response", ",", "InputStream", "in", ",", "int", "bufferSize", ")", "{", "ServletOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "response", ".", "getOutputStream", "(", ")", ";", "IoUtil", ".", "copy", "(", "in", ",", "out", ",", "bufferSize", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "UtilException", "(", "e", ")", ";", "}", "finally", "{", "IoUtil", ".", "close", "(", "out", ")", ";", "IoUtil", ".", "close", "(", "in", ")", ";", "}", "}" ]
返回数据给客户端 @param response 响应对象{@link HttpServletResponse} @param in 需要返回客户端的内容 @param bufferSize 缓存大小
[ "返回数据给客户端" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L558-L569
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.createOrUpdateAsync
public Observable<ShareInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, ShareInner share) { """ Creates a new share or updates an existing share on the device. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @param share The share properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, share).map(new Func1<ServiceResponse<ShareInner>, ShareInner>() { @Override public ShareInner call(ServiceResponse<ShareInner> response) { return response.body(); } }); }
java
public Observable<ShareInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, ShareInner share) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, share).map(new Func1<ServiceResponse<ShareInner>, ShareInner>() { @Override public ShareInner call(ServiceResponse<ShareInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ShareInner", ">", "createOrUpdateAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "ShareInner", "share", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ",", "share", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ShareInner", ">", ",", "ShareInner", ">", "(", ")", "{", "@", "Override", "public", "ShareInner", "call", "(", "ServiceResponse", "<", "ShareInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a new share or updates an existing share on the device. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @param share The share properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "new", "share", "or", "updates", "an", "existing", "share", "on", "the", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java#L360-L367
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.truncate
public static DateTime truncate(Date date, DateField dateField) { """ 修改日期为某个时间字段起始时间 @param date {@link Date} @param dateField 时间字段 @return {@link DateTime} @since 4.5.7 """ return new DateTime(truncate(calendar(date), dateField)); }
java
public static DateTime truncate(Date date, DateField dateField) { return new DateTime(truncate(calendar(date), dateField)); }
[ "public", "static", "DateTime", "truncate", "(", "Date", "date", ",", "DateField", "dateField", ")", "{", "return", "new", "DateTime", "(", "truncate", "(", "calendar", "(", "date", ")", ",", "dateField", ")", ")", ";", "}" ]
修改日期为某个时间字段起始时间 @param date {@link Date} @param dateField 时间字段 @return {@link DateTime} @since 4.5.7
[ "修改日期为某个时间字段起始时间" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L755-L757
box/box-java-sdk
src/main/java/com/box/sdk/BoxMetadataFilter.java
BoxMetadataFilter.addNumberRangeFilter
public void addNumberRangeFilter(String key, SizeRange sizeRange) { """ Set a NumberRanger filter to the filter numbers, example: key=documentNumber, lt : 20, gt : 5. @param key the key that the filter should be looking for. @param sizeRange the specific value that corresponds to the key. """ JsonObject opObj = new JsonObject(); if (sizeRange.getLowerBoundBytes() != 0) { opObj.add("gt", sizeRange.getLowerBoundBytes()); } if (sizeRange.getUpperBoundBytes() != 0) { opObj.add("lt", sizeRange.getUpperBoundBytes()); } this.filtersList.add(key, opObj); }
java
public void addNumberRangeFilter(String key, SizeRange sizeRange) { JsonObject opObj = new JsonObject(); if (sizeRange.getLowerBoundBytes() != 0) { opObj.add("gt", sizeRange.getLowerBoundBytes()); } if (sizeRange.getUpperBoundBytes() != 0) { opObj.add("lt", sizeRange.getUpperBoundBytes()); } this.filtersList.add(key, opObj); }
[ "public", "void", "addNumberRangeFilter", "(", "String", "key", ",", "SizeRange", "sizeRange", ")", "{", "JsonObject", "opObj", "=", "new", "JsonObject", "(", ")", ";", "if", "(", "sizeRange", ".", "getLowerBoundBytes", "(", ")", "!=", "0", ")", "{", "opObj", ".", "add", "(", "\"gt\"", ",", "sizeRange", ".", "getLowerBoundBytes", "(", ")", ")", ";", "}", "if", "(", "sizeRange", ".", "getUpperBoundBytes", "(", ")", "!=", "0", ")", "{", "opObj", ".", "add", "(", "\"lt\"", ",", "sizeRange", ".", "getUpperBoundBytes", "(", ")", ")", ";", "}", "this", ".", "filtersList", ".", "add", "(", "key", ",", "opObj", ")", ";", "}" ]
Set a NumberRanger filter to the filter numbers, example: key=documentNumber, lt : 20, gt : 5. @param key the key that the filter should be looking for. @param sizeRange the specific value that corresponds to the key.
[ "Set", "a", "NumberRanger", "filter", "to", "the", "filter", "numbers", "example", ":", "key", "=", "documentNumber", "lt", ":", "20", "gt", ":", "5", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxMetadataFilter.java#L56-L67
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java
CheckLang.setActiveProjectProperty
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { """ Sets property in active ant project with name specified inpropertyName, and value specified in propertyValue parameter """ final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
java
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
[ "private", "void", "setActiveProjectProperty", "(", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ")", "{", "final", "Project", "activeProject", "=", "getProject", "(", ")", ";", "if", "(", "activeProject", "!=", "null", ")", "{", "activeProject", ".", "setProperty", "(", "propertyName", ",", "propertyValue", ")", ";", "}", "}" ]
Sets property in active ant project with name specified inpropertyName, and value specified in propertyValue parameter
[ "Sets", "property", "in", "active", "ant", "project", "with", "name", "specified", "inpropertyName", "and", "value", "specified", "in", "propertyValue", "parameter" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java#L123-L128
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.getAsync
public Observable<WebhookInner> getAsync(String resourceGroupName, String registryName, String webhookName) { """ Gets the properties of the specified webhook. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WebhookInner object """ return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
java
public Observable<WebhookInner> getAsync(String resourceGroupName, String registryName, String webhookName) { return getWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WebhookInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "webhookName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "webhookName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "WebhookInner", ">", ",", "WebhookInner", ">", "(", ")", "{", "@", "Override", "public", "WebhookInner", "call", "(", "ServiceResponse", "<", "WebhookInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the properties of the specified webhook. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WebhookInner object
[ "Gets", "the", "properties", "of", "the", "specified", "webhook", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L160-L167
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java
Context.getVisibleVariables
public Context getVisibleVariables() { """ Get all visible names from this Context, with more visible values overriding those below. @return A new Context with all visible names. """ Context visible = new Context(assistantFactory, location, title, null); if (outer != null) { visible.putAll(outer.getVisibleVariables()); } visible.putAll(this); // Overriding anything below here return visible; }
java
public Context getVisibleVariables() { Context visible = new Context(assistantFactory, location, title, null); if (outer != null) { visible.putAll(outer.getVisibleVariables()); } visible.putAll(this); // Overriding anything below here return visible; }
[ "public", "Context", "getVisibleVariables", "(", ")", "{", "Context", "visible", "=", "new", "Context", "(", "assistantFactory", ",", "location", ",", "title", ",", "null", ")", ";", "if", "(", "outer", "!=", "null", ")", "{", "visible", ".", "putAll", "(", "outer", ".", "getVisibleVariables", "(", ")", ")", ";", "}", "visible", ".", "putAll", "(", "this", ")", ";", "// Overriding anything below here", "return", "visible", ";", "}" ]
Get all visible names from this Context, with more visible values overriding those below. @return A new Context with all visible names.
[ "Get", "all", "visible", "names", "from", "this", "Context", "with", "more", "visible", "values", "overriding", "those", "below", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java#L235-L246
Stratio/bdt
src/main/java/com/stratio/qa/specs/KafkaSpec.java
KafkaSpec.checkNumberOfPartitions
@Then("^The number of partitions in topic '(.+?)' should be '(.+?)''?$") public void checkNumberOfPartitions(String topic_name, int numOfPartitions) throws Exception { """ Check that the number of partitions is like expected. @param topic_name Name of kafka topic @param numOfPartitions Number of partitions @throws Exception """ Assertions.assertThat(commonspec.getKafkaUtils().getPartitions(topic_name)).isEqualTo(numOfPartitions); }
java
@Then("^The number of partitions in topic '(.+?)' should be '(.+?)''?$") public void checkNumberOfPartitions(String topic_name, int numOfPartitions) throws Exception { Assertions.assertThat(commonspec.getKafkaUtils().getPartitions(topic_name)).isEqualTo(numOfPartitions); }
[ "@", "Then", "(", "\"^The number of partitions in topic '(.+?)' should be '(.+?)''?$\"", ")", "public", "void", "checkNumberOfPartitions", "(", "String", "topic_name", ",", "int", "numOfPartitions", ")", "throws", "Exception", "{", "Assertions", ".", "assertThat", "(", "commonspec", ".", "getKafkaUtils", "(", ")", ".", "getPartitions", "(", "topic_name", ")", ")", ".", "isEqualTo", "(", "numOfPartitions", ")", ";", "}" ]
Check that the number of partitions is like expected. @param topic_name Name of kafka topic @param numOfPartitions Number of partitions @throws Exception
[ "Check", "that", "the", "number", "of", "partitions", "is", "like", "expected", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/KafkaSpec.java#L140-L144
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java
JobScheduleOperations.existsJobSchedule
public boolean existsJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Checks whether the specified job schedule exists. @param jobScheduleId The ID of the job schedule which you want to check. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @return True if the specified job schedule exists; otherwise, false. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ JobScheduleExistsOptions options = new JobScheduleExistsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobSchedules().exists(jobScheduleId, options); }
java
public boolean existsJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobScheduleExistsOptions options = new JobScheduleExistsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobSchedules().exists(jobScheduleId, options); }
[ "public", "boolean", "existsJobSchedule", "(", "String", "jobScheduleId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "JobScheduleExistsOptions", "options", "=", "new", "JobScheduleExistsOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "return", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "jobSchedules", "(", ")", ".", "exists", "(", "jobScheduleId", ",", "options", ")", ";", "}" ]
Checks whether the specified job schedule exists. @param jobScheduleId The ID of the job schedule which you want to check. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @return True if the specified job schedule exists; otherwise, false. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Checks", "whether", "the", "specified", "job", "schedule", "exists", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L89-L95
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.updateTags
public VirtualNetworkGatewayConnectionListEntityInner updateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { """ Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayConnectionListEntityInner object if successful. """ return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().last().body(); }
java
public VirtualNetworkGatewayConnectionListEntityInner updateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().last().body(); }
[ "public", "VirtualNetworkGatewayConnectionListEntityInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayConnectionListEntityInner object if successful.
[ "Updates", "a", "virtual", "network", "gateway", "connection", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L611-L613
threerings/nenya
core/src/main/java/com/threerings/media/FrameManager.java
FrameManager.getRoot
public static Component getRoot (Component comp, Rectangle rect) { """ Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer. Along the way, it adjusts the supplied component-relative rectangle to be relative to the returned root component. """ for (Component c = comp; c != null; c = c.getParent()) { if (!c.isVisible() || !c.isDisplayable()) { return null; } if (c instanceof Window || c instanceof Applet) { return c; } rect.x += c.getX(); rect.y += c.getY(); } return null; }
java
public static Component getRoot (Component comp, Rectangle rect) { for (Component c = comp; c != null; c = c.getParent()) { if (!c.isVisible() || !c.isDisplayable()) { return null; } if (c instanceof Window || c instanceof Applet) { return c; } rect.x += c.getX(); rect.y += c.getY(); } return null; }
[ "public", "static", "Component", "getRoot", "(", "Component", "comp", ",", "Rectangle", "rect", ")", "{", "for", "(", "Component", "c", "=", "comp", ";", "c", "!=", "null", ";", "c", "=", "c", ".", "getParent", "(", ")", ")", "{", "if", "(", "!", "c", ".", "isVisible", "(", ")", "||", "!", "c", ".", "isDisplayable", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "c", "instanceof", "Window", "||", "c", "instanceof", "Applet", ")", "{", "return", "c", ";", "}", "rect", ".", "x", "+=", "c", ".", "getX", "(", ")", ";", "rect", ".", "y", "+=", "c", ".", "getY", "(", ")", ";", "}", "return", "null", ";", "}" ]
Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer. Along the way, it adjusts the supplied component-relative rectangle to be relative to the returned root component.
[ "Returns", "the", "root", "component", "for", "the", "supplied", "component", "or", "null", "if", "it", "is", "not", "part", "of", "a", "rooted", "hierarchy", "or", "if", "any", "parent", "along", "the", "way", "is", "found", "to", "be", "hidden", "or", "without", "a", "peer", ".", "Along", "the", "way", "it", "adjusts", "the", "supplied", "component", "-", "relative", "rectangle", "to", "be", "relative", "to", "the", "returned", "root", "component", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L343-L356
js-lib-com/commons
src/main/java/js/util/Params.java
Params.notNull
public static void notNull(Object parameter, String name, Object... args) throws IllegalArgumentException { """ Throw exception if parameter is null. Name parameter can be formatted as accepted by {@link String#format(String, Object...)}. @param parameter invocation parameter to test, @param name parameter name used on exception message, @param args optional arguments if name is formatted. @throws IllegalArgumentException if <code>parameter</code> is null. """ if (parameter == null) { throw new IllegalArgumentException(String.format(name, args) + " parameter is null."); } }
java
public static void notNull(Object parameter, String name, Object... args) throws IllegalArgumentException { if (parameter == null) { throw new IllegalArgumentException(String.format(name, args) + " parameter is null."); } }
[ "public", "static", "void", "notNull", "(", "Object", "parameter", ",", "String", "name", ",", "Object", "...", "args", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "name", ",", "args", ")", "+", "\" parameter is null.\"", ")", ";", "}", "}" ]
Throw exception if parameter is null. Name parameter can be formatted as accepted by {@link String#format(String, Object...)}. @param parameter invocation parameter to test, @param name parameter name used on exception message, @param args optional arguments if name is formatted. @throws IllegalArgumentException if <code>parameter</code> is null.
[ "Throw", "exception", "if", "parameter", "is", "null", ".", "Name", "parameter", "can", "be", "formatted", "as", "accepted", "by", "{", "@link", "String#format", "(", "String", "Object", "...", ")", "}", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L42-L46
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/journal/EventJournalReadOperation.java
EventJournalReadOperation.clampToBounds
private long clampToBounds(EventJournal<J> journal, int partitionId, long requestedSequence) { """ Checks if the provided {@code requestedSequence} is within bounds of the oldest and newest sequence in the event journal. If the {@code requestedSequence} is too old or too new, it will return the current oldest or newest journal sequence. This method can be used for a loss-tolerant reader when trying to avoid a {@link com.hazelcast.ringbuffer.StaleSequenceException}. @param journal the event journal @param partitionId the partition ID to read @param requestedSequence the requested sequence to read @return the bounded journal sequence """ final long oldestSequence = journal.oldestSequence(namespace, partitionId); final long newestSequence = journal.newestSequence(namespace, partitionId); // fast forward if late and no store is configured if (requestedSequence < oldestSequence && !journal.isPersistenceEnabled(namespace, partitionId)) { return oldestSequence; } // jump back if too far in future if (requestedSequence > newestSequence + 1) { return newestSequence + 1; } return requestedSequence; }
java
private long clampToBounds(EventJournal<J> journal, int partitionId, long requestedSequence) { final long oldestSequence = journal.oldestSequence(namespace, partitionId); final long newestSequence = journal.newestSequence(namespace, partitionId); // fast forward if late and no store is configured if (requestedSequence < oldestSequence && !journal.isPersistenceEnabled(namespace, partitionId)) { return oldestSequence; } // jump back if too far in future if (requestedSequence > newestSequence + 1) { return newestSequence + 1; } return requestedSequence; }
[ "private", "long", "clampToBounds", "(", "EventJournal", "<", "J", ">", "journal", ",", "int", "partitionId", ",", "long", "requestedSequence", ")", "{", "final", "long", "oldestSequence", "=", "journal", ".", "oldestSequence", "(", "namespace", ",", "partitionId", ")", ";", "final", "long", "newestSequence", "=", "journal", ".", "newestSequence", "(", "namespace", ",", "partitionId", ")", ";", "// fast forward if late and no store is configured", "if", "(", "requestedSequence", "<", "oldestSequence", "&&", "!", "journal", ".", "isPersistenceEnabled", "(", "namespace", ",", "partitionId", ")", ")", "{", "return", "oldestSequence", ";", "}", "// jump back if too far in future", "if", "(", "requestedSequence", ">", "newestSequence", "+", "1", ")", "{", "return", "newestSequence", "+", "1", ";", "}", "return", "requestedSequence", ";", "}" ]
Checks if the provided {@code requestedSequence} is within bounds of the oldest and newest sequence in the event journal. If the {@code requestedSequence} is too old or too new, it will return the current oldest or newest journal sequence. This method can be used for a loss-tolerant reader when trying to avoid a {@link com.hazelcast.ringbuffer.StaleSequenceException}. @param journal the event journal @param partitionId the partition ID to read @param requestedSequence the requested sequence to read @return the bounded journal sequence
[ "Checks", "if", "the", "provided", "{", "@code", "requestedSequence", "}", "is", "within", "bounds", "of", "the", "oldest", "and", "newest", "sequence", "in", "the", "event", "journal", ".", "If", "the", "{", "@code", "requestedSequence", "}", "is", "too", "old", "or", "too", "new", "it", "will", "return", "the", "current", "oldest", "or", "newest", "journal", "sequence", ".", "This", "method", "can", "be", "used", "for", "a", "loss", "-", "tolerant", "reader", "when", "trying", "to", "avoid", "a", "{", "@link", "com", ".", "hazelcast", ".", "ringbuffer", ".", "StaleSequenceException", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/journal/EventJournalReadOperation.java#L201-L215
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/support/RegisteredServiceRegexAttributeFilter.java
RegisteredServiceRegexAttributeFilter.filterAttributes
private List filterAttributes(final List<Object> valuesToFilter, final String attributeName) { """ Filter array attributes. @param valuesToFilter the values to filter @param attributeName the attribute name @return the string[] """ return valuesToFilter .stream() .filter(this::patternMatchesAttributeValue) .peek(attributeValue -> logReleasedAttributeEntry(attributeName, attributeValue)) .collect(Collectors.toList()); }
java
private List filterAttributes(final List<Object> valuesToFilter, final String attributeName) { return valuesToFilter .stream() .filter(this::patternMatchesAttributeValue) .peek(attributeValue -> logReleasedAttributeEntry(attributeName, attributeValue)) .collect(Collectors.toList()); }
[ "private", "List", "filterAttributes", "(", "final", "List", "<", "Object", ">", "valuesToFilter", ",", "final", "String", "attributeName", ")", "{", "return", "valuesToFilter", ".", "stream", "(", ")", ".", "filter", "(", "this", "::", "patternMatchesAttributeValue", ")", ".", "peek", "(", "attributeValue", "->", "logReleasedAttributeEntry", "(", "attributeName", ",", "attributeValue", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Filter array attributes. @param valuesToFilter the values to filter @param attributeName the attribute name @return the string[]
[ "Filter", "array", "attributes", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/support/RegisteredServiceRegexAttributeFilter.java#L107-L113
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java
ClassReflectionIndexUtil.findMethod
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) { """ Finds and returns a method corresponding to the passed <code>methodIdentifier</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns null if no such method is found @param deploymentReflectionIndex The deployment reflection index @param clazz The class reflection index which will be used to traverse the class hierarchy to find the method @param methodIdentifier The method identifier of the method being searched for @return """ Class<?> c = clazz; List<Class<?>> interfaces = new ArrayList<>(); while (c != null) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(c); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } addInterfaces(c, interfaces); c = c.getSuperclass(); } for(Class<?> i : interfaces) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(i); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } } return null; }
java
public static Method findMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final MethodIdentifier methodIdentifier) { Class<?> c = clazz; List<Class<?>> interfaces = new ArrayList<>(); while (c != null) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(c); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } addInterfaces(c, interfaces); c = c.getSuperclass(); } for(Class<?> i : interfaces) { final ClassReflectionIndex index = deploymentReflectionIndex.getClassIndex(i); final Method method = index.getMethod(methodIdentifier); if(method != null) { return method; } } return null; }
[ "public", "static", "Method", "findMethod", "(", "final", "DeploymentReflectionIndex", "deploymentReflectionIndex", ",", "final", "Class", "<", "?", ">", "clazz", ",", "final", "MethodIdentifier", "methodIdentifier", ")", "{", "Class", "<", "?", ">", "c", "=", "clazz", ";", "List", "<", "Class", "<", "?", ">", ">", "interfaces", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "c", "!=", "null", ")", "{", "final", "ClassReflectionIndex", "index", "=", "deploymentReflectionIndex", ".", "getClassIndex", "(", "c", ")", ";", "final", "Method", "method", "=", "index", ".", "getMethod", "(", "methodIdentifier", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "return", "method", ";", "}", "addInterfaces", "(", "c", ",", "interfaces", ")", ";", "c", "=", "c", ".", "getSuperclass", "(", ")", ";", "}", "for", "(", "Class", "<", "?", ">", "i", ":", "interfaces", ")", "{", "final", "ClassReflectionIndex", "index", "=", "deploymentReflectionIndex", ".", "getClassIndex", "(", "i", ")", ";", "final", "Method", "method", "=", "index", ".", "getMethod", "(", "methodIdentifier", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "return", "method", ";", "}", "}", "return", "null", ";", "}" ]
Finds and returns a method corresponding to the passed <code>methodIdentifier</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns null if no such method is found @param deploymentReflectionIndex The deployment reflection index @param clazz The class reflection index which will be used to traverse the class hierarchy to find the method @param methodIdentifier The method identifier of the method being searched for @return
[ "Finds", "and", "returns", "a", "method", "corresponding", "to", "the", "passed", "<code", ">", "methodIdentifier<", "/", "code", ">", ".", "The", "passed", "<code", ">", "classReflectionIndex<", "/", "code", ">", "will", "be", "used", "to", "traverse", "the", "class", "hierarchy", "while", "finding", "the", "method", ".", "<p", "/", ">", "Returns", "null", "if", "no", "such", "method", "is", "found" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L53-L73
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.variableInitializer
public static Matcher<VariableTree> variableInitializer( final Matcher<ExpressionTree> expressionTreeMatcher) { """ Matches on the initializer of a VariableTree AST node. @param expressionTreeMatcher A matcher on the initializer of the variable. """ return new Matcher<VariableTree>() { @Override public boolean matches(VariableTree variableTree, VisitorState state) { ExpressionTree initializer = variableTree.getInitializer(); return initializer == null ? false : expressionTreeMatcher.matches(initializer, state); } }; }
java
public static Matcher<VariableTree> variableInitializer( final Matcher<ExpressionTree> expressionTreeMatcher) { return new Matcher<VariableTree>() { @Override public boolean matches(VariableTree variableTree, VisitorState state) { ExpressionTree initializer = variableTree.getInitializer(); return initializer == null ? false : expressionTreeMatcher.matches(initializer, state); } }; }
[ "public", "static", "Matcher", "<", "VariableTree", ">", "variableInitializer", "(", "final", "Matcher", "<", "ExpressionTree", ">", "expressionTreeMatcher", ")", "{", "return", "new", "Matcher", "<", "VariableTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "VariableTree", "variableTree", ",", "VisitorState", "state", ")", "{", "ExpressionTree", "initializer", "=", "variableTree", ".", "getInitializer", "(", ")", ";", "return", "initializer", "==", "null", "?", "false", ":", "expressionTreeMatcher", ".", "matches", "(", "initializer", ",", "state", ")", ";", "}", "}", ";", "}" ]
Matches on the initializer of a VariableTree AST node. @param expressionTreeMatcher A matcher on the initializer of the variable.
[ "Matches", "on", "the", "initializer", "of", "a", "VariableTree", "AST", "node", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1084-L1093
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.beginCreateOrUpdateAsync
public Observable<FailoverGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { """ Creates or updates a failover group. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @param parameters The failover group parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FailoverGroupInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
java
public Observable<FailoverGroupInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FailoverGroupInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "failoverGroupName", ",", "FailoverGroupInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "failoverGroupName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "FailoverGroupInner", ">", ",", "FailoverGroupInner", ">", "(", ")", "{", "@", "Override", "public", "FailoverGroupInner", "call", "(", "ServiceResponse", "<", "FailoverGroupInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a failover group. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @param parameters The failover group parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FailoverGroupInner object
[ "Creates", "or", "updates", "a", "failover", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L339-L346
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/utils/Base64.java
Base64.decode4to3
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) { """ Decodes four bytes from array <var>source</var> and writes the resulting bytes (up to three of them) to <var>destination</var>. The source and destination arrays can be manipulated anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>. This method does not check to make sure your arrays are large enough to accomodate <var>srcOffset</var> + 4 for the <var>source</var> array or <var>destOffset</var> + 3 for the <var>destination</var> array. This method returns the actual number of bytes that were converted from the Base64 encoding. @param source the array to convert @param srcOffset the index where conversion begins @param destination the array to hold the conversion @param destOffset the index where output will be put @return the number of decoded bytes converted @since 1.3 """ // Example: Dk== if (source[srcOffset + 2] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12); destination[destOffset] = (byte)(outBuff >>> 16); return 1; } // Example: DkL= else if (source[srcOffset + 3] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6); destination[destOffset] = (byte)(outBuff >>> 16); destination[destOffset + 1] = (byte)(outBuff >>> 8); return 2; } // Example: DkLE else { try { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ) // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) | ((DECODABET[source[srcOffset + 3]] & 0xFF)); destination[destOffset] = (byte)(outBuff >> 16); destination[destOffset + 1] = (byte)(outBuff >> 8); destination[destOffset + 2] = (byte)(outBuff); return 3; } catch (Exception e) { log.error("" + source[srcOffset] + ": " + (DECODABET[source[srcOffset]])); log.error("" + source[srcOffset + 1] + ": " + (DECODABET[source[srcOffset + 1]])); log.error("" + source[srcOffset + 2] + ": " + (DECODABET[source[srcOffset + 2]])); log.error("" + source[srcOffset + 3] + ": " + (DECODABET[source[srcOffset + 3]])); return -1; } //end catch } }
java
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) { // Example: Dk== if (source[srcOffset + 2] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12); destination[destOffset] = (byte)(outBuff >>> 16); return 1; } // Example: DkL= else if (source[srcOffset + 3] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6); destination[destOffset] = (byte)(outBuff >>> 16); destination[destOffset + 1] = (byte)(outBuff >>> 8); return 2; } // Example: DkLE else { try { // Two ways to do the same thing. Don't know which way I like best. //int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ) // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) | ((DECODABET[source[srcOffset + 3]] & 0xFF)); destination[destOffset] = (byte)(outBuff >> 16); destination[destOffset + 1] = (byte)(outBuff >> 8); destination[destOffset + 2] = (byte)(outBuff); return 3; } catch (Exception e) { log.error("" + source[srcOffset] + ": " + (DECODABET[source[srcOffset]])); log.error("" + source[srcOffset + 1] + ": " + (DECODABET[source[srcOffset + 1]])); log.error("" + source[srcOffset + 2] + ": " + (DECODABET[source[srcOffset + 2]])); log.error("" + source[srcOffset + 3] + ": " + (DECODABET[source[srcOffset + 3]])); return -1; } //end catch } }
[ "private", "static", "int", "decode4to3", "(", "byte", "[", "]", "source", ",", "int", "srcOffset", ",", "byte", "[", "]", "destination", ",", "int", "destOffset", ")", "{", "// Example: Dk==", "if", "(", "source", "[", "srcOffset", "+", "2", "]", "==", "EQUALS_SIGN", ")", "{", "// Two ways to do the same thing. Don't know which way I like best.", "//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )", "// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );", "int", "outBuff", "=", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "]", "]", "&", "0xFF", ")", "<<", "18", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "1", "]", "]", "&", "0xFF", ")", "<<", "12", ")", ";", "destination", "[", "destOffset", "]", "=", "(", "byte", ")", "(", "outBuff", ">>>", "16", ")", ";", "return", "1", ";", "}", "// Example: DkL=", "else", "if", "(", "source", "[", "srcOffset", "+", "3", "]", "==", "EQUALS_SIGN", ")", "{", "// Two ways to do the same thing. Don't know which way I like best.", "//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )", "// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )", "// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );", "int", "outBuff", "=", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "]", "]", "&", "0xFF", ")", "<<", "18", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "1", "]", "]", "&", "0xFF", ")", "<<", "12", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "2", "]", "]", "&", "0xFF", ")", "<<", "6", ")", ";", "destination", "[", "destOffset", "]", "=", "(", "byte", ")", "(", "outBuff", ">>>", "16", ")", ";", "destination", "[", "destOffset", "+", "1", "]", "=", "(", "byte", ")", "(", "outBuff", ">>>", "8", ")", ";", "return", "2", ";", "}", "// Example: DkLE", "else", "{", "try", "{", "// Two ways to do the same thing. Don't know which way I like best.", "//int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )", "// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )", "// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )", "// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );", "int", "outBuff", "=", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "]", "]", "&", "0xFF", ")", "<<", "18", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "1", "]", "]", "&", "0xFF", ")", "<<", "12", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "2", "]", "]", "&", "0xFF", ")", "<<", "6", ")", "|", "(", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "3", "]", "]", "&", "0xFF", ")", ")", ";", "destination", "[", "destOffset", "]", "=", "(", "byte", ")", "(", "outBuff", ">>", "16", ")", ";", "destination", "[", "destOffset", "+", "1", "]", "=", "(", "byte", ")", "(", "outBuff", ">>", "8", ")", ";", "destination", "[", "destOffset", "+", "2", "]", "=", "(", "byte", ")", "(", "outBuff", ")", ";", "return", "3", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"\"", "+", "source", "[", "srcOffset", "]", "+", "\": \"", "+", "(", "DECODABET", "[", "source", "[", "srcOffset", "]", "]", ")", ")", ";", "log", ".", "error", "(", "\"\"", "+", "source", "[", "srcOffset", "+", "1", "]", "+", "\": \"", "+", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "1", "]", "]", ")", ")", ";", "log", ".", "error", "(", "\"\"", "+", "source", "[", "srcOffset", "+", "2", "]", "+", "\": \"", "+", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "2", "]", "]", ")", ")", ";", "log", ".", "error", "(", "\"\"", "+", "source", "[", "srcOffset", "+", "3", "]", "+", "\": \"", "+", "(", "DECODABET", "[", "source", "[", "srcOffset", "+", "3", "]", "]", ")", ")", ";", "return", "-", "1", ";", "}", "//end catch", "}", "}" ]
Decodes four bytes from array <var>source</var> and writes the resulting bytes (up to three of them) to <var>destination</var>. The source and destination arrays can be manipulated anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>. This method does not check to make sure your arrays are large enough to accomodate <var>srcOffset</var> + 4 for the <var>source</var> array or <var>destOffset</var> + 3 for the <var>destination</var> array. This method returns the actual number of bytes that were converted from the Base64 encoding. @param source the array to convert @param srcOffset the index where conversion begins @param destination the array to hold the conversion @param destOffset the index where output will be put @return the number of decoded bytes converted @since 1.3
[ "Decodes", "four", "bytes", "from", "array", "<var", ">", "source<", "/", "var", ">", "and", "writes", "the", "resulting", "bytes", "(", "up", "to", "three", "of", "them", ")", "to", "<var", ">", "destination<", "/", "var", ">", ".", "The", "source", "and", "destination", "arrays", "can", "be", "manipulated", "anywhere", "along", "their", "length", "by", "specifying", "<var", ">", "srcOffset<", "/", "var", ">", "and", "<var", ">", "destOffset<", "/", "var", ">", ".", "This", "method", "does", "not", "check", "to", "make", "sure", "your", "arrays", "are", "large", "enough", "to", "accomodate", "<var", ">", "srcOffset<", "/", "var", ">", "+", "4", "for", "the", "<var", ">", "source<", "/", "var", ">", "array", "or", "<var", ">", "destOffset<", "/", "var", ">", "+", "3", "for", "the", "<var", ">", "destination<", "/", "var", ">", "array", ".", "This", "method", "returns", "the", "actual", "number", "of", "bytes", "that", "were", "converted", "from", "the", "Base64", "encoding", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/utils/Base64.java#L599-L656
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java
SheetRowResourcesImpl.moveRows
public CopyOrMoveRowResult moveRows(Long sheetId, EnumSet<RowMoveInclusion> includes, Boolean ignoreRowsNotFound, CopyOrMoveRowDirective moveParameters) throws SmartsheetException { """ Moves Row(s) from the Sheet specified in the URL to (the bottom of) another sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/move Exceptions: IllegalArgumentException : if any argument is null, or path is empty string InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the sheet ID to move @param includes the parameters to include @param ignoreRowsNotFound optional,specifying row Ids that do not exist within the source sheet @param moveParameters CopyOrMoveRowDirective object @return the result object @throws SmartsheetException the smartsheet exception """ String path = "sheets/" + sheetId +"/rows/move"; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); if (ignoreRowsNotFound != null){ parameters.put("ignoreRowsNotFound", ignoreRowsNotFound.toString()); } path += QueryUtil.generateUrl(null, parameters); return this.postAndReceiveRowObject(path, moveParameters); }
java
public CopyOrMoveRowResult moveRows(Long sheetId, EnumSet<RowMoveInclusion> includes, Boolean ignoreRowsNotFound, CopyOrMoveRowDirective moveParameters) throws SmartsheetException { String path = "sheets/" + sheetId +"/rows/move"; HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("include", QueryUtil.generateCommaSeparatedList(includes)); if (ignoreRowsNotFound != null){ parameters.put("ignoreRowsNotFound", ignoreRowsNotFound.toString()); } path += QueryUtil.generateUrl(null, parameters); return this.postAndReceiveRowObject(path, moveParameters); }
[ "public", "CopyOrMoveRowResult", "moveRows", "(", "Long", "sheetId", ",", "EnumSet", "<", "RowMoveInclusion", ">", "includes", ",", "Boolean", "ignoreRowsNotFound", ",", "CopyOrMoveRowDirective", "moveParameters", ")", "throws", "SmartsheetException", "{", "String", "path", "=", "\"sheets/\"", "+", "sheetId", "+", "\"/rows/move\"", ";", "HashMap", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"include\"", ",", "QueryUtil", ".", "generateCommaSeparatedList", "(", "includes", ")", ")", ";", "if", "(", "ignoreRowsNotFound", "!=", "null", ")", "{", "parameters", ".", "put", "(", "\"ignoreRowsNotFound\"", ",", "ignoreRowsNotFound", ".", "toString", "(", ")", ")", ";", "}", "path", "+=", "QueryUtil", ".", "generateUrl", "(", "null", ",", "parameters", ")", ";", "return", "this", ".", "postAndReceiveRowObject", "(", "path", ",", "moveParameters", ")", ";", "}" ]
Moves Row(s) from the Sheet specified in the URL to (the bottom of) another sheet. It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/move Exceptions: IllegalArgumentException : if any argument is null, or path is empty string InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the sheet ID to move @param includes the parameters to include @param ignoreRowsNotFound optional,specifying row Ids that do not exist within the source sheet @param moveParameters CopyOrMoveRowDirective object @return the result object @throws SmartsheetException the smartsheet exception
[ "Moves", "Row", "(", "s", ")", "from", "the", "Sheet", "specified", "in", "the", "URL", "to", "(", "the", "bottom", "of", ")", "another", "sheet", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L323-L334
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java
TimeSeriesUtils.reverseTimeSeries
public static INDArray reverseTimeSeries(INDArray in, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType) { """ Reverse an input time series along the time dimension @param in Input activations to reverse, with shape [minibatch, size, timeSeriesLength] @return Reversed activations """ if(in == null){ return null; } if(in.ordering() != 'f' || in.isView() || !Shape.strideDescendingCAscendingF(in)){ in = workspaceMgr.dup(arrayType, in, 'f'); } // FIXME: int cast int[] idxs = new int[(int) in.size(2)]; int j=0; for( int i=idxs.length-1; i>=0; i--){ idxs[j++] = i; } INDArray inReshape = in.reshape('f', in.size(0)*in.size(1), in.size(2)); INDArray outReshape = workspaceMgr.create(arrayType, in.dataType(), new long[]{inReshape.size(0), idxs.length}, 'f'); Nd4j.pullRows(inReshape, outReshape, 0, idxs); return workspaceMgr.leverageTo(arrayType, outReshape.reshape('f', in.size(0), in.size(1), in.size(2))); /* INDArray out = Nd4j.createUninitialized(in.shape(), 'f'); CustomOp op = DynamicCustomOp.builder("reverse") .addIntegerArguments(new int[]{0,1}) .addInputs(in) .addOutputs(out) .callInplace(false) .build(); Nd4j.getExecutioner().exec(op); return out; */ }
java
public static INDArray reverseTimeSeries(INDArray in, LayerWorkspaceMgr workspaceMgr, ArrayType arrayType){ if(in == null){ return null; } if(in.ordering() != 'f' || in.isView() || !Shape.strideDescendingCAscendingF(in)){ in = workspaceMgr.dup(arrayType, in, 'f'); } // FIXME: int cast int[] idxs = new int[(int) in.size(2)]; int j=0; for( int i=idxs.length-1; i>=0; i--){ idxs[j++] = i; } INDArray inReshape = in.reshape('f', in.size(0)*in.size(1), in.size(2)); INDArray outReshape = workspaceMgr.create(arrayType, in.dataType(), new long[]{inReshape.size(0), idxs.length}, 'f'); Nd4j.pullRows(inReshape, outReshape, 0, idxs); return workspaceMgr.leverageTo(arrayType, outReshape.reshape('f', in.size(0), in.size(1), in.size(2))); /* INDArray out = Nd4j.createUninitialized(in.shape(), 'f'); CustomOp op = DynamicCustomOp.builder("reverse") .addIntegerArguments(new int[]{0,1}) .addInputs(in) .addOutputs(out) .callInplace(false) .build(); Nd4j.getExecutioner().exec(op); return out; */ }
[ "public", "static", "INDArray", "reverseTimeSeries", "(", "INDArray", "in", ",", "LayerWorkspaceMgr", "workspaceMgr", ",", "ArrayType", "arrayType", ")", "{", "if", "(", "in", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "in", ".", "ordering", "(", ")", "!=", "'", "'", "||", "in", ".", "isView", "(", ")", "||", "!", "Shape", ".", "strideDescendingCAscendingF", "(", "in", ")", ")", "{", "in", "=", "workspaceMgr", ".", "dup", "(", "arrayType", ",", "in", ",", "'", "'", ")", ";", "}", "// FIXME: int cast", "int", "[", "]", "idxs", "=", "new", "int", "[", "(", "int", ")", "in", ".", "size", "(", "2", ")", "]", ";", "int", "j", "=", "0", ";", "for", "(", "int", "i", "=", "idxs", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "idxs", "[", "j", "++", "]", "=", "i", ";", "}", "INDArray", "inReshape", "=", "in", ".", "reshape", "(", "'", "'", ",", "in", ".", "size", "(", "0", ")", "*", "in", ".", "size", "(", "1", ")", ",", "in", ".", "size", "(", "2", ")", ")", ";", "INDArray", "outReshape", "=", "workspaceMgr", ".", "create", "(", "arrayType", ",", "in", ".", "dataType", "(", ")", ",", "new", "long", "[", "]", "{", "inReshape", ".", "size", "(", "0", ")", ",", "idxs", ".", "length", "}", ",", "'", "'", ")", ";", "Nd4j", ".", "pullRows", "(", "inReshape", ",", "outReshape", ",", "0", ",", "idxs", ")", ";", "return", "workspaceMgr", ".", "leverageTo", "(", "arrayType", ",", "outReshape", ".", "reshape", "(", "'", "'", ",", "in", ".", "size", "(", "0", ")", ",", "in", ".", "size", "(", "1", ")", ",", "in", ".", "size", "(", "2", ")", ")", ")", ";", "/*\n INDArray out = Nd4j.createUninitialized(in.shape(), 'f');\n CustomOp op = DynamicCustomOp.builder(\"reverse\")\n .addIntegerArguments(new int[]{0,1})\n .addInputs(in)\n .addOutputs(out)\n .callInplace(false)\n .build();\n Nd4j.getExecutioner().exec(op);\n return out;\n */", "}" ]
Reverse an input time series along the time dimension @param in Input activations to reverse, with shape [minibatch, size, timeSeriesLength] @return Reversed activations
[ "Reverse", "an", "input", "time", "series", "along", "the", "time", "dimension" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L242-L275
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java
ChannelFactoryDataImpl.setProperty
synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException { """ Iternally set a property associated with this object @param key @param value @throws ChannelFactoryPropertyIgnoredException """ if (null == key) { throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null"); } if (myProperties == null) { this.myProperties = new HashMap<Object, Object>(); } this.myProperties.put(key, value); if (cf != null) { cf.updateProperties(myProperties); } }
java
synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException { if (null == key) { throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null"); } if (myProperties == null) { this.myProperties = new HashMap<Object, Object>(); } this.myProperties.put(key, value); if (cf != null) { cf.updateProperties(myProperties); } }
[ "synchronized", "void", "setProperty", "(", "Object", "key", ",", "Object", "value", ")", "throws", "ChannelFactoryPropertyIgnoredException", "{", "if", "(", "null", "==", "key", ")", "{", "throw", "new", "ChannelFactoryPropertyIgnoredException", "(", "\"Ignored channel factory property key of null\"", ")", ";", "}", "if", "(", "myProperties", "==", "null", ")", "{", "this", ".", "myProperties", "=", "new", "HashMap", "<", "Object", ",", "Object", ">", "(", ")", ";", "}", "this", ".", "myProperties", ".", "put", "(", "key", ",", "value", ")", ";", "if", "(", "cf", "!=", "null", ")", "{", "cf", ".", "updateProperties", "(", "myProperties", ")", ";", "}", "}" ]
Iternally set a property associated with this object @param key @param value @throws ChannelFactoryPropertyIgnoredException
[ "Iternally", "set", "a", "property", "associated", "with", "this", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java#L119-L130
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.endsWith
public static boolean endsWith(CharSequence s, char c) { """ Determine if the string {@code s} ends with the char {@code c}. @param s the string to test @param c the tested char @return true if {@code s} ends with the char {@code c} """ int len = s.length(); return len > 0 && s.charAt(len - 1) == c; }
java
public static boolean endsWith(CharSequence s, char c) { int len = s.length(); return len > 0 && s.charAt(len - 1) == c; }
[ "public", "static", "boolean", "endsWith", "(", "CharSequence", "s", ",", "char", "c", ")", "{", "int", "len", "=", "s", ".", "length", "(", ")", ";", "return", "len", ">", "0", "&&", "s", ".", "charAt", "(", "len", "-", "1", ")", "==", "c", ";", "}" ]
Determine if the string {@code s} ends with the char {@code c}. @param s the string to test @param c the tested char @return true if {@code s} ends with the char {@code c}
[ "Determine", "if", "the", "string", "{", "@code", "s", "}", "ends", "with", "the", "char", "{", "@code", "c", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L578-L581
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/ConnectLinesGrid.java
ConnectLinesGrid.findBestCompatible
private int findBestCompatible( LineSegment2D_F32 target , List<LineSegment2D_F32> candidates , int start ) { """ Searches for a line in the list which the target is compatible with and can be connected to. @param target Line being connected to. @param candidates List of candidate lines. @param start First index in the candidate list it should start searching at. @return Index of the candidate it can connect to. -1 if there is no match. """ int bestIndex = -1; double bestDistance = Double.MAX_VALUE; int bestFarthest = 0; float targetAngle = UtilAngle.atanSafe(target.slopeY(),target.slopeX()); float cos = (float)Math.cos(targetAngle); float sin = (float)Math.sin(targetAngle); for( int i = start; i < candidates.size(); i++ ) { LineSegment2D_F32 c = candidates.get(i); float angle = UtilAngle.atanSafe(c.slopeY(),c.slopeX()); // see if the two lines have the same slope if( UtilAngle.distHalf(targetAngle,angle) > lineSlopeAngleTol ) continue; // see the distance the two lines are apart and if it could be the best line closestFarthestPoints(target, c); // two closest end points Point2D_F32 pt0 = closestIndex < 2 ? target.a : target.b; Point2D_F32 pt1 = (closestIndex %2) == 0 ? c.a : c.b; float xx = pt1.x-pt0.x; float yy = pt1.y-pt0.y; float distX = Math.abs(cos*xx - sin*yy); float distY = Math.abs(cos*yy + sin*xx); if( distX >= bestDistance || distX > parallelTol || distY > tangentTol ) continue; // check the angle of the combined line pt0 = farthestIndex < 2 ? target.a : target.b; pt1 = (farthestIndex %2) == 0 ? c.a : c.b; float angleCombined = UtilAngle.atanSafe(pt1.y-pt0.y,pt1.x-pt0.x); if( UtilAngle.distHalf(targetAngle,angleCombined) <= lineSlopeAngleTol ) { bestDistance = distX; bestIndex = i; bestFarthest = farthestIndex; } } if( bestDistance < parallelTol) { farthestIndex = bestFarthest; return bestIndex; } return -1; }
java
private int findBestCompatible( LineSegment2D_F32 target , List<LineSegment2D_F32> candidates , int start ) { int bestIndex = -1; double bestDistance = Double.MAX_VALUE; int bestFarthest = 0; float targetAngle = UtilAngle.atanSafe(target.slopeY(),target.slopeX()); float cos = (float)Math.cos(targetAngle); float sin = (float)Math.sin(targetAngle); for( int i = start; i < candidates.size(); i++ ) { LineSegment2D_F32 c = candidates.get(i); float angle = UtilAngle.atanSafe(c.slopeY(),c.slopeX()); // see if the two lines have the same slope if( UtilAngle.distHalf(targetAngle,angle) > lineSlopeAngleTol ) continue; // see the distance the two lines are apart and if it could be the best line closestFarthestPoints(target, c); // two closest end points Point2D_F32 pt0 = closestIndex < 2 ? target.a : target.b; Point2D_F32 pt1 = (closestIndex %2) == 0 ? c.a : c.b; float xx = pt1.x-pt0.x; float yy = pt1.y-pt0.y; float distX = Math.abs(cos*xx - sin*yy); float distY = Math.abs(cos*yy + sin*xx); if( distX >= bestDistance || distX > parallelTol || distY > tangentTol ) continue; // check the angle of the combined line pt0 = farthestIndex < 2 ? target.a : target.b; pt1 = (farthestIndex %2) == 0 ? c.a : c.b; float angleCombined = UtilAngle.atanSafe(pt1.y-pt0.y,pt1.x-pt0.x); if( UtilAngle.distHalf(targetAngle,angleCombined) <= lineSlopeAngleTol ) { bestDistance = distX; bestIndex = i; bestFarthest = farthestIndex; } } if( bestDistance < parallelTol) { farthestIndex = bestFarthest; return bestIndex; } return -1; }
[ "private", "int", "findBestCompatible", "(", "LineSegment2D_F32", "target", ",", "List", "<", "LineSegment2D_F32", ">", "candidates", ",", "int", "start", ")", "{", "int", "bestIndex", "=", "-", "1", ";", "double", "bestDistance", "=", "Double", ".", "MAX_VALUE", ";", "int", "bestFarthest", "=", "0", ";", "float", "targetAngle", "=", "UtilAngle", ".", "atanSafe", "(", "target", ".", "slopeY", "(", ")", ",", "target", ".", "slopeX", "(", ")", ")", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cos", "(", "targetAngle", ")", ";", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin", "(", "targetAngle", ")", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<", "candidates", ".", "size", "(", ")", ";", "i", "++", ")", "{", "LineSegment2D_F32", "c", "=", "candidates", ".", "get", "(", "i", ")", ";", "float", "angle", "=", "UtilAngle", ".", "atanSafe", "(", "c", ".", "slopeY", "(", ")", ",", "c", ".", "slopeX", "(", ")", ")", ";", "// see if the two lines have the same slope", "if", "(", "UtilAngle", ".", "distHalf", "(", "targetAngle", ",", "angle", ")", ">", "lineSlopeAngleTol", ")", "continue", ";", "// see the distance the two lines are apart and if it could be the best line", "closestFarthestPoints", "(", "target", ",", "c", ")", ";", "// two closest end points", "Point2D_F32", "pt0", "=", "closestIndex", "<", "2", "?", "target", ".", "a", ":", "target", ".", "b", ";", "Point2D_F32", "pt1", "=", "(", "closestIndex", "%", "2", ")", "==", "0", "?", "c", ".", "a", ":", "c", ".", "b", ";", "float", "xx", "=", "pt1", ".", "x", "-", "pt0", ".", "x", ";", "float", "yy", "=", "pt1", ".", "y", "-", "pt0", ".", "y", ";", "float", "distX", "=", "Math", ".", "abs", "(", "cos", "*", "xx", "-", "sin", "*", "yy", ")", ";", "float", "distY", "=", "Math", ".", "abs", "(", "cos", "*", "yy", "+", "sin", "*", "xx", ")", ";", "if", "(", "distX", ">=", "bestDistance", "||", "distX", ">", "parallelTol", "||", "distY", ">", "tangentTol", ")", "continue", ";", "// check the angle of the combined line", "pt0", "=", "farthestIndex", "<", "2", "?", "target", ".", "a", ":", "target", ".", "b", ";", "pt1", "=", "(", "farthestIndex", "%", "2", ")", "==", "0", "?", "c", ".", "a", ":", "c", ".", "b", ";", "float", "angleCombined", "=", "UtilAngle", ".", "atanSafe", "(", "pt1", ".", "y", "-", "pt0", ".", "y", ",", "pt1", ".", "x", "-", "pt0", ".", "x", ")", ";", "if", "(", "UtilAngle", ".", "distHalf", "(", "targetAngle", ",", "angleCombined", ")", "<=", "lineSlopeAngleTol", ")", "{", "bestDistance", "=", "distX", ";", "bestIndex", "=", "i", ";", "bestFarthest", "=", "farthestIndex", ";", "}", "}", "if", "(", "bestDistance", "<", "parallelTol", ")", "{", "farthestIndex", "=", "bestFarthest", ";", "return", "bestIndex", ";", "}", "return", "-", "1", ";", "}" ]
Searches for a line in the list which the target is compatible with and can be connected to. @param target Line being connected to. @param candidates List of candidate lines. @param start First index in the candidate list it should start searching at. @return Index of the candidate it can connect to. -1 if there is no match.
[ "Searches", "for", "a", "line", "in", "the", "list", "which", "the", "target", "is", "compatible", "with", "and", "can", "be", "connected", "to", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/ConnectLinesGrid.java#L207-L263
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/JdbcUtil.java
JdbcUtil.setQueryParams
public void setQueryParams(Collection queryParams, PreparedStatement ps) throws Exception { """ queryParam type only support String Integer Float or Long Double Bye Short if you need operate other types, you must use JDBC directly! """ if ((queryParams == null) || (queryParams.size() == 0)) return; int i = 1; Object key = null; Iterator iter = queryParams.iterator(); while (iter.hasNext()) { key = iter.next(); if (key != null) { convertType(i, key, ps); Debug.logVerbose("[JdonFramework] parameter " + i + " = " + key.toString(), module); } else { Debug.logWarning("[JdonFramework] parameter " + i + " is null", module); ps.setString(i, ""); } i++; } }
java
public void setQueryParams(Collection queryParams, PreparedStatement ps) throws Exception { if ((queryParams == null) || (queryParams.size() == 0)) return; int i = 1; Object key = null; Iterator iter = queryParams.iterator(); while (iter.hasNext()) { key = iter.next(); if (key != null) { convertType(i, key, ps); Debug.logVerbose("[JdonFramework] parameter " + i + " = " + key.toString(), module); } else { Debug.logWarning("[JdonFramework] parameter " + i + " is null", module); ps.setString(i, ""); } i++; } }
[ "public", "void", "setQueryParams", "(", "Collection", "queryParams", ",", "PreparedStatement", "ps", ")", "throws", "Exception", "{", "if", "(", "(", "queryParams", "==", "null", ")", "||", "(", "queryParams", ".", "size", "(", ")", "==", "0", ")", ")", "return", ";", "int", "i", "=", "1", ";", "Object", "key", "=", "null", ";", "Iterator", "iter", "=", "queryParams", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "key", "=", "iter", ".", "next", "(", ")", ";", "if", "(", "key", "!=", "null", ")", "{", "convertType", "(", "i", ",", "key", ",", "ps", ")", ";", "Debug", ".", "logVerbose", "(", "\"[JdonFramework] parameter \"", "+", "i", "+", "\" = \"", "+", "key", ".", "toString", "(", ")", ",", "module", ")", ";", "}", "else", "{", "Debug", ".", "logWarning", "(", "\"[JdonFramework] parameter \"", "+", "i", "+", "\" is null\"", ",", "module", ")", ";", "ps", ".", "setString", "(", "i", ",", "\"\"", ")", ";", "}", "i", "++", ";", "}", "}" ]
queryParam type only support String Integer Float or Long Double Bye Short if you need operate other types, you must use JDBC directly!
[ "queryParam", "type", "only", "support", "String", "Integer", "Float", "or", "Long", "Double", "Bye", "Short", "if", "you", "need", "operate", "other", "types", "you", "must", "use", "JDBC", "directly!" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/JdbcUtil.java#L43-L62
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.isSelected
public boolean isSelected(String selectedSystemUnderTestInfo, String key) { """ Verifies if the the selectedSystemUnderTestInfo matches the specified key </p> @param selectedSystemUnderTestInfo a {@link java.lang.String} object. @param key a {@link java.lang.String} object. @return true if the the selectedSystemUnderTestInfo matches the specified key. """ return selectedSystemUnderTestInfo != null ? selectedSystemUnderTestInfo.equals(key) : false; }
java
public boolean isSelected(String selectedSystemUnderTestInfo, String key) { return selectedSystemUnderTestInfo != null ? selectedSystemUnderTestInfo.equals(key) : false; }
[ "public", "boolean", "isSelected", "(", "String", "selectedSystemUnderTestInfo", ",", "String", "key", ")", "{", "return", "selectedSystemUnderTestInfo", "!=", "null", "?", "selectedSystemUnderTestInfo", ".", "equals", "(", "key", ")", ":", "false", ";", "}" ]
Verifies if the the selectedSystemUnderTestInfo matches the specified key </p> @param selectedSystemUnderTestInfo a {@link java.lang.String} object. @param key a {@link java.lang.String} object. @return true if the the selectedSystemUnderTestInfo matches the specified key.
[ "Verifies", "if", "the", "the", "selectedSystemUnderTestInfo", "matches", "the", "specified", "key", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L689-L691
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java
DirectoryWatcher.watchDirectoryTree
public void watchDirectoryTree(Path dir) { """ Walk the directories under given path, and register a watcher for every directory. @param dir the starting point under which to listen for changes, if it doesn't exist, do nothing. """ if (_watchedDirectories == null) { throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance."); } try { if (Files.exists(dir)) { Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { watchDirectory(dir); return FileVisitResult.CONTINUE; } }); } } catch (IOException e) { throw new RuntimeException(e); } }
java
public void watchDirectoryTree(Path dir) { if (_watchedDirectories == null) { throw new IllegalStateException("DirectoryWatcher.close() was called. Please make a new instance."); } try { if (Files.exists(dir)) { Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { watchDirectory(dir); return FileVisitResult.CONTINUE; } }); } } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "void", "watchDirectoryTree", "(", "Path", "dir", ")", "{", "if", "(", "_watchedDirectories", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"DirectoryWatcher.close() was called. Please make a new instance.\"", ")", ";", "}", "try", "{", "if", "(", "Files", ".", "exists", "(", "dir", ")", ")", "{", "Files", ".", "walkFileTree", "(", "dir", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Override", "public", "FileVisitResult", "preVisitDirectory", "(", "Path", "dir", ",", "BasicFileAttributes", "attrs", ")", "throws", "IOException", "{", "watchDirectory", "(", "dir", ")", ";", "return", "FileVisitResult", ".", "CONTINUE", ";", "}", "}", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Walk the directories under given path, and register a watcher for every directory. @param dir the starting point under which to listen for changes, if it doesn't exist, do nothing.
[ "Walk", "the", "directories", "under", "given", "path", "and", "register", "a", "watcher", "for", "every", "directory", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/fs/watcher/DirectoryWatcher.java#L60-L77
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.translate2D
public static void translate2D(IAtomContainer atomCon, Vector2d vector) { """ Translates a molecule from the origin to a new point denoted by a vector. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param atomCon molecule to be translated @param vector dimension that represents the translation vector """ for (IAtom atom : atomCon.atoms()) { if (atom.getPoint2d() != null) { atom.getPoint2d().add(vector); } else { logger.warn("Could not translate atom in 2D space"); } } }
java
public static void translate2D(IAtomContainer atomCon, Vector2d vector) { for (IAtom atom : atomCon.atoms()) { if (atom.getPoint2d() != null) { atom.getPoint2d().add(vector); } else { logger.warn("Could not translate atom in 2D space"); } } }
[ "public", "static", "void", "translate2D", "(", "IAtomContainer", "atomCon", ",", "Vector2d", "vector", ")", "{", "for", "(", "IAtom", "atom", ":", "atomCon", ".", "atoms", "(", ")", ")", "{", "if", "(", "atom", ".", "getPoint2d", "(", ")", "!=", "null", ")", "{", "atom", ".", "getPoint2d", "(", ")", ".", "add", "(", "vector", ")", ";", "}", "else", "{", "logger", ".", "warn", "(", "\"Could not translate atom in 2D space\"", ")", ";", "}", "}", "}" ]
Translates a molecule from the origin to a new point denoted by a vector. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param atomCon molecule to be translated @param vector dimension that represents the translation vector
[ "Translates", "a", "molecule", "from", "the", "origin", "to", "a", "new", "point", "denoted", "by", "a", "vector", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", "areaDim", "HashMap", "renderingCoordinates", ")", "for", "details", "on", "coordinate", "sets" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L198-L206
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java
NShortPath.getPaths
public List<int[]> getPaths(int index) { """ 获取前index+1短的路径 @param index index = 0 : 最短的路径; index = 1 : 次短的路径, 依此类推。index <= this.N @return """ assert (index <= N && index >= 0); Stack<PathNode> stack = new Stack<PathNode>(); int curNode = vertexCount - 1, curIndex = index; QueueElement element; PathNode node; int[] aPath; List<int[]> result = new ArrayList<int[]>(); element = fromArray[curNode - 1][curIndex].GetFirst(); while (element != null) { // ---------- 通过压栈得到路径 ----------- stack.push(new PathNode(curNode, curIndex)); stack.push(new PathNode(element.from, element.index)); curNode = element.from; while (curNode != 0) { element = fromArray[element.from - 1][element.index].GetFirst(); // System.out.println(element.from + " " + element.index); stack.push(new PathNode(element.from, element.index)); curNode = element.from; } // -------------- 输出路径 -------------- PathNode[] nArray = new PathNode[stack.size()]; for (int i = 0; i < stack.size(); ++i) { nArray[i] = stack.get(stack.size() - i - 1); } aPath = new int[nArray.length]; for (int i = 0; i < aPath.length; i++) aPath[i] = nArray[i].from; result.add(aPath); // -------------- 出栈以检查是否还有其它路径 -------------- do { node = stack.pop(); curNode = node.from; curIndex = node.index; } while (curNode < 1 || (stack.size() != 0 && !fromArray[curNode - 1][curIndex].CanGetNext())); element = fromArray[curNode - 1][curIndex].GetNext(); } return result; }
java
public List<int[]> getPaths(int index) { assert (index <= N && index >= 0); Stack<PathNode> stack = new Stack<PathNode>(); int curNode = vertexCount - 1, curIndex = index; QueueElement element; PathNode node; int[] aPath; List<int[]> result = new ArrayList<int[]>(); element = fromArray[curNode - 1][curIndex].GetFirst(); while (element != null) { // ---------- 通过压栈得到路径 ----------- stack.push(new PathNode(curNode, curIndex)); stack.push(new PathNode(element.from, element.index)); curNode = element.from; while (curNode != 0) { element = fromArray[element.from - 1][element.index].GetFirst(); // System.out.println(element.from + " " + element.index); stack.push(new PathNode(element.from, element.index)); curNode = element.from; } // -------------- 输出路径 -------------- PathNode[] nArray = new PathNode[stack.size()]; for (int i = 0; i < stack.size(); ++i) { nArray[i] = stack.get(stack.size() - i - 1); } aPath = new int[nArray.length]; for (int i = 0; i < aPath.length; i++) aPath[i] = nArray[i].from; result.add(aPath); // -------------- 出栈以检查是否还有其它路径 -------------- do { node = stack.pop(); curNode = node.from; curIndex = node.index; } while (curNode < 1 || (stack.size() != 0 && !fromArray[curNode - 1][curIndex].CanGetNext())); element = fromArray[curNode - 1][curIndex].GetNext(); } return result; }
[ "public", "List", "<", "int", "[", "]", ">", "getPaths", "(", "int", "index", ")", "{", "assert", "(", "index", "<=", "N", "&&", "index", ">=", "0", ")", ";", "Stack", "<", "PathNode", ">", "stack", "=", "new", "Stack", "<", "PathNode", ">", "(", ")", ";", "int", "curNode", "=", "vertexCount", "-", "1", ",", "curIndex", "=", "index", ";", "QueueElement", "element", ";", "PathNode", "node", ";", "int", "[", "]", "aPath", ";", "List", "<", "int", "[", "]", ">", "result", "=", "new", "ArrayList", "<", "int", "[", "]", ">", "(", ")", ";", "element", "=", "fromArray", "[", "curNode", "-", "1", "]", "[", "curIndex", "]", ".", "GetFirst", "(", ")", ";", "while", "(", "element", "!=", "null", ")", "{", "// ---------- 通过压栈得到路径 -----------", "stack", ".", "push", "(", "new", "PathNode", "(", "curNode", ",", "curIndex", ")", ")", ";", "stack", ".", "push", "(", "new", "PathNode", "(", "element", ".", "from", ",", "element", ".", "index", ")", ")", ";", "curNode", "=", "element", ".", "from", ";", "while", "(", "curNode", "!=", "0", ")", "{", "element", "=", "fromArray", "[", "element", ".", "from", "-", "1", "]", "[", "element", ".", "index", "]", ".", "GetFirst", "(", ")", ";", "// System.out.println(element.from + \" \" + element.index);", "stack", ".", "push", "(", "new", "PathNode", "(", "element", ".", "from", ",", "element", ".", "index", ")", ")", ";", "curNode", "=", "element", ".", "from", ";", "}", "// -------------- 输出路径 --------------", "PathNode", "[", "]", "nArray", "=", "new", "PathNode", "[", "stack", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stack", ".", "size", "(", ")", ";", "++", "i", ")", "{", "nArray", "[", "i", "]", "=", "stack", ".", "get", "(", "stack", ".", "size", "(", ")", "-", "i", "-", "1", ")", ";", "}", "aPath", "=", "new", "int", "[", "nArray", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "aPath", ".", "length", ";", "i", "++", ")", "aPath", "[", "i", "]", "=", "nArray", "[", "i", "]", ".", "from", ";", "result", ".", "add", "(", "aPath", ")", ";", "// -------------- 出栈以检查是否还有其它路径 --------------", "do", "{", "node", "=", "stack", ".", "pop", "(", ")", ";", "curNode", "=", "node", ".", "from", ";", "curIndex", "=", "node", ".", "index", ";", "}", "while", "(", "curNode", "<", "1", "||", "(", "stack", ".", "size", "(", ")", "!=", "0", "&&", "!", "fromArray", "[", "curNode", "-", "1", "]", "[", "curIndex", "]", ".", "CanGetNext", "(", ")", ")", ")", ";", "element", "=", "fromArray", "[", "curNode", "-", "1", "]", "[", "curIndex", "]", ".", "GetNext", "(", ")", ";", "}", "return", "result", ";", "}" ]
获取前index+1短的路径 @param index index = 0 : 最短的路径; index = 1 : 次短的路径, 依此类推。index <= this.N @return
[ "获取前index", "+", "1短的路径" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/NShort/Path/NShortPath.java#L173-L226
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java
StorageDir.removeBlockMeta
public void removeBlockMeta(BlockMeta blockMeta) throws BlockDoesNotExistException { """ Removes a block from this storage dir. @param blockMeta the metadata of the block @throws BlockDoesNotExistException if no block is found """ Preconditions.checkNotNull(blockMeta, "blockMeta"); long blockId = blockMeta.getBlockId(); BlockMeta deletedBlockMeta = mBlockIdToBlockMap.remove(blockId); if (deletedBlockMeta == null) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); } reclaimSpace(blockMeta.getBlockSize(), true); }
java
public void removeBlockMeta(BlockMeta blockMeta) throws BlockDoesNotExistException { Preconditions.checkNotNull(blockMeta, "blockMeta"); long blockId = blockMeta.getBlockId(); BlockMeta deletedBlockMeta = mBlockIdToBlockMap.remove(blockId); if (deletedBlockMeta == null) { throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId); } reclaimSpace(blockMeta.getBlockSize(), true); }
[ "public", "void", "removeBlockMeta", "(", "BlockMeta", "blockMeta", ")", "throws", "BlockDoesNotExistException", "{", "Preconditions", ".", "checkNotNull", "(", "blockMeta", ",", "\"blockMeta\"", ")", ";", "long", "blockId", "=", "blockMeta", ".", "getBlockId", "(", ")", ";", "BlockMeta", "deletedBlockMeta", "=", "mBlockIdToBlockMap", ".", "remove", "(", "blockId", ")", ";", "if", "(", "deletedBlockMeta", "==", "null", ")", "{", "throw", "new", "BlockDoesNotExistException", "(", "ExceptionMessage", ".", "BLOCK_META_NOT_FOUND", ",", "blockId", ")", ";", "}", "reclaimSpace", "(", "blockMeta", ".", "getBlockSize", "(", ")", ",", "true", ")", ";", "}" ]
Removes a block from this storage dir. @param blockMeta the metadata of the block @throws BlockDoesNotExistException if no block is found
[ "Removes", "a", "block", "from", "this", "storage", "dir", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java#L329-L337
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java
EntityJsonParser.parseEntityJson
public EntityJson parseEntityJson(Object instanceSource, ObjectNode instance) throws SchemaValidationException, InvalidInstanceException { """ Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way. @param instanceSource An object describing the source of the instance, typically an instance of java.net.URL or java.io.File. @param instance A JSON ObjectNode containing the JSON representation of an EntityJSON instance. @return An EntityJSON instance. @throws SchemaValidationException If the given instance does not meet the general EntityJSON schema. @throws InvalidInstanceException If the given instance is structurally invalid. """ try { return new EntityJson(validate(ENTITY_JSON_SCHEMA_URL, instanceSource, instance)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
java
public EntityJson parseEntityJson(Object instanceSource, ObjectNode instance) throws SchemaValidationException, InvalidInstanceException { try { return new EntityJson(validate(ENTITY_JSON_SCHEMA_URL, instanceSource, instance)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
[ "public", "EntityJson", "parseEntityJson", "(", "Object", "instanceSource", ",", "ObjectNode", "instance", ")", "throws", "SchemaValidationException", ",", "InvalidInstanceException", "{", "try", "{", "return", "new", "EntityJson", "(", "validate", "(", "ENTITY_JSON_SCHEMA_URL", ",", "instanceSource", ",", "instance", ")", ")", ";", "}", "catch", "(", "NoSchemaException", "|", "InvalidSchemaException", "e", ")", "{", "// In theory this cannot happen", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Parse an EntityJSON instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way. @param instanceSource An object describing the source of the instance, typically an instance of java.net.URL or java.io.File. @param instance A JSON ObjectNode containing the JSON representation of an EntityJSON instance. @return An EntityJSON instance. @throws SchemaValidationException If the given instance does not meet the general EntityJSON schema. @throws InvalidInstanceException If the given instance is structurally invalid.
[ "Parse", "an", "EntityJSON", "instance", "from", "the", "given", "URL", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java#L162-L173
paymill/paymill-java
src/main/java/com/paymill/services/TransactionService.java
TransactionService.createWithPreauthorization
public Transaction createWithPreauthorization( Preauthorization preauthorization, Integer amount, String currency ) { """ Executes a {@link Transaction} with {@link Preauthorization} for the given amount in the given currency. @param preauthorization A {@link Preauthorization}, which has reserved some money from the client’s credit card. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @return {@link Transaction} object indicating whether a the call was successful or not. """ return this.createWithPreauthorization( preauthorization.getId(), amount, currency, null ); }
java
public Transaction createWithPreauthorization( Preauthorization preauthorization, Integer amount, String currency ) { return this.createWithPreauthorization( preauthorization.getId(), amount, currency, null ); }
[ "public", "Transaction", "createWithPreauthorization", "(", "Preauthorization", "preauthorization", ",", "Integer", "amount", ",", "String", "currency", ")", "{", "return", "this", ".", "createWithPreauthorization", "(", "preauthorization", ".", "getId", "(", ")", ",", "amount", ",", "currency", ",", "null", ")", ";", "}" ]
Executes a {@link Transaction} with {@link Preauthorization} for the given amount in the given currency. @param preauthorization A {@link Preauthorization}, which has reserved some money from the client’s credit card. @param amount Amount (in cents) which will be charged. @param currency ISO 4217 formatted currency code. @return {@link Transaction} object indicating whether a the call was successful or not.
[ "Executes", "a", "{" ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L339-L341
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/security/J2EESecurityManager.java
J2EESecurityManager.getAccessAllowed
public Boolean getAccessAllowed(ActionBean bean, Method handler) { """ Determines if access for the given execution context is allowed. The security manager is used to determine if access is allowed (to handle an event) or if access is not denied (thus allowing the display of error messages for binding and/or validation errors for a secured event). If the latter would not be checked, a user can (even if only theoretically) see an error message, correct his input, and then see an &quot;access forbidden&quot; message. <p> If required contextual information (like what data is affected) is not available, no decision should be made. This is to ensure that access is not denied when required data is missing because of a binding and/or validation error. @param bean the action bean on which to perform the action @param handler the event handler to check authorization for @return {@link Boolean#TRUE} if access is allowed, {@link Boolean#FALSE} if not, and null if no decision can be made @see SecurityManager#getAccessAllowed(ActionBean,Method) """ // Determine if the event handler allows access. LOG.debug("Determining if access is allowed for " + handler.getName() + " on " + bean.toString()); Boolean allowed = determineAccessOnElement(bean, handler, handler); // If the event handler didn't decide, determine if the action bean class allows access. // Rinse and repeat for all superclasses. Class<?> beanClass = bean.getClass(); while (allowed == null && beanClass != null) { LOG.debug("Determining if access is allowed for " + beanClass.getName() + " on " + bean.toString()); allowed = determineAccessOnElement(bean, handler, beanClass); beanClass = beanClass.getSuperclass(); } // If the event handler nor the action bean class decided, allow access. // This default allows access if no security annotations are used. if (allowed == null) { allowed = true; } // Return the decision. return allowed; }
java
public Boolean getAccessAllowed(ActionBean bean, Method handler) { // Determine if the event handler allows access. LOG.debug("Determining if access is allowed for " + handler.getName() + " on " + bean.toString()); Boolean allowed = determineAccessOnElement(bean, handler, handler); // If the event handler didn't decide, determine if the action bean class allows access. // Rinse and repeat for all superclasses. Class<?> beanClass = bean.getClass(); while (allowed == null && beanClass != null) { LOG.debug("Determining if access is allowed for " + beanClass.getName() + " on " + bean.toString()); allowed = determineAccessOnElement(bean, handler, beanClass); beanClass = beanClass.getSuperclass(); } // If the event handler nor the action bean class decided, allow access. // This default allows access if no security annotations are used. if (allowed == null) { allowed = true; } // Return the decision. return allowed; }
[ "public", "Boolean", "getAccessAllowed", "(", "ActionBean", "bean", ",", "Method", "handler", ")", "{", "// Determine if the event handler allows access.", "LOG", ".", "debug", "(", "\"Determining if access is allowed for \"", "+", "handler", ".", "getName", "(", ")", "+", "\" on \"", "+", "bean", ".", "toString", "(", ")", ")", ";", "Boolean", "allowed", "=", "determineAccessOnElement", "(", "bean", ",", "handler", ",", "handler", ")", ";", "// If the event handler didn't decide, determine if the action bean class allows access.", "// Rinse and repeat for all superclasses.", "Class", "<", "?", ">", "beanClass", "=", "bean", ".", "getClass", "(", ")", ";", "while", "(", "allowed", "==", "null", "&&", "beanClass", "!=", "null", ")", "{", "LOG", ".", "debug", "(", "\"Determining if access is allowed for \"", "+", "beanClass", ".", "getName", "(", ")", "+", "\" on \"", "+", "bean", ".", "toString", "(", ")", ")", ";", "allowed", "=", "determineAccessOnElement", "(", "bean", ",", "handler", ",", "beanClass", ")", ";", "beanClass", "=", "beanClass", ".", "getSuperclass", "(", ")", ";", "}", "// If the event handler nor the action bean class decided, allow access.", "// This default allows access if no security annotations are used.", "if", "(", "allowed", "==", "null", ")", "{", "allowed", "=", "true", ";", "}", "// Return the decision.", "return", "allowed", ";", "}" ]
Determines if access for the given execution context is allowed. The security manager is used to determine if access is allowed (to handle an event) or if access is not denied (thus allowing the display of error messages for binding and/or validation errors for a secured event). If the latter would not be checked, a user can (even if only theoretically) see an error message, correct his input, and then see an &quot;access forbidden&quot; message. <p> If required contextual information (like what data is affected) is not available, no decision should be made. This is to ensure that access is not denied when required data is missing because of a binding and/or validation error. @param bean the action bean on which to perform the action @param handler the event handler to check authorization for @return {@link Boolean#TRUE} if access is allowed, {@link Boolean#FALSE} if not, and null if no decision can be made @see SecurityManager#getAccessAllowed(ActionBean,Method)
[ "Determines", "if", "access", "for", "the", "given", "execution", "context", "is", "allowed", ".", "The", "security", "manager", "is", "used", "to", "determine", "if", "access", "is", "allowed", "(", "to", "handle", "an", "event", ")", "or", "if", "access", "is", "not", "denied", "(", "thus", "allowing", "the", "display", "of", "error", "messages", "for", "binding", "and", "/", "or", "validation", "errors", "for", "a", "secured", "event", ")", ".", "If", "the", "latter", "would", "not", "be", "checked", "a", "user", "can", "(", "even", "if", "only", "theoretically", ")", "see", "an", "error", "message", "correct", "his", "input", "and", "then", "see", "an", "&quot", ";", "access", "forbidden&quot", ";", "message", ".", "<p", ">", "If", "required", "contextual", "information", "(", "like", "what", "data", "is", "affected", ")", "is", "not", "available", "no", "decision", "should", "be", "made", ".", "This", "is", "to", "ensure", "that", "access", "is", "not", "denied", "when", "required", "data", "is", "missing", "because", "of", "a", "binding", "and", "/", "or", "validation", "error", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/security/J2EESecurityManager.java#L52-L81
SeleniumHQ/fluent-selenium
java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java
FluentSelect.selectByIndex
public FluentSelect selectByIndex(final int index) { """ Select the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting. @param index The option at this index will be selected """ executeAndWrapReThrowIfNeeded(new SelectByIndex(index), Context.singular(context, "selectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
java
public FluentSelect selectByIndex(final int index) { executeAndWrapReThrowIfNeeded(new SelectByIndex(index), Context.singular(context, "selectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
[ "public", "FluentSelect", "selectByIndex", "(", "final", "int", "index", ")", "{", "executeAndWrapReThrowIfNeeded", "(", "new", "SelectByIndex", "(", "index", ")", ",", "Context", ".", "singular", "(", "context", ",", "\"selectByIndex\"", ",", "null", ",", "index", ")", ",", "true", ")", ";", "return", "new", "FluentSelect", "(", "super", ".", "delegate", ",", "currentElement", ".", "getFound", "(", ")", ",", "this", ".", "context", ",", "monitor", ",", "booleanInsteadOfNotFoundException", ")", ";", "}" ]
Select the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting. @param index The option at this index will be selected
[ "Select", "the", "option", "at", "the", "given", "index", ".", "This", "is", "done", "by", "examing", "the", "index", "attribute", "of", "an", "element", "and", "not", "merely", "by", "counting", "." ]
train
https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L99-L102
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsDestinationImpl.java
JmsDestinationImpl.setDestName
void setDestName(String destName) throws JMSException { """ setDestName Set the destName for this Destination. @param destName The value for the destName @exception JMSException Thrown if the destName is null or blank """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDestName", destName); if ((null == destName) || ("".equals(destName))) { // d238447 FFDC review. More likely to be an external rather than internal error, // so no FFDC. throw (JMSException) JmsErrorUtils.newThrowable( InvalidDestinationException.class, "INVALID_VALUE_CWSIA0281", new Object[] { "destName", destName }, tc ); } // Store the property updateProperty(DEST_NAME, destName); // Clear the cached destinationAddresses, as they may now be incorrect clearCachedProducerDestinationAddress(); clearCachedConsumerDestinationAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDestName"); }
java
void setDestName(String destName) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDestName", destName); if ((null == destName) || ("".equals(destName))) { // d238447 FFDC review. More likely to be an external rather than internal error, // so no FFDC. throw (JMSException) JmsErrorUtils.newThrowable( InvalidDestinationException.class, "INVALID_VALUE_CWSIA0281", new Object[] { "destName", destName }, tc ); } // Store the property updateProperty(DEST_NAME, destName); // Clear the cached destinationAddresses, as they may now be incorrect clearCachedProducerDestinationAddress(); clearCachedConsumerDestinationAddress(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDestName"); }
[ "void", "setDestName", "(", "String", "destName", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"setDestName\"", ",", "destName", ")", ";", "if", "(", "(", "null", "==", "destName", ")", "||", "(", "\"\"", ".", "equals", "(", "destName", ")", ")", ")", "{", "// d238447 FFDC review. More likely to be an external rather than internal error,", "// so no FFDC.", "throw", "(", "JMSException", ")", "JmsErrorUtils", ".", "newThrowable", "(", "InvalidDestinationException", ".", "class", ",", "\"INVALID_VALUE_CWSIA0281\"", ",", "new", "Object", "[", "]", "{", "\"destName\"", ",", "destName", "}", ",", "tc", ")", ";", "}", "// Store the property", "updateProperty", "(", "DEST_NAME", ",", "destName", ")", ";", "// Clear the cached destinationAddresses, as they may now be incorrect", "clearCachedProducerDestinationAddress", "(", ")", ";", "clearCachedConsumerDestinationAddress", "(", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"setDestName\"", ")", ";", "}" ]
setDestName Set the destName for this Destination. @param destName The value for the destName @exception JMSException Thrown if the destName is null or blank
[ "setDestName", "Set", "the", "destName", "for", "this", "Destination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsDestinationImpl.java#L215-L238
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.removeByG_A
@Override public void removeByG_A(long groupId, boolean active) { """ Removes all the commerce countries where groupId = &#63; and active = &#63; from the database. @param groupId the group ID @param active the active """ for (CommerceCountry commerceCountry : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCountry); } }
java
@Override public void removeByG_A(long groupId, boolean active) { for (CommerceCountry commerceCountry : findByG_A(groupId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceCountry); } }
[ "@", "Override", "public", "void", "removeByG_A", "(", "long", "groupId", ",", "boolean", "active", ")", "{", "for", "(", "CommerceCountry", "commerceCountry", ":", "findByG_A", "(", "groupId", ",", "active", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceCountry", ")", ";", "}", "}" ]
Removes all the commerce countries where groupId = &#63; and active = &#63; from the database. @param groupId the group ID @param active the active
[ "Removes", "all", "the", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2934-L2940
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsVfsSitemapService.java
CmsVfsSitemapService.isValidOpenPath
private boolean isValidOpenPath(CmsObject cms, String openPath) { """ Checks if the given open path is valid.<p> @param cms the cms context @param openPath the open path @return <code>true</code> if the given open path is valid """ if (CmsStringUtil.isEmptyOrWhitespaceOnly(openPath)) { return false; } if (!cms.existsResource(openPath)) { // in case of a detail-page check the parent folder String parent = CmsResource.getParentFolder(openPath); if (CmsStringUtil.isEmptyOrWhitespaceOnly(parent) || !cms.existsResource(parent)) { return false; } } return true; }
java
private boolean isValidOpenPath(CmsObject cms, String openPath) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(openPath)) { return false; } if (!cms.existsResource(openPath)) { // in case of a detail-page check the parent folder String parent = CmsResource.getParentFolder(openPath); if (CmsStringUtil.isEmptyOrWhitespaceOnly(parent) || !cms.existsResource(parent)) { return false; } } return true; }
[ "private", "boolean", "isValidOpenPath", "(", "CmsObject", "cms", ",", "String", "openPath", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "openPath", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "cms", ".", "existsResource", "(", "openPath", ")", ")", "{", "// in case of a detail-page check the parent folder", "String", "parent", "=", "CmsResource", ".", "getParentFolder", "(", "openPath", ")", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "parent", ")", "||", "!", "cms", ".", "existsResource", "(", "parent", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks if the given open path is valid.<p> @param cms the cms context @param openPath the open path @return <code>true</code> if the given open path is valid
[ "Checks", "if", "the", "given", "open", "path", "is", "valid", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2813-L2826
hal/elemento
core/src/main/java/org/jboss/gwt/elemento/core/Elements.java
Elements.lazyInsertAfter
public static void lazyInsertAfter(Element parent, Element newElement, Element after) { """ Inserts the specified element into the parent element if not already present. If parent already contains child, this method does nothing. """ if (!parent.contains(newElement)) { parent.insertBefore(newElement, after.nextSibling); } }
java
public static void lazyInsertAfter(Element parent, Element newElement, Element after) { if (!parent.contains(newElement)) { parent.insertBefore(newElement, after.nextSibling); } }
[ "public", "static", "void", "lazyInsertAfter", "(", "Element", "parent", ",", "Element", "newElement", ",", "Element", "after", ")", "{", "if", "(", "!", "parent", ".", "contains", "(", "newElement", ")", ")", "{", "parent", ".", "insertBefore", "(", "newElement", ",", "after", ".", "nextSibling", ")", ";", "}", "}" ]
Inserts the specified element into the parent element if not already present. If parent already contains child, this method does nothing.
[ "Inserts", "the", "specified", "element", "into", "the", "parent", "element", "if", "not", "already", "present", ".", "If", "parent", "already", "contains", "child", "this", "method", "does", "nothing", "." ]
train
https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L673-L677
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsElementView.java
CmsElementView.hasPermission
public boolean hasPermission(CmsObject cms, CmsResource folder) { """ Checks whether the current user has permissions to use the element view.<p> @param cms the cms context @param folder used for permission checks for explorertype based views @return <code>true</code> if the current user has permissions to use the element view """ if ((m_explorerType != null) && (folder != null)) { CmsPermissionSet permSet = m_explorerType.getAccess().getPermissions(cms, folder); boolean result = permSet.requiresViewPermission(); return result; } try { if (m_resource != null) { return cms.hasPermissions( m_resource, CmsPermissionSet.ACCESS_VIEW, false, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible()); } else { return OpenCms.getRoleManager().hasRole(cms, CmsRole.ELEMENT_AUTHOR); } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } return false; }
java
public boolean hasPermission(CmsObject cms, CmsResource folder) { if ((m_explorerType != null) && (folder != null)) { CmsPermissionSet permSet = m_explorerType.getAccess().getPermissions(cms, folder); boolean result = permSet.requiresViewPermission(); return result; } try { if (m_resource != null) { return cms.hasPermissions( m_resource, CmsPermissionSet.ACCESS_VIEW, false, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible()); } else { return OpenCms.getRoleManager().hasRole(cms, CmsRole.ELEMENT_AUTHOR); } } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } return false; }
[ "public", "boolean", "hasPermission", "(", "CmsObject", "cms", ",", "CmsResource", "folder", ")", "{", "if", "(", "(", "m_explorerType", "!=", "null", ")", "&&", "(", "folder", "!=", "null", ")", ")", "{", "CmsPermissionSet", "permSet", "=", "m_explorerType", ".", "getAccess", "(", ")", ".", "getPermissions", "(", "cms", ",", "folder", ")", ";", "boolean", "result", "=", "permSet", ".", "requiresViewPermission", "(", ")", ";", "return", "result", ";", "}", "try", "{", "if", "(", "m_resource", "!=", "null", ")", "{", "return", "cms", ".", "hasPermissions", "(", "m_resource", ",", "CmsPermissionSet", ".", "ACCESS_VIEW", ",", "false", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ".", "addRequireVisible", "(", ")", ")", ";", "}", "else", "{", "return", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRole", "(", "cms", ",", "CmsRole", ".", "ELEMENT_AUTHOR", ")", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "return", "false", ";", "}" ]
Checks whether the current user has permissions to use the element view.<p> @param cms the cms context @param folder used for permission checks for explorertype based views @return <code>true</code> if the current user has permissions to use the element view
[ "Checks", "whether", "the", "current", "user", "has", "permissions", "to", "use", "the", "element", "view", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsElementView.java#L264-L287
craftercms/commons
utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java
I10nUtils.getLocalizedMessage
public static String getLocalizedMessage(String bundleName, String key, Object... args) { """ Returns a formatted, localized message according to the specified resource bundle and key. @param bundleName the name of the resource bundle where the message format should be @param key the key of the message format @param args the args of the message format @return the formatted, localized message """ return getLocalizedMessage(ResourceBundle.getBundle(bundleName), key, args); }
java
public static String getLocalizedMessage(String bundleName, String key, Object... args) { return getLocalizedMessage(ResourceBundle.getBundle(bundleName), key, args); }
[ "public", "static", "String", "getLocalizedMessage", "(", "String", "bundleName", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "return", "getLocalizedMessage", "(", "ResourceBundle", ".", "getBundle", "(", "bundleName", ")", ",", "key", ",", "args", ")", ";", "}" ]
Returns a formatted, localized message according to the specified resource bundle and key. @param bundleName the name of the resource bundle where the message format should be @param key the key of the message format @param args the args of the message format @return the formatted, localized message
[ "Returns", "a", "formatted", "localized", "message", "according", "to", "the", "specified", "resource", "bundle", "and", "key", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java#L46-L48
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsFocalPoint.java
CmsFocalPoint.setCenterCoordsRelativeToParent
public void setCenterCoordsRelativeToParent(int x, int y) { """ Positions the center of this widget over the given coordinates.<p> @param x the x coordinate @param y the y coordinate """ Style style = getElement().getStyle(); style.setLeft(x - 10, Unit.PX); style.setTop(y - 10, Unit.PX); }
java
public void setCenterCoordsRelativeToParent(int x, int y) { Style style = getElement().getStyle(); style.setLeft(x - 10, Unit.PX); style.setTop(y - 10, Unit.PX); }
[ "public", "void", "setCenterCoordsRelativeToParent", "(", "int", "x", ",", "int", "y", ")", "{", "Style", "style", "=", "getElement", "(", ")", ".", "getStyle", "(", ")", ";", "style", ".", "setLeft", "(", "x", "-", "10", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setTop", "(", "y", "-", "10", ",", "Unit", ".", "PX", ")", ";", "}" ]
Positions the center of this widget over the given coordinates.<p> @param x the x coordinate @param y the y coordinate
[ "Positions", "the", "center", "of", "this", "widget", "over", "the", "given", "coordinates", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsFocalPoint.java#L83-L88
scireum/parsii
src/main/java/parsii/tokenizer/Token.java
Token.createAndFill
public static Token createAndFill(TokenType type, Char ch) { """ Creates a new token with the given type, using the Char a initial trigger and content. @param type the type if this token. The supplied Char will be used as initial part of the trigger to further specify the token @param ch first character of the content and trigger of this token. Also specifies the position of the token. @return a new token which is initialized with the given Char """ Token result = new Token(); result.type = type; result.line = ch.getLine(); result.pos = ch.getPos(); result.contents = ch.getStringValue(); result.trigger = ch.getStringValue(); result.source = ch.toString(); return result; }
java
public static Token createAndFill(TokenType type, Char ch) { Token result = new Token(); result.type = type; result.line = ch.getLine(); result.pos = ch.getPos(); result.contents = ch.getStringValue(); result.trigger = ch.getStringValue(); result.source = ch.toString(); return result; }
[ "public", "static", "Token", "createAndFill", "(", "TokenType", "type", ",", "Char", "ch", ")", "{", "Token", "result", "=", "new", "Token", "(", ")", ";", "result", ".", "type", "=", "type", ";", "result", ".", "line", "=", "ch", ".", "getLine", "(", ")", ";", "result", ".", "pos", "=", "ch", ".", "getPos", "(", ")", ";", "result", ".", "contents", "=", "ch", ".", "getStringValue", "(", ")", ";", "result", ".", "trigger", "=", "ch", ".", "getStringValue", "(", ")", ";", "result", ".", "source", "=", "ch", ".", "toString", "(", ")", ";", "return", "result", ";", "}" ]
Creates a new token with the given type, using the Char a initial trigger and content. @param type the type if this token. The supplied Char will be used as initial part of the trigger to further specify the token @param ch first character of the content and trigger of this token. Also specifies the position of the token. @return a new token which is initialized with the given Char
[ "Creates", "a", "new", "token", "with", "the", "given", "type", "using", "the", "Char", "a", "initial", "trigger", "and", "content", "." ]
train
https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L86-L95
james-hu/jabb-core
src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java
AbstractRestClient.buildAddHeadersRequestInterceptor
protected ClientHttpRequestInterceptor buildAddHeadersRequestInterceptor(String header1, String value1, String header2, String value2, String header3, String value3, String header4, String value4) { """ Build a ClientHttpRequestInterceptor that adds three request headers @param header1 name of header 1 @param value1 value of header 1 @param header2 name of header 2 @param value2 value of header 2 @param header3 name of header 3 @param value3 value of header 3 @param header4 name of the header 4 @param value4 value of the header 4 @return the ClientHttpRequestInterceptor built """ return new AddHeadersRequestInterceptor(new String[]{header1, header2, header3, header4}, new String[]{value1, value2, value3, value4}); }
java
protected ClientHttpRequestInterceptor buildAddHeadersRequestInterceptor(String header1, String value1, String header2, String value2, String header3, String value3, String header4, String value4){ return new AddHeadersRequestInterceptor(new String[]{header1, header2, header3, header4}, new String[]{value1, value2, value3, value4}); }
[ "protected", "ClientHttpRequestInterceptor", "buildAddHeadersRequestInterceptor", "(", "String", "header1", ",", "String", "value1", ",", "String", "header2", ",", "String", "value2", ",", "String", "header3", ",", "String", "value3", ",", "String", "header4", ",", "String", "value4", ")", "{", "return", "new", "AddHeadersRequestInterceptor", "(", "new", "String", "[", "]", "{", "header1", ",", "header2", ",", "header3", ",", "header4", "}", ",", "new", "String", "[", "]", "{", "value1", ",", "value2", ",", "value3", ",", "value4", "}", ")", ";", "}" ]
Build a ClientHttpRequestInterceptor that adds three request headers @param header1 name of header 1 @param value1 value of header 1 @param header2 name of header 2 @param value2 value of header 2 @param header3 name of header 3 @param value3 value of header 3 @param header4 name of the header 4 @param value4 value of the header 4 @return the ClientHttpRequestInterceptor built
[ "Build", "a", "ClientHttpRequestInterceptor", "that", "adds", "three", "request", "headers" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L513-L515
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/POICellFormatter.java
POICellFormatter.format
public CellFormatResult format(final Cell cell, final Locale locale) { """ ロケールを指定してセルの値を取得する @since 0.3 @param cell フォーマット対象のセル @param locale locale フォーマットしたロケール。nullでも可能。 ロケールに依存する場合、指定したロケールにより自動的に切り替わります。 @return フォーマット結果。cellがnullの場合、空セルとして値を返す。 """ if(cell == null) { return createBlankCellResult(); } final Locale runtimeLocale = locale != null ? locale : Locale.getDefault(); switch(cell.getCellTypeEnum()) { case BLANK: if(isConsiderMergedCell()) { // 結合しているセルの場合、左上のセル以外に値が設定されている場合がある。 return getMergedCellValue(cell, runtimeLocale); } else { return createBlankCellResult(); } case BOOLEAN: return getCellValue(cell, runtimeLocale); case STRING: return getCellValue(cell, runtimeLocale); case NUMERIC: return getCellValue(cell, runtimeLocale); case FORMULA: return getFormulaCellValue(cell, runtimeLocale); case ERROR: return getErrorCellValue(cell, runtimeLocale); default: final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Unknown); result.setText(""); return result; } }
java
public CellFormatResult format(final Cell cell, final Locale locale) { if(cell == null) { return createBlankCellResult(); } final Locale runtimeLocale = locale != null ? locale : Locale.getDefault(); switch(cell.getCellTypeEnum()) { case BLANK: if(isConsiderMergedCell()) { // 結合しているセルの場合、左上のセル以外に値が設定されている場合がある。 return getMergedCellValue(cell, runtimeLocale); } else { return createBlankCellResult(); } case BOOLEAN: return getCellValue(cell, runtimeLocale); case STRING: return getCellValue(cell, runtimeLocale); case NUMERIC: return getCellValue(cell, runtimeLocale); case FORMULA: return getFormulaCellValue(cell, runtimeLocale); case ERROR: return getErrorCellValue(cell, runtimeLocale); default: final CellFormatResult result = new CellFormatResult(); result.setCellType(FormatCellType.Unknown); result.setText(""); return result; } }
[ "public", "CellFormatResult", "format", "(", "final", "Cell", "cell", ",", "final", "Locale", "locale", ")", "{", "if", "(", "cell", "==", "null", ")", "{", "return", "createBlankCellResult", "(", ")", ";", "}", "final", "Locale", "runtimeLocale", "=", "locale", "!=", "null", "?", "locale", ":", "Locale", ".", "getDefault", "(", ")", ";", "switch", "(", "cell", ".", "getCellTypeEnum", "(", ")", ")", "{", "case", "BLANK", ":", "if", "(", "isConsiderMergedCell", "(", ")", ")", "{", "// 結合しているセルの場合、左上のセル以外に値が設定されている場合がある。\r", "return", "getMergedCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "}", "else", "{", "return", "createBlankCellResult", "(", ")", ";", "}", "case", "BOOLEAN", ":", "return", "getCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "case", "STRING", ":", "return", "getCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "case", "NUMERIC", ":", "return", "getCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "case", "FORMULA", ":", "return", "getFormulaCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "case", "ERROR", ":", "return", "getErrorCellValue", "(", "cell", ",", "runtimeLocale", ")", ";", "default", ":", "final", "CellFormatResult", "result", "=", "new", "CellFormatResult", "(", ")", ";", "result", ".", "setCellType", "(", "FormatCellType", ".", "Unknown", ")", ";", "result", ".", "setText", "(", "\"\"", ")", ";", "return", "result", ";", "}", "}" ]
ロケールを指定してセルの値を取得する @since 0.3 @param cell フォーマット対象のセル @param locale locale フォーマットしたロケール。nullでも可能。 ロケールに依存する場合、指定したロケールにより自動的に切り替わります。 @return フォーマット結果。cellがnullの場合、空セルとして値を返す。
[ "ロケールを指定してセルの値を取得する" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/POICellFormatter.java#L127-L165
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/PhoneIntents.java
PhoneIntents.newSmsIntent
public static Intent newSmsIntent(Context context, String body, String phoneNumber) { """ Creates an intent that will allow to send an SMS without specifying the phone number @param body The text to send @param phoneNumber The phone number to send the SMS to @return the intent """ return newSmsIntent(context, body, new String[]{phoneNumber}); }
java
public static Intent newSmsIntent(Context context, String body, String phoneNumber) { return newSmsIntent(context, body, new String[]{phoneNumber}); }
[ "public", "static", "Intent", "newSmsIntent", "(", "Context", "context", ",", "String", "body", ",", "String", "phoneNumber", ")", "{", "return", "newSmsIntent", "(", "context", ",", "body", ",", "new", "String", "[", "]", "{", "phoneNumber", "}", ")", ";", "}" ]
Creates an intent that will allow to send an SMS without specifying the phone number @param body The text to send @param phoneNumber The phone number to send the SMS to @return the intent
[ "Creates", "an", "intent", "that", "will", "allow", "to", "send", "an", "SMS", "without", "specifying", "the", "phone", "number" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L82-L84
threerings/narya
core/src/main/java/com/threerings/io/ObjectInputStream.java
ObjectInputStream.readBareObject
protected void readBareObject (Object object, Streamer streamer, boolean useReader) throws IOException, ClassNotFoundException { """ Reads an object from the input stream that was previously written with {@link ObjectOutputStream#writeBareObject(Object,Streamer,boolean)}. """ _current = object; _streamer = streamer; try { _streamer.readObject(object, this, useReader); } finally { // clear out our current object references _current = null; _streamer = null; } }
java
protected void readBareObject (Object object, Streamer streamer, boolean useReader) throws IOException, ClassNotFoundException { _current = object; _streamer = streamer; try { _streamer.readObject(object, this, useReader); } finally { // clear out our current object references _current = null; _streamer = null; } }
[ "protected", "void", "readBareObject", "(", "Object", "object", ",", "Streamer", "streamer", ",", "boolean", "useReader", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "_current", "=", "object", ";", "_streamer", "=", "streamer", ";", "try", "{", "_streamer", ".", "readObject", "(", "object", ",", "this", ",", "useReader", ")", ";", "}", "finally", "{", "// clear out our current object references", "_current", "=", "null", ";", "_streamer", "=", "null", ";", "}", "}" ]
Reads an object from the input stream that was previously written with {@link ObjectOutputStream#writeBareObject(Object,Streamer,boolean)}.
[ "Reads", "an", "object", "from", "the", "input", "stream", "that", "was", "previously", "written", "with", "{" ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ObjectInputStream.java#L277-L289
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java
SimpleBitfinexApiBroker.waitForChannelResubscription
private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap) throws BitfinexClientException, InterruptedException { """ Wait for the successful channel re-subscription @param oldChannelIdSymbolMap @return @throws BitfinexClientException @throws InterruptedException """ final Stopwatch stopwatch = Stopwatch.createStarted(); final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3); logger.info("Waiting for streams to resubscribe (max wait time {} msec)", MAX_WAIT_TIME_IN_MS); synchronized (channelIdToHandlerMap) { while(channelIdToHandlerMap.size() != oldChannelIdSymbolMap.size()) { if(stopwatch.elapsed(TimeUnit.MILLISECONDS) > MAX_WAIT_TIME_IN_MS) { // Raise BitfinexClientException handleResubscribeFailed(oldChannelIdSymbolMap); } channelIdToHandlerMap.wait(500); } } }
java
private void waitForChannelResubscription(final Map<Integer, ChannelCallbackHandler> oldChannelIdSymbolMap) throws BitfinexClientException, InterruptedException { final Stopwatch stopwatch = Stopwatch.createStarted(); final long MAX_WAIT_TIME_IN_MS = TimeUnit.MINUTES.toMillis(3); logger.info("Waiting for streams to resubscribe (max wait time {} msec)", MAX_WAIT_TIME_IN_MS); synchronized (channelIdToHandlerMap) { while(channelIdToHandlerMap.size() != oldChannelIdSymbolMap.size()) { if(stopwatch.elapsed(TimeUnit.MILLISECONDS) > MAX_WAIT_TIME_IN_MS) { // Raise BitfinexClientException handleResubscribeFailed(oldChannelIdSymbolMap); } channelIdToHandlerMap.wait(500); } } }
[ "private", "void", "waitForChannelResubscription", "(", "final", "Map", "<", "Integer", ",", "ChannelCallbackHandler", ">", "oldChannelIdSymbolMap", ")", "throws", "BitfinexClientException", ",", "InterruptedException", "{", "final", "Stopwatch", "stopwatch", "=", "Stopwatch", ".", "createStarted", "(", ")", ";", "final", "long", "MAX_WAIT_TIME_IN_MS", "=", "TimeUnit", ".", "MINUTES", ".", "toMillis", "(", "3", ")", ";", "logger", ".", "info", "(", "\"Waiting for streams to resubscribe (max wait time {} msec)\"", ",", "MAX_WAIT_TIME_IN_MS", ")", ";", "synchronized", "(", "channelIdToHandlerMap", ")", "{", "while", "(", "channelIdToHandlerMap", ".", "size", "(", ")", "!=", "oldChannelIdSymbolMap", ".", "size", "(", ")", ")", "{", "if", "(", "stopwatch", ".", "elapsed", "(", "TimeUnit", ".", "MILLISECONDS", ")", ">", "MAX_WAIT_TIME_IN_MS", ")", "{", "// Raise BitfinexClientException", "handleResubscribeFailed", "(", "oldChannelIdSymbolMap", ")", ";", "}", "channelIdToHandlerMap", ".", "wait", "(", "500", ")", ";", "}", "}", "}" ]
Wait for the successful channel re-subscription @param oldChannelIdSymbolMap @return @throws BitfinexClientException @throws InterruptedException
[ "Wait", "for", "the", "successful", "channel", "re", "-", "subscription" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L658-L678
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/eval/ExpressionEvaluator.java
ExpressionEvaluator.eval
public Value eval(ACaseAlternative node, Value val, Context ctxt) throws AnalysisException { """ Utility method for ACaseAlternative @param node @param val @param ctxt @return @throws AnalysisException """ Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "case alternative", ctxt); try { evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getPattern(), val, ctxt)); return node.getResult().apply(VdmRuntime.getExpressionEvaluator(), evalContext); } catch (PatternMatchException e) { // Silently fail (CasesExpression will try the others) } return null; }
java
public Value eval(ACaseAlternative node, Value val, Context ctxt) throws AnalysisException { Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "case alternative", ctxt); try { evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getPattern(), val, ctxt)); return node.getResult().apply(VdmRuntime.getExpressionEvaluator(), evalContext); } catch (PatternMatchException e) { // Silently fail (CasesExpression will try the others) } return null; }
[ "public", "Value", "eval", "(", "ACaseAlternative", "node", ",", "Value", "val", ",", "Context", "ctxt", ")", "throws", "AnalysisException", "{", "Context", "evalContext", "=", "new", "Context", "(", "ctxt", ".", "assistantFactory", ",", "node", ".", "getLocation", "(", ")", ",", "\"case alternative\"", ",", "ctxt", ")", ";", "try", "{", "evalContext", ".", "putList", "(", "ctxt", ".", "assistantFactory", ".", "createPPatternAssistant", "(", ")", ".", "getNamedValues", "(", "node", ".", "getPattern", "(", ")", ",", "val", ",", "ctxt", ")", ")", ";", "return", "node", ".", "getResult", "(", ")", ".", "apply", "(", "VdmRuntime", ".", "getExpressionEvaluator", "(", ")", ",", "evalContext", ")", ";", "}", "catch", "(", "PatternMatchException", "e", ")", "{", "// Silently fail (CasesExpression will try the others)", "}", "return", "null", ";", "}" ]
Utility method for ACaseAlternative @param node @param val @param ctxt @return @throws AnalysisException
[ "Utility", "method", "for", "ACaseAlternative" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/eval/ExpressionEvaluator.java#L254-L269
dbracewell/mango
src/main/java/com/davidbracewell/io/FileUtils.java
FileUtils.baseName
public static String baseName(String file, @NonNull String suffix) { """ <p>Attempts to get the base name for a given file/directory. Removes the suffix from the name as well. This command should work in the same way as the unix <code>basename</code> command. </p> @param file The file path/name @param suffix The suffix to remove @return The file name if given a file, the directory name if given a directory, or null if given a null or empty string. """ if (StringUtils.isNullOrBlank(file)) { return StringUtils.EMPTY; } file = StringUtils.trim(file); int index = indexOfLastSeparator(file); if (index == -1) { return file.replaceAll(Pattern.quote(suffix) + "$", ""); } else if (index == file.length() - 1) { return baseName(file.substring(0, file.length() - 1)); } return file.substring(index + 1).replaceAll(Pattern.quote(suffix) + "$", ""); }
java
public static String baseName(String file, @NonNull String suffix) { if (StringUtils.isNullOrBlank(file)) { return StringUtils.EMPTY; } file = StringUtils.trim(file); int index = indexOfLastSeparator(file); if (index == -1) { return file.replaceAll(Pattern.quote(suffix) + "$", ""); } else if (index == file.length() - 1) { return baseName(file.substring(0, file.length() - 1)); } return file.substring(index + 1).replaceAll(Pattern.quote(suffix) + "$", ""); }
[ "public", "static", "String", "baseName", "(", "String", "file", ",", "@", "NonNull", "String", "suffix", ")", "{", "if", "(", "StringUtils", ".", "isNullOrBlank", "(", "file", ")", ")", "{", "return", "StringUtils", ".", "EMPTY", ";", "}", "file", "=", "StringUtils", ".", "trim", "(", "file", ")", ";", "int", "index", "=", "indexOfLastSeparator", "(", "file", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "return", "file", ".", "replaceAll", "(", "Pattern", ".", "quote", "(", "suffix", ")", "+", "\"$\"", ",", "\"\"", ")", ";", "}", "else", "if", "(", "index", "==", "file", ".", "length", "(", ")", "-", "1", ")", "{", "return", "baseName", "(", "file", ".", "substring", "(", "0", ",", "file", ".", "length", "(", ")", "-", "1", ")", ")", ";", "}", "return", "file", ".", "substring", "(", "index", "+", "1", ")", ".", "replaceAll", "(", "Pattern", ".", "quote", "(", "suffix", ")", "+", "\"$\"", ",", "\"\"", ")", ";", "}" ]
<p>Attempts to get the base name for a given file/directory. Removes the suffix from the name as well. This command should work in the same way as the unix <code>basename</code> command. </p> @param file The file path/name @param suffix The suffix to remove @return The file name if given a file, the directory name if given a directory, or null if given a null or empty string.
[ "<p", ">", "Attempts", "to", "get", "the", "base", "name", "for", "a", "given", "file", "/", "directory", ".", "Removes", "the", "suffix", "from", "the", "name", "as", "well", ".", "This", "command", "should", "work", "in", "the", "same", "way", "as", "the", "unix", "<code", ">", "basename<", "/", "code", ">", "command", ".", "<", "/", "p", ">" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/FileUtils.java#L155-L167
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.removeByG_N
@Override public CommerceCountry removeByG_N(long groupId, int numericISOCode) throws NoSuchCountryException { """ Removes the commerce country where groupId = &#63; and numericISOCode = &#63; from the database. @param groupId the group ID @param numericISOCode the numeric iso code @return the commerce country that was removed """ CommerceCountry commerceCountry = findByG_N(groupId, numericISOCode); return remove(commerceCountry); }
java
@Override public CommerceCountry removeByG_N(long groupId, int numericISOCode) throws NoSuchCountryException { CommerceCountry commerceCountry = findByG_N(groupId, numericISOCode); return remove(commerceCountry); }
[ "@", "Override", "public", "CommerceCountry", "removeByG_N", "(", "long", "groupId", ",", "int", "numericISOCode", ")", "throws", "NoSuchCountryException", "{", "CommerceCountry", "commerceCountry", "=", "findByG_N", "(", "groupId", ",", "numericISOCode", ")", ";", "return", "remove", "(", "commerceCountry", ")", ";", "}" ]
Removes the commerce country where groupId = &#63; and numericISOCode = &#63; from the database. @param groupId the group ID @param numericISOCode the numeric iso code @return the commerce country that was removed
[ "Removes", "the", "commerce", "country", "where", "groupId", "=", "&#63", ";", "and", "numericISOCode", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2389-L2395
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doPut
protected void doPut(String path) throws ClientException { """ Updates the resource specified by the path, for situations where the nature of the update is completely specified by the path alone. @param path the path to the resource. Cannot be <code>null</code>. @throws ClientException if a status code other than 204 (No Content) and 200 (OK) is returned. """ this.readLock.lock(); try { ClientResponse response = this.getResourceWrapper() .rewritten(path, HttpMethod.PUT) .put(ClientResponse.class); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT); response.close(); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
java
protected void doPut(String path) throws ClientException { this.readLock.lock(); try { ClientResponse response = this.getResourceWrapper() .rewritten(path, HttpMethod.PUT) .put(ClientResponse.class); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.NO_CONTENT); response.close(); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
[ "protected", "void", "doPut", "(", "String", "path", ")", "throws", "ClientException", "{", "this", ".", "readLock", ".", "lock", "(", ")", ";", "try", "{", "ClientResponse", "response", "=", "this", ".", "getResourceWrapper", "(", ")", ".", "rewritten", "(", "path", ",", "HttpMethod", ".", "PUT", ")", ".", "put", "(", "ClientResponse", ".", "class", ")", ";", "errorIfStatusNotEqualTo", "(", "response", ",", "ClientResponse", ".", "Status", ".", "OK", ",", "ClientResponse", ".", "Status", ".", "NO_CONTENT", ")", ";", "response", ".", "close", "(", ")", ";", "}", "catch", "(", "ClientHandlerException", "ex", ")", "{", "throw", "new", "ClientException", "(", "ClientResponse", ".", "Status", ".", "INTERNAL_SERVER_ERROR", ",", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "this", ".", "readLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Updates the resource specified by the path, for situations where the nature of the update is completely specified by the path alone. @param path the path to the resource. Cannot be <code>null</code>. @throws ClientException if a status code other than 204 (No Content) and 200 (OK) is returned.
[ "Updates", "the", "resource", "specified", "by", "the", "path", "for", "situations", "where", "the", "nature", "of", "the", "update", "is", "completely", "specified", "by", "the", "path", "alone", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L153-L166
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.getRandomly
private void getRandomly(final int fetchSize, final StringBuilder sql) { """ getRandomly. @param fetchSize fetchSize @param sql sql """ sql.append(JdbcFactory.getInstance().getRandomlySql(getName(), fetchSize)); }
java
private void getRandomly(final int fetchSize, final StringBuilder sql) { sql.append(JdbcFactory.getInstance().getRandomlySql(getName(), fetchSize)); }
[ "private", "void", "getRandomly", "(", "final", "int", "fetchSize", ",", "final", "StringBuilder", "sql", ")", "{", "sql", ".", "append", "(", "JdbcFactory", ".", "getInstance", "(", ")", ".", "getRandomlySql", "(", "getName", "(", ")", ",", "fetchSize", ")", ")", ";", "}" ]
getRandomly. @param fetchSize fetchSize @param sql sql
[ "getRandomly", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L671-L673
windup/windup
config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java
Iteration.as
@Override public IterationBuilderVar as(Class<? extends WindupVertexFrame> varType, String var) { """ Change the name of the single variable of the given type. If this method is not called, the name is calculated using the {@link Iteration#singleVariableIterationName(String)} method. """ setPayloadManager(new TypedNamedIterationPayloadManager(varType, var)); return this; }
java
@Override public IterationBuilderVar as(Class<? extends WindupVertexFrame> varType, String var) { setPayloadManager(new TypedNamedIterationPayloadManager(varType, var)); return this; }
[ "@", "Override", "public", "IterationBuilderVar", "as", "(", "Class", "<", "?", "extends", "WindupVertexFrame", ">", "varType", ",", "String", "var", ")", "{", "setPayloadManager", "(", "new", "TypedNamedIterationPayloadManager", "(", "varType", ",", "var", ")", ")", ";", "return", "this", ";", "}" ]
Change the name of the single variable of the given type. If this method is not called, the name is calculated using the {@link Iteration#singleVariableIterationName(String)} method.
[ "Change", "the", "name", "of", "the", "single", "variable", "of", "the", "given", "type", ".", "If", "this", "method", "is", "not", "called", "the", "name", "is", "calculated", "using", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L185-L190
azkaban/azkaban
azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java
DagBuilder.createNode
public Node createNode(final String name, final NodeProcessor nodeProcessor) { """ Creates a new node and adds it to the DagBuilder. @param name name of the node @param nodeProcessor node processor associated with this node @return a new node @throws DagException if the name is not unique in the DAG. """ checkIsBuilt(); if (this.nameToNodeMap.get(name) != null) { throw new DagException(String.format("Node names in %s need to be unique. The name " + "(%s) already exists.", this, name)); } final Node node = new Node(name, nodeProcessor, this.dag); this.nameToNodeMap.put(name, node); return node; }
java
public Node createNode(final String name, final NodeProcessor nodeProcessor) { checkIsBuilt(); if (this.nameToNodeMap.get(name) != null) { throw new DagException(String.format("Node names in %s need to be unique. The name " + "(%s) already exists.", this, name)); } final Node node = new Node(name, nodeProcessor, this.dag); this.nameToNodeMap.put(name, node); return node; }
[ "public", "Node", "createNode", "(", "final", "String", "name", ",", "final", "NodeProcessor", "nodeProcessor", ")", "{", "checkIsBuilt", "(", ")", ";", "if", "(", "this", ".", "nameToNodeMap", ".", "get", "(", "name", ")", "!=", "null", ")", "{", "throw", "new", "DagException", "(", "String", ".", "format", "(", "\"Node names in %s need to be unique. The name \"", "+", "\"(%s) already exists.\"", ",", "this", ",", "name", ")", ")", ";", "}", "final", "Node", "node", "=", "new", "Node", "(", "name", ",", "nodeProcessor", ",", "this", ".", "dag", ")", ";", "this", ".", "nameToNodeMap", ".", "put", "(", "name", ",", "node", ")", ";", "return", "node", ";", "}" ]
Creates a new node and adds it to the DagBuilder. @param name name of the node @param nodeProcessor node processor associated with this node @return a new node @throws DagException if the name is not unique in the DAG.
[ "Creates", "a", "new", "node", "and", "adds", "it", "to", "the", "DagBuilder", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java#L65-L76
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.findContainerByIdOrByName
public static Container findContainerByIdOrByName( String name, DockerClient dockerClient ) { """ Finds a container by ID or by name. @param name the container ID or name (not null) @param dockerClient a Docker client @return a container, or null if none was found """ Container result = null; List<Container> containers = dockerClient.listContainersCmd().withShowAll( true ).exec(); for( Container container : containers ) { List<String> names = Arrays.asList( container.getNames()); // Docker containers are prefixed with '/'. // At least, those we created, since their parent is the Docker daemon. if( container.getId().equals( name ) || names.contains( "/" + name )) { result = container; break; } } return result; }
java
public static Container findContainerByIdOrByName( String name, DockerClient dockerClient ) { Container result = null; List<Container> containers = dockerClient.listContainersCmd().withShowAll( true ).exec(); for( Container container : containers ) { List<String> names = Arrays.asList( container.getNames()); // Docker containers are prefixed with '/'. // At least, those we created, since their parent is the Docker daemon. if( container.getId().equals( name ) || names.contains( "/" + name )) { result = container; break; } } return result; }
[ "public", "static", "Container", "findContainerByIdOrByName", "(", "String", "name", ",", "DockerClient", "dockerClient", ")", "{", "Container", "result", "=", "null", ";", "List", "<", "Container", ">", "containers", "=", "dockerClient", ".", "listContainersCmd", "(", ")", ".", "withShowAll", "(", "true", ")", ".", "exec", "(", ")", ";", "for", "(", "Container", "container", ":", "containers", ")", "{", "List", "<", "String", ">", "names", "=", "Arrays", ".", "asList", "(", "container", ".", "getNames", "(", ")", ")", ";", "// Docker containers are prefixed with '/'.", "// At least, those we created, since their parent is the Docker daemon.", "if", "(", "container", ".", "getId", "(", ")", ".", "equals", "(", "name", ")", "||", "names", ".", "contains", "(", "\"/\"", "+", "name", ")", ")", "{", "result", "=", "container", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Finds a container by ID or by name. @param name the container ID or name (not null) @param dockerClient a Docker client @return a container, or null if none was found
[ "Finds", "a", "container", "by", "ID", "or", "by", "name", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L187-L204
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toMultiLineStringFromList
public MultiLineString toMultiLineStringFromList( List<List<LatLng>> polylineList) { """ Convert a list of List<LatLng> to a {@link MultiLineString} @param polylineList polyline list @return multi line string """ return toMultiLineStringFromList(polylineList, false, false); }
java
public MultiLineString toMultiLineStringFromList( List<List<LatLng>> polylineList) { return toMultiLineStringFromList(polylineList, false, false); }
[ "public", "MultiLineString", "toMultiLineStringFromList", "(", "List", "<", "List", "<", "LatLng", ">", ">", "polylineList", ")", "{", "return", "toMultiLineStringFromList", "(", "polylineList", ",", "false", ",", "false", ")", ";", "}" ]
Convert a list of List<LatLng> to a {@link MultiLineString} @param polylineList polyline list @return multi line string
[ "Convert", "a", "list", "of", "List<LatLng", ">", "to", "a", "{", "@link", "MultiLineString", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L859-L862
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.leftShift
public static OffsetTime leftShift(final LocalTime self, ZoneOffset offset) { """ Returns an {@link java.time.OffsetTime} of this time and the provided {@link java.time.ZoneOffset}. @param self a LocalTime @param offset a ZoneOffset @return an OffsetTime @since 2.5.0 """ return OffsetTime.of(self, offset); }
java
public static OffsetTime leftShift(final LocalTime self, ZoneOffset offset) { return OffsetTime.of(self, offset); }
[ "public", "static", "OffsetTime", "leftShift", "(", "final", "LocalTime", "self", ",", "ZoneOffset", "offset", ")", "{", "return", "OffsetTime", ".", "of", "(", "self", ",", "offset", ")", ";", "}" ]
Returns an {@link java.time.OffsetTime} of this time and the provided {@link java.time.ZoneOffset}. @param self a LocalTime @param offset a ZoneOffset @return an OffsetTime @since 2.5.0
[ "Returns", "an", "{", "@link", "java", ".", "time", ".", "OffsetTime", "}", "of", "this", "time", "and", "the", "provided", "{", "@link", "java", ".", "time", ".", "ZoneOffset", "}", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L961-L963
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.removeLastInstanceActiveTime
protected void removeLastInstanceActiveTime(String instanceId, T jedis) { """ Remove the given instance from the hash @param instanceId The instance id to remove @param jedis a thread-safe Redis connection """ jedis.hdel(redisSchema.lastInstanceActiveTime(), instanceId); }
java
protected void removeLastInstanceActiveTime(String instanceId, T jedis){ jedis.hdel(redisSchema.lastInstanceActiveTime(), instanceId); }
[ "protected", "void", "removeLastInstanceActiveTime", "(", "String", "instanceId", ",", "T", "jedis", ")", "{", "jedis", ".", "hdel", "(", "redisSchema", ".", "lastInstanceActiveTime", "(", ")", ",", "instanceId", ")", ";", "}" ]
Remove the given instance from the hash @param instanceId The instance id to remove @param jedis a thread-safe Redis connection
[ "Remove", "the", "given", "instance", "from", "the", "hash" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L758-L760
crawljax/crawljax
core/src/main/java/com/crawljax/stateabstractions/visual/imagehashes/DHash.java
DHash.imagesPerceptuallySimilar
public boolean imagesPerceptuallySimilar(String img1, String img2) { """ compares the DHash of two images and return whether they are perceptually similar (max 10 different pixels allowed) @param img1 @param img2 @return true/false """ return distance(getDHash(img1), getDHash(img2)) <= 10; }
java
public boolean imagesPerceptuallySimilar(String img1, String img2) { return distance(getDHash(img1), getDHash(img2)) <= 10; }
[ "public", "boolean", "imagesPerceptuallySimilar", "(", "String", "img1", ",", "String", "img2", ")", "{", "return", "distance", "(", "getDHash", "(", "img1", ")", ",", "getDHash", "(", "img2", ")", ")", "<=", "10", ";", "}" ]
compares the DHash of two images and return whether they are perceptually similar (max 10 different pixels allowed) @param img1 @param img2 @return true/false
[ "compares", "the", "DHash", "of", "two", "images", "and", "return", "whether", "they", "are", "perceptually", "similar", "(", "max", "10", "different", "pixels", "allowed", ")" ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/stateabstractions/visual/imagehashes/DHash.java#L98-L100