repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphAddChildGraphNode
public static int cuGraphAddChildGraphNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUgraph childGraph) { """ Creates a child graph node and adds it to a graph.<br> <br> Creates a new node which executes an embedded graph, and adds it to \p hGraph with \p numDependencies dependencies specified via \p dependencies. It is possible for \p numDependencies to be 0, in which case the node will be placed at the root of the graph. \p dependencies may not have any duplicate entries. A handle to the new node will be returned in \p phGraphNode.<br> <br> The node executes an embedded child graph. The child graph is cloned in this call. @param phGraphNode - Returns newly created node @param hGraph - Graph to which to add the node @param dependencies - Dependencies of the node @param numDependencies - Number of dependencies @param childGraph - The graph to clone into this node @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE, @see JCudaDriver#cuGraphChildGraphNodeGetGraph JCudaDriver#cuGraphCreate JCudaDriver#cuGraphDestroyNode JCudaDriver#cuGraphAddEmptyNode JCudaDriver#cuGraphAddKernelNode JCudaDriver#cuGraphAddHostNode JCudaDriver#cuGraphAddMemcpyNode JCudaDriver#cuGraphAddMemsetNode JCudaDriver#cuGraphClone """ return checkResult(cuGraphAddChildGraphNodeNative(phGraphNode, hGraph, dependencies, numDependencies, childGraph)); }
java
public static int cuGraphAddChildGraphNode(CUgraphNode phGraphNode, CUgraph hGraph, CUgraphNode dependencies[], long numDependencies, CUgraph childGraph) { return checkResult(cuGraphAddChildGraphNodeNative(phGraphNode, hGraph, dependencies, numDependencies, childGraph)); }
[ "public", "static", "int", "cuGraphAddChildGraphNode", "(", "CUgraphNode", "phGraphNode", ",", "CUgraph", "hGraph", ",", "CUgraphNode", "dependencies", "[", "]", ",", "long", "numDependencies", ",", "CUgraph", "childGraph", ")", "{", "return", "checkResult", "(", "cuGraphAddChildGraphNodeNative", "(", "phGraphNode", ",", "hGraph", ",", "dependencies", ",", "numDependencies", ",", "childGraph", ")", ")", ";", "}" ]
Creates a child graph node and adds it to a graph.<br> <br> Creates a new node which executes an embedded graph, and adds it to \p hGraph with \p numDependencies dependencies specified via \p dependencies. It is possible for \p numDependencies to be 0, in which case the node will be placed at the root of the graph. \p dependencies may not have any duplicate entries. A handle to the new node will be returned in \p phGraphNode.<br> <br> The node executes an embedded child graph. The child graph is cloned in this call. @param phGraphNode - Returns newly created node @param hGraph - Graph to which to add the node @param dependencies - Dependencies of the node @param numDependencies - Number of dependencies @param childGraph - The graph to clone into this node @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE, @see JCudaDriver#cuGraphChildGraphNodeGetGraph JCudaDriver#cuGraphCreate JCudaDriver#cuGraphDestroyNode JCudaDriver#cuGraphAddEmptyNode JCudaDriver#cuGraphAddKernelNode JCudaDriver#cuGraphAddHostNode JCudaDriver#cuGraphAddMemcpyNode JCudaDriver#cuGraphAddMemsetNode JCudaDriver#cuGraphClone
[ "Creates", "a", "child", "graph", "node", "and", "adds", "it", "to", "a", "graph", ".", "<br", ">", "<br", ">", "Creates", "a", "new", "node", "which", "executes", "an", "embedded", "graph", "and", "adds", "it", "to", "\\", "p", "hGraph", "with", "\\", "p", "numDependencies", "dependencies", "specified", "via", "\\", "p", "dependencies", ".", "It", "is", "possible", "for", "\\", "p", "numDependencies", "to", "be", "0", "in", "which", "case", "the", "node", "will", "be", "placed", "at", "the", "root", "of", "the", "graph", ".", "\\", "p", "dependencies", "may", "not", "have", "any", "duplicate", "entries", ".", "A", "handle", "to", "the", "new", "node", "will", "be", "returned", "in", "\\", "p", "phGraphNode", ".", "<br", ">", "<br", ">", "The", "node", "executes", "an", "embedded", "child", "graph", ".", "The", "child", "graph", "is", "cloned", "in", "this", "call", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12483-L12486
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20TokenAuthorizationResponseBuilder.java
OAuth20TokenAuthorizationResponseBuilder.buildCallbackUrlResponseType
protected ModelAndView buildCallbackUrlResponseType(final AccessTokenRequestDataHolder holder, final String redirectUri, final AccessToken accessToken, final List<NameValuePair> params, final RefreshToken refreshToken, final J2EContext context) throws Exception { """ Build callback url response type string. @param holder the holder @param redirectUri the redirect uri @param accessToken the access token @param params the params @param refreshToken the refresh token @param context the context @return the string @throws Exception the exception """ val attributes = holder.getAuthentication().getAttributes(); val state = attributes.get(OAuth20Constants.STATE).get(0).toString(); val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString(); val builder = new URIBuilder(redirectUri); val stringBuilder = new StringBuilder(); val timeToLive = accessTokenExpirationPolicy.getTimeToLive(); stringBuilder.append(OAuth20Constants.ACCESS_TOKEN) .append('=') .append(accessToken.getId()) .append('&') .append(OAuth20Constants.TOKEN_TYPE) .append('=') .append(OAuth20Constants.TOKEN_TYPE_BEARER) .append('&') .append(OAuth20Constants.EXPIRES_IN) .append('=') .append(timeToLive); if (refreshToken != null) { stringBuilder.append('&') .append(OAuth20Constants.REFRESH_TOKEN) .append('=') .append(refreshToken.getId()); } params.forEach(p -> stringBuilder.append('&') .append(p.getName()) .append('=') .append(p.getValue())); if (StringUtils.isNotBlank(state)) { stringBuilder.append('&') .append(OAuth20Constants.STATE) .append('=') .append(EncodingUtils.urlEncode(state)); } if (StringUtils.isNotBlank(nonce)) { stringBuilder.append('&') .append(OAuth20Constants.NONCE) .append('=') .append(EncodingUtils.urlEncode(nonce)); } builder.setFragment(stringBuilder.toString()); val url = builder.toString(); LOGGER.debug("Redirecting to URL [{}]", url); val parameters = new LinkedHashMap<String, String>(); parameters.put(OAuth20Constants.ACCESS_TOKEN, accessToken.getId()); if (refreshToken != null) { parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId()); } parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString()); parameters.put(OAuth20Constants.STATE, state); parameters.put(OAuth20Constants.NONCE, nonce); parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId()); return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters); }
java
protected ModelAndView buildCallbackUrlResponseType(final AccessTokenRequestDataHolder holder, final String redirectUri, final AccessToken accessToken, final List<NameValuePair> params, final RefreshToken refreshToken, final J2EContext context) throws Exception { val attributes = holder.getAuthentication().getAttributes(); val state = attributes.get(OAuth20Constants.STATE).get(0).toString(); val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString(); val builder = new URIBuilder(redirectUri); val stringBuilder = new StringBuilder(); val timeToLive = accessTokenExpirationPolicy.getTimeToLive(); stringBuilder.append(OAuth20Constants.ACCESS_TOKEN) .append('=') .append(accessToken.getId()) .append('&') .append(OAuth20Constants.TOKEN_TYPE) .append('=') .append(OAuth20Constants.TOKEN_TYPE_BEARER) .append('&') .append(OAuth20Constants.EXPIRES_IN) .append('=') .append(timeToLive); if (refreshToken != null) { stringBuilder.append('&') .append(OAuth20Constants.REFRESH_TOKEN) .append('=') .append(refreshToken.getId()); } params.forEach(p -> stringBuilder.append('&') .append(p.getName()) .append('=') .append(p.getValue())); if (StringUtils.isNotBlank(state)) { stringBuilder.append('&') .append(OAuth20Constants.STATE) .append('=') .append(EncodingUtils.urlEncode(state)); } if (StringUtils.isNotBlank(nonce)) { stringBuilder.append('&') .append(OAuth20Constants.NONCE) .append('=') .append(EncodingUtils.urlEncode(nonce)); } builder.setFragment(stringBuilder.toString()); val url = builder.toString(); LOGGER.debug("Redirecting to URL [{}]", url); val parameters = new LinkedHashMap<String, String>(); parameters.put(OAuth20Constants.ACCESS_TOKEN, accessToken.getId()); if (refreshToken != null) { parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId()); } parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString()); parameters.put(OAuth20Constants.STATE, state); parameters.put(OAuth20Constants.NONCE, nonce); parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId()); return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters); }
[ "protected", "ModelAndView", "buildCallbackUrlResponseType", "(", "final", "AccessTokenRequestDataHolder", "holder", ",", "final", "String", "redirectUri", ",", "final", "AccessToken", "accessToken", ",", "final", "List", "<", "NameValuePair", ">", "params", ",", "final", "RefreshToken", "refreshToken", ",", "final", "J2EContext", "context", ")", "throws", "Exception", "{", "val", "attributes", "=", "holder", ".", "getAuthentication", "(", ")", ".", "getAttributes", "(", ")", ";", "val", "state", "=", "attributes", ".", "get", "(", "OAuth20Constants", ".", "STATE", ")", ".", "get", "(", "0", ")", ".", "toString", "(", ")", ";", "val", "nonce", "=", "attributes", ".", "get", "(", "OAuth20Constants", ".", "NONCE", ")", ".", "get", "(", "0", ")", ".", "toString", "(", ")", ";", "val", "builder", "=", "new", "URIBuilder", "(", "redirectUri", ")", ";", "val", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "val", "timeToLive", "=", "accessTokenExpirationPolicy", ".", "getTimeToLive", "(", ")", ";", "stringBuilder", ".", "append", "(", "OAuth20Constants", ".", "ACCESS_TOKEN", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "accessToken", ".", "getId", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "TOKEN_TYPE", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "TOKEN_TYPE_BEARER", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "EXPIRES_IN", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "timeToLive", ")", ";", "if", "(", "refreshToken", "!=", "null", ")", "{", "stringBuilder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "REFRESH_TOKEN", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "refreshToken", ".", "getId", "(", ")", ")", ";", "}", "params", ".", "forEach", "(", "p", "->", "stringBuilder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "p", ".", "getName", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "p", ".", "getValue", "(", ")", ")", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "state", ")", ")", "{", "stringBuilder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "STATE", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "EncodingUtils", ".", "urlEncode", "(", "state", ")", ")", ";", "}", "if", "(", "StringUtils", ".", "isNotBlank", "(", "nonce", ")", ")", "{", "stringBuilder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "OAuth20Constants", ".", "NONCE", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "EncodingUtils", ".", "urlEncode", "(", "nonce", ")", ")", ";", "}", "builder", ".", "setFragment", "(", "stringBuilder", ".", "toString", "(", ")", ")", ";", "val", "url", "=", "builder", ".", "toString", "(", ")", ";", "LOGGER", ".", "debug", "(", "\"Redirecting to URL [{}]\"", ",", "url", ")", ";", "val", "parameters", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "parameters", ".", "put", "(", "OAuth20Constants", ".", "ACCESS_TOKEN", ",", "accessToken", ".", "getId", "(", ")", ")", ";", "if", "(", "refreshToken", "!=", "null", ")", "{", "parameters", ".", "put", "(", "OAuth20Constants", ".", "REFRESH_TOKEN", ",", "refreshToken", ".", "getId", "(", ")", ")", ";", "}", "parameters", ".", "put", "(", "OAuth20Constants", ".", "EXPIRES_IN", ",", "timeToLive", ".", "toString", "(", ")", ")", ";", "parameters", ".", "put", "(", "OAuth20Constants", ".", "STATE", ",", "state", ")", ";", "parameters", ".", "put", "(", "OAuth20Constants", ".", "NONCE", ",", "nonce", ")", ";", "parameters", ".", "put", "(", "OAuth20Constants", ".", "CLIENT_ID", ",", "accessToken", ".", "getClientId", "(", ")", ")", ";", "return", "buildResponseModelAndView", "(", "context", ",", "servicesManager", ",", "accessToken", ".", "getClientId", "(", ")", ",", "url", ",", "parameters", ")", ";", "}" ]
Build callback url response type string. @param holder the holder @param redirectUri the redirect uri @param accessToken the access token @param params the params @param refreshToken the refresh token @param context the context @return the string @throws Exception the exception
[ "Build", "callback", "url", "response", "type", "string", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20TokenAuthorizationResponseBuilder.java#L67-L131
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.deleteEntity
public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { """ Supports Deletion of an entity identified by its unique attribute value @param entityType Type of the entity being deleted @param uniqueAttributeName Attribute Name that uniquely identifies the entity @param uniqueAttributeValue Attribute Value that uniquely identifies the entity @return List of entity ids updated/deleted(including composite references from that entity) """ LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API.DELETE_ENTITY; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); JSONObject jsonResponse = callAPIWithResource(API.DELETE_ENTITIES, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
java
public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API.DELETE_ENTITY; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); JSONObject jsonResponse = callAPIWithResource(API.DELETE_ENTITIES, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
[ "public", "EntityResult", "deleteEntity", "(", "String", "entityType", ",", "String", "uniqueAttributeName", ",", "String", "uniqueAttributeValue", ")", "throws", "AtlasServiceException", "{", "LOG", ".", "debug", "(", "\"Deleting entity type: {}, attributeName: {}, attributeValue: {}\"", ",", "entityType", ",", "uniqueAttributeName", ",", "uniqueAttributeValue", ")", ";", "API", "api", "=", "API", ".", "DELETE_ENTITY", ";", "WebResource", "resource", "=", "getResource", "(", "api", ")", ";", "resource", "=", "resource", ".", "queryParam", "(", "TYPE", ",", "entityType", ")", ";", "resource", "=", "resource", ".", "queryParam", "(", "ATTRIBUTE_NAME", ",", "uniqueAttributeName", ")", ";", "resource", "=", "resource", ".", "queryParam", "(", "ATTRIBUTE_VALUE", ",", "uniqueAttributeValue", ")", ";", "JSONObject", "jsonResponse", "=", "callAPIWithResource", "(", "API", ".", "DELETE_ENTITIES", ",", "resource", ")", ";", "EntityResult", "results", "=", "extractEntityResult", "(", "jsonResponse", ")", ";", "LOG", ".", "debug", "(", "\"Delete entities returned results: {}\"", ",", "results", ")", ";", "return", "results", ";", "}" ]
Supports Deletion of an entity identified by its unique attribute value @param entityType Type of the entity being deleted @param uniqueAttributeName Attribute Name that uniquely identifies the entity @param uniqueAttributeValue Attribute Value that uniquely identifies the entity @return List of entity ids updated/deleted(including composite references from that entity)
[ "Supports", "Deletion", "of", "an", "entity", "identified", "by", "its", "unique", "attribute", "value" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L616-L629
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
SvgGraphicsContext.moveElement
public void moveElement(String name, Object sourceParent, Object targetParent) { """ Move an element from on group to another. The elements name will remain the same. @param name The name of the element within the sourceParent group. @param sourceParent The original parent object associated with the element. @param targetParent The target parent object to be associated with the element. @since 1.8.0 """ helper.moveElement(name, sourceParent, targetParent); }
java
public void moveElement(String name, Object sourceParent, Object targetParent) { helper.moveElement(name, sourceParent, targetParent); }
[ "public", "void", "moveElement", "(", "String", "name", ",", "Object", "sourceParent", ",", "Object", "targetParent", ")", "{", "helper", ".", "moveElement", "(", "name", ",", "sourceParent", ",", "targetParent", ")", ";", "}" ]
Move an element from on group to another. The elements name will remain the same. @param name The name of the element within the sourceParent group. @param sourceParent The original parent object associated with the element. @param targetParent The target parent object to be associated with the element. @since 1.8.0
[ "Move", "an", "element", "from", "on", "group", "to", "another", ".", "The", "elements", "name", "will", "remain", "the", "same", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L769-L771
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java
SimpleIOHandler.convertToOWL
public void convertToOWL(Model model, OutputStream outputStream) { """ Converts a model into BioPAX (OWL) format, and writes it into the outputStream. Saved data can be then read via {@link BioPAXIOHandler} interface (e.g., {@link SimpleIOHandler}). Note: When the model is incomplete (i.e., contains elements that refer externals, dangling BioPAX elements) and is exported by this method, it works; however one will find corresponding object properties set to NULL later, after converting such data back to Model. Note: if the model is very very large, and the output stream is a byte array stream, then you can eventually get OutOfMemoryError "Requested array size exceeds VM limit" (max. array size is 2Gb) @param model model to be converted into OWL format @param outputStream output stream into which the output will be written @throws BioPaxIOException in case of I/O problems """ initializeExporter(model); try { Writer out = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8")); writeObjects(out, model); out.close(); } catch (IOException e) { throw new BioPaxIOException("Cannot convert to OWL!", e); } }
java
public void convertToOWL(Model model, OutputStream outputStream) { initializeExporter(model); try { Writer out = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8")); writeObjects(out, model); out.close(); } catch (IOException e) { throw new BioPaxIOException("Cannot convert to OWL!", e); } }
[ "public", "void", "convertToOWL", "(", "Model", "model", ",", "OutputStream", "outputStream", ")", "{", "initializeExporter", "(", "model", ")", ";", "try", "{", "Writer", "out", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "outputStream", ",", "\"UTF-8\"", ")", ")", ";", "writeObjects", "(", "out", ",", "model", ")", ";", "out", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "BioPaxIOException", "(", "\"Cannot convert to OWL!\"", ",", "e", ")", ";", "}", "}" ]
Converts a model into BioPAX (OWL) format, and writes it into the outputStream. Saved data can be then read via {@link BioPAXIOHandler} interface (e.g., {@link SimpleIOHandler}). Note: When the model is incomplete (i.e., contains elements that refer externals, dangling BioPAX elements) and is exported by this method, it works; however one will find corresponding object properties set to NULL later, after converting such data back to Model. Note: if the model is very very large, and the output stream is a byte array stream, then you can eventually get OutOfMemoryError "Requested array size exceeds VM limit" (max. array size is 2Gb) @param model model to be converted into OWL format @param outputStream output stream into which the output will be written @throws BioPaxIOException in case of I/O problems
[ "Converts", "a", "model", "into", "BioPAX", "(", "OWL", ")", "format", "and", "writes", "it", "into", "the", "outputStream", ".", "Saved", "data", "can", "be", "then", "read", "via", "{", "@link", "BioPAXIOHandler", "}", "interface", "(", "e", ".", "g", ".", "{", "@link", "SimpleIOHandler", "}", ")", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java#L561-L575
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.doRestart
@CLIMethod(name="restart") public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { """ Perform a restart of Jenkins, if we can. This first replaces "app" to {@link HudsonIsRestarting} """ checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
java
@CLIMethod(name="restart") public void doRestart(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, RestartNotSupportedException { checkPermission(ADMINISTER); if (req != null && req.getMethod().equals("GET")) { req.getView(this,"_restart.jelly").forward(req,rsp); return; } if (req == null || req.getMethod().equals("POST")) { restart(); } if (rsp != null) { rsp.sendRedirect2("."); } }
[ "@", "CLIMethod", "(", "name", "=", "\"restart\"", ")", "public", "void", "doRestart", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "IOException", ",", "ServletException", ",", "RestartNotSupportedException", "{", "checkPermission", "(", "ADMINISTER", ")", ";", "if", "(", "req", "!=", "null", "&&", "req", ".", "getMethod", "(", ")", ".", "equals", "(", "\"GET\"", ")", ")", "{", "req", ".", "getView", "(", "this", ",", "\"_restart.jelly\"", ")", ".", "forward", "(", "req", ",", "rsp", ")", ";", "return", ";", "}", "if", "(", "req", "==", "null", "||", "req", ".", "getMethod", "(", ")", ".", "equals", "(", "\"POST\"", ")", ")", "{", "restart", "(", ")", ";", "}", "if", "(", "rsp", "!=", "null", ")", "{", "rsp", ".", "sendRedirect2", "(", "\".\"", ")", ";", "}", "}" ]
Perform a restart of Jenkins, if we can. This first replaces "app" to {@link HudsonIsRestarting}
[ "Perform", "a", "restart", "of", "Jenkins", "if", "we", "can", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4185-L4200
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.cancelOperation
public final void cancelOperation(String projectId, String zone, String operationId) { """ Cancels the specified operation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String operationId = ""; clusterManagerClient.cancelOperation(projectId, zone, operationId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the operation resides. This field has been deprecated and replaced by the name field. @param operationId Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CancelOperationRequest request = CancelOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); cancelOperation(request); }
java
public final void cancelOperation(String projectId, String zone, String operationId) { CancelOperationRequest request = CancelOperationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setOperationId(operationId) .build(); cancelOperation(request); }
[ "public", "final", "void", "cancelOperation", "(", "String", "projectId", ",", "String", "zone", ",", "String", "operationId", ")", "{", "CancelOperationRequest", "request", "=", "CancelOperationRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setZone", "(", "zone", ")", ".", "setOperationId", "(", "operationId", ")", ".", "build", "(", ")", ";", "cancelOperation", "(", "request", ")", ";", "}" ]
Cancels the specified operation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String operationId = ""; clusterManagerClient.cancelOperation(projectId, zone, operationId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the operation resides. This field has been deprecated and replaced by the name field. @param operationId Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Cancels", "the", "specified", "operation", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1567-L1576
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/segmentation/FactorySegmentationAlg.java
FactorySegmentationAlg.meanShift
public static<T extends ImageBase<T>> SegmentMeanShift<T> meanShift(@Nullable ConfigSegmentMeanShift config, ImageType<T> imageType ) { """ Creates an instance of {@link boofcv.alg.segmentation.ms.SegmentMeanShift}. Uniform distributions are used for spacial and color weights. @param config Specify configuration for mean-shift @param imageType Type of input image @return SegmentMeanShift """ if( config == null ) config = new ConfigSegmentMeanShift(); int spacialRadius = config.spacialRadius; float colorRadius = config.colorRadius; int maxIterations = 20; float convergenceTol = 0.1f; SegmentMeanShiftSearch<T> search; if( imageType.getFamily() == ImageType.Family.GRAY) { InterpolatePixelS interp = FactoryInterpolation.bilinearPixelS(imageType.getImageClass(), BorderType.EXTENDED); search = new SegmentMeanShiftSearchGray(maxIterations,convergenceTol,interp, spacialRadius,spacialRadius,colorRadius,config.fast); } else { InterpolatePixelMB interp = FactoryInterpolation.createPixelMB(0,255, InterpolationType.BILINEAR, BorderType.EXTENDED,(ImageType)imageType); search = new SegmentMeanShiftSearchColor(maxIterations,convergenceTol,interp, spacialRadius,spacialRadius,colorRadius,config.fast,imageType); } ComputeRegionMeanColor<T> regionColor = regionMeanColor(imageType); MergeRegionMeanShift merge = new MergeRegionMeanShift(spacialRadius/2+1,Math.max(1,colorRadius/2)); MergeSmallRegions<T> prune = config.minimumRegionSize >= 2 ? new MergeSmallRegions<>(config.minimumRegionSize, config.connectRule, regionColor) : null; return new SegmentMeanShift<>(search, merge, prune, config.connectRule); }
java
public static<T extends ImageBase<T>> SegmentMeanShift<T> meanShift(@Nullable ConfigSegmentMeanShift config, ImageType<T> imageType ) { if( config == null ) config = new ConfigSegmentMeanShift(); int spacialRadius = config.spacialRadius; float colorRadius = config.colorRadius; int maxIterations = 20; float convergenceTol = 0.1f; SegmentMeanShiftSearch<T> search; if( imageType.getFamily() == ImageType.Family.GRAY) { InterpolatePixelS interp = FactoryInterpolation.bilinearPixelS(imageType.getImageClass(), BorderType.EXTENDED); search = new SegmentMeanShiftSearchGray(maxIterations,convergenceTol,interp, spacialRadius,spacialRadius,colorRadius,config.fast); } else { InterpolatePixelMB interp = FactoryInterpolation.createPixelMB(0,255, InterpolationType.BILINEAR, BorderType.EXTENDED,(ImageType)imageType); search = new SegmentMeanShiftSearchColor(maxIterations,convergenceTol,interp, spacialRadius,spacialRadius,colorRadius,config.fast,imageType); } ComputeRegionMeanColor<T> regionColor = regionMeanColor(imageType); MergeRegionMeanShift merge = new MergeRegionMeanShift(spacialRadius/2+1,Math.max(1,colorRadius/2)); MergeSmallRegions<T> prune = config.minimumRegionSize >= 2 ? new MergeSmallRegions<>(config.minimumRegionSize, config.connectRule, regionColor) : null; return new SegmentMeanShift<>(search, merge, prune, config.connectRule); }
[ "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ">", "SegmentMeanShift", "<", "T", ">", "meanShift", "(", "@", "Nullable", "ConfigSegmentMeanShift", "config", ",", "ImageType", "<", "T", ">", "imageType", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigSegmentMeanShift", "(", ")", ";", "int", "spacialRadius", "=", "config", ".", "spacialRadius", ";", "float", "colorRadius", "=", "config", ".", "colorRadius", ";", "int", "maxIterations", "=", "20", ";", "float", "convergenceTol", "=", "0.1f", ";", "SegmentMeanShiftSearch", "<", "T", ">", "search", ";", "if", "(", "imageType", ".", "getFamily", "(", ")", "==", "ImageType", ".", "Family", ".", "GRAY", ")", "{", "InterpolatePixelS", "interp", "=", "FactoryInterpolation", ".", "bilinearPixelS", "(", "imageType", ".", "getImageClass", "(", ")", ",", "BorderType", ".", "EXTENDED", ")", ";", "search", "=", "new", "SegmentMeanShiftSearchGray", "(", "maxIterations", ",", "convergenceTol", ",", "interp", ",", "spacialRadius", ",", "spacialRadius", ",", "colorRadius", ",", "config", ".", "fast", ")", ";", "}", "else", "{", "InterpolatePixelMB", "interp", "=", "FactoryInterpolation", ".", "createPixelMB", "(", "0", ",", "255", ",", "InterpolationType", ".", "BILINEAR", ",", "BorderType", ".", "EXTENDED", ",", "(", "ImageType", ")", "imageType", ")", ";", "search", "=", "new", "SegmentMeanShiftSearchColor", "(", "maxIterations", ",", "convergenceTol", ",", "interp", ",", "spacialRadius", ",", "spacialRadius", ",", "colorRadius", ",", "config", ".", "fast", ",", "imageType", ")", ";", "}", "ComputeRegionMeanColor", "<", "T", ">", "regionColor", "=", "regionMeanColor", "(", "imageType", ")", ";", "MergeRegionMeanShift", "merge", "=", "new", "MergeRegionMeanShift", "(", "spacialRadius", "/", "2", "+", "1", ",", "Math", ".", "max", "(", "1", ",", "colorRadius", "/", "2", ")", ")", ";", "MergeSmallRegions", "<", "T", ">", "prune", "=", "config", ".", "minimumRegionSize", ">=", "2", "?", "new", "MergeSmallRegions", "<>", "(", "config", ".", "minimumRegionSize", ",", "config", ".", "connectRule", ",", "regionColor", ")", ":", "null", ";", "return", "new", "SegmentMeanShift", "<>", "(", "search", ",", "merge", ",", "prune", ",", "config", ".", "connectRule", ")", ";", "}" ]
Creates an instance of {@link boofcv.alg.segmentation.ms.SegmentMeanShift}. Uniform distributions are used for spacial and color weights. @param config Specify configuration for mean-shift @param imageType Type of input image @return SegmentMeanShift
[ "Creates", "an", "instance", "of", "{", "@link", "boofcv", ".", "alg", ".", "segmentation", ".", "ms", ".", "SegmentMeanShift", "}", ".", "Uniform", "distributions", "are", "used", "for", "spacial", "and", "color", "weights", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/segmentation/FactorySegmentationAlg.java#L83-L115
sbang/jsr330activator
jsr330activator.mocks/src/main/java/no/steria/osgi/mocks/MockBundleContext.java
MockBundleContext.addServiceListener
@Override public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException { """ Register a listener for a service, using a filter expression. @param listener the listener callback object to register @param filter a filter expression matching a service """ if (null == filteredServiceListeners.get(filter)) { filteredServiceListeners.put(filter, new ArrayList<ServiceListener>(1)); } filteredServiceListeners.get(filter).add(listener); }
java
@Override public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException { if (null == filteredServiceListeners.get(filter)) { filteredServiceListeners.put(filter, new ArrayList<ServiceListener>(1)); } filteredServiceListeners.get(filter).add(listener); }
[ "@", "Override", "public", "void", "addServiceListener", "(", "ServiceListener", "listener", ",", "String", "filter", ")", "throws", "InvalidSyntaxException", "{", "if", "(", "null", "==", "filteredServiceListeners", ".", "get", "(", "filter", ")", ")", "{", "filteredServiceListeners", ".", "put", "(", "filter", ",", "new", "ArrayList", "<", "ServiceListener", ">", "(", "1", ")", ")", ";", "}", "filteredServiceListeners", ".", "get", "(", "filter", ")", ".", "add", "(", "listener", ")", ";", "}" ]
Register a listener for a service, using a filter expression. @param listener the listener callback object to register @param filter a filter expression matching a service
[ "Register", "a", "listener", "for", "a", "service", "using", "a", "filter", "expression", "." ]
train
https://github.com/sbang/jsr330activator/blob/a9e106db3242f1bfcf76ec391b5a3026679b9645/jsr330activator.mocks/src/main/java/no/steria/osgi/mocks/MockBundleContext.java#L202-L209
derari/cthul
strings/src/main/java/org/cthul/strings/Strings.java
Strings.join
public static StringBuilder join(final StringBuilder sb, final String sep, final String... tokens) { """ Appends {@code tokens} to {@code target}, separated by {@code sep}. @param tokens @param sb """ boolean first = true; for (Object t: tokens) { if (!first) sb.append(sep); else first = false; sb.append(t); } return sb; }
java
public static StringBuilder join(final StringBuilder sb, final String sep, final String... tokens) { boolean first = true; for (Object t: tokens) { if (!first) sb.append(sep); else first = false; sb.append(t); } return sb; }
[ "public", "static", "StringBuilder", "join", "(", "final", "StringBuilder", "sb", ",", "final", "String", "sep", ",", "final", "String", "...", "tokens", ")", "{", "boolean", "first", "=", "true", ";", "for", "(", "Object", "t", ":", "tokens", ")", "{", "if", "(", "!", "first", ")", "sb", ".", "append", "(", "sep", ")", ";", "else", "first", "=", "false", ";", "sb", ".", "append", "(", "t", ")", ";", "}", "return", "sb", ";", "}" ]
Appends {@code tokens} to {@code target}, separated by {@code sep}. @param tokens @param sb
[ "Appends", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/Strings.java#L59-L67
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByBirthday
public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) { """ query-by method for field birthday @param birthday the specified attribute @return an Iterable of DContacts for the specified birthday """ return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday); }
java
public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) { return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday); }
[ "public", "Iterable", "<", "DContact", ">", "queryByBirthday", "(", "Object", "parent", ",", "java", ".", "util", ".", "Date", "birthday", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "BIRTHDAY", ".", "getFieldName", "(", ")", ",", "birthday", ")", ";", "}" ]
query-by method for field birthday @param birthday the specified attribute @return an Iterable of DContacts for the specified birthday
[ "query", "-", "by", "method", "for", "field", "birthday" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L97-L99
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallPlanVersion
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) { """ Unmarshals the given map source into a bean. @param source the source @return the plan version """ if (source == null) { return null; } PlanVersionBean bean = new PlanVersionBean(); bean.setVersion(asString(source.get("version"))); bean.setStatus(asEnum(source.get("status"), PlanStatus.class)); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setLockedOn(asDate(source.get("lockedOn"))); postMarshall(bean); return bean; }
java
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) { if (source == null) { return null; } PlanVersionBean bean = new PlanVersionBean(); bean.setVersion(asString(source.get("version"))); bean.setStatus(asEnum(source.get("status"), PlanStatus.class)); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setLockedOn(asDate(source.get("lockedOn"))); postMarshall(bean); return bean; }
[ "public", "static", "PlanVersionBean", "unmarshallPlanVersion", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "PlanVersionBean", "bean", "=", "new", "PlanVersionBean", "(", ")", ";", "bean", ".", "setVersion", "(", "asString", "(", "source", ".", "get", "(", "\"version\"", ")", ")", ")", ";", "bean", ".", "setStatus", "(", "asEnum", "(", "source", ".", "get", "(", "\"status\"", ")", ",", "PlanStatus", ".", "class", ")", ")", ";", "bean", ".", "setCreatedBy", "(", "asString", "(", "source", ".", "get", "(", "\"createdBy\"", ")", ")", ")", ";", "bean", ".", "setCreatedOn", "(", "asDate", "(", "source", ".", "get", "(", "\"createdOn\"", ")", ")", ")", ";", "bean", ".", "setModifiedBy", "(", "asString", "(", "source", ".", "get", "(", "\"modifiedBy\"", ")", ")", ")", ";", "bean", ".", "setModifiedOn", "(", "asDate", "(", "source", ".", "get", "(", "\"modifiedOn\"", ")", ")", ")", ";", "bean", ".", "setLockedOn", "(", "asDate", "(", "source", ".", "get", "(", "\"lockedOn\"", ")", ")", ")", ";", "postMarshall", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Unmarshals the given map source into a bean. @param source the source @return the plan version
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L864-L878
Bearded-Hen/Android-Bootstrap
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java
BootstrapDrawableFactory.bootstrapButtonText
static ColorStateList bootstrapButtonText(Context context, boolean outline, BootstrapBrand brand) { """ Generates a colorstatelist for a bootstrap button @param context the current context @param outline whether the button is outlined @param brand the button brand @return the color state list """ int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context); int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context); int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context); if (outline && brand instanceof DefaultBootstrapBrand) { // special case DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand; if (db == DefaultBootstrapBrand.SECONDARY) { defaultColor = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context); disabledColor = defaultColor; } } return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor)); }
java
static ColorStateList bootstrapButtonText(Context context, boolean outline, BootstrapBrand brand) { int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context); int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context); int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context); if (outline && brand instanceof DefaultBootstrapBrand) { // special case DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand; if (db == DefaultBootstrapBrand.SECONDARY) { defaultColor = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context); disabledColor = defaultColor; } } return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor)); }
[ "static", "ColorStateList", "bootstrapButtonText", "(", "Context", "context", ",", "boolean", "outline", ",", "BootstrapBrand", "brand", ")", "{", "int", "defaultColor", "=", "outline", "?", "brand", ".", "defaultFill", "(", "context", ")", ":", "brand", ".", "defaultTextColor", "(", "context", ")", ";", "int", "activeColor", "=", "outline", "?", "ColorUtils", ".", "resolveColor", "(", "android", ".", "R", ".", "color", ".", "white", ",", "context", ")", ":", "brand", ".", "activeTextColor", "(", "context", ")", ";", "int", "disabledColor", "=", "outline", "?", "brand", ".", "disabledFill", "(", "context", ")", ":", "brand", ".", "disabledTextColor", "(", "context", ")", ";", "if", "(", "outline", "&&", "brand", "instanceof", "DefaultBootstrapBrand", ")", "{", "// special case", "DefaultBootstrapBrand", "db", "=", "(", "DefaultBootstrapBrand", ")", "brand", ";", "if", "(", "db", "==", "DefaultBootstrapBrand", ".", "SECONDARY", ")", "{", "defaultColor", "=", "ColorUtils", ".", "resolveColor", "(", "R", ".", "color", ".", "bootstrap_brand_secondary_border", ",", "context", ")", ";", "disabledColor", "=", "defaultColor", ";", "}", "}", "return", "new", "ColorStateList", "(", "getStateList", "(", ")", ",", "getColorList", "(", "defaultColor", ",", "activeColor", ",", "disabledColor", ")", ")", ";", "}" ]
Generates a colorstatelist for a bootstrap button @param context the current context @param outline whether the button is outlined @param brand the button brand @return the color state list
[ "Generates", "a", "colorstatelist", "for", "a", "bootstrap", "button" ]
train
https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java#L204-L219
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java
Startup.fromFileList
static Startup fromFileList(List<String> fns, String context, MessageHandler mh) { """ Factory method: Read Startup from a list of external files or resources. @param fns list of file/resource names to access @param context printable non-natural language context for errors @param mh handler for error messages @return files as Startup, or null when error (message has been printed) """ List<StartupEntry> entries = fns.stream() .map(fn -> readFile(fn, context, mh)) .collect(toList()); if (entries.stream().anyMatch(sue -> sue == null)) { return null; } return new Startup(entries); }
java
static Startup fromFileList(List<String> fns, String context, MessageHandler mh) { List<StartupEntry> entries = fns.stream() .map(fn -> readFile(fn, context, mh)) .collect(toList()); if (entries.stream().anyMatch(sue -> sue == null)) { return null; } return new Startup(entries); }
[ "static", "Startup", "fromFileList", "(", "List", "<", "String", ">", "fns", ",", "String", "context", ",", "MessageHandler", "mh", ")", "{", "List", "<", "StartupEntry", ">", "entries", "=", "fns", ".", "stream", "(", ")", ".", "map", "(", "fn", "->", "readFile", "(", "fn", ",", "context", ",", "mh", ")", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "if", "(", "entries", ".", "stream", "(", ")", ".", "anyMatch", "(", "sue", "->", "sue", "==", "null", ")", ")", "{", "return", "null", ";", "}", "return", "new", "Startup", "(", "entries", ")", ";", "}" ]
Factory method: Read Startup from a list of external files or resources. @param fns list of file/resource names to access @param context printable non-natural language context for errors @param mh handler for error messages @return files as Startup, or null when error (message has been printed)
[ "Factory", "method", ":", "Read", "Startup", "from", "a", "list", "of", "external", "files", "or", "resources", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java#L276-L284
google/closure-compiler
src/com/google/javascript/jscomp/PeepholeFoldConstants.java
PeepholeFoldConstants.tryFoldInstanceof
private Node tryFoldInstanceof(Node n, Node left, Node right) { """ Try to fold {@code left instanceof right} into {@code true} or {@code false}. """ checkArgument(n.isInstanceOf()); // TODO(johnlenz) Use type information if available to fold // instanceof. if (NodeUtil.isLiteralValue(left, true) && !mayHaveSideEffects(right)) { Node replacementNode = null; if (NodeUtil.isImmutableValue(left)) { // Non-object types are never instances. replacementNode = IR.falseNode(); } else if (right.isName() && "Object".equals(right.getString())) { replacementNode = IR.trueNode(); } if (replacementNode != null) { n.replaceWith(replacementNode); reportChangeToEnclosingScope(replacementNode); markFunctionsDeleted(n); return replacementNode; } } return n; }
java
private Node tryFoldInstanceof(Node n, Node left, Node right) { checkArgument(n.isInstanceOf()); // TODO(johnlenz) Use type information if available to fold // instanceof. if (NodeUtil.isLiteralValue(left, true) && !mayHaveSideEffects(right)) { Node replacementNode = null; if (NodeUtil.isImmutableValue(left)) { // Non-object types are never instances. replacementNode = IR.falseNode(); } else if (right.isName() && "Object".equals(right.getString())) { replacementNode = IR.trueNode(); } if (replacementNode != null) { n.replaceWith(replacementNode); reportChangeToEnclosingScope(replacementNode); markFunctionsDeleted(n); return replacementNode; } } return n; }
[ "private", "Node", "tryFoldInstanceof", "(", "Node", "n", ",", "Node", "left", ",", "Node", "right", ")", "{", "checkArgument", "(", "n", ".", "isInstanceOf", "(", ")", ")", ";", "// TODO(johnlenz) Use type information if available to fold", "// instanceof.", "if", "(", "NodeUtil", ".", "isLiteralValue", "(", "left", ",", "true", ")", "&&", "!", "mayHaveSideEffects", "(", "right", ")", ")", "{", "Node", "replacementNode", "=", "null", ";", "if", "(", "NodeUtil", ".", "isImmutableValue", "(", "left", ")", ")", "{", "// Non-object types are never instances.", "replacementNode", "=", "IR", ".", "falseNode", "(", ")", ";", "}", "else", "if", "(", "right", ".", "isName", "(", ")", "&&", "\"Object\"", ".", "equals", "(", "right", ".", "getString", "(", ")", ")", ")", "{", "replacementNode", "=", "IR", ".", "trueNode", "(", ")", ";", "}", "if", "(", "replacementNode", "!=", "null", ")", "{", "n", ".", "replaceWith", "(", "replacementNode", ")", ";", "reportChangeToEnclosingScope", "(", "replacementNode", ")", ";", "markFunctionsDeleted", "(", "n", ")", ";", "return", "replacementNode", ";", "}", "}", "return", "n", ";", "}" ]
Try to fold {@code left instanceof right} into {@code true} or {@code false}.
[ "Try", "to", "fold", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeFoldConstants.java#L447-L474
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java
HttpServer.newServer
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { """ Creates a new server using the passed port. @param socketAddress Socket address for the server. @param eventLoopGroup Eventloop group to be used for server as well as client sockets. @param channelClass The class to be used for server channel. @return A new {@link HttpServer} """ return _newServer(TcpServer.newServer(socketAddress, eventLoopGroup, eventLoopGroup, channelClass)); }
java
public static HttpServer<ByteBuf, ByteBuf> newServer(SocketAddress socketAddress, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { return _newServer(TcpServer.newServer(socketAddress, eventLoopGroup, eventLoopGroup, channelClass)); }
[ "public", "static", "HttpServer", "<", "ByteBuf", ",", "ByteBuf", ">", "newServer", "(", "SocketAddress", "socketAddress", ",", "EventLoopGroup", "eventLoopGroup", ",", "Class", "<", "?", "extends", "ServerChannel", ">", "channelClass", ")", "{", "return", "_newServer", "(", "TcpServer", ".", "newServer", "(", "socketAddress", ",", "eventLoopGroup", ",", "eventLoopGroup", ",", "channelClass", ")", ")", ";", "}" ]
Creates a new server using the passed port. @param socketAddress Socket address for the server. @param eventLoopGroup Eventloop group to be used for server as well as client sockets. @param channelClass The class to be used for server channel. @return A new {@link HttpServer}
[ "Creates", "a", "new", "server", "using", "the", "passed", "port", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/server/HttpServer.java#L421-L424
cryptomator/cryptofs
src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java
CryptoFileSystemProvider.newFileSystem
public static CryptoFileSystem newFileSystem(Path pathToVault, CryptoFileSystemProperties properties) throws FileSystemNeedsMigrationException, IOException { """ Typesafe alternative to {@link FileSystems#newFileSystem(URI, Map)}. Default way to retrieve a CryptoFS instance. @param pathToVault Path to this vault's storage location @param properties Parameters used during initialization of the file system @return a new file system @throws FileSystemNeedsMigrationException if the vault format needs to get updated and <code>properties</code> did not contain a flag for implicit migration. @throws IOException if an I/O error occurs creating the file system """ URI uri = CryptoFileSystemUri.create(pathToVault.toAbsolutePath()); return (CryptoFileSystem) FileSystems.newFileSystem(uri, properties); }
java
public static CryptoFileSystem newFileSystem(Path pathToVault, CryptoFileSystemProperties properties) throws FileSystemNeedsMigrationException, IOException { URI uri = CryptoFileSystemUri.create(pathToVault.toAbsolutePath()); return (CryptoFileSystem) FileSystems.newFileSystem(uri, properties); }
[ "public", "static", "CryptoFileSystem", "newFileSystem", "(", "Path", "pathToVault", ",", "CryptoFileSystemProperties", "properties", ")", "throws", "FileSystemNeedsMigrationException", ",", "IOException", "{", "URI", "uri", "=", "CryptoFileSystemUri", ".", "create", "(", "pathToVault", ".", "toAbsolutePath", "(", ")", ")", ";", "return", "(", "CryptoFileSystem", ")", "FileSystems", ".", "newFileSystem", "(", "uri", ",", "properties", ")", ";", "}" ]
Typesafe alternative to {@link FileSystems#newFileSystem(URI, Map)}. Default way to retrieve a CryptoFS instance. @param pathToVault Path to this vault's storage location @param properties Parameters used during initialization of the file system @return a new file system @throws FileSystemNeedsMigrationException if the vault format needs to get updated and <code>properties</code> did not contain a flag for implicit migration. @throws IOException if an I/O error occurs creating the file system
[ "Typesafe", "alternative", "to", "{", "@link", "FileSystems#newFileSystem", "(", "URI", "Map", ")", "}", ".", "Default", "way", "to", "retrieve", "a", "CryptoFS", "instance", "." ]
train
https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java#L126-L129
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/tsdb/model/Filters.java
Filters.addTag
public Filters addTag(String tagKey, List<String> tagValues) { """ Add tag to tags which just append not replace. @param tagKey @param tagValues @return Filters """ addTags(tagKey, tagValues); return this; }
java
public Filters addTag(String tagKey, List<String> tagValues) { addTags(tagKey, tagValues); return this; }
[ "public", "Filters", "addTag", "(", "String", "tagKey", ",", "List", "<", "String", ">", "tagValues", ")", "{", "addTags", "(", "tagKey", ",", "tagValues", ")", ";", "return", "this", ";", "}" ]
Add tag to tags which just append not replace. @param tagKey @param tagValues @return Filters
[ "Add", "tag", "to", "tags", "which", "just", "append", "not", "replace", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Filters.java#L290-L293
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/ChildReplacer.java
ChildReplacer.replaceChildren
public static PlanNode replaceChildren(PlanNode node, List<PlanNode> children) { """ Return an identical copy of the given node with its children replaced """ for (int i = 0; i < node.getSources().size(); i++) { if (children.get(i) != node.getSources().get(i)) { return node.replaceChildren(children); } } return node; }
java
public static PlanNode replaceChildren(PlanNode node, List<PlanNode> children) { for (int i = 0; i < node.getSources().size(); i++) { if (children.get(i) != node.getSources().get(i)) { return node.replaceChildren(children); } } return node; }
[ "public", "static", "PlanNode", "replaceChildren", "(", "PlanNode", "node", ",", "List", "<", "PlanNode", ">", "children", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getSources", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "children", ".", "get", "(", "i", ")", "!=", "node", ".", "getSources", "(", ")", ".", "get", "(", "i", ")", ")", "{", "return", "node", ".", "replaceChildren", "(", "children", ")", ";", "}", "}", "return", "node", ";", "}" ]
Return an identical copy of the given node with its children replaced
[ "Return", "an", "identical", "copy", "of", "the", "given", "node", "with", "its", "children", "replaced" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/plan/ChildReplacer.java#L27-L35
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java
EJSContainer.notifySecurityCollaboratorPreInvoke
private Object notifySecurityCollaboratorPreInvoke(EJBSecurityCollaborator<?> collaborator, EJBRequestData request) throws CSIException { """ Notify the security collaborator for pre-invoke. This method handles exception mapping for EJBSecurityCollaborator that throw EJBAccessException rather than the legacy CSIAccessException. """ try { return collaborator.preInvoke(request); } catch (EJBAccessException ex) { // The CSI exception created here will eventually be mapped back to an // EJBAccessException, so avoid setting the cause so that we don't end // up with an EJBAccessException chained to an EJBAccessException. // Also, security actually throws an 'internal' subclass of // EJBAccessException that will not deserialize on a client. CSIAccessException csiEx = new CSIAccessException(ex.getMessage()); csiEx.setStackTrace(ex.getStackTrace()); throw csiEx; } catch (RuntimeException ex) { throw ex; } catch (CSIException ex) { throw ex; } catch (Exception ex) { throw new CSIException("", ex); } }
java
private Object notifySecurityCollaboratorPreInvoke(EJBSecurityCollaborator<?> collaborator, EJBRequestData request) throws CSIException { try { return collaborator.preInvoke(request); } catch (EJBAccessException ex) { // The CSI exception created here will eventually be mapped back to an // EJBAccessException, so avoid setting the cause so that we don't end // up with an EJBAccessException chained to an EJBAccessException. // Also, security actually throws an 'internal' subclass of // EJBAccessException that will not deserialize on a client. CSIAccessException csiEx = new CSIAccessException(ex.getMessage()); csiEx.setStackTrace(ex.getStackTrace()); throw csiEx; } catch (RuntimeException ex) { throw ex; } catch (CSIException ex) { throw ex; } catch (Exception ex) { throw new CSIException("", ex); } }
[ "private", "Object", "notifySecurityCollaboratorPreInvoke", "(", "EJBSecurityCollaborator", "<", "?", ">", "collaborator", ",", "EJBRequestData", "request", ")", "throws", "CSIException", "{", "try", "{", "return", "collaborator", ".", "preInvoke", "(", "request", ")", ";", "}", "catch", "(", "EJBAccessException", "ex", ")", "{", "// The CSI exception created here will eventually be mapped back to an", "// EJBAccessException, so avoid setting the cause so that we don't end", "// up with an EJBAccessException chained to an EJBAccessException.", "// Also, security actually throws an 'internal' subclass of", "// EJBAccessException that will not deserialize on a client.", "CSIAccessException", "csiEx", "=", "new", "CSIAccessException", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "csiEx", ".", "setStackTrace", "(", "ex", ".", "getStackTrace", "(", ")", ")", ";", "throw", "csiEx", ";", "}", "catch", "(", "RuntimeException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "CSIException", "ex", ")", "{", "throw", "ex", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "CSIException", "(", "\"\"", ",", "ex", ")", ";", "}", "}" ]
Notify the security collaborator for pre-invoke. This method handles exception mapping for EJBSecurityCollaborator that throw EJBAccessException rather than the legacy CSIAccessException.
[ "Notify", "the", "security", "collaborator", "for", "pre", "-", "invoke", ".", "This", "method", "handles", "exception", "mapping", "for", "EJBSecurityCollaborator", "that", "throw", "EJBAccessException", "rather", "than", "the", "legacy", "CSIAccessException", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L3145-L3164
jcuda/jcusolver
JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java
JCusolverDn.cusolverDnSorgbr_bufferSize
public static int cusolverDnSorgbr_bufferSize( cusolverDnHandle handle, int side, int m, int n, int k, Pointer A, int lda, Pointer tau, int[] lwork) { """ generates one of the unitary matrices Q or P**T determined by GEBRD """ return checkResult(cusolverDnSorgbr_bufferSizeNative(handle, side, m, n, k, A, lda, tau, lwork)); }
java
public static int cusolverDnSorgbr_bufferSize( cusolverDnHandle handle, int side, int m, int n, int k, Pointer A, int lda, Pointer tau, int[] lwork) { return checkResult(cusolverDnSorgbr_bufferSizeNative(handle, side, m, n, k, A, lda, tau, lwork)); }
[ "public", "static", "int", "cusolverDnSorgbr_bufferSize", "(", "cusolverDnHandle", "handle", ",", "int", "side", ",", "int", "m", ",", "int", "n", ",", "int", "k", ",", "Pointer", "A", ",", "int", "lda", ",", "Pointer", "tau", ",", "int", "[", "]", "lwork", ")", "{", "return", "checkResult", "(", "cusolverDnSorgbr_bufferSizeNative", "(", "handle", ",", "side", ",", "m", ",", "n", ",", "k", ",", "A", ",", "lda", ",", "tau", ",", "lwork", ")", ")", ";", "}" ]
generates one of the unitary matrices Q or P**T determined by GEBRD
[ "generates", "one", "of", "the", "unitary", "matrices", "Q", "or", "P", "**", "T", "determined", "by", "GEBRD" ]
train
https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L1935-L1947
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.exportsIn
public static List<ExportsDirective> exportsIn(Iterable<? extends Directive> directives) { """ Returns a list of {@code exports} directives in {@code directives}. @return a list of {@code exports} directives in {@code directives} @param directives the directives to filter @since 9 @spec JPMS """ return listFilter(directives, DirectiveKind.EXPORTS, ExportsDirective.class); }
java
public static List<ExportsDirective> exportsIn(Iterable<? extends Directive> directives) { return listFilter(directives, DirectiveKind.EXPORTS, ExportsDirective.class); }
[ "public", "static", "List", "<", "ExportsDirective", ">", "exportsIn", "(", "Iterable", "<", "?", "extends", "Directive", ">", "directives", ")", "{", "return", "listFilter", "(", "directives", ",", "DirectiveKind", ".", "EXPORTS", ",", "ExportsDirective", ".", "class", ")", ";", "}" ]
Returns a list of {@code exports} directives in {@code directives}. @return a list of {@code exports} directives in {@code directives} @param directives the directives to filter @since 9 @spec JPMS
[ "Returns", "a", "list", "of", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L243-L246
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java
Client.postBatch
@NotNull public BatchRes postBatch(@NotNull final BatchReq batchReq) throws IOException { """ Send batch request to the LFS-server. @param batchReq Batch request. @return Object metadata. @throws IOException """ return doWork(auth -> doRequest(auth, new JsonPost<>(batchReq, BatchRes.class), AuthHelper.join(auth.getHref(), PATH_BATCH)), batchReq.getOperation()); }
java
@NotNull public BatchRes postBatch(@NotNull final BatchReq batchReq) throws IOException { return doWork(auth -> doRequest(auth, new JsonPost<>(batchReq, BatchRes.class), AuthHelper.join(auth.getHref(), PATH_BATCH)), batchReq.getOperation()); }
[ "@", "NotNull", "public", "BatchRes", "postBatch", "(", "@", "NotNull", "final", "BatchReq", "batchReq", ")", "throws", "IOException", "{", "return", "doWork", "(", "auth", "->", "doRequest", "(", "auth", ",", "new", "JsonPost", "<>", "(", "batchReq", ",", "BatchRes", ".", "class", ")", ",", "AuthHelper", ".", "join", "(", "auth", ".", "getHref", "(", ")", ",", "PATH_BATCH", ")", ")", ",", "batchReq", ".", "getOperation", "(", ")", ")", ";", "}" ]
Send batch request to the LFS-server. @param batchReq Batch request. @return Object metadata. @throws IOException
[ "Send", "batch", "request", "to", "the", "LFS", "-", "server", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L116-L119
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java
PatchModuleInvalidationUtils.computeBadByteSkipArray
private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) { """ Fills the Boyer Moore "bad character array" for the given pattern """ for (int a = 0; a < ALPHABET_SIZE; a++) { badByteArray[a] = pattern.length; } for (int j = 0; j < pattern.length - 1; j++) { badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1; } }
java
private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) { for (int a = 0; a < ALPHABET_SIZE; a++) { badByteArray[a] = pattern.length; } for (int j = 0; j < pattern.length - 1; j++) { badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1; } }
[ "private", "static", "void", "computeBadByteSkipArray", "(", "byte", "[", "]", "pattern", ",", "int", "[", "]", "badByteArray", ")", "{", "for", "(", "int", "a", "=", "0", ";", "a", "<", "ALPHABET_SIZE", ";", "a", "++", ")", "{", "badByteArray", "[", "a", "]", "=", "pattern", ".", "length", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "pattern", ".", "length", "-", "1", ";", "j", "++", ")", "{", "badByteArray", "[", "pattern", "[", "j", "]", "-", "Byte", ".", "MIN_VALUE", "]", "=", "pattern", ".", "length", "-", "j", "-", "1", ";", "}", "}" ]
Fills the Boyer Moore "bad character array" for the given pattern
[ "Fills", "the", "Boyer", "Moore", "bad", "character", "array", "for", "the", "given", "pattern" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L520-L528
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.substringFirstFront
public static String substringFirstFront(final String str, final String... delimiters) { """ Extract front sub-string from first-found delimiter. <pre> substringFirstFront("foo.bar/baz.qux", ".", "/") returns "foo" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The part of string. (NotNull: if delimiter not found, returns argument-plain string) """ assertStringNotNull(str); return doSubstringFirstRear(false, false, false, str, delimiters); }
java
public static String substringFirstFront(final String str, final String... delimiters) { assertStringNotNull(str); return doSubstringFirstRear(false, false, false, str, delimiters); }
[ "public", "static", "String", "substringFirstFront", "(", "final", "String", "str", ",", "final", "String", "...", "delimiters", ")", "{", "assertStringNotNull", "(", "str", ")", ";", "return", "doSubstringFirstRear", "(", "false", ",", "false", ",", "false", ",", "str", ",", "delimiters", ")", ";", "}" ]
Extract front sub-string from first-found delimiter. <pre> substringFirstFront("foo.bar/baz.qux", ".", "/") returns "foo" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The part of string. (NotNull: if delimiter not found, returns argument-plain string)
[ "Extract", "front", "sub", "-", "string", "from", "first", "-", "found", "delimiter", ".", "<pre", ">", "substringFirstFront", "(", "foo", ".", "bar", "/", "baz", ".", "qux", ".", "/", ")", "returns", "foo", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L627-L630
gresrun/jesque
src/main/java/net/greghaines/jesque/admin/AdminImpl.java
AdminImpl.recoverFromException
protected void recoverFromException(final String channel, final Exception e) { """ Handle an exception that was thrown from inside {@link PubSubListener#onMessage(String,String)}. @param channel the name of the channel that was being processed when the exception was thrown @param e the exception that was thrown """ final RecoveryStrategy recoveryStrategy = this.exceptionHandlerRef.get().onException(this, e, channel); switch (recoveryStrategy) { case RECONNECT: LOG.info("Reconnecting to Redis in response to exception", e); final int reconAttempts = getReconnectAttempts(); if (!JedisUtils.reconnect(this.jedis, reconAttempts, RECONNECT_SLEEP_TIME)) { LOG.warn("Terminating in response to exception after " + reconAttempts + " to reconnect", e); end(false); } else { LOG.info("Reconnected to Redis"); } break; case TERMINATE: LOG.warn("Terminating in response to exception", e); end(false); break; case PROCEED: break; default: LOG.error("Unknown RecoveryStrategy: " + recoveryStrategy + " while attempting to recover from the following exception; Admin proceeding...", e); break; } }
java
protected void recoverFromException(final String channel, final Exception e) { final RecoveryStrategy recoveryStrategy = this.exceptionHandlerRef.get().onException(this, e, channel); switch (recoveryStrategy) { case RECONNECT: LOG.info("Reconnecting to Redis in response to exception", e); final int reconAttempts = getReconnectAttempts(); if (!JedisUtils.reconnect(this.jedis, reconAttempts, RECONNECT_SLEEP_TIME)) { LOG.warn("Terminating in response to exception after " + reconAttempts + " to reconnect", e); end(false); } else { LOG.info("Reconnected to Redis"); } break; case TERMINATE: LOG.warn("Terminating in response to exception", e); end(false); break; case PROCEED: break; default: LOG.error("Unknown RecoveryStrategy: " + recoveryStrategy + " while attempting to recover from the following exception; Admin proceeding...", e); break; } }
[ "protected", "void", "recoverFromException", "(", "final", "String", "channel", ",", "final", "Exception", "e", ")", "{", "final", "RecoveryStrategy", "recoveryStrategy", "=", "this", ".", "exceptionHandlerRef", ".", "get", "(", ")", ".", "onException", "(", "this", ",", "e", ",", "channel", ")", ";", "switch", "(", "recoveryStrategy", ")", "{", "case", "RECONNECT", ":", "LOG", ".", "info", "(", "\"Reconnecting to Redis in response to exception\"", ",", "e", ")", ";", "final", "int", "reconAttempts", "=", "getReconnectAttempts", "(", ")", ";", "if", "(", "!", "JedisUtils", ".", "reconnect", "(", "this", ".", "jedis", ",", "reconAttempts", ",", "RECONNECT_SLEEP_TIME", ")", ")", "{", "LOG", ".", "warn", "(", "\"Terminating in response to exception after \"", "+", "reconAttempts", "+", "\" to reconnect\"", ",", "e", ")", ";", "end", "(", "false", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Reconnected to Redis\"", ")", ";", "}", "break", ";", "case", "TERMINATE", ":", "LOG", ".", "warn", "(", "\"Terminating in response to exception\"", ",", "e", ")", ";", "end", "(", "false", ")", ";", "break", ";", "case", "PROCEED", ":", "break", ";", "default", ":", "LOG", ".", "error", "(", "\"Unknown RecoveryStrategy: \"", "+", "recoveryStrategy", "+", "\" while attempting to recover from the following exception; Admin proceeding...\"", ",", "e", ")", ";", "break", ";", "}", "}" ]
Handle an exception that was thrown from inside {@link PubSubListener#onMessage(String,String)}. @param channel the name of the channel that was being processed when the exception was thrown @param e the exception that was thrown
[ "Handle", "an", "exception", "that", "was", "thrown", "from", "inside", "{", "@link", "PubSubListener#onMessage", "(", "String", "String", ")", "}", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/admin/AdminImpl.java#L363-L387
JM-Lab/utils-java8
src/main/java/kr/jm/utils/collections/JMNestedMap.java
JMNestedMap.getOrPutGetNew
public V getOrPutGetNew(K1 key1, K2 key2, Supplier<V> newValueSupplier) { """ Gets or put get new. @param key1 the key 1 @param key2 the key 2 @param newValueSupplier the new value supplier @return the or put get new """ return JMMap .getOrPutGetNew(getOrPutGetNew(key1), key2, newValueSupplier); }
java
public V getOrPutGetNew(K1 key1, K2 key2, Supplier<V> newValueSupplier) { return JMMap .getOrPutGetNew(getOrPutGetNew(key1), key2, newValueSupplier); }
[ "public", "V", "getOrPutGetNew", "(", "K1", "key1", ",", "K2", "key2", ",", "Supplier", "<", "V", ">", "newValueSupplier", ")", "{", "return", "JMMap", ".", "getOrPutGetNew", "(", "getOrPutGetNew", "(", "key1", ")", ",", "key2", ",", "newValueSupplier", ")", ";", "}" ]
Gets or put get new. @param key1 the key 1 @param key2 the key 2 @param newValueSupplier the new value supplier @return the or put get new
[ "Gets", "or", "put", "get", "new", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/JMNestedMap.java#L174-L177
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/selector/ExecutorComparator.java
ExecutorComparator.getNumberOfAssignedFlowComparator
private static FactorComparator<Executor> getNumberOfAssignedFlowComparator(final int weight) { """ function defines the number of assigned flow comparator. @param weight weight of the comparator. """ return FactorComparator .create(NUMOFASSIGNEDFLOW_COMPARATOR_NAME, weight, new Comparator<Executor>() { @Override public int compare(final Executor o1, final Executor o2) { final ExecutorInfo stat1 = o1.getExecutorInfo(); final ExecutorInfo stat2 = o2.getExecutorInfo(); final Integer result = 0; if (statisticsObjectCheck(stat1, stat2, NUMOFASSIGNEDFLOW_COMPARATOR_NAME)) { return result; } return ((Integer) stat1.getRemainingFlowCapacity()) .compareTo(stat2.getRemainingFlowCapacity()); } }); }
java
private static FactorComparator<Executor> getNumberOfAssignedFlowComparator(final int weight) { return FactorComparator .create(NUMOFASSIGNEDFLOW_COMPARATOR_NAME, weight, new Comparator<Executor>() { @Override public int compare(final Executor o1, final Executor o2) { final ExecutorInfo stat1 = o1.getExecutorInfo(); final ExecutorInfo stat2 = o2.getExecutorInfo(); final Integer result = 0; if (statisticsObjectCheck(stat1, stat2, NUMOFASSIGNEDFLOW_COMPARATOR_NAME)) { return result; } return ((Integer) stat1.getRemainingFlowCapacity()) .compareTo(stat2.getRemainingFlowCapacity()); } }); }
[ "private", "static", "FactorComparator", "<", "Executor", ">", "getNumberOfAssignedFlowComparator", "(", "final", "int", "weight", ")", "{", "return", "FactorComparator", ".", "create", "(", "NUMOFASSIGNEDFLOW_COMPARATOR_NAME", ",", "weight", ",", "new", "Comparator", "<", "Executor", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "final", "Executor", "o1", ",", "final", "Executor", "o2", ")", "{", "final", "ExecutorInfo", "stat1", "=", "o1", ".", "getExecutorInfo", "(", ")", ";", "final", "ExecutorInfo", "stat2", "=", "o2", ".", "getExecutorInfo", "(", ")", ";", "final", "Integer", "result", "=", "0", ";", "if", "(", "statisticsObjectCheck", "(", "stat1", ",", "stat2", ",", "NUMOFASSIGNEDFLOW_COMPARATOR_NAME", ")", ")", "{", "return", "result", ";", "}", "return", "(", "(", "Integer", ")", "stat1", ".", "getRemainingFlowCapacity", "(", ")", ")", ".", "compareTo", "(", "stat2", ".", "getRemainingFlowCapacity", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
function defines the number of assigned flow comparator. @param weight weight of the comparator.
[ "function", "defines", "the", "number", "of", "assigned", "flow", "comparator", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/selector/ExecutorComparator.java#L149-L166
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.writeModel
public static void writeModel(@NonNull Model model, @NonNull String path, boolean saveUpdater) throws IOException { """ Write a model to a file path @param model the model to write @param path the path to write to @param saveUpdater whether to save the updater or not @throws IOException """ try (BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(path))) { writeModel(model, stream, saveUpdater); } }
java
public static void writeModel(@NonNull Model model, @NonNull String path, boolean saveUpdater) throws IOException { try (BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(path))) { writeModel(model, stream, saveUpdater); } }
[ "public", "static", "void", "writeModel", "(", "@", "NonNull", "Model", "model", ",", "@", "NonNull", "String", "path", ",", "boolean", "saveUpdater", ")", "throws", "IOException", "{", "try", "(", "BufferedOutputStream", "stream", "=", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "path", ")", ")", ")", "{", "writeModel", "(", "model", ",", "stream", ",", "saveUpdater", ")", ";", "}", "}" ]
Write a model to a file path @param model the model to write @param path the path to write to @param saveUpdater whether to save the updater or not @throws IOException
[ "Write", "a", "model", "to", "a", "file", "path" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L104-L108
kubernetes-client/java
util/src/main/java/io/kubernetes/client/util/Yaml.java
Yaml.addModelMap
public static void addModelMap(String apiGroupVersion, String kind, Class<?> clazz) { """ Add a mapping from API Group/version/kind to a Class to use when calling <code>load(...)</code> . <p>Shouldn't really be needed as most API Group/Version/Kind are loaded dynamically at startup. """ classes.put(apiGroupVersion + "/" + kind, clazz); }
java
public static void addModelMap(String apiGroupVersion, String kind, Class<?> clazz) { classes.put(apiGroupVersion + "/" + kind, clazz); }
[ "public", "static", "void", "addModelMap", "(", "String", "apiGroupVersion", ",", "String", "kind", ",", "Class", "<", "?", ">", "clazz", ")", "{", "classes", ".", "put", "(", "apiGroupVersion", "+", "\"/\"", "+", "kind", ",", "clazz", ")", ";", "}" ]
Add a mapping from API Group/version/kind to a Class to use when calling <code>load(...)</code> . <p>Shouldn't really be needed as most API Group/Version/Kind are loaded dynamically at startup.
[ "Add", "a", "mapping", "from", "API", "Group", "/", "version", "/", "kind", "to", "a", "Class", "to", "use", "when", "calling", "<code", ">", "load", "(", "...", ")", "<", "/", "code", ">", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/util/Yaml.java#L148-L150
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/utility/ReadBufferManager.java
ReadBufferManager.getWindowOffset
private int getWindowOffset(long bytePos, int length) throws IOException { """ Moves the window if necessary to contain the desired byte and returns the position of the byte in the window @param bytePos @throws java.io.IOException """ long desiredMax = bytePos + length - 1; if ((bytePos >= windowStart) && (desiredMax < windowStart + buffer.capacity())) { long res = bytePos - windowStart; if (res < Integer.MAX_VALUE) { return (int) res; } else { throw new IOException("This buffer is quite large..."); } } else { long bufferCapacity = Math.max(bufferSize, length); long size = channel.size(); bufferCapacity = Math.min(bufferCapacity, size - bytePos); if (bufferCapacity > Integer.MAX_VALUE) { throw new IOException("Woaw ! You want to have a REALLY LARGE buffer !"); } windowStart = bytePos; channel.position(windowStart); if (buffer.capacity() != bufferCapacity) { ByteOrder order = buffer.order(); buffer = ByteBuffer.allocate((int)bufferCapacity); buffer.order(order); } else { buffer.clear(); } channel.read(buffer); buffer.flip(); return (int) (bytePos - windowStart); } }
java
private int getWindowOffset(long bytePos, int length) throws IOException { long desiredMax = bytePos + length - 1; if ((bytePos >= windowStart) && (desiredMax < windowStart + buffer.capacity())) { long res = bytePos - windowStart; if (res < Integer.MAX_VALUE) { return (int) res; } else { throw new IOException("This buffer is quite large..."); } } else { long bufferCapacity = Math.max(bufferSize, length); long size = channel.size(); bufferCapacity = Math.min(bufferCapacity, size - bytePos); if (bufferCapacity > Integer.MAX_VALUE) { throw new IOException("Woaw ! You want to have a REALLY LARGE buffer !"); } windowStart = bytePos; channel.position(windowStart); if (buffer.capacity() != bufferCapacity) { ByteOrder order = buffer.order(); buffer = ByteBuffer.allocate((int)bufferCapacity); buffer.order(order); } else { buffer.clear(); } channel.read(buffer); buffer.flip(); return (int) (bytePos - windowStart); } }
[ "private", "int", "getWindowOffset", "(", "long", "bytePos", ",", "int", "length", ")", "throws", "IOException", "{", "long", "desiredMax", "=", "bytePos", "+", "length", "-", "1", ";", "if", "(", "(", "bytePos", ">=", "windowStart", ")", "&&", "(", "desiredMax", "<", "windowStart", "+", "buffer", ".", "capacity", "(", ")", ")", ")", "{", "long", "res", "=", "bytePos", "-", "windowStart", ";", "if", "(", "res", "<", "Integer", ".", "MAX_VALUE", ")", "{", "return", "(", "int", ")", "res", ";", "}", "else", "{", "throw", "new", "IOException", "(", "\"This buffer is quite large...\"", ")", ";", "}", "}", "else", "{", "long", "bufferCapacity", "=", "Math", ".", "max", "(", "bufferSize", ",", "length", ")", ";", "long", "size", "=", "channel", ".", "size", "(", ")", ";", "bufferCapacity", "=", "Math", ".", "min", "(", "bufferCapacity", ",", "size", "-", "bytePos", ")", ";", "if", "(", "bufferCapacity", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "IOException", "(", "\"Woaw ! You want to have a REALLY LARGE buffer !\"", ")", ";", "}", "windowStart", "=", "bytePos", ";", "channel", ".", "position", "(", "windowStart", ")", ";", "if", "(", "buffer", ".", "capacity", "(", ")", "!=", "bufferCapacity", ")", "{", "ByteOrder", "order", "=", "buffer", ".", "order", "(", ")", ";", "buffer", "=", "ByteBuffer", ".", "allocate", "(", "(", "int", ")", "bufferCapacity", ")", ";", "buffer", ".", "order", "(", "order", ")", ";", "}", "else", "{", "buffer", ".", "clear", "(", ")", ";", "}", "channel", ".", "read", "(", "buffer", ")", ";", "buffer", ".", "flip", "(", ")", ";", "return", "(", "int", ")", "(", "bytePos", "-", "windowStart", ")", ";", "}", "}" ]
Moves the window if necessary to contain the desired byte and returns the position of the byte in the window @param bytePos @throws java.io.IOException
[ "Moves", "the", "window", "if", "necessary", "to", "contain", "the", "desired", "byte", "and", "returns", "the", "position", "of", "the", "byte", "in", "the", "window" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/ReadBufferManager.java#L70-L102
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.isAssignable
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) { """ <p>Checks if an array of Classes can be assigned to another array of Classes.</p> <p>This method calls {@link #isAssignable(Class, Class) isAssignable} for each Class pair in the input arrays. It can be used to check if a set of arguments (the first parameter) are suitably compatible with a set of method parameter types (the second parameter).</p> <p>Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of primitive classes and {@code null}s.</p> <p>Primitive widenings allow an int to be assigned to a {@code long}, {@code float} or {@code double}. This method returns the correct result for these cases.</p> <p>{@code Null} may be assigned to any reference type. This method will return {@code true} if {@code null} is passed in and the toClass is non-primitive.</p> <p>Specifically, this method tests whether the type represented by the specified {@code Class} parameter can be converted to the type represented by this {@code Class} object via an identity conversion widening primitive or widening reference conversion. See <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> <p><strong>Since Lang 3.0,</strong> this method will default behavior for calculating assignability between primitive and wrapper types <em>corresponding to the running Java version</em>; i.e. autoboxing will be the default behavior in VMs running Java versions &gt; 1.5.</p> @param classArray the array of Classes to check, may be {@code null} @param toClassArray the array of Classes to try to assign into, may be {@code null} @return {@code true} if assignment possible """ return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
java
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) { return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "boolean", "isAssignable", "(", "final", "Class", "<", "?", ">", "[", "]", "classArray", ",", "final", "Class", "<", "?", ">", "...", "toClassArray", ")", "{", "return", "isAssignable", "(", "classArray", ",", "toClassArray", ",", "SystemUtils", ".", "isJavaVersionAtLeast", "(", "JavaVersion", ".", "JAVA_1_5", ")", ")", ";", "}" ]
<p>Checks if an array of Classes can be assigned to another array of Classes.</p> <p>This method calls {@link #isAssignable(Class, Class) isAssignable} for each Class pair in the input arrays. It can be used to check if a set of arguments (the first parameter) are suitably compatible with a set of method parameter types (the second parameter).</p> <p>Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of primitive classes and {@code null}s.</p> <p>Primitive widenings allow an int to be assigned to a {@code long}, {@code float} or {@code double}. This method returns the correct result for these cases.</p> <p>{@code Null} may be assigned to any reference type. This method will return {@code true} if {@code null} is passed in and the toClass is non-primitive.</p> <p>Specifically, this method tests whether the type represented by the specified {@code Class} parameter can be converted to the type represented by this {@code Class} object via an identity conversion widening primitive or widening reference conversion. See <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> <p><strong>Since Lang 3.0,</strong> this method will default behavior for calculating assignability between primitive and wrapper types <em>corresponding to the running Java version</em>; i.e. autoboxing will be the default behavior in VMs running Java versions &gt; 1.5.</p> @param classArray the array of Classes to check, may be {@code null} @param toClassArray the array of Classes to try to assign into, may be {@code null} @return {@code true} if assignment possible
[ "<p", ">", "Checks", "if", "an", "array", "of", "Classes", "can", "be", "assigned", "to", "another", "array", "of", "Classes", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L648-L651
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.isRelated
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { """ Returns true if targetClass or a superclass of targetClass is related to sourceClass. @param sourceClass The primary class. @param targetClass The class to test. @return True if targetClass or a superclass of targetClass is related to sourceClass. """ return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
java
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
[ "public", "boolean", "isRelated", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "targetClass", ")", "{", "return", "getCardinality", "(", "sourceClass", ",", "targetClass", ")", ".", "maxOccurrences", ">", "0", ";", "}" ]
Returns true if targetClass or a superclass of targetClass is related to sourceClass. @param sourceClass The primary class. @param targetClass The class to test. @return True if targetClass or a superclass of targetClass is related to sourceClass.
[ "Returns", "true", "if", "targetClass", "or", "a", "superclass", "of", "targetClass", "is", "related", "to", "sourceClass", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L186-L188
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java
LinkedConverter.convertIndexToField
public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode) { """ Convert the display's index to the field value and move to field. @param index The index to convert an set this field to. @param bDisplayOption If true, display the change in the converters. @param iMoveMove The type of move. """ // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().convertIndexToField(index, bDisplayOption, iMoveMode); else return super.convertIndexToField(index, bDisplayOption, iMoveMode); }
java
public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode) { // Must be overidden if (this.getNextConverter() != null) return this.getNextConverter().convertIndexToField(index, bDisplayOption, iMoveMode); else return super.convertIndexToField(index, bDisplayOption, iMoveMode); }
[ "public", "int", "convertIndexToField", "(", "int", "index", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Must be overidden", "if", "(", "this", ".", "getNextConverter", "(", ")", "!=", "null", ")", "return", "this", ".", "getNextConverter", "(", ")", ".", "convertIndexToField", "(", "index", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "else", "return", "super", ".", "convertIndexToField", "(", "index", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Convert the display's index to the field value and move to field. @param index The index to convert an set this field to. @param bDisplayOption If true, display the change in the converters. @param iMoveMove The type of move.
[ "Convert", "the", "display", "s", "index", "to", "the", "field", "value", "and", "move", "to", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java#L142-L148
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java
XmlErrorHandler.printError
void printError(String type, SAXParseException e) { """ Prints the error to STDOUT, used to be consistent with TEAM Engine error handler. """ PrintWriter logger = new PrintWriter(System.out); logger.print(type); if (e.getLineNumber() >= 0) { logger.print(" at line " + e.getLineNumber()); if (e.getColumnNumber() >= 0) { logger.print(", column " + e.getColumnNumber()); } if (e.getSystemId() != null) { logger.print(" of " + e.getSystemId()); } } else { if (e.getSystemId() != null) { logger.print(" in " + e.getSystemId()); } } logger.println(":"); logger.println(" " + e.getMessage()); logger.flush(); }
java
void printError(String type, SAXParseException e) { PrintWriter logger = new PrintWriter(System.out); logger.print(type); if (e.getLineNumber() >= 0) { logger.print(" at line " + e.getLineNumber()); if (e.getColumnNumber() >= 0) { logger.print(", column " + e.getColumnNumber()); } if (e.getSystemId() != null) { logger.print(" of " + e.getSystemId()); } } else { if (e.getSystemId() != null) { logger.print(" in " + e.getSystemId()); } } logger.println(":"); logger.println(" " + e.getMessage()); logger.flush(); }
[ "void", "printError", "(", "String", "type", ",", "SAXParseException", "e", ")", "{", "PrintWriter", "logger", "=", "new", "PrintWriter", "(", "System", ".", "out", ")", ";", "logger", ".", "print", "(", "type", ")", ";", "if", "(", "e", ".", "getLineNumber", "(", ")", ">=", "0", ")", "{", "logger", ".", "print", "(", "\" at line \"", "+", "e", ".", "getLineNumber", "(", ")", ")", ";", "if", "(", "e", ".", "getColumnNumber", "(", ")", ">=", "0", ")", "{", "logger", ".", "print", "(", "\", column \"", "+", "e", ".", "getColumnNumber", "(", ")", ")", ";", "}", "if", "(", "e", ".", "getSystemId", "(", ")", "!=", "null", ")", "{", "logger", ".", "print", "(", "\" of \"", "+", "e", ".", "getSystemId", "(", ")", ")", ";", "}", "}", "else", "{", "if", "(", "e", ".", "getSystemId", "(", ")", "!=", "null", ")", "{", "logger", ".", "print", "(", "\" in \"", "+", "e", ".", "getSystemId", "(", ")", ")", ";", "}", "}", "logger", ".", "println", "(", "\":\"", ")", ";", "logger", ".", "println", "(", "\" \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "logger", ".", "flush", "(", ")", ";", "}" ]
Prints the error to STDOUT, used to be consistent with TEAM Engine error handler.
[ "Prints", "the", "error", "to", "STDOUT", "used", "to", "be", "consistent", "with", "TEAM", "Engine", "error", "handler", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/XmlErrorHandler.java#L83-L102
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.dateTruncStr
public static Expression dateTruncStr(Expression expression, DatePart part) { """ Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant. """ return x("DATE_TRUNC_STR(" + expression.toString() + ", \"" + part.toString() + "\")"); }
java
public static Expression dateTruncStr(Expression expression, DatePart part) { return x("DATE_TRUNC_STR(" + expression.toString() + ", \"" + part.toString() + "\")"); }
[ "public", "static", "Expression", "dateTruncStr", "(", "Expression", "expression", ",", "DatePart", "part", ")", "{", "return", "x", "(", "\"DATE_TRUNC_STR(\"", "+", "expression", ".", "toString", "(", ")", "+", "\", \\\"\"", "+", "part", ".", "toString", "(", ")", "+", "\"\\\")\"", ")", ";", "}" ]
Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant.
[ "Returned", "expression", "results", "in", "ISO", "8601", "timestamp", "that", "has", "been", "truncated", "so", "that", "the", "given", "date", "part", "is", "the", "least", "significant", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L188-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileSharedServerLeaseLog.java
FileSharedServerLeaseLog.getFileSharedServerLeaseLog
public static FileSharedServerLeaseLog getFileSharedServerLeaseLog(String logDirStem, String localRecoveryIdentity, String recoveryGroup) { """ Access the singleton instance of the FileSystem Lease log. @return ChannelFrameworkImpl """ if (tc.isEntryEnabled()) Tr.entry(tc, "FileSharedServerLeaseLog", new Object[] { logDirStem, localRecoveryIdentity, recoveryGroup }); if (_serverInstallLeaseLogDir == null) setLeaseLog(logDirStem, localRecoveryIdentity, recoveryGroup); if (tc.isEntryEnabled()) Tr.exit(tc, "FileSharedServerLeaseLog", _fileLeaseLog); return _fileLeaseLog; }
java
public static FileSharedServerLeaseLog getFileSharedServerLeaseLog(String logDirStem, String localRecoveryIdentity, String recoveryGroup) { if (tc.isEntryEnabled()) Tr.entry(tc, "FileSharedServerLeaseLog", new Object[] { logDirStem, localRecoveryIdentity, recoveryGroup }); if (_serverInstallLeaseLogDir == null) setLeaseLog(logDirStem, localRecoveryIdentity, recoveryGroup); if (tc.isEntryEnabled()) Tr.exit(tc, "FileSharedServerLeaseLog", _fileLeaseLog); return _fileLeaseLog; }
[ "public", "static", "FileSharedServerLeaseLog", "getFileSharedServerLeaseLog", "(", "String", "logDirStem", ",", "String", "localRecoveryIdentity", ",", "String", "recoveryGroup", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"FileSharedServerLeaseLog\"", ",", "new", "Object", "[", "]", "{", "logDirStem", ",", "localRecoveryIdentity", ",", "recoveryGroup", "}", ")", ";", "if", "(", "_serverInstallLeaseLogDir", "==", "null", ")", "setLeaseLog", "(", "logDirStem", ",", "localRecoveryIdentity", ",", "recoveryGroup", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"FileSharedServerLeaseLog\"", ",", "_fileLeaseLog", ")", ";", "return", "_fileLeaseLog", ";", "}" ]
Access the singleton instance of the FileSystem Lease log. @return ChannelFrameworkImpl
[ "Access", "the", "singleton", "instance", "of", "the", "FileSystem", "Lease", "log", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/FileSharedServerLeaseLog.java#L106-L116
httl/httl
httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java
ConcurrentLinkedHashMap.addTaskToChain
void addTaskToChain(Task[] tasks, Task task, int index) { """ Adds the task as the head of the chain at the index location. @param tasks the ordered array of the pending operations @param task the pending operation to add @param index the array location """ task.setNext(tasks[index]); tasks[index] = task; }
java
void addTaskToChain(Task[] tasks, Task task, int index) { task.setNext(tasks[index]); tasks[index] = task; }
[ "void", "addTaskToChain", "(", "Task", "[", "]", "tasks", ",", "Task", "task", ",", "int", "index", ")", "{", "task", ".", "setNext", "(", "tasks", "[", "index", "]", ")", ";", "tasks", "[", "index", "]", "=", "task", ";", "}" ]
Adds the task as the head of the chain at the index location. @param tasks the ordered array of the pending operations @param task the pending operation to add @param index the array location
[ "Adds", "the", "task", "as", "the", "head", "of", "the", "chain", "at", "the", "index", "location", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java#L511-L514
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java
CookieExtensions.newCookie
public static Cookie newCookie(final String name, final String value, final String purpose, final String domain, final int maxAge, final String path, final boolean secure) { """ Creates a new cookie. @param name the name @param value the value @param purpose the purpose @param domain the domain @param maxAge the max age @param path the path @param secure the secure @return the cookie """ final Cookie cookie = new Cookie(name, value); cookie.setComment(purpose); cookie.setDomain(domain); cookie.setMaxAge(maxAge); cookie.setPath(path); return cookie; }
java
public static Cookie newCookie(final String name, final String value, final String purpose, final String domain, final int maxAge, final String path, final boolean secure) { final Cookie cookie = new Cookie(name, value); cookie.setComment(purpose); cookie.setDomain(domain); cookie.setMaxAge(maxAge); cookie.setPath(path); return cookie; }
[ "public", "static", "Cookie", "newCookie", "(", "final", "String", "name", ",", "final", "String", "value", ",", "final", "String", "purpose", ",", "final", "String", "domain", ",", "final", "int", "maxAge", ",", "final", "String", "path", ",", "final", "boolean", "secure", ")", "{", "final", "Cookie", "cookie", "=", "new", "Cookie", "(", "name", ",", "value", ")", ";", "cookie", ".", "setComment", "(", "purpose", ")", ";", "cookie", ".", "setDomain", "(", "domain", ")", ";", "cookie", ".", "setMaxAge", "(", "maxAge", ")", ";", "cookie", ".", "setPath", "(", "path", ")", ";", "return", "cookie", ";", "}" ]
Creates a new cookie. @param name the name @param value the value @param purpose the purpose @param domain the domain @param maxAge the max age @param path the path @param secure the secure @return the cookie
[ "Creates", "a", "new", "cookie", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java#L83-L93
mongodb/stitch-android-sdk
server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java
RemoteMongoCollectionImpl.findOne
public DocumentT findOne(final Bson filter, final RemoteFindOptions options) { """ Finds a document in the collection. @param filter the query filter @param options A RemoteFindOptions struct @return a task containing the result of the find one operation """ return proxy.findOne(filter, options); }
java
public DocumentT findOne(final Bson filter, final RemoteFindOptions options) { return proxy.findOne(filter, options); }
[ "public", "DocumentT", "findOne", "(", "final", "Bson", "filter", ",", "final", "RemoteFindOptions", "options", ")", "{", "return", "proxy", ".", "findOne", "(", "filter", ",", "options", ")", ";", "}" ]
Finds a document in the collection. @param filter the query filter @param options A RemoteFindOptions struct @return a task containing the result of the find one operation
[ "Finds", "a", "document", "in", "the", "collection", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java#L170-L172
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.countChar
private int countChar(String string, char c) { """ Counts the number of times the character is present in the string. @param string the string to count the characters in @param c the character to count @return the number of times the character is present in the string """ int count = 0; final int max = string.length(); for (int i = 0; i < max; i++) { if (c == string.charAt(i)) { count++; } } return count; }
java
private int countChar(String string, char c) { int count = 0; final int max = string.length(); for (int i = 0; i < max; i++) { if (c == string.charAt(i)) { count++; } } return count; }
[ "private", "int", "countChar", "(", "String", "string", ",", "char", "c", ")", "{", "int", "count", "=", "0", ";", "final", "int", "max", "=", "string", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "++", ")", "{", "if", "(", "c", "==", "string", ".", "charAt", "(", "i", ")", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
Counts the number of times the character is present in the string. @param string the string to count the characters in @param c the character to count @return the number of times the character is present in the string
[ "Counts", "the", "number", "of", "times", "the", "character", "is", "present", "in", "the", "string", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L455-L464
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_options_PUT
public void billingAccount_line_serviceName_options_PUT(String billingAccount, String serviceName, OvhLineOptions body) throws IOException { """ Alter this object properties REST: PUT /telephony/{billingAccount}/line/{serviceName}/options @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_line_serviceName_options_PUT(String billingAccount, String serviceName, OvhLineOptions body) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_line_serviceName_options_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhLineOptions", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/options\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /telephony/{billingAccount}/line/{serviceName}/options @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1710-L1714
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByLastName
public Iterable<DUser> queryByLastName(java.lang.String lastName) { """ query-by method for field lastName @param lastName the specified attribute @return an Iterable of DUsers for the specified lastName """ return queryByField(null, DUserMapper.Field.LASTNAME.getFieldName(), lastName); }
java
public Iterable<DUser> queryByLastName(java.lang.String lastName) { return queryByField(null, DUserMapper.Field.LASTNAME.getFieldName(), lastName); }
[ "public", "Iterable", "<", "DUser", ">", "queryByLastName", "(", "java", ".", "lang", ".", "String", "lastName", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "LASTNAME", ".", "getFieldName", "(", ")", ",", "lastName", ")", ";", "}" ]
query-by method for field lastName @param lastName the specified attribute @return an Iterable of DUsers for the specified lastName
[ "query", "-", "by", "method", "for", "field", "lastName" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L169-L171
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipPhone.java
SipPhone.addBuddy
public PresenceSubscriber addBuddy(String uri, long timeout) { """ This method is the same as addBuddy(uri, duration, eventId, timeout) except that the duration is defaulted to the default period defined in the event package RFC (3600 seconds) and no event "id" parameter will be included. @param uri the URI (ie, sip:[email protected]) of the buddy to be added to the list. @param timeout The maximum amount of time to wait for a SUBSCRIBE response, in milliseconds. Use a value of 0 to wait indefinitely. @return PresenceSubscriber object representing the buddy if the operation is successful so far, null otherwise. """ return addBuddy(uri, DEFAULT_SUBSCRIBE_DURATION, null, timeout); }
java
public PresenceSubscriber addBuddy(String uri, long timeout) { return addBuddy(uri, DEFAULT_SUBSCRIBE_DURATION, null, timeout); }
[ "public", "PresenceSubscriber", "addBuddy", "(", "String", "uri", ",", "long", "timeout", ")", "{", "return", "addBuddy", "(", "uri", ",", "DEFAULT_SUBSCRIBE_DURATION", ",", "null", ",", "timeout", ")", ";", "}" ]
This method is the same as addBuddy(uri, duration, eventId, timeout) except that the duration is defaulted to the default period defined in the event package RFC (3600 seconds) and no event "id" parameter will be included. @param uri the URI (ie, sip:[email protected]) of the buddy to be added to the list. @param timeout The maximum amount of time to wait for a SUBSCRIBE response, in milliseconds. Use a value of 0 to wait indefinitely. @return PresenceSubscriber object representing the buddy if the operation is successful so far, null otherwise.
[ "This", "method", "is", "the", "same", "as", "addBuddy", "(", "uri", "duration", "eventId", "timeout", ")", "except", "that", "the", "duration", "is", "defaulted", "to", "the", "default", "period", "defined", "in", "the", "event", "package", "RFC", "(", "3600", "seconds", ")", "and", "no", "event", "id", "parameter", "will", "be", "included", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L1441-L1443
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.accessBase
Symbol accessBase(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified) { """ Variant of the generalized access routine, to be used for generating variable, type resolution diagnostics """ return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper); }
java
Symbol accessBase(Symbol sym, DiagnosticPosition pos, Symbol location, Type site, Name name, boolean qualified) { return accessInternal(sym, pos, location, site, name, qualified, List.nil(), null, basicLogResolveHelper); }
[ "Symbol", "accessBase", "(", "Symbol", "sym", ",", "DiagnosticPosition", "pos", ",", "Symbol", "location", ",", "Type", "site", ",", "Name", "name", ",", "boolean", "qualified", ")", "{", "return", "accessInternal", "(", "sym", ",", "pos", ",", "location", ",", "site", ",", "name", ",", "qualified", ",", "List", ".", "nil", "(", ")", ",", "null", ",", "basicLogResolveHelper", ")", ";", "}" ]
Variant of the generalized access routine, to be used for generating variable, type resolution diagnostics
[ "Variant", "of", "the", "generalized", "access", "routine", "to", "be", "used", "for", "generating", "variable", "type", "resolution", "diagnostics" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2485-L2492
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java
CacheUnitImpl.addAlias
public void addAlias(String cacheName, Object id, Object[] aliasArray) { """ This implements the method in the CacheUnit interface. This is called to add alias ids for cache id. @param cacheName The cache name @param id The cache id @param aliasArray The array of alias ids """ if (id != null && aliasArray != null) { DCache cache = ServerCache.getCache(cacheName); if (cache != null) { try { cache.addAlias(id, aliasArray, false, false); } catch (IllegalArgumentException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Adding alias for cache id " + id + " failure: " + e.getMessage()); } } } } }
java
public void addAlias(String cacheName, Object id, Object[] aliasArray) { if (id != null && aliasArray != null) { DCache cache = ServerCache.getCache(cacheName); if (cache != null) { try { cache.addAlias(id, aliasArray, false, false); } catch (IllegalArgumentException e) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Adding alias for cache id " + id + " failure: " + e.getMessage()); } } } } }
[ "public", "void", "addAlias", "(", "String", "cacheName", ",", "Object", "id", ",", "Object", "[", "]", "aliasArray", ")", "{", "if", "(", "id", "!=", "null", "&&", "aliasArray", "!=", "null", ")", "{", "DCache", "cache", "=", "ServerCache", ".", "getCache", "(", "cacheName", ")", ";", "if", "(", "cache", "!=", "null", ")", "{", "try", "{", "cache", ".", "addAlias", "(", "id", ",", "aliasArray", ",", "false", ",", "false", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Adding alias for cache id \"", "+", "id", "+", "\" failure: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", "}" ]
This implements the method in the CacheUnit interface. This is called to add alias ids for cache id. @param cacheName The cache name @param id The cache id @param aliasArray The array of alias ids
[ "This", "implements", "the", "method", "in", "the", "CacheUnit", "interface", ".", "This", "is", "called", "to", "add", "alias", "ids", "for", "cache", "id", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L334-L347
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.createAuthzHeaderForAuthorizedEndpoint
public String createAuthzHeaderForAuthorizedEndpoint(String endpointUrl, String token) { """ Generates the Authorization header value required for an authorized endpoint request. Assumes that {@code tokenSecret} has already been set to the appropriate value based on the provided token. See {@link https://dev.twitter.com/oauth/reference/post/oauth/access_token} for details. @param endpointUrl @param token For {@value TwitterConstants#TWITTER_ENDPOINT_ACCESS_TOKEN} requests, this is the request token obtained in an earlier call. For other authorized requests, this is a valid access token. @return """ Map<String, String> parameters = populateAuthorizedEndpointAuthzHeaderParams(token); return signAndCreateAuthzHeader(endpointUrl, parameters); }
java
public String createAuthzHeaderForAuthorizedEndpoint(String endpointUrl, String token) { Map<String, String> parameters = populateAuthorizedEndpointAuthzHeaderParams(token); return signAndCreateAuthzHeader(endpointUrl, parameters); }
[ "public", "String", "createAuthzHeaderForAuthorizedEndpoint", "(", "String", "endpointUrl", ",", "String", "token", ")", "{", "Map", "<", "String", ",", "String", ">", "parameters", "=", "populateAuthorizedEndpointAuthzHeaderParams", "(", "token", ")", ";", "return", "signAndCreateAuthzHeader", "(", "endpointUrl", ",", "parameters", ")", ";", "}" ]
Generates the Authorization header value required for an authorized endpoint request. Assumes that {@code tokenSecret} has already been set to the appropriate value based on the provided token. See {@link https://dev.twitter.com/oauth/reference/post/oauth/access_token} for details. @param endpointUrl @param token For {@value TwitterConstants#TWITTER_ENDPOINT_ACCESS_TOKEN} requests, this is the request token obtained in an earlier call. For other authorized requests, this is a valid access token. @return
[ "Generates", "the", "Authorization", "header", "value", "required", "for", "an", "authorized", "endpoint", "request", ".", "Assumes", "that", "{", "@code", "tokenSecret", "}", "has", "already", "been", "set", "to", "the", "appropriate", "value", "based", "on", "the", "provided", "token", ".", "See", "{", "@link", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "oauth", "/", "reference", "/", "post", "/", "oauth", "/", "access_token", "}", "for", "details", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L441-L444
craterdog/java-security-framework
java-security-utilities/src/main/java/craterdog/security/EncryptedPropertyConfigurer.java
EncryptedPropertyConfigurer.doProcessProperties
@Override protected void doProcessProperties(ConfigurableListableBeanFactory beanFactoryToProcess, final StringValueResolver valueResolver) { """ This is method is needed because of https://jira.springsource.org/browse/SPR-8928 @param beanFactoryToProcess The factory to be used for the processing. @param valueResolver The value resolver to be used. """ StringValueResolver valueConvertingResolver = (String strVal) -> convertPropertyValue(valueResolver.resolveStringValue(strVal)); super.doProcessProperties(beanFactoryToProcess, valueConvertingResolver); }
java
@Override protected void doProcessProperties(ConfigurableListableBeanFactory beanFactoryToProcess, final StringValueResolver valueResolver) { StringValueResolver valueConvertingResolver = (String strVal) -> convertPropertyValue(valueResolver.resolveStringValue(strVal)); super.doProcessProperties(beanFactoryToProcess, valueConvertingResolver); }
[ "@", "Override", "protected", "void", "doProcessProperties", "(", "ConfigurableListableBeanFactory", "beanFactoryToProcess", ",", "final", "StringValueResolver", "valueResolver", ")", "{", "StringValueResolver", "valueConvertingResolver", "=", "(", "String", "strVal", ")", "->", "convertPropertyValue", "(", "valueResolver", ".", "resolveStringValue", "(", "strVal", ")", ")", ";", "super", ".", "doProcessProperties", "(", "beanFactoryToProcess", ",", "valueConvertingResolver", ")", ";", "}" ]
This is method is needed because of https://jira.springsource.org/browse/SPR-8928 @param beanFactoryToProcess The factory to be used for the processing. @param valueResolver The value resolver to be used.
[ "This", "is", "method", "is", "needed", "because", "of", "https", ":", "//", "jira", ".", "springsource", ".", "org", "/", "browse", "/", "SPR", "-", "8928" ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-security-utilities/src/main/java/craterdog/security/EncryptedPropertyConfigurer.java#L73-L79
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/Transport.java
Transport.getChildEntries
public <T> List<T> getChildEntries(Class<?> parentClass, String parentKey, Class<T> classs) throws RedmineException { """ Delivers a list of a child entries. @param classs target class. """ final EntityConfig<T> config = getConfig(classs); final URI uri = getURIConfigurator().getChildObjectsURI(parentClass, parentKey, classs, new BasicNameValuePair("limit", String.valueOf(objectsPerPage))); HttpGet http = new HttpGet(uri); String response = send(http); final JSONObject responseObject; try { responseObject = RedmineJSONParser.getResponse(response); return JsonInput.getListNotNull(responseObject, config.multiObjectName, config.parser); } catch (JSONException e) { throw new RedmineFormatException("Bad categories response " + response, e); } }
java
public <T> List<T> getChildEntries(Class<?> parentClass, String parentKey, Class<T> classs) throws RedmineException { final EntityConfig<T> config = getConfig(classs); final URI uri = getURIConfigurator().getChildObjectsURI(parentClass, parentKey, classs, new BasicNameValuePair("limit", String.valueOf(objectsPerPage))); HttpGet http = new HttpGet(uri); String response = send(http); final JSONObject responseObject; try { responseObject = RedmineJSONParser.getResponse(response); return JsonInput.getListNotNull(responseObject, config.multiObjectName, config.parser); } catch (JSONException e) { throw new RedmineFormatException("Bad categories response " + response, e); } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "getChildEntries", "(", "Class", "<", "?", ">", "parentClass", ",", "String", "parentKey", ",", "Class", "<", "T", ">", "classs", ")", "throws", "RedmineException", "{", "final", "EntityConfig", "<", "T", ">", "config", "=", "getConfig", "(", "classs", ")", ";", "final", "URI", "uri", "=", "getURIConfigurator", "(", ")", ".", "getChildObjectsURI", "(", "parentClass", ",", "parentKey", ",", "classs", ",", "new", "BasicNameValuePair", "(", "\"limit\"", ",", "String", ".", "valueOf", "(", "objectsPerPage", ")", ")", ")", ";", "HttpGet", "http", "=", "new", "HttpGet", "(", "uri", ")", ";", "String", "response", "=", "send", "(", "http", ")", ";", "final", "JSONObject", "responseObject", ";", "try", "{", "responseObject", "=", "RedmineJSONParser", ".", "getResponse", "(", "response", ")", ";", "return", "JsonInput", ".", "getListNotNull", "(", "responseObject", ",", "config", ".", "multiObjectName", ",", "config", ".", "parser", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "throw", "new", "RedmineFormatException", "(", "\"Bad categories response \"", "+", "response", ",", "e", ")", ";", "}", "}" ]
Delivers a list of a child entries. @param classs target class.
[ "Delivers", "a", "list", "of", "a", "child", "entries", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/Transport.java#L527-L541
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java
FieldAccessor.setMapLabel
public void setMapLabel(final Object targetObj, final String label, final String key) { """ {@link XlsMapColumns}フィールド用のラベル情報を設定します。 <p>ラベル情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param label ラベル情報 @param key マップのキー @throws IllegalArgumentException {@literal targetObj == null or label == null or key == null} @throws IllegalArgumentException {@literal label or key is empty.} """ ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notEmpty(label, "label"); ArgUtils.notEmpty(key, "key"); mapLabelSetter.ifPresent(setter -> setter.set(targetObj, label, key)); }
java
public void setMapLabel(final Object targetObj, final String label, final String key) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notEmpty(label, "label"); ArgUtils.notEmpty(key, "key"); mapLabelSetter.ifPresent(setter -> setter.set(targetObj, label, key)); }
[ "public", "void", "setMapLabel", "(", "final", "Object", "targetObj", ",", "final", "String", "label", ",", "final", "String", "key", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ",", "\"targetObj\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "label", ",", "\"label\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "key", ",", "\"key\"", ")", ";", "mapLabelSetter", ".", "ifPresent", "(", "setter", "->", "setter", ".", "set", "(", "targetObj", ",", "label", ",", "key", ")", ")", ";", "}" ]
{@link XlsMapColumns}フィールド用のラベル情報を設定します。 <p>ラベル情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param label ラベル情報 @param key マップのキー @throws IllegalArgumentException {@literal targetObj == null or label == null or key == null} @throws IllegalArgumentException {@literal label or key is empty.}
[ "{", "@link", "XlsMapColumns", "}", "フィールド用のラベル情報を設定します。", "<p", ">", "ラベル情報を保持するフィールドがない場合は、処理はスキップされます。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L453-L461
elki-project/elki
elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNAndRKNNPreprocessor.java
MaterializeKNNAndRKNNPreprocessor.materializeKNNAndRKNNs
private void materializeKNNAndRKNNs(ArrayDBIDs ids, FiniteProgress progress) { """ Materializes the kNNs and RkNNs of the specified object IDs. @param ids the IDs of the objects """ // add an empty list to each rknn for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { if(materialized_RkNN.get(iter) == null) { materialized_RkNN.put(iter, new TreeSet<DoubleDBIDPair>()); } } // knn query List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(ids, k); for(DBIDArrayIter id = ids.iter(); id.valid(); id.advance()) { KNNList kNNs = kNNList.get(id.getOffset()); storage.put(id, kNNs); for(DoubleDBIDListIter iter = kNNs.iter(); iter.valid(); iter.advance()) { materialized_RkNN.get(iter).add(DBIDUtil.newPair(iter.doubleValue(), id)); } LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); }
java
private void materializeKNNAndRKNNs(ArrayDBIDs ids, FiniteProgress progress) { // add an empty list to each rknn for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { if(materialized_RkNN.get(iter) == null) { materialized_RkNN.put(iter, new TreeSet<DoubleDBIDPair>()); } } // knn query List<? extends KNNList> kNNList = knnQuery.getKNNForBulkDBIDs(ids, k); for(DBIDArrayIter id = ids.iter(); id.valid(); id.advance()) { KNNList kNNs = kNNList.get(id.getOffset()); storage.put(id, kNNs); for(DoubleDBIDListIter iter = kNNs.iter(); iter.valid(); iter.advance()) { materialized_RkNN.get(iter).add(DBIDUtil.newPair(iter.doubleValue(), id)); } LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); }
[ "private", "void", "materializeKNNAndRKNNs", "(", "ArrayDBIDs", "ids", ",", "FiniteProgress", "progress", ")", "{", "// add an empty list to each rknn", "for", "(", "DBIDIter", "iter", "=", "ids", ".", "iter", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "if", "(", "materialized_RkNN", ".", "get", "(", "iter", ")", "==", "null", ")", "{", "materialized_RkNN", ".", "put", "(", "iter", ",", "new", "TreeSet", "<", "DoubleDBIDPair", ">", "(", ")", ")", ";", "}", "}", "// knn query", "List", "<", "?", "extends", "KNNList", ">", "kNNList", "=", "knnQuery", ".", "getKNNForBulkDBIDs", "(", "ids", ",", "k", ")", ";", "for", "(", "DBIDArrayIter", "id", "=", "ids", ".", "iter", "(", ")", ";", "id", ".", "valid", "(", ")", ";", "id", ".", "advance", "(", ")", ")", "{", "KNNList", "kNNs", "=", "kNNList", ".", "get", "(", "id", ".", "getOffset", "(", ")", ")", ";", "storage", ".", "put", "(", "id", ",", "kNNs", ")", ";", "for", "(", "DoubleDBIDListIter", "iter", "=", "kNNs", ".", "iter", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "materialized_RkNN", ".", "get", "(", "iter", ")", ".", "add", "(", "DBIDUtil", ".", "newPair", "(", "iter", ".", "doubleValue", "(", ")", ",", "id", ")", ")", ";", "}", "LOG", ".", "incrementProcessed", "(", "progress", ")", ";", "}", "LOG", ".", "ensureCompleted", "(", "progress", ")", ";", "}" ]
Materializes the kNNs and RkNNs of the specified object IDs. @param ids the IDs of the objects
[ "Materializes", "the", "kNNs", "and", "RkNNs", "of", "the", "specified", "object", "IDs", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-preprocessed/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/knn/MaterializeKNNAndRKNNPreprocessor.java#L95-L115
hubrick/vertx-rest-client
src/main/java/com/hubrick/vertx/rest/RestClientOptions.java
RestClientOptions.putGlobalHeader
public RestClientOptions putGlobalHeader(String name, String value) { """ Add a global header which will be appended to every HTTP request. The headers defined per request will override this headers. @param name The name of the header @param value The value of the header @return a reference to this so multiple method calls can be chained together """ globalHeaders.add(name, value); return this; }
java
public RestClientOptions putGlobalHeader(String name, String value) { globalHeaders.add(name, value); return this; }
[ "public", "RestClientOptions", "putGlobalHeader", "(", "String", "name", ",", "String", "value", ")", "{", "globalHeaders", ".", "add", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a global header which will be appended to every HTTP request. The headers defined per request will override this headers. @param name The name of the header @param value The value of the header @return a reference to this so multiple method calls can be chained together
[ "Add", "a", "global", "header", "which", "will", "be", "appended", "to", "every", "HTTP", "request", ".", "The", "headers", "defined", "per", "request", "will", "override", "this", "headers", "." ]
train
https://github.com/hubrick/vertx-rest-client/blob/4e6715bc2fb031555fc635adbf94a53b9cfba81e/src/main/java/com/hubrick/vertx/rest/RestClientOptions.java#L134-L137
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/DiscordianDate.java
DiscordianDate.ofYearDay
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) { """ Obtains a {@code DiscordianDate} representing a date in the Discordian calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code DiscordianDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Discordian proleptic-year @param dayOfYear the Discordian day-of-year, from 1 to 366 @return the date in Discordian calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year """ DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear == 366 && !leap) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year"); } if (leap) { if (dayOfYear == ST_TIBS_OFFSET) { // Take care of special case of St Tib's Day. return new DiscordianDate(prolepticYear, 0, 0); } else if (dayOfYear > ST_TIBS_OFFSET) { // Offset dayOfYear to account for added day. dayOfYear--; } } int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1; int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1; return new DiscordianDate(prolepticYear, month, dayOfMonth); }
java
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) { DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear == 366 && !leap) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year"); } if (leap) { if (dayOfYear == ST_TIBS_OFFSET) { // Take care of special case of St Tib's Day. return new DiscordianDate(prolepticYear, 0, 0); } else if (dayOfYear > ST_TIBS_OFFSET) { // Offset dayOfYear to account for added day. dayOfYear--; } } int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1; int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1; return new DiscordianDate(prolepticYear, month, dayOfMonth); }
[ "static", "DiscordianDate", "ofYearDay", "(", "int", "prolepticYear", ",", "int", "dayOfYear", ")", "{", "DiscordianChronology", ".", "YEAR_RANGE", ".", "checkValidValue", "(", "prolepticYear", ",", "YEAR", ")", ";", "DAY_OF_YEAR", ".", "checkValidValue", "(", "dayOfYear", ")", ";", "boolean", "leap", "=", "DiscordianChronology", ".", "INSTANCE", ".", "isLeapYear", "(", "prolepticYear", ")", ";", "if", "(", "dayOfYear", "==", "366", "&&", "!", "leap", ")", "{", "throw", "new", "DateTimeException", "(", "\"Invalid date 'DayOfYear 366' as '\"", "+", "prolepticYear", "+", "\"' is not a leap year\"", ")", ";", "}", "if", "(", "leap", ")", "{", "if", "(", "dayOfYear", "==", "ST_TIBS_OFFSET", ")", "{", "// Take care of special case of St Tib's Day.", "return", "new", "DiscordianDate", "(", "prolepticYear", ",", "0", ",", "0", ")", ";", "}", "else", "if", "(", "dayOfYear", ">", "ST_TIBS_OFFSET", ")", "{", "// Offset dayOfYear to account for added day.", "dayOfYear", "--", ";", "}", "}", "int", "month", "=", "(", "dayOfYear", "-", "1", ")", "/", "DAYS_IN_MONTH", "+", "1", ";", "int", "dayOfMonth", "=", "(", "dayOfYear", "-", "1", ")", "%", "DAYS_IN_MONTH", "+", "1", ";", "return", "new", "DiscordianDate", "(", "prolepticYear", ",", "month", ",", "dayOfMonth", ")", ";", "}" ]
Obtains a {@code DiscordianDate} representing a date in the Discordian calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code DiscordianDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Discordian proleptic-year @param dayOfYear the Discordian day-of-year, from 1 to 366 @return the date in Discordian calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year
[ "Obtains", "a", "{", "@code", "DiscordianDate", "}", "representing", "a", "date", "in", "the", "Discordian", "calendar", "system", "from", "the", "proleptic", "-", "year", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "This", "returns", "a", "{", "@code", "DiscordianDate", "}", "with", "the", "specified", "fields", ".", "The", "day", "must", "be", "valid", "for", "the", "year", "otherwise", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/DiscordianDate.java#L229-L251
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.isValueSelectedInDropDown
public boolean isValueSelectedInDropDown(final By by, final String value) { """ Checks if a value is selected in a drop down list. @param by the method of identifying the element @param value the value to search for @return true if the value is selected or false otherwise """ WebElement element = driver.findElement(by); StringBuilder builder = new StringBuilder(".//option[@value = "); builder.append(escapeQuotes(value)); builder.append("]"); List<WebElement> options = element.findElements(By.xpath(builder .toString())); for (WebElement opt : options) { if (opt.isSelected()) { return true; } } return false; }
java
public boolean isValueSelectedInDropDown(final By by, final String value) { WebElement element = driver.findElement(by); StringBuilder builder = new StringBuilder(".//option[@value = "); builder.append(escapeQuotes(value)); builder.append("]"); List<WebElement> options = element.findElements(By.xpath(builder .toString())); for (WebElement opt : options) { if (opt.isSelected()) { return true; } } return false; }
[ "public", "boolean", "isValueSelectedInDropDown", "(", "final", "By", "by", ",", "final", "String", "value", ")", "{", "WebElement", "element", "=", "driver", ".", "findElement", "(", "by", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "\".//option[@value = \"", ")", ";", "builder", ".", "append", "(", "escapeQuotes", "(", "value", ")", ")", ";", "builder", ".", "append", "(", "\"]\"", ")", ";", "List", "<", "WebElement", ">", "options", "=", "element", ".", "findElements", "(", "By", ".", "xpath", "(", "builder", ".", "toString", "(", ")", ")", ")", ";", "for", "(", "WebElement", "opt", ":", "options", ")", "{", "if", "(", "opt", ".", "isSelected", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks if a value is selected in a drop down list. @param by the method of identifying the element @param value the value to search for @return true if the value is selected or false otherwise
[ "Checks", "if", "a", "value", "is", "selected", "in", "a", "drop", "down", "list", "." ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L677-L693
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java
JobSchedulesImpl.listNextWithServiceResponseAsync
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { """ Lists all of the job schedules in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobScheduleListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CloudJobSchedule&gt; object """ return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions)); } }); }
java
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listNextWithServiceResponseAsync(final String nextPageLink, final JobScheduleListNextOptions jobScheduleListNextOptions) { return listNextSinglePageAsync(nextPageLink, jobScheduleListNextOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions)); } }); }
[ "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", ">", "listNextWithServiceResponseAsync", "(", "final", "String", "nextPageLink", ",", "final", "JobScheduleListNextOptions", "jobScheduleListNextOptions", ")", "{", "return", "listNextSinglePageAsync", "(", "nextPageLink", ",", "jobScheduleListNextOptions", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJobSchedule", ">", ",", "JobScheduleListHeaders", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listNextWithServiceResponseAsync", "(", "nextPageLink", ",", "jobScheduleListNextOptions", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists all of the job schedules in the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobScheduleListNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CloudJobSchedule&gt; object
[ "Lists", "all", "of", "the", "job", "schedules", "in", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L2639-L2651
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java
MapExtensions.operator_remove
@Inline(value = "$1.remove($2)", statementExpression = true) public static <K, V> V operator_remove(Map<K, V> map, K key) { """ Remove a key from the given map. @param <K> type of the map keys. @param <V> type of the map values. @param map the map to update. @param key the key to remove. @return the removed value, or <code>null</code> if the key was not present in the map. @since 2.15 """ return map.remove(key); }
java
@Inline(value = "$1.remove($2)", statementExpression = true) public static <K, V> V operator_remove(Map<K, V> map, K key) { return map.remove(key); }
[ "@", "Inline", "(", "value", "=", "\"$1.remove($2)\"", ",", "statementExpression", "=", "true", ")", "public", "static", "<", "K", ",", "V", ">", "V", "operator_remove", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "K", "key", ")", "{", "return", "map", ".", "remove", "(", "key", ")", ";", "}" ]
Remove a key from the given map. @param <K> type of the map keys. @param <V> type of the map values. @param map the map to update. @param key the key to remove. @return the removed value, or <code>null</code> if the key was not present in the map. @since 2.15
[ "Remove", "a", "key", "from", "the", "given", "map", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L206-L209
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.mix
public static Expression mix(Generator generator, FunctionCall input) { """ Calculates the weighted arithmetic mean of two colors. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation """ Color color1 = input.getExpectedColorParam(0); Color color2 = input.getExpectedColorParam(1); float weight = input.getParameters().size() > 2 ? input.getExpectedFloatParam(2) : 0.5f; return new Color((int) Math.round(color1.getR() * weight + color2.getR() * (1.0 - weight)), (int) Math.round(color1.getG() * weight + color2.getG() * (1.0 - weight)), (int) Math.round(color1.getB() * weight + color2.getB() * (1.0 - weight)), (float) (color1.getA() * weight + color2.getA() * (1.0 - weight))); }
java
public static Expression mix(Generator generator, FunctionCall input) { Color color1 = input.getExpectedColorParam(0); Color color2 = input.getExpectedColorParam(1); float weight = input.getParameters().size() > 2 ? input.getExpectedFloatParam(2) : 0.5f; return new Color((int) Math.round(color1.getR() * weight + color2.getR() * (1.0 - weight)), (int) Math.round(color1.getG() * weight + color2.getG() * (1.0 - weight)), (int) Math.round(color1.getB() * weight + color2.getB() * (1.0 - weight)), (float) (color1.getA() * weight + color2.getA() * (1.0 - weight))); }
[ "public", "static", "Expression", "mix", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "Color", "color1", "=", "input", ".", "getExpectedColorParam", "(", "0", ")", ";", "Color", "color2", "=", "input", ".", "getExpectedColorParam", "(", "1", ")", ";", "float", "weight", "=", "input", ".", "getParameters", "(", ")", ".", "size", "(", ")", ">", "2", "?", "input", ".", "getExpectedFloatParam", "(", "2", ")", ":", "0.5f", ";", "return", "new", "Color", "(", "(", "int", ")", "Math", ".", "round", "(", "color1", ".", "getR", "(", ")", "*", "weight", "+", "color2", ".", "getR", "(", ")", "*", "(", "1.0", "-", "weight", ")", ")", ",", "(", "int", ")", "Math", ".", "round", "(", "color1", ".", "getG", "(", ")", "*", "weight", "+", "color2", ".", "getG", "(", ")", "*", "(", "1.0", "-", "weight", ")", ")", ",", "(", "int", ")", "Math", ".", "round", "(", "color1", ".", "getB", "(", ")", "*", "weight", "+", "color2", ".", "getB", "(", ")", "*", "(", "1.0", "-", "weight", ")", ")", ",", "(", "float", ")", "(", "color1", ".", "getA", "(", ")", "*", "weight", "+", "color2", ".", "getA", "(", ")", "*", "(", "1.0", "-", "weight", ")", ")", ")", ";", "}" ]
Calculates the weighted arithmetic mean of two colors. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Calculates", "the", "weighted", "arithmetic", "mean", "of", "two", "colors", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L219-L227
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java
EJSHome.createLocalBusinessObject
public Object createLocalBusinessObject(String interfaceName, boolean useSupporting) throws RemoteException, CreateException, ClassNotFoundException, EJBConfigurationException { """ Returns an Object (wrapper) representing the specified EJB 3.0 Business Local Interface, managed by this home. <p> This method provides a Business Object (wrapper) factory capability, for use during business interface injection or lookup. It is called directly for Stateless Session beans, or through the basic wrapper for Stateful Session beans. <p> For Stateless Session beans, a 'singleton' (per home) wrapper instance is returned, since all Stateless Session beans are interchangeable. Since no customer code is invoked, no pre or postInvoke calls are required. <p> For Stateful Session beans, a new instance of a Stateful Session bean is created, and the corresponding new wrapper instance is returned. Since a new instance will be constructed, this method must be wrapped with pre and postInvoke calls. <p> @param interfaceName One of the local business interfaces for this session bean @param useSupporting whether or not to try to match the passed in interface to a known sublcass (ejb-link / beanName situation) @return The business object (wrapper) corresponding to the given business interface. @throws RemoteException @throws CreateException @throws ClassNotFoundException @throws EJBConfigurationException """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "createLocalBusinessObject: " + interfaceName); // d367572.7 int interfaceIndex; if (useSupporting) { interfaceIndex = beanMetaData.getSupportingLocalBusinessInterfaceIndex(interfaceName); } else { interfaceIndex = beanMetaData.getRequiredLocalBusinessInterfaceIndex(interfaceName); } Object result = createLocalBusinessObject(interfaceIndex, null); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createLocalBusinessObject returning: " + Util.identity(result)); // d367572.7 return result; }
java
public Object createLocalBusinessObject(String interfaceName, boolean useSupporting) throws RemoteException, CreateException, ClassNotFoundException, EJBConfigurationException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "createLocalBusinessObject: " + interfaceName); // d367572.7 int interfaceIndex; if (useSupporting) { interfaceIndex = beanMetaData.getSupportingLocalBusinessInterfaceIndex(interfaceName); } else { interfaceIndex = beanMetaData.getRequiredLocalBusinessInterfaceIndex(interfaceName); } Object result = createLocalBusinessObject(interfaceIndex, null); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createLocalBusinessObject returning: " + Util.identity(result)); // d367572.7 return result; }
[ "public", "Object", "createLocalBusinessObject", "(", "String", "interfaceName", ",", "boolean", "useSupporting", ")", "throws", "RemoteException", ",", "CreateException", ",", "ClassNotFoundException", ",", "EJBConfigurationException", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"createLocalBusinessObject: \"", "+", "interfaceName", ")", ";", "// d367572.7", "int", "interfaceIndex", ";", "if", "(", "useSupporting", ")", "{", "interfaceIndex", "=", "beanMetaData", ".", "getSupportingLocalBusinessInterfaceIndex", "(", "interfaceName", ")", ";", "}", "else", "{", "interfaceIndex", "=", "beanMetaData", ".", "getRequiredLocalBusinessInterfaceIndex", "(", "interfaceName", ")", ";", "}", "Object", "result", "=", "createLocalBusinessObject", "(", "interfaceIndex", ",", "null", ")", ";", "if", "(", "isTraceOn", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"createLocalBusinessObject returning: \"", "+", "Util", ".", "identity", "(", "result", ")", ")", ";", "// d367572.7", "return", "result", ";", "}" ]
Returns an Object (wrapper) representing the specified EJB 3.0 Business Local Interface, managed by this home. <p> This method provides a Business Object (wrapper) factory capability, for use during business interface injection or lookup. It is called directly for Stateless Session beans, or through the basic wrapper for Stateful Session beans. <p> For Stateless Session beans, a 'singleton' (per home) wrapper instance is returned, since all Stateless Session beans are interchangeable. Since no customer code is invoked, no pre or postInvoke calls are required. <p> For Stateful Session beans, a new instance of a Stateful Session bean is created, and the corresponding new wrapper instance is returned. Since a new instance will be constructed, this method must be wrapped with pre and postInvoke calls. <p> @param interfaceName One of the local business interfaces for this session bean @param useSupporting whether or not to try to match the passed in interface to a known sublcass (ejb-link / beanName situation) @return The business object (wrapper) corresponding to the given business interface. @throws RemoteException @throws CreateException @throws ClassNotFoundException @throws EJBConfigurationException
[ "Returns", "an", "Object", "(", "wrapper", ")", "representing", "the", "specified", "EJB", "3", ".", "0", "Business", "Local", "Interface", "managed", "by", "this", "home", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L1524-L1551
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F4.applyOrElse
public R applyOrElse(P1 p1, P2 p2, P3 p3, P4 p4, F4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> fallback ) { """ Applies this partial function to the given argument when it is contained in the function domain. Applies fallback function where this partial function is not defined. @param p1 the first argument @param p2 the second argument @param p3 the third argument @param p4 the fourth argument @param fallback the failover function to be called if application of this function failed with any runtime exception @return a composite function that apply to this function first and if failed apply to the callback function """ try { return apply(p1, p2, p3, p4); } catch (RuntimeException e) { return fallback.apply(p1, p2, p3, p4); } }
java
public R applyOrElse(P1 p1, P2 p2, P3 p3, P4 p4, F4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> fallback ) { try { return apply(p1, p2, p3, p4); } catch (RuntimeException e) { return fallback.apply(p1, p2, p3, p4); } }
[ "public", "R", "applyOrElse", "(", "P1", "p1", ",", "P2", "p2", ",", "P3", "p3", ",", "P4", "p4", ",", "F4", "<", "?", "super", "P1", ",", "?", "super", "P2", ",", "?", "super", "P3", ",", "?", "super", "P4", ",", "?", "extends", "R", ">", "fallback", ")", "{", "try", "{", "return", "apply", "(", "p1", ",", "p2", ",", "p3", ",", "p4", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "return", "fallback", ".", "apply", "(", "p1", ",", "p2", ",", "p3", ",", "p4", ")", ";", "}", "}" ]
Applies this partial function to the given argument when it is contained in the function domain. Applies fallback function where this partial function is not defined. @param p1 the first argument @param p2 the second argument @param p3 the third argument @param p4 the fourth argument @param fallback the failover function to be called if application of this function failed with any runtime exception @return a composite function that apply to this function first and if failed apply to the callback function
[ "Applies", "this", "partial", "function", "to", "the", "given", "argument", "when", "it", "is", "contained", "in", "the", "function", "domain", ".", "Applies", "fallback", "function", "where", "this", "partial", "function", "is", "not", "defined", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1485-L1493
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/parsetree/Expression.java
Expression.setInitialType
public void setInitialType(Type type) { """ Sets the intial type in the conversion chain, but does not clear the conversions. """ Type initial = getInitialType(); Type actual = Type.preserveType(initial, type); if (actual != null && !actual.equals(initial)) { if (initial == null) { setType(actual); } else { Iterator<Conversion> it = mConversions.iterator(); mConversions = new LinkedList<Conversion>(); // Prefer cast for initial type for correct operation of // setInitialType if a conversion needs to be inserted at the // beginning. mConversions.add(new Conversion(null, actual, true)); while (it.hasNext()) { Conversion conv = (Conversion)it.next(); convertTo(conv.getToType(), conv.isCastPreferred()); } } } }
java
public void setInitialType(Type type) { Type initial = getInitialType(); Type actual = Type.preserveType(initial, type); if (actual != null && !actual.equals(initial)) { if (initial == null) { setType(actual); } else { Iterator<Conversion> it = mConversions.iterator(); mConversions = new LinkedList<Conversion>(); // Prefer cast for initial type for correct operation of // setInitialType if a conversion needs to be inserted at the // beginning. mConversions.add(new Conversion(null, actual, true)); while (it.hasNext()) { Conversion conv = (Conversion)it.next(); convertTo(conv.getToType(), conv.isCastPreferred()); } } } }
[ "public", "void", "setInitialType", "(", "Type", "type", ")", "{", "Type", "initial", "=", "getInitialType", "(", ")", ";", "Type", "actual", "=", "Type", ".", "preserveType", "(", "initial", ",", "type", ")", ";", "if", "(", "actual", "!=", "null", "&&", "!", "actual", ".", "equals", "(", "initial", ")", ")", "{", "if", "(", "initial", "==", "null", ")", "{", "setType", "(", "actual", ")", ";", "}", "else", "{", "Iterator", "<", "Conversion", ">", "it", "=", "mConversions", ".", "iterator", "(", ")", ";", "mConversions", "=", "new", "LinkedList", "<", "Conversion", ">", "(", ")", ";", "// Prefer cast for initial type for correct operation of", "// setInitialType if a conversion needs to be inserted at the", "// beginning.", "mConversions", ".", "add", "(", "new", "Conversion", "(", "null", ",", "actual", ",", "true", ")", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Conversion", "conv", "=", "(", "Conversion", ")", "it", ".", "next", "(", ")", ";", "convertTo", "(", "conv", ".", "getToType", "(", ")", ",", "conv", ".", "isCastPreferred", "(", ")", ")", ";", "}", "}", "}", "}" ]
Sets the intial type in the conversion chain, but does not clear the conversions.
[ "Sets", "the", "intial", "type", "in", "the", "conversion", "chain", "but", "does", "not", "clear", "the", "conversions", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/parsetree/Expression.java#L331-L351
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscape.java
JavaEscape.unescapeJava
public static void unescapeJava(final char[] text, final int offset, final int len, final Writer writer) throws IOException { """ <p> Perform a Java <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java unescape of SECs, u-based and octal escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } JavaEscapeUtil.unescape(text, offset, len, writer); }
java
public static void unescapeJava(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } JavaEscapeUtil.unescape(text, offset, len, writer); }
[ "public", "static", "void", "unescapeJava", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "final", "int", "textLen", "=", "(", "text", "==", "null", "?", "0", ":", "text", ".", "length", ")", ";", "if", "(", "offset", "<", "0", "||", "offset", ">", "textLen", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid (offset, len). offset=\"", "+", "offset", "+", "\", len=\"", "+", "len", "+", "\", text.length=\"", "+", "textLen", ")", ";", "}", "if", "(", "len", "<", "0", "||", "(", "offset", "+", "len", ")", ">", "textLen", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid (offset, len). offset=\"", "+", "offset", "+", "\", len=\"", "+", "len", "+", "\", text.length=\"", "+", "textLen", ")", ";", "}", "JavaEscapeUtil", ".", "unescape", "(", "text", ",", "offset", ",", "len", ",", "writer", ")", ";", "}" ]
<p> Perform a Java <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java unescape of SECs, u-based and octal escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "Java", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", "are", "required", ".", "Unescape", "operations", "will", "always", "perform", "<em", ">", "complete<", "/", "em", ">", "Java", "unescape", "of", "SECs", "u", "-", "based", "and", "octal", "escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L949-L970
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/grpc/UfsFallbackBlockWriteHandler.java
UfsFallbackBlockWriteHandler.transferToUfsBlock
private void transferToUfsBlock(BlockWriteRequestContext context, long pos) throws Exception { """ Transfers data from block store to UFS. @param context context of this request @param pos number of bytes in block store to write in the UFS block """ OutputStream ufsOutputStream = context.getOutputStream(); long sessionId = context.getRequest().getSessionId(); long blockId = context.getRequest().getId(); TempBlockMeta block = mWorker.getBlockStore().getTempBlockMeta(sessionId, blockId); if (block == null) { throw new NotFoundException("block " + blockId + " not found"); } Preconditions.checkState(Files.copy(Paths.get(block.getPath()), ufsOutputStream) == pos); }
java
private void transferToUfsBlock(BlockWriteRequestContext context, long pos) throws Exception { OutputStream ufsOutputStream = context.getOutputStream(); long sessionId = context.getRequest().getSessionId(); long blockId = context.getRequest().getId(); TempBlockMeta block = mWorker.getBlockStore().getTempBlockMeta(sessionId, blockId); if (block == null) { throw new NotFoundException("block " + blockId + " not found"); } Preconditions.checkState(Files.copy(Paths.get(block.getPath()), ufsOutputStream) == pos); }
[ "private", "void", "transferToUfsBlock", "(", "BlockWriteRequestContext", "context", ",", "long", "pos", ")", "throws", "Exception", "{", "OutputStream", "ufsOutputStream", "=", "context", ".", "getOutputStream", "(", ")", ";", "long", "sessionId", "=", "context", ".", "getRequest", "(", ")", ".", "getSessionId", "(", ")", ";", "long", "blockId", "=", "context", ".", "getRequest", "(", ")", ".", "getId", "(", ")", ";", "TempBlockMeta", "block", "=", "mWorker", ".", "getBlockStore", "(", ")", ".", "getTempBlockMeta", "(", "sessionId", ",", "blockId", ")", ";", "if", "(", "block", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"block \"", "+", "blockId", "+", "\" not found\"", ")", ";", "}", "Preconditions", ".", "checkState", "(", "Files", ".", "copy", "(", "Paths", ".", "get", "(", "block", ".", "getPath", "(", ")", ")", ",", "ufsOutputStream", ")", "==", "pos", ")", ";", "}" ]
Transfers data from block store to UFS. @param context context of this request @param pos number of bytes in block store to write in the UFS block
[ "Transfers", "data", "from", "block", "store", "to", "UFS", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/grpc/UfsFallbackBlockWriteHandler.java#L242-L252
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.registerCachedFile
public void registerCachedFile(String filePath, String name, boolean executable) { """ Registers a file at the distributed cache under the given name. The file will be accessible from any user-defined function in the (distributed) runtime under a local path. Files may be local files (which will be distributed via BlobServer), or files in a distributed file system. The runtime will copy the files temporarily to a local cache, if needed. <p>The {@link org.apache.flink.api.common.functions.RuntimeContext} can be obtained inside UDFs via {@link org.apache.flink.api.common.functions.RichFunction#getRuntimeContext()} and provides access {@link org.apache.flink.api.common.cache.DistributedCache} via {@link org.apache.flink.api.common.functions.RuntimeContext#getDistributedCache()}. @param filePath The path of the file, as a URI (e.g. "file:///some/path" or "hdfs://host:port/and/path") @param name The name under which the file is registered. @param executable flag indicating whether the file should be executable """ this.cacheFile.add(new Tuple2<>(name, new DistributedCacheEntry(filePath, executable))); }
java
public void registerCachedFile(String filePath, String name, boolean executable){ this.cacheFile.add(new Tuple2<>(name, new DistributedCacheEntry(filePath, executable))); }
[ "public", "void", "registerCachedFile", "(", "String", "filePath", ",", "String", "name", ",", "boolean", "executable", ")", "{", "this", ".", "cacheFile", ".", "add", "(", "new", "Tuple2", "<>", "(", "name", ",", "new", "DistributedCacheEntry", "(", "filePath", ",", "executable", ")", ")", ")", ";", "}" ]
Registers a file at the distributed cache under the given name. The file will be accessible from any user-defined function in the (distributed) runtime under a local path. Files may be local files (which will be distributed via BlobServer), or files in a distributed file system. The runtime will copy the files temporarily to a local cache, if needed. <p>The {@link org.apache.flink.api.common.functions.RuntimeContext} can be obtained inside UDFs via {@link org.apache.flink.api.common.functions.RichFunction#getRuntimeContext()} and provides access {@link org.apache.flink.api.common.cache.DistributedCache} via {@link org.apache.flink.api.common.functions.RuntimeContext#getDistributedCache()}. @param filePath The path of the file, as a URI (e.g. "file:///some/path" or "hdfs://host:port/and/path") @param name The name under which the file is registered. @param executable flag indicating whether the file should be executable
[ "Registers", "a", "file", "at", "the", "distributed", "cache", "under", "the", "given", "name", ".", "The", "file", "will", "be", "accessible", "from", "any", "user", "-", "defined", "function", "in", "the", "(", "distributed", ")", "runtime", "under", "a", "local", "path", ".", "Files", "may", "be", "local", "files", "(", "which", "will", "be", "distributed", "via", "BlobServer", ")", "or", "files", "in", "a", "distributed", "file", "system", ".", "The", "runtime", "will", "copy", "the", "files", "temporarily", "to", "a", "local", "cache", "if", "needed", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L878-L880
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java
HttpUtils.executeGet
public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters, final Map<String, Object> headers) { """ Execute get http response. @param url the url @param basicAuthUsername the basic auth username @param basicAuthPassword the basic auth password @param parameters the parameters @param headers the headers @return the http response """ try { return execute(url, HttpMethod.GET.name(), basicAuthUsername, basicAuthPassword, parameters, headers); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
java
public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters, final Map<String, Object> headers) { try { return execute(url, HttpMethod.GET.name(), basicAuthUsername, basicAuthPassword, parameters, headers); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
[ "public", "static", "HttpResponse", "executeGet", "(", "final", "String", "url", ",", "final", "String", "basicAuthUsername", ",", "final", "String", "basicAuthPassword", ",", "final", "Map", "<", "String", ",", "Object", ">", "parameters", ",", "final", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "try", "{", "return", "execute", "(", "url", ",", "HttpMethod", ".", "GET", ".", "name", "(", ")", ",", "basicAuthUsername", ",", "basicAuthPassword", ",", "parameters", ",", "headers", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Execute get http response. @param url the url @param basicAuthUsername the basic auth username @param basicAuthPassword the basic auth password @param parameters the parameters @param headers the headers @return the http response
[ "Execute", "get", "http", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java#L217-L228
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginGetLearnedRoutes
public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) { """ This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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 GatewayRouteListResultInner object if successful. """ return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
java
public GatewayRouteListResultInner beginGetLearnedRoutes(String resourceGroupName, String virtualNetworkGatewayName) { return beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().single().body(); }
[ "public", "GatewayRouteListResultInner", "beginGetLearnedRoutes", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "beginGetLearnedRoutesWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @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 GatewayRouteListResultInner object if successful.
[ "This", "operation", "retrieves", "a", "list", "of", "routes", "the", "virtual", "network", "gateway", "has", "learned", "including", "routes", "learned", "from", "BGP", "peers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2407-L2409
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/OrientModule.java
OrientModule.bindPool
protected final <T, P extends PoolManager<T>> void bindPool(final Class<T> type, final Class<P> pool) { """ Register pool within pools set and register provider for specified type. Use to register custom pools in {@link #configurePools()}. @param type connection object type @param pool pool type @param <T> connection object type @param <P> pool type """ bind(pool).in(Singleton.class); poolsMultibinder.addBinding().to(pool); bind(type).toProvider(pool); }
java
protected final <T, P extends PoolManager<T>> void bindPool(final Class<T> type, final Class<P> pool) { bind(pool).in(Singleton.class); poolsMultibinder.addBinding().to(pool); bind(type).toProvider(pool); }
[ "protected", "final", "<", "T", ",", "P", "extends", "PoolManager", "<", "T", ">", ">", "void", "bindPool", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Class", "<", "P", ">", "pool", ")", "{", "bind", "(", "pool", ")", ".", "in", "(", "Singleton", ".", "class", ")", ";", "poolsMultibinder", ".", "addBinding", "(", ")", ".", "to", "(", "pool", ")", ";", "bind", "(", "type", ")", ".", "toProvider", "(", "pool", ")", ";", "}" ]
Register pool within pools set and register provider for specified type. Use to register custom pools in {@link #configurePools()}. @param type connection object type @param pool pool type @param <T> connection object type @param <P> pool type
[ "Register", "pool", "within", "pools", "set", "and", "register", "provider", "for", "specified", "type", ".", "Use", "to", "register", "custom", "pools", "in", "{", "@link", "#configurePools", "()", "}", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/OrientModule.java#L344-L348
google/closure-compiler
src/com/google/javascript/jscomp/ExpressionDecomposer.java
ExpressionDecomposer.isSafeAssign
private boolean isSafeAssign(Node n, boolean seenSideEffects) { """ It is always safe to inline "foo()" for expressions such as "a = b = c = foo();" As the assignment is unaffected by side effect of "foo()" and the names assigned-to can not influence the state before the call to foo. <p>It is also safe in cases where the object is constant: <pre> CONST_NAME.a = foo() CONST_NAME[CONST_VALUE] = foo(); </pre> <p>This is not true of more complex LHS values, such as <pre> a.x = foo(); next().x = foo(); </pre> in these cases the checks below are necessary. @param seenSideEffects If true, check to see if node-tree maybe affected by side-effects, otherwise if the tree has side-effects. @see isExpressionTreeUnsafe @return Whether the assignment is safe from side-effects. """ if (n.isAssign()) { Node lhs = n.getFirstChild(); switch (lhs.getToken()) { case NAME: return true; case GETPROP: return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects); case GETELEM: return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects) && !isExpressionTreeUnsafe(lhs.getLastChild(), seenSideEffects); default: break; } } return false; }
java
private boolean isSafeAssign(Node n, boolean seenSideEffects) { if (n.isAssign()) { Node lhs = n.getFirstChild(); switch (lhs.getToken()) { case NAME: return true; case GETPROP: return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects); case GETELEM: return !isExpressionTreeUnsafe(lhs.getFirstChild(), seenSideEffects) && !isExpressionTreeUnsafe(lhs.getLastChild(), seenSideEffects); default: break; } } return false; }
[ "private", "boolean", "isSafeAssign", "(", "Node", "n", ",", "boolean", "seenSideEffects", ")", "{", "if", "(", "n", ".", "isAssign", "(", ")", ")", "{", "Node", "lhs", "=", "n", ".", "getFirstChild", "(", ")", ";", "switch", "(", "lhs", ".", "getToken", "(", ")", ")", "{", "case", "NAME", ":", "return", "true", ";", "case", "GETPROP", ":", "return", "!", "isExpressionTreeUnsafe", "(", "lhs", ".", "getFirstChild", "(", ")", ",", "seenSideEffects", ")", ";", "case", "GETELEM", ":", "return", "!", "isExpressionTreeUnsafe", "(", "lhs", ".", "getFirstChild", "(", ")", ",", "seenSideEffects", ")", "&&", "!", "isExpressionTreeUnsafe", "(", "lhs", ".", "getLastChild", "(", ")", ",", "seenSideEffects", ")", ";", "default", ":", "break", ";", "}", "}", "return", "false", ";", "}" ]
It is always safe to inline "foo()" for expressions such as "a = b = c = foo();" As the assignment is unaffected by side effect of "foo()" and the names assigned-to can not influence the state before the call to foo. <p>It is also safe in cases where the object is constant: <pre> CONST_NAME.a = foo() CONST_NAME[CONST_VALUE] = foo(); </pre> <p>This is not true of more complex LHS values, such as <pre> a.x = foo(); next().x = foo(); </pre> in these cases the checks below are necessary. @param seenSideEffects If true, check to see if node-tree maybe affected by side-effects, otherwise if the tree has side-effects. @see isExpressionTreeUnsafe @return Whether the assignment is safe from side-effects.
[ "It", "is", "always", "safe", "to", "inline", "foo", "()", "for", "expressions", "such", "as", "a", "=", "b", "=", "c", "=", "foo", "()", ";", "As", "the", "assignment", "is", "unaffected", "by", "side", "effect", "of", "foo", "()", "and", "the", "names", "assigned", "-", "to", "can", "not", "influence", "the", "state", "before", "the", "call", "to", "foo", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExpressionDecomposer.java#L1021-L1037
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.linguisticProcessorExists
public boolean linguisticProcessorExists(String layer, String name, String version) { """ Returns wether the given linguistic processor is already defined or not. Both name and version must be exactly the same. """ List<LinguisticProcessor> layerLPs = lps.get(layer); if (layerLPs == null) { return false; } for (LinguisticProcessor lp : layerLPs) { if (lp.version == null) { return false; } else if (lp.name.equals(name) && lp.version.equals(version)) { return true; } } return false; }
java
public boolean linguisticProcessorExists(String layer, String name, String version) { List<LinguisticProcessor> layerLPs = lps.get(layer); if (layerLPs == null) { return false; } for (LinguisticProcessor lp : layerLPs) { if (lp.version == null) { return false; } else if (lp.name.equals(name) && lp.version.equals(version)) { return true; } } return false; }
[ "public", "boolean", "linguisticProcessorExists", "(", "String", "layer", ",", "String", "name", ",", "String", "version", ")", "{", "List", "<", "LinguisticProcessor", ">", "layerLPs", "=", "lps", ".", "get", "(", "layer", ")", ";", "if", "(", "layerLPs", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "LinguisticProcessor", "lp", ":", "layerLPs", ")", "{", "if", "(", "lp", ".", "version", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "lp", ".", "name", ".", "equals", "(", "name", ")", "&&", "lp", ".", "version", ".", "equals", "(", "version", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns wether the given linguistic processor is already defined or not. Both name and version must be exactly the same.
[ "Returns", "wether", "the", "given", "linguistic", "processor", "is", "already", "defined", "or", "not", ".", "Both", "name", "and", "version", "must", "be", "exactly", "the", "same", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L479-L493
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_exchangeLite_services_domain_GET
public OvhExchangeLiteService packName_exchangeLite_services_domain_GET(String packName, String domain) throws IOException { """ Get this object properties REST: GET /pack/xdsl/{packName}/exchangeLite/services/{domain} @param packName [required] The internal name of your pack @param domain [required] """ String qPath = "/pack/xdsl/{packName}/exchangeLite/services/{domain}"; StringBuilder sb = path(qPath, packName, domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeLiteService.class); }
java
public OvhExchangeLiteService packName_exchangeLite_services_domain_GET(String packName, String domain) throws IOException { String qPath = "/pack/xdsl/{packName}/exchangeLite/services/{domain}"; StringBuilder sb = path(qPath, packName, domain); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeLiteService.class); }
[ "public", "OvhExchangeLiteService", "packName_exchangeLite_services_domain_GET", "(", "String", "packName", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/exchangeLite/services/{domain}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ",", "domain", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhExchangeLiteService", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /pack/xdsl/{packName}/exchangeLite/services/{domain} @param packName [required] The internal name of your pack @param domain [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L619-L624
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion2.java
CmsImportVersion2.setDirectories
public static String setDirectories(String content, String[] rules) { """ Translates directory Strings from OpenCms 4.x structure to new 5.0 structure.<p> @param content the filecontent @param rules the translation rules @return String the manipulated file content """ // get translation rules for (int i = 0; i < rules.length; i++) { String actRule = rules[i]; // cut String "/default/vfs/" from rule actRule = CmsStringUtil.substitute(actRule, "/default/vfs", ""); // divide rule into search and replace parts and delete regular expressions StringTokenizer ruleT = new StringTokenizer(actRule, "#"); ruleT.nextToken(); String search = ruleT.nextToken(); int pos = search.lastIndexOf("(.*)"); if (pos >= 0) { search = search.substring(0, pos); } String replace = ruleT.nextToken(); if (pos >= 0) { replace = replace.substring(0, replace.lastIndexOf("$1")); } // scan content for paths if the replace String is not present if ((content.indexOf(replace) == -1) && (content.indexOf(search) != -1)) { // ensure subdirectories of the same name are not replaced search = "([}>\"'\\[]\\s*)" + search; replace = "$1" + replace; content = CmsStringUtil.substitutePerl(content, search, replace, "g"); } } return content; }
java
public static String setDirectories(String content, String[] rules) { // get translation rules for (int i = 0; i < rules.length; i++) { String actRule = rules[i]; // cut String "/default/vfs/" from rule actRule = CmsStringUtil.substitute(actRule, "/default/vfs", ""); // divide rule into search and replace parts and delete regular expressions StringTokenizer ruleT = new StringTokenizer(actRule, "#"); ruleT.nextToken(); String search = ruleT.nextToken(); int pos = search.lastIndexOf("(.*)"); if (pos >= 0) { search = search.substring(0, pos); } String replace = ruleT.nextToken(); if (pos >= 0) { replace = replace.substring(0, replace.lastIndexOf("$1")); } // scan content for paths if the replace String is not present if ((content.indexOf(replace) == -1) && (content.indexOf(search) != -1)) { // ensure subdirectories of the same name are not replaced search = "([}>\"'\\[]\\s*)" + search; replace = "$1" + replace; content = CmsStringUtil.substitutePerl(content, search, replace, "g"); } } return content; }
[ "public", "static", "String", "setDirectories", "(", "String", "content", ",", "String", "[", "]", "rules", ")", "{", "// get translation rules", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ";", "i", "++", ")", "{", "String", "actRule", "=", "rules", "[", "i", "]", ";", "// cut String \"/default/vfs/\" from rule", "actRule", "=", "CmsStringUtil", ".", "substitute", "(", "actRule", ",", "\"/default/vfs\"", ",", "\"\"", ")", ";", "// divide rule into search and replace parts and delete regular expressions", "StringTokenizer", "ruleT", "=", "new", "StringTokenizer", "(", "actRule", ",", "\"#\"", ")", ";", "ruleT", ".", "nextToken", "(", ")", ";", "String", "search", "=", "ruleT", ".", "nextToken", "(", ")", ";", "int", "pos", "=", "search", ".", "lastIndexOf", "(", "\"(.*)\"", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "search", "=", "search", ".", "substring", "(", "0", ",", "pos", ")", ";", "}", "String", "replace", "=", "ruleT", ".", "nextToken", "(", ")", ";", "if", "(", "pos", ">=", "0", ")", "{", "replace", "=", "replace", ".", "substring", "(", "0", ",", "replace", ".", "lastIndexOf", "(", "\"$1\"", ")", ")", ";", "}", "// scan content for paths if the replace String is not present", "if", "(", "(", "content", ".", "indexOf", "(", "replace", ")", "==", "-", "1", ")", "&&", "(", "content", ".", "indexOf", "(", "search", ")", "!=", "-", "1", ")", ")", "{", "// ensure subdirectories of the same name are not replaced", "search", "=", "\"([}>\\\"'\\\\[]\\\\s*)\"", "+", "search", ";", "replace", "=", "\"$1\"", "+", "replace", ";", "content", "=", "CmsStringUtil", ".", "substitutePerl", "(", "content", ",", "search", ",", "replace", ",", "\"g\"", ")", ";", "}", "}", "return", "content", ";", "}" ]
Translates directory Strings from OpenCms 4.x structure to new 5.0 structure.<p> @param content the filecontent @param rules the translation rules @return String the manipulated file content
[ "Translates", "directory", "Strings", "from", "OpenCms", "4", ".", "x", "structure", "to", "new", "5", ".", "0", "structure", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion2.java#L121-L149
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java
IntervalFactory.getInstance
public Interval getInstance(Long position, Granularity gran) { """ Returns an interval representing a position on the timeline or other axis at a specified granularity. The interpretation of the <code>position</code> parameter depends on what implementation of {@link Granularity} is provided. For example, if the granularity implementation is {@link AbsoluteTimeGranularity}, the <code>position</code> is intepreted as a timestamp. @param position a { @ling Long} representing a single position on the timeline or other axis. If <code>null</code>, the interval will be unbounded. @param gran a {@link Granularity}. @return an {@link Interval}. """ List<Object> key = Arrays.asList(new Object[]{position, gran}); Interval result; synchronized (cache) { result = cache.get(key); if (result == null) { if (position == null) { result = new DefaultInterval(position, gran, position, gran); } else { result = new SimpleInterval(position, gran); } cache.put(key, result); } } return result; }
java
public Interval getInstance(Long position, Granularity gran) { List<Object> key = Arrays.asList(new Object[]{position, gran}); Interval result; synchronized (cache) { result = cache.get(key); if (result == null) { if (position == null) { result = new DefaultInterval(position, gran, position, gran); } else { result = new SimpleInterval(position, gran); } cache.put(key, result); } } return result; }
[ "public", "Interval", "getInstance", "(", "Long", "position", ",", "Granularity", "gran", ")", "{", "List", "<", "Object", ">", "key", "=", "Arrays", ".", "asList", "(", "new", "Object", "[", "]", "{", "position", ",", "gran", "}", ")", ";", "Interval", "result", ";", "synchronized", "(", "cache", ")", "{", "result", "=", "cache", ".", "get", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "if", "(", "position", "==", "null", ")", "{", "result", "=", "new", "DefaultInterval", "(", "position", ",", "gran", ",", "position", ",", "gran", ")", ";", "}", "else", "{", "result", "=", "new", "SimpleInterval", "(", "position", ",", "gran", ")", ";", "}", "cache", ".", "put", "(", "key", ",", "result", ")", ";", "}", "}", "return", "result", ";", "}" ]
Returns an interval representing a position on the timeline or other axis at a specified granularity. The interpretation of the <code>position</code> parameter depends on what implementation of {@link Granularity} is provided. For example, if the granularity implementation is {@link AbsoluteTimeGranularity}, the <code>position</code> is intepreted as a timestamp. @param position a { @ling Long} representing a single position on the timeline or other axis. If <code>null</code>, the interval will be unbounded. @param gran a {@link Granularity}. @return an {@link Interval}.
[ "Returns", "an", "interval", "representing", "a", "position", "on", "the", "timeline", "or", "other", "axis", "at", "a", "specified", "granularity", ".", "The", "interpretation", "of", "the", "<code", ">", "position<", "/", "code", ">", "parameter", "depends", "on", "what", "implementation", "of", "{", "@link", "Granularity", "}", "is", "provided", ".", "For", "example", "if", "the", "granularity", "implementation", "is", "{", "@link", "AbsoluteTimeGranularity", "}", "the", "<code", ">", "position<", "/", "code", ">", "is", "intepreted", "as", "a", "timestamp", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java#L143-L158
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processPredecessor
private void processPredecessor(Task task, MapRow row) { """ Extract data for a single predecessor. @param task parent task @param row Synchro predecessor data """ Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
java
private void processPredecessor(Task task, MapRow row) { Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
[ "private", "void", "processPredecessor", "(", "Task", "task", ",", "MapRow", "row", ")", "{", "Task", "predecessor", "=", "m_taskMap", ".", "get", "(", "row", ".", "getUUID", "(", "\"PREDECESSOR_UUID\"", ")", ")", ";", "if", "(", "predecessor", "!=", "null", ")", "{", "task", ".", "addPredecessor", "(", "predecessor", ",", "row", ".", "getRelationType", "(", "\"RELATION_TYPE\"", ")", ",", "row", ".", "getDuration", "(", "\"LAG\"", ")", ")", ";", "}", "}" ]
Extract data for a single predecessor. @param task parent task @param row Synchro predecessor data
[ "Extract", "data", "for", "a", "single", "predecessor", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L396-L403
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/ServerDnsAliasesInner.java
ServerDnsAliasesInner.getAsync
public Observable<ServerDnsAliasInner> getAsync(String resourceGroupName, String serverName, String dnsAliasName) { """ Gets a server DNS alias. @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 that the alias is pointing to. @param dnsAliasName The name of the server DNS alias. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerDnsAliasInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
java
public Observable<ServerDnsAliasInner> getAsync(String resourceGroupName, String serverName, String dnsAliasName) { return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerDnsAliasInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "dnsAliasName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ServerDnsAliasInner", ">", ",", "ServerDnsAliasInner", ">", "(", ")", "{", "@", "Override", "public", "ServerDnsAliasInner", "call", "(", "ServiceResponse", "<", "ServerDnsAliasInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a server DNS alias. @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 that the alias is pointing to. @param dnsAliasName The name of the server DNS alias. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerDnsAliasInner object
[ "Gets", "a", "server", "DNS", "alias", "." ]
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/ServerDnsAliasesInner.java#L141-L148
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/ip/DiscoverHardcodedIPAddressRuleProvider.java
DiscoverHardcodedIPAddressRuleProvider.isMavenVersionTag
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model) { """ if this is a maven file, checks to see if "version" tags match the discovered text; if the discovered text does match something in a version tag, it is likely a version, not an IP address @param context @param model @return """ if (isMavenFile(context, model)) { Document doc = ((XmlFileModel) model.getFile()).asDocument(); for (Element elm : $(doc).find("version")) { String text = StringUtils.trim($(elm).text()); if (StringUtils.equals(text, model.getSourceSnippit())) { return true; } } } return false; }
java
private boolean isMavenVersionTag(GraphContext context, FileLocationModel model) { if (isMavenFile(context, model)) { Document doc = ((XmlFileModel) model.getFile()).asDocument(); for (Element elm : $(doc).find("version")) { String text = StringUtils.trim($(elm).text()); if (StringUtils.equals(text, model.getSourceSnippit())) { return true; } } } return false; }
[ "private", "boolean", "isMavenVersionTag", "(", "GraphContext", "context", ",", "FileLocationModel", "model", ")", "{", "if", "(", "isMavenFile", "(", "context", ",", "model", ")", ")", "{", "Document", "doc", "=", "(", "(", "XmlFileModel", ")", "model", ".", "getFile", "(", ")", ")", ".", "asDocument", "(", ")", ";", "for", "(", "Element", "elm", ":", "$", "(", "doc", ")", ".", "find", "(", "\"version\"", ")", ")", "{", "String", "text", "=", "StringUtils", ".", "trim", "(", "$", "(", "elm", ")", ".", "text", "(", ")", ")", ";", "if", "(", "StringUtils", ".", "equals", "(", "text", ",", "model", ".", "getSourceSnippit", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
if this is a maven file, checks to see if "version" tags match the discovered text; if the discovered text does match something in a version tag, it is likely a version, not an IP address @param context @param model @return
[ "if", "this", "is", "a", "maven", "file", "checks", "to", "see", "if", "version", "tags", "match", "the", "discovered", "text", ";", "if", "the", "discovered", "text", "does", "match", "something", "in", "a", "version", "tag", "it", "is", "likely", "a", "version", "not", "an", "IP", "address" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/ip/DiscoverHardcodedIPAddressRuleProvider.java#L177-L192
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.isTrue
public void isTrue(final boolean expression, final String message, final Object... values) { """ <p>Validate that the argument condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.</p> <pre> Validate.isTrue(i &gt;= min &amp;&amp; i &lt;= max, "The value must be between &#37;d and &#37;d", min, max); Validate.isTrue(myObject.isOk(), "The object is not okay"); </pre> @param expression the boolean expression to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @throws IllegalArgumentValidationException if expression is {@code false} @see #isTrue(boolean) @see #isTrue(boolean, String, long) @see #isTrue(boolean, String, double) """ if (!expression) { fail(String.format(message, values)); } }
java
public void isTrue(final boolean expression, final String message, final Object... values) { if (!expression) { fail(String.format(message, values)); } }
[ "public", "void", "isTrue", "(", "final", "boolean", "expression", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "!", "expression", ")", "{", "fail", "(", "String", ".", "format", "(", "message", ",", "values", ")", ")", ";", "}", "}" ]
<p>Validate that the argument condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.</p> <pre> Validate.isTrue(i &gt;= min &amp;&amp; i &lt;= max, "The value must be between &#37;d and &#37;d", min, max); Validate.isTrue(myObject.isOk(), "The object is not okay"); </pre> @param expression the boolean expression to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @throws IllegalArgumentValidationException if expression is {@code false} @see #isTrue(boolean) @see #isTrue(boolean, String, long) @see #isTrue(boolean, String, double)
[ "<p", ">", "Validate", "that", "the", "argument", "condition", "is", "{", "@code", "true", "}", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "This", "method", "is", "useful", "when", "validating", "according", "to", "an", "arbitrary", "boolean", "expression", "such", "as", "validating", "a", "primitive", "number", "or", "using", "your", "own", "custom", "validation", "expression", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", "isTrue", "(", "i", "&gt", ";", "=", "min", "&amp", ";", "&amp", ";", "i", "&lt", ";", "=", "max", "The", "value", "must", "be", "between", "&#37", ";", "d", "and", "&#37", ";", "d", "min", "max", ")", ";", "Validate", ".", "isTrue", "(", "myObject", ".", "isOk", "()", "The", "object", "is", "not", "okay", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L352-L356
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
AbstractQueuedSynchronizer.unparkSuccessor
private void unparkSuccessor(Node node) { """ Wakes up node's successor, if one exists. @param node the node """ /* * If status is negative (i.e., possibly needing signal) try * to clear in anticipation of signalling. It is OK if this * fails or if status is changed by waiting thread. */ int ws = node.waitStatus; if (ws < 0) node.compareAndSetWaitStatus(ws, 0); /* * Thread to unpark is held in successor, which is normally * just the next node. But if cancelled or apparently null, * traverse backwards from tail to find the actual * non-cancelled successor. */ Node s = node.next; if (s == null || s.waitStatus > 0) { s = null; for (Node p = tail; p != node && p != null; p = p.prev) if (p.waitStatus <= 0) s = p; } if (s != null) LockSupport.unpark(s.thread); }
java
private void unparkSuccessor(Node node) { /* * If status is negative (i.e., possibly needing signal) try * to clear in anticipation of signalling. It is OK if this * fails or if status is changed by waiting thread. */ int ws = node.waitStatus; if (ws < 0) node.compareAndSetWaitStatus(ws, 0); /* * Thread to unpark is held in successor, which is normally * just the next node. But if cancelled or apparently null, * traverse backwards from tail to find the actual * non-cancelled successor. */ Node s = node.next; if (s == null || s.waitStatus > 0) { s = null; for (Node p = tail; p != node && p != null; p = p.prev) if (p.waitStatus <= 0) s = p; } if (s != null) LockSupport.unpark(s.thread); }
[ "private", "void", "unparkSuccessor", "(", "Node", "node", ")", "{", "/*\n * If status is negative (i.e., possibly needing signal) try\n * to clear in anticipation of signalling. It is OK if this\n * fails or if status is changed by waiting thread.\n */", "int", "ws", "=", "node", ".", "waitStatus", ";", "if", "(", "ws", "<", "0", ")", "node", ".", "compareAndSetWaitStatus", "(", "ws", ",", "0", ")", ";", "/*\n * Thread to unpark is held in successor, which is normally\n * just the next node. But if cancelled or apparently null,\n * traverse backwards from tail to find the actual\n * non-cancelled successor.\n */", "Node", "s", "=", "node", ".", "next", ";", "if", "(", "s", "==", "null", "||", "s", ".", "waitStatus", ">", "0", ")", "{", "s", "=", "null", ";", "for", "(", "Node", "p", "=", "tail", ";", "p", "!=", "node", "&&", "p", "!=", "null", ";", "p", "=", "p", ".", "prev", ")", "if", "(", "p", ".", "waitStatus", "<=", "0", ")", "s", "=", "p", ";", "}", "if", "(", "s", "!=", "null", ")", "LockSupport", ".", "unpark", "(", "s", ".", "thread", ")", ";", "}" ]
Wakes up node's successor, if one exists. @param node the node
[ "Wakes", "up", "node", "s", "successor", "if", "one", "exists", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#L674-L699
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setState
public int setState(boolean state, boolean bDisplayOption, int iMoveMode) { """ For binary fields, set the current state. @param state The state to set this field. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN). """ String tempString = "N"; if (state) tempString = "Y"; return this.setString(tempString, bDisplayOption, iMoveMode); // Move value to this field }
java
public int setState(boolean state, boolean bDisplayOption, int iMoveMode) { String tempString = "N"; if (state) tempString = "Y"; return this.setString(tempString, bDisplayOption, iMoveMode); // Move value to this field }
[ "public", "int", "setState", "(", "boolean", "state", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "String", "tempString", "=", "\"N\"", ";", "if", "(", "state", ")", "tempString", "=", "\"Y\"", ";", "return", "this", ".", "setString", "(", "tempString", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "// Move value to this field", "}" ]
For binary fields, set the current state. @param state The state to set this field. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "For", "binary", "fields", "set", "the", "current", "state", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L878-L884
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.generateFileTypeDetectionScript
protected void generateFileTypeDetectionScript(String basename) { """ Generate the script for detecting the SARL files. @param basename the name of the file to create. @see #getFileTypeDetectionScript() """ final CharSequence scriptContent = getFileTypeDetectionScript(); if (scriptContent != null) { final String textualContent = scriptContent.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output, FTDETECT_FOLDER).getAbsoluteFile(); try { final File outputFile = new File(directory, basename); outputFile.getParentFile().mkdirs(); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
java
protected void generateFileTypeDetectionScript(String basename) { final CharSequence scriptContent = getFileTypeDetectionScript(); if (scriptContent != null) { final String textualContent = scriptContent.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output, FTDETECT_FOLDER).getAbsoluteFile(); try { final File outputFile = new File(directory, basename); outputFile.getParentFile().mkdirs(); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
[ "protected", "void", "generateFileTypeDetectionScript", "(", "String", "basename", ")", "{", "final", "CharSequence", "scriptContent", "=", "getFileTypeDetectionScript", "(", ")", ";", "if", "(", "scriptContent", "!=", "null", ")", "{", "final", "String", "textualContent", "=", "scriptContent", ".", "toString", "(", ")", ";", "if", "(", "!", "Strings", ".", "isEmpty", "(", "textualContent", ")", ")", "{", "final", "byte", "[", "]", "bytes", "=", "textualContent", ".", "getBytes", "(", ")", ";", "for", "(", "final", "String", "output", ":", "getOutputs", "(", ")", ")", "{", "final", "File", "directory", "=", "new", "File", "(", "output", ",", "FTDETECT_FOLDER", ")", ".", "getAbsoluteFile", "(", ")", ";", "try", "{", "final", "File", "outputFile", "=", "new", "File", "(", "directory", ",", "basename", ")", ";", "outputFile", ".", "getParentFile", "(", ")", ".", "mkdirs", "(", ")", ";", "Files", ".", "write", "(", "Paths", ".", "get", "(", "outputFile", ".", "getAbsolutePath", "(", ")", ")", ",", "bytes", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}", "}", "}" ]
Generate the script for detecting the SARL files. @param basename the name of the file to create. @see #getFileTypeDetectionScript()
[ "Generate", "the", "script", "for", "detecting", "the", "SARL", "files", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L583-L601
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeDesc
public static int decodeDesc(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { """ Decodes the given BigInteger as originally encoded for descending order. @param src source of encoded data @param srcOffset offset into encoded data @param valueRef decoded BigInteger is stored in element 0, which may be null @return amount of bytes read from source @throws CorruptEncodingException if source data is corrupt @since 1.2 """ int headerSize; int bytesLength; byte[] bytes; try { int header = src[srcOffset]; if (header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW) { valueRef[0] = null; return 1; } header &= 0xff; if (header > 1 && header < 0xfe) { if (header < 0x80) { bytesLength = 0x80 - header; } else { bytesLength = header - 0x7f; } headerSize = 1; } else { bytesLength = Math.abs(DataDecoder.decodeInt(src, srcOffset + 1)); headerSize = 5; } bytes = new byte[bytesLength]; srcOffset += headerSize; for (int i=0; i<bytesLength; i++) { bytes[i] = (byte) ~src[srcOffset + i]; } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } valueRef[0] = new BigInteger(bytes); return headerSize + bytesLength; }
java
public static int decodeDesc(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { int headerSize; int bytesLength; byte[] bytes; try { int header = src[srcOffset]; if (header == NULL_BYTE_HIGH || header == NULL_BYTE_LOW) { valueRef[0] = null; return 1; } header &= 0xff; if (header > 1 && header < 0xfe) { if (header < 0x80) { bytesLength = 0x80 - header; } else { bytesLength = header - 0x7f; } headerSize = 1; } else { bytesLength = Math.abs(DataDecoder.decodeInt(src, srcOffset + 1)); headerSize = 5; } bytes = new byte[bytesLength]; srcOffset += headerSize; for (int i=0; i<bytesLength; i++) { bytes[i] = (byte) ~src[srcOffset + i]; } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } valueRef[0] = new BigInteger(bytes); return headerSize + bytesLength; }
[ "public", "static", "int", "decodeDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ",", "BigInteger", "[", "]", "valueRef", ")", "throws", "CorruptEncodingException", "{", "int", "headerSize", ";", "int", "bytesLength", ";", "byte", "[", "]", "bytes", ";", "try", "{", "int", "header", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "header", "==", "NULL_BYTE_HIGH", "||", "header", "==", "NULL_BYTE_LOW", ")", "{", "valueRef", "[", "0", "]", "=", "null", ";", "return", "1", ";", "}", "header", "&=", "0xff", ";", "if", "(", "header", ">", "1", "&&", "header", "<", "0xfe", ")", "{", "if", "(", "header", "<", "0x80", ")", "{", "bytesLength", "=", "0x80", "-", "header", ";", "}", "else", "{", "bytesLength", "=", "header", "-", "0x7f", ";", "}", "headerSize", "=", "1", ";", "}", "else", "{", "bytesLength", "=", "Math", ".", "abs", "(", "DataDecoder", ".", "decodeInt", "(", "src", ",", "srcOffset", "+", "1", ")", ")", ";", "headerSize", "=", "5", ";", "}", "bytes", "=", "new", "byte", "[", "bytesLength", "]", ";", "srcOffset", "+=", "headerSize", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bytesLength", ";", "i", "++", ")", "{", "bytes", "[", "i", "]", "=", "(", "byte", ")", "~", "src", "[", "srcOffset", "+", "i", "]", ";", "}", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "valueRef", "[", "0", "]", "=", "new", "BigInteger", "(", "bytes", ")", ";", "return", "headerSize", "+", "bytesLength", ";", "}" ]
Decodes the given BigInteger as originally encoded for descending order. @param src source of encoded data @param srcOffset offset into encoded data @param valueRef decoded BigInteger is stored in element 0, which may be null @return amount of bytes read from source @throws CorruptEncodingException if source data is corrupt @since 1.2
[ "Decodes", "the", "given", "BigInteger", "as", "originally", "encoded", "for", "descending", "order", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L395-L435
b3log/latke
latke-core/src/main/java/org/json/JSONObject.java
JSONObject.optNumber
public Number optNumber(String key, Number defaultValue) { """ Get an optional {@link Number} value associated with a key, or the default if there is no such key or if the value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. This method would be used in cases where type coercion of the number value is unwanted. @param key A key string. @param defaultValue The default. @return An object which is the value. """ Object val = this.opt(key); if (NULL.equals(val)) { return defaultValue; } if (val instanceof Number){ return (Number) val; } try { return stringToNumber(val.toString()); } catch (Exception e) { return defaultValue; } }
java
public Number optNumber(String key, Number defaultValue) { Object val = this.opt(key); if (NULL.equals(val)) { return defaultValue; } if (val instanceof Number){ return (Number) val; } try { return stringToNumber(val.toString()); } catch (Exception e) { return defaultValue; } }
[ "public", "Number", "optNumber", "(", "String", "key", ",", "Number", "defaultValue", ")", "{", "Object", "val", "=", "this", ".", "opt", "(", "key", ")", ";", "if", "(", "NULL", ".", "equals", "(", "val", ")", ")", "{", "return", "defaultValue", ";", "}", "if", "(", "val", "instanceof", "Number", ")", "{", "return", "(", "Number", ")", "val", ";", "}", "try", "{", "return", "stringToNumber", "(", "val", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Get an optional {@link Number} value associated with a key, or the default if there is no such key or if the value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. This method would be used in cases where type coercion of the number value is unwanted. @param key A key string. @param defaultValue The default. @return An object which is the value.
[ "Get", "an", "optional", "{", "@link", "Number", "}", "value", "associated", "with", "a", "key", "or", "the", "default", "if", "there", "is", "no", "such", "key", "or", "if", "the", "value", "is", "not", "a", "number", ".", "If", "the", "value", "is", "a", "string", "an", "attempt", "will", "be", "made", "to", "evaluate", "it", "as", "a", "number", ".", "This", "method", "would", "be", "used", "in", "cases", "where", "type", "coercion", "of", "the", "number", "value", "is", "unwanted", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1398-L1412
forge/furnace
container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java
Annotations.isAnnotationPresent
public static boolean isAnnotationPresent(final Class<?> c, final Class<? extends Annotation> type) { """ Discover if a Class <b>c</b> has been annotated with <b>type</b>. This also discovers annotations defined through a @{@link Stereotype}. @param c The class to inspect. @param type The targeted annotation class @return True if annotation is present either on class, false if the annotation is not present. """ return getAnnotation(c, type) != null; }
java
public static boolean isAnnotationPresent(final Class<?> c, final Class<? extends Annotation> type) { return getAnnotation(c, type) != null; }
[ "public", "static", "boolean", "isAnnotationPresent", "(", "final", "Class", "<", "?", ">", "c", ",", "final", "Class", "<", "?", "extends", "Annotation", ">", "type", ")", "{", "return", "getAnnotation", "(", "c", ",", "type", ")", "!=", "null", ";", "}" ]
Discover if a Class <b>c</b> has been annotated with <b>type</b>. This also discovers annotations defined through a @{@link Stereotype}. @param c The class to inspect. @param type The targeted annotation class @return True if annotation is present either on class, false if the annotation is not present.
[ "Discover", "if", "a", "Class", "<b", ">", "c<", "/", "b", ">", "has", "been", "annotated", "with", "<b", ">", "type<", "/", "b", ">", ".", "This", "also", "discovers", "annotations", "defined", "through", "a", "@", "{", "@link", "Stereotype", "}", "." ]
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/Annotations.java#L86-L89
OpenLiberty/open-liberty
dev/com.ibm.rls.jdbc/src/com/ibm/rls/jdbc/SQLRecoveryLogFactory.java
SQLRecoveryLogFactory.createRecoveryLog
@Override public RecoveryLog createRecoveryLog(CustomLogProperties props, RecoveryAgent agent, RecoveryLogComponent logComp, FailureScope fs) throws InvalidLogPropertiesException { """ /* createRecoveryLog @param props properties to be associated with the new recovery log (eg DBase config) @param agent RecoveryAgent which provides client service data eg clientId @param logcomp RecoveryLogComponent which can be used by the recovery log to notify failures @param failureScope the failurescope (server) for which this log is to be created @return RecoveryLog or MultiScopeLog to be used for logging @exception InvalidLogPropertiesException thrown if the properties are not consistent with the logFactory """ if (tc.isEntryEnabled()) Tr.entry(tc, "createRecoveryLog", new Object[] { props, agent, logComp, fs }); SQLMultiScopeRecoveryLog theLog = new SQLMultiScopeRecoveryLog(props, agent, fs); if (tc.isEntryEnabled()) Tr.exit(tc, "createRecoveryLog", theLog); return theLog; }
java
@Override public RecoveryLog createRecoveryLog(CustomLogProperties props, RecoveryAgent agent, RecoveryLogComponent logComp, FailureScope fs) throws InvalidLogPropertiesException { if (tc.isEntryEnabled()) Tr.entry(tc, "createRecoveryLog", new Object[] { props, agent, logComp, fs }); SQLMultiScopeRecoveryLog theLog = new SQLMultiScopeRecoveryLog(props, agent, fs); if (tc.isEntryEnabled()) Tr.exit(tc, "createRecoveryLog", theLog); return theLog; }
[ "@", "Override", "public", "RecoveryLog", "createRecoveryLog", "(", "CustomLogProperties", "props", ",", "RecoveryAgent", "agent", ",", "RecoveryLogComponent", "logComp", ",", "FailureScope", "fs", ")", "throws", "InvalidLogPropertiesException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"createRecoveryLog\"", ",", "new", "Object", "[", "]", "{", "props", ",", "agent", ",", "logComp", ",", "fs", "}", ")", ";", "SQLMultiScopeRecoveryLog", "theLog", "=", "new", "SQLMultiScopeRecoveryLog", "(", "props", ",", "agent", ",", "fs", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"createRecoveryLog\"", ",", "theLog", ")", ";", "return", "theLog", ";", "}" ]
/* createRecoveryLog @param props properties to be associated with the new recovery log (eg DBase config) @param agent RecoveryAgent which provides client service data eg clientId @param logcomp RecoveryLogComponent which can be used by the recovery log to notify failures @param failureScope the failurescope (server) for which this log is to be created @return RecoveryLog or MultiScopeLog to be used for logging @exception InvalidLogPropertiesException thrown if the properties are not consistent with the logFactory
[ "/", "*", "createRecoveryLog" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/rls/jdbc/SQLRecoveryLogFactory.java#L67-L77
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java
DBInitializerHelper.prepareScripts
public static String prepareScripts(JDBCDataContainerConfig containerConfig) throws IOException { """ Returns SQL scripts for initialization database for defined {@link JDBCDataContainerConfig}. """ String itemTableSuffix = getItemTableSuffix(containerConfig); String valueTableSuffix = getValueTableSuffix(containerConfig); String refTableSuffix = getRefTableSuffix(containerConfig); boolean isolatedDB = containerConfig.dbStructureType == DatabaseStructureType.ISOLATED; return prepareScripts(containerConfig.initScriptPath, itemTableSuffix, valueTableSuffix, refTableSuffix, isolatedDB); }
java
public static String prepareScripts(JDBCDataContainerConfig containerConfig) throws IOException { String itemTableSuffix = getItemTableSuffix(containerConfig); String valueTableSuffix = getValueTableSuffix(containerConfig); String refTableSuffix = getRefTableSuffix(containerConfig); boolean isolatedDB = containerConfig.dbStructureType == DatabaseStructureType.ISOLATED; return prepareScripts(containerConfig.initScriptPath, itemTableSuffix, valueTableSuffix, refTableSuffix, isolatedDB); }
[ "public", "static", "String", "prepareScripts", "(", "JDBCDataContainerConfig", "containerConfig", ")", "throws", "IOException", "{", "String", "itemTableSuffix", "=", "getItemTableSuffix", "(", "containerConfig", ")", ";", "String", "valueTableSuffix", "=", "getValueTableSuffix", "(", "containerConfig", ")", ";", "String", "refTableSuffix", "=", "getRefTableSuffix", "(", "containerConfig", ")", ";", "boolean", "isolatedDB", "=", "containerConfig", ".", "dbStructureType", "==", "DatabaseStructureType", ".", "ISOLATED", ";", "return", "prepareScripts", "(", "containerConfig", ".", "initScriptPath", ",", "itemTableSuffix", ",", "valueTableSuffix", ",", "refTableSuffix", ",", "isolatedDB", ")", ";", "}" ]
Returns SQL scripts for initialization database for defined {@link JDBCDataContainerConfig}.
[ "Returns", "SQL", "scripts", "for", "initialization", "database", "for", "defined", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L58-L67
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/IntegerField.java
IntegerField.getSQLFromField
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { """ Move the physical binary data to this SQL parameter row. This is overidden to move the physical data type. @param statement The SQL prepare statement. @param iType the type of SQL statement. @param iParamColumn The column in the prepared statement to set the data. @exception SQLException From SQL calls. """ if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE)) statement.setNull(iParamColumn, Types.INTEGER); else statement.setInt(iParamColumn, NAN); } else statement.setInt(iParamColumn, (int)this.getValue()); }
java
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE)) statement.setNull(iParamColumn, Types.INTEGER); else statement.setInt(iParamColumn, NAN); } else statement.setInt(iParamColumn, (int)this.getValue()); }
[ "public", "void", "getSQLFromField", "(", "PreparedStatement", "statement", ",", "int", "iType", ",", "int", "iParamColumn", ")", "throws", "SQLException", "{", "if", "(", "this", ".", "isNull", "(", ")", ")", "{", "if", "(", "(", "this", ".", "isNullable", "(", ")", ")", "&&", "(", "iType", "!=", "DBConstants", ".", "SQL_SELECT_TYPE", ")", ")", "statement", ".", "setNull", "(", "iParamColumn", ",", "Types", ".", "INTEGER", ")", ";", "else", "statement", ".", "setInt", "(", "iParamColumn", ",", "NAN", ")", ";", "}", "else", "statement", ".", "setInt", "(", "iParamColumn", ",", "(", "int", ")", "this", ".", "getValue", "(", ")", ")", ";", "}" ]
Move the physical binary data to this SQL parameter row. This is overidden to move the physical data type. @param statement The SQL prepare statement. @param iType the type of SQL statement. @param iParamColumn The column in the prepared statement to set the data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", ".", "This", "is", "overidden", "to", "move", "the", "physical", "data", "type", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/IntegerField.java#L142-L153
dlew/joda-time-android
library/src/main/java/net/danlew/android/joda/DateUtils.java
DateUtils.getRelativeTimeSpanString
public static CharSequence getRelativeTimeSpanString(Context context, ReadableInstant time) { """ Returns a string describing 'time' as a time relative to the current time. @see #getRelativeTimeSpanString(Context, ReadableInstant, int) """ int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_ABBREV_MONTH; return getRelativeTimeSpanString(context, time, flags); }
java
public static CharSequence getRelativeTimeSpanString(Context context, ReadableInstant time) { int flags = FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_ABBREV_MONTH; return getRelativeTimeSpanString(context, time, flags); }
[ "public", "static", "CharSequence", "getRelativeTimeSpanString", "(", "Context", "context", ",", "ReadableInstant", "time", ")", "{", "int", "flags", "=", "FORMAT_SHOW_DATE", "|", "FORMAT_SHOW_YEAR", "|", "FORMAT_ABBREV_MONTH", ";", "return", "getRelativeTimeSpanString", "(", "context", ",", "time", ",", "flags", ")", ";", "}" ]
Returns a string describing 'time' as a time relative to the current time. @see #getRelativeTimeSpanString(Context, ReadableInstant, int)
[ "Returns", "a", "string", "describing", "time", "as", "a", "time", "relative", "to", "the", "current", "time", "." ]
train
https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L222-L225
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_volume_volumeId_attach_POST
public OvhVolume project_serviceName_volume_volumeId_attach_POST(String serviceName, String volumeId, String instanceId) throws IOException { """ Attach a volume on an instance REST: POST /cloud/project/{serviceName}/volume/{volumeId}/attach @param instanceId [required] Instance id @param serviceName [required] Service name @param volumeId [required] Volume id """ String qPath = "/cloud/project/{serviceName}/volume/{volumeId}/attach"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
java
public OvhVolume project_serviceName_volume_volumeId_attach_POST(String serviceName, String volumeId, String instanceId) throws IOException { String qPath = "/cloud/project/{serviceName}/volume/{volumeId}/attach"; StringBuilder sb = path(qPath, serviceName, volumeId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "instanceId", instanceId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVolume.class); }
[ "public", "OvhVolume", "project_serviceName_volume_volumeId_attach_POST", "(", "String", "serviceName", ",", "String", "volumeId", ",", "String", "instanceId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/volume/{volumeId}/attach\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "volumeId", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"instanceId\"", ",", "instanceId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhVolume", ".", "class", ")", ";", "}" ]
Attach a volume on an instance REST: POST /cloud/project/{serviceName}/volume/{volumeId}/attach @param instanceId [required] Instance id @param serviceName [required] Service name @param volumeId [required] Volume id
[ "Attach", "a", "volume", "on", "an", "instance" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1172-L1179
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java
ByteArrayUtil.readInt
public static int readInt(byte[] array, int offset) { """ Read an integer from the byte array at the given offset. @param array Array to read from @param offset Offset to read at @return data """ // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; int b2 = array[offset + 2] & 0xFF; int b3 = array[offset + 3] & 0xFF; return ((b0 << 24) + (b1 << 16) + (b2 << 8) + (b3 << 0)); }
java
public static int readInt(byte[] array, int offset) { // First make integers to resolve signed vs. unsigned issues. int b0 = array[offset + 0] & 0xFF; int b1 = array[offset + 1] & 0xFF; int b2 = array[offset + 2] & 0xFF; int b3 = array[offset + 3] & 0xFF; return ((b0 << 24) + (b1 << 16) + (b2 << 8) + (b3 << 0)); }
[ "public", "static", "int", "readInt", "(", "byte", "[", "]", "array", ",", "int", "offset", ")", "{", "// First make integers to resolve signed vs. unsigned issues.", "int", "b0", "=", "array", "[", "offset", "+", "0", "]", "&", "0xFF", ";", "int", "b1", "=", "array", "[", "offset", "+", "1", "]", "&", "0xFF", ";", "int", "b2", "=", "array", "[", "offset", "+", "2", "]", "&", "0xFF", ";", "int", "b3", "=", "array", "[", "offset", "+", "3", "]", "&", "0xFF", ";", "return", "(", "(", "b0", "<<", "24", ")", "+", "(", "b1", "<<", "16", ")", "+", "(", "b2", "<<", "8", ")", "+", "(", "b3", "<<", "0", ")", ")", ";", "}" ]
Read an integer from the byte array at the given offset. @param array Array to read from @param offset Offset to read at @return data
[ "Read", "an", "integer", "from", "the", "byte", "array", "at", "the", "given", "offset", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L207-L214
protegeproject/existentialquery
src/main/java/uk/ac/manchester/cs/owl/existentialquery/OWLExistentialReasonerImpl.java
OWLExistentialReasonerImpl.getFillers
public NodeSet<OWLClass> getFillers(OWLClassExpression ce, OWLObjectPropertyExpression property) { """ Gets the fillers of the existential restrictions that are entailed to be superclasses the specified class expression and act along the specified property. In essence, this finds bindings for ?x with respect to the following template: <code>SubClassOf(ce ObjectSomeValuesFrom(property, ?x))</code> @param ce The class expression. Not {@code null}. @param property The property expression. Not {@code null}. @return A set of class expressions that are the entailed fillers of entailed existential restriction superclasses. """ return getFillers(ce, Arrays.asList(property)); }
java
public NodeSet<OWLClass> getFillers(OWLClassExpression ce, OWLObjectPropertyExpression property) { return getFillers(ce, Arrays.asList(property)); }
[ "public", "NodeSet", "<", "OWLClass", ">", "getFillers", "(", "OWLClassExpression", "ce", ",", "OWLObjectPropertyExpression", "property", ")", "{", "return", "getFillers", "(", "ce", ",", "Arrays", ".", "asList", "(", "property", ")", ")", ";", "}" ]
Gets the fillers of the existential restrictions that are entailed to be superclasses the specified class expression and act along the specified property. In essence, this finds bindings for ?x with respect to the following template: <code>SubClassOf(ce ObjectSomeValuesFrom(property, ?x))</code> @param ce The class expression. Not {@code null}. @param property The property expression. Not {@code null}. @return A set of class expressions that are the entailed fillers of entailed existential restriction superclasses.
[ "Gets", "the", "fillers", "of", "the", "existential", "restrictions", "that", "are", "entailed", "to", "be", "superclasses", "the", "specified", "class", "expression", "and", "act", "along", "the", "specified", "property", ".", "In", "essence", "this", "finds", "bindings", "for", "?x", "with", "respect", "to", "the", "following", "template", ":", "<code", ">", "SubClassOf", "(", "ce", "ObjectSomeValuesFrom", "(", "property", "?x", "))", "<", "/", "code", ">" ]
train
https://github.com/protegeproject/existentialquery/blob/bd4b34a4383fcec4f2250da6609deede5186eb87/src/main/java/uk/ac/manchester/cs/owl/existentialquery/OWLExistentialReasonerImpl.java#L55-L57
lukas-krecan/json2xml
src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java
JsonXmlHelper.convertChildren
private static void convertChildren(JsonGenerator generator, Element element, boolean isArray, ElementNameConverter converter) throws IOException { """ Method to recurse within children elements and convert them to JSON too. @param generator @param element @param isArray @throws IOException """ NodeList list = element.getChildNodes(); int len = list.getLength(); for (int i = 0; i < len; i++) { Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { convertElement(generator, (Element) node, isArray, converter); } } }
java
private static void convertChildren(JsonGenerator generator, Element element, boolean isArray, ElementNameConverter converter) throws IOException { NodeList list = element.getChildNodes(); int len = list.getLength(); for (int i = 0; i < len; i++) { Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { convertElement(generator, (Element) node, isArray, converter); } } }
[ "private", "static", "void", "convertChildren", "(", "JsonGenerator", "generator", ",", "Element", "element", ",", "boolean", "isArray", ",", "ElementNameConverter", "converter", ")", "throws", "IOException", "{", "NodeList", "list", "=", "element", ".", "getChildNodes", "(", ")", ";", "int", "len", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "Node", "node", "=", "list", ".", "item", "(", "i", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "convertElement", "(", "generator", ",", "(", "Element", ")", "node", ",", "isArray", ",", "converter", ")", ";", "}", "}", "}" ]
Method to recurse within children elements and convert them to JSON too. @param generator @param element @param isArray @throws IOException
[ "Method", "to", "recurse", "within", "children", "elements", "and", "convert", "them", "to", "JSON", "too", "." ]
train
https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L172-L181
doubledutch/LazyJSON
src/main/java/me/doubledutch/lazyjson/LazyObject.java
LazyObject.getJSONObject
public LazyObject getJSONObject(String key) throws LazyException { """ Returns the JSON object stored in this object for the given key. @param key the name of the field on this object @return an array value @throws LazyException if the value for the given key was not an object. """ LazyNode token=getFieldToken(key); if(token.type!=LazyNode.OBJECT)throw new LazyException("Requested value is not an object",token); LazyObject obj=new LazyObject(token); obj.parent=this; return obj; }
java
public LazyObject getJSONObject(String key) throws LazyException{ LazyNode token=getFieldToken(key); if(token.type!=LazyNode.OBJECT)throw new LazyException("Requested value is not an object",token); LazyObject obj=new LazyObject(token); obj.parent=this; return obj; }
[ "public", "LazyObject", "getJSONObject", "(", "String", "key", ")", "throws", "LazyException", "{", "LazyNode", "token", "=", "getFieldToken", "(", "key", ")", ";", "if", "(", "token", ".", "type", "!=", "LazyNode", ".", "OBJECT", ")", "throw", "new", "LazyException", "(", "\"Requested value is not an object\"", ",", "token", ")", ";", "LazyObject", "obj", "=", "new", "LazyObject", "(", "token", ")", ";", "obj", ".", "parent", "=", "this", ";", "return", "obj", ";", "}" ]
Returns the JSON object stored in this object for the given key. @param key the name of the field on this object @return an array value @throws LazyException if the value for the given key was not an object.
[ "Returns", "the", "JSON", "object", "stored", "in", "this", "object", "for", "the", "given", "key", "." ]
train
https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L578-L584
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java
LinkedConverter.setValue
public int setValue(double value, boolean bDisplayOption, int iMoveMode) { """ For numeric fields, set the current value. Override this method to convert the value to the actual Physical Data Type. @param bState the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code. """ if (this.getNextConverter() != null) return this.getNextConverter().setValue(value, bDisplayOption, iMoveMode); else return super.setValue(value, bDisplayOption, iMoveMode); }
java
public int setValue(double value, boolean bDisplayOption, int iMoveMode) { if (this.getNextConverter() != null) return this.getNextConverter().setValue(value, bDisplayOption, iMoveMode); else return super.setValue(value, bDisplayOption, iMoveMode); }
[ "public", "int", "setValue", "(", "double", "value", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "this", ".", "getNextConverter", "(", ")", "!=", "null", ")", "return", "this", ".", "getNextConverter", "(", ")", ".", "setValue", "(", "value", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "else", "return", "super", ".", "setValue", "(", "value", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
For numeric fields, set the current value. Override this method to convert the value to the actual Physical Data Type. @param bState the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code.
[ "For", "numeric", "fields", "set", "the", "current", "value", ".", "Override", "this", "method", "to", "convert", "the", "value", "to", "the", "actual", "Physical", "Data", "Type", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java#L302-L308
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/reflect/TypeMatcher.java
TypeMatcher.matchValueByName
public static boolean matchValueByName(String expectedType, Object actualValue) { """ Matches expected type to a type of a value. @param expectedType an expected type name to match. @param actualValue a value to match its type to the expected one. @return true if types are matching and false if they don't. """ if (expectedType == null) return true; if (actualValue == null) throw new NullPointerException("Actual value cannot be null"); return matchTypeByName(expectedType, actualValue.getClass()); }
java
public static boolean matchValueByName(String expectedType, Object actualValue) { if (expectedType == null) return true; if (actualValue == null) throw new NullPointerException("Actual value cannot be null"); return matchTypeByName(expectedType, actualValue.getClass()); }
[ "public", "static", "boolean", "matchValueByName", "(", "String", "expectedType", ",", "Object", "actualValue", ")", "{", "if", "(", "expectedType", "==", "null", ")", "return", "true", ";", "if", "(", "actualValue", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Actual value cannot be null\"", ")", ";", "return", "matchTypeByName", "(", "expectedType", ",", "actualValue", ".", "getClass", "(", ")", ")", ";", "}" ]
Matches expected type to a type of a value. @param expectedType an expected type name to match. @param actualValue a value to match its type to the expected one. @return true if types are matching and false if they don't.
[ "Matches", "expected", "type", "to", "a", "type", "of", "a", "value", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeMatcher.java#L74-L81
OpenLiberty/open-liberty
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java
AbstractRasMethodAdapter.visitAnnotation
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { """ Visit the method annotations looking at the supported RAS annotations. The visitors are only used when a {@code MethodInfo} model object was not provided during construction. @param desc the annotation descriptor @param visible true if the annotation is a runtime visible annotation """ AnnotationVisitor av = super.visitAnnotation(desc, visible); observedAnnotations.add(Type.getType(desc)); if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) { injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass()); av = injectedTraceAnnotationVisitor; } return av; }
java
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = super.visitAnnotation(desc, visible); observedAnnotations.add(Type.getType(desc)); if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) { injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass()); av = injectedTraceAnnotationVisitor; } return av; }
[ "@", "Override", "public", "AnnotationVisitor", "visitAnnotation", "(", "String", "desc", ",", "boolean", "visible", ")", "{", "AnnotationVisitor", "av", "=", "super", ".", "visitAnnotation", "(", "desc", ",", "visible", ")", ";", "observedAnnotations", ".", "add", "(", "Type", ".", "getType", "(", "desc", ")", ")", ";", "if", "(", "desc", ".", "equals", "(", "INJECTED_TRACE_TYPE", ".", "getDescriptor", "(", ")", ")", ")", "{", "injectedTraceAnnotationVisitor", "=", "new", "InjectedTraceAnnotationVisitor", "(", "av", ",", "getClass", "(", ")", ")", ";", "av", "=", "injectedTraceAnnotationVisitor", ";", "}", "return", "av", ";", "}" ]
Visit the method annotations looking at the supported RAS annotations. The visitors are only used when a {@code MethodInfo} model object was not provided during construction. @param desc the annotation descriptor @param visible true if the annotation is a runtime visible annotation
[ "Visit", "the", "method", "annotations", "looking", "at", "the", "supported", "RAS", "annotations", ".", "The", "visitors", "are", "only", "used", "when", "a", "{", "@code", "MethodInfo", "}", "model", "object", "was", "not", "provided", "during", "construction", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java#L332-L341
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java
ProxiedFileSystemCache.getProxiedFileSystem
@Deprecated public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties, Configuration conf) throws IOException { """ Gets a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs. @param userNameToProxyAs The name of the user the super user should proxy as @param properties {@link java.util.Properties} containing initialization properties. @param conf The {@link Configuration} for the {@link FileSystem} that should be created. @return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs @throws IOException @deprecated use {@link #fromProperties} """ return getProxiedFileSystem(userNameToProxyAs, properties, FileSystem.getDefaultUri(conf), conf); }
java
@Deprecated public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties, Configuration conf) throws IOException { return getProxiedFileSystem(userNameToProxyAs, properties, FileSystem.getDefaultUri(conf), conf); }
[ "@", "Deprecated", "public", "static", "FileSystem", "getProxiedFileSystem", "(", "@", "NonNull", "final", "String", "userNameToProxyAs", ",", "Properties", "properties", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "return", "getProxiedFileSystem", "(", "userNameToProxyAs", ",", "properties", ",", "FileSystem", ".", "getDefaultUri", "(", "conf", ")", ",", "conf", ")", ";", "}" ]
Gets a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs. @param userNameToProxyAs The name of the user the super user should proxy as @param properties {@link java.util.Properties} containing initialization properties. @param conf The {@link Configuration} for the {@link FileSystem} that should be created. @return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs @throws IOException @deprecated use {@link #fromProperties}
[ "Gets", "a", "{", "@link", "FileSystem", "}", "that", "can", "perform", "any", "operations", "allowed", "by", "the", "specified", "userNameToProxyAs", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java#L90-L94
opoo/opoopress
core/src/main/java/org/opoo/press/util/ClassUtils.java
ClassUtils.newInstance
public static <T> T newInstance(String className, SiteConfig config) { """ Create a new instance for the specified class name. @param className class name @param config site config @return new instance """ return newInstance(className, null, null, config); }
java
public static <T> T newInstance(String className, SiteConfig config) { return newInstance(className, null, null, config); }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "String", "className", ",", "SiteConfig", "config", ")", "{", "return", "newInstance", "(", "className", ",", "null", ",", "null", ",", "config", ")", ";", "}" ]
Create a new instance for the specified class name. @param className class name @param config site config @return new instance
[ "Create", "a", "new", "instance", "for", "the", "specified", "class", "name", "." ]
train
https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/util/ClassUtils.java#L55-L57
j-a-w-r/jawr
jawr-core/src/main/java/net/jawr/web/taglib/jsf/ImagePathTag.java
ImagePathTag.getImageUrl
protected String getImageUrl(FacesContext context, String src, boolean base64) { """ Returns the image URL generated by Jawr from a source image path @param context the faces context @param src the image source @param base64 the flag indicating if the image should be encoded in base64 @return the image URL generated by Jawr from a source image path """ BinaryResourcesHandler imgRsHandler = getBinaryResourcesHandler(context); HttpServletResponse response = ((HttpServletResponse) context.getExternalContext().getResponse()); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); return ImageTagUtils.getImageUrl(src, base64, imgRsHandler, request, response); }
java
protected String getImageUrl(FacesContext context, String src, boolean base64) { BinaryResourcesHandler imgRsHandler = getBinaryResourcesHandler(context); HttpServletResponse response = ((HttpServletResponse) context.getExternalContext().getResponse()); HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest(); return ImageTagUtils.getImageUrl(src, base64, imgRsHandler, request, response); }
[ "protected", "String", "getImageUrl", "(", "FacesContext", "context", ",", "String", "src", ",", "boolean", "base64", ")", "{", "BinaryResourcesHandler", "imgRsHandler", "=", "getBinaryResourcesHandler", "(", "context", ")", ";", "HttpServletResponse", "response", "=", "(", "(", "HttpServletResponse", ")", "context", ".", "getExternalContext", "(", ")", ".", "getResponse", "(", ")", ")", ";", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "context", ".", "getExternalContext", "(", ")", ".", "getRequest", "(", ")", ";", "return", "ImageTagUtils", ".", "getImageUrl", "(", "src", ",", "base64", ",", "imgRsHandler", ",", "request", ",", "response", ")", ";", "}" ]
Returns the image URL generated by Jawr from a source image path @param context the faces context @param src the image source @param base64 the flag indicating if the image should be encoded in base64 @return the image URL generated by Jawr from a source image path
[ "Returns", "the", "image", "URL", "generated", "by", "Jawr", "from", "a", "source", "image", "path" ]
train
https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/taglib/jsf/ImagePathTag.java#L95-L103
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryApi.java
RepositoryApi.createBranch
public Branch createBranch(Object projectIdOrPath, String branchName, String ref) throws GitLabApiException { """ Creates a branch for the project. Support as of version 6.8.x <pre><code>GitLab Endpoint: POST /projects/:id/repository/branches</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to create @param ref Source to create the branch from, can be an existing branch, tag or commit SHA @return the branch info for the created branch @throws GitLabApiException if any exception occurs """ Form formData = new GitLabApiForm() .withParam(isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true) .withParam("ref", ref, true); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches"); return (response.readEntity(Branch.class)); }
java
public Branch createBranch(Object projectIdOrPath, String branchName, String ref) throws GitLabApiException { Form formData = new GitLabApiForm() .withParam(isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true) .withParam("ref", ref, true); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches"); return (response.readEntity(Branch.class)); }
[ "public", "Branch", "createBranch", "(", "Object", "projectIdOrPath", ",", "String", "branchName", ",", "String", "ref", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", "?", "\"branch_name\"", ":", "\"branch\"", ",", "branchName", ",", "true", ")", ".", "withParam", "(", "\"ref\"", ",", "ref", ",", "true", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"branches\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Branch", ".", "class", ")", ")", ";", "}" ]
Creates a branch for the project. Support as of version 6.8.x <pre><code>GitLab Endpoint: POST /projects/:id/repository/branches</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to create @param ref Source to create the branch from, can be an existing branch, tag or commit SHA @return the branch info for the created branch @throws GitLabApiException if any exception occurs
[ "Creates", "a", "branch", "for", "the", "project", ".", "Support", "as", "of", "version", "6", ".", "8", ".", "x" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L139-L147
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/KeyIgnoringCRAMOutputFormat.java
KeyIgnoringCRAMOutputFormat.getRecordWriter
@Override public RecordWriter<K,SAMRecordWritable> getRecordWriter( TaskAttemptContext ctx) throws IOException { """ <code>setSAMHeader</code> or <code>readSAMHeaderFrom</code> must have been called first. """ return getRecordWriter(ctx, getDefaultWorkFile(ctx, "")); }
java
@Override public RecordWriter<K,SAMRecordWritable> getRecordWriter( TaskAttemptContext ctx) throws IOException { return getRecordWriter(ctx, getDefaultWorkFile(ctx, "")); }
[ "@", "Override", "public", "RecordWriter", "<", "K", ",", "SAMRecordWritable", ">", "getRecordWriter", "(", "TaskAttemptContext", "ctx", ")", "throws", "IOException", "{", "return", "getRecordWriter", "(", "ctx", ",", "getDefaultWorkFile", "(", "ctx", ",", "\"\"", ")", ")", ";", "}" ]
<code>setSAMHeader</code> or <code>readSAMHeaderFrom</code> must have been called first.
[ "<code", ">", "setSAMHeader<", "/", "code", ">", "or", "<code", ">", "readSAMHeaderFrom<", "/", "code", ">", "must", "have", "been", "called", "first", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/KeyIgnoringCRAMOutputFormat.java#L53-L58
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createSingle
public static IDLProxyObject createSingle(String data, boolean debug) { """ Creates the single. @param data the data @param debug the debug @return the IDL proxy object """ return createSingle(data, debug, null, true); }
java
public static IDLProxyObject createSingle(String data, boolean debug) { return createSingle(data, debug, null, true); }
[ "public", "static", "IDLProxyObject", "createSingle", "(", "String", "data", ",", "boolean", "debug", ")", "{", "return", "createSingle", "(", "data", ",", "debug", ",", "null", ",", "true", ")", ";", "}" ]
Creates the single. @param data the data @param debug the debug @return the IDL proxy object
[ "Creates", "the", "single", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1097-L1099
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java
StrBuilder.insert
public StrBuilder insert(int index, char[] src, int srcPos, int length) { """ 指定位置插入数据<br> 如果插入位置为当前位置,则定义为追加<br> 如果插入位置大于当前位置,则中间部分补充空格 @param index 插入位置 @param src 源数组 @param srcPos 位置 @param length 长度 @return this """ if (ArrayUtil.isEmpty(src) || srcPos > src.length || length <= 0) { return this; } if (index < 0) { index = 0; } if (srcPos < 0) { srcPos = 0; } else if (srcPos + length > src.length) { // 长度越界,只截取最大长度 length = src.length - srcPos; } moveDataAfterIndex(index, length); // 插入数据 System.arraycopy(src, srcPos, value, index, length); this.position = Math.max(this.position, index) + length; return this; }
java
public StrBuilder insert(int index, char[] src, int srcPos, int length) { if (ArrayUtil.isEmpty(src) || srcPos > src.length || length <= 0) { return this; } if (index < 0) { index = 0; } if (srcPos < 0) { srcPos = 0; } else if (srcPos + length > src.length) { // 长度越界,只截取最大长度 length = src.length - srcPos; } moveDataAfterIndex(index, length); // 插入数据 System.arraycopy(src, srcPos, value, index, length); this.position = Math.max(this.position, index) + length; return this; }
[ "public", "StrBuilder", "insert", "(", "int", "index", ",", "char", "[", "]", "src", ",", "int", "srcPos", ",", "int", "length", ")", "{", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "src", ")", "||", "srcPos", ">", "src", ".", "length", "||", "length", "<=", "0", ")", "{", "return", "this", ";", "}", "if", "(", "index", "<", "0", ")", "{", "index", "=", "0", ";", "}", "if", "(", "srcPos", "<", "0", ")", "{", "srcPos", "=", "0", ";", "}", "else", "if", "(", "srcPos", "+", "length", ">", "src", ".", "length", ")", "{", "// 长度越界,只截取最大长度", "length", "=", "src", ".", "length", "-", "srcPos", ";", "}", "moveDataAfterIndex", "(", "index", ",", "length", ")", ";", "// 插入数据", "System", ".", "arraycopy", "(", "src", ",", "srcPos", ",", "value", ",", "index", ",", "length", ")", ";", "this", ".", "position", "=", "Math", ".", "max", "(", "this", ".", "position", ",", "index", ")", "+", "length", ";", "return", "this", ";", "}" ]
指定位置插入数据<br> 如果插入位置为当前位置,则定义为追加<br> 如果插入位置大于当前位置,则中间部分补充空格 @param index 插入位置 @param src 源数组 @param srcPos 位置 @param length 长度 @return this
[ "指定位置插入数据<br", ">", "如果插入位置为当前位置,则定义为追加<br", ">", "如果插入位置大于当前位置,则中间部分补充空格" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrBuilder.java#L197-L216