repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveTask.java | HiveTask.addFile | public static void addFile(State state, String file) {
state.setProp(ADD_FILES, state.getProp(ADD_FILES, "") + "," + file);
} | java | public static void addFile(State state, String file) {
state.setProp(ADD_FILES, state.getProp(ADD_FILES, "") + "," + file);
} | [
"public",
"static",
"void",
"addFile",
"(",
"State",
"state",
",",
"String",
"file",
")",
"{",
"state",
".",
"setProp",
"(",
"ADD_FILES",
",",
"state",
".",
"getProp",
"(",
"ADD_FILES",
",",
"\"\"",
")",
"+",
"\",\"",
"+",
"file",
")",
";",
"}"
] | Add the input file to the Hive session before running the task. | [
"Add",
"the",
"input",
"file",
"to",
"the",
"Hive",
"session",
"before",
"running",
"the",
"task",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveTask.java#L73-L75 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java | MongoDBQuery.getKeys | private BasicDBObject getKeys(EntityMetadata m, String[] columns)
{
BasicDBObject keys = new BasicDBObject();
if (columns != null && columns.length > 0)
{
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(m.getPersistenceUnit());
EntityType entity = metaModel.entity(m.getEntityClazz());
for (int i = 1; i < columns.length; i++)
{
if (columns[i] != null)
{
Attribute col = entity.getAttribute(columns[i]);
if (col == null)
{
throw new QueryHandlerException("column type is null for: " + columns);
}
keys.put(((AbstractAttribute) col).getJPAColumnName(), 1);
}
}
}
return keys;
} | java | private BasicDBObject getKeys(EntityMetadata m, String[] columns)
{
BasicDBObject keys = new BasicDBObject();
if (columns != null && columns.length > 0)
{
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(m.getPersistenceUnit());
EntityType entity = metaModel.entity(m.getEntityClazz());
for (int i = 1; i < columns.length; i++)
{
if (columns[i] != null)
{
Attribute col = entity.getAttribute(columns[i]);
if (col == null)
{
throw new QueryHandlerException("column type is null for: " + columns);
}
keys.put(((AbstractAttribute) col).getJPAColumnName(), 1);
}
}
}
return keys;
} | [
"private",
"BasicDBObject",
"getKeys",
"(",
"EntityMetadata",
"m",
",",
"String",
"[",
"]",
"columns",
")",
"{",
"BasicDBObject",
"keys",
"=",
"new",
"BasicDBObject",
"(",
")",
";",
"if",
"(",
"columns",
"!=",
"null",
"&&",
"columns",
".",
"length",
">",
... | Gets the keys.
@param m
the m
@param columns
the columns
@return the keys | [
"Gets",
"the",
"keys",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L804-L826 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateKey | public KeyBundle updateKey(String vaultBaseUrl, String keyName, String keyVersion, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) {
return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, keyOps, keyAttributes, tags).toBlocking().single().body();
} | java | public KeyBundle updateKey(String vaultBaseUrl, String keyName, String keyVersion, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) {
return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, keyOps, keyAttributes, tags).toBlocking().single().body();
} | [
"public",
"KeyBundle",
"updateKey",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
",",
"List",
"<",
"JsonWebKeyOperation",
">",
"keyOps",
",",
"KeyAttributes",
"keyAttributes",
",",
"Map",
"<",
"String",
",",
"String",
">"... | The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault.
In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of key to update.
@param keyVersion The version of the key to update.
@param keyOps Json web key operations. For more information on possible key operations, see JsonWebKeyOperation.
@param keyAttributes the KeyAttributes value
@param tags Application specific metadata in the form of key-value pairs.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the KeyBundle object if successful. | [
"The",
"update",
"key",
"operation",
"changes",
"specified",
"attributes",
"of",
"a",
"stored",
"key",
"and",
"can",
"be",
"applied",
"to",
"any",
"key",
"type",
"and",
"key",
"version",
"stored",
"in",
"Azure",
"Key",
"Vault",
".",
"In",
"order",
"to",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1274-L1276 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java | Resources.getDateTime | public Date getDateTime( String key, Date defaultValue )
throws MissingResourceException
{
try
{
return getDateTime( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | java | public Date getDateTime( String key, Date defaultValue )
throws MissingResourceException
{
try
{
return getDateTime( key );
}
catch( MissingResourceException mre )
{
return defaultValue;
}
} | [
"public",
"Date",
"getDateTime",
"(",
"String",
"key",
",",
"Date",
"defaultValue",
")",
"throws",
"MissingResourceException",
"{",
"try",
"{",
"return",
"getDateTime",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"mre",
")",
"{",
"retu... | Retrieve a time from bundle.
@param key the key of resource
@param defaultValue the default value if key is missing
@return the resource time
@throws MissingResourceException if the requested key is unknown | [
"Retrieve",
"a",
"time",
"from",
"bundle",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L631-L642 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/dynssl/SslCertificateUtils.java | SslCertificateUtils.containsSection | private static boolean containsSection(String contents, String beginToken, String endToken) {
int idxToken;
if ((idxToken = contents.indexOf(beginToken)) == -1 || contents.indexOf(endToken) < idxToken) {
return false;
}
return true;
} | java | private static boolean containsSection(String contents, String beginToken, String endToken) {
int idxToken;
if ((idxToken = contents.indexOf(beginToken)) == -1 || contents.indexOf(endToken) < idxToken) {
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"containsSection",
"(",
"String",
"contents",
",",
"String",
"beginToken",
",",
"String",
"endToken",
")",
"{",
"int",
"idxToken",
";",
"if",
"(",
"(",
"idxToken",
"=",
"contents",
".",
"indexOf",
"(",
"beginToken",
")",
")",
... | Tells whether or not the given ({@code .pem} file) contents contain a section with the given begin and end tokens.
@param contents the ({@code .pem} file) contents to check if contains the section.
@param beginToken the begin token of the section.
@param endToken the end token of the section.
@return {@code true} if the section was found, {@code false} otherwise. | [
"Tells",
"whether",
"or",
"not",
"the",
"given",
"(",
"{",
"@code",
".",
"pem",
"}",
"file",
")",
"contents",
"contain",
"a",
"section",
"with",
"the",
"given",
"begin",
"and",
"end",
"tokens",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/dynssl/SslCertificateUtils.java#L253-L259 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.addLikelySubtags | private ULocale addLikelySubtags(ULocale languageCode) {
// max("und") = "en_Latn_US", and since matching is based on maximized tags, the undefined
// language would normally match English. But that would produce the counterintuitive results
// that getBestMatch("und", LocaleMatcher("it,en")) would be "en", and
// getBestMatch("en", LocaleMatcher("it,und")) would be "und".
//
// To avoid that, we change the matcher's definitions of max (AddLikelySubtagsWithDefaults)
// so that max("und")="und". That produces the following, more desirable results:
if (languageCode.equals(UNKNOWN_LOCALE)) {
return UNKNOWN_LOCALE;
}
final ULocale result = ULocale.addLikelySubtags(languageCode);
// should have method on getLikelySubtags for this
if (result == null || result.equals(languageCode)) {
final String language = languageCode.getLanguage();
final String script = languageCode.getScript();
final String region = languageCode.getCountry();
return new ULocale((language.length()==0 ? "und"
: language)
+ "_"
+ (script.length()==0 ? "Zzzz" : script)
+ "_"
+ (region.length()==0 ? "ZZ" : region));
}
return result;
} | java | private ULocale addLikelySubtags(ULocale languageCode) {
// max("und") = "en_Latn_US", and since matching is based on maximized tags, the undefined
// language would normally match English. But that would produce the counterintuitive results
// that getBestMatch("und", LocaleMatcher("it,en")) would be "en", and
// getBestMatch("en", LocaleMatcher("it,und")) would be "und".
//
// To avoid that, we change the matcher's definitions of max (AddLikelySubtagsWithDefaults)
// so that max("und")="und". That produces the following, more desirable results:
if (languageCode.equals(UNKNOWN_LOCALE)) {
return UNKNOWN_LOCALE;
}
final ULocale result = ULocale.addLikelySubtags(languageCode);
// should have method on getLikelySubtags for this
if (result == null || result.equals(languageCode)) {
final String language = languageCode.getLanguage();
final String script = languageCode.getScript();
final String region = languageCode.getCountry();
return new ULocale((language.length()==0 ? "und"
: language)
+ "_"
+ (script.length()==0 ? "Zzzz" : script)
+ "_"
+ (region.length()==0 ? "ZZ" : region));
}
return result;
} | [
"private",
"ULocale",
"addLikelySubtags",
"(",
"ULocale",
"languageCode",
")",
"{",
"// max(\"und\") = \"en_Latn_US\", and since matching is based on maximized tags, the undefined",
"// language would normally match English. But that would produce the counterintuitive results",
"// that getBest... | We need to add another method to addLikelySubtags that doesn't return
null, but instead substitutes Zzzz and ZZ if unknown. There are also
a few cases where addLikelySubtags needs to have expanded data, to handle
all deprecated codes.
@param languageCode
@return "fixed" addLikelySubtags | [
"We",
"need",
"to",
"add",
"another",
"method",
"to",
"addLikelySubtags",
"that",
"doesn",
"t",
"return",
"null",
"but",
"instead",
"substitutes",
"Zzzz",
"and",
"ZZ",
"if",
"unknown",
".",
"There",
"are",
"also",
"a",
"few",
"cases",
"where",
"addLikelySubt... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L352-L377 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsDependenciesEdit.java | CmsDependenciesEdit.getModules | private List getModules() {
List retVal = new ArrayList();
// get all modules
Iterator i = OpenCms.getModuleManager().getModuleNames().iterator();
// add them to the list of modules
while (i.hasNext()) {
String moduleName = (String)i.next();
if (moduleName.equals(getParamDependency())) {
// check for the preselection
retVal.add(new CmsSelectWidgetOption(moduleName, true));
} else {
retVal.add(new CmsSelectWidgetOption(moduleName, false));
}
}
Collections.sort(retVal, new Comparator() {
/** Collator used / wrapped */
private Collator m_collator = Collator.getInstance(getLocale());
/**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public int compare(Object arg0, Object arg1) {
CmsSelectWidgetOption o1 = (CmsSelectWidgetOption)arg0;
CmsSelectWidgetOption o2 = (CmsSelectWidgetOption)arg1;
return m_collator.compare(o1.getOption(), o2.getOption());
}
});
return retVal;
} | java | private List getModules() {
List retVal = new ArrayList();
// get all modules
Iterator i = OpenCms.getModuleManager().getModuleNames().iterator();
// add them to the list of modules
while (i.hasNext()) {
String moduleName = (String)i.next();
if (moduleName.equals(getParamDependency())) {
// check for the preselection
retVal.add(new CmsSelectWidgetOption(moduleName, true));
} else {
retVal.add(new CmsSelectWidgetOption(moduleName, false));
}
}
Collections.sort(retVal, new Comparator() {
/** Collator used / wrapped */
private Collator m_collator = Collator.getInstance(getLocale());
/**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
public int compare(Object arg0, Object arg1) {
CmsSelectWidgetOption o1 = (CmsSelectWidgetOption)arg0;
CmsSelectWidgetOption o2 = (CmsSelectWidgetOption)arg1;
return m_collator.compare(o1.getOption(), o2.getOption());
}
});
return retVal;
} | [
"private",
"List",
"getModules",
"(",
")",
"{",
"List",
"retVal",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// get all modules",
"Iterator",
"i",
"=",
"OpenCms",
".",
"getModuleManager",
"(",
")",
".",
"getModuleNames",
"(",
")",
".",
"iterator",
"(",
")",
... | Get the list of all modules available.<p>
@return list of module names | [
"Get",
"the",
"list",
"of",
"all",
"modules",
"available",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsDependenciesEdit.java#L381-L413 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/Password.java | Password.getPassword | public static Password getPassword(String realm,String dft, String promptDft)
{
String passwd=System.getProperty(realm,dft);
if (passwd==null || passwd.length()==0)
{
try
{
System.out.print(realm+
((promptDft!=null && promptDft.length()>0)
?" [dft]":"")+" : ");
System.out.flush();
byte[] buf = new byte[512];
int len=System.in.read(buf);
if (len>0)
passwd=new String(buf,0,len).trim();
}
catch(IOException e)
{
log.warn(LogSupport.EXCEPTION,e);
}
if (passwd==null || passwd.length()==0)
passwd=promptDft;
}
return new Password(passwd);
} | java | public static Password getPassword(String realm,String dft, String promptDft)
{
String passwd=System.getProperty(realm,dft);
if (passwd==null || passwd.length()==0)
{
try
{
System.out.print(realm+
((promptDft!=null && promptDft.length()>0)
?" [dft]":"")+" : ");
System.out.flush();
byte[] buf = new byte[512];
int len=System.in.read(buf);
if (len>0)
passwd=new String(buf,0,len).trim();
}
catch(IOException e)
{
log.warn(LogSupport.EXCEPTION,e);
}
if (passwd==null || passwd.length()==0)
passwd=promptDft;
}
return new Password(passwd);
} | [
"public",
"static",
"Password",
"getPassword",
"(",
"String",
"realm",
",",
"String",
"dft",
",",
"String",
"promptDft",
")",
"{",
"String",
"passwd",
"=",
"System",
".",
"getProperty",
"(",
"realm",
",",
"dft",
")",
";",
"if",
"(",
"passwd",
"==",
"null... | Get a password.
A password is obtained by trying <UL>
<LI>Calling <Code>System.getProperty(realm,dft)</Code>
<LI>Prompting for a password
<LI>Using promptDft if nothing was entered.
</UL>
@param realm The realm name for the password, used as a SystemProperty name.
@param dft The default password.
@param promptDft The default to use if prompting for the password.
@return Password | [
"Get",
"a",
"password",
".",
"A",
"password",
"is",
"obtained",
"by",
"trying",
"<UL",
">",
"<LI",
">",
"Calling",
"<Code",
">",
"System",
".",
"getProperty",
"(",
"realm",
"dft",
")",
"<",
"/",
"Code",
">",
"<LI",
">",
"Prompting",
"for",
"a",
"pass... | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/Password.java#L187-L211 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/OrderUrl.java | OrderUrl.deleteOrderDraftUrl | public static MozuUrl deleteOrderDraftUrl(String orderId, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/draft?version={version}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteOrderDraftUrl(String orderId, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/draft?version={version}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteOrderDraftUrl",
"(",
"String",
"orderId",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}/draft?version={version}\"",
")",
";",
"formatter",
".",
"f... | Get Resource Url for DeleteOrderDraft
@param orderId Unique identifier of the order.
@param version Determines whether or not to check versioning of items for concurrency purposes.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteOrderDraft"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/OrderUrl.java#L180-L186 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileExtFileFilter.java | FileExtFileFilter.accept | @Override
public boolean accept(final File aDir, final String aFileName) {
for (final String extension : myExtensions) {
if (new File(aDir, aFileName).isFile() && aFileName.endsWith(extension)) {
return true;
}
}
return false;
} | java | @Override
public boolean accept(final File aDir, final String aFileName) {
for (final String extension : myExtensions) {
if (new File(aDir, aFileName).isFile() && aFileName.endsWith(extension)) {
return true;
}
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"final",
"File",
"aDir",
",",
"final",
"String",
"aFileName",
")",
"{",
"for",
"(",
"final",
"String",
"extension",
":",
"myExtensions",
")",
"{",
"if",
"(",
"new",
"File",
"(",
"aDir",
",",
"aFileName... | Returns true if the supplied file name and parent directory are a match for this <code>FilenameFilter</code>.
@param aDir A parent directory for the supplied file name
@param aFileName The file name we want to check against our filter
@return True if the filter matches the supplied parent and file name; else, false | [
"Returns",
"true",
"if",
"the",
"supplied",
"file",
"name",
"and",
"parent",
"directory",
"are",
"a",
"match",
"for",
"this",
"<code",
">",
"FilenameFilter<",
"/",
"code",
">",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileExtFileFilter.java#L60-L69 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.toIntBiFunction | public static <T, U> ToIntBiFunction<T, U> toIntBiFunction(CheckedToIntBiFunction<T, U> function) {
return toIntBiFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION);
} | java | public static <T, U> ToIntBiFunction<T, U> toIntBiFunction(CheckedToIntBiFunction<T, U> function) {
return toIntBiFunction(function, THROWABLE_TO_RUNTIME_EXCEPTION);
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"ToIntBiFunction",
"<",
"T",
",",
"U",
">",
"toIntBiFunction",
"(",
"CheckedToIntBiFunction",
"<",
"T",
",",
"U",
">",
"function",
")",
"{",
"return",
"toIntBiFunction",
"(",
"function",
",",
"THROWABLE_TO_RUNTIME... | Wrap a {@link CheckedToIntBiFunction} in a {@link ToIntBiFunction}. | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L367-L369 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java | CLI.cmd | public Result cmd(String cliCommand) {
try {
// The intent here is to return a Response when this is doable.
if (ctx.isWorkflowMode() || ctx.isBatchMode()) {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
handler.parse(ctx.getCurrentNodePath(), cliCommand, ctx);
if (handler.getFormat() == OperationFormat.INSTANCE) {
ModelNode request = ctx.buildRequest(cliCommand);
ModelNode response = ctx.execute(request, cliCommand);
return new Result(cliCommand, request, response);
} else {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
} catch (CommandLineException cfe) {
throw new IllegalArgumentException("Error handling command: "
+ cliCommand, cfe);
} catch (IOException ioe) {
throw new IllegalStateException("Unable to send command "
+ cliCommand + " to server.", ioe);
}
} | java | public Result cmd(String cliCommand) {
try {
// The intent here is to return a Response when this is doable.
if (ctx.isWorkflowMode() || ctx.isBatchMode()) {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
handler.parse(ctx.getCurrentNodePath(), cliCommand, ctx);
if (handler.getFormat() == OperationFormat.INSTANCE) {
ModelNode request = ctx.buildRequest(cliCommand);
ModelNode response = ctx.execute(request, cliCommand);
return new Result(cliCommand, request, response);
} else {
ctx.handle(cliCommand);
return new Result(cliCommand, ctx.getExitCode());
}
} catch (CommandLineException cfe) {
throw new IllegalArgumentException("Error handling command: "
+ cliCommand, cfe);
} catch (IOException ioe) {
throw new IllegalStateException("Unable to send command "
+ cliCommand + " to server.", ioe);
}
} | [
"public",
"Result",
"cmd",
"(",
"String",
"cliCommand",
")",
"{",
"try",
"{",
"// The intent here is to return a Response when this is doable.",
"if",
"(",
"ctx",
".",
"isWorkflowMode",
"(",
")",
"||",
"ctx",
".",
"isBatchMode",
"(",
")",
")",
"{",
"ctx",
".",
... | Execute a CLI command. This can be any command that you might execute on
the CLI command line, including both server-side operations and local
commands such as 'cd' or 'cn'.
@param cliCommand A CLI command.
@return A result object that provides all information about the execution
of the command. | [
"Execute",
"a",
"CLI",
"command",
".",
"This",
"can",
"be",
"any",
"command",
"that",
"you",
"might",
"execute",
"on",
"the",
"CLI",
"command",
"line",
"including",
"both",
"server",
"-",
"side",
"operations",
"and",
"local",
"commands",
"such",
"as",
"cd"... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java#L231-L254 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java | PrefixMappedItemCache.containsListRaw | @VisibleForTesting
boolean containsListRaw(String bucket, String objectName) {
return prefixMap.containsKey(new PrefixKey(bucket, objectName));
} | java | @VisibleForTesting
boolean containsListRaw(String bucket, String objectName) {
return prefixMap.containsKey(new PrefixKey(bucket, objectName));
} | [
"@",
"VisibleForTesting",
"boolean",
"containsListRaw",
"(",
"String",
"bucket",
",",
"String",
"objectName",
")",
"{",
"return",
"prefixMap",
".",
"containsKey",
"(",
"new",
"PrefixKey",
"(",
"bucket",
",",
"objectName",
")",
")",
";",
"}"
] | Checks if the prefix map contains an exact entry for the given bucket/objectName. | [
"Checks",
"if",
"the",
"prefix",
"map",
"contains",
"an",
"exact",
"entry",
"for",
"the",
"given",
"bucket",
"/",
"objectName",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java#L318-L321 |
johncarl81/transfuse | transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java | IntentFactory.buildPendingIntent | public PendingIntent buildPendingIntent(int requestCode, int flags, IntentFactoryStrategy parameters){
return PendingIntent.getActivity(context, requestCode, buildIntent(parameters), flags);
} | java | public PendingIntent buildPendingIntent(int requestCode, int flags, IntentFactoryStrategy parameters){
return PendingIntent.getActivity(context, requestCode, buildIntent(parameters), flags);
} | [
"public",
"PendingIntent",
"buildPendingIntent",
"(",
"int",
"requestCode",
",",
"int",
"flags",
",",
"IntentFactoryStrategy",
"parameters",
")",
"{",
"return",
"PendingIntent",
".",
"getActivity",
"(",
"context",
",",
"requestCode",
",",
"buildIntent",
"(",
"parame... | Build a PendingIntent specified by the given input Strategy.
@param requestCode request code for the sender
@param flags intent flags
@param parameters Strategy instance
@return PendingIntent | [
"Build",
"a",
"PendingIntent",
"specified",
"by",
"the",
"given",
"input",
"Strategy",
"."
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java#L134-L136 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.getCacheKey | public String getCacheKey(String siteRoot, String uri) {
return new StringBuffer(siteRoot).append(uri).toString();
} | java | public String getCacheKey(String siteRoot, String uri) {
return new StringBuffer(siteRoot).append(uri).toString();
} | [
"public",
"String",
"getCacheKey",
"(",
"String",
"siteRoot",
",",
"String",
"uri",
")",
"{",
"return",
"new",
"StringBuffer",
"(",
"siteRoot",
")",
".",
"append",
"(",
"uri",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Returns the key for the online, export and secure cache.<p>
@param siteRoot the site root of the resource
@param uri the URI of the resource
@return a key for the cache | [
"Returns",
"the",
"key",
"for",
"the",
"online",
"export",
"and",
"secure",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L830-L833 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/component/rabbitmq/RabbitmqClusterContext.java | RabbitmqClusterContext.setConnectionProcessMap | public void setConnectionProcessMap(Map<String, String> connectionProcessMap)
throws RabbitmqCommunicateException
{
Map<String, String> tempConnectionProcessMap = connectionProcessMap;
if (connectionProcessMap == null)
{
tempConnectionProcessMap = new HashMap<String, String>();
}
validateProcessReference(this.mqProcessList, tempConnectionProcessMap);
this.connectionProcessMap = tempConnectionProcessMap;
} | java | public void setConnectionProcessMap(Map<String, String> connectionProcessMap)
throws RabbitmqCommunicateException
{
Map<String, String> tempConnectionProcessMap = connectionProcessMap;
if (connectionProcessMap == null)
{
tempConnectionProcessMap = new HashMap<String, String>();
}
validateProcessReference(this.mqProcessList, tempConnectionProcessMap);
this.connectionProcessMap = tempConnectionProcessMap;
} | [
"public",
"void",
"setConnectionProcessMap",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"connectionProcessMap",
")",
"throws",
"RabbitmqCommunicateException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"tempConnectionProcessMap",
"=",
"connectionProcessMap",
"... | 呼出元別、接続先RabbitMQプロセスの定義マップを検証して設定する。
@param connectionProcessMap the connectionProcessMap to set
@throws RabbitmqCommunicateException 接続先RabbitMQプロセスがRabbitMQプロセス一覧に定義されていない場合 | [
"呼出元別、接続先RabbitMQプロセスの定義マップを検証して設定する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/component/rabbitmq/RabbitmqClusterContext.java#L169-L179 |
apereo/cas | support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java | DelegatedClientAuthenticationAction.isDelegatedClientAuthorizedForService | protected boolean isDelegatedClientAuthorizedForService(final Client client, final Service service) {
if (service == null || StringUtils.isBlank(service.getId())) {
LOGGER.debug("Can not evaluate delegated authentication policy since no service was provided in the request while processing client [{}]", client);
return true;
}
val registeredService = this.servicesManager.findServiceBy(service);
if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
LOGGER.warn("Service access for [{}] is denied", registeredService);
return false;
}
LOGGER.trace("Located registered service definition [{}] matching [{}]", registeredService, service);
val context = AuditableContext.builder()
.registeredService(registeredService)
.properties(CollectionUtils.wrap(Client.class.getSimpleName(), client.getName()))
.build();
val result = delegatedAuthenticationPolicyEnforcer.execute(context);
if (!result.isExecutionFailure()) {
LOGGER.debug("Delegated authentication policy for [{}] allows for using client [{}]", registeredService, client);
return true;
}
LOGGER.warn("Delegated authentication policy for [{}] refuses access to client [{}]", registeredService.getServiceId(), client);
return false;
} | java | protected boolean isDelegatedClientAuthorizedForService(final Client client, final Service service) {
if (service == null || StringUtils.isBlank(service.getId())) {
LOGGER.debug("Can not evaluate delegated authentication policy since no service was provided in the request while processing client [{}]", client);
return true;
}
val registeredService = this.servicesManager.findServiceBy(service);
if (registeredService == null || !registeredService.getAccessStrategy().isServiceAccessAllowed()) {
LOGGER.warn("Service access for [{}] is denied", registeredService);
return false;
}
LOGGER.trace("Located registered service definition [{}] matching [{}]", registeredService, service);
val context = AuditableContext.builder()
.registeredService(registeredService)
.properties(CollectionUtils.wrap(Client.class.getSimpleName(), client.getName()))
.build();
val result = delegatedAuthenticationPolicyEnforcer.execute(context);
if (!result.isExecutionFailure()) {
LOGGER.debug("Delegated authentication policy for [{}] allows for using client [{}]", registeredService, client);
return true;
}
LOGGER.warn("Delegated authentication policy for [{}] refuses access to client [{}]", registeredService.getServiceId(), client);
return false;
} | [
"protected",
"boolean",
"isDelegatedClientAuthorizedForService",
"(",
"final",
"Client",
"client",
",",
"final",
"Service",
"service",
")",
"{",
"if",
"(",
"service",
"==",
"null",
"||",
"StringUtils",
".",
"isBlank",
"(",
"service",
".",
"getId",
"(",
")",
")... | Is delegated client authorized for service boolean.
@param client the client
@param service the service
@return the boolean | [
"Is",
"delegated",
"client",
"authorized",
"for",
"service",
"boolean",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java#L423-L446 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_region_POST | public OvhRegion project_serviceName_region_POST(String serviceName, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/region";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "region", region);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRegion.class);
} | java | public OvhRegion project_serviceName_region_POST(String serviceName, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/region";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "region", region);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRegion.class);
} | [
"public",
"OvhRegion",
"project_serviceName_region_POST",
"(",
"String",
"serviceName",
",",
"String",
"region",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/region\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | Request access to a region
REST: POST /cloud/project/{serviceName}/region
@param region [required] Region to add on your project
@param serviceName [required] The project id | [
"Request",
"access",
"to",
"a",
"region"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L138-L145 |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackBinaryHeader | public int unpackBinaryHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedRaw(b)) { // FixRaw
return b & 0x1f;
}
int len = tryReadBinaryHeader(b);
if (len >= 0) {
return len;
}
if (allowReadingStringAsBinary) {
len = tryReadStringHeader(b);
if (len >= 0) {
return len;
}
}
throw unexpected("Binary", b);
} | java | public int unpackBinaryHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedRaw(b)) { // FixRaw
return b & 0x1f;
}
int len = tryReadBinaryHeader(b);
if (len >= 0) {
return len;
}
if (allowReadingStringAsBinary) {
len = tryReadStringHeader(b);
if (len >= 0) {
return len;
}
}
throw unexpected("Binary", b);
} | [
"public",
"int",
"unpackBinaryHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixedRaw",
"(",
"b",
")",
")",
"{",
"// FixRaw",
"return",
"b",
"&",
"0x1f",
";",
"}",
"int",
"len"... | Reads header of a binary.
<p>
This method returns number of bytes to be read. After this method call, you call a readPayload method such as
{@link #readPayload(int)} with the returned count.
<p>
You can divide readPayload method into multiple calls. In this case, you must repeat readPayload methods
until total amount of bytes becomes equal to the returned count.
@return the size of the map to be read
@throws MessageTypeException when value is not MessagePack Map type
@throws MessageSizeException when size of the map is larger than 2^31 - 1
@throws IOException when underlying input throws IOException | [
"Reads",
"header",
"of",
"a",
"binary",
"."
] | train | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1446-L1465 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java | OmemoService.removeStaleDevicesFromDeviceList | private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice,
BareJid contact,
OmemoCachedDeviceList contactsDeviceList,
int maxAgeHours) {
OmemoCachedDeviceList deviceList = new OmemoCachedDeviceList(contactsDeviceList); // Don't work on original list.
// Iterate through original list, but modify copy instead
for (int deviceId : contactsDeviceList.getActiveDevices()) {
OmemoDevice device = new OmemoDevice(contact, deviceId);
Date lastDeviceIdPublication = getOmemoStoreBackend().getDateOfLastDeviceIdPublication(userDevice, device);
if (lastDeviceIdPublication == null) {
lastDeviceIdPublication = new Date();
getOmemoStoreBackend().setDateOfLastDeviceIdPublication(userDevice, device, lastDeviceIdPublication);
}
Date lastMessageReceived = getOmemoStoreBackend().getDateOfLastReceivedMessage(userDevice, device);
if (lastMessageReceived == null) {
lastMessageReceived = new Date();
getOmemoStoreBackend().setDateOfLastReceivedMessage(userDevice, device, lastMessageReceived);
}
boolean stale = isStale(userDevice, device, lastDeviceIdPublication, maxAgeHours);
stale &= isStale(userDevice, device, lastMessageReceived, maxAgeHours);
if (stale) {
deviceList.addInactiveDevice(deviceId);
}
}
return deviceList;
} | java | private OmemoCachedDeviceList removeStaleDevicesFromDeviceList(OmemoDevice userDevice,
BareJid contact,
OmemoCachedDeviceList contactsDeviceList,
int maxAgeHours) {
OmemoCachedDeviceList deviceList = new OmemoCachedDeviceList(contactsDeviceList); // Don't work on original list.
// Iterate through original list, but modify copy instead
for (int deviceId : contactsDeviceList.getActiveDevices()) {
OmemoDevice device = new OmemoDevice(contact, deviceId);
Date lastDeviceIdPublication = getOmemoStoreBackend().getDateOfLastDeviceIdPublication(userDevice, device);
if (lastDeviceIdPublication == null) {
lastDeviceIdPublication = new Date();
getOmemoStoreBackend().setDateOfLastDeviceIdPublication(userDevice, device, lastDeviceIdPublication);
}
Date lastMessageReceived = getOmemoStoreBackend().getDateOfLastReceivedMessage(userDevice, device);
if (lastMessageReceived == null) {
lastMessageReceived = new Date();
getOmemoStoreBackend().setDateOfLastReceivedMessage(userDevice, device, lastMessageReceived);
}
boolean stale = isStale(userDevice, device, lastDeviceIdPublication, maxAgeHours);
stale &= isStale(userDevice, device, lastMessageReceived, maxAgeHours);
if (stale) {
deviceList.addInactiveDevice(deviceId);
}
}
return deviceList;
} | [
"private",
"OmemoCachedDeviceList",
"removeStaleDevicesFromDeviceList",
"(",
"OmemoDevice",
"userDevice",
",",
"BareJid",
"contact",
",",
"OmemoCachedDeviceList",
"contactsDeviceList",
",",
"int",
"maxAgeHours",
")",
"{",
"OmemoCachedDeviceList",
"deviceList",
"=",
"new",
"... | Return a copy of the given deviceList of user contact, but with stale devices marked as inactive.
Never mark our own device as stale. If we haven't yet received a message from a device, store the current date
as last date of message receipt to allow future decisions.
A stale device is a device, from which we haven't received an OMEMO message from for more than
"maxAgeMillis" milliseconds.
@param userDevice our OmemoDevice.
@param contact subjects BareJid.
@param contactsDeviceList subjects deviceList.
@return copy of subjects deviceList with stale devices marked as inactive. | [
"Return",
"a",
"copy",
"of",
"the",
"given",
"deviceList",
"of",
"user",
"contact",
"but",
"with",
"stale",
"devices",
"marked",
"as",
"inactive",
".",
"Never",
"mark",
"our",
"own",
"device",
"as",
"stale",
".",
"If",
"we",
"haven",
"t",
"yet",
"receive... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L938-L968 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java | CmsToolbarNewButton.makeNewElementItem | private CmsCreatableListItem makeNewElementItem(final CmsNewResourceInfo typeInfo) {
CmsListItemWidget widget = new CmsListItemWidget(typeInfo);
if ((typeInfo.getDescription() != null) && (typeInfo.getDescription().trim().length() > 0)) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(
Messages.get().key(Messages.GUI_LABEL_DESCRIPTION_0),
typeInfo.getDescription(),
null));
}
if (typeInfo.getVfsPath() != null) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(
Messages.get().key(Messages.GUI_LABEL_VFSPATH_0),
typeInfo.getVfsPath(),
null));
}
if (typeInfo.getDate() != null) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(Messages.get().key(Messages.GUI_LABEL_DATE_0), typeInfo.getDate(), null));
}
CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.regular);
listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler(), true);
return listItem;
} | java | private CmsCreatableListItem makeNewElementItem(final CmsNewResourceInfo typeInfo) {
CmsListItemWidget widget = new CmsListItemWidget(typeInfo);
if ((typeInfo.getDescription() != null) && (typeInfo.getDescription().trim().length() > 0)) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(
Messages.get().key(Messages.GUI_LABEL_DESCRIPTION_0),
typeInfo.getDescription(),
null));
}
if (typeInfo.getVfsPath() != null) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(
Messages.get().key(Messages.GUI_LABEL_VFSPATH_0),
typeInfo.getVfsPath(),
null));
}
if (typeInfo.getDate() != null) {
widget.addAdditionalInfo(
new CmsAdditionalInfoBean(Messages.get().key(Messages.GUI_LABEL_DATE_0), typeInfo.getDate(), null));
}
CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.regular);
listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler(), true);
return listItem;
} | [
"private",
"CmsCreatableListItem",
"makeNewElementItem",
"(",
"final",
"CmsNewResourceInfo",
"typeInfo",
")",
"{",
"CmsListItemWidget",
"widget",
"=",
"new",
"CmsListItemWidget",
"(",
"typeInfo",
")",
";",
"if",
"(",
"(",
"typeInfo",
".",
"getDescription",
"(",
")",... | Create a new-element list item.<p>
@param typeInfo the new-element info
@return the list item | [
"Create",
"a",
"new",
"-",
"element",
"list",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java#L192-L216 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java | AkkaRpcActor.lookupRpcMethod | private Method lookupRpcMethod(final String methodName, final Class<?>[] parameterTypes) throws NoSuchMethodException {
return rpcEndpoint.getClass().getMethod(methodName, parameterTypes);
} | java | private Method lookupRpcMethod(final String methodName, final Class<?>[] parameterTypes) throws NoSuchMethodException {
return rpcEndpoint.getClass().getMethod(methodName, parameterTypes);
} | [
"private",
"Method",
"lookupRpcMethod",
"(",
"final",
"String",
"methodName",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
")",
"throws",
"NoSuchMethodException",
"{",
"return",
"rpcEndpoint",
".",
"getClass",
"(",
")",
".",
"getMethod",
"... | Look up the rpc method on the given {@link RpcEndpoint} instance.
@param methodName Name of the method
@param parameterTypes Parameter types of the method
@return Method of the rpc endpoint
@throws NoSuchMethodException Thrown if the method with the given name and parameter types
cannot be found at the rpc endpoint | [
"Look",
"up",
"the",
"rpc",
"method",
"on",
"the",
"given",
"{",
"@link",
"RpcEndpoint",
"}",
"instance",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java#L424-L426 |
tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getPattern | public static String getPattern(Object bean, Object target)
{
return stream(bean).filter((s)->{return target.equals(getValue(bean, s));} | java | public static String getPattern(Object bean, Object target)
{
return stream(bean).filter((s)->{return target.equals(getValue(bean, s));} | [
"public",
"static",
"String",
"getPattern",
"(",
"Object",
"bean",
",",
"Object",
"target",
")",
"{",
"return",
"stream",
"(",
"bean",
")",
".",
"filter",
"(",
"(",
"s",
")",
"-",
">",
"{",
"return",
"target",
".",
"equals",
"(",
"getValue",
"(",
"be... | Returns targets pattern or null if target not found.
@param bean
@param target
@return | [
"Returns",
"targets",
"pattern",
"or",
"null",
"if",
"target",
"not",
"found",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L974-L976 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java | KltTracker.setImage | public void setImage(I image, D derivX, D derivY) {
InputSanityCheck.checkSameShape(image, derivX, derivY);
this.image = image;
this.interpInput.setImage(image);
this.derivX = derivX;
this.derivY = derivY;
} | java | public void setImage(I image, D derivX, D derivY) {
InputSanityCheck.checkSameShape(image, derivX, derivY);
this.image = image;
this.interpInput.setImage(image);
this.derivX = derivX;
this.derivY = derivY;
} | [
"public",
"void",
"setImage",
"(",
"I",
"image",
",",
"D",
"derivX",
",",
"D",
"derivY",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"image",
",",
"derivX",
",",
"derivY",
")",
";",
"this",
".",
"image",
"=",
"image",
";",
"this",
".",
... | Sets the current image it should be tracking with.
@param image Original input image.
@param derivX Image derivative along the x-axis
@param derivY Image derivative along the y-axis | [
"Sets",
"the",
"current",
"image",
"it",
"should",
"be",
"tracking",
"with",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L119-L127 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.asyncCAS | @Override
public OperationFuture<CASResponse>
asyncCAS(String key, long casId, Object value) {
return asyncCAS(key, casId, value, transcoder);
} | java | @Override
public OperationFuture<CASResponse>
asyncCAS(String key, long casId, Object value) {
return asyncCAS(key, casId, value, transcoder);
} | [
"@",
"Override",
"public",
"OperationFuture",
"<",
"CASResponse",
">",
"asyncCAS",
"(",
"String",
"key",
",",
"long",
"casId",
",",
"Object",
"value",
")",
"{",
"return",
"asyncCAS",
"(",
"key",
",",
"casId",
",",
"value",
",",
"transcoder",
")",
";",
"}... | Asynchronous CAS operation using the default transcoder.
@param key the key
@param casId the CAS identifier (from a gets operation)
@param value the new value
@return a future that will indicate the status of the CAS
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Asynchronous",
"CAS",
"operation",
"using",
"the",
"default",
"transcoder",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L667-L671 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java | WRadioButtonSelectExample.addDisabledExamples | private void addDisabledExamples() {
add(new WHeading(HeadingLevel.H2, "Disabled WRadioButtonSelect examples"));
WFieldLayout layout = new WFieldLayout();
add(layout);
WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setDisabled(true);
layout.addField("Disabled with no selection", select);
select = new WRadioButtonSelect("australian_state");
select.setDisabled(true);
select.setFrameless(true);
layout.addField("Disabled with no selection no frame", select);
select = new SelectWithSelection("australian_state");
select.setDisabled(true);
layout.addField("Disabled with selection", select);
} | java | private void addDisabledExamples() {
add(new WHeading(HeadingLevel.H2, "Disabled WRadioButtonSelect examples"));
WFieldLayout layout = new WFieldLayout();
add(layout);
WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setDisabled(true);
layout.addField("Disabled with no selection", select);
select = new WRadioButtonSelect("australian_state");
select.setDisabled(true);
select.setFrameless(true);
layout.addField("Disabled with no selection no frame", select);
select = new SelectWithSelection("australian_state");
select.setDisabled(true);
layout.addField("Disabled with selection", select);
} | [
"private",
"void",
"addDisabledExamples",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"Disabled WRadioButtonSelect examples\"",
")",
")",
";",
"WFieldLayout",
"layout",
"=",
"new",
"WFieldLayout",
"(",
")",
";",
"add",
... | Examples of disabled state. You should use {@link WSubordinateControl} to set and manage the disabled state
unless there is no facility for the user to enable a control.
If you want to prevent the user enabling and interacting with a WRadioButtonSeelct then you should consider using
the readOnly state instead of the disabled state. | [
"Examples",
"of",
"disabled",
"state",
".",
"You",
"should",
"use",
"{",
"@link",
"WSubordinateControl",
"}",
"to",
"set",
"and",
"manage",
"the",
"disabled",
"state",
"unless",
"there",
"is",
"no",
"facility",
"for",
"the",
"user",
"to",
"enable",
"a",
"c... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java#L304-L320 |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/DoubleArrays.java | DoubleArrays.multiply | public static void multiply(double[] array1, double[] array2) {
assert (array1.length == array2.length);
for (int i=0; i<array1.length; i++) {
array1[i] *= array2[i];
}
} | java | public static void multiply(double[] array1, double[] array2) {
assert (array1.length == array2.length);
for (int i=0; i<array1.length; i++) {
array1[i] *= array2[i];
}
} | [
"public",
"static",
"void",
"multiply",
"(",
"double",
"[",
"]",
"array1",
",",
"double",
"[",
"]",
"array2",
")",
"{",
"assert",
"(",
"array1",
".",
"length",
"==",
"array2",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"... | Each element of the second array is multiplied with each element of the first. | [
"Each",
"element",
"of",
"the",
"second",
"array",
"is",
"multiplied",
"with",
"each",
"element",
"of",
"the",
"first",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L398-L403 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateLocalX | public Matrix3f rotateLocalX(float ang, Matrix3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm01 = cos * m01 - sin * m02;
float nm02 = sin * m01 + cos * m02;
float nm11 = cos * m11 - sin * m12;
float nm12 = sin * m11 + cos * m12;
float nm21 = cos * m21 - sin * m22;
float nm22 = sin * m21 + cos * m22;
dest.m00 = m00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = m10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m20 = m20;
dest.m21 = nm21;
dest.m22 = nm22;
return dest;
} | java | public Matrix3f rotateLocalX(float ang, Matrix3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm01 = cos * m01 - sin * m02;
float nm02 = sin * m01 + cos * m02;
float nm11 = cos * m11 - sin * m12;
float nm12 = sin * m11 + cos * m12;
float nm21 = cos * m21 - sin * m22;
float nm22 = sin * m21 + cos * m22;
dest.m00 = m00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m10 = m10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m20 = m20;
dest.m21 = nm21;
dest.m22 = nm22;
return dest;
} | [
"public",
"Matrix3f",
"rotateLocalX",
"(",
"float",
"ang",
",",
"Matrix3f",
"dest",
")",
"{",
"float",
"sin",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"ang",
")",
";",
"float",
"cos",
"=",
"(",
"float",
")",
"Math",
".",
"cosFromSin",
"(",
... | Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians
about the X axis and store the result in <code>dest</code>.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>R * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the
rotation will be applied last!
<p>
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use {@link #rotationX(float) rotationX()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotationX(float)
@param ang
the angle in radians to rotate about the X axis
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"rotation",
"around",
"the",
"X",
"axis",
"to",
"this",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"X",
"axis",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2473-L2492 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java | Counter.getPreviouslyCounted | int getPreviouslyCounted(XPathContext support, int node)
{
int n = m_countNodes.size();
m_countResult = 0;
for (int i = n - 1; i >= 0; i--)
{
int countedNode = m_countNodes.elementAt(i);
if (node == countedNode)
{
// Since the list is in backwards order, the count is
// how many are in the rest of the list.
m_countResult = i + 1 + m_countNodesStartCount;
break;
}
DTM dtm = support.getDTM(countedNode);
// Try to see if the given node falls after the counted node...
// if it does, don't keep searching backwards.
if (dtm.isNodeAfter(countedNode, node))
break;
}
return m_countResult;
} | java | int getPreviouslyCounted(XPathContext support, int node)
{
int n = m_countNodes.size();
m_countResult = 0;
for (int i = n - 1; i >= 0; i--)
{
int countedNode = m_countNodes.elementAt(i);
if (node == countedNode)
{
// Since the list is in backwards order, the count is
// how many are in the rest of the list.
m_countResult = i + 1 + m_countNodesStartCount;
break;
}
DTM dtm = support.getDTM(countedNode);
// Try to see if the given node falls after the counted node...
// if it does, don't keep searching backwards.
if (dtm.isNodeAfter(countedNode, node))
break;
}
return m_countResult;
} | [
"int",
"getPreviouslyCounted",
"(",
"XPathContext",
"support",
",",
"int",
"node",
")",
"{",
"int",
"n",
"=",
"m_countNodes",
".",
"size",
"(",
")",
";",
"m_countResult",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"n",
"-",
"1",
";",
"i",
">=",
"0... | Try and find a node that was previously counted. If found,
return a positive integer that corresponds to the count.
@param support The XPath context to use
@param node The node to be counted.
@return The count of the node, or -1 if not found. | [
"Try",
"and",
"find",
"a",
"node",
"that",
"was",
"previously",
"counted",
".",
"If",
"found",
"return",
"a",
"positive",
"integer",
"that",
"corresponds",
"to",
"the",
"count",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java#L113-L143 |
bbottema/simple-java-mail | modules/core-module/src/main/java/org/simplejavamail/internal/util/MiscUtil.java | MiscUtil.readInputStreamToString | @Nonnull
public static String readInputStreamToString(@Nonnull final InputStream inputStream, @Nonnull final Charset charset)
throws IOException {
final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int result = bufferedInputStream.read();
while (result != -1) {
byteArrayOutputStream.write((byte) result);
result = bufferedInputStream.read();
}
return byteArrayOutputStream.toString(checkNonEmptyArgument(charset, "charset").name());
} | java | @Nonnull
public static String readInputStreamToString(@Nonnull final InputStream inputStream, @Nonnull final Charset charset)
throws IOException {
final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
int result = bufferedInputStream.read();
while (result != -1) {
byteArrayOutputStream.write((byte) result);
result = bufferedInputStream.read();
}
return byteArrayOutputStream.toString(checkNonEmptyArgument(charset, "charset").name());
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"readInputStreamToString",
"(",
"@",
"Nonnull",
"final",
"InputStream",
"inputStream",
",",
"@",
"Nonnull",
"final",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"final",
"BufferedInputStream",
"bufferedInputSt... | Uses standard JDK java to read an inputstream to String using the given encoding (in {@link ByteArrayOutputStream#toString(String)}). | [
"Uses",
"standard",
"JDK",
"java",
"to",
"read",
"an",
"inputstream",
"to",
"String",
"using",
"the",
"given",
"encoding",
"(",
"in",
"{"
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/core-module/src/main/java/org/simplejavamail/internal/util/MiscUtil.java#L102-L113 |
sundrio/sundrio | maven-plugin/src/main/java/io/sundr/maven/Reflections.java | Reflections.readAnyField | static String readAnyField(Object obj, String ... names) {
try {
for (String name : names) {
try {
Field field = obj.getClass().getDeclaredField(name);
field.setAccessible(true);
return (String) field.get(obj);
} catch (NoSuchFieldException e) {
//ignore and try next field...
}
}
return null;
} catch (IllegalAccessException e) {
return null;
}
} | java | static String readAnyField(Object obj, String ... names) {
try {
for (String name : names) {
try {
Field field = obj.getClass().getDeclaredField(name);
field.setAccessible(true);
return (String) field.get(obj);
} catch (NoSuchFieldException e) {
//ignore and try next field...
}
}
return null;
} catch (IllegalAccessException e) {
return null;
}
} | [
"static",
"String",
"readAnyField",
"(",
"Object",
"obj",
",",
"String",
"...",
"names",
")",
"{",
"try",
"{",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getDeclare... | Read any field that matches the specified name.
@param obj The obj to read from.
@param names The var-arg of names.
@return The value of the first field that matches or null if no match is found. | [
"Read",
"any",
"field",
"that",
"matches",
"the",
"specified",
"name",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/maven-plugin/src/main/java/io/sundr/maven/Reflections.java#L54-L69 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getSetter | public static MethodInstance getSetter(Object obj, String prop, Object value) throws NoSuchMethodException {
prop = "set" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstance(obj, obj.getClass(), prop, new Object[] { value });
Method m = mi.getMethod();
if (m.getReturnType() != void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] must have return type void, now [" + m.getReturnType().getName() + "]");
return mi;
} | java | public static MethodInstance getSetter(Object obj, String prop, Object value) throws NoSuchMethodException {
prop = "set" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstance(obj, obj.getClass(), prop, new Object[] { value });
Method m = mi.getMethod();
if (m.getReturnType() != void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] must have return type void, now [" + m.getReturnType().getName() + "]");
return mi;
} | [
"public",
"static",
"MethodInstance",
"getSetter",
"(",
"Object",
"obj",
",",
"String",
"prop",
",",
"Object",
"value",
")",
"throws",
"NoSuchMethodException",
"{",
"prop",
"=",
"\"set\"",
"+",
"StringUtil",
".",
"ucFirst",
"(",
"prop",
")",
";",
"MethodInstan... | to invoke a setter Method of a Object
@param obj Object to invoke method from
@param prop Name of the Method without get
@param value Value to set to the Method
@return MethodInstance
@throws NoSuchMethodException
@throws PageException | [
"to",
"invoke",
"a",
"setter",
"Method",
"of",
"a",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1016-L1024 |
infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/TransactionalSharedLuceneLock.java | TransactionalSharedLuceneLock.startTransaction | private void startTransaction() throws IOException {
try {
tm.begin();
}
catch (Exception e) {
log.unableToStartTransaction(e);
throw new IOException("SharedLuceneLock could not start a transaction after having acquired the lock", e);
}
if (trace) {
log.tracef("Batch transaction started for index: %s", indexName);
}
} | java | private void startTransaction() throws IOException {
try {
tm.begin();
}
catch (Exception e) {
log.unableToStartTransaction(e);
throw new IOException("SharedLuceneLock could not start a transaction after having acquired the lock", e);
}
if (trace) {
log.tracef("Batch transaction started for index: %s", indexName);
}
} | [
"private",
"void",
"startTransaction",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"tm",
".",
"begin",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"unableToStartTransaction",
"(",
"e",
")",
";",
"throw",
"new",
"IO... | Starts a new transaction. Used to batch changes in LuceneDirectory:
a transaction is created at lock acquire, and closed on release.
It's also committed and started again at each IndexWriter.commit();
@throws IOException wraps Infinispan exceptions to adapt to Lucene's API | [
"Starts",
"a",
"new",
"transaction",
".",
"Used",
"to",
"batch",
"changes",
"in",
"LuceneDirectory",
":",
"a",
"transaction",
"is",
"created",
"at",
"lock",
"acquire",
"and",
"closed",
"on",
"release",
".",
"It",
"s",
"also",
"committed",
"and",
"started",
... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/TransactionalSharedLuceneLock.java#L109-L120 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java | EntrySerializer.serializeUpdate | void serializeUpdate(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, TableKey.NO_VERSION);
}
} | java | void serializeUpdate(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, TableKey.NO_VERSION);
}
} | [
"void",
"serializeUpdate",
"(",
"@",
"NonNull",
"Collection",
"<",
"TableEntry",
">",
"entries",
",",
"byte",
"[",
"]",
"target",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"TableEntry",
"e",
":",
"entries",
")",
"{",
"offset",
"=",
"seriali... | Serializes the given {@link TableEntry} collection into the given byte array, without explicitly recording the
versions for each entry.
@param entries A Collection of {@link TableEntry} to serialize.
@param target The byte array to serialize into. | [
"Serializes",
"the",
"given",
"{",
"@link",
"TableEntry",
"}",
"collection",
"into",
"the",
"given",
"byte",
"array",
"without",
"explicitly",
"recording",
"the",
"versions",
"for",
"each",
"entry",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java#L68-L73 |
landawn/AbacusUtil | src/com/landawn/abacus/util/IOUtil.java | IOUtil.splitBySize | public static void splitBySize(final File file, final long sizeOfPart, final File destDir) throws UncheckedIOException {
final int numOfParts = (int) ((file.length() % sizeOfPart) == 0 ? (file.length() / sizeOfPart) : (file.length() / sizeOfPart) + 1);
final String fileName = file.getName();
final long fileLength = file.length();
int fileSerNum = 1;
final byte[] buf = Objectory.createByteArrayBuffer();
InputStream input = null;
OutputStream output = null;
try {
input = new FileInputStream(file);
for (int i = 0; i < numOfParts; i++) {
String subFileNmae = destDir.getAbsolutePath() + IOUtil.FILE_SEPARATOR + fileName + "_" + StringUtil.padStart(N.stringOf(fileSerNum++), 4, '0');
output = new FileOutputStream(new File(subFileNmae));
long partLength = sizeOfPart;
if (i == numOfParts - 1) {
partLength += fileLength % numOfParts;
}
int count = 0;
try {
while (partLength > 0 && EOF != (count = read(input, buf, 0, (int) Math.min(buf.length, partLength)))) {
output.write(buf, 0, count);
partLength = partLength - count;
}
output.flush();
} finally {
close(output);
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
Objectory.recycle(buf);
closeQuietly(input);
}
} | java | public static void splitBySize(final File file, final long sizeOfPart, final File destDir) throws UncheckedIOException {
final int numOfParts = (int) ((file.length() % sizeOfPart) == 0 ? (file.length() / sizeOfPart) : (file.length() / sizeOfPart) + 1);
final String fileName = file.getName();
final long fileLength = file.length();
int fileSerNum = 1;
final byte[] buf = Objectory.createByteArrayBuffer();
InputStream input = null;
OutputStream output = null;
try {
input = new FileInputStream(file);
for (int i = 0; i < numOfParts; i++) {
String subFileNmae = destDir.getAbsolutePath() + IOUtil.FILE_SEPARATOR + fileName + "_" + StringUtil.padStart(N.stringOf(fileSerNum++), 4, '0');
output = new FileOutputStream(new File(subFileNmae));
long partLength = sizeOfPart;
if (i == numOfParts - 1) {
partLength += fileLength % numOfParts;
}
int count = 0;
try {
while (partLength > 0 && EOF != (count = read(input, buf, 0, (int) Math.min(buf.length, partLength)))) {
output.write(buf, 0, count);
partLength = partLength - count;
}
output.flush();
} finally {
close(output);
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
Objectory.recycle(buf);
closeQuietly(input);
}
} | [
"public",
"static",
"void",
"splitBySize",
"(",
"final",
"File",
"file",
",",
"final",
"long",
"sizeOfPart",
",",
"final",
"File",
"destDir",
")",
"throws",
"UncheckedIOException",
"{",
"final",
"int",
"numOfParts",
"=",
"(",
"int",
")",
"(",
"(",
"file",
... | Mostly it's designed for (zipped/unzipped/log) text files.
@param file
@param sizeOfPart
@param destDir | [
"Mostly",
"it",
"s",
"designed",
"for",
"(",
"zipped",
"/",
"unzipped",
"/",
"log",
")",
"text",
"files",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L3342-L3385 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java | CeCPMain.filterDuplicateAFPs | public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated) throws StructureException {
return filterDuplicateAFPs(afpChain, ceCalc, ca1, ca2duplicated, null);
} | java | public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated) throws StructureException {
return filterDuplicateAFPs(afpChain, ceCalc, ca1, ca2duplicated, null);
} | [
"public",
"static",
"AFPChain",
"filterDuplicateAFPs",
"(",
"AFPChain",
"afpChain",
",",
"CECalculator",
"ceCalc",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2duplicated",
")",
"throws",
"StructureException",
"{",
"return",
"filterDuplicateAFPs",
"(",... | Takes as input an AFPChain where ca2 has been artificially duplicated.
This raises the possibility that some residues of ca2 will appear in
multiple AFPs. This method filters out duplicates and makes sure that
all AFPs are numbered relative to the original ca2.
<p>The current version chooses a CP site such that the length of the
alignment is maximized.
<p>This method does <i>not</i> update scores to reflect the filtered alignment.
It <i>does</i> update the RMSD and superposition.
@param afpChain The alignment between ca1 and ca2-ca2. Blindly assumes
that ca2 has been duplicated.
@return A new AFPChain consisting of ca1 to ca2, with each residue in
at most 1 AFP.
@throws StructureException | [
"Takes",
"as",
"input",
"an",
"AFPChain",
"where",
"ca2",
"has",
"been",
"artificially",
"duplicated",
".",
"This",
"raises",
"the",
"possibility",
"that",
"some",
"residues",
"of",
"ca2",
"will",
"appear",
"in",
"multiple",
"AFPs",
".",
"This",
"method",
"f... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java#L323-L325 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UsersApi.java | UsersApi.supervisorRemotePlaceOperation | public ApiSuccessResponse supervisorRemotePlaceOperation(String dbid, SupervisorPlaceData supervisorPlaceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = supervisorRemotePlaceOperationWithHttpInfo(dbid, supervisorPlaceData);
return resp.getData();
} | java | public ApiSuccessResponse supervisorRemotePlaceOperation(String dbid, SupervisorPlaceData supervisorPlaceData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = supervisorRemotePlaceOperationWithHttpInfo(dbid, supervisorPlaceData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"supervisorRemotePlaceOperation",
"(",
"String",
"dbid",
",",
"SupervisorPlaceData",
"supervisorPlaceData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"supervisorRemotePlaceOperationWithHttpInf... | Log out the agent specified by the dbid.
Log out the agent specified by the dbid.
@param dbid The dbid of the agent. (required)
@param supervisorPlaceData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Log",
"out",
"the",
"agent",
"specified",
"by",
"the",
"dbid",
".",
"Log",
"out",
"the",
"agent",
"specified",
"by",
"the",
"dbid",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UsersApi.java#L569-L572 |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java | RestController.retrieveEntityAttributeMetaPost | @PostMapping(
value = "/{entityTypeId}/meta/{attributeName}",
params = "_method=GET",
produces = APPLICATION_JSON_VALUE)
public AttributeResponse retrieveEntityAttributeMetaPost(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("attributeName") String attributeName,
@Valid @RequestBody EntityTypeRequest request) {
Set<String> attributeSet = toAttributeSet(request != null ? request.getAttributes() : null);
Map<String, Set<String>> attributeExpandSet =
toExpandMap(request != null ? request.getExpand() : null);
return getAttributePostInternal(entityTypeId, attributeName, attributeSet, attributeExpandSet);
} | java | @PostMapping(
value = "/{entityTypeId}/meta/{attributeName}",
params = "_method=GET",
produces = APPLICATION_JSON_VALUE)
public AttributeResponse retrieveEntityAttributeMetaPost(
@PathVariable("entityTypeId") String entityTypeId,
@PathVariable("attributeName") String attributeName,
@Valid @RequestBody EntityTypeRequest request) {
Set<String> attributeSet = toAttributeSet(request != null ? request.getAttributes() : null);
Map<String, Set<String>> attributeExpandSet =
toExpandMap(request != null ? request.getExpand() : null);
return getAttributePostInternal(entityTypeId, attributeName, attributeSet, attributeExpandSet);
} | [
"@",
"PostMapping",
"(",
"value",
"=",
"\"/{entityTypeId}/meta/{attributeName}\"",
",",
"params",
"=",
"\"_method=GET\"",
",",
"produces",
"=",
"APPLICATION_JSON_VALUE",
")",
"public",
"AttributeResponse",
"retrieveEntityAttributeMetaPost",
"(",
"@",
"PathVariable",
"(",
... | Same as retrieveEntityAttributeMeta (GET) only tunneled through POST.
@return EntityType | [
"Same",
"as",
"retrieveEntityAttributeMeta",
"(",
"GET",
")",
"only",
"tunneled",
"through",
"POST",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v1/RestController.java#L234-L247 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/AmBaseBolt.java | AmBaseBolt.emit | protected void emit(StreamMessage message, Object messageKey)
{
KeyHistory newHistory = null;
if (this.recordHistory)
{
newHistory = createKeyRecorededHistory(this.executingKeyHistory, messageKey);
}
else
{
newHistory = createKeyRecorededHistory(this.executingKeyHistory);
}
message.getHeader().setHistory(newHistory);
getCollector().emit(this.getExecutingTuple(), new Values("", message));
} | java | protected void emit(StreamMessage message, Object messageKey)
{
KeyHistory newHistory = null;
if (this.recordHistory)
{
newHistory = createKeyRecorededHistory(this.executingKeyHistory, messageKey);
}
else
{
newHistory = createKeyRecorededHistory(this.executingKeyHistory);
}
message.getHeader().setHistory(newHistory);
getCollector().emit(this.getExecutingTuple(), new Values("", message));
} | [
"protected",
"void",
"emit",
"(",
"StreamMessage",
"message",
",",
"Object",
"messageKey",
")",
"{",
"KeyHistory",
"newHistory",
"=",
"null",
";",
"if",
"(",
"this",
".",
"recordHistory",
")",
"{",
"newHistory",
"=",
"createKeyRecorededHistory",
"(",
"this",
"... | Use anchor function(child message failed. notify fail to parent message.), MessageKey(Use key history's value).<br>
Send message to downstream component.<br>
Use following situation.
<ol>
<li>Use this class's key history function.</li>
<li>Use storm's fault detect function.</li>
</ol>
@param message sending message
@param messageKey MessageKey(Use key history's value) | [
"Use",
"anchor",
"function",
"(",
"child",
"message",
"failed",
".",
"notify",
"fail",
"to",
"parent",
"message",
".",
")",
"MessageKey",
"(",
"Use",
"key",
"history",
"s",
"value",
")",
".",
"<br",
">",
"Send",
"message",
"to",
"downstream",
"component",
... | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L359-L374 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java | CommerceOrderNotePersistenceImpl.findAll | @Override
public List<CommerceOrderNote> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceOrderNote> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderNote",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce order notes.
@return the commerce order notes | [
"Returns",
"all",
"the",
"commerce",
"order",
"notes",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java#L2011-L2014 |
zaproxy/zaproxy | src/org/parosproxy/paros/common/FileXML.java | FileXML.getValue | protected String getValue(Element base, String tag) {
Element element = null;
String result = "";
try {
// ZAP: Removed unnecessary cast.
element = getElement(base, tag);
result = getText(element);
} catch (Exception e) {
}
return result;
} | java | protected String getValue(Element base, String tag) {
Element element = null;
String result = "";
try {
// ZAP: Removed unnecessary cast.
element = getElement(base, tag);
result = getText(element);
} catch (Exception e) {
}
return result;
} | [
"protected",
"String",
"getValue",
"(",
"Element",
"base",
",",
"String",
"tag",
")",
"{",
"Element",
"element",
"=",
"null",
";",
"String",
"result",
"=",
"\"\"",
";",
"try",
"{",
"// ZAP: Removed unnecessary cast.\r",
"element",
"=",
"getElement",
"(",
"base... | Get the value of the tag under a base element
@param base
@param tag
@return | [
"Get",
"the",
"value",
"of",
"the",
"tag",
"under",
"a",
"base",
"element"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/common/FileXML.java#L184-L196 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java | PolicyEventsInner.listQueryResultsForSubscriptionLevelPolicyAssignmentAsync | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyEventsQueryResultsInner> listQueryResultsForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName, QueryOptions queryOptions) {
return listQueryResultsForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName, queryOptions).map(new Func1<ServiceResponse<PolicyEventsQueryResultsInner>, PolicyEventsQueryResultsInner>() {
@Override
public PolicyEventsQueryResultsInner call(ServiceResponse<PolicyEventsQueryResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyEventsQueryResultsInner",
">",
"listQueryResultsForSubscriptionLevelPolicyAssignmentAsync",
"(",
"String",
"subscriptionId",
",",
"String",
"policyAssignmentName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForSub... | Queries policy events for the subscription level policy assignment.
@param subscriptionId Microsoft Azure subscription ID.
@param policyAssignmentName Policy assignment name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyEventsQueryResultsInner object | [
"Queries",
"policy",
"events",
"for",
"the",
"subscription",
"level",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyEventsInner.java#L1396-L1403 |
alkacon/opencms-core | src/org/opencms/configuration/CmsElementWithSubElementsParamConfigHelper.java | CmsElementWithSubElementsParamConfigHelper.generateXml | public void generateXml(Element parent, I_CmsConfigurationParameterHandler config) {
if (config != null) {
Element elem = parent.addElement(m_name);
for (String subElemName : m_subElements) {
for (String value : config.getConfiguration().getList(subElemName)) {
elem.addElement(subElemName).addText(value);
}
}
}
} | java | public void generateXml(Element parent, I_CmsConfigurationParameterHandler config) {
if (config != null) {
Element elem = parent.addElement(m_name);
for (String subElemName : m_subElements) {
for (String value : config.getConfiguration().getList(subElemName)) {
elem.addElement(subElemName).addText(value);
}
}
}
} | [
"public",
"void",
"generateXml",
"(",
"Element",
"parent",
",",
"I_CmsConfigurationParameterHandler",
"config",
")",
"{",
"if",
"(",
"config",
"!=",
"null",
")",
"{",
"Element",
"elem",
"=",
"parent",
".",
"addElement",
"(",
"m_name",
")",
";",
"for",
"(",
... | Generates the XML configuration from the given configuration object.<p>
@param parent the parent element
@param config the configuration | [
"Generates",
"the",
"XML",
"configuration",
"from",
"the",
"given",
"configuration",
"object",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsElementWithSubElementsParamConfigHelper.java#L118-L128 |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/EjbJarDescriptorImpl.java | EjbJarDescriptorImpl.addNamespace | public EjbJarDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | java | public EjbJarDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | [
"public",
"EjbJarDescriptor",
"addNamespace",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"model",
".",
"attribute",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new namespace
@return the current instance of <code>EjbJarDescriptor</code> | [
"Adds",
"a",
"new",
"namespace"
] | train | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/EjbJarDescriptorImpl.java#L89-L93 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java | HttpCommandExecutor.defineCommand | protected void defineCommand(String commandName, CommandInfo info) {
checkNotNull(commandName);
checkNotNull(info);
commandCodec.defineCommand(commandName, info.getMethod(), info.getUrl());
} | java | protected void defineCommand(String commandName, CommandInfo info) {
checkNotNull(commandName);
checkNotNull(info);
commandCodec.defineCommand(commandName, info.getMethod(), info.getUrl());
} | [
"protected",
"void",
"defineCommand",
"(",
"String",
"commandName",
",",
"CommandInfo",
"info",
")",
"{",
"checkNotNull",
"(",
"commandName",
")",
";",
"checkNotNull",
"(",
"info",
")",
";",
"commandCodec",
".",
"defineCommand",
"(",
"commandName",
",",
"info",
... | It may be useful to extend the commands understood by this {@code HttpCommandExecutor} at run
time, and this can be achieved via this method. Note, this is protected, and expected usage is
for subclasses only to call this.
@param commandName The name of the command to use.
@param info CommandInfo for the command name provided | [
"It",
"may",
"be",
"useful",
"to",
"extend",
"the",
"commands",
"understood",
"by",
"this",
"{",
"@code",
"HttpCommandExecutor",
"}",
"at",
"run",
"time",
"and",
"this",
"can",
"be",
"achieved",
"via",
"this",
"method",
".",
"Note",
"this",
"is",
"protecte... | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java#L101-L105 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/SparseBooleanArray.java | SparseBooleanArray.put | public void put(int key, boolean value) {
int i = ContainerHelpers.binarySearch(mKeys, mSize, key);
if (i >= 0) {
mValues[i] = value;
} else {
i = ~i;
if (mSize >= mKeys.length) {
int n = ArrayUtils.idealIntArraySize(mSize + 1);
int[] nkeys = new int[n];
boolean[] nvalues = new boolean[n];
// Log.e("SparseBooleanArray", "grow " + mKeys.length + " to " + n);
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
if (mSize - i != 0) {
// Log.e("SparseBooleanArray", "move " + (mSize - i));
System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i);
System.arraycopy(mValues, i, mValues, i + 1, mSize - i);
}
mKeys[i] = key;
mValues[i] = value;
mSize++;
}
} | java | public void put(int key, boolean value) {
int i = ContainerHelpers.binarySearch(mKeys, mSize, key);
if (i >= 0) {
mValues[i] = value;
} else {
i = ~i;
if (mSize >= mKeys.length) {
int n = ArrayUtils.idealIntArraySize(mSize + 1);
int[] nkeys = new int[n];
boolean[] nvalues = new boolean[n];
// Log.e("SparseBooleanArray", "grow " + mKeys.length + " to " + n);
System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length);
System.arraycopy(mValues, 0, nvalues, 0, mValues.length);
mKeys = nkeys;
mValues = nvalues;
}
if (mSize - i != 0) {
// Log.e("SparseBooleanArray", "move " + (mSize - i));
System.arraycopy(mKeys, i, mKeys, i + 1, mSize - i);
System.arraycopy(mValues, i, mValues, i + 1, mSize - i);
}
mKeys[i] = key;
mValues[i] = value;
mSize++;
}
} | [
"public",
"void",
"put",
"(",
"int",
"key",
",",
"boolean",
"value",
")",
"{",
"int",
"i",
"=",
"ContainerHelpers",
".",
"binarySearch",
"(",
"mKeys",
",",
"mSize",
",",
"key",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"mValues",
"[",
"i",
"... | Adds a mapping from the specified key to the specified value,
replacing the previous mapping from the specified key if there
was one. | [
"Adds",
"a",
"mapping",
"from",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"replacing",
"the",
"previous",
"mapping",
"from",
"the",
"specified",
"key",
"if",
"there",
"was",
"one",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseBooleanArray.java#L123-L155 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java | JNDIContentRepositoryBuilder.withSecurityPrincipal | public JNDIContentRepositoryBuilder withSecurityPrincipal(final String principalName, final String credentials) {
contextProperties.put(Context.SECURITY_PRINCIPAL, principalName);
contextProperties.put(Context.SECURITY_CREDENTIALS, credentials);
return this;
} | java | public JNDIContentRepositoryBuilder withSecurityPrincipal(final String principalName, final String credentials) {
contextProperties.put(Context.SECURITY_PRINCIPAL, principalName);
contextProperties.put(Context.SECURITY_CREDENTIALS, credentials);
return this;
} | [
"public",
"JNDIContentRepositoryBuilder",
"withSecurityPrincipal",
"(",
"final",
"String",
"principalName",
",",
"final",
"String",
"credentials",
")",
"{",
"contextProperties",
".",
"put",
"(",
"Context",
".",
"SECURITY_PRINCIPAL",
",",
"principalName",
")",
";",
"co... | Sets the context properties for SECURITY_PRINCIPAL and SECURITY_CREDENTIAL to perform the lookup. This method is
a convenience for setting the properties SECURITY_PRINCIPAL and SECURITY_CREDENTIAL on the environment.
@param principalName
the principal name to use to perform the lookup
@param credentials
the credentials used to authenticate the principal
@return this test rule | [
"Sets",
"the",
"context",
"properties",
"for",
"SECURITY_PRINCIPAL",
"and",
"SECURITY_CREDENTIAL",
"to",
"perform",
"the",
"lookup",
".",
"This",
"method",
"is",
"a",
"convenience",
"for",
"setting",
"the",
"properties",
"SECURITY_PRINCIPAL",
"and",
"SECURITY_CREDENTI... | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java#L190-L195 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/JapaneseChronology.java | JapaneseChronology.dateYearDay | @Override
public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) {
LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
} | java | @Override
public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) {
LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
} | [
"@",
"Override",
"public",
"JapaneseDate",
"dateYearDay",
"(",
"int",
"prolepticYear",
",",
"int",
"dayOfYear",
")",
"{",
"LocalDate",
"date",
"=",
"LocalDate",
".",
"ofYearDay",
"(",
"prolepticYear",
",",
"dayOfYear",
")",
";",
"return",
"date",
"(",
"prolept... | Obtains a local date in Japanese calendar system from the
proleptic-year and day-of-year fields.
<p>
The day-of-year in this factory is expressed relative to the start of the proleptic year.
The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system.
They are not reset when the era changes.
@param prolepticYear the proleptic-year
@param dayOfYear the day-of-year
@return the Japanese local date, not null
@throws DateTimeException if unable to create the date | [
"Obtains",
"a",
"local",
"date",
"in",
"Japanese",
"calendar",
"system",
"from",
"the",
"proleptic",
"-",
"year",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
".",
"<p",
">",
"The",
"day",
"-",
"of",
"-",
"year",
"in",
"this",
"factory",
"is",
"ex... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/JapaneseChronology.java#L256-L260 |
apereo/cas | support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/web/WsFederationNavigationController.java | WsFederationNavigationController.redirectToProvider | @GetMapping(ENDPOINT_REDIRECT)
public View redirectToProvider(final HttpServletRequest request, final HttpServletResponse response) {
val wsfedId = request.getParameter(PARAMETER_NAME);
try {
val cfg = configurations.stream().filter(c -> c.getId().equals(wsfedId)).findFirst().orElse(null);
if (cfg == null) {
throw new IllegalArgumentException("Could not locate WsFederation configuration for " + wsfedId);
}
val service = determineService(request);
val id = wsFederationHelper.getRelyingPartyIdentifier(service, cfg);
val url = cfg.getAuthorizationUrl(id, cfg.getId());
wsFederationCookieManager.store(request, response, cfg.getId(), service, cfg);
return new RedirectView(url);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
} | java | @GetMapping(ENDPOINT_REDIRECT)
public View redirectToProvider(final HttpServletRequest request, final HttpServletResponse response) {
val wsfedId = request.getParameter(PARAMETER_NAME);
try {
val cfg = configurations.stream().filter(c -> c.getId().equals(wsfedId)).findFirst().orElse(null);
if (cfg == null) {
throw new IllegalArgumentException("Could not locate WsFederation configuration for " + wsfedId);
}
val service = determineService(request);
val id = wsFederationHelper.getRelyingPartyIdentifier(service, cfg);
val url = cfg.getAuthorizationUrl(id, cfg.getId());
wsFederationCookieManager.store(request, response, cfg.getId(), service, cfg);
return new RedirectView(url);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, StringUtils.EMPTY);
} | [
"@",
"GetMapping",
"(",
"ENDPOINT_REDIRECT",
")",
"public",
"View",
"redirectToProvider",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"val",
"wsfedId",
"=",
"request",
".",
"getParameter",
"(",
"PARAMETER... | Redirect to provider. Receive the client name from the request and then try to determine and build the endpoint url
for the redirection. The redirection data/url must contain a delegated client ticket id so that the request be can
restored on the trip back. SAML clients use the relay-state session attribute while others use request parameters.
@param request the request
@param response the response
@return the view | [
"Redirect",
"to",
"provider",
".",
"Receive",
"the",
"client",
"name",
"from",
"the",
"request",
"and",
"then",
"try",
"to",
"determine",
"and",
"build",
"the",
"endpoint",
"url",
"for",
"the",
"redirection",
".",
"The",
"redirection",
"data",
"/",
"url",
... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/web/WsFederationNavigationController.java#L63-L80 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java | Configuration.setProperty | public void setProperty(String category, String key, String value) {
category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim();
if (Strings.isNullOrEmpty(category)) category = "Main";
key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_");
value = (this.compressedSpaces ? value.replaceAll("\\s+", " ") : value).trim();
if (!this.categories.containsKey(category))
this.categories.put(category, Maps.<String, String>newLinkedHashMap());
LinkedHashMap<String, String> currCat = this.categories.get(category);
currCat.put(key, value);
this.categories.put(category, currCat);
} | java | public void setProperty(String category, String key, String value) {
category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim();
if (Strings.isNullOrEmpty(category)) category = "Main";
key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_");
value = (this.compressedSpaces ? value.replaceAll("\\s+", " ") : value).trim();
if (!this.categories.containsKey(category))
this.categories.put(category, Maps.<String, String>newLinkedHashMap());
LinkedHashMap<String, String> currCat = this.categories.get(category);
currCat.put(key, value);
this.categories.put(category, currCat);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"category",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"category",
"=",
"(",
"this",
".",
"compressedSpaces",
"?",
"category",
".",
"replaceAll",
"(",
"\"\\\\s+\"",
",",
"\" \"",
")",
":",
"categ... | Sets a property in the configuration
@param category The category of the property
@param key The key to identify the property
@param value The value associated with it | [
"Sets",
"a",
"property",
"in",
"the",
"configuration"
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L226-L237 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/PowerFormsApi.java | PowerFormsApi.getPowerFormData | public PowerFormsFormDataResponse getPowerFormData(String accountId, String powerFormId, PowerFormsApi.GetPowerFormDataOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling getPowerFormData");
}
// verify the required parameter 'powerFormId' is set
if (powerFormId == null) {
throw new ApiException(400, "Missing the required parameter 'powerFormId' when calling getPowerFormData");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/powerforms/{powerFormId}/form_data".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
.replaceAll("\\{" + "powerFormId" + "\\}", apiClient.escapeString(powerFormId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "data_layout", options.dataLayout));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<PowerFormsFormDataResponse> localVarReturnType = new GenericType<PowerFormsFormDataResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public PowerFormsFormDataResponse getPowerFormData(String accountId, String powerFormId, PowerFormsApi.GetPowerFormDataOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling getPowerFormData");
}
// verify the required parameter 'powerFormId' is set
if (powerFormId == null) {
throw new ApiException(400, "Missing the required parameter 'powerFormId' when calling getPowerFormData");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/powerforms/{powerFormId}/form_data".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()))
.replaceAll("\\{" + "powerFormId" + "\\}", apiClient.escapeString(powerFormId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "data_layout", options.dataLayout));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<PowerFormsFormDataResponse> localVarReturnType = new GenericType<PowerFormsFormDataResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"PowerFormsFormDataResponse",
"getPowerFormData",
"(",
"String",
"accountId",
",",
"String",
"powerFormId",
",",
"PowerFormsApi",
".",
"GetPowerFormDataOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"\"{}\"",
";",
"... | Returns the form data associated with the usage of a PowerForm.
@param accountId The external account number (int) or account ID Guid. (required)
@param powerFormId (required)
@param options for modifying the method behavior.
@return PowerFormsFormDataResponse
@throws ApiException if fails to make API call | [
"Returns",
"the",
"form",
"data",
"associated",
"with",
"the",
"usage",
"of",
"a",
"PowerForm",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/PowerFormsApi.java#L286-L330 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/PackageInspectorImpl.java | PackageInspectorImpl.populateSPIInfo | final void populateSPIInfo(BundleContext bundleContext, FeatureManager fm) {
//if the bundleContext is null we aren't going to be able to do this
if (bundleContext != null) {
// We're going to rebuild new indices, so use local variables
ProductPackages newPackageIndex = new ProductPackages();
// For figuring out SPI information, we need the installed features and the kernel features.
Collection<ProvisioningFeatureDefinition> allInstalledFeatures = fm.getInstalledFeatureDefinitions();
allInstalledFeatures.addAll(KernelFeatureDefinitionImpl.getKernelFeatures(bundleContext, fm.getLocationService()));
// For all installed features, get information about the declared product packages
// and the declared osgi bundles..
for (ProvisioningFeatureDefinition def : allInstalledFeatures) {
// Add package information to ProductPackages..
newPackageIndex.addPackages(def);
}
// compact the read-only index
newPackageIndex.compact();
// Replace the member variables with the new instances
packageIndex = newPackageIndex;
}
} | java | final void populateSPIInfo(BundleContext bundleContext, FeatureManager fm) {
//if the bundleContext is null we aren't going to be able to do this
if (bundleContext != null) {
// We're going to rebuild new indices, so use local variables
ProductPackages newPackageIndex = new ProductPackages();
// For figuring out SPI information, we need the installed features and the kernel features.
Collection<ProvisioningFeatureDefinition> allInstalledFeatures = fm.getInstalledFeatureDefinitions();
allInstalledFeatures.addAll(KernelFeatureDefinitionImpl.getKernelFeatures(bundleContext, fm.getLocationService()));
// For all installed features, get information about the declared product packages
// and the declared osgi bundles..
for (ProvisioningFeatureDefinition def : allInstalledFeatures) {
// Add package information to ProductPackages..
newPackageIndex.addPackages(def);
}
// compact the read-only index
newPackageIndex.compact();
// Replace the member variables with the new instances
packageIndex = newPackageIndex;
}
} | [
"final",
"void",
"populateSPIInfo",
"(",
"BundleContext",
"bundleContext",
",",
"FeatureManager",
"fm",
")",
"{",
"//if the bundleContext is null we aren't going to be able to do this",
"if",
"(",
"bundleContext",
"!=",
"null",
")",
"{",
"// We're going to rebuild new indices, ... | This method creates and sets new instances of the two maps used to answer questions
about packages in the system:
<OL>
<LI>The set of currently installed features is iterated querying the bundle resources for each feature
<LI> The list of currently installed bundles (getBundles()) is iterated
<LI> each bundle is checked against each feature definition
<LI> feature definitions with matching bundles are added to the collection
<LI> the collection is added to the map, keyed by bundle for faster checks during resolution.
</OL> | [
"This",
"method",
"creates",
"and",
"sets",
"new",
"instances",
"of",
"the",
"two",
"maps",
"used",
"to",
"answer",
"questions",
"about",
"packages",
"in",
"the",
"system",
":",
"<OL",
">",
"<LI",
">",
"The",
"set",
"of",
"currently",
"installed",
"feature... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/PackageInspectorImpl.java#L78-L103 |
stevespringett/Alpine | alpine/src/main/java/alpine/crypto/DataEncryption.java | DataEncryption.decryptAsBytes | public static byte[] decryptAsBytes(final byte[] encryptedIvTextBytes) throws Exception {
final SecretKey secretKey = KeyManager.getInstance().getSecretKey();
return decryptAsBytes(secretKey, encryptedIvTextBytes);
} | java | public static byte[] decryptAsBytes(final byte[] encryptedIvTextBytes) throws Exception {
final SecretKey secretKey = KeyManager.getInstance().getSecretKey();
return decryptAsBytes(secretKey, encryptedIvTextBytes);
} | [
"public",
"static",
"byte",
"[",
"]",
"decryptAsBytes",
"(",
"final",
"byte",
"[",
"]",
"encryptedIvTextBytes",
")",
"throws",
"Exception",
"{",
"final",
"SecretKey",
"secretKey",
"=",
"KeyManager",
".",
"getInstance",
"(",
")",
".",
"getSecretKey",
"(",
")",
... | Decrypts the specified bytes using AES-256. This method uses the default secret key.
@param encryptedIvTextBytes the text to decrypt
@return the decrypted bytes
@throws Exception a number of exceptions may be thrown
@since 1.3.0 | [
"Decrypts",
"the",
"specified",
"bytes",
"using",
"AES",
"-",
"256",
".",
"This",
"method",
"uses",
"the",
"default",
"secret",
"key",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L145-L148 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.deleteGroupMember | public void deleteGroupMember(GitlabGroup group, GitlabUser user) throws IOException {
deleteGroupMember(group.getId(), user.getId());
} | java | public void deleteGroupMember(GitlabGroup group, GitlabUser user) throws IOException {
deleteGroupMember(group.getId(), user.getId());
} | [
"public",
"void",
"deleteGroupMember",
"(",
"GitlabGroup",
"group",
",",
"GitlabUser",
"user",
")",
"throws",
"IOException",
"{",
"deleteGroupMember",
"(",
"group",
".",
"getId",
"(",
")",
",",
"user",
".",
"getId",
"(",
")",
")",
";",
"}"
] | Delete a group member.
@param group the GitlabGroup
@param user the GitlabUser
@throws IOException on gitlab api call error | [
"Delete",
"a",
"group",
"member",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L748-L750 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.findLast | @NotNull
public Optional<T> findLast() {
return reduce(new BinaryOperator<T>() {
@Override
public T apply(T left, T right) {
return right;
}
});
} | java | @NotNull
public Optional<T> findLast() {
return reduce(new BinaryOperator<T>() {
@Override
public T apply(T left, T right) {
return right;
}
});
} | [
"@",
"NotNull",
"public",
"Optional",
"<",
"T",
">",
"findLast",
"(",
")",
"{",
"return",
"reduce",
"(",
"new",
"BinaryOperator",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"T",
"apply",
"(",
"T",
"left",
",",
"T",
"right",
")",
"{",
... | Returns the last element wrapped by {@code Optional} class.
If stream is empty, returns {@code Optional.empty()}.
<p>This is a short-circuiting terminal operation.
@return an {@code Optional} with the last element
or {@code Optional.empty()} if the stream is empty
@since 1.1.8 | [
"Returns",
"the",
"last",
"element",
"wrapped",
"by",
"{",
"@code",
"Optional",
"}",
"class",
".",
"If",
"stream",
"is",
"empty",
"returns",
"{",
"@code",
"Optional",
".",
"empty",
"()",
"}",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L2044-L2052 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.getDurationInHours | public long getDurationInHours(String name, long defaultValue) {
TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " HOURS");
long duration = getLong(name, defaultValue);
return timeUnit.toHours(duration);
} | java | public long getDurationInHours(String name, long defaultValue) {
TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " HOURS");
long duration = getLong(name, defaultValue);
return timeUnit.toHours(duration);
} | [
"public",
"long",
"getDurationInHours",
"(",
"String",
"name",
",",
"long",
"defaultValue",
")",
"{",
"TimeUnit",
"timeUnit",
"=",
"extractTimeUnit",
"(",
"name",
",",
"defaultValue",
"+",
"\" HOURS\"",
")",
";",
"long",
"duration",
"=",
"getLong",
"(",
"name"... | Gets the duration setting and converts it to hours.
<p/>
The setting must be use one of the following conventions:
<ul>
<li>n MILLISECONDS
<li>n SECONDS
<li>n MINUTES
<li>n HOURS
<li>n DAYS
</ul>
@param name
@param defaultValue in hours
@return hours | [
"Gets",
"the",
"duration",
"setting",
"and",
"converts",
"it",
"to",
"hours",
".",
"<p",
"/",
">",
"The",
"setting",
"must",
"be",
"use",
"one",
"of",
"the",
"following",
"conventions",
":",
"<ul",
">",
"<li",
">",
"n",
"MILLISECONDS",
"<li",
">",
"n",... | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L929-L934 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java | FactoryFiducialCalibration.circleRegularGrid | public static CalibrationDetectorCircleRegularGrid circleRegularGrid( @Nullable ConfigCircleRegularGrid config ,
ConfigGridDimen configGrid ) {
if( config == null )
config = new ConfigCircleRegularGrid();
config.checkValidity();
return new CalibrationDetectorCircleRegularGrid(config,configGrid);
} | java | public static CalibrationDetectorCircleRegularGrid circleRegularGrid( @Nullable ConfigCircleRegularGrid config ,
ConfigGridDimen configGrid ) {
if( config == null )
config = new ConfigCircleRegularGrid();
config.checkValidity();
return new CalibrationDetectorCircleRegularGrid(config,configGrid);
} | [
"public",
"static",
"CalibrationDetectorCircleRegularGrid",
"circleRegularGrid",
"(",
"@",
"Nullable",
"ConfigCircleRegularGrid",
"config",
",",
"ConfigGridDimen",
"configGrid",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"config",
"=",
"new",
"ConfigCircleRegular... | Detector for regular grid of circles. All circles must be entirely inside of the image.
@param config Configuration for target
@return The detector | [
"Detector",
"for",
"regular",
"grid",
"of",
"circles",
".",
"All",
"circles",
"must",
"be",
"entirely",
"inside",
"of",
"the",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java#L122-L129 |
maxirosson/jdroid-android | jdroid-android-google-inappbilling/src/main/java/com/jdroid/android/google/inappbilling/client/InAppBillingClient.java | InAppBillingClient.launchPurchaseFlow | private void launchPurchaseFlow(Activity activity, Product product, ItemType itemType, String oldProductId) {
executeServiceRequest(new Runnable() {
@Override
public void run() {
if (itemType.equals(ItemType.SUBSCRIPTION) && !isSubscriptionsSupported()) {
LOGGER.debug("Failed in-app purchase flow for product id " + product.getId() + ", item type: " + itemType + ". Subscriptions not supported.");
if (listener != null) {
listener.onPurchaseFailed(InAppBillingErrorCode.SUBSCRIPTIONS_NOT_AVAILABLE.newErrorCodeException());
}
} else {
LOGGER.debug("Launching in-app purchase flow for product id " + product.getId() + ", item type: " + itemType);
String productIdToBuy = InAppBillingAppModule.get().getInAppBillingContext().isStaticResponsesEnabled() ?
product.getProductType().getTestProductId() : product.getId();
BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
.setSku(productIdToBuy)
.setType(itemType.getType())
.setOldSku(oldProductId)
.build();
int responseCode = billingClient.launchBillingFlow(activity, purchaseParams);
InAppBillingErrorCode inAppBillingErrorCode = InAppBillingErrorCode.findByErrorResponseCode(responseCode);
if (inAppBillingErrorCode != null) {
if (listener != null) {
AbstractApplication.get().getExceptionHandler().logHandledException(inAppBillingErrorCode.newErrorCodeException());
listener.onPurchaseFailed(inAppBillingErrorCode.newErrorCodeException());
}
}
}
}
});
} | java | private void launchPurchaseFlow(Activity activity, Product product, ItemType itemType, String oldProductId) {
executeServiceRequest(new Runnable() {
@Override
public void run() {
if (itemType.equals(ItemType.SUBSCRIPTION) && !isSubscriptionsSupported()) {
LOGGER.debug("Failed in-app purchase flow for product id " + product.getId() + ", item type: " + itemType + ". Subscriptions not supported.");
if (listener != null) {
listener.onPurchaseFailed(InAppBillingErrorCode.SUBSCRIPTIONS_NOT_AVAILABLE.newErrorCodeException());
}
} else {
LOGGER.debug("Launching in-app purchase flow for product id " + product.getId() + ", item type: " + itemType);
String productIdToBuy = InAppBillingAppModule.get().getInAppBillingContext().isStaticResponsesEnabled() ?
product.getProductType().getTestProductId() : product.getId();
BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
.setSku(productIdToBuy)
.setType(itemType.getType())
.setOldSku(oldProductId)
.build();
int responseCode = billingClient.launchBillingFlow(activity, purchaseParams);
InAppBillingErrorCode inAppBillingErrorCode = InAppBillingErrorCode.findByErrorResponseCode(responseCode);
if (inAppBillingErrorCode != null) {
if (listener != null) {
AbstractApplication.get().getExceptionHandler().logHandledException(inAppBillingErrorCode.newErrorCodeException());
listener.onPurchaseFailed(inAppBillingErrorCode.newErrorCodeException());
}
}
}
}
});
} | [
"private",
"void",
"launchPurchaseFlow",
"(",
"Activity",
"activity",
",",
"Product",
"product",
",",
"ItemType",
"itemType",
",",
"String",
"oldProductId",
")",
"{",
"executeServiceRequest",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"voi... | Initiate the UI flow for an in-app purchase. Call this method to initiate an in-app purchase, which will involve
bringing up the Google Play screen. The calling activity will be paused while the user interacts with Google
Play
This method MUST be called from the UI thread of the Activity.
@param activity The calling activity.
@param product The product to purchase.
@param itemType indicates if it's a product or a subscription (ITEM_TYPE_INAPP or ITEM_TYPE_SUBS)
@param oldProductId The SKU which the new SKU is replacing or null if there is none | [
"Initiate",
"the",
"UI",
"flow",
"for",
"an",
"in",
"-",
"app",
"purchase",
".",
"Call",
"this",
"method",
"to",
"initiate",
"an",
"in",
"-",
"app",
"purchase",
"which",
"will",
"involve",
"bringing",
"up",
"the",
"Google",
"Play",
"screen",
".",
"The",
... | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-google-inappbilling/src/main/java/com/jdroid/android/google/inappbilling/client/InAppBillingClient.java#L393-L422 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java | ValueMap.withLong | public ValueMap withLong(String key, long val) {
return withNumber(key, Long.valueOf(val));
} | java | public ValueMap withLong(String key, long val) {
return withNumber(key, Long.valueOf(val));
} | [
"public",
"ValueMap",
"withLong",
"(",
"String",
"key",
",",
"long",
"val",
")",
"{",
"return",
"withNumber",
"(",
"key",
",",
"Long",
".",
"valueOf",
"(",
"val",
")",
")",
";",
"}"
] | Sets the value of the specified key in the current ValueMap to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"key",
"in",
"the",
"current",
"ValueMap",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L76-L78 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.getFilesUrl | public FileUrlResponse getFilesUrl(String requestId) throws HelloSignException {
String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId;
HttpClient httpClient = this.httpClient.withAuth(auth).withGetParam(PARAM_GET_URL, "1").get(url);
if (httpClient.getLastResponseCode() == 404) {
throw new HelloSignException(String.format("Could not find request with id=%s", requestId));
}
return new FileUrlResponse(httpClient.asJson());
} | java | public FileUrlResponse getFilesUrl(String requestId) throws HelloSignException {
String url = BASE_URI + SIGNATURE_REQUEST_FILES_URI + "/" + requestId;
HttpClient httpClient = this.httpClient.withAuth(auth).withGetParam(PARAM_GET_URL, "1").get(url);
if (httpClient.getLastResponseCode() == 404) {
throw new HelloSignException(String.format("Could not find request with id=%s", requestId));
}
return new FileUrlResponse(httpClient.asJson());
} | [
"public",
"FileUrlResponse",
"getFilesUrl",
"(",
"String",
"requestId",
")",
"throws",
"HelloSignException",
"{",
"String",
"url",
"=",
"BASE_URI",
"+",
"SIGNATURE_REQUEST_FILES_URI",
"+",
"\"/\"",
"+",
"requestId",
";",
"HttpClient",
"httpClient",
"=",
"this",
".",... | Retrieves a URL for a file associated with a signature request.
@param requestId String signature request ID
@return {@link FileUrlResponse}
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response.
@see <a href="https://app.hellosign.com/api/reference#get_files">https://app.hellosign.com/api/reference#get_files</a> | [
"Retrieves",
"a",
"URL",
"for",
"a",
"file",
"associated",
"with",
"a",
"signature",
"request",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L789-L799 |
h2oai/h2o-3 | h2o-algos/src/main/java/hex/util/DimensionReductionUtils.java | DimensionReductionUtils.getTransformedEigenvectors | public static double[][] getTransformedEigenvectors(DataInfo dinfo, double[][] vEigenIn) {
Frame tempFrame = new Frame(dinfo._adaptedFrame);
Frame eigFrame = new water.util.ArrayUtils().frame(vEigenIn);
tempFrame.add(eigFrame);
LinearAlgebraUtils.SMulTask stsk = new LinearAlgebraUtils.SMulTask(dinfo, eigFrame.numCols(),
dinfo._numOffsets[dinfo._numOffsets.length - 1]); // will allocate new memory for _atq
double[][] eigenVecs = stsk.doAll(tempFrame)._atq;
if (eigFrame != null) { // delete frame to prevent leak keys.
eigFrame.delete();
}
// need to normalize eigenvectors after multiplication by transpose(A) so that they have unit norm
double[][] eigenVecsTranspose = transpose(eigenVecs); // transpose will allocate memory
double[] eigenNormsI = new double[eigenVecsTranspose.length];
for (int vecIndex = 0; vecIndex < eigenVecsTranspose.length; vecIndex++) {
eigenNormsI[vecIndex] = 1.0 / l2norm(eigenVecsTranspose[vecIndex]);
}
return transpose(mult(eigenVecsTranspose, eigenNormsI));
} | java | public static double[][] getTransformedEigenvectors(DataInfo dinfo, double[][] vEigenIn) {
Frame tempFrame = new Frame(dinfo._adaptedFrame);
Frame eigFrame = new water.util.ArrayUtils().frame(vEigenIn);
tempFrame.add(eigFrame);
LinearAlgebraUtils.SMulTask stsk = new LinearAlgebraUtils.SMulTask(dinfo, eigFrame.numCols(),
dinfo._numOffsets[dinfo._numOffsets.length - 1]); // will allocate new memory for _atq
double[][] eigenVecs = stsk.doAll(tempFrame)._atq;
if (eigFrame != null) { // delete frame to prevent leak keys.
eigFrame.delete();
}
// need to normalize eigenvectors after multiplication by transpose(A) so that they have unit norm
double[][] eigenVecsTranspose = transpose(eigenVecs); // transpose will allocate memory
double[] eigenNormsI = new double[eigenVecsTranspose.length];
for (int vecIndex = 0; vecIndex < eigenVecsTranspose.length; vecIndex++) {
eigenNormsI[vecIndex] = 1.0 / l2norm(eigenVecsTranspose[vecIndex]);
}
return transpose(mult(eigenVecsTranspose, eigenNormsI));
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"getTransformedEigenvectors",
"(",
"DataInfo",
"dinfo",
",",
"double",
"[",
"]",
"[",
"]",
"vEigenIn",
")",
"{",
"Frame",
"tempFrame",
"=",
"new",
"Frame",
"(",
"dinfo",
".",
"_adaptedFrame",
")",
";",
"F... | This function will tranform the eigenvectors calculated for a matrix T(A) to the ones calculated for
matrix A.
@param dinfo
@param vEigenIn
@return transformed eigenvectors | [
"This",
"function",
"will",
"tranform",
"the",
"eigenvectors",
"calculated",
"for",
"a",
"matrix",
"T",
"(",
"A",
")",
"to",
"the",
"ones",
"calculated",
"for",
"matrix",
"A",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/util/DimensionReductionUtils.java#L118-L139 |
meertensinstituut/mtas | src/main/java/mtas/parser/cql/util/MtasCQLParserSentencePartCondition.java | MtasCQLParserSentencePartCondition.setFirstOccurence | public void setFirstOccurence(int min, int max) throws ParseException {
if (fullCondition == null) {
if ((min < 0) || (min > max) || (max < 1)) {
throw new ParseException("Illegal number {" + min + "," + max + "}");
}
if (min == 0) {
firstOptional = true;
}
firstMinimumOccurence = Math.max(1, min);
firstMaximumOccurence = max;
} else {
throw new ParseException("fullCondition already generated");
}
} | java | public void setFirstOccurence(int min, int max) throws ParseException {
if (fullCondition == null) {
if ((min < 0) || (min > max) || (max < 1)) {
throw new ParseException("Illegal number {" + min + "," + max + "}");
}
if (min == 0) {
firstOptional = true;
}
firstMinimumOccurence = Math.max(1, min);
firstMaximumOccurence = max;
} else {
throw new ParseException("fullCondition already generated");
}
} | [
"public",
"void",
"setFirstOccurence",
"(",
"int",
"min",
",",
"int",
"max",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"fullCondition",
"==",
"null",
")",
"{",
"if",
"(",
"(",
"min",
"<",
"0",
")",
"||",
"(",
"min",
">",
"max",
")",
"||",
"(... | Sets the first occurence.
@param min the min
@param max the max
@throws ParseException the parse exception | [
"Sets",
"the",
"first",
"occurence",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/parser/cql/util/MtasCQLParserSentencePartCondition.java#L83-L96 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java | StartContainersInner.launchExec | public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
} | java | public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
} | [
"public",
"ContainerExecResponseInner",
"launchExec",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"String",
"containerName",
",",
"ContainerExecRequest",
"containerExecRequest",
")",
"{",
"return",
"launchExecWithServiceResponseAsync",
"(",
"... | Starts the exec command for a specific container instance.
Starts the exec command for a specified container instance in a specified resource group and container group.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param containerName The name of the container instance.
@param containerExecRequest The request for the exec command.
@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 ContainerExecResponseInner object if successful. | [
"Starts",
"the",
"exec",
"command",
"for",
"a",
"specific",
"container",
"instance",
".",
"Starts",
"the",
"exec",
"command",
"for",
"a",
"specified",
"container",
"instance",
"in",
"a",
"specified",
"resource",
"group",
"and",
"container",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java#L76-L78 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/parser/GosuParserFactory.java | GosuParserFactory.createParser | public static IGosuParser createParser( String strSource, ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint )
{
return CommonServices.getGosuParserFactory().createParser( strSource, symTable, scriptabilityConstraint );
} | java | public static IGosuParser createParser( String strSource, ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint )
{
return CommonServices.getGosuParserFactory().createParser( strSource, symTable, scriptabilityConstraint );
} | [
"public",
"static",
"IGosuParser",
"createParser",
"(",
"String",
"strSource",
",",
"ISymbolTable",
"symTable",
",",
"IScriptabilityModifier",
"scriptabilityConstraint",
")",
"{",
"return",
"CommonServices",
".",
"getGosuParserFactory",
"(",
")",
".",
"createParser",
"(... | Creates an IGosuParser appropriate for parsing and executing Gosu.
@param strSource The text of the the rule source
@param symTable The symbol table the parser uses to parse and execute the rule
@param scriptabilityConstraint Specifies the types of methods/properties that are visible
@return A parser appropriate for parsing Gosu source. | [
"Creates",
"an",
"IGosuParser",
"appropriate",
"for",
"parsing",
"and",
"executing",
"Gosu",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/parser/GosuParserFactory.java#L22-L25 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java | DomainsInner.createOrUpdateOwnershipIdentifierAsync | public Observable<DomainOwnershipIdentifierInner> createOrUpdateOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name, DomainOwnershipIdentifierInner domainOwnershipIdentifier) {
return createOrUpdateOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name, domainOwnershipIdentifier).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() {
@Override
public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) {
return response.body();
}
});
} | java | public Observable<DomainOwnershipIdentifierInner> createOrUpdateOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name, DomainOwnershipIdentifierInner domainOwnershipIdentifier) {
return createOrUpdateOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name, domainOwnershipIdentifier).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() {
@Override
public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DomainOwnershipIdentifierInner",
">",
"createOrUpdateOwnershipIdentifierAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"String",
"name",
",",
"DomainOwnershipIdentifierInner",
"domainOwnershipIdentifier",
")",
"{",
... | Creates an ownership identifier for a domain or updates identifier details for an existing identifer.
Creates an ownership identifier for a domain or updates identifier details for an existing identifer.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param domainName Name of domain.
@param name Name of identifier.
@param domainOwnershipIdentifier A JSON representation of the domain ownership properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DomainOwnershipIdentifierInner object | [
"Creates",
"an",
"ownership",
"identifier",
"for",
"a",
"domain",
"or",
"updates",
"identifier",
"details",
"for",
"an",
"existing",
"identifer",
".",
"Creates",
"an",
"ownership",
"identifier",
"for",
"a",
"domain",
"or",
"updates",
"identifier",
"details",
"fo... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1552-L1559 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java | InputType.convolutional3D | @Deprecated
public static InputType convolutional3D(long depth, long height, long width, long channels) {
return convolutional3D(Convolution3D.DataFormat.NDHWC, depth, height, width, channels);
} | java | @Deprecated
public static InputType convolutional3D(long depth, long height, long width, long channels) {
return convolutional3D(Convolution3D.DataFormat.NDHWC, depth, height, width, channels);
} | [
"@",
"Deprecated",
"public",
"static",
"InputType",
"convolutional3D",
"(",
"long",
"depth",
",",
"long",
"height",
",",
"long",
"width",
",",
"long",
"channels",
")",
"{",
"return",
"convolutional3D",
"(",
"Convolution3D",
".",
"DataFormat",
".",
"NDHWC",
","... | Input type for 3D convolutional (CNN3D) data in NDHWC format, that is 5d with shape
[miniBatchSize, depth, height, width, channels].
@param height height of the input
@param width Width of the input
@param depth Depth of the input
@param channels Number of channels of the input
@return InputTypeConvolutional3D
@deprecated Use {@link #convolutional3D(Convolution3D.DataFormat, long, long, long, long)} | [
"Input",
"type",
"for",
"3D",
"convolutional",
"(",
"CNN3D",
")",
"data",
"in",
"NDHWC",
"format",
"that",
"is",
"5d",
"with",
"shape",
"[",
"miniBatchSize",
"depth",
"height",
"width",
"channels",
"]",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java#L142-L145 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addReferenceValue | protected void addReferenceValue(Document doc, String fieldName, Object internalValue)
{
String uuid = internalValue.toString();
doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE));
doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES,
Field.Index.NO, Field.TermVector.NO));
} | java | protected void addReferenceValue(Document doc, String fieldName, Object internalValue)
{
String uuid = internalValue.toString();
doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE));
doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES,
Field.Index.NO, Field.TermVector.NO));
} | [
"protected",
"void",
"addReferenceValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"String",
"uuid",
"=",
"internalValue",
".",
"toString",
"(",
")",
";",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"... | Adds the reference value to the document as the named field. The value's
string representation is added as the reference data. Additionally the
reference data is stored in the index.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"reference",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
".",
"The",
"value",
"s",
"string",
"representation",
"is",
"added",
"as",
"the",
"reference",
"data",
".",
"Additionally",
"the",
"reference",
"data",
"is",
"stored... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L790-L796 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateCalendar | private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar)
{
if (isBaseCalendar == true)
{
calendar.setName(record.getString(0));
}
else
{
calendar.setParent(m_projectFile.getCalendarByName(record.getString(0)));
}
calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1)));
calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2)));
calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3)));
calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4)));
calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5)));
calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6)));
calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7)));
m_eventManager.fireCalendarReadEvent(calendar);
} | java | private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar)
{
if (isBaseCalendar == true)
{
calendar.setName(record.getString(0));
}
else
{
calendar.setParent(m_projectFile.getCalendarByName(record.getString(0)));
}
calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1)));
calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2)));
calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3)));
calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4)));
calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5)));
calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6)));
calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7)));
m_eventManager.fireCalendarReadEvent(calendar);
} | [
"private",
"void",
"populateCalendar",
"(",
"Record",
"record",
",",
"ProjectCalendar",
"calendar",
",",
"boolean",
"isBaseCalendar",
")",
"{",
"if",
"(",
"isBaseCalendar",
"==",
"true",
")",
"{",
"calendar",
".",
"setName",
"(",
"record",
".",
"getString",
"(... | Populates a calendar instance.
@param record MPX record
@param calendar calendar instance
@param isBaseCalendar true if this is a base calendar | [
"Populates",
"a",
"calendar",
"instance",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L717-L737 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.updateDocuments | public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocuments(accountId, envelopeId, envelopeDefinition, null);
} | java | public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocuments(accountId, envelopeId, envelopeDefinition, null);
} | [
"public",
"EnvelopeDocumentsResult",
"updateDocuments",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"EnvelopeDefinition",
"envelopeDefinition",
")",
"throws",
"ApiException",
"{",
"return",
"updateDocuments",
"(",
"accountId",
",",
"envelopeId",
",",
"... | Adds one or more documents to an existing envelope document.
Adds one or more documents to an existing envelope document.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param envelopeDefinition (optional)
@return EnvelopeDocumentsResult | [
"Adds",
"one",
"or",
"more",
"documents",
"to",
"an",
"existing",
"envelope",
"document",
".",
"Adds",
"one",
"or",
"more",
"documents",
"to",
"an",
"existing",
"envelope",
"document",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L5130-L5132 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.makeAbsolute | @Pure
public static URL makeAbsolute(URL filename, File current) {
try {
return makeAbsolute(filename, current == null ? null : current.toURI().toURL());
} catch (MalformedURLException exception) {
//
}
return filename;
} | java | @Pure
public static URL makeAbsolute(URL filename, File current) {
try {
return makeAbsolute(filename, current == null ? null : current.toURI().toURL());
} catch (MalformedURLException exception) {
//
}
return filename;
} | [
"@",
"Pure",
"public",
"static",
"URL",
"makeAbsolute",
"(",
"URL",
"filename",
",",
"File",
"current",
")",
"{",
"try",
"{",
"return",
"makeAbsolute",
"(",
"filename",
",",
"current",
"==",
"null",
"?",
"null",
":",
"current",
".",
"toURI",
"(",
")",
... | Make the given filename absolute from the given root if it is not already absolute.
<table border="1" width="100%" summary="Cases">
<thead>
<tr>
<td>{@code filename}</td><td>{@code current}</td><td>Result</td>
</tr>
</thead>
<tr>
<td><code>null</code></td>
<td><code>null</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td><code>null</code></td>
<td><code>/myroot</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td><code>file:/path/to/file</code></td>
<td><code>null</code></td>
<td><code>file:/path/to/file</code></td>
</tr>
<tr>
<td><code>file:path/to/file</code></td>
<td><code>null</code></td>
<td><code>file:path/to/file</code></td>
</tr>
<tr>
<td><code>file:/path/to/file</code></td>
<td><code>/myroot</code></td>
<td><code>file:/path/to/file</code></td>
</tr>
<tr>
<td><code>file:path/to/file</code></td>
<td><code>/myroot</code></td>
<td><code>file:/myroot/path/to/file</code></td>
</tr>
<tr>
<td><code>http://host.com/path/to/file</code></td>
<td><code>null</code></td>
<td><code>http://host.com/path/to/file</code></td>
</tr>
<tr>
<td><code>http://host.com/path/to/file</code></td>
<td><code>/myroot</code></td>
<td><code>http://host.com/path/to/file</code></td>
</tr>
<tr>
<td><code>ftp://host.com/path/to/file</code></td>
<td><code>null</code></td>
<td><code>ftp://host.com/path/to/file</code></td>
</tr>
<tr>
<td><code>ftp://host.com/path/to/file</code></td>
<td><code>/myroot</code></td>
<td><code>ftp://host.com/path/to/file</code></td>
</tr>
<tr>
<td><code>ssh://host.com/path/to/file</code></td>
<td><code>null</code></td>
<td><code>ssh://host.com/path/to/file</code></td>
</tr>
<tr>
<td><code>ssh://host.com/path/to/file</code></td>
<td><code>/myroot</code></td>
<td><code>ssh://host.com/path/to/file</code></td>
</tr>
</table>
@param filename is the name to make absolute.
@param current is the current directory which permits to make absolute.
@return an absolute filename. | [
"Make",
"the",
"given",
"filename",
"absolute",
"from",
"the",
"given",
"root",
"if",
"it",
"is",
"not",
"already",
"absolute",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2255-L2263 |
bwkimmel/java-util | src/main/java/ca/eandb/util/io/FileUtil.java | FileUtil.preOrderTraversal | public static boolean preOrderTraversal(File root, FileVisitor visitor) throws Exception {
if (!visitor.visit(root)) {
return false;
}
if (root.isDirectory()) {
for (File child : root.listFiles()) {
if (!preOrderTraversal(child, visitor)) {
return false;
}
}
}
return true;
} | java | public static boolean preOrderTraversal(File root, FileVisitor visitor) throws Exception {
if (!visitor.visit(root)) {
return false;
}
if (root.isDirectory()) {
for (File child : root.listFiles()) {
if (!preOrderTraversal(child, visitor)) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"preOrderTraversal",
"(",
"File",
"root",
",",
"FileVisitor",
"visitor",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"visitor",
".",
"visit",
"(",
"root",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"root",
... | Walks a directory tree using pre-order traversal. The contents of a
directory are visited after the directory itself is visited.
@param root The <code>File</code> indicating the file or directory to
walk.
@param visitor The <code>FileVisitor</code> to use to visit files and
directories while walking the tree.
@return A value indicating whether the tree walk was completed without
{@link FileVisitor#visit(File)} ever returning false.
@throws Exception If {@link FileVisitor#visit(File)} threw an exception.
@see FileVisitor#visit(File) | [
"Walks",
"a",
"directory",
"tree",
"using",
"pre",
"-",
"order",
"traversal",
".",
"The",
"contents",
"of",
"a",
"directory",
"are",
"visited",
"after",
"the",
"directory",
"itself",
"is",
"visited",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L253-L265 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.generateVpnProfile | public String generateVpnProfile(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) {
return generateVpnProfileWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().last().body();
} | java | public String generateVpnProfile(String resourceGroupName, String virtualNetworkGatewayName, VpnClientParameters parameters) {
return generateVpnProfileWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, parameters).toBlocking().last().body();
} | [
"public",
"String",
"generateVpnProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
",",
"VpnClientParameters",
"parameters",
")",
"{",
"return",
"generateVpnProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGa... | Generates VPN profile for P2S client of the virtual network gateway in the specified resource group. Used for IKEV2 and radius based authentication.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@param parameters Parameters supplied to the generate virtual network gateway VPN client package 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 String object if successful. | [
"Generates",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"Used",
"for",
"IKEV2",
"and",
"radius",
"based",
"authentication",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1632-L1634 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.cacheAuthorizationInfoById | private void cacheAuthorizationInfoById(String id, AuthorizationInfo authorizationInfo) {
Cache<String, AuthorizationInfo> idAuthorizationCache = getAvailableIdAuthorizationCache();
if (idAuthorizationCache != null) {
idAuthorizationCache.put(id, authorizationInfo);
}
} | java | private void cacheAuthorizationInfoById(String id, AuthorizationInfo authorizationInfo) {
Cache<String, AuthorizationInfo> idAuthorizationCache = getAvailableIdAuthorizationCache();
if (idAuthorizationCache != null) {
idAuthorizationCache.put(id, authorizationInfo);
}
} | [
"private",
"void",
"cacheAuthorizationInfoById",
"(",
"String",
"id",
",",
"AuthorizationInfo",
"authorizationInfo",
")",
"{",
"Cache",
"<",
"String",
",",
"AuthorizationInfo",
">",
"idAuthorizationCache",
"=",
"getAvailableIdAuthorizationCache",
"(",
")",
";",
"if",
... | If possible, this method caches the authorization info for an API key by its ID. This may be called
either by an explicit call to get the authorization info by ID or as a side effect of loading the
authorization info by API key and proactive caching by ID. | [
"If",
"possible",
"this",
"method",
"caches",
"the",
"authorization",
"info",
"for",
"an",
"API",
"key",
"by",
"its",
"ID",
".",
"This",
"may",
"be",
"called",
"either",
"by",
"an",
"explicit",
"call",
"to",
"get",
"the",
"authorization",
"info",
"by",
"... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L407-L413 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java | MenuTree.addMenuItem | public void addMenuItem(SubMenuItem parent, MenuItem item) {
SubMenuItem subMenu = (parent != null) ? parent : ROOT;
synchronized (subMenuItems) {
ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>());
subMenuChildren.add(item);
if (item.hasChildren()) {
subMenuItems.put(item, new ArrayList<>());
}
}
} | java | public void addMenuItem(SubMenuItem parent, MenuItem item) {
SubMenuItem subMenu = (parent != null) ? parent : ROOT;
synchronized (subMenuItems) {
ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>());
subMenuChildren.add(item);
if (item.hasChildren()) {
subMenuItems.put(item, new ArrayList<>());
}
}
} | [
"public",
"void",
"addMenuItem",
"(",
"SubMenuItem",
"parent",
",",
"MenuItem",
"item",
")",
"{",
"SubMenuItem",
"subMenu",
"=",
"(",
"parent",
"!=",
"null",
")",
"?",
"parent",
":",
"ROOT",
";",
"synchronized",
"(",
"subMenuItems",
")",
"{",
"ArrayList",
... | add a new menu item to a sub menu, for the top level menu use ROOT.
@param parent the submenu where this should appear
@param item the item to be added | [
"add",
"a",
"new",
"menu",
"item",
"to",
"a",
"sub",
"menu",
"for",
"the",
"top",
"level",
"menu",
"use",
"ROOT",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L62-L73 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/internal/Utils.java | Utils.getResourceString | public static String getResourceString(Context context, String key) {
int id = getIdentifier(context, "string", key);
if (id != 0) {
return context.getResources().getString(id);
} else {
return null;
}
} | java | public static String getResourceString(Context context, String key) {
int id = getIdentifier(context, "string", key);
if (id != 0) {
return context.getResources().getString(id);
} else {
return null;
}
} | [
"public",
"static",
"String",
"getResourceString",
"(",
"Context",
"context",
",",
"String",
"key",
")",
"{",
"int",
"id",
"=",
"getIdentifier",
"(",
"context",
",",
"\"string\"",
",",
"key",
")",
";",
"if",
"(",
"id",
"!=",
"0",
")",
"{",
"return",
"c... | Get the string resource for the given key. Returns null if not found. | [
"Get",
"the",
"string",
"resource",
"for",
"the",
"given",
"key",
".",
"Returns",
"null",
"if",
"not",
"found",
"."
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/internal/Utils.java#L289-L296 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/core/PageSnapshot.java | PageSnapshot.cropAround | public PageSnapshot cropAround(WebElement element, int offsetX, int offsetY) {
try{
image = ImageProcessor.cropAround(image, new Coordinates(element,devicePixelRatio), offsetX, offsetY);
}catch(RasterFormatException rfe){
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE,rfe);
}
return this;
} | java | public PageSnapshot cropAround(WebElement element, int offsetX, int offsetY) {
try{
image = ImageProcessor.cropAround(image, new Coordinates(element,devicePixelRatio), offsetX, offsetY);
}catch(RasterFormatException rfe){
throw new ElementOutsideViewportException(ELEMENT_OUT_OF_VIEWPORT_EX_MESSAGE,rfe);
}
return this;
} | [
"public",
"PageSnapshot",
"cropAround",
"(",
"WebElement",
"element",
",",
"int",
"offsetX",
",",
"int",
"offsetY",
")",
"{",
"try",
"{",
"image",
"=",
"ImageProcessor",
".",
"cropAround",
"(",
"image",
",",
"new",
"Coordinates",
"(",
"element",
",",
"device... | Crop the image around specified element with offset.
@param element WebElement to crop around
@param offsetX offsetX around element in px
@param offsetY offsetY around element in px
@return instance of type PageSnapshot | [
"Crop",
"the",
"image",
"around",
"specified",
"element",
"with",
"offset",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/PageSnapshot.java#L167-L174 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.deleteConversation | public Observable<ComapiResult<Void>> deleteConversation(@NonNull final String conversationId, final String eTag) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueDeleteConversation(conversationId, eTag);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doDeleteConversation(token, conversationId, eTag);
}
} | java | public Observable<ComapiResult<Void>> deleteConversation(@NonNull final String conversationId, final String eTag) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueDeleteConversation(conversationId, eTag);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doDeleteConversation(token, conversationId, eTag);
}
} | [
"public",
"Observable",
"<",
"ComapiResult",
"<",
"Void",
">",
">",
"deleteConversation",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"final",
"String",
"eTag",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
... | Returns observable to create a conversation.
@param conversationId ID of a conversation to delete.
@param eTag ETag for server to check if local version of the data is the same as the one the server side.
@return Observable to to create a conversation. | [
"Returns",
"observable",
"to",
"create",
"a",
"conversation",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L444-L455 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new IllegalArgumentException(String.valueOf(errorMessage));
}
} | java | public static void checkArgument(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new IllegalArgumentException(String.valueOf(errorMessage));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"condition",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"valueOf",
"(",
"errorMes... | Checks the given boolean condition, and throws an {@code IllegalArgumentException} if
the condition is not met (evaluates to {@code false}). The exception will have the
given error message.
@param condition The condition to check
@param errorMessage The message for the {@code IllegalArgumentException} that is thrown if the check fails.
@throws IllegalArgumentException Thrown, if the condition is violated. | [
"Checks",
"the",
"given",
"boolean",
"condition",
"and",
"throws",
"an",
"{",
"@code",
"IllegalArgumentException",
"}",
"if",
"the",
"condition",
"is",
"not",
"met",
"(",
"evaluates",
"to",
"{",
"@code",
"false",
"}",
")",
".",
"The",
"exception",
"will",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/Preconditions.java#L137-L141 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java | CmsTabbedPanel.disableTab | public void disableTab(E tabContent, String reason) {
Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
Element tab = getTabElement(index.intValue());
if ((tab != null) && !m_disabledTabIndexes.containsKey(index)) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(tab.getTitle())) {
m_disabledTabIndexes.put(index, tab.getTitle());
} else {
m_disabledTabIndexes.put(index, "");
}
tab.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
tab.setTitle(reason);
}
} | java | public void disableTab(E tabContent, String reason) {
Integer index = new Integer(m_tabPanel.getWidgetIndex(tabContent));
Element tab = getTabElement(index.intValue());
if ((tab != null) && !m_disabledTabIndexes.containsKey(index)) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(tab.getTitle())) {
m_disabledTabIndexes.put(index, tab.getTitle());
} else {
m_disabledTabIndexes.put(index, "");
}
tab.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabDisabled());
tab.setTitle(reason);
}
} | [
"public",
"void",
"disableTab",
"(",
"E",
"tabContent",
",",
"String",
"reason",
")",
"{",
"Integer",
"index",
"=",
"new",
"Integer",
"(",
"m_tabPanel",
".",
"getWidgetIndex",
"(",
"tabContent",
")",
")",
";",
"Element",
"tab",
"=",
"getTabElement",
"(",
"... | Disables the tab with the given index.<p>
@param tabContent the content of the tab that should be disabled
@param reason the reason why the tab is disabled | [
"Disables",
"the",
"tab",
"with",
"the",
"given",
"index",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java#L375-L388 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/visitclass/PreorderVisitor.java | PreorderVisitor.getSizeOfSurroundingTryBlock | public int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc) {
if (code == null) {
throw new IllegalStateException("Not visiting Code");
}
return Util.getSizeOfSurroundingTryBlock(constantPool, code, vmNameOfExceptionClass, pc);
} | java | public int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc) {
if (code == null) {
throw new IllegalStateException("Not visiting Code");
}
return Util.getSizeOfSurroundingTryBlock(constantPool, code, vmNameOfExceptionClass, pc);
} | [
"public",
"int",
"getSizeOfSurroundingTryBlock",
"(",
"String",
"vmNameOfExceptionClass",
",",
"int",
"pc",
")",
"{",
"if",
"(",
"code",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Not visiting Code\"",
")",
";",
"}",
"return",
"Util... | Get lines of code in try block that surround pc
@param pc
@return number of lines of code in try block | [
"Get",
"lines",
"of",
"code",
"in",
"try",
"block",
"that",
"surround",
"pc"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/visitclass/PreorderVisitor.java#L221-L226 |
tommyettinger/RegExodus | src/main/java/regexodus/ds/CharArrayList.java | CharArrayList.addElements | public void addElements(final int index, final char a[], final int offset, final int length) {
ensureIndex(index);
CharArrays.ensureOffsetLength(a, offset, length);
grow(size + length);
System.arraycopy(this.a, index, this.a, index + length, size - index);
System.arraycopy(a, offset, this.a, index, length);
size += length;
} | java | public void addElements(final int index, final char a[], final int offset, final int length) {
ensureIndex(index);
CharArrays.ensureOffsetLength(a, offset, length);
grow(size + length);
System.arraycopy(this.a, index, this.a, index + length, size - index);
System.arraycopy(a, offset, this.a, index, length);
size += length;
} | [
"public",
"void",
"addElements",
"(",
"final",
"int",
"index",
",",
"final",
"char",
"a",
"[",
"]",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"ensureIndex",
"(",
"index",
")",
";",
"CharArrays",
".",
"ensureOffsetLength",
"(... | Adds elements to this type-specific list using optimized system calls.
@param index the index at which to add elements.
@param a the array containing the elements.
@param offset the offset of the first element to add.
@param length the number of elements to add. | [
"Adds",
"elements",
"to",
"this",
"type",
"-",
"specific",
"list",
"using",
"optimized",
"system",
"calls",
"."
] | train | https://github.com/tommyettinger/RegExodus/blob/d4af9bb7c132c5f9d29f45b76121f93b2f89de16/src/main/java/regexodus/ds/CharArrayList.java#L495-L502 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderDataAger.java | SpiderDataAger.checkTable | private void checkTable() {
// Documentation says that "0 xxx" means data-aging is disabled.
if (m_retentionAge.getValue() == 0) {
m_logger.info("Data aging disabled for table: {}", m_tableDef.getTableName());
return;
}
m_logger.info("Checking expired objects for: {}", m_tableDef.getTableName());
GregorianCalendar checkDate = new GregorianCalendar(Utils.UTC_TIMEZONE);
GregorianCalendar expireDate = m_retentionAge.getExpiredDate(checkDate);
int objsExpired = 0;
String fixedQuery = buildFixedQuery(expireDate);
String contToken = null;
StringBuilder uriParam = new StringBuilder();
do {
uriParam.setLength(0);
uriParam.append(fixedQuery);
if (!Utils.isEmpty(contToken)) {
uriParam.append("&g=");
uriParam.append(contToken);
}
ObjectQuery objQuery = new ObjectQuery(m_tableDef, uriParam.toString());
SearchResultList resultList =
SpiderService.instance().objectQuery(m_tableDef, objQuery);
List<String> objIDs = new ArrayList<>();
for (SearchResult result : resultList.results) {
objIDs.add(result.id());
}
if (deleteBatch(objIDs)) {
contToken = resultList.continuation_token;
} else {
contToken = null;
}
objsExpired += objIDs.size();
reportProgress("Expired " + objsExpired + " objects");
} while (!Utils.isEmpty(contToken));
m_logger.info("Deleted {} objects for {}", objsExpired, m_tableDef.getTableName());
} | java | private void checkTable() {
// Documentation says that "0 xxx" means data-aging is disabled.
if (m_retentionAge.getValue() == 0) {
m_logger.info("Data aging disabled for table: {}", m_tableDef.getTableName());
return;
}
m_logger.info("Checking expired objects for: {}", m_tableDef.getTableName());
GregorianCalendar checkDate = new GregorianCalendar(Utils.UTC_TIMEZONE);
GregorianCalendar expireDate = m_retentionAge.getExpiredDate(checkDate);
int objsExpired = 0;
String fixedQuery = buildFixedQuery(expireDate);
String contToken = null;
StringBuilder uriParam = new StringBuilder();
do {
uriParam.setLength(0);
uriParam.append(fixedQuery);
if (!Utils.isEmpty(contToken)) {
uriParam.append("&g=");
uriParam.append(contToken);
}
ObjectQuery objQuery = new ObjectQuery(m_tableDef, uriParam.toString());
SearchResultList resultList =
SpiderService.instance().objectQuery(m_tableDef, objQuery);
List<String> objIDs = new ArrayList<>();
for (SearchResult result : resultList.results) {
objIDs.add(result.id());
}
if (deleteBatch(objIDs)) {
contToken = resultList.continuation_token;
} else {
contToken = null;
}
objsExpired += objIDs.size();
reportProgress("Expired " + objsExpired + " objects");
} while (!Utils.isEmpty(contToken));
m_logger.info("Deleted {} objects for {}", objsExpired, m_tableDef.getTableName());
} | [
"private",
"void",
"checkTable",
"(",
")",
"{",
"// Documentation says that \"0 xxx\" means data-aging is disabled.",
"if",
"(",
"m_retentionAge",
".",
"getValue",
"(",
")",
"==",
"0",
")",
"{",
"m_logger",
".",
"info",
"(",
"\"Data aging disabled for table: {}\"",
",",... | Scan the given table for expired objects relative to the given date. | [
"Scan",
"the",
"given",
"table",
"for",
"expired",
"objects",
"relative",
"to",
"the",
"given",
"date",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderDataAger.java#L75-L114 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java | TagRenderingBase.renderAttributes | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote)
{
HashMap map = null;
switch (type) {
case AbstractAttributeState.ATTR_GENERAL:
map = state.getGeneralAttributeMap();
break;
default:
String s = Bundle.getString("Tags_ParameterRenderError",
new Object[]{new Integer(type)});
logger.error(s);
throw new IllegalStateException(s);
}
renderGeneral(map, sb, doubleQuote);
} | java | protected void renderAttributes(int type, AbstractRenderAppender sb, AbstractAttributeState state, boolean doubleQuote)
{
HashMap map = null;
switch (type) {
case AbstractAttributeState.ATTR_GENERAL:
map = state.getGeneralAttributeMap();
break;
default:
String s = Bundle.getString("Tags_ParameterRenderError",
new Object[]{new Integer(type)});
logger.error(s);
throw new IllegalStateException(s);
}
renderGeneral(map, sb, doubleQuote);
} | [
"protected",
"void",
"renderAttributes",
"(",
"int",
"type",
",",
"AbstractRenderAppender",
"sb",
",",
"AbstractAttributeState",
"state",
",",
"boolean",
"doubleQuote",
")",
"{",
"HashMap",
"map",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"Abs... | Render all of the attributes defined in a map and return the string value. The attributes
are rendered with in a name="value" style supported by XML.
@param type an integer key indentifying the map | [
"Render",
"all",
"of",
"the",
"attributes",
"defined",
"in",
"a",
"map",
"and",
"return",
"the",
"string",
"value",
".",
"The",
"attributes",
"are",
"rendered",
"with",
"in",
"a",
"name",
"=",
"value",
"style",
"supported",
"by",
"XML",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/TagRenderingBase.java#L224-L238 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllFieldDefinitions | public void forAllFieldDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getFields(); it.hasNext(); )
{
_curFieldDef = (FieldDescriptorDef)it.next();
if (!isFeatureIgnored(LEVEL_FIELD) &&
!_curFieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
{
generate(template);
}
}
_curFieldDef = null;
} | java | public void forAllFieldDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getFields(); it.hasNext(); )
{
_curFieldDef = (FieldDescriptorDef)it.next();
if (!isFeatureIgnored(LEVEL_FIELD) &&
!_curFieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
{
generate(template);
}
}
_curFieldDef = null;
} | [
"public",
"void",
"forAllFieldDefinitions",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_curClassDef",
".",
"getFields",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
... | Processes the template for all field definitions of the current class definition (including inherited ones if
required)
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"field",
"definitions",
"of",
"the",
"current",
"class",
"definition",
"(",
"including",
"inherited",
"ones",
"if",
"required",
")"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L791-L803 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UBench.java | UBench.press | public UReport press(UMode mode, final long timeLimit, final TimeUnit timeUnit) {
return press(mode, 0, 0, 0.0, timeLimit, timeUnit);
} | java | public UReport press(UMode mode, final long timeLimit, final TimeUnit timeUnit) {
return press(mode, 0, 0, 0.0, timeLimit, timeUnit);
} | [
"public",
"UReport",
"press",
"(",
"UMode",
"mode",
",",
"final",
"long",
"timeLimit",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"press",
"(",
"mode",
",",
"0",
",",
"0",
",",
"0.0",
",",
"timeLimit",
",",
"timeUnit",
")",
";",
"}"
] | Benchmark all added tasks until they exceed the set time limit
@param mode
The UMode execution model to use for task execution
@param timeLimit
combined with the timeUnit, indicates how long to run tests
for. A value less than or equal to 0 turns off this check.
@param timeUnit
combined with the timeLimit, indicates how long to run tests
for.
@return the results of all completed tasks. | [
"Benchmark",
"all",
"added",
"tasks",
"until",
"they",
"exceed",
"the",
"set",
"time",
"limit"
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L351-L353 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/GlConverter.java | GlConverter.setString | public int setString(String strString, boolean bDisplayOption, int moveMode) // init this field override for other value
{ // By default, move the data as-is
String string = Constants.BLANK;
int fieldLength = strString.length();
for (int source = 0; source < (int)fieldLength; source++)
{
if ((strString.charAt(source) >= '0') && (strString.charAt(source) <= '9'))
string += strString.charAt(source);
}
fieldLength = string.length();
if ((fieldLength <= 4) && (fieldLength > 0))
string += "000";
return super.setString(string, bDisplayOption, moveMode); // Convert to internal rep and return
} | java | public int setString(String strString, boolean bDisplayOption, int moveMode) // init this field override for other value
{ // By default, move the data as-is
String string = Constants.BLANK;
int fieldLength = strString.length();
for (int source = 0; source < (int)fieldLength; source++)
{
if ((strString.charAt(source) >= '0') && (strString.charAt(source) <= '9'))
string += strString.charAt(source);
}
fieldLength = string.length();
if ((fieldLength <= 4) && (fieldLength > 0))
string += "000";
return super.setString(string, bDisplayOption, moveMode); // Convert to internal rep and return
} | [
"public",
"int",
"setString",
"(",
"String",
"strString",
",",
"boolean",
"bDisplayOption",
",",
"int",
"moveMode",
")",
"// init this field override for other value",
"{",
"// By default, move the data as-is",
"String",
"string",
"=",
"Constants",
".",
"BLANK",
";",
"i... | Convert and move string to this field.
Override this method to convert the String to the actual Physical Data Type.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code. | [
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Override",
"this",
"method",
"to",
"convert",
"the",
"String",
"to",
"the",
"actual",
"Physical",
"Data",
"Type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/GlConverter.java#L78-L91 |
JodaOrg/joda-time | src/main/java/org/joda/time/base/BasePeriod.java | BasePeriod.checkAndUpdate | private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) {
int index = indexOf(type);
if (index == -1) {
if (newValue != 0) {
throw new IllegalArgumentException(
"Period does not support field '" + type.getName() + "'");
}
} else {
values[index] = newValue;
}
} | java | private void checkAndUpdate(DurationFieldType type, int[] values, int newValue) {
int index = indexOf(type);
if (index == -1) {
if (newValue != 0) {
throw new IllegalArgumentException(
"Period does not support field '" + type.getName() + "'");
}
} else {
values[index] = newValue;
}
} | [
"private",
"void",
"checkAndUpdate",
"(",
"DurationFieldType",
"type",
",",
"int",
"[",
"]",
"values",
",",
"int",
"newValue",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"type",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"if",
"(",
... | Checks whether a field type is supported, and if so adds the new value
to the relevant index in the specified array.
@param type the field type
@param values the array to update
@param newValue the new value to store if successful | [
"Checks",
"whether",
"a",
"field",
"type",
"is",
"supported",
"and",
"if",
"so",
"adds",
"the",
"new",
"value",
"to",
"the",
"relevant",
"index",
"in",
"the",
"specified",
"array",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BasePeriod.java#L389-L399 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java | Unmarshaller.initializeEmbedded | private static Object initializeEmbedded(EmbeddedMetadata embeddedMetadata, Object target) {
try {
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
Object embeddedObject = null;
if (constructorMetadata.isClassicConstructionStrategy()) {
embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
}
if (embeddedObject == null) {
embeddedObject = constructorMetadata.getConstructorMethodHandle().invoke();
}
return embeddedObject;
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | java | private static Object initializeEmbedded(EmbeddedMetadata embeddedMetadata, Object target) {
try {
ConstructorMetadata constructorMetadata = embeddedMetadata.getConstructorMetadata();
Object embeddedObject = null;
if (constructorMetadata.isClassicConstructionStrategy()) {
embeddedObject = embeddedMetadata.getReadMethod().invoke(target);
}
if (embeddedObject == null) {
embeddedObject = constructorMetadata.getConstructorMethodHandle().invoke();
}
return embeddedObject;
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | [
"private",
"static",
"Object",
"initializeEmbedded",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"ConstructorMetadata",
"constructorMetadata",
"=",
"embeddedMetadata",
".",
"getConstructorMetadata",
"(",
")",
";",
"Object"... | Initializes the Embedded object represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field
@param target
the object in which the embedded field is declared/accessible from
@return the initialized object
@throws EntityManagerException
if any error occurs during initialization of the embedded object | [
"Initializes",
"the",
"Embedded",
"object",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L353-L367 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/MiniSat.java | MiniSat.miniCard | public static MiniSat miniCard(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | java | public static MiniSat miniCard(final FormulaFactory f) {
return new MiniSat(f, SolverStyle.MINICARD, new MiniSatConfig.Builder().build(), null);
} | [
"public",
"static",
"MiniSat",
"miniCard",
"(",
"final",
"FormulaFactory",
"f",
")",
"{",
"return",
"new",
"MiniSat",
"(",
"f",
",",
"SolverStyle",
".",
"MINICARD",
",",
"new",
"MiniSatConfig",
".",
"Builder",
"(",
")",
".",
"build",
"(",
")",
",",
"null... | Returns a new MiniCard solver.
@param f the formula factory
@return the solver | [
"Returns",
"a",
"new",
"MiniCard",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L171-L173 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateCuboid | public static VertexData generateCuboid(Vector3f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3);
destination.addAttribute(1, normalsAttribute);
final TFloatList normals = new TFloatArrayList();
final TIntList indices = destination.getIndices();
final VertexAttribute textureCoordsAttribute = new VertexAttribute("textureCoords", DataType.FLOAT, 2);
destination.addAttribute(2, textureCoordsAttribute);
final TFloatList texturesCoords = new TFloatArrayList();
// Generate the mesh
generateCuboid(positions, normals, texturesCoords, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
normalsAttribute.setData(normals);
textureCoordsAttribute.setData(texturesCoords);
return destination;
} | java | public static VertexData generateCuboid(Vector3f size) {
final VertexData destination = new VertexData();
final VertexAttribute positionsAttribute = new VertexAttribute("positions", DataType.FLOAT, 3);
destination.addAttribute(0, positionsAttribute);
final TFloatList positions = new TFloatArrayList();
final VertexAttribute normalsAttribute = new VertexAttribute("normals", DataType.FLOAT, 3);
destination.addAttribute(1, normalsAttribute);
final TFloatList normals = new TFloatArrayList();
final TIntList indices = destination.getIndices();
final VertexAttribute textureCoordsAttribute = new VertexAttribute("textureCoords", DataType.FLOAT, 2);
destination.addAttribute(2, textureCoordsAttribute);
final TFloatList texturesCoords = new TFloatArrayList();
// Generate the mesh
generateCuboid(positions, normals, texturesCoords, indices, size);
// Put the mesh in the vertex data
positionsAttribute.setData(positions);
normalsAttribute.setData(normals);
textureCoordsAttribute.setData(texturesCoords);
return destination;
} | [
"public",
"static",
"VertexData",
"generateCuboid",
"(",
"Vector3f",
"size",
")",
"{",
"final",
"VertexData",
"destination",
"=",
"new",
"VertexData",
"(",
")",
";",
"final",
"VertexAttribute",
"positionsAttribute",
"=",
"new",
"VertexAttribute",
"(",
"\"positions\"... | Generates a solid cuboid mesh. This mesh includes the positions, normals, texture coords and tangents. The center is at the middle of the cuboid.
@param size The size of the cuboid to generate, on x, y and z
@return The vertex data | [
"Generates",
"a",
"solid",
"cuboid",
"mesh",
".",
"This",
"mesh",
"includes",
"the",
"positions",
"normals",
"texture",
"coords",
"and",
"tangents",
".",
"The",
"center",
"is",
"at",
"the",
"middle",
"of",
"the",
"cuboid",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L660-L679 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java | SeaGlassStyle.compileDefaults | private void compileDefaults(Map<String, TreeMap<String, Object>> compiledDefaults, UIDefaults d) {
for (Map.Entry<Object, Object> entry : d.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String) entry.getKey();
String kp = parsePrefix(key);
if (kp == null)
continue;
TreeMap<String, Object> map = compiledDefaults.get(kp);
if (map == null) {
map = new TreeMap<String, Object>();
compiledDefaults.put(kp, map);
}
map.put(key, entry.getValue());
}
}
} | java | private void compileDefaults(Map<String, TreeMap<String, Object>> compiledDefaults, UIDefaults d) {
for (Map.Entry<Object, Object> entry : d.entrySet()) {
if (entry.getKey() instanceof String) {
String key = (String) entry.getKey();
String kp = parsePrefix(key);
if (kp == null)
continue;
TreeMap<String, Object> map = compiledDefaults.get(kp);
if (map == null) {
map = new TreeMap<String, Object>();
compiledDefaults.put(kp, map);
}
map.put(key, entry.getValue());
}
}
} | [
"private",
"void",
"compileDefaults",
"(",
"Map",
"<",
"String",
",",
"TreeMap",
"<",
"String",
",",
"Object",
">",
">",
"compiledDefaults",
",",
"UIDefaults",
"d",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
... | Iterates over all the keys in the specified UIDefaults and compiles those
keys into the comiledDefaults data structure. It relies on parsing the
"prefix" out of the key. If the key is not a String or is null then it is
ignored. In all other cases a prefix is parsed out (even if that prefix
is the empty String or is a "fake" prefix. That is, suppose you had a key
Foo~~MySpecial.KeyThing~~. In this case this is not a SeaGlass formatted
key, but we don't care, we treat it as if it is. This doesn't pose any
harm, it will simply never be used).
@param compiledDefaults the compiled defaults data structure.
@param d the UIDefaults to be parsed. | [
"Iterates",
"over",
"all",
"the",
"keys",
"in",
"the",
"specified",
"UIDefaults",
"and",
"compiles",
"those",
"keys",
"into",
"the",
"comiledDefaults",
"data",
"structure",
".",
"It",
"relies",
"on",
"parsing",
"the",
"prefix",
"out",
"of",
"the",
"key",
"."... | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L502-L522 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java | PreConditionException.validateLesserThan | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PreConditionException
{
if( value.doubleValue() < limit.doubleValue() )
{
return;
}
throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value );
} | java | public static void validateLesserThan( Number value, Number limit, String identifier )
throws PreConditionException
{
if( value.doubleValue() < limit.doubleValue() )
{
return;
}
throw new PreConditionException( identifier + " was not lesser than " + limit + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateLesserThan",
"(",
"Number",
"value",
",",
"Number",
"limit",
",",
"String",
"identifier",
")",
"throws",
"PreConditionException",
"{",
"if",
"(",
"value",
".",
"doubleValue",
"(",
")",
"<",
"limit",
".",
"doubleValue",
"(",... | Validates that the value is lesser than a limit.
<p/>
This method ensures that <code>value < limit</code>.
@param identifier The name of the object.
@param limit The limit that the value must be smaller than.
@param value The value to be tested.
@throws PreConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"is",
"lesser",
"than",
"a",
"limit",
".",
"<p",
"/",
">",
"This",
"method",
"ensures",
"that",
"<code",
">",
"value",
"<",
"limit<",
"/",
"code",
">",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PreConditionException.java#L190-L198 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/IndexTagCalc.java | IndexTagCalc.isHashConfigurationIsSupported | private static boolean isHashConfigurationIsSupported(long numBuckets, int tagBits, int hashSize) {
int hashBitsNeeded = getTotalBitsNeeded(numBuckets, tagBits);
switch (hashSize) {
case 32:
case 64:
return hashBitsNeeded <= hashSize;
default:
}
if (hashSize >= 128)
return tagBits <= 64 && getIndexBitsUsed(numBuckets) <= 64;
return false;
} | java | private static boolean isHashConfigurationIsSupported(long numBuckets, int tagBits, int hashSize) {
int hashBitsNeeded = getTotalBitsNeeded(numBuckets, tagBits);
switch (hashSize) {
case 32:
case 64:
return hashBitsNeeded <= hashSize;
default:
}
if (hashSize >= 128)
return tagBits <= 64 && getIndexBitsUsed(numBuckets) <= 64;
return false;
} | [
"private",
"static",
"boolean",
"isHashConfigurationIsSupported",
"(",
"long",
"numBuckets",
",",
"int",
"tagBits",
",",
"int",
"hashSize",
")",
"{",
"int",
"hashBitsNeeded",
"=",
"getTotalBitsNeeded",
"(",
"numBuckets",
",",
"tagBits",
")",
";",
"switch",
"(",
... | Determines if the chosen hash function is long enough for the table
configuration used. | [
"Determines",
"if",
"the",
"chosen",
"hash",
"function",
"is",
"long",
"enough",
"for",
"the",
"table",
"configuration",
"used",
"."
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/IndexTagCalc.java#L111-L122 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java | BondTools.giveAngleBothMethods | public static double giveAngleBothMethods(IAtom from, IAtom to1, IAtom to2, boolean bool) {
return giveAngleBothMethods(from.getPoint2d(), to1.getPoint2d(), to2.getPoint2d(), bool);
} | java | public static double giveAngleBothMethods(IAtom from, IAtom to1, IAtom to2, boolean bool) {
return giveAngleBothMethods(from.getPoint2d(), to1.getPoint2d(), to2.getPoint2d(), bool);
} | [
"public",
"static",
"double",
"giveAngleBothMethods",
"(",
"IAtom",
"from",
",",
"IAtom",
"to1",
",",
"IAtom",
"to2",
",",
"boolean",
"bool",
")",
"{",
"return",
"giveAngleBothMethods",
"(",
"from",
".",
"getPoint2d",
"(",
")",
",",
"to1",
".",
"getPoint2d",... | Gives the angle between two lines starting at atom from and going to to1
and to2. If bool=false the angle starts from the middle line and goes from
0 to PI or 0 to -PI if the to2 is on the left or right side of the line. If
bool=true the angle goes from 0 to 2PI.
@param from the atom to view from.
@param to1 first direction to look in.
@param to2 second direction to look in.
@param bool true=angle is 0 to 2PI, false=angel is -PI to PI.
@return The angle in rad. | [
"Gives",
"the",
"angle",
"between",
"two",
"lines",
"starting",
"at",
"atom",
"from",
"and",
"going",
"to",
"to1",
"and",
"to2",
".",
"If",
"bool",
"=",
"false",
"the",
"angle",
"starts",
"from",
"the",
"middle",
"line",
"and",
"goes",
"from",
"0",
"to... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java#L157-L159 |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java | HiveSessionImplwithUGI.cancelDelegationToken | private void cancelDelegationToken() throws HiveSQLException {
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close the metastore connection created with this delegation token
Hive.closeCurrent();
}
} | java | private void cancelDelegationToken() throws HiveSQLException {
if (delegationTokenStr != null) {
try {
Hive.get(getHiveConf()).cancelDelegationToken(delegationTokenStr);
} catch (HiveException e) {
throw new HiveSQLException("Couldn't cancel delegation token", e);
}
// close the metastore connection created with this delegation token
Hive.closeCurrent();
}
} | [
"private",
"void",
"cancelDelegationToken",
"(",
")",
"throws",
"HiveSQLException",
"{",
"if",
"(",
"delegationTokenStr",
"!=",
"null",
")",
"{",
"try",
"{",
"Hive",
".",
"get",
"(",
"getHiveConf",
"(",
")",
")",
".",
"cancelDelegationToken",
"(",
"delegationT... | If the session has a delegation token obtained from the metastore, then cancel it | [
"If",
"the",
"session",
"has",
"a",
"delegation",
"token",
"obtained",
"from",
"the",
"metastore",
"then",
"cancel",
"it"
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java#L141-L151 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/TypedQuery.java | TypedQuery.withResultSetAsyncListeners | public TypedQuery<ENTITY> withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) {
this.options.setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners));
return this;
} | java | public TypedQuery<ENTITY> withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) {
this.options.setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners));
return this;
} | [
"public",
"TypedQuery",
"<",
"ENTITY",
">",
"withResultSetAsyncListeners",
"(",
"List",
"<",
"Function",
"<",
"ResultSet",
",",
"ResultSet",
">",
">",
"resultSetAsyncListeners",
")",
"{",
"this",
".",
"options",
".",
"setResultSetAsyncListeners",
"(",
"Optional",
... | Add the given list of async listeners on the {@link com.datastax.driver.core.ResultSet} object.
Example of usage:
<pre class="code"><code class="java">
.withResultSetAsyncListeners(Arrays.asList(resultSet -> {
//Do something with the resultSet object here
}))
</code></pre>
Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong> | [
"Add",
"the",
"given",
"list",
"of",
"async",
"listeners",
"on",
"the",
"{",
"@link",
"com",
".",
"datastax",
".",
"driver",
".",
"core",
".",
"ResultSet",
"}",
"object",
".",
"Example",
"of",
"usage",
":",
"<pre",
"class",
"=",
"code",
">",
"<code",
... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/raw/TypedQuery.java#L83-L86 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java | FXMLProcessor.loadFxmlPaneAndControllerPair | public static Pair<Pane, AbstractFXController> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY);
} | java | public static Pair<Pane, AbstractFXController> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY);
} | [
"public",
"static",
"Pair",
"<",
"Pane",
",",
"AbstractFXController",
">",
"loadFxmlPaneAndControllerPair",
"(",
"final",
"String",
"fxmlFileUri",
",",
"final",
"Class",
"clazz",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"loadFxmlPaneAndControllerPair",
... | Method load the pane and controller of the given fxml file.
@param fxmlFileUri the uri pointing to the fxml file within the classpath.
@param clazz the responsible class which is used for class path resolution.
@return an pair of the pane and its controller.
@throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist. | [
"Method",
"load",
"the",
"pane",
"and",
"controller",
"of",
"the",
"given",
"fxml",
"file",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java#L121-L123 |
logic-ng/LogicNG | src/main/java/org/logicng/bdds/orderings/ForceOrdering.java | ForceOrdering.orderingFromTentativeNewLocations | private LinkedHashMap<HypergraphNode<Variable>, Integer> orderingFromTentativeNewLocations(final LinkedHashMap<HypergraphNode<Variable>, Double> newLocations) {
final LinkedHashMap<HypergraphNode<Variable>, Integer> ordering = new LinkedHashMap<>();
final List<Map.Entry<HypergraphNode<Variable>, Double>> list = new ArrayList<>(newLocations.entrySet());
Collections.sort(list, COMPARATOR);
int count = 0;
for (final Map.Entry<HypergraphNode<Variable>, Double> entry : list)
ordering.put(entry.getKey(), count++);
return ordering;
}
/**
* The abortion criteria for the FORCE algorithm.
* @param lastOrdering the ordering of the last step
* @param currentOrdering the ordering of the current step
* @return {@code true} if the algorithm should proceed, {@code false} if it should stop
*/
private boolean shouldProceed(final Map<HypergraphNode<Variable>, Integer> lastOrdering, final Map<HypergraphNode<Variable>, Integer> currentOrdering) {
return !lastOrdering.equals(currentOrdering);
} | java | private LinkedHashMap<HypergraphNode<Variable>, Integer> orderingFromTentativeNewLocations(final LinkedHashMap<HypergraphNode<Variable>, Double> newLocations) {
final LinkedHashMap<HypergraphNode<Variable>, Integer> ordering = new LinkedHashMap<>();
final List<Map.Entry<HypergraphNode<Variable>, Double>> list = new ArrayList<>(newLocations.entrySet());
Collections.sort(list, COMPARATOR);
int count = 0;
for (final Map.Entry<HypergraphNode<Variable>, Double> entry : list)
ordering.put(entry.getKey(), count++);
return ordering;
}
/**
* The abortion criteria for the FORCE algorithm.
* @param lastOrdering the ordering of the last step
* @param currentOrdering the ordering of the current step
* @return {@code true} if the algorithm should proceed, {@code false} if it should stop
*/
private boolean shouldProceed(final Map<HypergraphNode<Variable>, Integer> lastOrdering, final Map<HypergraphNode<Variable>, Integer> currentOrdering) {
return !lastOrdering.equals(currentOrdering);
} | [
"private",
"LinkedHashMap",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Integer",
">",
"orderingFromTentativeNewLocations",
"(",
"final",
"LinkedHashMap",
"<",
"HypergraphNode",
"<",
"Variable",
">",
",",
"Double",
">",
"newLocations",
")",
"{",
"final",
"L... | Generates a new integer ordering from tentative new locations of nodes with the double weighting.
@param newLocations the tentative new locations
@return the new integer ordering | [
"Generates",
"a",
"new",
"integer",
"ordering",
"from",
"tentative",
"new",
"locations",
"of",
"nodes",
"with",
"the",
"double",
"weighting",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/bdds/orderings/ForceOrdering.java#L120-L138 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java | GenericDraweeHierarchy.setPlaceholderImage | public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
} | java | public void setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType) {
setPlaceholderImage(mResources.getDrawable(resourceId), scaleType);
} | [
"public",
"void",
"setPlaceholderImage",
"(",
"int",
"resourceId",
",",
"ScalingUtils",
".",
"ScaleType",
"scaleType",
")",
"{",
"setPlaceholderImage",
"(",
"mResources",
".",
"getDrawable",
"(",
"resourceId",
")",
",",
"scaleType",
")",
";",
"}"
] | Sets a new placeholder drawable with scale type.
@param resourceId an identifier of an Android drawable or color resource.
@param ScalingUtils.ScaleType a new scale type. | [
"Sets",
"a",
"new",
"placeholder",
"drawable",
"with",
"scale",
"type",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java#L453-L455 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.getDateLastVisitedBy | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException {
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | java | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, CmsResource resource) throws CmsException {
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | [
"public",
"long",
"getDateLastVisitedBy",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"getDateLastVisitedBy",
"(",
"cms",
".",
"getRequestContext",
"(",
")",... | Returns the date when the resource was last visited by the user.<p>
@param cms the current users context
@param user the user to check the date
@param resource the resource to check the date
@return the date when the resource was last visited by the user
@throws CmsException if something goes wrong | [
"Returns",
"the",
"date",
"when",
"the",
"resource",
"was",
"last",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L90-L93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.