repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/appfw/appfw_stats.java
appfw_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { appfw_stats[] resources = new appfw_stats[1]; appfw_response result = (appfw_response) service.get_payload_formatter().string_to_resource(appfw_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.appfw; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { appfw_stats[] resources = new appfw_stats[1]; appfw_response result = (appfw_response) service.get_payload_formatter().string_to_resource(appfw_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.appfw; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "appfw_stats", "[", "]", "resources", "=", "new", "appfw_stats", "[", "1", "]", ";", "appfw_response", "res...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/appfw/appfw_stats.java#L707-L726
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java
GlobalConfiguration.loadYAMLResource
private static Configuration loadYAMLResource(File file) { final Configuration config = new Configuration(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)))){ String line; int lineNo = 0; while ((line = reader.readLine()) != null) { lineNo++; // 1. check for comments String[] comments = line.split("#", 2); String conf = comments[0].trim(); // 2. get key and value if (conf.length() > 0) { String[] kv = conf.split(": ", 2); // skip line with no valid key-value pair if (kv.length == 1) { LOG.warn("Error while trying to split key and value in configuration file " + file + ":" + lineNo + ": \"" + line + "\""); continue; } String key = kv[0].trim(); String value = kv[1].trim(); // sanity check if (key.length() == 0 || value.length() == 0) { LOG.warn("Error after splitting key and value in configuration file " + file + ":" + lineNo + ": \"" + line + "\""); continue; } LOG.info("Loading configuration property: {}, {}", key, isSensitive(key) ? HIDDEN_CONTENT : value); config.setString(key, value); } } } catch (IOException e) { throw new RuntimeException("Error parsing YAML configuration.", e); } return config; }
java
private static Configuration loadYAMLResource(File file) { final Configuration config = new Configuration(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)))){ String line; int lineNo = 0; while ((line = reader.readLine()) != null) { lineNo++; // 1. check for comments String[] comments = line.split("#", 2); String conf = comments[0].trim(); // 2. get key and value if (conf.length() > 0) { String[] kv = conf.split(": ", 2); // skip line with no valid key-value pair if (kv.length == 1) { LOG.warn("Error while trying to split key and value in configuration file " + file + ":" + lineNo + ": \"" + line + "\""); continue; } String key = kv[0].trim(); String value = kv[1].trim(); // sanity check if (key.length() == 0 || value.length() == 0) { LOG.warn("Error after splitting key and value in configuration file " + file + ":" + lineNo + ": \"" + line + "\""); continue; } LOG.info("Loading configuration property: {}, {}", key, isSensitive(key) ? HIDDEN_CONTENT : value); config.setString(key, value); } } } catch (IOException e) { throw new RuntimeException("Error parsing YAML configuration.", e); } return config; }
[ "private", "static", "Configuration", "loadYAMLResource", "(", "File", "file", ")", "{", "final", "Configuration", "config", "=", "new", "Configuration", "(", ")", ";", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStrea...
Loads a YAML-file of key-value pairs. <p>Colon and whitespace ": " separate key and value (one per line). The hash tag "#" starts a single-line comment. <p>Example: <pre> jobmanager.rpc.address: localhost # network address for communication with the job manager jobmanager.rpc.port : 6123 # network port to connect to for communication with the job manager taskmanager.rpc.port : 6122 # network port the task manager expects incoming IPC connections </pre> <p>This does not span the whole YAML specification, but only the *syntax* of simple YAML key-value pairs (see issue #113 on GitHub). If at any point in time, there is a need to go beyond simple key-value pairs syntax compatibility will allow to introduce a YAML parser library. @param file the YAML file to read from @see <a href="http://www.yaml.org/spec/1.2/spec.html">YAML 1.2 specification</a>
[ "Loads", "a", "YAML", "-", "file", "of", "key", "-", "value", "pairs", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L160-L201
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/beans/ELTools.java
ELTools.createValueExpression
public static ValueExpression createValueExpression(String p_expression, Class<?> expectedType) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elContext = context.getELContext(); if (null == expectedType) { LOGGER.severe("The expected type of " + p_expression + " is null. Defaulting to String."); expectedType = String.class; } ValueExpression vex = expressionFactory.createValueExpression(elContext, p_expression, expectedType); return vex; }
java
public static ValueExpression createValueExpression(String p_expression, Class<?> expectedType) { FacesContext context = FacesContext.getCurrentInstance(); ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ELContext elContext = context.getELContext(); if (null == expectedType) { LOGGER.severe("The expected type of " + p_expression + " is null. Defaulting to String."); expectedType = String.class; } ValueExpression vex = expressionFactory.createValueExpression(elContext, p_expression, expectedType); return vex; }
[ "public", "static", "ValueExpression", "createValueExpression", "(", "String", "p_expression", ",", "Class", "<", "?", ">", "expectedType", ")", "{", "FacesContext", "context", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ";", "ExpressionFactory", "expr...
Utility method to create a JSF Value expression from p_expression with exprectedType class as return @param p_expression @param expectedType @return
[ "Utility", "method", "to", "create", "a", "JSF", "Value", "expression", "from", "p_expression", "with", "exprectedType", "class", "as", "return" ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/beans/ELTools.java#L68-L78
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/JCAResourceMBeanImpl.java
JCAResourceMBeanImpl.setConnectionFactoryChild
protected JCAConnectionFactoryMBeanImpl setConnectionFactoryChild(String key, JCAConnectionFactoryMBeanImpl cf) { return cfMBeanChildrenList.put(key, cf); }
java
protected JCAConnectionFactoryMBeanImpl setConnectionFactoryChild(String key, JCAConnectionFactoryMBeanImpl cf) { return cfMBeanChildrenList.put(key, cf); }
[ "protected", "JCAConnectionFactoryMBeanImpl", "setConnectionFactoryChild", "(", "String", "key", ",", "JCAConnectionFactoryMBeanImpl", "cf", ")", "{", "return", "cfMBeanChildrenList", ".", "put", "(", "key", ",", "cf", ")", ";", "}" ]
setConnectionFactoryChild add a child of type JCAConnectionFactoryMBeanImpl to this MBean. @param key the String value which will be used as the key for the JCAConnectionFactoryMBeanImpl item @param cf the JCAConnectionFactoryMBeanImpl value to be associated with the specified key @return The previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key.)
[ "setConnectionFactoryChild", "add", "a", "child", "of", "type", "JCAConnectionFactoryMBeanImpl", "to", "this", "MBean", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.management.j2ee/src/com/ibm/ws/jca/management/j2ee/internal/JCAResourceMBeanImpl.java#L243-L245
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkManager.java
CmsLinkManager.substituteLink
public String substituteLink(CmsObject cms, String link) { return substituteLink(cms, link, null, false); }
java
public String substituteLink(CmsObject cms, String link) { return substituteLink(cms, link, null, false); }
[ "public", "String", "substituteLink", "(", "CmsObject", "cms", ",", "String", "link", ")", "{", "return", "substituteLink", "(", "cms", ",", "link", ",", "null", ",", "false", ")", ";", "}" ]
Returns a link <i>from</i> the URI stored in the provided OpenCms user context <i>to</i> the VFS resource indicated by the given <code>link</code> in the current site, for use on web pages.<p> The provided <code>link</code> is assumed to be the contained in the site currently set in the provided OpenCms user context <code>cms</code>.<p> The result will be an absolute link that contains the configured context path and servlet name, and in the case of the "online" project it will also be rewritten according to to the configured static export settings.<p> In case <code>link</code> is a relative URI, the current URI contained in the provided OpenCms user context <code>cms</code> is used to make the relative <code>link</code> absolute.<p> Please note the above text describes the default behavior as implemented by {@link CmsDefaultLinkSubstitutionHandler}, which can be fully customized using the {@link I_CmsLinkSubstitutionHandler} interface.<p> @param cms the current OpenCms user context @param link the link to process which is assumed to point to a VFS resource, with optional parameters @return a link <i>from</i> the URI stored in the provided OpenCms user context <i>to</i> the VFS resource indicated by the given <code>link</code> in the current site
[ "Returns", "a", "link", "<i", ">", "from<", "/", "i", ">", "the", "URI", "stored", "in", "the", "provided", "OpenCms", "user", "context", "<i", ">", "to<", "/", "i", ">", "the", "VFS", "resource", "indicated", "by", "the", "given", "<code", ">", "lin...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkManager.java#L682-L685
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSearchReplaceThread.java
CmsSearchReplaceThread.replaceInContent
private byte[] replaceInContent( CmsObject cmsObject, I_CmsReport report, CmsFile file, byte[] contents, boolean replace) throws Exception { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_settings.getLocale())) { Locale contentLocale = CmsLocaleManager.getMainLocale(cmsObject, file); if (!contentLocale.toString().equalsIgnoreCase(m_settings.getLocale())) { // content does not match the requested locale, skip it report.println( Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0), I_CmsReport.FORMAT_NOTE); return null; } } String encoding = CmsLocaleManager.getResourceEncoding(cmsObject, file); String content = new String(contents, encoding); Matcher matcher; matcher = Pattern.compile(m_settings.getSearchpattern()).matcher(content); if (matcher.find()) { // search pattern did match here, so take this file in the list with matches resources m_matchedResources.add(file); report.println(Messages.get().container(Messages.RPT_SOURCESEARCH_MATCHED_0), I_CmsReport.FORMAT_OK); if (replace) { return matcher.replaceAll(m_settings.getReplacepattern()).getBytes(encoding); } } else { // search pattern did not match report.println(Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0), I_CmsReport.FORMAT_NOTE); } return null; }
java
private byte[] replaceInContent( CmsObject cmsObject, I_CmsReport report, CmsFile file, byte[] contents, boolean replace) throws Exception { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_settings.getLocale())) { Locale contentLocale = CmsLocaleManager.getMainLocale(cmsObject, file); if (!contentLocale.toString().equalsIgnoreCase(m_settings.getLocale())) { // content does not match the requested locale, skip it report.println( Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0), I_CmsReport.FORMAT_NOTE); return null; } } String encoding = CmsLocaleManager.getResourceEncoding(cmsObject, file); String content = new String(contents, encoding); Matcher matcher; matcher = Pattern.compile(m_settings.getSearchpattern()).matcher(content); if (matcher.find()) { // search pattern did match here, so take this file in the list with matches resources m_matchedResources.add(file); report.println(Messages.get().container(Messages.RPT_SOURCESEARCH_MATCHED_0), I_CmsReport.FORMAT_OK); if (replace) { return matcher.replaceAll(m_settings.getReplacepattern()).getBytes(encoding); } } else { // search pattern did not match report.println(Messages.get().container(Messages.RPT_SOURCESEARCH_NOT_MATCHED_0), I_CmsReport.FORMAT_NOTE); } return null; }
[ "private", "byte", "[", "]", "replaceInContent", "(", "CmsObject", "cmsObject", ",", "I_CmsReport", "report", ",", "CmsFile", "file", ",", "byte", "[", "]", "contents", ",", "boolean", "replace", ")", "throws", "Exception", "{", "if", "(", "CmsStringUtil", "...
Performs the replacement in content.<p> @param cmsObject the cms context @param report the report to print messages to @param file the file object @param contents the byte content @param replace signals whether to execute a replacement or not @return the new content if a replacement has been performed @throws Exception if something goes wrong
[ "Performs", "the", "replacement", "in", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/sourcesearch/CmsSearchReplaceThread.java#L394-L430
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/UcsApi.java
UcsApi.setCallComment
public ApiSuccessResponse setCallComment(String id, CallCommentData callCommentData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setCallCommentWithHttpInfo(id, callCommentData); return resp.getData(); }
java
public ApiSuccessResponse setCallComment(String id, CallCommentData callCommentData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = setCallCommentWithHttpInfo(id, callCommentData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "setCallComment", "(", "String", "id", ",", "CallCommentData", "callCommentData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "setCallCommentWithHttpInfo", "(", "id", ",", "callCommentDa...
Set the comment for the call @param id id of the Interaction (required) @param callCommentData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Set", "the", "comment", "for", "the", "call" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L1785-L1788
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java
SqlFunctionUtils.splitIndex
public static String splitIndex(String str, int character, int index) { if (character > 255 || character < 1 || index < 0) { return null; } String[] values = StringUtils.splitPreserveAllTokens(str, (char) character); if (index >= values.length) { return null; } else { return values[index]; } }
java
public static String splitIndex(String str, int character, int index) { if (character > 255 || character < 1 || index < 0) { return null; } String[] values = StringUtils.splitPreserveAllTokens(str, (char) character); if (index >= values.length) { return null; } else { return values[index]; } }
[ "public", "static", "String", "splitIndex", "(", "String", "str", ",", "int", "character", ",", "int", "index", ")", "{", "if", "(", "character", ">", "255", "||", "character", "<", "1", "||", "index", "<", "0", ")", "{", "return", "null", ";", "}", ...
Split target string with custom separator and pick the index-th(start with 0) result. @param str target string. @param character int value of the separator character @param index index of the result which you want. @return the string at the index of split results.
[ "Split", "target", "string", "with", "custom", "separator", "and", "pick", "the", "index", "-", "th", "(", "start", "with", "0", ")", "result", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlFunctionUtils.java#L330-L340
alkacon/opencms-core
src/org/opencms/ui/components/categoryselect/CmsCategoryTree.java
CmsCategoryTree.loadCategories
void loadCategories(CmsObject cms, String contextPath) { m_checkboxes.clear(); m_container.removeAllItems(); List<CmsCategory> categories; Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); CmsCategoryService catService = CmsCategoryService.getInstance(); // get the categories try { categories = catService.readCategories(cms, "", true, contextPath); categories = catService.localizeCategories(cms, categories, wpLocale); setCategories(categories); } catch (CmsException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
java
void loadCategories(CmsObject cms, String contextPath) { m_checkboxes.clear(); m_container.removeAllItems(); List<CmsCategory> categories; Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); CmsCategoryService catService = CmsCategoryService.getInstance(); // get the categories try { categories = catService.readCategories(cms, "", true, contextPath); categories = catService.localizeCategories(cms, categories, wpLocale); setCategories(categories); } catch (CmsException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
[ "void", "loadCategories", "(", "CmsObject", "cms", ",", "String", "contextPath", ")", "{", "m_checkboxes", ".", "clear", "(", ")", ";", "m_container", ".", "removeAllItems", "(", ")", ";", "List", "<", "CmsCategory", ">", "categories", ";", "Locale", "wpLoca...
Loads the categories for the given context path.<p> @param cms the cms context @param contextPath the context path
[ "Loads", "the", "categories", "for", "the", "given", "context", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/categoryselect/CmsCategoryTree.java#L213-L231
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/DirectoryResourceFileSource.java
DirectoryResourceFileSource.populateFileList
private void populateFileList(ResourceFileList list, File root, boolean recurse) throws IOException { if(root.isDirectory()) { File[] files = root.listFiles(); if(files != null) { for(File file : files) { if(file.isFile() && filter.accept(root, file.getName())) { ResourceFileLocation location = new ResourceFileLocation( file.getName(),file.getAbsolutePath()); list.add(location); } else if(recurse && file.isDirectory()){ populateFileList(list, file, recurse); } } } } else { LOGGER.warning(root.getAbsolutePath() + " is not a directory."); return; } }
java
private void populateFileList(ResourceFileList list, File root, boolean recurse) throws IOException { if(root.isDirectory()) { File[] files = root.listFiles(); if(files != null) { for(File file : files) { if(file.isFile() && filter.accept(root, file.getName())) { ResourceFileLocation location = new ResourceFileLocation( file.getName(),file.getAbsolutePath()); list.add(location); } else if(recurse && file.isDirectory()){ populateFileList(list, file, recurse); } } } } else { LOGGER.warning(root.getAbsolutePath() + " is not a directory."); return; } }
[ "private", "void", "populateFileList", "(", "ResourceFileList", "list", ",", "File", "root", ",", "boolean", "recurse", ")", "throws", "IOException", "{", "if", "(", "root", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "files", "=", "root", ...
add all files matching this.filter beneath root to list, recursing if recurse is set. @param list @param root @param recurse @throws IOException
[ "add", "all", "files", "matching", "this", ".", "filter", "beneath", "root", "to", "list", "recursing", "if", "recurse", "is", "set", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/DirectoryResourceFileSource.java#L68-L87
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java
ODataRendererUtils.buildContextUrlFromOperationCall
public static String buildContextUrlFromOperationCall(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) { String serviceRoot = oDataUri.serviceRoot(); String returnType = ODataUriUtil.getOperationReturnType(oDataUri, entityDataModel); return serviceRoot + "/" + METADATA + "#" + returnType + (isPrimitive ? "" : "/$entity"); }
java
public static String buildContextUrlFromOperationCall(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) { String serviceRoot = oDataUri.serviceRoot(); String returnType = ODataUriUtil.getOperationReturnType(oDataUri, entityDataModel); return serviceRoot + "/" + METADATA + "#" + returnType + (isPrimitive ? "" : "/$entity"); }
[ "public", "static", "String", "buildContextUrlFromOperationCall", "(", "ODataUri", "oDataUri", ",", "EntityDataModel", "entityDataModel", ",", "boolean", "isPrimitive", ")", "{", "String", "serviceRoot", "=", "oDataUri", ".", "serviceRoot", "(", ")", ";", "String", ...
Builds the 'Context URL' when the request is an action or function call. @param oDataUri The odata uri @param entityDataModel The entity data model. @param isPrimitive True if the context URL is for primitive. @return The built 'Context URL'. @see <a href= "http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793671"> OData Version 4.0 Part 1: Protocol, paragraph 10.16</a>
[ "Builds", "the", "Context", "URL", "when", "the", "request", "is", "an", "action", "or", "function", "call", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L90-L95
graknlabs/grakn
server/src/server/session/optimisation/JanusPreviousPropertyStepStrategy.java
JanusPreviousPropertyStepStrategy.executeStrategy
private void executeStrategy( Traversal.Admin<?, ?> traversal, GraphStep<?, ?> graphStep, TraversalFilterStep<Vertex> filterStep, String propertyKey, String label) { JanusPreviousPropertyStep newStep = new JanusPreviousPropertyStep(traversal, propertyKey, label); traversal.removeStep(filterStep); TraversalHelper.replaceStep(graphStep, newStep, traversal); }
java
private void executeStrategy( Traversal.Admin<?, ?> traversal, GraphStep<?, ?> graphStep, TraversalFilterStep<Vertex> filterStep, String propertyKey, String label) { JanusPreviousPropertyStep newStep = new JanusPreviousPropertyStep(traversal, propertyKey, label); traversal.removeStep(filterStep); TraversalHelper.replaceStep(graphStep, newStep, traversal); }
[ "private", "void", "executeStrategy", "(", "Traversal", ".", "Admin", "<", "?", ",", "?", ">", "traversal", ",", "GraphStep", "<", "?", ",", "?", ">", "graphStep", ",", "TraversalFilterStep", "<", "Vertex", ">", "filterStep", ",", "String", "propertyKey", ...
Replace the {@code graphStep} and {@code filterStep} with a new {@link JanusPreviousPropertyStep} in the given {@code traversal}.
[ "Replace", "the", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/session/optimisation/JanusPreviousPropertyStepStrategy.java#L111-L118
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getRegexEntityRoleAsync
public Observable<EntityRole> getRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return getRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
java
public Observable<EntityRole> getRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return getRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() { @Override public EntityRole call(ServiceResponse<EntityRole> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EntityRole", ">", "getRegexEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "getRegexEntityRoleWithServiceResponseAsync", "(", "appId", ",", "version...
Get one entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity ID. @param roleId entity role ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EntityRole object
[ "Get", "one", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11980-L11987
koendeschacht/bow-utils
src/main/java/be/bagofwords/util/SerializationUtils.java
SerializationUtils.readObject
public static <T> T readObject(Class<T> _class, InputStream inputStream) { try { return defaultObjectMapper.readValue(inputStream, _class); } catch (IOException exp) { throw new RuntimeException("Failed to read object from inputstream", exp); } }
java
public static <T> T readObject(Class<T> _class, InputStream inputStream) { try { return defaultObjectMapper.readValue(inputStream, _class); } catch (IOException exp) { throw new RuntimeException("Failed to read object from inputstream", exp); } }
[ "public", "static", "<", "T", ">", "T", "readObject", "(", "Class", "<", "T", ">", "_class", ",", "InputStream", "inputStream", ")", "{", "try", "{", "return", "defaultObjectMapper", ".", "readValue", "(", "inputStream", ",", "_class", ")", ";", "}", "ca...
Careful! Not compatible with above method to convert objects to byte arrays!
[ "Careful!", "Not", "compatible", "with", "above", "method", "to", "convert", "objects", "to", "byte", "arrays!" ]
train
https://github.com/koendeschacht/bow-utils/blob/f599da17cb7a40b8ffc5610a9761fa922e99d7cb/src/main/java/be/bagofwords/util/SerializationUtils.java#L367-L373
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.escapePropertiesKey
public static String escapePropertiesKey(final String text, final PropertiesKeyEscapeLevel level) { if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } return PropertiesKeyEscapeUtil.escape(text, level); }
java
public static String escapePropertiesKey(final String text, final PropertiesKeyEscapeLevel level) { if (level == null) { throw new IllegalArgumentException("The 'level' argument cannot be null"); } return PropertiesKeyEscapeUtil.escape(text, level); }
[ "public", "static", "String", "escapePropertiesKey", "(", "final", "String", "text", ",", "final", "PropertiesKeyEscapeLevel", "level", ")", "{", "if", "(", "level", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The 'level' argument can...
<p> Perform a (configurable) Java Properties Key <strong>escape</strong> operation on a <tt>String</tt> input. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.properties.PropertiesKeyEscapeLevel} argument value. </p> <p> All other <tt>String</tt>-based <tt>escapePropertiesKey*(...)</tt> methods call this one with preconfigured <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param level the escape level to be applied, see {@link org.unbescape.properties.PropertiesKeyEscapeLevel}. @return The escaped result <tt>String</tt>. As a memory-performance improvement, will return the exact same object as the <tt>text</tt> input argument if no escaping modifications were required (and no additional <tt>String</tt> objects will be created during processing). Will return <tt>null</tt> if input is <tt>null</tt>.
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "Java", "Properties", "Key", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "me...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L882-L889
JetBrains/xodus
openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java
EnvironmentConfig.setTreeDupMaxPageSize
public EnvironmentConfig setTreeDupMaxPageSize(final int pageSize) throws InvalidSettingException { if (pageSize < 8 || pageSize > 128) { throw new InvalidSettingException("Invalid dup tree page size: " + pageSize); } return setSetting(TREE_DUP_MAX_PAGE_SIZE, pageSize); }
java
public EnvironmentConfig setTreeDupMaxPageSize(final int pageSize) throws InvalidSettingException { if (pageSize < 8 || pageSize > 128) { throw new InvalidSettingException("Invalid dup tree page size: " + pageSize); } return setSetting(TREE_DUP_MAX_PAGE_SIZE, pageSize); }
[ "public", "EnvironmentConfig", "setTreeDupMaxPageSize", "(", "final", "int", "pageSize", ")", "throws", "InvalidSettingException", "{", "if", "(", "pageSize", "<", "8", "||", "pageSize", ">", "128", ")", "{", "throw", "new", "InvalidSettingException", "(", "\"Inva...
Sets the maximum size of page of duplicates sub-B+Tree. Default value is {@code 8}. Only sizes in the range [8..128] are accepted. <p>Mutable at runtime: yes @param pageSize maximum size of page of duplicates sub-B+Tree @return this {@code EnvironmentConfig} instance @throws InvalidSettingException page size is not in the range [8..128]
[ "Sets", "the", "maximum", "size", "of", "page", "of", "duplicates", "sub", "-", "B", "+", "Tree", ".", "Default", "value", "is", "{", "@code", "8", "}", ".", "Only", "sizes", "in", "the", "range", "[", "8", "..", "128", "]", "are", "accepted", ".",...
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L1748-L1753
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobSynchronizer.java
BlobSynchronizer.updateKeySetForBlobStore
private void updateKeySetForBlobStore(Set<String> keySetBlobStore, CuratorFramework zkClient) { try { for (String key : keySetBlobStore) { LOG.debug("updating blob"); BlobStoreUtils.updateKeyForBlobStore(conf, blobStore, zkClient, key, nimbusInfo); } } catch (Exception exp) { throw new RuntimeException(exp); } }
java
private void updateKeySetForBlobStore(Set<String> keySetBlobStore, CuratorFramework zkClient) { try { for (String key : keySetBlobStore) { LOG.debug("updating blob"); BlobStoreUtils.updateKeyForBlobStore(conf, blobStore, zkClient, key, nimbusInfo); } } catch (Exception exp) { throw new RuntimeException(exp); } }
[ "private", "void", "updateKeySetForBlobStore", "(", "Set", "<", "String", ">", "keySetBlobStore", ",", "CuratorFramework", "zkClient", ")", "{", "try", "{", "for", "(", "String", "key", ":", "keySetBlobStore", ")", "{", "LOG", ".", "debug", "(", "\"updating bl...
Update current key list inside the blobstore if the version changes
[ "Update", "current", "key", "list", "inside", "the", "blobstore", "if", "the", "version", "changes" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/blobstore/BlobSynchronizer.java#L110-L119
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java
PayloadSender.handleFinishSendingPayload
private synchronized void handleFinishSendingPayload(PayloadData payload, boolean cancelled, String errorMessage, int responseCode, JSONObject responseData) { sendingFlag = false; // mark sender as 'not busy' try { if (listener != null) { listener.onFinishSending(this, payload, cancelled, errorMessage, responseCode, responseData); } } catch (Exception e) { ApptentiveLog.e(e, "Exception while notifying payload listener"); logException(e); } }
java
private synchronized void handleFinishSendingPayload(PayloadData payload, boolean cancelled, String errorMessage, int responseCode, JSONObject responseData) { sendingFlag = false; // mark sender as 'not busy' try { if (listener != null) { listener.onFinishSending(this, payload, cancelled, errorMessage, responseCode, responseData); } } catch (Exception e) { ApptentiveLog.e(e, "Exception while notifying payload listener"); logException(e); } }
[ "private", "synchronized", "void", "handleFinishSendingPayload", "(", "PayloadData", "payload", ",", "boolean", "cancelled", ",", "String", "errorMessage", ",", "int", "responseCode", ",", "JSONObject", "responseData", ")", "{", "sendingFlag", "=", "false", ";", "//...
Executed when we're done with the current payload @param payload - current payload @param cancelled - flag indicating if payload Http-request was cancelled @param errorMessage - if not <code>null</code> - payload request failed @param responseCode - http-request response code @param responseData - http-reqeust response json (or null if failed)
[ "Executed", "when", "we", "re", "done", "with", "the", "current", "payload" ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/storage/PayloadSender.java#L156-L167
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/spi/algorithm/TypeBasedSPIServiceLoader.java
TypeBasedSPIServiceLoader.newService
public final T newService(final String type, final Properties props) { Collection<T> typeBasedServices = loadTypeBasedServices(type); if (typeBasedServices.isEmpty()) { throw new ShardingConfigurationException("Invalid `%s` SPI type `%s`.", classType.getName(), type); } T result = typeBasedServices.iterator().next(); result.setProperties(props); return result; }
java
public final T newService(final String type, final Properties props) { Collection<T> typeBasedServices = loadTypeBasedServices(type); if (typeBasedServices.isEmpty()) { throw new ShardingConfigurationException("Invalid `%s` SPI type `%s`.", classType.getName(), type); } T result = typeBasedServices.iterator().next(); result.setProperties(props); return result; }
[ "public", "final", "T", "newService", "(", "final", "String", "type", ",", "final", "Properties", "props", ")", "{", "Collection", "<", "T", ">", "typeBasedServices", "=", "loadTypeBasedServices", "(", "type", ")", ";", "if", "(", "typeBasedServices", ".", "...
Create new instance for type based SPI. @param type SPI type @param props SPI properties @return SPI instance
[ "Create", "new", "instance", "for", "type", "based", "SPI", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/spi/algorithm/TypeBasedSPIServiceLoader.java#L50-L58
ZuInnoTe/hadoopoffice
flinkds/src/main/java/org/zuinnote/flink/office/common/FlinkKeyStoreManager.java
FlinkKeyStoreManager.openKeyStore
public void openKeyStore(Path path, String keyStoreType, String keyStorePassword) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException { this.keystore = KeyStore.getInstance(keyStoreType); if (path!=null) { InputStream keyStoreInputStream = ffr.openFile(path); this.keystore.load(keyStoreInputStream, keyStorePassword.toCharArray()); } else { this.keystore.load(null, keyStorePassword.toCharArray()); } }
java
public void openKeyStore(Path path, String keyStoreType, String keyStorePassword) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException { this.keystore = KeyStore.getInstance(keyStoreType); if (path!=null) { InputStream keyStoreInputStream = ffr.openFile(path); this.keystore.load(keyStoreInputStream, keyStorePassword.toCharArray()); } else { this.keystore.load(null, keyStorePassword.toCharArray()); } }
[ "public", "void", "openKeyStore", "(", "Path", "path", ",", "String", "keyStoreType", ",", "String", "keyStorePassword", ")", "throws", "IOException", ",", "NoSuchAlgorithmException", ",", "CertificateException", ",", "KeyStoreException", "{", "this", ".", "keystore",...
** Opens a keystore on any Hadoop compatible filesystem @param path path to key store, if null then a new keystore is created @param keyStoreType @param keyStorePassword @throws IOException @throws NoSuchAlgorithmException @throws CertificateException @throws KeyStoreException
[ "**", "Opens", "a", "keystore", "on", "any", "Hadoop", "compatible", "filesystem" ]
train
https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/flinkds/src/main/java/org/zuinnote/flink/office/common/FlinkKeyStoreManager.java#L69-L77
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setClob
@Override public void setClob(int parameterIndex, Clob x) throws SQLException { internalStmt.setClob(parameterIndex, x); }
java
@Override public void setClob(int parameterIndex, Clob x) throws SQLException { internalStmt.setClob(parameterIndex, x); }
[ "@", "Override", "public", "void", "setClob", "(", "int", "parameterIndex", ",", "Clob", "x", ")", "throws", "SQLException", "{", "internalStmt", ".", "setClob", "(", "parameterIndex", ",", "x", ")", ";", "}" ]
Method setClob. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setClob(int, Clob)
[ "Method", "setClob", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L671-L674
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_delegation_target_GET
public OvhReverseDelegation ip_delegation_target_GET(String ip, String target) throws IOException { String qPath = "/ip/{ip}/delegation/{target}"; StringBuilder sb = path(qPath, ip, target); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhReverseDelegation.class); }
java
public OvhReverseDelegation ip_delegation_target_GET(String ip, String target) throws IOException { String qPath = "/ip/{ip}/delegation/{target}"; StringBuilder sb = path(qPath, ip, target); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhReverseDelegation.class); }
[ "public", "OvhReverseDelegation", "ip_delegation_target_GET", "(", "String", "ip", ",", "String", "target", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/delegation/{target}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip...
Get this object properties REST: GET /ip/{ip}/delegation/{target} @param ip [required] @param target [required] NS target for delegation
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L112-L117
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.unlockSourceAndCopy
private void unlockSourceAndCopy(File sourceFile, File copyFile) { ReadWriteLock sourceLock = sourceFile.contentLock(); if (sourceLock != null) { sourceLock.readLock().unlock(); } ReadWriteLock copyLock = copyFile.contentLock(); if (copyLock != null) { copyLock.writeLock().unlock(); } sourceFile.closed(); }
java
private void unlockSourceAndCopy(File sourceFile, File copyFile) { ReadWriteLock sourceLock = sourceFile.contentLock(); if (sourceLock != null) { sourceLock.readLock().unlock(); } ReadWriteLock copyLock = copyFile.contentLock(); if (copyLock != null) { copyLock.writeLock().unlock(); } sourceFile.closed(); }
[ "private", "void", "unlockSourceAndCopy", "(", "File", "sourceFile", ",", "File", "copyFile", ")", "{", "ReadWriteLock", "sourceLock", "=", "sourceFile", ".", "contentLock", "(", ")", ";", "if", "(", "sourceLock", "!=", "null", ")", "{", "sourceLock", ".", "...
Unlocks source and copy files after copying content. Also closes the source file so its content can be deleted if it was deleted.
[ "Unlocks", "source", "and", "copy", "files", "after", "copying", "content", ".", "Also", "closes", "the", "source", "file", "so", "its", "content", "can", "be", "deleted", "if", "it", "was", "deleted", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L682-L692
google/auto
common/src/main/java/com/google/auto/common/MoreElements.java
MoreElements.getLocalAndInheritedMethods
@Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); }
java
@Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); }
[ "@", "Deprecated", "public", "static", "ImmutableSet", "<", "ExecutableElement", ">", "getLocalAndInheritedMethods", "(", "TypeElement", "type", ",", "Elements", "elementUtils", ")", "{", "Overrides", "overrides", "=", "new", "Overrides", ".", "NativeOverrides", "(", ...
Returns the set of all non-private methods from {@code type}, including methods that it inherits from its ancestors. Inherited methods that are overridden are not included in the result. So if {@code type} defines {@code public String toString()}, the returned set will contain that method, but not the {@code toString()} method defined by {@code Object}. <p>The returned set may contain more than one method with the same signature, if {@code type} inherits those methods from different ancestors. For example, if it inherits from unrelated interfaces {@code One} and {@code Two} which each define {@code void foo();}, and if it does not itself override the {@code foo()} method, then both {@code One.foo()} and {@code Two.foo()} will be in the returned set. @param type the type whose own and inherited methods are to be returned @param elementUtils an {@link Elements} object, typically returned by {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!-- -->.{@link javax.annotation.processing.ProcessingEnvironment#getElementUtils getElementUtils()} @deprecated The method {@link #getLocalAndInheritedMethods(TypeElement, Types, Elements)} has better consistency between Java compilers.
[ "Returns", "the", "set", "of", "all", "non", "-", "private", "methods", "from", "{", "@code", "type", "}", "including", "methods", "that", "it", "inherits", "from", "its", "ancestors", ".", "Inherited", "methods", "that", "are", "overridden", "are", "not", ...
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/MoreElements.java#L300-L305
orbisgis/h2gis
h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java
SFSUtilities.getSRID
public static int getSRID(Connection connection, TableLocation table) throws SQLException { ResultSet geomResultSet = getGeometryColumnsView(connection, table.getCatalog(), table.getSchema(), table.getTable()); int srid = 0; while (geomResultSet.next()) { srid = geomResultSet.getInt("srid"); break; } geomResultSet.close(); return srid; }
java
public static int getSRID(Connection connection, TableLocation table) throws SQLException { ResultSet geomResultSet = getGeometryColumnsView(connection, table.getCatalog(), table.getSchema(), table.getTable()); int srid = 0; while (geomResultSet.next()) { srid = geomResultSet.getInt("srid"); break; } geomResultSet.close(); return srid; }
[ "public", "static", "int", "getSRID", "(", "Connection", "connection", ",", "TableLocation", "table", ")", "throws", "SQLException", "{", "ResultSet", "geomResultSet", "=", "getGeometryColumnsView", "(", "connection", ",", "table", ".", "getCatalog", "(", ")", ","...
Return the SRID of the first geometry column of the input table @param connection Active connection @param table Table name @return The SRID of the first geometry column @throws SQLException
[ "Return", "the", "SRID", "of", "the", "first", "geometry", "column", "of", "the", "input", "table" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/SFSUtilities.java#L491-L501
DV8FromTheWorld/JDA
src/main/java/com/iwebpp/crypto/TweetNaclFast.java
Box.open
public byte [] open(byte [] box) { if (box==null) return null; // prepare shared key if (this.sharedKey == null) before(); return open_after(box, 0, box.length); }
java
public byte [] open(byte [] box) { if (box==null) return null; // prepare shared key if (this.sharedKey == null) before(); return open_after(box, 0, box.length); }
[ "public", "byte", "[", "]", "open", "(", "byte", "[", "]", "box", ")", "{", "if", "(", "box", "==", "null", ")", "return", "null", ";", "// prepare shared key", "if", "(", "this", ".", "sharedKey", "==", "null", ")", "before", "(", ")", ";", "retur...
/* @description Authenticates and decrypts the given box with peer's public key, our secret key, and the given nonce. Returns the original message, or null if authentication fails.
[ "/", "*", "@description", "Authenticates", "and", "decrypts", "the", "given", "box", "with", "peer", "s", "public", "key", "our", "secret", "key", "and", "the", "given", "nonce", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/com/iwebpp/crypto/TweetNaclFast.java#L146-L153
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java
ValueFilter.createValueFilter
public static ValueFilter createValueFilter(String operation, Double value) { checkArgument(LONG_DOUBLE_SUPPORTED_OPERATION.contains(operation), "Double value only support operations in " + LONG_DOUBLE_SUPPORTED_OPERATION.toString()); ValueFilter valueFilter = new ValueFilter(operation, String.valueOf(value)); return valueFilter; }
java
public static ValueFilter createValueFilter(String operation, Double value) { checkArgument(LONG_DOUBLE_SUPPORTED_OPERATION.contains(operation), "Double value only support operations in " + LONG_DOUBLE_SUPPORTED_OPERATION.toString()); ValueFilter valueFilter = new ValueFilter(operation, String.valueOf(value)); return valueFilter; }
[ "public", "static", "ValueFilter", "createValueFilter", "(", "String", "operation", ",", "Double", "value", ")", "{", "checkArgument", "(", "LONG_DOUBLE_SUPPORTED_OPERATION", ".", "contains", "(", "operation", ")", ",", "\"Double value only support operations in \"", "+",...
Create value filter for Double type. @param operation Operation for comparing which support =, !=, &gt;, &lt;, &gt;= and &lt;=. @param value Value for comparing with. @return ValueFilter
[ "Create", "value", "filter", "for", "Double", "type", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/ValueFilter.java#L93-L98
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.open
public static Anima open(String url, Quirks quirks) { return open(url, null, null, quirks); }
java
public static Anima open(String url, Quirks quirks) { return open(url, null, null, quirks); }
[ "public", "static", "Anima", "open", "(", "String", "url", ",", "Quirks", "quirks", ")", "{", "return", "open", "(", "url", ",", "null", ",", "null", ",", "quirks", ")", ";", "}" ]
Create anima with url, like Sqlite or h2 @param url jdbc url @return Anima
[ "Create", "anima", "with", "url", "like", "Sqlite", "or", "h2" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L167-L169
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java
GVRPose.getWorldRotation
public void getWorldRotation(int boneindex, Quaternionf q) { Bone bone = mBones[boneindex]; if ((bone.Changed & LOCAL_ROT) == LOCAL_ROT) { calcWorld(bone, mSkeleton.getParentBoneIndex(boneindex)); } bone.WorldMatrix.getUnnormalizedRotation(q); q.normalize(); }
java
public void getWorldRotation(int boneindex, Quaternionf q) { Bone bone = mBones[boneindex]; if ((bone.Changed & LOCAL_ROT) == LOCAL_ROT) { calcWorld(bone, mSkeleton.getParentBoneIndex(boneindex)); } bone.WorldMatrix.getUnnormalizedRotation(q); q.normalize(); }
[ "public", "void", "getWorldRotation", "(", "int", "boneindex", ",", "Quaternionf", "q", ")", "{", "Bone", "bone", "=", "mBones", "[", "boneindex", "]", ";", "if", "(", "(", "bone", ".", "Changed", "&", "LOCAL_ROT", ")", "==", "LOCAL_ROT", ")", "{", "ca...
Gets the world location of a bone (relative to hierarchy root). <p> @param boneindex zero based index of bone whose rotation is wanted. @return world rotation for the designated bone as a quaternion. @see #setWorldRotation @see #setWorldRotations @see #setWorldMatrix @see GVRSkeleton#setBoneAxis
[ "Gets", "the", "world", "location", "of", "a", "bone", "(", "relative", "to", "hierarchy", "root", ")", ".", "<p", ">", "@param", "boneindex", "zero", "based", "index", "of", "bone", "whose", "rotation", "is", "wanted", ".", "@return", "world", "rotation",...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L430-L440
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java
LocalTime.withSecond
public LocalTime withSecond(int second) { if (this.second == second) { return this; } SECOND_OF_MINUTE.checkValidValue(second); return create(hour, minute, second, nano); }
java
public LocalTime withSecond(int second) { if (this.second == second) { return this; } SECOND_OF_MINUTE.checkValidValue(second); return create(hour, minute, second, nano); }
[ "public", "LocalTime", "withSecond", "(", "int", "second", ")", "{", "if", "(", "this", ".", "second", "==", "second", ")", "{", "return", "this", ";", "}", "SECOND_OF_MINUTE", ".", "checkValidValue", "(", "second", ")", ";", "return", "create", "(", "ho...
Returns a copy of this {@code LocalTime} with the second-of-minute altered. <p> This instance is immutable and unaffected by this method call. @param second the second-of-minute to set in the result, from 0 to 59 @return a {@code LocalTime} based on this time with the requested second, not null @throws DateTimeException if the second value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalTime", "}", "with", "the", "second", "-", "of", "-", "minute", "altered", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L897-L903
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java
ExposeLinearLayoutManagerEx.recycleByLayoutStateExpose
private void recycleByLayoutStateExpose(RecyclerView.Recycler recycler, LayoutState layoutState) { if (!layoutState.mRecycle) { return; } if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { recycleViewsFromEndExpose(recycler, layoutState.mScrollingOffset); } else { recycleViewsFromStartExpose(recycler, layoutState.mScrollingOffset); } }
java
private void recycleByLayoutStateExpose(RecyclerView.Recycler recycler, LayoutState layoutState) { if (!layoutState.mRecycle) { return; } if (layoutState.mLayoutDirection == LayoutState.LAYOUT_START) { recycleViewsFromEndExpose(recycler, layoutState.mScrollingOffset); } else { recycleViewsFromStartExpose(recycler, layoutState.mScrollingOffset); } }
[ "private", "void", "recycleByLayoutStateExpose", "(", "RecyclerView", ".", "Recycler", "recycler", ",", "LayoutState", "layoutState", ")", "{", "if", "(", "!", "layoutState", ".", "mRecycle", ")", "{", "return", ";", "}", "if", "(", "layoutState", ".", "mLayou...
Helper method to call appropriate recycle method depending on current layout direction @param recycler Current recycler that is attached to RecyclerView @param layoutState Current layout state. Right now, this object does not change but we may consider moving it out of this view so passing around as a parameter for now, rather than accessing {@link #mLayoutState} @see #recycleViewsFromStartExpose(RecyclerView.Recycler, int) @see #recycleViewsFromEndExpose(RecyclerView.Recycler, int) @see LinearLayoutManager.LayoutState#mLayoutDirection
[ "Helper", "method", "to", "call", "appropriate", "recycle", "method", "depending", "on", "current", "layout", "direction" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java#L1122-L1131
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.constructDuplicatePathSql
private String constructDuplicatePathSql(SqlgGraph sqlgGraph, List<LinkedList<SchemaTableTree>> subQueryLinkedLists, Set<SchemaTableTree> leftJoinOn) { StringBuilder singlePathSql = new StringBuilder("\nFROM ("); int count = 1; SchemaTableTree lastOfPrevious = null; for (LinkedList<SchemaTableTree> subQueryLinkedList : subQueryLinkedLists) { SchemaTableTree firstOfNext = null; boolean last = count == subQueryLinkedLists.size(); if (!last) { //this is to get the next SchemaTable to join to LinkedList<SchemaTableTree> nextList = subQueryLinkedLists.get(count); firstOfNext = nextList.getFirst(); } SchemaTableTree firstSchemaTableTree = subQueryLinkedList.getFirst(); String sql; if (last) { //only the last step must have dropStep as true. As only the outer select needs only an ID in the select sql = constructSinglePathSql(sqlgGraph, true, subQueryLinkedList, lastOfPrevious, null, leftJoinOn, false); } else { sql = constructSinglePathSql(sqlgGraph, true, subQueryLinkedList, lastOfPrevious, firstOfNext); } singlePathSql.append(sql); if (count == 1) { singlePathSql.append("\n) a").append(count++).append(" INNER JOIN ("); } else { //join the last with the first singlePathSql.append("\n) a").append(count).append(" ON "); singlePathSql.append(constructSectionedJoin(sqlgGraph, lastOfPrevious, firstSchemaTableTree, count)); if (count++ < subQueryLinkedLists.size()) { singlePathSql.append(" INNER JOIN ("); } } lastOfPrevious = subQueryLinkedList.getLast(); } singlePathSql.append(constructOuterOrderByClause(sqlgGraph, subQueryLinkedLists)); String result = "SELECT\n\t" + constructOuterFromClause(subQueryLinkedLists); return result + singlePathSql; }
java
private String constructDuplicatePathSql(SqlgGraph sqlgGraph, List<LinkedList<SchemaTableTree>> subQueryLinkedLists, Set<SchemaTableTree> leftJoinOn) { StringBuilder singlePathSql = new StringBuilder("\nFROM ("); int count = 1; SchemaTableTree lastOfPrevious = null; for (LinkedList<SchemaTableTree> subQueryLinkedList : subQueryLinkedLists) { SchemaTableTree firstOfNext = null; boolean last = count == subQueryLinkedLists.size(); if (!last) { //this is to get the next SchemaTable to join to LinkedList<SchemaTableTree> nextList = subQueryLinkedLists.get(count); firstOfNext = nextList.getFirst(); } SchemaTableTree firstSchemaTableTree = subQueryLinkedList.getFirst(); String sql; if (last) { //only the last step must have dropStep as true. As only the outer select needs only an ID in the select sql = constructSinglePathSql(sqlgGraph, true, subQueryLinkedList, lastOfPrevious, null, leftJoinOn, false); } else { sql = constructSinglePathSql(sqlgGraph, true, subQueryLinkedList, lastOfPrevious, firstOfNext); } singlePathSql.append(sql); if (count == 1) { singlePathSql.append("\n) a").append(count++).append(" INNER JOIN ("); } else { //join the last with the first singlePathSql.append("\n) a").append(count).append(" ON "); singlePathSql.append(constructSectionedJoin(sqlgGraph, lastOfPrevious, firstSchemaTableTree, count)); if (count++ < subQueryLinkedLists.size()) { singlePathSql.append(" INNER JOIN ("); } } lastOfPrevious = subQueryLinkedList.getLast(); } singlePathSql.append(constructOuterOrderByClause(sqlgGraph, subQueryLinkedLists)); String result = "SELECT\n\t" + constructOuterFromClause(subQueryLinkedLists); return result + singlePathSql; }
[ "private", "String", "constructDuplicatePathSql", "(", "SqlgGraph", "sqlgGraph", ",", "List", "<", "LinkedList", "<", "SchemaTableTree", ">", ">", "subQueryLinkedLists", ",", "Set", "<", "SchemaTableTree", ">", "leftJoinOn", ")", "{", "StringBuilder", "singlePathSql",...
Construct a sql statement for one original path to a leaf node. As the path contains the same label more than once its been split into a List of Stacks.
[ "Construct", "a", "sql", "statement", "for", "one", "original", "path", "to", "a", "leaf", "node", ".", "As", "the", "path", "contains", "the", "same", "label", "more", "than", "once", "its", "been", "split", "into", "a", "List", "of", "Stacks", "." ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L523-L560
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.eachKeyLike
public LambdaDslObject eachKeyLike(String exampleKey, PactDslJsonRootValue value) { object.eachKeyLike(exampleKey, value); return this; }
java
public LambdaDslObject eachKeyLike(String exampleKey, PactDslJsonRootValue value) { object.eachKeyLike(exampleKey, value); return this; }
[ "public", "LambdaDslObject", "eachKeyLike", "(", "String", "exampleKey", ",", "PactDslJsonRootValue", "value", ")", "{", "object", ".", "eachKeyLike", "(", "exampleKey", ",", "value", ")", ";", "return", "this", ";", "}" ]
Accepts any key, and each key is mapped to a map that must match the provided object definition Note: this needs the Java system property "pact.matching.wildcard" set to value "true" when the pact file is verified. @param exampleKey Example key to use for generating bodies @param value Value to use for matching and generated bodies
[ "Accepts", "any", "key", "and", "each", "key", "is", "mapped", "to", "a", "map", "that", "must", "match", "the", "provided", "object", "definition", "Note", ":", "this", "needs", "the", "Java", "system", "property", "pact", ".", "matching", ".", "wildcard"...
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L679-L682
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcActionElement.java
CmsUgcActionElement.createSessionForResource
public String createSessionForResource(String configPath, String fileName) throws CmsUgcException { CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile( getCmsObject(), getRequest(), configPath, fileName); return "" + formSession.getId(); }
java
public String createSessionForResource(String configPath, String fileName) throws CmsUgcException { CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile( getCmsObject(), getRequest(), configPath, fileName); return "" + formSession.getId(); }
[ "public", "String", "createSessionForResource", "(", "String", "configPath", ",", "String", "fileName", ")", "throws", "CmsUgcException", "{", "CmsUgcSession", "formSession", "=", "CmsUgcSessionFactory", ".", "getInstance", "(", ")", ".", "createSessionForFile", "(", ...
Creates a new form session to edit the file with the given name using the given form configuration. @param configPath the site path of the form configuration @param fileName the name (not path) of the XML content to edit @return the id of the newly created form session @throws CmsUgcException if something goes wrong
[ "Creates", "a", "new", "form", "session", "to", "edit", "the", "file", "with", "the", "given", "name", "using", "the", "given", "form", "configuration", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcActionElement.java#L63-L71
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/StringHelper.java
StringHelper.makeFormattedString
public static String makeFormattedString( String aAttrName, int aInt, boolean aPrependSeparator) { StringBuffer mStrBuff = new StringBuffer(PreFormatString(aAttrName, aPrependSeparator)); mStrBuff.append(String.valueOf(aInt)); return mStrBuff.toString(); }
java
public static String makeFormattedString( String aAttrName, int aInt, boolean aPrependSeparator) { StringBuffer mStrBuff = new StringBuffer(PreFormatString(aAttrName, aPrependSeparator)); mStrBuff.append(String.valueOf(aInt)); return mStrBuff.toString(); }
[ "public", "static", "String", "makeFormattedString", "(", "String", "aAttrName", ",", "int", "aInt", ",", "boolean", "aPrependSeparator", ")", "{", "StringBuffer", "mStrBuff", "=", "new", "StringBuffer", "(", "PreFormatString", "(", "aAttrName", ",", "aPrependSepara...
Utility method that gets formatted string representing a <code>int</code>. <p> Example: aAttrName="String.valueOf(aInt)",aAttrName="String.valueOf(aInt)", etc, where the "," is controlled using the aPrependSeparator set to true. @param aAttrName A String attribute name value. @param aInt An integer value. @param aPrependSeparator A boolean value used in PreFormatString(String, boolean) to append a "," before the aAttrName value. @return A formatted String. @see #PreFormatString(String, boolean)
[ "Utility", "method", "that", "gets", "formatted", "string", "representing", "a", "<code", ">", "int<", "/", "code", ">", ".", "<p", ">", "Example", ":", "aAttrName", "=", "String", ".", "valueOf", "(", "aInt", ")", "aAttrName", "=", "String", ".", "value...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L109-L116
atomix/catalyst
serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java
Serializer.writeObject
public <T> Buffer writeObject(T object, Buffer buffer) { writeObject(object, (BufferOutput<?>) buffer); return buffer; }
java
public <T> Buffer writeObject(T object, Buffer buffer) { writeObject(object, (BufferOutput<?>) buffer); return buffer; }
[ "public", "<", "T", ">", "Buffer", "writeObject", "(", "T", "object", ",", "Buffer", "buffer", ")", "{", "writeObject", "(", "object", ",", "(", "BufferOutput", "<", "?", ">", ")", "buffer", ")", ";", "return", "buffer", ";", "}" ]
Writes an object to the given buffer. <p> Serialized bytes will be written to the given {@link Buffer} starting at its current {@link Buffer#position()}. If the bytes {@link Buffer#remaining()} in the buffer are not great enough to hold the serialized bytes, the buffer will be automatically expanded up to the buffer's {@link Buffer#maxCapacity()}. <p> The given object must have a {@link Serializer#register(Class) registered} serializer or implement {@link java.io.Serializable}. If a serializable type ID was provided during registration, the type ID will be written to the given {@link Buffer} in lieu of the class name. Types with no associated type ID will be written to the buffer with a full class name for reference during serialization. <p> Types that implement {@link CatalystSerializable} will be serialized via {@link CatalystSerializable#writeObject(BufferOutput, Serializer)} unless a {@link TypeSerializer} was explicitly registered for the type. <p> Types that implement {@link java.io.Serializable} will be serialized using Java's {@link java.io.ObjectOutputStream}. Types that implement {@link java.io.Externalizable} will be serialized via that interface's methods unless a custom {@link TypeSerializer} has been registered for the type. {@link java.io.Externalizable} types can, however, still take advantage of faster serialization of type IDs. @param object The object to write. @param buffer The buffer to which to write the object. @param <T> The object type. @return The serialized object. @throws SerializationException If no serializer is registered for the object. @see Serializer#writeObject(Object)
[ "Writes", "an", "object", "to", "the", "given", "buffer", ".", "<p", ">", "Serialized", "bytes", "will", "be", "written", "to", "the", "given", "{", "@link", "Buffer", "}", "starting", "at", "its", "current", "{", "@link", "Buffer#position", "()", "}", "...
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L811-L814
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecInfo.java
CodecInfo.getNumberOfPositions
public Integer getNumberOfPositions(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return 1 + doc.maxPosition - doc.minPosition; } } return null; }
java
public Integer getNumberOfPositions(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return 1 + doc.maxPosition - doc.minPosition; } } return null; }
[ "public", "Integer", "getNumberOfPositions", "(", "String", "field", ",", "int", "docId", ")", "{", "if", "(", "fieldReferences", ".", "containsKey", "(", "field", ")", ")", "{", "IndexDoc", "doc", "=", "getDoc", "(", "field", ",", "docId", ")", ";", "if...
Gets the number of positions. @param field the field @param docId the doc id @return the number of positions
[ "Gets", "the", "number", "of", "positions", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L643-L651
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java
KTypeArrayList.forEach
public <T extends KTypePredicate<? super KType>> T forEach(T predicate, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { if (!predicate.apply(buffer[i])) break; } return predicate; }
java
public <T extends KTypePredicate<? super KType>> T forEach(T predicate, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { if (!predicate.apply(buffer[i])) break; } return predicate; }
[ "public", "<", "T", "extends", "KTypePredicate", "<", "?", "super", "KType", ">", ">", "T", "forEach", "(", "T", "predicate", ",", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "assert", "(", "fromIndex", ">=", "0", "&&", "fromIndex", "...
Applies <code>predicate</code> to a slice of the list, <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive, or until predicate returns <code>false</code>.
[ "Applies", "<code", ">", "predicate<", "/", "code", ">", "to", "a", "slice", "of", "the", "list", "<code", ">", "fromIndex<", "/", "code", ">", "inclusive", "to", "<code", ">", "toIndex<", "/", "code", ">", "exclusive", "or", "until", "predicate", "retur...
train
https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java#L621-L636
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java
FtpFileUtil.connectAndLoginOnFTPServer
public static void connectAndLoginOnFTPServer(FTPClient ftpClient, String hostName, Integer port, String userName, String password) { try { if (port != null && port.intValue() > 0) { ftpClient.connect(hostName, port); } else { ftpClient.connect(hostName); } if (!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { throw new IOException(String.format("FTP server '%s' refused connection.", hostName)); } // try to login if (!ftpClient.login(userName, password)) { throw new IOException(String.format("Unable to login to FTP server '%s'.", hostName)); } } catch (IOException ex) { throw new RuntimeException( String.format("Unable to connect and login to FTP server '%s'. Cause: ", hostName), ex); } }
java
public static void connectAndLoginOnFTPServer(FTPClient ftpClient, String hostName, Integer port, String userName, String password) { try { if (port != null && port.intValue() > 0) { ftpClient.connect(hostName, port); } else { ftpClient.connect(hostName); } if (!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { throw new IOException(String.format("FTP server '%s' refused connection.", hostName)); } // try to login if (!ftpClient.login(userName, password)) { throw new IOException(String.format("Unable to login to FTP server '%s'.", hostName)); } } catch (IOException ex) { throw new RuntimeException( String.format("Unable to connect and login to FTP server '%s'. Cause: ", hostName), ex); } }
[ "public", "static", "void", "connectAndLoginOnFTPServer", "(", "FTPClient", "ftpClient", ",", "String", "hostName", ",", "Integer", "port", ",", "String", "userName", ",", "String", "password", ")", "{", "try", "{", "if", "(", "port", "!=", "null", "&&", "po...
Connect and login on given FTP server with provided credentials. @param hostName the FTP server host name to connect @param port the port to connect @param userName the user name @param password the password
[ "Connect", "and", "login", "on", "given", "FTP", "server", "with", "provided", "credentials", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java#L205-L225
banq/jdonframework
JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java
PageIteratorSolver.getDatas
public PageIterator getDatas(String queryParam, String sqlqueryAllCount, String sqlquery, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } Collection queryParams = new ArrayList(); if (!UtilValidate.isEmpty(queryParam)) queryParams.add(queryParam); return getPageIterator(sqlqueryAllCount, sqlquery, queryParams, start, count); }
java
public PageIterator getDatas(String queryParam, String sqlqueryAllCount, String sqlquery, int start, int count) { if (UtilValidate.isEmpty(sqlqueryAllCount)) { Debug.logError(" the parameter sqlqueryAllCount is null", module); return new PageIterator(); } if (UtilValidate.isEmpty(sqlquery)) { Debug.logError(" the parameter sqlquery is null", module); return new PageIterator(); } Collection queryParams = new ArrayList(); if (!UtilValidate.isEmpty(queryParam)) queryParams.add(queryParam); return getPageIterator(sqlqueryAllCount, sqlquery, queryParams, start, count); }
[ "public", "PageIterator", "getDatas", "(", "String", "queryParam", ",", "String", "sqlqueryAllCount", ",", "String", "sqlquery", ",", "int", "start", ",", "int", "count", ")", "{", "if", "(", "UtilValidate", ".", "isEmpty", "(", "sqlqueryAllCount", ")", ")", ...
create a PageIterator instance @param queryParam the value of sqlquery's "?" @param sqlqueryAllCount the sql for query all count that fit for condition @param sqlquery the sql for query that fit for condtion, return id collection @param start @param count @return PageIterator @throws java.lang.Exception
[ "create", "a", "PageIterator", "instance" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L168-L183
rhuss/jolokia
agent/core/src/main/java/org/jolokia/http/AgentServlet.java
AgentServlet.doOptions
@Override protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map<String,String> responseHeaders = requestHandler.handleCorsPreflightRequest( getOriginOrReferer(req), req.getHeader("Access-Control-Request-Headers")); for (Map.Entry<String,String> entry : responseHeaders.entrySet()) { resp.setHeader(entry.getKey(),entry.getValue()); } }
java
@Override protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map<String,String> responseHeaders = requestHandler.handleCorsPreflightRequest( getOriginOrReferer(req), req.getHeader("Access-Control-Request-Headers")); for (Map.Entry<String,String> entry : responseHeaders.entrySet()) { resp.setHeader(entry.getKey(),entry.getValue()); } }
[ "@", "Override", "protected", "void", "doOptions", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "Map", "<", "String", ",", "String", ">", "responseHeaders", "=", "requestHandler", ...
OPTION requests are treated as CORS preflight requests @param req the original request @param resp the response the answer are written to
[ "OPTION", "requests", "are", "treated", "as", "CORS", "preflight", "requests" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/http/AgentServlet.java#L293-L302
graknlabs/grakn
server/src/graql/analytics/Utility.java
Utility.mayHaveResourceEdge
private static boolean mayHaveResourceEdge(TransactionOLTP graknGraph, ConceptId conceptId1, ConceptId conceptId2) { Concept concept1 = graknGraph.getConcept(conceptId1); Concept concept2 = graknGraph.getConcept(conceptId2); return concept1 != null && concept2 != null && (concept1.isAttribute() || concept2.isAttribute()); }
java
private static boolean mayHaveResourceEdge(TransactionOLTP graknGraph, ConceptId conceptId1, ConceptId conceptId2) { Concept concept1 = graknGraph.getConcept(conceptId1); Concept concept2 = graknGraph.getConcept(conceptId2); return concept1 != null && concept2 != null && (concept1.isAttribute() || concept2.isAttribute()); }
[ "private", "static", "boolean", "mayHaveResourceEdge", "(", "TransactionOLTP", "graknGraph", ",", "ConceptId", "conceptId1", ",", "ConceptId", "conceptId2", ")", "{", "Concept", "concept1", "=", "graknGraph", ".", "getConcept", "(", "conceptId1", ")", ";", "Concept"...
Check whether it is possible that there is a resource edge between the two given concepts.
[ "Check", "whether", "it", "is", "possible", "that", "there", "is", "a", "resource", "edge", "between", "the", "two", "given", "concepts", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/analytics/Utility.java#L116-L120
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/extractor/CassandraExtractor.java
CassandraExtractor.initRecordReader
private DeepRecordReader initRecordReader(final DeepPartition dp, CassandraDeepJobConfig<T> config) { DeepRecordReader recordReader = new DeepRecordReader(config, dp.splitWrapper()); return recordReader; }
java
private DeepRecordReader initRecordReader(final DeepPartition dp, CassandraDeepJobConfig<T> config) { DeepRecordReader recordReader = new DeepRecordReader(config, dp.splitWrapper()); return recordReader; }
[ "private", "DeepRecordReader", "initRecordReader", "(", "final", "DeepPartition", "dp", ",", "CassandraDeepJobConfig", "<", "T", ">", "config", ")", "{", "DeepRecordReader", "recordReader", "=", "new", "DeepRecordReader", "(", "config", ",", "dp", ".", "splitWrapper...
Instantiates a new deep record reader object associated to the provided partition. @param dp a spark deep partition @return the deep record reader associated to the provided partition.
[ "Instantiates", "a", "new", "deep", "record", "reader", "object", "associated", "to", "the", "provided", "partition", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/extractor/CassandraExtractor.java#L159-L166
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitText
@Override public R visitText(TextTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitText(TextTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitText", "(", "TextTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L405-L408
vnesek/nmote-iim4j
src/main/java/com/nmote/iim4j/stream/SubIIMInputStream.java
SubIIMInputStream.setOffsetAndLength
protected void setOffsetAndLength(long offset, int length) throws IOException { this.offset = offset; this.length = length; this.position = 0; if (subStream.position() != offset) { subStream.seek(offset); } }
java
protected void setOffsetAndLength(long offset, int length) throws IOException { this.offset = offset; this.length = length; this.position = 0; if (subStream.position() != offset) { subStream.seek(offset); } }
[ "protected", "void", "setOffsetAndLength", "(", "long", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "this", ".", "offset", "=", "offset", ";", "this", ".", "length", "=", "length", ";", "this", ".", "position", "=", "0", ";", "if",...
This should be called from a subclass constructor, if offset or length are unknown at a time when SubIIMInputStream constructor is called. This method shouldn't be called more than once. @param offset byte offset @param length byte length @throws IOException if underlying stream can't be read
[ "This", "should", "be", "called", "from", "a", "subclass", "constructor", "if", "offset", "or", "length", "are", "unknown", "at", "a", "time", "when", "SubIIMInputStream", "constructor", "is", "called", ".", "This", "method", "shouldn", "t", "be", "called", ...
train
https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/stream/SubIIMInputStream.java#L64-L72
thorntail/wildfly-config-api
generator/src/main/java/org/wildfly/swarm/config/generator/generator/ConsumerFactory.java
ConsumerFactory.create
public JavaType create(ClassIndex index, ClassPlan plan) { // base class JavaInterfaceSource type = Roaster.parse( JavaInterfaceSource.class, "public interface " + plan.getClassName() + "Consumer<T extends " + plan.getClassName() + "<T>> {}" ); type.setPackage(plan.getPackageName()); type.addImport(plan.getPackageName() + "." + plan.getClassName()); type.addAnnotation(FunctionalInterface.class); addAccept(type, plan); addAndThen(type, plan); return type; }
java
public JavaType create(ClassIndex index, ClassPlan plan) { // base class JavaInterfaceSource type = Roaster.parse( JavaInterfaceSource.class, "public interface " + plan.getClassName() + "Consumer<T extends " + plan.getClassName() + "<T>> {}" ); type.setPackage(plan.getPackageName()); type.addImport(plan.getPackageName() + "." + plan.getClassName()); type.addAnnotation(FunctionalInterface.class); addAccept(type, plan); addAndThen(type, plan); return type; }
[ "public", "JavaType", "create", "(", "ClassIndex", "index", ",", "ClassPlan", "plan", ")", "{", "// base class", "JavaInterfaceSource", "type", "=", "Roaster", ".", "parse", "(", "JavaInterfaceSource", ".", "class", ",", "\"public interface \"", "+", "plan", ".", ...
Base template for a resource representation. Covers the resource attributes @param index @param plan @return
[ "Base", "template", "for", "a", "resource", "representation", ".", "Covers", "the", "resource", "attributes" ]
train
https://github.com/thorntail/wildfly-config-api/blob/ddb3f3bcb7b85b22c6371415546f567bc44493db/generator/src/main/java/org/wildfly/swarm/config/generator/generator/ConsumerFactory.java#L28-L45
knowm/XChange
xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinTradeServiceRaw.java
OkCoinTradeServiceRaw.batchTrade
public OkCoinMoreTradeResult batchTrade(String symbol, String type, String ordersData) throws IOException { OkCoinMoreTradeResult tradeResult = okCoin.batchTrade(apikey, symbol, type, ordersData, signatureCreator()); return returnOrThrow(tradeResult); }
java
public OkCoinMoreTradeResult batchTrade(String symbol, String type, String ordersData) throws IOException { OkCoinMoreTradeResult tradeResult = okCoin.batchTrade(apikey, symbol, type, ordersData, signatureCreator()); return returnOrThrow(tradeResult); }
[ "public", "OkCoinMoreTradeResult", "batchTrade", "(", "String", "symbol", ",", "String", "type", ",", "String", "ordersData", ")", "throws", "IOException", "{", "OkCoinMoreTradeResult", "tradeResult", "=", "okCoin", ".", "batchTrade", "(", "apikey", ",", "symbol", ...
批量下单 @param symbol @param type 限价单(buy/sell) @param ordersData "[{price:3,amount:5,type:'sell'},{price:3,amount:3,type:'buy'}]" 最终买卖类型由orders_data 中type 为准,如orders_data不设定type 则由上面type设置为准。 若,上面type没有设置,orderData 必须设置type @return @throws IOException
[ "批量下单" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-okcoin/src/main/java/org/knowm/xchange/okcoin/service/OkCoinTradeServiceRaw.java#L76-L81
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java
ClassNameRewriterUtil.convertFieldAnnotation
public static FieldAnnotation convertFieldAnnotation(ClassNameRewriter classNameRewriter, FieldAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new FieldAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getFieldName(), rewriteSignature(classNameRewriter, annotation.getFieldSignature()), annotation.isStatic()); } return annotation; }
java
public static FieldAnnotation convertFieldAnnotation(ClassNameRewriter classNameRewriter, FieldAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new FieldAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getFieldName(), rewriteSignature(classNameRewriter, annotation.getFieldSignature()), annotation.isStatic()); } return annotation; }
[ "public", "static", "FieldAnnotation", "convertFieldAnnotation", "(", "ClassNameRewriter", "classNameRewriter", ",", "FieldAnnotation", "annotation", ")", "{", "if", "(", "classNameRewriter", "!=", "IdentityClassNameRewriter", ".", "instance", "(", ")", ")", "{", "annot...
Rewrite a FieldAnnotation to update the class name and field signature, if needed. @param classNameRewriter a ClassNameRewriter @param annotation a FieldAnnotation @return the possibly-rewritten FieldAnnotation
[ "Rewrite", "a", "FieldAnnotation", "to", "update", "the", "class", "name", "and", "field", "signature", "if", "needed", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L115-L123
JDBDT/jdbdt
src/main/java/org/jdbdt/JDBDT.java
JDBDT.assertState
@SafeVarargs public static void assertState(String message, DataSet... dataSets) throws DBAssertionError { multipleStateAssertions(CallInfo.create(message), dataSets); }
java
@SafeVarargs public static void assertState(String message, DataSet... dataSets) throws DBAssertionError { multipleStateAssertions(CallInfo.create(message), dataSets); }
[ "@", "SafeVarargs", "public", "static", "void", "assertState", "(", "String", "message", ",", "DataSet", "...", "dataSets", ")", "throws", "DBAssertionError", "{", "multipleStateAssertions", "(", "CallInfo", ".", "create", "(", "message", ")", ",", "dataSets", "...
Assert that the database state matches the given data sets (error message variant) @param message Assertion error message. @param dataSets Data sets. @throws DBAssertionError if the assertion fails. @see #assertState(String,DataSet) @see #assertEmpty(String,DataSource...) @since 1.2
[ "Assert", "that", "the", "database", "state", "matches", "the", "given", "data", "sets", "(", "error", "message", "variant", ")" ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L636-L639
agmip/agmip-common-functions
src/main/java/org/agmip/common/Functions.java
Functions.numericStringToBigInteger
public static BigInteger numericStringToBigInteger(String numeric, boolean round) { BigDecimal decimal; try { decimal = new BigDecimal(numeric); } catch (Exception ex) { return null; } if (round) { decimal = decimal.setScale(0, BigDecimal.ROUND_HALF_UP); } BigInteger integer = decimal.toBigInteger(); return integer; }
java
public static BigInteger numericStringToBigInteger(String numeric, boolean round) { BigDecimal decimal; try { decimal = new BigDecimal(numeric); } catch (Exception ex) { return null; } if (round) { decimal = decimal.setScale(0, BigDecimal.ROUND_HALF_UP); } BigInteger integer = decimal.toBigInteger(); return integer; }
[ "public", "static", "BigInteger", "numericStringToBigInteger", "(", "String", "numeric", ",", "boolean", "round", ")", "{", "BigDecimal", "decimal", ";", "try", "{", "decimal", "=", "new", "BigDecimal", "(", "numeric", ")", ";", "}", "catch", "(", "Exception",...
Converts a numeric string to a {@code BigInteger}. This function first converts to a {@code BigDecimal} to make sure the base number being used is accurate. If {@code round} is set to <strong>true</strong> this method uses the {@code ROUND_HALF_UP} rounding method from {@code BigDecimal}. Otherwise the decimal part is dropped. If the string cannot be converted, this method returns {@code null} @param numeric A numeric string (with or without decimals). @param round Use {@link BigDecimal#ROUND_HALF_UP} method. @return {@code BigInteger} representation of the string or {@code null} @see BigDecimal
[ "Converts", "a", "numeric", "string", "to", "a", "{", "@code", "BigInteger", "}", "." ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/common/Functions.java#L64-L78
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java
MapKeyLoader.sendKeysInBatches
private void sendKeysInBatches(MapStoreContext mapStoreContext, boolean replaceExistingValues) throws Exception { if (logger.isFinestEnabled()) { logger.finest("sendKeysInBatches invoked " + getStateMessage()); } int clusterSize = partitionService.getMemberPartitionsMap().size(); Iterator<Object> keys = null; Throwable loadError = null; try { Iterable<Object> allKeys = mapStoreContext.loadAllKeys(); keys = allKeys.iterator(); Iterator<Data> dataKeys = map(keys, toData); int mapMaxSize = clusterSize * maxSizePerNode; if (mapMaxSize > 0) { dataKeys = limit(dataKeys, mapMaxSize); } Iterator<Entry<Integer, Data>> partitionsAndKeys = map(dataKeys, toPartition(partitionService)); Iterator<Map<Integer, List<Data>>> batches = toBatches(partitionsAndKeys, maxBatch); List<Future> futures = new ArrayList<>(); while (batches.hasNext()) { Map<Integer, List<Data>> batch = batches.next(); futures.addAll(sendBatch(batch, replaceExistingValues)); } // This acts as a barrier to prevent re-ordering of key distribution operations (LoadAllOperation) // and LoadStatusOperation(s) which indicates all keys were already loaded. // Re-ordering of in-flight operations can happen during a partition migration. We are waiting here // for all LoadAllOperation(s) to be ACKed by receivers and only then we send them the LoadStatusOperation // See https://github.com/hazelcast/hazelcast/issues/4024 for additional details FutureUtil.waitForever(futures); } catch (Exception caught) { loadError = caught; } finally { sendKeyLoadCompleted(clusterSize, loadError); if (keys instanceof Closeable) { closeResource((Closeable) keys); } } }
java
private void sendKeysInBatches(MapStoreContext mapStoreContext, boolean replaceExistingValues) throws Exception { if (logger.isFinestEnabled()) { logger.finest("sendKeysInBatches invoked " + getStateMessage()); } int clusterSize = partitionService.getMemberPartitionsMap().size(); Iterator<Object> keys = null; Throwable loadError = null; try { Iterable<Object> allKeys = mapStoreContext.loadAllKeys(); keys = allKeys.iterator(); Iterator<Data> dataKeys = map(keys, toData); int mapMaxSize = clusterSize * maxSizePerNode; if (mapMaxSize > 0) { dataKeys = limit(dataKeys, mapMaxSize); } Iterator<Entry<Integer, Data>> partitionsAndKeys = map(dataKeys, toPartition(partitionService)); Iterator<Map<Integer, List<Data>>> batches = toBatches(partitionsAndKeys, maxBatch); List<Future> futures = new ArrayList<>(); while (batches.hasNext()) { Map<Integer, List<Data>> batch = batches.next(); futures.addAll(sendBatch(batch, replaceExistingValues)); } // This acts as a barrier to prevent re-ordering of key distribution operations (LoadAllOperation) // and LoadStatusOperation(s) which indicates all keys were already loaded. // Re-ordering of in-flight operations can happen during a partition migration. We are waiting here // for all LoadAllOperation(s) to be ACKed by receivers and only then we send them the LoadStatusOperation // See https://github.com/hazelcast/hazelcast/issues/4024 for additional details FutureUtil.waitForever(futures); } catch (Exception caught) { loadError = caught; } finally { sendKeyLoadCompleted(clusterSize, loadError); if (keys instanceof Closeable) { closeResource((Closeable) keys); } } }
[ "private", "void", "sendKeysInBatches", "(", "MapStoreContext", "mapStoreContext", ",", "boolean", "replaceExistingValues", ")", "throws", "Exception", "{", "if", "(", "logger", ".", "isFinestEnabled", "(", ")", ")", "{", "logger", ".", "finest", "(", "\"sendKeysI...
Loads keys from the map loader and sends them to the partition owners in batches for value loading. This method will return after all keys have been dispatched to the partition owners for value loading and all partitions have been notified that the key loading has completed. The values will still be loaded asynchronously and can be put into the record stores after this method has returned. If there is a configured max size policy per node, the keys will be loaded until this many keys have been loaded from the map loader. If the keys returned from the map loader are not equally distributed over all partitions, this may cause some nodes to load more entries than others and exceed the configured policy. @param mapStoreContext the map store context for this map @param replaceExistingValues if the existing entries for the loaded keys should be replaced @throws Exception if there was an exception when notifying the record stores that the key loading has finished @see MapLoader#loadAllKeys()
[ "Loads", "keys", "from", "the", "map", "loader", "and", "sends", "them", "to", "the", "partition", "owners", "in", "batches", "for", "value", "loading", ".", "This", "method", "will", "return", "after", "all", "keys", "have", "been", "dispatched", "to", "t...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java#L413-L457
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java
UrlUtils.toNoApiUri
public static URI toNoApiUri(final URI uri, final String context, final String path) { final String p = path.matches("(?i)https?://.*") ? path : join(context, path); return uri.resolve("/").resolve(p); }
java
public static URI toNoApiUri(final URI uri, final String context, final String path) { final String p = path.matches("(?i)https?://.*") ? path : join(context, path); return uri.resolve("/").resolve(p); }
[ "public", "static", "URI", "toNoApiUri", "(", "final", "URI", "uri", ",", "final", "String", "context", ",", "final", "String", "path", ")", "{", "final", "String", "p", "=", "path", ".", "matches", "(", "\"(?i)https?://.*\"", ")", "?", "path", ":", "joi...
Create a URI from the supplied parameters. @param uri the server URI @param context the server context if any @param path the specific API path @return new full URI instance
[ "Create", "a", "URI", "from", "the", "supplied", "parameters", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/client/util/UrlUtils.java#L149-L152
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagProperty.java
CmsJspTagProperty.propertyTagAction
public static String propertyTagAction( String property, String action, String defaultValue, boolean escape, ServletRequest req, Locale locale) throws CmsException { CmsFlexController controller = CmsFlexController.getController(req); String value = null; CmsPropertyAction propertyAction = new CmsPropertyAction(req, action); if (null != propertyAction.getVfsUri()) { value = controller.getCmsObject().readPropertyObject( propertyAction.getVfsUri(), property, propertyAction.isSearch(), locale).getValue(); } if (value == null) { value = defaultValue; } if (escape) { // HTML escape the value value = CmsEncoder.escapeHtml(value); } return value; }
java
public static String propertyTagAction( String property, String action, String defaultValue, boolean escape, ServletRequest req, Locale locale) throws CmsException { CmsFlexController controller = CmsFlexController.getController(req); String value = null; CmsPropertyAction propertyAction = new CmsPropertyAction(req, action); if (null != propertyAction.getVfsUri()) { value = controller.getCmsObject().readPropertyObject( propertyAction.getVfsUri(), property, propertyAction.isSearch(), locale).getValue(); } if (value == null) { value = defaultValue; } if (escape) { // HTML escape the value value = CmsEncoder.escapeHtml(value); } return value; }
[ "public", "static", "String", "propertyTagAction", "(", "String", "property", ",", "String", "action", ",", "String", "defaultValue", ",", "boolean", "escape", ",", "ServletRequest", "req", ",", "Locale", "locale", ")", "throws", "CmsException", "{", "CmsFlexContr...
Internal action method.<p> @param property the property to look up @param action the search action @param defaultValue the default value @param escape if the result html should be escaped or not @param req the current request @param locale the locale for which the property should be read @return the value of the property or <code>null</code> if not found (and no defaultValue was provided) @throws CmsException if something goes wrong
[ "Internal", "action", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagProperty.java#L328-L355
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.addUserToGroup
public void addUserToGroup(String username, String groupname) throws CmsException { m_securityManager.addUserToGroup(m_context, username, groupname, false); }
java
public void addUserToGroup(String username, String groupname) throws CmsException { m_securityManager.addUserToGroup(m_context, username, groupname, false); }
[ "public", "void", "addUserToGroup", "(", "String", "username", ",", "String", "groupname", ")", "throws", "CmsException", "{", "m_securityManager", ".", "addUserToGroup", "(", "m_context", ",", "username", ",", "groupname", ",", "false", ")", ";", "}" ]
Adds a user to a group.<p> @param username the name of the user that is to be added to the group @param groupname the name of the group @throws CmsException if something goes wrong
[ "Adds", "a", "user", "to", "a", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L174-L177
tminglei/form-binder-java
src/main/java/com/github/tminglei/bind/Processors.java
Processors.changePrefix
public static PreProcessor changePrefix(String from, String to) { return mkPreProcessorWithMeta((prefix, data, options) -> { logger.debug("changing prefix at '{}' from '{}' to '{}'", prefix, from, to); return data.entrySet().stream() .map(e -> { if (!e.getKey().startsWith(prefix)) return e; else { String tail = e.getKey().substring(prefix.length()) .replaceFirst("^[\\.]?" + Pattern.quote(from), to) .replaceFirst("^\\.", ""); String newKey = isEmptyStr(tail) ? prefix : (prefix + "." + tail).replaceFirst("^\\.", ""); return entry( newKey, e.getValue() ); } }).collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue )); }, new ExtensionMeta(PRE_PROCESSOR_CHANGE_PREFIX, "changePrefix(from '" +from+ "' to '" +to+ "')", Arrays.asList(from, to))); }
java
public static PreProcessor changePrefix(String from, String to) { return mkPreProcessorWithMeta((prefix, data, options) -> { logger.debug("changing prefix at '{}' from '{}' to '{}'", prefix, from, to); return data.entrySet().stream() .map(e -> { if (!e.getKey().startsWith(prefix)) return e; else { String tail = e.getKey().substring(prefix.length()) .replaceFirst("^[\\.]?" + Pattern.quote(from), to) .replaceFirst("^\\.", ""); String newKey = isEmptyStr(tail) ? prefix : (prefix + "." + tail).replaceFirst("^\\.", ""); return entry( newKey, e.getValue() ); } }).collect(Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue )); }, new ExtensionMeta(PRE_PROCESSOR_CHANGE_PREFIX, "changePrefix(from '" +from+ "' to '" +to+ "')", Arrays.asList(from, to))); }
[ "public", "static", "PreProcessor", "changePrefix", "(", "String", "from", ",", "String", "to", ")", "{", "return", "mkPreProcessorWithMeta", "(", "(", "prefix", ",", "data", ",", "options", ")", "->", "{", "logger", ".", "debug", "(", "\"changing prefix at '{...
change data key prefix from one to other @param from from prefix @param to to prefix @return new created pre-processor
[ "change", "data", "key", "prefix", "from", "one", "to", "other" ]
train
https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Processors.java#L177-L202
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java
DiagnosticSource.getColumnNumber
public int getColumnNumber(int pos, boolean expandTabs) { try { if (findLine(pos)) { int column = 0; for (int bp = lineStart; bp < pos; bp++) { if (bp >= bufLen) { return 0; } if (buf[bp] == '\t' && expandTabs) { column = (column / TabInc * TabInc) + TabInc; } else { column++; } } return column + 1; // positions are one-based } return 0; } finally { buf = null; } }
java
public int getColumnNumber(int pos, boolean expandTabs) { try { if (findLine(pos)) { int column = 0; for (int bp = lineStart; bp < pos; bp++) { if (bp >= bufLen) { return 0; } if (buf[bp] == '\t' && expandTabs) { column = (column / TabInc * TabInc) + TabInc; } else { column++; } } return column + 1; // positions are one-based } return 0; } finally { buf = null; } }
[ "public", "int", "getColumnNumber", "(", "int", "pos", ",", "boolean", "expandTabs", ")", "{", "try", "{", "if", "(", "findLine", "(", "pos", ")", ")", "{", "int", "column", "=", "0", ";", "for", "(", "int", "bp", "=", "lineStart", ";", "bp", "<", ...
Return the one-based column number associated with a given pos for the current source file. Zero is returned if no column exists for the given position.
[ "Return", "the", "one", "-", "based", "column", "number", "associated", "with", "a", "given", "pos", "for", "the", "current", "source", "file", ".", "Zero", "is", "returned", "if", "no", "column", "exists", "for", "the", "given", "position", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/DiagnosticSource.java#L90-L110
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.getFirewallRule
public FirewallRuleInner getFirewallRule(String resourceGroupName, String accountName, String firewallRuleName) { return getFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).toBlocking().single().body(); }
java
public FirewallRuleInner getFirewallRule(String resourceGroupName, String accountName, String firewallRuleName) { return getFirewallRuleWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName).toBlocking().single().body(); }
[ "public", "FirewallRuleInner", "getFirewallRule", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "firewallRuleName", ")", "{", "return", "getFirewallRuleWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "firewall...
Gets the specified Data Lake Store firewall rule. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account from which to get the firewall rule. @param firewallRuleName The name of the firewall rule to retrieve. @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 FirewallRuleInner object if successful.
[ "Gets", "the", "specified", "Data", "Lake", "Store", "firewall", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L243-L245
aeshell/aesh
aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java
ParsedLineIterator.pollParsedWord
public ParsedWord pollParsedWord() { if(hasNextWord()) { //set correct next char if(parsedLine.words().size() > (word+1)) character = parsedLine.words().get(word+1).lineIndex(); else character = -1; return parsedLine.words().get(word++); } else return new ParsedWord(null, -1); }
java
public ParsedWord pollParsedWord() { if(hasNextWord()) { //set correct next char if(parsedLine.words().size() > (word+1)) character = parsedLine.words().get(word+1).lineIndex(); else character = -1; return parsedLine.words().get(word++); } else return new ParsedWord(null, -1); }
[ "public", "ParsedWord", "pollParsedWord", "(", ")", "{", "if", "(", "hasNextWord", "(", ")", ")", "{", "//set correct next char", "if", "(", "parsedLine", ".", "words", "(", ")", ".", "size", "(", ")", ">", "(", "word", "+", "1", ")", ")", "character",...
Polls the next ParsedWord from the stack. @return next ParsedWord
[ "Polls", "the", "next", "ParsedWord", "from", "the", "stack", "." ]
train
https://github.com/aeshell/aesh/blob/fd7d38d333c5dbf116a9778523a4d1df61f027a3/aesh/src/main/java/org/aesh/parser/ParsedLineIterator.java#L63-L74
line/armeria
core/src/main/java/com/linecorp/armeria/common/metric/MeterIdPrefix.java
MeterIdPrefix.appendWithTags
public MeterIdPrefix appendWithTags(String suffix, String... tags) { return new MeterIdPrefix(name(suffix), sortedImmutableTags(tags)); }
java
public MeterIdPrefix appendWithTags(String suffix, String... tags) { return new MeterIdPrefix(name(suffix), sortedImmutableTags(tags)); }
[ "public", "MeterIdPrefix", "appendWithTags", "(", "String", "suffix", ",", "String", "...", "tags", ")", "{", "return", "new", "MeterIdPrefix", "(", "name", "(", "suffix", ")", ",", "sortedImmutableTags", "(", "tags", ")", ")", ";", "}" ]
Returns a newly-created instance whose name is concatenated by the specified {@code suffix} and {@code tags}.
[ "Returns", "a", "newly", "-", "created", "instance", "whose", "name", "is", "concatenated", "by", "the", "specified", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/MeterIdPrefix.java#L175-L177
GoogleCloudPlatform/bigdata-interop
util/src/main/java/com/google/cloud/hadoop/util/HttpTransportFactory.java
HttpTransportFactory.createHttpTransport
public static HttpTransport createHttpTransport( HttpTransportType type, @Nullable String proxyAddress, @Nullable String proxyUsername, @Nullable String proxyPassword) throws IOException { logger.atFine().log( "createHttpTransport(%s, %s, %s, %s)", type, proxyAddress, toSecretString(proxyUsername), toSecretString(proxyPassword)); checkArgument( proxyAddress != null || (proxyUsername == null && proxyPassword == null), "if proxyAddress is null then proxyUsername and proxyPassword should be null too"); checkArgument( (proxyUsername == null) == (proxyPassword == null), "both proxyUsername and proxyPassword should be null or not null together"); URI proxyUri = parseProxyAddress(proxyAddress); try { switch (type) { case APACHE: Credentials proxyCredentials = proxyUsername != null ? new UsernamePasswordCredentials(proxyUsername, proxyPassword) : null; return createApacheHttpTransport(proxyUri, proxyCredentials); case JAVA_NET: PasswordAuthentication proxyAuth = proxyUsername != null ? new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray()) : null; return createNetHttpTransport(proxyUri, proxyAuth); default: throw new IllegalArgumentException( String.format("Invalid HttpTransport type '%s'", type.name())); } } catch (GeneralSecurityException e) { throw new IOException(e); } }
java
public static HttpTransport createHttpTransport( HttpTransportType type, @Nullable String proxyAddress, @Nullable String proxyUsername, @Nullable String proxyPassword) throws IOException { logger.atFine().log( "createHttpTransport(%s, %s, %s, %s)", type, proxyAddress, toSecretString(proxyUsername), toSecretString(proxyPassword)); checkArgument( proxyAddress != null || (proxyUsername == null && proxyPassword == null), "if proxyAddress is null then proxyUsername and proxyPassword should be null too"); checkArgument( (proxyUsername == null) == (proxyPassword == null), "both proxyUsername and proxyPassword should be null or not null together"); URI proxyUri = parseProxyAddress(proxyAddress); try { switch (type) { case APACHE: Credentials proxyCredentials = proxyUsername != null ? new UsernamePasswordCredentials(proxyUsername, proxyPassword) : null; return createApacheHttpTransport(proxyUri, proxyCredentials); case JAVA_NET: PasswordAuthentication proxyAuth = proxyUsername != null ? new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray()) : null; return createNetHttpTransport(proxyUri, proxyAuth); default: throw new IllegalArgumentException( String.format("Invalid HttpTransport type '%s'", type.name())); } } catch (GeneralSecurityException e) { throw new IOException(e); } }
[ "public", "static", "HttpTransport", "createHttpTransport", "(", "HttpTransportType", "type", ",", "@", "Nullable", "String", "proxyAddress", ",", "@", "Nullable", "String", "proxyUsername", ",", "@", "Nullable", "String", "proxyPassword", ")", "throws", "IOException"...
Create an {@link HttpTransport} based on an type class and an optional HTTP proxy. @param type The type of HttpTransport to use. @param proxyAddress The HTTP proxy to use with the transport. Of the form hostname:port. If empty no proxy will be used. @param proxyUsername The HTTP proxy username to use with the transport. If empty no proxy username will be used. @param proxyPassword The HTTP proxy password to use with the transport. If empty no proxy password will be used. @return The resulting HttpTransport. @throws IllegalArgumentException If the proxy address is invalid. @throws IOException If there is an issue connecting to Google's Certification server.
[ "Create", "an", "{", "@link", "HttpTransport", "}", "based", "on", "an", "type", "class", "and", "an", "optional", "HTTP", "proxy", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/HttpTransportFactory.java#L85-L122
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/MethodUtils.java
MethodUtils.getAccessibleMethod
public static Method getAccessibleMethod(Class<?> clazz, String methodName) { return getAccessibleMethod(clazz, methodName, EMPTY_CLASS_PARAMETERS); }
java
public static Method getAccessibleMethod(Class<?> clazz, String methodName) { return getAccessibleMethod(clazz, methodName, EMPTY_CLASS_PARAMETERS); }
[ "public", "static", "Method", "getAccessibleMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ")", "{", "return", "getAccessibleMethod", "(", "clazz", ",", "methodName", ",", "EMPTY_CLASS_PARAMETERS", ")", ";", "}" ]
<p>Return an accessible method (that is, one that can be invoked via reflection) with given name and a single parameter. If no such method can be found, return {@code null}. Basically, a convenience wrapper that constructs a {@code Class} array for you.</p> @param clazz get method from this class @param methodName get method with this name @return the accessible method
[ "<p", ">", "Return", "an", "accessible", "method", "(", "that", "is", "one", "that", "can", "be", "invoked", "via", "reflection", ")", "with", "given", "name", "and", "a", "single", "parameter", ".", "If", "no", "such", "method", "can", "be", "found", ...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L607-L609
alibaba/jstorm
jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java
UIUtils.getTaskEntity
public static TaskEntity getTaskEntity(List<TaskSummary> tasks, int taskId) { TaskEntity entity = null; for (TaskSummary task : tasks) { if (task.get_taskId() == taskId) { entity = new TaskEntity(task); break; } } return entity; }
java
public static TaskEntity getTaskEntity(List<TaskSummary> tasks, int taskId) { TaskEntity entity = null; for (TaskSummary task : tasks) { if (task.get_taskId() == taskId) { entity = new TaskEntity(task); break; } } return entity; }
[ "public", "static", "TaskEntity", "getTaskEntity", "(", "List", "<", "TaskSummary", ">", "tasks", ",", "int", "taskId", ")", "{", "TaskEntity", "entity", "=", "null", ";", "for", "(", "TaskSummary", "task", ":", "tasks", ")", "{", "if", "(", "task", ".",...
get the specific task entity @param tasks list of task summaries @param taskId task id @return
[ "get", "the", "specific", "task", "entity" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-ui/src/main/java/com/alibaba/jstorm/ui/utils/UIUtils.java#L288-L297
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader.readFromStream
@Nullable public static IJson readFromStream (@Nonnull final IHasInputStream aISP, @Nonnull final Charset aFallbackCharset, @Nullable final IJsonParseExceptionCallback aCustomExceptionHandler) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); final InputStream aIS = aISP.getInputStream (); if (aIS == null) return null; return readFromStream (aIS, aFallbackCharset, aCustomExceptionHandler); }
java
@Nullable public static IJson readFromStream (@Nonnull final IHasInputStream aISP, @Nonnull final Charset aFallbackCharset, @Nullable final IJsonParseExceptionCallback aCustomExceptionHandler) { ValueEnforcer.notNull (aISP, "InputStreamProvider"); final InputStream aIS = aISP.getInputStream (); if (aIS == null) return null; return readFromStream (aIS, aFallbackCharset, aCustomExceptionHandler); }
[ "@", "Nullable", "public", "static", "IJson", "readFromStream", "(", "@", "Nonnull", "final", "IHasInputStream", "aISP", ",", "@", "Nonnull", "final", "Charset", "aFallbackCharset", ",", "@", "Nullable", "final", "IJsonParseExceptionCallback", "aCustomExceptionHandler",...
Read the Json from the passed {@link IHasInputStream}. @param aISP The input stream to use. May not be <code>null</code>. @param aFallbackCharset The charset to be used in case no BOM is present. May not be <code>null</code>. @param aCustomExceptionHandler An optional custom exception handler that can be used to collect the unrecoverable parsing errors. May be <code>null</code>. @return <code>null</code> if reading failed, the Json declarations otherwise.
[ "Read", "the", "Json", "from", "the", "passed", "{", "@link", "IHasInputStream", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L618-L628
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/ApiImplementor.java
ApiImplementor.handleApiPersistentConnection
public void handleApiPersistentConnection(HttpMessage msg, HttpInputStream httpIn, HttpOutputStream httpOut, String name, JSONObject params) throws ApiException { throw new ApiException(ApiException.Type.BAD_PCONN, name); }
java
public void handleApiPersistentConnection(HttpMessage msg, HttpInputStream httpIn, HttpOutputStream httpOut, String name, JSONObject params) throws ApiException { throw new ApiException(ApiException.Type.BAD_PCONN, name); }
[ "public", "void", "handleApiPersistentConnection", "(", "HttpMessage", "msg", ",", "HttpInputStream", "httpIn", ",", "HttpOutputStream", "httpOut", ",", "String", "name", ",", "JSONObject", "params", ")", "throws", "ApiException", "{", "throw", "new", "ApiException", ...
Override if implementing one or more 'persistent connection' operations. These are operations that maintain long running connections, potentially staying alive as long as the client holds them open. @param msg the HTTP message containing the API request @param httpIn the input stream @param httpOut the output stream @param name the name of the requested pconn endpoint @param params the API request parameters @throws ApiException if an error occurred while handling the API pconn endpoint
[ "Override", "if", "implementing", "one", "or", "more", "persistent", "connection", "operations", ".", "These", "are", "operations", "that", "maintain", "long", "running", "connections", "potentially", "staying", "alive", "as", "long", "as", "the", "client", "holds...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/ApiImplementor.java#L362-L366
Waikato/moa
moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java
AccuracyUpdatedEnsemble.addToStored
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight) { Classifier addedClassifier = null; Classifier[] newStored = new Classifier[this.learners.length + 1]; double[][] newStoredWeights = new double[newStored.length][2]; for (int i = 0; i < newStored.length; i++) { if (i < this.learners.length) { newStored[i] = this.learners[i]; newStoredWeights[i][0] = this.weights[i][0]; newStoredWeights[i][1] = this.weights[i][1]; } else { newStored[i] = addedClassifier = newClassifier.copy(); newStoredWeights[i][0] = newClassifiersWeight; newStoredWeights[i][1] = i; } } this.learners = newStored; this.weights = newStoredWeights; return addedClassifier; }
java
protected Classifier addToStored(Classifier newClassifier, double newClassifiersWeight) { Classifier addedClassifier = null; Classifier[] newStored = new Classifier[this.learners.length + 1]; double[][] newStoredWeights = new double[newStored.length][2]; for (int i = 0; i < newStored.length; i++) { if (i < this.learners.length) { newStored[i] = this.learners[i]; newStoredWeights[i][0] = this.weights[i][0]; newStoredWeights[i][1] = this.weights[i][1]; } else { newStored[i] = addedClassifier = newClassifier.copy(); newStoredWeights[i][0] = newClassifiersWeight; newStoredWeights[i][1] = i; } } this.learners = newStored; this.weights = newStoredWeights; return addedClassifier; }
[ "protected", "Classifier", "addToStored", "(", "Classifier", "newClassifier", ",", "double", "newClassifiersWeight", ")", "{", "Classifier", "addedClassifier", "=", "null", ";", "Classifier", "[", "]", "newStored", "=", "new", "Classifier", "[", "this", ".", "lear...
Adds a classifier to the storage. @param newClassifier The classifier to add. @param newClassifiersWeight The new classifiers weight.
[ "Adds", "a", "classifier", "to", "the", "storage", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/meta/AccuracyUpdatedEnsemble.java#L309-L329
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java
CPOptionCategoryPersistenceImpl.removeByG_K
@Override public CPOptionCategory removeByG_K(long groupId, String key) throws NoSuchCPOptionCategoryException { CPOptionCategory cpOptionCategory = findByG_K(groupId, key); return remove(cpOptionCategory); }
java
@Override public CPOptionCategory removeByG_K(long groupId, String key) throws NoSuchCPOptionCategoryException { CPOptionCategory cpOptionCategory = findByG_K(groupId, key); return remove(cpOptionCategory); }
[ "@", "Override", "public", "CPOptionCategory", "removeByG_K", "(", "long", "groupId", ",", "String", "key", ")", "throws", "NoSuchCPOptionCategoryException", "{", "CPOptionCategory", "cpOptionCategory", "=", "findByG_K", "(", "groupId", ",", "key", ")", ";", "return...
Removes the cp option category where groupId = &#63; and key = &#63; from the database. @param groupId the group ID @param key the key @return the cp option category that was removed
[ "Removes", "the", "cp", "option", "category", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L2671-L2677
timehop/sticky-headers-recyclerview
library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java
HeaderPositionCalculator.hasNewHeader
public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; } long headerId = mAdapter.getHeaderId(position); if (headerId < 0) { return false; } long nextItemHeaderId = -1; int nextItemPosition = position + (isReverseLayout? 1: -1); if (!indexOutOfBounds(nextItemPosition)){ nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); } int firstItemPosition = isReverseLayout? mAdapter.getItemCount()-1 : 0; return position == firstItemPosition || headerId != nextItemHeaderId; }
java
public boolean hasNewHeader(int position, boolean isReverseLayout) { if (indexOutOfBounds(position)) { return false; } long headerId = mAdapter.getHeaderId(position); if (headerId < 0) { return false; } long nextItemHeaderId = -1; int nextItemPosition = position + (isReverseLayout? 1: -1); if (!indexOutOfBounds(nextItemPosition)){ nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition); } int firstItemPosition = isReverseLayout? mAdapter.getItemCount()-1 : 0; return position == firstItemPosition || headerId != nextItemHeaderId; }
[ "public", "boolean", "hasNewHeader", "(", "int", "position", ",", "boolean", "isReverseLayout", ")", "{", "if", "(", "indexOutOfBounds", "(", "position", ")", ")", "{", "return", "false", ";", "}", "long", "headerId", "=", "mAdapter", ".", "getHeaderId", "("...
Determines if an item in the list should have a header that is different than the item in the list that immediately precedes it. Items with no headers will always return false. @param position of the list item in questions @param isReverseLayout TRUE if layout manager has flag isReverseLayout @return true if this item has a different header than the previous item in the list
[ "Determines", "if", "an", "item", "in", "the", "list", "should", "have", "a", "header", "that", "is", "different", "than", "the", "item", "in", "the", "list", "that", "immediately", "precedes", "it", ".", "Items", "with", "no", "headers", "will", "always",...
train
https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java#L72-L91
google/closure-compiler
src/com/google/javascript/jscomp/NodeTraversal.java
NodeTraversal.traverseWithScope
void traverseWithScope(Node root, AbstractScope<?, ?> s) { checkState(s.isGlobal() || s.isModuleScope(), s); try { initTraversal(root); curNode = root; pushScope(s); traverseBranch(root, null); popScope(); } catch (Error | Exception unexpectedException) { throwUnexpectedException(unexpectedException); } }
java
void traverseWithScope(Node root, AbstractScope<?, ?> s) { checkState(s.isGlobal() || s.isModuleScope(), s); try { initTraversal(root); curNode = root; pushScope(s); traverseBranch(root, null); popScope(); } catch (Error | Exception unexpectedException) { throwUnexpectedException(unexpectedException); } }
[ "void", "traverseWithScope", "(", "Node", "root", ",", "AbstractScope", "<", "?", ",", "?", ">", "s", ")", "{", "checkState", "(", "s", ".", "isGlobal", "(", ")", "||", "s", ".", "isModuleScope", "(", ")", ",", "s", ")", ";", "try", "{", "initTrave...
Traverses a parse tree recursively with a scope, starting with the given root. This should only be used in the global scope or module scopes. Otherwise, use {@link #traverseAtScope}.
[ "Traverses", "a", "parse", "tree", "recursively", "with", "a", "scope", "starting", "with", "the", "given", "root", ".", "This", "should", "only", "be", "used", "in", "the", "global", "scope", "or", "module", "scopes", ".", "Otherwise", "use", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L438-L449
netty/netty
common/src/main/java/io/netty/util/NetUtil.java
NetUtil.toAddressString
public static String toAddressString(InetAddress ip, boolean ipv4Mapped) { if (ip instanceof Inet4Address) { return ip.getHostAddress(); } if (!(ip instanceof Inet6Address)) { throw new IllegalArgumentException("Unhandled type: " + ip); } return toAddressString(ip.getAddress(), 0, ipv4Mapped); }
java
public static String toAddressString(InetAddress ip, boolean ipv4Mapped) { if (ip instanceof Inet4Address) { return ip.getHostAddress(); } if (!(ip instanceof Inet6Address)) { throw new IllegalArgumentException("Unhandled type: " + ip); } return toAddressString(ip.getAddress(), 0, ipv4Mapped); }
[ "public", "static", "String", "toAddressString", "(", "InetAddress", "ip", ",", "boolean", "ipv4Mapped", ")", "{", "if", "(", "ip", "instanceof", "Inet4Address", ")", "{", "return", "ip", ".", "getHostAddress", "(", ")", ";", "}", "if", "(", "!", "(", "i...
Returns the {@link String} representation of an {@link InetAddress}. <ul> <li>Inet4Address results are identical to {@link InetAddress#getHostAddress()}</li> <li>Inet6Address results adhere to <a href="http://tools.ietf.org/html/rfc5952#section-4">rfc 5952 section 4</a> if {@code ipv4Mapped} is false. If {@code ipv4Mapped} is true then "IPv4 mapped" format from <a href="http://tools.ietf.org/html/rfc4291#section-2.5.5">rfc 4291 section 2</a> will be supported. The compressed result will always obey the compression rules defined in <a href="http://tools.ietf.org/html/rfc5952#section-4">rfc 5952 section 4</a></li> </ul> <p> The output does not include Scope ID. @param ip {@link InetAddress} to be converted to an address string @param ipv4Mapped <ul> <li>{@code true} to stray from strict rfc 5952 and support the "IPv4 mapped" format defined in <a href="http://tools.ietf.org/html/rfc4291#section-2.5.5">rfc 4291 section 2</a> while still following the updated guidelines in <a href="http://tools.ietf.org/html/rfc5952#section-4">rfc 5952 section 4</a></li> <li>{@code false} to strictly follow rfc 5952</li> </ul> @return {@code String} containing the text-formatted IP address
[ "Returns", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L1017-L1026
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessage.java
BaseMessage.init
public void init(BaseMessageHeader messageHeader, Object data) { m_messageDataDesc = null; m_externalMessage = null; m_messageHeader = messageHeader; this.setData(data); m_bIsConsumed = false; }
java
public void init(BaseMessageHeader messageHeader, Object data) { m_messageDataDesc = null; m_externalMessage = null; m_messageHeader = messageHeader; this.setData(data); m_bIsConsumed = false; }
[ "public", "void", "init", "(", "BaseMessageHeader", "messageHeader", ",", "Object", "data", ")", "{", "m_messageDataDesc", "=", "null", ";", "m_externalMessage", "=", "null", ";", "m_messageHeader", "=", "messageHeader", ";", "this", ".", "setData", "(", "data",...
Constructor. @param messageHeader The message header which contains information such as destination and type. @param data This properties object is a default way to pass messages.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessage.java#L99-L107
milaboratory/milib
src/main/java/com/milaboratory/util/HashFunctions.java
HashFunctions.MurmurHash2
@SuppressWarnings("fallthrough") public static int MurmurHash2(byte[] data, int seed) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. int m = 0x5bd1e995; int r = 24; // Initialize the hash to a 'random' value int len = data.length; int h = seed ^ len; int i = 0; while (len >= 4) { int k = data[i] & 0xFF; k |= (data[i + 1] & 0xFF) << 8; k |= (data[i + 2] & 0xFF) << 16; k |= (data[i + 3] & 0xFF) << 24; k *= m; k ^= k >>> r; k *= m; h *= m; h ^= k; i += 4; len -= 4; } switch (len) { case 3: h ^= (data[i + 2] & 0xFF) << 16; case 2: h ^= (data[i + 1] & 0xFF) << 8; case 1: h ^= (data[i] & 0xFF); h *= m; } h ^= h >>> 13; h *= m; h ^= h >>> 15; return h; }
java
@SuppressWarnings("fallthrough") public static int MurmurHash2(byte[] data, int seed) { // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. int m = 0x5bd1e995; int r = 24; // Initialize the hash to a 'random' value int len = data.length; int h = seed ^ len; int i = 0; while (len >= 4) { int k = data[i] & 0xFF; k |= (data[i + 1] & 0xFF) << 8; k |= (data[i + 2] & 0xFF) << 16; k |= (data[i + 3] & 0xFF) << 24; k *= m; k ^= k >>> r; k *= m; h *= m; h ^= k; i += 4; len -= 4; } switch (len) { case 3: h ^= (data[i + 2] & 0xFF) << 16; case 2: h ^= (data[i + 1] & 0xFF) << 8; case 1: h ^= (data[i] & 0xFF); h *= m; } h ^= h >>> 13; h *= m; h ^= h >>> 15; return h; }
[ "@", "SuppressWarnings", "(", "\"fallthrough\"", ")", "public", "static", "int", "MurmurHash2", "(", "byte", "[", "]", "data", ",", "int", "seed", ")", "{", "// 'm' and 'r' are mixing constants generated offline.", "// They're not really 'magic', they just happen to work well...
MurmurHash hash function for bytes array. <p/> <h3>Links</h3> <a href="http://sites.google.com/site/murmurhash/">http://sites.google.com/site/murmurhash/</a><br/> <a href="http://dmy999.com/article/50/murmurhash-2-java-port">http://dmy999.com/article/50/murmurhash-2-java-port</a><br/> <a href="http://en.wikipedia.org/wiki/MurmurHash">http://en.wikipedia.org/wiki/MurmurHash</a><br/> @param data bytes to be hashed @param seed seed parameter @return 32 bit hash
[ "MurmurHash", "hash", "function", "for", "bytes", "array", ".", "<p", "/", ">", "<h3", ">", "Links<", "/", "h3", ">", "<a", "href", "=", "http", ":", "//", "sites", ".", "google", ".", "com", "/", "site", "/", "murmurhash", "/", ">", "http", ":", ...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/util/HashFunctions.java#L342-L386
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java
FineUploader5DeleteFile.setParams
@Nonnull public FineUploader5DeleteFile setParams (@Nullable final Map <String, String> aParams) { m_aDeleteFileParams.setAll (aParams); return this; }
java
@Nonnull public FineUploader5DeleteFile setParams (@Nullable final Map <String, String> aParams) { m_aDeleteFileParams.setAll (aParams); return this; }
[ "@", "Nonnull", "public", "FineUploader5DeleteFile", "setParams", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aParams", ")", "{", "m_aDeleteFileParams", ".", "setAll", "(", "aParams", ")", ";", "return", "this", ";", "}" ]
Any additional parameters to attach to delete file requests. @param aParams New parameters to be set. @return this
[ "Any", "additional", "parameters", "to", "attach", "to", "delete", "file", "requests", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java#L183-L188
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/GraphsHandler.java
GraphsHandler.addDependencyToGraph
private void addDependencyToGraph(final DbDependency dependency, final AbstractGraph graph, final int depth, final String parentId) { // In that case of Axway artifact we will add a module to the graph if (filters.getCorporateFilter().filter(dependency)) { final DbModule dbTarget = repoHandler.getModuleOf(dependency.getTarget()); // if there is no module, add the artifact to the graph if(dbTarget == null){ LOG.error("Got missing reference: " + dependency.getTarget()); final DbArtifact dbArtifact = DataUtils.createDbArtifact(dependency.getTarget()); final String targetElementId = graph.getId(dbArtifact); graph.addElement(targetElementId, dbArtifact.getVersion(), false); graph.addDependency(parentId, targetElementId, dependency.getScope()); return; } // Add the element to the graph addModuleToGraph(dbTarget, graph, depth + 1); //Add the dependency to the graph final String moduleElementId = graph.getId(dbTarget); graph.addDependency(parentId, moduleElementId, dependency.getScope()); } // In case a third-party we will add an artifact else { final DbArtifact dbTarget = repoHandler.getArtifact(dependency.getTarget()); if(dbTarget == null){ LOG.error("Got missing artifact: " + dependency.getTarget()); return; } if(!graph.isTreated(graph.getId(dbTarget))){ final ModelMapper modelMapper = new ModelMapper(repoHandler); final Artifact target = modelMapper.getArtifact(dbTarget); final String targetElementId = graph.getId(target); graph.addElement(targetElementId, target.getVersion(), false); graph.addDependency(parentId, targetElementId, dependency.getScope()); } } }
java
private void addDependencyToGraph(final DbDependency dependency, final AbstractGraph graph, final int depth, final String parentId) { // In that case of Axway artifact we will add a module to the graph if (filters.getCorporateFilter().filter(dependency)) { final DbModule dbTarget = repoHandler.getModuleOf(dependency.getTarget()); // if there is no module, add the artifact to the graph if(dbTarget == null){ LOG.error("Got missing reference: " + dependency.getTarget()); final DbArtifact dbArtifact = DataUtils.createDbArtifact(dependency.getTarget()); final String targetElementId = graph.getId(dbArtifact); graph.addElement(targetElementId, dbArtifact.getVersion(), false); graph.addDependency(parentId, targetElementId, dependency.getScope()); return; } // Add the element to the graph addModuleToGraph(dbTarget, graph, depth + 1); //Add the dependency to the graph final String moduleElementId = graph.getId(dbTarget); graph.addDependency(parentId, moduleElementId, dependency.getScope()); } // In case a third-party we will add an artifact else { final DbArtifact dbTarget = repoHandler.getArtifact(dependency.getTarget()); if(dbTarget == null){ LOG.error("Got missing artifact: " + dependency.getTarget()); return; } if(!graph.isTreated(graph.getId(dbTarget))){ final ModelMapper modelMapper = new ModelMapper(repoHandler); final Artifact target = modelMapper.getArtifact(dbTarget); final String targetElementId = graph.getId(target); graph.addElement(targetElementId, target.getVersion(), false); graph.addDependency(parentId, targetElementId, dependency.getScope()); } } }
[ "private", "void", "addDependencyToGraph", "(", "final", "DbDependency", "dependency", ",", "final", "AbstractGraph", "graph", ",", "final", "int", "depth", ",", "final", "String", "parentId", ")", "{", "// In that case of Axway artifact we will add a module to the graph", ...
Add a dependency to the graph @param dependency @param graph @param depth @param parentId
[ "Add", "a", "dependency", "to", "the", "graph" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/GraphsHandler.java#L89-L127
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.rotateLocal
public Matrix3f rotateLocal(float ang, float x, float y, float z) { return rotateLocal(ang, x, y, z, this); }
java
public Matrix3f rotateLocal(float ang, float x, float y, float z) { return rotateLocal(ang, x, y, z, this); }
[ "public", "Matrix3f", "rotateLocal", "(", "float", "ang", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "return", "rotateLocal", "(", "ang", ",", "x", ",", "y", ",", "z", ",", "this", ")", ";", "}" ]
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotation(float, float, float, float) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(float, float, float, float) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this
[ "Pre", "-", "multiply", "a", "rotation", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", ".", "<p", ">", "The", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2443-L2445
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java
NotificationsApi.connectCall
public com.squareup.okhttp.Call connectCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/notifications/connect"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); }
java
public com.squareup.okhttp.Call connectCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/notifications/connect"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); if(progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); return originalResponse.newBuilder() .body(new ProgressResponseBody(originalResponse.body(), progressListener)) .build(); } }); } String[] localVarAuthNames = new String[] { }; return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "connectCall", "(", "final", "ProgressResponseBody", ".", "ProgressListener", "progressListener", ",", "final", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", ")", "throws", ...
Build call for connect @param progressListener Progress listener @param progressRequestListener Progress request listener @return Call to execute @throws ApiException If fail to serialize the request body object
[ "Build", "call", "for", "connect" ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L63-L102
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setLookAlong
public Matrix4d setLookAlong(Vector3dc dir, Vector3dc up) { return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
java
public Matrix4d setLookAlong(Vector3dc dir, Vector3dc up) { return setLookAlong(dir.x(), dir.y(), dir.z(), up.x(), up.y(), up.z()); }
[ "public", "Matrix4d", "setLookAlong", "(", "Vector3dc", "dir", ",", "Vector3dc", "up", ")", "{", "return", "setLookAlong", "(", "dir", ".", "x", "(", ")", ",", "dir", ".", "y", "(", ")", ",", "dir", ".", "z", "(", ")", ",", "up", ".", "x", "(", ...
Set this matrix to a rotation transformation to make <code>-z</code> point along <code>dir</code>. <p> This is equivalent to calling {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc) setLookAt()} with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>. <p> In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3dc, Vector3dc)}. @see #setLookAlong(Vector3dc, Vector3dc) @see #lookAlong(Vector3dc, Vector3dc) @param dir the direction in space to look along @param up the direction of 'up' @return this
[ "Set", "this", "matrix", "to", "a", "rotation", "transformation", "to", "make", "<code", ">", "-", "z<", "/", "code", ">", "point", "along", "<code", ">", "dir<", "/", "code", ">", ".", "<p", ">", "This", "is", "equivalent", "to", "calling", "{", "@l...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L11017-L11019
cucumber/cucumber-jvm
core/src/main/java/cucumber/runtime/formatter/Plugins.java
Plugins.pluginProxy
private <T> T pluginProxy(final Class<T> type) { Object proxy = Proxy.newProxyInstance(classLoader, new Class<?>[]{type}, new InvocationHandler() { @Override public Object invoke(Object target, Method method, Object[] args) throws Throwable { for (Object plugin : getPlugins()) { if (type.isInstance(plugin)) { try { Utils.invoke(plugin, method, 0, args); } catch (Throwable t) { if (!method.getName().equals("startOfScenarioLifeCycle") && !method.getName().equals("endOfScenarioLifeCycle")) { // IntelliJ has its own formatter which doesn't yet implement these methods. throw t; } } } } return null; } }); return type.cast(proxy); }
java
private <T> T pluginProxy(final Class<T> type) { Object proxy = Proxy.newProxyInstance(classLoader, new Class<?>[]{type}, new InvocationHandler() { @Override public Object invoke(Object target, Method method, Object[] args) throws Throwable { for (Object plugin : getPlugins()) { if (type.isInstance(plugin)) { try { Utils.invoke(plugin, method, 0, args); } catch (Throwable t) { if (!method.getName().equals("startOfScenarioLifeCycle") && !method.getName().equals("endOfScenarioLifeCycle")) { // IntelliJ has its own formatter which doesn't yet implement these methods. throw t; } } } } return null; } }); return type.cast(proxy); }
[ "private", "<", "T", ">", "T", "pluginProxy", "(", "final", "Class", "<", "T", ">", "type", ")", "{", "Object", "proxy", "=", "Proxy", ".", "newProxyInstance", "(", "classLoader", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "type", "}", ",",...
Creates a dynamic proxy that multiplexes method invocations to all plugins of the same type. @param type proxy type @param <T> generic proxy type @return a proxy
[ "Creates", "a", "dynamic", "proxy", "that", "multiplexes", "method", "invocations", "to", "all", "plugins", "of", "the", "same", "type", "." ]
train
https://github.com/cucumber/cucumber-jvm/blob/437bb3a1f1d91b56f44059c835765b395eefc777/core/src/main/java/cucumber/runtime/formatter/Plugins.java#L124-L144
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/ExportEncoder.java
ExportEncoder.encodeGeography
static public void encodeGeography(final FastSerializer fs, GeographyValue value) throws IOException { ByteBuffer bb = ByteBuffer.allocate(value.getLengthInBytes()); bb.order(ByteOrder.nativeOrder()); value.flattenToBuffer(bb); byte[] array = bb.array(); fs.writeInt(array.length); fs.write(array); }
java
static public void encodeGeography(final FastSerializer fs, GeographyValue value) throws IOException { ByteBuffer bb = ByteBuffer.allocate(value.getLengthInBytes()); bb.order(ByteOrder.nativeOrder()); value.flattenToBuffer(bb); byte[] array = bb.array(); fs.writeInt(array.length); fs.write(array); }
[ "static", "public", "void", "encodeGeography", "(", "final", "FastSerializer", "fs", ",", "GeographyValue", "value", ")", "throws", "IOException", "{", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "allocate", "(", "value", ".", "getLengthInBytes", "(", ")", ")", ...
Encode a GEOGRAPHY according to the Export encoding specification. @param fs The serializer to serialize to @throws IOException
[ "Encode", "a", "GEOGRAPHY", "according", "to", "the", "Export", "encoding", "specification", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportEncoder.java#L334-L343
kohsuke/args4j
args4j/src/org/kohsuke/args4j/CmdLineParser.java
CmdLineParser.registerHandler
public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); OptionHandlerRegistry.getRegistry().registerHandler(valueType, handlerClass); }
java
public static void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); OptionHandlerRegistry.getRegistry().registerHandler(valueType, handlerClass); }
[ "public", "static", "void", "registerHandler", "(", "Class", "valueType", ",", "Class", "<", "?", "extends", "OptionHandler", ">", "handlerClass", ")", "{", "checkNonNull", "(", "valueType", ",", "\"valueType\"", ")", ";", "checkNonNull", "(", "handlerClass", ",...
Registers a user-defined {@link OptionHandler} class with args4j. <p> This method allows users to extend the behavior of args4j by writing their own {@link OptionHandler} implementation. @param valueType The specified handler is used when the field/method annotated by {@link Option} is of this type. @param handlerClass This class must have the constructor that has the same signature as {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}. @deprecated You should use {@link OptionHandlerRegistry#registerHandler(java.lang.Class, java.lang.Class)} instead.
[ "Registers", "a", "user", "-", "defined", "{", "@link", "OptionHandler", "}", "class", "with", "args4j", "." ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L698-L703
VoltDB/voltdb
src/frontend/org/voltdb/utils/SystemStatsCollector.java
SystemStatsCollector.getRSSFromProcFS
private static long getRSSFromProcFS() { try { File statFile = new File(String.format("/proc/%d/stat", pid)); FileInputStream fis = new FileInputStream(statFile); try { BufferedReader r = new BufferedReader(new InputStreamReader(fis)); String stats = r.readLine(); String[] parts = stats.split(" "); return Long.parseLong(parts[23]) * 4 * 1024; } finally { fis.close(); } } catch (Exception e) { return -1; } }
java
private static long getRSSFromProcFS() { try { File statFile = new File(String.format("/proc/%d/stat", pid)); FileInputStream fis = new FileInputStream(statFile); try { BufferedReader r = new BufferedReader(new InputStreamReader(fis)); String stats = r.readLine(); String[] parts = stats.split(" "); return Long.parseLong(parts[23]) * 4 * 1024; } finally { fis.close(); } } catch (Exception e) { return -1; } }
[ "private", "static", "long", "getRSSFromProcFS", "(", ")", "{", "try", "{", "File", "statFile", "=", "new", "File", "(", "String", ".", "format", "(", "\"/proc/%d/stat\"", ",", "pid", ")", ")", ";", "FileInputStream", "fis", "=", "new", "FileInputStream", ...
Get the RSS using the procfs. If procfs is not around, this will return -1;
[ "Get", "the", "RSS", "using", "the", "procfs", ".", "If", "procfs", "is", "not", "around", "this", "will", "return", "-", "1", ";" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/SystemStatsCollector.java#L341-L357
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeAfter
public boolean removeAfter(ST obj, PT pt) { return removeAfter(indexOf(obj, pt), false); }
java
public boolean removeAfter(ST obj, PT pt) { return removeAfter(indexOf(obj, pt), false); }
[ "public", "boolean", "removeAfter", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeAfter", "(", "indexOf", "(", "obj", ",", "pt", ")", ",", "false", ")", ";", "}" ]
Remove the path's elements after the specified one which is starting at the specified point. The specified element will not be removed. <p>This function removes after the <i>first occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "after", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "not", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L778-L780
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java
PropertiesDao.saveProperty
public void saveProperty(DbSession session, PropertyDto property) { save(getMapper(session), property.getKey(), property.getUserId(), property.getResourceId(), property.getValue()); }
java
public void saveProperty(DbSession session, PropertyDto property) { save(getMapper(session), property.getKey(), property.getUserId(), property.getResourceId(), property.getValue()); }
[ "public", "void", "saveProperty", "(", "DbSession", "session", ",", "PropertyDto", "property", ")", "{", "save", "(", "getMapper", "(", "session", ")", ",", "property", ".", "getKey", "(", ")", ",", "property", ".", "getUserId", "(", ")", ",", "property", ...
Saves the specified property and its value. <p> If {@link PropertyDto#getValue()} is {@code null} or empty, the properties is persisted as empty. </p> @throws IllegalArgumentException if {@link PropertyDto#getKey()} is {@code null} or empty
[ "Saves", "the", "specified", "property", "and", "its", "value", ".", "<p", ">", "If", "{", "@link", "PropertyDto#getValue", "()", "}", "is", "{", "@code", "null", "}", "or", "empty", "the", "properties", "is", "persisted", "as", "empty", ".", "<", "/", ...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/property/PropertiesDao.java#L202-L204
googleapis/cloud-bigtable-client
bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/AbstractCloudBigtableTableDoFn.java
AbstractCloudBigtableTableDoFn.logExceptions
protected void logExceptions(Object context, RetriesExhaustedWithDetailsException exception) { logRetriesExhaustedWithDetailsException(DOFN_LOG, String.valueOf(context), exception); }
java
protected void logExceptions(Object context, RetriesExhaustedWithDetailsException exception) { logRetriesExhaustedWithDetailsException(DOFN_LOG, String.valueOf(context), exception); }
[ "protected", "void", "logExceptions", "(", "Object", "context", ",", "RetriesExhaustedWithDetailsException", "exception", ")", "{", "logRetriesExhaustedWithDetailsException", "(", "DOFN_LOG", ",", "String", ".", "valueOf", "(", "context", ")", ",", "exception", ")", "...
Logs a context and the exception's {@link RetriesExhaustedWithDetailsException#getExhaustiveDescription()}.
[ "Logs", "a", "context", "and", "the", "exception", "s", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-dataflow-parent/bigtable-hbase-beam/src/main/java/com/google/cloud/bigtable/beam/AbstractCloudBigtableTableDoFn.java#L115-L117
samskivert/samskivert
src/main/java/com/samskivert/swing/CollapsibleList.java
CollapsibleList.addSection
public int addSection (String label, ListModel model) { add(new JLabel(label)); add(new JList(model)); return getSectionCount()-1; }
java
public int addSection (String label, ListModel model) { add(new JLabel(label)); add(new JList(model)); return getSectionCount()-1; }
[ "public", "int", "addSection", "(", "String", "label", ",", "ListModel", "model", ")", "{", "add", "(", "new", "JLabel", "(", "label", ")", ")", ";", "add", "(", "new", "JList", "(", "model", ")", ")", ";", "return", "getSectionCount", "(", ")", "-",...
Adds a section to this collapsible list. @param label the title of the section. @param model the list model to use for the new section. @return the index of the newly added section.
[ "Adds", "a", "section", "to", "this", "collapsible", "list", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/CollapsibleList.java#L64-L69
lucee/Lucee
core/src/main/java/lucee/commons/lang/ArchiveClassLoader.java
ArchiveClassLoader.loadClass
@Override protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded Class c = findLoadedClass(name); if (c == null) { c = findClassEL(name); if (c == null) { c = pcl.loadClass(name); } } if (resolve) { resolveClass(c); } return c; }
java
@Override protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { // First, check if the class has already been loaded Class c = findLoadedClass(name); if (c == null) { c = findClassEL(name); if (c == null) { c = pcl.loadClass(name); } } if (resolve) { resolveClass(c); } return c; }
[ "@", "Override", "protected", "synchronized", "Class", "loadClass", "(", "String", "name", ",", "boolean", "resolve", ")", "throws", "ClassNotFoundException", "{", "// First, check if the class has already been loaded", "Class", "c", "=", "findLoadedClass", "(", "name", ...
Loads the class with the specified name. The default implementation of this method searches for classes in the following order: <p> <ol> <li>Call {@link #findLoadedClass(String)} to check if the class has already been loaded. <p> <li>Call the <code>loadClass</code> method on the parent class loader. If the parent is <code>null</code> the class loader built-in to the virtual machine is used, instead. <p> <li>Call the {@link #findClass(String)} method to find the class. <p> </ol> If the class was found using the above steps, and the <code>resolve</code> flag is true, this method will then call the {@link #resolveClass(Class)} method on the resulting class object. <p> From the Java 2 SDK, v1.2, subclasses of ClassLoader are encouraged to override {@link #findClass(String)}, rather than this method. <p> @param name the name of the class @param resolve if <code>true</code> then resolve the class @return the resulting <code>Class</code> object @exception ClassNotFoundException if the class could not be found
[ "Loads", "the", "class", "with", "the", "specified", "name", ".", "The", "default", "implementation", "of", "this", "method", "searches", "for", "classes", "in", "the", "following", "order", ":", "<p", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ArchiveClassLoader.java#L103-L117
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withOutgoingPayload
public T withOutgoingPayload(Map<String, ByteBuffer> outgoingPayload) { getOptions().setOutgoingPayLoad(Optional.of(outgoingPayload)); return getThis(); }
java
public T withOutgoingPayload(Map<String, ByteBuffer> outgoingPayload) { getOptions().setOutgoingPayLoad(Optional.of(outgoingPayload)); return getThis(); }
[ "public", "T", "withOutgoingPayload", "(", "Map", "<", "String", ",", "ByteBuffer", ">", "outgoingPayload", ")", "{", "getOptions", "(", ")", ".", "setOutgoingPayLoad", "(", "Optional", ".", "of", "(", "outgoingPayload", ")", ")", ";", "return", "getThis", "...
Set the given outgoing payload map on the generated statement @throws NullPointerException if outgoingPayload is null
[ "Set", "the", "given", "outgoing", "payload", "map", "on", "the", "generated", "statement" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L103-L106
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java
XSLTAttributeDef.processSIMPLEPATTERNLIST
Vector processSIMPLEPATTERNLIST( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nPatterns = tokenizer.countTokens(); Vector patterns = new Vector(nPatterns); for (int i = 0; i < nPatterns; i++) { XPath pattern = handler.createMatchPatternXPath(tokenizer.nextToken(), owner); patterns.addElement(pattern); } return patterns; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } }
java
Vector processSIMPLEPATTERNLIST( StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner) throws org.xml.sax.SAXException { try { StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f"); int nPatterns = tokenizer.countTokens(); Vector patterns = new Vector(nPatterns); for (int i = 0; i < nPatterns; i++) { XPath pattern = handler.createMatchPatternXPath(tokenizer.nextToken(), owner); patterns.addElement(pattern); } return patterns; } catch (TransformerException te) { throw new org.xml.sax.SAXException(te); } }
[ "Vector", "processSIMPLEPATTERNLIST", "(", "StylesheetHandler", "handler", ",", "String", "uri", ",", "String", "name", ",", "String", "rawName", ",", "String", "value", ",", "ElemTemplateElement", "owner", ")", "throws", "org", ".", "xml", ".", "sax", ".", "S...
Process an attribute string of type T_SIMPLEPATTERNLIST into a vector of XPath match patterns. @param handler non-null reference to current StylesheetHandler that is constructing the Templates. @param uri The Namespace URI, or an empty string. @param name The local name (without prefix), or empty string if not namespace processing. @param rawName The qualified name (with prefix). @param value A whitespace delimited list of simple match patterns. @return A Vector of XPath objects. @throws org.xml.sax.SAXException that wraps a {@link javax.xml.transform.TransformerException} if one of the match pattern strings contains a syntax error.
[ "Process", "an", "attribute", "string", "of", "type", "T_SIMPLEPATTERNLIST", "into", "a", "vector", "of", "XPath", "match", "patterns", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1158-L1184
apache/incubator-heron
heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java
GeneralTopologyContextImpl.getComponentOutputFields
public Fields getComponentOutputFields(String componentId, String streamId) { Map<String, Fields> componentFields = componentsOutputFields.get(componentId); if (componentFields != null) { return componentFields.get(streamId); } return null; }
java
public Fields getComponentOutputFields(String componentId, String streamId) { Map<String, Fields> componentFields = componentsOutputFields.get(componentId); if (componentFields != null) { return componentFields.get(streamId); } return null; }
[ "public", "Fields", "getComponentOutputFields", "(", "String", "componentId", ",", "String", "streamId", ")", "{", "Map", "<", "String", ",", "Fields", ">", "componentFields", "=", "componentsOutputFields", ".", "get", "(", "componentId", ")", ";", "if", "(", ...
Gets the declared output fields for the specified component/stream.
[ "Gets", "the", "declared", "output", "fields", "for", "the", "specified", "component", "/", "stream", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/utils/topology/GeneralTopologyContextImpl.java#L182-L189
keshrath/Giphy4J
src/main/java/at/mukprojects/giphy4j/Giphy.java
Giphy.searchByID
public SearchGiphy searchByID(String id) throws GiphyException { SearchGiphy giphy = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(IDEndpoint + id, params)); try { Response response = sender.sendRequest(request); giphy = gson.fromJson(response.getBody(), SearchGiphy.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return giphy; }
java
public SearchGiphy searchByID(String id) throws GiphyException { SearchGiphy giphy = null; HashMap<String, String> params = new HashMap<String, String>(); params.put("api_key", apiKey); Request request = new Request(UrlUtil.buildUrlQuery(IDEndpoint + id, params)); try { Response response = sender.sendRequest(request); giphy = gson.fromJson(response.getBody(), SearchGiphy.class); } catch (JsonSyntaxException | IOException e) { log.error(e.getMessage(), e); throw new GiphyException(e); } return giphy; }
[ "public", "SearchGiphy", "searchByID", "(", "String", "id", ")", "throws", "GiphyException", "{", "SearchGiphy", "giphy", "=", "null", ";", "HashMap", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(...
Returns a SerachGiphy object. <p> Be aware that not every response has all information available. In that case the value will be returned as null. @param id the Giphy id @return the SerachGiphy object @throws GiphyException if an error occurs during the search
[ "Returns", "a", "SerachGiphy", "object", "." ]
train
https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L178-L196
apache/groovy
src/main/groovy/groovy/lang/Closure.java
Closure.rightShift
public <W> Closure<W> rightShift(final Closure<W> other) { return new ComposedClosure<W>(this, other); }
java
public <W> Closure<W> rightShift(final Closure<W> other) { return new ComposedClosure<W>(this, other); }
[ "public", "<", "W", ">", "Closure", "<", "W", ">", "rightShift", "(", "final", "Closure", "<", "W", ">", "other", ")", "{", "return", "new", "ComposedClosure", "<", "W", ">", "(", "this", ",", "other", ")", ";", "}" ]
Support for Closure forward composition. <p> Typical usage: <pre class="groovyTestCase"> def times2 = { a {@code ->} a * 2 } def add3 = { a {@code ->} a + 3 } def timesThenAdd = times2 {@code >>} add3 // equivalent: timesThenAdd = { a {@code ->} add3(times2(a)) } assert timesThenAdd(3) == 9 </pre> @param other the Closure to compose with the current Closure @return the new composed Closure
[ "Support", "for", "Closure", "forward", "composition", ".", "<p", ">", "Typical", "usage", ":", "<pre", "class", "=", "groovyTestCase", ">", "def", "times2", "=", "{", "a", "{", "@code", "-", ">", "}", "a", "*", "2", "}", "def", "add3", "=", "{", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/Closure.java#L636-L638
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/socks/Socks5Proxy.java
Socks5Proxy.setAuthenticationMethod
public boolean setAuthenticationMethod(int methodId, Authentication method) { if (methodId < 0 || methodId > 255) return false; if (method == null) { // Want to remove a particular method return (authMethods.remove(new Integer(methodId)) != null); } else {// Add the method, or rewrite old one authMethods.put(new Integer(methodId), method); } return true; }
java
public boolean setAuthenticationMethod(int methodId, Authentication method) { if (methodId < 0 || methodId > 255) return false; if (method == null) { // Want to remove a particular method return (authMethods.remove(new Integer(methodId)) != null); } else {// Add the method, or rewrite old one authMethods.put(new Integer(methodId), method); } return true; }
[ "public", "boolean", "setAuthenticationMethod", "(", "int", "methodId", ",", "Authentication", "method", ")", "{", "if", "(", "methodId", "<", "0", "||", "methodId", ">", "255", ")", "return", "false", ";", "if", "(", "method", "==", "null", ")", "{", "/...
Adds another authentication method. @param methodId Authentication method id, see rfc1928 @param method Implementation of Authentication @see Authentication
[ "Adds", "another", "authentication", "method", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/Socks5Proxy.java#L149-L159
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java
JsJmsMapMessageImpl.setBoolean
public void setBoolean(String name, boolean value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBoolean", Boolean.valueOf(value)); getBodyMap().put(name, Boolean.valueOf(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBoolean"); }
java
public void setBoolean(String name, boolean value) throws UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBoolean", Boolean.valueOf(value)); getBodyMap().put(name, Boolean.valueOf(value)); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBoolean"); }
[ "public", "void", "setBoolean", "(", "String", "name", ",", "boolean", "value", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", "....
/* Set a boolean value with the given name, into the Map. Javadoc description supplied by JsJmsMessage interface.
[ "/", "*", "Set", "a", "boolean", "value", "with", "the", "given", "name", "into", "the", "Map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsJmsMapMessageImpl.java#L269-L273
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/ParseBigDecimal.java
ParseBigDecimal.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final BigDecimal result; if( value instanceof String ) { final String s = (String) value; try { if( symbols == null ) { result = new BigDecimal(s); } else { result = new BigDecimal(fixSymbols(s, symbols)); } } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a BigDecimal", value), context, this, e); } } else { throw new SuperCsvCellProcessorException(String.class, value, context, this); } return next.execute(result, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final BigDecimal result; if( value instanceof String ) { final String s = (String) value; try { if( symbols == null ) { result = new BigDecimal(s); } else { result = new BigDecimal(fixSymbols(s, symbols)); } } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a BigDecimal", value), context, this, e); } } else { throw new SuperCsvCellProcessorException(String.class, value, context, this); } return next.execute(result, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "final", "BigDecimal", "result", ";", "if", "(", "value", "instanceof", "String", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null, isn't a String, or can't be parsed as a BigDecimal
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseBigDecimal.java#L119-L141
rundeck/rundeck
core/src/main/java/com/dtolabs/shared/resources/ResourceXMLParser.java
ResourceXMLParser.parseResourceRef
private Entity parseResourceRef(final EntitySet set, final Node n) throws ResourceXMLParserException { final Node node2 = n.selectSingleNode("@" + COMMON_NAME); if (null == node2) { throw new ResourceXMLParserException("@" + COMMON_NAME + " required: " + reportNodeErrorLocation(n)); } final String rname = node2.getStringValue(); return set.getOrCreateEntity( rname); }
java
private Entity parseResourceRef(final EntitySet set, final Node n) throws ResourceXMLParserException { final Node node2 = n.selectSingleNode("@" + COMMON_NAME); if (null == node2) { throw new ResourceXMLParserException("@" + COMMON_NAME + " required: " + reportNodeErrorLocation(n)); } final String rname = node2.getStringValue(); return set.getOrCreateEntity( rname); }
[ "private", "Entity", "parseResourceRef", "(", "final", "EntitySet", "set", ",", "final", "Node", "n", ")", "throws", "ResourceXMLParserException", "{", "final", "Node", "node2", "=", "n", ".", "selectSingleNode", "(", "\"@\"", "+", "COMMON_NAME", ")", ";", "if...
Parse a simple resource/entity node for the type/name attributes, returning a new or existing Entity @param set entity set @param n entity DOM node @return new or existing Entity @throws ResourceXMLParserException if the ndoe is missing the required attributes
[ "Parse", "a", "simple", "resource", "/", "entity", "node", "for", "the", "type", "/", "name", "attributes", "returning", "a", "new", "or", "existing", "Entity" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/shared/resources/ResourceXMLParser.java#L202-L209
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.api_application_applicationId_GET
public OvhApplication api_application_applicationId_GET(Long applicationId) throws IOException { String qPath = "/me/api/application/{applicationId}"; StringBuilder sb = path(qPath, applicationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhApplication.class); }
java
public OvhApplication api_application_applicationId_GET(Long applicationId) throws IOException { String qPath = "/me/api/application/{applicationId}"; StringBuilder sb = path(qPath, applicationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhApplication.class); }
[ "public", "OvhApplication", "api_application_applicationId_GET", "(", "Long", "applicationId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/api/application/{applicationId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "applicationId"...
Get this object properties REST: GET /me/api/application/{applicationId} @param applicationId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L450-L455
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.indexOf
public static int indexOf(String[] arr, String value) { for (int i = 0; i < arr.length; i++) { if (arr[i].equals(value)) return i; } return -1; }
java
public static int indexOf(String[] arr, String value) { for (int i = 0; i < arr.length; i++) { if (arr[i].equals(value)) return i; } return -1; }
[ "public", "static", "int", "indexOf", "(", "String", "[", "]", "arr", ",", "String", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "if", "(", "arr", "[", "i", "]", ".", "...
return index of given value in Array or -1 @param arr @param value @return index of position in array
[ "return", "index", "of", "given", "value", "in", "Array", "or", "-", "1" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L306-L311
samskivert/samskivert
src/main/java/com/samskivert/velocity/InvocationContext.java
InvocationContext.getTemplate
public Template getTemplate (String path, String encoding) throws Exception { Object siteId = get("__siteid__"); if (siteId != null) { path = siteId + ":" + path; } if (encoding == null) { return RuntimeSingleton.getRuntimeServices().getTemplate(path); } else { return RuntimeSingleton.getRuntimeServices().getTemplate(path, encoding); } }
java
public Template getTemplate (String path, String encoding) throws Exception { Object siteId = get("__siteid__"); if (siteId != null) { path = siteId + ":" + path; } if (encoding == null) { return RuntimeSingleton.getRuntimeServices().getTemplate(path); } else { return RuntimeSingleton.getRuntimeServices().getTemplate(path, encoding); } }
[ "public", "Template", "getTemplate", "(", "String", "path", ",", "String", "encoding", ")", "throws", "Exception", "{", "Object", "siteId", "=", "get", "(", "\"__siteid__\"", ")", ";", "if", "(", "siteId", "!=", "null", ")", "{", "path", "=", "siteId", "...
Fetches a Velocity template that can be used for later formatting. The template is read with the specified encoding or the default encoding if encoding is null. @exception Exception thrown if an error occurs loading or parsing the template.
[ "Fetches", "a", "Velocity", "template", "that", "can", "be", "used", "for", "later", "formatting", ".", "The", "template", "is", "read", "with", "the", "specified", "encoding", "or", "the", "default", "encoding", "if", "encoding", "is", "null", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/InvocationContext.java#L57-L69
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getRelativePathForPath
private static String getRelativePathForPath(final String relativePath, final String sep) { final StringTokenizer tokenizer = new StringTokenizer(relativePath.replace(WINDOWS_SEPARATOR, UNIX_SEPARATOR), UNIX_SEPARATOR); final StringBuilder buffer = new StringBuilder(); if (tokenizer.countTokens() == 1) { return null; } else { while(tokenizer.countTokens() > 1) { tokenizer.nextToken(); buffer.append(".."); buffer.append(sep); } return buffer.toString(); } }
java
private static String getRelativePathForPath(final String relativePath, final String sep) { final StringTokenizer tokenizer = new StringTokenizer(relativePath.replace(WINDOWS_SEPARATOR, UNIX_SEPARATOR), UNIX_SEPARATOR); final StringBuilder buffer = new StringBuilder(); if (tokenizer.countTokens() == 1) { return null; } else { while(tokenizer.countTokens() > 1) { tokenizer.nextToken(); buffer.append(".."); buffer.append(sep); } return buffer.toString(); } }
[ "private", "static", "String", "getRelativePathForPath", "(", "final", "String", "relativePath", ",", "final", "String", "sep", ")", "{", "final", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", "(", "relativePath", ".", "replace", "(", "WINDOWS_SEPAR...
Get relative path to base path. <p>For {@code foo/bar/baz.txt} return {@code ../../}</p> @param relativePath relative path @param sep path separator @return relative path to base path, {@code null} if reference path was a single file
[ "Get", "relative", "path", "to", "base", "path", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L279-L292
aboutsip/pkts
pkts-sip/src/main/java/io/pkts/packet/sip/address/impl/SipURIImpl.java
SipURIImpl.getTransportParam
@Override public Optional<Transport> getTransportParam() throws SipParseException { try { final Optional<Buffer> transport = getParameter(SipParser.TRANSPORT); return transport.map(Transport::of); } catch (final IllegalArgumentException e) { throw new SipParseException(0, e.getMessage(), e); } }
java
@Override public Optional<Transport> getTransportParam() throws SipParseException { try { final Optional<Buffer> transport = getParameter(SipParser.TRANSPORT); return transport.map(Transport::of); } catch (final IllegalArgumentException e) { throw new SipParseException(0, e.getMessage(), e); } }
[ "@", "Override", "public", "Optional", "<", "Transport", ">", "getTransportParam", "(", ")", "throws", "SipParseException", "{", "try", "{", "final", "Optional", "<", "Buffer", ">", "transport", "=", "getParameter", "(", "SipParser", ".", "TRANSPORT", ")", ";"...
/* @Override public void setPort(final int port) { this.isDirty = true; if (port < 0) { this.port = null; } else { this.port = Buffers.wrap(port); } }
[ "/", "*" ]
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-sip/src/main/java/io/pkts/packet/sip/address/impl/SipURIImpl.java#L206-L214
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/tree/CmsTreeItem.java
CmsTreeItem.shouldInsertIntoSiblingList
private boolean shouldInsertIntoSiblingList(int originalPathLevel, CmsTreeItem parent, int index) { if ((index <= 0) || (parent == null)) { return false; } return originalPathLevel != getPathLevel(parent.getPath()); }
java
private boolean shouldInsertIntoSiblingList(int originalPathLevel, CmsTreeItem parent, int index) { if ((index <= 0) || (parent == null)) { return false; } return originalPathLevel != getPathLevel(parent.getPath()); }
[ "private", "boolean", "shouldInsertIntoSiblingList", "(", "int", "originalPathLevel", ",", "CmsTreeItem", "parent", ",", "int", "index", ")", "{", "if", "(", "(", "index", "<=", "0", ")", "||", "(", "parent", "==", "null", ")", ")", "{", "return", "false",...
Determines if the draggable should be inserted into the previous siblings children list.<p> @param originalPathLevel the original path level @param parent the parent item @param index the current index @return <code>true</code> if the item should be inserted into the previous siblings children list
[ "Determines", "if", "the", "draggable", "should", "be", "inserted", "into", "the", "previous", "siblings", "children", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/tree/CmsTreeItem.java#L902-L908