repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
JDBCDriverURLRecognizerEngine.getDatabaseType
public static DatabaseType getDatabaseType(final String url) { switch (getDriverClassName(url)) { case "com.mysql.cj.jdbc.Driver": case "com.mysql.jdbc.Driver": return DatabaseType.MySQL; case "org.postgresql.Driver": return DatabaseType.PostgreSQL; case "oracle.jdbc.driver.OracleDriver": return DatabaseType.Oracle; case "com.microsoft.sqlserver.jdbc.SQLServerDriver": return DatabaseType.SQLServer; case "org.h2.Driver": return DatabaseType.H2; default: throw new ShardingException("Cannot resolve JDBC url `%s`", url); } }
java
public static DatabaseType getDatabaseType(final String url) { switch (getDriverClassName(url)) { case "com.mysql.cj.jdbc.Driver": case "com.mysql.jdbc.Driver": return DatabaseType.MySQL; case "org.postgresql.Driver": return DatabaseType.PostgreSQL; case "oracle.jdbc.driver.OracleDriver": return DatabaseType.Oracle; case "com.microsoft.sqlserver.jdbc.SQLServerDriver": return DatabaseType.SQLServer; case "org.h2.Driver": return DatabaseType.H2; default: throw new ShardingException("Cannot resolve JDBC url `%s`", url); } }
[ "public", "static", "DatabaseType", "getDatabaseType", "(", "final", "String", "url", ")", "{", "switch", "(", "getDriverClassName", "(", "url", ")", ")", "{", "case", "\"com.mysql.cj.jdbc.Driver\"", ":", "case", "\"com.mysql.jdbc.Driver\"", ":", "return", "Database...
Get database type. @param url JDBC URL @return database type
[ "Get", "database", "type", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java#L74-L90
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/SubscriptionsApi.java
SubscriptionsApi.getAllSubscriptionsAsync
public com.squareup.okhttp.Call getAllSubscriptionsAsync(String uid, Integer offset, Integer count, final ApiCallback<SubscriptionsEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getAllSubscriptionsValidateBeforeCall(uid, offset, count, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SubscriptionsEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getAllSubscriptionsAsync(String uid, Integer offset, Integer count, final ApiCallback<SubscriptionsEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getAllSubscriptionsValidateBeforeCall(uid, offset, count, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<SubscriptionsEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getAllSubscriptionsAsync", "(", "String", "uid", ",", "Integer", "offset", ",", "Integer", "count", ",", "final", "ApiCallback", "<", "SubscriptionsEnvelope", ">", "callback", ")", "throws", "ApiExce...
Get All Subscriptions (asynchronously) Get All Subscriptions @param uid User ID (optional) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "All", "Subscriptions", "(", "asynchronously", ")", "Get", "All", "Subscriptions" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/SubscriptionsApi.java#L397-L422
apereo/cas
support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java
PasswordManagementWebflowUtils.putPasswordResetToken
public void putPasswordResetToken(final RequestContext requestContext, final String token) { val flowScope = requestContext.getFlowScope(); flowScope.put(FLOWSCOPE_PARAMETER_NAME_TOKEN, token); }
java
public void putPasswordResetToken(final RequestContext requestContext, final String token) { val flowScope = requestContext.getFlowScope(); flowScope.put(FLOWSCOPE_PARAMETER_NAME_TOKEN, token); }
[ "public", "void", "putPasswordResetToken", "(", "final", "RequestContext", "requestContext", ",", "final", "String", "token", ")", "{", "val", "flowScope", "=", "requestContext", ".", "getFlowScope", "(", ")", ";", "flowScope", ".", "put", "(", "FLOWSCOPE_PARAMETE...
Put password reset token. @param requestContext the request context @param token the token
[ "Put", "password", "reset", "token", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/PasswordManagementWebflowUtils.java#L35-L38
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmetrictable_metric_binding.java
lbmetrictable_metric_binding.count_filtered
public static long count_filtered(nitro_service service, String metrictable, String filter) throws Exception{ lbmetrictable_metric_binding obj = new lbmetrictable_metric_binding(); obj.set_metrictable(metrictable); options option = new options(); option.set_count(true); option.set_filter(filter); lbmetrictable_metric_binding[] response = (lbmetrictable_metric_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String metrictable, String filter) throws Exception{ lbmetrictable_metric_binding obj = new lbmetrictable_metric_binding(); obj.set_metrictable(metrictable); options option = new options(); option.set_count(true); option.set_filter(filter); lbmetrictable_metric_binding[] response = (lbmetrictable_metric_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "metrictable", ",", "String", "filter", ")", "throws", "Exception", "{", "lbmetrictable_metric_binding", "obj", "=", "new", "lbmetrictable_metric_binding", "(", ")", ";", "...
Use this API to count the filtered set of lbmetrictable_metric_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "lbmetrictable_metric_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmetrictable_metric_binding.java#L237-L248
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java
ServerDnsAliasesInner.beginCreateOrUpdateAsync
public Observable<ServerDnsAliasInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
java
public Observable<ServerDnsAliasInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String dnsAliasName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerDnsAliasInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ...
Creates a server dns alias. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server that the alias is pointing to. @param dnsAliasName The name of the server DNS alias. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerDnsAliasInner object
[ "Creates", "a", "server", "dns", "alias", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L310-L317
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.findByUsername
public DUser findByUsername(java.lang.String username) { return queryUniqueByField(null, DUserMapper.Field.USERNAME.getFieldName(), username); }
java
public DUser findByUsername(java.lang.String username) { return queryUniqueByField(null, DUserMapper.Field.USERNAME.getFieldName(), username); }
[ "public", "DUser", "findByUsername", "(", "java", ".", "lang", ".", "String", "username", ")", "{", "return", "queryUniqueByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "USERNAME", ".", "getFieldName", "(", ")", ",", "username", ")", ";", "}...
find-by method for unique field username @param username the unique attribute @return the unique DUser for the specified username
[ "find", "-", "by", "method", "for", "unique", "field", "username" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L277-L279
Azure/autorest-clientruntime-for-java
azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGNode.java
DAGNode.onFaultedResolution
protected void onFaultedResolution(String dependencyKey, Throwable throwable) { if (toBeResolved == 0) { throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey"); } toBeResolved--; }
java
protected void onFaultedResolution(String dependencyKey, Throwable throwable) { if (toBeResolved == 0) { throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey"); } toBeResolved--; }
[ "protected", "void", "onFaultedResolution", "(", "String", "dependencyKey", ",", "Throwable", "throwable", ")", "{", "if", "(", "toBeResolved", "==", "0", ")", "{", "throw", "new", "RuntimeException", "(", "\"invalid state - \"", "+", "this", ".", "key", "(", ...
Reports a dependency of this node has been faulted. @param dependencyKey the id of the dependency node @param throwable the reason for unsuccessful resolution
[ "Reports", "a", "dependency", "of", "this", "node", "has", "been", "faulted", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/dag/DAGNode.java#L154-L159
icoloma/simpleds
src/main/java/org/simpleds/metadata/ClassMetadataFactory.java
ClassMetadataFactory.addEmbeddedProperties
private void addEmbeddedProperties(ClassMetadata classMetadata, SinglePropertyMetadata propertyMetadata) { ClassMetadata nested = new ClassMetadata(); nested.setPersistentClass(propertyMetadata.getPropertyType()); visit(nested.getPersistentClass(), nested, new HashSet<String>()); for (Iterator<String> i = nested.getPropertyNames(); i.hasNext(); ) { String propertyName = i.next(); EmbeddedPropertyMetadata property = new EmbeddedPropertyMetadata(propertyMetadata, nested.getProperty(propertyName)); doAddProperty(classMetadata, property); } }
java
private void addEmbeddedProperties(ClassMetadata classMetadata, SinglePropertyMetadata propertyMetadata) { ClassMetadata nested = new ClassMetadata(); nested.setPersistentClass(propertyMetadata.getPropertyType()); visit(nested.getPersistentClass(), nested, new HashSet<String>()); for (Iterator<String> i = nested.getPropertyNames(); i.hasNext(); ) { String propertyName = i.next(); EmbeddedPropertyMetadata property = new EmbeddedPropertyMetadata(propertyMetadata, nested.getProperty(propertyName)); doAddProperty(classMetadata, property); } }
[ "private", "void", "addEmbeddedProperties", "(", "ClassMetadata", "classMetadata", ",", "SinglePropertyMetadata", "propertyMetadata", ")", "{", "ClassMetadata", "nested", "=", "new", "ClassMetadata", "(", ")", ";", "nested", ".", "setPersistentClass", "(", "propertyMeta...
Recursively processes all nested {@link Embedded} properties and adds them as {@link EmbeddedPropertyMetadata} instances
[ "Recursively", "processes", "all", "nested", "{" ]
train
https://github.com/icoloma/simpleds/blob/b07763df98b9375b764e625f617a6c78df4b068d/src/main/java/org/simpleds/metadata/ClassMetadataFactory.java#L150-L159
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tracer/Tracer.java
Tracer.clearConnectionListener
public static synchronized void clearConnectionListener(String poolName, Object mcp, Object cl) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.CLEAR_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)))); }
java
public static synchronized void clearConnectionListener(String poolName, Object mcp, Object cl) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.CLEAR_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)))); }
[ "public", "static", "synchronized", "void", "clearConnectionListener", "(", "String", "poolName", ",", "Object", "mcp", ",", "Object", "cl", ")", "{", "log", ".", "tracef", "(", "\"%s\"", ",", "new", "TraceEvent", "(", "poolName", ",", "Integer", ".", "toHex...
Clear connection listener @param poolName The name of the pool @param mcp The managed connection pool @param cl The connection listener
[ "Clear", "connection", "listener" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L230-L236
diirt/util
src/main/java/org/epics/util/array/ListNumbers.java
ListNumbers.binarySearchValueOrHigher
public static int binarySearchValueOrHigher(ListNumber values, double value) { if (value <= values.getDouble(0)) { return 0; } if (value >= values.getDouble(values.size() -1)) { return values.size() - 1; } int index = binarySearch(0, values.size() - 1, values, value); while (index != values.size() - 1 && value > values.getDouble(index)) { index++; } while (index != values.size() - 1 && value == values.getDouble(index + 1)) { index++; } return index; }
java
public static int binarySearchValueOrHigher(ListNumber values, double value) { if (value <= values.getDouble(0)) { return 0; } if (value >= values.getDouble(values.size() -1)) { return values.size() - 1; } int index = binarySearch(0, values.size() - 1, values, value); while (index != values.size() - 1 && value > values.getDouble(index)) { index++; } while (index != values.size() - 1 && value == values.getDouble(index + 1)) { index++; } return index; }
[ "public", "static", "int", "binarySearchValueOrHigher", "(", "ListNumber", "values", ",", "double", "value", ")", "{", "if", "(", "value", "<=", "values", ".", "getDouble", "(", "0", ")", ")", "{", "return", "0", ";", "}", "if", "(", "value", ">=", "va...
Finds the value in the list, or the one right above it. @param values a list of values @param value a value @return the index of the value
[ "Finds", "the", "value", "in", "the", "list", "or", "the", "one", "right", "above", "it", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L93-L112
alkacon/opencms-core
src/org/opencms/ui/dataview/CmsDataViewPanel.java
CmsDataViewPanel.updateFilter
public void updateFilter(String id, String value) { CmsDataViewFilter oldFilter = m_filterMap.get(id); CmsDataViewFilter newFilter = oldFilter.copyWithValue(value); m_filterMap.put(id, newFilter); List<CmsDataViewFilter> filters = new ArrayList<CmsDataViewFilter>(m_filterMap.values()); updateFilters(m_dataView.updateFilters(filters)); }
java
public void updateFilter(String id, String value) { CmsDataViewFilter oldFilter = m_filterMap.get(id); CmsDataViewFilter newFilter = oldFilter.copyWithValue(value); m_filterMap.put(id, newFilter); List<CmsDataViewFilter> filters = new ArrayList<CmsDataViewFilter>(m_filterMap.values()); updateFilters(m_dataView.updateFilters(filters)); }
[ "public", "void", "updateFilter", "(", "String", "id", ",", "String", "value", ")", "{", "CmsDataViewFilter", "oldFilter", "=", "m_filterMap", ".", "get", "(", "id", ")", ";", "CmsDataViewFilter", "newFilter", "=", "oldFilter", ".", "copyWithValue", "(", "valu...
Updates the search results after a filter is changed by the user.<p> @param id the filter id @param value the filter value
[ "Updates", "the", "search", "results", "after", "a", "filter", "is", "changed", "by", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dataview/CmsDataViewPanel.java#L433-L440
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.waitForElementToContainText
public void waitForElementToContainText(final By by, final int maximumSeconds) { (new WebDriverWait(driver, maximumSeconds)) .until(new ExpectedCondition<Boolean>() { public Boolean apply(final WebDriver error1) { return !driver.findElement(by).getText().isEmpty(); } }); }
java
public void waitForElementToContainText(final By by, final int maximumSeconds) { (new WebDriverWait(driver, maximumSeconds)) .until(new ExpectedCondition<Boolean>() { public Boolean apply(final WebDriver error1) { return !driver.findElement(by).getText().isEmpty(); } }); }
[ "public", "void", "waitForElementToContainText", "(", "final", "By", "by", ",", "final", "int", "maximumSeconds", ")", "{", "(", "new", "WebDriverWait", "(", "driver", ",", "maximumSeconds", ")", ")", ".", "until", "(", "new", "ExpectedCondition", "<", "Boolea...
Waits for an element to contain some text. @param by the method of identifying the element @param maximumSeconds the maximum number of seconds to wait
[ "Waits", "for", "an", "element", "to", "contain", "some", "text", "." ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L511-L519
aalmiray/Json-lib
src/main/java/net/sf/json/JSONSerializer.java
JSONSerializer.toJSON
private static JSON toJSON( String string, JsonConfig jsonConfig ) { JSON json = null; if( string.startsWith( "[" ) ){ json = JSONArray.fromObject( string, jsonConfig ); }else if( string.startsWith( "{" ) ){ json = JSONObject.fromObject( string, jsonConfig ); }else if( "null".equals( string ) ){ json = JSONNull.getInstance(); }else{ throw new JSONException( "Invalid JSON String" ); } return json; }
java
private static JSON toJSON( String string, JsonConfig jsonConfig ) { JSON json = null; if( string.startsWith( "[" ) ){ json = JSONArray.fromObject( string, jsonConfig ); }else if( string.startsWith( "{" ) ){ json = JSONObject.fromObject( string, jsonConfig ); }else if( "null".equals( string ) ){ json = JSONNull.getInstance(); }else{ throw new JSONException( "Invalid JSON String" ); } return json; }
[ "private", "static", "JSON", "toJSON", "(", "String", "string", ",", "JsonConfig", "jsonConfig", ")", "{", "JSON", "json", "=", "null", ";", "if", "(", "string", ".", "startsWith", "(", "\"[\"", ")", ")", "{", "json", "=", "JSONArray", ".", "fromObject",...
Creates a JSONObject, JSONArray or a JSONNull from a JSONString. @throws JSONException if the string is not a valid JSON string
[ "Creates", "a", "JSONObject", "JSONArray", "or", "a", "JSONNull", "from", "a", "JSONString", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONSerializer.java#L134-L147
Sciss/abc4j
abc/src/main/java/abc/ui/swing/ScoreTemplate.java
ScoreTemplate.setAttribute
public void setAttribute(ScoreAttribute sa, Object value) { if (value == null) m_attributes.remove(sa.getName()); else m_attributes.put(sa.getName(), value); notifyListeners(); }
java
public void setAttribute(ScoreAttribute sa, Object value) { if (value == null) m_attributes.remove(sa.getName()); else m_attributes.put(sa.getName(), value); notifyListeners(); }
[ "public", "void", "setAttribute", "(", "ScoreAttribute", "sa", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "m_attributes", ".", "remove", "(", "sa", ".", "getName", "(", ")", ")", ";", "else", "m_attributes", ".", "put", "(...
Sets the object associated to an attribute @param value <TT>null</TT> to remove this attribute
[ "Sets", "the", "object", "associated", "to", "an", "attribute" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreTemplate.java#L716-L722
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.addListener
public static void addListener(Document doc, Element root) { Element listener = doc.createElement("listener"); Element listenerClass = doc.createElement("listener-class"); listener.appendChild(listenerClass); listenerClass.appendChild(doc .createTextNode("org.apache.shiro.web.env.EnvironmentLoaderListener")); addRelativeTo(root, listener, "listener", true); }
java
public static void addListener(Document doc, Element root) { Element listener = doc.createElement("listener"); Element listenerClass = doc.createElement("listener-class"); listener.appendChild(listenerClass); listenerClass.appendChild(doc .createTextNode("org.apache.shiro.web.env.EnvironmentLoaderListener")); addRelativeTo(root, listener, "listener", true); }
[ "public", "static", "void", "addListener", "(", "Document", "doc", ",", "Element", "root", ")", "{", "Element", "listener", "=", "doc", ".", "createElement", "(", "\"listener\"", ")", ";", "Element", "listenerClass", "=", "doc", ".", "createElement", "(", "\...
Adds a shiro environment listener to load the shiro config file. @param doc The xml DOM document to create the new xml elements with. @param root The xml Element node to add the listener to.
[ "Adds", "a", "shiro", "environment", "listener", "to", "load", "the", "shiro", "config", "file", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L261-L269
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java
LollipopDrawablesCompat.createFromXml
public static Drawable createFromXml(Resources r, XmlPullParser parser, Resources.Theme theme) throws XmlPullParserException, IOException { AttributeSet attrs = Xml.asAttributeSet(parser); int type; while ((type = parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) { // Empty loop } if (type != XmlPullParser.START_TAG) { throw new XmlPullParserException("No start tag found"); } Drawable drawable = createFromXmlInner(r, parser, attrs, theme); if (drawable == null) { throw new RuntimeException("Unknown initial tag: " + parser.getName()); } return drawable; }
java
public static Drawable createFromXml(Resources r, XmlPullParser parser, Resources.Theme theme) throws XmlPullParserException, IOException { AttributeSet attrs = Xml.asAttributeSet(parser); int type; while ((type = parser.next()) != XmlPullParser.START_TAG && type != XmlPullParser.END_DOCUMENT) { // Empty loop } if (type != XmlPullParser.START_TAG) { throw new XmlPullParserException("No start tag found"); } Drawable drawable = createFromXmlInner(r, parser, attrs, theme); if (drawable == null) { throw new RuntimeException("Unknown initial tag: " + parser.getName()); } return drawable; }
[ "public", "static", "Drawable", "createFromXml", "(", "Resources", "r", ",", "XmlPullParser", "parser", ",", "Resources", ".", "Theme", "theme", ")", "throws", "XmlPullParserException", ",", "IOException", "{", "AttributeSet", "attrs", "=", "Xml", ".", "asAttribut...
Create a drawable from an XML document using an optional {@link Resources.Theme}. For more information on how to create resources in XML, see <a href="{@docRoot}guide/topics/resources/drawable-resource.html">Drawable Resources</a>.
[ "Create", "a", "drawable", "from", "an", "XML", "document", "using", "an", "optional", "{" ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LollipopDrawablesCompat.java#L108-L127
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.getPasswordlessAuthenticationAccount
public static <T> T getPasswordlessAuthenticationAccount(final Event event, final Class<T> clazz) { return event.getAttributes().get("passwordlessAccount", clazz); }
java
public static <T> T getPasswordlessAuthenticationAccount(final Event event, final Class<T> clazz) { return event.getAttributes().get("passwordlessAccount", clazz); }
[ "public", "static", "<", "T", ">", "T", "getPasswordlessAuthenticationAccount", "(", "final", "Event", "event", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "return", "event", ".", "getAttributes", "(", ")", ".", "get", "(", "\"passwordlessAccoun...
Gets passwordless authentication account. @param <T> the type parameter @param event the event @param clazz the clazz @return the passwordless authentication account
[ "Gets", "passwordless", "authentication", "account", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L849-L851
triceo/splitlog
splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java
LogWatchBuilder.withDelayBetweenSweeps
public LogWatchBuilder withDelayBetweenSweeps(final int length, final TimeUnit unit) { this.delayBetweenSweeps = LogWatchBuilder.getDelay(length, unit); return this; }
java
public LogWatchBuilder withDelayBetweenSweeps(final int length, final TimeUnit unit) { this.delayBetweenSweeps = LogWatchBuilder.getDelay(length, unit); return this; }
[ "public", "LogWatchBuilder", "withDelayBetweenSweeps", "(", "final", "int", "length", ",", "final", "TimeUnit", "unit", ")", "{", "this", ".", "delayBetweenSweeps", "=", "LogWatchBuilder", ".", "getDelay", "(", "length", ",", "unit", ")", ";", "return", "this", ...
Specify the delay between attempts to sweep the log watch from unreachable messages. @param length Length of time. @param unit Unit of that length. @return This.
[ "Specify", "the", "delay", "between", "attempts", "to", "sweep", "the", "log", "watch", "from", "unreachable", "messages", "." ]
train
https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java#L329-L332
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java
JBBPCompiler.writePackedInt
private static int writePackedInt(final OutputStream out, final int value) throws IOException { final byte[] packedInt = JBBPUtils.packInt(value); out.write(packedInt); return packedInt.length; }
java
private static int writePackedInt(final OutputStream out, final int value) throws IOException { final byte[] packedInt = JBBPUtils.packInt(value); out.write(packedInt); return packedInt.length; }
[ "private", "static", "int", "writePackedInt", "(", "final", "OutputStream", "out", ",", "final", "int", "value", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "packedInt", "=", "JBBPUtils", ".", "packInt", "(", "value", ")", ";", "out", "."...
Write an integer value in packed form into an output stream. @param out the output stream to be used to write the value into @param value the value to be written into the output stream @return the length of packed data in bytes @throws IOException it will be thrown for any IO problems
[ "Write", "an", "integer", "value", "in", "packed", "form", "into", "an", "output", "stream", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompiler.java#L529-L533
kiegroup/droolsjbpm-integration
kie-spring-boot/kie-spring-boot-autoconfiguration/kie-server-spring-boot-autoconfiguration-jbpm/src/main/java/org/kie/server/springboot/jbpm/ContainerAliasResolver.java
ContainerAliasResolver.forProcessInstance
public String forProcessInstance(String alias, long processInstanceId) { return registry.getContainerId(alias, new ByProcessInstanceIdContainerLocator(processInstanceId)); }
java
public String forProcessInstance(String alias, long processInstanceId) { return registry.getContainerId(alias, new ByProcessInstanceIdContainerLocator(processInstanceId)); }
[ "public", "String", "forProcessInstance", "(", "String", "alias", ",", "long", "processInstanceId", ")", "{", "return", "registry", ".", "getContainerId", "(", "alias", ",", "new", "ByProcessInstanceIdContainerLocator", "(", "processInstanceId", ")", ")", ";", "}" ]
Looks up container id for given alias that is associated with process instance @param alias container alias @param processInstanceId unique process instance id @return @throws IllegalArgumentException in case there are no containers for given alias
[ "Looks", "up", "container", "id", "for", "given", "alias", "that", "is", "associated", "with", "process", "instance" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-spring-boot/kie-spring-boot-autoconfiguration/kie-server-spring-boot-autoconfiguration-jbpm/src/main/java/org/kie/server/springboot/jbpm/ContainerAliasResolver.java#L65-L67
Nexmo/nexmo-java
src/main/java/com/nexmo/client/voice/VoiceClient.java
VoiceClient.startStream
public StreamResponse startStream(String uuid, String streamUrl, int loop) throws IOException, NexmoClientException { return streams.put(new StreamRequest(uuid, streamUrl, loop)); }
java
public StreamResponse startStream(String uuid, String streamUrl, int loop) throws IOException, NexmoClientException { return streams.put(new StreamRequest(uuid, streamUrl, loop)); }
[ "public", "StreamResponse", "startStream", "(", "String", "uuid", ",", "String", "streamUrl", ",", "int", "loop", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "streams", ".", "put", "(", "new", "StreamRequest", "(", "uuid", ",", "s...
Stream audio to an ongoing call. @param uuid The UUID of the call, obtained from the object returned by {@link #createCall(Call)}. This value can be obtained with {@link CallEvent#getUuid()} @param streamUrl A URL of an audio file in MP3 or 16-bit WAV format, to be streamed to the call. @param loop The number of times to repeat the audio. The default value is {@code 1}, or you can use {@code 0} to indicate that the audio should be repeated indefinitely. @return The data returned from the Voice API @throws IOException if a network error occurred contacting the Nexmo Voice API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects.
[ "Stream", "audio", "to", "an", "ongoing", "call", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/voice/VoiceClient.java#L206-L208
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.sendTransaction
public CompletableFuture<TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses, Collection<Orderer> orderers) { return sendTransaction(proposalResponses, orderers, client.getUserContext()); }
java
public CompletableFuture<TransactionEvent> sendTransaction(Collection<? extends ProposalResponse> proposalResponses, Collection<Orderer> orderers) { return sendTransaction(proposalResponses, orderers, client.getUserContext()); }
[ "public", "CompletableFuture", "<", "TransactionEvent", ">", "sendTransaction", "(", "Collection", "<", "?", "extends", "ProposalResponse", ">", "proposalResponses", ",", "Collection", "<", "Orderer", ">", "orderers", ")", "{", "return", "sendTransaction", "(", "pro...
Send transaction to one of the specified orderers using the usercontext set on the client.. @param proposalResponses The proposal responses to be sent to the orderer @param orderers The orderers to send the transaction to. @return a future allowing access to the result of the transaction invocation once complete.
[ "Send", "transaction", "to", "one", "of", "the", "specified", "orderers", "using", "the", "usercontext", "set", "on", "the", "client", ".." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L4657-L4660
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GpxParserTrk.java
GpxParserTrk.endElement
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); if ((getCurrentElement().equalsIgnoreCase(GPXTags.TEXT)) && (isPoint())) { getCurrentPoint().setLinkText(getContentBuffer()); } else if (getCurrentElement().equalsIgnoreCase(GPXTags.TEXT)) { getCurrentLine().setLinkText(getContentBuffer()); } }
java
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); if ((getCurrentElement().equalsIgnoreCase(GPXTags.TEXT)) && (isPoint())) { getCurrentPoint().setLinkText(getContentBuffer()); } else if (getCurrentElement().equalsIgnoreCase(GPXTags.TEXT)) { getCurrentLine().setLinkText(getContentBuffer()); } }
[ "@", "Override", "public", "void", "endElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "super", ".", "endElement", "(", "uri", ",", "localName", ",", "qName", ")", ";", "if", "(", "(...
Fires whenever an XML end markup is encountered. It catches attributes of trackPoints, trackSegments or routes and saves them in corresponding values[]. @param uri URI of the local element @param localName Name of the local element (without prefix) @param qName qName of the local element (with prefix) @throws SAXException Any SAX exception, possibly wrapping another exception
[ "Fires", "whenever", "an", "XML", "end", "markup", "is", "encountered", ".", "It", "catches", "attributes", "of", "trackPoints", "trackSegments", "or", "routes", "and", "saves", "them", "in", "corresponding", "values", "[]", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GpxParserTrk.java#L83-L91
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFileToDirectory
public static boolean copyFileToDirectory(final File source, final File destinationDir, final boolean lastModified) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { if (null == destinationDir) { throw new IllegalArgumentException("Destination must not be null"); } if (!destinationDir.isDirectory()) { throw new FileIsNotADirectoryException("Destination File-object '" + destinationDir.getAbsolutePath() + "' is not a directory."); } final File destinationFile = new File(destinationDir, source.getName()); return copyFile(source, destinationFile, lastModified); }
java
public static boolean copyFileToDirectory(final File source, final File destinationDir, final boolean lastModified) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { if (null == destinationDir) { throw new IllegalArgumentException("Destination must not be null"); } if (!destinationDir.isDirectory()) { throw new FileIsNotADirectoryException("Destination File-object '" + destinationDir.getAbsolutePath() + "' is not a directory."); } final File destinationFile = new File(destinationDir, source.getName()); return copyFile(source, destinationFile, lastModified); }
[ "public", "static", "boolean", "copyFileToDirectory", "(", "final", "File", "source", ",", "final", "File", "destinationDir", ",", "final", "boolean", "lastModified", ")", "throws", "FileIsNotADirectoryException", ",", "IOException", ",", "FileIsADirectoryException", "{...
Copies the given source file to the given destination directory with the option to set the lastModified time from the given destination directory. @param source The source directory. @param destinationDir The destination directory. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination directory. @return 's true if the file is copied to the given directory, otherwise false. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "directory", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L620-L637
alkacon/opencms-core
src/org/opencms/ui/CmsVaadinUtils.java
CmsVaadinUtils.replaceComponent
public static void replaceComponent(Component component, Component replacement) { if (!component.isAttached()) { throw new IllegalArgumentException("Component must be attached"); } HasComponents parent = component.getParent(); if (parent instanceof ComponentContainer) { ((ComponentContainer)parent).replaceComponent(component, replacement); } else if (parent instanceof SingleComponentContainer) { ((SingleComponentContainer)parent).setContent(replacement); } else { throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass()); } }
java
public static void replaceComponent(Component component, Component replacement) { if (!component.isAttached()) { throw new IllegalArgumentException("Component must be attached"); } HasComponents parent = component.getParent(); if (parent instanceof ComponentContainer) { ((ComponentContainer)parent).replaceComponent(component, replacement); } else if (parent instanceof SingleComponentContainer) { ((SingleComponentContainer)parent).setContent(replacement); } else { throw new IllegalArgumentException("Illegal class for parent: " + parent.getClass()); } }
[ "public", "static", "void", "replaceComponent", "(", "Component", "component", ",", "Component", "replacement", ")", "{", "if", "(", "!", "component", ".", "isAttached", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Component must be atta...
Replaces component with new component.<p> @param component to be replaced @param replacement new component
[ "Replaces", "component", "with", "new", "component", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1105-L1118
ozimov/cirneco
hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java
IsDateWithTime.hasHourAndMin
public static Matcher<Date> hasHourAndMin(final int hour, final int minute) { return new IsDateWithTime(hour, minute, null, null); }
java
public static Matcher<Date> hasHourAndMin(final int hour, final int minute) { return new IsDateWithTime(hour, minute, null, null); }
[ "public", "static", "Matcher", "<", "Date", ">", "hasHourAndMin", "(", "final", "int", "hour", ",", "final", "int", "minute", ")", "{", "return", "new", "IsDateWithTime", "(", "hour", ",", "minute", ",", "null", ",", "null", ")", ";", "}" ]
Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>hour</code> in a 24 hours clock period and <code>minute</code>.
[ "Creates", "a", "matcher", "that", "matches", "when", "the", "examined", "{" ]
train
https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java#L92-L94
intellimate/Izou
src/main/java/org/intellimate/izou/support/SystemMail.java
SystemMail.sendMail
public void sendMail(String toAddress, String subject, String content) { final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; logger.debug("Sending mail..."); Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); final String username = "intellimate.izou@gmail.com"; final String password = "Karlskrone"; // TODO: hide this when password stuff is done try{ Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(username)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(subject); message.setText(content); Transport.send(message); logger.debug("Mail sent successfully."); } catch (MessagingException e) { logger.error("Unable to send mail.", e); } }
java
public void sendMail(String toAddress, String subject, String content) { final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; logger.debug("Sending mail..."); Properties props = System.getProperties(); props.setProperty("mail.smtp.host", "smtp.gmail.com"); props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY); props.setProperty("mail.smtp.socketFactory.fallback", "false"); props.setProperty("mail.smtp.port", "465"); props.setProperty("mail.smtp.socketFactory.port", "465"); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.store.protocol", "pop3"); props.put("mail.transport.protocol", "smtp"); final String username = "intellimate.izou@gmail.com"; final String password = "Karlskrone"; // TODO: hide this when password stuff is done try{ Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(username)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); message.setSubject(subject); message.setText(content); Transport.send(message); logger.debug("Mail sent successfully."); } catch (MessagingException e) { logger.error("Unable to send mail.", e); } }
[ "public", "void", "sendMail", "(", "String", "toAddress", ",", "String", "subject", ",", "String", "content", ")", "{", "final", "String", "SSL_FACTORY", "=", "\"javax.net.ssl.SSLSocketFactory\"", ";", "logger", ".", "debug", "(", "\"Sending mail...\"", ")", ";", ...
Sends a mail to the address of {@code toAddress} with a subject of {@code subject} and a content of {@code content} WITHOUT an attachment @param toAddress the address to send the mail to @param subject the subject of the email to send @param content the content of the email (without attachment)
[ "Sends", "a", "mail", "to", "the", "address", "of", "{", "@code", "toAddress", "}", "with", "a", "subject", "of", "{", "@code", "subject", "}", "and", "a", "content", "of", "{", "@code", "content", "}", "WITHOUT", "an", "attachment" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/support/SystemMail.java#L135-L170
graphhopper/graphhopper
client-hc/src/main/java/com/graphhopper/api/MatrixResponse.java
MatrixResponse.getTime
public long getTime(int from, int to) { if (hasErrors()) { throw new IllegalStateException("Cannot return time (" + from + "," + to + ") if errors occured " + getErrors()); } if (from >= times.length) { throw new IllegalStateException("Cannot get 'from' " + from + " from times with size " + times.length); } else if (to >= times[from].length) { throw new IllegalStateException("Cannot get 'to' " + to + " from times with size " + times[from].length); } return times[from][to]; }
java
public long getTime(int from, int to) { if (hasErrors()) { throw new IllegalStateException("Cannot return time (" + from + "," + to + ") if errors occured " + getErrors()); } if (from >= times.length) { throw new IllegalStateException("Cannot get 'from' " + from + " from times with size " + times.length); } else if (to >= times[from].length) { throw new IllegalStateException("Cannot get 'to' " + to + " from times with size " + times[from].length); } return times[from][to]; }
[ "public", "long", "getTime", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "hasErrors", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot return time (\"", "+", "from", "+", "\",\"", "+", "to", "+", "\") if errors occ...
Returns the time for the specific entry (from -&gt; to) in milliseconds.
[ "Returns", "the", "time", "for", "the", "specific", "entry", "(", "from", "-", "&gt", ";", "to", ")", "in", "milliseconds", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/client-hc/src/main/java/com/graphhopper/api/MatrixResponse.java#L101-L112
census-instrumentation/opencensus-java
contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/HostResource.java
HostResource.create
public static Resource create(String hostname, String name, String id, String type) { Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(HOSTNAME_KEY, checkNotNull(hostname, "hostname")); labels.put(NAME_KEY, checkNotNull(name, "name")); labels.put(ID_KEY, checkNotNull(id, "id")); labels.put(TYPE_KEY, checkNotNull(type, "type")); return Resource.create(TYPE, labels); }
java
public static Resource create(String hostname, String name, String id, String type) { Map<String, String> labels = new LinkedHashMap<String, String>(); labels.put(HOSTNAME_KEY, checkNotNull(hostname, "hostname")); labels.put(NAME_KEY, checkNotNull(name, "name")); labels.put(ID_KEY, checkNotNull(id, "id")); labels.put(TYPE_KEY, checkNotNull(type, "type")); return Resource.create(TYPE, labels); }
[ "public", "static", "Resource", "create", "(", "String", "hostname", ",", "String", "name", ",", "String", "id", ",", "String", "type", ")", "{", "Map", "<", "String", ",", "String", ">", "labels", "=", "new", "LinkedHashMap", "<", "String", ",", "String...
Returns a {@link Resource} that describes a k8s container. @param hostname the hostname of the host. @param name the name of the host. @param id the unique host id (instance id in Cloud). @param type the type of the host (machine type). @return a {@link Resource} that describes a k8s container. @since 0.20
[ "Returns", "a", "{", "@link", "Resource", "}", "that", "describes", "a", "k8s", "container", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/resource_util/src/main/java/io/opencensus/contrib/resource/util/HostResource.java#L82-L89
konvergeio/cofoja
src/main/java/com/google/java/contract/core/agent/SpecificationMethodAdapter.java
SpecificationMethodAdapter.visitMaxs
@Override public void visitMaxs(int maxStack, int maxLocals) { if (withPreconditions || withPostconditions || withInvariants) { mark(methodEnd); catchException(methodStart, methodEnd, null); if (withPostconditions) { Label skipEx = new Label(); dup(); instanceOf(EXCEPTION_TYPE); ifZCmp(EQ, skipEx); Label skip = enterBusySection(); int throwIndex = newLocal(EXCEPTION_TYPE); checkCast(EXCEPTION_TYPE); storeLocal(throwIndex); invokeCommonPostconditions(ContractKind.SIGNAL, signalOldValueLocals, throwIndex); if (withInvariants && !statik) { invokeInvariants(); } loadLocal(throwIndex); leaveBusySection(skip); mark(skipEx); } /* * The exception to throw is on the stack and * leaveContractedMethod() does not alter that fact. */ leaveContractedMethod(); throwException(); } super.visitMaxs(maxStack, maxLocals); }
java
@Override public void visitMaxs(int maxStack, int maxLocals) { if (withPreconditions || withPostconditions || withInvariants) { mark(methodEnd); catchException(methodStart, methodEnd, null); if (withPostconditions) { Label skipEx = new Label(); dup(); instanceOf(EXCEPTION_TYPE); ifZCmp(EQ, skipEx); Label skip = enterBusySection(); int throwIndex = newLocal(EXCEPTION_TYPE); checkCast(EXCEPTION_TYPE); storeLocal(throwIndex); invokeCommonPostconditions(ContractKind.SIGNAL, signalOldValueLocals, throwIndex); if (withInvariants && !statik) { invokeInvariants(); } loadLocal(throwIndex); leaveBusySection(skip); mark(skipEx); } /* * The exception to throw is on the stack and * leaveContractedMethod() does not alter that fact. */ leaveContractedMethod(); throwException(); } super.visitMaxs(maxStack, maxLocals); }
[ "@", "Override", "public", "void", "visitMaxs", "(", "int", "maxStack", ",", "int", "maxLocals", ")", "{", "if", "(", "withPreconditions", "||", "withPostconditions", "||", "withInvariants", ")", "{", "mark", "(", "methodEnd", ")", ";", "catchException", "(", ...
Advises the method by injecting exceptional postconditions and invariants after the original code. This code only gets executed if an exception has been thrown (otherwise, a {@code return} instruction would have ended execution of the method already).
[ "Advises", "the", "method", "by", "injecting", "exceptional", "postconditions", "and", "invariants", "after", "the", "original", "code", ".", "This", "code", "only", "gets", "executed", "if", "an", "exception", "has", "been", "thrown", "(", "otherwise", "a", "...
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/agent/SpecificationMethodAdapter.java#L272-L309
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findResult
public static <T,K,V> T findResult(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<T> closure) { for (Map.Entry<K, V> entry : self.entrySet()) { T result = callClosureForMapEntry(closure, entry); if (result != null) { return result; } } return null; }
java
public static <T,K,V> T findResult(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<T> closure) { for (Map.Entry<K, V> entry : self.entrySet()) { T result = callClosureForMapEntry(closure, entry); if (result != null) { return result; } } return null; }
[ "public", "static", "<", "T", ",", "K", ",", "V", ">", "T", "findResult", "(", "Map", "<", "K", ",", "V", ">", "self", ",", "@", "ClosureParams", "(", "MapEntryOrKeyValue", ".", "class", ")", "Closure", "<", "T", ">", "closure", ")", "{", "for", ...
Returns the first non-null closure result found by passing each map entry to the closure, otherwise null is returned. If the closure takes two parameters, the entry key and value are passed. If the closure takes one parameter, the Map.Entry object is passed. <pre class="groovyTestCase"> assert "Found b:3" == [a:1, b:3].findResult { if (it.value == 3) return "Found ${it.key}:${it.value}" } assert null == [a:1, b:3].findResult { if (it.value == 9) return "Found ${it.key}:${it.value}" } assert "Found a:1" == [a:1, b:3].findResult { k, v -> if (k.size() + v == 2) return "Found $k:$v" } </pre> @param self a Map @param closure a 1 or 2 arg Closure that returns a non-null value when processing should stop and a value should be returned @return the first non-null result collected by calling the closure, or null if no such result was found @since 1.7.5
[ "Returns", "the", "first", "non", "-", "null", "closure", "result", "found", "by", "passing", "each", "map", "entry", "to", "the", "closure", "otherwise", "null", "is", "returned", ".", "If", "the", "closure", "takes", "two", "parameters", "the", "entry", ...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4105-L4113
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationPicker.java
CmsLocationPicker.setLocationInfo
protected void setLocationInfo(Map<String, String> infos) { if (infos.isEmpty()) { m_locationInfoPanel.getStyle().setDisplay(Display.NONE); } else { StringBuffer infoHtml = new StringBuffer(); for (Entry<String, String> info : infos.entrySet()) { infoHtml.append("<p><span>").append(info.getKey()).append(":</span>").append(info.getValue()).append( "</p>"); } m_locationInfoPanel.setInnerHTML(infoHtml.toString()); m_locationInfoPanel.getStyle().clearDisplay(); } }
java
protected void setLocationInfo(Map<String, String> infos) { if (infos.isEmpty()) { m_locationInfoPanel.getStyle().setDisplay(Display.NONE); } else { StringBuffer infoHtml = new StringBuffer(); for (Entry<String, String> info : infos.entrySet()) { infoHtml.append("<p><span>").append(info.getKey()).append(":</span>").append(info.getValue()).append( "</p>"); } m_locationInfoPanel.setInnerHTML(infoHtml.toString()); m_locationInfoPanel.getStyle().clearDisplay(); } }
[ "protected", "void", "setLocationInfo", "(", "Map", "<", "String", ",", "String", ">", "infos", ")", "{", "if", "(", "infos", ".", "isEmpty", "(", ")", ")", "{", "m_locationInfoPanel", ".", "getStyle", "(", ")", ".", "setDisplay", "(", "Display", ".", ...
Sets the location info to the info panel.<p> @param infos the location info items
[ "Sets", "the", "location", "info", "to", "the", "info", "panel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/location/CmsLocationPicker.java#L202-L215
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.appendProcessingInstruction
protected void appendProcessingInstruction(StringBuilder sb, ProcessingInstruction instr) { sb.append("<?") .append(instr.getTarget()) .append(' ').append(instr.getData()) .append("?>"); }
java
protected void appendProcessingInstruction(StringBuilder sb, ProcessingInstruction instr) { sb.append("<?") .append(instr.getTarget()) .append(' ').append(instr.getData()) .append("?>"); }
[ "protected", "void", "appendProcessingInstruction", "(", "StringBuilder", "sb", ",", "ProcessingInstruction", "instr", ")", "{", "sb", ".", "append", "(", "\"<?\"", ")", ".", "append", "(", "instr", ".", "getTarget", "(", ")", ")", ".", "append", "(", "'", ...
Formats a processing instruction for {@link #getShortString}. @param sb the builder to append to @param instr the processing instruction @since XMLUnit 2.4.0
[ "Formats", "a", "processing", "instruction", "for", "{", "@link", "#getShortString", "}", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L248-L253
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/JesqueUtils.java
JesqueUtils.createKey
public static String createKey(final String namespace, final Iterable<String> parts) { final List<String> list = new LinkedList<String>(); if (!"".equals(namespace)) { list.add(namespace); } for (final String part : parts) { list.add(part); } return join(COLON, list); }
java
public static String createKey(final String namespace, final Iterable<String> parts) { final List<String> list = new LinkedList<String>(); if (!"".equals(namespace)) { list.add(namespace); } for (final String part : parts) { list.add(part); } return join(COLON, list); }
[ "public", "static", "String", "createKey", "(", "final", "String", "namespace", ",", "final", "Iterable", "<", "String", ">", "parts", ")", "{", "final", "List", "<", "String", ">", "list", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "...
Builds a namespaced Redis key with the given arguments. @param namespace the namespace to use @param parts the key parts to be joined @return an assembled String key
[ "Builds", "a", "namespaced", "Redis", "key", "with", "the", "given", "arguments", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/JesqueUtils.java#L111-L120
grpc/grpc-java
context/src/main/java/io/grpc/Context.java
Context.addListener
public void addListener(final CancellationListener cancellationListener, final Executor executor) { checkNotNull(cancellationListener, "cancellationListener"); checkNotNull(executor, "executor"); if (canBeCancelled()) { ExecutableListener executableListener = new ExecutableListener(executor, cancellationListener); synchronized (this) { if (isCancelled()) { executableListener.deliver(); } else { if (listeners == null) { // Now that we have a listener we need to listen to our parent so // we can cascade listener notification. listeners = new ArrayList<>(); listeners.add(executableListener); if (cancellableAncestor != null) { cancellableAncestor.addListener(parentListener, DirectExecutor.INSTANCE); } } else { listeners.add(executableListener); } } } } }
java
public void addListener(final CancellationListener cancellationListener, final Executor executor) { checkNotNull(cancellationListener, "cancellationListener"); checkNotNull(executor, "executor"); if (canBeCancelled()) { ExecutableListener executableListener = new ExecutableListener(executor, cancellationListener); synchronized (this) { if (isCancelled()) { executableListener.deliver(); } else { if (listeners == null) { // Now that we have a listener we need to listen to our parent so // we can cascade listener notification. listeners = new ArrayList<>(); listeners.add(executableListener); if (cancellableAncestor != null) { cancellableAncestor.addListener(parentListener, DirectExecutor.INSTANCE); } } else { listeners.add(executableListener); } } } } }
[ "public", "void", "addListener", "(", "final", "CancellationListener", "cancellationListener", ",", "final", "Executor", "executor", ")", "{", "checkNotNull", "(", "cancellationListener", ",", "\"cancellationListener\"", ")", ";", "checkNotNull", "(", "executor", ",", ...
Add a listener that will be notified when the context becomes cancelled.
[ "Add", "a", "listener", "that", "will", "be", "notified", "when", "the", "context", "becomes", "cancelled", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/context/src/main/java/io/grpc/Context.java#L460-L485
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optBoolean
public static boolean optBoolean(@Nullable Bundle bundle, @Nullable String key, boolean fallback) { if (bundle == null) { return fallback; } return bundle.getBoolean(key, fallback); }
java
public static boolean optBoolean(@Nullable Bundle bundle, @Nullable String key, boolean fallback) { if (bundle == null) { return fallback; } return bundle.getBoolean(key, fallback); }
[ "public", "static", "boolean", "optBoolean", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "boolean", "fallback", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "return", "fallback", ";", "}", "return", "bu...
Returns a optional boolean value. In other words, returns the value mapped by key if it exists and is a boolean. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a boolean value if exists, fallback value otherwise. @see android.os.Bundle#getBoolean(String, boolean)
[ "Returns", "a", "optional", "boolean", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "boolean", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L138-L143
matomo-org/piwik-java-tracker
src/main/java/org/piwik/java/tracking/PiwikRequest.java
PiwikRequest.setUserCustomVariable
@Deprecated public void setUserCustomVariable(String key, String value){ if (value == null){ removeCustomVariable(VISIT_CUSTOM_VARIABLE, key); } else { setCustomVariable(VISIT_CUSTOM_VARIABLE, new CustomVariable(key, value), null); } }
java
@Deprecated public void setUserCustomVariable(String key, String value){ if (value == null){ removeCustomVariable(VISIT_CUSTOM_VARIABLE, key); } else { setCustomVariable(VISIT_CUSTOM_VARIABLE, new CustomVariable(key, value), null); } }
[ "@", "Deprecated", "public", "void", "setUserCustomVariable", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "removeCustomVariable", "(", "VISIT_CUSTOM_VARIABLE", ",", "key", ")", ";", "}", "else", "{", ...
Set a visit custom variable with the specified key and value at the first available index. All visit custom variables with this key will be overwritten or deleted @param key the key of the variable to set @param value the value of the variable to set at the specified key. A null value will remove this parameter @deprecated Use the {@link #setVisitCustomVariable(CustomVariable, int)} method instead.
[ "Set", "a", "visit", "custom", "variable", "with", "the", "specified", "key", "and", "value", "at", "the", "first", "available", "index", ".", "All", "visit", "custom", "variables", "with", "this", "key", "will", "be", "overwritten", "or", "deleted" ]
train
https://github.com/matomo-org/piwik-java-tracker/blob/23df71d27a89e89dc7a539b2eda88c90a206458b/src/main/java/org/piwik/java/tracking/PiwikRequest.java#L1382-L1389
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ThreadUtils.java
ThreadUtils.findThreadsByName
public static Collection<Thread> findThreadsByName(final String threadName, final ThreadGroup threadGroup) { return findThreads(threadGroup, false, new NamePredicate(threadName)); }
java
public static Collection<Thread> findThreadsByName(final String threadName, final ThreadGroup threadGroup) { return findThreads(threadGroup, false, new NamePredicate(threadName)); }
[ "public", "static", "Collection", "<", "Thread", ">", "findThreadsByName", "(", "final", "String", "threadName", ",", "final", "ThreadGroup", "threadGroup", ")", "{", "return", "findThreads", "(", "threadGroup", ",", "false", ",", "new", "NamePredicate", "(", "t...
Return active threads with the specified name if they belong to a specified thread group. @param threadName The thread name @param threadGroup The thread group @return The threads which belongs to a thread group and the thread's name match the specified name, An empty collection is returned if no such thread exists. The collection returned is always unmodifiable. @throws IllegalArgumentException if the specified thread name or group is null @throws SecurityException if the current thread cannot access the system thread group @throws SecurityException if the current thread cannot modify thread groups from this thread's thread group up to the system thread group
[ "Return", "active", "threads", "with", "the", "specified", "name", "if", "they", "belong", "to", "a", "specified", "thread", "group", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ThreadUtils.java#L101-L103
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/MalisisRegistry.java
MalisisRegistry.onPreSetBlock
public static void onPreSetBlock(ISetBlockCallback callback, CallbackOption<ISetBlockCallbackPredicate> option) { preSetBlockRegistry.registerCallback(callback, option); }
java
public static void onPreSetBlock(ISetBlockCallback callback, CallbackOption<ISetBlockCallbackPredicate> option) { preSetBlockRegistry.registerCallback(callback, option); }
[ "public", "static", "void", "onPreSetBlock", "(", "ISetBlockCallback", "callback", ",", "CallbackOption", "<", "ISetBlockCallbackPredicate", ">", "option", ")", "{", "preSetBlockRegistry", ".", "registerCallback", "(", "callback", ",", "option", ")", ";", "}" ]
Registers a {@link ISetBlockCallback} with the specified {@link CallbackOption} to be called after a {@link Block} is placed in the world. @param callback the callback @param option the option
[ "Registers", "a", "{", "@link", "ISetBlockCallback", "}", "with", "the", "specified", "{", "@link", "CallbackOption", "}", "to", "be", "called", "after", "a", "{", "@link", "Block", "}", "is", "placed", "in", "the", "world", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/MalisisRegistry.java#L175-L178
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/BosClient.java
BosClient.putObject
public PutObjectResponse putObject(String bucketName, String key, String value) { try { return this.putObject(bucketName, key, value.getBytes(DEFAULT_ENCODING), new ObjectMetadata()); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get bytes.", e); } }
java
public PutObjectResponse putObject(String bucketName, String key, String value) { try { return this.putObject(bucketName, key, value.getBytes(DEFAULT_ENCODING), new ObjectMetadata()); } catch (UnsupportedEncodingException e) { throw new BceClientException("Fail to get bytes.", e); } }
[ "public", "PutObjectResponse", "putObject", "(", "String", "bucketName", ",", "String", "key", ",", "String", "value", ")", "{", "try", "{", "return", "this", ".", "putObject", "(", "bucketName", ",", "key", ",", "value", ".", "getBytes", "(", "DEFAULT_ENCOD...
Uploads the specified string to Bos under the specified bucket and key name. @param bucketName The name of an existing bucket, to which you have Write permission. @param key The key under which to store the specified file. @param value The string containing the value to be uploaded to Bos. @return A PutObjectResponse object containing the information returned by Bos for the newly created object.
[ "Uploads", "the", "specified", "string", "to", "Bos", "under", "the", "specified", "bucket", "and", "key", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L814-L820
aerogear/aerogear-unifiedpush-server
push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java
AbstractJMSMessageProducer.sendNonTransacted
protected void sendNonTransacted(Destination destination, Serializable message) { send(destination, message, null, null, false); }
java
protected void sendNonTransacted(Destination destination, Serializable message) { send(destination, message, null, null, false); }
[ "protected", "void", "sendNonTransacted", "(", "Destination", "destination", ",", "Serializable", "message", ")", "{", "send", "(", "destination", ",", "message", ",", "null", ",", "null", ",", "false", ")", ";", "}" ]
Sends message to the destination in non-transactional manner. @param destination where to send @param message what to send Since non-transacted session is used, the message is send immediately without requiring to commit enclosing transaction.
[ "Sends", "message", "to", "the", "destination", "in", "non", "-", "transactional", "manner", "." ]
train
https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java#L54-L56
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java
WTemplate.addEngineOption
public void addEngineOption(final String key, final Object value) { if (Util.empty(key)) { throw new IllegalArgumentException("A key must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.engineOptions == null) { model.engineOptions = new HashMap<>(); } model.engineOptions.put(key, value); }
java
public void addEngineOption(final String key, final Object value) { if (Util.empty(key)) { throw new IllegalArgumentException("A key must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.engineOptions == null) { model.engineOptions = new HashMap<>(); } model.engineOptions.put(key, value); }
[ "public", "void", "addEngineOption", "(", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "if", "(", "Util", ".", "empty", "(", "key", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A key must be provided\"", ")", ";"...
Pass configuration options to the template engine. <p> The options are determined by the {@link TemplateRenderer} implementation for the template engine. </p> <p> The {@link TemplateRenderer} implemented is determined by the {@link TemplateRendererFactory}. </p> @param key the engine option key @param value the engine option value
[ "Pass", "configuration", "options", "to", "the", "template", "engine", ".", "<p", ">", "The", "options", "are", "determined", "by", "the", "{", "@link", "TemplateRenderer", "}", "implementation", "for", "the", "template", "engine", ".", "<", "/", "p", ">", ...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L313-L322
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsDocidNotFound
public FessMessages addErrorsDocidNotFound(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_docid_not_found, arg0)); return this; }
java
public FessMessages addErrorsDocidNotFound(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_docid_not_found, arg0)); return this; }
[ "public", "FessMessages", "addErrorsDocidNotFound", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_docid_not_found", ",", "arg0", ")", ...
Add the created action message for the key 'errors.docid_not_found' with parameters. <pre> message: Not found Doc ID:{0} </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "docid_not_found", "with", "parameters", ".", "<pre", ">", "message", ":", "Not", "found", "Doc", "ID", ":", "{", "0", "}", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1477-L1481
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newSecurityException
public static SecurityException newSecurityException(Throwable cause, String message, Object... args) { return new SecurityException(format(message, args), cause); }
java
public static SecurityException newSecurityException(Throwable cause, String message, Object... args) { return new SecurityException(format(message, args), cause); }
[ "public", "static", "SecurityException", "newSecurityException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "SecurityException", "(", "format", "(", "message", ",", "args", ")", ",", "cause", "...
Constructs and initializes a new {@link SecurityException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link SecurityException} was thrown. @param message {@link String} describing the {@link SecurityException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link SecurityException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.security.SecurityException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "SecurityException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L655-L657
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java
FastByteArrayOutputStream.writeToImpl
private void writeToImpl(Writer out, String encoding, byte[] bufferToWrite, int bufferToWriteLen) throws IOException { String writeStr; if (encoding != null) { writeStr = new String(bufferToWrite, 0, bufferToWriteLen, encoding); } else { writeStr = new String(bufferToWrite, 0, bufferToWriteLen); } out.write(writeStr); }
java
private void writeToImpl(Writer out, String encoding, byte[] bufferToWrite, int bufferToWriteLen) throws IOException { String writeStr; if (encoding != null) { writeStr = new String(bufferToWrite, 0, bufferToWriteLen, encoding); } else { writeStr = new String(bufferToWrite, 0, bufferToWriteLen); } out.write(writeStr); }
[ "private", "void", "writeToImpl", "(", "Writer", "out", ",", "String", "encoding", ",", "byte", "[", "]", "bufferToWrite", ",", "int", "bufferToWriteLen", ")", "throws", "IOException", "{", "String", "writeStr", ";", "if", "(", "encoding", "!=", "null", ")",...
Write <code>bufferToWriteLen</code> of bytes from <code>bufferToWrite</code> to <code>out</code> encoding it at the same time. @param out @param encoding @param bufferToWrite @param bufferToWriteLen @throws IOException
[ "Write", "<code", ">", "bufferToWriteLen<", "/", "code", ">", "of", "bytes", "from", "<code", ">", "bufferToWrite<", "/", "code", ">", "to", "<code", ">", "out<", "/", "code", ">", "encoding", "it", "at", "the", "same", "time", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java#L249-L258
RestComm/sip-servlets
containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/annotations/AnnotationsClassLoader.java
AnnotationsClassLoader.addPermission
public void addPermission(String path) { if (path == null) { return; } if (securityManager != null) { Permission permission = null; if( path.startsWith("jndi:") || path.startsWith("jar:jndi:") ) { if (!path.endsWith("/")) { path = path + "/"; } permission = new JndiPermission(path + "*"); addPermission(permission); } else { if (!path.endsWith(File.separator)) { permission = new FilePermission(path, "read"); addPermission(permission); path = path + File.separator; } permission = new FilePermission(path + "-", "read"); addPermission(permission); } } }
java
public void addPermission(String path) { if (path == null) { return; } if (securityManager != null) { Permission permission = null; if( path.startsWith("jndi:") || path.startsWith("jar:jndi:") ) { if (!path.endsWith("/")) { path = path + "/"; } permission = new JndiPermission(path + "*"); addPermission(permission); } else { if (!path.endsWith(File.separator)) { permission = new FilePermission(path, "read"); addPermission(permission); path = path + File.separator; } permission = new FilePermission(path + "-", "read"); addPermission(permission); } } }
[ "public", "void", "addPermission", "(", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", ";", "}", "if", "(", "securityManager", "!=", "null", ")", "{", "Permission", "permission", "=", "null", ";", "if", "(", "path", ...
If there is a Java SecurityManager create a read FilePermission or JndiPermission for the file directory path. @param path file directory path
[ "If", "there", "is", "a", "Java", "SecurityManager", "create", "a", "read", "FilePermission", "or", "JndiPermission", "for", "the", "file", "directory", "path", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/annotations/AnnotationsClassLoader.java#L449-L472
amaembo/streamex
src/main/java/one/util/streamex/IntStreamEx.java
IntStreamEx.joining
public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) { return collect(IntCollector.joining(delimiter, prefix, suffix)); }
java
public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) { return collect(IntCollector.joining(delimiter, prefix, suffix)); }
[ "public", "String", "joining", "(", "CharSequence", "delimiter", ",", "CharSequence", "prefix", ",", "CharSequence", "suffix", ")", "{", "return", "collect", "(", "IntCollector", ".", "joining", "(", "delimiter", ",", "prefix", ",", "suffix", ")", ")", ";", ...
Returns a {@link String} which is the concatenation of the results of calling {@link String#valueOf(int)} on each element of this stream, separated by the specified delimiter, with the specified prefix and suffix in encounter order. <p> This is a terminal operation. @param delimiter the delimiter to be used between each element @param prefix the sequence of characters to be used at the beginning of the joined result @param suffix the sequence of characters to be used at the end of the joined result @return the result of concatenation. For empty input stream {@code prefix + suffix} is returned. @since 0.3.1
[ "Returns", "a", "{", "@link", "String", "}", "which", "is", "the", "concatenation", "of", "the", "results", "of", "calling", "{", "@link", "String#valueOf", "(", "int", ")", "}", "on", "each", "element", "of", "this", "stream", "separated", "by", "the", ...
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1610-L1612
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/CommonUtils.java
CommonUtils.dateReservedQuarter999
public static Date dateReservedQuarter999(int year, int quarter) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); if (quarter <= 1) { calendar.set(Calendar.MONTH, Calendar.MARCH); } else if (quarter == 2) { calendar.set(Calendar.MONTH, Calendar.JUNE); } else if (quarter == 3) { calendar.set(Calendar.MONTH, Calendar.SEPTEMBER); } else { calendar.set(Calendar.MONTH, Calendar.DECEMBER); } return dateReservedMonth999(calendar); }
java
public static Date dateReservedQuarter999(int year, int quarter) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); if (quarter <= 1) { calendar.set(Calendar.MONTH, Calendar.MARCH); } else if (quarter == 2) { calendar.set(Calendar.MONTH, Calendar.JUNE); } else if (quarter == 3) { calendar.set(Calendar.MONTH, Calendar.SEPTEMBER); } else { calendar.set(Calendar.MONTH, Calendar.DECEMBER); } return dateReservedMonth999(calendar); }
[ "public", "static", "Date", "dateReservedQuarter999", "(", "int", "year", ",", "int", "quarter", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ")", ...
获取指定年,季度的最末时刻 @param year 年份 @param quarter 季度 @return 指定年, 季度的最末时刻日期对象
[ "获取指定年", "季度的最末时刻" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L492-L505
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java
AppClassLoader.checkLib
private static boolean checkLib(final File f, String basename) { boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return f.exists(); } }); return fExists && (f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename))); }
java
private static boolean checkLib(final File f, String basename) { boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return f.exists(); } }); return fExists && (f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename))); }
[ "private", "static", "boolean", "checkLib", "(", "final", "File", "f", ",", "String", "basename", ")", "{", "boolean", "fExists", "=", "System", ".", "getSecurityManager", "(", ")", "==", "null", "?", "f", ".", "exists", "(", ")", ":", "AccessController", ...
Check if the given file's name matches the given library basename. @param f The file to check. @param basename The basename to compare the file against. @return true if the file exists and its name matches the given basename. false otherwise.
[ "Check", "if", "the", "given", "file", "s", "name", "matches", "the", "given", "library", "basename", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L635-L644
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/common/ognl/OgnlFactory.java
OgnlFactory.getInstance
public static OgnlEvaluator getInstance(final Object root, final String expression) { final OgnlEvaluatorCollection collection = INSTANCE.getEvaluators(getRootClass(root)); return collection.get(expression); }
java
public static OgnlEvaluator getInstance(final Object root, final String expression) { final OgnlEvaluatorCollection collection = INSTANCE.getEvaluators(getRootClass(root)); return collection.get(expression); }
[ "public", "static", "OgnlEvaluator", "getInstance", "(", "final", "Object", "root", ",", "final", "String", "expression", ")", "{", "final", "OgnlEvaluatorCollection", "collection", "=", "INSTANCE", ".", "getEvaluators", "(", "getRootClass", "(", "root", ")", ")",...
Get an OGNL Evaluator for a particular expression with a given input @param root an example instance of the root object that will be passed to this OGNL evaluator @param expression the OGNL expression @return @see <a href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL Language Guide</a>
[ "Get", "an", "OGNL", "Evaluator", "for", "a", "particular", "expression", "with", "a", "given", "input" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/common/ognl/OgnlFactory.java#L61-L66
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/JNRPELogger.java
JNRPELogger.fatal
public void fatal(final IJNRPEExecutionContext ctx, final String message) { postEvent(ctx, new LogEvent(source, LogEventType.FATAL, message)); }
java
public void fatal(final IJNRPEExecutionContext ctx, final String message) { postEvent(ctx, new LogEvent(source, LogEventType.FATAL, message)); }
[ "public", "void", "fatal", "(", "final", "IJNRPEExecutionContext", "ctx", ",", "final", "String", "message", ")", "{", "postEvent", "(", "ctx", ",", "new", "LogEvent", "(", "source", ",", "LogEventType", ".", "FATAL", ",", "message", ")", ")", ";", "}" ]
Sends error level messages. @param ctx the JNRPE context @param message the message
[ "Sends", "error", "level", "messages", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/JNRPELogger.java#L154-L156
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_serviceInfos_GET
public OvhService organizationName_service_exchangeService_serviceInfos_GET(String organizationName, String exchangeService) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/serviceInfos"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
java
public OvhService organizationName_service_exchangeService_serviceInfos_GET(String organizationName, String exchangeService) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/serviceInfos"; StringBuilder sb = path(qPath, organizationName, exchangeService); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
[ "public", "OvhService", "organizationName_service_exchangeService_serviceInfos_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/service...
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/serviceInfos @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L336-L341
Netflix/astyanax
astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/AbstractHostPartitionConnectionPool.java
AbstractHostPartitionConnectionPool.removeHost
@Override public synchronized boolean removeHost(Host host, boolean refresh) { HostConnectionPool<CL> pool = hosts.remove(host); if (pool != null) { topology.removePool(pool); rebuildPartitions(); monitor.onHostRemoved(host); pool.shutdown(); return true; } else { return false; } }
java
@Override public synchronized boolean removeHost(Host host, boolean refresh) { HostConnectionPool<CL> pool = hosts.remove(host); if (pool != null) { topology.removePool(pool); rebuildPartitions(); monitor.onHostRemoved(host); pool.shutdown(); return true; } else { return false; } }
[ "@", "Override", "public", "synchronized", "boolean", "removeHost", "(", "Host", "host", ",", "boolean", "refresh", ")", "{", "HostConnectionPool", "<", "CL", ">", "pool", "=", "hosts", ".", "remove", "(", "host", ")", ";", "if", "(", "pool", "!=", "null...
Remove host from the system. Shuts down pool associated with the host and rebuilds partition map @param host @param refresh
[ "Remove", "host", "from", "the", "system", ".", "Shuts", "down", "pool", "associated", "with", "the", "host", "and", "rebuilds", "partition", "map" ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/impl/AbstractHostPartitionConnectionPool.java#L277-L290
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static <E extends Exception> int importData(final DataSet dataset, final int offset, final int count, final Try.Predicate<? super Object[], E> filter, final Connection conn, final String insertSQL, final int batchSize, final int batchInterval, final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException, E { PreparedStatement stmt = null; try { stmt = prepareStatement(conn, insertSQL); return importData(dataset, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter); } catch (SQLException e) { throw new UncheckedSQLException(e); } finally { JdbcUtil.closeQuietly(stmt); } }
java
public static <E extends Exception> int importData(final DataSet dataset, final int offset, final int count, final Try.Predicate<? super Object[], E> filter, final Connection conn, final String insertSQL, final int batchSize, final int batchInterval, final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException, E { PreparedStatement stmt = null; try { stmt = prepareStatement(conn, insertSQL); return importData(dataset, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter); } catch (SQLException e) { throw new UncheckedSQLException(e); } finally { JdbcUtil.closeQuietly(stmt); } }
[ "public", "static", "<", "E", "extends", "Exception", ">", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "int", "offset", ",", "final", "int", "count", ",", "final", "Try", ".", "Predicate", "<", "?", "super", "Object", "[", "]",...
Imports the data from <code>DataSet</code> to database. @param dataset @param offset @param count @param filter @param conn @param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql: <pre><code> List<String> columnNameList = new ArrayList<>(dataset.columnNameList()); columnNameList.retainAll(yourSelectColumnNames); String sql = RE.insert(columnNameList).into(tableName).sql(); </code></pre> @param batchSize @param batchInterval @param stmtSetter @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2152-L2166
threerings/narya
core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java
ChatDirector.setClientInfo
protected void setClientInfo (ChatMessage msg, String localType) { if (msg.localtype == null) { msg.setClientInfo(xlate(msg.bundle, msg.message), localType); } }
java
protected void setClientInfo (ChatMessage msg, String localType) { if (msg.localtype == null) { msg.setClientInfo(xlate(msg.bundle, msg.message), localType); } }
[ "protected", "void", "setClientInfo", "(", "ChatMessage", "msg", ",", "String", "localType", ")", "{", "if", "(", "msg", ".", "localtype", "==", "null", ")", "{", "msg", ".", "setClientInfo", "(", "xlate", "(", "msg", ".", "bundle", ",", "msg", ".", "m...
Set the "client info" on the specified message, if not already set.
[ "Set", "the", "client", "info", "on", "the", "specified", "message", "if", "not", "already", "set", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L1058-L1063
VoltDB/voltdb
third_party/java/src/org/apache/jute_voltpatches/compiler/CppGenerator.java
CppGenerator.genCode
void genCode() throws IOException { if (!outputDirectory.exists()) { if (!outputDirectory.mkdirs()) { throw new IOException("unable to create output directory " + outputDirectory); } } FileWriter cc = new FileWriter(new File(outputDirectory, mName + ".cc")); FileWriter hh = new FileWriter(new File(outputDirectory, mName + ".hh")); hh.write("/**\n"); hh.write("* Licensed to the Apache Software Foundation (ASF) under one\n"); hh.write("* or more contributor license agreements. See the NOTICE file\n"); hh.write("* distributed with this work for additional information\n"); hh.write("* regarding copyright ownership. The ASF licenses this file\n"); hh.write("* to you under the Apache License, Version 2.0 (the\n"); hh.write("* \"License\"); you may not use this file except in compliance\n"); hh.write("* with the License. You may obtain a copy of the License at\n"); hh.write("*\n"); hh.write("* http://www.apache.org/licenses/LICENSE-2.0\n"); hh.write("*\n"); hh.write("* Unless required by applicable law or agreed to in writing, software\n"); hh.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n"); hh.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); hh.write("* See the License for the specific language governing permissions and\n"); hh.write("* limitations under the License.\n"); hh.write("*/\n"); hh.write("\n"); cc.write("/**\n"); cc.write("* Licensed to the Apache Software Foundation (ASF) under one\n"); cc.write("* or more contributor license agreements. See the NOTICE file\n"); cc.write("* distributed with this work for additional information\n"); cc.write("* regarding copyright ownership. The ASF licenses this file\n"); cc.write("* to you under the Apache License, Version 2.0 (the\n"); cc.write("* \"License\"); you may not use this file except in compliance\n"); cc.write("* with the License. You may obtain a copy of the License at\n"); cc.write("*\n"); cc.write("* http://www.apache.org/licenses/LICENSE-2.0\n"); cc.write("*\n"); cc.write("* Unless required by applicable law or agreed to in writing, software\n"); cc.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n"); cc.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); cc.write("* See the License for the specific language governing permissions and\n"); cc.write("* limitations under the License.\n"); cc.write("*/\n"); cc.write("\n"); hh.write("#ifndef __" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.write("#define __" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.write("#include \"recordio.hh\"\n"); for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) { JFile f = i.next(); hh.write("#include \"" + f.getName() + ".hh\"\n"); } cc.write("#include \"" + mName + ".hh\"\n"); for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) { JRecord jr = i.next(); jr.genCppCode(hh, cc); } hh.write("#endif //" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.close(); cc.close(); }
java
void genCode() throws IOException { if (!outputDirectory.exists()) { if (!outputDirectory.mkdirs()) { throw new IOException("unable to create output directory " + outputDirectory); } } FileWriter cc = new FileWriter(new File(outputDirectory, mName + ".cc")); FileWriter hh = new FileWriter(new File(outputDirectory, mName + ".hh")); hh.write("/**\n"); hh.write("* Licensed to the Apache Software Foundation (ASF) under one\n"); hh.write("* or more contributor license agreements. See the NOTICE file\n"); hh.write("* distributed with this work for additional information\n"); hh.write("* regarding copyright ownership. The ASF licenses this file\n"); hh.write("* to you under the Apache License, Version 2.0 (the\n"); hh.write("* \"License\"); you may not use this file except in compliance\n"); hh.write("* with the License. You may obtain a copy of the License at\n"); hh.write("*\n"); hh.write("* http://www.apache.org/licenses/LICENSE-2.0\n"); hh.write("*\n"); hh.write("* Unless required by applicable law or agreed to in writing, software\n"); hh.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n"); hh.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); hh.write("* See the License for the specific language governing permissions and\n"); hh.write("* limitations under the License.\n"); hh.write("*/\n"); hh.write("\n"); cc.write("/**\n"); cc.write("* Licensed to the Apache Software Foundation (ASF) under one\n"); cc.write("* or more contributor license agreements. See the NOTICE file\n"); cc.write("* distributed with this work for additional information\n"); cc.write("* regarding copyright ownership. The ASF licenses this file\n"); cc.write("* to you under the Apache License, Version 2.0 (the\n"); cc.write("* \"License\"); you may not use this file except in compliance\n"); cc.write("* with the License. You may obtain a copy of the License at\n"); cc.write("*\n"); cc.write("* http://www.apache.org/licenses/LICENSE-2.0\n"); cc.write("*\n"); cc.write("* Unless required by applicable law or agreed to in writing, software\n"); cc.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n"); cc.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"); cc.write("* See the License for the specific language governing permissions and\n"); cc.write("* limitations under the License.\n"); cc.write("*/\n"); cc.write("\n"); hh.write("#ifndef __" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.write("#define __" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.write("#include \"recordio.hh\"\n"); for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) { JFile f = i.next(); hh.write("#include \"" + f.getName() + ".hh\"\n"); } cc.write("#include \"" + mName + ".hh\"\n"); for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) { JRecord jr = i.next(); jr.genCppCode(hh, cc); } hh.write("#endif //" + mName.toUpperCase().replace('.', '_') + "__\n"); hh.close(); cc.close(); }
[ "void", "genCode", "(", ")", "throws", "IOException", "{", "if", "(", "!", "outputDirectory", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "outputDirectory", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"unable to create...
Generate C++ code. This method only creates the requested file(s) and spits-out file-level elements (such as include statements etc.) record-level code is generated by JRecord.
[ "Generate", "C", "++", "code", ".", "This", "method", "only", "creates", "the", "requested", "file", "(", "s", ")", "and", "spits", "-", "out", "file", "-", "level", "elements", "(", "such", "as", "include", "statements", "etc", ".", ")", "record", "-"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/jute_voltpatches/compiler/CppGenerator.java#L60-L127
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java
PathPatternUtils.acceptDescendant
public static boolean acceptDescendant(String pattern, String absPath) { absPath = normalizePath(absPath); pattern = adopt2JavaPattern(pattern); // allows any descendants after pattern += "(/.+)?"; return absPath.matches(pattern); }
java
public static boolean acceptDescendant(String pattern, String absPath) { absPath = normalizePath(absPath); pattern = adopt2JavaPattern(pattern); // allows any descendants after pattern += "(/.+)?"; return absPath.matches(pattern); }
[ "public", "static", "boolean", "acceptDescendant", "(", "String", "pattern", ",", "String", "absPath", ")", "{", "absPath", "=", "normalizePath", "(", "absPath", ")", ";", "pattern", "=", "adopt2JavaPattern", "(", "pattern", ")", ";", "// allows any descendants af...
Returns <code>true</code> if a specified path or any descendant path is matched by pattern. @param pattern pattern for node path @param absPath node absolute path @return a <code>boolean</code>.
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "a", "specified", "path", "or", "any", "descendant", "path", "is", "matched", "by", "pattern", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/quota/PathPatternUtils.java#L84-L93
killbill/killbill
util/src/main/java/org/killbill/billing/util/entity/DefaultPagination.java
DefaultPagination.build
public static <T> Pagination<T> build(final Long offset, final Long limit, final Collection<T> elements) { return build(offset, limit, elements.size(), elements); }
java
public static <T> Pagination<T> build(final Long offset, final Long limit, final Collection<T> elements) { return build(offset, limit, elements.size(), elements); }
[ "public", "static", "<", "T", ">", "Pagination", "<", "T", ">", "build", "(", "final", "Long", "offset", ",", "final", "Long", "limit", ",", "final", "Collection", "<", "T", ">", "elements", ")", "{", "return", "build", "(", "offset", ",", "limit", "...
Notes: elements should be the entire records set (regardless of filtering) otherwise maxNbRecords won't be accurate
[ "Notes", ":", "elements", "should", "be", "the", "entire", "records", "set", "(", "regardless", "of", "filtering", ")", "otherwise", "maxNbRecords", "won", "t", "be", "accurate" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/entity/DefaultPagination.java#L42-L44
adyliu/jafka
src/main/java/io/jafka/utils/Utils.java
Utils.registerMBean
static boolean registerMBean(Object mbean, String name) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); synchronized (mbs) { ObjectName objName = new ObjectName(name); if (mbs.isRegistered(objName)) { mbs.unregisterMBean(objName); } mbs.registerMBean(mbean, objName); } return true; } catch (Exception e) { e.printStackTrace(); } return false; }
java
static boolean registerMBean(Object mbean, String name) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); synchronized (mbs) { ObjectName objName = new ObjectName(name); if (mbs.isRegistered(objName)) { mbs.unregisterMBean(objName); } mbs.registerMBean(mbean, objName); } return true; } catch (Exception e) { e.printStackTrace(); } return false; }
[ "static", "boolean", "registerMBean", "(", "Object", "mbean", ",", "String", "name", ")", "{", "try", "{", "MBeanServer", "mbs", "=", "ManagementFactory", ".", "getPlatformMBeanServer", "(", ")", ";", "synchronized", "(", "mbs", ")", "{", "ObjectName", "objNam...
Register the given mbean with the platform mbean server, unregistering any mbean that was there before. Note, this method will not throw an exception if the registration fails (since there is nothing you can do and it isn't fatal), instead it just returns false indicating the registration failed. @param mbean The object to register as an mbean @param name The name to register this mbean with @return true if the registration succeeded
[ "Register", "the", "given", "mbean", "with", "the", "platform", "mbean", "server", "unregistering", "any", "mbean", "that", "was", "there", "before", ".", "Note", "this", "method", "will", "not", "throw", "an", "exception", "if", "the", "registration", "fails"...
train
https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/utils/Utils.java#L371-L386
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java
RuntimeUtil.getResult
public static String getResult(Process process, Charset charset) { InputStream in = null; try { in = process.getInputStream(); return IoUtil.read(in, charset); } finally { IoUtil.close(in); destroy(process); } }
java
public static String getResult(Process process, Charset charset) { InputStream in = null; try { in = process.getInputStream(); return IoUtil.read(in, charset); } finally { IoUtil.close(in); destroy(process); } }
[ "public", "static", "String", "getResult", "(", "Process", "process", ",", "Charset", "charset", ")", "{", "InputStream", "in", "=", "null", ";", "try", "{", "in", "=", "process", ".", "getInputStream", "(", ")", ";", "return", "IoUtil", ".", "read", "("...
获取命令执行结果,获取后销毁进程 @param process {@link Process} 进程 @param charset 编码 @return 命令执行结果列表 @since 3.1.2
[ "获取命令执行结果,获取后销毁进程" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L191-L200
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomMetadataWriter.java
AtomMetadataWriter.writeFeedId
void writeFeedId(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_ID); if (entity != null) { xmlWriter.writeCharacters(String.format("%s/%s/%s", oDataUri.serviceRoot(), getEntityWithKey(entity), property.getName())); } else { String id; if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { id = buildFeedIdFromOperationCall(oDataUri); } else { id = getEntitySetId(oDataUri).get(); } xmlWriter.writeCharacters(id); } xmlWriter.writeEndElement(); }
java
void writeFeedId(Object entity, NavigationProperty property) throws XMLStreamException, ODataEdmException { xmlWriter.writeStartElement(ATOM_ID); if (entity != null) { xmlWriter.writeCharacters(String.format("%s/%s/%s", oDataUri.serviceRoot(), getEntityWithKey(entity), property.getName())); } else { String id; if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { id = buildFeedIdFromOperationCall(oDataUri); } else { id = getEntitySetId(oDataUri).get(); } xmlWriter.writeCharacters(id); } xmlWriter.writeEndElement(); }
[ "void", "writeFeedId", "(", "Object", "entity", ",", "NavigationProperty", "property", ")", "throws", "XMLStreamException", ",", "ODataEdmException", "{", "xmlWriter", ".", "writeStartElement", "(", "ATOM_ID", ")", ";", "if", "(", "entity", "!=", "null", ")", "{...
Write an {@code <id>} element when the parent element is a {@code <feed>} element. @param entity The enclosing entity for which the feed is getting generated. @param property The property that will be expanded in the feed. @throws XMLStreamException If unable to write to stream @throws ODataEdmException If unable to write feed id to stream
[ "Write", "an", "{", "@code", "<id", ">", "}", "element", "when", "the", "parent", "element", "is", "a", "{", "@code", "<feed", ">", "}", "element", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomMetadataWriter.java#L203-L221
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getMapValueFieldType
public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) { return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel); }
java
public static Class<?> getMapValueFieldType(Field mapField, int nestingLevel) { return getGenericFieldType(mapField, Map.class, 1, null, nestingLevel); }
[ "public", "static", "Class", "<", "?", ">", "getMapValueFieldType", "(", "Field", "mapField", ",", "int", "nestingLevel", ")", "{", "return", "getGenericFieldType", "(", "mapField", ",", "Map", ".", "class", ",", "1", ",", "null", ",", "nestingLevel", ")", ...
Determine the generic value type of the given Map field. @param mapField the map field to introspect @param nestingLevel the nesting level of the target type (typically 1; e.g. in case of a List of Lists, 1 would indicate the nested List, whereas 2 would indicate the element of the nested List) @return the generic type, or {@code null} if none
[ "Determine", "the", "generic", "value", "type", "of", "the", "given", "Map", "field", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/GenericCollectionTypeResolver.java#L160-L162
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.email_pro_email_GET
public OvhXdslEmailPro email_pro_email_GET(String email) throws IOException { String qPath = "/xdsl/email/pro/{email}"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhXdslEmailPro.class); }
java
public OvhXdslEmailPro email_pro_email_GET(String email) throws IOException { String qPath = "/xdsl/email/pro/{email}"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhXdslEmailPro.class); }
[ "public", "OvhXdslEmailPro", "email_pro_email_GET", "(", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/email/pro/{email}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "email", ")", ";", "String", "resp", ...
Get this object properties REST: GET /xdsl/email/pro/{email} @param email [required] The email address if the XDSL Email Pro
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1910-L1915
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/loader/BindingXmlLoader.java
BindingXmlLoader.loadDocument
private static Document loadDocument(URL location) throws IOException, ParserConfigurationException, SAXException { InputStream inputStream = null; if (location != null) { URLConnection urlConnection = location.openConnection(); urlConnection.setUseCaches(false); inputStream = urlConnection.getInputStream(); } if (inputStream == null) { if (location == null) { throw new IOException("Failed to obtain InputStream for named location: null"); } else { throw new IOException("Failed to obtain InputStream for named location: " + location.toExternalForm()); } } InputSource inputSource = new InputSource(inputStream); List<SAXParseException> errors = new ArrayList<SAXParseException>(); DocumentBuilder docBuilder = constructDocumentBuilder(errors); Document document = docBuilder.parse(inputSource); if (!errors.isEmpty()) { if (location == null) { throw new IllegalStateException("Invalid File: null", (Throwable) errors.get(0)); } else { throw new IllegalStateException("Invalid file: " + location.toExternalForm(), (Throwable) errors.get(0)); } } return document; }
java
private static Document loadDocument(URL location) throws IOException, ParserConfigurationException, SAXException { InputStream inputStream = null; if (location != null) { URLConnection urlConnection = location.openConnection(); urlConnection.setUseCaches(false); inputStream = urlConnection.getInputStream(); } if (inputStream == null) { if (location == null) { throw new IOException("Failed to obtain InputStream for named location: null"); } else { throw new IOException("Failed to obtain InputStream for named location: " + location.toExternalForm()); } } InputSource inputSource = new InputSource(inputStream); List<SAXParseException> errors = new ArrayList<SAXParseException>(); DocumentBuilder docBuilder = constructDocumentBuilder(errors); Document document = docBuilder.parse(inputSource); if (!errors.isEmpty()) { if (location == null) { throw new IllegalStateException("Invalid File: null", (Throwable) errors.get(0)); } else { throw new IllegalStateException("Invalid file: " + location.toExternalForm(), (Throwable) errors.get(0)); } } return document; }
[ "private", "static", "Document", "loadDocument", "(", "URL", "location", ")", "throws", "IOException", ",", "ParserConfigurationException", ",", "SAXException", "{", "InputStream", "inputStream", "=", "null", ";", "if", "(", "location", "!=", "null", ")", "{", "...
Helper method to load a DOM Document from the given configuration URL @param location The configuration URL @return A W3C DOM Document @throws IOException If the configuration cannot be read @throws ParserConfigurationException If the DOM Parser cannot be initialised @throws SAXException If the configuraiton cannot be parsed
[ "Helper", "method", "to", "load", "a", "DOM", "Document", "from", "the", "given", "configuration", "URL" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/loader/BindingXmlLoader.java#L87-L118
mapsforge/mapsforge
mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/group/ChildMarker.java
ChildMarker.init
public void init(int index, Bitmap bitmap, int horizontalOffset, int verticalOffset) { this.index = index; this.groupBitmapHalfHeight = bitmap.getHeight() / 2; this.groupBitmapHalfWidth = bitmap.getWidth() / 2; this.groupHOffset = horizontalOffset; this.groupVOffset = verticalOffset; }
java
public void init(int index, Bitmap bitmap, int horizontalOffset, int verticalOffset) { this.index = index; this.groupBitmapHalfHeight = bitmap.getHeight() / 2; this.groupBitmapHalfWidth = bitmap.getWidth() / 2; this.groupHOffset = horizontalOffset; this.groupVOffset = verticalOffset; }
[ "public", "void", "init", "(", "int", "index", ",", "Bitmap", "bitmap", ",", "int", "horizontalOffset", ",", "int", "verticalOffset", ")", "{", "this", ".", "index", "=", "index", ";", "this", ".", "groupBitmapHalfHeight", "=", "bitmap", ".", "getHeight", ...
Set group marker parameter. To know index and calculate position on spiral. @param index the index of this child marker. @param bitmap the bitmap of the group marker. @param horizontalOffset the horizontal offset of the group marker. @param verticalOffset the vertical offset of the group marker.
[ "Set", "group", "marker", "parameter", ".", "To", "know", "index", "and", "calculate", "position", "on", "spiral", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-android/src/main/java/org/mapsforge/samples/android/group/ChildMarker.java#L125-L132
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.fillBeanWithMap
public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) { return fillBeanWithMap(map, bean, false, copyOptions); }
java
public static <T> T fillBeanWithMap(Map<?, ?> map, T bean, CopyOptions copyOptions) { return fillBeanWithMap(map, bean, false, copyOptions); }
[ "public", "static", "<", "T", ">", "T", "fillBeanWithMap", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "T", "bean", ",", "CopyOptions", "copyOptions", ")", "{", "return", "fillBeanWithMap", "(", "map", ",", "bean", ",", "false", ",", "copyOptions"...
使用Map填充Bean对象 @param <T> Bean类型 @param map Map @param bean Bean @param copyOptions 属性复制选项 {@link CopyOptions} @return Bean
[ "使用Map填充Bean对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L408-L410
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java
ClassUtils.buildApplicationObject
@SuppressWarnings("unchecked") public static <T> T buildApplicationObject(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, Collection<String> classNamesIterator, T defaultObject) { return buildApplicationObject(interfaceClass, extendedInterfaceClass, extendedInterfaceWrapperClass, classNamesIterator, defaultObject, null); }
java
@SuppressWarnings("unchecked") public static <T> T buildApplicationObject(Class<T> interfaceClass, Class<? extends T> extendedInterfaceClass, Class<? extends T> extendedInterfaceWrapperClass, Collection<String> classNamesIterator, T defaultObject) { return buildApplicationObject(interfaceClass, extendedInterfaceClass, extendedInterfaceWrapperClass, classNamesIterator, defaultObject, null); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "buildApplicationObject", "(", "Class", "<", "T", ">", "interfaceClass", ",", "Class", "<", "?", "extends", "T", ">", "extendedInterfaceClass", ",", "Class", "<", "?"...
Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern. @param <T> @param interfaceClass The class from which the implementation has to inherit from. @param extendedInterfaceClass A subclass of interfaceClass which specifies a more detailed implementation. @param extendedInterfaceWrapperClass A wrapper class for the case that you have an ApplicationObject which only implements the interfaceClass but not the extendedInterfaceClass. @param classNamesIterator All the class names of the actual ApplicationObject implementations from the faces-config.xml. @param defaultObject The default implementation for the given ApplicationObject. @return
[ "Creates", "ApplicationObjects", "like", "NavigationHandler", "or", "StateManager", "and", "creates", "the", "right", "wrapping", "chain", "of", "the", "ApplicationObjects", "known", "as", "the", "decorator", "pattern", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java#L579-L586
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/ProtempaUtil.java
ProtempaUtil.checkArray
public static void checkArray(Object[] array, String arrayName) { if (array == null) { throw new IllegalArgumentException(arrayName + " cannot be null"); } if (array.length == 0) { throw new IllegalArgumentException(arrayName + " cannot be empty"); } checkArrayForNullElement(array, arrayName); }
java
public static void checkArray(Object[] array, String arrayName) { if (array == null) { throw new IllegalArgumentException(arrayName + " cannot be null"); } if (array.length == 0) { throw new IllegalArgumentException(arrayName + " cannot be empty"); } checkArrayForNullElement(array, arrayName); }
[ "public", "static", "void", "checkArray", "(", "Object", "[", "]", "array", ",", "String", "arrayName", ")", "{", "if", "(", "array", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "arrayName", "+", "\" cannot be null\"", ")", ";", ...
Checks if the specified array is null, has length zero or has null values. If any of those criteria are me, an {@link IllegalArgumentException} is thrown. @param array an {@link Object[]}. @param arrayName the variable name {@link String} of the array ( used in the exception message). Should not be <code>null</code>, or the exception message will not indicate which parameter was erroneously <code>null</code>.
[ "Checks", "if", "the", "specified", "array", "is", "null", "has", "length", "zero", "or", "has", "null", "values", ".", "If", "any", "of", "those", "criteria", "are", "me", "an", "{", "@link", "IllegalArgumentException", "}", "is", "thrown", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/ProtempaUtil.java#L112-L122
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/JcElement.java
JcElement.stringProperty
public JcString stringProperty(String name) { JcString ret = new JcString(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "stringProperty", ret, QueryRecorder.literal(name)); return ret; }
java
public JcString stringProperty(String name) { JcString ret = new JcString(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS); QueryRecorder.recordInvocationConditional(this, "stringProperty", ret, QueryRecorder.literal(name)); return ret; }
[ "public", "JcString", "stringProperty", "(", "String", "name", ")", "{", "JcString", "ret", "=", "new", "JcString", "(", "name", ",", "this", ",", "OPERATOR", ".", "PropertyContainer", ".", "PROPERTY_ACCESS", ")", ";", "QueryRecorder", ".", "recordInvocationCond...
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>access a named string property, return a <b>JcString</b></i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", ...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcElement.java#L53-L57
aol/cyclops
cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java
Pipes.publishToAsync
public void publishToAsync(final K key, final Publisher<V> publisher) { SequentialElasticPools.simpleReact.react(er -> er.of(publisher) .peek(p -> publishTo(key, p))); }
java
public void publishToAsync(final K key, final Publisher<V> publisher) { SequentialElasticPools.simpleReact.react(er -> er.of(publisher) .peek(p -> publishTo(key, p))); }
[ "public", "void", "publishToAsync", "(", "final", "K", "key", ",", "final", "Publisher", "<", "V", ">", "publisher", ")", "{", "SequentialElasticPools", ".", "simpleReact", ".", "react", "(", "er", "->", "er", ".", "of", "(", "publisher", ")", ".", "peek...
Asynchronously publish data to the Adapter specified by the provided Key <pre> {@code Pipes<String,Integer> pipes = Pipes.of(); Queue<Integer> queue = new Queue(); pipes.register("hello", queue); pipes.publishToAsync("hello",ReactiveSeq.of(1,2,3)); Thread.sleep(100); queue.offer(4); queue.close(); assertThat(queue.stream().toList(),equalTo(Arrays.asList(1,2,3,4))); } </pre> @param key for registered simple-react async.Adapter @param publisher Reactive Streams publisher to push data onto this pipe
[ "Asynchronously", "publish", "data", "to", "the", "Adapter", "specified", "by", "the", "provided", "Key" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/Pipes.java#L613-L616
KyoriPowered/text
api/src/main/java/net/kyori/text/TranslatableComponent.java
TranslatableComponent.of
public static TranslatableComponent of(final @NonNull String key, final @NonNull List<Component> args) { return of(key, null, args); }
java
public static TranslatableComponent of(final @NonNull String key, final @NonNull List<Component> args) { return of(key, null, args); }
[ "public", "static", "TranslatableComponent", "of", "(", "final", "@", "NonNull", "String", "key", ",", "final", "@", "NonNull", "List", "<", "Component", ">", "args", ")", "{", "return", "of", "(", "key", ",", "null", ",", "args", ")", ";", "}" ]
Creates a translatable component with a translation key and arguments. @param key the translation key @param args the translation arguments @return the translatable component
[ "Creates", "a", "translatable", "component", "with", "a", "translation", "key", "and", "arguments", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TranslatableComponent.java#L157-L159
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.getPropertyValue
private String getPropertyValue(String level, String name) { return getDefForLevel(level).getProperty(name); }
java
private String getPropertyValue(String level, String name) { return getDefForLevel(level).getProperty(name); }
[ "private", "String", "getPropertyValue", "(", "String", "level", ",", "String", "name", ")", "{", "return", "getDefForLevel", "(", "level", ")", ".", "getProperty", "(", "name", ")", ";", "}" ]
Returns the value of the indicated property of the current object on the specified level. @param level The level @param name The name of the property @return The property value
[ "Returns", "the", "value", "of", "the", "indicated", "property", "of", "the", "current", "object", "on", "the", "specified", "level", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1901-L1904
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/StreamNanoHTTPD.java
StreamNanoHTTPD.addAsyncHandler
public void addAsyncHandler(final String path, final String mimeType, @javax.annotation.Nonnull final Consumer<OutputStream> logic, final boolean async) { addSessionHandler(path, com.simiacryptus.util.StreamNanoHTTPD.asyncHandler(pool, mimeType, logic, async)); }
java
public void addAsyncHandler(final String path, final String mimeType, @javax.annotation.Nonnull final Consumer<OutputStream> logic, final boolean async) { addSessionHandler(path, com.simiacryptus.util.StreamNanoHTTPD.asyncHandler(pool, mimeType, logic, async)); }
[ "public", "void", "addAsyncHandler", "(", "final", "String", "path", ",", "final", "String", "mimeType", ",", "@", "javax", ".", "annotation", ".", "Nonnull", "final", "Consumer", "<", "OutputStream", ">", "logic", ",", "final", "boolean", "async", ")", "{",...
Add async handler. @param path the path @param mimeType the mime type @param logic the logic @param async the async
[ "Add", "async", "handler", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/StreamNanoHTTPD.java#L175-L177
zaproxy/zaproxy
src/org/parosproxy/paros/view/AbstractFrame.java
AbstractFrame.restoreWindowSize
private Dimension restoreWindowSize() { Dimension result = null; final String sizestr = preferences.get(prefnzPrefix+PREF_WINDOW_SIZE, null); if (sizestr != null) { int width = 0; int height = 0; final String[] sizes = sizestr.split("[,]"); try { width = Integer.parseInt(sizes[0].trim()); height = Integer.parseInt(sizes[1].trim()); } catch (final Exception e) { // ignoring, cause is prevented by default values; } if (width > 0 && height > 0) { result = new Dimension(width, height); if (logger.isDebugEnabled()) logger.debug("Restoring preference " + PREF_WINDOW_SIZE + "=" + result.width + "," + result.height); this.setSize(result); } } return result; }
java
private Dimension restoreWindowSize() { Dimension result = null; final String sizestr = preferences.get(prefnzPrefix+PREF_WINDOW_SIZE, null); if (sizestr != null) { int width = 0; int height = 0; final String[] sizes = sizestr.split("[,]"); try { width = Integer.parseInt(sizes[0].trim()); height = Integer.parseInt(sizes[1].trim()); } catch (final Exception e) { // ignoring, cause is prevented by default values; } if (width > 0 && height > 0) { result = new Dimension(width, height); if (logger.isDebugEnabled()) logger.debug("Restoring preference " + PREF_WINDOW_SIZE + "=" + result.width + "," + result.height); this.setSize(result); } } return result; }
[ "private", "Dimension", "restoreWindowSize", "(", ")", "{", "Dimension", "result", "=", "null", ";", "final", "String", "sizestr", "=", "preferences", ".", "get", "(", "prefnzPrefix", "+", "PREF_WINDOW_SIZE", ",", "null", ")", ";", "if", "(", "sizestr", "!="...
Loads and set the saved size preferences for this frame. @return the size of the frame OR null, if there wasn't any preference.
[ "Loads", "and", "set", "the", "saved", "size", "preferences", "for", "this", "frame", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractFrame.java#L199-L219
nohana/Amalgam
amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java
MotionEventUtils.getHorizontalMotionDirection
public static MotionDirection getHorizontalMotionDirection(float delta, float threshold) { if (threshold < 0) { throw new IllegalArgumentException("threshold should be positive or zero."); } return delta < -threshold ? MotionDirection.LEFT : delta > threshold ? MotionDirection.RIGHT : MotionDirection.FIX; }
java
public static MotionDirection getHorizontalMotionDirection(float delta, float threshold) { if (threshold < 0) { throw new IllegalArgumentException("threshold should be positive or zero."); } return delta < -threshold ? MotionDirection.LEFT : delta > threshold ? MotionDirection.RIGHT : MotionDirection.FIX; }
[ "public", "static", "MotionDirection", "getHorizontalMotionDirection", "(", "float", "delta", ",", "float", "threshold", ")", "{", "if", "(", "threshold", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"threshold should be positive or zero.\"", ...
Calculate the horizontal move motion direction. @param delta moved delta. @param threshold threshold to detect the motion. @return the motion direction for the horizontal axis.
[ "Calculate", "the", "horizontal", "move", "motion", "direction", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/MotionEventUtils.java#L72-L77
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/impl/TransactionTable.java
TransactionTable.getOrCreateLocalTransaction
public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) { LocalTransaction current = localTransactions.get(transaction); if (current == null) { if (!running) { // Assume that we wouldn't get this far if the cache was already stopped throw log.cacheIsStopping(cacheName); } GlobalTransaction tx = gtxFactory.get(); current = txFactory.newLocalTransaction(transaction, tx, implicitTransaction, currentTopologyId); if (trace) log.tracef("Created a new local transaction: %s", current); localTransactions.put(transaction, current); globalToLocalTransactions.put(current.getGlobalTransaction(), current); if (notifier.hasListener(TransactionRegistered.class)) { // TODO: this should be allowed to be async at some point CompletionStages.join(notifier.notifyTransactionRegistered(tx, true)); } } return current; }
java
public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) { LocalTransaction current = localTransactions.get(transaction); if (current == null) { if (!running) { // Assume that we wouldn't get this far if the cache was already stopped throw log.cacheIsStopping(cacheName); } GlobalTransaction tx = gtxFactory.get(); current = txFactory.newLocalTransaction(transaction, tx, implicitTransaction, currentTopologyId); if (trace) log.tracef("Created a new local transaction: %s", current); localTransactions.put(transaction, current); globalToLocalTransactions.put(current.getGlobalTransaction(), current); if (notifier.hasListener(TransactionRegistered.class)) { // TODO: this should be allowed to be async at some point CompletionStages.join(notifier.notifyTransactionRegistered(tx, true)); } } return current; }
[ "public", "LocalTransaction", "getOrCreateLocalTransaction", "(", "Transaction", "transaction", ",", "boolean", "implicitTransaction", ",", "Supplier", "<", "GlobalTransaction", ">", "gtxFactory", ")", "{", "LocalTransaction", "current", "=", "localTransactions", ".", "ge...
Similar to {@link #getOrCreateLocalTransaction(Transaction, boolean)} but with a custom global transaction factory.
[ "Similar", "to", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/impl/TransactionTable.java#L426-L444
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.randomlyDivideSave
public void randomlyDivideSave(double percentage, String fileName1, String fileName2) throws Exception { ArrayList<String> rows = this.getDataRows(); Collections.shuffle(rows); int portion = (int) (rows.size() * percentage); for (int i = 0; i < portion; i++) { this.hideRow(rows.get(i), true); } this.saveTXT(fileName2); for (int i = 0; i < portion; i++) { this.hideRow(rows.get(i), false); } for (int i = portion; i < rows.size(); i++) { this.hideRow(rows.get(i), true); } this.saveTXT(fileName1); for (int i = portion; i < rows.size(); i++) { this.hideRow(rows.get(i), false); } }
java
public void randomlyDivideSave(double percentage, String fileName1, String fileName2) throws Exception { ArrayList<String> rows = this.getDataRows(); Collections.shuffle(rows); int portion = (int) (rows.size() * percentage); for (int i = 0; i < portion; i++) { this.hideRow(rows.get(i), true); } this.saveTXT(fileName2); for (int i = 0; i < portion; i++) { this.hideRow(rows.get(i), false); } for (int i = portion; i < rows.size(); i++) { this.hideRow(rows.get(i), true); } this.saveTXT(fileName1); for (int i = portion; i < rows.size(); i++) { this.hideRow(rows.get(i), false); } }
[ "public", "void", "randomlyDivideSave", "(", "double", "percentage", ",", "String", "fileName1", ",", "String", "fileName2", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "rows", "=", "this", ".", "getDataRows", "(", ")", ";", "Collections"...
Split a worksheet randomly. Used for creating a discovery/validation data set The first file name will matched the percentage and the second file the remainder @param percentage @param fileName1 @param fileName2 @throws Exception
[ "Split", "a", "worksheet", "randomly", ".", "Used", "for", "creating", "a", "discovery", "/", "validation", "data", "set", "The", "first", "file", "name", "will", "matched", "the", "percentage", "and", "the", "second", "file", "the", "remainder" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L141-L160
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findIndexOf
public static <T> int findIndexOf(Iterator<T> self, int startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) { int result = -1; int i = 0; BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition); while (self.hasNext()) { Object value = self.next(); if (i++ < startIndex) { continue; } if (bcw.call(value)) { result = i - 1; break; } } return result; }
java
public static <T> int findIndexOf(Iterator<T> self, int startIndex, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) { int result = -1; int i = 0; BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition); while (self.hasNext()) { Object value = self.next(); if (i++ < startIndex) { continue; } if (bcw.call(value)) { result = i - 1; break; } } return result; }
[ "public", "static", "<", "T", ">", "int", "findIndexOf", "(", "Iterator", "<", "T", ">", "self", ",", "int", "startIndex", ",", "@", "ClosureParams", "(", "FirstParam", ".", "FirstGenericType", ".", "class", ")", "Closure", "condition", ")", "{", "int", ...
Iterates over the elements of an Iterator, starting from a specified startIndex, and returns the index of the first item that satisfies the condition specified by the closure. @param self an Iterator @param startIndex start matching from this index @param condition the matching condition @return an integer that is the index of the first matched object or -1 if no match was found @since 2.5.0
[ "Iterates", "over", "the", "elements", "of", "an", "Iterator", "starting", "from", "a", "specified", "startIndex", "and", "returns", "the", "index", "of", "the", "first", "item", "that", "satisfies", "the", "condition", "specified", "by", "the", "closure", "."...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16737-L16752
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java
HawkbitCommonUtil.getFormatedLabel
public static Label getFormatedLabel(final String labelContent) { final Label labelValue = new Label(labelContent, ContentMode.HTML); labelValue.setSizeFull(); labelValue.addStyleName(SPUIDefinitions.TEXT_STYLE); labelValue.addStyleName("label-style"); return labelValue; }
java
public static Label getFormatedLabel(final String labelContent) { final Label labelValue = new Label(labelContent, ContentMode.HTML); labelValue.setSizeFull(); labelValue.addStyleName(SPUIDefinitions.TEXT_STYLE); labelValue.addStyleName("label-style"); return labelValue; }
[ "public", "static", "Label", "getFormatedLabel", "(", "final", "String", "labelContent", ")", "{", "final", "Label", "labelValue", "=", "new", "Label", "(", "labelContent", ",", "ContentMode", ".", "HTML", ")", ";", "labelValue", ".", "setSizeFull", "(", ")", ...
Get formatted label.Appends ellipses if content does not fit the label. @param labelContent content @return Label
[ "Get", "formatted", "label", ".", "Appends", "ellipses", "if", "content", "does", "not", "fit", "the", "label", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java#L248-L254
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java
PumpStreamHandler.createPump
protected Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted, boolean flushImmediately) { return newThread(new StreamPumper(is, os, closeWhenExhausted, flushImmediately)); }
java
protected Thread createPump(InputStream is, OutputStream os, boolean closeWhenExhausted, boolean flushImmediately) { return newThread(new StreamPumper(is, os, closeWhenExhausted, flushImmediately)); }
[ "protected", "Thread", "createPump", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "boolean", "closeWhenExhausted", ",", "boolean", "flushImmediately", ")", "{", "return", "newThread", "(", "new", "StreamPumper", "(", "is", ",", "os", ",", "closeWhen...
Creates a stream pumper to copy the given input stream to the given output stream. @param is the input stream to copy from @param os the output stream to copy into @param closeWhenExhausted close the output stream when the input stream is exhausted @param flushImmediately flush the output stream whenever data was written to it @return the stream pumper thread
[ "Creates", "a", "stream", "pumper", "to", "copy", "the", "given", "input", "stream", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java#L338-L340
apigee/usergrid-java-sdk
src/main/java/org/usergrid/java/client/Client.java
Client.registerDeviceForPush
public Device registerDeviceForPush(UUID deviceId, String notifier, String token, Map<String, Object> properties) { if (properties == null) { properties = new HashMap<String, Object>(); } String notifierKey = notifier + ".notifier.id"; properties.put(notifierKey, token); return registerDevice(deviceId, properties); }
java
public Device registerDeviceForPush(UUID deviceId, String notifier, String token, Map<String, Object> properties) { if (properties == null) { properties = new HashMap<String, Object>(); } String notifierKey = notifier + ".notifier.id"; properties.put(notifierKey, token); return registerDevice(deviceId, properties); }
[ "public", "Device", "registerDeviceForPush", "(", "UUID", "deviceId", ",", "String", "notifier", ",", "String", "token", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "properties", "==", "null", ")", "{", "properties", "...
Registers a device using the device's unique device ID. @param context @param properties @return a Device object if success
[ "Registers", "a", "device", "using", "the", "device", "s", "unique", "device", "ID", "." ]
train
https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L561-L571
intellimate/Izou
src/main/java/org/intellimate/izou/output/OutputManager.java
OutputManager.removeOutputExtension
public void removeOutputExtension(OutputExtensionModel<?, ?> outputExtension) { IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensions = this.outputExtensions.get(outputExtension.getPluginId()); if (outputExtensions != null) outputExtensions.remove(outputExtension); IdentificationManager.getInstance().getIdentification(outputExtension) .ifPresent(id -> outputPlugins.stream() .filter(outputPlugin -> outputPlugin.getID().equals(outputExtension.getPluginId())) .forEach(outputPlugin -> outputPlugin.outputExtensionRemoved(id))); }
java
public void removeOutputExtension(OutputExtensionModel<?, ?> outputExtension) { IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensions = this.outputExtensions.get(outputExtension.getPluginId()); if (outputExtensions != null) outputExtensions.remove(outputExtension); IdentificationManager.getInstance().getIdentification(outputExtension) .ifPresent(id -> outputPlugins.stream() .filter(outputPlugin -> outputPlugin.getID().equals(outputExtension.getPluginId())) .forEach(outputPlugin -> outputPlugin.outputExtensionRemoved(id))); }
[ "public", "void", "removeOutputExtension", "(", "OutputExtensionModel", "<", "?", ",", "?", ">", "outputExtension", ")", "{", "IdentifiableSet", "<", "OutputExtensionModel", "<", "?", ",", "?", ">", ">", "outputExtensions", "=", "this", ".", "outputExtensions", ...
removes the output-extension of id: extensionId from outputPluginList @param outputExtension the OutputExtension to remove
[ "removes", "the", "output", "-", "extension", "of", "id", ":", "extensionId", "from", "outputPluginList" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L120-L129
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.checkDirectory
protected static void checkDirectory(boolean generateSouceOnly, File sourceOutputDir) { if (generateSouceOnly) { if (sourceOutputDir == null) { throw new RuntimeException("param 'sourceOutputDir' is null."); } if (!sourceOutputDir.isDirectory()) { throw new RuntimeException("param 'sourceOutputDir' should be a exist file directory."); } } }
java
protected static void checkDirectory(boolean generateSouceOnly, File sourceOutputDir) { if (generateSouceOnly) { if (sourceOutputDir == null) { throw new RuntimeException("param 'sourceOutputDir' is null."); } if (!sourceOutputDir.isDirectory()) { throw new RuntimeException("param 'sourceOutputDir' should be a exist file directory."); } } }
[ "protected", "static", "void", "checkDirectory", "(", "boolean", "generateSouceOnly", ",", "File", "sourceOutputDir", ")", "{", "if", "(", "generateSouceOnly", ")", "{", "if", "(", "sourceOutputDir", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(...
to check current {@link File} is a directory. @param generateSouceOnly the generate souce only @param sourceOutputDir the source output dir
[ "to", "check", "current", "{", "@link", "File", "}", "is", "a", "directory", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L267-L277
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/XMLBuilder.java
XMLBuilder.addDataElement
public void addDataElement(String elemName, String content, String attrName, String attrValue) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", attrName, "", "CDATA", attrValue); writeDataElement(elemName, attrs, content); }
java
public void addDataElement(String elemName, String content, String attrName, String attrValue) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", attrName, "", "CDATA", attrValue); writeDataElement(elemName, attrs, content); }
[ "public", "void", "addDataElement", "(", "String", "elemName", ",", "String", "content", ",", "String", "attrName", ",", "String", "attrValue", ")", "{", "AttributesImpl", "attrs", "=", "new", "AttributesImpl", "(", ")", ";", "attrs", ".", "addAttribute", "(",...
Same as above but with a single attribute name/value pair as well.
[ "Same", "as", "above", "but", "with", "a", "single", "attribute", "name", "/", "value", "pair", "as", "well", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/XMLBuilder.java#L105-L109
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
MultiUserChatLight.setRoomConfigs
public void setRoomConfigs(HashMap<String, String> customConfigs) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { setRoomConfigs(null, customConfigs); }
java
public void setRoomConfigs(HashMap<String, String> customConfigs) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { setRoomConfigs(null, customConfigs); }
[ "public", "void", "setRoomConfigs", "(", "HashMap", "<", "String", ",", "String", ">", "customConfigs", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "setRoomConfigs", "(", "null", ",",...
Set the room configurations. @param customConfigs @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Set", "the", "room", "configurations", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java#L484-L487
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java
MetadataStore.getOrAssignSegmentId
@VisibleForTesting CompletableFuture<Long> getOrAssignSegmentId(String streamSegmentName, Duration timeout) { return getOrAssignSegmentId(streamSegmentName, timeout, CompletableFuture::completedFuture); }
java
@VisibleForTesting CompletableFuture<Long> getOrAssignSegmentId(String streamSegmentName, Duration timeout) { return getOrAssignSegmentId(streamSegmentName, timeout, CompletableFuture::completedFuture); }
[ "@", "VisibleForTesting", "CompletableFuture", "<", "Long", ">", "getOrAssignSegmentId", "(", "String", "streamSegmentName", ",", "Duration", "timeout", ")", "{", "return", "getOrAssignSegmentId", "(", "streamSegmentName", ",", "timeout", ",", "CompletableFuture", "::",...
Same as {@link #getOrAssignSegmentId(String, Duration, Function)) except that this simply returns a CompletableFuture with the SegmentId. @param streamSegmentName The case-sensitive StreamSegment Name. @param timeout The timeout for the operation. @return A CompletableFuture that, when completed normally, will contain SegmentId. If failed, this will contain the exception that caused the failure.
[ "Same", "as", "{", "@link", "#getOrAssignSegmentId", "(", "String", "Duration", "Function", "))", "except", "that", "this", "simply", "returns", "a", "CompletableFuture", "with", "the", "SegmentId", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L369-L372
nobuoka/android-lib-ZXingCaptureActivity
src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java
CaptureActivityIntents.setDecodeFormats
public static void setDecodeFormats(Intent intent, Collection<BarcodeFormat> formats) { StringBuilder sb = new StringBuilder(); for (BarcodeFormat f : formats) { if (sb.length() != 0) sb.append(","); sb.append(f.name()); } String formatsStr = sb.toString(); if (formatsStr.length() != 0) intent.putExtra(Intents.Scan.FORMATS, formatsStr); }
java
public static void setDecodeFormats(Intent intent, Collection<BarcodeFormat> formats) { StringBuilder sb = new StringBuilder(); for (BarcodeFormat f : formats) { if (sb.length() != 0) sb.append(","); sb.append(f.name()); } String formatsStr = sb.toString(); if (formatsStr.length() != 0) intent.putExtra(Intents.Scan.FORMATS, formatsStr); }
[ "public", "static", "void", "setDecodeFormats", "(", "Intent", "intent", ",", "Collection", "<", "BarcodeFormat", ">", "formats", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "BarcodeFormat", "f", ":", "formats", "...
Set barcode formats to scan for onto {@code Intent}. This setting precedes to setting by {@code #setDecodeFormats} method. In case that {@code formats} is empty collection, this method do nothing. @param intent Target intent. @param formats Barcode formats to scan for.
[ "Set", "barcode", "formats", "to", "scan", "for", "onto", "{" ]
train
https://github.com/nobuoka/android-lib-ZXingCaptureActivity/blob/17aaa7cf75520d3f2e03db9796b7e8c1d1f1b1e6/src/main/java/info/vividcode/android/zxing/CaptureActivityIntents.java#L38-L46
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
Watch.addDoc
private DocumentChange addDoc(QueryDocumentSnapshot newDocument) { ResourcePath resourcePath = newDocument.getReference().getResourcePath(); documentSet = documentSet.add(newDocument); int newIndex = documentSet.indexOf(resourcePath); return new DocumentChange(newDocument, Type.ADDED, -1, newIndex); }
java
private DocumentChange addDoc(QueryDocumentSnapshot newDocument) { ResourcePath resourcePath = newDocument.getReference().getResourcePath(); documentSet = documentSet.add(newDocument); int newIndex = documentSet.indexOf(resourcePath); return new DocumentChange(newDocument, Type.ADDED, -1, newIndex); }
[ "private", "DocumentChange", "addDoc", "(", "QueryDocumentSnapshot", "newDocument", ")", "{", "ResourcePath", "resourcePath", "=", "newDocument", ".", "getReference", "(", ")", ".", "getResourcePath", "(", ")", ";", "documentSet", "=", "documentSet", ".", "add", "...
Applies a document add to the document tree. Returns the corresponding DocumentChange event.
[ "Applies", "a", "document", "add", "to", "the", "document", "tree", ".", "Returns", "the", "corresponding", "DocumentChange", "event", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L497-L502
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java
HttpAuthUtils.splitCookieToken
private static Map<String, String> splitCookieToken(String tokenStr) { Map<String, String> map = new HashMap<String, String>(); StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR); while (st.hasMoreTokens()) { String part = st.nextToken(); int separator = part.indexOf(COOKIE_KEY_VALUE_SEPARATOR); if (separator == -1) { LOG.error("Invalid token string " + tokenStr); return null; } String key = part.substring(0, separator); String value = part.substring(separator + 1); map.put(key, value); } return map; }
java
private static Map<String, String> splitCookieToken(String tokenStr) { Map<String, String> map = new HashMap<String, String>(); StringTokenizer st = new StringTokenizer(tokenStr, COOKIE_ATTR_SEPARATOR); while (st.hasMoreTokens()) { String part = st.nextToken(); int separator = part.indexOf(COOKIE_KEY_VALUE_SEPARATOR); if (separator == -1) { LOG.error("Invalid token string " + tokenStr); return null; } String key = part.substring(0, separator); String value = part.substring(separator + 1); map.put(key, value); } return map; }
[ "private", "static", "Map", "<", "String", ",", "String", ">", "splitCookieToken", "(", "String", "tokenStr", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "StringTok...
Splits the cookie token into attributes pairs. @param str input token. @return a map with the attribute pairs of the token if the input is valid. Else, returns null.
[ "Splits", "the", "cookie", "token", "into", "attributes", "pairs", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L124-L140
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.mergeCalls
public void mergeCalls( String connId, String otherConnId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidmergeData mergeData = new VoicecallsidmergeData(); mergeData.setOtherConnId(otherConnId); mergeData.setReasons(Util.toKVList(reasons)); mergeData.setExtensions(Util.toKVList(extensions)); MergeData data = new MergeData(); data.data(mergeData); ApiSuccessResponse response = this.voiceApi.merge(connId, data); throwIfNotOk("mergeCalls", response); } catch (ApiException e) { throw new WorkspaceApiException("mergeCalls failed.", e); } }
java
public void mergeCalls( String connId, String otherConnId, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidmergeData mergeData = new VoicecallsidmergeData(); mergeData.setOtherConnId(otherConnId); mergeData.setReasons(Util.toKVList(reasons)); mergeData.setExtensions(Util.toKVList(extensions)); MergeData data = new MergeData(); data.data(mergeData); ApiSuccessResponse response = this.voiceApi.merge(connId, data); throwIfNotOk("mergeCalls", response); } catch (ApiException e) { throw new WorkspaceApiException("mergeCalls failed.", e); } }
[ "public", "void", "mergeCalls", "(", "String", "connId", ",", "String", "otherConnId", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidmergeData", "mergeData", "=", "n...
Merge the two specified calls. @param connId The connection ID of the first call to be merged. @param otherConnId The connection ID of the second call to be merged. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Merge", "the", "two", "specified", "calls", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1252-L1272
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java
MapTileCollisionLoader.loadCollisions
public void loadCollisions(MapTileCollision mapCollision, Media collisionFormulas, Media collisionGroups) { if (collisionFormulas.exists()) { loadCollisionFormulas(collisionFormulas); } if (collisionGroups.exists()) { loadCollisionGroups(mapCollision, collisionGroups); } loadTilesCollisions(mapCollision); applyConstraints(); }
java
public void loadCollisions(MapTileCollision mapCollision, Media collisionFormulas, Media collisionGroups) { if (collisionFormulas.exists()) { loadCollisionFormulas(collisionFormulas); } if (collisionGroups.exists()) { loadCollisionGroups(mapCollision, collisionGroups); } loadTilesCollisions(mapCollision); applyConstraints(); }
[ "public", "void", "loadCollisions", "(", "MapTileCollision", "mapCollision", ",", "Media", "collisionFormulas", ",", "Media", "collisionGroups", ")", "{", "if", "(", "collisionFormulas", ".", "exists", "(", ")", ")", "{", "loadCollisionFormulas", "(", "collisionForm...
Load map collision from an external file. @param mapCollision The map tile collision owner. @param collisionFormulas The collision formulas descriptor. @param collisionGroups The tile collision groups descriptor. @throws LionEngineException If error when reading collisions.
[ "Load", "map", "collision", "from", "an", "external", "file", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java#L83-L95
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java
Retryer.incrementingWait
public Retryer<R> incrementingWait(final long initialSleepTime, final long increment) { checkArgument(initialSleepTime >= 0L, "initialSleepTime must be >= 0 but is %d", initialSleepTime); return withWaitStrategy(new WaitStrategy() { @Override public long computeSleepTime(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { long result = initialSleepTime + (increment * (previousAttemptNumber - 1)); return result >= 0L ? result : 0L; } }); }
java
public Retryer<R> incrementingWait(final long initialSleepTime, final long increment) { checkArgument(initialSleepTime >= 0L, "initialSleepTime must be >= 0 but is %d", initialSleepTime); return withWaitStrategy(new WaitStrategy() { @Override public long computeSleepTime(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) { long result = initialSleepTime + (increment * (previousAttemptNumber - 1)); return result >= 0L ? result : 0L; } }); }
[ "public", "Retryer", "<", "R", ">", "incrementingWait", "(", "final", "long", "initialSleepTime", ",", "final", "long", "increment", ")", "{", "checkArgument", "(", "initialSleepTime", ">=", "0L", ",", "\"initialSleepTime must be >= 0 but is %d\"", ",", "initialSleepT...
Sets the strategy that sleeps a fixed amount milliseconds after the first failed attempt and in incrementing amounts milliseconds after each additional failed attempt. @param initialSleepTime @param increment @return
[ "Sets", "the", "strategy", "that", "sleeps", "a", "fixed", "amount", "milliseconds", "after", "the", "first", "failed", "attempt", "and", "in", "incrementing", "amounts", "milliseconds", "after", "each", "additional", "failed", "attempt", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Retryer.java#L451-L460
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getFactors
public List<AuthFactor> getFactors(long userId) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_FACTORS_URL, userId)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); List<AuthFactor> authFactors = new ArrayList<AuthFactor>(); OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { JSONObject data = oAuthResponse.getData(); if (data.has("auth_factors")) { JSONArray dataArray = data.getJSONArray("auth_factors"); if (dataArray != null && dataArray.length() > 0) { AuthFactor authFactor; for (int i = 0; i < dataArray.length(); i++) { authFactor = new AuthFactor(dataArray.getJSONObject(i)); authFactors.add(authFactor); } } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return authFactors; }
java
public List<AuthFactor> getFactors(long userId) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_FACTORS_URL, userId)); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); List<AuthFactor> authFactors = new ArrayList<AuthFactor>(); OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() == 200) { JSONObject data = oAuthResponse.getData(); if (data.has("auth_factors")) { JSONArray dataArray = data.getJSONArray("auth_factors"); if (dataArray != null && dataArray.length() > 0) { AuthFactor authFactor; for (int i = 0; i < dataArray.length(); i++) { authFactor = new AuthFactor(dataArray.getJSONObject(i)); authFactors.add(authFactor); } } } } else { error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return authFactors; }
[ "public", "List", "<", "AuthFactor", ">", "getFactors", "(", "long", "userId", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "URIBuilder", "url", "...
Returns a list of authentication factors that are available for user enrollment via API. @param userId The id of the user. @return Array AuthFactor list @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/available-factors">Get Available Authentication Factors documentation</a>
[ "Returns", "a", "list", "of", "authentication", "factors", "that", "are", "available", "for", "user", "enrollment", "via", "API", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2624-L2660
jpelzer/pelzer-util
src/main/java/com/pelzer/util/json/JSONUtil.java
JSONUtil.fromJSON
public static <T> T fromJSON(String json, Class<T> classOfT) { return gson.fromJson(json, classOfT); }
java
public static <T> T fromJSON(String json, Class<T> classOfT) { return gson.fromJson(json, classOfT); }
[ "public", "static", "<", "T", ">", "T", "fromJSON", "(", "String", "json", ",", "Class", "<", "T", ">", "classOfT", ")", "{", "return", "gson", ".", "fromJson", "(", "json", ",", "classOfT", ")", ";", "}" ]
Deserializes the given JSON into an instance of the given class.
[ "Deserializes", "the", "given", "JSON", "into", "an", "instance", "of", "the", "given", "class", "." ]
train
https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/json/JSONUtil.java#L27-L29
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java
ExpressRouteLinksInner.getAsync
public Observable<ExpressRouteLinkInner> getAsync(String resourceGroupName, String expressRoutePortName, String linkName) { return getWithServiceResponseAsync(resourceGroupName, expressRoutePortName, linkName).map(new Func1<ServiceResponse<ExpressRouteLinkInner>, ExpressRouteLinkInner>() { @Override public ExpressRouteLinkInner call(ServiceResponse<ExpressRouteLinkInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteLinkInner> getAsync(String resourceGroupName, String expressRoutePortName, String linkName) { return getWithServiceResponseAsync(resourceGroupName, expressRoutePortName, linkName).map(new Func1<ServiceResponse<ExpressRouteLinkInner>, ExpressRouteLinkInner>() { @Override public ExpressRouteLinkInner call(ServiceResponse<ExpressRouteLinkInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteLinkInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "expressRoutePortName", ",", "String", "linkName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "expressRoutePort...
Retrieves the specified ExpressRouteLink resource. @param resourceGroupName The name of the resource group. @param expressRoutePortName The name of the ExpressRoutePort resource. @param linkName The name of the ExpressRouteLink resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteLinkInner object
[ "Retrieves", "the", "specified", "ExpressRouteLink", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java#L112-L119
opentok/Opentok-Java-SDK
src/main/java/com/opentok/OpenTok.java
OpenTok.forceDisconnect
public void forceDisconnect(String sessionId, String connectionId) throws OpenTokException , InvalidArgumentException, RequestException { if (sessionId == null || sessionId.isEmpty() || connectionId == null || connectionId.isEmpty()) { throw new InvalidArgumentException("Session or Connection string null or empty"); } try { this.client.forceDisconnect(sessionId, connectionId); } catch (Exception e) { throw e; } }
java
public void forceDisconnect(String sessionId, String connectionId) throws OpenTokException , InvalidArgumentException, RequestException { if (sessionId == null || sessionId.isEmpty() || connectionId == null || connectionId.isEmpty()) { throw new InvalidArgumentException("Session or Connection string null or empty"); } try { this.client.forceDisconnect(sessionId, connectionId); } catch (Exception e) { throw e; } }
[ "public", "void", "forceDisconnect", "(", "String", "sessionId", ",", "String", "connectionId", ")", "throws", "OpenTokException", ",", "InvalidArgumentException", ",", "RequestException", "{", "if", "(", "sessionId", "==", "null", "||", "sessionId", ".", "isEmpty",...
Disconnect a client from an OpenTok session <p> Use this API to forcibly terminate a connection of a session. @param sessionId The session ID of the connection @param connectionId The connection ID to disconnect
[ "Disconnect", "a", "client", "from", "an", "OpenTok", "session", "<p", ">", "Use", "this", "API", "to", "forcibly", "terminate", "a", "connection", "of", "a", "session", "." ]
train
https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L633-L644
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/ParameterFactoryImpl.java
ParameterFactoryImpl.createParameter
public Parameter createParameter(final String name, final String value) throws URISyntaxException { final ParameterFactory factory = getFactory(name); Parameter parameter; if (factory != null) { parameter = factory.createParameter(value); } else if (isExperimentalName(name)) { parameter = new XParameter(name, value); } else if (allowIllegalNames()) { parameter = new XParameter(name, value); } else { throw new IllegalArgumentException(String.format("Unsupported parameter name: %s", name)); } return parameter; }
java
public Parameter createParameter(final String name, final String value) throws URISyntaxException { final ParameterFactory factory = getFactory(name); Parameter parameter; if (factory != null) { parameter = factory.createParameter(value); } else if (isExperimentalName(name)) { parameter = new XParameter(name, value); } else if (allowIllegalNames()) { parameter = new XParameter(name, value); } else { throw new IllegalArgumentException(String.format("Unsupported parameter name: %s", name)); } return parameter; }
[ "public", "Parameter", "createParameter", "(", "final", "String", "name", ",", "final", "String", "value", ")", "throws", "URISyntaxException", "{", "final", "ParameterFactory", "factory", "=", "getFactory", "(", "name", ")", ";", "Parameter", "parameter", ";", ...
Creates a parameter. @param name name of the parameter @param value a parameter value @return a component @throws URISyntaxException thrown when the specified string is not a valid representation of a URI for selected parameters
[ "Creates", "a", "parameter", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/ParameterFactoryImpl.java#L73-L87
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java
HelpDoclet.processDocs
private void processDocs(final RootDoc rootDoc) { this.rootDoc = rootDoc; // Get a list of all the features and groups that we'll actually retain workUnits = computeWorkUnits(); final Set<String> uniqueGroups = new HashSet<>(); final List<Map<String, String>> featureMaps = new ArrayList<>(); final List<Map<String, String>> groupMaps = new ArrayList<>(); // First pass over work units: create the top level map of features and groups workUnits.stream().forEach( workUnit -> { featureMaps.add(indexDataMap(workUnit)); if (!uniqueGroups.contains(workUnit.getGroupName())) { uniqueGroups.add(workUnit.getGroupName()); groupMaps.add(getGroupMap(workUnit)); } } ); // Second pass: populate the property map for each work unit workUnits.stream().forEach(workUnit -> { workUnit.processDoc(featureMaps, groupMaps); }); // Third pass: Generate the individual outputs for each work unit, and the top-level index file emitOutputFromTemplates(groupMaps, featureMaps); }
java
private void processDocs(final RootDoc rootDoc) { this.rootDoc = rootDoc; // Get a list of all the features and groups that we'll actually retain workUnits = computeWorkUnits(); final Set<String> uniqueGroups = new HashSet<>(); final List<Map<String, String>> featureMaps = new ArrayList<>(); final List<Map<String, String>> groupMaps = new ArrayList<>(); // First pass over work units: create the top level map of features and groups workUnits.stream().forEach( workUnit -> { featureMaps.add(indexDataMap(workUnit)); if (!uniqueGroups.contains(workUnit.getGroupName())) { uniqueGroups.add(workUnit.getGroupName()); groupMaps.add(getGroupMap(workUnit)); } } ); // Second pass: populate the property map for each work unit workUnits.stream().forEach(workUnit -> { workUnit.processDoc(featureMaps, groupMaps); }); // Third pass: Generate the individual outputs for each work unit, and the top-level index file emitOutputFromTemplates(groupMaps, featureMaps); }
[ "private", "void", "processDocs", "(", "final", "RootDoc", "rootDoc", ")", "{", "this", ".", "rootDoc", "=", "rootDoc", ";", "// Get a list of all the features and groups that we'll actually retain", "workUnits", "=", "computeWorkUnits", "(", ")", ";", "final", "Set", ...
Process the classes that have been included by the javadoc process in the rootDoc object. @param rootDoc root structure containing the the set of objects accumulated by the javadoc process
[ "Process", "the", "classes", "that", "have", "been", "included", "by", "the", "javadoc", "process", "in", "the", "rootDoc", "object", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L256-L282
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoImages.java
DaoImages.getEnvelope
public static ReferencedEnvelope getEnvelope( IHMConnection connection ) throws Exception { String query = "SELECT min(" + // ImageTableFields.COLUMN_LON.getFieldName() + "), max(" + // ImageTableFields.COLUMN_LON.getFieldName() + "), min(" + // ImageTableFields.COLUMN_LAT.getFieldName() + "), max(" + // ImageTableFields.COLUMN_LAT.getFieldName() + ") " + // " FROM " + TABLE_IMAGES; try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(query);) { if (rs.next()) { double minX = rs.getDouble(1); double maxX = rs.getDouble(2); double minY = rs.getDouble(3); double maxY = rs.getDouble(4); ReferencedEnvelope env = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84); return env; } } return null; }
java
public static ReferencedEnvelope getEnvelope( IHMConnection connection ) throws Exception { String query = "SELECT min(" + // ImageTableFields.COLUMN_LON.getFieldName() + "), max(" + // ImageTableFields.COLUMN_LON.getFieldName() + "), min(" + // ImageTableFields.COLUMN_LAT.getFieldName() + "), max(" + // ImageTableFields.COLUMN_LAT.getFieldName() + ") " + // " FROM " + TABLE_IMAGES; try (IHMStatement statement = connection.createStatement(); IHMResultSet rs = statement.executeQuery(query);) { if (rs.next()) { double minX = rs.getDouble(1); double maxX = rs.getDouble(2); double minY = rs.getDouble(3); double maxY = rs.getDouble(4); ReferencedEnvelope env = new ReferencedEnvelope(minX, maxX, minY, maxY, DefaultGeographicCRS.WGS84); return env; } } return null; }
[ "public", "static", "ReferencedEnvelope", "getEnvelope", "(", "IHMConnection", "connection", ")", "throws", "Exception", "{", "String", "query", "=", "\"SELECT min(\"", "+", "//", "ImageTableFields", ".", "COLUMN_LON", ".", "getFieldName", "(", ")", "+", "\"), max(\...
Get the current data envelope. @param connection the db connection. @return the envelope. @throws Exception
[ "Get", "the", "current", "data", "envelope", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/geopap4/DaoImages.java#L272-L292
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java
ManagedClustersInner.beginResetServicePrincipalProfile
public void beginResetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { beginResetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); }
java
public void beginResetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { beginResetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); }
[ "public", "void", "beginResetServicePrincipalProfile", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ManagedClusterServicePrincipalProfile", "parameters", ")", "{", "beginResetServicePrincipalProfileWithServiceResponseAsync", "(", "resourceGroupName", ","...
Reset Service Principal Profile of a managed cluster. Update the service principal Profile for a managed cluster. @param resourceGroupName The name of the resource group. @param resourceName The name of the managed cluster resource. @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. @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
[ "Reset", "Service", "Principal", "Profile", "of", "a", "managed", "cluster", ".", "Update", "the", "service", "principal", "Profile", "for", "a", "managed", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1579-L1581