repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
VoltDB/voltdb | src/frontend/org/voltcore/logging/VoltLogger.java | VoltLogger.configure | public static void configure(String xmlConfig, File voltroot) {
try {
Class<?> loggerClz = Class.forName("org.voltcore.logging.VoltLog4jLogger");
assert(loggerClz != null);
Method configureMethod = loggerClz.getMethod("configure", String.class, File.class);
configureMethod.invoke(null, xmlConfig, voltroot);
} catch (Exception e) {}
} | java | public static void configure(String xmlConfig, File voltroot) {
try {
Class<?> loggerClz = Class.forName("org.voltcore.logging.VoltLog4jLogger");
assert(loggerClz != null);
Method configureMethod = loggerClz.getMethod("configure", String.class, File.class);
configureMethod.invoke(null, xmlConfig, voltroot);
} catch (Exception e) {}
} | [
"public",
"static",
"void",
"configure",
"(",
"String",
"xmlConfig",
",",
"File",
"voltroot",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"loggerClz",
"=",
"Class",
".",
"forName",
"(",
"\"org.voltcore.logging.VoltLog4jLogger\"",
")",
";",
"assert",
"(",
"... | Static method to change the Log4j config globally. This fails
if you're not using Log4j for now.
@param xmlConfig The text of a Log4j config file.
@param voltroot The VoltDB root path | [
"Static",
"method",
"to",
"change",
"the",
"Log4j",
"config",
"globally",
".",
"This",
"fails",
"if",
"you",
"re",
"not",
"using",
"Log4j",
"for",
"now",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/logging/VoltLogger.java#L360-L367 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.feed_publishStoryToUser | public boolean feed_publishStoryToUser(CharSequence title, CharSequence body)
throws FacebookException, IOException {
return feed_publishStoryToUser(title, body, null, null);
} | java | public boolean feed_publishStoryToUser(CharSequence title, CharSequence body)
throws FacebookException, IOException {
return feed_publishStoryToUser(title, body, null, null);
} | [
"public",
"boolean",
"feed_publishStoryToUser",
"(",
"CharSequence",
"title",
",",
"CharSequence",
"body",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"return",
"feed_publishStoryToUser",
"(",
"title",
",",
"body",
",",
"null",
",",
"null",
")",
"... | Publish a story to the logged-in user's newsfeed.
@param title the title of the feed story
@param body the body of the feed story
@return whether the story was successfully published; false in case of permission error
@see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser">
Developers Wiki: Feed.publishStoryToUser</a> | [
"Publish",
"a",
"story",
"to",
"the",
"logged",
"-",
"in",
"user",
"s",
"newsfeed",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L321-L324 |
GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/CredentialFactory.java | CredentialFactory.getCredentialFromFileCredentialStoreForInstalledApp | public Credential getCredentialFromFileCredentialStoreForInstalledApp(
String clientId,
String clientSecret,
String filePath,
List<String> scopes,
HttpTransport transport)
throws IOException, GeneralSecurityException {
logger.atFine().log(
"getCredentialFromFileCredentialStoreForInstalledApp(%s, %s, %s, %s)",
clientId, clientSecret, filePath, scopes);
checkArgument(!isNullOrEmpty(clientId), "clientId must not be null or empty");
checkArgument(!isNullOrEmpty(clientSecret), "clientSecret must not be null or empty");
checkArgument(!isNullOrEmpty(filePath), "filePath must not be null or empty");
checkNotNull(scopes, "scopes must not be null");
// Initialize client secrets.
GoogleClientSecrets.Details details =
new GoogleClientSecrets.Details().setClientId(clientId).setClientSecret(clientSecret);
GoogleClientSecrets clientSecrets = new GoogleClientSecrets().setInstalled(details);
// Set up file credential store.
FileCredentialStore credentialStore = new FileCredentialStore(new File(filePath), JSON_FACTORY);
// Set up authorization code flow.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(transport, JSON_FACTORY, clientSecrets, scopes)
.setCredentialStore(credentialStore)
.setRequestInitializer(new CredentialHttpRetryInitializer())
.setTokenServerUrl(new GenericUrl(TOKEN_SERVER_URL))
.build();
// Authorize access.
return new AuthorizationCodeInstalledApp(flow, new GooglePromptReceiver()).authorize("user");
} | java | public Credential getCredentialFromFileCredentialStoreForInstalledApp(
String clientId,
String clientSecret,
String filePath,
List<String> scopes,
HttpTransport transport)
throws IOException, GeneralSecurityException {
logger.atFine().log(
"getCredentialFromFileCredentialStoreForInstalledApp(%s, %s, %s, %s)",
clientId, clientSecret, filePath, scopes);
checkArgument(!isNullOrEmpty(clientId), "clientId must not be null or empty");
checkArgument(!isNullOrEmpty(clientSecret), "clientSecret must not be null or empty");
checkArgument(!isNullOrEmpty(filePath), "filePath must not be null or empty");
checkNotNull(scopes, "scopes must not be null");
// Initialize client secrets.
GoogleClientSecrets.Details details =
new GoogleClientSecrets.Details().setClientId(clientId).setClientSecret(clientSecret);
GoogleClientSecrets clientSecrets = new GoogleClientSecrets().setInstalled(details);
// Set up file credential store.
FileCredentialStore credentialStore = new FileCredentialStore(new File(filePath), JSON_FACTORY);
// Set up authorization code flow.
GoogleAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow.Builder(transport, JSON_FACTORY, clientSecrets, scopes)
.setCredentialStore(credentialStore)
.setRequestInitializer(new CredentialHttpRetryInitializer())
.setTokenServerUrl(new GenericUrl(TOKEN_SERVER_URL))
.build();
// Authorize access.
return new AuthorizationCodeInstalledApp(flow, new GooglePromptReceiver()).authorize("user");
} | [
"public",
"Credential",
"getCredentialFromFileCredentialStoreForInstalledApp",
"(",
"String",
"clientId",
",",
"String",
"clientSecret",
",",
"String",
"filePath",
",",
"List",
"<",
"String",
">",
"scopes",
",",
"HttpTransport",
"transport",
")",
"throws",
"IOException"... | Initialized OAuth2 credential for the "installed application" flow; where the credential
typically represents an actual end user (instead of a service account), and is stored as a
refresh token in a local FileCredentialStore.
@param clientId OAuth2 client ID identifying the 'installed app'
@param clientSecret OAuth2 client secret
@param filePath full path to a ".json" file for storing the credential
@param scopes list of well-formed scopes desired in the credential
@param transport The HttpTransport used for authorization
@return credential with desired scopes, possibly obtained from loading {@code filePath}.
@throws IOException on IO error | [
"Initialized",
"OAuth2",
"credential",
"for",
"the",
"installed",
"application",
"flow",
";",
"where",
"the",
"credential",
"typically",
"represents",
"an",
"actual",
"end",
"user",
"(",
"instead",
"of",
"a",
"service",
"account",
")",
"and",
"is",
"stored",
"... | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/CredentialFactory.java#L325-L358 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/session/RaftSession.java | RaftSession.registerResult | public void registerResult(long sequence, OperationResult result) {
setRequestSequence(sequence);
results.put(sequence, result);
} | java | public void registerResult(long sequence, OperationResult result) {
setRequestSequence(sequence);
results.put(sequence, result);
} | [
"public",
"void",
"registerResult",
"(",
"long",
"sequence",
",",
"OperationResult",
"result",
")",
"{",
"setRequestSequence",
"(",
"sequence",
")",
";",
"results",
".",
"put",
"(",
"sequence",
",",
"result",
")",
";",
"}"
] | Registers a session result.
<p>
Results are stored in memory on all servers in order to provide linearizable semantics. When a command
is applied to the state machine, the command's return value is stored with the sequence number. Once the
client acknowledges receipt of the command output the result will be cleared from memory.
@param sequence The result sequence number.
@param result The result. | [
"Registers",
"a",
"session",
"result",
".",
"<p",
">",
"Results",
"are",
"stored",
"in",
"memory",
"on",
"all",
"servers",
"in",
"order",
"to",
"provide",
"linearizable",
"semantics",
".",
"When",
"a",
"command",
"is",
"applied",
"to",
"the",
"state",
"mac... | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/RaftSession.java#L383-L386 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | RandomUtil.randomDouble | public static double randomDouble(int scale, RoundingMode roundingMode) {
return NumberUtil.round(randomDouble(), scale, roundingMode).doubleValue();
} | java | public static double randomDouble(int scale, RoundingMode roundingMode) {
return NumberUtil.round(randomDouble(), scale, roundingMode).doubleValue();
} | [
"public",
"static",
"double",
"randomDouble",
"(",
"int",
"scale",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"NumberUtil",
".",
"round",
"(",
"randomDouble",
"(",
")",
",",
"scale",
",",
"roundingMode",
")",
".",
"doubleValue",
"(",
")",
";",
... | 获得指定范围内的随机数
@param scale 保留小数位数
@param roundingMode 保留小数的模式 {@link RoundingMode}
@return 随机数
@since 4.0.8 | [
"获得指定范围内的随机数"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L182-L184 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java | XMLContentHandler.startElementMixin | private void startElementMixin(final Attributes attributes) {
LOG.debug("Found mixin declaration");
try {
this.addMixin(this.nodeStack.peek(), attributes);
} catch (final RepositoryException e) {
throw new AssertionError("Could not add mixin type", e);
}
} | java | private void startElementMixin(final Attributes attributes) {
LOG.debug("Found mixin declaration");
try {
this.addMixin(this.nodeStack.peek(), attributes);
} catch (final RepositoryException e) {
throw new AssertionError("Could not add mixin type", e);
}
} | [
"private",
"void",
"startElementMixin",
"(",
"final",
"Attributes",
"attributes",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Found mixin declaration\"",
")",
";",
"try",
"{",
"this",
".",
"addMixin",
"(",
"this",
".",
"nodeStack",
".",
"peek",
"(",
")",
",",
"... | Invoked on mixin element.
@param attributes
the DOM attributes of the mixin element
@throws SAXException
if the mixin type can not be added | [
"Invoked",
"on",
"mixin",
"element",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L373-L381 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/webapp/UIComponentClassicTagBase.java | UIComponentClassicTagBase.addFacetNameToParentTag | private void addFacetNameToParentTag(UIComponentClassicTagBase parentTag, String facetName)
{
if (parentTag._facetsAdded == null)
{
parentTag._facetsAdded = new ArrayList<String>();
}
parentTag._facetsAdded.add(facetName);
} | java | private void addFacetNameToParentTag(UIComponentClassicTagBase parentTag, String facetName)
{
if (parentTag._facetsAdded == null)
{
parentTag._facetsAdded = new ArrayList<String>();
}
parentTag._facetsAdded.add(facetName);
} | [
"private",
"void",
"addFacetNameToParentTag",
"(",
"UIComponentClassicTagBase",
"parentTag",
",",
"String",
"facetName",
")",
"{",
"if",
"(",
"parentTag",
".",
"_facetsAdded",
"==",
"null",
")",
"{",
"parentTag",
".",
"_facetsAdded",
"=",
"new",
"ArrayList",
"<",
... | Notify the enclosing JSP tag of the id of this facet's id. The parent tag will later delete any existing view
facets that were not seen during this rendering phase; see doEndTag for details. | [
"Notify",
"the",
"enclosing",
"JSP",
"tag",
"of",
"the",
"id",
"of",
"this",
"facet",
"s",
"id",
".",
"The",
"parent",
"tag",
"will",
"later",
"delete",
"any",
"existing",
"view",
"facets",
"that",
"were",
"not",
"seen",
"during",
"this",
"rendering",
"p... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/webapp/UIComponentClassicTagBase.java#L1392-L1399 |
gresrun/jesque | src/main/java/net/greghaines/jesque/utils/PoolUtils.java | PoolUtils.doWorkInPool | public static <V> V doWorkInPool(final Pool<Jedis> pool, final PoolWork<Jedis, V> work) throws Exception {
if (pool == null) {
throw new IllegalArgumentException("pool must not be null");
}
if (work == null) {
throw new IllegalArgumentException("work must not be null");
}
final V result;
final Jedis poolResource = pool.getResource();
try {
result = work.doWork(poolResource);
} finally {
poolResource.close();
}
return result;
} | java | public static <V> V doWorkInPool(final Pool<Jedis> pool, final PoolWork<Jedis, V> work) throws Exception {
if (pool == null) {
throw new IllegalArgumentException("pool must not be null");
}
if (work == null) {
throw new IllegalArgumentException("work must not be null");
}
final V result;
final Jedis poolResource = pool.getResource();
try {
result = work.doWork(poolResource);
} finally {
poolResource.close();
}
return result;
} | [
"public",
"static",
"<",
"V",
">",
"V",
"doWorkInPool",
"(",
"final",
"Pool",
"<",
"Jedis",
">",
"pool",
",",
"final",
"PoolWork",
"<",
"Jedis",
",",
"V",
">",
"work",
")",
"throws",
"Exception",
"{",
"if",
"(",
"pool",
"==",
"null",
")",
"{",
"thr... | Perform the given work with a Jedis connection from the given pool.
@param pool the resource pool
@param work the work to perform
@param <V> the result type
@return the result of the given work
@throws Exception if something went wrong | [
"Perform",
"the",
"given",
"work",
"with",
"a",
"Jedis",
"connection",
"from",
"the",
"given",
"pool",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/PoolUtils.java#L42-L57 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/crypto/GlibcCryptPasswordEncoder.java | GlibcCryptPasswordEncoder.matches | @Override
public boolean matches(final CharSequence rawPassword, final String encodedPassword) {
if (StringUtils.isBlank(encodedPassword)) {
LOGGER.warn("The encoded password provided for matching is null. Returning false");
return false;
}
var providedSalt = StringUtils.EMPTY;
val lastDollarIndex = encodedPassword.lastIndexOf('$');
if (lastDollarIndex == -1) {
providedSalt = encodedPassword.substring(0, 2);
LOGGER.debug("Assuming DES UnixCrypt as no delimiter could be found in the encoded password provided");
} else {
providedSalt = encodedPassword.substring(0, lastDollarIndex);
LOGGER.debug("Encoded password uses algorithm [{}]", providedSalt.charAt(1));
}
var encodedRawPassword = Crypt.crypt(rawPassword.toString(), providedSalt);
var matched = StringUtils.equals(encodedRawPassword, encodedPassword);
LOGGER.debug("Provided password does {}match the encoded password", BooleanUtils.toString(matched, StringUtils.EMPTY, "not "));
return matched;
} | java | @Override
public boolean matches(final CharSequence rawPassword, final String encodedPassword) {
if (StringUtils.isBlank(encodedPassword)) {
LOGGER.warn("The encoded password provided for matching is null. Returning false");
return false;
}
var providedSalt = StringUtils.EMPTY;
val lastDollarIndex = encodedPassword.lastIndexOf('$');
if (lastDollarIndex == -1) {
providedSalt = encodedPassword.substring(0, 2);
LOGGER.debug("Assuming DES UnixCrypt as no delimiter could be found in the encoded password provided");
} else {
providedSalt = encodedPassword.substring(0, lastDollarIndex);
LOGGER.debug("Encoded password uses algorithm [{}]", providedSalt.charAt(1));
}
var encodedRawPassword = Crypt.crypt(rawPassword.toString(), providedSalt);
var matched = StringUtils.equals(encodedRawPassword, encodedPassword);
LOGGER.debug("Provided password does {}match the encoded password", BooleanUtils.toString(matched, StringUtils.EMPTY, "not "));
return matched;
} | [
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"final",
"CharSequence",
"rawPassword",
",",
"final",
"String",
"encodedPassword",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"encodedPassword",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\... | Special note on DES UnixCrypt:
In DES UnixCrypt, so first two characters of the encoded password are the salt.
<p>
When you change your password, the {@code /bin/passwd} program selects a salt based on the time of day.
The salt is converted into a two-character string and is stored in the {@code /etc/passwd} file along with the
encrypted {@code "password."[10]} In this manner, when you type your password at login time, the same salt is used again.
UNIX stores the salt as the first two characters of the encrypted password.
@param rawPassword the raw password as it was provided
@param encodedPassword the encoded password.
@return true/false | [
"Special",
"note",
"on",
"DES",
"UnixCrypt",
":",
"In",
"DES",
"UnixCrypt",
"so",
"first",
"two",
"characters",
"of",
"the",
"encoded",
"password",
"are",
"the",
"salt",
".",
"<p",
">",
"When",
"you",
"change",
"your",
"password",
"the",
"{",
"@code",
"/... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/crypto/GlibcCryptPasswordEncoder.java#L56-L75 |
Netflix/spectator | spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java | HttpLogEntry.logServerRequest | @Deprecated
public static void logServerRequest(Logger logger, HttpLogEntry entry) {
log(logger, SERVER, entry);
} | java | @Deprecated
public static void logServerRequest(Logger logger, HttpLogEntry entry) {
log(logger, SERVER, entry);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"logServerRequest",
"(",
"Logger",
"logger",
",",
"HttpLogEntry",
"entry",
")",
"{",
"log",
"(",
"logger",
",",
"SERVER",
",",
"entry",
")",
";",
"}"
] | Log a request received by a server.
@deprecated Use {@link #logServerRequest(HttpLogEntry)} instead. | [
"Log",
"a",
"request",
"received",
"by",
"a",
"server",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/HttpLogEntry.java#L125-L128 |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java | NumberSelectorServiceImpl.searchNumberWithResult | @Override
public NumberSelectionResult searchNumberWithResult(String phone,
Sid sourceOrganizationSid, Sid destinationOrganizationSid){
return searchNumberWithResult(phone, sourceOrganizationSid, destinationOrganizationSid, new HashSet<>(Arrays.asList(SearchModifier.ORG_COMPLIANT)));
} | java | @Override
public NumberSelectionResult searchNumberWithResult(String phone,
Sid sourceOrganizationSid, Sid destinationOrganizationSid){
return searchNumberWithResult(phone, sourceOrganizationSid, destinationOrganizationSid, new HashSet<>(Arrays.asList(SearchModifier.ORG_COMPLIANT)));
} | [
"@",
"Override",
"public",
"NumberSelectionResult",
"searchNumberWithResult",
"(",
"String",
"phone",
",",
"Sid",
"sourceOrganizationSid",
",",
"Sid",
"destinationOrganizationSid",
")",
"{",
"return",
"searchNumberWithResult",
"(",
"phone",
",",
"sourceOrganizationSid",
"... | The main logic is: -Find a perfect match in DB using different formats.
-If not matched, use available Regexes in the organization. -If not
matched, try with the special * match.
@param phone
@param sourceOrganizationSid
@param destinationOrganizationSid
@return | [
"The",
"main",
"logic",
"is",
":",
"-",
"Find",
"a",
"perfect",
"match",
"in",
"DB",
"using",
"different",
"formats",
".",
"-",
"If",
"not",
"matched",
"use",
"available",
"Regexes",
"in",
"the",
"organization",
".",
"-",
"If",
"not",
"matched",
"try",
... | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java#L260-L264 |
xvik/dropwizard-guicey | src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java | ConfigurationContext.registerDisablePredicates | @SuppressWarnings("PMD.UseVarargs")
public void registerDisablePredicates(final Predicate<ItemInfo>[] predicates) {
final List<PredicateHandler> list = Arrays.stream(predicates)
.map(p -> new PredicateHandler(p, getScope()))
.collect(Collectors.toList());
disablePredicates.addAll(list);
applyPredicatesForRegisteredItems(list);
} | java | @SuppressWarnings("PMD.UseVarargs")
public void registerDisablePredicates(final Predicate<ItemInfo>[] predicates) {
final List<PredicateHandler> list = Arrays.stream(predicates)
.map(p -> new PredicateHandler(p, getScope()))
.collect(Collectors.toList());
disablePredicates.addAll(list);
applyPredicatesForRegisteredItems(list);
} | [
"@",
"SuppressWarnings",
"(",
"\"PMD.UseVarargs\"",
")",
"public",
"void",
"registerDisablePredicates",
"(",
"final",
"Predicate",
"<",
"ItemInfo",
">",
"[",
"]",
"predicates",
")",
"{",
"final",
"List",
"<",
"PredicateHandler",
">",
"list",
"=",
"Arrays",
".",
... | Register disable predicates, used to disable all matched items.
<p>
After registration predicates are applied to all currently registered items to avoid registration
order influence.
@param predicates disable predicates | [
"Register",
"disable",
"predicates",
"used",
"to",
"disable",
"all",
"matched",
"items",
".",
"<p",
">",
"After",
"registration",
"predicates",
"are",
"applied",
"to",
"all",
"currently",
"registered",
"items",
"to",
"avoid",
"registration",
"order",
"influence",
... | train | https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L474-L481 |
infinispan/infinispan | core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java | InternalCacheRegistryImpl.registerInternalCache | @Override
public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
// check if it already has been defined. Currently we don't support existing user-defined configuration.
if ((flags.contains(Flag.EXCLUSIVE) || !internalCaches.containsKey(name)) && configPresent) {
throw log.existingConfigForInternalCache(name);
}
// Don't redefine
if (configPresent) {
return;
}
ConfigurationBuilder builder = new ConfigurationBuilder().read(configuration);
builder.jmxStatistics().disable(); // Internal caches must not be included in stats counts
GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration();
if (flags.contains(Flag.GLOBAL) && globalConfiguration.isClustered()) {
// TODO: choose a merge policy
builder.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(true);
}
if (flags.contains(Flag.PERSISTENT) && globalConfiguration.globalState().enabled()) {
builder.persistence().addSingleFileStore().location(globalConfiguration.globalState().persistentLocation()).purgeOnStartup(false).preload(true).fetchPersistentState(true);
}
SecurityActions.defineConfiguration(cacheManager, name, builder.build());
internalCaches.put(name, flags);
if (!flags.contains(Flag.USER)) {
privateCaches.add(name);
}
} | java | @Override
public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
// check if it already has been defined. Currently we don't support existing user-defined configuration.
if ((flags.contains(Flag.EXCLUSIVE) || !internalCaches.containsKey(name)) && configPresent) {
throw log.existingConfigForInternalCache(name);
}
// Don't redefine
if (configPresent) {
return;
}
ConfigurationBuilder builder = new ConfigurationBuilder().read(configuration);
builder.jmxStatistics().disable(); // Internal caches must not be included in stats counts
GlobalConfiguration globalConfiguration = cacheManager.getCacheManagerConfiguration();
if (flags.contains(Flag.GLOBAL) && globalConfiguration.isClustered()) {
// TODO: choose a merge policy
builder.clustering()
.cacheMode(CacheMode.REPL_SYNC)
.stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(true);
}
if (flags.contains(Flag.PERSISTENT) && globalConfiguration.globalState().enabled()) {
builder.persistence().addSingleFileStore().location(globalConfiguration.globalState().persistentLocation()).purgeOnStartup(false).preload(true).fetchPersistentState(true);
}
SecurityActions.defineConfiguration(cacheManager, name, builder.build());
internalCaches.put(name, flags);
if (!flags.contains(Flag.USER)) {
privateCaches.add(name);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"registerInternalCache",
"(",
"String",
"name",
",",
"Configuration",
"configuration",
",",
"EnumSet",
"<",
"Flag",
">",
"flags",
")",
"{",
"boolean",
"configPresent",
"=",
"cacheManager",
".",
"getCacheConfiguratio... | Synchronized to prevent users from registering the same configuration at the same time | [
"Synchronized",
"to",
"prevent",
"users",
"from",
"registering",
"the",
"same",
"configuration",
"at",
"the",
"same",
"time"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/registry/impl/InternalCacheRegistryImpl.java#L40-L68 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java | MetadataGenerationEnvironment.getFieldDefaultValue | public Object getFieldDefaultValue(TypeElement type, String name) {
return this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
.get(name);
} | java | public Object getFieldDefaultValue(TypeElement type, String name) {
return this.defaultValues.computeIfAbsent(type, this::resolveFieldValues)
.get(name);
} | [
"public",
"Object",
"getFieldDefaultValue",
"(",
"TypeElement",
"type",
",",
"String",
"name",
")",
"{",
"return",
"this",
".",
"defaultValues",
".",
"computeIfAbsent",
"(",
"type",
",",
"this",
"::",
"resolveFieldValues",
")",
".",
"get",
"(",
"name",
")",
... | Return the default value of the field with the specified {@code name}.
@param type the type to consider
@param name the name of the field
@return the default value or {@code null} if the field does not exist or no default
value has been detected | [
"Return",
"the",
"default",
"value",
"of",
"the",
"field",
"with",
"the",
"specified",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/MetadataGenerationEnvironment.java#L136-L139 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java | AbstractCodeGen.writeLeftCurlyBracket | void writeLeftCurlyBracket(Writer out, int indent) throws IOException
{
writeEol(out);
writeWithIndent(out, indent, "{\n");
} | java | void writeLeftCurlyBracket(Writer out, int indent) throws IOException
{
writeEol(out);
writeWithIndent(out, indent, "{\n");
} | [
"void",
"writeLeftCurlyBracket",
"(",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeEol",
"(",
"out",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"{\\n\"",
")",
";",
"}"
] | Output left curly bracket
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"left",
"curly",
"bracket"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L189-L193 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/server/JavacServer.java | JavacServer.connectGetSysInfo | public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
SysInfo sysinfo = new SysInfo(-1, -1);
String id = Util.extractStringOption("id", serverSettings);
String portfile = Util.extractStringOption("portfile", serverSettings);
try {
PortFile pf = getPortFile(portfile);
useServer(serverSettings, new String[0],
new HashSet<URI>(),
new HashSet<URI>(),
new HashMap<URI, Set<String>>(),
new HashMap<String, Set<URI>>(),
new HashMap<String, Set<String>>(),
new HashMap<String, String>(),
sysinfo, out, err);
} catch (Exception e) {
e.printStackTrace(err);
}
return sysinfo;
} | java | public static SysInfo connectGetSysInfo(String serverSettings, PrintStream out, PrintStream err) {
SysInfo sysinfo = new SysInfo(-1, -1);
String id = Util.extractStringOption("id", serverSettings);
String portfile = Util.extractStringOption("portfile", serverSettings);
try {
PortFile pf = getPortFile(portfile);
useServer(serverSettings, new String[0],
new HashSet<URI>(),
new HashSet<URI>(),
new HashMap<URI, Set<String>>(),
new HashMap<String, Set<URI>>(),
new HashMap<String, Set<String>>(),
new HashMap<String, String>(),
sysinfo, out, err);
} catch (Exception e) {
e.printStackTrace(err);
}
return sysinfo;
} | [
"public",
"static",
"SysInfo",
"connectGetSysInfo",
"(",
"String",
"serverSettings",
",",
"PrintStream",
"out",
",",
"PrintStream",
"err",
")",
"{",
"SysInfo",
"sysinfo",
"=",
"new",
"SysInfo",
"(",
"-",
"1",
",",
"-",
"1",
")",
";",
"String",
"id",
"=",
... | Make a request to the server only to get the maximum possible heap size to use for compilations.
@param port_file The port file used to synchronize creation of this server.
@param id The identify of the compilation.
@param out Standard out information.
@param err Standard err information.
@return The maximum heap size in bytes. | [
"Make",
"a",
"request",
"to",
"the",
"server",
"only",
"to",
"get",
"the",
"maximum",
"possible",
"heap",
"size",
"to",
"use",
"for",
"compilations",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/server/JavacServer.java#L432-L450 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELProcessor.java | ELProcessor.getValue | public Object getValue(String expression, Class<?> expectedType) {
ValueExpression exp = factory.createValueExpression(
elManager.getELContext(),
bracket(expression), expectedType);
return exp.getValue(elManager.getELContext());
} | java | public Object getValue(String expression, Class<?> expectedType) {
ValueExpression exp = factory.createValueExpression(
elManager.getELContext(),
bracket(expression), expectedType);
return exp.getValue(elManager.getELContext());
} | [
"public",
"Object",
"getValue",
"(",
"String",
"expression",
",",
"Class",
"<",
"?",
">",
"expectedType",
")",
"{",
"ValueExpression",
"exp",
"=",
"factory",
".",
"createValueExpression",
"(",
"elManager",
".",
"getELContext",
"(",
")",
",",
"bracket",
"(",
... | Evaluates an EL expression, and coerces the result to the specified type.
@param expression The EL expression to be evaluated.
@param expectedType Specifies the type that the resultant evaluation
will be coerced to.
@return The result of the expression evaluation. | [
"Evaluates",
"an",
"EL",
"expression",
"and",
"coerces",
"the",
"result",
"to",
"the",
"specified",
"type",
"."
] | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELProcessor.java#L125-L130 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java | Metrics.gaugeMapSize | @Nullable
public static <T extends Map<?, ?>> T gaugeMapSize(String name, Iterable<Tag> tags, T map) {
return globalRegistry.gaugeMapSize(name, tags, map);
} | java | @Nullable
public static <T extends Map<?, ?>> T gaugeMapSize(String name, Iterable<Tag> tags, T map) {
return globalRegistry.gaugeMapSize(name, tags, map);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
"extends",
"Map",
"<",
"?",
",",
"?",
">",
">",
"T",
"gaugeMapSize",
"(",
"String",
"name",
",",
"Iterable",
"<",
"Tag",
">",
"tags",
",",
"T",
"map",
")",
"{",
"return",
"globalRegistry",
".",
"gaugeMap... | Register a gauge that reports the size of the {@link java.util.Map}. The registration
will keep a weak reference to the collection so it will not prevent garbage collection.
The collection implementation used should be thread safe. Note that calling
{@link java.util.Map#size()} can be expensive for some collection implementations
and should be considered before registering.
@param name Name of the gauge being registered.
@param tags Sequence of dimensions for breaking down the name.
@param map Thread-safe implementation of {@link Map} used to access the value.
@param <T> The type of the state object from which the gauge value is extracted.
@return The number that was passed in so the registration can be done as part of an assignment
statement. | [
"Register",
"a",
"gauge",
"that",
"reports",
"the",
"size",
"of",
"the",
"{",
"@link",
"java",
".",
"util",
".",
"Map",
"}",
".",
"The",
"registration",
"will",
"keep",
"a",
"weak",
"reference",
"to",
"the",
"collection",
"so",
"it",
"will",
"not",
"pr... | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/Metrics.java#L233-L236 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java | PhoneNumberUtil.formatDin5008National | public final String formatDin5008National(final String pphoneNumber, final String pcountryCode) {
return this.formatDin5008National(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | java | public final String formatDin5008National(final String pphoneNumber, final String pcountryCode) {
return this.formatDin5008National(this.parsePhoneNumber(pphoneNumber, pcountryCode));
} | [
"public",
"final",
"String",
"formatDin5008National",
"(",
"final",
"String",
"pphoneNumber",
",",
"final",
"String",
"pcountryCode",
")",
"{",
"return",
"this",
".",
"formatDin5008National",
"(",
"this",
".",
"parsePhoneNumber",
"(",
"pphoneNumber",
",",
"pcountryC... | format phone number in DIN 5008 national format.
@param pphoneNumber phone number to format
@param pcountryCode iso code of country
@return formated phone number as String | [
"format",
"phone",
"number",
"in",
"DIN",
"5008",
"national",
"format",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java#L951-L953 |
zaproxy/zaproxy | src/org/zaproxy/zap/session/CookieBasedSessionManagementHelper.java | CookieBasedSessionManagementHelper.processMessageToMatchSession | public static void processMessageToMatchSession(HttpMessage message, HttpSession session) {
processMessageToMatchSession(message, message.getRequestHeader().getHttpCookies(), session);
} | java | public static void processMessageToMatchSession(HttpMessage message, HttpSession session) {
processMessageToMatchSession(message, message.getRequestHeader().getHttpCookies(), session);
} | [
"public",
"static",
"void",
"processMessageToMatchSession",
"(",
"HttpMessage",
"message",
",",
"HttpSession",
"session",
")",
"{",
"processMessageToMatchSession",
"(",
"message",
",",
"message",
".",
"getRequestHeader",
"(",
")",
".",
"getHttpCookies",
"(",
")",
",... | Modifies a message so its Request Header/Body matches the web session provided.
@param message the message
@param session the session | [
"Modifies",
"a",
"message",
"so",
"its",
"Request",
"Header",
"/",
"Body",
"matches",
"the",
"web",
"session",
"provided",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/session/CookieBasedSessionManagementHelper.java#L48-L50 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java | ObjectTypeNode.createMemory | public ObjectTypeNodeMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
Class<?> classType = ((ClassObjectType) getObjectType()).getClassType();
if (InitialFact.class.isAssignableFrom(classType)) {
return new InitialFactObjectTypeNodeMemory(classType);
}
return new ObjectTypeNodeMemory(classType, wm);
} | java | public ObjectTypeNodeMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
Class<?> classType = ((ClassObjectType) getObjectType()).getClassType();
if (InitialFact.class.isAssignableFrom(classType)) {
return new InitialFactObjectTypeNodeMemory(classType);
}
return new ObjectTypeNodeMemory(classType, wm);
} | [
"public",
"ObjectTypeNodeMemory",
"createMemory",
"(",
"final",
"RuleBaseConfiguration",
"config",
",",
"InternalWorkingMemory",
"wm",
")",
"{",
"Class",
"<",
"?",
">",
"classType",
"=",
"(",
"(",
"ClassObjectType",
")",
"getObjectType",
"(",
")",
")",
".",
"get... | Creates memory for the node using PrimitiveLongMap as its optimised for storage and reteivals of Longs.
However PrimitiveLongMap is not ideal for spase data. So it should be monitored incase its more optimal
to switch back to a standard HashMap. | [
"Creates",
"memory",
"for",
"the",
"node",
"using",
"PrimitiveLongMap",
"as",
"its",
"optimised",
"for",
"storage",
"and",
"reteivals",
"of",
"Longs",
".",
"However",
"PrimitiveLongMap",
"is",
"not",
"ideal",
"for",
"spase",
"data",
".",
"So",
"it",
"should",
... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java#L524-L530 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/ResponseAttachmentInputStreamSupport.java | ResponseAttachmentInputStreamSupport.gc | void gc() {
if (stopped) {
return;
}
long expirationTime = System.currentTimeMillis() - timeout;
for (Iterator<Map.Entry<InputStreamKey, TimedStreamEntry>> iter = streamMap.entrySet().iterator(); iter.hasNext();) {
if (stopped) {
return;
}
Map.Entry<InputStreamKey, TimedStreamEntry> entry = iter.next();
TimedStreamEntry timedStreamEntry = entry.getValue();
if (timedStreamEntry.timestamp.get() <= expirationTime) {
iter.remove();
InputStreamKey key = entry.getKey();
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (timedStreamEntry) { // ensure there's no race with a request that got a ref before we removed it
closeStreamEntry(timedStreamEntry, key.requestId, key.index);
}
}
}
} | java | void gc() {
if (stopped) {
return;
}
long expirationTime = System.currentTimeMillis() - timeout;
for (Iterator<Map.Entry<InputStreamKey, TimedStreamEntry>> iter = streamMap.entrySet().iterator(); iter.hasNext();) {
if (stopped) {
return;
}
Map.Entry<InputStreamKey, TimedStreamEntry> entry = iter.next();
TimedStreamEntry timedStreamEntry = entry.getValue();
if (timedStreamEntry.timestamp.get() <= expirationTime) {
iter.remove();
InputStreamKey key = entry.getKey();
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (timedStreamEntry) { // ensure there's no race with a request that got a ref before we removed it
closeStreamEntry(timedStreamEntry, key.requestId, key.index);
}
}
}
} | [
"void",
"gc",
"(",
")",
"{",
"if",
"(",
"stopped",
")",
"{",
"return",
";",
"}",
"long",
"expirationTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"timeout",
";",
"for",
"(",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"InputStreamKey",
... | Close and remove expired streams. Package protected to allow unit tests to invoke it. | [
"Close",
"and",
"remove",
"expired",
"streams",
".",
"Package",
"protected",
"to",
"allow",
"unit",
"tests",
"to",
"invoke",
"it",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/ResponseAttachmentInputStreamSupport.java#L203-L223 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailAccountManager.java | MailAccountManager.reserveMailAccount | public MailAccount reserveMailAccount(final String accountReservationKey, final String pool) {
if (pool == null && emailAddressPools.keySet().size() > 1) {
throw new IllegalStateException("No pool specified but multiple pools available.");
}
String poolKey = pool == null ? defaultPool : pool;
List<MailAccount> addressPool = newArrayList(emailAddressPools.get(poolKey));
Collections.shuffle(addressPool, random.getRandom());
return reserveAvailableMailAccount(accountReservationKey, addressPool);
} | java | public MailAccount reserveMailAccount(final String accountReservationKey, final String pool) {
if (pool == null && emailAddressPools.keySet().size() > 1) {
throw new IllegalStateException("No pool specified but multiple pools available.");
}
String poolKey = pool == null ? defaultPool : pool;
List<MailAccount> addressPool = newArrayList(emailAddressPools.get(poolKey));
Collections.shuffle(addressPool, random.getRandom());
return reserveAvailableMailAccount(accountReservationKey, addressPool);
} | [
"public",
"MailAccount",
"reserveMailAccount",
"(",
"final",
"String",
"accountReservationKey",
",",
"final",
"String",
"pool",
")",
"{",
"if",
"(",
"pool",
"==",
"null",
"&&",
"emailAddressPools",
".",
"keySet",
"(",
")",
".",
"size",
"(",
")",
">",
"1",
... | Reserves an available mail account from the specified pool under the specified reservation
key. The method blocks until an account is available.
@param pool
the mail address pool to reserve an account from
@param accountReservationKey
the key under which to reserve the account
@return the reserved mail account | [
"Reserves",
"an",
"available",
"mail",
"account",
"from",
"the",
"specified",
"pool",
"under",
"the",
"specified",
"reservation",
"key",
".",
"The",
"method",
"blocks",
"until",
"an",
"account",
"is",
"available",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailAccountManager.java#L177-L187 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java | PhotosApi.setSafetyLevel | public Response setSafetyLevel(String photoId, JinxConstants.SafetyLevel safetyLevel, boolean hidden) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setSafetyLevel");
params.put("photo_id", photoId);
if (safetyLevel != null) {
params.put("safety_level", Integer.toString(JinxUtils.safetyLevelToFlickrSafteyLevelId(safetyLevel)));
}
params.put("hidden", hidden ? "1" : "0");
return jinx.flickrPost(params, Response.class);
} | java | public Response setSafetyLevel(String photoId, JinxConstants.SafetyLevel safetyLevel, boolean hidden) throws JinxException {
JinxUtils.validateParams(photoId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setSafetyLevel");
params.put("photo_id", photoId);
if (safetyLevel != null) {
params.put("safety_level", Integer.toString(JinxUtils.safetyLevelToFlickrSafteyLevelId(safetyLevel)));
}
params.put("hidden", hidden ? "1" : "0");
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"setSafetyLevel",
"(",
"String",
"photoId",
",",
"JinxConstants",
".",
"SafetyLevel",
"safetyLevel",
",",
"boolean",
"hidden",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
")",
";",
"Map",
"<",
"S... | Set the safety level of a photo.
<br>
This method requires authentication with 'write' permission.
@param photoId Required. The id of the photo to set the adultness of.
@param safetyLevel Optional. Safely level of the photo.
@param hidden Whether or not to additionally hide the photo from public searches.
@return object with the result of the requested operation.
@throws JinxException if required parameters are null or empty, or if there are errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.setSafetyLevel.html">flickr.photos.setSafetyLevel</a> | [
"Set",
"the",
"safety",
"level",
"of",
"a",
"photo",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L1000-L1010 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfPatternPainter.java | PdfPatternPainter.setPatternMatrix | public void setPatternMatrix(float a, float b, float c, float d, float e, float f) {
setMatrix(a, b, c, d, e, f);
} | java | public void setPatternMatrix(float a, float b, float c, float d, float e, float f) {
setMatrix(a, b, c, d, e, f);
} | [
"public",
"void",
"setPatternMatrix",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
",",
"float",
"d",
",",
"float",
"e",
",",
"float",
"f",
")",
"{",
"setMatrix",
"(",
"a",
",",
"b",
",",
"c",
",",
"d",
",",
"e",
",",
"f",
")",
";... | Sets the transformation matrix for the pattern.
@param a
@param b
@param c
@param d
@param e
@param f | [
"Sets",
"the",
"transformation",
"matrix",
"for",
"the",
"pattern",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPatternPainter.java#L147-L149 |
undertow-io/undertow | core/src/main/java/io/undertow/util/FileUtils.java | FileUtils.readFile | public static String readFile(InputStream file) {
try (BufferedInputStream stream = new BufferedInputStream(file)) {
byte[] buff = new byte[1024];
StringBuilder builder = new StringBuilder();
int read;
while ((read = stream.read(buff)) != -1) {
builder.append(new String(buff, 0, read, StandardCharsets.UTF_8));
}
return builder.toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static String readFile(InputStream file) {
try (BufferedInputStream stream = new BufferedInputStream(file)) {
byte[] buff = new byte[1024];
StringBuilder builder = new StringBuilder();
int read;
while ((read = stream.read(buff)) != -1) {
builder.append(new String(buff, 0, read, StandardCharsets.UTF_8));
}
return builder.toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"readFile",
"(",
"InputStream",
"file",
")",
"{",
"try",
"(",
"BufferedInputStream",
"stream",
"=",
"new",
"BufferedInputStream",
"(",
"file",
")",
")",
"{",
"byte",
"[",
"]",
"buff",
"=",
"new",
"byte",
"[",
"1024",
"]",
";... | Reads the {@link InputStream file} and converting it to {@link String} using UTF-8 encoding. | [
"Reads",
"the",
"{"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FileUtils.java#L57-L69 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java | TimeZoneNames.getDisplayName | public final String getDisplayName(String tzID, NameType type, long date) {
String name = getTimeZoneDisplayName(tzID, type);
if (name == null) {
String mzID = getMetaZoneID(tzID, date);
name = getMetaZoneDisplayName(mzID, type);
}
return name;
} | java | public final String getDisplayName(String tzID, NameType type, long date) {
String name = getTimeZoneDisplayName(tzID, type);
if (name == null) {
String mzID = getMetaZoneID(tzID, date);
name = getMetaZoneDisplayName(mzID, type);
}
return name;
} | [
"public",
"final",
"String",
"getDisplayName",
"(",
"String",
"tzID",
",",
"NameType",
"type",
",",
"long",
"date",
")",
"{",
"String",
"name",
"=",
"getTimeZoneDisplayName",
"(",
"tzID",
",",
"type",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
... | Returns the display name of the time zone at the given date.
<p>
<b>Note:</b> This method calls the subclass's {@link #getTimeZoneDisplayName(String, NameType)} first. When the
result is null, this method calls {@link #getMetaZoneID(String, long)} to get the meta zone ID mapped from the
time zone, then calls {@link #getMetaZoneDisplayName(String, NameType)}.
@param tzID
The canonical time zone ID.
@param type
The display name type. See {@link TimeZoneNames.NameType}.
@param date
The date
@return The display name for the time zone at the given date. When this object does not have a localized display
name for the time zone with the specified type and date, null is returned. | [
"Returns",
"the",
"display",
"name",
"of",
"the",
"time",
"zone",
"at",
"the",
"given",
"date",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneNames.java#L262-L269 |
sdl/Testy | src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java | WebLocatorAbstractBuilder.setTemplate | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setTemplate(final String key, final String value) {
pathBuilder.setTemplate(key, value);
return (T) this;
} | java | @SuppressWarnings("unchecked")
public <T extends WebLocatorAbstractBuilder> T setTemplate(final String key, final String value) {
pathBuilder.setTemplate(key, value);
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"WebLocatorAbstractBuilder",
">",
"T",
"setTemplate",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"pathBuilder",
".",
"setTemplate",
"(",
"key",
",... | For customize template please see here: See http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#dpos
@param key name template
@param value template
@param <T> the element which calls this method
@return this element | [
"For",
"customize",
"template",
"please",
"see",
"here",
":",
"See",
"http",
":",
"//",
"docs",
".",
"oracle",
".",
"com",
"/",
"javase",
"/",
"7",
"/",
"docs",
"/",
"api",
"/",
"java",
"/",
"util",
"/",
"Formatter",
".",
"html#dpos"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/web/WebLocatorAbstractBuilder.java#L324-L328 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java | DecisionTableImpl.satisfies | private boolean satisfies(EvaluationContext ctx, Object param, UnaryTest test ) {
return test.apply( ctx, param );
} | java | private boolean satisfies(EvaluationContext ctx, Object param, UnaryTest test ) {
return test.apply( ctx, param );
} | [
"private",
"boolean",
"satisfies",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"param",
",",
"UnaryTest",
"test",
")",
"{",
"return",
"test",
".",
"apply",
"(",
"ctx",
",",
"param",
")",
";",
"}"
] | Checks that a given parameter matches a single cell test
@param ctx
@param param
@param test
@return | [
"Checks",
"that",
"a",
"given",
"parameter",
"matches",
"a",
"single",
"cell",
"test"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/decisiontables/DecisionTableImpl.java#L289-L291 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java | MiniSatStyleSolver.varBumpActivity | protected void varBumpActivity(int v, double inc) {
final MSVariable var = this.vars.get(v);
var.incrementActivity(inc);
if (var.activity() > 1e100) {
for (final MSVariable variable : this.vars)
variable.rescaleActivity();
this.varInc *= 1e-100;
}
if (this.orderHeap.inHeap(v))
this.orderHeap.decrease(v);
} | java | protected void varBumpActivity(int v, double inc) {
final MSVariable var = this.vars.get(v);
var.incrementActivity(inc);
if (var.activity() > 1e100) {
for (final MSVariable variable : this.vars)
variable.rescaleActivity();
this.varInc *= 1e-100;
}
if (this.orderHeap.inHeap(v))
this.orderHeap.decrease(v);
} | [
"protected",
"void",
"varBumpActivity",
"(",
"int",
"v",
",",
"double",
"inc",
")",
"{",
"final",
"MSVariable",
"var",
"=",
"this",
".",
"vars",
".",
"get",
"(",
"v",
")",
";",
"var",
".",
"incrementActivity",
"(",
"inc",
")",
";",
"if",
"(",
"var",
... | Bumps the activity of the variable at a given index by a given value.
@param v the variable index
@param inc the increment value | [
"Bumps",
"the",
"activity",
"of",
"the",
"variable",
"at",
"a",
"given",
"index",
"by",
"a",
"given",
"value",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/MiniSatStyleSolver.java#L482-L492 |
rhiot/rhiot | gateway/components/camel-gpsd/src/main/java/io/rhiot/component/gpsd/GpsdHelper.java | GpsdHelper.consumeTPVObject | public static void consumeTPVObject(TPVObject tpv, Processor processor, GpsdEndpoint endpoint, ExceptionHandler exceptionHandler) {
// Simplify logging when https://github.com/taimos/GPSd4Java/pull/19 is merged into upstream.
LOG.debug("About to consume TPV object {},{} from {}", tpv.getLatitude(), tpv.getLongitude(), endpoint);
Validate.notNull(tpv);
Validate.notNull(processor);
Validate.notNull(endpoint);
GpsCoordinates coordinates = gpsCoordinates(new Date(new Double(tpv.getTimestamp()).longValue()), tpv.getLatitude(), tpv.getLongitude());
Exchange exchange = anExchange(endpoint.getCamelContext()).withPattern(OutOnly).
withHeader(TPV_HEADER, tpv).withBody(coordinates).build();
try {
processor.process(exchange);
} catch (Exception e) {
exceptionHandler.handleException(e);
}
} | java | public static void consumeTPVObject(TPVObject tpv, Processor processor, GpsdEndpoint endpoint, ExceptionHandler exceptionHandler) {
// Simplify logging when https://github.com/taimos/GPSd4Java/pull/19 is merged into upstream.
LOG.debug("About to consume TPV object {},{} from {}", tpv.getLatitude(), tpv.getLongitude(), endpoint);
Validate.notNull(tpv);
Validate.notNull(processor);
Validate.notNull(endpoint);
GpsCoordinates coordinates = gpsCoordinates(new Date(new Double(tpv.getTimestamp()).longValue()), tpv.getLatitude(), tpv.getLongitude());
Exchange exchange = anExchange(endpoint.getCamelContext()).withPattern(OutOnly).
withHeader(TPV_HEADER, tpv).withBody(coordinates).build();
try {
processor.process(exchange);
} catch (Exception e) {
exceptionHandler.handleException(e);
}
} | [
"public",
"static",
"void",
"consumeTPVObject",
"(",
"TPVObject",
"tpv",
",",
"Processor",
"processor",
",",
"GpsdEndpoint",
"endpoint",
",",
"ExceptionHandler",
"exceptionHandler",
")",
"{",
"// Simplify logging when https://github.com/taimos/GPSd4Java/pull/19 is merged into ups... | Process the TPVObject, all params required.
@param tpv The time-position-velocity object to process
@param processor Processor that handles the exchange.
@param endpoint GpsdEndpoint receiving the exchange. | [
"Process",
"the",
"TPVObject",
"all",
"params",
"required",
"."
] | train | https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-gpsd/src/main/java/io/rhiot/component/gpsd/GpsdHelper.java#L49-L66 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.similarityToLabel | public double similarityToLabel(LabelledDocument document, String label) {
if (document.getReferencedContent() != null) {
return similarityToLabel(document.getReferencedContent(), label);
} else
return similarityToLabel(document.getContent(), label);
} | java | public double similarityToLabel(LabelledDocument document, String label) {
if (document.getReferencedContent() != null) {
return similarityToLabel(document.getReferencedContent(), label);
} else
return similarityToLabel(document.getContent(), label);
} | [
"public",
"double",
"similarityToLabel",
"(",
"LabelledDocument",
"document",
",",
"String",
"label",
")",
"{",
"if",
"(",
"document",
".",
"getReferencedContent",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"similarityToLabel",
"(",
"document",
".",
"getReferen... | This method returns similarity of the document to specific label, based on mean value
@param document
@param label
@return | [
"This",
"method",
"returns",
"similarity",
"of",
"the",
"document",
"to",
"specific",
"label",
"based",
"on",
"mean",
"value"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L681-L686 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.setRotate | public void setRotate(double cosA, double sinA) {
xx = cosA;
xy = -sinA;
xd = 0;
yx = sinA;
yy = cosA;
yd = 0;
} | java | public void setRotate(double cosA, double sinA) {
xx = cosA;
xy = -sinA;
xd = 0;
yx = sinA;
yy = cosA;
yd = 0;
} | [
"public",
"void",
"setRotate",
"(",
"double",
"cosA",
",",
"double",
"sinA",
")",
"{",
"xx",
"=",
"cosA",
";",
"xy",
"=",
"-",
"sinA",
";",
"xd",
"=",
"0",
";",
"yx",
"=",
"sinA",
";",
"yy",
"=",
"cosA",
";",
"yd",
"=",
"0",
";",
"}"
] | Sets rotation for this transformation.
When the axis Y is directed up and X is directed to the right, the
positive angle corresponds to the anti-clockwise rotation. When the axis
Y is directed down and X is directed to the right, the positive angle
corresponds to the clockwise rotation.
@param cosA
The rotation angle.
@param sinA
The rotation angle. | [
"Sets",
"rotation",
"for",
"this",
"transformation",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L728-L735 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java | CacheProxyUtil.validateResults | public static void validateResults(Map<Integer, Object> results) {
for (Object result : results.values()) {
if (result != null && result instanceof CacheClearResponse) {
Object response = ((CacheClearResponse) result).getResponse();
if (response instanceof Throwable) {
ExceptionUtil.sneakyThrow((Throwable) response);
}
}
}
} | java | public static void validateResults(Map<Integer, Object> results) {
for (Object result : results.values()) {
if (result != null && result instanceof CacheClearResponse) {
Object response = ((CacheClearResponse) result).getResponse();
if (response instanceof Throwable) {
ExceptionUtil.sneakyThrow((Throwable) response);
}
}
}
} | [
"public",
"static",
"void",
"validateResults",
"(",
"Map",
"<",
"Integer",
",",
"Object",
">",
"results",
")",
"{",
"for",
"(",
"Object",
"result",
":",
"results",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"result",
"!=",
"null",
"&&",
"result",
... | Cache clear response validator, loop on results to validate that no exception exists on the result map.
Throws the first exception in the map.
@param results map of {@link CacheClearResponse}. | [
"Cache",
"clear",
"response",
"validator",
"loop",
"on",
"results",
"to",
"validate",
"that",
"no",
"exception",
"exists",
"on",
"the",
"result",
"map",
".",
"Throws",
"the",
"first",
"exception",
"in",
"the",
"map",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java#L52-L61 |
milaboratory/milib | src/main/java/com/milaboratory/core/alignment/AlignmentTrimmer.java | AlignmentTrimmer.rightTrimAlignment | public static <S extends Sequence<S>> Alignment<S> rightTrimAlignment(Alignment<S> alignment,
AlignmentScoring<S> scoring) {
if (scoring instanceof LinearGapAlignmentScoring)
return rightTrimAlignment(alignment, (LinearGapAlignmentScoring<S>) scoring);
else if (scoring instanceof AffineGapAlignmentScoring)
return rightTrimAlignment(alignment, (AffineGapAlignmentScoring<S>) scoring);
else
throw new IllegalArgumentException("Unknown scoring type");
} | java | public static <S extends Sequence<S>> Alignment<S> rightTrimAlignment(Alignment<S> alignment,
AlignmentScoring<S> scoring) {
if (scoring instanceof LinearGapAlignmentScoring)
return rightTrimAlignment(alignment, (LinearGapAlignmentScoring<S>) scoring);
else if (scoring instanceof AffineGapAlignmentScoring)
return rightTrimAlignment(alignment, (AffineGapAlignmentScoring<S>) scoring);
else
throw new IllegalArgumentException("Unknown scoring type");
} | [
"public",
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"S",
">",
">",
"Alignment",
"<",
"S",
">",
"rightTrimAlignment",
"(",
"Alignment",
"<",
"S",
">",
"alignment",
",",
"AlignmentScoring",
"<",
"S",
">",
"scoring",
")",
"{",
"if",
"(",
"scoring",
... | Try increase total alignment score by partially (or fully) trimming it from right side. If score can't be
increased the same alignment will be returned.
@param alignment input alignment
@param scoring scoring
@return resulting alignment | [
"Try",
"increase",
"total",
"alignment",
"score",
"by",
"partially",
"(",
"or",
"fully",
")",
"trimming",
"it",
"from",
"right",
"side",
".",
"If",
"score",
"can",
"t",
"be",
"increased",
"the",
"same",
"alignment",
"will",
"be",
"returned",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/AlignmentTrimmer.java#L178-L186 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.ipxeScript_POST | public OvhIpxe ipxeScript_POST(String description, String name, String script) throws IOException {
String qPath = "/me/ipxeScript";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "name", name);
addBody(o, "script", script);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpxe.class);
} | java | public OvhIpxe ipxeScript_POST(String description, String name, String script) throws IOException {
String qPath = "/me/ipxeScript";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "name", name);
addBody(o, "script", script);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhIpxe.class);
} | [
"public",
"OvhIpxe",
"ipxeScript_POST",
"(",
"String",
"description",
",",
"String",
"name",
",",
"String",
"script",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/ipxeScript\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
"... | Add an IPXE script
REST: POST /me/ipxeScript
@param script [required] Content of your IPXE script
@param description [required] A personnal description of this script
@param name [required] name of your script | [
"Add",
"an",
"IPXE",
"script"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L976-L985 |
dropbox/dropbox-sdk-java | examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/DropboxBrowse.java | DropboxBrowse.slurpUtf8Part | private static String slurpUtf8Part(HttpServletRequest request, HttpServletResponse response, String name, int maxLength)
throws IOException, ServletException
{
Part part = request.getPart(name);
if (part == null) {
response.sendError(400, "Form field " + jq(name) + " is missing");
return null;
}
byte[] bytes = new byte[maxLength];
InputStream in = part.getInputStream();
int bytesRead = in.read(bytes);
if (bytesRead == -1) {
return "";
}
String s = StringUtil.utf8ToString(bytes, 0, bytesRead);
if (in.read() != -1) {
response.sendError(400, "Field " + jq(name) + " is too long (the limit is " + maxLength + " bytes): " + jq(s));
return null;
}
// TODO: We're just assuming the content is UTF-8 text. We should actually check it.
return s;
} | java | private static String slurpUtf8Part(HttpServletRequest request, HttpServletResponse response, String name, int maxLength)
throws IOException, ServletException
{
Part part = request.getPart(name);
if (part == null) {
response.sendError(400, "Form field " + jq(name) + " is missing");
return null;
}
byte[] bytes = new byte[maxLength];
InputStream in = part.getInputStream();
int bytesRead = in.read(bytes);
if (bytesRead == -1) {
return "";
}
String s = StringUtil.utf8ToString(bytes, 0, bytesRead);
if (in.read() != -1) {
response.sendError(400, "Field " + jq(name) + " is too long (the limit is " + maxLength + " bytes): " + jq(s));
return null;
}
// TODO: We're just assuming the content is UTF-8 text. We should actually check it.
return s;
} | [
"private",
"static",
"String",
"slurpUtf8Part",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"int",
"maxLength",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"Part",
"part",
"=",
"request",
... | Reads in a single field of a multipart/form-data request. If the field is not present
or the field is longer than maxLength, we'll use the given HttpServletResponse to respond
with an error and then return null.
Otherwise, process it as UTF-8 bytes and return the equivalent String. | [
"Reads",
"in",
"a",
"single",
"field",
"of",
"a",
"multipart",
"/",
"form",
"-",
"data",
"request",
".",
"If",
"the",
"field",
"is",
"not",
"present",
"or",
"the",
"field",
"is",
"longer",
"than",
"maxLength",
"we",
"ll",
"use",
"the",
"given",
"HttpSe... | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/DropboxBrowse.java#L317-L343 |
ops4j/org.ops4j.base | ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java | PropertiesUtils.readProperties | public static Properties readProperties( InputStream stream, Properties mappings, boolean closeStream )
throws IOException
{
try
{
Properties p = new Properties();
p.load( stream );
mappings.putAll( p );
boolean doAgain = true;
while( doAgain )
{
doAgain = false;
for( Map.Entry<Object, Object> entry : p.entrySet() )
{
String value = (String) entry.getValue();
if( value.indexOf( "${" ) >= 0 )
{
value = resolveProperty( mappings, value );
entry.setValue( value );
doAgain = true;
}
}
}
return p;
}
finally
{
if( closeStream )
{
stream.close();
}
}
} | java | public static Properties readProperties( InputStream stream, Properties mappings, boolean closeStream )
throws IOException
{
try
{
Properties p = new Properties();
p.load( stream );
mappings.putAll( p );
boolean doAgain = true;
while( doAgain )
{
doAgain = false;
for( Map.Entry<Object, Object> entry : p.entrySet() )
{
String value = (String) entry.getValue();
if( value.indexOf( "${" ) >= 0 )
{
value = resolveProperty( mappings, value );
entry.setValue( value );
doAgain = true;
}
}
}
return p;
}
finally
{
if( closeStream )
{
stream.close();
}
}
} | [
"public",
"static",
"Properties",
"readProperties",
"(",
"InputStream",
"stream",
",",
"Properties",
"mappings",
",",
"boolean",
"closeStream",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"p",
".",... | Read a set of properties from a property file provided as an Inputstream.
<p/>
Property files may reference symbolic properties in the form ${name}. Translations occur from both the
<code>mappings</code> properties as well as all values within the Properties that are being read.
</p>
<p/>
Example;
</p>
<code><pre>
Properties mappings = System.getProperties();
Properties myProps = PropertiesUtils.readProperties( "mine.properties", mappings );
</pre></code>
<p/>
and the "mine.properties" file contains;
</p>
<code><pre>
mything=${myplace}/mything
myplace=${user.home}/myplace
</pre></code>
<p/>
then the Properties object <i>myProps</i> will contain;
</p>
<code><pre>
mything=/home/niclas/myplace/mything
myplace=/home/niclas/myplace
</pre></code>
@param stream the InputStream of the property file to read.
@param mappings Properties that will be available for translations initially.
@param closeStream true if the method should close the stream before returning, false otherwise.
@return the resolved properties.
@throws IOException if an io error occurs | [
"Read",
"a",
"set",
"of",
"properties",
"from",
"a",
"property",
"file",
"provided",
"as",
"an",
"Inputstream",
".",
"<p",
"/",
">",
"Property",
"files",
"may",
"reference",
"symbolic",
"properties",
"in",
"the",
"form",
"$",
"{",
"name",
"}",
".",
"Tran... | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L97-L129 |
google/gson | gson/src/main/java/com/google/gson/Gson.java | Gson.fromJson | @SuppressWarnings("unchecked")
public <T> T fromJson(Reader json, Type typeOfT) throws JsonIOException, JsonSyntaxException {
JsonReader jsonReader = newJsonReader(json);
T object = (T) fromJson(jsonReader, typeOfT);
assertFullConsumption(object, jsonReader);
return object;
} | java | @SuppressWarnings("unchecked")
public <T> T fromJson(Reader json, Type typeOfT) throws JsonIOException, JsonSyntaxException {
JsonReader jsonReader = newJsonReader(json);
T object = (T) fromJson(jsonReader, typeOfT);
assertFullConsumption(object, jsonReader);
return object;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"fromJson",
"(",
"Reader",
"json",
",",
"Type",
"typeOfT",
")",
"throws",
"JsonIOException",
",",
"JsonSyntaxException",
"{",
"JsonReader",
"jsonReader",
"=",
"newJsonReader",
"(",... | This method deserializes the Json read from the specified reader into an object of the
specified type. This method is useful if the specified object is a generic type. For
non-generic objects, use {@link #fromJson(Reader, Class)} instead. If you have the Json in a
String form instead of a {@link Reader}, use {@link #fromJson(String, Type)} instead.
@param <T> the type of the desired object
@param json the reader producing Json from which the object is to be deserialized
@param typeOfT The specific genericized type of src. You can obtain this type by using the
{@link com.google.gson.reflect.TypeToken} class. For example, to get the type for
{@code Collection<Foo>}, you should use:
<pre>
Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
</pre>
@return an object of type T from the json. Returns {@code null} if {@code json} is at EOF.
@throws JsonIOException if there was a problem reading from the Reader
@throws JsonSyntaxException if json is not a valid representation for an object of type
@since 1.2 | [
"This",
"method",
"deserializes",
"the",
"Json",
"read",
"from",
"the",
"specified",
"reader",
"into",
"an",
"object",
"of",
"the",
"specified",
"type",
".",
"This",
"method",
"is",
"useful",
"if",
"the",
"specified",
"object",
"is",
"a",
"generic",
"type",
... | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/Gson.java#L894-L900 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.createSessionLoginToken | public Object createSessionLoginToken(Map<String, Object> queryParams) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return createSessionLoginToken(queryParams, null);
} | java | public Object createSessionLoginToken(Map<String, Object> queryParams) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return createSessionLoginToken(queryParams, null);
} | [
"public",
"Object",
"createSessionLoginToken",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"queryParams",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"createSessionLoginToken",
"(",
"queryParams",
","... | Generate a session login token in scenarios in which MFA may or may not be required.
A session login token expires two minutes after creation.
@param queryParams
Query Parameters (username_or_email, password, subdomain, return_to_url, ip_address, browser_id)
@return SessionTokenInfo or SessionTokenMFAInfo object if success
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/create-session-login-token">Create Session Login Token documentation</a> | [
"Generate",
"a",
"session",
"login",
"token",
"in",
"scenarios",
"in",
"which",
"MFA",
"may",
"or",
"may",
"not",
"be",
"required",
".",
"A",
"session",
"login",
"token",
"expires",
"two",
"minutes",
"after",
"creation",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L870-L872 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java | SquareGraph.acuteAngle | public double acuteAngle( SquareNode a , int sideA , SquareNode b , int sideB ) {
Point2D_F64 a0 = a.square.get(sideA);
Point2D_F64 a1 = a.square.get(add(sideA, 1));
Point2D_F64 b0 = b.square.get(sideB);
Point2D_F64 b1 = b.square.get(add(sideB, 1));
vector0.set(a1.x - a0.x, a1.y - a0.y);
vector1.set(b1.x - b0.x, b1.y - b0.y);
double acute = vector0.acute(vector1);
return Math.min(UtilAngle.dist(Math.PI, acute), acute);
} | java | public double acuteAngle( SquareNode a , int sideA , SquareNode b , int sideB ) {
Point2D_F64 a0 = a.square.get(sideA);
Point2D_F64 a1 = a.square.get(add(sideA, 1));
Point2D_F64 b0 = b.square.get(sideB);
Point2D_F64 b1 = b.square.get(add(sideB, 1));
vector0.set(a1.x - a0.x, a1.y - a0.y);
vector1.set(b1.x - b0.x, b1.y - b0.y);
double acute = vector0.acute(vector1);
return Math.min(UtilAngle.dist(Math.PI, acute), acute);
} | [
"public",
"double",
"acuteAngle",
"(",
"SquareNode",
"a",
",",
"int",
"sideA",
",",
"SquareNode",
"b",
",",
"int",
"sideB",
")",
"{",
"Point2D_F64",
"a0",
"=",
"a",
".",
"square",
".",
"get",
"(",
"sideA",
")",
";",
"Point2D_F64",
"a1",
"=",
"a",
"."... | Returns an angle between 0 and PI/4 which describes the difference in slope
between the two sides | [
"Returns",
"an",
"angle",
"between",
"0",
"and",
"PI",
"/",
"4",
"which",
"describes",
"the",
"difference",
"in",
"slope",
"between",
"the",
"two",
"sides"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L166-L178 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.sliceOffsetForTensor | public static long sliceOffsetForTensor(int index, INDArray arr, int[] tensorShape) {
long tensorLength = ArrayUtil.prodLong(tensorShape);
long lengthPerSlice = NDArrayMath.lengthPerSlice(arr);
long offset = index * tensorLength / lengthPerSlice;
return offset;
} | java | public static long sliceOffsetForTensor(int index, INDArray arr, int[] tensorShape) {
long tensorLength = ArrayUtil.prodLong(tensorShape);
long lengthPerSlice = NDArrayMath.lengthPerSlice(arr);
long offset = index * tensorLength / lengthPerSlice;
return offset;
} | [
"public",
"static",
"long",
"sliceOffsetForTensor",
"(",
"int",
"index",
",",
"INDArray",
"arr",
",",
"int",
"[",
"]",
"tensorShape",
")",
"{",
"long",
"tensorLength",
"=",
"ArrayUtil",
".",
"prodLong",
"(",
"tensorShape",
")",
";",
"long",
"lengthPerSlice",
... | calculates the offset for a tensor
@param index
@param arr
@param tensorShape
@return | [
"calculates",
"the",
"offset",
"for",
"a",
"tensor"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L160-L165 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/properties/GlobalFileProperties.java | GlobalFileProperties.getFilePath | private static String getFilePath(String defaultPath, String filePath) {
return defaultPath+File.separator+filePath;
} | java | private static String getFilePath(String defaultPath, String filePath) {
return defaultPath+File.separator+filePath;
} | [
"private",
"static",
"String",
"getFilePath",
"(",
"String",
"defaultPath",
",",
"String",
"filePath",
")",
"{",
"return",
"defaultPath",
"+",
"File",
".",
"separator",
"+",
"filePath",
";",
"}"
] | Crea el path para el fichero a partir del path por defecto
@param defaultPath
@param filePath
@return | [
"Crea",
"el",
"path",
"para",
"el",
"fichero",
"a",
"partir",
"del",
"path",
"por",
"defecto"
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/properties/GlobalFileProperties.java#L468-L470 |
edwardcapriolo/teknek-core | src/main/java/io/teknek/driver/DriverFactory.java | DriverFactory.createDriver | public static Driver createDriver(FeedPartition feedPartition, Plan plan, MetricRegistry metricRegistry){
populateFeedMetricInfo(plan, feedPartition, metricRegistry);
OperatorDesc desc = plan.getRootOperator();
Operator oper = buildOperator(desc, metricRegistry, plan.getName(), feedPartition);
OffsetStorage offsetStorage = null;
OffsetStorageDesc offsetDesc = plan.getOffsetStorageDesc();
if (offsetDesc != null && feedPartition.supportsOffsetManagement()){
offsetStorage = buildOffsetStorage(feedPartition, plan, offsetDesc);
Offset offset = offsetStorage.findLatestPersistedOffset();
if (offset != null){
feedPartition.setOffset(new String(offset.serialize(), Charsets.UTF_8));
}
}
CollectorProcessor cp = new CollectorProcessor();
cp.setTupleRetry(plan.getTupleRetry());
int offsetCommitInterval = plan.getOffsetCommitInterval();
Driver driver = new Driver(feedPartition, oper, offsetStorage, cp, offsetCommitInterval, metricRegistry, plan.getName());
recurseOperatorAndDriverNode(desc, driver.getDriverNode(), metricRegistry, feedPartition);
return driver;
} | java | public static Driver createDriver(FeedPartition feedPartition, Plan plan, MetricRegistry metricRegistry){
populateFeedMetricInfo(plan, feedPartition, metricRegistry);
OperatorDesc desc = plan.getRootOperator();
Operator oper = buildOperator(desc, metricRegistry, plan.getName(), feedPartition);
OffsetStorage offsetStorage = null;
OffsetStorageDesc offsetDesc = plan.getOffsetStorageDesc();
if (offsetDesc != null && feedPartition.supportsOffsetManagement()){
offsetStorage = buildOffsetStorage(feedPartition, plan, offsetDesc);
Offset offset = offsetStorage.findLatestPersistedOffset();
if (offset != null){
feedPartition.setOffset(new String(offset.serialize(), Charsets.UTF_8));
}
}
CollectorProcessor cp = new CollectorProcessor();
cp.setTupleRetry(plan.getTupleRetry());
int offsetCommitInterval = plan.getOffsetCommitInterval();
Driver driver = new Driver(feedPartition, oper, offsetStorage, cp, offsetCommitInterval, metricRegistry, plan.getName());
recurseOperatorAndDriverNode(desc, driver.getDriverNode(), metricRegistry, feedPartition);
return driver;
} | [
"public",
"static",
"Driver",
"createDriver",
"(",
"FeedPartition",
"feedPartition",
",",
"Plan",
"plan",
",",
"MetricRegistry",
"metricRegistry",
")",
"{",
"populateFeedMetricInfo",
"(",
"plan",
",",
"feedPartition",
",",
"metricRegistry",
")",
";",
"OperatorDesc",
... | Given a FeedParition and Plan create a Driver that will consume from the feed partition
and execute the plan.
@param feedPartition
@param plan
@return an uninitialized Driver | [
"Given",
"a",
"FeedParition",
"and",
"Plan",
"create",
"a",
"Driver",
"that",
"will",
"consume",
"from",
"the",
"feed",
"partition",
"and",
"execute",
"the",
"plan",
"."
] | train | https://github.com/edwardcapriolo/teknek-core/blob/4fa972d11044dee2954c0cc5e1b53b18fba319b9/src/main/java/io/teknek/driver/DriverFactory.java#L60-L79 |
apache/groovy | src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java | ClassNodeUtils.addDeclaredMethodsFromInterfaces | public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
// add in unimplemented abstract methods from the interfaces
for (ClassNode iface : cNode.getInterfaces()) {
Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
for (Map.Entry<String, MethodNode> entry : ifaceMethodsMap.entrySet()) {
String methSig = entry.getKey();
if (!methodsMap.containsKey(methSig)) {
methodsMap.put(methSig, entry.getValue());
}
}
}
} | java | public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
// add in unimplemented abstract methods from the interfaces
for (ClassNode iface : cNode.getInterfaces()) {
Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
for (Map.Entry<String, MethodNode> entry : ifaceMethodsMap.entrySet()) {
String methSig = entry.getKey();
if (!methodsMap.containsKey(methSig)) {
methodsMap.put(methSig, entry.getValue());
}
}
}
} | [
"public",
"static",
"void",
"addDeclaredMethodsFromInterfaces",
"(",
"ClassNode",
"cNode",
",",
"Map",
"<",
"String",
",",
"MethodNode",
">",
"methodsMap",
")",
"{",
"// add in unimplemented abstract methods from the interfaces",
"for",
"(",
"ClassNode",
"iface",
":",
"... | Add in methods from all interfaces. Existing entries in the methods map take precedence.
Methods from interfaces visited early take precedence over later ones.
@param cNode The ClassNode
@param methodsMap A map of existing methods to alter | [
"Add",
"in",
"methods",
"from",
"all",
"interfaces",
".",
"Existing",
"entries",
"in",
"the",
"methods",
"map",
"take",
"precedence",
".",
"Methods",
"from",
"interfaces",
"visited",
"early",
"take",
"precedence",
"over",
"later",
"ones",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L158-L169 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnRestoreDropoutDescriptor | public static int cudnnRestoreDropoutDescriptor(
cudnnDropoutDescriptor dropoutDesc,
cudnnHandle handle,
float dropout,
Pointer states,
long stateSizeInBytes,
long seed)
{
return checkResult(cudnnRestoreDropoutDescriptorNative(dropoutDesc, handle, dropout, states, stateSizeInBytes, seed));
} | java | public static int cudnnRestoreDropoutDescriptor(
cudnnDropoutDescriptor dropoutDesc,
cudnnHandle handle,
float dropout,
Pointer states,
long stateSizeInBytes,
long seed)
{
return checkResult(cudnnRestoreDropoutDescriptorNative(dropoutDesc, handle, dropout, states, stateSizeInBytes, seed));
} | [
"public",
"static",
"int",
"cudnnRestoreDropoutDescriptor",
"(",
"cudnnDropoutDescriptor",
"dropoutDesc",
",",
"cudnnHandle",
"handle",
",",
"float",
"dropout",
",",
"Pointer",
"states",
",",
"long",
"stateSizeInBytes",
",",
"long",
"seed",
")",
"{",
"return",
"chec... | Restores the dropout descriptor to a previously saved-off state | [
"Restores",
"the",
"dropout",
"descriptor",
"to",
"a",
"previously",
"saved",
"-",
"off",
"state"
] | train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2802-L2811 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getDelta | public DbxDelta<DbxEntry> getDelta(/*@Nullable*/String cursor, boolean includeMediaInfo)
throws DbxException
{
return _getDelta(cursor, null, includeMediaInfo);
} | java | public DbxDelta<DbxEntry> getDelta(/*@Nullable*/String cursor, boolean includeMediaInfo)
throws DbxException
{
return _getDelta(cursor, null, includeMediaInfo);
} | [
"public",
"DbxDelta",
"<",
"DbxEntry",
">",
"getDelta",
"(",
"/*@Nullable*/",
"String",
"cursor",
",",
"boolean",
"includeMediaInfo",
")",
"throws",
"DbxException",
"{",
"return",
"_getDelta",
"(",
"cursor",
",",
"null",
",",
"includeMediaInfo",
")",
";",
"}"
] | Return "delta" entries for the contents of a user's Dropbox. This lets you
efficiently keep up with the latest state of the files and folders. See
{@link DbxDelta} for more documentation on what each entry means.
<p>
To start, pass in {@code null} for {@code cursor}. For subsequent calls
To get the next set of delta entries, pass in the {@link DbxDelta#cursor cursor} returned
by the previous call.
</p>
<p>
To catch up to the current state, keep calling this method until the returned
object's {@link DbxDelta#hasMore hasMore} field is {@code false}.
</p>
<p>
If your app is a "Full Dropbox" app, this will return all entries for the user's entire
Dropbox folder. If your app is an "App Folder" app, this will only return entries
for the App Folder's contents.
</p> | [
"Return",
"delta",
"entries",
"for",
"the",
"contents",
"of",
"a",
"user",
"s",
"Dropbox",
".",
"This",
"lets",
"you",
"efficiently",
"keep",
"up",
"with",
"the",
"latest",
"state",
"of",
"the",
"files",
"and",
"folders",
".",
"See",
"{",
"@link",
"DbxDe... | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1479-L1483 |
windup/windup | graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java | OrganizationService.attachOrganization | public OrganizationModel attachOrganization(ArchiveModel archiveModel, String organizationName)
{
OrganizationModel model = getUnique(getQuery().traverse(g -> g.has(OrganizationModel.NAME, organizationName)).getRawTraversal());
if (model == null)
{
model = create();
model.setName(organizationName);
model.addArchiveModel(archiveModel);
}
else
{
return attachOrganization(model, archiveModel);
}
return model;
} | java | public OrganizationModel attachOrganization(ArchiveModel archiveModel, String organizationName)
{
OrganizationModel model = getUnique(getQuery().traverse(g -> g.has(OrganizationModel.NAME, organizationName)).getRawTraversal());
if (model == null)
{
model = create();
model.setName(organizationName);
model.addArchiveModel(archiveModel);
}
else
{
return attachOrganization(model, archiveModel);
}
return model;
} | [
"public",
"OrganizationModel",
"attachOrganization",
"(",
"ArchiveModel",
"archiveModel",
",",
"String",
"organizationName",
")",
"{",
"OrganizationModel",
"model",
"=",
"getUnique",
"(",
"getQuery",
"(",
")",
".",
"traverse",
"(",
"g",
"->",
"g",
".",
"has",
"(... | Attach a {@link OrganizationModel} with the given organization to the provided {@link ArchiveModel}. If an existing Model
exists with the provided organization, that one will be used instead. | [
"Attach",
"a",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/graph/api/src/main/java/org/jboss/windup/graph/service/OrganizationService.java#L26-L41 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDigestOffset | public int getDigestOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDigestOffset2(handshake, bufferOffset);
default:
case 0:
return getDigestOffset1(handshake, bufferOffset);
}
} | java | public int getDigestOffset(int algorithm, byte[] handshake, int bufferOffset) {
switch (algorithm) {
case 1:
return getDigestOffset2(handshake, bufferOffset);
default:
case 0:
return getDigestOffset1(handshake, bufferOffset);
}
} | [
"public",
"int",
"getDigestOffset",
"(",
"int",
"algorithm",
",",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"switch",
"(",
"algorithm",
")",
"{",
"case",
"1",
":",
"return",
"getDigestOffset2",
"(",
"handshake",
",",
"bufferOffset"... | Returns the digest offset using current validation scheme.
@param algorithm validation algorithm
@param handshake handshake sequence
@param bufferOffset buffer offset
@return digest offset | [
"Returns",
"the",
"digest",
"offset",
"using",
"current",
"validation",
"scheme",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L491-L499 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.reactsWith | public static Pattern reactsWith(Blacklist blacklist)
{
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR1");
p.add(erToPE(), "SMR1", "SPE1");
p.add(notGeneric(), "SPE1");
p.add(linkToComplex(blacklist), "SPE1", "PE1");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "PE1", "Conv");
p.add(type(BiochemicalReaction.class), "Conv");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR1");
p.add(new ConversionSide(ConversionSide.Type.SAME_SIDE, blacklist, RelType.INPUT), "PE1", "Conv", "PE2");
p.add(type(SmallMolecule.class), "PE2");
p.add(linkToSpecific(), "PE2", "SPE2");
p.add(notGeneric(), "SPE2");
p.add(new PEChainsIntersect(false), "SPE1", "PE1", "SPE2", "PE2");
p.add(peToER(), "SPE2", "SMR2");
p.add(equal(false), "SMR1", "SMR2");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR2");
return p;
} | java | public static Pattern reactsWith(Blacklist blacklist)
{
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR1");
p.add(erToPE(), "SMR1", "SPE1");
p.add(notGeneric(), "SPE1");
p.add(linkToComplex(blacklist), "SPE1", "PE1");
p.add(new ParticipatesInConv(RelType.INPUT, blacklist), "PE1", "Conv");
p.add(type(BiochemicalReaction.class), "Conv");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR1");
p.add(new ConversionSide(ConversionSide.Type.SAME_SIDE, blacklist, RelType.INPUT), "PE1", "Conv", "PE2");
p.add(type(SmallMolecule.class), "PE2");
p.add(linkToSpecific(), "PE2", "SPE2");
p.add(notGeneric(), "SPE2");
p.add(new PEChainsIntersect(false), "SPE1", "PE1", "SPE2", "PE2");
p.add(peToER(), "SPE2", "SMR2");
p.add(equal(false), "SMR1", "SMR2");
p.add(new InterToPartER(InterToPartER.Direction.ONESIDERS), "Conv", "SMR2");
return p;
} | [
"public",
"static",
"Pattern",
"reactsWith",
"(",
"Blacklist",
"blacklist",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"SmallMoleculeReference",
".",
"class",
",",
"\"SMR1\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"SMR1\"",
... | Constructs a pattern where first and last small molecules are substrates to the same
biochemical reaction.
@param blacklist a skip-list of ubiquitous molecules
@return the pattern | [
"Constructs",
"a",
"pattern",
"where",
"first",
"and",
"last",
"small",
"molecules",
"are",
"substrates",
"to",
"the",
"same",
"biochemical",
"reaction",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L594-L612 |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationHierarchyEventListener.java | FoundationHierarchyEventListener.addAppenderEvent | public void addAppenderEvent(final Category cat, final Appender appender) {
updateDefaultLayout(appender);
if (appender instanceof FoundationFileRollingAppender) {
final FoundationFileRollingAppender timeSizeRollingAppender = (FoundationFileRollingAppender) appender;
// update the appender with default vales such as logging pattern, file size etc.
//updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender);
// read teh proeprties and determine if archiving should be enabled.
updateArchivingSupport(timeSizeRollingAppender);
// by default add the rolling file listener to enable application
// state.
timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName());
boolean rollOnStartup = true;
if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString()));
}
timeSizeRollingAppender.setRollOnStartup(rollOnStartup);
// refresh the appender
timeSizeRollingAppender.activateOptions();
// timeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems
}else if(!(appender instanceof FoundationFileRollingAppender) && (appender instanceof TimeAndSizeRollingAppender)){ //TimeAndSizeRollingAppender
final TimeAndSizeRollingAppender timeSizeRollingAppender = (TimeAndSizeRollingAppender) appender;
// update the appender with default vales such as logging pattern, file size etc.
updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender);
// read teh proeprties and determine if archiving should be enabled.
updateArchivingSupport(timeSizeRollingAppender);
// by default add the rolling file listener to enable application
// state.
timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName());
boolean rollOnStartup = true;
if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString()));
}
timeSizeRollingAppender.setRollOnStartup(rollOnStartup);
// refresh the appender
timeSizeRollingAppender.activateOptions();
// timeSizeRollingAppender.setOriginalLayout();
}
if ( ! (appender instanceof org.apache.log4j.AsyncAppender))
initiateAsyncSupport(appender);
} | java | public void addAppenderEvent(final Category cat, final Appender appender) {
updateDefaultLayout(appender);
if (appender instanceof FoundationFileRollingAppender) {
final FoundationFileRollingAppender timeSizeRollingAppender = (FoundationFileRollingAppender) appender;
// update the appender with default vales such as logging pattern, file size etc.
//updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender);
// read teh proeprties and determine if archiving should be enabled.
updateArchivingSupport(timeSizeRollingAppender);
// by default add the rolling file listener to enable application
// state.
timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName());
boolean rollOnStartup = true;
if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString()));
}
timeSizeRollingAppender.setRollOnStartup(rollOnStartup);
// refresh the appender
timeSizeRollingAppender.activateOptions();
// timeSizeRollingAppender.setOriginalLayout(); //So application state will not make any problems
}else if(!(appender instanceof FoundationFileRollingAppender) && (appender instanceof TimeAndSizeRollingAppender)){ //TimeAndSizeRollingAppender
final TimeAndSizeRollingAppender timeSizeRollingAppender = (TimeAndSizeRollingAppender) appender;
// update the appender with default vales such as logging pattern, file size etc.
updateDefaultTimeAndSizeRollingAppender(timeSizeRollingAppender);
// read teh proeprties and determine if archiving should be enabled.
updateArchivingSupport(timeSizeRollingAppender);
// by default add the rolling file listener to enable application
// state.
timeSizeRollingAppender.setFileRollEventListener(FoundationRollEventListener.class.getName());
boolean rollOnStartup = true;
if (FoundationLogger.log4jConfigProps != null && FoundationLogger.log4jConfigProps.containsKey(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString())) {
rollOnStartup = Boolean.valueOf(FoundationLogger.log4jConfigProps.getProperty(FoundationLoggerConstants.Foundation_ROLL_ON_STARTUP.toString()));
}
timeSizeRollingAppender.setRollOnStartup(rollOnStartup);
// refresh the appender
timeSizeRollingAppender.activateOptions();
// timeSizeRollingAppender.setOriginalLayout();
}
if ( ! (appender instanceof org.apache.log4j.AsyncAppender))
initiateAsyncSupport(appender);
} | [
"public",
"void",
"addAppenderEvent",
"(",
"final",
"Category",
"cat",
",",
"final",
"Appender",
"appender",
")",
"{",
"updateDefaultLayout",
"(",
"appender",
")",
";",
"if",
"(",
"appender",
"instanceof",
"FoundationFileRollingAppender",
")",
"{",
"final",
"Found... | In this method perform the actual override in runtime.
@see org.apache.log4j.spi.HierarchyEventListener#addAppenderEvent(org.apache.log4j.Category, org.apache.log4j.Appender) | [
"In",
"this",
"method",
"perform",
"the",
"actual",
"override",
"in",
"runtime",
"."
] | train | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationHierarchyEventListener.java#L55-L116 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java | ModelUtils.findAnnotationMirror | public static Optional<AnnotationMirror> findAnnotationMirror(
Element element, Class<? extends Annotation> annotationClass) {
return findAnnotationMirror(element, Shading.unshadedName(annotationClass.getName()));
} | java | public static Optional<AnnotationMirror> findAnnotationMirror(
Element element, Class<? extends Annotation> annotationClass) {
return findAnnotationMirror(element, Shading.unshadedName(annotationClass.getName()));
} | [
"public",
"static",
"Optional",
"<",
"AnnotationMirror",
">",
"findAnnotationMirror",
"(",
"Element",
"element",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"return",
"findAnnotationMirror",
"(",
"element",
",",
"Shading",
".... | Returns an {@link AnnotationMirror} for the annotation of type {@code annotationClass} on
{@code element}, or {@link Optional#empty()} if no such annotation exists. | [
"Returns",
"an",
"{"
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java#L58-L61 |
medallia/Word2VecJava | src/main/java/com/medallia/word2vec/util/IO.java | IO.copyAndCloseOutput | public static int copyAndCloseOutput(Reader input, Writer output) throws IOException {
try {
return copy(input, output);
} finally {
output.close();
}
} | java | public static int copyAndCloseOutput(Reader input, Writer output) throws IOException {
try {
return copy(input, output);
} finally {
output.close();
}
} | [
"public",
"static",
"int",
"copyAndCloseOutput",
"(",
"Reader",
"input",
",",
"Writer",
"output",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"copy",
"(",
"input",
",",
"output",
")",
";",
"}",
"finally",
"{",
"output",
".",
"close",
"(",
")... | Copy input to output and close the output stream before returning | [
"Copy",
"input",
"to",
"output",
"and",
"close",
"the",
"output",
"stream",
"before",
"returning"
] | train | https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L96-L103 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setBaselineBudgetCost | public void setBaselineBudgetCost(int baselineNumber, Number value)
{
set(selectField(AssignmentFieldLists.BASELINE_BUDGET_COSTS, baselineNumber), value);
} | java | public void setBaselineBudgetCost(int baselineNumber, Number value)
{
set(selectField(AssignmentFieldLists.BASELINE_BUDGET_COSTS, baselineNumber), value);
} | [
"public",
"void",
"setBaselineBudgetCost",
"(",
"int",
"baselineNumber",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"BASELINE_BUDGET_COSTS",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1474-L1477 |
JetBrains/xodus | vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java | VirtualFileSystem.touchFile | public void touchFile(@NotNull final Transaction txn, @NotNull final File file) {
new LastModifiedTrigger(txn, file, pathnames).run();
} | java | public void touchFile(@NotNull final Transaction txn, @NotNull final File file) {
new LastModifiedTrigger(txn, file, pathnames).run();
} | [
"public",
"void",
"touchFile",
"(",
"@",
"NotNull",
"final",
"Transaction",
"txn",
",",
"@",
"NotNull",
"final",
"File",
"file",
")",
"{",
"new",
"LastModifiedTrigger",
"(",
"txn",
",",
"file",
",",
"pathnames",
")",
".",
"run",
"(",
")",
";",
"}"
] | Touches the specified {@linkplain File}, i.e. sets its {@linkplain File#getLastModified() last modified time} to
current time.
@param txn {@linkplain Transaction} instance
@param file {@linkplain File} instance
@see #readFile(Transaction, File)
@see #readFile(Transaction, long)
@see #readFile(Transaction, File, long)
@see #writeFile(Transaction, File)
@see #writeFile(Transaction, long)
@see #writeFile(Transaction, File, long)
@see #writeFile(Transaction, long, long)
@see #appendFile(Transaction, File)
@see File#getLastModified() | [
"Touches",
"the",
"specified",
"{",
"@linkplain",
"File",
"}",
"i",
".",
"e",
".",
"sets",
"its",
"{",
"@linkplain",
"File#getLastModified",
"()",
"last",
"modified",
"time",
"}",
"to",
"current",
"time",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L475-L477 |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java | NodeImpl.setPropertyValue | public static NodeImpl setPropertyValue(final NodeImpl node, final Object value) {
return new NodeImpl( //
node.name, //
node.parent, //
node.isIterableValue, //
node.index, //
node.key, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | java | public static NodeImpl setPropertyValue(final NodeImpl node, final Object value) {
return new NodeImpl( //
node.name, //
node.parent, //
node.isIterableValue, //
node.index, //
node.key, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | [
"public",
"static",
"NodeImpl",
"setPropertyValue",
"(",
"final",
"NodeImpl",
"node",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"new",
"NodeImpl",
"(",
"//",
"node",
".",
"name",
",",
"//",
"node",
".",
"parent",
",",
"//",
"node",
".",
"isIte... | set property value to a copied node.
@param node node to build
@param value value to set
@return new created node implementation | [
"set",
"property",
"value",
"to",
"a",
"copied",
"node",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java#L357-L371 |
foundation-runtime/logging | logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/FileRollEvent.java | FileRollEvent.dispatchToAppender | final void dispatchToAppender(final LoggingEvent customLoggingEvent) {
// wrap the LoggingEvent in a FileRollEvent to prevent recursion bug
final FoundationFileRollingAppender appender = this.getSource();
if (appender != null) {
appender.append(new FileRollEvent(customLoggingEvent, this));
}
} | java | final void dispatchToAppender(final LoggingEvent customLoggingEvent) {
// wrap the LoggingEvent in a FileRollEvent to prevent recursion bug
final FoundationFileRollingAppender appender = this.getSource();
if (appender != null) {
appender.append(new FileRollEvent(customLoggingEvent, this));
}
} | [
"final",
"void",
"dispatchToAppender",
"(",
"final",
"LoggingEvent",
"customLoggingEvent",
")",
"{",
"// wrap the LoggingEvent in a FileRollEvent to prevent recursion bug",
"final",
"FoundationFileRollingAppender",
"appender",
"=",
"this",
".",
"getSource",
"(",
")",
";",
"if... | Convenience method dispatches the specified event to the source appender,
which will result in the custom event data being appended to the new file.
@param customLoggingEvent
The custom Log4J event to be appended. | [
"Convenience",
"method",
"dispatches",
"the",
"specified",
"event",
"to",
"the",
"source",
"appender",
"which",
"will",
"result",
"in",
"the",
"custom",
"event",
"data",
"being",
"appended",
"to",
"the",
"new",
"file",
"."
] | train | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/appender/FileRollEvent.java#L150-L156 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfImportedPage.java | PdfImportedPage.addImage | public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
throwError();
} | java | public void addImage(Image image, float a, float b, float c, float d, float e, float f) throws DocumentException {
throwError();
} | [
"public",
"void",
"addImage",
"(",
"Image",
"image",
",",
"float",
"a",
",",
"float",
"b",
",",
"float",
"c",
",",
"float",
"d",
",",
"float",
"e",
",",
"float",
"f",
")",
"throws",
"DocumentException",
"{",
"throwError",
"(",
")",
";",
"}"
] | Always throws an error. This operation is not allowed.
@param image dummy
@param a dummy
@param b dummy
@param c dummy
@param d dummy
@param e dummy
@param f dummy
@throws DocumentException dummy | [
"Always",
"throws",
"an",
"error",
".",
"This",
"operation",
"is",
"not",
"allowed",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfImportedPage.java#L97-L99 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_feature_duration_GET | public OvhOrder dedicated_server_serviceName_feature_duration_GET(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "feature", feature);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_feature_duration_GET(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
query(sb, "feature", feature);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_feature_duration_GET",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderableSysFeatureEnum",
"feature",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/... | Get prices and contracts information
REST: GET /order/dedicated/server/{serviceName}/feature/{duration}
@param feature [required] the feature
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2209-L2215 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.buildCoverage | public static GridCoverage2D buildCoverage( String name, WritableRaster writableRaster,
HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) {
if (writableRaster instanceof GrassLegacyWritableRaster) {
GrassLegacyWritableRaster wRaster = (GrassLegacyWritableRaster) writableRaster;
double west = envelopeParams.get(WEST);
double south = envelopeParams.get(SOUTH);
double east = envelopeParams.get(EAST);
double north = envelopeParams.get(NORTH);
int rows = envelopeParams.get(ROWS).intValue();
int cols = envelopeParams.get(COLS).intValue();
Window window = new Window(west, east, south, north, rows, cols);
GrassLegacyGridCoverage2D coverage2D = new GrassLegacyGridCoverage2D(window, wRaster.getData(), crs);
return coverage2D;
} else {
double west = envelopeParams.get(WEST);
double south = envelopeParams.get(SOUTH);
double east = envelopeParams.get(EAST);
double north = envelopeParams.get(NORTH);
Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south);
GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
GridCoverage2D coverage2D = factory.create(name, writableRaster, writeEnvelope);
return coverage2D;
}
} | java | public static GridCoverage2D buildCoverage( String name, WritableRaster writableRaster,
HashMap<String, Double> envelopeParams, CoordinateReferenceSystem crs ) {
if (writableRaster instanceof GrassLegacyWritableRaster) {
GrassLegacyWritableRaster wRaster = (GrassLegacyWritableRaster) writableRaster;
double west = envelopeParams.get(WEST);
double south = envelopeParams.get(SOUTH);
double east = envelopeParams.get(EAST);
double north = envelopeParams.get(NORTH);
int rows = envelopeParams.get(ROWS).intValue();
int cols = envelopeParams.get(COLS).intValue();
Window window = new Window(west, east, south, north, rows, cols);
GrassLegacyGridCoverage2D coverage2D = new GrassLegacyGridCoverage2D(window, wRaster.getData(), crs);
return coverage2D;
} else {
double west = envelopeParams.get(WEST);
double south = envelopeParams.get(SOUTH);
double east = envelopeParams.get(EAST);
double north = envelopeParams.get(NORTH);
Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south);
GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
GridCoverage2D coverage2D = factory.create(name, writableRaster, writeEnvelope);
return coverage2D;
}
} | [
"public",
"static",
"GridCoverage2D",
"buildCoverage",
"(",
"String",
"name",
",",
"WritableRaster",
"writableRaster",
",",
"HashMap",
"<",
"String",
",",
"Double",
">",
"envelopeParams",
",",
"CoordinateReferenceSystem",
"crs",
")",
"{",
"if",
"(",
"writableRaster"... | Creates a {@link GridCoverage2D coverage} from the {@link WritableRaster writable raster} and the necessary geographic Information.
@param name the name of the coverage.
@param writableRaster the raster containing the data.
@param envelopeParams the map of boundary parameters.
@param crs the {@link CoordinateReferenceSystem}.
@return the {@link GridCoverage2D coverage}. | [
"Creates",
"a",
"{",
"@link",
"GridCoverage2D",
"coverage",
"}",
"from",
"the",
"{",
"@link",
"WritableRaster",
"writable",
"raster",
"}",
"and",
"the",
"necessary",
"geographic",
"Information",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L885-L909 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/BitStrings.java | BitStrings.andWith | public static String andWith(final String str, final String boolString) {
if (Strings.isEmpty(str)) { return null; }
if (Strings.isEmpty(boolString)) { return str; }
if (str.length() < boolString.length()) { return str; }
final StringBuilder buffer = new StringBuilder(str);
for (int i = 0; i < buffer.length(); i++) {
if (boolString.charAt(i) == '0') {
buffer.setCharAt(i, '0');
}
}
return buffer.toString();
} | java | public static String andWith(final String str, final String boolString) {
if (Strings.isEmpty(str)) { return null; }
if (Strings.isEmpty(boolString)) { return str; }
if (str.length() < boolString.length()) { return str; }
final StringBuilder buffer = new StringBuilder(str);
for (int i = 0; i < buffer.length(); i++) {
if (boolString.charAt(i) == '0') {
buffer.setCharAt(i, '0');
}
}
return buffer.toString();
} | [
"public",
"static",
"String",
"andWith",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"boolString",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"Strings",
".",
"isEmpty",
... | 将一个字符串,按照boolString的形式进行变化. 如果boolString[i]!=0则保留str[i],否则置0
@param str a {@link java.lang.String} object.
@param boolString a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"将一个字符串,按照boolString的形式进行变化",
".",
"如果boolString",
"[",
"i",
"]",
"!",
"=",
"0则保留str",
"[",
"i",
"]",
"否则置0"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/BitStrings.java#L80-L91 |
Javacord/Javacord | javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java | ChannelUpdateHandler.handleServerTextChannel | private void handleServerTextChannel(JsonNode jsonChannel) {
long channelId = jsonChannel.get("id").asLong();
api.getTextChannelById(channelId).map(c -> ((ServerTextChannelImpl) c)).ifPresent(channel -> {
String oldTopic = channel.getTopic();
String newTopic = jsonChannel.has("topic") && !jsonChannel.get("topic").isNull()
? jsonChannel.get("topic").asText() : "";
if (!oldTopic.equals(newTopic)) {
channel.setTopic(newTopic);
ServerTextChannelChangeTopicEvent event =
new ServerTextChannelChangeTopicEventImpl(channel, newTopic, oldTopic);
api.getEventDispatcher().dispatchServerTextChannelChangeTopicEvent(
(DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event);
}
boolean oldNsfwFlag = channel.isNsfw();
boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean();
if (oldNsfwFlag != newNsfwFlag) {
channel.setNsfwFlag(newNsfwFlag);
ServerChannelChangeNsfwFlagEvent event =
new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag);
api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent(
(DispatchQueueSelector) channel.getServer(), null, channel.getServer(), channel, event);
}
int oldSlowmodeDelay = channel.getSlowmodeDelayInSeconds();
int newSlowmodeDelay = jsonChannel.get("rate_limit_per_user").asInt(0);
if (oldSlowmodeDelay != newSlowmodeDelay) {
channel.setSlowmodeDelayInSeconds(newSlowmodeDelay);
ServerTextChannelChangeSlowmodeEvent event =
new ServerTextChannelChangeSlowmodeEventImpl(channel, oldSlowmodeDelay, newSlowmodeDelay);
api.getEventDispatcher().dispatchServerTextChannelChangeSlowmodeEvent(
(DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event
);
}
});
} | java | private void handleServerTextChannel(JsonNode jsonChannel) {
long channelId = jsonChannel.get("id").asLong();
api.getTextChannelById(channelId).map(c -> ((ServerTextChannelImpl) c)).ifPresent(channel -> {
String oldTopic = channel.getTopic();
String newTopic = jsonChannel.has("topic") && !jsonChannel.get("topic").isNull()
? jsonChannel.get("topic").asText() : "";
if (!oldTopic.equals(newTopic)) {
channel.setTopic(newTopic);
ServerTextChannelChangeTopicEvent event =
new ServerTextChannelChangeTopicEventImpl(channel, newTopic, oldTopic);
api.getEventDispatcher().dispatchServerTextChannelChangeTopicEvent(
(DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event);
}
boolean oldNsfwFlag = channel.isNsfw();
boolean newNsfwFlag = jsonChannel.get("nsfw").asBoolean();
if (oldNsfwFlag != newNsfwFlag) {
channel.setNsfwFlag(newNsfwFlag);
ServerChannelChangeNsfwFlagEvent event =
new ServerChannelChangeNsfwFlagEventImpl(channel, newNsfwFlag, oldNsfwFlag);
api.getEventDispatcher().dispatchServerChannelChangeNsfwFlagEvent(
(DispatchQueueSelector) channel.getServer(), null, channel.getServer(), channel, event);
}
int oldSlowmodeDelay = channel.getSlowmodeDelayInSeconds();
int newSlowmodeDelay = jsonChannel.get("rate_limit_per_user").asInt(0);
if (oldSlowmodeDelay != newSlowmodeDelay) {
channel.setSlowmodeDelayInSeconds(newSlowmodeDelay);
ServerTextChannelChangeSlowmodeEvent event =
new ServerTextChannelChangeSlowmodeEventImpl(channel, oldSlowmodeDelay, newSlowmodeDelay);
api.getEventDispatcher().dispatchServerTextChannelChangeSlowmodeEvent(
(DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event
);
}
});
} | [
"private",
"void",
"handleServerTextChannel",
"(",
"JsonNode",
"jsonChannel",
")",
"{",
"long",
"channelId",
"=",
"jsonChannel",
".",
"get",
"(",
"\"id\"",
")",
".",
"asLong",
"(",
")",
";",
"api",
".",
"getTextChannelById",
"(",
"channelId",
")",
".",
"map"... | Handles a server text channel update.
@param jsonChannel The json channel data. | [
"Handles",
"a",
"server",
"text",
"channel",
"update",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java#L272-L311 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java | SessionManager.getSession | public Object getSession(String id, int version, boolean isSessionAccess, Object xdCorrelator) {
return getSession(id, version, isSessionAccess, false, xdCorrelator);
} | java | public Object getSession(String id, int version, boolean isSessionAccess, Object xdCorrelator) {
return getSession(id, version, isSessionAccess, false, xdCorrelator);
} | [
"public",
"Object",
"getSession",
"(",
"String",
"id",
",",
"int",
"version",
",",
"boolean",
"isSessionAccess",
",",
"Object",
"xdCorrelator",
")",
"{",
"return",
"getSession",
"(",
"id",
",",
"version",
",",
"isSessionAccess",
",",
"false",
",",
"xdCorrelato... | This method is invoked by the HttpSessionManagerImpl to get at the session
or related session information. If the getSession is a result of a
request.getSession
call from the application, then the isSessionAccess boolean is set to true.
Also if the version number is available, then it is provided. If not, then
a value
of -1 is passed in. This can happen either in the case of an incoming
request
that provides the session id via URL rewriting but does not provide the
version/clone
info or in the case of a isRequestedSessionIDValid call.
<p>
@param id
@param version
@param isSessionAccess
tells us if the request came from a session access (user request)
@return Object | [
"This",
"method",
"is",
"invoked",
"by",
"the",
"HttpSessionManagerImpl",
"to",
"get",
"at",
"the",
"session",
"or",
"related",
"session",
"information",
".",
"If",
"the",
"getSession",
"is",
"a",
"result",
"of",
"a",
"request",
".",
"getSession",
"call",
"f... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java#L433-L435 |
mojohaus/mrm | mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/DiskFileSystem.java | DiskFileSystem.toFile | private File toFile( Entry entry )
{
Stack<String> stack = new Stack<String>();
Entry entryRoot = entry.getFileSystem().getRoot();
while ( entry != null && !entryRoot.equals( entry ) )
{
String name = entry.getName();
if ( "..".equals( name ) )
{
if ( !stack.isEmpty() )
{
stack.pop();
}
}
else if ( !".".equals( name ) )
{
stack.push( name );
}
entry = entry.getParent();
}
File file = this.root;
while ( !stack.empty() )
{
file = new File( file, (String) stack.pop() );
}
return file;
} | java | private File toFile( Entry entry )
{
Stack<String> stack = new Stack<String>();
Entry entryRoot = entry.getFileSystem().getRoot();
while ( entry != null && !entryRoot.equals( entry ) )
{
String name = entry.getName();
if ( "..".equals( name ) )
{
if ( !stack.isEmpty() )
{
stack.pop();
}
}
else if ( !".".equals( name ) )
{
stack.push( name );
}
entry = entry.getParent();
}
File file = this.root;
while ( !stack.empty() )
{
file = new File( file, (String) stack.pop() );
}
return file;
} | [
"private",
"File",
"toFile",
"(",
"Entry",
"entry",
")",
"{",
"Stack",
"<",
"String",
">",
"stack",
"=",
"new",
"Stack",
"<",
"String",
">",
"(",
")",
";",
"Entry",
"entryRoot",
"=",
"entry",
".",
"getFileSystem",
"(",
")",
".",
"getRoot",
"(",
")",
... | Convert an entry into the corresponding file path.
@param entry the entry.
@return the corresponding file.
@since 1.0 | [
"Convert",
"an",
"entry",
"into",
"the",
"corresponding",
"file",
"path",
"."
] | train | https://github.com/mojohaus/mrm/blob/ecbe54a1866f210c10bf2e9274b63d4804d6a151/mrm-servlet/src/main/java/org/codehaus/mojo/mrm/impl/DiskFileSystem.java#L120-L146 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java | SVGIcon.startForegroundIconRotateAnimation | public void startForegroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) {
stopForegroundIconRotateAnimation();
foregroundRotateAnimation = Animations.createRotateTransition(foregroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse);
foregroundRotateAnimation.setOnFinished(event -> foregroundIcon.setRotate(0));
foregroundRotateAnimation.play();
} | java | public void startForegroundIconRotateAnimation(final double fromAngle, final double toAngle, final int cycleCount, final double duration, final Interpolator interpolator, final boolean autoReverse) {
stopForegroundIconRotateAnimation();
foregroundRotateAnimation = Animations.createRotateTransition(foregroundIcon, fromAngle, toAngle, cycleCount, duration, interpolator, autoReverse);
foregroundRotateAnimation.setOnFinished(event -> foregroundIcon.setRotate(0));
foregroundRotateAnimation.play();
} | [
"public",
"void",
"startForegroundIconRotateAnimation",
"(",
"final",
"double",
"fromAngle",
",",
"final",
"double",
"toAngle",
",",
"final",
"int",
"cycleCount",
",",
"final",
"double",
"duration",
",",
"final",
"Interpolator",
"interpolator",
",",
"final",
"boolea... | Method starts the rotate animation of the foreground icon.
@param fromAngle the rotation angle where the transition should start.
@param toAngle the rotation angle where the transition should end.
@param cycleCount the number of times the animation should be played (use Animation.INDEFINITE for endless).
@param duration the duration which one animation cycle should take.
@param interpolator defines the rotation value interpolation between {@code fromAngle} and {@code toAngle}.
@param autoReverse defines if the animation should be reversed at the end. | [
"Method",
"starts",
"the",
"rotate",
"animation",
"of",
"the",
"foreground",
"icon",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L359-L364 |
voldemort/voldemort | src/java/voldemort/utils/ReflectUtils.java | ReflectUtils.callConstructor | public static <T> T callConstructor(Class<T> klass) {
return callConstructor(klass, new Class<?>[0], new Object[0]);
} | java | public static <T> T callConstructor(Class<T> klass) {
return callConstructor(klass, new Class<?>[0], new Object[0]);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"callConstructor",
"(",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"return",
"callConstructor",
"(",
"klass",
",",
"new",
"Class",
"<",
"?",
">",
"[",
"0",
"]",
",",
"new",
"Object",
"[",
"0",
"]",
")",
";"... | Call the no-arg constructor for the given class
@param <T> The type of the thing to construct
@param klass The class
@return The constructed thing | [
"Call",
"the",
"no",
"-",
"arg",
"constructor",
"for",
"the",
"given",
"class"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L85-L87 |
op4j/op4j | src/main/java/org/op4j/functions/FnDate.java | FnDate.toStr | public static final Function<Date,String> toStr(final String pattern, final Locale locale) {
return new ToString(pattern, locale);
} | java | public static final Function<Date,String> toStr(final String pattern, final Locale locale) {
return new ToString(pattern, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"Date",
",",
"String",
">",
"toStr",
"(",
"final",
"String",
"pattern",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ToString",
"(",
"pattern",
",",
"locale",
")",
";",
"}"
] | <p>
Converts the target Date into a String using the specified <tt>pattern</tt>.
The pattern has to be written in the <tt>java.text.SimpleDateFormat</tt> format,
and the specified locale will be used for text-based pattern components (like
month names or week days).
</p>
@param pattern the pattern to be used, as specified by <tt>java.text.SimpleDateFormat</tt>.
@param locale the locale to be used for text-based pattern components
@return the String representation of the target Date. | [
"<p",
">",
"Converts",
"the",
"target",
"Date",
"into",
"a",
"String",
"using",
"the",
"specified",
"<tt",
">",
"pattern<",
"/",
"tt",
">",
".",
"The",
"pattern",
"has",
"to",
"be",
"written",
"in",
"the",
"<tt",
">",
"java",
".",
"text",
".",
"Simpl... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnDate.java#L408-L410 |
threerings/narya | core/src/main/java/com/threerings/presents/client/InvocationDirector.java | InvocationDirector.sendRequest | public void sendRequest (int invOid, int invCode, int methodId, Object[] args)
{
sendRequest(invOid, invCode, methodId, args, Transport.DEFAULT);
} | java | public void sendRequest (int invOid, int invCode, int methodId, Object[] args)
{
sendRequest(invOid, invCode, methodId, args, Transport.DEFAULT);
} | [
"public",
"void",
"sendRequest",
"(",
"int",
"invOid",
",",
"int",
"invCode",
",",
"int",
"methodId",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"sendRequest",
"(",
"invOid",
",",
"invCode",
",",
"methodId",
",",
"args",
",",
"Transport",
".",
"DEFAULT",... | Requests that the specified invocation request be packaged up and sent to the supplied
invocation oid. | [
"Requests",
"that",
"the",
"specified",
"invocation",
"request",
"be",
"packaged",
"up",
"and",
"sent",
"to",
"the",
"supplied",
"invocation",
"oid",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/InvocationDirector.java#L207-L210 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource.java | WSJdbcDataSource.replaceObject | Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
DSConfig config = dsConfig.get();
String filter = config.jndiName == null || config.jndiName.startsWith("java:")
? FilterUtils.createPropertyFilter("config.displayId", config.id)
: FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
if (resRefInfo != null) {
resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling());
resRefConfig.setCommitPriority(resRefInfo.getCommitPriority());
resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel());
resRefConfig.setJNDIName(resRefInfo.getJNDIName());
resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName());
resRefConfig.setResAuthType(resRefInfo.getAuth());
resRefConfig.setSharingScope(resRefInfo.getSharingScope());
}
return new SerializedDataSourceWrapper(filter, resRefConfig);
} | java | Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
DSConfig config = dsConfig.get();
String filter = config.jndiName == null || config.jndiName.startsWith("java:")
? FilterUtils.createPropertyFilter("config.displayId", config.id)
: FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
if (resRefInfo != null) {
resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling());
resRefConfig.setCommitPriority(resRefInfo.getCommitPriority());
resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel());
resRefConfig.setJNDIName(resRefInfo.getJNDIName());
resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName());
resRefConfig.setResAuthType(resRefInfo.getAuth());
resRefConfig.setSharingScope(resRefInfo.getSharingScope());
}
return new SerializedDataSourceWrapper(filter, resRefConfig);
} | [
"Object",
"replaceObject",
"(",
"ResourceRefConfigFactory",
"resRefConfigFactory",
")",
"{",
"DSConfig",
"config",
"=",
"dsConfig",
".",
"get",
"(",
")",
";",
"String",
"filter",
"=",
"config",
".",
"jndiName",
"==",
"null",
"||",
"config",
".",
"jndiName",
".... | Returns a replacement object that can be serialized instead of WSJdbcDataSource.
@param resRefConfigFactory factory for resource ref config.
@return a replacement object that can be serialized instead of WSJdbcDataSource. | [
"Returns",
"a",
"replacement",
"object",
"that",
"can",
"be",
"serialized",
"instead",
"of",
"WSJdbcDataSource",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcDataSource.java#L341-L357 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java | PathAlterationObserver.createPathEntry | private FileStatusEntry createPathEntry(final FileStatusEntry parent, final Path childPath)
throws IOException {
final FileStatusEntry entry = parent.newChildInstance(childPath);
entry.refresh(childPath);
final FileStatusEntry[] children = doListPathsEntry(childPath, entry);
entry.setChildren(children);
return entry;
} | java | private FileStatusEntry createPathEntry(final FileStatusEntry parent, final Path childPath)
throws IOException {
final FileStatusEntry entry = parent.newChildInstance(childPath);
entry.refresh(childPath);
final FileStatusEntry[] children = doListPathsEntry(childPath, entry);
entry.setChildren(children);
return entry;
} | [
"private",
"FileStatusEntry",
"createPathEntry",
"(",
"final",
"FileStatusEntry",
"parent",
",",
"final",
"Path",
"childPath",
")",
"throws",
"IOException",
"{",
"final",
"FileStatusEntry",
"entry",
"=",
"parent",
".",
"newChildInstance",
"(",
"childPath",
")",
";",... | Create a new FileStatusEntry for the specified file.
@param parent The parent file entry
@param childPath The file to create an entry for
@return A new file entry | [
"Create",
"a",
"new",
"FileStatusEntry",
"for",
"the",
"specified",
"file",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/PathAlterationObserver.java#L238-L245 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.beginImportData | public void beginImportData(String resourceGroupName, String name, ImportRDBParameters parameters) {
beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | java | public void beginImportData(String resourceGroupName, String name, ImportRDBParameters parameters) {
beginImportDataWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | [
"public",
"void",
"beginImportData",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"ImportRDBParameters",
"parameters",
")",
"{",
"beginImportDataWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"parameters",
")",
".",
"toBlocking... | Import data into Redis cache.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param parameters Parameters for Redis import 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 | [
"Import",
"data",
"into",
"Redis",
"cache",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1413-L1415 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/JobExecutionState.java | JobExecutionState.awaitForStatePredicate | public void awaitForStatePredicate(Predicate<JobExecutionState> predicate, long timeoutMs)
throws InterruptedException, TimeoutException {
Preconditions.checkArgument(timeoutMs >= 0);
if (0 == timeoutMs) {
timeoutMs = Long.MAX_VALUE;
}
long startTimeMs = System.currentTimeMillis();
long millisRemaining = timeoutMs;
this.changeLock.lock();
try {
while (!predicate.apply(this) && millisRemaining > 0) {
if (!this.runningStateChanged.await(millisRemaining, TimeUnit.MILLISECONDS)) {
// Not necessary but shuts up FindBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
break;
}
millisRemaining = timeoutMs - (System.currentTimeMillis() - startTimeMs);
}
if (!predicate.apply(this)) {
throw new TimeoutException("Timeout waiting for state predicate: " + predicate);
}
}
finally {
this.changeLock.unlock();
}
} | java | public void awaitForStatePredicate(Predicate<JobExecutionState> predicate, long timeoutMs)
throws InterruptedException, TimeoutException {
Preconditions.checkArgument(timeoutMs >= 0);
if (0 == timeoutMs) {
timeoutMs = Long.MAX_VALUE;
}
long startTimeMs = System.currentTimeMillis();
long millisRemaining = timeoutMs;
this.changeLock.lock();
try {
while (!predicate.apply(this) && millisRemaining > 0) {
if (!this.runningStateChanged.await(millisRemaining, TimeUnit.MILLISECONDS)) {
// Not necessary but shuts up FindBugs RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
break;
}
millisRemaining = timeoutMs - (System.currentTimeMillis() - startTimeMs);
}
if (!predicate.apply(this)) {
throw new TimeoutException("Timeout waiting for state predicate: " + predicate);
}
}
finally {
this.changeLock.unlock();
}
} | [
"public",
"void",
"awaitForStatePredicate",
"(",
"Predicate",
"<",
"JobExecutionState",
">",
"predicate",
",",
"long",
"timeoutMs",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"timeoutMs",
">=",
"0",... | Waits till a predicate on {@link #getRunningState()} becomes true or timeout is reached.
@param predicate the predicate to evaluate. Note that even though the predicate
is applied on the entire object, it will be evaluated only when
the running state changes.
@param timeoutMs the number of milliseconds to wait for the predicate to become
true; 0 means wait forever.
@throws InterruptedException if the waiting was interrupted
@throws TimeoutException if we reached the timeout before the predicate was satisfied. | [
"Waits",
"till",
"a",
"predicate",
"on",
"{",
"@link",
"#getRunningState",
"()",
"}",
"becomes",
"true",
"or",
"timeout",
"is",
"reached",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/JobExecutionState.java#L257-L283 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setQueueConfigs | public Config setQueueConfigs(Map<String, QueueConfig> queueConfigs) {
this.queueConfigs.clear();
this.queueConfigs.putAll(queueConfigs);
for (Entry<String, QueueConfig> entry : queueConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setQueueConfigs(Map<String, QueueConfig> queueConfigs) {
this.queueConfigs.clear();
this.queueConfigs.putAll(queueConfigs);
for (Entry<String, QueueConfig> entry : queueConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setQueueConfigs",
"(",
"Map",
"<",
"String",
",",
"QueueConfig",
">",
"queueConfigs",
")",
"{",
"this",
".",
"queueConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"queueConfigs",
".",
"putAll",
"(",
"queueConfigs",
")",
";",
"for",... | Sets the map of {@link com.hazelcast.core.IQueue} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param queueConfigs the queue configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"core",
".",
"IQueue",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"w... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L706-L713 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java | BeansToExcelOnTemplate.directMergeRows | private void directMergeRows(MergeRow mergeRowAnn, int fromRow, int lastRow, int col) {
fixCellValue(mergeRowAnn, fromRow, col);
if (lastRow < fromRow) return;
if (lastRow == fromRow && mergeRowAnn.moreCols() == 0) return;
val c1 = new CellRangeAddress(fromRow, lastRow, col, col + mergeRowAnn.moreCols());
sheet.addMergedRegion(c1);
} | java | private void directMergeRows(MergeRow mergeRowAnn, int fromRow, int lastRow, int col) {
fixCellValue(mergeRowAnn, fromRow, col);
if (lastRow < fromRow) return;
if (lastRow == fromRow && mergeRowAnn.moreCols() == 0) return;
val c1 = new CellRangeAddress(fromRow, lastRow, col, col + mergeRowAnn.moreCols());
sheet.addMergedRegion(c1);
} | [
"private",
"void",
"directMergeRows",
"(",
"MergeRow",
"mergeRowAnn",
",",
"int",
"fromRow",
",",
"int",
"lastRow",
",",
"int",
"col",
")",
"{",
"fixCellValue",
"(",
"mergeRowAnn",
",",
"fromRow",
",",
"col",
")",
";",
"if",
"(",
"lastRow",
"<",
"fromRow",... | 直接纵向合并单元格。
@param mergeRowAnn 纵向合并单元格注解。
@param fromRow 开始合并行索引。
@param lastRow 结束合并行索引。
@param col 纵向列索引。 | [
"直接纵向合并单元格。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L179-L187 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java | HylaFaxJob.setSenderName | public void setSenderName(String senderName)
{
try
{
this.JOB.setFromUser(senderName);
}
catch(Exception exception)
{
throw new FaxException("Error while setting job sender name.",exception);
}
} | java | public void setSenderName(String senderName)
{
try
{
this.JOB.setFromUser(senderName);
}
catch(Exception exception)
{
throw new FaxException("Error while setting job sender name.",exception);
}
} | [
"public",
"void",
"setSenderName",
"(",
"String",
"senderName",
")",
"{",
"try",
"{",
"this",
".",
"JOB",
".",
"setFromUser",
"(",
"senderName",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Error ... | This function sets the fax job sender name.
@param senderName
The fax job sender name | [
"This",
"function",
"sets",
"the",
"fax",
"job",
"sender",
"name",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L246-L256 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.isCounterColumnType | private boolean isCounterColumnType(TableInfo tableInfo, String defaultValidationClass)
{
return (csmd != null && csmd.isCounterColumn(databaseName, tableInfo.getTableName()))
|| (defaultValidationClass != null
&& (defaultValidationClass.equalsIgnoreCase(CounterColumnType.class.getSimpleName()) || defaultValidationClass
.equalsIgnoreCase(CounterColumnType.class.getName())) || (tableInfo.getType()
.equals(CounterColumnType.class.getSimpleName())));
} | java | private boolean isCounterColumnType(TableInfo tableInfo, String defaultValidationClass)
{
return (csmd != null && csmd.isCounterColumn(databaseName, tableInfo.getTableName()))
|| (defaultValidationClass != null
&& (defaultValidationClass.equalsIgnoreCase(CounterColumnType.class.getSimpleName()) || defaultValidationClass
.equalsIgnoreCase(CounterColumnType.class.getName())) || (tableInfo.getType()
.equals(CounterColumnType.class.getSimpleName())));
} | [
"private",
"boolean",
"isCounterColumnType",
"(",
"TableInfo",
"tableInfo",
",",
"String",
"defaultValidationClass",
")",
"{",
"return",
"(",
"csmd",
"!=",
"null",
"&&",
"csmd",
".",
"isCounterColumn",
"(",
"databaseName",
",",
"tableInfo",
".",
"getTableName",
"(... | Checks if is counter column type.
@param tableInfo
the table info
@param defaultValidationClass
the default validation class
@return true, if is counter column type | [
"Checks",
"if",
"is",
"counter",
"column",
"type",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L3225-L3232 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesManagementApi.java | DevicesManagementApi.getTasksAsync | public com.squareup.okhttp.Call getTasksAsync(String dtid, Integer count, Integer offset, String status, String order, String sort, final ApiCallback<TaskListEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getTasksValidateBeforeCall(dtid, count, offset, status, order, sort, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<TaskListEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call getTasksAsync(String dtid, Integer count, Integer offset, String status, String order, String sort, final ApiCallback<TaskListEnvelope> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getTasksValidateBeforeCall(dtid, count, offset, status, order, sort, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<TaskListEnvelope>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"getTasksAsync",
"(",
"String",
"dtid",
",",
"Integer",
"count",
",",
"Integer",
"offset",
",",
"String",
"status",
",",
"String",
"order",
",",
"String",
"sort",
",",
"final",
"ApiCallback",
"<... | Returns the all the tasks for a device type. (asynchronously)
Returns the all the tasks for a device type.
@param dtid Device Type ID. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@param status Status filter. Comma-separated statuses. (optional)
@param order Sort results by a field. Valid fields: createdOn. (optional)
@param sort Sort order. Valid values: asc or desc. (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Returns",
"the",
"all",
"the",
"tasks",
"for",
"a",
"device",
"type",
".",
"(",
"asynchronously",
")",
"Returns",
"the",
"all",
"the",
"tasks",
"for",
"a",
"device",
"type",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1315-L1340 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.invokeConstructor | public MethodHandle invokeConstructor(MethodHandles.Lookup lookup, Class<?> target) throws NoSuchMethodException, IllegalAccessException {
return invoke(lookup.findConstructor(target, type().changeReturnType(void.class)));
} | java | public MethodHandle invokeConstructor(MethodHandles.Lookup lookup, Class<?> target) throws NoSuchMethodException, IllegalAccessException {
return invoke(lookup.findConstructor(target, type().changeReturnType(void.class)));
} | [
"public",
"MethodHandle",
"invokeConstructor",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
"{",
"return",
"invoke",
"(",
"lookup",
".",
"findConstructor"... | Apply the chain of transforms and bind them to a constructor specified
using the end signature plus the given class. The constructor will
be retrieved using the given Lookup and must match the end signature's
arguments exactly.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
@param lookup the MethodHandles.Lookup to use to look up the constructor
@param target the constructor's class
@return the full handle chain, bound to the given constructor
@throws java.lang.NoSuchMethodException if the constructor does not exist
@throws java.lang.IllegalAccessException if the constructor is not accessible | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"a",
"constructor",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
".",
"The",
"constructor",
"will",
"be",
"retrieved",
"using",
"the",
"given",
"Lo... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1342-L1344 |
apptik/jus | rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java | RxRequestQueue.errorObservable | public static Observable<ErrorEvent> errorObservable(
RequestQueue queue, RequestQueue.RequestFilter filter) {
return Observable.create(new QRequestErrorOnSubscribe(queue, filter));
} | java | public static Observable<ErrorEvent> errorObservable(
RequestQueue queue, RequestQueue.RequestFilter filter) {
return Observable.create(new QRequestErrorOnSubscribe(queue, filter));
} | [
"public",
"static",
"Observable",
"<",
"ErrorEvent",
">",
"errorObservable",
"(",
"RequestQueue",
"queue",
",",
"RequestQueue",
".",
"RequestFilter",
"filter",
")",
"{",
"return",
"Observable",
".",
"create",
"(",
"new",
"QRequestErrorOnSubscribe",
"(",
"queue",
"... | Returns {@link Observable} of error events coming as {@link ErrorEvent}
@param queue the {@link RequestQueue} to listen to
@param filter the {@link io.apptik.comm.jus.RequestQueue.RequestFilter} which will filter
the requests to hook to. Set null for no filtering.
@return {@link Observable} of errors | [
"Returns",
"{",
"@link",
"Observable",
"}",
"of",
"error",
"events",
"coming",
"as",
"{",
"@link",
"ErrorEvent",
"}"
] | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java#L76-L79 |
graknlabs/grakn | server/src/graql/gremlin/TraversalPlanner.java | TraversalPlanner.createTraversal | public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) {
Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns();
Set<? extends List<Fragment>> fragments = patterns.stream()
.map(conjunction -> new ConjunctionQuery(conjunction, tx))
.map((ConjunctionQuery query) -> planForConjunction(query, tx))
.collect(toImmutableSet());
return GraqlTraversal.create(fragments);
} | java | public static GraqlTraversal createTraversal(Pattern pattern, TransactionOLTP tx) {
Collection<Conjunction<Statement>> patterns = pattern.getDisjunctiveNormalForm().getPatterns();
Set<? extends List<Fragment>> fragments = patterns.stream()
.map(conjunction -> new ConjunctionQuery(conjunction, tx))
.map((ConjunctionQuery query) -> planForConjunction(query, tx))
.collect(toImmutableSet());
return GraqlTraversal.create(fragments);
} | [
"public",
"static",
"GraqlTraversal",
"createTraversal",
"(",
"Pattern",
"pattern",
",",
"TransactionOLTP",
"tx",
")",
"{",
"Collection",
"<",
"Conjunction",
"<",
"Statement",
">>",
"patterns",
"=",
"pattern",
".",
"getDisjunctiveNormalForm",
"(",
")",
".",
"getPa... | Create a traversal plan.
@param pattern a pattern to find a query plan for
@return a semi-optimal traversal plan | [
"Create",
"a",
"traversal",
"plan",
"."
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L77-L86 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/model/CMAWebhook.java | CMAWebhook.addHeader | public CMAWebhook addHeader(String key, String value) {
if (this.headers == null) {
this.headers = new ArrayList<CMAWebhookHeader>();
}
this.headers.add(new CMAWebhookHeader(key, value));
return this;
} | java | public CMAWebhook addHeader(String key, String value) {
if (this.headers == null) {
this.headers = new ArrayList<CMAWebhookHeader>();
}
this.headers.add(new CMAWebhookHeader(key, value));
return this;
} | [
"public",
"CMAWebhook",
"addHeader",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"headers",
"==",
"null",
")",
"{",
"this",
".",
"headers",
"=",
"new",
"ArrayList",
"<",
"CMAWebhookHeader",
">",
"(",
")",
";",
"}",
... | Adds a custom http header to the call done by this webhook.
@param key HTTP header key to be used (aka 'X-My-Header-Name')
@param value HTTP header value to be used (aka 'this-is-my-name')
@return this webhook for chaining. | [
"Adds",
"a",
"custom",
"http",
"header",
"to",
"the",
"call",
"done",
"by",
"this",
"webhook",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/CMAWebhook.java#L115-L122 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/send/ComQuery.java | ComQuery.sendMultiDirect | public static void sendMultiDirect(final PacketOutputStream pos, List<byte[]> sqlBytes)
throws IOException {
pos.startPacket(0);
pos.write(Packet.COM_QUERY);
for (byte[] bytes : sqlBytes) {
pos.write(bytes);
}
pos.flush();
} | java | public static void sendMultiDirect(final PacketOutputStream pos, List<byte[]> sqlBytes)
throws IOException {
pos.startPacket(0);
pos.write(Packet.COM_QUERY);
for (byte[] bytes : sqlBytes) {
pos.write(bytes);
}
pos.flush();
} | [
"public",
"static",
"void",
"sendMultiDirect",
"(",
"final",
"PacketOutputStream",
"pos",
",",
"List",
"<",
"byte",
"[",
"]",
">",
"sqlBytes",
")",
"throws",
"IOException",
"{",
"pos",
".",
"startPacket",
"(",
"0",
")",
";",
"pos",
".",
"write",
"(",
"Pa... | Send directly to socket the sql data.
@param pos output stream
@param sqlBytes the query in UTF-8 bytes
@throws IOException if connection error occur | [
"Send",
"directly",
"to",
"socket",
"the",
"sql",
"data",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/send/ComQuery.java#L331-L339 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java | AzureFirewallsInner.getByResourceGroupAsync | public Observable<AzureFirewallInner> getByResourceGroupAsync(String resourceGroupName, String azureFirewallName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).map(new Func1<ServiceResponse<AzureFirewallInner>, AzureFirewallInner>() {
@Override
public AzureFirewallInner call(ServiceResponse<AzureFirewallInner> response) {
return response.body();
}
});
} | java | public Observable<AzureFirewallInner> getByResourceGroupAsync(String resourceGroupName, String azureFirewallName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).map(new Func1<ServiceResponse<AzureFirewallInner>, AzureFirewallInner>() {
@Override
public AzureFirewallInner call(ServiceResponse<AzureFirewallInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AzureFirewallInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"azureFirewallName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"azureFirewallName",
")"... | Gets the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AzureFirewallInner object | [
"Gets",
"the",
"specified",
"Azure",
"Firewall",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java#L291-L298 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java | LocalDateTime.plusMonths | public LocalDateTime plusMonths(long months) {
LocalDate newDate = date.plusMonths(months);
return with(newDate, time);
} | java | public LocalDateTime plusMonths(long months) {
LocalDate newDate = date.plusMonths(months);
return with(newDate, time);
} | [
"public",
"LocalDateTime",
"plusMonths",
"(",
"long",
"months",
")",
"{",
"LocalDate",
"newDate",
"=",
"date",
".",
"plusMonths",
"(",
"months",
")",
";",
"return",
"with",
"(",
"newDate",
",",
"time",
")",
";",
"}"
] | Returns a copy of this {@code LocalDateTime} with the specified number of months added.
<p>
This method adds the specified amount to the months field in three steps:
<ol>
<li>Add the input months to the month-of-year field</li>
<li>Check if the resulting date would be invalid</li>
<li>Adjust the day-of-month to the last valid day if necessary</li>
</ol>
<p>
For example, 2007-03-31 plus one month would result in the invalid date
2007-04-31. Instead of returning an invalid result, the last valid day
of the month, 2007-04-30, is selected instead.
<p>
This instance is immutable and unaffected by this method call.
@param months the months to add, may be negative
@return a {@code LocalDateTime} based on this date-time with the months added, not null
@throws DateTimeException if the result exceeds the supported date range | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalDateTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"months",
"added",
".",
"<p",
">",
"This",
"method",
"adds",
"the",
"specified",
"amount",
"to",
"the",
"months",
"field",
"in",
"three",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1239-L1242 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mox/VirtualMachineDeviceManager.java | VirtualMachineDeviceManager.createNetworkAdapter | public void createNetworkAdapter(VirtualNetworkAdapterType type, String networkName, String macAddress, boolean wakeOnLan, boolean startConnected) throws InvalidProperty, RuntimeFault, RemoteException, InterruptedException {
VirtualMachinePowerState powerState = vm.getRuntime().getPowerState();
String vmVerStr = vm.getConfig().getVersion();
int vmVer = Integer.parseInt(vmVerStr.substring(vmVerStr.length() - 2));
if ((powerState == VirtualMachinePowerState.suspended)) {
throw new InvalidPowerState();
}
HostSystem host = new HostSystem(vm.getServerConnection(), vm.getRuntime().getHost());
ComputeResource cr = (ComputeResource) host.getParent();
EnvironmentBrowser envBrowser = cr.getEnvironmentBrowser();
ConfigTarget configTarget = envBrowser.queryConfigTarget(host);
VirtualMachineConfigOption vmCfgOpt = envBrowser.queryConfigOption(null, host);
type = validateNicType(vmCfgOpt.getGuestOSDescriptor(), vm.getConfig().getGuestId(), type);
VirtualDeviceConfigSpec nicSpec = createNicSpec(type, networkName, macAddress, wakeOnLan, startConnected, configTarget);
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec[]{nicSpec});
Task task = vm.reconfigVM_Task(vmConfigSpec);
task.waitForTask(200, 100);
} | java | public void createNetworkAdapter(VirtualNetworkAdapterType type, String networkName, String macAddress, boolean wakeOnLan, boolean startConnected) throws InvalidProperty, RuntimeFault, RemoteException, InterruptedException {
VirtualMachinePowerState powerState = vm.getRuntime().getPowerState();
String vmVerStr = vm.getConfig().getVersion();
int vmVer = Integer.parseInt(vmVerStr.substring(vmVerStr.length() - 2));
if ((powerState == VirtualMachinePowerState.suspended)) {
throw new InvalidPowerState();
}
HostSystem host = new HostSystem(vm.getServerConnection(), vm.getRuntime().getHost());
ComputeResource cr = (ComputeResource) host.getParent();
EnvironmentBrowser envBrowser = cr.getEnvironmentBrowser();
ConfigTarget configTarget = envBrowser.queryConfigTarget(host);
VirtualMachineConfigOption vmCfgOpt = envBrowser.queryConfigOption(null, host);
type = validateNicType(vmCfgOpt.getGuestOSDescriptor(), vm.getConfig().getGuestId(), type);
VirtualDeviceConfigSpec nicSpec = createNicSpec(type, networkName, macAddress, wakeOnLan, startConnected, configTarget);
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec[]{nicSpec});
Task task = vm.reconfigVM_Task(vmConfigSpec);
task.waitForTask(200, 100);
} | [
"public",
"void",
"createNetworkAdapter",
"(",
"VirtualNetworkAdapterType",
"type",
",",
"String",
"networkName",
",",
"String",
"macAddress",
",",
"boolean",
"wakeOnLan",
",",
"boolean",
"startConnected",
")",
"throws",
"InvalidProperty",
",",
"RuntimeFault",
",",
"R... | Create a new virtual network adapter on the VM
Your MAC address should start with 00:50:56 | [
"Create",
"a",
"new",
"virtual",
"network",
"adapter",
"on",
"the",
"VM",
"Your",
"MAC",
"address",
"should",
"start",
"with",
"00",
":",
"50",
":",
"56"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mox/VirtualMachineDeviceManager.java#L449-L473 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java | MiniTemplator.setVariable | public void setVariable(String variableName, String variableValue) throws VariableNotDefinedException {
setVariable(variableName, variableValue, false);
} | java | public void setVariable(String variableName, String variableValue) throws VariableNotDefinedException {
setVariable(variableName, variableValue, false);
} | [
"public",
"void",
"setVariable",
"(",
"String",
"variableName",
",",
"String",
"variableValue",
")",
"throws",
"VariableNotDefinedException",
"{",
"setVariable",
"(",
"variableName",
",",
"variableValue",
",",
"false",
")",
";",
"}"
] | Sets a template variable.
<p>
Convenience method for: <code>setVariable (variableName, variableValue, false)</code>
@param variableName the name of the variable to be set. Case-insensitive.
@param variableValue the new value of the variable. May be <code>null</code>.
@throws VariableNotDefinedException when no variable with the specified name exists in the template.
@see #setVariable(String, String, boolean) | [
"Sets",
"a",
"template",
"variable",
".",
"<p",
">",
"Convenience",
"method",
"for",
":",
"<code",
">",
"setVariable",
"(",
"variableName",
"variableValue",
"false",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java#L387-L389 |
jglobus/JGlobus | gss/src/main/java/org/globus/gsi/gssapi/GlobusGSSContextImpl.java | GlobusGSSContextImpl.getMIC | public byte[] getMIC(byte [] inBuf,
int off,
int len,
MessageProp prop)
throws GSSException {
throw new GSSException(GSSException.UNAVAILABLE);
/*TODO
checkContext();
logger.debug("enter getMic");
if (prop != null && (prop.getQOP() != 0 || prop.getPrivacy())) {
throw new GSSException(GSSException.BAD_QOP);
}
SSLCipherState st = this.conn.getWriteCipherState();
SSLCipherSuite cs = st.getCipherSuite();
long sequence = this.conn.getWriteSequence();
byte [] mic = new byte[GSI_MESSAGE_DIGEST_PADDING + cs.getDigestOutputLength()];
System.arraycopy(Util.toBytes(sequence), 0, mic, 0, GSI_SEQUENCE_SIZE);
System.arraycopy(Util.toBytes(len, 4), 0, mic, GSI_SEQUENCE_SIZE, 4);
this.conn.incrementWriteSequence();
int pad_ct = (cs.getDigestOutputLength()==16) ? 48 : 40;
try {
MessageDigest md =
MessageDigest.getInstance(cs.getDigestAlg());
md.update(st.getMacKey());
for(int i=0;i<pad_ct;i++) {
md.update(SSLHandshake.pad_1);
}
md.update(mic, 0, GSI_MESSAGE_DIGEST_PADDING);
md.update(inBuf, off, len);
byte[] digest = md.digest();
System.arraycopy(digest, 0, mic, GSI_MESSAGE_DIGEST_PADDING, digest.length);
} catch (NoSuchAlgorithmException e) {
throw new GlobusGSSException(GSSException.FAILURE, e);
}
if (prop != null) {
prop.setPrivacy(false);
prop.setQOP(0);
}
logger.debug("exit getMic");
return mic;
*/
} | java | public byte[] getMIC(byte [] inBuf,
int off,
int len,
MessageProp prop)
throws GSSException {
throw new GSSException(GSSException.UNAVAILABLE);
/*TODO
checkContext();
logger.debug("enter getMic");
if (prop != null && (prop.getQOP() != 0 || prop.getPrivacy())) {
throw new GSSException(GSSException.BAD_QOP);
}
SSLCipherState st = this.conn.getWriteCipherState();
SSLCipherSuite cs = st.getCipherSuite();
long sequence = this.conn.getWriteSequence();
byte [] mic = new byte[GSI_MESSAGE_DIGEST_PADDING + cs.getDigestOutputLength()];
System.arraycopy(Util.toBytes(sequence), 0, mic, 0, GSI_SEQUENCE_SIZE);
System.arraycopy(Util.toBytes(len, 4), 0, mic, GSI_SEQUENCE_SIZE, 4);
this.conn.incrementWriteSequence();
int pad_ct = (cs.getDigestOutputLength()==16) ? 48 : 40;
try {
MessageDigest md =
MessageDigest.getInstance(cs.getDigestAlg());
md.update(st.getMacKey());
for(int i=0;i<pad_ct;i++) {
md.update(SSLHandshake.pad_1);
}
md.update(mic, 0, GSI_MESSAGE_DIGEST_PADDING);
md.update(inBuf, off, len);
byte[] digest = md.digest();
System.arraycopy(digest, 0, mic, GSI_MESSAGE_DIGEST_PADDING, digest.length);
} catch (NoSuchAlgorithmException e) {
throw new GlobusGSSException(GSSException.FAILURE, e);
}
if (prop != null) {
prop.setPrivacy(false);
prop.setQOP(0);
}
logger.debug("exit getMic");
return mic;
*/
} | [
"public",
"byte",
"[",
"]",
"getMIC",
"(",
"byte",
"[",
"]",
"inBuf",
",",
"int",
"off",
",",
"int",
"len",
",",
"MessageProp",
"prop",
")",
"throws",
"GSSException",
"{",
"throw",
"new",
"GSSException",
"(",
"GSSException",
".",
"UNAVAILABLE",
")",
";",... | Returns a cryptographic MIC (message integrity check)
of a specified message. | [
"Returns",
"a",
"cryptographic",
"MIC",
"(",
"message",
"integrity",
"check",
")",
"of",
"a",
"specified",
"message",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/GlobusGSSContextImpl.java#L1771-L1826 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java | NetworkInterfaceTapConfigurationsInner.getAsync | public Observable<NetworkInterfaceTapConfigurationInner> getAsync(String resourceGroupName, String networkInterfaceName, String tapConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName).map(new Func1<ServiceResponse<NetworkInterfaceTapConfigurationInner>, NetworkInterfaceTapConfigurationInner>() {
@Override
public NetworkInterfaceTapConfigurationInner call(ServiceResponse<NetworkInterfaceTapConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkInterfaceTapConfigurationInner> getAsync(String resourceGroupName, String networkInterfaceName, String tapConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tapConfigurationName).map(new Func1<ServiceResponse<NetworkInterfaceTapConfigurationInner>, NetworkInterfaceTapConfigurationInner>() {
@Override
public NetworkInterfaceTapConfigurationInner call(ServiceResponse<NetworkInterfaceTapConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkInterfaceTapConfigurationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
",",
"String",
"tapConfigurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName"... | Get the specified tap configuration on a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param tapConfigurationName The name of the tap configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkInterfaceTapConfigurationInner object | [
"Get",
"the",
"specified",
"tap",
"configuration",
"on",
"a",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkInterfaceTapConfigurationsInner.java#L297-L304 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateEntityAsync | public Observable<OperationStatus> updateEntityAsync(UUID appId, String versionId, UUID entityId, UpdateEntityOptionalParameter updateEntityOptionalParameter) {
return updateEntityWithServiceResponseAsync(appId, versionId, entityId, updateEntityOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateEntityAsync(UUID appId, String versionId, UUID entityId, UpdateEntityOptionalParameter updateEntityOptionalParameter) {
return updateEntityWithServiceResponseAsync(appId, versionId, entityId, updateEntityOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UpdateEntityOptionalParameter",
"updateEntityOptionalParameter",
")",
"{",
"return",
"updateEntityWithServiceResponseAs... | Updates the name of an entity extractor.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity extractor ID.
@param updateEntityOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"the",
"name",
"of",
"an",
"entity",
"extractor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3407-L3414 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java | OAuth20Utils.writeError | public static ModelAndView writeError(final HttpServletResponse response, final String error) {
val model = CollectionUtils.wrap(OAuth20Constants.ERROR, error);
val mv = new ModelAndView(new MappingJackson2JsonView(MAPPER), (Map) model);
mv.setStatus(HttpStatus.BAD_REQUEST);
response.setStatus(HttpStatus.BAD_REQUEST.value());
return mv;
} | java | public static ModelAndView writeError(final HttpServletResponse response, final String error) {
val model = CollectionUtils.wrap(OAuth20Constants.ERROR, error);
val mv = new ModelAndView(new MappingJackson2JsonView(MAPPER), (Map) model);
mv.setStatus(HttpStatus.BAD_REQUEST);
response.setStatus(HttpStatus.BAD_REQUEST.value());
return mv;
} | [
"public",
"static",
"ModelAndView",
"writeError",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"error",
")",
"{",
"val",
"model",
"=",
"CollectionUtils",
".",
"wrap",
"(",
"OAuth20Constants",
".",
"ERROR",
",",
"error",
")",
";",
"v... | Write to the output this error.
@param response the response
@param error error message
@return json -backed view. | [
"Write",
"to",
"the",
"output",
"this",
"error",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java#L61-L67 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java | ActiveSyncManager.applyAndJournal | public void applyAndJournal(Supplier<JournalContext> context, AddSyncPointEntry entry) {
try {
apply(entry);
context.get().append(Journal.JournalEntry.newBuilder().setAddSyncPoint(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} | java | public void applyAndJournal(Supplier<JournalContext> context, AddSyncPointEntry entry) {
try {
apply(entry);
context.get().append(Journal.JournalEntry.newBuilder().setAddSyncPoint(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} | [
"public",
"void",
"applyAndJournal",
"(",
"Supplier",
"<",
"JournalContext",
">",
"context",
",",
"AddSyncPointEntry",
"entry",
")",
"{",
"try",
"{",
"apply",
"(",
"entry",
")",
";",
"context",
".",
"get",
"(",
")",
".",
"append",
"(",
"Journal",
".",
"J... | Apply AddSyncPoint entry and journal the entry.
@param context journal context
@param entry addSyncPoint entry | [
"Apply",
"AddSyncPoint",
"entry",
"and",
"journal",
"the",
"entry",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L232-L240 |
jdereg/java-util | src/main/java/com/cedarsoftware/util/DeepEquals.java | DeepEquals.nearlyEqual | private static boolean nearlyEqual(double a, double b, double epsilon)
{
final double absA = Math.abs(a);
final double absB = Math.abs(b);
final double diff = Math.abs(a - b);
if (a == b)
{ // shortcut, handles infinities
return true;
}
else if (a == 0 || b == 0 || diff < Double.MIN_NORMAL)
{
// a or b is zero or both are extremely close to it
// relative error is less meaningful here
return diff < (epsilon * Double.MIN_NORMAL);
}
else
{ // use relative error
return diff / (absA + absB) < epsilon;
}
} | java | private static boolean nearlyEqual(double a, double b, double epsilon)
{
final double absA = Math.abs(a);
final double absB = Math.abs(b);
final double diff = Math.abs(a - b);
if (a == b)
{ // shortcut, handles infinities
return true;
}
else if (a == 0 || b == 0 || diff < Double.MIN_NORMAL)
{
// a or b is zero or both are extremely close to it
// relative error is less meaningful here
return diff < (epsilon * Double.MIN_NORMAL);
}
else
{ // use relative error
return diff / (absA + absB) < epsilon;
}
} | [
"private",
"static",
"boolean",
"nearlyEqual",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"epsilon",
")",
"{",
"final",
"double",
"absA",
"=",
"Math",
".",
"abs",
"(",
"a",
")",
";",
"final",
"double",
"absB",
"=",
"Math",
".",
"abs",
"("... | Correctly handles floating point comparisions. <br>
source: http://floating-point-gui.de/errors/comparison/
@param a first number
@param b second number
@param epsilon double tolerance value
@return true if a and b are close enough | [
"Correctly",
"handles",
"floating",
"point",
"comparisions",
".",
"<br",
">",
"source",
":",
"http",
":",
"//",
"floating",
"-",
"point",
"-",
"gui",
".",
"de",
"/",
"errors",
"/",
"comparison",
"/"
] | train | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L652-L672 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java | DefaultPluginRegistry.readPluginFile | protected Plugin readPluginFile(PluginCoordinates coordinates, File pluginFile) throws Exception {
try {
PluginClassLoader pluginClassLoader = createPluginClassLoader(pluginFile);
URL specFile = pluginClassLoader.getResource(PluginUtils.PLUGIN_SPEC_PATH);
if (specFile == null) {
throw new Exception(Messages.i18n.format("DefaultPluginRegistry.MissingPluginSpecFile", PluginUtils.PLUGIN_SPEC_PATH)); //$NON-NLS-1$
} else {
PluginSpec spec = PluginUtils.readPluginSpecFile(specFile);
Plugin plugin = new Plugin(spec, coordinates, pluginClassLoader);
// TODO use logger when available
System.out.println("Read apiman plugin: " + spec); //$NON-NLS-1$
return plugin;
}
} catch (Exception e) {
throw new Exception(Messages.i18n.format("DefaultPluginRegistry.InvalidPlugin", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$
}
} | java | protected Plugin readPluginFile(PluginCoordinates coordinates, File pluginFile) throws Exception {
try {
PluginClassLoader pluginClassLoader = createPluginClassLoader(pluginFile);
URL specFile = pluginClassLoader.getResource(PluginUtils.PLUGIN_SPEC_PATH);
if (specFile == null) {
throw new Exception(Messages.i18n.format("DefaultPluginRegistry.MissingPluginSpecFile", PluginUtils.PLUGIN_SPEC_PATH)); //$NON-NLS-1$
} else {
PluginSpec spec = PluginUtils.readPluginSpecFile(specFile);
Plugin plugin = new Plugin(spec, coordinates, pluginClassLoader);
// TODO use logger when available
System.out.println("Read apiman plugin: " + spec); //$NON-NLS-1$
return plugin;
}
} catch (Exception e) {
throw new Exception(Messages.i18n.format("DefaultPluginRegistry.InvalidPlugin", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$
}
} | [
"protected",
"Plugin",
"readPluginFile",
"(",
"PluginCoordinates",
"coordinates",
",",
"File",
"pluginFile",
")",
"throws",
"Exception",
"{",
"try",
"{",
"PluginClassLoader",
"pluginClassLoader",
"=",
"createPluginClassLoader",
"(",
"pluginFile",
")",
";",
"URL",
"spe... | Reads the plugin into an object. This method will fail if the plugin is not valid.
This could happen if the file is not a java archive, or if the plugin spec file is
missing from the archive, etc. | [
"Reads",
"the",
"plugin",
"into",
"an",
"object",
".",
"This",
"method",
"will",
"fail",
"if",
"the",
"plugin",
"is",
"not",
"valid",
".",
"This",
"could",
"happen",
"if",
"the",
"file",
"is",
"not",
"a",
"java",
"archive",
"or",
"if",
"the",
"plugin",... | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java#L298-L314 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java | RedisInner.beginCreate | public RedisResourceInner beginCreate(String resourceGroupName, String name, RedisCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | java | public RedisResourceInner beginCreate(String resourceGroupName, String name, RedisCreateParameters parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body();
} | [
"public",
"RedisResourceInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"RedisCreateParameters",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"parameters",
")",
... | Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param parameters Parameters supplied to the Create Redis 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 RedisResourceInner object if successful. | [
"Create",
"or",
"replace",
"(",
"overwrite",
"/",
"recreate",
"with",
"potential",
"downtime",
")",
"an",
"existing",
"Redis",
"cache",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L412-L414 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java | MustBeClosedChecker.matchNewClass | @Override
public Description matchNewClass(NewClassTree tree, VisitorState state) {
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
return NO_MATCH;
}
return matchNewClassOrMethodInvocation(tree, state);
} | java | @Override
public Description matchNewClass(NewClassTree tree, VisitorState state) {
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
return NO_MATCH;
}
return matchNewClassOrMethodInvocation(tree, state);
} | [
"@",
"Override",
"public",
"Description",
"matchNewClass",
"(",
"NewClassTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"!",
"HAS_MUST_BE_CLOSED_ANNOTATION",
".",
"matches",
"(",
"tree",
",",
"state",
")",
")",
"{",
"return",
"NO_MATCH",
";"... | Check that construction of constructors annotated with {@link MustBeClosed} occurs within the
resource variable initializer of a try-with-resources statement. | [
"Check",
"that",
"construction",
"of",
"constructors",
"annotated",
"with",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java#L123-L129 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java | Price.createFromNetAmount | @Nonnull
public static Price createFromNetAmount (@Nonnull final ICurrencyValue aNetAmount, @Nonnull final IVATItem aVATItem)
{
return new Price (aNetAmount, aVATItem);
} | java | @Nonnull
public static Price createFromNetAmount (@Nonnull final ICurrencyValue aNetAmount, @Nonnull final IVATItem aVATItem)
{
return new Price (aNetAmount, aVATItem);
} | [
"@",
"Nonnull",
"public",
"static",
"Price",
"createFromNetAmount",
"(",
"@",
"Nonnull",
"final",
"ICurrencyValue",
"aNetAmount",
",",
"@",
"Nonnull",
"final",
"IVATItem",
"aVATItem",
")",
"{",
"return",
"new",
"Price",
"(",
"aNetAmount",
",",
"aVATItem",
")",
... | Create a price from a net amount.
@param aNetAmount
The net amount to use. May not be <code>null</code>.
@param aVATItem
The VAT item to use. May not be <code>null</code>.
@return The created {@link Price} | [
"Create",
"a",
"price",
"from",
"a",
"net",
"amount",
"."
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java#L246-L250 |
BoltsFramework/Bolts-Android | bolts-tasks/src/main/java/bolts/Task.java | Task.continueWhile | public Task<Void> continueWhile(Callable<Boolean> predicate,
Continuation<Void, Task<Void>> continuation, CancellationToken ct) {
return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct);
} | java | public Task<Void> continueWhile(Callable<Boolean> predicate,
Continuation<Void, Task<Void>> continuation, CancellationToken ct) {
return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct);
} | [
"public",
"Task",
"<",
"Void",
">",
"continueWhile",
"(",
"Callable",
"<",
"Boolean",
">",
"predicate",
",",
"Continuation",
"<",
"Void",
",",
"Task",
"<",
"Void",
">",
">",
"continuation",
",",
"CancellationToken",
"ct",
")",
"{",
"return",
"continueWhile",... | Continues a task with the equivalent of a Task-based while loop, where the body of the loop is
a task continuation. | [
"Continues",
"a",
"task",
"with",
"the",
"equivalent",
"of",
"a",
"Task",
"-",
"based",
"while",
"loop",
"where",
"the",
"body",
"of",
"the",
"loop",
"is",
"a",
"task",
"continuation",
"."
] | train | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L585-L588 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/PatientXmlWriter.java | PatientXmlWriter.convertSyntaxException | protected NaaccrIOException convertSyntaxException(ConversionException ex) {
String msg = ex.get("message");
if (msg == null)
msg = ex.getMessage();
NaaccrIOException e = new NaaccrIOException(msg, ex);
if (ex.get("line number") != null)
e.setLineNumber(Integer.valueOf(ex.get("line number")));
e.setPath(ex.get("path"));
return e;
} | java | protected NaaccrIOException convertSyntaxException(ConversionException ex) {
String msg = ex.get("message");
if (msg == null)
msg = ex.getMessage();
NaaccrIOException e = new NaaccrIOException(msg, ex);
if (ex.get("line number") != null)
e.setLineNumber(Integer.valueOf(ex.get("line number")));
e.setPath(ex.get("path"));
return e;
} | [
"protected",
"NaaccrIOException",
"convertSyntaxException",
"(",
"ConversionException",
"ex",
")",
"{",
"String",
"msg",
"=",
"ex",
".",
"get",
"(",
"\"message\"",
")",
";",
"if",
"(",
"msg",
"==",
"null",
")",
"msg",
"=",
"ex",
".",
"getMessage",
"(",
")"... | We don't want to expose the conversion exceptions, so let's translate them into our own exceptions... | [
"We",
"don",
"t",
"want",
"to",
"expose",
"the",
"conversion",
"exceptions",
"so",
"let",
"s",
"translate",
"them",
"into",
"our",
"own",
"exceptions",
"..."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/PatientXmlWriter.java#L268-L277 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/util/MainApplication.java | MainApplication.setProperty | public void setProperty(String strProperty, String strValue)
{
if (this.getSystemRecordOwner() != null)
this.getSystemRecordOwner().setProperty(strProperty, strValue); // Note: This is where the user properies are.
super.setProperty(strProperty, strValue);
} | java | public void setProperty(String strProperty, String strValue)
{
if (this.getSystemRecordOwner() != null)
this.getSystemRecordOwner().setProperty(strProperty, strValue); // Note: This is where the user properies are.
super.setProperty(strProperty, strValue);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"strProperty",
",",
"String",
"strValue",
")",
"{",
"if",
"(",
"this",
".",
"getSystemRecordOwner",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getSystemRecordOwner",
"(",
")",
".",
"setProperty",
"(",
"strPrope... | Set this property.
@param strProperty The property key.
@param strValue The property value. | [
"Set",
"this",
"property",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L560-L565 |
RestComm/jss7 | map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java | MAPDialogImpl.getMessageUserDataLengthOnClose | public int getMessageUserDataLengthOnClose(boolean prearrangedEnd) throws MAPException {
if (prearrangedEnd)
// we do not send any data in prearrangedEnd dialog termination
return 0;
try {
switch (this.tcapDialog.getState()) {
case InitialReceived:
ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory()
.createApplicationContextName(this.appCntx.getOID());
TCEndRequest te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), true, prearrangedEnd, acn,
this.extContainer);
return tcapDialog.getDataLength(te);
case Active:
te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), false, prearrangedEnd, null, null);
return tcapDialog.getDataLength(te);
}
} catch (TCAPSendException e) {
throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e);
}
throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState());
} | java | public int getMessageUserDataLengthOnClose(boolean prearrangedEnd) throws MAPException {
if (prearrangedEnd)
// we do not send any data in prearrangedEnd dialog termination
return 0;
try {
switch (this.tcapDialog.getState()) {
case InitialReceived:
ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory()
.createApplicationContextName(this.appCntx.getOID());
TCEndRequest te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), true, prearrangedEnd, acn,
this.extContainer);
return tcapDialog.getDataLength(te);
case Active:
te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), false, prearrangedEnd, null, null);
return tcapDialog.getDataLength(te);
}
} catch (TCAPSendException e) {
throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e);
}
throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState());
} | [
"public",
"int",
"getMessageUserDataLengthOnClose",
"(",
"boolean",
"prearrangedEnd",
")",
"throws",
"MAPException",
"{",
"if",
"(",
"prearrangedEnd",
")",
"// we do not send any data in prearrangedEnd dialog termination",
"return",
"0",
";",
"try",
"{",
"switch",
"(",
"t... | Return the MAP message length (in bytes) that will be after encoding if TC-END case This value must not exceed
getMaxUserDataLength() value
@param prearrangedEnd
@return | [
"Return",
"the",
"MAP",
"message",
"length",
"(",
"in",
"bytes",
")",
"that",
"will",
"be",
"after",
"encoding",
"if",
"TC",
"-",
"END",
"case",
"This",
"value",
"must",
"not",
"exceed",
"getMaxUserDataLength",
"()",
"value"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java#L649-L674 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.