repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java
LuisRuntimeManager.authenticate
public static LuisRuntimeAPI authenticate(String baseUrl, ServiceClientCredentials credentials) { String endpointAPI = null; try { URI uri = new URI(baseUrl); endpointAPI = uri.getHost(); } catch (Exception e) { endpointAPI = EndpointAPI.US_WEST.toString(); } return new LuisRuntimeAPIImpl(baseUrl, credentials) .withEndpoint(endpointAPI); }
java
public static LuisRuntimeAPI authenticate(String baseUrl, ServiceClientCredentials credentials) { String endpointAPI = null; try { URI uri = new URI(baseUrl); endpointAPI = uri.getHost(); } catch (Exception e) { endpointAPI = EndpointAPI.US_WEST.toString(); } return new LuisRuntimeAPIImpl(baseUrl, credentials) .withEndpoint(endpointAPI); }
[ "public", "static", "LuisRuntimeAPI", "authenticate", "(", "String", "baseUrl", ",", "ServiceClientCredentials", "credentials", ")", "{", "String", "endpointAPI", "=", "null", ";", "try", "{", "URI", "uri", "=", "new", "URI", "(", "baseUrl", ")", ";", "endpoin...
Initializes an instance of Language Understanding (LUIS) Runtime API client. @param baseUrl the base URL of the service @param credentials the management credentials for Azure @return the Language Understanding (LUIS) Runtime API client
[ "Initializes", "an", "instance", "of", "Language", "Understanding", "(", "LUIS", ")", "Runtime", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java#L92-L102
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/IoUtils.java
IoUtils.newFile
public static File newFile(File baseDir, String... segments) { File f = baseDir; for (String segment : segments) { f = new File(f, segment); } return f; }
java
public static File newFile(File baseDir, String... segments) { File f = baseDir; for (String segment : segments) { f = new File(f, segment); } return f; }
[ "public", "static", "File", "newFile", "(", "File", "baseDir", ",", "String", "...", "segments", ")", "{", "File", "f", "=", "baseDir", ";", "for", "(", "String", "segment", ":", "segments", ")", "{", "f", "=", "new", "File", "(", "f", ",", "segment"...
Return a new File object based on the baseDir and the segments. This method does not perform any operation on the file system.
[ "Return", "a", "new", "File", "object", "based", "on", "the", "baseDir", "and", "the", "segments", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/IoUtils.java#L208-L214
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java
DataMaskingRulesInner.createOrUpdate
public DataMaskingRuleInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).toBlocking().single().body(); }
java
public DataMaskingRuleInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String dataMaskingRuleName, DataMaskingRuleInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters).toBlocking().single().body(); }
[ "public", "DataMaskingRuleInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "dataMaskingRuleName", ",", "DataMaskingRuleInner", "parameters", ")", "{", "return", "createOrUpdateWithServic...
Creates or updates a database data masking rule. @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. @param databaseName The name of the database. @param dataMaskingRuleName The name of the data masking rule. @param parameters The required parameters for creating or updating a data masking rule. @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 DataMaskingRuleInner object if successful.
[ "Creates", "or", "updates", "a", "database", "data", "masking", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingRulesInner.java#L81-L83
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java
CmsJSONSearchConfigurationParser.parseOptionalBooleanValue
protected static Boolean parseOptionalBooleanValue(JSONObject json, String key) { try { return Boolean.valueOf(json.getBoolean(key)); } catch (JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, key), e); return null; } }
java
protected static Boolean parseOptionalBooleanValue(JSONObject json, String key) { try { return Boolean.valueOf(json.getBoolean(key)); } catch (JSONException e) { LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, key), e); return null; } }
[ "protected", "static", "Boolean", "parseOptionalBooleanValue", "(", "JSONObject", "json", ",", "String", "key", ")", "{", "try", "{", "return", "Boolean", ".", "valueOf", "(", "json", ".", "getBoolean", "(", "key", ")", ")", ";", "}", "catch", "(", "JSONEx...
Helper for reading an optional Boolean value - returning <code>null</code> if parsing fails. @param json The JSON object where the value should be read from. @param key The key of the value to read. @return The value from the JSON, or <code>null</code> if the value does not exist, or is no Boolean.
[ "Helper", "for", "reading", "an", "optional", "Boolean", "value", "-", "returning", "<code", ">", "null<", "/", "code", ">", "if", "parsing", "fails", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsJSONSearchConfigurationParser.java#L269-L277
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java
SheetRenderer.encodeSortVar
protected void encodeSortVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb) throws IOException { final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false); for (final SheetColumn column : sheet.getColumns()) { if (!column.isRendered()) { continue; } if (column.getValueExpression("sortBy") == null) { vb.appendArrayValue("false", false); } else { vb.appendArrayValue("true", false); } } wb.nativeAttr("sortable", vb.closeVar().toString()); }
java
protected void encodeSortVar(final FacesContext context, final Sheet sheet, final WidgetBuilder wb) throws IOException { final JavascriptVarBuilder vb = new JavascriptVarBuilder(null, false); for (final SheetColumn column : sheet.getColumns()) { if (!column.isRendered()) { continue; } if (column.getValueExpression("sortBy") == null) { vb.appendArrayValue("false", false); } else { vb.appendArrayValue("true", false); } } wb.nativeAttr("sortable", vb.closeVar().toString()); }
[ "protected", "void", "encodeSortVar", "(", "final", "FacesContext", "context", ",", "final", "Sheet", "sheet", ",", "final", "WidgetBuilder", "wb", ")", "throws", "IOException", "{", "final", "JavascriptVarBuilder", "vb", "=", "new", "JavascriptVarBuilder", "(", "...
Encodes a javascript sort var that informs the col header event of the column's sorting options. The var is an array of boolean indicating whether or not the column is sortable. @param context @param sheet @param wb @throws IOException
[ "Encodes", "a", "javascript", "sort", "var", "that", "informs", "the", "col", "header", "event", "of", "the", "column", "s", "sorting", "options", ".", "The", "var", "is", "an", "array", "of", "boolean", "indicating", "whether", "or", "not", "the", "column...
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L780-L797
Alluxio/alluxio
underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoUnderFileSystem.java
KodoUnderFileSystem.getObjectStatus
@Nullable @Override protected ObjectStatus getObjectStatus(String key) { try { FileInfo fileInfo = mKodoClinet.getFileInfo(key); if (fileInfo == null) { return null; } return new ObjectStatus(key, fileInfo.hash, fileInfo.fsize, fileInfo.putTime / 10000); } catch (QiniuException e) { LOG.warn("Failed to get Object {}, Msg: {}", key, e); } return null; }
java
@Nullable @Override protected ObjectStatus getObjectStatus(String key) { try { FileInfo fileInfo = mKodoClinet.getFileInfo(key); if (fileInfo == null) { return null; } return new ObjectStatus(key, fileInfo.hash, fileInfo.fsize, fileInfo.putTime / 10000); } catch (QiniuException e) { LOG.warn("Failed to get Object {}, Msg: {}", key, e); } return null; }
[ "@", "Nullable", "@", "Override", "protected", "ObjectStatus", "getObjectStatus", "(", "String", "key", ")", "{", "try", "{", "FileInfo", "fileInfo", "=", "mKodoClinet", ".", "getFileInfo", "(", "key", ")", ";", "if", "(", "fileInfo", "==", "null", ")", "{...
Gets metadata information about object. Implementations should process the key as is, which may be a file or a directory key. @param key ufs key to get metadata for @return {@link ObjectStatus} if key exists and successful, otherwise null
[ "Gets", "metadata", "information", "about", "object", ".", "Implementations", "should", "process", "the", "key", "as", "is", "which", "may", "be", "a", "file", "or", "a", "directory", "key", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoUnderFileSystem.java#L186-L199
apereo/cas
support/cas-server-support-ldap/src/main/java/org/apereo/cas/authentication/LdapAuthenticationHandler.java
LdapAuthenticationHandler.getLdapPrincipalIdentifier
protected String getLdapPrincipalIdentifier(final String username, final LdapEntry ldapEntry) throws LoginException { if (StringUtils.isNotBlank(this.principalIdAttribute)) { val principalAttr = ldapEntry.getAttribute(this.principalIdAttribute); if (principalAttr == null || principalAttr.size() == 0) { if (this.allowMissingPrincipalAttributeValue) { LOGGER.warn("The principal id attribute [{}] is not found. CAS cannot construct the final authenticated principal " + "if it's unable to locate the attribute that is designated as the principal id. " + "Attributes available on the LDAP entry are [{}]. Since principal id attribute is not available, CAS will " + "fall back to construct the principal based on the provided user id: [{}]", this.principalIdAttribute, ldapEntry.getAttributes(), username); return username; } LOGGER.error("The principal id attribute [{}] is not found. CAS is configured to disallow missing principal attributes", this.principalIdAttribute); throw new LoginException("Principal id attribute is not found for " + principalAttr); } val value = principalAttr.getStringValue(); if (principalAttr.size() > 1) { if (!this.allowMultiplePrincipalAttributeValues) { throw new LoginException("Multiple principal values are not allowed: " + principalAttr); } LOGGER.warn("Found multiple values for principal id attribute: [{}]. Using first value=[{}].", principalAttr, value); } LOGGER.debug("Retrieved principal id attribute [{}]", value); return value; } LOGGER.debug("Principal id attribute is not defined. Using the default provided user id [{}]", username); return username; }
java
protected String getLdapPrincipalIdentifier(final String username, final LdapEntry ldapEntry) throws LoginException { if (StringUtils.isNotBlank(this.principalIdAttribute)) { val principalAttr = ldapEntry.getAttribute(this.principalIdAttribute); if (principalAttr == null || principalAttr.size() == 0) { if (this.allowMissingPrincipalAttributeValue) { LOGGER.warn("The principal id attribute [{}] is not found. CAS cannot construct the final authenticated principal " + "if it's unable to locate the attribute that is designated as the principal id. " + "Attributes available on the LDAP entry are [{}]. Since principal id attribute is not available, CAS will " + "fall back to construct the principal based on the provided user id: [{}]", this.principalIdAttribute, ldapEntry.getAttributes(), username); return username; } LOGGER.error("The principal id attribute [{}] is not found. CAS is configured to disallow missing principal attributes", this.principalIdAttribute); throw new LoginException("Principal id attribute is not found for " + principalAttr); } val value = principalAttr.getStringValue(); if (principalAttr.size() > 1) { if (!this.allowMultiplePrincipalAttributeValues) { throw new LoginException("Multiple principal values are not allowed: " + principalAttr); } LOGGER.warn("Found multiple values for principal id attribute: [{}]. Using first value=[{}].", principalAttr, value); } LOGGER.debug("Retrieved principal id attribute [{}]", value); return value; } LOGGER.debug("Principal id attribute is not defined. Using the default provided user id [{}]", username); return username; }
[ "protected", "String", "getLdapPrincipalIdentifier", "(", "final", "String", "username", ",", "final", "LdapEntry", "ldapEntry", ")", "throws", "LoginException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "this", ".", "principalIdAttribute", ")", ")", ...
Gets ldap principal identifier. If the principal id attribute is defined, it's retrieved. If no attribute value is found, a warning is generated and the provided username is used instead. If no attribute is defined, username is used instead. @param username the username @param ldapEntry the ldap entry @return the ldap principal identifier @throws LoginException in case the principal id cannot be determined.
[ "Gets", "ldap", "principal", "identifier", ".", "If", "the", "principal", "id", "attribute", "is", "defined", "it", "s", "retrieved", ".", "If", "no", "attribute", "value", "is", "found", "a", "warning", "is", "generated", "and", "the", "provided", "username...
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap/src/main/java/org/apereo/cas/authentication/LdapAuthenticationHandler.java#L205-L233
geomajas/geomajas-project-client-gwt
plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/gfx/JsSnapService.java
JsSnapService.addNearestEdgeSnappingRule
public void addNearestEdgeSnappingRule(String snapLayer, double distance) { SnapSourceProvider snapSourceProvider = new VectorLayerSourceProvider(editor.getMapWidget().getMapModel() .getVectorLayer(snapLayer)); delegate.addSnappingRule(new SnappingRule(new NearestEdgeSnapAlgorithm(), snapSourceProvider, distance)); }
java
public void addNearestEdgeSnappingRule(String snapLayer, double distance) { SnapSourceProvider snapSourceProvider = new VectorLayerSourceProvider(editor.getMapWidget().getMapModel() .getVectorLayer(snapLayer)); delegate.addSnappingRule(new SnappingRule(new NearestEdgeSnapAlgorithm(), snapSourceProvider, distance)); }
[ "public", "void", "addNearestEdgeSnappingRule", "(", "String", "snapLayer", ",", "double", "distance", ")", "{", "SnapSourceProvider", "snapSourceProvider", "=", "new", "VectorLayerSourceProvider", "(", "editor", ".", "getMapWidget", "(", ")", ".", "getMapModel", "(",...
Add a new snapping rules to the list. Each new rule provides information on how snapping should occur. The added rule will use algorithm {@link NearestVertexSnapAlgorithm}. @param snapLayer The layer id that will provide the target geometries where to snap. @param distance The maximum distance to bridge during snapping. unit=meters.
[ "Add", "a", "new", "snapping", "rules", "to", "the", "list", ".", "Each", "new", "rule", "provides", "information", "on", "how", "snapping", "should", "occur", ".", "The", "added", "rule", "will", "use", "algorithm", "{", "@link", "NearestVertexSnapAlgorithm",...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/gfx/JsSnapService.java#L81-L85
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java
JobExecutionsInner.beginCreateAsync
public Observable<JobExecutionInner> beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() { @Override public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) { return response.body(); } }); }
java
public Observable<JobExecutionInner> beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() { @Override public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobExecutionInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resource...
Starts an elastic job execution. @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. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobExecutionInner object
[ "Starts", "an", "elastic", "job", "execution", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L633-L640
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/resolver/ClavinLocationResolver.java
ClavinLocationResolver.resolveLocations
@SuppressWarnings("unchecked") public List<ResolvedLocation> resolveLocations(final List<LocationOccurrence> locations, final int maxHitDepth, final int maxContextWindow, final boolean fuzzy) throws ClavinException { return resolveLocations(locations, maxHitDepth, maxContextWindow, fuzzy, DEFAULT_ANCESTRY_MODE); }
java
@SuppressWarnings("unchecked") public List<ResolvedLocation> resolveLocations(final List<LocationOccurrence> locations, final int maxHitDepth, final int maxContextWindow, final boolean fuzzy) throws ClavinException { return resolveLocations(locations, maxHitDepth, maxContextWindow, fuzzy, DEFAULT_ANCESTRY_MODE); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "ResolvedLocation", ">", "resolveLocations", "(", "final", "List", "<", "LocationOccurrence", ">", "locations", ",", "final", "int", "maxHitDepth", ",", "final", "int", "maxContextWindow", ...
Resolves the supplied list of location names into {@link ResolvedLocation}s containing {@link com.bericotech.clavin.gazetteer.GeoName} objects. Calls {@link Gazetteer#getClosestLocations} on each location name to find all possible matches, then uses heuristics to select the best match for each by calling {@link ClavinLocationResolver#pickBestCandidates}. @param locations list of location names to be resolved @param maxHitDepth number of candidate matches to consider @param maxContextWindow how much context to consider when resolving @param fuzzy switch for turning on/off fuzzy matching @return list of {@link ResolvedLocation} objects @throws ClavinException if an error occurs parsing the search terms
[ "Resolves", "the", "supplied", "list", "of", "location", "names", "into", "{", "@link", "ResolvedLocation", "}", "s", "containing", "{", "@link", "com", ".", "bericotech", ".", "clavin", ".", "gazetteer", ".", "GeoName", "}", "objects", "." ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/resolver/ClavinLocationResolver.java#L136-L140
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseScsric0
public static int cusparseScsric0( cusparseHandle handle, int trans, int m, cusparseMatDescr descrA, Pointer csrSortedValA_ValM, /** matrix A values are updated inplace to be the preconditioner M values */ Pointer csrSortedRowPtrA, Pointer csrSortedColIndA, cusparseSolveAnalysisInfo info) { return checkResult(cusparseScsric0Native(handle, trans, m, descrA, csrSortedValA_ValM, csrSortedRowPtrA, csrSortedColIndA, info)); }
java
public static int cusparseScsric0( cusparseHandle handle, int trans, int m, cusparseMatDescr descrA, Pointer csrSortedValA_ValM, /** matrix A values are updated inplace to be the preconditioner M values */ Pointer csrSortedRowPtrA, Pointer csrSortedColIndA, cusparseSolveAnalysisInfo info) { return checkResult(cusparseScsric0Native(handle, trans, m, descrA, csrSortedValA_ValM, csrSortedRowPtrA, csrSortedColIndA, info)); }
[ "public", "static", "int", "cusparseScsric0", "(", "cusparseHandle", "handle", ",", "int", "trans", ",", "int", "m", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrSortedValA_ValM", ",", "/** matrix A values are updated inplace \r\n ...
<pre> Description: Compute the incomplete-Cholesky factorization with 0 fill-in (IC0) of the matrix A stored in CSR format based on the information in the opaque structure info that was obtained from the analysis phase (csrsv_analysis). This routine implements algorithm 1 for this problem. </pre>
[ "<pre", ">", "Description", ":", "Compute", "the", "incomplete", "-", "Cholesky", "factorization", "with", "0", "fill", "-", "in", "(", "IC0", ")", "of", "the", "matrix", "A", "stored", "in", "CSR", "format", "based", "on", "the", "information", "in", "t...
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L6946-L6959
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java
Component.findValue
protected Object findValue(String expr, Class<?> toType) { if (altSyntax() && toType == String.class) { return TextParseUtil.translateVariables('%', expr, stack); } else { expr = stripExpressionIfAltSyntax(expr); return stack.findValue(expr, toType, false); } }
java
protected Object findValue(String expr, Class<?> toType) { if (altSyntax() && toType == String.class) { return TextParseUtil.translateVariables('%', expr, stack); } else { expr = stripExpressionIfAltSyntax(expr); return stack.findValue(expr, toType, false); } }
[ "protected", "Object", "findValue", "(", "String", "expr", ",", "Class", "<", "?", ">", "toType", ")", "{", "if", "(", "altSyntax", "(", ")", "&&", "toType", "==", "String", ".", "class", ")", "{", "return", "TextParseUtil", ".", "translateVariables", "(...
Evaluates the OGNL stack to find an Object of the given type. Will evaluate <code>expr</code> the portion wrapped with altSyntax (%{...}) against stack when altSyntax is on, else the whole <code>expr</code> is evaluated against the stack. <p/> This method only supports the altSyntax. So this should be set to true. @param expr OGNL expression. @param toType the type expected to find. @return the Object found, or <tt>null</tt> if not found.
[ "Evaluates", "the", "OGNL", "stack", "to", "find", "an", "Object", "of", "the", "given", "type", ".", "Will", "evaluate", "<code", ">", "expr<", "/", "code", ">", "the", "portion", "wrapped", "with", "altSyntax", "(", "%", "{", "...", "}", ")", "agains...
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L360-L367
JM-Lab/utils-java9
src/main/java/kr/jm/utils/HttpGetRequester.java
HttpGetRequester.getResponseAsString
public static String getResponseAsString(String uri, String charsetName) { return HttpRequester.getResponseAsString(uri, charsetName); }
java
public static String getResponseAsString(String uri, String charsetName) { return HttpRequester.getResponseAsString(uri, charsetName); }
[ "public", "static", "String", "getResponseAsString", "(", "String", "uri", ",", "String", "charsetName", ")", "{", "return", "HttpRequester", ".", "getResponseAsString", "(", "uri", ",", "charsetName", ")", ";", "}" ]
Gets response as string. @param uri the uri @param charsetName the charset name @return the response as string
[ "Gets", "response", "as", "string", "." ]
train
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/HttpGetRequester.java#L41-L43
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/ApiResponseConversionUtils.java
ApiResponseConversionUtils.httpMessageToSet
public static ApiResponseSet<String> httpMessageToSet(int historyId, int historyType, HttpMessage msg) { Map<String, String> map = new HashMap<>(); map.put("id", String.valueOf(historyId)); map.put("type", String.valueOf(historyType)); map.put("timestamp", String.valueOf(msg.getTimeSentMillis())); map.put("rtt", String.valueOf(msg.getTimeElapsedMillis())); map.put("cookieParams", msg.getCookieParamsAsString()); map.put("note", msg.getNote()); map.put("requestHeader", msg.getRequestHeader().toString()); map.put("requestBody", msg.getRequestBody().toString()); map.put("responseHeader", msg.getResponseHeader().toString()); if (HttpHeader.GZIP.equals(msg.getResponseHeader().getHeader(HttpHeader.CONTENT_ENCODING))) { // Uncompress gziped content try (ByteArrayInputStream bais = new ByteArrayInputStream(msg.getResponseBody().getBytes()); GZIPInputStream gis = new GZIPInputStream(bais); InputStreamReader isr = new InputStreamReader(gis); BufferedReader br = new BufferedReader(isr);) { StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) { sb.append(line); } map.put("responseBody", sb.toString()); } catch (IOException e) { LOGGER.error("Unable to uncompress gzip content: " + e.getMessage(), e); map.put("responseBody", msg.getResponseBody().toString()); } } else { map.put("responseBody", msg.getResponseBody().toString()); } List<String> tags = Collections.emptyList(); try { tags = HistoryReference.getTags(historyId); } catch (DatabaseException e) { LOGGER.warn("Failed to obtain the tags for message with ID " + historyId, e); } return new HttpMessageResponseSet(map, tags); }
java
public static ApiResponseSet<String> httpMessageToSet(int historyId, int historyType, HttpMessage msg) { Map<String, String> map = new HashMap<>(); map.put("id", String.valueOf(historyId)); map.put("type", String.valueOf(historyType)); map.put("timestamp", String.valueOf(msg.getTimeSentMillis())); map.put("rtt", String.valueOf(msg.getTimeElapsedMillis())); map.put("cookieParams", msg.getCookieParamsAsString()); map.put("note", msg.getNote()); map.put("requestHeader", msg.getRequestHeader().toString()); map.put("requestBody", msg.getRequestBody().toString()); map.put("responseHeader", msg.getResponseHeader().toString()); if (HttpHeader.GZIP.equals(msg.getResponseHeader().getHeader(HttpHeader.CONTENT_ENCODING))) { // Uncompress gziped content try (ByteArrayInputStream bais = new ByteArrayInputStream(msg.getResponseBody().getBytes()); GZIPInputStream gis = new GZIPInputStream(bais); InputStreamReader isr = new InputStreamReader(gis); BufferedReader br = new BufferedReader(isr);) { StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) { sb.append(line); } map.put("responseBody", sb.toString()); } catch (IOException e) { LOGGER.error("Unable to uncompress gzip content: " + e.getMessage(), e); map.put("responseBody", msg.getResponseBody().toString()); } } else { map.put("responseBody", msg.getResponseBody().toString()); } List<String> tags = Collections.emptyList(); try { tags = HistoryReference.getTags(historyId); } catch (DatabaseException e) { LOGGER.warn("Failed to obtain the tags for message with ID " + historyId, e); } return new HttpMessageResponseSet(map, tags); }
[ "public", "static", "ApiResponseSet", "<", "String", ">", "httpMessageToSet", "(", "int", "historyId", ",", "int", "historyType", ",", "HttpMessage", "msg", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ...
Converts the given HTTP message into an {@code ApiResponseSet}. @param historyId the ID of the message @param historyType the type of the message @param msg the HTTP message to be converted @return the {@code ApiResponseSet} with the ID, type and the HTTP message @since 2.6.0
[ "Converts", "the", "given", "HTTP", "message", "into", "an", "{", "@code", "ApiResponseSet", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/ApiResponseConversionUtils.java#L81-L120
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java
FileCacheServlet.doHead
protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Process request without content. processRequest(request, response, false); }
java
protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // Process request without content. processRequest(request, response, false); }
[ "protected", "void", "doHead", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "// Process request without content.", "processRequest", "(", "request", ",", "response", ",", "false",...
Process HEAD request. This returns the same headers as GET request, but without content. @see HttpServlet#doHead(HttpServletRequest, HttpServletResponse).
[ "Process", "HEAD", "request", ".", "This", "returns", "the", "same", "headers", "as", "GET", "request", "but", "without", "content", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java#L62-L66
apache/flink
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java
Kafka.startFromSpecificOffsets
public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.specificOffsets = Preconditions.checkNotNull(specificOffsets); return this; }
java
public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.specificOffsets = Preconditions.checkNotNull(specificOffsets); return this; }
[ "public", "Kafka", "startFromSpecificOffsets", "(", "Map", "<", "Integer", ",", "Long", ">", "specificOffsets", ")", "{", "this", ".", "startupMode", "=", "StartupMode", ".", "SPECIFIC_OFFSETS", ";", "this", ".", "specificOffsets", "=", "Preconditions", ".", "ch...
Configures to start reading partitions from specific offsets, set independently for each partition. Resets previously set offsets. @param specificOffsets the specified offsets for partitions @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map)
[ "Configures", "to", "start", "reading", "partitions", "from", "specific", "offsets", "set", "independently", "for", "each", "partition", ".", "Resets", "previously", "set", "offsets", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java#L163-L167
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/PaxExamRuntime.java
PaxExamRuntime.waitForStop
private static void waitForStop(TestContainer testContainer, int localPort) { try { ServerSocket serverSocket = new ServerSocket(localPort); Socket socket = serverSocket.accept(); InputStreamReader isr = new InputStreamReader(socket.getInputStream(), "UTF-8"); BufferedReader reader = new BufferedReader(isr); OutputStream os = socket.getOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); PrintWriter pw = new PrintWriter(writer, true); boolean running = true; while (running) { String command = reader.readLine(); LOG.debug("command = {}", command); if (command.equals("stop")) { testContainer.stop(); pw.println("stopped"); writer.flush(); LOG.info("test container stopped"); } else if (command.equals("quit")) { LOG.debug("quitting PaxExamRuntime"); pw.close(); socket.close(); serverSocket.close(); running = false; } } } catch (IOException exc) { LOG.debug("socket error", exc); } }
java
private static void waitForStop(TestContainer testContainer, int localPort) { try { ServerSocket serverSocket = new ServerSocket(localPort); Socket socket = serverSocket.accept(); InputStreamReader isr = new InputStreamReader(socket.getInputStream(), "UTF-8"); BufferedReader reader = new BufferedReader(isr); OutputStream os = socket.getOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); PrintWriter pw = new PrintWriter(writer, true); boolean running = true; while (running) { String command = reader.readLine(); LOG.debug("command = {}", command); if (command.equals("stop")) { testContainer.stop(); pw.println("stopped"); writer.flush(); LOG.info("test container stopped"); } else if (command.equals("quit")) { LOG.debug("quitting PaxExamRuntime"); pw.close(); socket.close(); serverSocket.close(); running = false; } } } catch (IOException exc) { LOG.debug("socket error", exc); } }
[ "private", "static", "void", "waitForStop", "(", "TestContainer", "testContainer", ",", "int", "localPort", ")", "{", "try", "{", "ServerSocket", "serverSocket", "=", "new", "ServerSocket", "(", "localPort", ")", ";", "Socket", "socket", "=", "serverSocket", "."...
Opens a server socket listening for text commands on the given port. Each command is terminated by a newline. The server expects a "stop" command followed by a "quit" command. @param testContainer @param localPort
[ "Opens", "a", "server", "socket", "listening", "for", "text", "commands", "on", "the", "given", "port", ".", "Each", "command", "is", "terminated", "by", "a", "newline", ".", "The", "server", "expects", "a", "stop", "command", "followed", "by", "a", "quit"...
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/PaxExamRuntime.java#L124-L156
molgenis/molgenis
molgenis-i18n/src/main/java/org/molgenis/i18n/LocalizationMessageSource.java
LocalizationMessageSource.resolveCodeWithoutArguments
@Override protected String resolveCodeWithoutArguments(String code, @Nullable @CheckForNull Locale locale) { Stream<Locale> candidates = Stream.of(locale, tryGetFallbackLocale(), DEFAULT_LOCALE); return candidates .filter(Objects::nonNull) .map(candidate -> messageRepository.resolveCodeWithoutArguments(code, candidate)) .filter(Objects::nonNull) .findFirst() .orElse(null); }
java
@Override protected String resolveCodeWithoutArguments(String code, @Nullable @CheckForNull Locale locale) { Stream<Locale> candidates = Stream.of(locale, tryGetFallbackLocale(), DEFAULT_LOCALE); return candidates .filter(Objects::nonNull) .map(candidate -> messageRepository.resolveCodeWithoutArguments(code, candidate)) .filter(Objects::nonNull) .findFirst() .orElse(null); }
[ "@", "Override", "protected", "String", "resolveCodeWithoutArguments", "(", "String", "code", ",", "@", "Nullable", "@", "CheckForNull", "Locale", "locale", ")", "{", "Stream", "<", "Locale", ">", "candidates", "=", "Stream", ".", "of", "(", "locale", ",", "...
Looks up a code in the {@link MessageResolution}. <p>First tries the given locale if it is nonnull, then the fallbackLocale and finally the default locale. @param code the messageID to look up. @param locale the Locale whose language code should be tried first, may be null @return The message, or null if none found.
[ "Looks", "up", "a", "code", "in", "the", "{", "@link", "MessageResolution", "}", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-i18n/src/main/java/org/molgenis/i18n/LocalizationMessageSource.java#L85-L94
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.setPermission
public static final void setPermission(Path path, String perms) throws IOException { checkFileType(path, perms); if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(permsPart(perms)); Files.setPosixFilePermissions(path, posixPerms); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setPermission(%s, %s)", path, perms); } }
java
public static final void setPermission(Path path, String perms) throws IOException { checkFileType(path, perms); if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(permsPart(perms)); Files.setPosixFilePermissions(path, posixPerms); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setPermission(%s, %s)", path, perms); } }
[ "public", "static", "final", "void", "setPermission", "(", "Path", "path", ",", "String", "perms", ")", "throws", "IOException", "{", "checkFileType", "(", "path", ",", "perms", ")", ";", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "Set", "<"...
Set posix permissions if supported. @param path @param perms 10 or 9 length E.g. -rwxr--r-- @throws java.io.IOException
[ "Set", "posix", "permissions", "if", "supported", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L223-L235
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java
ProjectsInner.getAsync
public Observable<ProjectInner> getAsync(String groupName, String serviceName, String projectName) { return getWithServiceResponseAsync(groupName, serviceName, projectName).map(new Func1<ServiceResponse<ProjectInner>, ProjectInner>() { @Override public ProjectInner call(ServiceResponse<ProjectInner> response) { return response.body(); } }); }
java
public Observable<ProjectInner> getAsync(String groupName, String serviceName, String projectName) { return getWithServiceResponseAsync(groupName, serviceName, projectName).map(new Func1<ServiceResponse<ProjectInner>, ProjectInner>() { @Override public ProjectInner call(ServiceResponse<ProjectInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProjectInner", ">", "getAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ")", "{", "return", "getWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ",", "projectName", ")", ...
Get project information. The project resource is a nested resource representing a stored migration project. The GET method retrieves information about a project. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectInner object
[ "Get", "project", "information", ".", "The", "project", "resource", "is", "a", "nested", "resource", "representing", "a", "stored", "migration", "project", ".", "The", "GET", "method", "retrieves", "information", "about", "a", "project", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java#L366-L373
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java
AnnotatorCache.setAnnotator
public void setAnnotator(@NonNull AnnotationType annotationType, @NonNull Language language, @NonNull Annotator annotator) { Preconditions.checkArgument(annotator.satisfies().contains(annotationType), "Attempting to register " + annotator.getClass() .getName() + " for " + annotationType.name() + " which it does not provide"); cache.put(createKey(annotationType, language), annotator); if (language == Language.UNKNOWN) { Config.setProperty("Annotator" + annotationType.name() + ".annotator", "CACHED"); } else { Config.setProperty("Annotator" + annotationType.name() + ".annotator." + language, "CACHED"); } assert cache.containsKey(createKey(annotationType, language)); }
java
public void setAnnotator(@NonNull AnnotationType annotationType, @NonNull Language language, @NonNull Annotator annotator) { Preconditions.checkArgument(annotator.satisfies().contains(annotationType), "Attempting to register " + annotator.getClass() .getName() + " for " + annotationType.name() + " which it does not provide"); cache.put(createKey(annotationType, language), annotator); if (language == Language.UNKNOWN) { Config.setProperty("Annotator" + annotationType.name() + ".annotator", "CACHED"); } else { Config.setProperty("Annotator" + annotationType.name() + ".annotator." + language, "CACHED"); } assert cache.containsKey(createKey(annotationType, language)); }
[ "public", "void", "setAnnotator", "(", "@", "NonNull", "AnnotationType", "annotationType", ",", "@", "NonNull", "Language", "language", ",", "@", "NonNull", "Annotator", "annotator", ")", "{", "Preconditions", ".", "checkArgument", "(", "annotator", ".", "satisfie...
Manually caches an annotator for an annotation type / language pair. Note that this will not be safe in a distributed environment like Spark or Map Reduce, but is useful for testing annotators. @param annotationType the annotation type @param language the language @param annotator the annotator
[ "Manually", "caches", "an", "annotator", "for", "an", "annotation", "type", "/", "language", "pair", ".", "Note", "that", "this", "will", "not", "be", "safe", "in", "a", "distributed", "environment", "like", "Spark", "or", "Map", "Reduce", "but", "is", "us...
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/AnnotatorCache.java#L116-L129
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_fkeep.java
Dcs_fkeep.cs_fkeep
public static int cs_fkeep(Dcs A, Dcs_ifkeep fkeep, Object other) { int j, p, nz = 0, n, Ap[], Ai[]; double Ax[]; if (!Dcs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Dcs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
java
public static int cs_fkeep(Dcs A, Dcs_ifkeep fkeep, Object other) { int j, p, nz = 0, n, Ap[], Ai[]; double Ax[]; if (!Dcs_util.CS_CSC(A)) return (-1); /* check inputs */ n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; for (j = 0; j < n; j++) { p = Ap[j]; /* get current location of col j */ Ap[j] = nz; /* record new location of col j */ for (; p < Ap[j + 1]; p++) { if (fkeep.fkeep(Ai[p], j, Ax != null ? Ax[p] : 1, other)) { if (Ax != null) Ax[nz] = Ax[p]; /* keep A(i,j) */ Ai[nz++] = Ai[p]; } } } Ap[n] = nz; /* finalize A */ Dcs_util.cs_sprealloc(A, 0); /* remove extra space from A */ return (nz); }
[ "public", "static", "int", "cs_fkeep", "(", "Dcs", "A", ",", "Dcs_ifkeep", "fkeep", ",", "Object", "other", ")", "{", "int", "j", ",", "p", ",", "nz", "=", "0", ",", "n", ",", "Ap", "[", "]", ",", "Ai", "[", "]", ";", "double", "Ax", "[", "]"...
Drops entries from a sparse matrix; @param A column-compressed matrix @param fkeep drop aij if fkeep.fkeep(i,j,aij,other) is false @param other optional parameter to fkeep @return nz, new number of entries in A, -1 on error
[ "Drops", "entries", "from", "a", "sparse", "matrix", ";" ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_fkeep.java#L48-L71
getsentry/sentry-java
sentry/src/main/java/io/sentry/SentryClient.java
SentryClient.setExtra
public void setExtra(Map<String, Object> extra) { if (extra == null) { this.extra = new HashMap<>(); } else { this.extra = extra; } }
java
public void setExtra(Map<String, Object> extra) { if (extra == null) { this.extra = new HashMap<>(); } else { this.extra = extra; } }
[ "public", "void", "setExtra", "(", "Map", "<", "String", ",", "Object", ">", "extra", ")", "{", "if", "(", "extra", "==", "null", ")", "{", "this", ".", "extra", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "else", "{", "this", ".", "extra", ...
Set the extra data that will be sent with all future {@link Event}s. @param extra Map of extra data
[ "Set", "the", "extra", "data", "that", "will", "be", "sent", "with", "all", "future", "{", "@link", "Event", "}", "s", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/SentryClient.java#L382-L388
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParserInputStream.java
JSONParserInputStream.parse
public Object parse(InputStream in) throws ParseException, UnsupportedEncodingException { InputStreamReader i2 = new InputStreamReader(in, "utf8"); return super.parse(i2); }
java
public Object parse(InputStream in) throws ParseException, UnsupportedEncodingException { InputStreamReader i2 = new InputStreamReader(in, "utf8"); return super.parse(i2); }
[ "public", "Object", "parse", "(", "InputStream", "in", ")", "throws", "ParseException", ",", "UnsupportedEncodingException", "{", "InputStreamReader", "i2", "=", "new", "InputStreamReader", "(", "in", ",", "\"utf8\"", ")", ";", "return", "super", ".", "parse", "...
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory @throws UnsupportedEncodingException
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserInputStream.java#L41-L44
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.onFlushCollection
private void onFlushCollection(Map<String, List<DBObject>> collections) { for (String tableName : collections.keySet()) { DBCollection dbCollection = mongoDb.getCollection(tableName); KunderaCoreUtils.printQuery("Persist collection:" + tableName, showQuery); try { dbCollection.insert(collections.get(tableName).toArray(new DBObject[0]), getWriteConcern(), encoder); } catch (MongoException ex) { throw new KunderaException("document is not inserted in " + dbCollection.getFullName() + " collection. Caused By:", ex); } } }
java
private void onFlushCollection(Map<String, List<DBObject>> collections) { for (String tableName : collections.keySet()) { DBCollection dbCollection = mongoDb.getCollection(tableName); KunderaCoreUtils.printQuery("Persist collection:" + tableName, showQuery); try { dbCollection.insert(collections.get(tableName).toArray(new DBObject[0]), getWriteConcern(), encoder); } catch (MongoException ex) { throw new KunderaException("document is not inserted in " + dbCollection.getFullName() + " collection. Caused By:", ex); } } }
[ "private", "void", "onFlushCollection", "(", "Map", "<", "String", ",", "List", "<", "DBObject", ">", ">", "collections", ")", "{", "for", "(", "String", "tableName", ":", "collections", ".", "keySet", "(", ")", ")", "{", "DBCollection", "dbCollection", "=...
On collections flush. @param collections collection containing records to be inserted in mongo db.
[ "On", "collections", "flush", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1360-L1377
Harium/keel
src/main/java/com/harium/keel/catalano/math/Tools.java
Tools.Clamp
public static double Clamp(double x, double min, double max) { if (x < min) return min; if (x > max) return max; return x; }
java
public static double Clamp(double x, double min, double max) { if (x < min) return min; if (x > max) return max; return x; }
[ "public", "static", "double", "Clamp", "(", "double", "x", ",", "double", "min", ",", "double", "max", ")", "{", "if", "(", "x", "<", "min", ")", "return", "min", ";", "if", "(", "x", ">", "max", ")", "return", "max", ";", "return", "x", ";", "...
Clamp values. @param x Value. @param min Minimum value. @param max Maximum value. @return Value.
[ "Clamp", "values", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L157-L163
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/Base64.java
Base64.encodeBytes
public static String encodeBytes( byte[] source, int off, int len ) { return encodeBytes( source, off, len, true ); }
java
public static String encodeBytes( byte[] source, int off, int len ) { return encodeBytes( source, off, len, true ); }
[ "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ")", "{", "return", "encodeBytes", "(", "source", ",", "off", ",", "len", ",", "true", ")", ";", "}" ]
Encodes a byte array into Base64 notation. @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @since 1.4
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/Base64.java#L498-L501
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java
SlotReference.getSlotReference
@SuppressWarnings("WeakerAccess") public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) { Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player); if (playerMap == null) { playerMap = new HashMap<CdjStatus.TrackSourceSlot, SlotReference>(); instances.put(player, playerMap); } SlotReference result = playerMap.get(slot); if (result == null) { result = new SlotReference(player, slot); playerMap.put(slot, result); } return result; }
java
@SuppressWarnings("WeakerAccess") public static synchronized SlotReference getSlotReference(int player, CdjStatus.TrackSourceSlot slot) { Map<CdjStatus.TrackSourceSlot, SlotReference> playerMap = instances.get(player); if (playerMap == null) { playerMap = new HashMap<CdjStatus.TrackSourceSlot, SlotReference>(); instances.put(player, playerMap); } SlotReference result = playerMap.get(slot); if (result == null) { result = new SlotReference(player, slot); playerMap.put(slot, result); } return result; }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "synchronized", "SlotReference", "getSlotReference", "(", "int", "player", ",", "CdjStatus", ".", "TrackSourceSlot", "slot", ")", "{", "Map", "<", "CdjStatus", ".", "TrackSourceSlot", ",", ...
Get a unique reference to a media slot on the network from which tracks can be loaded. @param player the player in which the slot is found @param slot the specific type of the slot @return the instance that will always represent the specified slot @throws NullPointerException if {@code slot} is {@code null}
[ "Get", "a", "unique", "reference", "to", "a", "media", "slot", "on", "the", "network", "from", "which", "tracks", "can", "be", "loaded", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/SlotReference.java#L56-L69
wuman/orientdb-android
commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java
OSynchEventAdapter.getValue
public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug( this, "Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource + (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms")); synchronized (iResource) { try { iResource.wait(iTimeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'"); } } Object[] value = queue.remove(iResource); return (RESPONSE_TYPE) (value != null ? value[1] : null); }
java
public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug( this, "Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource + (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms")); synchronized (iResource) { try { iResource.wait(iTimeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'"); } } Object[] value = queue.remove(iResource); return (RESPONSE_TYPE) (value != null ? value[1] : null); }
[ "public", "synchronized", "RESPONSE_TYPE", "getValue", "(", "final", "RESOURCE_TYPE", "iResource", ",", "final", "long", "iTimeout", ")", "{", "if", "(", "OLogManager", ".", "instance", "(", ")", ".", "isDebugEnabled", "(", ")", ")", "OLogManager", ".", "insta...
Wait until the requested resource is unlocked. Put the current thread in sleep until timeout or is waked up by an unlock.
[ "Wait", "until", "the", "requested", "resource", "is", "unlocked", ".", "Put", "the", "current", "thread", "in", "sleep", "until", "timeout", "or", "is", "waked", "up", "by", "an", "unlock", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/synch/OSynchEventAdapter.java#L32-L51
javagl/CommonUI
src/main/java/de/javagl/common/ui/layout/AspectLayout.java
AspectLayout.computeGridSize
private static Point computeGridSize( Container container, int numComponents, double aspect) { double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; minWasteGridSizeX = gridSizeX; } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } return new Point(gridSizeX, gridSizeY); }
java
private static Point computeGridSize( Container container, int numComponents, double aspect) { double containerSizeX = container.getWidth(); double containerSizeY = container.getHeight(); double minTotalWastedSpace = Double.MAX_VALUE; int minWasteGridSizeX = -1; for (int gridSizeX = 1; gridSizeX <= numComponents; gridSizeX++) { int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } double cellSizeX = containerSizeX / gridSizeX; double cellSizeY = containerSizeY / gridSizeY; double wastedSpace = computeWastedSpace(cellSizeX, cellSizeY, aspect); double totalWastedSpace = gridSizeX * gridSizeY * wastedSpace; if (totalWastedSpace < minTotalWastedSpace) { minTotalWastedSpace = totalWastedSpace; minWasteGridSizeX = gridSizeX; } } int gridSizeX = minWasteGridSizeX; int gridSizeY = numComponents / gridSizeX; if (gridSizeX * gridSizeY < numComponents) { gridSizeY++; } return new Point(gridSizeX, gridSizeY); }
[ "private", "static", "Point", "computeGridSize", "(", "Container", "container", ",", "int", "numComponents", ",", "double", "aspect", ")", "{", "double", "containerSizeX", "=", "container", ".", "getWidth", "(", ")", ";", "double", "containerSizeY", "=", "contai...
Compute a grid size for the given container, for the given number of components with the specified aspect ratio, optimizing the number of rows/columns so that the space is used optimally. @param container The container @param numComponents The number of components @param aspect The aspect ratio of the components @return A point (x,y) storing the (columns,rows) that the grid should have in order to waste as little space as possible
[ "Compute", "a", "grid", "size", "for", "the", "given", "container", "for", "the", "given", "number", "of", "components", "with", "the", "specified", "aspect", "ratio", "optimizing", "the", "number", "of", "rows", "/", "columns", "so", "that", "the", "space",...
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/layout/AspectLayout.java#L175-L207
banq/jdonframework
src/main/java/com/jdon/container/visitor/http/HttpSessionVisitorFactoryImp.java
HttpSessionVisitorFactoryImp.createtVisitor
public ComponentVisitor createtVisitor(SessionWrapper session, TargetMetaDef targetMetaDef) { if (session != null) return createtSessionVisitor(session, targetMetaDef); else return new NoSessionProxyComponentVisitor(componentVisitor, targetMetaRequestsHolder); }
java
public ComponentVisitor createtVisitor(SessionWrapper session, TargetMetaDef targetMetaDef) { if (session != null) return createtSessionVisitor(session, targetMetaDef); else return new NoSessionProxyComponentVisitor(componentVisitor, targetMetaRequestsHolder); }
[ "public", "ComponentVisitor", "createtVisitor", "(", "SessionWrapper", "session", ",", "TargetMetaDef", "targetMetaDef", ")", "{", "if", "(", "session", "!=", "null", ")", "return", "createtSessionVisitor", "(", "session", ",", "targetMetaDef", ")", ";", "else", "...
return a ComponentVisitor with cache. the httpSession is used for optimizing the component performance @param request @param targetMetaDef @return
[ "return", "a", "ComponentVisitor", "with", "cache", ".", "the", "httpSession", "is", "used", "for", "optimizing", "the", "component", "performance" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/visitor/http/HttpSessionVisitorFactoryImp.java#L53-L59
andrehertwig/admintool
admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java
AdminToolMenuUtils.isActiveInMenuTree
public boolean isActiveInMenuTree(MenuEntry activeMenu, MenuEntry actualEntry) { return actualEntry.flattened().anyMatch( entry -> checkForNull(entry, activeMenu) ? entry.getName().equals(activeMenu.getName()): false); }
java
public boolean isActiveInMenuTree(MenuEntry activeMenu, MenuEntry actualEntry) { return actualEntry.flattened().anyMatch( entry -> checkForNull(entry, activeMenu) ? entry.getName().equals(activeMenu.getName()): false); }
[ "public", "boolean", "isActiveInMenuTree", "(", "MenuEntry", "activeMenu", ",", "MenuEntry", "actualEntry", ")", "{", "return", "actualEntry", ".", "flattened", "(", ")", ".", "anyMatch", "(", "entry", "->", "checkForNull", "(", "entry", ",", "activeMenu", ")", ...
checks if actualEntry contains the activeMenuName in entry itself and its sub entries @param activeMenuName @param actualEntry current iterated object @return
[ "checks", "if", "actualEntry", "contains", "the", "activeMenuName", "in", "entry", "itself", "and", "its", "sub", "entries" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java#L119-L122
eclipse/hawkbit
hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilter.java
ControllerPreAuthenticatedSecurityHeaderFilter.getIssuerHashHeader
private String getIssuerHashHeader(final DmfTenantSecurityToken secruityToken, final String knownIssuerHashes) { // there may be several knownIssuerHashes configured for the tenant final List<String> knownHashes = splitMultiHashBySemicolon(knownIssuerHashes); // iterate over the headers until we get a null header. int iHeader = 1; String foundHash; while ((foundHash = secruityToken.getHeader(String.format(sslIssuerHashBasicHeader, iHeader))) != null) { if (knownHashes.contains(foundHash.toLowerCase())) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found matching ssl issuer hash at position {}", iHeader); } return foundHash.toLowerCase(); } iHeader++; } LOG_SECURITY_AUTH.debug( "Certifacte request but no matching hash found in headers {} for common name {} in request", sslIssuerHashBasicHeader, secruityToken.getHeader(caCommonNameHeader)); return null; }
java
private String getIssuerHashHeader(final DmfTenantSecurityToken secruityToken, final String knownIssuerHashes) { // there may be several knownIssuerHashes configured for the tenant final List<String> knownHashes = splitMultiHashBySemicolon(knownIssuerHashes); // iterate over the headers until we get a null header. int iHeader = 1; String foundHash; while ((foundHash = secruityToken.getHeader(String.format(sslIssuerHashBasicHeader, iHeader))) != null) { if (knownHashes.contains(foundHash.toLowerCase())) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Found matching ssl issuer hash at position {}", iHeader); } return foundHash.toLowerCase(); } iHeader++; } LOG_SECURITY_AUTH.debug( "Certifacte request but no matching hash found in headers {} for common name {} in request", sslIssuerHashBasicHeader, secruityToken.getHeader(caCommonNameHeader)); return null; }
[ "private", "String", "getIssuerHashHeader", "(", "final", "DmfTenantSecurityToken", "secruityToken", ",", "final", "String", "knownIssuerHashes", ")", "{", "// there may be several knownIssuerHashes configured for the tenant", "final", "List", "<", "String", ">", "knownHashes",...
Iterates over the {@link #sslIssuerHashBasicHeader} basic header {@code X-Ssl-Issuer-Hash-%d} and try to finds the same hash as known. It's ok if we find the the hash in any the trusted CA chain to accept this request for this tenant.
[ "Iterates", "over", "the", "{" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-integration/src/main/java/org/eclipse/hawkbit/security/ControllerPreAuthenticatedSecurityHeaderFilter.java#L123-L143
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.element
public JSONObject element( String key, Collection value ) { return element( key, value, new JsonConfig() ); }
java
public JSONObject element( String key, Collection value ) { return element( key, value, new JsonConfig() ); }
[ "public", "JSONObject", "element", "(", "String", "key", ",", "Collection", "value", ")", "{", "return", "element", "(", "key", ",", "value", ",", "new", "JsonConfig", "(", ")", ")", ";", "}" ]
Put a key/value pair in the JSONObject, where the value will be a JSONArray which is produced from a Collection. @param key A key string. @param value A Collection value. @return this. @throws JSONException
[ "Put", "a", "key", "/", "value", "pair", "in", "the", "JSONObject", "where", "the", "value", "will", "be", "a", "JSONArray", "which", "is", "produced", "from", "a", "Collection", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1583-L1585
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java
HttpUploadRequest.setBasicAuth
public B setBasicAuth(final String username, final String password) { String auth = Base64.encodeToString((username + ":" + password).getBytes(), Base64.NO_WRAP); httpParams.addHeader("Authorization", "Basic " + auth); return self(); }
java
public B setBasicAuth(final String username, final String password) { String auth = Base64.encodeToString((username + ":" + password).getBytes(), Base64.NO_WRAP); httpParams.addHeader("Authorization", "Basic " + auth); return self(); }
[ "public", "B", "setBasicAuth", "(", "final", "String", "username", ",", "final", "String", "password", ")", "{", "String", "auth", "=", "Base64", ".", "encodeToString", "(", "(", "username", "+", "\":\"", "+", "password", ")", ".", "getBytes", "(", ")", ...
Sets the HTTP Basic Authentication header. @param username HTTP Basic Auth username @param password HTTP Basic Auth password @return self instance
[ "Sets", "the", "HTTP", "Basic", "Authentication", "header", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/HttpUploadRequest.java#L72-L76
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertSqlXml
public static Object convertSqlXml(Connection conn, InputStream input) throws SQLException { return convertSqlXml(conn, toByteArray(input)); }
java
public static Object convertSqlXml(Connection conn, InputStream input) throws SQLException { return convertSqlXml(conn, toByteArray(input)); }
[ "public", "static", "Object", "convertSqlXml", "(", "Connection", "conn", ",", "InputStream", "input", ")", "throws", "SQLException", "{", "return", "convertSqlXml", "(", "conn", ",", "toByteArray", "(", "input", ")", ")", ";", "}" ]
Transfers data from InputStream into sql.SQLXML <p/> Using default locale. If different locale is required see {@link #convertSqlXml(java.sql.Connection, String)} @param conn connection for which sql.SQLXML object would be created @param input InputStream @return sql.SQLXML from InputStream @throws SQLException
[ "Transfers", "data", "from", "InputStream", "into", "sql", ".", "SQLXML", "<p", "/", ">", "Using", "default", "locale", ".", "If", "different", "locale", "is", "required", "see", "{", "@link", "#convertSqlXml", "(", "java", ".", "sql", ".", "Connection", "...
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L320-L322
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java
GoogleCloudStorageImpl.getObject
private StorageObject getObject(StorageResourceId resourceId) throws IOException { logger.atFine().log("getObject(%s)", resourceId); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); Storage.Objects.Get getObject = configureRequest(gcs.objects().get(bucketName, objectName), bucketName); try { return getObject.execute(); } catch (IOException e) { if (errorExtractor.itemNotFound(e)) { logger.atFine().withCause(e).log("getObject(%s): not found", resourceId); return null; } throw new IOException("Error accessing " + resourceId, e); } }
java
private StorageObject getObject(StorageResourceId resourceId) throws IOException { logger.atFine().log("getObject(%s)", resourceId); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); Storage.Objects.Get getObject = configureRequest(gcs.objects().get(bucketName, objectName), bucketName); try { return getObject.execute(); } catch (IOException e) { if (errorExtractor.itemNotFound(e)) { logger.atFine().withCause(e).log("getObject(%s): not found", resourceId); return null; } throw new IOException("Error accessing " + resourceId, e); } }
[ "private", "StorageObject", "getObject", "(", "StorageResourceId", "resourceId", ")", "throws", "IOException", "{", "logger", ".", "atFine", "(", ")", ".", "log", "(", "\"getObject(%s)\"", ",", "resourceId", ")", ";", "Preconditions", ".", "checkArgument", "(", ...
Gets the object with the given resourceId. @param resourceId identifies a StorageObject @return the object with the given name or null if object not found @throws IOException if the object exists but cannot be accessed
[ "Gets", "the", "object", "with", "the", "given", "resourceId", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java#L1834-L1852
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/ConsumerMonitorRegistrar.java
ConsumerMonitorRegistrar.addConsumerToRegisteredMonitors
public void addConsumerToRegisteredMonitors( MonitoredConsumer mc, ArrayList exactMonitorList, ArrayList wildcardMonitorList) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addConsumerToRegisteredMonitors", new Object[] { mc, exactMonitorList, wildcardMonitorList }); // Add consumer to correct places in the maps addConsumerToRegisteredMonitorMap(mc, exactMonitorList, _registeredExactConsumerMonitors); // Now process the wildcard monitor list addConsumerToRegisteredMonitorMap(mc, wildcardMonitorList, _registeredWildcardConsumerMonitors); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addConsumerToRegisteredMonitors"); }
java
public void addConsumerToRegisteredMonitors( MonitoredConsumer mc, ArrayList exactMonitorList, ArrayList wildcardMonitorList) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, "addConsumerToRegisteredMonitors", new Object[] { mc, exactMonitorList, wildcardMonitorList }); // Add consumer to correct places in the maps addConsumerToRegisteredMonitorMap(mc, exactMonitorList, _registeredExactConsumerMonitors); // Now process the wildcard monitor list addConsumerToRegisteredMonitorMap(mc, wildcardMonitorList, _registeredWildcardConsumerMonitors); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addConsumerToRegisteredMonitors"); }
[ "public", "void", "addConsumerToRegisteredMonitors", "(", "MonitoredConsumer", "mc", ",", "ArrayList", "exactMonitorList", ",", "ArrayList", "wildcardMonitorList", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEn...
Method addConsumerToRegisteredMonitors This method adds a new consumer to the appropriate places in each of the monitor maps. @param mc @param exactMonitorList @param wildcardMonitorList
[ "Method", "addConsumerToRegisteredMonitors" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/matching/ConsumerMonitorRegistrar.java#L707-L728
cbeust/jcommander
src/main/java/com/beust/jcommander/DefaultUsageFormatter.java
DefaultUsageFormatter.getI18nString
public static String getI18nString(ResourceBundle bundle, String key, String def) { String s = bundle != null ? bundle.getString(key) : null; return s != null ? s : def; }
java
public static String getI18nString(ResourceBundle bundle, String key, String def) { String s = bundle != null ? bundle.getString(key) : null; return s != null ? s : def; }
[ "public", "static", "String", "getI18nString", "(", "ResourceBundle", "bundle", ",", "String", "key", ",", "String", "def", ")", "{", "String", "s", "=", "bundle", "!=", "null", "?", "bundle", ".", "getString", "(", "key", ")", ":", "null", ";", "return"...
Returns the internationalized version of the string if available, otherwise it returns <tt>def</tt>. @return the internationalized version of the string if available, otherwise it returns <tt>def</tt>
[ "Returns", "the", "internationalized", "version", "of", "the", "string", "if", "available", "otherwise", "it", "returns", "<tt", ">", "def<", "/", "tt", ">", "." ]
train
https://github.com/cbeust/jcommander/blob/85cb6f7217e15f62225185ffd97491f34b7b49bb/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java#L362-L365
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/scripting/ExecutableScript.java
ExecutableScript.execute
public Object execute(ScriptEngine scriptEngine, VariableScope variableScope, Bindings bindings) { return evaluate(scriptEngine, variableScope, bindings); }
java
public Object execute(ScriptEngine scriptEngine, VariableScope variableScope, Bindings bindings) { return evaluate(scriptEngine, variableScope, bindings); }
[ "public", "Object", "execute", "(", "ScriptEngine", "scriptEngine", ",", "VariableScope", "variableScope", ",", "Bindings", "bindings", ")", "{", "return", "evaluate", "(", "scriptEngine", ",", "variableScope", ",", "bindings", ")", ";", "}" ]
<p>Evaluates the script using the provided engine and bindings</p> @param scriptEngine the script engine to use for evaluating the script. @param variableScope the variable scope of the execution @param bindings the bindings to use for evaluating the script. @throws ProcessEngineException in case the script cannot be evaluated. @return the result of the script evaluation
[ "<p", ">", "Evaluates", "the", "script", "using", "the", "provided", "engine", "and", "bindings<", "/", "p", ">" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/scripting/ExecutableScript.java#L62-L64
apache/incubator-gobblin
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveSerDeWrapper.java
HiveSerDeWrapper.getSerDe
public SerDe getSerDe() throws IOException { if (!this.serDe.isPresent()) { try { this.serDe = Optional.of(SerDe.class.cast(Class.forName(this.serDeClassName).newInstance())); } catch (Throwable t) { throw new IOException("Failed to instantiate SerDe " + this.serDeClassName, t); } } return this.serDe.get(); }
java
public SerDe getSerDe() throws IOException { if (!this.serDe.isPresent()) { try { this.serDe = Optional.of(SerDe.class.cast(Class.forName(this.serDeClassName).newInstance())); } catch (Throwable t) { throw new IOException("Failed to instantiate SerDe " + this.serDeClassName, t); } } return this.serDe.get(); }
[ "public", "SerDe", "getSerDe", "(", ")", "throws", "IOException", "{", "if", "(", "!", "this", ".", "serDe", ".", "isPresent", "(", ")", ")", "{", "try", "{", "this", ".", "serDe", "=", "Optional", ".", "of", "(", "SerDe", ".", "class", ".", "cast"...
Get the {@link SerDe} instance associated with this {@link HiveSerDeWrapper}. This method performs lazy initialization.
[ "Get", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveSerDeWrapper.java#L110-L119
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java
JavaAnnotationMetadataBuilder.hasAnnotation
public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann) { List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) { return true; } } return false; }
java
public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann) { List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors(); for (AnnotationMirror annotationMirror : annotationMirrors) { if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) { return true; } } return false; }
[ "public", "static", "boolean", "hasAnnotation", "(", "ExecutableElement", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "ann", ")", "{", "List", "<", "?", "extends", "AnnotationMirror", ">", "annotationMirrors", "=", "method", ".", "getAnnotati...
Checks if a method has an annotation. @param method The method @param ann The annotation to look for @return Whether if the method has the annotation
[ "Checks", "if", "a", "method", "has", "an", "annotation", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java#L422-L430
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java
UnImplNode.replaceChild
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!"); return null; }
java
public Node replaceChild(Node newChild, Node oldChild) throws DOMException { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!"); return null; }
[ "public", "Node", "replaceChild", "(", "Node", "newChild", ",", "Node", "oldChild", ")", "throws", "DOMException", "{", "error", "(", "XMLErrorResources", ".", "ER_FUNCTION_NOT_SUPPORTED", ")", ";", "//\"replaceChild not supported!\");", "return", "null", ";", "}" ]
Unimplemented. See org.w3c.dom.Node @param newChild Replace existing child with this one @param oldChild Existing child to be replaced @return null @throws DOMException
[ "Unimplemented", ".", "See", "org", ".", "w3c", ".", "dom", ".", "Node" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java#L674-L680
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/WhitelistingApi.java
WhitelistingApi.getUploadStatus
public UploadStatusEnvelope getUploadStatus(String dtid, String uploadId) throws ApiException { ApiResponse<UploadStatusEnvelope> resp = getUploadStatusWithHttpInfo(dtid, uploadId); return resp.getData(); }
java
public UploadStatusEnvelope getUploadStatus(String dtid, String uploadId) throws ApiException { ApiResponse<UploadStatusEnvelope> resp = getUploadStatusWithHttpInfo(dtid, uploadId); return resp.getData(); }
[ "public", "UploadStatusEnvelope", "getUploadStatus", "(", "String", "dtid", ",", "String", "uploadId", ")", "throws", "ApiException", "{", "ApiResponse", "<", "UploadStatusEnvelope", ">", "resp", "=", "getUploadStatusWithHttpInfo", "(", "dtid", ",", "uploadId", ")", ...
Get the status of a uploaded CSV file. Get the status of a uploaded CSV file. @param dtid Device type id related to the uploaded CSV file. (required) @param uploadId Upload id related to the uploaded CSV file. (required) @return UploadStatusEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "status", "of", "a", "uploaded", "CSV", "file", ".", "Get", "the", "status", "of", "a", "uploaded", "CSV", "file", "." ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L658-L661
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateGuardEvaluators
protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) { final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO); final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container); if (guardEvaluators == null) { return; } boolean first = true; for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) { if (first) { first = false; } else { it.newLine(); } it.append("def __guard_"); //$NON-NLS-1$ it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$ it.append("__(self, occurrence):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); it.append("it = occurrence").newLine(); //$NON-NLS-1$ final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$ it.append(eventHandleName).append(" = list"); //$NON-NLS-1$ for (final Pair<XExpression, String> guardDesc : entry.getValue()) { it.newLine(); if (guardDesc.getKey() == null) { it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { it.append("if "); //$NON-NLS-1$ generate(guardDesc.getKey(), null, it, context); it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$ it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation(); } } it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$ it.decreaseIndentation().newLine(); } }
java
protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) { final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO); final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container); if (guardEvaluators == null) { return; } boolean first = true; for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) { if (first) { first = false; } else { it.newLine(); } it.append("def __guard_"); //$NON-NLS-1$ it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$ it.append("__(self, occurrence):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); it.append("it = occurrence").newLine(); //$NON-NLS-1$ final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$ it.append(eventHandleName).append(" = list"); //$NON-NLS-1$ for (final Pair<XExpression, String> guardDesc : entry.getValue()) { it.newLine(); if (guardDesc.getKey() == null) { it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { it.append("if "); //$NON-NLS-1$ generate(guardDesc.getKey(), null, it, context); it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$ it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation(); } } it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$ it.decreaseIndentation().newLine(); } }
[ "protected", "void", "generateGuardEvaluators", "(", "String", "container", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "Pair", "<", "XExpressi...
Generate the memorized guard evaluators. @param container the fully qualified name of the container of the guards. @param it the output. @param context the generation context.
[ "Generate", "the", "memorized", "guard", "evaluators", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L601-L636
threerings/nenya
core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java
SubtitleChatOverlay.getHistorySubtitle
protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx) { // do a brute search (over a small set) for an already-created subtitle for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); if (cg.histIndex == index) { return cg; } } // it looks like we have to create a new one: expensive! ChatGlyph cg = createHistorySubtitle(index, layoutGfx); cg.histIndex = index; cg.setDim(_dimmed); _showingHistory.add(cg); return cg; }
java
protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx) { // do a brute search (over a small set) for an already-created subtitle for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) { ChatGlyph cg = _showingHistory.get(ii); if (cg.histIndex == index) { return cg; } } // it looks like we have to create a new one: expensive! ChatGlyph cg = createHistorySubtitle(index, layoutGfx); cg.histIndex = index; cg.setDim(_dimmed); _showingHistory.add(cg); return cg; }
[ "protected", "ChatGlyph", "getHistorySubtitle", "(", "int", "index", ",", "Graphics2D", "layoutGfx", ")", "{", "// do a brute search (over a small set) for an already-created subtitle", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "_showingHistory", ".", "size", ...
Get the glyph for the specified history index, creating if necessary.
[ "Get", "the", "glyph", "for", "the", "specified", "history", "index", "creating", "if", "necessary", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L484-L500
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java
KafkaUtils.setPartitionAvgRecordMillis
public static void setPartitionAvgRecordMillis(State state, KafkaPartition partition, double millis) { state.setProp( getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS, millis); }
java
public static void setPartitionAvgRecordMillis(State state, KafkaPartition partition, double millis) { state.setProp( getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS, millis); }
[ "public", "static", "void", "setPartitionAvgRecordMillis", "(", "State", "state", ",", "KafkaPartition", "partition", ",", "double", "millis", ")", "{", "state", ".", "setProp", "(", "getPartitionPropName", "(", "partition", ".", "getTopicName", "(", ")", ",", "...
Set the average time in milliseconds to pull a record of a partition, which will be stored in property "[topicname].[partitionid].avg.record.millis".
[ "Set", "the", "average", "time", "in", "milliseconds", "to", "pull", "a", "record", "of", "a", "partition", "which", "will", "be", "stored", "in", "property", "[", "topicname", "]", ".", "[", "partitionid", "]", ".", "avg", ".", "record", ".", "millis", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java#L167-L171
google/closure-templates
java/src/com/google/template/soy/conformance/Rule.java
Rule.checkConformance
final void checkConformance(Node node, ErrorReporter errorReporter) { if (nodeClass.isAssignableFrom(node.getClass())) { doCheckConformance(nodeClass.cast(node), errorReporter); } }
java
final void checkConformance(Node node, ErrorReporter errorReporter) { if (nodeClass.isAssignableFrom(node.getClass())) { doCheckConformance(nodeClass.cast(node), errorReporter); } }
[ "final", "void", "checkConformance", "(", "Node", "node", ",", "ErrorReporter", "errorReporter", ")", "{", "if", "(", "nodeClass", ".", "isAssignableFrom", "(", "node", ".", "getClass", "(", ")", ")", ")", "{", "doCheckConformance", "(", "nodeClass", ".", "c...
Checks whether the given node is relevant for this rule, and, if so, checks whether the node conforms to the rule. Intended to be called only from {@link SoyConformance}.
[ "Checks", "whether", "the", "given", "node", "is", "relevant", "for", "this", "rule", "and", "if", "so", "checks", "whether", "the", "node", "conforms", "to", "the", "rule", ".", "Intended", "to", "be", "called", "only", "from", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/conformance/Rule.java#L56-L60
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java
MonetaryFunctions.sortNumberDesc
public static Comparator<MonetaryAmount> sortNumberDesc(){ return new Comparator<MonetaryAmount>() { @Override public int compare(MonetaryAmount o1, MonetaryAmount o2) { return sortNumber().compare(o1, o2) * -1; } }; }
java
public static Comparator<MonetaryAmount> sortNumberDesc(){ return new Comparator<MonetaryAmount>() { @Override public int compare(MonetaryAmount o1, MonetaryAmount o2) { return sortNumber().compare(o1, o2) * -1; } }; }
[ "public", "static", "Comparator", "<", "MonetaryAmount", ">", "sortNumberDesc", "(", ")", "{", "return", "new", "Comparator", "<", "MonetaryAmount", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "MonetaryAmount", "o1", ",", "MonetaryAmo...
Get a comparator for sorting amount by number value descending. @return the Comparator to sort by number in descending way, not null.
[ "Get", "a", "comparator", "for", "sorting", "amount", "by", "number", "value", "descending", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L152-L159
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/StorageRef.java
StorageRef.isAuthenticated
public StorageRef isAuthenticated(String authenticationToken, OnBooleanResponse onBooleanResponse, OnError onError){ PostBodyBuilder pbb = new PostBodyBuilder(context); Rest r = new Rest(context, RestType.ISAUTHENTICATED, pbb, null); r.onError = onError; r.onBooleanResponse = onBooleanResponse; r.rawBody = "{\"applicationKey\":\""+context.applicationKey+"\", \"authenticationToken\":\""+authenticationToken+"\"}"; context.processRest(r); return this; }
java
public StorageRef isAuthenticated(String authenticationToken, OnBooleanResponse onBooleanResponse, OnError onError){ PostBodyBuilder pbb = new PostBodyBuilder(context); Rest r = new Rest(context, RestType.ISAUTHENTICATED, pbb, null); r.onError = onError; r.onBooleanResponse = onBooleanResponse; r.rawBody = "{\"applicationKey\":\""+context.applicationKey+"\", \"authenticationToken\":\""+authenticationToken+"\"}"; context.processRest(r); return this; }
[ "public", "StorageRef", "isAuthenticated", "(", "String", "authenticationToken", ",", "OnBooleanResponse", "onBooleanResponse", ",", "OnError", "onError", ")", "{", "PostBodyBuilder", "pbb", "=", "new", "PostBodyBuilder", "(", "context", ")", ";", "Rest", "r", "=", ...
Checks if a specified authentication token is authenticated. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); storage.isAuthenticated("authToken",new OnBooleanResponse() { &#064;Override public void run(Boolean aBoolean) { Log.d("StorageRef", "Is Authenticated? : " + aBoolean); } }, new OnError() { &#064;Override public void run(Integer integer, String errorMessage) { Log.e("StorageRef","Error checking authentication: " + errorMessage); } }); </pre> @param authenticationToken The token to verify. @param onBooleanResponse The callback to call when the operation is completed, with an argument as a result of verification. @param onError The callback to call if an exception occurred @return Current storage reference
[ "Checks", "if", "a", "specified", "authentication", "token", "is", "authenticated", "." ]
train
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/StorageRef.java#L408-L416
zandero/mail
src/main/java/com/zandero/mail/MailMessage.java
MailMessage.defaultFrom
public MailMessage defaultFrom(String email, String name) { if (StringUtils.isNullOrEmptyTrimmed(fromEmail)) { from(email, name); } if (!StringUtils.isNullOrEmptyTrimmed(email) && StringUtils.equals(fromEmail, email.trim(), true) && StringUtils.isNullOrEmptyTrimmed(fromName)) { from(email, name); } return this; }
java
public MailMessage defaultFrom(String email, String name) { if (StringUtils.isNullOrEmptyTrimmed(fromEmail)) { from(email, name); } if (!StringUtils.isNullOrEmptyTrimmed(email) && StringUtils.equals(fromEmail, email.trim(), true) && StringUtils.isNullOrEmptyTrimmed(fromName)) { from(email, name); } return this; }
[ "public", "MailMessage", "defaultFrom", "(", "String", "email", ",", "String", "name", ")", "{", "if", "(", "StringUtils", ".", "isNullOrEmptyTrimmed", "(", "fromEmail", ")", ")", "{", "from", "(", "email", ",", "name", ")", ";", "}", "if", "(", "!", "...
Sets from email address only if not already set @param email target email address @param name target name associated with email address @return mail message
[ "Sets", "from", "email", "address", "only", "if", "not", "already", "set" ]
train
https://github.com/zandero/mail/blob/2e30fe99e1dde755113bd4652b01033c0583f8a6/src/main/java/com/zandero/mail/MailMessage.java#L242-L255
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/cli/CommandLineParser.java
CommandLineParser.processOption
protected String processOption(DefaultCommandLine cl, String arg) { if (arg.length() < 2) { return null; } if (arg.charAt(1) == 'D' && arg.contains("=")) { processSystemArg(cl, arg); return null; } arg = (arg.charAt(1) == '-' ? arg.substring(2, arg.length()) : arg.substring(1, arg.length())).trim(); if (arg.contains("=")) { String[] split = arg.split("="); String name = split[0].trim(); validateOptionName(name); String value = split[1].trim(); if (declaredOptions.containsKey(name)) { cl.addDeclaredOption(declaredOptions.get(name), value); } else { cl.addUndeclaredOption(name, value); } return null; } validateOptionName(arg); if (declaredOptions.containsKey(arg)) { cl.addDeclaredOption(declaredOptions.get(arg)); } else { cl.addUndeclaredOption(arg); } return arg; }
java
protected String processOption(DefaultCommandLine cl, String arg) { if (arg.length() < 2) { return null; } if (arg.charAt(1) == 'D' && arg.contains("=")) { processSystemArg(cl, arg); return null; } arg = (arg.charAt(1) == '-' ? arg.substring(2, arg.length()) : arg.substring(1, arg.length())).trim(); if (arg.contains("=")) { String[] split = arg.split("="); String name = split[0].trim(); validateOptionName(name); String value = split[1].trim(); if (declaredOptions.containsKey(name)) { cl.addDeclaredOption(declaredOptions.get(name), value); } else { cl.addUndeclaredOption(name, value); } return null; } validateOptionName(arg); if (declaredOptions.containsKey(arg)) { cl.addDeclaredOption(declaredOptions.get(arg)); } else { cl.addUndeclaredOption(arg); } return arg; }
[ "protected", "String", "processOption", "(", "DefaultCommandLine", "cl", ",", "String", "arg", ")", "{", "if", "(", "arg", ".", "length", "(", ")", "<", "2", ")", "{", "return", "null", ";", "}", "if", "(", "arg", ".", "charAt", "(", "1", ")", "=="...
Process the passed in options. @param cl cl @param arg arg @return argument processed
[ "Process", "the", "passed", "in", "options", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/cli/CommandLineParser.java#L153-L185
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.asyncBidiStreamingCall
public static <ReqT, RespT> StreamObserver<ReqT> asyncBidiStreamingCall( ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) { return asyncStreamingRequestCall(call, responseObserver, true); }
java
public static <ReqT, RespT> StreamObserver<ReqT> asyncBidiStreamingCall( ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) { return asyncStreamingRequestCall(call, responseObserver, true); }
[ "public", "static", "<", "ReqT", ",", "RespT", ">", "StreamObserver", "<", "ReqT", ">", "asyncBidiStreamingCall", "(", "ClientCall", "<", "ReqT", ",", "RespT", ">", "call", ",", "StreamObserver", "<", "RespT", ">", "responseObserver", ")", "{", "return", "as...
Executes a bidirectional-streaming call. The {@code call} should not be already started. After calling this method, {@code call} should no longer be used. @return request stream observer.
[ "Executes", "a", "bidirectional", "-", "streaming", "call", ".", "The", "{", "@code", "call", "}", "should", "not", "be", "already", "started", ".", "After", "calling", "this", "method", "{", "@code", "call", "}", "should", "no", "longer", "be", "used", ...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L96-L99
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/Projection.java
Projection.fromPixels
public IGeoPoint fromPixels(final int pPixelX, final int pPixelY, final GeoPoint pReuse) { return fromPixels(pPixelX, pPixelY, pReuse, false); }
java
public IGeoPoint fromPixels(final int pPixelX, final int pPixelY, final GeoPoint pReuse) { return fromPixels(pPixelX, pPixelY, pReuse, false); }
[ "public", "IGeoPoint", "fromPixels", "(", "final", "int", "pPixelX", ",", "final", "int", "pPixelY", ",", "final", "GeoPoint", "pReuse", ")", "{", "return", "fromPixels", "(", "pPixelX", ",", "pPixelY", ",", "pReuse", ",", "false", ")", ";", "}" ]
note: if {@link MapView#setHorizontalMapRepetitionEnabled(boolean)} or {@link MapView#setVerticalMapRepetitionEnabled(boolean)} is false, then this can return values that beyond the max extents of the world. This may or may not be desired. <a href="https://github.com/osmdroid/osmdroid/pull/722">https://github.com/osmdroid/osmdroid/pull/722</a> for more information and the discussion associated with this. @param pPixelX @param pPixelY @param pReuse @return
[ "note", ":", "if", "{" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/Projection.java#L163-L165
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.concatMapCompletable
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) public final Completable concatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, int prefetch) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapCompletable<T>(this, mapper, ErrorMode.IMMEDIATE, prefetch)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) @BackpressureSupport(BackpressureKind.FULL) public final Completable concatMapCompletable(Function<? super T, ? extends CompletableSource> mapper, int prefetch) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new FlowableConcatMapCompletable<T>(this, mapper, ErrorMode.IMMEDIATE, prefetch)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "FULL", ")", "public", "final", "Completable", "concatMapCompletable", "(", "Function", "<", "?", "super", "T", "...
Maps the upstream items into {@link CompletableSource}s and subscribes to them one after the other completes. <p> <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/concatMap.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator expects the upstream to support backpressure. If this {@code Flowable} violates the rule, the operator will signal a {@code MissingBackpressureException}.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code concatMapCompletable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.1.11 - experimental @param mapper the function called with the upstream item and should return a {@code CompletableSource} to become the next source to be subscribed to @param prefetch The number of upstream items to prefetch so that fresh items are ready to be mapped when a previous {@code CompletableSource} terminates. The operator replenishes after half of the prefetch amount has been consumed and turned into {@code CompletableSource}s. @return a new Completable instance @see #concatMapCompletableDelayError(Function, boolean, int) @since 2.2
[ "Maps", "the", "upstream", "items", "into", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L7182-L7189
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java
MultiLayerNetwork.calculateGradients
public Pair<Gradient,INDArray> calculateGradients(@NonNull INDArray features, @NonNull INDArray label, INDArray fMask, INDArray labelMask) { try{ return calculateGradientsHelper(features, label, fMask, labelMask); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
java
public Pair<Gradient,INDArray> calculateGradients(@NonNull INDArray features, @NonNull INDArray label, INDArray fMask, INDArray labelMask) { try{ return calculateGradientsHelper(features, label, fMask, labelMask); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
[ "public", "Pair", "<", "Gradient", ",", "INDArray", ">", "calculateGradients", "(", "@", "NonNull", "INDArray", "features", ",", "@", "NonNull", "INDArray", "label", ",", "INDArray", "fMask", ",", "INDArray", "labelMask", ")", "{", "try", "{", "return", "cal...
Calculate parameter gradients and input activation gradients given the input and labels, and optionally mask arrays @param features Features for gradient calculation @param label Labels for gradient @param fMask Features mask array (may be null) @param labelMask Label mask array (may be null) @return A pair of gradient arrays: parameter gradients (in Gradient object) and input activation gradients
[ "Calculate", "parameter", "gradients", "and", "input", "activation", "gradients", "given", "the", "input", "and", "labels", "and", "optionally", "mask", "arrays" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/multilayer/MultiLayerNetwork.java#L1708-L1716
headius/invokebinder
src/main/java/com/headius/invokebinder/SmartHandle.java
SmartHandle.dropLast
public SmartHandle dropLast(String newName, Class<?> type) { return new SmartHandle(signature.appendArg(newName, type), MethodHandles.dropArguments(handle, signature.argOffset(newName), type)); }
java
public SmartHandle dropLast(String newName, Class<?> type) { return new SmartHandle(signature.appendArg(newName, type), MethodHandles.dropArguments(handle, signature.argOffset(newName), type)); }
[ "public", "SmartHandle", "dropLast", "(", "String", "newName", ",", "Class", "<", "?", ">", "type", ")", "{", "return", "new", "SmartHandle", "(", "signature", ".", "appendArg", "(", "newName", ",", "type", ")", ",", "MethodHandles", ".", "dropArguments", ...
Drop an argument from the handle at the end, returning a new SmartHandle. @param newName name of the argument @param type type of the argument @return a new SmartHandle with the additional argument
[ "Drop", "an", "argument", "from", "the", "handle", "at", "the", "end", "returning", "a", "new", "SmartHandle", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartHandle.java#L204-L206
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.weekNumber
protected int weekNumber(int desiredDay, int dayOfPeriod, int dayOfWeek) { // Determine the day of the week of the first day of the period // in question (either a year or a month). Zero represents the // first day of the week on this calendar. int periodStartDayOfWeek = (dayOfWeek - getFirstDayOfWeek() - dayOfPeriod + 1) % 7; if (periodStartDayOfWeek < 0) periodStartDayOfWeek += 7; // Compute the week number. Initially, ignore the first week, which // may be fractional (or may not be). We add periodStartDayOfWeek in // order to fill out the first week, if it is fractional. int weekNo = (desiredDay + periodStartDayOfWeek - 1)/7; // If the first week is long enough, then count it. If // the minimal days in the first week is one, or if the period start // is zero, we always increment weekNo. if ((7 - periodStartDayOfWeek) >= getMinimalDaysInFirstWeek()) ++weekNo; return weekNo; }
java
protected int weekNumber(int desiredDay, int dayOfPeriod, int dayOfWeek) { // Determine the day of the week of the first day of the period // in question (either a year or a month). Zero represents the // first day of the week on this calendar. int periodStartDayOfWeek = (dayOfWeek - getFirstDayOfWeek() - dayOfPeriod + 1) % 7; if (periodStartDayOfWeek < 0) periodStartDayOfWeek += 7; // Compute the week number. Initially, ignore the first week, which // may be fractional (or may not be). We add periodStartDayOfWeek in // order to fill out the first week, if it is fractional. int weekNo = (desiredDay + periodStartDayOfWeek - 1)/7; // If the first week is long enough, then count it. If // the minimal days in the first week is one, or if the period start // is zero, we always increment weekNo. if ((7 - periodStartDayOfWeek) >= getMinimalDaysInFirstWeek()) ++weekNo; return weekNo; }
[ "protected", "int", "weekNumber", "(", "int", "desiredDay", ",", "int", "dayOfPeriod", ",", "int", "dayOfWeek", ")", "{", "// Determine the day of the week of the first day of the period", "// in question (either a year or a month). Zero represents the", "// first day of the week on...
Returns the week number of a day, within a period. This may be the week number in a year or the week number in a month. Usually this will be a value &gt;= 1, but if some initial days of the period are excluded from week 1, because {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is &gt; 1, then the week number will be zero for those initial days. This method requires the day number and day of week for some known date in the period in order to determine the day of week on the desired day. <p> <b>Subclassing:</b> <br> This method is intended for use by subclasses in implementing their {@link #computeTime computeTime} and/or {@link #computeFields computeFields} methods. It is often useful in {@link #getActualMinimum getActualMinimum} and {@link #getActualMaximum getActualMaximum} as well. <p> This variant is handy for computing the week number of some other day of a period (often the first or last day of the period) when its day of the week is not known but the day number and day of week for some other day in the period (e.g. the current date) <em>is</em> known. <p> @param desiredDay The {@link #DAY_OF_YEAR DAY_OF_YEAR} or {@link #DAY_OF_MONTH DAY_OF_MONTH} whose week number is desired. Should be 1 for the first day of the period. @param dayOfPeriod The {@link #DAY_OF_YEAR DAY_OF_YEAR} or {@link #DAY_OF_MONTH DAY_OF_MONTH} for a day in the period whose {@link #DAY_OF_WEEK DAY_OF_WEEK} is specified by the <code>dayOfWeek</code> parameter. Should be 1 for first day of period. @param dayOfWeek The {@link #DAY_OF_WEEK DAY_OF_WEEK} for the day corresponding to the <code>dayOfPeriod</code> parameter. 1-based with 1=Sunday. @return The week number (one-based), or zero if the day falls before the first week because {@link #getMinimalDaysInFirstWeek getMinimalDaysInFirstWeek} is more than one.
[ "Returns", "the", "week", "number", "of", "a", "day", "within", "a", "period", ".", "This", "may", "be", "the", "week", "number", "in", "a", "year", "or", "the", "week", "number", "in", "a", "month", ".", "Usually", "this", "will", "be", "a", "value"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L3828-L3847
structurizr/java
structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java
DocumentationTemplate.addSection
public Section addSection(SoftwareSystem softwareSystem, String title, Format format, String content) { return add(softwareSystem, title, format, content); }
java
public Section addSection(SoftwareSystem softwareSystem, String title, Format format, String content) { return add(softwareSystem, title, format, content); }
[ "public", "Section", "addSection", "(", "SoftwareSystem", "softwareSystem", ",", "String", "title", ",", "Format", "format", ",", "String", "content", ")", "{", "return", "add", "(", "softwareSystem", ",", "title", ",", "format", ",", "content", ")", ";", "}...
Adds a section relating to a {@link SoftwareSystem}. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param title the section title @param format the {@link Format} of the documentation content @param content a String containing the documentation content @return a documentation {@link Section}
[ "Adds", "a", "section", "relating", "to", "a", "{", "@link", "SoftwareSystem", "}", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L87-L89
lessthanoptimal/BoofCV
integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java
SimpleCamera2Activity.configureTransform
private void configureTransform(int viewWidth, int viewHeight) { int cameraWidth,cameraHeight; try { open.mLock.lock(); if (null == mTextureView || null == open.mCameraSize) { return; } cameraWidth = open.mCameraSize.getWidth(); cameraHeight = open.mCameraSize.getHeight(); } finally { open.mLock.unlock(); } int rotation = getWindowManager().getDefaultDisplay().getRotation(); Matrix matrix = new Matrix(); RectF viewRect = new RectF(0, 0, viewWidth, viewHeight); RectF bufferRect = new RectF(0, 0, cameraHeight, cameraWidth);// TODO why w/h swapped? float centerX = viewRect.centerX(); float centerY = viewRect.centerY(); if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) { bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY()); matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL); float scale = Math.max( (float) viewHeight / cameraHeight, (float) viewWidth / cameraWidth); matrix.postScale(scale, scale, centerX, centerY); matrix.postRotate(90 * (rotation - 2), centerX, centerY); } mTextureView.setTransform(matrix); }
java
private void configureTransform(int viewWidth, int viewHeight) { int cameraWidth,cameraHeight; try { open.mLock.lock(); if (null == mTextureView || null == open.mCameraSize) { return; } cameraWidth = open.mCameraSize.getWidth(); cameraHeight = open.mCameraSize.getHeight(); } finally { open.mLock.unlock(); } int rotation = getWindowManager().getDefaultDisplay().getRotation(); Matrix matrix = new Matrix(); RectF viewRect = new RectF(0, 0, viewWidth, viewHeight); RectF bufferRect = new RectF(0, 0, cameraHeight, cameraWidth);// TODO why w/h swapped? float centerX = viewRect.centerX(); float centerY = viewRect.centerY(); if (Surface.ROTATION_90 == rotation || Surface.ROTATION_270 == rotation) { bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY()); matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL); float scale = Math.max( (float) viewHeight / cameraHeight, (float) viewWidth / cameraWidth); matrix.postScale(scale, scale, centerX, centerY); matrix.postRotate(90 * (rotation - 2), centerX, centerY); } mTextureView.setTransform(matrix); }
[ "private", "void", "configureTransform", "(", "int", "viewWidth", ",", "int", "viewHeight", ")", "{", "int", "cameraWidth", ",", "cameraHeight", ";", "try", "{", "open", ".", "mLock", ".", "lock", "(", ")", ";", "if", "(", "null", "==", "mTextureView", "...
Configures the necessary {@link Matrix} transformation to `mTextureView`. This method should not to be called until the camera preview size is determined in openCamera, or until the size of `mTextureView` is fixed. @param viewWidth The width of `mTextureView` @param viewHeight The height of `mTextureView`
[ "Configures", "the", "necessary", "{", "@link", "Matrix", "}", "transformation", "to", "mTextureView", ".", "This", "method", "should", "not", "to", "be", "called", "until", "the", "camera", "preview", "size", "is", "determined", "in", "openCamera", "or", "unt...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/SimpleCamera2Activity.java#L728-L757
dustin/java-memcached-client
src/main/java/net/spy/memcached/tapmessage/RequestMessage.java
RequestMessage.setvBucketCheckpoints
public void setvBucketCheckpoints(Map<Short, Long> vbchkpnts) { int oldSize = (vBucketCheckpoints.size()) * 10; int newSize = (vbchkpnts.size()) * 10; totalbody += newSize - oldSize; vBucketCheckpoints = vbchkpnts; }
java
public void setvBucketCheckpoints(Map<Short, Long> vbchkpnts) { int oldSize = (vBucketCheckpoints.size()) * 10; int newSize = (vbchkpnts.size()) * 10; totalbody += newSize - oldSize; vBucketCheckpoints = vbchkpnts; }
[ "public", "void", "setvBucketCheckpoints", "(", "Map", "<", "Short", ",", "Long", ">", "vbchkpnts", ")", "{", "int", "oldSize", "=", "(", "vBucketCheckpoints", ".", "size", "(", ")", ")", "*", "10", ";", "int", "newSize", "=", "(", "vbchkpnts", ".", "s...
Sets a map of vbucket checkpoints. @param vbchkpnts - A map of vbucket checkpoint identifiers
[ "Sets", "a", "map", "of", "vbucket", "checkpoints", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/tapmessage/RequestMessage.java#L125-L130
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java
Segment3dfx.z2Property
@Pure public DoubleProperty z2Property() { if (this.p2.z == null) { this.p2.z = new SimpleDoubleProperty(this, MathFXAttributeNames.Z2); } return this.p2.z; }
java
@Pure public DoubleProperty z2Property() { if (this.p2.z == null) { this.p2.z = new SimpleDoubleProperty(this, MathFXAttributeNames.Z2); } return this.p2.z; }
[ "@", "Pure", "public", "DoubleProperty", "z2Property", "(", ")", "{", "if", "(", "this", ".", "p2", ".", "z", "==", "null", ")", "{", "this", ".", "p2", ".", "z", "=", "new", "SimpleDoubleProperty", "(", "this", ",", "MathFXAttributeNames", ".", "Z2", ...
Replies the property that is the z coordinate of the second segment point. @return the z2 property.
[ "Replies", "the", "property", "that", "is", "the", "z", "coordinate", "of", "the", "second", "segment", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java#L295-L301
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.isTextPresentInDropDown
public boolean isTextPresentInDropDown(final By by, final String text) { WebElement element = driver.findElement(by); List<WebElement> options = element.findElements(By .xpath(".//option[normalize-space(.) = " + escapeQuotes(text) + "]")); return options != null && !options.isEmpty(); }
java
public boolean isTextPresentInDropDown(final By by, final String text) { WebElement element = driver.findElement(by); List<WebElement> options = element.findElements(By .xpath(".//option[normalize-space(.) = " + escapeQuotes(text) + "]")); return options != null && !options.isEmpty(); }
[ "public", "boolean", "isTextPresentInDropDown", "(", "final", "By", "by", ",", "final", "String", "text", ")", "{", "WebElement", "element", "=", "driver", ".", "findElement", "(", "by", ")", ";", "List", "<", "WebElement", ">", "options", "=", "element", ...
Checks if a text is displayed in the drop-down. This method considers the actual display text. <br/> For example if we have the following situation: &lt;select id="test"&gt; &lt;option value="4"&gt;June&lt;/option&gt; &lt;/select&gt; we will call the method as follows: isValuePresentInDropDown(By.id("test"), "June"); @param by the method of identifying the drop-down @param text the text to search for @return true if the text is present or false otherwise
[ "Checks", "if", "a", "text", "is", "displayed", "in", "the", "drop", "-", "down", ".", "This", "method", "considers", "the", "actual", "display", "text", ".", "<br", "/", ">", "For", "example", "if", "we", "have", "the", "following", "situation", ":", ...
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L562-L568
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java
SwiftAPIClient.createObject
@Override public FSDataOutputStream createObject(String objName, String contentType, Map<String, String> metadata, Statistics statistics) throws IOException { final URL url = new URL(mJossAccount.getAccessURL() + "/" + getURLEncodedObjName(objName)); LOG.debug("PUT {}. Content-Type : {}", url.toString(), contentType); // When overwriting an object, cached metadata will be outdated String cachedName = getObjName(container + "/", objName); objectCache.remove(cachedName); try { final OutputStream sos; if (nonStreamingUpload) { sos = new SwiftNoStreamingOutputStream(mJossAccount, url, contentType, metadata, swiftConnectionManager, this); } else { sos = new SwiftOutputStream(mJossAccount, url, contentType, metadata, swiftConnectionManager); } return new FSDataOutputStream(sos, statistics); } catch (IOException e) { LOG.error(e.getMessage()); throw e; } }
java
@Override public FSDataOutputStream createObject(String objName, String contentType, Map<String, String> metadata, Statistics statistics) throws IOException { final URL url = new URL(mJossAccount.getAccessURL() + "/" + getURLEncodedObjName(objName)); LOG.debug("PUT {}. Content-Type : {}", url.toString(), contentType); // When overwriting an object, cached metadata will be outdated String cachedName = getObjName(container + "/", objName); objectCache.remove(cachedName); try { final OutputStream sos; if (nonStreamingUpload) { sos = new SwiftNoStreamingOutputStream(mJossAccount, url, contentType, metadata, swiftConnectionManager, this); } else { sos = new SwiftOutputStream(mJossAccount, url, contentType, metadata, swiftConnectionManager); } return new FSDataOutputStream(sos, statistics); } catch (IOException e) { LOG.error(e.getMessage()); throw e; } }
[ "@", "Override", "public", "FSDataOutputStream", "createObject", "(", "String", "objName", ",", "String", "contentType", ",", "Map", "<", "String", ",", "String", ">", "metadata", ",", "Statistics", "statistics", ")", "throws", "IOException", "{", "final", "URL"...
Direct HTTP PUT request without JOSS package @param objName name of the object @param contentType content type @return HttpURLConnection
[ "Direct", "HTTP", "PUT", "request", "without", "JOSS", "package" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java#L641-L665
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java
SimpleFormValidator.valueLesserThan
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value) { return valueLesserThan(field, errorMsg, value, false); }
java
public FormInputValidator valueLesserThan (VisValidatableTextField field, String errorMsg, float value) { return valueLesserThan(field, errorMsg, value, false); }
[ "public", "FormInputValidator", "valueLesserThan", "(", "VisValidatableTextField", "field", ",", "String", "errorMsg", ",", "float", "value", ")", "{", "return", "valueLesserThan", "(", "field", ",", "errorMsg", ",", "value", ",", "false", ")", ";", "}" ]
Validates if entered text is lesser than entered number <p> Can be used in combination with {@link #integerNumber(VisValidatableTextField, String)} to only allows integers.
[ "Validates", "if", "entered", "text", "is", "lesser", "than", "entered", "number", "<p", ">", "Can", "be", "used", "in", "combination", "with", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/form/SimpleFormValidator.java#L133-L135
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java
XmlWriter.writeText
public void writeText(char[] buf, int offset, int length) { closeElementIfNeeded(false); writeIndentIfNewLine(); _strategy.writeText(this, buf, offset, length); }
java
public void writeText(char[] buf, int offset, int length) { closeElementIfNeeded(false); writeIndentIfNewLine(); _strategy.writeText(this, buf, offset, length); }
[ "public", "void", "writeText", "(", "char", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "closeElementIfNeeded", "(", "false", ")", ";", "writeIndentIfNewLine", "(", ")", ";", "_strategy", ".", "writeText", "(", "this", ",", "bu...
Close an open element (if any), then write with escaping as needed.
[ "Close", "an", "open", "element", "(", "if", "any", ")", "then", "write", "with", "escaping", "as", "needed", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java#L355-L360
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/render/ResponseStateManager.java
ResponseStateManager.getState
public Object getState(FacesContext context, String viewId) { Object stateArray[] = { getTreeStructureToRestore(context, viewId), getComponentStateToRestore(context) }; return stateArray; }
java
public Object getState(FacesContext context, String viewId) { Object stateArray[] = { getTreeStructureToRestore(context, viewId), getComponentStateToRestore(context) }; return stateArray; }
[ "public", "Object", "getState", "(", "FacesContext", "context", ",", "String", "viewId", ")", "{", "Object", "stateArray", "[", "]", "=", "{", "getTreeStructureToRestore", "(", "context", ",", "viewId", ")", ",", "getComponentStateToRestore", "(", "context", ")"...
<p><span class="changed_modified_2_2">The</span> implementation must inspect the current request and return an Object representing the tree structure and component state passed in to a previous invocation of {@link #writeState(javax.faces.context.FacesContext,java.lang.Object)}.</p> <p class="changed_added_2_2">If the state saving method for this application is {@link javax.faces.application.StateManager#STATE_SAVING_METHOD_CLIENT}, <code>writeState()</code> will have encrypted the state in a tamper evident manner. If the state fails to decrypt, or decrypts but indicates evidence of tampering, a {@link javax.faces.application.ProtectedViewException} must be thrown.</p> <p>For backwards compatability with existing <code>ResponseStateManager</code> implementations, the default implementation of this method calls {@link #getTreeStructureToRestore} and {@link #getComponentStateToRestore} and creates and returns a two element <code>Object</code> array with element zero containing the <code>structure</code> property and element one containing the <code>state</code> property of the <code>SerializedView</code>.</p> @since 1.2 @param context The {@link FacesContext} instance for the current request @param viewId View identifier of the view to be restored @return the tree structure and component state Object passed in to <code>writeState</code>. If this is an initial request, this method returns <code>null</code>.
[ "<p", ">", "<span", "class", "=", "changed_modified_2_2", ">", "The<", "/", "span", ">", "implementation", "must", "inspect", "the", "current", "request", "and", "return", "an", "Object", "representing", "the", "tree", "structure", "and", "component", "state", ...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/render/ResponseStateManager.java#L372-L376
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/service/rest/Attributes.java
Attributes.put
@Override @Path("/{ownerType}/{ownerId}") @ApiOperation(value="Update attributes for an ownerType and ownerId", response=StatusMessage.class) @ApiImplicitParams({ @ApiImplicitParam(name="Attributes", paramType="body", required=true, dataType="java.lang.Object")}) public JSONObject put(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException { String ownerType = getSegment(path, 1); if (ownerType == null) throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerType"); String ownerId = getSegment(path, 2); if (ownerId == null) throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerId"); try { Map<String,String> attrs = JsonUtil.getMap(content); ServiceLocator.getWorkflowServices().updateAttributes(ownerType, Long.parseLong(ownerId), attrs); return null; } catch (NumberFormatException ex) { throw new ServiceException(ServiceException.BAD_REQUEST, "Invalid ownerId: " + ownerId); } catch (JSONException ex) { throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex); } }
java
@Override @Path("/{ownerType}/{ownerId}") @ApiOperation(value="Update attributes for an ownerType and ownerId", response=StatusMessage.class) @ApiImplicitParams({ @ApiImplicitParam(name="Attributes", paramType="body", required=true, dataType="java.lang.Object")}) public JSONObject put(String path, JSONObject content, Map<String,String> headers) throws ServiceException, JSONException { String ownerType = getSegment(path, 1); if (ownerType == null) throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerType"); String ownerId = getSegment(path, 2); if (ownerId == null) throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerId"); try { Map<String,String> attrs = JsonUtil.getMap(content); ServiceLocator.getWorkflowServices().updateAttributes(ownerType, Long.parseLong(ownerId), attrs); return null; } catch (NumberFormatException ex) { throw new ServiceException(ServiceException.BAD_REQUEST, "Invalid ownerId: " + ownerId); } catch (JSONException ex) { throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex); } }
[ "@", "Override", "@", "Path", "(", "\"/{ownerType}/{ownerId}\"", ")", "@", "ApiOperation", "(", "value", "=", "\"Update attributes for an ownerType and ownerId\"", ",", "response", "=", "StatusMessage", ".", "class", ")", "@", "ApiImplicitParams", "(", "{", "@", "Ap...
Update attributes owner type and id (does not delete existing ones).
[ "Update", "attributes", "owner", "type", "and", "id", "(", "does", "not", "delete", "existing", "ones", ")", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/rest/Attributes.java#L86-L111
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/WallComponent.java
WallComponent.canMerge
@Override public boolean canMerge(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) { IBlockState state = world.getBlockState(pos); if (isCorner(state)) return false; return EnumFacingUtils.getRealSide(state, side) != EnumFacing.NORTH; }
java
@Override public boolean canMerge(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) { IBlockState state = world.getBlockState(pos); if (isCorner(state)) return false; return EnumFacingUtils.getRealSide(state, side) != EnumFacing.NORTH; }
[ "@", "Override", "public", "boolean", "canMerge", "(", "ItemStack", "itemStack", ",", "EntityPlayer", "player", ",", "World", "world", ",", "BlockPos", "pos", ",", "EnumFacing", "side", ")", "{", "IBlockState", "state", "=", "world", ".", "getBlockState", "(",...
Checks whether the block can be merged into a corner. @param itemStack the item stack @param player the player @param world the world @param pos the pos @param side the side @return true, if successful
[ "Checks", "whether", "the", "block", "can", "be", "merged", "into", "a", "corner", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/WallComponent.java#L107-L115
jpardogo/FlabbyListView
library/src/main/java/com/jpardogo/android/flabbylistview/lib/FlabbyListView.java
FlabbyListView.onScrollChanged
@Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mTrackedChild == null) { if (getChildCount() > 0) { mTrackedChild = getChildInTheMiddle(); mTrackedChildPrevTop = mTrackedChild.getTop(); mTrackedChildPrevPosition = getPositionForView(mTrackedChild); } } else { boolean childIsSafeToTrack = mTrackedChild.getParent() == this && getPositionForView(mTrackedChild) == mTrackedChildPrevPosition; if (childIsSafeToTrack) { int top = mTrackedChild.getTop(); float deltaY = top - mTrackedChildPrevTop; if (deltaY == 0) { //When we scroll so fast the list this value becomes 0 all the time // so we don't want the other list stop, and we give it the last //no 0 value we have deltaY = OldDeltaY; } else { OldDeltaY = deltaY; } updateChildrenControlPoints(deltaY); mTrackedChildPrevTop = top; } else { mTrackedChild = null; } } }
java
@Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { super.onScrollChanged(l, t, oldl, oldt); if (mTrackedChild == null) { if (getChildCount() > 0) { mTrackedChild = getChildInTheMiddle(); mTrackedChildPrevTop = mTrackedChild.getTop(); mTrackedChildPrevPosition = getPositionForView(mTrackedChild); } } else { boolean childIsSafeToTrack = mTrackedChild.getParent() == this && getPositionForView(mTrackedChild) == mTrackedChildPrevPosition; if (childIsSafeToTrack) { int top = mTrackedChild.getTop(); float deltaY = top - mTrackedChildPrevTop; if (deltaY == 0) { //When we scroll so fast the list this value becomes 0 all the time // so we don't want the other list stop, and we give it the last //no 0 value we have deltaY = OldDeltaY; } else { OldDeltaY = deltaY; } updateChildrenControlPoints(deltaY); mTrackedChildPrevTop = top; } else { mTrackedChild = null; } } }
[ "@", "Override", "protected", "void", "onScrollChanged", "(", "int", "l", ",", "int", "t", ",", "int", "oldl", ",", "int", "oldt", ")", "{", "super", ".", "onScrollChanged", "(", "l", ",", "t", ",", "oldl", ",", "oldt", ")", ";", "if", "(", "mTrack...
Calculate the scroll distance comparing the distance with the top of the list of the current child and the last one tracked @param l - Current horizontal scroll origin. @param t - Current vertical scroll origin. @param oldl - Previous horizontal scroll origin. @param oldt - Previous vertical scroll origin.
[ "Calculate", "the", "scroll", "distance", "comparing", "the", "distance", "with", "the", "top", "of", "the", "list", "of", "the", "current", "child", "and", "the", "last", "one", "tracked" ]
train
https://github.com/jpardogo/FlabbyListView/blob/2988f9182c98717a9c66326177c3ee1d7f42975f/library/src/main/java/com/jpardogo/android/flabbylistview/lib/FlabbyListView.java#L63-L97
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java
UnsafeOperations.deepCopyArrayField
public final void deepCopyArrayField(Object obj, Object copy, Field field, IdentityHashMap<Object, Object> referencesToReuse) { deepCopyArrayAtOffset(obj, copy, field.getType(), getObjectFieldOffset(field), referencesToReuse); }
java
public final void deepCopyArrayField(Object obj, Object copy, Field field, IdentityHashMap<Object, Object> referencesToReuse) { deepCopyArrayAtOffset(obj, copy, field.getType(), getObjectFieldOffset(field), referencesToReuse); }
[ "public", "final", "void", "deepCopyArrayField", "(", "Object", "obj", ",", "Object", "copy", ",", "Field", "field", ",", "IdentityHashMap", "<", "Object", ",", "Object", ">", "referencesToReuse", ")", "{", "deepCopyArrayAtOffset", "(", "obj", ",", "copy", ","...
Copies the array of the specified type from the given field in the source object to the same field in the copy, visiting the array during the copy so that its contents are also copied @param obj The object to copy from @param copy The target object @param field Field to be copied @param referencesToReuse An identity map of references to reuse - this is further populated as the copy progresses. The key is the original object reference - the value is the copied instance for that original.
[ "Copies", "the", "array", "of", "the", "specified", "type", "from", "the", "given", "field", "in", "the", "source", "object", "to", "the", "same", "field", "in", "the", "copy", "visiting", "the", "array", "during", "the", "copy", "so", "that", "its", "co...
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L491-L494
operasoftware/operaprestodriver
src/com/opera/core/systems/OperaDesktopDriver.java
OperaDesktopDriver.findWidgetByPosition
public QuickWidget findWidgetByPosition(QuickWidgetType type, int windowId, int row, int column) { return desktopWindowManager.getQuickWidgetByPos(type, windowId, row, column); }
java
public QuickWidget findWidgetByPosition(QuickWidgetType type, int windowId, int row, int column) { return desktopWindowManager.getQuickWidgetByPos(type, windowId, row, column); }
[ "public", "QuickWidget", "findWidgetByPosition", "(", "QuickWidgetType", "type", ",", "int", "windowId", ",", "int", "row", ",", "int", "column", ")", "{", "return", "desktopWindowManager", ".", "getQuickWidgetByPos", "(", "type", ",", "windowId", ",", "row", ",...
Finds widget by specified position. Used for widgets that have a position only, e.g. treeviewitems and tabs. @param windowId id of parent window @param row row of widget within its parent @param column column of widget within its parent @return QuickWidget matching, or null if no matching widget is found
[ "Finds", "widget", "by", "specified", "position", ".", "Used", "for", "widgets", "that", "have", "a", "position", "only", "e", ".", "g", ".", "treeviewitems", "and", "tabs", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L408-L410
jruby/yecht
src/main/org/yecht/DefaultYAMLParser.java
DefaultYAMLParser.yyparse
public Object yyparse (yyInput yyLex, Object yydebug) throws java.io.IOException { //t this.yydebug = (jay.yydebug.yyDebug)yydebug; return yyparse(yyLex); }
java
public Object yyparse (yyInput yyLex, Object yydebug) throws java.io.IOException { //t this.yydebug = (jay.yydebug.yyDebug)yydebug; return yyparse(yyLex); }
[ "public", "Object", "yyparse", "(", "yyInput", "yyLex", ",", "Object", "yydebug", ")", "throws", "java", ".", "io", ".", "IOException", "{", "//t this.yydebug = (jay.yydebug.yyDebug)yydebug;", "return", "yyparse", "(", "yyLex", ")", ";", "}" ]
the generated parser, with debugging messages. Maintains a dynamic state and value stack. @param yyLex scanner. @param yydebug debug message writer implementing <tt>yyDebug</tt>, or <tt>null</tt>. @return result of the last reduction, if any.
[ "the", "generated", "parser", "with", "debugging", "messages", ".", "Maintains", "a", "dynamic", "state", "and", "value", "stack", "." ]
train
https://github.com/jruby/yecht/blob/d745f62de8c10556b8964d78a07d436b65eeb8a9/src/main/org/yecht/DefaultYAMLParser.java#L262-L266
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java
Query.adding
public Query adding( Column... columns ) { List<Column> newColumns = null; if (this.columns != null) { newColumns = new ArrayList<Column>(this.columns); for (Column column : columns) { newColumns.add(column); } } else { newColumns = Arrays.asList(columns); } return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct); }
java
public Query adding( Column... columns ) { List<Column> newColumns = null; if (this.columns != null) { newColumns = new ArrayList<Column>(this.columns); for (Column column : columns) { newColumns.add(column); } } else { newColumns = Arrays.asList(columns); } return new Query(source, constraint, orderings(), newColumns, getLimits(), distinct); }
[ "public", "Query", "adding", "(", "Column", "...", "columns", ")", "{", "List", "<", "Column", ">", "newColumns", "=", "null", ";", "if", "(", "this", ".", "columns", "!=", "null", ")", "{", "newColumns", "=", "new", "ArrayList", "<", "Column", ">", ...
Create a copy of this query, but that returns results that include the columns specified by this query as well as the supplied columns. @param columns the additional columns that should be included in the the results; may not be null @return the copy of the query returning the supplied result columns; never null
[ "Create", "a", "copy", "of", "this", "query", "but", "that", "returns", "results", "that", "include", "the", "columns", "specified", "by", "this", "query", "as", "well", "as", "the", "supplied", "columns", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java#L240-L251
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java
GroupElement.cmov
org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement cmov( final org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement u, final int b) { return precomp(curve, X.cmov(u.X, b), Y.cmov(u.Y, b), Z.cmov(u.Z, b)); }
java
org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement cmov( final org.mariadb.jdbc.internal.com.send.authentication.ed25519.math.GroupElement u, final int b) { return precomp(curve, X.cmov(u.X, b), Y.cmov(u.Y, b), Z.cmov(u.Z, b)); }
[ "org", ".", "mariadb", ".", "jdbc", ".", "internal", ".", "com", ".", "send", ".", "authentication", ".", "ed25519", ".", "math", ".", "GroupElement", "cmov", "(", "final", "org", ".", "mariadb", ".", "jdbc", ".", "internal", ".", "com", ".", "send", ...
Constant-time conditional move. <p> Replaces this with $u$ if $b == 1$.<br> Replaces this with this if $b == 0$. <p> Method is package private only so that tests run. @param u The group element to return if $b == 1$. @param b in $\{0, 1\}$ @return $u$ if $b == 1$; this if $b == 0$. Results undefined if $b$ is not in $\{0, 1\}$.
[ "Constant", "-", "time", "conditional", "move", ".", "<p", ">", "Replaces", "this", "with", "$u$", "if", "$b", "==", "1$", ".", "<br", ">", "Replaces", "this", "with", "this", "if", "$b", "==", "0$", ".", "<p", ">", "Method", "is", "package", "privat...
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/authentication/ed25519/math/GroupElement.java#L868-L871
rollbar/rollbar-java
rollbar-java/src/main/java/com/rollbar/Rollbar.java
Rollbar.handleUncaughtErrors
public void handleUncaughtErrors(Thread thread) { final Rollbar rollbar = this; thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { rollbar.log(e, null, null, null, true); } }); }
java
public void handleUncaughtErrors(Thread thread) { final Rollbar rollbar = this; thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { rollbar.log(e, null, null, null, true); } }); }
[ "public", "void", "handleUncaughtErrors", "(", "Thread", "thread", ")", "{", "final", "Rollbar", "rollbar", "=", "this", ";", "thread", ".", "setUncaughtExceptionHandler", "(", "new", "Thread", ".", "UncaughtExceptionHandler", "(", ")", "{", "public", "void", "u...
Handle all uncaught errors on {@code thread} with this `Rollbar`. @param thread the thread to handle errors on
[ "Handle", "all", "uncaught", "errors", "on", "{" ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-java/src/main/java/com/rollbar/Rollbar.java#L142-L149
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java
BlockVector.removeElementsAt
public final void removeElementsAt(int firstindex, int count) { if (tc.isEntryEnabled()) SibTr.entry( tc, "removeElementsAt", new Object[] { new Integer(firstindex), new Integer(count)}); removeRange(firstindex, firstindex + count); if (tc.isEntryEnabled()) SibTr.exit(tc, "removeElementsAt"); }
java
public final void removeElementsAt(int firstindex, int count) { if (tc.isEntryEnabled()) SibTr.entry( tc, "removeElementsAt", new Object[] { new Integer(firstindex), new Integer(count)}); removeRange(firstindex, firstindex + count); if (tc.isEntryEnabled()) SibTr.exit(tc, "removeElementsAt"); }
[ "public", "final", "void", "removeElementsAt", "(", "int", "firstindex", ",", "int", "count", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"removeElementsAt\"", ",", "new", "Object", "[", "]", ...
Deletes the components in [firstindex, firstindex+ count-1]. Each component in this vector with an index greater than firstindex+count-1 is shifted downward. The firstindex+count-1 must be a value less than the current size of the vector. @exception ArrayIndexOutOfBoundsException if the indices was invalid.
[ "Deletes", "the", "components", "in", "[", "firstindex", "firstindex", "+", "count", "-", "1", "]", ".", "Each", "component", "in", "this", "vector", "with", "an", "index", "greater", "than", "firstindex", "+", "count", "-", "1", "is", "shifted", "downward...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java#L42-L54
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java
ListWidget.getViewFromAdapter
protected Widget getViewFromAdapter(final int index, ListItemHostWidget host) { return mAdapter == null ? null : mAdapter.getView(index, host.getGuest(), host); }
java
protected Widget getViewFromAdapter(final int index, ListItemHostWidget host) { return mAdapter == null ? null : mAdapter.getView(index, host.getGuest(), host); }
[ "protected", "Widget", "getViewFromAdapter", "(", "final", "int", "index", ",", "ListItemHostWidget", "host", ")", "{", "return", "mAdapter", "==", "null", "?", "null", ":", "mAdapter", ".", "getView", "(", "index", ",", "host", ".", "getGuest", "(", ")", ...
Get view displays the data at the specified position in the {@link Adapter} @param index - item index in {@link Adapter} @param host - view using as a host for the adapter view @return view displays the data at the specified position
[ "Get", "view", "displays", "the", "data", "at", "the", "specified", "position", "in", "the", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L951-L953
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getMethodByNameIgnoreCase
public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException { return getMethodByName(clazz, true, methodName); }
java
public static Method getMethodByNameIgnoreCase(Class<?> clazz, String methodName) throws SecurityException { return getMethodByName(clazz, true, methodName); }
[ "public", "static", "Method", "getMethodByNameIgnoreCase", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ")", "throws", "SecurityException", "{", "return", "getMethodByName", "(", "clazz", ",", "true", ",", "methodName", ")", ";", "}" ]
按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code> <p> 此方法只检查方法名是否一致(忽略大小写),并不检查参数的一致性。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param methodName 方法名,如果为空字符串返回{@code null} @return 方法 @throws SecurityException 无权访问抛出异常 @since 4.3.2
[ "按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L498-L500
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java
XsdGeneratorHelper.parseXmlStream
public static Document parseXmlStream(final Reader xmlStream) { // Build a DOM model of the provided xmlFileStream. final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { return factory.newDocumentBuilder().parse(new InputSource(xmlStream)); } catch (Exception e) { throw new IllegalArgumentException("Could not acquire DOM Document", e); } }
java
public static Document parseXmlStream(final Reader xmlStream) { // Build a DOM model of the provided xmlFileStream. final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); try { return factory.newDocumentBuilder().parse(new InputSource(xmlStream)); } catch (Exception e) { throw new IllegalArgumentException("Could not acquire DOM Document", e); } }
[ "public", "static", "Document", "parseXmlStream", "(", "final", "Reader", "xmlStream", ")", "{", "// Build a DOM model of the provided xmlFileStream.\r", "final", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory...
Parses the provided InputStream to create a dom Document. @param xmlStream An InputStream connected to an XML document. @return A DOM Document created from the contents of the provided stream.
[ "Parses", "the", "provided", "InputStream", "to", "create", "a", "dom", "Document", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/XsdGeneratorHelper.java#L431-L442
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java
TorqueDBHandling.createDB
public void createDB() throws PlatformException { if (_creationScript == null) { createCreationScript(); } Project project = new Project(); TorqueDataModelTask modelTask = new TorqueDataModelTask(); File tmpDir = null; File scriptFile = null; try { tmpDir = new File(getWorkDir(), "schemas"); tmpDir.mkdir(); scriptFile = new File(tmpDir, CREATION_SCRIPT_NAME); writeCompressedText(scriptFile, _creationScript); project.setBasedir(tmpDir.getAbsolutePath()); // we use the ant task 'sql' to perform the creation script SQLExec sqlTask = new SQLExec(); SQLExec.OnError onError = new SQLExec.OnError(); onError.setValue("continue"); sqlTask.setProject(project); sqlTask.setAutocommit(true); sqlTask.setDriver(_jcd.getDriver()); sqlTask.setOnerror(onError); sqlTask.setUserid(_jcd.getUserName()); sqlTask.setPassword(_jcd.getPassWord() == null ? "" : _jcd.getPassWord()); sqlTask.setUrl(getDBCreationUrl()); sqlTask.setSrc(scriptFile); sqlTask.execute(); deleteDir(tmpDir); } catch (Exception ex) { // clean-up if ((tmpDir != null) && tmpDir.exists()) { try { scriptFile.delete(); } catch (NullPointerException e) { LoggerFactory.getLogger(this.getClass()).error("NPE While deleting scriptFile [" + scriptFile.getName() + "]", e); } } throw new PlatformException(ex); } }
java
public void createDB() throws PlatformException { if (_creationScript == null) { createCreationScript(); } Project project = new Project(); TorqueDataModelTask modelTask = new TorqueDataModelTask(); File tmpDir = null; File scriptFile = null; try { tmpDir = new File(getWorkDir(), "schemas"); tmpDir.mkdir(); scriptFile = new File(tmpDir, CREATION_SCRIPT_NAME); writeCompressedText(scriptFile, _creationScript); project.setBasedir(tmpDir.getAbsolutePath()); // we use the ant task 'sql' to perform the creation script SQLExec sqlTask = new SQLExec(); SQLExec.OnError onError = new SQLExec.OnError(); onError.setValue("continue"); sqlTask.setProject(project); sqlTask.setAutocommit(true); sqlTask.setDriver(_jcd.getDriver()); sqlTask.setOnerror(onError); sqlTask.setUserid(_jcd.getUserName()); sqlTask.setPassword(_jcd.getPassWord() == null ? "" : _jcd.getPassWord()); sqlTask.setUrl(getDBCreationUrl()); sqlTask.setSrc(scriptFile); sqlTask.execute(); deleteDir(tmpDir); } catch (Exception ex) { // clean-up if ((tmpDir != null) && tmpDir.exists()) { try { scriptFile.delete(); } catch (NullPointerException e) { LoggerFactory.getLogger(this.getClass()).error("NPE While deleting scriptFile [" + scriptFile.getName() + "]", e); } } throw new PlatformException(ex); } }
[ "public", "void", "createDB", "(", ")", "throws", "PlatformException", "{", "if", "(", "_creationScript", "==", "null", ")", "{", "createCreationScript", "(", ")", ";", "}", "Project", "project", "=", "new", "Project", "(", ")", ";", "TorqueDataModelTask", "...
Creates the database. @throws PlatformException If some error occurred
[ "Creates", "the", "database", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L258-L314
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java
ScreamTrackerOldMod.createNewPatternElement
private PatternElement createNewPatternElement(int pattNum, int row, int channel, int note) { PatternElement pe = new PatternElement(pattNum, row, channel); pe.setInstrument((note&0xF80000)>>19); int oktave = (note&0xF0000000)>>28; if (oktave!=-1) { int ton = (note&0x0F000000)>>24; int index = (oktave+3)*12+ton; // fit to it octaves pe.setPeriod((index<Helpers.noteValues.length) ? Helpers.noteValues[index] : 0); pe.setNoteIndex(index+1); } else { pe.setPeriod(0); pe.setNoteIndex(0); } pe.setEffekt((note&0xF00)>>8); pe.setEffektOp(note&0xFF); if (pe.getEffekt()==0x01) // set Tempo needs correction. Do not ask why! { int effektOp = pe.getEffektOp(); pe.setEffektOp(((effektOp&0x0F)<<4) | ((effektOp&0xF0)>>4)); } int volume =((note&0x70000)>>16) | ((note&0xF000)>>9); if (volume<=64) { pe.setVolumeEffekt(1); pe.setVolumeEffektOp(volume); } return pe; }
java
private PatternElement createNewPatternElement(int pattNum, int row, int channel, int note) { PatternElement pe = new PatternElement(pattNum, row, channel); pe.setInstrument((note&0xF80000)>>19); int oktave = (note&0xF0000000)>>28; if (oktave!=-1) { int ton = (note&0x0F000000)>>24; int index = (oktave+3)*12+ton; // fit to it octaves pe.setPeriod((index<Helpers.noteValues.length) ? Helpers.noteValues[index] : 0); pe.setNoteIndex(index+1); } else { pe.setPeriod(0); pe.setNoteIndex(0); } pe.setEffekt((note&0xF00)>>8); pe.setEffektOp(note&0xFF); if (pe.getEffekt()==0x01) // set Tempo needs correction. Do not ask why! { int effektOp = pe.getEffektOp(); pe.setEffektOp(((effektOp&0x0F)<<4) | ((effektOp&0xF0)>>4)); } int volume =((note&0x70000)>>16) | ((note&0xF000)>>9); if (volume<=64) { pe.setVolumeEffekt(1); pe.setVolumeEffektOp(volume); } return pe; }
[ "private", "PatternElement", "createNewPatternElement", "(", "int", "pattNum", ",", "int", "row", ",", "int", "channel", ",", "int", "note", ")", "{", "PatternElement", "pe", "=", "new", "PatternElement", "(", "pattNum", ",", "row", ",", "channel", ")", ";",...
Read the STM pattern data @param pattNum @param row @param channel @param note @return
[ "Read", "the", "STM", "pattern", "data" ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/tracker/ScreamTrackerOldMod.java#L164-L200
unbescape/unbescape
src/main/java/org/unbescape/json/JsonEscape.java
JsonEscape.escapeJsonMinimal
public static void escapeJsonMinimal(final Reader reader, final Writer writer) throws IOException { escapeJson(reader, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapeJsonMinimal(final Reader reader, final Writer writer) throws IOException { escapeJson(reader, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJsonMinimal", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJson", "(", "reader", ",", "writer", ",", "JsonEscapeType", ".", "SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA", ",...
<p> Perform a JSON level 1 (only basic set) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the JSON basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#92;</tt> (<tt>U+005C</tt>) and <tt>&#92;&#47;</tt> (<tt>U+002F</tt>). Note that <tt>&#92;&#47;</tt> is optional, and will only be used when the <tt>&#47;</tt> symbol appears after <tt>&lt;</tt>, as in <tt>&lt;&#47;</tt>. This is to avoid accidentally closing <tt>&lt;script&gt;</tt> tags in HTML. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> (required by the JSON spec) and <tt>U+007F</tt> to <tt>U+009F</tt> (additional). </li> </ul> <p> This method calls {@link #escapeJson(Reader, Writer, JsonEscapeType, JsonEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA}</li> <li><tt>level</tt>: {@link JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "JSON", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L549-L554
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.toHexString
public static <T extends Appendable> T toHexString(T dst, byte[] src) { return toHexString(dst, src, 0, src.length); }
java
public static <T extends Appendable> T toHexString(T dst, byte[] src) { return toHexString(dst, src, 0, src.length); }
[ "public", "static", "<", "T", "extends", "Appendable", ">", "T", "toHexString", "(", "T", "dst", ",", "byte", "[", "]", "src", ")", "{", "return", "toHexString", "(", "dst", ",", "src", ",", "0", ",", "src", ".", "length", ")", ";", "}" ]
Converts the specified byte array into a hexadecimal value and appends it to the specified buffer.
[ "Converts", "the", "specified", "byte", "array", "into", "a", "hexadecimal", "value", "and", "appends", "it", "to", "the", "specified", "buffer", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L174-L176
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java
MultiChangeBuilder.insertText
public MultiChangeBuilder<PS, SEG, S> insertText(int paragraphIndex, int columnPosition, String text) { int index = area.getAbsolutePosition(paragraphIndex, columnPosition); return replaceText(index, index, text); }
java
public MultiChangeBuilder<PS, SEG, S> insertText(int paragraphIndex, int columnPosition, String text) { int index = area.getAbsolutePosition(paragraphIndex, columnPosition); return replaceText(index, index, text); }
[ "public", "MultiChangeBuilder", "<", "PS", ",", "SEG", ",", "S", ">", "insertText", "(", "int", "paragraphIndex", ",", "int", "columnPosition", ",", "String", "text", ")", "{", "int", "index", "=", "area", ".", "getAbsolutePosition", "(", "paragraphIndex", "...
Inserts the given text at the position returned from {@code getAbsolutePosition(paragraphIndex, columnPosition)}. <p><b>Caution:</b> see {@link StyledDocument#getAbsolutePosition(int, int)} to know how the column index argument can affect the returned position.</p> @param text The text to insert
[ "Inserts", "the", "given", "text", "at", "the", "position", "returned", "from", "{", "@code", "getAbsolutePosition", "(", "paragraphIndex", "columnPosition", ")", "}", "." ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java#L163-L166
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/validationConfiguration11/ValidationConfigurationDescriptorImpl.java
ValidationConfigurationDescriptorImpl.addNamespace
public ValidationConfigurationDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public ValidationConfigurationDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "ValidationConfigurationDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>ValidationConfigurationDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/validationConfiguration11/ValidationConfigurationDescriptorImpl.java#L84-L88
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setDate
public void setDate(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_DATE, index), value); }
java
public void setDate(int index, Date value) { set(selectField(TaskFieldLists.CUSTOM_DATE, index), value); }
[ "public", "void", "setDate", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "CUSTOM_DATE", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a date value. @param index date index (1-10) @param value date value
[ "Set", "a", "date", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3301-L3304
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeIntWithDefault
@Pure public static Integer getAttributeIntWithDefault(Node document, boolean caseSensitive, Integer defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { // } } return defaultValue; }
java
@Pure public static Integer getAttributeIntWithDefault(Node document, boolean caseSensitive, Integer defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); final String v = getAttributeValue(document, caseSensitive, 0, path); if (v != null) { try { return Integer.parseInt(v); } catch (NumberFormatException e) { // } } return defaultValue; }
[ "@", "Pure", "public", "static", "Integer", "getAttributeIntWithDefault", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "Integer", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ...
Replies the integer value that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param defaultValue is the default value to reply. @param path is the list of and ended by the attribute's name. @return the integer value of the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "integer", "value", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L845-L857
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/expression/Uris.java
Uris.escapePath
public String escapePath(final String text, final String encoding) { return UriEscape.escapeUriPath(text, encoding); }
java
public String escapePath(final String text, final String encoding) { return UriEscape.escapeUriPath(text, encoding); }
[ "public", "String", "escapePath", "(", "final", "String", "text", ",", "final", "String", "encoding", ")", "{", "return", "UriEscape", ".", "escapeUriPath", "(", "text", ",", "encoding", ")", ";", "}" ]
<p> Perform am URI path <strong>escape</strong> operation on a {@code String} input. </p> <p> This method simply calls the equivalent method in the {@code UriEscape} class from the <a href="http://www.unbescape.org">Unbescape</a> library. </p> <p> The following are the only allowed chars in an URI path (will not be escaped): </p> <ul> <li>{@code A-Z a-z 0-9}</li> <li>{@code - . _ ~}</li> <li>{@code ! $ & ' ( ) * + , ; =}</li> <li>{@code : @}</li> <li>{@code /}</li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in {@code %HH} syntax, being {@code HH} the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the {@code String} to be escaped. @param encoding the encoding to be used for unescaping. @return The escaped result {@code String}. As a memory-performance improvement, will return the exact same object as the {@code text} input argument if no escaping modifications were required (and no additional {@code String} objects will be created during processing). Will return {@code null} if {@code text} is {@code null}.
[ "<p", ">", "Perform", "am", "URI", "path", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "{", "@code", "String", "}", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "simply", "calls", "the", "equivalent", "met...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Uris.java#L153-L155
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/StandardSREInstall.java
StandardSREInstall.parsePath
private static IPath parsePath(String path, IPath defaultPath, IPath rootPath) { if (!Strings.isNullOrEmpty(path)) { try { final IPath pathObject = Path.fromPortableString(path); if (pathObject != null) { if (rootPath != null && !pathObject.isAbsolute()) { return rootPath.append(pathObject); } return pathObject; } } catch (Throwable exception) { // } } return defaultPath; }
java
private static IPath parsePath(String path, IPath defaultPath, IPath rootPath) { if (!Strings.isNullOrEmpty(path)) { try { final IPath pathObject = Path.fromPortableString(path); if (pathObject != null) { if (rootPath != null && !pathObject.isAbsolute()) { return rootPath.append(pathObject); } return pathObject; } } catch (Throwable exception) { // } } return defaultPath; }
[ "private", "static", "IPath", "parsePath", "(", "String", "path", ",", "IPath", "defaultPath", ",", "IPath", "rootPath", ")", "{", "if", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "path", ")", ")", "{", "try", "{", "final", "IPath", "pathObject", "=...
Path the given string for extracting a path. @param path the string representation of the path to parse. @param defaultPath the default path. @param rootPath the root path to use is the given path is not absolute. @return the absolute path.
[ "Path", "the", "given", "string", "for", "extracting", "a", "path", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/StandardSREInstall.java#L515-L530
jenkinsci/jenkins
core/src/main/java/jenkins/util/AntClassLoader.java
AntClassLoader.defineClassFromData
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException { definePackage(container, classname); ProtectionDomain currentPd = Project.class.getProtectionDomain(); String classResource = getClassFilename(classname); CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container), getCertificates(container, classResource)); ProtectionDomain classesPd = new ProtectionDomain(src, currentPd.getPermissions(), this, currentPd.getPrincipals()); return defineClass(classname, classData, 0, classData.length, classesPd); }
java
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException { definePackage(container, classname); ProtectionDomain currentPd = Project.class.getProtectionDomain(); String classResource = getClassFilename(classname); CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container), getCertificates(container, classResource)); ProtectionDomain classesPd = new ProtectionDomain(src, currentPd.getPermissions(), this, currentPd.getPrincipals()); return defineClass(classname, classData, 0, classData.length, classesPd); }
[ "protected", "Class", "defineClassFromData", "(", "File", "container", ",", "byte", "[", "]", "classData", ",", "String", "classname", ")", "throws", "IOException", "{", "definePackage", "(", "container", ",", "classname", ")", ";", "ProtectionDomain", "currentPd"...
Define a class given its bytes @param container the container from which the class data has been read may be a directory or a jar/zip file. @param classData the bytecode data for the class @param classname the name of the class @return the Class instance created from the given data @throws IOException if the class data cannot be read.
[ "Define", "a", "class", "given", "its", "bytes" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/AntClassLoader.java#L1127-L1141
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java
DefaultOptionParser.handleLongOptionWithoutEqual
private void handleLongOptionWithoutEqual(String token) throws OptionParserException { List<String> matchingOpts = getMatchingLongOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(token)) { throw new AmbiguousOptionException(token, matchingOpts); } else { String key = (options.hasLongOption(token) ? token : matchingOpts.get(0)); handleOption(options.getOption(key)); } }
java
private void handleLongOptionWithoutEqual(String token) throws OptionParserException { List<String> matchingOpts = getMatchingLongOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(token)) { throw new AmbiguousOptionException(token, matchingOpts); } else { String key = (options.hasLongOption(token) ? token : matchingOpts.get(0)); handleOption(options.getOption(key)); } }
[ "private", "void", "handleLongOptionWithoutEqual", "(", "String", "token", ")", "throws", "OptionParserException", "{", "List", "<", "String", ">", "matchingOpts", "=", "getMatchingLongOptions", "(", "token", ")", ";", "if", "(", "matchingOpts", ".", "isEmpty", "(...
Handles the following tokens: <pre> --L -L --l -l </pre> @param token the command line token to handle @throws OptionParserException if option parsing fails
[ "Handles", "the", "following", "tokens", ":", "<pre", ">", "--", "L", "-", "L", "--", "l", "-", "l", "<", "/", "pre", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L266-L276
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java
GeometryExtrude.getClockWise
private static LineString getClockWise(final LineString lineString) { final Coordinate c0 = lineString.getCoordinateN(0); final Coordinate c1 = lineString.getCoordinateN(1); final Coordinate c2 = lineString.getCoordinateN(2); lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3)); if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.CLOCKWISE) { return lineString; } else { return (LineString) lineString.reverse(); } }
java
private static LineString getClockWise(final LineString lineString) { final Coordinate c0 = lineString.getCoordinateN(0); final Coordinate c1 = lineString.getCoordinateN(1); final Coordinate c2 = lineString.getCoordinateN(2); lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3)); if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.CLOCKWISE) { return lineString; } else { return (LineString) lineString.reverse(); } }
[ "private", "static", "LineString", "getClockWise", "(", "final", "LineString", "lineString", ")", "{", "final", "Coordinate", "c0", "=", "lineString", ".", "getCoordinateN", "(", "0", ")", ";", "final", "Coordinate", "c1", "=", "lineString", ".", "getCoordinateN...
Reverse the LineString to be oriented clockwise. All NaN z values are replaced by a zero value. @param lineString @return
[ "Reverse", "the", "LineString", "to", "be", "oriented", "clockwise", ".", "All", "NaN", "z", "values", "are", "replaced", "by", "a", "zero", "value", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L187-L197
palaima/DebugDrawer
debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/util/Intents.java
Intents.hasHandler
public static boolean hasHandler(Context context, Intent intent) { List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0); return !handlers.isEmpty(); }
java
public static boolean hasHandler(Context context, Intent intent) { List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0); return !handlers.isEmpty(); }
[ "public", "static", "boolean", "hasHandler", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "List", "<", "ResolveInfo", ">", "handlers", "=", "context", ".", "getPackageManager", "(", ")", ".", "queryIntentActivities", "(", "intent", ",", "0", ...
Queries on-device packages for a handler for the supplied {@link Intent}.
[ "Queries", "on", "-", "device", "packages", "for", "a", "handler", "for", "the", "supplied", "{" ]
train
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/util/Intents.java#L29-L32
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java
CareWebUtil.showMessage
public static void showMessage(String message, String caption) { getShell().getMessageWindow().showMessage(message, caption); }
java
public static void showMessage(String message, String caption) { getShell().getMessageWindow().showMessage(message, caption); }
[ "public", "static", "void", "showMessage", "(", "String", "message", ",", "String", "caption", ")", "{", "getShell", "(", ")", ".", "getMessageWindow", "(", ")", ".", "showMessage", "(", "message", ",", "caption", ")", ";", "}" ]
Sends an informational message for display by desktop. @param message Text of the message. @param caption Optional caption text.
[ "Sends", "an", "informational", "message", "for", "display", "by", "desktop", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java#L83-L85
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectStringOrNumberOrSymbol
void expectStringOrNumberOrSymbol(Node n, JSType type, String msg) { if (!type.matchesNumberContext() && !type.matchesStringContext() && !type.matchesSymbolContext()) { mismatch(n, msg, type, NUMBER_STRING_SYMBOL); } else { expectStringOrNumberOrSymbolStrict(n, type, msg); } }
java
void expectStringOrNumberOrSymbol(Node n, JSType type, String msg) { if (!type.matchesNumberContext() && !type.matchesStringContext() && !type.matchesSymbolContext()) { mismatch(n, msg, type, NUMBER_STRING_SYMBOL); } else { expectStringOrNumberOrSymbolStrict(n, type, msg); } }
[ "void", "expectStringOrNumberOrSymbol", "(", "Node", "n", ",", "JSType", "type", ",", "String", "msg", ")", "{", "if", "(", "!", "type", ".", "matchesNumberContext", "(", ")", "&&", "!", "type", ".", "matchesStringContext", "(", ")", "&&", "!", "type", "...
Expect the type to be a number or string or symbol, or a type convertible to a number or string. If the expectation is not met, issue a warning at the provided node's source code position.
[ "Expect", "the", "type", "to", "be", "a", "number", "or", "string", "or", "symbol", "or", "a", "type", "convertible", "to", "a", "number", "or", "string", ".", "If", "the", "expectation", "is", "not", "met", "issue", "a", "warning", "at", "the", "provi...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L456-L464
NoraUi/NoraUi
src/main/java/com/github/noraui/utils/Utilities.java
Utilities.findElement
public static WebElement findElement(PageElement element, Object... args) { return Context.getDriver().findElement(getLocator(element.getPage().getApplication(), element.getPage().getPageKey() + element.getKey(), args)); }
java
public static WebElement findElement(PageElement element, Object... args) { return Context.getDriver().findElement(getLocator(element.getPage().getApplication(), element.getPage().getPageKey() + element.getKey(), args)); }
[ "public", "static", "WebElement", "findElement", "(", "PageElement", "element", ",", "Object", "...", "args", ")", "{", "return", "Context", ".", "getDriver", "(", ")", ".", "findElement", "(", "getLocator", "(", "element", ".", "getPage", "(", ")", ".", "...
Find the first {@link WebElement} using the given method. This method is affected by the 'implicit wait' times in force at the time of execution. The findElement(..) invocation will return a matching row, or try again repeatedly until the configured timeout is reached. @param element is PageElement find in page. @param args can be a index i @return the first {@link WebElement} using the given method
[ "Find", "the", "first", "{", "@link", "WebElement", "}", "using", "the", "given", "method", ".", "This", "method", "is", "affected", "by", "the", "implicit", "wait", "times", "in", "force", "at", "the", "time", "of", "execution", ".", "The", "findElement",...
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L193-L195
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startProcessInstanceByIdForm
@Deprecated public void startProcessInstanceByIdForm(String processDefinitionId, String callbackUrl) { this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
java
@Deprecated public void startProcessInstanceByIdForm(String processDefinitionId, String callbackUrl) { this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
[ "@", "Deprecated", "public", "void", "startProcessInstanceByIdForm", "(", "String", "processDefinitionId", ",", "String", "callbackUrl", ")", "{", "this", ".", "url", "=", "callbackUrl", ";", "this", ".", "processDefinitionId", "=", "processDefinitionId", ";", "begi...
@deprecated use {@link startProcessInstanceByIdForm()} instead @param processDefinitionId @param callbackUrl
[ "@deprecated", "use", "{", "@link", "startProcessInstanceByIdForm", "()", "}", "instead" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L127-L132
beders/Resty
src/main/java/us/monoid/web/Resty.java
Resty.authenticate
public void authenticate(URI aSite, String aLogin, char[] aPwd) { rath.addSite(aSite, aLogin, aPwd); }
java
public void authenticate(URI aSite, String aLogin, char[] aPwd) { rath.addSite(aSite, aLogin, aPwd); }
[ "public", "void", "authenticate", "(", "URI", "aSite", ",", "String", "aLogin", ",", "char", "[", "]", "aPwd", ")", "{", "rath", ".", "addSite", "(", "aSite", ",", "aLogin", ",", "aPwd", ")", ";", "}" ]
Register this root URI for authentication. Whenever a URL is requested that starts with this root, the credentials given are used for HTTP AUTH. Note that currently authentication information is shared across all Resty instances. This is due to the shortcomings of the java.net authentication mechanism. This might change should Resty adopt HttpClient and is the reason why this method is not a static one. @param aSite the root URI of the site @param aLogin the login name @param aPwd the password. The array will not be internally copied. Whenever you null it, the password is gone within Resty
[ "Register", "this", "root", "URI", "for", "authentication", ".", "Whenever", "a", "URL", "is", "requested", "that", "starts", "with", "this", "root", "the", "credentials", "given", "are", "used", "for", "HTTP", "AUTH", ".", "Note", "that", "currently", "auth...
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L136-L138
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java
ObjectTreeParser.invoke
private void invoke(Method method, Object instance, Object[] params) throws SlickXMLException { try { method.setAccessible(true); method.invoke(instance, params); } catch (IllegalArgumentException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (IllegalAccessException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (InvocationTargetException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } finally { method.setAccessible(false); } }
java
private void invoke(Method method, Object instance, Object[] params) throws SlickXMLException { try { method.setAccessible(true); method.invoke(instance, params); } catch (IllegalArgumentException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (IllegalAccessException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (InvocationTargetException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } finally { method.setAccessible(false); } }
[ "private", "void", "invoke", "(", "Method", "method", ",", "Object", "instance", ",", "Object", "[", "]", "params", ")", "throws", "SlickXMLException", "{", "try", "{", "method", ".", "setAccessible", "(", "true", ")", ";", "method", ".", "invoke", "(", ...
Call a method on a object @param method The method to call @param instance The objet to call the method on @param params The parameters to pass @throws SlickXMLException Indicates a failure to call or access the method
[ "Call", "a", "method", "on", "a", "object" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java#L450-L463