repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setFinish
public void setFinish(int index, Date value) { set(selectField(ResourceFieldLists.CUSTOM_FINISH, index), value); }
java
public void setFinish(int index, Date value) { set(selectField(ResourceFieldLists.CUSTOM_FINISH, index), value); }
[ "public", "void", "setFinish", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_FINISH", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a finish value. @param index finish index (1-10) @param value finish value
[ "Set", "a", "finish", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1617-L1620
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
DateTimeUtils.newDateFormat
public static SimpleDateFormat newDateFormat(String format) { SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.ROOT); sdf.setLenient(false); return sdf; }
java
public static SimpleDateFormat newDateFormat(String format) { SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.ROOT); sdf.setLenient(false); return sdf; }
[ "public", "static", "SimpleDateFormat", "newDateFormat", "(", "String", "format", ")", "{", "SimpleDateFormat", "sdf", "=", "new", "SimpleDateFormat", "(", "format", ",", "Locale", ".", "ROOT", ")", ";", "sdf", ".", "setLenient", "(", "false", ")", ";", "ret...
Creates a new date formatter with Farrago specific options. Farrago parsing is strict and does not allow values such as day 0, month 13, etc. @param format {@link SimpleDateFormat} pattern
[ "Creates", "a", "new", "date", "formatter", "with", "Farrago", "specific", "options", ".", "Farrago", "parsing", "is", "strict", "and", "does", "not", "allow", "values", "such", "as", "day", "0", "month", "13", "etc", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java#L306-L310
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/Utils.java
Utils.parsePositiveInteger
public static long parsePositiveInteger(String valueName, String value, long defaultValue) { long result = defaultValue; if (value != null) { boolean valid = true; try { result = Long.parseLong(value); if (result <= 0) { valid = false; } } catch (NumberFormatException e) { valid = false; } if (!valid) { String message = String.format("Invalid value \"%s\" for %s, must be a positive integer", value, valueName); throw new IllegalArgumentException(message); } } return result; }
java
public static long parsePositiveInteger(String valueName, String value, long defaultValue) { long result = defaultValue; if (value != null) { boolean valid = true; try { result = Long.parseLong(value); if (result <= 0) { valid = false; } } catch (NumberFormatException e) { valid = false; } if (!valid) { String message = String.format("Invalid value \"%s\" for %s, must be a positive integer", value, valueName); throw new IllegalArgumentException(message); } } return result; }
[ "public", "static", "long", "parsePositiveInteger", "(", "String", "valueName", ",", "String", "value", ",", "long", "defaultValue", ")", "{", "long", "result", "=", "defaultValue", ";", "if", "(", "value", "!=", "null", ")", "{", "boolean", "valid", "=", ...
Validate that the given string value is a valid positive integer (int or long) and convert it to a long @param valueName @param value @param defaultValue result to be returned if value is null @return @throws IllegalArgumentException if the value is not a positive integer (including if it is an empty string)
[ "Validate", "that", "the", "given", "string", "value", "is", "a", "valid", "positive", "integer", "(", "int", "or", "long", ")", "and", "convert", "it", "to", "a", "long" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L553-L573
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java
StandardResponsesApi.getStandardResponse
public ApiSuccessResponse getStandardResponse(String id, GetStandardResponseData getStandardResponseData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getStandardResponseWithHttpInfo(id, getStandardResponseData); return resp.getData(); }
java
public ApiSuccessResponse getStandardResponse(String id, GetStandardResponseData getStandardResponseData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = getStandardResponseWithHttpInfo(id, getStandardResponseData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "getStandardResponse", "(", "String", "id", ",", "GetStandardResponseData", "getStandardResponseData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "getStandardResponseWithHttpInfo", "(", "id...
Get the details of a Standard Response. @param id id of the Standard Response (required) @param getStandardResponseData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "the", "details", "of", "a", "Standard", "Response", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java#L766-L769
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newTypeNotFoundException
public static TypeNotFoundException newTypeNotFoundException(String message, Object... args) { return newTypeNotFoundException(null, message, args); }
java
public static TypeNotFoundException newTypeNotFoundException(String message, Object... args) { return newTypeNotFoundException(null, message, args); }
[ "public", "static", "TypeNotFoundException", "newTypeNotFoundException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newTypeNotFoundException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link TypeNotFoundException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link TypeNotFoundException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link TypeNotFoundException} with the given {@link String message}. @see #newTypeNotFoundException(Throwable, String, Object...) @see org.cp.elements.lang.TypeNotFoundException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "TypeNotFoundException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L525-L527
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java
Instrumented.setMetricContextName
public static void setMetricContextName(State state, String name) { state.setProp(Instrumented.METRIC_CONTEXT_NAME_KEY, name); }
java
public static void setMetricContextName(State state, String name) { state.setProp(Instrumented.METRIC_CONTEXT_NAME_KEY, name); }
[ "public", "static", "void", "setMetricContextName", "(", "State", "state", ",", "String", "name", ")", "{", "state", ".", "setProp", "(", "Instrumented", ".", "METRIC_CONTEXT_NAME_KEY", ",", "name", ")", ";", "}" ]
Sets the key {@link #METRIC_CONTEXT_NAME_KEY} to the specified name, in the given {@link State}.
[ "Sets", "the", "key", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java#L276-L278
icode/ameba
src/main/java/ameba/db/ebean/EbeanUtils.java
EbeanUtils.checkQuery
public static void checkQuery(SpiQuery<?> query, ListExpressionValidation validation, boolean ignoreUnknown) { if (query != null) { validate(query.getWhereExpressions(), validation, ignoreUnknown); validate(query.getHavingExpressions(), validation, ignoreUnknown); validate(query.getOrderBy(), validation, ignoreUnknown); Set<String> invalid = validation.getUnknownProperties(); if (!ignoreUnknown && !invalid.isEmpty()) { UnprocessableEntityException.throwQuery(invalid); } } }
java
public static void checkQuery(SpiQuery<?> query, ListExpressionValidation validation, boolean ignoreUnknown) { if (query != null) { validate(query.getWhereExpressions(), validation, ignoreUnknown); validate(query.getHavingExpressions(), validation, ignoreUnknown); validate(query.getOrderBy(), validation, ignoreUnknown); Set<String> invalid = validation.getUnknownProperties(); if (!ignoreUnknown && !invalid.isEmpty()) { UnprocessableEntityException.throwQuery(invalid); } } }
[ "public", "static", "void", "checkQuery", "(", "SpiQuery", "<", "?", ">", "query", ",", "ListExpressionValidation", "validation", ",", "boolean", "ignoreUnknown", ")", "{", "if", "(", "query", "!=", "null", ")", "{", "validate", "(", "query", ".", "getWhereE...
<p>checkQuery.</p> @param query a {@link io.ebeaninternal.api.SpiQuery} object. @param validation a {@link ameba.db.ebean.internal.ListExpressionValidation} object. @param ignoreUnknown a boolean.
[ "<p", ">", "checkQuery", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/EbeanUtils.java#L206-L218
NessComputing/service-discovery
jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java
ServiceDiscoveryTransportFactory.buildTransport
private Transport buildTransport(Map<String, String> params, final List<ServiceInformation> services) throws IOException { final String configPostfix = getConfig(params).getServiceConfigurationPostfix(); final StringBuilder uriBuilder = new StringBuilder(); uriBuilder.append("failover:("); uriBuilder.append(Joiner.on(',').join(Collections2.transform(services, SERVICE_TO_URI))); uriBuilder.append(')'); if (!StringUtils.isBlank(configPostfix)) { uriBuilder.append('?'); uriBuilder.append(configPostfix); } try { final URI uri = URI.create(uriBuilder.toString()); LOG.debug("Service discovery transport discovered %s", uri); return interceptPropertySetters(TransportFactory.compositeConnect(uri)); } catch (final Exception e) { Throwables.propagateIfPossible(e, IOException.class); throw new IOException("Could not create failover transport", e); } }
java
private Transport buildTransport(Map<String, String> params, final List<ServiceInformation> services) throws IOException { final String configPostfix = getConfig(params).getServiceConfigurationPostfix(); final StringBuilder uriBuilder = new StringBuilder(); uriBuilder.append("failover:("); uriBuilder.append(Joiner.on(',').join(Collections2.transform(services, SERVICE_TO_URI))); uriBuilder.append(')'); if (!StringUtils.isBlank(configPostfix)) { uriBuilder.append('?'); uriBuilder.append(configPostfix); } try { final URI uri = URI.create(uriBuilder.toString()); LOG.debug("Service discovery transport discovered %s", uri); return interceptPropertySetters(TransportFactory.compositeConnect(uri)); } catch (final Exception e) { Throwables.propagateIfPossible(e, IOException.class); throw new IOException("Could not create failover transport", e); } }
[ "private", "Transport", "buildTransport", "(", "Map", "<", "String", ",", "String", ">", "params", ",", "final", "List", "<", "ServiceInformation", ">", "services", ")", "throws", "IOException", "{", "final", "String", "configPostfix", "=", "getConfig", "(", "...
From a list of ServiceInformation, build a failover transport that balances between the brokers.
[ "From", "a", "list", "of", "ServiceInformation", "build", "a", "failover", "transport", "that", "balances", "between", "the", "brokers", "." ]
train
https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java#L157-L175
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java
HTTPBatchClientConnectionInterceptor.authorizeRequest
private void authorizeRequest(Context context, HttpRequestBase httpRequest) throws FMSException { context.getAuthorizer().authorize(httpRequest); }
java
private void authorizeRequest(Context context, HttpRequestBase httpRequest) throws FMSException { context.getAuthorizer().authorize(httpRequest); }
[ "private", "void", "authorizeRequest", "(", "Context", "context", ",", "HttpRequestBase", "httpRequest", ")", "throws", "FMSException", "{", "context", ".", "getAuthorizer", "(", ")", ".", "authorize", "(", "httpRequest", ")", ";", "}" ]
Method to authorize the given HttpRequest @param context the context @param httpRequest the http request @throws com.intuit.ipp.exception.FMSException the FMSException
[ "Method", "to", "authorize", "the", "given", "HttpRequest" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L369-L371
liferay/com-liferay-commerce
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java
CommerceDiscountPersistenceImpl.findByGroupId
@Override public List<CommerceDiscount> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceDiscount> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceDiscount", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce discounts where groupId = &#63;. @param groupId the group ID @return the matching commerce discounts
[ "Returns", "all", "the", "commerce", "discounts", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L1518-L1521
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getWvWObjectiveInfo
public void getWvWObjectiveInfo(String[] ids, Callback<List<WvWObjective>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWObjectiveInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getWvWObjectiveInfo(String[] ids, Callback<List<WvWObjective>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWObjectiveInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getWvWObjectiveInfo", "(", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "WvWObjective", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", ...
For more info on WvW abilities API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/abilities">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of WvW objective id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see WvWObjective WvW objective info
[ "For", "more", "info", "on", "WvW", "abilities", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "wvw", "/", "abilities", ">", "here<", "/", "a", ">", "<br", "/", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2737-L2740
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java
Roster.preApproveAndCreateEntry
public void preApproveAndCreateEntry(BareJid user, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, FeatureNotSupportedException { preApprove(user); createItemAndRequestSubscription(user, name, groups); }
java
public void preApproveAndCreateEntry(BareJid user, String name, String[] groups) throws NotLoggedInException, NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, FeatureNotSupportedException { preApprove(user); createItemAndRequestSubscription(user, name, groups); }
[ "public", "void", "preApproveAndCreateEntry", "(", "BareJid", "user", ",", "String", "name", ",", "String", "[", "]", "groups", ")", "throws", "NotLoggedInException", ",", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "Interrupte...
Creates a new pre-approved roster entry and presence subscription. The server will asynchronously update the roster with the subscription status. @param user the user. (e.g. johndoe@jabber.org) @param name the nickname of the user. @param groups the list of group names the entry will belong to, or <tt>null</tt> if the the roster entry won't belong to a group. @throws NoResponseException if there was no response from the server. @throws XMPPErrorException if an XMPP exception occurs. @throws NotLoggedInException if not logged in. @throws NotConnectedException @throws InterruptedException @throws FeatureNotSupportedException if pre-approving is not supported. @since 4.2
[ "Creates", "a", "new", "pre", "-", "approved", "roster", "entry", "and", "presence", "subscription", ".", "The", "server", "will", "asynchronously", "update", "the", "roster", "with", "the", "subscription", "status", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java#L729-L732
stevespringett/Alpine
alpine/src/main/java/alpine/auth/JsonWebToken.java
JsonWebToken.addDays
private Date addDays(final Date date, final int days) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, days); //minus number would decrement the days return cal.getTime(); }
java
private Date addDays(final Date date, final int days) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, days); //minus number would decrement the days return cal.getTime(); }
[ "private", "Date", "addDays", "(", "final", "Date", "date", ",", "final", "int", "days", ")", "{", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "cal", ".", "add", "(", ...
Create a new future Date from the specified Date. @param date The date to base the future date from @param days The number of dates to + offset @return a future date
[ "Create", "a", "new", "future", "Date", "from", "the", "specified", "Date", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/JsonWebToken.java#L176-L181
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isNonPositive
public static void isNonPositive( int argument, String name ) { if (argument > 0) { throw new IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument)); } }
java
public static void isNonPositive( int argument, String name ) { if (argument > 0) { throw new IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument)); } }
[ "public", "static", "void", "isNonPositive", "(", "int", "argument", ",", "String", "name", ")", "{", "if", "(", "argument", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", "argumentMayNotBePositive", ".", "text", "(", ...
Check that the argument is non-positive (<=0). @param argument The argument @param name The name of the argument @throws IllegalArgumentException If argument is positive (>0)
[ "Check", "that", "the", "argument", "is", "non", "-", "positive", "(", "<", "=", "0", ")", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L168-L173
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_updateUsage_POST
public void domain_account_accountName_updateUsage_POST(String domain, String accountName) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/updateUsage"; StringBuilder sb = path(qPath, domain, accountName); exec(qPath, "POST", sb.toString(), null); }
java
public void domain_account_accountName_updateUsage_POST(String domain, String accountName) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/updateUsage"; StringBuilder sb = path(qPath, domain, accountName); exec(qPath, "POST", sb.toString(), null); }
[ "public", "void", "domain_account_accountName_updateUsage_POST", "(", "String", "domain", ",", "String", "accountName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accountName}/updateUsage\"", ";", "StringBuilder", "sb", "=", ...
Update usage of account REST: POST /email/domain/{domain}/account/{accountName}/updateUsage @param domain [required] Name of your domain name @param accountName [required] Name of account
[ "Update", "usage", "of", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L635-L639
alkacon/opencms-core
src/org/opencms/configuration/CmsElementWithAttrsParamConfigHelper.java
CmsElementWithAttrsParamConfigHelper.addRules
public void addRules(Digester digester) { digester.addRule(m_basePath, new Rule() { @SuppressWarnings("synthetic-access") @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { I_CmsConfigurationParameterHandler config = (I_CmsConfigurationParameterHandler)(m_class.newInstance()); for (String attr : m_attrs) { String attrValue = attributes.getValue(attr); if (attrValue != null) { config.addConfigurationParameter(attr, attrValue); } } config.initConfiguration(); getDigester().push(config); } @Override public void end(String namespace, String name) throws Exception { getDigester().pop(); } }); }
java
public void addRules(Digester digester) { digester.addRule(m_basePath, new Rule() { @SuppressWarnings("synthetic-access") @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { I_CmsConfigurationParameterHandler config = (I_CmsConfigurationParameterHandler)(m_class.newInstance()); for (String attr : m_attrs) { String attrValue = attributes.getValue(attr); if (attrValue != null) { config.addConfigurationParameter(attr, attrValue); } } config.initConfiguration(); getDigester().push(config); } @Override public void end(String namespace, String name) throws Exception { getDigester().pop(); } }); }
[ "public", "void", "addRules", "(", "Digester", "digester", ")", "{", "digester", ".", "addRule", "(", "m_basePath", ",", "new", "Rule", "(", ")", "{", "@", "SuppressWarnings", "(", "\"synthetic-access\"", ")", "@", "Override", "public", "void", "begin", "(",...
Adds the configuration parsing rules to the digester.<p> @param digester the digester to which the rules should be added
[ "Adds", "the", "configuration", "parsing", "rules", "to", "the", "digester", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsElementWithAttrsParamConfigHelper.java#L74-L100
bbottema/simple-java-mail
modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java
ConfigLoader.loadProperties
public static Map<Property, Object> loadProperties(final String filename, final boolean addProperties) { final InputStream input = ConfigLoader.class.getClassLoader().getResourceAsStream(filename); if (input != null) { return loadProperties(input, addProperties); } LOGGER.debug("Property file not found on classpath, skipping config file"); return new HashMap<>(); }
java
public static Map<Property, Object> loadProperties(final String filename, final boolean addProperties) { final InputStream input = ConfigLoader.class.getClassLoader().getResourceAsStream(filename); if (input != null) { return loadProperties(input, addProperties); } LOGGER.debug("Property file not found on classpath, skipping config file"); return new HashMap<>(); }
[ "public", "static", "Map", "<", "Property", ",", "Object", ">", "loadProperties", "(", "final", "String", "filename", ",", "final", "boolean", "addProperties", ")", "{", "final", "InputStream", "input", "=", "ConfigLoader", ".", "class", ".", "getClassLoader", ...
Loads properties from property file on the classpath, if provided. Calling this method only has effect on new Email and Mailer instances after this. @param filename Any file that is on the classpath that holds a list of key=value pairs. @param addProperties Flag to indicate if the new properties should be added or replacing the old properties. @return The updated properties map that is used internally.
[ "Loads", "properties", "from", "property", "file", "on", "the", "classpath", "if", "provided", ".", "Calling", "this", "method", "only", "has", "effect", "on", "new", "Email", "and", "Mailer", "instances", "after", "this", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java#L214-L221
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java
DescribePointSift.process
public void process( double c_x , double c_y , double sigma , double orientation , TupleDesc_F64 descriptor ) { descriptor.fill(0); computeRawDescriptor(c_x, c_y, sigma, orientation, descriptor); normalizeDescriptor(descriptor,maxDescriptorElementValue); }
java
public void process( double c_x , double c_y , double sigma , double orientation , TupleDesc_F64 descriptor ) { descriptor.fill(0); computeRawDescriptor(c_x, c_y, sigma, orientation, descriptor); normalizeDescriptor(descriptor,maxDescriptorElementValue); }
[ "public", "void", "process", "(", "double", "c_x", ",", "double", "c_y", ",", "double", "sigma", ",", "double", "orientation", ",", "TupleDesc_F64", "descriptor", ")", "{", "descriptor", ".", "fill", "(", "0", ")", ";", "computeRawDescriptor", "(", "c_x", ...
Computes the SIFT descriptor for the specified key point @param c_x center of key point. x-axis @param c_y center of key point. y-axis @param sigma Computed sigma in scale-space for this point @param orientation Orientation of keypoint in radians @param descriptor (output) Storage for computed descriptor. Make sure it's the appropriate length first
[ "Computes", "the", "SIFT", "descriptor", "for", "the", "specified", "key", "point" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSift.java#L105-L112
grails/grails-core
grails-core/src/main/groovy/org/grails/spring/beans/factory/GenericBeanFactoryAccessor.java
GenericBeanFactoryAccessor.findAnnotationOnBean
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) { Class<?> handlerType = beanFactory.getType(beanName); A ann = AnnotationUtils.findAnnotation(handlerType, annotationType); if (ann == null && beanFactory instanceof ConfigurableBeanFactory && beanFactory.containsBeanDefinition(beanName)) { ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory; BeanDefinition bd = cbf.getMergedBeanDefinition(beanName); if (bd instanceof AbstractBeanDefinition) { AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; if (abd.hasBeanClass()) { Class<?> beanClass = abd.getBeanClass(); ann = AnnotationUtils.findAnnotation(beanClass, annotationType); } } } return ann; }
java
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType) { Class<?> handlerType = beanFactory.getType(beanName); A ann = AnnotationUtils.findAnnotation(handlerType, annotationType); if (ann == null && beanFactory instanceof ConfigurableBeanFactory && beanFactory.containsBeanDefinition(beanName)) { ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory; BeanDefinition bd = cbf.getMergedBeanDefinition(beanName); if (bd instanceof AbstractBeanDefinition) { AbstractBeanDefinition abd = (AbstractBeanDefinition) bd; if (abd.hasBeanClass()) { Class<?> beanClass = abd.getBeanClass(); ann = AnnotationUtils.findAnnotation(beanClass, annotationType); } } } return ann; }
[ "public", "<", "A", "extends", "Annotation", ">", "A", "findAnnotationOnBean", "(", "String", "beanName", ",", "Class", "<", "A", ">", "annotationType", ")", "{", "Class", "<", "?", ">", "handlerType", "=", "beanFactory", ".", "getType", "(", "beanName", "...
Find a {@link Annotation} of <code>annotationType</code> on the specified bean, traversing its interfaces and super classes if no annotation can be found on the given class itself, as well as checking its raw bean class if not found on the exposed bean reference (e.g. in case of a proxy). @param beanName the name of the bean to look for annotations on @param annotationType the annotation class to look for @return the annotation of the given type found, or <code>null</code> @see org.springframework.core.annotation.AnnotationUtils#findAnnotation(Class, Class)
[ "Find", "a", "{" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/spring/beans/factory/GenericBeanFactoryAccessor.java#L116-L132
box/box-java-sdk
src/main/java/com/box/sdk/BoxTermsOfServiceUserStatus.java
BoxTermsOfServiceUserStatus.getInfo
public static List<BoxTermsOfServiceUserStatus.Info> getInfo(final BoxAPIConnection api, String termsOfServiceID, String userID) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("tos_id", termsOfServiceID); if (userID != null) { builder.appendParam("user_id", userID); } URL url = ALL_TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int totalCount = responseJSON.get("total_count").asInt(); List<BoxTermsOfServiceUserStatus.Info> termsOfServiceUserStatuses = new ArrayList<BoxTermsOfServiceUserStatus.Info>(totalCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue value : entries) { JsonObject termsOfServiceUserStatusJSON = value.asObject(); BoxTermsOfServiceUserStatus termsOfServiceUserStatus = new BoxTermsOfServiceUserStatus(api, termsOfServiceUserStatusJSON.get("id").asString()); BoxTermsOfServiceUserStatus.Info info = termsOfServiceUserStatus.new Info(termsOfServiceUserStatusJSON); termsOfServiceUserStatuses.add(info); } return termsOfServiceUserStatuses; }
java
public static List<BoxTermsOfServiceUserStatus.Info> getInfo(final BoxAPIConnection api, String termsOfServiceID, String userID) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("tos_id", termsOfServiceID); if (userID != null) { builder.appendParam("user_id", userID); } URL url = ALL_TERMS_OF_SERVICE_USER_STATUSES_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int totalCount = responseJSON.get("total_count").asInt(); List<BoxTermsOfServiceUserStatus.Info> termsOfServiceUserStatuses = new ArrayList<BoxTermsOfServiceUserStatus.Info>(totalCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue value : entries) { JsonObject termsOfServiceUserStatusJSON = value.asObject(); BoxTermsOfServiceUserStatus termsOfServiceUserStatus = new BoxTermsOfServiceUserStatus(api, termsOfServiceUserStatusJSON.get("id").asString()); BoxTermsOfServiceUserStatus.Info info = termsOfServiceUserStatus.new Info(termsOfServiceUserStatusJSON); termsOfServiceUserStatuses.add(info); } return termsOfServiceUserStatuses; }
[ "public", "static", "List", "<", "BoxTermsOfServiceUserStatus", ".", "Info", ">", "getInfo", "(", "final", "BoxAPIConnection", "api", ",", "String", "termsOfServiceID", ",", "String", "userID", ")", "{", "QueryStringBuilder", "builder", "=", "new", "QueryStringBuild...
Retrieves a list of User Status for Terms of Service as an Iterable. @param api the API connection to be used by the resource. @param termsOfServiceID the ID of the terms of service. @param userID the ID of the user to retrieve terms of service for. @return the Iterable of User Status for Terms of Service.
[ "Retrieves", "a", "list", "of", "User", "Status", "for", "Terms", "of", "Service", "as", "an", "Iterable", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTermsOfServiceUserStatus.java#L100-L126
rterp/GMapsFX
GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java
JavascriptObject.invokeJavascriptReturnValue
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) { Object returnObject = invokeJavascript(function); if (returnObject instanceof JSObject) { try { Constructor<T> constructor = returnType.getConstructor(JSObject.class); return constructor.newInstance((JSObject) returnObject); } catch (Exception ex) { throw new IllegalStateException(ex); } } else { return (T) returnObject; } }
java
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) { Object returnObject = invokeJavascript(function); if (returnObject instanceof JSObject) { try { Constructor<T> constructor = returnType.getConstructor(JSObject.class); return constructor.newInstance((JSObject) returnObject); } catch (Exception ex) { throw new IllegalStateException(ex); } } else { return (T) returnObject; } }
[ "protected", "<", "T", ">", "T", "invokeJavascriptReturnValue", "(", "String", "function", ",", "Class", "<", "T", ">", "returnType", ")", "{", "Object", "returnObject", "=", "invokeJavascript", "(", "function", ")", ";", "if", "(", "returnObject", "instanceof...
Invokes a JavaScript function that takes no arguments. @param <T> @param function The function to invoke @param returnType The type of object to return @return The result of the function.
[ "Invokes", "a", "JavaScript", "function", "that", "takes", "no", "arguments", "." ]
train
https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java#L241-L253
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java
CmsForm.defaultHandleKeyPress
protected void defaultHandleKeyPress(I_CmsFormField field, int keyCode) { I_CmsFormWidget widget = field.getWidget(); if (keyCode == KeyCodes.KEY_ENTER) { m_pressedEnter = true; if (widget instanceof I_CmsHasBlur) { // force a blur because not all browsers send a change event if the user just presses enter in a field ((I_CmsHasBlur)widget).blur(); } // make sure that the flag is set to false again after the other events have been processed Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { m_pressedEnter = false; } }); } }
java
protected void defaultHandleKeyPress(I_CmsFormField field, int keyCode) { I_CmsFormWidget widget = field.getWidget(); if (keyCode == KeyCodes.KEY_ENTER) { m_pressedEnter = true; if (widget instanceof I_CmsHasBlur) { // force a blur because not all browsers send a change event if the user just presses enter in a field ((I_CmsHasBlur)widget).blur(); } // make sure that the flag is set to false again after the other events have been processed Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { m_pressedEnter = false; } }); } }
[ "protected", "void", "defaultHandleKeyPress", "(", "I_CmsFormField", "field", ",", "int", "keyCode", ")", "{", "I_CmsFormWidget", "widget", "=", "field", ".", "getWidget", "(", ")", ";", "if", "(", "keyCode", "==", "KeyCodes", ".", "KEY_ENTER", ")", "{", "m_...
The default keypress event handling function for form fields.<p> @param field the form field for which the event has been fired @param keyCode the key code
[ "The", "default", "keypress", "event", "handling", "function", "for", "form", "fields", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L430-L451
mapbox/mapbox-java
services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java
TurfAssertions.featureOf
public static void featureOf(Feature feature, String type, String name) { if (name == null || name.length() == 0) { throw new TurfException(".featureOf() requires a name"); } if (feature == null || !feature.type().equals("Feature") || feature.geometry() == null) { throw new TurfException(String.format( "Invalid input to %s, Feature with geometry required", name)); } if (feature.geometry() == null || !feature.geometry().type().equals(type)) { throw new TurfException(String.format( "Invalid input to %s: must be a %s, given %s", name, type, feature.geometry().type())); } }
java
public static void featureOf(Feature feature, String type, String name) { if (name == null || name.length() == 0) { throw new TurfException(".featureOf() requires a name"); } if (feature == null || !feature.type().equals("Feature") || feature.geometry() == null) { throw new TurfException(String.format( "Invalid input to %s, Feature with geometry required", name)); } if (feature.geometry() == null || !feature.geometry().type().equals(type)) { throw new TurfException(String.format( "Invalid input to %s: must be a %s, given %s", name, type, feature.geometry().type())); } }
[ "public", "static", "void", "featureOf", "(", "Feature", "feature", ",", "String", "type", ",", "String", "name", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "TurfException", ...
Enforce expectations about types of {@link Feature} inputs for Turf. Internally this uses {@link Feature#type()} to judge geometry types. @param feature with an expected geometry type @param type type expected GeoJson type @param name name of calling function @see <a href="http://turfjs.org/docs/#featureof">Turf featureOf documentation</a> @since 1.2.0
[ "Enforce", "expectations", "about", "types", "of", "{", "@link", "Feature", "}", "inputs", "for", "Turf", ".", "Internally", "this", "uses", "{", "@link", "Feature#type", "()", "}", "to", "judge", "geometry", "types", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java#L64-L76
h2oai/h2o-2
src/main/java/water/api/Models.java
Models.serveOneOrAll
private Response serveOneOrAll(Map<String, Model> modelsMap) { // returns empty sets if !this.find_compatible_frames Pair<Map<String, Frame>, Map<String, Set<String>>> frames_info = fetchFrames(); Map<String, Frame> all_frames = frames_info.getFirst(); Map<String, Set<String>> all_frames_cols = frames_info.getSecond(); Map<String, ModelSummary> modelSummaries = Models.generateModelSummaries(null, modelsMap, find_compatible_frames, all_frames, all_frames_cols); Map resultsMap = new LinkedHashMap(); resultsMap.put("models", modelSummaries); // If find_compatible_frames then include a map of the Frame summaries. Should we put this on a separate switch? if (this.find_compatible_frames) { Set<String> all_referenced_frames = new TreeSet<String>(); for (Map.Entry<String, ModelSummary> entry: modelSummaries.entrySet()) { ModelSummary summary = entry.getValue(); all_referenced_frames.addAll(summary.compatible_frames); } Map<String, FrameSummary> frameSummaries = Frames.generateFrameSummaries(all_referenced_frames, all_frames, false, null, null); resultsMap.put("frames", frameSummaries); } // TODO: temporary hack to get things going String json = gson.toJson(resultsMap); JsonObject result = gson.fromJson(json, JsonElement.class).getAsJsonObject(); return Response.done(result); }
java
private Response serveOneOrAll(Map<String, Model> modelsMap) { // returns empty sets if !this.find_compatible_frames Pair<Map<String, Frame>, Map<String, Set<String>>> frames_info = fetchFrames(); Map<String, Frame> all_frames = frames_info.getFirst(); Map<String, Set<String>> all_frames_cols = frames_info.getSecond(); Map<String, ModelSummary> modelSummaries = Models.generateModelSummaries(null, modelsMap, find_compatible_frames, all_frames, all_frames_cols); Map resultsMap = new LinkedHashMap(); resultsMap.put("models", modelSummaries); // If find_compatible_frames then include a map of the Frame summaries. Should we put this on a separate switch? if (this.find_compatible_frames) { Set<String> all_referenced_frames = new TreeSet<String>(); for (Map.Entry<String, ModelSummary> entry: modelSummaries.entrySet()) { ModelSummary summary = entry.getValue(); all_referenced_frames.addAll(summary.compatible_frames); } Map<String, FrameSummary> frameSummaries = Frames.generateFrameSummaries(all_referenced_frames, all_frames, false, null, null); resultsMap.put("frames", frameSummaries); } // TODO: temporary hack to get things going String json = gson.toJson(resultsMap); JsonObject result = gson.fromJson(json, JsonElement.class).getAsJsonObject(); return Response.done(result); }
[ "private", "Response", "serveOneOrAll", "(", "Map", "<", "String", ",", "Model", ">", "modelsMap", ")", "{", "// returns empty sets if !this.find_compatible_frames", "Pair", "<", "Map", "<", "String", ",", "Frame", ">", ",", "Map", "<", "String", ",", "Set", "...
Fetch all the Models from the KV store, sumamrize and enhance them, and return a map of them.
[ "Fetch", "all", "the", "Models", "from", "the", "KV", "store", "sumamrize", "and", "enhance", "them", "and", "return", "a", "map", "of", "them", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Models.java#L386-L415
twilio/twilio-java
src/main/java/com/twilio/example/ValidationExample.java
ValidationExample.main
public static void main(String[] args) throws Exception { // Generate public/private key pair KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(2048); KeyPair pair = keyGen.generateKeyPair(); java.security.PublicKey pk = pair.getPublic(); // Use the default rest client TwilioRestClient client = new TwilioRestClient.Builder(ACCOUNT_SID, AUTH_TOKEN) .build(); // Create a public key and signing key using the default client PublicKey key = PublicKey.creator( Base64.encodeBase64String(pk.getEncoded()) ).setFriendlyName("Public Key").create(client); NewSigningKey signingKey = NewSigningKey.creator().create(client); // Switch to validation client as the default client TwilioRestClient validationClient = new TwilioRestClient.Builder(signingKey.getSid(), signingKey.getSecret()) .accountSid(ACCOUNT_SID) .httpClient(new ValidationClient(ACCOUNT_SID, key.getSid(), signingKey.getSid(), pair.getPrivate())) .build(); // Make REST API requests Iterable<Message> messages = Message.reader().read(validationClient); for (Message message : messages) { System.out.println(message.getBody()); } Message message = Message.creator( new PhoneNumber("+1XXXXXXXXXX"), new PhoneNumber("+1XXXXXXXXXX"), "Public Key Client Validation Test" ).create(validationClient); System.out.println(message.getSid()); }
java
public static void main(String[] args) throws Exception { // Generate public/private key pair KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(2048); KeyPair pair = keyGen.generateKeyPair(); java.security.PublicKey pk = pair.getPublic(); // Use the default rest client TwilioRestClient client = new TwilioRestClient.Builder(ACCOUNT_SID, AUTH_TOKEN) .build(); // Create a public key and signing key using the default client PublicKey key = PublicKey.creator( Base64.encodeBase64String(pk.getEncoded()) ).setFriendlyName("Public Key").create(client); NewSigningKey signingKey = NewSigningKey.creator().create(client); // Switch to validation client as the default client TwilioRestClient validationClient = new TwilioRestClient.Builder(signingKey.getSid(), signingKey.getSecret()) .accountSid(ACCOUNT_SID) .httpClient(new ValidationClient(ACCOUNT_SID, key.getSid(), signingKey.getSid(), pair.getPrivate())) .build(); // Make REST API requests Iterable<Message> messages = Message.reader().read(validationClient); for (Message message : messages) { System.out.println(message.getBody()); } Message message = Message.creator( new PhoneNumber("+1XXXXXXXXXX"), new PhoneNumber("+1XXXXXXXXXX"), "Public Key Client Validation Test" ).create(validationClient); System.out.println(message.getSid()); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "// Generate public/private key pair", "KeyPairGenerator", "keyGen", "=", "KeyPairGenerator", ".", "getInstance", "(", "\"RSA\"", ")", ";", "keyGen", ".", "initia...
Example Twilio usage. @param args command line args @throws TwiMLException if unable to generate TwiML
[ "Example", "Twilio", "usage", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/example/ValidationExample.java#L27-L65
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/relation/RelationMetadataProcessorFactory.java
RelationMetadataProcessorFactory.getRelationMetadataProcessor
public static RelationMetadataProcessor getRelationMetadataProcessor(Field relationField, KunderaMetadata kunderaMetadata) { RelationMetadataProcessor relProcessor = null; // OneToOne if (relationField.isAnnotationPresent(OneToOne.class)) { relProcessor = new OneToOneRelationMetadataProcessor(kunderaMetadata); } // OneToMany else if (relationField.isAnnotationPresent(OneToMany.class)) { relProcessor = new OneToManyRelationMetadataProcessor(kunderaMetadata); } // ManyToOne else if (relationField.isAnnotationPresent(ManyToOne.class)) { relProcessor = new ManyToOneRelationMetadataProcessor(kunderaMetadata); } // ManyToMany else if (relationField.isAnnotationPresent(ManyToMany.class)) { relProcessor = new ManyToManyRelationMetadataProcessor(kunderaMetadata); } return relProcessor; }
java
public static RelationMetadataProcessor getRelationMetadataProcessor(Field relationField, KunderaMetadata kunderaMetadata) { RelationMetadataProcessor relProcessor = null; // OneToOne if (relationField.isAnnotationPresent(OneToOne.class)) { relProcessor = new OneToOneRelationMetadataProcessor(kunderaMetadata); } // OneToMany else if (relationField.isAnnotationPresent(OneToMany.class)) { relProcessor = new OneToManyRelationMetadataProcessor(kunderaMetadata); } // ManyToOne else if (relationField.isAnnotationPresent(ManyToOne.class)) { relProcessor = new ManyToOneRelationMetadataProcessor(kunderaMetadata); } // ManyToMany else if (relationField.isAnnotationPresent(ManyToMany.class)) { relProcessor = new ManyToManyRelationMetadataProcessor(kunderaMetadata); } return relProcessor; }
[ "public", "static", "RelationMetadataProcessor", "getRelationMetadataProcessor", "(", "Field", "relationField", ",", "KunderaMetadata", "kunderaMetadata", ")", "{", "RelationMetadataProcessor", "relProcessor", "=", "null", ";", "// OneToOne", "if", "(", "relationField", "."...
Gets the relation metadata processor. @param relationField the relation field @return the relation metadata processor
[ "Gets", "the", "relation", "metadata", "processor", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/relation/RelationMetadataProcessorFactory.java#L42-L75
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayScriptInContext
@Deprecated public static String getDisplayScriptInContext(String localeID, String displayLocaleID) { return getDisplayScriptInContextInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
java
@Deprecated public static String getDisplayScriptInContext(String localeID, String displayLocaleID) { return getDisplayScriptInContextInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
[ "@", "Deprecated", "public", "static", "String", "getDisplayScriptInContext", "(", "String", "localeID", ",", "String", "displayLocaleID", ")", "{", "return", "getDisplayScriptInContextInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "new", "ULocale", "(...
<strong>[icu]</strong> Returns a locale's script localized for display in the provided locale. This is a cover for the ICU4C API. @param localeID the id of the locale whose script will be displayed @param displayLocaleID the id of the locale in which to display the name. @return the localized script name. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "script", "localized", "for", "display", "in", "the", "provided", "locale", ".", "This", "is", "a", "cover", "for", "the", "ICU4C", "API", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1523-L1526
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-collection/src/main/java/org/xwiki/collection/SoftCache.java
SoftCache.put
public void put(K key, V value) { this.lock.writeLock().lock(); try { this.map.put(key, new SoftReference<>(value)); } finally { this.lock.writeLock().unlock(); } }
java
public void put(K key, V value) { this.lock.writeLock().lock(); try { this.map.put(key, new SoftReference<>(value)); } finally { this.lock.writeLock().unlock(); } }
[ "public", "void", "put", "(", "K", "key", ",", "V", "value", ")", "{", "this", ".", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "this", ".", "map", ".", "put", "(", "key", ",", "new", "SoftReference", "<>", "(", ...
Associate passed key to passed value. @param key the entry key @param value the entry value
[ "Associate", "passed", "key", "to", "passed", "value", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-collection/src/main/java/org/xwiki/collection/SoftCache.java#L91-L100
lucee/Lucee
core/src/main/java/lucee/runtime/osgi/OSGiUtil.java
OSGiUtil._loadBundle
private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException { log(Log.LEVEL_INFO, "add bundle:" + path); try { // we make this very simply so an old loader that is calling this still works return context.installBundle(path, is); } finally { // we make this very simply so an old loader that is calling this still works if (closeStream && is != null) { try { is.close(); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } }
java
private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException { log(Log.LEVEL_INFO, "add bundle:" + path); try { // we make this very simply so an old loader that is calling this still works return context.installBundle(path, is); } finally { // we make this very simply so an old loader that is calling this still works if (closeStream && is != null) { try { is.close(); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } } }
[ "private", "static", "Bundle", "_loadBundle", "(", "BundleContext", "context", ",", "String", "path", ",", "InputStream", "is", ",", "boolean", "closeStream", ")", "throws", "BundleException", "{", "log", "(", "Log", ".", "LEVEL_INFO", ",", "\"add bundle:\"", "+...
does not check if the bundle already exists! @param context @param path @param is @param closeStream @return @throws BundleException
[ "does", "not", "check", "if", "the", "bundle", "already", "exists!" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L125-L143
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java
LRUHashMap.removeEldestEntry
protected boolean removeEldestEntry(Map.Entry<K, V> pEldest) { // NOTE: As removeLRU() may remove more than one entry, this is better // than simply removing the eldest entry. if (size() >= maxSize) { removeLRU(); } return false; }
java
protected boolean removeEldestEntry(Map.Entry<K, V> pEldest) { // NOTE: As removeLRU() may remove more than one entry, this is better // than simply removing the eldest entry. if (size() >= maxSize) { removeLRU(); } return false; }
[ "protected", "boolean", "removeEldestEntry", "(", "Map", ".", "Entry", "<", "K", ",", "V", ">", "pEldest", ")", "{", "// NOTE: As removeLRU() may remove more than one entry, this is better", "// than simply removing the eldest entry.", "if", "(", "size", "(", ")", ">=", ...
always returns {@code false}, and instead invokes {@code removeLRU()} if {@code size >= maxSize}.
[ "always", "returns", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/LRUHashMap.java#L180-L187
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/CompositeBundlePathMappingBuilder.java
CompositeBundlePathMappingBuilder.addFilePathMapping
private void addFilePathMapping(BundlePathMapping bundlePathMapping, Set<String> paths) { for (String path : paths) { addFilePathMapping(bundlePathMapping, path); } }
java
private void addFilePathMapping(BundlePathMapping bundlePathMapping, Set<String> paths) { for (String path : paths) { addFilePathMapping(bundlePathMapping, path); } }
[ "private", "void", "addFilePathMapping", "(", "BundlePathMapping", "bundlePathMapping", ",", "Set", "<", "String", ">", "paths", ")", "{", "for", "(", "String", "path", ":", "paths", ")", "{", "addFilePathMapping", "(", "bundlePathMapping", ",", "path", ")", "...
Adds paths to the file path mapping @param bundlePathMapping the bundle path mapping @param paths the paths to add
[ "Adds", "paths", "to", "the", "file", "path", "mapping" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/CompositeBundlePathMappingBuilder.java#L83-L87
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.pushError
@SuppressWarnings({"unused", "WeakerAccess"}) public void pushError(final String errorMessage, final int errorCode) { final HashMap<String, Object> props = new HashMap<>(); props.put("Error Message", errorMessage); props.put("Error Code", errorCode); try { final String activityName = getCurrentActivityName(); if (activityName != null) { props.put("Location", activityName); } else { props.put("Location", "Unknown"); } } catch (Throwable t) { // Ignore props.put("Location", "Unknown"); } pushEvent("Error Occurred", props); }
java
@SuppressWarnings({"unused", "WeakerAccess"}) public void pushError(final String errorMessage, final int errorCode) { final HashMap<String, Object> props = new HashMap<>(); props.put("Error Message", errorMessage); props.put("Error Code", errorCode); try { final String activityName = getCurrentActivityName(); if (activityName != null) { props.put("Location", activityName); } else { props.put("Location", "Unknown"); } } catch (Throwable t) { // Ignore props.put("Location", "Unknown"); } pushEvent("Error Occurred", props); }
[ "@", "SuppressWarnings", "(", "{", "\"unused\"", ",", "\"WeakerAccess\"", "}", ")", "public", "void", "pushError", "(", "final", "String", "errorMessage", ",", "final", "int", "errorCode", ")", "{", "final", "HashMap", "<", "String", ",", "Object", ">", "pro...
Internally records an "Error Occurred" event, which can be viewed in the dashboard. @param errorMessage The error message @param errorCode The error code
[ "Internally", "records", "an", "Error", "Occurred", "event", "which", "can", "be", "viewed", "in", "the", "dashboard", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L4569-L4588
zalando-nakadi/fahrschein
fahrschein/src/main/java/org/zalando/fahrschein/StreamParameters.java
StreamParameters.withBatchFlushTimeout
public StreamParameters withBatchFlushTimeout(int batchFlushTimeout) throws IllegalArgumentException { if (streamTimeout != null && streamTimeout < batchFlushTimeout){ throw new IllegalArgumentException("stream_timeout is lower than batch_flush_timeout."); } return new StreamParameters(batchLimit, streamLimit, batchFlushTimeout, streamTimeout, streamKeepAliveLimit, maxUncommittedEvents, commitTimeout); }
java
public StreamParameters withBatchFlushTimeout(int batchFlushTimeout) throws IllegalArgumentException { if (streamTimeout != null && streamTimeout < batchFlushTimeout){ throw new IllegalArgumentException("stream_timeout is lower than batch_flush_timeout."); } return new StreamParameters(batchLimit, streamLimit, batchFlushTimeout, streamTimeout, streamKeepAliveLimit, maxUncommittedEvents, commitTimeout); }
[ "public", "StreamParameters", "withBatchFlushTimeout", "(", "int", "batchFlushTimeout", ")", "throws", "IllegalArgumentException", "{", "if", "(", "streamTimeout", "!=", "null", "&&", "streamTimeout", "<", "batchFlushTimeout", ")", "{", "throw", "new", "IllegalArgumentE...
Maximum time in seconds to wait for the flushing of each chunk (per partition). @param batchFlushTimeout If the amount of buffered Events reaches batch_limit before this batch_flush_timeout is reached, the messages are immediately flushed to the client and batch flush timer is reset. If 0 or undefined, will assume 30 seconds. @throws IllegalArgumentException
[ "Maximum", "time", "in", "seconds", "to", "wait", "for", "the", "flushing", "of", "each", "chunk", "(", "per", "partition", ")", "." ]
train
https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/StreamParameters.java#L126-L132
wiselenium/wiselenium
wiselenium-factory/src/main/java/com/github/wiselenium/factory/RootInjector.java
RootInjector.rootElement
public static <E> void rootElement(WebElement root, E element) { if (element == null || root == null) return; if (element instanceof WebElement) return; for (Class<?> clazz = element.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) { if (Enhancer.isEnhanced(clazz)) continue; Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { setRootElementField(root, element, field); } } }
java
public static <E> void rootElement(WebElement root, E element) { if (element == null || root == null) return; if (element instanceof WebElement) return; for (Class<?> clazz = element.getClass(); !clazz.equals(Object.class); clazz = clazz.getSuperclass()) { if (Enhancer.isEnhanced(clazz)) continue; Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { setRootElementField(root, element, field); } } }
[ "public", "static", "<", "E", ">", "void", "rootElement", "(", "WebElement", "root", ",", "E", "element", ")", "{", "if", "(", "element", "==", "null", "||", "root", "==", "null", ")", "return", ";", "if", "(", "element", "instanceof", "WebElement", ")...
Injects the root webelement into an element. @param root The root webelement. @param element The element. @since 0.3.0
[ "Injects", "the", "root", "webelement", "into", "an", "element", "." ]
train
https://github.com/wiselenium/wiselenium/blob/15de6484d8f516b3d02391d3bd6a56a03e632706/wiselenium-factory/src/main/java/com/github/wiselenium/factory/RootInjector.java#L50-L64
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java
IcyInputStream.readInitialHeaders
protected void readInitialHeaders() throws IOException { String line; while ((line = readCRLFLine()).length()!=0) { int colonIndex = line.indexOf(':'); // does it have a ':' separator if (colonIndex == -1) continue; String tagName = line.substring(0, colonIndex); String value = line.substring(colonIndex + 1); if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4); IcyTag tag = new IcyTag(tagName, value); addTag(tag); } }
java
protected void readInitialHeaders() throws IOException { String line; while ((line = readCRLFLine()).length()!=0) { int colonIndex = line.indexOf(':'); // does it have a ':' separator if (colonIndex == -1) continue; String tagName = line.substring(0, colonIndex); String value = line.substring(colonIndex + 1); if (value.toLowerCase().endsWith("<br>")) value = value.substring(0, value.length()-4); IcyTag tag = new IcyTag(tagName, value); addTag(tag); } }
[ "protected", "void", "readInitialHeaders", "(", ")", "throws", "IOException", "{", "String", "line", ";", "while", "(", "(", "line", "=", "readCRLFLine", "(", ")", ")", ".", "length", "(", ")", "!=", "0", ")", "{", "int", "colonIndex", "=", "line", "."...
Assuming we're at the top of the stream, read lines one by one until we hit a completely blank \r\n. Parse the data as IcyTags.
[ "Assuming", "we", "re", "at", "the", "top", "of", "the", "stream", "read", "lines", "one", "by", "one", "until", "we", "hit", "a", "completely", "blank", "\\", "r", "\\", "n", ".", "Parse", "the", "data", "as", "IcyTags", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/streaming/IcyInputStream.java#L183-L197
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java
SocketBindingJBossASClient.addSocketBinding
public void addSocketBinding(String socketBindingGroupName, String socketBindingName, String sysPropName, int port) throws Exception { if (isSocketBinding(socketBindingGroupName, socketBindingName)) { return; } String portValue; if (sysPropName != null) { portValue = "${" + sysPropName + ":" + port + "}"; } else { portValue = String.valueOf(port); } Address addr = Address.root().add(SOCKET_BINDING_GROUP, socketBindingGroupName, SOCKET_BINDING, socketBindingName); final ModelNode request = new ModelNode(); setPossibleExpression(request, PORT, portValue); request.get(OPERATION).set(ADD); request.get(ADDRESS).set(addr.getAddressNode()); ModelNode results = execute(request); if (!isSuccess(results)) { throw new FailureException(results); } return; // everything is OK }
java
public void addSocketBinding(String socketBindingGroupName, String socketBindingName, String sysPropName, int port) throws Exception { if (isSocketBinding(socketBindingGroupName, socketBindingName)) { return; } String portValue; if (sysPropName != null) { portValue = "${" + sysPropName + ":" + port + "}"; } else { portValue = String.valueOf(port); } Address addr = Address.root().add(SOCKET_BINDING_GROUP, socketBindingGroupName, SOCKET_BINDING, socketBindingName); final ModelNode request = new ModelNode(); setPossibleExpression(request, PORT, portValue); request.get(OPERATION).set(ADD); request.get(ADDRESS).set(addr.getAddressNode()); ModelNode results = execute(request); if (!isSuccess(results)) { throw new FailureException(results); } return; // everything is OK }
[ "public", "void", "addSocketBinding", "(", "String", "socketBindingGroupName", ",", "String", "socketBindingName", ",", "String", "sysPropName", ",", "int", "port", ")", "throws", "Exception", "{", "if", "(", "isSocketBinding", "(", "socketBindingGroupName", ",", "s...
Adds a socket binding with the given name in the named socket binding group. If sysPropName is null, this simply sets the port number explicitly to the given port number. If sysPropName is not null, this sets the port to the expression "${sysPropName:port}". If a socket binding with the given name already exists, this method does nothing. @param socketBindingGroupName the name of the socket binding group in which to create the named socket binding @param socketBindingName the name of the socket binding to be created with the given port @param sysPropName the name of the system property whose value is to be the port number @param port the default port number if the sysPropName is not defined @throws Exception any error
[ "Adds", "a", "socket", "binding", "with", "the", "given", "name", "in", "the", "named", "socket", "binding", "group", ".", "If", "sysPropName", "is", "null", "this", "simply", "sets", "the", "port", "number", "explicitly", "to", "the", "given", "port", "nu...
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L133-L159
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java
MavenModelScannerPlugin.addConfiguration
private void addConfiguration(ConfigurableDescriptor configurableDescriptor, Xpp3Dom config, Store store) { if (null == config) { return; } MavenConfigurationDescriptor configDescriptor = store.create(MavenConfigurationDescriptor.class); configurableDescriptor.setConfiguration(configDescriptor); Xpp3Dom[] children = config.getChildren(); for (Xpp3Dom child : children) { configDescriptor.getValues().add(getConfigChildNodes(child, store)); } }
java
private void addConfiguration(ConfigurableDescriptor configurableDescriptor, Xpp3Dom config, Store store) { if (null == config) { return; } MavenConfigurationDescriptor configDescriptor = store.create(MavenConfigurationDescriptor.class); configurableDescriptor.setConfiguration(configDescriptor); Xpp3Dom[] children = config.getChildren(); for (Xpp3Dom child : children) { configDescriptor.getValues().add(getConfigChildNodes(child, store)); } }
[ "private", "void", "addConfiguration", "(", "ConfigurableDescriptor", "configurableDescriptor", ",", "Xpp3Dom", "config", ",", "Store", "store", ")", "{", "if", "(", "null", "==", "config", ")", "{", "return", ";", "}", "MavenConfigurationDescriptor", "configDescrip...
Adds configuration information. @param configurableDescriptor The descriptor for the configured element (Plugin, PluginExecution). @param config The configuration information. @param store The database.
[ "Adds", "configuration", "information", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L237-L247
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfigBuilder.java
CorsConfigBuilder.preflightResponseHeader
public <T> CorsConfigBuilder preflightResponseHeader(final CharSequence name, final Callable<T> valueGenerator) { preflightHeaders.put(name, valueGenerator); return this; }
java
public <T> CorsConfigBuilder preflightResponseHeader(final CharSequence name, final Callable<T> valueGenerator) { preflightHeaders.put(name, valueGenerator); return this; }
[ "public", "<", "T", ">", "CorsConfigBuilder", "preflightResponseHeader", "(", "final", "CharSequence", "name", ",", "final", "Callable", "<", "T", ">", "valueGenerator", ")", "{", "preflightHeaders", ".", "put", "(", "name", ",", "valueGenerator", ")", ";", "r...
Returns HTTP response headers that should be added to a CORS preflight response. An intermediary like a load balancer might require that a CORS preflight request have certain headers set. This enables such headers to be added. Some values must be dynamically created when the HTTP response is created, for example the 'Date' response header. This can be accomplished by using a Callable which will have its 'call' method invoked when the HTTP response is created. @param name the name of the HTTP header. @param valueGenerator a Callable which will be invoked at HTTP response creation. @param <T> the type of the value that the Callable can return. @return {@link CorsConfigBuilder} to support method chaining.
[ "Returns", "HTTP", "response", "headers", "that", "should", "be", "added", "to", "a", "CORS", "preflight", "response", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsConfigBuilder.java#L323-L326
maxirosson/jdroid-android
jdroid-android-core/src/main/java/com/jdroid/android/utils/TooltipHelper.java
TooltipHelper.setup
public static void setup(View view, final int textResId) { view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return showCheatSheet(view, view.getContext().getString(textResId)); } }); }
java
public static void setup(View view, final int textResId) { view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { return showCheatSheet(view, view.getContext().getString(textResId)); } }); }
[ "public", "static", "void", "setup", "(", "View", "view", ",", "final", "int", "textResId", ")", "{", "view", ".", "setOnLongClickListener", "(", "new", "View", ".", "OnLongClickListener", "(", ")", "{", "@", "Override", "public", "boolean", "onLongClick", "...
Sets up a cheat sheet (tooltip) for the given view by setting its {@link android.view.View.OnLongClickListener}. When the view is long-pressed, a {@link Toast} with the given text will be shown either above (default) or below the view (if there isn't room above it). @param view The view to add a cheat sheet for. @param textResId The string resource containing the text to show on long-press.
[ "Sets", "up", "a", "cheat", "sheet", "(", "tooltip", ")", "for", "the", "given", "view", "by", "setting", "its", "{", "@link", "android", ".", "view", ".", "View", ".", "OnLongClickListener", "}", ".", "When", "the", "view", "is", "long", "-", "pressed...
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/TooltipHelper.java#L53-L61
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.regenerateKey
public SignalRKeysInner regenerateKey(String resourceGroupName, String resourceName, KeyType keyType) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).toBlocking().last().body(); }
java
public SignalRKeysInner regenerateKey(String resourceGroupName, String resourceName, KeyType keyType) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).toBlocking().last().body(); }
[ "public", "SignalRKeysInner", "regenerateKey", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "KeyType", "keyType", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "keyType", ")", ...
Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. @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 resourceName The name of the SignalR resource. @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SignalRKeysInner object if successful.
[ "Regenerate", "SignalR", "service", "access", "key", ".", "PrimaryKey", "and", "SecondaryKey", "cannot", "be", "regenerated", "at", "the", "same", "time", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L665-L667
zeromq/jeromq
src/main/java/org/zeromq/ZMsg.java
ZMsg.recvMsg
public static ZMsg recvMsg(Socket socket, int flag) { if (socket == null) { throw new IllegalArgumentException("socket is null"); } ZMsg msg = new ZMsg(); while (true) { ZFrame f = ZFrame.recvFrame(socket, flag); if (f == null) { // If receive failed or was interrupted msg.destroy(); msg = null; break; } msg.add(f); if (!f.hasMore()) { break; } } return msg; }
java
public static ZMsg recvMsg(Socket socket, int flag) { if (socket == null) { throw new IllegalArgumentException("socket is null"); } ZMsg msg = new ZMsg(); while (true) { ZFrame f = ZFrame.recvFrame(socket, flag); if (f == null) { // If receive failed or was interrupted msg.destroy(); msg = null; break; } msg.add(f); if (!f.hasMore()) { break; } } return msg; }
[ "public", "static", "ZMsg", "recvMsg", "(", "Socket", "socket", ",", "int", "flag", ")", "{", "if", "(", "socket", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"socket is null\"", ")", ";", "}", "ZMsg", "msg", "=", "new", "Z...
Receives message from socket, returns ZMsg object or null if the recv was interrupted. Setting the flag to ZMQ.DONTWAIT does a non-blocking recv. @param socket @param flag see ZMQ constants @return ZMsg object, null if interrupted
[ "Receives", "message", "from", "socket", "returns", "ZMsg", "object", "or", "null", "if", "the", "recv", "was", "interrupted", ".", "Setting", "the", "flag", "to", "ZMQ", ".", "DONTWAIT", "does", "a", "non", "-", "blocking", "recv", "." ]
train
https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZMsg.java#L232-L254
ZuInnoTe/hadoopoffice
fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/parser/msexcel/MSExcelParser.java
MSExcelParser.addLinkedWorkbook
@Override public boolean addLinkedWorkbook(String name, InputStream inputStream, String password) throws FormatNotUnderstoodException { // check if already added if (this.addedFormulaEvaluators.containsKey(name)) { return false; } LOG.debug("Start adding \""+name+"\" to current workbook"); // create new parser, select all sheets, no linkedworkbookpasswords,no metadatafilter HadoopOfficeReadConfiguration linkedWBHOCR = new HadoopOfficeReadConfiguration(); linkedWBHOCR.setLocale(this.hocr.getLocale()); linkedWBHOCR.setSheets(null); linkedWBHOCR.setIgnoreMissingLinkedWorkbooks(this.hocr.getIgnoreMissingLinkedWorkbooks()); linkedWBHOCR.setFileName(name); linkedWBHOCR.setPassword(password); linkedWBHOCR.setMetaDataFilter(null); MSExcelParser linkedWBMSExcelParser = new MSExcelParser(linkedWBHOCR,null); // parse workbook linkedWBMSExcelParser.parse(inputStream); // add linked workbook this.addedWorkbooks.add(linkedWBMSExcelParser.getCurrentWorkbook()); this.addedFormulaEvaluators.put(name,linkedWBMSExcelParser.getCurrentFormulaEvaluator()); this.formulaEvaluator.setupReferencedWorkbooks(addedFormulaEvaluators); return true; }
java
@Override public boolean addLinkedWorkbook(String name, InputStream inputStream, String password) throws FormatNotUnderstoodException { // check if already added if (this.addedFormulaEvaluators.containsKey(name)) { return false; } LOG.debug("Start adding \""+name+"\" to current workbook"); // create new parser, select all sheets, no linkedworkbookpasswords,no metadatafilter HadoopOfficeReadConfiguration linkedWBHOCR = new HadoopOfficeReadConfiguration(); linkedWBHOCR.setLocale(this.hocr.getLocale()); linkedWBHOCR.setSheets(null); linkedWBHOCR.setIgnoreMissingLinkedWorkbooks(this.hocr.getIgnoreMissingLinkedWorkbooks()); linkedWBHOCR.setFileName(name); linkedWBHOCR.setPassword(password); linkedWBHOCR.setMetaDataFilter(null); MSExcelParser linkedWBMSExcelParser = new MSExcelParser(linkedWBHOCR,null); // parse workbook linkedWBMSExcelParser.parse(inputStream); // add linked workbook this.addedWorkbooks.add(linkedWBMSExcelParser.getCurrentWorkbook()); this.addedFormulaEvaluators.put(name,linkedWBMSExcelParser.getCurrentFormulaEvaluator()); this.formulaEvaluator.setupReferencedWorkbooks(addedFormulaEvaluators); return true; }
[ "@", "Override", "public", "boolean", "addLinkedWorkbook", "(", "String", "name", ",", "InputStream", "inputStream", ",", "String", "password", ")", "throws", "FormatNotUnderstoodException", "{", "// check if already added", "if", "(", "this", ".", "addedFormulaEvaluato...
Adds a linked workbook that is referred from this workbook. If the filename is already in the list then it is not processed twice. Note that the inputStream is closed after parsing @param name fileName (without path) of the workbook @param inputStream content of the linked workbook @param password if document is encrypted, null if not encrypted @return true if it has been added, false if it has been already added @throws org.zuinnote.hadoop.office.format.common.parser.FormatNotUnderstoodException in case there are issues reading from the Excel file
[ "Adds", "a", "linked", "workbook", "that", "is", "referred", "from", "this", "workbook", ".", "If", "the", "filename", "is", "already", "in", "the", "list", "then", "it", "is", "not", "processed", "twice", ".", "Note", "that", "the", "inputStream", "is", ...
train
https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/parser/msexcel/MSExcelParser.java#L270-L296
diffplug/durian
src/com/diffplug/common/base/Either.java
Either.fold
public final <T> T fold(Function<? super L, ? extends T> left, Function<? super R, ? extends T> right) { if (isLeft()) { return left.apply(getLeft()); } else { return right.apply(getRight()); } }
java
public final <T> T fold(Function<? super L, ? extends T> left, Function<? super R, ? extends T> right) { if (isLeft()) { return left.apply(getLeft()); } else { return right.apply(getRight()); } }
[ "public", "final", "<", "T", ">", "T", "fold", "(", "Function", "<", "?", "super", "L", ",", "?", "extends", "T", ">", "left", ",", "Function", "<", "?", "super", "R", ",", "?", "extends", "T", ">", "right", ")", "{", "if", "(", "isLeft", "(", ...
Applies either the left or the right function as appropriate.
[ "Applies", "either", "the", "left", "or", "the", "right", "function", "as", "appropriate", "." ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/Either.java#L68-L74
ontop/ontop
mapping/sql/owlapi/src/main/java/it/unibz/inf/ontop/spec/mapping/bootstrap/impl/DirectMappingAxiomProducer.java
DirectMappingAxiomProducer.generateSubject
private ImmutableTerm generateSubject(DatabaseRelationDefinition td, boolean ref) { String varNamePrefix = ""; if (ref) varNamePrefix = td.getID().getTableName() + "_"; UniqueConstraint pk = td.getPrimaryKey(); if (pk != null) { List<ImmutableTerm> terms = new ArrayList<>(pk.getAttributes().size() + 1); List<String> attributes = new ArrayList<>(pk.getAttributes().size()); for (Attribute att : pk.getAttributes()) attributes.add(R2RMLIRISafeEncoder.encode(att.getID().getName()) + "={}"); String template = baseIRI + R2RMLIRISafeEncoder.encode(td.getID().getTableName()) + "/" + Joiner.on(";").join(attributes); terms.add(termFactory.getConstantLiteral(template)); for (Attribute att : pk.getAttributes()) terms.add(termFactory.getVariable(varNamePrefix + att.getID().getName())); return termFactory.getImmutableUriTemplate(ImmutableList.copyOf(terms)); } else { List<ImmutableTerm> vars = new ArrayList<>(td.getAttributes().size()); for (Attribute att : td.getAttributes()) vars.add(termFactory.getVariable(varNamePrefix + att.getID().getName())); return termFactory.getImmutableBNodeTemplate(ImmutableList.copyOf(vars)); } }
java
private ImmutableTerm generateSubject(DatabaseRelationDefinition td, boolean ref) { String varNamePrefix = ""; if (ref) varNamePrefix = td.getID().getTableName() + "_"; UniqueConstraint pk = td.getPrimaryKey(); if (pk != null) { List<ImmutableTerm> terms = new ArrayList<>(pk.getAttributes().size() + 1); List<String> attributes = new ArrayList<>(pk.getAttributes().size()); for (Attribute att : pk.getAttributes()) attributes.add(R2RMLIRISafeEncoder.encode(att.getID().getName()) + "={}"); String template = baseIRI + R2RMLIRISafeEncoder.encode(td.getID().getTableName()) + "/" + Joiner.on(";").join(attributes); terms.add(termFactory.getConstantLiteral(template)); for (Attribute att : pk.getAttributes()) terms.add(termFactory.getVariable(varNamePrefix + att.getID().getName())); return termFactory.getImmutableUriTemplate(ImmutableList.copyOf(terms)); } else { List<ImmutableTerm> vars = new ArrayList<>(td.getAttributes().size()); for (Attribute att : td.getAttributes()) vars.add(termFactory.getVariable(varNamePrefix + att.getID().getName())); return termFactory.getImmutableBNodeTemplate(ImmutableList.copyOf(vars)); } }
[ "private", "ImmutableTerm", "generateSubject", "(", "DatabaseRelationDefinition", "td", ",", "boolean", "ref", ")", "{", "String", "varNamePrefix", "=", "\"\"", ";", "if", "(", "ref", ")", "varNamePrefix", "=", "td", ".", "getID", "(", ")", ".", "getTableName"...
- If the table has a primary key, the row node is a relative IRI obtained by concatenating: - the percent-encoded form of the table name, - the SOLIDUS character '/', - for each column in the primary key, in order: - the percent-encoded form of the column name, - a EQUALS SIGN character '=', - the percent-encoded lexical form of the canonical RDF literal representation of the column value as defined in R2RML section 10.2 Natural Mapping of SQL Values [R2RML], - if it is not the last column in the primary key, a SEMICOLON character ';' - If the table has no primary key, the row node is a fresh blank node that is unique to this row. @param td @return
[ "-", "If", "the", "table", "has", "a", "primary", "key", "the", "row", "node", "is", "a", "relative", "IRI", "obtained", "by", "concatenating", ":", "-", "the", "percent", "-", "encoded", "form", "of", "the", "table", "name", "-", "the", "SOLIDUS", "ch...
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/owlapi/src/main/java/it/unibz/inf/ontop/spec/mapping/bootstrap/impl/DirectMappingAxiomProducer.java#L224-L253
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.mixin
public static void mixin(Class self, Class categoryClass) { mixin(getMetaClass(self), Collections.singletonList(categoryClass)); }
java
public static void mixin(Class self, Class categoryClass) { mixin(getMetaClass(self), Collections.singletonList(categoryClass)); }
[ "public", "static", "void", "mixin", "(", "Class", "self", ",", "Class", "categoryClass", ")", "{", "mixin", "(", "getMetaClass", "(", "self", ")", ",", "Collections", ".", "singletonList", "(", "categoryClass", ")", ")", ";", "}" ]
Extend class globally with category methods. @param self any Class @param categoryClass a category class to use @since 1.6.0
[ "Extend", "class", "globally", "with", "category", "methods", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L589-L591
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseRequest.java
CreateRouteResponseRequest.withResponseParameters
public CreateRouteResponseRequest withResponseParameters(java.util.Map<String, ParameterConstraints> responseParameters) { setResponseParameters(responseParameters); return this; }
java
public CreateRouteResponseRequest withResponseParameters(java.util.Map<String, ParameterConstraints> responseParameters) { setResponseParameters(responseParameters); return this; }
[ "public", "CreateRouteResponseRequest", "withResponseParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "ParameterConstraints", ">", "responseParameters", ")", "{", "setResponseParameters", "(", "responseParameters", ")", ";", "return", "this", ";"...
<p> The route response parameters. </p> @param responseParameters The route response parameters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "route", "response", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseRequest.java#L236-L239
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.readResourceURL
@Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); } catch (Throwable exception) { // } } return null; }
java
@Pure public static URL readResourceURL(Element node, XMLResources resources, String... path) { final String stringValue = getAttributeValue(node, path); if (XMLResources.isStringIdentifier(stringValue)) { try { final long id = XMLResources.getNumericalIdentifier(stringValue); return resources.getResourceURL(id); } catch (Throwable exception) { // } } return null; }
[ "@", "Pure", "public", "static", "URL", "readResourceURL", "(", "Element", "node", ",", "XMLResources", "resources", ",", "String", "...", "path", ")", "{", "final", "String", "stringValue", "=", "getAttributeValue", "(", "node", ",", "path", ")", ";", "if",...
Replies the resource URL that is contained inside the XML attribute defined in the given node and with the given XML path. @param node is the XML node to read. @param resources is the collection of resources to read. @param path is the XML path, relative to the node, of the attribute. The last element of the array is the name of the attribute. @return the resource URL, or <code>null</code> if it cannot be retrieved.
[ "Replies", "the", "resource", "URL", "that", "is", "contained", "inside", "the", "XML", "attribute", "defined", "in", "the", "given", "node", "and", "with", "the", "given", "XML", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2604-L2616
ddf-project/DDF
core/src/main/java/io/ddf/misc/Config.java
Config.getValueWithGlobalDefault
public static String getValueWithGlobalDefault(String section, ConfigConstant key) { String value = getValue(section, key); return (Strings.isNullOrEmpty(value) ? getGlobalValue(key) : value); }
java
public static String getValueWithGlobalDefault(String section, ConfigConstant key) { String value = getValue(section, key); return (Strings.isNullOrEmpty(value) ? getGlobalValue(key) : value); }
[ "public", "static", "String", "getValueWithGlobalDefault", "(", "String", "section", ",", "ConfigConstant", "key", ")", "{", "String", "value", "=", "getValue", "(", "section", ",", "key", ")", ";", "return", "(", "Strings", ".", "isNullOrEmpty", "(", "value",...
If the named section does not have the value, then try the same key from the "global" section @param section @param key @return
[ "If", "the", "named", "section", "does", "not", "have", "the", "value", "then", "try", "the", "same", "key", "from", "the", "global", "section" ]
train
https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/misc/Config.java#L68-L71
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.findAndModify
public T findAndModify(DBObject query, DBObject fields, DBObject sort, boolean remove, DBObject update, boolean returnNew, boolean upsert) { return convertFromDbObject(dbCollection.findAndModify(serializeFields(query), fields, sort, remove, update, returnNew, upsert)); }
java
public T findAndModify(DBObject query, DBObject fields, DBObject sort, boolean remove, DBObject update, boolean returnNew, boolean upsert) { return convertFromDbObject(dbCollection.findAndModify(serializeFields(query), fields, sort, remove, update, returnNew, upsert)); }
[ "public", "T", "findAndModify", "(", "DBObject", "query", ",", "DBObject", "fields", ",", "DBObject", "sort", ",", "boolean", "remove", ",", "DBObject", "update", ",", "boolean", "returnNew", ",", "boolean", "upsert", ")", "{", "return", "convertFromDbObject", ...
Finds the first document in the query and updates it. @param query query to match @param fields fields to be returned @param sort sort to apply before picking first document @param remove if true, document found will be removed @param update update to apply @param returnNew if true, the updated document is returned, otherwise the old document is returned (or it would be lost forever) @param upsert do upsert (insert if document not present) @return the object
[ "Finds", "the", "first", "document", "in", "the", "query", "and", "updates", "it", "." ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L581-L583
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readAssignments
private void readAssignments(Resource mpxjResource, net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res) { for (Assignment assignment : res.getAssignment()) { readAssignment(mpxjResource, assignment); } }
java
private void readAssignments(Resource mpxjResource, net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res) { for (Assignment assignment : res.getAssignment()) { readAssignment(mpxjResource, assignment); } }
[ "private", "void", "readAssignments", "(", "Resource", "mpxjResource", ",", "net", ".", "sf", ".", "mpxj", ".", "phoenix", ".", "schema", ".", "Project", ".", "Storepoints", ".", "Storepoint", ".", "Resources", ".", "Resource", "res", ")", "{", "for", "(",...
Reads Phoenix resource assignments. @param mpxjResource MPXJ resource @param res Phoenix resource
[ "Reads", "Phoenix", "resource", "assignments", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L631-L637
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_POST
public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, OvhOvhPabxDialplanExtensionRuleActionEnum action, String actionParam, Boolean negativeAction, Long position) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "actionParam", actionParam); addBody(o, "negativeAction", negativeAction); addBody(o, "position", position); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class); }
java
public OvhOvhPabxDialplanExtensionRule billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, OvhOvhPabxDialplanExtensionRuleActionEnum action, String actionParam, Boolean negativeAction, Long position) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); addBody(o, "actionParam", actionParam); addBody(o, "negativeAction", negativeAction); addBody(o, "position", position); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionRule.class); }
[ "public", "OvhOvhPabxDialplanExtensionRule", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "OvhOvhPabxDialplanExtensi...
Create a new rule for an extension REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule @param actionParam [required] The parameter of the chosen action @param action [required] The action made by the rule @param position [required] The position of the rule in the extension (the rules are executed following this order) @param negativeAction [required] If true, the rule will be executed only when the result of the conditions is false @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required]
[ "Create", "a", "new", "rule", "for", "an", "extension" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7312-L7322
liyiorg/weixin-popular
src/main/java/weixin/popular/api/BizwifiAPI.java
BizwifiAPI.shopUpdate
public static BaseResult shopUpdate(String accessToken, ShopUpdate shopUpdate) { return shopUpdate(accessToken, JsonUtil.toJSONString(shopUpdate)); }
java
public static BaseResult shopUpdate(String accessToken, ShopUpdate shopUpdate) { return shopUpdate(accessToken, JsonUtil.toJSONString(shopUpdate)); }
[ "public", "static", "BaseResult", "shopUpdate", "(", "String", "accessToken", ",", "ShopUpdate", "shopUpdate", ")", "{", "return", "shopUpdate", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "shopUpdate", ")", ")", ";", "}" ]
Wi-Fi门店管理-修改门店网络信息 @param accessToken accessToken @param shopUpdate shopUpdate @return BaseResult
[ "Wi", "-", "Fi门店管理", "-", "修改门店网络信息" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L254-L256
aaberg/sql2o
core/src/main/java/org/sql2o/Sql2o.java
Sql2o.beginTransaction
public Connection beginTransaction(ConnectionSource connectionSource, int isolationLevel) { Connection connection = new Connection(this, connectionSource, false); boolean success = false; try { connection.getJdbcConnection().setAutoCommit(false); connection.getJdbcConnection().setTransactionIsolation(isolationLevel); success = true; } catch (SQLException e) { throw new Sql2oException("Could not start the transaction - " + e.getMessage(), e); } finally { if (!success) { connection.close(); } } return connection; }
java
public Connection beginTransaction(ConnectionSource connectionSource, int isolationLevel) { Connection connection = new Connection(this, connectionSource, false); boolean success = false; try { connection.getJdbcConnection().setAutoCommit(false); connection.getJdbcConnection().setTransactionIsolation(isolationLevel); success = true; } catch (SQLException e) { throw new Sql2oException("Could not start the transaction - " + e.getMessage(), e); } finally { if (!success) { connection.close(); } } return connection; }
[ "public", "Connection", "beginTransaction", "(", "ConnectionSource", "connectionSource", ",", "int", "isolationLevel", ")", "{", "Connection", "connection", "=", "new", "Connection", "(", "this", ",", "connectionSource", ",", "false", ")", ";", "boolean", "success",...
Begins a transaction with the given isolation level. Every statement executed on the return {@link Connection} instance, will be executed in the transaction. It is very important to always call either the {@link org.sql2o.Connection#commit()} method or the {@link org.sql2o.Connection#rollback()} method to close the transaction. Use proper try-catch logic. @param connectionSource the {@link ConnectionSource} implementation substitution, that will be used instead of one from {@link Sql2o} instance. @param isolationLevel the isolation level of the transaction @return the {@link Connection} instance to use to run statements in the transaction.
[ "Begins", "a", "transaction", "with", "the", "given", "isolation", "level", ".", "Every", "statement", "executed", "on", "the", "return", "{" ]
train
https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Sql2o.java#L293-L311
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java
DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors
public static DiscountCurveInterpolation createDiscountCurveFromDiscountFactors( String name, LocalDate referenceDate, double[] times, double[] givenDiscountFactors, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { DiscountCurveInterpolation discountFactors = new DiscountCurveInterpolation(name, referenceDate, interpolationMethod, extrapolationMethod, interpolationEntity); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { discountFactors.addDiscountFactor(times[timeIndex], givenDiscountFactors[timeIndex], isParameter != null && isParameter[timeIndex]); } return discountFactors; }
java
public static DiscountCurveInterpolation createDiscountCurveFromDiscountFactors( String name, LocalDate referenceDate, double[] times, double[] givenDiscountFactors, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { DiscountCurveInterpolation discountFactors = new DiscountCurveInterpolation(name, referenceDate, interpolationMethod, extrapolationMethod, interpolationEntity); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { discountFactors.addDiscountFactor(times[timeIndex], givenDiscountFactors[timeIndex], isParameter != null && isParameter[timeIndex]); } return discountFactors; }
[ "public", "static", "DiscountCurveInterpolation", "createDiscountCurveFromDiscountFactors", "(", "String", "name", ",", "LocalDate", "referenceDate", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenDiscountFactors", ",", "boolean", "[", "]", "isParame...
Create a discount curve from given times and given discount factors using given interpolation and extrapolation methods. @param name The name of this discount curve. @param referenceDate The reference date for this curve, i.e., the date which defined t=0. @param times Array of times as doubles. @param givenDiscountFactors Array of corresponding discount factors. @param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves). @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @return A new discount factor object.
[ "Create", "a", "discount", "curve", "from", "given", "times", "and", "given", "discount", "factors", "using", "given", "interpolation", "and", "extrapolation", "methods", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java#L89-L101
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java
TasksImpl.updateAsync
public Observable<Void> updateAsync(String jobId, String taskId) { return updateWithServiceResponseAsync(jobId, taskId).map(new Func1<ServiceResponseWithHeaders<Void, TaskUpdateHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, TaskUpdateHeaders> response) { return response.body(); } }); }
java
public Observable<Void> updateAsync(String jobId, String taskId) { return updateWithServiceResponseAsync(jobId, taskId).map(new Func1<ServiceResponseWithHeaders<Void, TaskUpdateHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, TaskUpdateHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "updateAsync", "(", "String", "jobId", ",", "String", "taskId", ")", "{", "return", "updateWithServiceResponseAsync", "(", "jobId", ",", "taskId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", ...
Updates the properties of the specified task. @param jobId The ID of the job containing the task. @param taskId The ID of the task to update. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Updates", "the", "properties", "of", "the", "specified", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L1402-L1409
alkacon/opencms-core
src/org/opencms/db/CmsExportPointDriver.java
CmsExportPointDriver.writeFile
public void writeFile(String resourceName, String exportpoint, byte[] content) { writeResource(resourceName, exportpoint, content); }
java
public void writeFile(String resourceName, String exportpoint, byte[] content) { writeResource(resourceName, exportpoint, content); }
[ "public", "void", "writeFile", "(", "String", "resourceName", ",", "String", "exportpoint", ",", "byte", "[", "]", "content", ")", "{", "writeResource", "(", "resourceName", ",", "exportpoint", ",", "content", ")", ";", "}" ]
Writes the file with the given root path to the real file system.<p> If required, missing parent folders in the real file system are automatically created.<p> @param resourceName the root path of the file to write @param exportpoint the export point to write file to @param content the contents of the file to write
[ "Writes", "the", "file", "with", "the", "given", "root", "path", "to", "the", "real", "file", "system", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsExportPointDriver.java#L162-L165
alexvasilkov/Events
library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java
Dispatcher.scheduleActiveStatusesUpdates
@MainThread private void scheduleActiveStatusesUpdates(EventTarget target, EventStatus status) { for (Event event : activeEvents) { for (EventMethod method : target.methods) { if (event.getKey().equals(method.eventKey) && method.type == EventMethod.Type.STATUS) { Utils.log(event.getKey(), method, "Scheduling status update for new target"); executionQueue.addFirst(Task.create(this, target, method, event, status)); } } } }
java
@MainThread private void scheduleActiveStatusesUpdates(EventTarget target, EventStatus status) { for (Event event : activeEvents) { for (EventMethod method : target.methods) { if (event.getKey().equals(method.eventKey) && method.type == EventMethod.Type.STATUS) { Utils.log(event.getKey(), method, "Scheduling status update for new target"); executionQueue.addFirst(Task.create(this, target, method, event, status)); } } } }
[ "@", "MainThread", "private", "void", "scheduleActiveStatusesUpdates", "(", "EventTarget", "target", ",", "EventStatus", "status", ")", "{", "for", "(", "Event", "event", ":", "activeEvents", ")", "{", "for", "(", "EventMethod", "method", ":", "target", ".", "...
Schedules status updates of all active events for given target.
[ "Schedules", "status", "updates", "of", "all", "active", "events", "for", "given", "target", "." ]
train
https://github.com/alexvasilkov/Events/blob/4208e11fab35d99229fe6c3b3d434ca1948f3fc5/library/src/main/java/com/alexvasilkov/events/internal/Dispatcher.java#L80-L91
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.beginCreateOrUpdate
public ExpressRouteCircuitInner beginCreateOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuitInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, parameters).toBlocking().single().body(); }
java
public ExpressRouteCircuitInner beginCreateOrUpdate(String resourceGroupName, String circuitName, ExpressRouteCircuitInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, parameters).toBlocking().single().body(); }
[ "public", "ExpressRouteCircuitInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "ExpressRouteCircuitInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "circu...
Creates or updates an express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of the circuit. @param parameters Parameters supplied to the create or update express route circuit operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCircuitInner object if successful.
[ "Creates", "or", "updates", "an", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L470-L472
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/ExecToolCommandLogger.java
ExecToolCommandLogger.expandMessage
private String expandMessage(final BuildEvent event, final String message) { final HashMap<String,String> data=new HashMap<String, String>(); final String user = retrieveUserName(event); if(null!=user){ data.put("user", user); } final String node = retrieveNodeName(event); if(null!=node){ data.put("node", node); } data.put("level", logLevelToString(event.getPriority())); if(null!=formatter){ return formatter.reformat(data, message); }else { return message; } }
java
private String expandMessage(final BuildEvent event, final String message) { final HashMap<String,String> data=new HashMap<String, String>(); final String user = retrieveUserName(event); if(null!=user){ data.put("user", user); } final String node = retrieveNodeName(event); if(null!=node){ data.put("node", node); } data.put("level", logLevelToString(event.getPriority())); if(null!=formatter){ return formatter.reformat(data, message); }else { return message; } }
[ "private", "String", "expandMessage", "(", "final", "BuildEvent", "event", ",", "final", "String", "message", ")", "{", "final", "HashMap", "<", "String", ",", "String", ">", "data", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";"...
Process string specified by the framework.log.dispatch.console.format property replacing any well known tokens with values from the event. @param event The BuildEvent @param message The concatenated message @return message string with tokens replaced by values.
[ "Process", "string", "specified", "by", "the", "framework", ".", "log", ".", "dispatch", ".", "console", ".", "format", "property", "replacing", "any", "well", "known", "tokens", "with", "values", "from", "the", "event", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/ExecToolCommandLogger.java#L76-L94
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.paintForegroundEnabled
private void paintForegroundEnabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(enabledColor); g.fill(s); }
java
private void paintForegroundEnabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(enabledColor); g.fill(s); }
[ "private", "void", "paintForegroundEnabled", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "decodeArrowPath", "(", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "enabledColor", ")", ";", "g...
Paint the arrow in enabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "arrow", "in", "enabled", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L109-L115
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java
SessionsInner.createOrUpdate
public IntegrationAccountSessionInner createOrUpdate(String resourceGroupName, String integrationAccountName, String sessionName, IntegrationAccountSessionInner session) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName, session).toBlocking().single().body(); }
java
public IntegrationAccountSessionInner createOrUpdate(String resourceGroupName, String integrationAccountName, String sessionName, IntegrationAccountSessionInner session) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName, session).toBlocking().single().body(); }
[ "public", "IntegrationAccountSessionInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "sessionName", ",", "IntegrationAccountSessionInner", "session", ")", "{", "return", "createOrUpdateWithServiceResponseAsync",...
Creates or updates an integration account session. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param sessionName The integration account session name. @param session The integration account session. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IntegrationAccountSessionInner object if successful.
[ "Creates", "or", "updates", "an", "integration", "account", "session", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java#L442-L444
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.setActivityAsyncDelegates
protected void setActivityAsyncDelegates(final ActivityImpl activity) { activity.setDelegateAsyncAfterUpdate(new ActivityImpl.AsyncAfterUpdate() { @Override public void updateAsyncAfter(boolean asyncAfter, boolean exclusive) { if (asyncAfter) { addMessageJobDeclaration(new AsyncAfterMessageJobDeclaration(), activity, exclusive); } else { removeMessageJobDeclarationWithJobConfiguration(activity, MessageJobDeclaration.ASYNC_AFTER); } } }); activity.setDelegateAsyncBeforeUpdate(new ActivityImpl.AsyncBeforeUpdate() { @Override public void updateAsyncBefore(boolean asyncBefore, boolean exclusive) { if (asyncBefore) { addMessageJobDeclaration(new AsyncBeforeMessageJobDeclaration(), activity, exclusive); } else { removeMessageJobDeclarationWithJobConfiguration(activity, MessageJobDeclaration.ASYNC_BEFORE); } } }); }
java
protected void setActivityAsyncDelegates(final ActivityImpl activity) { activity.setDelegateAsyncAfterUpdate(new ActivityImpl.AsyncAfterUpdate() { @Override public void updateAsyncAfter(boolean asyncAfter, boolean exclusive) { if (asyncAfter) { addMessageJobDeclaration(new AsyncAfterMessageJobDeclaration(), activity, exclusive); } else { removeMessageJobDeclarationWithJobConfiguration(activity, MessageJobDeclaration.ASYNC_AFTER); } } }); activity.setDelegateAsyncBeforeUpdate(new ActivityImpl.AsyncBeforeUpdate() { @Override public void updateAsyncBefore(boolean asyncBefore, boolean exclusive) { if (asyncBefore) { addMessageJobDeclaration(new AsyncBeforeMessageJobDeclaration(), activity, exclusive); } else { removeMessageJobDeclarationWithJobConfiguration(activity, MessageJobDeclaration.ASYNC_BEFORE); } } }); }
[ "protected", "void", "setActivityAsyncDelegates", "(", "final", "ActivityImpl", "activity", ")", "{", "activity", ".", "setDelegateAsyncAfterUpdate", "(", "new", "ActivityImpl", ".", "AsyncAfterUpdate", "(", ")", "{", "@", "Override", "public", "void", "updateAsyncAft...
Sets the delegates for the activity, which will be called if the attribute asyncAfter or asyncBefore was changed. @param activity the activity which gets the delegates
[ "Sets", "the", "delegates", "for", "the", "activity", "which", "will", "be", "called", "if", "the", "attribute", "asyncAfter", "or", "asyncBefore", "was", "changed", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1797-L1819
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java
DiscountCurveInterpolation.createDiscountCurveFromZeroRates
@Deprecated public static DiscountCurveInterpolation createDiscountCurveFromZeroRates( String name, double[] times, double[] givenZeroRates, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { return createDiscountCurveFromZeroRates(name, (LocalDate)null, times, givenZeroRates, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
java
@Deprecated public static DiscountCurveInterpolation createDiscountCurveFromZeroRates( String name, double[] times, double[] givenZeroRates, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { return createDiscountCurveFromZeroRates(name, (LocalDate)null, times, givenZeroRates, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
[ "@", "Deprecated", "public", "static", "DiscountCurveInterpolation", "createDiscountCurveFromZeroRates", "(", "String", "name", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenZeroRates", ",", "boolean", "[", "]", "isParameter", ",", "InterpolationM...
Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods. The discount factor is determined by <code> givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]); </code> @param name The name of this discount curve. @param times Array of times as doubles. @param givenZeroRates Array of corresponding zero rates. @param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves). @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @return A new discount factor object. @deprecated Initializing a curve without reference date is deprecated.
[ "Create", "a", "discount", "curve", "from", "given", "times", "and", "given", "zero", "rates", "using", "given", "interpolation", "and", "extrapolation", "methods", ".", "The", "discount", "factor", "is", "determined", "by", "<code", ">", "givenDiscountFactors", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java#L239-L246
unbescape/unbescape
src/main/java/org/unbescape/java/JavaEscape.java
JavaEscape.escapeJava
public static void escapeJava(final Reader reader, final Writer writer) throws IOException { escapeJava(reader, writer, JavaEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapeJava(final Reader reader, final Writer writer) throws IOException { escapeJava(reader, writer, JavaEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJava", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJava", "(", "reader", ",", "writer", ",", "JavaEscapeLevel", ".", "LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET", "...
<p> Perform a Java level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The Java basic escape set: <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#39;</tt> (<tt>U+0027</tt>) and <tt>&#92;&#92;</tt> (<tt>U+005C</tt>). Note <tt>&#92;&#39;</tt> is not really needed in String literals (only in Character literals), so it won't be used until escape level 3. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using the Single Escape Chars whenever possible. For escaped characters that do not have an associated SEC, default to <tt>&#92;uFFFF</tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapeJava(Reader, Writer, JavaEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>level</tt>: {@link JavaEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L608-L611
segmentio/analytics-android
analytics/src/main/java/com/segment/analytics/ValueMap.java
ValueMap.getValueMap
public ValueMap getValueMap(Object key) { Object value = get(key); if (value instanceof ValueMap) { return (ValueMap) value; } else if (value instanceof Map) { //noinspection unchecked return new ValueMap((Map<String, Object>) value); } else { return null; } }
java
public ValueMap getValueMap(Object key) { Object value = get(key); if (value instanceof ValueMap) { return (ValueMap) value; } else if (value instanceof Map) { //noinspection unchecked return new ValueMap((Map<String, Object>) value); } else { return null; } }
[ "public", "ValueMap", "getValueMap", "(", "Object", "key", ")", "{", "Object", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "instanceof", "ValueMap", ")", "{", "return", "(", "ValueMap", ")", "value", ";", "}", "else", "if", "(", "v...
Returns the value mapped by {@code key} if it exists and is a {@link ValueMap}. Returns null otherwise.
[ "Returns", "the", "value", "mapped", "by", "{" ]
train
https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/ValueMap.java#L311-L321
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.updateStorageAccountAsync
public Observable<Void> updateStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) { return updateStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> updateStorageAccountAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) { return updateStorageAccountWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "updateStorageAccountAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "storageAccountName", ",", "AddStorageAccountParameters", "parameters", ")", "{", "return", "updateStorageAccountWithServi...
Updates the Data Lake Analytics account to replace Azure Storage blob account details, such as the access key and/or suffix. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account to modify storage accounts in @param storageAccountName The Azure Storage account to modify @param parameters The parameters containing the access key and suffix to update the storage account with. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Updates", "the", "Data", "Lake", "Analytics", "account", "to", "replace", "Azure", "Storage", "blob", "account", "details", "such", "as", "the", "access", "key", "and", "/", "or", "suffix", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L406-L413
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/collection/MultiMap.java
MultiMap.addValues
public void addValues(String name, List<V> values) { List<V> lo = get(name); if (lo == null) { lo = new ArrayList<>(); } lo.addAll(values); put(name, lo); }
java
public void addValues(String name, List<V> values) { List<V> lo = get(name); if (lo == null) { lo = new ArrayList<>(); } lo.addAll(values); put(name, lo); }
[ "public", "void", "addValues", "(", "String", "name", ",", "List", "<", "V", ">", "values", ")", "{", "List", "<", "V", ">", "lo", "=", "get", "(", "name", ")", ";", "if", "(", "lo", "==", "null", ")", "{", "lo", "=", "new", "ArrayList", "<>", ...
Add values to multi valued entry. If the entry is single valued, it is converted to the first value of a multi valued entry. @param name The entry key. @param values The List of multiple values.
[ "Add", "values", "to", "multi", "valued", "entry", ".", "If", "the", "entry", "is", "single", "valued", "it", "is", "converted", "to", "the", "first", "value", "of", "a", "multi", "valued", "entry", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/collection/MultiMap.java#L165-L172
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/PrefHelper.java
PrefHelper.setLong
public void setLong(String key, long value) { prefHelper_.prefsEditor_.putLong(key, value); prefHelper_.prefsEditor_.apply(); }
java
public void setLong(String key, long value) { prefHelper_.prefsEditor_.putLong(key, value); prefHelper_.prefsEditor_.apply(); }
[ "public", "void", "setLong", "(", "String", "key", ",", "long", "value", ")", "{", "prefHelper_", ".", "prefsEditor_", ".", "putLong", "(", "key", ",", "value", ")", ";", "prefHelper_", ".", "prefsEditor_", ".", "apply", "(", ")", ";", "}" ]
<p>Sets the value of the {@link String} key value supplied in preferences.</p> @param key A {@link String} value containing the key to reference. @param value A {@link Long} value to set the preference record to.
[ "<p", ">", "Sets", "the", "value", "of", "the", "{", "@link", "String", "}", "key", "value", "supplied", "in", "preferences", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L981-L984
authlete/authlete-java-common
src/main/java/com/authlete/common/util/TypedProperties.java
TypedProperties.getFloat
public float getFloat(Enum<?> key, float defaultValue) { if (key == null) { return defaultValue; } return getFloat(key.name(), defaultValue); }
java
public float getFloat(Enum<?> key, float defaultValue) { if (key == null) { return defaultValue; } return getFloat(key.name(), defaultValue); }
[ "public", "float", "getFloat", "(", "Enum", "<", "?", ">", "key", ",", "float", "defaultValue", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "return", "getFloat", "(", "key", ".", "name", "(", ")", ",", "d...
Equivalent to {@link #getFloat(String, float) getFloat}{@code (key.name(), defaultValue)}. If {@code key} is null, {@code defaultValue} is returned.
[ "Equivalent", "to", "{" ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L173-L181
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.waitingToLock
public static @Nonnull Predicate waitingToLock(final @Nonnull String className) { return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { final ThreadLock lock = thread.getWaitingToLock(); return lock != null && lock.getClassName().equals(className); } }; }
java
public static @Nonnull Predicate waitingToLock(final @Nonnull String className) { return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { final ThreadLock lock = thread.getWaitingToLock(); return lock != null && lock.getClassName().equals(className); } }; }
[ "public", "static", "@", "Nonnull", "Predicate", "waitingToLock", "(", "final", "@", "Nonnull", "String", "className", ")", "{", "return", "new", "Predicate", "(", ")", "{", "@", "Override", "public", "boolean", "isValid", "(", "@", "Nonnull", "ProcessThread",...
Match thread that is waiting on lock identified by <tt>className</tt>.
[ "Match", "thread", "that", "is", "waiting", "on", "lock", "identified", "by", "<tt", ">", "className<", "/", "tt", ">", "." ]
train
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L553-L561
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.performDeletion
private void performDeletion(final ClassDescriptor cld, final Object obj, final Identity oid, final boolean ignoreReferences) throws PersistenceBrokerException { // 1. delete dependend collections if (!ignoreReferences && cld.getCollectionDescriptors().size() > 0) { deleteCollections(obj, cld.getCollectionDescriptors()); } // 2. delete object from directly mapped table try { dbAccess.executeDelete(cld, obj); // use obj not oid to delete, BRJ } catch(OptimisticLockException e) { // ensure that the outdated object be removed from cache objectCache.remove(oid); throw e; } // 3. Add OID to the set of deleted objects deletedDuringTransaction.add(oid); // 4. delete dependend upon objects last to avoid FK violations if (cld.getObjectReferenceDescriptors().size() > 0) { deleteReferences(cld, obj, oid, ignoreReferences); } // remove obj from the object cache: objectCache.remove(oid); }
java
private void performDeletion(final ClassDescriptor cld, final Object obj, final Identity oid, final boolean ignoreReferences) throws PersistenceBrokerException { // 1. delete dependend collections if (!ignoreReferences && cld.getCollectionDescriptors().size() > 0) { deleteCollections(obj, cld.getCollectionDescriptors()); } // 2. delete object from directly mapped table try { dbAccess.executeDelete(cld, obj); // use obj not oid to delete, BRJ } catch(OptimisticLockException e) { // ensure that the outdated object be removed from cache objectCache.remove(oid); throw e; } // 3. Add OID to the set of deleted objects deletedDuringTransaction.add(oid); // 4. delete dependend upon objects last to avoid FK violations if (cld.getObjectReferenceDescriptors().size() > 0) { deleteReferences(cld, obj, oid, ignoreReferences); } // remove obj from the object cache: objectCache.remove(oid); }
[ "private", "void", "performDeletion", "(", "final", "ClassDescriptor", "cld", ",", "final", "Object", "obj", ",", "final", "Identity", "oid", ",", "final", "boolean", "ignoreReferences", ")", "throws", "PersistenceBrokerException", "{", "// 1. delete dependend collectio...
This method perform the delete of the specified object based on the {@link org.apache.ojb.broker.metadata.ClassDescriptor}.
[ "This", "method", "perform", "the", "delete", "of", "the", "specified", "object", "based", "on", "the", "{" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L598-L627
jurmous/etcd4j
src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java
SecurityContextBuilder.forKeystore
public static SslContext forKeystore(InputStream keystore, String keystorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { final KeyStore ks = KeyStore.getInstance(KEYSTORE_JKS); final KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerAlgorithm); ks.load(keystore, keystorePassword.toCharArray()); kmf.init(ks, keystorePassword.toCharArray()); SslContextBuilder ctxBuilder = SslContextBuilder.forClient().keyManager(kmf); return ctxBuilder.build(); } catch (Exception e) { throw new SecurityContextException(e); } }
java
public static SslContext forKeystore(InputStream keystore, String keystorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { final KeyStore ks = KeyStore.getInstance(KEYSTORE_JKS); final KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyManagerAlgorithm); ks.load(keystore, keystorePassword.toCharArray()); kmf.init(ks, keystorePassword.toCharArray()); SslContextBuilder ctxBuilder = SslContextBuilder.forClient().keyManager(kmf); return ctxBuilder.build(); } catch (Exception e) { throw new SecurityContextException(e); } }
[ "public", "static", "SslContext", "forKeystore", "(", "InputStream", "keystore", ",", "String", "keystorePassword", ",", "String", "keyManagerAlgorithm", ")", "throws", "SecurityContextException", "{", "try", "{", "final", "KeyStore", "ks", "=", "KeyStore", ".", "ge...
Builds SslContext using protected keystore file overriding default key manger algorithm. Adequate for non-mutual TLS connections. @param keystore Keystore inputstream (file, binaries, etc) @param keystorePassword Password for protected keystore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException for any troubles building the SslContext
[ "Builds", "SslContext", "using", "protected", "keystore", "file", "overriding", "default", "key", "manger", "algorithm", ".", "Adequate", "for", "non", "-", "mutual", "TLS", "connections", "." ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java#L60-L75
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.deleteAsync
public Observable<OperationStatusResponseInner> deleteAsync(String resourceGroupName, String vmScaleSetName) { return deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> deleteAsync(String resourceGroupName, String vmScaleSetName) { return deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "deleteAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", ...
Deletes a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Deletes", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L572-L579
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java
ConnectionUtils.tryLocalHostBeforeReturning
private static InetAddress tryLocalHostBeforeReturning( InetAddress preliminaryResult, SocketAddress targetAddress, boolean logging) throws IOException { InetAddress localhostName = InetAddress.getLocalHost(); if (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
java
private static InetAddress tryLocalHostBeforeReturning( InetAddress preliminaryResult, SocketAddress targetAddress, boolean logging) throws IOException { InetAddress localhostName = InetAddress.getLocalHost(); if (preliminaryResult.equals(localhostName)) { // preliminary result is equal to the local host name return preliminaryResult; } else if (tryToConnect(localhostName, targetAddress, AddressDetectionState.SLOW_CONNECT.getTimeout(), logging)) { // success, we were able to use local host to connect LOG.debug("Preferring {} (InetAddress.getLocalHost()) for local bind point over previous candidate {}", localhostName, preliminaryResult); return localhostName; } else { // we have to make the preliminary result the final result return preliminaryResult; } }
[ "private", "static", "InetAddress", "tryLocalHostBeforeReturning", "(", "InetAddress", "preliminaryResult", ",", "SocketAddress", "targetAddress", ",", "boolean", "logging", ")", "throws", "IOException", "{", "InetAddress", "localhostName", "=", "InetAddress", ".", "getLo...
This utility method tries to connect to the JobManager using the InetAddress returned by InetAddress.getLocalHost(). The purpose of the utility is to have a final try connecting to the target address using the LocalHost before using the address returned. We do a second try because the JM might have been unavailable during the first check. @param preliminaryResult The address detected by the heuristic @return either the preliminaryResult or the address returned by InetAddress.getLocalHost() (if we are able to connect to targetAddress from there)
[ "This", "utility", "method", "tries", "to", "connect", "to", "the", "JobManager", "using", "the", "InetAddress", "returned", "by", "InetAddress", ".", "getLocalHost", "()", ".", "The", "purpose", "of", "the", "utility", "is", "to", "have", "a", "final", "try...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/ConnectionUtils.java#L187-L206
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryByChaincode
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest) throws InvalidArgumentException, ProposalException { return queryByChaincode(queryByChaincodeRequest, getChaincodeQueryPeers()); }
java
public Collection<ProposalResponse> queryByChaincode(QueryByChaincodeRequest queryByChaincodeRequest) throws InvalidArgumentException, ProposalException { return queryByChaincode(queryByChaincodeRequest, getChaincodeQueryPeers()); }
[ "public", "Collection", "<", "ProposalResponse", ">", "queryByChaincode", "(", "QueryByChaincodeRequest", "queryByChaincodeRequest", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "queryByChaincode", "(", "queryByChaincodeRequest", ",", "g...
Send Query proposal @param queryByChaincodeRequest @return Collection proposal responses. @throws InvalidArgumentException @throws ProposalException
[ "Send", "Query", "proposal" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L4368-L4370
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java
JmsConnectionImpl.initExceptionThreadPool
private static void initExceptionThreadPool() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initExceptionThreadPool"); // Do a synchronous check to ensure once-only creation synchronized (exceptionTPCreateSync) { if (exceptionThreadPool == null) { // Get the maximum size for the thread pool, defaulting if // not specified or if the value cannot be parsed int maxThreads = Integer.parseInt(ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT); String maxThreadsStr = RuntimeInfo.getProperty(ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT, ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT); try { maxThreads = Integer.parseInt(maxThreadsStr); } catch (NumberFormatException e) { // No FFDC code needed, but we will exception this SibTr.exception(tc, e); } // Trace the value we will use if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer.toString(maxThreads)); // Create the thread pool exceptionThreadPool = new ThreadPool(ApiJmsConstants.EXCEPTION_THREADPOOL_NAME_INT, 0, maxThreads); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initExceptionThreadPool"); }
java
private static void initExceptionThreadPool() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "initExceptionThreadPool"); // Do a synchronous check to ensure once-only creation synchronized (exceptionTPCreateSync) { if (exceptionThreadPool == null) { // Get the maximum size for the thread pool, defaulting if // not specified or if the value cannot be parsed int maxThreads = Integer.parseInt(ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT); String maxThreadsStr = RuntimeInfo.getProperty(ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT, ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT); try { maxThreads = Integer.parseInt(maxThreadsStr); } catch (NumberFormatException e) { // No FFDC code needed, but we will exception this SibTr.exception(tc, e); } // Trace the value we will use if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer.toString(maxThreads)); // Create the thread pool exceptionThreadPool = new ThreadPool(ApiJmsConstants.EXCEPTION_THREADPOOL_NAME_INT, 0, maxThreads); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "initExceptionThreadPool"); }
[ "private", "static", "void", "initExceptionThreadPool", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"initExceptionThreadPool\"", ")...
PK59962 Ensure the existence of a single thread pool within the process
[ "PK59962", "Ensure", "the", "existence", "of", "a", "single", "thread", "pool", "within", "the", "process" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsConnectionImpl.java#L1167-L1197
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.openSiteMap
public void openSiteMap(String sitePath, boolean siteChange) { String uri = CmsCoreProvider.get().link( CmsCoreProvider.get().getUri()) + "?" + CmsCoreData.PARAM_PATH + "=" + sitePath; if (!siteChange) { uri += "&" + CmsCoreData.PARAM_RETURNCODE + "=" + getData().getReturnCode(); } Window.Location.replace(uri); }
java
public void openSiteMap(String sitePath, boolean siteChange) { String uri = CmsCoreProvider.get().link( CmsCoreProvider.get().getUri()) + "?" + CmsCoreData.PARAM_PATH + "=" + sitePath; if (!siteChange) { uri += "&" + CmsCoreData.PARAM_RETURNCODE + "=" + getData().getReturnCode(); } Window.Location.replace(uri); }
[ "public", "void", "openSiteMap", "(", "String", "sitePath", ",", "boolean", "siteChange", ")", "{", "String", "uri", "=", "CmsCoreProvider", ".", "get", "(", ")", ".", "link", "(", "CmsCoreProvider", ".", "get", "(", ")", ".", "getUri", "(", ")", ")", ...
Opens the site-map specified.<p> @param sitePath the site path to the site-map folder @param siteChange in case the site was changed
[ "Opens", "the", "site", "-", "map", "specified", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1754-L1762
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/ProxySettings.java
ProxySettings.setServer
public ProxySettings setServer(URI uri) { if (uri == null) { return this; } String scheme = uri.getScheme(); String userInfo = uri.getUserInfo(); String host = uri.getHost(); int port = uri.getPort(); return setServer(scheme, userInfo, host, port); }
java
public ProxySettings setServer(URI uri) { if (uri == null) { return this; } String scheme = uri.getScheme(); String userInfo = uri.getUserInfo(); String host = uri.getHost(); int port = uri.getPort(); return setServer(scheme, userInfo, host, port); }
[ "public", "ProxySettings", "setServer", "(", "URI", "uri", ")", "{", "if", "(", "uri", "==", "null", ")", "{", "return", "this", ";", "}", "String", "scheme", "=", "uri", ".", "getScheme", "(", ")", ";", "String", "userInfo", "=", "uri", ".", "getUse...
Set the proxy server by a URI. The parameters are updated as described below. <blockquote> <dl> <dt>Secure</dt> <dd><p> If the URI contains the scheme part and its value is either {@code "http"} or {@code "https"} (case-insensitive), the {@code secure} parameter is updated to {@code false} or to {@code true} accordingly. In other cases, the parameter is not updated. </p></dd> <dt>ID &amp; Password</dt> <dd><p> If the URI contains the userinfo part and the ID embedded in the userinfo part is not an empty string, the {@code id} parameter and the {@code password} parameter are updated accordingly. In other cases, the parameters are not updated. </p></dd> <dt>Host</dt> <dd><p> The {@code host} parameter is always updated by the given URI. </p></dd> <dt>Port</dt> <dd><p> The {@code port} parameter is always updated by the given URI. </p></dd> </dl> </blockquote> @param uri The URI of the proxy server. If {@code null} is given, none of the parameters is updated. @return {@code this} object.
[ "Set", "the", "proxy", "server", "by", "a", "URI", ".", "The", "parameters", "are", "updated", "as", "described", "below", "." ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ProxySettings.java#L486-L499
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
ConverterRegistry.addConverter
@Override public void addConverter(Class<?> from, Class<?> to, Converter converter) { Map toMap = fromMap.get(from); if (toMap == null) { toMap = new HashMap<Class<?>, Map<Class<?>, Converter>>(); fromMap.put(from, toMap); } toMap.put(to, converter); }
java
@Override public void addConverter(Class<?> from, Class<?> to, Converter converter) { Map toMap = fromMap.get(from); if (toMap == null) { toMap = new HashMap<Class<?>, Map<Class<?>, Converter>>(); fromMap.put(from, toMap); } toMap.put(to, converter); }
[ "@", "Override", "public", "void", "addConverter", "(", "Class", "<", "?", ">", "from", ",", "Class", "<", "?", ">", "to", ",", "Converter", "converter", ")", "{", "Map", "toMap", "=", "fromMap", ".", "get", "(", "from", ")", ";", "if", "(", "toMap...
Converter calls this method to register conversion path. @param from @param to @param converter
[ "Converter", "calls", "this", "method", "to", "register", "conversion", "path", "." ]
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java#L52-L60
gsi-upm/BeastTool
beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java
Reader.createDotStoryFile
public static void createDotStoryFile(String scenarioName, String srcTestRootFolder, String packagePath, String givenDescription, String whenDescription, String thenDescription) throws BeastException { String[] folders = packagePath.split("."); for (String folder : folders) { srcTestRootFolder += "/" + folder; } FileWriter writer = createFileWriter(createDotStoryName(scenarioName), packagePath, srcTestRootFolder); try { writer.write("Scenario: " + scenarioName + "\n"); writer.write("Given " + givenDescription + "\n"); writer.write("When " + whenDescription + "\n"); writer.write("Then " + thenDescription + "\n"); writer.close(); } catch (Exception e) { String message = "Unable to write the .story file for the scenario " + scenarioName; logger.severe(message); logger.severe(e.getMessage()); throw new BeastException(message, e); } }
java
public static void createDotStoryFile(String scenarioName, String srcTestRootFolder, String packagePath, String givenDescription, String whenDescription, String thenDescription) throws BeastException { String[] folders = packagePath.split("."); for (String folder : folders) { srcTestRootFolder += "/" + folder; } FileWriter writer = createFileWriter(createDotStoryName(scenarioName), packagePath, srcTestRootFolder); try { writer.write("Scenario: " + scenarioName + "\n"); writer.write("Given " + givenDescription + "\n"); writer.write("When " + whenDescription + "\n"); writer.write("Then " + thenDescription + "\n"); writer.close(); } catch (Exception e) { String message = "Unable to write the .story file for the scenario " + scenarioName; logger.severe(message); logger.severe(e.getMessage()); throw new BeastException(message, e); } }
[ "public", "static", "void", "createDotStoryFile", "(", "String", "scenarioName", ",", "String", "srcTestRootFolder", ",", "String", "packagePath", ",", "String", "givenDescription", ",", "String", "whenDescription", ",", "String", "thenDescription", ")", "throws", "Be...
Creates the .story file necessary for every Beast Test Case. @param scenarioName - The name of the scenario, with spaces @param srcTestRootFolder - The test root folder @param packagePath - The package of the BeastTestCase @param scenarioDescription - the scenario name @param givenDescription - The given description @param whenDescription - The when description @param thenDescription - The then description @throws BeastException
[ "Creates", "the", ".", "story", "file", "necessary", "for", "every", "Beast", "Test", "Case", "." ]
train
https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L307-L331
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/NettyTransport.java
NettyTransport.getChannelHandlers
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(final MessageInput input) { LinkedHashMap<String, Callable<? extends ChannelHandler>> handlerList = new LinkedHashMap<>(); handlerList.put("exception-logger", () -> new ExceptionLoggingChannelHandler(input, log)); handlerList.put("packet-meta-dumper", () -> new PacketInformationDumper(input)); handlerList.put("output-failure-logger", () -> PromiseFailureHandler.INSTANCE); return handlerList; }
java
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getChannelHandlers(final MessageInput input) { LinkedHashMap<String, Callable<? extends ChannelHandler>> handlerList = new LinkedHashMap<>(); handlerList.put("exception-logger", () -> new ExceptionLoggingChannelHandler(input, log)); handlerList.put("packet-meta-dumper", () -> new PacketInformationDumper(input)); handlerList.put("output-failure-logger", () -> PromiseFailureHandler.INSTANCE); return handlerList; }
[ "protected", "LinkedHashMap", "<", "String", ",", "Callable", "<", "?", "extends", "ChannelHandler", ">", ">", "getChannelHandlers", "(", "final", "MessageInput", "input", ")", "{", "LinkedHashMap", "<", "String", ",", "Callable", "<", "?", "extends", "ChannelHa...
Subclasses can override this to add additional {@link ChannelHandler channel handlers} to the Netty {@link ChannelPipeline} to support additional features. Some common use cases are to add connection counters or traffic shapers. @param input The {@link MessageInput} for which these channel handlers are being added @return list of initial {@link ChannelHandler channel handlers} to add to the Netty {@link ChannelPipeline channel pipeline}
[ "Subclasses", "can", "override", "this", "to", "add", "additional", "{", "@link", "ChannelHandler", "channel", "handlers", "}", "to", "the", "Netty", "{", "@link", "ChannelPipeline", "}", "to", "support", "additional", "features", "." ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/NettyTransport.java#L143-L151
aseovic/coherence-tools
loader/src/main/java/com/seovic/loader/target/JpaTarget.java
JpaTarget.mergeInTransaction
private void mergeInTransaction(EntityManager em, Collection objects) { EntityTransaction tx = null; try { tx = em.getTransaction(); tx.begin(); for (Object o : objects) { em.merge(o); } tx.commit(); } catch (RuntimeException e) { if (tx != null && tx.isActive()) { tx.rollback(); } throw e; } }
java
private void mergeInTransaction(EntityManager em, Collection objects) { EntityTransaction tx = null; try { tx = em.getTransaction(); tx.begin(); for (Object o : objects) { em.merge(o); } tx.commit(); } catch (RuntimeException e) { if (tx != null && tx.isActive()) { tx.rollback(); } throw e; } }
[ "private", "void", "mergeInTransaction", "(", "EntityManager", "em", ",", "Collection", "objects", ")", "{", "EntityTransaction", "tx", "=", "null", ";", "try", "{", "tx", "=", "em", ".", "getTransaction", "(", ")", ";", "tx", ".", "begin", "(", ")", ";"...
Persist collection of objects. @param em entity manager used to persist objects @param objects objects to persist
[ "Persist", "collection", "of", "objects", "." ]
train
https://github.com/aseovic/coherence-tools/blob/561a1d7e572ad98657fcd26beb1164891b0cd6fe/loader/src/main/java/com/seovic/loader/target/JpaTarget.java#L98-L114
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setSecretAsync
public ServiceFuture<SecretBundle> setSecretAsync(String vaultBaseUrl, String secretName, String value, final ServiceCallback<SecretBundle> serviceCallback) { return ServiceFuture.fromResponse(setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value), serviceCallback); }
java
public ServiceFuture<SecretBundle> setSecretAsync(String vaultBaseUrl, String secretName, String value, final ServiceCallback<SecretBundle> serviceCallback) { return ServiceFuture.fromResponse(setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value), serviceCallback); }
[ "public", "ServiceFuture", "<", "SecretBundle", ">", "setSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "value", ",", "final", "ServiceCallback", "<", "SecretBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFutur...
Sets a secret in a specified key vault. The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param value The value of the secret. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Sets", "a", "secret", "in", "a", "specified", "key", "vault", ".", "The", "SET", "operation", "adds", "a", "secret", "to", "the", "Azure", "Key", "Vault", ".", "If", "the", "named", "secret", "already", "exists", "Azure", "Key", "Vault", "creates", "a",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3337-L3339
alkacon/opencms-core
src/org/opencms/xml/templatemapper/CmsTemplateMapper.java
CmsTemplateMapper.transformDetailElement
public CmsContainerElementBean transformDetailElement( CmsObject cms, CmsContainerElementBean input, String rootPath) { CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } return transformContainerElement(cms, config, input); }
java
public CmsContainerElementBean transformDetailElement( CmsObject cms, CmsContainerElementBean input, String rootPath) { CmsTemplateMapperConfiguration config = getConfiguration(cms); if ((config == null) || !config.isEnabledForPath(rootPath)) { return input; } return transformContainerElement(cms, config, input); }
[ "public", "CmsContainerElementBean", "transformDetailElement", "(", "CmsObject", "cms", ",", "CmsContainerElementBean", "input", ",", "String", "rootPath", ")", "{", "CmsTemplateMapperConfiguration", "config", "=", "getConfiguration", "(", "cms", ")", ";", "if", "(", ...
Transforms a container element bean used for detail elements.<p> @param cms the current CMS context @param input the bean to be transformed @param rootPath the root path of the page @return the transformed bean
[ "Transforms", "a", "container", "element", "bean", "used", "for", "detail", "elements", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L205-L216
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cart_cartId_item_itemId_requiredConfiguration_GET
public ArrayList<OvhConfigurationRequirements> cart_cartId_item_itemId_requiredConfiguration_GET(String cartId, Long itemId) throws IOException { String qPath = "/order/cart/{cartId}/item/{itemId}/requiredConfiguration"; StringBuilder sb = path(qPath, cartId, itemId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
java
public ArrayList<OvhConfigurationRequirements> cart_cartId_item_itemId_requiredConfiguration_GET(String cartId, Long itemId) throws IOException { String qPath = "/order/cart/{cartId}/item/{itemId}/requiredConfiguration"; StringBuilder sb = path(qPath, cartId, itemId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t6); }
[ "public", "ArrayList", "<", "OvhConfigurationRequirements", ">", "cart_cartId_item_itemId_requiredConfiguration_GET", "(", "String", "cartId", ",", "Long", "itemId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cart/{cartId}/item/{itemId}/requiredConfigu...
Retrieve all required configuration item of the cart item REST: GET /order/cart/{cartId}/item/{itemId}/requiredConfiguration @param cartId [required] Cart identifier @param itemId [required] Product item identifier
[ "Retrieve", "all", "required", "configuration", "item", "of", "the", "cart", "item" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8116-L8121
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.cancelThrow
private static RuntimeException cancelThrow(ClientCall<?, ?> call, Throwable t) { try { call.cancel(null, t); } catch (Throwable e) { assert e instanceof RuntimeException || e instanceof Error; logger.log(Level.SEVERE, "RuntimeException encountered while closing call", e); } if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } // should be impossible throw new AssertionError(t); }
java
private static RuntimeException cancelThrow(ClientCall<?, ?> call, Throwable t) { try { call.cancel(null, t); } catch (Throwable e) { assert e instanceof RuntimeException || e instanceof Error; logger.log(Level.SEVERE, "RuntimeException encountered while closing call", e); } if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } // should be impossible throw new AssertionError(t); }
[ "private", "static", "RuntimeException", "cancelThrow", "(", "ClientCall", "<", "?", ",", "?", ">", "call", ",", "Throwable", "t", ")", "{", "try", "{", "call", ".", "cancel", "(", "null", ",", "t", ")", ";", "}", "catch", "(", "Throwable", "e", ")",...
Cancels a call, and throws the exception. @param t must be a RuntimeException or Error
[ "Cancels", "a", "call", "and", "throws", "the", "exception", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L247-L261
foundation-runtime/monitoring
monitoring-jmx-lib/src/main/java/com/cisco/oss/foundation/monitoring/RMIRegistryManager.java
RMIRegistryManager.startRMIRegistry
public static boolean startRMIRegistry(Configuration configuration, int port) { if (isRMIRegistryRunning(configuration, port)) return true; if (configuration.getBoolean(FoundationMonitoringConstants.IN_PROC_RMI)) { return startInProcRMIRegistry(port); } else { return startOutProcRMIRegistry(configuration, port); } }
java
public static boolean startRMIRegistry(Configuration configuration, int port) { if (isRMIRegistryRunning(configuration, port)) return true; if (configuration.getBoolean(FoundationMonitoringConstants.IN_PROC_RMI)) { return startInProcRMIRegistry(port); } else { return startOutProcRMIRegistry(configuration, port); } }
[ "public", "static", "boolean", "startRMIRegistry", "(", "Configuration", "configuration", ",", "int", "port", ")", "{", "if", "(", "isRMIRegistryRunning", "(", "configuration", ",", "port", ")", ")", "return", "true", ";", "if", "(", "configuration", ".", "get...
Starts rmiregistry on the specified port. If property "service.monitor.inProcess" is set to true in configSchema.xml, then an in-process rmiregistry is started. Otherwise rmiregistry will be started in a seperate process. @param port on which the rmiregistry needs to be started @return true if successful or it is already started, false otherwise
[ "Starts", "rmiregistry", "on", "the", "specified", "port", ".", "If", "property", "service", ".", "monitor", ".", "inProcess", "is", "set", "to", "true", "in", "configSchema", ".", "xml", "then", "an", "in", "-", "process", "rmiregistry", "is", "started", ...
train
https://github.com/foundation-runtime/monitoring/blob/a85ec72dc5558f787704fb13d9125a5803403ee5/monitoring-jmx-lib/src/main/java/com/cisco/oss/foundation/monitoring/RMIRegistryManager.java#L94-L103
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ProcedureExtensions.java
ProcedureExtensions.curry
@Pure public static <P1> Procedure0 curry(final Procedure1<? super P1> procedure, final P1 argument) { if (procedure == null) throw new NullPointerException("procedure"); return new Procedure0() { @Override public void apply() { procedure.apply(argument); } }; }
java
@Pure public static <P1> Procedure0 curry(final Procedure1<? super P1> procedure, final P1 argument) { if (procedure == null) throw new NullPointerException("procedure"); return new Procedure0() { @Override public void apply() { procedure.apply(argument); } }; }
[ "@", "Pure", "public", "static", "<", "P1", ">", "Procedure0", "curry", "(", "final", "Procedure1", "<", "?", "super", "P1", ">", "procedure", ",", "final", "P1", "argument", ")", "{", "if", "(", "procedure", "==", "null", ")", "throw", "new", "NullPoi...
Curries a procedure that takes one argument. @param procedure the original procedure. May not be <code>null</code>. @param argument the fixed argument. @return a procedure that takes no arguments. Never <code>null</code>.
[ "Curries", "a", "procedure", "that", "takes", "one", "argument", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ProcedureExtensions.java#L37-L47
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearch.java
CmsGallerySearch.searchByPath
public static CmsGallerySearchResult searchByPath(CmsObject cms, String rootPath, Locale locale) throws CmsException { CmsGallerySearch gallerySearch = new CmsGallerySearch(); gallerySearch.init(cms); gallerySearch.setIndexForProject(cms); return gallerySearch.searchByPath(rootPath, locale); }
java
public static CmsGallerySearchResult searchByPath(CmsObject cms, String rootPath, Locale locale) throws CmsException { CmsGallerySearch gallerySearch = new CmsGallerySearch(); gallerySearch.init(cms); gallerySearch.setIndexForProject(cms); return gallerySearch.searchByPath(rootPath, locale); }
[ "public", "static", "CmsGallerySearchResult", "searchByPath", "(", "CmsObject", "cms", ",", "String", "rootPath", ",", "Locale", "locale", ")", "throws", "CmsException", "{", "CmsGallerySearch", "gallerySearch", "=", "new", "CmsGallerySearch", "(", ")", ";", "galler...
Searches by structure id.<p> @param cms the OpenCms context to use for the search @param rootPath the resource root path @param locale the locale for which the search result should be returned @return the search result @throws CmsException if something goes wrong
[ "Searches", "by", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearch.java#L92-L99
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java
HystrixTimer.addTimerListener
public Reference<TimerListener> addTimerListener(final TimerListener listener) { startThreadIfNeeded(); // add the listener Runnable r = new Runnable() { @Override public void run() { try { listener.tick(); } catch (Exception e) { logger.error("Failed while ticking TimerListener", e); } } }; ScheduledFuture<?> f = executor.get().getThreadPool().scheduleAtFixedRate(r, listener.getIntervalTimeInMilliseconds(), listener.getIntervalTimeInMilliseconds(), TimeUnit.MILLISECONDS); return new TimerReference(listener, f); }
java
public Reference<TimerListener> addTimerListener(final TimerListener listener) { startThreadIfNeeded(); // add the listener Runnable r = new Runnable() { @Override public void run() { try { listener.tick(); } catch (Exception e) { logger.error("Failed while ticking TimerListener", e); } } }; ScheduledFuture<?> f = executor.get().getThreadPool().scheduleAtFixedRate(r, listener.getIntervalTimeInMilliseconds(), listener.getIntervalTimeInMilliseconds(), TimeUnit.MILLISECONDS); return new TimerReference(listener, f); }
[ "public", "Reference", "<", "TimerListener", ">", "addTimerListener", "(", "final", "TimerListener", "listener", ")", "{", "startThreadIfNeeded", "(", ")", ";", "// add the listener", "Runnable", "r", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "publ...
Add a {@link TimerListener} that will be executed until it is garbage collected or removed by clearing the returned {@link Reference}. <p> NOTE: It is the responsibility of code that adds a listener via this method to clear this listener when completed. <p> <blockquote> <pre> {@code // add a TimerListener Reference<TimerListener> listener = HystrixTimer.getInstance().addTimerListener(listenerImpl); // sometime later, often in a thread shutdown, request cleanup, servlet filter or something similar the listener must be shutdown via the clear() method listener.clear(); }</pre> </blockquote> @param listener TimerListener implementation that will be triggered according to its <code>getIntervalTimeInMilliseconds()</code> method implementation. @return reference to the TimerListener that allows cleanup via the <code>clear()</code> method
[ "Add", "a", "{", "@link", "TimerListener", "}", "that", "will", "be", "executed", "until", "it", "is", "garbage", "collected", "or", "removed", "by", "clearing", "the", "returned", "{", "@link", "Reference", "}", ".", "<p", ">", "NOTE", ":", "It", "is", ...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/util/HystrixTimer.java#L90-L108
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.addTransitionPath
private void addTransitionPath(MDAGNode originNode, String str) { if (!str.isEmpty()) { MDAGNode currentNode = originNode; int charCount = str.length(); //Loop through the characters in str, iteratevely adding // a _transition path corresponding to it from originNode for (int i = 0; i < charCount; i++, transitionCount++) { char currentChar = str.charAt(i); boolean isLastChar = (i == charCount - 1); currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar); charTreeSet.add(currentChar); } ///// } else originNode.setAcceptStateStatus(true); }
java
private void addTransitionPath(MDAGNode originNode, String str) { if (!str.isEmpty()) { MDAGNode currentNode = originNode; int charCount = str.length(); //Loop through the characters in str, iteratevely adding // a _transition path corresponding to it from originNode for (int i = 0; i < charCount; i++, transitionCount++) { char currentChar = str.charAt(i); boolean isLastChar = (i == charCount - 1); currentNode = currentNode.addOutgoingTransition(currentChar, isLastChar); charTreeSet.add(currentChar); } ///// } else originNode.setAcceptStateStatus(true); }
[ "private", "void", "addTransitionPath", "(", "MDAGNode", "originNode", ",", "String", "str", ")", "{", "if", "(", "!", "str", ".", "isEmpty", "(", ")", ")", "{", "MDAGNode", "currentNode", "=", "originNode", ";", "int", "charCount", "=", "str", ".", "len...
给节点添加一个转移路径<br> Adds a _transition path starting from a specific node in the MDAG. @param originNode the MDAGNode which will serve as the start point of the to-be-created _transition path @param str the String to be used to create a new _transition path from {@code originNode}
[ "给节点添加一个转移路径<br", ">", "Adds", "a", "_transition", "path", "starting", "from", "a", "specific", "node", "in", "the", "MDAG", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L574-L595
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/UpdateCommand.java
UpdateCommand.sendUpdateMessage
public static boolean sendUpdateMessage(String site2, String repo, String branch, String revision, String comment, String token) throws Exception { return sendUpdateMessage(site2, repo, branch, revision, comment, token, UPDATE_ENDPOINT); }
java
public static boolean sendUpdateMessage(String site2, String repo, String branch, String revision, String comment, String token) throws Exception { return sendUpdateMessage(site2, repo, branch, revision, comment, token, UPDATE_ENDPOINT); }
[ "public", "static", "boolean", "sendUpdateMessage", "(", "String", "site2", ",", "String", "repo", ",", "String", "branch", ",", "String", "revision", ",", "String", "comment", ",", "String", "token", ")", "throws", "Exception", "{", "return", "sendUpdateMessage...
Sends a update message to a Cadmium site. This method will block until the update is complete. @param site2 The uri to a Cadmium site. @param repo The git repository to tell the site to change to. @param branch The branch to switch to. @param revision The revision to reset to. @param comment The message to record with this event in the history on the Cadmium site. @param token The Github API token to authenticate with. @return true if successfull or false otherwise. @throws Exception
[ "Sends", "a", "update", "message", "to", "a", "Cadmium", "site", ".", "This", "method", "will", "block", "until", "the", "update", "is", "complete", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/UpdateCommand.java#L166-L168
census-instrumentation/opencensus-java
contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpClientHandler.java
HttpClientHandler.handleStart
public HttpRequestContext handleStart(@Nullable Span parent, C carrier, Q request) { checkNotNull(carrier, "carrier"); checkNotNull(request, "request"); if (parent == null) { parent = tracer.getCurrentSpan(); } String spanName = getSpanName(request, extractor); SpanBuilder builder = tracer.spanBuilderWithExplicitParent(spanName, parent); Span span = builder.setSpanKind(Kind.CLIENT).startSpan(); if (span.getOptions().contains(Options.RECORD_EVENTS)) { addSpanRequestAttributes(span, request, extractor); } // inject propagation header SpanContext spanContext = span.getContext(); if (!spanContext.equals(SpanContext.INVALID)) { textFormat.inject(spanContext, carrier, setter); } return getNewContext(span, tagger.getCurrentTagContext()); }
java
public HttpRequestContext handleStart(@Nullable Span parent, C carrier, Q request) { checkNotNull(carrier, "carrier"); checkNotNull(request, "request"); if (parent == null) { parent = tracer.getCurrentSpan(); } String spanName = getSpanName(request, extractor); SpanBuilder builder = tracer.spanBuilderWithExplicitParent(spanName, parent); Span span = builder.setSpanKind(Kind.CLIENT).startSpan(); if (span.getOptions().contains(Options.RECORD_EVENTS)) { addSpanRequestAttributes(span, request, extractor); } // inject propagation header SpanContext spanContext = span.getContext(); if (!spanContext.equals(SpanContext.INVALID)) { textFormat.inject(spanContext, carrier, setter); } return getNewContext(span, tagger.getCurrentTagContext()); }
[ "public", "HttpRequestContext", "handleStart", "(", "@", "Nullable", "Span", "parent", ",", "C", "carrier", ",", "Q", "request", ")", "{", "checkNotNull", "(", "carrier", ",", "\"carrier\"", ")", ";", "checkNotNull", "(", "request", ",", "\"request\"", ")", ...
Instrument a request for tracing and stats before it is sent. <p>This method will create a span in current context to represent the HTTP call. The created span will be serialized and propagated to the server. <p>The generated span will NOT be set as current context. User can control when to enter the scope of this span. Use {@link AbstractHttpHandler#getSpanFromContext} to retrieve the span. @param parent the parent {@link Span}. {@code null} indicates using current span. @param carrier the entity that holds the HTTP information. @param request the request entity. @return the {@link HttpRequestContext} that contains stats and trace data associated with the request. @since 0.19
[ "Instrument", "a", "request", "for", "tracing", "and", "stats", "before", "it", "is", "sent", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/http_util/src/main/java/io/opencensus/contrib/http/HttpClientHandler.java#L109-L129
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.pushToRepository
public Iterable<PushResult> pushToRepository(Git git, String remote, String passphrase, Path privateKey) { SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { session.setUserInfo(new PassphraseUserInfo(passphrase)); } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (privateKey != null) { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey.toFile().getAbsolutePath()); return defaultJSch; } else { return super.createDefaultJSch(fs); } } }; try { return git.push() .setRemote(remote) .setPushAll() .setPushTags() .setTransportConfigCallback(transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public Iterable<PushResult> pushToRepository(Git git, String remote, String passphrase, Path privateKey) { SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() { @Override protected void configure(OpenSshConfig.Host host, Session session) { session.setUserInfo(new PassphraseUserInfo(passphrase)); } @Override protected JSch createDefaultJSch(FS fs) throws JSchException { if (privateKey != null) { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(privateKey.toFile().getAbsolutePath()); return defaultJSch; } else { return super.createDefaultJSch(fs); } } }; try { return git.push() .setRemote(remote) .setPushAll() .setPushTags() .setTransportConfigCallback(transport -> { SshTransport sshTransport = (SshTransport) transport; sshTransport.setSshSessionFactory(sshSessionFactory); }) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "Iterable", "<", "PushResult", ">", "pushToRepository", "(", "Git", "git", ",", "String", "remote", ",", "String", "passphrase", ",", "Path", "privateKey", ")", "{", "SshSessionFactory", "sshSessionFactory", "=", "new", "JschConfigSessionFactory", "(", "...
Push all changes and tags to given remote. @param git instance. @param remote to be used. @param passphrase to access private key. @param privateKey file location. @return List of all results of given push.
[ "Push", "all", "changes", "and", "tags", "to", "given", "remote", "." ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L353-L385
WiQuery/wiquery
wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java
Options.putLong
public Options putLong(String key, IModel<Long> value) { putOption(key, new LongOption(value)); return this; }
java
public Options putLong(String key, IModel<Long> value) { putOption(key, new LongOption(value)); return this; }
[ "public", "Options", "putLong", "(", "String", "key", ",", "IModel", "<", "Long", ">", "value", ")", "{", "putOption", "(", "key", ",", "new", "LongOption", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
<p> Puts a {@link Long} value for the given option name. </p> @param key the option name. @param value the {@link Long} value.
[ "<p", ">", "Puts", "a", "{", "@link", "Long", "}", "value", "for", "the", "given", "option", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L596-L600
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestClient.java
RestClient.createWebTarget
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) { WebTarget webTarget; try { URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath); Client client = createRestClient(); webTarget = client.target(u); if (queryParams != null && !queryParams.isEmpty()) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue()); webTarget = webTarget.queryParam(entry.getKey(), entry.getValue()); } } } } catch (Exception e) { throw new IllegalArgumentException("Something went wrong by creating the client: " + e); } return webTarget; }
java
private WebTarget createWebTarget(String restPath, Map<String, String> queryParams) { WebTarget webTarget; try { URI u = new URI(this.baseURI + "/plugins/restapi/v1/" + restPath); Client client = createRestClient(); webTarget = client.target(u); if (queryParams != null && !queryParams.isEmpty()) { for (Map.Entry<String, String> entry : queryParams.entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { LOG.debug("PARAM: {} = {}", entry.getKey(), entry.getValue()); webTarget = webTarget.queryParam(entry.getKey(), entry.getValue()); } } } } catch (Exception e) { throw new IllegalArgumentException("Something went wrong by creating the client: " + e); } return webTarget; }
[ "private", "WebTarget", "createWebTarget", "(", "String", "restPath", ",", "Map", "<", "String", ",", "String", ">", "queryParams", ")", "{", "WebTarget", "webTarget", ";", "try", "{", "URI", "u", "=", "new", "URI", "(", "this", ".", "baseURI", "+", "\"/...
Creates the web target. @param restPath the rest path @param queryParams the query params @return the web target
[ "Creates", "the", "web", "target", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestClient.java#L207-L228
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitIndex
@Override public R visitIndex(IndexTree node, P p) { R r = scan(node.getSearchTerm(), p); r = scanAndReduce(node.getDescription(), p, r); return r; }
java
@Override public R visitIndex(IndexTree node, P p) { R r = scan(node.getSearchTerm(), p); r = scanAndReduce(node.getDescription(), p, r); return r; }
[ "@", "Override", "public", "R", "visitIndex", "(", "IndexTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getSearchTerm", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getDescription", ...
{@inheritDoc} This implementation returns {@code null}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L268-L273
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java
ST_GeometryShadow.createShadowPolygons
private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) { for (int i = 1; i < coordinates.length; i++) { Coordinate startCoord = coordinates[i - 1]; Coordinate endCoord = coordinates[i]; Coordinate nextEnd = moveCoordinate(endCoord, shadow); Coordinate nextStart = moveCoordinate(startCoord, shadow); Polygon polygon = factory.createPolygon(new Coordinate[]{startCoord, endCoord, nextEnd, nextStart, startCoord}); if (polygon.isValid()) { shadows.add(polygon); } } }
java
private static void createShadowPolygons(Collection<Polygon> shadows, Coordinate[] coordinates, double[] shadow, GeometryFactory factory) { for (int i = 1; i < coordinates.length; i++) { Coordinate startCoord = coordinates[i - 1]; Coordinate endCoord = coordinates[i]; Coordinate nextEnd = moveCoordinate(endCoord, shadow); Coordinate nextStart = moveCoordinate(startCoord, shadow); Polygon polygon = factory.createPolygon(new Coordinate[]{startCoord, endCoord, nextEnd, nextStart, startCoord}); if (polygon.isValid()) { shadows.add(polygon); } } }
[ "private", "static", "void", "createShadowPolygons", "(", "Collection", "<", "Polygon", ">", "shadows", ",", "Coordinate", "[", "]", "coordinates", ",", "double", "[", "]", "shadow", ",", "GeometryFactory", "factory", ")", "{", "for", "(", "int", "i", "=", ...
Create and collect shadow polygons. @param shadows @param coordinates @param shadow @param factory
[ "Create", "and", "collect", "shadow", "polygons", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_GeometryShadow.java#L235-L248
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java
ParentsArray.getChildrenOf
public static IntArrayList getChildrenOf(int[] parents, int parent) { IntArrayList children = new IntArrayList(); for (int i=0; i<parents.length; i++) { if (parents[i] == parent) { children.add(i); } } return children; }
java
public static IntArrayList getChildrenOf(int[] parents, int parent) { IntArrayList children = new IntArrayList(); for (int i=0; i<parents.length; i++) { if (parents[i] == parent) { children.add(i); } } return children; }
[ "public", "static", "IntArrayList", "getChildrenOf", "(", "int", "[", "]", "parents", ",", "int", "parent", ")", "{", "IntArrayList", "children", "=", "new", "IntArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parents", "."...
Gets the children of the specified parent. @param parents A parents array. @param parent The parent for which the children should be extracted. @return The indices of the children.
[ "Gets", "the", "children", "of", "the", "specified", "parent", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ParentsArray.java#L200-L208
facebook/fresco
samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java
DefaultZoomableController.mapImageToView
public PointF mapImageToView(PointF imagePoint) { float[] points = mTempValues; points[0] = imagePoint.x; points[1] = imagePoint.y; mapRelativeToAbsolute(points, points, 1); mActiveTransform.mapPoints(points, 0, points, 0, 1); return new PointF(points[0], points[1]); }
java
public PointF mapImageToView(PointF imagePoint) { float[] points = mTempValues; points[0] = imagePoint.x; points[1] = imagePoint.y; mapRelativeToAbsolute(points, points, 1); mActiveTransform.mapPoints(points, 0, points, 0, 1); return new PointF(points[0], points[1]); }
[ "public", "PointF", "mapImageToView", "(", "PointF", "imagePoint", ")", "{", "float", "[", "]", "points", "=", "mTempValues", ";", "points", "[", "0", "]", "=", "imagePoint", ".", "x", ";", "points", "[", "1", "]", "=", "imagePoint", ".", "y", ";", "...
Maps point from image-relative to view-absolute coordinates. This takes into account the zoomable transformation.
[ "Maps", "point", "from", "image", "-", "relative", "to", "view", "-", "absolute", "coordinates", ".", "This", "takes", "into", "account", "the", "zoomable", "transformation", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L298-L305