repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
contentful/contentful.java | src/main/java/com/contentful/java/cda/rich/RichTextFactory.java | RichTextFactory.resolveRichDocument | private static void resolveRichDocument(CDAEntry entry, CDAField field) {
"""
Resolve all children of the top most document block.
@param entry the entry to contain the field to be walked
@param field the id of the field to be walked.
"""
final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id());
if (rawValue == null) {
return;
}
for (final String locale : rawValue.keySet()) {
final Object raw = rawValue.get(locale);
if (raw == null || raw instanceof CDARichNode) {
// ignore null and already parsed values
continue;
}
final Map<String, Object> map = (Map<String, Object>) rawValue.get(locale);
entry.setField(locale, field.id(), RESOLVER_MAP.get("document").resolve(map));
}
} | java | private static void resolveRichDocument(CDAEntry entry, CDAField field) {
final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id());
if (rawValue == null) {
return;
}
for (final String locale : rawValue.keySet()) {
final Object raw = rawValue.get(locale);
if (raw == null || raw instanceof CDARichNode) {
// ignore null and already parsed values
continue;
}
final Map<String, Object> map = (Map<String, Object>) rawValue.get(locale);
entry.setField(locale, field.id(), RESOLVER_MAP.get("document").resolve(map));
}
} | [
"private",
"static",
"void",
"resolveRichDocument",
"(",
"CDAEntry",
"entry",
",",
"CDAField",
"field",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"rawValue",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"entry",
".",
"rawFields",
"(",
")",
".",
"get",
"(",
"field",
".",
"id",
"(",
")",
")",
";",
"if",
"(",
"rawValue",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"final",
"String",
"locale",
":",
"rawValue",
".",
"keySet",
"(",
")",
")",
"{",
"final",
"Object",
"raw",
"=",
"rawValue",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"raw",
"==",
"null",
"||",
"raw",
"instanceof",
"CDARichNode",
")",
"{",
"// ignore null and already parsed values",
"continue",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"rawValue",
".",
"get",
"(",
"locale",
")",
";",
"entry",
".",
"setField",
"(",
"locale",
",",
"field",
".",
"id",
"(",
")",
",",
"RESOLVER_MAP",
".",
"get",
"(",
"\"document\"",
")",
".",
"resolve",
"(",
"map",
")",
")",
";",
"}",
"}"
] | Resolve all children of the top most document block.
@param entry the entry to contain the field to be walked
@param field the id of the field to be walked. | [
"Resolve",
"all",
"children",
"of",
"the",
"top",
"most",
"document",
"block",
"."
] | train | https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/rich/RichTextFactory.java#L285-L301 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java | CleverTapAPI.getDefaultInstance | @SuppressWarnings("WeakerAccess")
public static @Nullable CleverTapAPI getDefaultInstance(Context context) {
"""
Returns the default shared instance of the CleverTap SDK.
@param context The Android context
@return The {@link CleverTapAPI} object
"""
// For Google Play Store/Android Studio tracking
sdkVersion = BuildConfig.SDK_VERSION_STRING;
if (defaultConfig == null) {
ManifestInfo manifest = ManifestInfo.getInstance(context);
String accountId = manifest.getAccountId();
String accountToken = manifest.getAcountToken();
String accountRegion = manifest.getAccountRegion();
if(accountId == null || accountToken == null) {
Logger.i("Account ID or Account token is missing from AndroidManifest.xml, unable to create default instance");
return null;
}
if (accountRegion == null) {
Logger.i("Account Region not specified in the AndroidManifest - using default region");
}
defaultConfig = CleverTapInstanceConfig.createDefaultInstance(context, accountId, accountToken, accountRegion);
defaultConfig.setDebugLevel(getDebugLevel());
}
return instanceWithConfig(context, defaultConfig);
} | java | @SuppressWarnings("WeakerAccess")
public static @Nullable CleverTapAPI getDefaultInstance(Context context) {
// For Google Play Store/Android Studio tracking
sdkVersion = BuildConfig.SDK_VERSION_STRING;
if (defaultConfig == null) {
ManifestInfo manifest = ManifestInfo.getInstance(context);
String accountId = manifest.getAccountId();
String accountToken = manifest.getAcountToken();
String accountRegion = manifest.getAccountRegion();
if(accountId == null || accountToken == null) {
Logger.i("Account ID or Account token is missing from AndroidManifest.xml, unable to create default instance");
return null;
}
if (accountRegion == null) {
Logger.i("Account Region not specified in the AndroidManifest - using default region");
}
defaultConfig = CleverTapInstanceConfig.createDefaultInstance(context, accountId, accountToken, accountRegion);
defaultConfig.setDebugLevel(getDebugLevel());
}
return instanceWithConfig(context, defaultConfig);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"@",
"Nullable",
"CleverTapAPI",
"getDefaultInstance",
"(",
"Context",
"context",
")",
"{",
"// For Google Play Store/Android Studio tracking",
"sdkVersion",
"=",
"BuildConfig",
".",
"SDK_VERSION_STRING",
";",
"if",
"(",
"defaultConfig",
"==",
"null",
")",
"{",
"ManifestInfo",
"manifest",
"=",
"ManifestInfo",
".",
"getInstance",
"(",
"context",
")",
";",
"String",
"accountId",
"=",
"manifest",
".",
"getAccountId",
"(",
")",
";",
"String",
"accountToken",
"=",
"manifest",
".",
"getAcountToken",
"(",
")",
";",
"String",
"accountRegion",
"=",
"manifest",
".",
"getAccountRegion",
"(",
")",
";",
"if",
"(",
"accountId",
"==",
"null",
"||",
"accountToken",
"==",
"null",
")",
"{",
"Logger",
".",
"i",
"(",
"\"Account ID or Account token is missing from AndroidManifest.xml, unable to create default instance\"",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"accountRegion",
"==",
"null",
")",
"{",
"Logger",
".",
"i",
"(",
"\"Account Region not specified in the AndroidManifest - using default region\"",
")",
";",
"}",
"defaultConfig",
"=",
"CleverTapInstanceConfig",
".",
"createDefaultInstance",
"(",
"context",
",",
"accountId",
",",
"accountToken",
",",
"accountRegion",
")",
";",
"defaultConfig",
".",
"setDebugLevel",
"(",
"getDebugLevel",
"(",
")",
")",
";",
"}",
"return",
"instanceWithConfig",
"(",
"context",
",",
"defaultConfig",
")",
";",
"}"
] | Returns the default shared instance of the CleverTap SDK.
@param context The Android context
@return The {@link CleverTapAPI} object | [
"Returns",
"the",
"default",
"shared",
"instance",
"of",
"the",
"CleverTap",
"SDK",
"."
] | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L485-L505 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java | DFSAdmin.metaSave | public int metaSave(String[] argv, int idx) throws IOException {
"""
Dumps DFS data structures into specified file.
Usage: java DFSAdmin -metasave filename
@param argv List of of command line parameters.
@param idx The index of the command that is being processed.
@exception IOException if an error accoured wile accessing
the file or path.
"""
String pathname = argv[idx];
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
dfs.metaSave(pathname);
System.out.println("Created file " + pathname + " on server " +
dfs.getUri());
return 0;
} | java | public int metaSave(String[] argv, int idx) throws IOException {
String pathname = argv[idx];
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
dfs.metaSave(pathname);
System.out.println("Created file " + pathname + " on server " +
dfs.getUri());
return 0;
} | [
"public",
"int",
"metaSave",
"(",
"String",
"[",
"]",
"argv",
",",
"int",
"idx",
")",
"throws",
"IOException",
"{",
"String",
"pathname",
"=",
"argv",
"[",
"idx",
"]",
";",
"DistributedFileSystem",
"dfs",
"=",
"getDFS",
"(",
")",
";",
"if",
"(",
"dfs",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"FileSystem is \"",
"+",
"getFS",
"(",
")",
".",
"getUri",
"(",
")",
")",
";",
"return",
"-",
"1",
";",
"}",
"dfs",
".",
"metaSave",
"(",
"pathname",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Created file \"",
"+",
"pathname",
"+",
"\" on server \"",
"+",
"dfs",
".",
"getUri",
"(",
")",
")",
";",
"return",
"0",
";",
"}"
] | Dumps DFS data structures into specified file.
Usage: java DFSAdmin -metasave filename
@param argv List of of command line parameters.
@param idx The index of the command that is being processed.
@exception IOException if an error accoured wile accessing
the file or path. | [
"Dumps",
"DFS",
"data",
"structures",
"into",
"specified",
"file",
".",
"Usage",
":",
"java",
"DFSAdmin",
"-",
"metasave",
"filename"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L774-L785 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java | ServiceInstanceQuery.getEqualQueryCriterion | public ServiceInstanceQuery getEqualQueryCriterion(String key, String value) {
"""
Get a metadata value equal QueryCriterion.
Add a QueryCriterion to check ServiceInstance has metadata value
equal to target.
@param key
the metadata key.
@param value
the metadata value should equal to.
@return
the ServiceInstanceQuery.
"""
QueryCriterion c = new EqualQueryCriterion(key, value);
addQueryCriterion(c);
return this;
} | java | public ServiceInstanceQuery getEqualQueryCriterion(String key, String value){
QueryCriterion c = new EqualQueryCriterion(key, value);
addQueryCriterion(c);
return this;
} | [
"public",
"ServiceInstanceQuery",
"getEqualQueryCriterion",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"QueryCriterion",
"c",
"=",
"new",
"EqualQueryCriterion",
"(",
"key",
",",
"value",
")",
";",
"addQueryCriterion",
"(",
"c",
")",
";",
"return",
"this",
";",
"}"
] | Get a metadata value equal QueryCriterion.
Add a QueryCriterion to check ServiceInstance has metadata value
equal to target.
@param key
the metadata key.
@param value
the metadata value should equal to.
@return
the ServiceInstanceQuery. | [
"Get",
"a",
"metadata",
"value",
"equal",
"QueryCriterion",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java#L61-L65 |
NessComputing/components-ness-jdbi | src/main/java/com/nesscomputing/jdbi/JdbiMappers.java | JdbiMappers.getDateTime | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException {
"""
Returns a DateTime object representing the date or null if the input is null.
"""
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | java | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | [
"public",
"static",
"DateTime",
"getDateTime",
"(",
"final",
"ResultSet",
"rs",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"final",
"Timestamp",
"ts",
"=",
"rs",
".",
"getTimestamp",
"(",
"columnName",
")",
";",
"return",
"(",
"ts",
"==",
"null",
")",
"?",
"null",
":",
"new",
"DateTime",
"(",
"ts",
")",
";",
"}"
] | Returns a DateTime object representing the date or null if the input is null. | [
"Returns",
"a",
"DateTime",
"object",
"representing",
"the",
"date",
"or",
"null",
"if",
"the",
"input",
"is",
"null",
"."
] | train | https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L73-L78 |
jankotek/mapdb | src/main/java/org/mapdb/io/DataIO.java | DataIO.packLong | static public void packLong(DataOutput out, long value) throws IOException {
"""
Pack long into output.
It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
@param out DataOutput to put value into
@param value to be serialized, must be non-negative
@throws java.io.IOException in case of IO error
"""
//$DELAY$
int shift = 63-Long.numberOfLeadingZeros(value);
shift -= shift%7; // round down to nearest multiple of 7
while(shift!=0){
out.writeByte((byte) ((value>>>shift) & 0x7F) );
//$DELAY$
shift-=7;
}
out.writeByte((byte) ((value & 0x7F)|0x80));
} | java | static public void packLong(DataOutput out, long value) throws IOException {
//$DELAY$
int shift = 63-Long.numberOfLeadingZeros(value);
shift -= shift%7; // round down to nearest multiple of 7
while(shift!=0){
out.writeByte((byte) ((value>>>shift) & 0x7F) );
//$DELAY$
shift-=7;
}
out.writeByte((byte) ((value & 0x7F)|0x80));
} | [
"static",
"public",
"void",
"packLong",
"(",
"DataOutput",
"out",
",",
"long",
"value",
")",
"throws",
"IOException",
"{",
"//$DELAY$",
"int",
"shift",
"=",
"63",
"-",
"Long",
".",
"numberOfLeadingZeros",
"(",
"value",
")",
";",
"shift",
"-=",
"shift",
"%",
"7",
";",
"// round down to nearest multiple of 7",
"while",
"(",
"shift",
"!=",
"0",
")",
"{",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"shift",
")",
"&",
"0x7F",
")",
")",
";",
"//$DELAY$",
"shift",
"-=",
"7",
";",
"}",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"(",
"(",
"value",
"&",
"0x7F",
")",
"|",
"0x80",
")",
")",
";",
"}"
] | Pack long into output.
It will occupy 1-10 bytes depending on value (lower values occupy smaller space)
@param out DataOutput to put value into
@param value to be serialized, must be non-negative
@throws java.io.IOException in case of IO error | [
"Pack",
"long",
"into",
"output",
".",
"It",
"will",
"occupy",
"1",
"-",
"10",
"bytes",
"depending",
"on",
"value",
"(",
"lower",
"values",
"occupy",
"smaller",
"space",
")"
] | train | https://github.com/jankotek/mapdb/blob/dfd873b2b9cc4e299228839c100adf93a98f1903/src/main/java/org/mapdb/io/DataIO.java#L111-L121 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.naturalTime | @Expose
public static String naturalTime(final Date duration, final Locale locale) {
"""
Same as {@link #naturalTime(Date)} for the specified locale.
@param duration
The duration
@param locale
The locale
@return String representing the relative date
"""
return naturalTime(new Date(), duration, locale);
} | java | @Expose
public static String naturalTime(final Date duration, final Locale locale)
{
return naturalTime(new Date(), duration, locale);
} | [
"@",
"Expose",
"public",
"static",
"String",
"naturalTime",
"(",
"final",
"Date",
"duration",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"naturalTime",
"(",
"new",
"Date",
"(",
")",
",",
"duration",
",",
"locale",
")",
";",
"}"
] | Same as {@link #naturalTime(Date)} for the specified locale.
@param duration
The duration
@param locale
The locale
@return String representing the relative date | [
"Same",
"as",
"{",
"@link",
"#naturalTime",
"(",
"Date",
")",
"}",
"for",
"the",
"specified",
"locale",
"."
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1666-L1670 |
Karumi/Dexter | dexter/src/main/java/com/karumi/dexter/DexterInstance.java | DexterInstance.checkSelfPermission | private int checkSelfPermission(Activity activity, String permission) {
"""
/*
Workaround for RuntimeException of Parcel#readException.
For additional details:
https://github.com/Karumi/Dexter/issues/86
"""
try {
return androidPermissionService.checkSelfPermission(activity, permission);
} catch (RuntimeException ignored) {
return PackageManager.PERMISSION_DENIED;
}
} | java | private int checkSelfPermission(Activity activity, String permission) {
try {
return androidPermissionService.checkSelfPermission(activity, permission);
} catch (RuntimeException ignored) {
return PackageManager.PERMISSION_DENIED;
}
} | [
"private",
"int",
"checkSelfPermission",
"(",
"Activity",
"activity",
",",
"String",
"permission",
")",
"{",
"try",
"{",
"return",
"androidPermissionService",
".",
"checkSelfPermission",
"(",
"activity",
",",
"permission",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"ignored",
")",
"{",
"return",
"PackageManager",
".",
"PERMISSION_DENIED",
";",
"}",
"}"
] | /*
Workaround for RuntimeException of Parcel#readException.
For additional details:
https://github.com/Karumi/Dexter/issues/86 | [
"/",
"*",
"Workaround",
"for",
"RuntimeException",
"of",
"Parcel#readException",
"."
] | train | https://github.com/Karumi/Dexter/blob/11cfa35a2eaa51f01f6678adb69bed0382a867e7/dexter/src/main/java/com/karumi/dexter/DexterInstance.java#L203-L209 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, Map params, Closure metaClosure, Closure rowClosure) throws SQLException {
"""
A variant of {@link #eachRow(String, java.util.List, groovy.lang.Closure, groovy.lang.Closure)}
useful when providing the named parameters as a map.
@param sql the sql statement
@param params a map of named parameters
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs
@since 1.8.7
"""
eachRow(sql, singletonList(params), metaClosure, rowClosure);
} | java | public void eachRow(String sql, Map params, Closure metaClosure, Closure rowClosure) throws SQLException {
eachRow(sql, singletonList(params), metaClosure, rowClosure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"Map",
"params",
",",
"Closure",
"metaClosure",
",",
"Closure",
"rowClosure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"singletonList",
"(",
"params",
")",
",",
"metaClosure",
",",
"rowClosure",
")",
";",
"}"
] | A variant of {@link #eachRow(String, java.util.List, groovy.lang.Closure, groovy.lang.Closure)}
useful when providing the named parameters as a map.
@param sql the sql statement
@param params a map of named parameters
@param metaClosure called for meta data (only once after sql execution)
@param rowClosure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs
@since 1.8.7 | [
"A",
"variant",
"of",
"{",
"@link",
"#eachRow",
"(",
"String",
"java",
".",
"util",
".",
"List",
"groovy",
".",
"lang",
".",
"Closure",
"groovy",
".",
"lang",
".",
"Closure",
")",
"}",
"useful",
"when",
"providing",
"the",
"named",
"parameters",
"as",
"a",
"map",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1351-L1353 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java | ThinTableModel.bumpTableSize | public void bumpTableSize(int iBumpIncrement, boolean bInsertRowsInModel) {
"""
The underlying table has increased in size, change the model to access these extra record(s).
Note: This is not implemented correctly.
@param iNewSize The new table size.
"""
int iRowCount = this.setRowCount(this.getRowCount(false) + iBumpIncrement); // Theoretical EOF value for table scroller (Actual when known).
if (m_iLastRecord != RECORD_UNKNOWN)
m_iLastRecord = iRowCount - 1; // Sync
if (bInsertRowsInModel)
this.fireTableRowsInserted(this.getRowCount(true) - iBumpIncrement, this.getRowCount(true) - 1);
} | java | public void bumpTableSize(int iBumpIncrement, boolean bInsertRowsInModel)
{
int iRowCount = this.setRowCount(this.getRowCount(false) + iBumpIncrement); // Theoretical EOF value for table scroller (Actual when known).
if (m_iLastRecord != RECORD_UNKNOWN)
m_iLastRecord = iRowCount - 1; // Sync
if (bInsertRowsInModel)
this.fireTableRowsInserted(this.getRowCount(true) - iBumpIncrement, this.getRowCount(true) - 1);
} | [
"public",
"void",
"bumpTableSize",
"(",
"int",
"iBumpIncrement",
",",
"boolean",
"bInsertRowsInModel",
")",
"{",
"int",
"iRowCount",
"=",
"this",
".",
"setRowCount",
"(",
"this",
".",
"getRowCount",
"(",
"false",
")",
"+",
"iBumpIncrement",
")",
";",
"// Theoretical EOF value for table scroller (Actual when known).",
"if",
"(",
"m_iLastRecord",
"!=",
"RECORD_UNKNOWN",
")",
"m_iLastRecord",
"=",
"iRowCount",
"-",
"1",
";",
"// Sync",
"if",
"(",
"bInsertRowsInModel",
")",
"this",
".",
"fireTableRowsInserted",
"(",
"this",
".",
"getRowCount",
"(",
"true",
")",
"-",
"iBumpIncrement",
",",
"this",
".",
"getRowCount",
"(",
"true",
")",
"-",
"1",
")",
";",
"}"
] | The underlying table has increased in size, change the model to access these extra record(s).
Note: This is not implemented correctly.
@param iNewSize The new table size. | [
"The",
"underlying",
"table",
"has",
"increased",
"in",
"size",
"change",
"the",
"model",
"to",
"access",
"these",
"extra",
"record",
"(",
"s",
")",
".",
"Note",
":",
"This",
"is",
"not",
"implemented",
"correctly",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L780-L787 |
sahan/IckleBot | icklebot/src/main/java/com/lonepulse/icklebot/injector/IllegalContextException.java | IllegalContextException.createMessage | private static final String createMessage(Object illegalContext, Set<Class<?>> applicableContexts) {
"""
<p>Creates the message to be used in {@link #IllegalContextException(Object, Set)}.
@since 1.0.0
"""
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("The given context ");
stringBuilder.append(illegalContext.getClass().getName());
stringBuilder.append(" is illegal");
if(applicableContexts != null && applicableContexts.size() > 0) {
stringBuilder.append(". The only applicable contexts are");
for (Class<?> contextClass : applicableContexts) {
stringBuilder.append(", ");
stringBuilder.append(contextClass.getName());
}
}
stringBuilder.append(". ");
return stringBuilder.toString();
} | java | private static final String createMessage(Object illegalContext, Set<Class<?>> applicableContexts) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("The given context ");
stringBuilder.append(illegalContext.getClass().getName());
stringBuilder.append(" is illegal");
if(applicableContexts != null && applicableContexts.size() > 0) {
stringBuilder.append(". The only applicable contexts are");
for (Class<?> contextClass : applicableContexts) {
stringBuilder.append(", ");
stringBuilder.append(contextClass.getName());
}
}
stringBuilder.append(". ");
return stringBuilder.toString();
} | [
"private",
"static",
"final",
"String",
"createMessage",
"(",
"Object",
"illegalContext",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"applicableContexts",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"stringBuilder",
".",
"append",
"(",
"\"The given context \"",
")",
";",
"stringBuilder",
".",
"append",
"(",
"illegalContext",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"stringBuilder",
".",
"append",
"(",
"\" is illegal\"",
")",
";",
"if",
"(",
"applicableContexts",
"!=",
"null",
"&&",
"applicableContexts",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"\". The only applicable contexts are\"",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"contextClass",
":",
"applicableContexts",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"\", \"",
")",
";",
"stringBuilder",
".",
"append",
"(",
"contextClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"stringBuilder",
".",
"append",
"(",
"\". \"",
")",
";",
"return",
"stringBuilder",
".",
"toString",
"(",
")",
";",
"}"
] | <p>Creates the message to be used in {@link #IllegalContextException(Object, Set)}.
@since 1.0.0 | [
"<p",
">",
"Creates",
"the",
"message",
"to",
"be",
"used",
"in",
"{",
"@link",
"#IllegalContextException",
"(",
"Object",
"Set",
")",
"}",
"."
] | train | https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/injector/IllegalContextException.java#L48-L70 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java | AbstractSequenceClassifier.classifyDocumentStdin | public boolean classifyDocumentStdin(DocumentReaderAndWriter<IN> readerWriter)
throws IOException {
"""
Classify stdin by documents seperated by 3 blank line
@param readerWriter
@return boolean reached end of IO
@throws IOException
"""
BufferedReader is = new BufferedReader(new InputStreamReader(System.in, flags.inputEncoding));
String line;
String text = "";
String eol = "\n";
String sentence = "<s>";
int blankLines = 0;
while ((line = is.readLine()) != null) {
if (line.trim().equals("")) {
++blankLines;
if (blankLines > 3) {
return false;
} else if (blankLines > 2) {
ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);
classifyAndWriteAnswers(documents, readerWriter);
text = "";
} else {
text += sentence + eol;
}
} else {
text += line + eol;
blankLines = 0;
}
}
// Classify last document before input stream end
if (text.trim() != "") {
ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);
classifyAndWriteAnswers(documents, readerWriter);
}
return (line == null); // reached eol
} | java | public boolean classifyDocumentStdin(DocumentReaderAndWriter<IN> readerWriter)
throws IOException
{
BufferedReader is = new BufferedReader(new InputStreamReader(System.in, flags.inputEncoding));
String line;
String text = "";
String eol = "\n";
String sentence = "<s>";
int blankLines = 0;
while ((line = is.readLine()) != null) {
if (line.trim().equals("")) {
++blankLines;
if (blankLines > 3) {
return false;
} else if (blankLines > 2) {
ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);
classifyAndWriteAnswers(documents, readerWriter);
text = "";
} else {
text += sentence + eol;
}
} else {
text += line + eol;
blankLines = 0;
}
}
// Classify last document before input stream end
if (text.trim() != "") {
ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter);
classifyAndWriteAnswers(documents, readerWriter);
}
return (line == null); // reached eol
} | [
"public",
"boolean",
"classifyDocumentStdin",
"(",
"DocumentReaderAndWriter",
"<",
"IN",
">",
"readerWriter",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"is",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"System",
".",
"in",
",",
"flags",
".",
"inputEncoding",
")",
")",
";",
"String",
"line",
";",
"String",
"text",
"=",
"\"\"",
";",
"String",
"eol",
"=",
"\"\\n\"",
";",
"String",
"sentence",
"=",
"\"<s>\"",
";",
"int",
"blankLines",
"=",
"0",
";",
"while",
"(",
"(",
"line",
"=",
"is",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"line",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"++",
"blankLines",
";",
"if",
"(",
"blankLines",
">",
"3",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"blankLines",
">",
"2",
")",
"{",
"ObjectBank",
"<",
"List",
"<",
"IN",
">>",
"documents",
"=",
"makeObjectBankFromString",
"(",
"text",
",",
"readerWriter",
")",
";",
"classifyAndWriteAnswers",
"(",
"documents",
",",
"readerWriter",
")",
";",
"text",
"=",
"\"\"",
";",
"}",
"else",
"{",
"text",
"+=",
"sentence",
"+",
"eol",
";",
"}",
"}",
"else",
"{",
"text",
"+=",
"line",
"+",
"eol",
";",
"blankLines",
"=",
"0",
";",
"}",
"}",
"// Classify last document before input stream end\r",
"if",
"(",
"text",
".",
"trim",
"(",
")",
"!=",
"\"\"",
")",
"{",
"ObjectBank",
"<",
"List",
"<",
"IN",
">>",
"documents",
"=",
"makeObjectBankFromString",
"(",
"text",
",",
"readerWriter",
")",
";",
"classifyAndWriteAnswers",
"(",
"documents",
",",
"readerWriter",
")",
";",
"}",
"return",
"(",
"line",
"==",
"null",
")",
";",
"// reached eol\r",
"}"
] | Classify stdin by documents seperated by 3 blank line
@param readerWriter
@return boolean reached end of IO
@throws IOException | [
"Classify",
"stdin",
"by",
"documents",
"seperated",
"by",
"3",
"blank",
"line"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L973-L1005 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/IteratorUtils.java | IteratorUtils.mapRRMDSI | public static JavaRDD<MultiDataSet> mapRRMDSI(JavaRDD<List<Writable>> rdd, RecordReaderMultiDataSetIterator iterator) {
"""
Apply a single reader {@link RecordReaderMultiDataSetIterator} to a {@code JavaRDD<List<Writable>>}.
<b>NOTE</b>: The RecordReaderMultiDataSetIterator <it>must</it> use {@link SparkSourceDummyReader} in place of
"real" RecordReader instances
@param rdd RDD with writables
@param iterator RecordReaderMultiDataSetIterator with {@link SparkSourceDummyReader} readers
"""
checkIterator(iterator, 1, 0);
return mapRRMDSIRecords(rdd.map(new Function<List<Writable>,DataVecRecords>(){
@Override
public DataVecRecords call(List<Writable> v1) throws Exception {
return new DataVecRecords(Collections.singletonList(v1), null);
}
}), iterator);
} | java | public static JavaRDD<MultiDataSet> mapRRMDSI(JavaRDD<List<Writable>> rdd, RecordReaderMultiDataSetIterator iterator){
checkIterator(iterator, 1, 0);
return mapRRMDSIRecords(rdd.map(new Function<List<Writable>,DataVecRecords>(){
@Override
public DataVecRecords call(List<Writable> v1) throws Exception {
return new DataVecRecords(Collections.singletonList(v1), null);
}
}), iterator);
} | [
"public",
"static",
"JavaRDD",
"<",
"MultiDataSet",
">",
"mapRRMDSI",
"(",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"rdd",
",",
"RecordReaderMultiDataSetIterator",
"iterator",
")",
"{",
"checkIterator",
"(",
"iterator",
",",
"1",
",",
"0",
")",
";",
"return",
"mapRRMDSIRecords",
"(",
"rdd",
".",
"map",
"(",
"new",
"Function",
"<",
"List",
"<",
"Writable",
">",
",",
"DataVecRecords",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DataVecRecords",
"call",
"(",
"List",
"<",
"Writable",
">",
"v1",
")",
"throws",
"Exception",
"{",
"return",
"new",
"DataVecRecords",
"(",
"Collections",
".",
"singletonList",
"(",
"v1",
")",
",",
"null",
")",
";",
"}",
"}",
")",
",",
"iterator",
")",
";",
"}"
] | Apply a single reader {@link RecordReaderMultiDataSetIterator} to a {@code JavaRDD<List<Writable>>}.
<b>NOTE</b>: The RecordReaderMultiDataSetIterator <it>must</it> use {@link SparkSourceDummyReader} in place of
"real" RecordReader instances
@param rdd RDD with writables
@param iterator RecordReaderMultiDataSetIterator with {@link SparkSourceDummyReader} readers | [
"Apply",
"a",
"single",
"reader",
"{",
"@link",
"RecordReaderMultiDataSetIterator",
"}",
"to",
"a",
"{",
"@code",
"JavaRDD<List<Writable",
">>",
"}",
".",
"<b",
">",
"NOTE<",
"/",
"b",
">",
":",
"The",
"RecordReaderMultiDataSetIterator",
"<it",
">",
"must<",
"/",
"it",
">",
"use",
"{",
"@link",
"SparkSourceDummyReader",
"}",
"in",
"place",
"of",
"real",
"RecordReader",
"instances"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/IteratorUtils.java#L48-L56 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.updateContact | public Contact updateContact(final String id, ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
"""
Updates an existing contact. You only need to supply the unique id that
was returned upon creation.
"""
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
String request = CONTACTPATH + "/" + id;
return messageBirdService.sendPayLoad("PATCH", request, contactRequest, Contact.class);
} | java | public Contact updateContact(final String id, ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
String request = CONTACTPATH + "/" + id;
return messageBirdService.sendPayLoad("PATCH", request, contactRequest, Contact.class);
} | [
"public",
"Contact",
"updateContact",
"(",
"final",
"String",
"id",
",",
"ContactRequest",
"contactRequest",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Contact ID must be specified.\"",
")",
";",
"}",
"String",
"request",
"=",
"CONTACTPATH",
"+",
"\"/\"",
"+",
"id",
";",
"return",
"messageBirdService",
".",
"sendPayLoad",
"(",
"\"PATCH\"",
",",
"request",
",",
"contactRequest",
",",
"Contact",
".",
"class",
")",
";",
"}"
] | Updates an existing contact. You only need to supply the unique id that
was returned upon creation. | [
"Updates",
"an",
"existing",
"contact",
".",
"You",
"only",
"need",
"to",
"supply",
"the",
"unique",
"id",
"that",
"was",
"returned",
"upon",
"creation",
"."
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L579-L585 |
perwendel/spark | src/main/java/spark/http/matching/Halt.java | Halt.modify | public static void modify(HttpServletResponse httpResponse, Body body, HaltException halt) {
"""
Modifies the HTTP response and body based on the provided HaltException.
@param httpResponse The HTTP servlet response
@param body The body content
@param halt The halt exception object
"""
httpResponse.setStatus(halt.statusCode());
if (halt.body() != null) {
body.set(halt.body());
} else {
body.set("");
}
} | java | public static void modify(HttpServletResponse httpResponse, Body body, HaltException halt) {
httpResponse.setStatus(halt.statusCode());
if (halt.body() != null) {
body.set(halt.body());
} else {
body.set("");
}
} | [
"public",
"static",
"void",
"modify",
"(",
"HttpServletResponse",
"httpResponse",
",",
"Body",
"body",
",",
"HaltException",
"halt",
")",
"{",
"httpResponse",
".",
"setStatus",
"(",
"halt",
".",
"statusCode",
"(",
")",
")",
";",
"if",
"(",
"halt",
".",
"body",
"(",
")",
"!=",
"null",
")",
"{",
"body",
".",
"set",
"(",
"halt",
".",
"body",
"(",
")",
")",
";",
"}",
"else",
"{",
"body",
".",
"set",
"(",
"\"\"",
")",
";",
"}",
"}"
] | Modifies the HTTP response and body based on the provided HaltException.
@param httpResponse The HTTP servlet response
@param body The body content
@param halt The halt exception object | [
"Modifies",
"the",
"HTTP",
"response",
"and",
"body",
"based",
"on",
"the",
"provided",
"HaltException",
"."
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/http/matching/Halt.java#L35-L44 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java | ProcessFaxClientSpi.executeProcess | protected ProcessOutput executeProcess(FaxJob faxJob,String command,FaxActionType faxActionType) {
"""
Executes the process and returns the output.
@param faxJob
The fax job object
@param command
The command to execute
@param faxActionType
The fax action type
@return The process output
"""
if(command==null)
{
this.throwUnsupportedException();
}
//update command
String updatedCommand=command;
if(this.useWindowsCommandPrefix)
{
//init buffer
StringBuilder buffer=new StringBuilder(updatedCommand.length()+this.windowsCommandPrefix.length()+1);
//update command
buffer.append(this.windowsCommandPrefix);
buffer.append(" ");
buffer.append(updatedCommand);
updatedCommand=buffer.toString();
}
//execute process
ProcessOutput processOutput=ProcessExecutorHelper.executeProcess(this,updatedCommand);
//validate output (if not valid, an exception should be thrown)
this.validateProcessOutput(processOutput,faxActionType);
//update fax job
this.updateFaxJob(faxJob,processOutput,faxActionType);
return processOutput;
} | java | protected ProcessOutput executeProcess(FaxJob faxJob,String command,FaxActionType faxActionType)
{
if(command==null)
{
this.throwUnsupportedException();
}
//update command
String updatedCommand=command;
if(this.useWindowsCommandPrefix)
{
//init buffer
StringBuilder buffer=new StringBuilder(updatedCommand.length()+this.windowsCommandPrefix.length()+1);
//update command
buffer.append(this.windowsCommandPrefix);
buffer.append(" ");
buffer.append(updatedCommand);
updatedCommand=buffer.toString();
}
//execute process
ProcessOutput processOutput=ProcessExecutorHelper.executeProcess(this,updatedCommand);
//validate output (if not valid, an exception should be thrown)
this.validateProcessOutput(processOutput,faxActionType);
//update fax job
this.updateFaxJob(faxJob,processOutput,faxActionType);
return processOutput;
} | [
"protected",
"ProcessOutput",
"executeProcess",
"(",
"FaxJob",
"faxJob",
",",
"String",
"command",
",",
"FaxActionType",
"faxActionType",
")",
"{",
"if",
"(",
"command",
"==",
"null",
")",
"{",
"this",
".",
"throwUnsupportedException",
"(",
")",
";",
"}",
"//update command",
"String",
"updatedCommand",
"=",
"command",
";",
"if",
"(",
"this",
".",
"useWindowsCommandPrefix",
")",
"{",
"//init buffer",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"updatedCommand",
".",
"length",
"(",
")",
"+",
"this",
".",
"windowsCommandPrefix",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"//update command",
"buffer",
".",
"append",
"(",
"this",
".",
"windowsCommandPrefix",
")",
";",
"buffer",
".",
"append",
"(",
"\" \"",
")",
";",
"buffer",
".",
"append",
"(",
"updatedCommand",
")",
";",
"updatedCommand",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"//execute process",
"ProcessOutput",
"processOutput",
"=",
"ProcessExecutorHelper",
".",
"executeProcess",
"(",
"this",
",",
"updatedCommand",
")",
";",
"//validate output (if not valid, an exception should be thrown)",
"this",
".",
"validateProcessOutput",
"(",
"processOutput",
",",
"faxActionType",
")",
";",
"//update fax job",
"this",
".",
"updateFaxJob",
"(",
"faxJob",
",",
"processOutput",
",",
"faxActionType",
")",
";",
"return",
"processOutput",
";",
"}"
] | Executes the process and returns the output.
@param faxJob
The fax job object
@param command
The command to execute
@param faxActionType
The fax action type
@return The process output | [
"Executes",
"the",
"process",
"and",
"returns",
"the",
"output",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/process/ProcessFaxClientSpi.java#L467-L498 |
haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.getSupport | private int getSupport(int[] itemset, int index, Node node) {
"""
Returns the support value for the given item set if found in the T-tree
and 0 otherwise.
@param itemset the given item set.
@param index the current index in the given item set.
@param nodes the nodes of the current T-tree level.
@return the support value (0 if not found)
"""
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
if (index == 0) {
return child.support;
} else {
if (child.children != null) {
return getSupport(itemset, index - 1, child);
}
}
}
return 0;
} | java | private int getSupport(int[] itemset, int index, Node node) {
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
if (index == 0) {
return child.support;
} else {
if (child.children != null) {
return getSupport(itemset, index - 1, child);
}
}
}
return 0;
} | [
"private",
"int",
"getSupport",
"(",
"int",
"[",
"]",
"itemset",
",",
"int",
"index",
",",
"Node",
"node",
")",
"{",
"int",
"item",
"=",
"order",
"[",
"itemset",
"[",
"index",
"]",
"]",
";",
"Node",
"child",
"=",
"node",
".",
"children",
"[",
"item",
"]",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"// If the index is 0, then this is the last element (i.e the",
"// input is a 1 itemset) and therefore item set found",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"return",
"child",
".",
"support",
";",
"}",
"else",
"{",
"if",
"(",
"child",
".",
"children",
"!=",
"null",
")",
"{",
"return",
"getSupport",
"(",
"itemset",
",",
"index",
"-",
"1",
",",
"child",
")",
";",
"}",
"}",
"}",
"return",
"0",
";",
"}"
] | Returns the support value for the given item set if found in the T-tree
and 0 otherwise.
@param itemset the given item set.
@param index the current index in the given item set.
@param nodes the nodes of the current T-tree level.
@return the support value (0 if not found) | [
"Returns",
"the",
"support",
"value",
"for",
"the",
"given",
"item",
"set",
"if",
"found",
"in",
"the",
"T",
"-",
"tree",
"and",
"0",
"otherwise",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L147-L163 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/transfer/TransferManager.java | TransferManager.uploadDirectory | public MultipleFileUpload uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories, ObjectMetadataProvider metadataProvider, ObjectTaggingProvider taggingProvider) {
"""
Uploads all files in the directory given to the bucket named, optionally
recursing for all subdirectories.
<p>
S3 will overwrite any existing objects that happen to have the same key,
just as when uploading individual files, so use with caution.
</p>
<p>
If you are uploading <a href="http://aws.amazon.com/kms/">AWS
KMS</a>-encrypted objects, you need to specify the correct region of the
bucket on your client and configure AWS Signature Version 4 for added
security. For more information on how to do this, see
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#
specify-signature-version
</p>
@param bucketName
The name of the bucket to upload objects to.
@param virtualDirectoryKeyPrefix
The key prefix of the virtual directory to upload to. Use the
null or empty string to upload files to the root of the
bucket.
@param directory
The directory to upload.
@param includeSubdirectories
Whether to include subdirectories in the upload. If true,
files found in subdirectories will be included with an
appropriate concatenation to the key prefix.
@param metadataProvider
A callback of type <code>ObjectMetadataProvider</code> which
is used to provide metadata for each file being uploaded.
@param taggingProvider
A callback of type <code>ObjectTaggingProvider</code> which
is used to provide the tags for each file being uploaded.
@return
"""
if ( directory == null || !directory.exists() || !directory.isDirectory() ) {
throw new IllegalArgumentException("Must provide a directory to upload");
}
List<File> files = new LinkedList<File>();
listFiles(directory, files, includeSubdirectories);
return uploadFileList(bucketName, virtualDirectoryKeyPrefix, directory, files, metadataProvider, taggingProvider);
} | java | public MultipleFileUpload uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories, ObjectMetadataProvider metadataProvider, ObjectTaggingProvider taggingProvider) {
if ( directory == null || !directory.exists() || !directory.isDirectory() ) {
throw new IllegalArgumentException("Must provide a directory to upload");
}
List<File> files = new LinkedList<File>();
listFiles(directory, files, includeSubdirectories);
return uploadFileList(bucketName, virtualDirectoryKeyPrefix, directory, files, metadataProvider, taggingProvider);
} | [
"public",
"MultipleFileUpload",
"uploadDirectory",
"(",
"String",
"bucketName",
",",
"String",
"virtualDirectoryKeyPrefix",
",",
"File",
"directory",
",",
"boolean",
"includeSubdirectories",
",",
"ObjectMetadataProvider",
"metadataProvider",
",",
"ObjectTaggingProvider",
"taggingProvider",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
"||",
"!",
"directory",
".",
"exists",
"(",
")",
"||",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must provide a directory to upload\"",
")",
";",
"}",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"listFiles",
"(",
"directory",
",",
"files",
",",
"includeSubdirectories",
")",
";",
"return",
"uploadFileList",
"(",
"bucketName",
",",
"virtualDirectoryKeyPrefix",
",",
"directory",
",",
"files",
",",
"metadataProvider",
",",
"taggingProvider",
")",
";",
"}"
] | Uploads all files in the directory given to the bucket named, optionally
recursing for all subdirectories.
<p>
S3 will overwrite any existing objects that happen to have the same key,
just as when uploading individual files, so use with caution.
</p>
<p>
If you are uploading <a href="http://aws.amazon.com/kms/">AWS
KMS</a>-encrypted objects, you need to specify the correct region of the
bucket on your client and configure AWS Signature Version 4 for added
security. For more information on how to do this, see
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#
specify-signature-version
</p>
@param bucketName
The name of the bucket to upload objects to.
@param virtualDirectoryKeyPrefix
The key prefix of the virtual directory to upload to. Use the
null or empty string to upload files to the root of the
bucket.
@param directory
The directory to upload.
@param includeSubdirectories
Whether to include subdirectories in the upload. If true,
files found in subdirectories will be included with an
appropriate concatenation to the key prefix.
@param metadataProvider
A callback of type <code>ObjectMetadataProvider</code> which
is used to provide metadata for each file being uploaded.
@param taggingProvider
A callback of type <code>ObjectTaggingProvider</code> which
is used to provide the tags for each file being uploaded.
@return | [
"Uploads",
"all",
"files",
"in",
"the",
"directory",
"given",
"to",
"the",
"bucket",
"named",
"optionally",
"recursing",
"for",
"all",
"subdirectories",
".",
"<p",
">",
"S3",
"will",
"overwrite",
"any",
"existing",
"objects",
"that",
"happen",
"to",
"have",
"the",
"same",
"key",
"just",
"as",
"when",
"uploading",
"individual",
"files",
"so",
"use",
"with",
"caution",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"you",
"are",
"uploading",
"<a",
"href",
"=",
"http",
":",
"//",
"aws",
".",
"amazon",
".",
"com",
"/",
"kms",
"/",
">",
"AWS",
"KMS<",
"/",
"a",
">",
"-",
"encrypted",
"objects",
"you",
"need",
"to",
"specify",
"the",
"correct",
"region",
"of",
"the",
"bucket",
"on",
"your",
"client",
"and",
"configure",
"AWS",
"Signature",
"Version",
"4",
"for",
"added",
"security",
".",
"For",
"more",
"information",
"on",
"how",
"to",
"do",
"this",
"see",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AmazonS3",
"/",
"latest",
"/",
"dev",
"/",
"UsingAWSSDK",
".",
"html#",
"specify",
"-",
"signature",
"-",
"version",
"<",
"/",
"p",
">"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/transfer/TransferManager.java#L1419-L1428 |
spring-projects/spring-flex | spring-flex-core/src/main/java/org/springframework/flex/core/io/AbstractAmfConversionServiceConfigProcessor.java | AbstractAmfConversionServiceConfigProcessor.registerAmfProxies | protected void registerAmfProxies(ConversionService conversionService, boolean useDirectFieldAccess) {
"""
Called during initialization, the default implementation configures and registers a {@link SpringPropertyProxy} instance
for each type returned by {@link AbstractAmfConversionServiceConfigProcessor#findTypesToRegister() findTypesToRegister}.
@param conversionService the conversion service to be used for property conversion
@param useDirectFieldAccess determines whether fields should be accessed directly
"""
Set<Class<?>> typesToRegister = findTypesToRegister();
if (log.isInfoEnabled()) {
log.info("Types detected for AMF serialization support: "+typesToRegister.toString());
}
for (Class<?> type : typesToRegister) {
registerPropertyProxy(SpringPropertyProxy.proxyFor(type, useDirectFieldAccess, conversionService));
}
} | java | protected void registerAmfProxies(ConversionService conversionService, boolean useDirectFieldAccess) {
Set<Class<?>> typesToRegister = findTypesToRegister();
if (log.isInfoEnabled()) {
log.info("Types detected for AMF serialization support: "+typesToRegister.toString());
}
for (Class<?> type : typesToRegister) {
registerPropertyProxy(SpringPropertyProxy.proxyFor(type, useDirectFieldAccess, conversionService));
}
} | [
"protected",
"void",
"registerAmfProxies",
"(",
"ConversionService",
"conversionService",
",",
"boolean",
"useDirectFieldAccess",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"typesToRegister",
"=",
"findTypesToRegister",
"(",
")",
";",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Types detected for AMF serialization support: \"",
"+",
"typesToRegister",
".",
"toString",
"(",
")",
")",
";",
"}",
"for",
"(",
"Class",
"<",
"?",
">",
"type",
":",
"typesToRegister",
")",
"{",
"registerPropertyProxy",
"(",
"SpringPropertyProxy",
".",
"proxyFor",
"(",
"type",
",",
"useDirectFieldAccess",
",",
"conversionService",
")",
")",
";",
"}",
"}"
] | Called during initialization, the default implementation configures and registers a {@link SpringPropertyProxy} instance
for each type returned by {@link AbstractAmfConversionServiceConfigProcessor#findTypesToRegister() findTypesToRegister}.
@param conversionService the conversion service to be used for property conversion
@param useDirectFieldAccess determines whether fields should be accessed directly | [
"Called",
"during",
"initialization",
"the",
"default",
"implementation",
"configures",
"and",
"registers",
"a",
"{"
] | train | https://github.com/spring-projects/spring-flex/blob/85f2bff300d74e2d77d565f97a09d12d18e19adc/spring-flex-core/src/main/java/org/springframework/flex/core/io/AbstractAmfConversionServiceConfigProcessor.java#L109-L117 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java | clusterinstance_stats.get | public static clusterinstance_stats get(nitro_service service, Long clid) throws Exception {
"""
Use this API to fetch statistics of clusterinstance_stats resource of given name .
"""
clusterinstance_stats obj = new clusterinstance_stats();
obj.set_clid(clid);
clusterinstance_stats response = (clusterinstance_stats) obj.stat_resource(service);
return response;
} | java | public static clusterinstance_stats get(nitro_service service, Long clid) throws Exception{
clusterinstance_stats obj = new clusterinstance_stats();
obj.set_clid(clid);
clusterinstance_stats response = (clusterinstance_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"clusterinstance_stats",
"get",
"(",
"nitro_service",
"service",
",",
"Long",
"clid",
")",
"throws",
"Exception",
"{",
"clusterinstance_stats",
"obj",
"=",
"new",
"clusterinstance_stats",
"(",
")",
";",
"obj",
".",
"set_clid",
"(",
"clid",
")",
";",
"clusterinstance_stats",
"response",
"=",
"(",
"clusterinstance_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of clusterinstance_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"clusterinstance_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cluster/clusterinstance_stats.java#L241-L246 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java | TaskManagerService.updateTaskStatus | void updateTaskStatus(Tenant tenant, TaskRecord taskRecord, boolean bDeleteClaimRecord) {
"""
Add or update a task status record and optionally delete the task's claim record at
the same time.
@param tenant {@link Tenant} that owns the task's application.
@param taskRecord {@link TaskRecord} containing task properties to be
written to the database. A null/empty property value
causes the corresponding column to be deleted.
@param bDeleteClaimRecord True to delete the task's claim record in the same
transaction.
"""
String taskID = taskRecord.getTaskID();
DBTransaction dbTran = DBService.instance(tenant).startTransaction();
Map<String, String> propMap = taskRecord.getProperties();
for (String name : propMap.keySet()) {
String value = propMap.get(name);
if (Utils.isEmpty(value)) {
dbTran.deleteColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name);
} else {
dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name, value);
}
}
if (bDeleteClaimRecord) {
dbTran.deleteRow(TaskManagerService.TASKS_STORE_NAME, "_claim/" + taskID);
}
DBService.instance(tenant).commit(dbTran);
} | java | void updateTaskStatus(Tenant tenant, TaskRecord taskRecord, boolean bDeleteClaimRecord) {
String taskID = taskRecord.getTaskID();
DBTransaction dbTran = DBService.instance(tenant).startTransaction();
Map<String, String> propMap = taskRecord.getProperties();
for (String name : propMap.keySet()) {
String value = propMap.get(name);
if (Utils.isEmpty(value)) {
dbTran.deleteColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name);
} else {
dbTran.addColumn(TaskManagerService.TASKS_STORE_NAME, taskID, name, value);
}
}
if (bDeleteClaimRecord) {
dbTran.deleteRow(TaskManagerService.TASKS_STORE_NAME, "_claim/" + taskID);
}
DBService.instance(tenant).commit(dbTran);
} | [
"void",
"updateTaskStatus",
"(",
"Tenant",
"tenant",
",",
"TaskRecord",
"taskRecord",
",",
"boolean",
"bDeleteClaimRecord",
")",
"{",
"String",
"taskID",
"=",
"taskRecord",
".",
"getTaskID",
"(",
")",
";",
"DBTransaction",
"dbTran",
"=",
"DBService",
".",
"instance",
"(",
"tenant",
")",
".",
"startTransaction",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"propMap",
"=",
"taskRecord",
".",
"getProperties",
"(",
")",
";",
"for",
"(",
"String",
"name",
":",
"propMap",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"value",
"=",
"propMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"Utils",
".",
"isEmpty",
"(",
"value",
")",
")",
"{",
"dbTran",
".",
"deleteColumn",
"(",
"TaskManagerService",
".",
"TASKS_STORE_NAME",
",",
"taskID",
",",
"name",
")",
";",
"}",
"else",
"{",
"dbTran",
".",
"addColumn",
"(",
"TaskManagerService",
".",
"TASKS_STORE_NAME",
",",
"taskID",
",",
"name",
",",
"value",
")",
";",
"}",
"}",
"if",
"(",
"bDeleteClaimRecord",
")",
"{",
"dbTran",
".",
"deleteRow",
"(",
"TaskManagerService",
".",
"TASKS_STORE_NAME",
",",
"\"_claim/\"",
"+",
"taskID",
")",
";",
"}",
"DBService",
".",
"instance",
"(",
"tenant",
")",
".",
"commit",
"(",
"dbTran",
")",
";",
"}"
] | Add or update a task status record and optionally delete the task's claim record at
the same time.
@param tenant {@link Tenant} that owns the task's application.
@param taskRecord {@link TaskRecord} containing task properties to be
written to the database. A null/empty property value
causes the corresponding column to be deleted.
@param bDeleteClaimRecord True to delete the task's claim record in the same
transaction. | [
"Add",
"or",
"update",
"a",
"task",
"status",
"record",
"and",
"optionally",
"delete",
"the",
"task",
"s",
"claim",
"record",
"at",
"the",
"same",
"time",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/taskmanager/TaskManagerService.java#L263-L279 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/PrefHelper.java | PrefHelper.setCreditCount | public void setCreditCount(String bucket, int count) {
"""
<p>Sets the credit count for the default bucket to the specified {@link Integer}, in preferences.</p>
<p>
<p><b>Note:</b> This does not set the actual value of the bucket itself on the Branch server,
but only the cached value as stored in preferences for the current app. The age of that value
should be checked before being considered accurate; read {@link #KEY_LAST_READ_SYSTEM} to see
when the last system sync occurred.
</p>
@param bucket A {@link String} value containing the value of the bucket being referenced.
@param count A {@link Integer} value that the default bucket credit count will be set to.
"""
ArrayList<String> buckets = getBuckets();
if (!buckets.contains(bucket)) {
buckets.add(bucket);
setBuckets(buckets);
}
setInteger(KEY_CREDIT_BASE + bucket, count);
} | java | public void setCreditCount(String bucket, int count) {
ArrayList<String> buckets = getBuckets();
if (!buckets.contains(bucket)) {
buckets.add(bucket);
setBuckets(buckets);
}
setInteger(KEY_CREDIT_BASE + bucket, count);
} | [
"public",
"void",
"setCreditCount",
"(",
"String",
"bucket",
",",
"int",
"count",
")",
"{",
"ArrayList",
"<",
"String",
">",
"buckets",
"=",
"getBuckets",
"(",
")",
";",
"if",
"(",
"!",
"buckets",
".",
"contains",
"(",
"bucket",
")",
")",
"{",
"buckets",
".",
"add",
"(",
"bucket",
")",
";",
"setBuckets",
"(",
"buckets",
")",
";",
"}",
"setInteger",
"(",
"KEY_CREDIT_BASE",
"+",
"bucket",
",",
"count",
")",
";",
"}"
] | <p>Sets the credit count for the default bucket to the specified {@link Integer}, in preferences.</p>
<p>
<p><b>Note:</b> This does not set the actual value of the bucket itself on the Branch server,
but only the cached value as stored in preferences for the current app. The age of that value
should be checked before being considered accurate; read {@link #KEY_LAST_READ_SYSTEM} to see
when the last system sync occurred.
</p>
@param bucket A {@link String} value containing the value of the bucket being referenced.
@param count A {@link Integer} value that the default bucket credit count will be set to. | [
"<p",
">",
"Sets",
"the",
"credit",
"count",
"for",
"the",
"default",
"bucket",
"to",
"the",
"specified",
"{",
"@link",
"Integer",
"}",
"in",
"preferences",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<p",
">",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"This",
"does",
"not",
"set",
"the",
"actual",
"value",
"of",
"the",
"bucket",
"itself",
"on",
"the",
"Branch",
"server",
"but",
"only",
"the",
"cached",
"value",
"as",
"stored",
"in",
"preferences",
"for",
"the",
"current",
"app",
".",
"The",
"age",
"of",
"that",
"value",
"should",
"be",
"checked",
"before",
"being",
"considered",
"accurate",
";",
"read",
"{",
"@link",
"#KEY_LAST_READ_SYSTEM",
"}",
"to",
"see",
"when",
"the",
"last",
"system",
"sync",
"occurred",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L774-L781 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notContain | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
"""
断言给定字符串是否不被另一个字符串包含(既是否为子串)
<pre class="code">
Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
</pre>
@param textToSearch 被搜索的字符串
@param substring 被检查的子串
@return 被检查的子串
@throws IllegalArgumentException 非子串抛出异常
"""
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | java | public static String notContain(String textToSearch, String substring) throws IllegalArgumentException {
return notContain(textToSearch, substring, "[Assertion failed] - this String argument must not contain the substring [{}]", substring);
} | [
"public",
"static",
"String",
"notContain",
"(",
"String",
"textToSearch",
",",
"String",
"substring",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"notContain",
"(",
"textToSearch",
",",
"substring",
",",
"\"[Assertion failed] - this String argument must not contain the substring [{}]\"",
",",
"substring",
")",
";",
"}"
] | 断言给定字符串是否不被另一个字符串包含(既是否为子串)
<pre class="code">
Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");
</pre>
@param textToSearch 被搜索的字符串
@param substring 被检查的子串
@return 被检查的子串
@throws IllegalArgumentException 非子串抛出异常 | [
"断言给定字符串是否不被另一个字符串包含(既是否为子串)"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L261-L263 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java | FilterChain.onAsyncResponse | public void onAsyncResponse(ConsumerConfig config, SofaRequest request, SofaResponse response, Throwable throwable)
throws SofaRpcException {
"""
Do filtering when async respond from server
@param config Consumer config
@param request SofaRequest
@param response SofaResponse
@param throwable Throwable when invoke
@throws SofaRpcException occur error
"""
try {
for (Filter loadedFilter : loadedFilters) {
loadedFilter.onAsyncResponse(config, request, response, throwable);
}
} catch (SofaRpcException e) {
LOGGER
.errorWithApp(config.getAppName(), "Catch exception when do filtering after asynchronous respond.", e);
}
} | java | public void onAsyncResponse(ConsumerConfig config, SofaRequest request, SofaResponse response, Throwable throwable)
throws SofaRpcException {
try {
for (Filter loadedFilter : loadedFilters) {
loadedFilter.onAsyncResponse(config, request, response, throwable);
}
} catch (SofaRpcException e) {
LOGGER
.errorWithApp(config.getAppName(), "Catch exception when do filtering after asynchronous respond.", e);
}
} | [
"public",
"void",
"onAsyncResponse",
"(",
"ConsumerConfig",
"config",
",",
"SofaRequest",
"request",
",",
"SofaResponse",
"response",
",",
"Throwable",
"throwable",
")",
"throws",
"SofaRpcException",
"{",
"try",
"{",
"for",
"(",
"Filter",
"loadedFilter",
":",
"loadedFilters",
")",
"{",
"loadedFilter",
".",
"onAsyncResponse",
"(",
"config",
",",
"request",
",",
"response",
",",
"throwable",
")",
";",
"}",
"}",
"catch",
"(",
"SofaRpcException",
"e",
")",
"{",
"LOGGER",
".",
"errorWithApp",
"(",
"config",
".",
"getAppName",
"(",
")",
",",
"\"Catch exception when do filtering after asynchronous respond.\"",
",",
"e",
")",
";",
"}",
"}"
] | Do filtering when async respond from server
@param config Consumer config
@param request SofaRequest
@param response SofaResponse
@param throwable Throwable when invoke
@throws SofaRpcException occur error | [
"Do",
"filtering",
"when",
"async",
"respond",
"from",
"server"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java#L274-L284 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java | JUnitReporter.createReportFile | private void createReportFile(String reportFileName, String content, File targetDirectory) {
"""
Creates the JUnit report file
@param reportFileName The report file to write
@param content The String content of the report file
"""
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | java | private void createReportFile(String reportFileName, String content, File targetDirectory) {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | [
"private",
"void",
"createReportFile",
"(",
"String",
"reportFileName",
",",
"String",
"content",
",",
"File",
"targetDirectory",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"mkdirs",
"(",
")",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Unable to create report output directory: \"",
"+",
"getReportDirectory",
"(",
")",
"+",
"(",
"StringUtils",
".",
"hasText",
"(",
"outputDirectory",
")",
"?",
"\"/\"",
"+",
"outputDirectory",
":",
"\"\"",
")",
")",
";",
"}",
"}",
"try",
"(",
"Writer",
"fileWriter",
"=",
"new",
"FileWriter",
"(",
"new",
"File",
"(",
"targetDirectory",
",",
"reportFileName",
")",
")",
")",
"{",
"fileWriter",
".",
"append",
"(",
"content",
")",
";",
"fileWriter",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to create test report\"",
",",
"e",
")",
";",
"}",
"}"
] | Creates the JUnit report file
@param reportFileName The report file to write
@param content The String content of the report file | [
"Creates",
"the",
"JUnit",
"report",
"file"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java#L156-L169 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnectionProxy.java | RestRepositoryConnectionProxy.setURL | private URL setURL(URL url) throws RepositoryIllegalArgumentException {
"""
Rather than setting the port directly, verify that the proxy URL did contain a port
and throw an exception if it did not. This avoids problems later.
@param url
@return
"""
int port = url.getPort();
if (port == -1) {
throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a port"));
}
String host = url.getHost();
if (host.equals("")) {
throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a host"));
}
return url;
} | java | private URL setURL(URL url) throws RepositoryIllegalArgumentException {
int port = url.getPort();
if (port == -1) {
throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a port"));
}
String host = url.getHost();
if (host.equals("")) {
throw new RepositoryIllegalArgumentException("Bad proxy URL", new IllegalArgumentException("Proxy URL does not contain a host"));
}
return url;
} | [
"private",
"URL",
"setURL",
"(",
"URL",
"url",
")",
"throws",
"RepositoryIllegalArgumentException",
"{",
"int",
"port",
"=",
"url",
".",
"getPort",
"(",
")",
";",
"if",
"(",
"port",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"RepositoryIllegalArgumentException",
"(",
"\"Bad proxy URL\"",
",",
"new",
"IllegalArgumentException",
"(",
"\"Proxy URL does not contain a port\"",
")",
")",
";",
"}",
"String",
"host",
"=",
"url",
".",
"getHost",
"(",
")",
";",
"if",
"(",
"host",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"throw",
"new",
"RepositoryIllegalArgumentException",
"(",
"\"Bad proxy URL\"",
",",
"new",
"IllegalArgumentException",
"(",
"\"Proxy URL does not contain a host\"",
")",
")",
";",
"}",
"return",
"url",
";",
"}"
] | Rather than setting the port directly, verify that the proxy URL did contain a port
and throw an exception if it did not. This avoids problems later.
@param url
@return | [
"Rather",
"than",
"setting",
"the",
"port",
"directly",
"verify",
"that",
"the",
"proxy",
"URL",
"did",
"contain",
"a",
"port",
"and",
"throw",
"an",
"exception",
"if",
"it",
"did",
"not",
".",
"This",
"avoids",
"problems",
"later",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/connections/RestRepositoryConnectionProxy.java#L60-L70 |
openengsb/openengsb | components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java | EntryFactory.addDescription | private static void addDescription(Entry entry, String description) {
"""
3 possibilities:<br>
1) description is null -> emptyFlag = false, no description attribute <br>
2) description is empty -> emptyFlag = true, no description attribute <br>
3) description exists -> no emptyFlag, description attribute exists and has a value
"""
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC);
if (description == null) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); // case 1
} else if (description.isEmpty()) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); // case 2
} else {
entry.add(SchemaConstants.STRING_ATTRIBUTE, description); // case 3
}
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
} | java | private static void addDescription(Entry entry, String description) {
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC);
if (description == null) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); // case 1
} else if (description.isEmpty()) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); // case 2
} else {
entry.add(SchemaConstants.STRING_ATTRIBUTE, description); // case 3
}
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
} | [
"private",
"static",
"void",
"addDescription",
"(",
"Entry",
"entry",
",",
"String",
"description",
")",
"{",
"try",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"OBJECT_CLASS_ATTRIBUTE",
",",
"SchemaConstants",
".",
"DESCRIPTIVE_OBJECT_OC",
")",
";",
"if",
"(",
"description",
"==",
"null",
")",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"EMPTY_FLAG_ATTRIBUTE",
",",
"String",
".",
"valueOf",
"(",
"false",
")",
")",
";",
"// case 1",
"}",
"else",
"if",
"(",
"description",
".",
"isEmpty",
"(",
")",
")",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"EMPTY_FLAG_ATTRIBUTE",
",",
"String",
".",
"valueOf",
"(",
"true",
")",
")",
";",
"// case 2",
"}",
"else",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"STRING_ATTRIBUTE",
",",
"description",
")",
";",
"// case 3",
"}",
"}",
"catch",
"(",
"LdapException",
"e",
")",
"{",
"throw",
"new",
"LdapRuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | 3 possibilities:<br>
1) description is null -> emptyFlag = false, no description attribute <br>
2) description is empty -> emptyFlag = true, no description attribute <br>
3) description exists -> no emptyFlag, description attribute exists and has a value | [
"3",
"possibilities",
":",
"<br",
">",
"1",
")",
"description",
"is",
"null",
"-",
">",
"emptyFlag",
"=",
"false",
"no",
"description",
"attribute",
"<br",
">",
"2",
")",
"description",
"is",
"empty",
"-",
">",
"emptyFlag",
"=",
"true",
"no",
"description",
"attribute",
"<br",
">",
"3",
")",
"description",
"exists",
"-",
">",
"no",
"emptyFlag",
"description",
"attribute",
"exists",
"and",
"has",
"a",
"value"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java#L160-L173 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java | BaseBo.tryLockForWrite | protected Lock tryLockForWrite(long time, TimeUnit unit) throws InterruptedException {
"""
Try to lock the BO for write.
@param time
@param unit
@return the "write"-lock in "lock" state if successful, {@code null} otherwise
@throws InterruptedException
@since 0.10.0
"""
if (time < 0 || unit == null) {
return tryLockForWrite();
}
Lock lock = writeLock();
return lock.tryLock(time, unit) ? lock : null;
} | java | protected Lock tryLockForWrite(long time, TimeUnit unit) throws InterruptedException {
if (time < 0 || unit == null) {
return tryLockForWrite();
}
Lock lock = writeLock();
return lock.tryLock(time, unit) ? lock : null;
} | [
"protected",
"Lock",
"tryLockForWrite",
"(",
"long",
"time",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"time",
"<",
"0",
"||",
"unit",
"==",
"null",
")",
"{",
"return",
"tryLockForWrite",
"(",
")",
";",
"}",
"Lock",
"lock",
"=",
"writeLock",
"(",
")",
";",
"return",
"lock",
".",
"tryLock",
"(",
"time",
",",
"unit",
")",
"?",
"lock",
":",
"null",
";",
"}"
] | Try to lock the BO for write.
@param time
@param unit
@return the "write"-lock in "lock" state if successful, {@code null} otherwise
@throws InterruptedException
@since 0.10.0 | [
"Try",
"to",
"lock",
"the",
"BO",
"for",
"write",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java#L536-L542 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java | RegistriesInner.queueBuildAsync | public Observable<BuildInner> queueBuildAsync(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
"""
Creates a new build based on the request parameters and add it to the build queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildRequest The parameters of a build that needs to queued.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return queueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).map(new Func1<ServiceResponse<BuildInner>, BuildInner>() {
@Override
public BuildInner call(ServiceResponse<BuildInner> response) {
return response.body();
}
});
} | java | public Observable<BuildInner> queueBuildAsync(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
return queueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).map(new Func1<ServiceResponse<BuildInner>, BuildInner>() {
@Override
public BuildInner call(ServiceResponse<BuildInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BuildInner",
">",
"queueBuildAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"QueueBuildRequest",
"buildRequest",
")",
"{",
"return",
"queueBuildWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildRequest",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"BuildInner",
">",
",",
"BuildInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"BuildInner",
"call",
"(",
"ServiceResponse",
"<",
"BuildInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a new build based on the request parameters and add it to the build queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildRequest The parameters of a build that needs to queued.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"new",
"build",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"build",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java#L1754-L1761 |
rey5137/material | material/src/main/java/com/rey/material/app/SimpleDialog.java | SimpleDialog.multiChoiceItems | public SimpleDialog multiChoiceItems(CharSequence[] items, int... selectedIndexes) {
"""
Set the list of items in multi-choice mode.
@param items The list of items.
@param selectedIndexes The indexes of selected items.
@return The SimpleDialog for chaining methods.
"""
if(mListView == null)
initListView();
mMode = MODE_MULTI_ITEMS;
mAdapter.setItems(items, selectedIndexes);
super.contentView(mListView);
return this;
} | java | public SimpleDialog multiChoiceItems(CharSequence[] items, int... selectedIndexes){
if(mListView == null)
initListView();
mMode = MODE_MULTI_ITEMS;
mAdapter.setItems(items, selectedIndexes);
super.contentView(mListView);
return this;
} | [
"public",
"SimpleDialog",
"multiChoiceItems",
"(",
"CharSequence",
"[",
"]",
"items",
",",
"int",
"...",
"selectedIndexes",
")",
"{",
"if",
"(",
"mListView",
"==",
"null",
")",
"initListView",
"(",
")",
";",
"mMode",
"=",
"MODE_MULTI_ITEMS",
";",
"mAdapter",
".",
"setItems",
"(",
"items",
",",
"selectedIndexes",
")",
";",
"super",
".",
"contentView",
"(",
"mListView",
")",
";",
"return",
"this",
";",
"}"
] | Set the list of items in multi-choice mode.
@param items The list of items.
@param selectedIndexes The indexes of selected items.
@return The SimpleDialog for chaining methods. | [
"Set",
"the",
"list",
"of",
"items",
"in",
"multi",
"-",
"choice",
"mode",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/SimpleDialog.java#L322-L330 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java | JUnit3FloatingPointComparisonWithoutDelta.isDouble | private boolean isDouble(VisitorState state, Type type) {
"""
Determines if the type is a double, including reference types.
"""
Type trueType = unboxedTypeOrType(state, type);
return trueType.getKind() == TypeKind.DOUBLE;
} | java | private boolean isDouble(VisitorState state, Type type) {
Type trueType = unboxedTypeOrType(state, type);
return trueType.getKind() == TypeKind.DOUBLE;
} | [
"private",
"boolean",
"isDouble",
"(",
"VisitorState",
"state",
",",
"Type",
"type",
")",
"{",
"Type",
"trueType",
"=",
"unboxedTypeOrType",
"(",
"state",
",",
"type",
")",
";",
"return",
"trueType",
".",
"getKind",
"(",
")",
"==",
"TypeKind",
".",
"DOUBLE",
";",
"}"
] | Determines if the type is a double, including reference types. | [
"Determines",
"if",
"the",
"type",
"is",
"a",
"double",
"including",
"reference",
"types",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java#L170-L173 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/RangeTombstoneList.java | RangeTombstoneList.searchDeletionTime | public DeletionTime searchDeletionTime(Composite name) {
"""
Returns the DeletionTime for the tombstone overlapping {@code name} (there can't be more than one),
or null if {@code name} is not covered by any tombstone.
"""
int idx = searchInternal(name, 0);
return idx < 0 ? null : new DeletionTime(markedAts[idx], delTimes[idx]);
} | java | public DeletionTime searchDeletionTime(Composite name)
{
int idx = searchInternal(name, 0);
return idx < 0 ? null : new DeletionTime(markedAts[idx], delTimes[idx]);
} | [
"public",
"DeletionTime",
"searchDeletionTime",
"(",
"Composite",
"name",
")",
"{",
"int",
"idx",
"=",
"searchInternal",
"(",
"name",
",",
"0",
")",
";",
"return",
"idx",
"<",
"0",
"?",
"null",
":",
"new",
"DeletionTime",
"(",
"markedAts",
"[",
"idx",
"]",
",",
"delTimes",
"[",
"idx",
"]",
")",
";",
"}"
] | Returns the DeletionTime for the tombstone overlapping {@code name} (there can't be more than one),
or null if {@code name} is not covered by any tombstone. | [
"Returns",
"the",
"DeletionTime",
"for",
"the",
"tombstone",
"overlapping",
"{"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/RangeTombstoneList.java#L258-L262 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.beginCreate | public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
"""
Creates a webhook for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@param webhookCreateParameters The parameters for creating a webhook.
@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 WebhookInner object if successful.
"""
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body();
} | java | public WebhookInner beginCreate(String resourceGroupName, String registryName, String webhookName, WebhookCreateParameters webhookCreateParameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookCreateParameters).toBlocking().single().body();
} | [
"public",
"WebhookInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"webhookName",
",",
"WebhookCreateParameters",
"webhookCreateParameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"webhookName",
",",
"webhookCreateParameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a webhook for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@param webhookCreateParameters The parameters for creating a webhook.
@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 WebhookInner object if successful. | [
"Creates",
"a",
"webhook",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L307-L309 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Base64.java | Base64.getMimeEncoder | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
"""
Returns a {@link Encoder} that encodes using the
<a href="#mime">MIME</a> type base64 encoding scheme
with specified line length and line separators.
@param lineLength
the length of each output line (rounded down to nearest multiple
of 4). If {@code lineLength <= 0} the output will not be separated
in lines
@param lineSeparator
the line separator for each output line
@return A Base64 encoder.
@throws IllegalArgumentException if {@code lineSeparator} includes any
character of "The Base64 Alphabet" as specified in Table 1 of
RFC 2045.
"""
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | java | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | [
"public",
"static",
"Encoder",
"getMimeEncoder",
"(",
"int",
"lineLength",
",",
"byte",
"[",
"]",
"lineSeparator",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"lineSeparator",
")",
";",
"int",
"[",
"]",
"base64",
"=",
"Decoder",
".",
"fromBase64",
";",
"for",
"(",
"byte",
"b",
":",
"lineSeparator",
")",
"{",
"if",
"(",
"base64",
"[",
"b",
"&",
"0xff",
"]",
"!=",
"-",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal base64 line separator character 0x\"",
"+",
"Integer",
".",
"toString",
"(",
"b",
",",
"16",
")",
")",
";",
"}",
"if",
"(",
"lineLength",
"<=",
"0",
")",
"{",
"return",
"Encoder",
".",
"RFC4648",
";",
"}",
"return",
"new",
"Encoder",
"(",
"false",
",",
"lineSeparator",
",",
"lineLength",
">>",
"2",
"<<",
"2",
",",
"true",
")",
";",
"}"
] | Returns a {@link Encoder} that encodes using the
<a href="#mime">MIME</a> type base64 encoding scheme
with specified line length and line separators.
@param lineLength
the length of each output line (rounded down to nearest multiple
of 4). If {@code lineLength <= 0} the output will not be separated
in lines
@param lineSeparator
the line separator for each output line
@return A Base64 encoder.
@throws IllegalArgumentException if {@code lineSeparator} includes any
character of "The Base64 Alphabet" as specified in Table 1 of
RFC 2045. | [
"Returns",
"a",
"{",
"@link",
"Encoder",
"}",
"that",
"encodes",
"using",
"the",
"<a",
"href",
"=",
"#mime",
">",
"MIME<",
"/",
"a",
">",
"type",
"base64",
"encoding",
"scheme",
"with",
"specified",
"line",
"length",
"and",
"line",
"separators",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Base64.java#L130-L142 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.findWith | public static void findWith(final ModelListener listener, String query, Object ... params) {
"""
This method is for processing really large result sets. Results found by this method are never cached.
@param listener this is a call back implementation which will receive instances of models found.
@param query sub-query (content after "WHERE" clause)
@param params optional parameters for a query.
"""
ModelDelegate.findWith(modelClass(), listener, query, params);
} | java | public static void findWith(final ModelListener listener, String query, Object ... params) {
ModelDelegate.findWith(modelClass(), listener, query, params);
} | [
"public",
"static",
"void",
"findWith",
"(",
"final",
"ModelListener",
"listener",
",",
"String",
"query",
",",
"Object",
"...",
"params",
")",
"{",
"ModelDelegate",
".",
"findWith",
"(",
"modelClass",
"(",
")",
",",
"listener",
",",
"query",
",",
"params",
")",
";",
"}"
] | This method is for processing really large result sets. Results found by this method are never cached.
@param listener this is a call back implementation which will receive instances of models found.
@param query sub-query (content after "WHERE" clause)
@param params optional parameters for a query. | [
"This",
"method",
"is",
"for",
"processing",
"really",
"large",
"result",
"sets",
".",
"Results",
"found",
"by",
"this",
"method",
"are",
"never",
"cached",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L2513-L2515 |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.copyBranch | public static void copyBranch(String base, String branch, long revision, String baseUrl) throws IOException {
"""
Make a branch by calling the "svn cp" operation.
@param base The source of the SVN copy operation
@param branch The name and location of the new branch
@param revision The revision to base the branch off
@param baseUrl The SVN url to connect to
@throws IOException Execution of the SVN sub-process failed or the
sub-process returned a exit value indicating a failure
"""
log.info("Copying branch " + base + AT_REVISION + revision + " to branch " + branch);
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument("cp");
addDefaultArguments(cmdLine, null, null);
if (revision > 0) {
cmdLine.addArgument("-r" + revision);
}
cmdLine.addArgument("-m");
cmdLine.addArgument("Branch automatically created from " + base + (revision > 0 ? AT_REVISION + revision : ""));
cmdLine.addArgument(baseUrl + base);
cmdLine.addArgument(baseUrl + branch);
/*
svn copy -r123 http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch
*/
try (InputStream result = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) {
log.info("Svn-Copy reported:\n" + extractResult(result));
}
} | java | public static void copyBranch(String base, String branch, long revision, String baseUrl) throws IOException {
log.info("Copying branch " + base + AT_REVISION + revision + " to branch " + branch);
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument("cp");
addDefaultArguments(cmdLine, null, null);
if (revision > 0) {
cmdLine.addArgument("-r" + revision);
}
cmdLine.addArgument("-m");
cmdLine.addArgument("Branch automatically created from " + base + (revision > 0 ? AT_REVISION + revision : ""));
cmdLine.addArgument(baseUrl + base);
cmdLine.addArgument(baseUrl + branch);
/*
svn copy -r123 http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch
*/
try (InputStream result = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) {
log.info("Svn-Copy reported:\n" + extractResult(result));
}
} | [
"public",
"static",
"void",
"copyBranch",
"(",
"String",
"base",
",",
"String",
"branch",
",",
"long",
"revision",
",",
"String",
"baseUrl",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Copying branch \"",
"+",
"base",
"+",
"AT_REVISION",
"+",
"revision",
"+",
"\" to branch \"",
"+",
"branch",
")",
";",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"\"cp\"",
")",
";",
"addDefaultArguments",
"(",
"cmdLine",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"revision",
">",
"0",
")",
"{",
"cmdLine",
".",
"addArgument",
"(",
"\"-r\"",
"+",
"revision",
")",
";",
"}",
"cmdLine",
".",
"addArgument",
"(",
"\"-m\"",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"\"Branch automatically created from \"",
"+",
"base",
"+",
"(",
"revision",
">",
"0",
"?",
"AT_REVISION",
"+",
"revision",
":",
"\"\"",
")",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"baseUrl",
"+",
"base",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"baseUrl",
"+",
"branch",
")",
";",
"/*\n\t\tsvn copy -r123 http://svn.example.com/repos/calc/trunk \\\n \t\thttp://svn.example.com/repos/calc/branches/my-calc-branch\n \t\t */",
"try",
"(",
"InputStream",
"result",
"=",
"ExecutionHelper",
".",
"getCommandResult",
"(",
"cmdLine",
",",
"new",
"File",
"(",
"\".\"",
")",
",",
"0",
",",
"120000",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Svn-Copy reported:\\n\"",
"+",
"extractResult",
"(",
"result",
")",
")",
";",
"}",
"}"
] | Make a branch by calling the "svn cp" operation.
@param base The source of the SVN copy operation
@param branch The name and location of the new branch
@param revision The revision to base the branch off
@param baseUrl The SVN url to connect to
@throws IOException Execution of the SVN sub-process failed or the
sub-process returned a exit value indicating a failure | [
"Make",
"a",
"branch",
"by",
"calling",
"the",
"svn",
"cp",
"operation",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L756-L778 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java | Message.setMetadata | public void setMetadata(String key, Object value) {
"""
Sets a metadata value.
@param key The key.
@param value The value.
"""
if (value != null) {
getMetadata().put(key, value);
}
} | java | public void setMetadata(String key, Object value) {
if (value != null) {
getMetadata().put(key, value);
}
} | [
"public",
"void",
"setMetadata",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"getMetadata",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | Sets a metadata value.
@param key The key.
@param value The value. | [
"Sets",
"a",
"metadata",
"value",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java#L146-L150 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/GlobalVariablesParser.java | GlobalVariablesParser.parseVariableDefinitions | private void parseVariableDefinitions(BeanDefinitionBuilder builder, Element element) {
"""
Parses all variable definitions and adds those to the bean definition
builder as property value.
@param builder the target bean definition builder.
@param element the source element.
"""
Map<String, String> testVariables = new LinkedHashMap<String, String>();
List<Element> variableElements = DomUtils.getChildElementsByTagName(element, "variable");
for (Element variableDefinition : variableElements) {
testVariables.put(variableDefinition.getAttribute("name"), variableDefinition.getAttribute("value"));
}
if (!testVariables.isEmpty()) {
builder.addPropertyValue("variables", testVariables);
}
} | java | private void parseVariableDefinitions(BeanDefinitionBuilder builder, Element element) {
Map<String, String> testVariables = new LinkedHashMap<String, String>();
List<Element> variableElements = DomUtils.getChildElementsByTagName(element, "variable");
for (Element variableDefinition : variableElements) {
testVariables.put(variableDefinition.getAttribute("name"), variableDefinition.getAttribute("value"));
}
if (!testVariables.isEmpty()) {
builder.addPropertyValue("variables", testVariables);
}
} | [
"private",
"void",
"parseVariableDefinitions",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"Element",
"element",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"testVariables",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"List",
"<",
"Element",
">",
"variableElements",
"=",
"DomUtils",
".",
"getChildElementsByTagName",
"(",
"element",
",",
"\"variable\"",
")",
";",
"for",
"(",
"Element",
"variableDefinition",
":",
"variableElements",
")",
"{",
"testVariables",
".",
"put",
"(",
"variableDefinition",
".",
"getAttribute",
"(",
"\"name\"",
")",
",",
"variableDefinition",
".",
"getAttribute",
"(",
"\"value\"",
")",
")",
";",
"}",
"if",
"(",
"!",
"testVariables",
".",
"isEmpty",
"(",
")",
")",
"{",
"builder",
".",
"addPropertyValue",
"(",
"\"variables\"",
",",
"testVariables",
")",
";",
"}",
"}"
] | Parses all variable definitions and adds those to the bean definition
builder as property value.
@param builder the target bean definition builder.
@param element the source element. | [
"Parses",
"all",
"variable",
"definitions",
"and",
"adds",
"those",
"to",
"the",
"bean",
"definition",
"builder",
"as",
"property",
"value",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/GlobalVariablesParser.java#L64-L74 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ScopeUtil.java | ScopeUtil.throwCompensationEvent | public static void throwCompensationEvent(List<CompensateEventSubscriptionEntity> eventSubscriptions, DelegateExecution execution, boolean async) {
"""
we create a separate execution for each compensation handler invocation.
"""
ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager();
// first spawn the compensating executions
for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
ExecutionEntity compensatingExecution = null;
// check whether compensating execution is already created (which is the case when compensating an embedded subprocess,
// where the compensating execution is created when leaving the subprocess and holds snapshot data).
if (eventSubscription.getConfiguration() != null) {
compensatingExecution = executionEntityManager.findById(eventSubscription.getConfiguration());
compensatingExecution.setParent(compensatingExecution.getProcessInstance());
compensatingExecution.setEventScope(false);
} else {
compensatingExecution = executionEntityManager.createChildExecution((ExecutionEntity) execution);
eventSubscription.setConfiguration(compensatingExecution.getId());
}
}
// signal compensation events in reverse order of their 'created' timestamp
Collections.sort(eventSubscriptions, new Comparator<EventSubscriptionEntity>() {
public int compare(EventSubscriptionEntity o1, EventSubscriptionEntity o2) {
return o2.getCreated().compareTo(o1.getCreated());
}
});
for (CompensateEventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions) {
Context.getCommandContext().getEventSubscriptionEntityManager().eventReceived(compensateEventSubscriptionEntity, null, async);
}
} | java | public static void throwCompensationEvent(List<CompensateEventSubscriptionEntity> eventSubscriptions, DelegateExecution execution, boolean async) {
ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager();
// first spawn the compensating executions
for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
ExecutionEntity compensatingExecution = null;
// check whether compensating execution is already created (which is the case when compensating an embedded subprocess,
// where the compensating execution is created when leaving the subprocess and holds snapshot data).
if (eventSubscription.getConfiguration() != null) {
compensatingExecution = executionEntityManager.findById(eventSubscription.getConfiguration());
compensatingExecution.setParent(compensatingExecution.getProcessInstance());
compensatingExecution.setEventScope(false);
} else {
compensatingExecution = executionEntityManager.createChildExecution((ExecutionEntity) execution);
eventSubscription.setConfiguration(compensatingExecution.getId());
}
}
// signal compensation events in reverse order of their 'created' timestamp
Collections.sort(eventSubscriptions, new Comparator<EventSubscriptionEntity>() {
public int compare(EventSubscriptionEntity o1, EventSubscriptionEntity o2) {
return o2.getCreated().compareTo(o1.getCreated());
}
});
for (CompensateEventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions) {
Context.getCommandContext().getEventSubscriptionEntityManager().eventReceived(compensateEventSubscriptionEntity, null, async);
}
} | [
"public",
"static",
"void",
"throwCompensationEvent",
"(",
"List",
"<",
"CompensateEventSubscriptionEntity",
">",
"eventSubscriptions",
",",
"DelegateExecution",
"execution",
",",
"boolean",
"async",
")",
"{",
"ExecutionEntityManager",
"executionEntityManager",
"=",
"Context",
".",
"getCommandContext",
"(",
")",
".",
"getExecutionEntityManager",
"(",
")",
";",
"// first spawn the compensating executions\r",
"for",
"(",
"EventSubscriptionEntity",
"eventSubscription",
":",
"eventSubscriptions",
")",
"{",
"ExecutionEntity",
"compensatingExecution",
"=",
"null",
";",
"// check whether compensating execution is already created (which is the case when compensating an embedded subprocess,\r",
"// where the compensating execution is created when leaving the subprocess and holds snapshot data).\r",
"if",
"(",
"eventSubscription",
".",
"getConfiguration",
"(",
")",
"!=",
"null",
")",
"{",
"compensatingExecution",
"=",
"executionEntityManager",
".",
"findById",
"(",
"eventSubscription",
".",
"getConfiguration",
"(",
")",
")",
";",
"compensatingExecution",
".",
"setParent",
"(",
"compensatingExecution",
".",
"getProcessInstance",
"(",
")",
")",
";",
"compensatingExecution",
".",
"setEventScope",
"(",
"false",
")",
";",
"}",
"else",
"{",
"compensatingExecution",
"=",
"executionEntityManager",
".",
"createChildExecution",
"(",
"(",
"ExecutionEntity",
")",
"execution",
")",
";",
"eventSubscription",
".",
"setConfiguration",
"(",
"compensatingExecution",
".",
"getId",
"(",
")",
")",
";",
"}",
"}",
"// signal compensation events in reverse order of their 'created' timestamp\r",
"Collections",
".",
"sort",
"(",
"eventSubscriptions",
",",
"new",
"Comparator",
"<",
"EventSubscriptionEntity",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"EventSubscriptionEntity",
"o1",
",",
"EventSubscriptionEntity",
"o2",
")",
"{",
"return",
"o2",
".",
"getCreated",
"(",
")",
".",
"compareTo",
"(",
"o1",
".",
"getCreated",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"CompensateEventSubscriptionEntity",
"compensateEventSubscriptionEntity",
":",
"eventSubscriptions",
")",
"{",
"Context",
".",
"getCommandContext",
"(",
")",
".",
"getEventSubscriptionEntityManager",
"(",
")",
".",
"eventReceived",
"(",
"compensateEventSubscriptionEntity",
",",
"null",
",",
"async",
")",
";",
"}",
"}"
] | we create a separate execution for each compensation handler invocation. | [
"we",
"create",
"a",
"separate",
"execution",
"for",
"each",
"compensation",
"handler",
"invocation",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ScopeUtil.java#L39-L70 |
mojohaus/webstart | webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/DefaultSignTool.java | DefaultSignTool.infoOrDebug | private void infoOrDebug( boolean info, String msg ) {
"""
Log a message as info or debug.
@param info if set to true, log as info(), otherwise as debug()
@param msg message to log
"""
if ( info )
{
getLogger().info( msg );
}
else
{
getLogger().debug( msg );
}
} | java | private void infoOrDebug( boolean info, String msg )
{
if ( info )
{
getLogger().info( msg );
}
else
{
getLogger().debug( msg );
}
} | [
"private",
"void",
"infoOrDebug",
"(",
"boolean",
"info",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"info",
")",
"{",
"getLogger",
"(",
")",
".",
"info",
"(",
"msg",
")",
";",
"}",
"else",
"{",
"getLogger",
"(",
")",
".",
"debug",
"(",
"msg",
")",
";",
"}",
"}"
] | Log a message as info or debug.
@param info if set to true, log as info(), otherwise as debug()
@param msg message to log | [
"Log",
"a",
"message",
"as",
"info",
"or",
"debug",
"."
] | train | https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/sign/DefaultSignTool.java#L288-L298 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java | FactoryMultiViewRobust.trifocalRansac | public static Ransac<TrifocalTensor, AssociatedTriple>
trifocalRansac( @Nullable ConfigTrifocal trifocal ,
@Nullable ConfigTrifocalError error,
@Nonnull ConfigRansac ransac ) {
"""
Robust RANSAC based estimator for
@see FactoryMultiView#trifocal_1
@param trifocal Configuration for trifocal tensor calculation
@param error Configuration for how trifocal error is computed
@param ransac Configuration for RANSAC
@return RANSAC
"""
if( trifocal == null )
trifocal = new ConfigTrifocal();
if( error == null )
error = new ConfigTrifocalError();
trifocal.checkValidity();
double ransacTol;
DistanceFromModel<TrifocalTensor,AssociatedTriple> distance;
switch( error.model) {
case REPROJECTION: {
ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalReprojectionSq();
} break;
case REPROJECTION_REFINE:
ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalReprojectionSq(error.converge.gtol,error.converge.maxIterations);
break;
case POINT_TRANSFER:
ransacTol = 2.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalTransferSq();
break;
default:
throw new IllegalArgumentException("Unknown error model "+error.model);
}
Estimate1ofTrifocalTensor estimator = FactoryMultiView.trifocal_1(trifocal);
ModelManager<TrifocalTensor> manager = new ManagerTrifocalTensor();
ModelGenerator<TrifocalTensor,AssociatedTriple> generator = new GenerateTrifocalTensor(estimator);
return new Ransac<>(ransac.randSeed, manager, generator, distance, ransac.maxIterations, ransacTol);
} | java | public static Ransac<TrifocalTensor, AssociatedTriple>
trifocalRansac( @Nullable ConfigTrifocal trifocal ,
@Nullable ConfigTrifocalError error,
@Nonnull ConfigRansac ransac ) {
if( trifocal == null )
trifocal = new ConfigTrifocal();
if( error == null )
error = new ConfigTrifocalError();
trifocal.checkValidity();
double ransacTol;
DistanceFromModel<TrifocalTensor,AssociatedTriple> distance;
switch( error.model) {
case REPROJECTION: {
ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalReprojectionSq();
} break;
case REPROJECTION_REFINE:
ransacTol = 3.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalReprojectionSq(error.converge.gtol,error.converge.maxIterations);
break;
case POINT_TRANSFER:
ransacTol = 2.0*ransac.inlierThreshold*ransac.inlierThreshold;
distance = new DistanceTrifocalTransferSq();
break;
default:
throw new IllegalArgumentException("Unknown error model "+error.model);
}
Estimate1ofTrifocalTensor estimator = FactoryMultiView.trifocal_1(trifocal);
ModelManager<TrifocalTensor> manager = new ManagerTrifocalTensor();
ModelGenerator<TrifocalTensor,AssociatedTriple> generator = new GenerateTrifocalTensor(estimator);
return new Ransac<>(ransac.randSeed, manager, generator, distance, ransac.maxIterations, ransacTol);
} | [
"public",
"static",
"Ransac",
"<",
"TrifocalTensor",
",",
"AssociatedTriple",
">",
"trifocalRansac",
"(",
"@",
"Nullable",
"ConfigTrifocal",
"trifocal",
",",
"@",
"Nullable",
"ConfigTrifocalError",
"error",
",",
"@",
"Nonnull",
"ConfigRansac",
"ransac",
")",
"{",
"if",
"(",
"trifocal",
"==",
"null",
")",
"trifocal",
"=",
"new",
"ConfigTrifocal",
"(",
")",
";",
"if",
"(",
"error",
"==",
"null",
")",
"error",
"=",
"new",
"ConfigTrifocalError",
"(",
")",
";",
"trifocal",
".",
"checkValidity",
"(",
")",
";",
"double",
"ransacTol",
";",
"DistanceFromModel",
"<",
"TrifocalTensor",
",",
"AssociatedTriple",
">",
"distance",
";",
"switch",
"(",
"error",
".",
"model",
")",
"{",
"case",
"REPROJECTION",
":",
"{",
"ransacTol",
"=",
"3.0",
"*",
"ransac",
".",
"inlierThreshold",
"*",
"ransac",
".",
"inlierThreshold",
";",
"distance",
"=",
"new",
"DistanceTrifocalReprojectionSq",
"(",
")",
";",
"}",
"break",
";",
"case",
"REPROJECTION_REFINE",
":",
"ransacTol",
"=",
"3.0",
"*",
"ransac",
".",
"inlierThreshold",
"*",
"ransac",
".",
"inlierThreshold",
";",
"distance",
"=",
"new",
"DistanceTrifocalReprojectionSq",
"(",
"error",
".",
"converge",
".",
"gtol",
",",
"error",
".",
"converge",
".",
"maxIterations",
")",
";",
"break",
";",
"case",
"POINT_TRANSFER",
":",
"ransacTol",
"=",
"2.0",
"*",
"ransac",
".",
"inlierThreshold",
"*",
"ransac",
".",
"inlierThreshold",
";",
"distance",
"=",
"new",
"DistanceTrifocalTransferSq",
"(",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown error model \"",
"+",
"error",
".",
"model",
")",
";",
"}",
"Estimate1ofTrifocalTensor",
"estimator",
"=",
"FactoryMultiView",
".",
"trifocal_1",
"(",
"trifocal",
")",
";",
"ModelManager",
"<",
"TrifocalTensor",
">",
"manager",
"=",
"new",
"ManagerTrifocalTensor",
"(",
")",
";",
"ModelGenerator",
"<",
"TrifocalTensor",
",",
"AssociatedTriple",
">",
"generator",
"=",
"new",
"GenerateTrifocalTensor",
"(",
"estimator",
")",
";",
"return",
"new",
"Ransac",
"<>",
"(",
"ransac",
".",
"randSeed",
",",
"manager",
",",
"generator",
",",
"distance",
",",
"ransac",
".",
"maxIterations",
",",
"ransacTol",
")",
";",
"}"
] | Robust RANSAC based estimator for
@see FactoryMultiView#trifocal_1
@param trifocal Configuration for trifocal tensor calculation
@param error Configuration for how trifocal error is computed
@param ransac Configuration for RANSAC
@return RANSAC | [
"Robust",
"RANSAC",
"based",
"estimator",
"for"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java#L399-L435 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java | FaultToleranceStateFactory.createAsyncBulkheadState | public AsyncBulkheadState createAsyncBulkheadState(ScheduledExecutorService executorService, BulkheadPolicy policy, MetricRecorder metricRecorder) {
"""
Create an object implementing an asynchronous Bulkhead
<p>
If {@code null} is passed for the policy, the returned object will still run submitted tasks asynchronously, but will not apply any bulkhead logic.
@param executorProvider the policy executor provider
@param executorService the executor to use to asynchronously run tasks
@param policy the BulkheadPolicy, may be {@code null}
@return a new AsyncBulkheadState
"""
if (policy == null) {
return new AsyncBulkheadStateNullImpl(executorService);
} else {
return new AsyncBulkheadStateImpl(executorService, policy, metricRecorder);
}
} | java | public AsyncBulkheadState createAsyncBulkheadState(ScheduledExecutorService executorService, BulkheadPolicy policy, MetricRecorder metricRecorder) {
if (policy == null) {
return new AsyncBulkheadStateNullImpl(executorService);
} else {
return new AsyncBulkheadStateImpl(executorService, policy, metricRecorder);
}
} | [
"public",
"AsyncBulkheadState",
"createAsyncBulkheadState",
"(",
"ScheduledExecutorService",
"executorService",
",",
"BulkheadPolicy",
"policy",
",",
"MetricRecorder",
"metricRecorder",
")",
"{",
"if",
"(",
"policy",
"==",
"null",
")",
"{",
"return",
"new",
"AsyncBulkheadStateNullImpl",
"(",
"executorService",
")",
";",
"}",
"else",
"{",
"return",
"new",
"AsyncBulkheadStateImpl",
"(",
"executorService",
",",
"policy",
",",
"metricRecorder",
")",
";",
"}",
"}"
] | Create an object implementing an asynchronous Bulkhead
<p>
If {@code null} is passed for the policy, the returned object will still run submitted tasks asynchronously, but will not apply any bulkhead logic.
@param executorProvider the policy executor provider
@param executorService the executor to use to asynchronously run tasks
@param policy the BulkheadPolicy, may be {@code null}
@return a new AsyncBulkheadState | [
"Create",
"an",
"object",
"implementing",
"an",
"asynchronous",
"Bulkhead",
"<p",
">",
"If",
"{",
"@code",
"null",
"}",
"is",
"passed",
"for",
"the",
"policy",
"the",
"returned",
"object",
"will",
"still",
"run",
"submitted",
"tasks",
"asynchronously",
"but",
"will",
"not",
"apply",
"any",
"bulkhead",
"logic",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java#L114-L120 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java | AbstractAsymmetricCrypto.encryptBcd | public String encryptBcd(String data, KeyType keyType, Charset charset) {
"""
分组加密
@param data 数据
@param keyType 密钥类型
@param charset 加密前编码
@return 加密后的密文
@throws CryptoException 加密异常
@since 4.1.0
"""
return BCD.bcdToStr(encrypt(data, charset, keyType));
} | java | public String encryptBcd(String data, KeyType keyType, Charset charset) {
return BCD.bcdToStr(encrypt(data, charset, keyType));
} | [
"public",
"String",
"encryptBcd",
"(",
"String",
"data",
",",
"KeyType",
"keyType",
",",
"Charset",
"charset",
")",
"{",
"return",
"BCD",
".",
"bcdToStr",
"(",
"encrypt",
"(",
"data",
",",
"charset",
",",
"keyType",
")",
")",
";",
"}"
] | 分组加密
@param data 数据
@param keyType 密钥类型
@param charset 加密前编码
@return 加密后的密文
@throws CryptoException 加密异常
@since 4.1.0 | [
"分组加密"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L212-L214 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyStoreFactory.java | KeyStoreFactory.newKeyStore | public static KeyStore newKeyStore(final String type, final String password,
final File keystoreFile) throws NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, KeyStoreException {
"""
Factory method for load the {@link KeyStore} object from the given file.
@param type
the type of the keystore
@param password
the password of the keystore
@param keystoreFile
the keystore file
@return the loaded {@link KeyStore} object
@throws NoSuchAlgorithmException
the no such algorithm exception
@throws CertificateException
the certificate exception
@throws FileNotFoundException
the file not found exception
@throws IOException
Signals that an I/O exception has occurred.
@throws KeyStoreException
the key store exception
"""
return newKeyStore(type, password, keystoreFile, false);
} | java | public static KeyStore newKeyStore(final String type, final String password,
final File keystoreFile) throws NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, KeyStoreException
{
return newKeyStore(type, password, keystoreFile, false);
} | [
"public",
"static",
"KeyStore",
"newKeyStore",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"password",
",",
"final",
"File",
"keystoreFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"FileNotFoundException",
",",
"IOException",
",",
"KeyStoreException",
"{",
"return",
"newKeyStore",
"(",
"type",
",",
"password",
",",
"keystoreFile",
",",
"false",
")",
";",
"}"
] | Factory method for load the {@link KeyStore} object from the given file.
@param type
the type of the keystore
@param password
the password of the keystore
@param keystoreFile
the keystore file
@return the loaded {@link KeyStore} object
@throws NoSuchAlgorithmException
the no such algorithm exception
@throws CertificateException
the certificate exception
@throws FileNotFoundException
the file not found exception
@throws IOException
Signals that an I/O exception has occurred.
@throws KeyStoreException
the key store exception | [
"Factory",
"method",
"for",
"load",
"the",
"{",
"@link",
"KeyStore",
"}",
"object",
"from",
"the",
"given",
"file",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyStoreFactory.java#L68-L73 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.contourWidthDp | @NonNull
public IconicsDrawable contourWidthDp(@Dimension(unit = DP) int sizeDp) {
"""
Set contour width from dp for the icon
@return The current IconicsDrawable for chaining.
"""
return contourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | java | @NonNull
public IconicsDrawable contourWidthDp(@Dimension(unit = DP) int sizeDp) {
return contourWidthPx(Utils.convertDpToPx(mContext, sizeDp));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"contourWidthDp",
"(",
"@",
"Dimension",
"(",
"unit",
"=",
"DP",
")",
"int",
"sizeDp",
")",
"{",
"return",
"contourWidthPx",
"(",
"Utils",
".",
"convertDpToPx",
"(",
"mContext",
",",
"sizeDp",
")",
")",
";",
"}"
] | Set contour width from dp for the icon
@return The current IconicsDrawable for chaining. | [
"Set",
"contour",
"width",
"from",
"dp",
"for",
"the",
"icon"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L1011-L1014 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java | ProcfsBasedProcessTree.constructProcessInfo | private static ProcessInfo constructProcessInfo(ProcessInfo pinfo,
String procfsDir) {
"""
Construct the ProcessInfo using the process' PID and procfs rooted at the
specified directory and return the same. It is provided mainly to assist
testing purposes.
Returns null on failing to read from procfs,
@param pinfo ProcessInfo that needs to be updated
@param procfsDir root of the proc file system
@return updated ProcessInfo, null on errors.
"""
ProcessInfo ret = null;
// Read "procfsDir/<pid>/stat" file - typically /proc/<pid>/stat
BufferedReader in = null;
FileReader fReader = null;
try {
File pidDir = new File(procfsDir, String.valueOf(pinfo.getPid()));
fReader = new FileReader(new File(pidDir, PROCFS_STAT_FILE));
in = new BufferedReader(fReader);
} catch (FileNotFoundException f) {
// The process vanished in the interim!
LOG.debug("The process " + pinfo.getPid()
+ " may have finished in the interim.");
return ret;
}
ret = pinfo;
try {
String str = in.readLine(); // only one line
Matcher m = PROCFS_STAT_FILE_FORMAT.matcher(str);
boolean mat = m.find();
if (mat) {
// Set (name) (ppid) (pgrpId) (session) (utime) (stime) (vsize) (rss)
pinfo.updateProcessInfo(m.group(2), Integer.parseInt(m.group(3)),
Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)),
Long.parseLong(m.group(7)), Long.parseLong(m.group(8)),
Long.parseLong(m.group(10)), Long.parseLong(m.group(11)));
} else {
LOG.warn("Unexpected: procfs stat file is not in the expected format"
+ " for process with pid " + pinfo.getPid());
ret = null;
}
} catch (IOException io) {
LOG.warn("Error reading the stream " + io);
ret = null;
} finally {
// Close the streams
try {
fReader.close();
try {
in.close();
} catch (IOException i) {
LOG.warn("Error closing the stream " + in);
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + fReader);
}
}
return ret;
} | java | private static ProcessInfo constructProcessInfo(ProcessInfo pinfo,
String procfsDir) {
ProcessInfo ret = null;
// Read "procfsDir/<pid>/stat" file - typically /proc/<pid>/stat
BufferedReader in = null;
FileReader fReader = null;
try {
File pidDir = new File(procfsDir, String.valueOf(pinfo.getPid()));
fReader = new FileReader(new File(pidDir, PROCFS_STAT_FILE));
in = new BufferedReader(fReader);
} catch (FileNotFoundException f) {
// The process vanished in the interim!
LOG.debug("The process " + pinfo.getPid()
+ " may have finished in the interim.");
return ret;
}
ret = pinfo;
try {
String str = in.readLine(); // only one line
Matcher m = PROCFS_STAT_FILE_FORMAT.matcher(str);
boolean mat = m.find();
if (mat) {
// Set (name) (ppid) (pgrpId) (session) (utime) (stime) (vsize) (rss)
pinfo.updateProcessInfo(m.group(2), Integer.parseInt(m.group(3)),
Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)),
Long.parseLong(m.group(7)), Long.parseLong(m.group(8)),
Long.parseLong(m.group(10)), Long.parseLong(m.group(11)));
} else {
LOG.warn("Unexpected: procfs stat file is not in the expected format"
+ " for process with pid " + pinfo.getPid());
ret = null;
}
} catch (IOException io) {
LOG.warn("Error reading the stream " + io);
ret = null;
} finally {
// Close the streams
try {
fReader.close();
try {
in.close();
} catch (IOException i) {
LOG.warn("Error closing the stream " + in);
}
} catch (IOException i) {
LOG.warn("Error closing the stream " + fReader);
}
}
return ret;
} | [
"private",
"static",
"ProcessInfo",
"constructProcessInfo",
"(",
"ProcessInfo",
"pinfo",
",",
"String",
"procfsDir",
")",
"{",
"ProcessInfo",
"ret",
"=",
"null",
";",
"// Read \"procfsDir/<pid>/stat\" file - typically /proc/<pid>/stat",
"BufferedReader",
"in",
"=",
"null",
";",
"FileReader",
"fReader",
"=",
"null",
";",
"try",
"{",
"File",
"pidDir",
"=",
"new",
"File",
"(",
"procfsDir",
",",
"String",
".",
"valueOf",
"(",
"pinfo",
".",
"getPid",
"(",
")",
")",
")",
";",
"fReader",
"=",
"new",
"FileReader",
"(",
"new",
"File",
"(",
"pidDir",
",",
"PROCFS_STAT_FILE",
")",
")",
";",
"in",
"=",
"new",
"BufferedReader",
"(",
"fReader",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"f",
")",
"{",
"// The process vanished in the interim!",
"LOG",
".",
"debug",
"(",
"\"The process \"",
"+",
"pinfo",
".",
"getPid",
"(",
")",
"+",
"\" may have finished in the interim.\"",
")",
";",
"return",
"ret",
";",
"}",
"ret",
"=",
"pinfo",
";",
"try",
"{",
"String",
"str",
"=",
"in",
".",
"readLine",
"(",
")",
";",
"// only one line",
"Matcher",
"m",
"=",
"PROCFS_STAT_FILE_FORMAT",
".",
"matcher",
"(",
"str",
")",
";",
"boolean",
"mat",
"=",
"m",
".",
"find",
"(",
")",
";",
"if",
"(",
"mat",
")",
"{",
"// Set (name) (ppid) (pgrpId) (session) (utime) (stime) (vsize) (rss)",
"pinfo",
".",
"updateProcessInfo",
"(",
"m",
".",
"group",
"(",
"2",
")",
",",
"Integer",
".",
"parseInt",
"(",
"m",
".",
"group",
"(",
"3",
")",
")",
",",
"Integer",
".",
"parseInt",
"(",
"m",
".",
"group",
"(",
"4",
")",
")",
",",
"Integer",
".",
"parseInt",
"(",
"m",
".",
"group",
"(",
"5",
")",
")",
",",
"Long",
".",
"parseLong",
"(",
"m",
".",
"group",
"(",
"7",
")",
")",
",",
"Long",
".",
"parseLong",
"(",
"m",
".",
"group",
"(",
"8",
")",
")",
",",
"Long",
".",
"parseLong",
"(",
"m",
".",
"group",
"(",
"10",
")",
")",
",",
"Long",
".",
"parseLong",
"(",
"m",
".",
"group",
"(",
"11",
")",
")",
")",
";",
"}",
"else",
"{",
"LOG",
".",
"warn",
"(",
"\"Unexpected: procfs stat file is not in the expected format\"",
"+",
"\" for process with pid \"",
"+",
"pinfo",
".",
"getPid",
"(",
")",
")",
";",
"ret",
"=",
"null",
";",
"}",
"}",
"catch",
"(",
"IOException",
"io",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Error reading the stream \"",
"+",
"io",
")",
";",
"ret",
"=",
"null",
";",
"}",
"finally",
"{",
"// Close the streams",
"try",
"{",
"fReader",
".",
"close",
"(",
")",
";",
"try",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"i",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Error closing the stream \"",
"+",
"in",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"i",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Error closing the stream \"",
"+",
"fReader",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Construct the ProcessInfo using the process' PID and procfs rooted at the
specified directory and return the same. It is provided mainly to assist
testing purposes.
Returns null on failing to read from procfs,
@param pinfo ProcessInfo that needs to be updated
@param procfsDir root of the proc file system
@return updated ProcessInfo, null on errors. | [
"Construct",
"the",
"ProcessInfo",
"using",
"the",
"process",
"PID",
"and",
"procfs",
"rooted",
"at",
"the",
"specified",
"directory",
"and",
"return",
"the",
"same",
".",
"It",
"is",
"provided",
"mainly",
"to",
"assist",
"testing",
"purposes",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L540-L591 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java | VirtualMachineScaleSetVMsInner.getInstanceViewAsync | public Observable<VirtualMachineScaleSetVMInstanceViewInner> getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
"""
Gets the status of a virtual machine from a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceId The instance ID of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineScaleSetVMInstanceViewInner object
"""
return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner>, VirtualMachineScaleSetVMInstanceViewInner>() {
@Override
public VirtualMachineScaleSetVMInstanceViewInner call(ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineScaleSetVMInstanceViewInner> getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner>, VirtualMachineScaleSetVMInstanceViewInner>() {
@Override
public VirtualMachineScaleSetVMInstanceViewInner call(ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineScaleSetVMInstanceViewInner",
">",
"getInstanceViewAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"String",
"instanceId",
")",
"{",
"return",
"getInstanceViewWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
",",
"instanceId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VirtualMachineScaleSetVMInstanceViewInner",
">",
",",
"VirtualMachineScaleSetVMInstanceViewInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VirtualMachineScaleSetVMInstanceViewInner",
"call",
"(",
"ServiceResponse",
"<",
"VirtualMachineScaleSetVMInstanceViewInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the status of a virtual machine from a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceId The instance ID of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineScaleSetVMInstanceViewInner object | [
"Gets",
"the",
"status",
"of",
"a",
"virtual",
"machine",
"from",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1161-L1168 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKTableRecord.java | JKTableRecord.getColumnValueAsDouble | public Double getColumnValueAsDouble(final int col, final double defaultValue) {
"""
Gets the column value as double.
@param col the col
@param defaultValue the default value
@return the column value as double
"""
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
}
return value;
} | java | public Double getColumnValueAsDouble(final int col, final double defaultValue) {
Double value = getColumnValueAsDouble(col);
if (value == null) {
value = defaultValue;
}
return value;
} | [
"public",
"Double",
"getColumnValueAsDouble",
"(",
"final",
"int",
"col",
",",
"final",
"double",
"defaultValue",
")",
"{",
"Double",
"value",
"=",
"getColumnValueAsDouble",
"(",
"col",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"defaultValue",
";",
"}",
"return",
"value",
";",
"}"
] | Gets the column value as double.
@param col the col
@param defaultValue the default value
@return the column value as double | [
"Gets",
"the",
"column",
"value",
"as",
"double",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKTableRecord.java#L184-L190 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.onErrorReturn | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> onErrorReturn(Function<? super Throwable, ? extends T> valueSupplier) {
"""
Instructs a Publisher to emit an item (returned by a specified function) rather than invoking
{@link Subscriber#onError onError} if it encounters an error.
<p>
<img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/onErrorReturn.png" alt="">
<p>
By default, when a Publisher encounters an error that prevents it from emitting the expected item to
its {@link Subscriber}, the Publisher invokes its Subscriber's {@code onError} method, and then quits
without invoking any more of its Subscriber's methods. The {@code onErrorReturn} method changes this
behavior. If you pass a function ({@code resumeFunction}) to a Publisher's {@code onErrorReturn}
method, if the original Publisher encounters an error, instead of invoking its Subscriber's
{@code onError} method, it will instead emit the return value of {@code resumeFunction}.
<p>
You can use this to prevent errors from propagating or to supply fallback data should errors be
encountered.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream. The source {@code Publisher}s is expected to honor
backpressure as well. If it this expectation is violated, the operator <em>may</em> throw
{@code IllegalStateException} when the source {@code Publisher} completes or
{@code MissingBackpressureException} is signaled somewhere downstream.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param valueSupplier
a function that returns a single value that will be emitted along with a regular onComplete in case
the current Flowable signals an onError event
@return the original Publisher with appropriately modified behavior
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a>
"""
ObjectHelper.requireNonNull(valueSupplier, "valueSupplier is null");
return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<T>(this, valueSupplier));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> onErrorReturn(Function<? super Throwable, ? extends T> valueSupplier) {
ObjectHelper.requireNonNull(valueSupplier, "valueSupplier is null");
return RxJavaPlugins.onAssembly(new FlowableOnErrorReturn<T>(this, valueSupplier));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
"onErrorReturn",
"(",
"Function",
"<",
"?",
"super",
"Throwable",
",",
"?",
"extends",
"T",
">",
"valueSupplier",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"valueSupplier",
",",
"\"valueSupplier is null\"",
")",
";",
"return",
"RxJavaPlugins",
".",
"onAssembly",
"(",
"new",
"FlowableOnErrorReturn",
"<",
"T",
">",
"(",
"this",
",",
"valueSupplier",
")",
")",
";",
"}"
] | Instructs a Publisher to emit an item (returned by a specified function) rather than invoking
{@link Subscriber#onError onError} if it encounters an error.
<p>
<img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/onErrorReturn.png" alt="">
<p>
By default, when a Publisher encounters an error that prevents it from emitting the expected item to
its {@link Subscriber}, the Publisher invokes its Subscriber's {@code onError} method, and then quits
without invoking any more of its Subscriber's methods. The {@code onErrorReturn} method changes this
behavior. If you pass a function ({@code resumeFunction}) to a Publisher's {@code onErrorReturn}
method, if the original Publisher encounters an error, instead of invoking its Subscriber's
{@code onError} method, it will instead emit the return value of {@code resumeFunction}.
<p>
You can use this to prevent errors from propagating or to supply fallback data should errors be
encountered.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from downstream. The source {@code Publisher}s is expected to honor
backpressure as well. If it this expectation is violated, the operator <em>may</em> throw
{@code IllegalStateException} when the source {@code Publisher} completes or
{@code MissingBackpressureException} is signaled somewhere downstream.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code onErrorReturn} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param valueSupplier
a function that returns a single value that will be emitted along with a regular onComplete in case
the current Flowable signals an onError event
@return the original Publisher with appropriately modified behavior
@see <a href="http://reactivex.io/documentation/operators/catch.html">ReactiveX operators documentation: Catch</a> | [
"Instructs",
"a",
"Publisher",
"to",
"emit",
"an",
"item",
"(",
"returned",
"by",
"a",
"specified",
"function",
")",
"rather",
"than",
"invoking",
"{",
"@link",
"Subscriber#onError",
"onError",
"}",
"if",
"it",
"encounters",
"an",
"error",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"310",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"onErrorReturn",
".",
"png",
"alt",
"=",
">",
"<p",
">",
"By",
"default",
"when",
"a",
"Publisher",
"encounters",
"an",
"error",
"that",
"prevents",
"it",
"from",
"emitting",
"the",
"expected",
"item",
"to",
"its",
"{",
"@link",
"Subscriber",
"}",
"the",
"Publisher",
"invokes",
"its",
"Subscriber",
"s",
"{",
"@code",
"onError",
"}",
"method",
"and",
"then",
"quits",
"without",
"invoking",
"any",
"more",
"of",
"its",
"Subscriber",
"s",
"methods",
".",
"The",
"{",
"@code",
"onErrorReturn",
"}",
"method",
"changes",
"this",
"behavior",
".",
"If",
"you",
"pass",
"a",
"function",
"(",
"{",
"@code",
"resumeFunction",
"}",
")",
"to",
"a",
"Publisher",
"s",
"{",
"@code",
"onErrorReturn",
"}",
"method",
"if",
"the",
"original",
"Publisher",
"encounters",
"an",
"error",
"instead",
"of",
"invoking",
"its",
"Subscriber",
"s",
"{",
"@code",
"onError",
"}",
"method",
"it",
"will",
"instead",
"emit",
"the",
"return",
"value",
"of",
"{",
"@code",
"resumeFunction",
"}",
".",
"<p",
">",
"You",
"can",
"use",
"this",
"to",
"prevent",
"errors",
"from",
"propagating",
"or",
"to",
"supply",
"fallback",
"data",
"should",
"errors",
"be",
"encountered",
".",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Backpressure",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"The",
"operator",
"honors",
"backpressure",
"from",
"downstream",
".",
"The",
"source",
"{",
"@code",
"Publisher",
"}",
"s",
"is",
"expected",
"to",
"honor",
"backpressure",
"as",
"well",
".",
"If",
"it",
"this",
"expectation",
"is",
"violated",
"the",
"operator",
"<em",
">",
"may<",
"/",
"em",
">",
"throw",
"{",
"@code",
"IllegalStateException",
"}",
"when",
"the",
"source",
"{",
"@code",
"Publisher",
"}",
"completes",
"or",
"{",
"@code",
"MissingBackpressureException",
"}",
"is",
"signaled",
"somewhere",
"downstream",
".",
"<",
"/",
"dd",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{",
"@code",
"onErrorReturn",
"}",
"does",
"not",
"operate",
"by",
"default",
"on",
"a",
"particular",
"{",
"@link",
"Scheduler",
"}",
".",
"<",
"/",
"dd",
">",
"<",
"/",
"dl",
">"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L11780-L11786 |
michel-kraemer/citeproc-java | citeproc-java-tool/src/main/java/de/undercouch/citeproc/tool/BibliographyCommand.java | BibliographyCommand.doGenerateCSL | protected void doGenerateCSL(CSL citeproc, String[] citationIds, PrintWriter out) {
"""
Performs CSL conversion and generates a bibliography
@param citeproc the CSL processor
@param citationIds the citation IDs for which the bibliography
should be generated (the CSL processor should already be prepared)
@param out the stream to write the result to
"""
Bibliography bibl = citeproc.makeBibliography();
out.println(bibl.makeString());
} | java | protected void doGenerateCSL(CSL citeproc, String[] citationIds, PrintWriter out) {
Bibliography bibl = citeproc.makeBibliography();
out.println(bibl.makeString());
} | [
"protected",
"void",
"doGenerateCSL",
"(",
"CSL",
"citeproc",
",",
"String",
"[",
"]",
"citationIds",
",",
"PrintWriter",
"out",
")",
"{",
"Bibliography",
"bibl",
"=",
"citeproc",
".",
"makeBibliography",
"(",
")",
";",
"out",
".",
"println",
"(",
"bibl",
".",
"makeString",
"(",
")",
")",
";",
"}"
] | Performs CSL conversion and generates a bibliography
@param citeproc the CSL processor
@param citationIds the citation IDs for which the bibliography
should be generated (the CSL processor should already be prepared)
@param out the stream to write the result to | [
"Performs",
"CSL",
"conversion",
"and",
"generates",
"a",
"bibliography"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java-tool/src/main/java/de/undercouch/citeproc/tool/BibliographyCommand.java#L189-L192 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.createCompositeEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<UUID>> createCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) {
"""
Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (cEntityId == null) {
throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null.");
}
final String name = createCompositeEntityRoleOptionalParameter != null ? createCompositeEntityRoleOptionalParameter.name() : null;
return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, name);
} | java | public Observable<ServiceResponse<UUID>> createCompositeEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (cEntityId == null) {
throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null.");
}
final String name = createCompositeEntityRoleOptionalParameter != null ? createCompositeEntityRoleOptionalParameter.name() : null;
return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"UUID",
">",
">",
"createCompositeEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"CreateCompositeEntityRoleOptionalParameter",
"createCompositeEntityRoleOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"versionId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter versionId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"cEntityId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter cEntityId is required and cannot be null.\"",
")",
";",
"}",
"final",
"String",
"name",
"=",
"createCompositeEntityRoleOptionalParameter",
"!=",
"null",
"?",
"createCompositeEntityRoleOptionalParameter",
".",
"name",
"(",
")",
":",
"null",
";",
"return",
"createCompositeEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"cEntityId",
",",
"name",
")",
";",
"}"
] | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8920-L8936 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/StringUtils.java | StringUtils.search | public static int search(String str, String keyw) {
"""
Returns the number of times the specified string was found
in the target string, or 0 if there is no specified string.
@param str the target string
@param keyw the string to find
@return the number of times the specified string was found
"""
int strLen = str.length();
int keywLen = keyw.length();
int pos = 0;
int cnt = 0;
if (keywLen == 0) {
return 0;
}
while ((pos = str.indexOf(keyw, pos)) != -1) {
pos += keywLen;
cnt++;
if (pos >= strLen) {
break;
}
}
return cnt;
} | java | public static int search(String str, String keyw) {
int strLen = str.length();
int keywLen = keyw.length();
int pos = 0;
int cnt = 0;
if (keywLen == 0) {
return 0;
}
while ((pos = str.indexOf(keyw, pos)) != -1) {
pos += keywLen;
cnt++;
if (pos >= strLen) {
break;
}
}
return cnt;
} | [
"public",
"static",
"int",
"search",
"(",
"String",
"str",
",",
"String",
"keyw",
")",
"{",
"int",
"strLen",
"=",
"str",
".",
"length",
"(",
")",
";",
"int",
"keywLen",
"=",
"keyw",
".",
"length",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"int",
"cnt",
"=",
"0",
";",
"if",
"(",
"keywLen",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"while",
"(",
"(",
"pos",
"=",
"str",
".",
"indexOf",
"(",
"keyw",
",",
"pos",
")",
")",
"!=",
"-",
"1",
")",
"{",
"pos",
"+=",
"keywLen",
";",
"cnt",
"++",
";",
"if",
"(",
"pos",
">=",
"strLen",
")",
"{",
"break",
";",
"}",
"}",
"return",
"cnt",
";",
"}"
] | Returns the number of times the specified string was found
in the target string, or 0 if there is no specified string.
@param str the target string
@param keyw the string to find
@return the number of times the specified string was found | [
"Returns",
"the",
"number",
"of",
"times",
"the",
"specified",
"string",
"was",
"found",
"in",
"the",
"target",
"string",
"or",
"0",
"if",
"there",
"is",
"no",
"specified",
"string",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L533-L549 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java | TrueTypeFontUnicode.setCharAdvance | public boolean setCharAdvance(int c, int advance) {
"""
Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return <CODE>true</CODE> if the advance was set,
<CODE>false</CODE> otherwise
"""
int[] m = getMetricsTT(c);
if (m == null)
return false;
m[1] = advance;
return true;
} | java | public boolean setCharAdvance(int c, int advance) {
int[] m = getMetricsTT(c);
if (m == null)
return false;
m[1] = advance;
return true;
} | [
"public",
"boolean",
"setCharAdvance",
"(",
"int",
"c",
",",
"int",
"advance",
")",
"{",
"int",
"[",
"]",
"m",
"=",
"getMetricsTT",
"(",
"c",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"return",
"false",
";",
"m",
"[",
"1",
"]",
"=",
"advance",
";",
"return",
"true",
";",
"}"
] | Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return <CODE>true</CODE> if the advance was set,
<CODE>false</CODE> otherwise | [
"Sets",
"the",
"character",
"advance",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L535-L541 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/ch/PrepareEncoder.java | PrepareEncoder.getScMergeStatus | public static final int getScMergeStatus(int existingScFlags, int newScFlags) {
"""
Returns 1 if existingScFlags of an existing shortcut can be overwritten with a new shortcut by
newScFlags without limiting or changing the directions of the existing shortcut.
The method returns 2 for the same condition but only if the new shortcut has to be added
even if weight is higher than existing shortcut weight.
<pre>
| newScFlags:
existingScFlags | -> | <- | <->
-> | 1 | 0 | 2
<- | 0 | 1 | 2
<-> | 0 | 0 | 1
</pre>
@return 1 if newScFlags is identical to existingScFlags for the two direction bits and 0 otherwise.
There are two special cases when it returns 2.
"""
if ((existingScFlags & scDirMask) == (newScFlags & scDirMask))
return 1;
else if ((newScFlags & scDirMask) == scDirMask)
return 2;
return 0;
} | java | public static final int getScMergeStatus(int existingScFlags, int newScFlags) {
if ((existingScFlags & scDirMask) == (newScFlags & scDirMask))
return 1;
else if ((newScFlags & scDirMask) == scDirMask)
return 2;
return 0;
} | [
"public",
"static",
"final",
"int",
"getScMergeStatus",
"(",
"int",
"existingScFlags",
",",
"int",
"newScFlags",
")",
"{",
"if",
"(",
"(",
"existingScFlags",
"&",
"scDirMask",
")",
"==",
"(",
"newScFlags",
"&",
"scDirMask",
")",
")",
"return",
"1",
";",
"else",
"if",
"(",
"(",
"newScFlags",
"&",
"scDirMask",
")",
"==",
"scDirMask",
")",
"return",
"2",
";",
"return",
"0",
";",
"}"
] | Returns 1 if existingScFlags of an existing shortcut can be overwritten with a new shortcut by
newScFlags without limiting or changing the directions of the existing shortcut.
The method returns 2 for the same condition but only if the new shortcut has to be added
even if weight is higher than existing shortcut weight.
<pre>
| newScFlags:
existingScFlags | -> | <- | <->
-> | 1 | 0 | 2
<- | 0 | 1 | 2
<-> | 0 | 0 | 1
</pre>
@return 1 if newScFlags is identical to existingScFlags for the two direction bits and 0 otherwise.
There are two special cases when it returns 2. | [
"Returns",
"1",
"if",
"existingScFlags",
"of",
"an",
"existing",
"shortcut",
"can",
"be",
"overwritten",
"with",
"a",
"new",
"shortcut",
"by",
"newScFlags",
"without",
"limiting",
"or",
"changing",
"the",
"directions",
"of",
"the",
"existing",
"shortcut",
".",
"The",
"method",
"returns",
"2",
"for",
"the",
"same",
"condition",
"but",
"only",
"if",
"the",
"new",
"shortcut",
"has",
"to",
"be",
"added",
"even",
"if",
"weight",
"is",
"higher",
"than",
"existing",
"shortcut",
"weight",
".",
"<pre",
">",
"|",
"newScFlags",
":",
"existingScFlags",
"|",
"-",
">",
"|",
"<",
"-",
"|",
"<",
"-",
">",
"-",
">",
"|",
"1",
"|",
"0",
"|",
"2",
"<",
"-",
"|",
"0",
"|",
"1",
"|",
"2",
"<",
"-",
">",
"|",
"0",
"|",
"0",
"|",
"1",
"<",
"/",
"pre",
">"
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/ch/PrepareEncoder.java#L69-L76 |
Azure/azure-sdk-for-java | policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java | PolicyAssignmentsInner.getAsync | public Observable<PolicyAssignmentInner> getAsync(String scope, String policyAssignmentName) {
"""
Gets a policy assignment.
@param scope The scope of the policy assignment.
@param policyAssignmentName The name of the policy assignment to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyAssignmentInner object
"""
return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() {
@Override
public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyAssignmentInner> getAsync(String scope, String policyAssignmentName) {
return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1<ServiceResponse<PolicyAssignmentInner>, PolicyAssignmentInner>() {
@Override
public PolicyAssignmentInner call(ServiceResponse<PolicyAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyAssignmentInner",
">",
"getAsync",
"(",
"String",
"scope",
",",
"String",
"policyAssignmentName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"scope",
",",
"policyAssignmentName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"PolicyAssignmentInner",
">",
",",
"PolicyAssignmentInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"PolicyAssignmentInner",
"call",
"(",
"ServiceResponse",
"<",
"PolicyAssignmentInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a policy assignment.
@param scope The scope of the policy assignment.
@param policyAssignmentName The name of the policy assignment to get.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyAssignmentInner object | [
"Gets",
"a",
"policy",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyAssignmentsInner.java#L330-L337 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESQuery.java | ESQuery.buildAggregation | public AggregationBuilder buildAggregation(KunderaQuery query, EntityMetadata entityMetadata, QueryBuilder filter) {
"""
Use aggregation.
@param query
the query
@param entityMetadata
the entity metadata
@param filter
the filter
@return the filter aggregation builder
"""
SelectStatement selectStatement = query.getSelectStatement();
// To apply filter for where clause
AggregationBuilder aggregationBuilder = buildWhereAggregations(entityMetadata, filter);
if (KunderaQueryUtils.hasGroupBy(query.getJpqlExpression()))
{
TermsBuilder termsBuilder = processGroupByClause(selectStatement.getGroupByClause(), entityMetadata, query);
aggregationBuilder.subAggregation(termsBuilder);
}
else
{
if (KunderaQueryUtils.hasHaving(query.getJpqlExpression()))
{
logger.error("Identified having clause without group by, Throwing not supported operation Exception");
throw new UnsupportedOperationException(
"Currently, Having clause without group by caluse is not supported.");
}
else
{
aggregationBuilder = (selectStatement != null) ? query.isAggregated() ? buildSelectAggregations(
aggregationBuilder, selectStatement, entityMetadata) : null : null;
}
}
return aggregationBuilder;
} | java | public AggregationBuilder buildAggregation(KunderaQuery query, EntityMetadata entityMetadata, QueryBuilder filter)
{
SelectStatement selectStatement = query.getSelectStatement();
// To apply filter for where clause
AggregationBuilder aggregationBuilder = buildWhereAggregations(entityMetadata, filter);
if (KunderaQueryUtils.hasGroupBy(query.getJpqlExpression()))
{
TermsBuilder termsBuilder = processGroupByClause(selectStatement.getGroupByClause(), entityMetadata, query);
aggregationBuilder.subAggregation(termsBuilder);
}
else
{
if (KunderaQueryUtils.hasHaving(query.getJpqlExpression()))
{
logger.error("Identified having clause without group by, Throwing not supported operation Exception");
throw new UnsupportedOperationException(
"Currently, Having clause without group by caluse is not supported.");
}
else
{
aggregationBuilder = (selectStatement != null) ? query.isAggregated() ? buildSelectAggregations(
aggregationBuilder, selectStatement, entityMetadata) : null : null;
}
}
return aggregationBuilder;
} | [
"public",
"AggregationBuilder",
"buildAggregation",
"(",
"KunderaQuery",
"query",
",",
"EntityMetadata",
"entityMetadata",
",",
"QueryBuilder",
"filter",
")",
"{",
"SelectStatement",
"selectStatement",
"=",
"query",
".",
"getSelectStatement",
"(",
")",
";",
"// To apply filter for where clause",
"AggregationBuilder",
"aggregationBuilder",
"=",
"buildWhereAggregations",
"(",
"entityMetadata",
",",
"filter",
")",
";",
"if",
"(",
"KunderaQueryUtils",
".",
"hasGroupBy",
"(",
"query",
".",
"getJpqlExpression",
"(",
")",
")",
")",
"{",
"TermsBuilder",
"termsBuilder",
"=",
"processGroupByClause",
"(",
"selectStatement",
".",
"getGroupByClause",
"(",
")",
",",
"entityMetadata",
",",
"query",
")",
";",
"aggregationBuilder",
".",
"subAggregation",
"(",
"termsBuilder",
")",
";",
"}",
"else",
"{",
"if",
"(",
"KunderaQueryUtils",
".",
"hasHaving",
"(",
"query",
".",
"getJpqlExpression",
"(",
")",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Identified having clause without group by, Throwing not supported operation Exception\"",
")",
";",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Currently, Having clause without group by caluse is not supported.\"",
")",
";",
"}",
"else",
"{",
"aggregationBuilder",
"=",
"(",
"selectStatement",
"!=",
"null",
")",
"?",
"query",
".",
"isAggregated",
"(",
")",
"?",
"buildSelectAggregations",
"(",
"aggregationBuilder",
",",
"selectStatement",
",",
"entityMetadata",
")",
":",
"null",
":",
"null",
";",
"}",
"}",
"return",
"aggregationBuilder",
";",
"}"
] | Use aggregation.
@param query
the query
@param entityMetadata
the entity metadata
@param filter
the filter
@return the filter aggregation builder | [
"Use",
"aggregation",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESQuery.java#L218-L245 |
JodaOrg/joda-time | src/main/java/org/joda/time/Days.java | Days.daysBetween | public static Days daysBetween(ReadableInstant start, ReadableInstant end) {
"""
Creates a <code>Days</code> representing the number of whole days
between the two specified datetimes. This method correctly handles
any daylight savings time changes that may occur during the interval.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in days
@throws IllegalArgumentException if the instants are null or invalid
"""
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days());
return Days.days(amount);
} | java | public static Days daysBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days());
return Days.days(amount);
} | [
"public",
"static",
"Days",
"daysBetween",
"(",
"ReadableInstant",
"start",
",",
"ReadableInstant",
"end",
")",
"{",
"int",
"amount",
"=",
"BaseSingleFieldPeriod",
".",
"between",
"(",
"start",
",",
"end",
",",
"DurationFieldType",
".",
"days",
"(",
")",
")",
";",
"return",
"Days",
".",
"days",
"(",
"amount",
")",
";",
"}"
] | Creates a <code>Days</code> representing the number of whole days
between the two specified datetimes. This method correctly handles
any daylight savings time changes that may occur during the interval.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in days
@throws IllegalArgumentException if the instants are null or invalid | [
"Creates",
"a",
"<code",
">",
"Days<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"days",
"between",
"the",
"two",
"specified",
"datetimes",
".",
"This",
"method",
"correctly",
"handles",
"any",
"daylight",
"savings",
"time",
"changes",
"that",
"may",
"occur",
"during",
"the",
"interval",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Days.java#L117-L120 |
GII/broccoli | broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java | OWLSServiceBuilder.buildOWLSServiceFromLocalOrRemoteURI | private OWLSAtomicService buildOWLSServiceFromLocalOrRemoteURI(URI serviceURI, List<URI> modelURIs) throws ModelException {
"""
Builds an OWLSAtomicService, from a given URI that has to be a local file
or an http URL
@param serviceURI the URI for the service location
@param modelURIs a List of URIs for ontologies that may be used by the
service to be loaded (currently needed when the service is written in
functional or turtle syntax)
@return
@throws ModelException
"""
BSDFLogger.getLogger().info("Builds OWL service (BSDF functionality) from: " + serviceURI.toString());
OWLContainer owlSyntaxTranslator = new OWLContainer();
OWLKnowledgeBase kb = KBWithReasonerBuilder.newKB();
if (null != modelURIs)
{
for (URI uri : modelURIs)
{
owlSyntaxTranslator.loadOntologyIfNotLoaded(uri);
}
}
owlSyntaxTranslator.loadAsServiceIntoKB(kb, serviceURI);
OWLSAtomicService service = new OWLSAtomicService(kb.getServices(false).iterator().next());
return completeOWLSServiceIfNeeded(service);
} | java | private OWLSAtomicService buildOWLSServiceFromLocalOrRemoteURI(URI serviceURI, List<URI> modelURIs) throws ModelException
{
BSDFLogger.getLogger().info("Builds OWL service (BSDF functionality) from: " + serviceURI.toString());
OWLContainer owlSyntaxTranslator = new OWLContainer();
OWLKnowledgeBase kb = KBWithReasonerBuilder.newKB();
if (null != modelURIs)
{
for (URI uri : modelURIs)
{
owlSyntaxTranslator.loadOntologyIfNotLoaded(uri);
}
}
owlSyntaxTranslator.loadAsServiceIntoKB(kb, serviceURI);
OWLSAtomicService service = new OWLSAtomicService(kb.getServices(false).iterator().next());
return completeOWLSServiceIfNeeded(service);
} | [
"private",
"OWLSAtomicService",
"buildOWLSServiceFromLocalOrRemoteURI",
"(",
"URI",
"serviceURI",
",",
"List",
"<",
"URI",
">",
"modelURIs",
")",
"throws",
"ModelException",
"{",
"BSDFLogger",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"Builds OWL service (BSDF functionality) from: \"",
"+",
"serviceURI",
".",
"toString",
"(",
")",
")",
";",
"OWLContainer",
"owlSyntaxTranslator",
"=",
"new",
"OWLContainer",
"(",
")",
";",
"OWLKnowledgeBase",
"kb",
"=",
"KBWithReasonerBuilder",
".",
"newKB",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"modelURIs",
")",
"{",
"for",
"(",
"URI",
"uri",
":",
"modelURIs",
")",
"{",
"owlSyntaxTranslator",
".",
"loadOntologyIfNotLoaded",
"(",
"uri",
")",
";",
"}",
"}",
"owlSyntaxTranslator",
".",
"loadAsServiceIntoKB",
"(",
"kb",
",",
"serviceURI",
")",
";",
"OWLSAtomicService",
"service",
"=",
"new",
"OWLSAtomicService",
"(",
"kb",
".",
"getServices",
"(",
"false",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"return",
"completeOWLSServiceIfNeeded",
"(",
"service",
")",
";",
"}"
] | Builds an OWLSAtomicService, from a given URI that has to be a local file
or an http URL
@param serviceURI the URI for the service location
@param modelURIs a List of URIs for ontologies that may be used by the
service to be loaded (currently needed when the service is written in
functional or turtle syntax)
@return
@throws ModelException | [
"Builds",
"an",
"OWLSAtomicService",
"from",
"a",
"given",
"URI",
"that",
"has",
"to",
"be",
"a",
"local",
"file",
"or",
"an",
"http",
"URL"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java#L129-L145 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.addCheckBox | private void addCheckBox(Date date, boolean checkState) {
"""
Add a new check box.
@param date the date for the check box
@param checkState the initial check state.
"""
CmsCheckBox cb = generateCheckBox(date, checkState);
m_checkBoxes.add(cb);
reInitLayoutElements();
} | java | private void addCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = generateCheckBox(date, checkState);
m_checkBoxes.add(cb);
reInitLayoutElements();
} | [
"private",
"void",
"addCheckBox",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"generateCheckBox",
"(",
"date",
",",
"checkState",
")",
";",
"m_checkBoxes",
".",
"add",
"(",
"cb",
")",
";",
"reInitLayoutElements",
"(",
")",
";",
"}"
] | Add a new check box.
@param date the date for the check box
@param checkState the initial check state. | [
"Add",
"a",
"new",
"check",
"box",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L272-L278 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.onValidity | private void onValidity(String paramString, boolean checkValidity, SingularAttribute<? super X, ?> attribute) {
"""
On validity check.
@param paramString
the param string
@param checkValidity
the check validity
@param attribute
the attribute
"""
if (checkValidity)
{
checkForValid(paramString, attribute);
}
} | java | private void onValidity(String paramString, boolean checkValidity, SingularAttribute<? super X, ?> attribute)
{
if (checkValidity)
{
checkForValid(paramString, attribute);
}
} | [
"private",
"void",
"onValidity",
"(",
"String",
"paramString",
",",
"boolean",
"checkValidity",
",",
"SingularAttribute",
"<",
"?",
"super",
"X",
",",
"?",
">",
"attribute",
")",
"{",
"if",
"(",
"checkValidity",
")",
"{",
"checkForValid",
"(",
"paramString",
",",
"attribute",
")",
";",
"}",
"}"
] | On validity check.
@param paramString
the param string
@param checkValidity
the check validity
@param attribute
the attribute | [
"On",
"validity",
"check",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1193-L1200 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/impl/GoogleCloudStorageReduceInput.java | GoogleCloudStorageReduceInput.createReaderForShard | private MergingReader<K, V> createReaderForShard(
Marshaller<KeyValue<ByteBuffer, ? extends Iterable<V>>> marshaller,
GoogleCloudStorageFileSet reducerInputFileSet) {
"""
Create a {@link MergingReader} that combines all the input files the reducer to provide a
global sort over all data for the shard.
(There are multiple input files in the event that the data didn't fit into the sorter's
memory)
A {@link MergingReader} is used to combine contents while maintaining key-order. This requires
a {@link PeekingInputReader}s to preview the next item of input.
@returns a reader producing key-sorted input for a shard.
"""
ArrayList<PeekingInputReader<KeyValue<ByteBuffer, ? extends Iterable<V>>>> inputFiles =
new ArrayList<>();
GoogleCloudStorageLevelDbInput reducerInput =
new GoogleCloudStorageLevelDbInput(reducerInputFileSet, DEFAULT_IO_BUFFER_SIZE);
for (InputReader<ByteBuffer> in : reducerInput.createReaders()) {
inputFiles.add(new PeekingInputReader<>(in, marshaller));
}
return new MergingReader<>(inputFiles, keyMarshaller, true);
} | java | private MergingReader<K, V> createReaderForShard(
Marshaller<KeyValue<ByteBuffer, ? extends Iterable<V>>> marshaller,
GoogleCloudStorageFileSet reducerInputFileSet) {
ArrayList<PeekingInputReader<KeyValue<ByteBuffer, ? extends Iterable<V>>>> inputFiles =
new ArrayList<>();
GoogleCloudStorageLevelDbInput reducerInput =
new GoogleCloudStorageLevelDbInput(reducerInputFileSet, DEFAULT_IO_BUFFER_SIZE);
for (InputReader<ByteBuffer> in : reducerInput.createReaders()) {
inputFiles.add(new PeekingInputReader<>(in, marshaller));
}
return new MergingReader<>(inputFiles, keyMarshaller, true);
} | [
"private",
"MergingReader",
"<",
"K",
",",
"V",
">",
"createReaderForShard",
"(",
"Marshaller",
"<",
"KeyValue",
"<",
"ByteBuffer",
",",
"?",
"extends",
"Iterable",
"<",
"V",
">",
">",
">",
"marshaller",
",",
"GoogleCloudStorageFileSet",
"reducerInputFileSet",
")",
"{",
"ArrayList",
"<",
"PeekingInputReader",
"<",
"KeyValue",
"<",
"ByteBuffer",
",",
"?",
"extends",
"Iterable",
"<",
"V",
">",
">",
">",
">",
"inputFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"GoogleCloudStorageLevelDbInput",
"reducerInput",
"=",
"new",
"GoogleCloudStorageLevelDbInput",
"(",
"reducerInputFileSet",
",",
"DEFAULT_IO_BUFFER_SIZE",
")",
";",
"for",
"(",
"InputReader",
"<",
"ByteBuffer",
">",
"in",
":",
"reducerInput",
".",
"createReaders",
"(",
")",
")",
"{",
"inputFiles",
".",
"add",
"(",
"new",
"PeekingInputReader",
"<>",
"(",
"in",
",",
"marshaller",
")",
")",
";",
"}",
"return",
"new",
"MergingReader",
"<>",
"(",
"inputFiles",
",",
"keyMarshaller",
",",
"true",
")",
";",
"}"
] | Create a {@link MergingReader} that combines all the input files the reducer to provide a
global sort over all data for the shard.
(There are multiple input files in the event that the data didn't fit into the sorter's
memory)
A {@link MergingReader} is used to combine contents while maintaining key-order. This requires
a {@link PeekingInputReader}s to preview the next item of input.
@returns a reader producing key-sorted input for a shard. | [
"Create",
"a",
"{",
"@link",
"MergingReader",
"}",
"that",
"combines",
"all",
"the",
"input",
"files",
"the",
"reducer",
"to",
"provide",
"a",
"global",
"sort",
"over",
"all",
"data",
"for",
"the",
"shard",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/GoogleCloudStorageReduceInput.java#L71-L82 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java | DataLabelingServiceClient.formatAnnotationSpecSetName | @Deprecated
public static final String formatAnnotationSpecSetName(String project, String annotationSpecSet) {
"""
Formats a string containing the fully-qualified path to represent a annotation_spec_set
resource.
@deprecated Use the {@link AnnotationSpecSetName} class instead.
"""
return ANNOTATION_SPEC_SET_PATH_TEMPLATE.instantiate(
"project", project,
"annotation_spec_set", annotationSpecSet);
} | java | @Deprecated
public static final String formatAnnotationSpecSetName(String project, String annotationSpecSet) {
return ANNOTATION_SPEC_SET_PATH_TEMPLATE.instantiate(
"project", project,
"annotation_spec_set", annotationSpecSet);
} | [
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatAnnotationSpecSetName",
"(",
"String",
"project",
",",
"String",
"annotationSpecSet",
")",
"{",
"return",
"ANNOTATION_SPEC_SET_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"annotation_spec_set\"",
",",
"annotationSpecSet",
")",
";",
"}"
] | Formats a string containing the fully-qualified path to represent a annotation_spec_set
resource.
@deprecated Use the {@link AnnotationSpecSetName} class instead. | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"annotation_spec_set",
"resource",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L162-L167 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.insertOrUpdate | public int insertOrUpdate(Entity record, String... keys) throws SQLException {
"""
插入或更新数据<br>
根据给定的字段名查询数据,如果存在则更新这些数据,否则执行插入
@param record 记录
@param keys 需要检查唯一性的字段
@return 插入行数
@throws SQLException SQL执行异常
@since 4.0.10
"""
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertOrUpdate(conn, record, keys);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public int insertOrUpdate(Entity record, String... keys) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.insertOrUpdate(conn, record, keys);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"int",
"insertOrUpdate",
"(",
"Entity",
"record",
",",
"String",
"...",
"keys",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"return",
"runner",
".",
"insertOrUpdate",
"(",
"conn",
",",
"record",
",",
"keys",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"finally",
"{",
"this",
".",
"closeConnection",
"(",
"conn",
")",
";",
"}",
"}"
] | 插入或更新数据<br>
根据给定的字段名查询数据,如果存在则更新这些数据,否则执行插入
@param record 记录
@param keys 需要检查唯一性的字段
@return 插入行数
@throws SQLException SQL执行异常
@since 4.0.10 | [
"插入或更新数据<br",
">",
"根据给定的字段名查询数据,如果存在则更新这些数据,否则执行插入"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L268-L278 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/core/QuartzScheduler.java | QuartzScheduler.triggerJob | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException {
"""
<p>
Trigger the identified <code>{@link com.helger.quartz.IJob}</code> (execute
it now) - with a non-volatile trigger.
</p>
"""
validateState ();
final IOperableTrigger trig = (IOperableTrigger) newTrigger ().withIdentity (_newTriggerId (),
IScheduler.DEFAULT_GROUP)
.forJob (jobKey)
.build ();
trig.computeFirstFireTime (null);
if (data != null)
{
trig.setJobDataMap (data);
}
boolean collision = true;
while (collision)
{
try
{
m_aResources.getJobStore ().storeTrigger (trig, false);
collision = false;
}
catch (final ObjectAlreadyExistsException oaee)
{
trig.setKey (new TriggerKey (_newTriggerId (), IScheduler.DEFAULT_GROUP));
}
}
notifySchedulerThread (trig.getNextFireTime ().getTime ());
notifySchedulerListenersSchduled (trig);
} | java | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
{
validateState ();
final IOperableTrigger trig = (IOperableTrigger) newTrigger ().withIdentity (_newTriggerId (),
IScheduler.DEFAULT_GROUP)
.forJob (jobKey)
.build ();
trig.computeFirstFireTime (null);
if (data != null)
{
trig.setJobDataMap (data);
}
boolean collision = true;
while (collision)
{
try
{
m_aResources.getJobStore ().storeTrigger (trig, false);
collision = false;
}
catch (final ObjectAlreadyExistsException oaee)
{
trig.setKey (new TriggerKey (_newTriggerId (), IScheduler.DEFAULT_GROUP));
}
}
notifySchedulerThread (trig.getNextFireTime ().getTime ());
notifySchedulerListenersSchduled (trig);
} | [
"public",
"void",
"triggerJob",
"(",
"final",
"JobKey",
"jobKey",
",",
"final",
"JobDataMap",
"data",
")",
"throws",
"SchedulerException",
"{",
"validateState",
"(",
")",
";",
"final",
"IOperableTrigger",
"trig",
"=",
"(",
"IOperableTrigger",
")",
"newTrigger",
"(",
")",
".",
"withIdentity",
"(",
"_newTriggerId",
"(",
")",
",",
"IScheduler",
".",
"DEFAULT_GROUP",
")",
".",
"forJob",
"(",
"jobKey",
")",
".",
"build",
"(",
")",
";",
"trig",
".",
"computeFirstFireTime",
"(",
"null",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"trig",
".",
"setJobDataMap",
"(",
"data",
")",
";",
"}",
"boolean",
"collision",
"=",
"true",
";",
"while",
"(",
"collision",
")",
"{",
"try",
"{",
"m_aResources",
".",
"getJobStore",
"(",
")",
".",
"storeTrigger",
"(",
"trig",
",",
"false",
")",
";",
"collision",
"=",
"false",
";",
"}",
"catch",
"(",
"final",
"ObjectAlreadyExistsException",
"oaee",
")",
"{",
"trig",
".",
"setKey",
"(",
"new",
"TriggerKey",
"(",
"_newTriggerId",
"(",
")",
",",
"IScheduler",
".",
"DEFAULT_GROUP",
")",
")",
";",
"}",
"}",
"notifySchedulerThread",
"(",
"trig",
".",
"getNextFireTime",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"notifySchedulerListenersSchduled",
"(",
"trig",
")",
";",
"}"
] | <p>
Trigger the identified <code>{@link com.helger.quartz.IJob}</code> (execute
it now) - with a non-volatile trigger.
</p> | [
"<p",
">",
"Trigger",
"the",
"identified",
"<code",
">",
"{"
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/core/QuartzScheduler.java#L947-L977 |
wouterd/docker-maven-plugin | src/main/java/net/wouterdanes/docker/remoteapi/MiscService.java | MiscService.buildImage | public String buildImage(byte[] tarArchive, Optional<String> name, Optional<String> buildArguments) {
"""
Builds an image based on the passed tar archive. Optionally names & tags the image
@param tarArchive the tar archive to use as a source for the image
@param name the name and optional tag of the image.
@param buildArguments a list of optional build arguments made available to the Dockerfile.
@return the ID of the created image
"""
Response response = getServiceEndPoint()
.path("/build")
.queryParam("q", true)
.queryParam("t", name.orElse(null))
.queryParam("buildargs", UriComponent.encode(buildArguments.orElse(null), UriComponent.Type.QUERY_PARAM_SPACE_ENCODED))
.queryParam("forcerm")
.request(MediaType.APPLICATION_JSON_TYPE)
.header(REGISTRY_AUTH_HEADER, getRegistryAuthHeaderValue())
.post(Entity.entity(tarArchive, "application/tar"));
InputStream inputStream = (InputStream) response.getEntity();
String imageId = parseSteamForImageId(inputStream);
if (imageId == null) {
throw new DockerException("Can't obtain ID from build output stream.");
}
return imageId;
} | java | public String buildImage(byte[] tarArchive, Optional<String> name, Optional<String> buildArguments) {
Response response = getServiceEndPoint()
.path("/build")
.queryParam("q", true)
.queryParam("t", name.orElse(null))
.queryParam("buildargs", UriComponent.encode(buildArguments.orElse(null), UriComponent.Type.QUERY_PARAM_SPACE_ENCODED))
.queryParam("forcerm")
.request(MediaType.APPLICATION_JSON_TYPE)
.header(REGISTRY_AUTH_HEADER, getRegistryAuthHeaderValue())
.post(Entity.entity(tarArchive, "application/tar"));
InputStream inputStream = (InputStream) response.getEntity();
String imageId = parseSteamForImageId(inputStream);
if (imageId == null) {
throw new DockerException("Can't obtain ID from build output stream.");
}
return imageId;
} | [
"public",
"String",
"buildImage",
"(",
"byte",
"[",
"]",
"tarArchive",
",",
"Optional",
"<",
"String",
">",
"name",
",",
"Optional",
"<",
"String",
">",
"buildArguments",
")",
"{",
"Response",
"response",
"=",
"getServiceEndPoint",
"(",
")",
".",
"path",
"(",
"\"/build\"",
")",
".",
"queryParam",
"(",
"\"q\"",
",",
"true",
")",
".",
"queryParam",
"(",
"\"t\"",
",",
"name",
".",
"orElse",
"(",
"null",
")",
")",
".",
"queryParam",
"(",
"\"buildargs\"",
",",
"UriComponent",
".",
"encode",
"(",
"buildArguments",
".",
"orElse",
"(",
"null",
")",
",",
"UriComponent",
".",
"Type",
".",
"QUERY_PARAM_SPACE_ENCODED",
")",
")",
".",
"queryParam",
"(",
"\"forcerm\"",
")",
".",
"request",
"(",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"header",
"(",
"REGISTRY_AUTH_HEADER",
",",
"getRegistryAuthHeaderValue",
"(",
")",
")",
".",
"post",
"(",
"Entity",
".",
"entity",
"(",
"tarArchive",
",",
"\"application/tar\"",
")",
")",
";",
"InputStream",
"inputStream",
"=",
"(",
"InputStream",
")",
"response",
".",
"getEntity",
"(",
")",
";",
"String",
"imageId",
"=",
"parseSteamForImageId",
"(",
"inputStream",
")",
";",
"if",
"(",
"imageId",
"==",
"null",
")",
"{",
"throw",
"new",
"DockerException",
"(",
"\"Can't obtain ID from build output stream.\"",
")",
";",
"}",
"return",
"imageId",
";",
"}"
] | Builds an image based on the passed tar archive. Optionally names & tags the image
@param tarArchive the tar archive to use as a source for the image
@param name the name and optional tag of the image.
@param buildArguments a list of optional build arguments made available to the Dockerfile.
@return the ID of the created image | [
"Builds",
"an",
"image",
"based",
"on",
"the",
"passed",
"tar",
"archive",
".",
"Optionally",
"names",
"&",
";",
"tags",
"the",
"image"
] | train | https://github.com/wouterd/docker-maven-plugin/blob/ea15f9e6c273989bb91f4228fb52cb73d00e07b3/src/main/java/net/wouterdanes/docker/remoteapi/MiscService.java#L121-L141 |
openbase/jul | processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java | XMLProcessor.extractAttributeValue | public static String extractAttributeValue(final String attrName, final Node doc, final boolean throwException) throws XMLParsingException {
"""
<p>
Returns the first Attribute with name attrName from Document doc. Uses xPath "//
@throws XMLParsingException
@param throwException flag set throw exception if no such Attribute can be found. <br>
@param attrName
@param doc
@return
"""
String xpath = "descendant-or-self::*/@" + attrName;
Nodes nodes = doc.query(xpath);
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i) instanceof Attribute) {
return nodes.get(i).getValue();
}
}
if (throwException) {
throw new XMLParsingException("No Attribute " + attrName + " in document:\n" + doc.toXML());
} else {
return null;
}
} | java | public static String extractAttributeValue(final String attrName, final Node doc, final boolean throwException) throws XMLParsingException {
String xpath = "descendant-or-self::*/@" + attrName;
Nodes nodes = doc.query(xpath);
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i) instanceof Attribute) {
return nodes.get(i).getValue();
}
}
if (throwException) {
throw new XMLParsingException("No Attribute " + attrName + " in document:\n" + doc.toXML());
} else {
return null;
}
} | [
"public",
"static",
"String",
"extractAttributeValue",
"(",
"final",
"String",
"attrName",
",",
"final",
"Node",
"doc",
",",
"final",
"boolean",
"throwException",
")",
"throws",
"XMLParsingException",
"{",
"String",
"xpath",
"=",
"\"descendant-or-self::*/@\"",
"+",
"attrName",
";",
"Nodes",
"nodes",
"=",
"doc",
".",
"query",
"(",
"xpath",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nodes",
".",
"get",
"(",
"i",
")",
"instanceof",
"Attribute",
")",
"{",
"return",
"nodes",
".",
"get",
"(",
"i",
")",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"if",
"(",
"throwException",
")",
"{",
"throw",
"new",
"XMLParsingException",
"(",
"\"No Attribute \"",
"+",
"attrName",
"+",
"\" in document:\\n\"",
"+",
"doc",
".",
"toXML",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | <p>
Returns the first Attribute with name attrName from Document doc. Uses xPath "//
@throws XMLParsingException
@param throwException flag set throw exception if no such Attribute can be found. <br>
@param attrName
@param doc
@return | [
"<p",
">",
"Returns",
"the",
"first",
"Attribute",
"with",
"name",
"attrName",
"from",
"Document",
"doc",
".",
"Uses",
"xPath",
"//"
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/xml/src/main/java/org/openbase/jul/processing/xml/processing/XMLProcessor.java#L269-L282 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/websocket/stream/IOState.java | IOState.onReadFailure | public void onReadFailure(Throwable t) {
"""
The local endpoint has reached a read failure.
<p>
This could be a normal result after a proper close handshake, or even a premature close due to a connection disconnect.
@param t the read failure
"""
ConnectionState event = null;
synchronized (this) {
if (this.state == ConnectionState.CLOSED) {
// already closed
return;
}
// Build out Close Reason
String reason = "WebSocket Read Failure";
if (t instanceof EOFException) {
reason = "WebSocket Read EOF";
Throwable cause = t.getCause();
if ((cause != null) && (StringUtils.hasText(cause.getMessage()))) {
reason = "EOF: " + cause.getMessage();
}
} else {
if (StringUtils.hasText(t.getMessage())) {
reason = t.getMessage();
}
}
CloseInfo close = new CloseInfo(StatusCode.ABNORMAL, reason);
finalClose.compareAndSet(null, close);
this.cleanClose = false;
this.state = ConnectionState.CLOSED;
this.closeInfo = close;
this.inputAvailable = false;
this.outputAvailable = false;
this.closeHandshakeSource = CloseHandshakeSource.ABNORMAL;
event = this.state;
}
notifyStateListeners(event);
} | java | public void onReadFailure(Throwable t) {
ConnectionState event = null;
synchronized (this) {
if (this.state == ConnectionState.CLOSED) {
// already closed
return;
}
// Build out Close Reason
String reason = "WebSocket Read Failure";
if (t instanceof EOFException) {
reason = "WebSocket Read EOF";
Throwable cause = t.getCause();
if ((cause != null) && (StringUtils.hasText(cause.getMessage()))) {
reason = "EOF: " + cause.getMessage();
}
} else {
if (StringUtils.hasText(t.getMessage())) {
reason = t.getMessage();
}
}
CloseInfo close = new CloseInfo(StatusCode.ABNORMAL, reason);
finalClose.compareAndSet(null, close);
this.cleanClose = false;
this.state = ConnectionState.CLOSED;
this.closeInfo = close;
this.inputAvailable = false;
this.outputAvailable = false;
this.closeHandshakeSource = CloseHandshakeSource.ABNORMAL;
event = this.state;
}
notifyStateListeners(event);
} | [
"public",
"void",
"onReadFailure",
"(",
"Throwable",
"t",
")",
"{",
"ConnectionState",
"event",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"state",
"==",
"ConnectionState",
".",
"CLOSED",
")",
"{",
"// already closed",
"return",
";",
"}",
"// Build out Close Reason",
"String",
"reason",
"=",
"\"WebSocket Read Failure\"",
";",
"if",
"(",
"t",
"instanceof",
"EOFException",
")",
"{",
"reason",
"=",
"\"WebSocket Read EOF\"",
";",
"Throwable",
"cause",
"=",
"t",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"(",
"cause",
"!=",
"null",
")",
"&&",
"(",
"StringUtils",
".",
"hasText",
"(",
"cause",
".",
"getMessage",
"(",
")",
")",
")",
")",
"{",
"reason",
"=",
"\"EOF: \"",
"+",
"cause",
".",
"getMessage",
"(",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"t",
".",
"getMessage",
"(",
")",
")",
")",
"{",
"reason",
"=",
"t",
".",
"getMessage",
"(",
")",
";",
"}",
"}",
"CloseInfo",
"close",
"=",
"new",
"CloseInfo",
"(",
"StatusCode",
".",
"ABNORMAL",
",",
"reason",
")",
";",
"finalClose",
".",
"compareAndSet",
"(",
"null",
",",
"close",
")",
";",
"this",
".",
"cleanClose",
"=",
"false",
";",
"this",
".",
"state",
"=",
"ConnectionState",
".",
"CLOSED",
";",
"this",
".",
"closeInfo",
"=",
"close",
";",
"this",
".",
"inputAvailable",
"=",
"false",
";",
"this",
".",
"outputAvailable",
"=",
"false",
";",
"this",
".",
"closeHandshakeSource",
"=",
"CloseHandshakeSource",
".",
"ABNORMAL",
";",
"event",
"=",
"this",
".",
"state",
";",
"}",
"notifyStateListeners",
"(",
"event",
")",
";",
"}"
] | The local endpoint has reached a read failure.
<p>
This could be a normal result after a proper close handshake, or even a premature close due to a connection disconnect.
@param t the read failure | [
"The",
"local",
"endpoint",
"has",
"reached",
"a",
"read",
"failure",
".",
"<p",
">",
"This",
"could",
"be",
"a",
"normal",
"result",
"after",
"a",
"proper",
"close",
"handshake",
"or",
"even",
"a",
"premature",
"close",
"due",
"to",
"a",
"connection",
"disconnect",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/stream/IOState.java#L395-L430 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/Branch.java | Branch.initSession | public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Activity activity) {
"""
<p>Initialises a session with the Branch API.</p>
@param callback A {@link BranchUniversalReferralInitListener} instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.
@param isReferrable A {@link Boolean} value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.
@param activity The calling {@link Activity} for context.
@return A {@link Boolean} value that returns <i>false</i> if unsuccessful.
"""
initUserSessionInternal(callback, activity, isReferrable);
return true;
} | java | public boolean initSession(BranchUniversalReferralInitListener callback, boolean isReferrable, Activity activity) {
initUserSessionInternal(callback, activity, isReferrable);
return true;
} | [
"public",
"boolean",
"initSession",
"(",
"BranchUniversalReferralInitListener",
"callback",
",",
"boolean",
"isReferrable",
",",
"Activity",
"activity",
")",
"{",
"initUserSessionInternal",
"(",
"callback",
",",
"activity",
",",
"isReferrable",
")",
";",
"return",
"true",
";",
"}"
] | <p>Initialises a session with the Branch API.</p>
@param callback A {@link BranchUniversalReferralInitListener} instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.
@param isReferrable A {@link Boolean} value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.
@param activity The calling {@link Activity} for context.
@return A {@link Boolean} value that returns <i>false</i> if unsuccessful. | [
"<p",
">",
"Initialises",
"a",
"session",
"with",
"the",
"Branch",
"API",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1311-L1314 |
daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setSliderTransformDuration | public void setSliderTransformDuration(int period,Interpolator interpolator) {
"""
set the duration between two slider changes.
@param period
@param interpolator
"""
try{
Field mScroller = ViewPagerEx.class.getDeclaredField("mScroller");
mScroller.setAccessible(true);
FixedSpeedScroller scroller = new FixedSpeedScroller(mViewPager.getContext(),interpolator, period);
mScroller.set(mViewPager,scroller);
}catch (Exception e){
}
} | java | public void setSliderTransformDuration(int period,Interpolator interpolator){
try{
Field mScroller = ViewPagerEx.class.getDeclaredField("mScroller");
mScroller.setAccessible(true);
FixedSpeedScroller scroller = new FixedSpeedScroller(mViewPager.getContext(),interpolator, period);
mScroller.set(mViewPager,scroller);
}catch (Exception e){
}
} | [
"public",
"void",
"setSliderTransformDuration",
"(",
"int",
"period",
",",
"Interpolator",
"interpolator",
")",
"{",
"try",
"{",
"Field",
"mScroller",
"=",
"ViewPagerEx",
".",
"class",
".",
"getDeclaredField",
"(",
"\"mScroller\"",
")",
";",
"mScroller",
".",
"setAccessible",
"(",
"true",
")",
";",
"FixedSpeedScroller",
"scroller",
"=",
"new",
"FixedSpeedScroller",
"(",
"mViewPager",
".",
"getContext",
"(",
")",
",",
"interpolator",
",",
"period",
")",
";",
"mScroller",
".",
"set",
"(",
"mViewPager",
",",
"scroller",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}"
] | set the duration between two slider changes.
@param period
@param interpolator | [
"set",
"the",
"duration",
"between",
"two",
"slider",
"changes",
"."
] | train | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L380-L389 |
OpenLiberty/open-liberty | dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLMultiScopeRecoveryLog.java | SQLMultiScopeRecoveryLog.closeConnectionAfterBatch | private void closeConnectionAfterBatch(Connection conn, int initialIsolation) throws SQLException {
"""
closes the connection and resets the isolation level if required
"""
if (_isDB2)
{
if (Connection.TRANSACTION_REPEATABLE_READ != initialIsolation && Connection.TRANSACTION_SERIALIZABLE != initialIsolation)
try
{
conn.setTransactionIsolation(initialIsolation);
} catch (Exception e)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setTransactionIsolation threw Exception. Specified transaction isolation level was " + initialIsolation + " ", e);
FFDCFilter.processException(e, "com.ibm.ws.recoverylog.spi.SQLMultiScopeRecoveryLog.closeConnectionAfterBatch", "3696", this);
if (!isolationFailureReported)
{
isolationFailureReported = true;
Tr.warning(tc, "CWRLS0024_EXC_DURING_RECOVERY", e);
}
}
}
conn.close();
} | java | private void closeConnectionAfterBatch(Connection conn, int initialIsolation) throws SQLException {
if (_isDB2)
{
if (Connection.TRANSACTION_REPEATABLE_READ != initialIsolation && Connection.TRANSACTION_SERIALIZABLE != initialIsolation)
try
{
conn.setTransactionIsolation(initialIsolation);
} catch (Exception e)
{
if (tc.isDebugEnabled())
Tr.debug(tc, "setTransactionIsolation threw Exception. Specified transaction isolation level was " + initialIsolation + " ", e);
FFDCFilter.processException(e, "com.ibm.ws.recoverylog.spi.SQLMultiScopeRecoveryLog.closeConnectionAfterBatch", "3696", this);
if (!isolationFailureReported)
{
isolationFailureReported = true;
Tr.warning(tc, "CWRLS0024_EXC_DURING_RECOVERY", e);
}
}
}
conn.close();
} | [
"private",
"void",
"closeConnectionAfterBatch",
"(",
"Connection",
"conn",
",",
"int",
"initialIsolation",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"_isDB2",
")",
"{",
"if",
"(",
"Connection",
".",
"TRANSACTION_REPEATABLE_READ",
"!=",
"initialIsolation",
"&&",
"Connection",
".",
"TRANSACTION_SERIALIZABLE",
"!=",
"initialIsolation",
")",
"try",
"{",
"conn",
".",
"setTransactionIsolation",
"(",
"initialIsolation",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"setTransactionIsolation threw Exception. Specified transaction isolation level was \"",
"+",
"initialIsolation",
"+",
"\" \"",
",",
"e",
")",
";",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.recoverylog.spi.SQLMultiScopeRecoveryLog.closeConnectionAfterBatch\"",
",",
"\"3696\"",
",",
"this",
")",
";",
"if",
"(",
"!",
"isolationFailureReported",
")",
"{",
"isolationFailureReported",
"=",
"true",
";",
"Tr",
".",
"warning",
"(",
"tc",
",",
"\"CWRLS0024_EXC_DURING_RECOVERY\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"conn",
".",
"close",
"(",
")",
";",
"}"
] | closes the connection and resets the isolation level if required | [
"closes",
"the",
"connection",
"and",
"resets",
"the",
"isolation",
"level",
"if",
"required"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLMultiScopeRecoveryLog.java#L3496-L3516 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/canvas/CanvasRenderer.java | CanvasRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:canvas.
@param context the FacesContext.
@param component the current b:canvas.
@throws IOException thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Canvas canvas = (Canvas) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = canvas.getClientId();
rw.startElement("canvas", canvas);
Tooltip.generateTooltip(context, canvas, rw);
// rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing");
rw.writeAttribute("id", clientId, "id");
writeAttribute(rw, "style", canvas.getStyle(), "style");
String styleClass = canvas.getStyleClass();
if (null != styleClass)
styleClass += Responsive.getResponsiveStyleClass(canvas, false);
else
styleClass = Responsive.getResponsiveStyleClass(canvas, false);
writeAttribute(rw, "class", styleClass, "class");
writeAttribute(rw, "width", canvas.getWidth(), "width");
writeAttribute(rw, "height", canvas.getHeight(), "height");
rw.endElement("canvas");
Tooltip.activateTooltips(context, canvas);
Drawing drawing = canvas.getDrawing();
if (null != drawing) {
String script = ((Drawing) drawing).getJavaScript();
rw.startElement("script", component);
rw.write("\nnew function(){\n");
rw.write(" var canvas=document.getElementById('" + clientId + "');\n");
rw.write(" var ctx = canvas.getContext('2d');\n");
rw.write(script);
rw.write("\n}();\n");
rw.endElement("script");
}
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Canvas canvas = (Canvas) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = canvas.getClientId();
rw.startElement("canvas", canvas);
Tooltip.generateTooltip(context, canvas, rw);
// rw.writeAttribute("initial-drawing", canvas.getInitial-drawing(), "initial-drawing");
rw.writeAttribute("id", clientId, "id");
writeAttribute(rw, "style", canvas.getStyle(), "style");
String styleClass = canvas.getStyleClass();
if (null != styleClass)
styleClass += Responsive.getResponsiveStyleClass(canvas, false);
else
styleClass = Responsive.getResponsiveStyleClass(canvas, false);
writeAttribute(rw, "class", styleClass, "class");
writeAttribute(rw, "width", canvas.getWidth(), "width");
writeAttribute(rw, "height", canvas.getHeight(), "height");
rw.endElement("canvas");
Tooltip.activateTooltips(context, canvas);
Drawing drawing = canvas.getDrawing();
if (null != drawing) {
String script = ((Drawing) drawing).getJavaScript();
rw.startElement("script", component);
rw.write("\nnew function(){\n");
rw.write(" var canvas=document.getElementById('" + clientId + "');\n");
rw.write(" var ctx = canvas.getContext('2d');\n");
rw.write(script);
rw.write("\n}();\n");
rw.endElement("script");
}
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Canvas",
"canvas",
"=",
"(",
"Canvas",
")",
"component",
";",
"ResponseWriter",
"rw",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"String",
"clientId",
"=",
"canvas",
".",
"getClientId",
"(",
")",
";",
"rw",
".",
"startElement",
"(",
"\"canvas\"",
",",
"canvas",
")",
";",
"Tooltip",
".",
"generateTooltip",
"(",
"context",
",",
"canvas",
",",
"rw",
")",
";",
"//\t rw.writeAttribute(\"initial-drawing\", canvas.getInitial-drawing(), \"initial-drawing\");",
"rw",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"clientId",
",",
"\"id\"",
")",
";",
"writeAttribute",
"(",
"rw",
",",
"\"style\"",
",",
"canvas",
".",
"getStyle",
"(",
")",
",",
"\"style\"",
")",
";",
"String",
"styleClass",
"=",
"canvas",
".",
"getStyleClass",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"styleClass",
")",
"styleClass",
"+=",
"Responsive",
".",
"getResponsiveStyleClass",
"(",
"canvas",
",",
"false",
")",
";",
"else",
"styleClass",
"=",
"Responsive",
".",
"getResponsiveStyleClass",
"(",
"canvas",
",",
"false",
")",
";",
"writeAttribute",
"(",
"rw",
",",
"\"class\"",
",",
"styleClass",
",",
"\"class\"",
")",
";",
"writeAttribute",
"(",
"rw",
",",
"\"width\"",
",",
"canvas",
".",
"getWidth",
"(",
")",
",",
"\"width\"",
")",
";",
"writeAttribute",
"(",
"rw",
",",
"\"height\"",
",",
"canvas",
".",
"getHeight",
"(",
")",
",",
"\"height\"",
")",
";",
"rw",
".",
"endElement",
"(",
"\"canvas\"",
")",
";",
"Tooltip",
".",
"activateTooltips",
"(",
"context",
",",
"canvas",
")",
";",
"Drawing",
"drawing",
"=",
"canvas",
".",
"getDrawing",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"drawing",
")",
"{",
"String",
"script",
"=",
"(",
"(",
"Drawing",
")",
"drawing",
")",
".",
"getJavaScript",
"(",
")",
";",
"rw",
".",
"startElement",
"(",
"\"script\"",
",",
"component",
")",
";",
"rw",
".",
"write",
"(",
"\"\\nnew function(){\\n\"",
")",
";",
"rw",
".",
"write",
"(",
"\" var canvas=document.getElementById('\"",
"+",
"clientId",
"+",
"\"');\\n\"",
")",
";",
"rw",
".",
"write",
"(",
"\" var ctx = canvas.getContext('2d');\\n\"",
")",
";",
"rw",
".",
"write",
"(",
"script",
")",
";",
"rw",
".",
"write",
"(",
"\"\\n}();\\n\"",
")",
";",
"rw",
".",
"endElement",
"(",
"\"script\"",
")",
";",
"}",
"}"
] | This methods generates the HTML code of the current b:canvas.
@param context the FacesContext.
@param component the current b:canvas.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"canvas",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/canvas/CanvasRenderer.java#L42-L79 |
Mthwate/DatLib | src/main/java/com/mthwate/datlib/HashUtils.java | HashUtils.sha224Hex | public static String sha224Hex(String data, Charset charset) throws NoSuchAlgorithmException {
"""
Hashes a string using the SHA-224 algorithm. Returns a hexadecimal result.
@since 1.1
@param data the string to hash
@param charset the charset of the string
@return the hexadecimal SHA-224 hash of the string
@throws NoSuchAlgorithmException the algorithm is not supported by existing providers
"""
return sha224Hex(data.getBytes(charset));
} | java | public static String sha224Hex(String data, Charset charset) throws NoSuchAlgorithmException {
return sha224Hex(data.getBytes(charset));
} | [
"public",
"static",
"String",
"sha224Hex",
"(",
"String",
"data",
",",
"Charset",
"charset",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"return",
"sha224Hex",
"(",
"data",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] | Hashes a string using the SHA-224 algorithm. Returns a hexadecimal result.
@since 1.1
@param data the string to hash
@param charset the charset of the string
@return the hexadecimal SHA-224 hash of the string
@throws NoSuchAlgorithmException the algorithm is not supported by existing providers | [
"Hashes",
"a",
"string",
"using",
"the",
"SHA",
"-",
"224",
"algorithm",
".",
"Returns",
"a",
"hexadecimal",
"result",
"."
] | train | https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L360-L362 |
JavaMoney/jsr354-ri | moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBRateReadingHandler.java | ECBRateReadingHandler.addRate | void addRate(CurrencyUnit term, LocalDate localDate, Number rate) {
"""
Method to add a currency exchange rate.
@param term the term (target) currency, mapped from EUR.
@param rate The rate.
"""
RateType rateType = RateType.HISTORIC;
ExchangeRateBuilder builder;
if (Objects.nonNull(localDate)) {
// TODO check/test!
if (localDate.equals(LocalDate.now())) {
rateType = RateType.DEFERRED;
}
builder = new ExchangeRateBuilder(
ConversionContextBuilder.create(context, rateType).set(localDate).build());
} else {
builder = new ExchangeRateBuilder(ConversionContextBuilder.create(context, rateType).build());
}
builder.setBase(ECBHistoricRateProvider.BASE_CURRENCY);
builder.setTerm(term);
builder.setFactor(DefaultNumberValue.of(rate));
ExchangeRate exchangeRate = builder.build();
Map<String, ExchangeRate> rateMap = this.historicRates.get(localDate);
if (Objects.isNull(rateMap)) {
synchronized (this.historicRates) {
rateMap = Optional.ofNullable(this.historicRates.get(localDate)).orElse(new ConcurrentHashMap<>());
this.historicRates.putIfAbsent(localDate, rateMap);
}
}
rateMap.put(term.getCurrencyCode(), exchangeRate);
} | java | void addRate(CurrencyUnit term, LocalDate localDate, Number rate) {
RateType rateType = RateType.HISTORIC;
ExchangeRateBuilder builder;
if (Objects.nonNull(localDate)) {
// TODO check/test!
if (localDate.equals(LocalDate.now())) {
rateType = RateType.DEFERRED;
}
builder = new ExchangeRateBuilder(
ConversionContextBuilder.create(context, rateType).set(localDate).build());
} else {
builder = new ExchangeRateBuilder(ConversionContextBuilder.create(context, rateType).build());
}
builder.setBase(ECBHistoricRateProvider.BASE_CURRENCY);
builder.setTerm(term);
builder.setFactor(DefaultNumberValue.of(rate));
ExchangeRate exchangeRate = builder.build();
Map<String, ExchangeRate> rateMap = this.historicRates.get(localDate);
if (Objects.isNull(rateMap)) {
synchronized (this.historicRates) {
rateMap = Optional.ofNullable(this.historicRates.get(localDate)).orElse(new ConcurrentHashMap<>());
this.historicRates.putIfAbsent(localDate, rateMap);
}
}
rateMap.put(term.getCurrencyCode(), exchangeRate);
} | [
"void",
"addRate",
"(",
"CurrencyUnit",
"term",
",",
"LocalDate",
"localDate",
",",
"Number",
"rate",
")",
"{",
"RateType",
"rateType",
"=",
"RateType",
".",
"HISTORIC",
";",
"ExchangeRateBuilder",
"builder",
";",
"if",
"(",
"Objects",
".",
"nonNull",
"(",
"localDate",
")",
")",
"{",
"// TODO check/test!",
"if",
"(",
"localDate",
".",
"equals",
"(",
"LocalDate",
".",
"now",
"(",
")",
")",
")",
"{",
"rateType",
"=",
"RateType",
".",
"DEFERRED",
";",
"}",
"builder",
"=",
"new",
"ExchangeRateBuilder",
"(",
"ConversionContextBuilder",
".",
"create",
"(",
"context",
",",
"rateType",
")",
".",
"set",
"(",
"localDate",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"else",
"{",
"builder",
"=",
"new",
"ExchangeRateBuilder",
"(",
"ConversionContextBuilder",
".",
"create",
"(",
"context",
",",
"rateType",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"builder",
".",
"setBase",
"(",
"ECBHistoricRateProvider",
".",
"BASE_CURRENCY",
")",
";",
"builder",
".",
"setTerm",
"(",
"term",
")",
";",
"builder",
".",
"setFactor",
"(",
"DefaultNumberValue",
".",
"of",
"(",
"rate",
")",
")",
";",
"ExchangeRate",
"exchangeRate",
"=",
"builder",
".",
"build",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ExchangeRate",
">",
"rateMap",
"=",
"this",
".",
"historicRates",
".",
"get",
"(",
"localDate",
")",
";",
"if",
"(",
"Objects",
".",
"isNull",
"(",
"rateMap",
")",
")",
"{",
"synchronized",
"(",
"this",
".",
"historicRates",
")",
"{",
"rateMap",
"=",
"Optional",
".",
"ofNullable",
"(",
"this",
".",
"historicRates",
".",
"get",
"(",
"localDate",
")",
")",
".",
"orElse",
"(",
"new",
"ConcurrentHashMap",
"<>",
"(",
")",
")",
";",
"this",
".",
"historicRates",
".",
"putIfAbsent",
"(",
"localDate",
",",
"rateMap",
")",
";",
"}",
"}",
"rateMap",
".",
"put",
"(",
"term",
".",
"getCurrencyCode",
"(",
")",
",",
"exchangeRate",
")",
";",
"}"
] | Method to add a currency exchange rate.
@param term the term (target) currency, mapped from EUR.
@param rate The rate. | [
"Method",
"to",
"add",
"a",
"currency",
"exchange",
"rate",
"."
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-convert/moneta-convert-ecb/src/main/java/org/javamoney/moneta/convert/ecb/ECBRateReadingHandler.java#L100-L126 |
openengsb/openengsb | components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java | ManipulationUtils.addFileFunction | private static void addFileFunction(CtClass clazz, String property)
throws NotFoundException, CannotCompileException {
"""
Adds the functionality that the models can handle File objects themselves.
"""
String wrapperName = property + "wrapper";
String funcName = "set";
funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
funcName = funcName + wrapperName.substring(1);
String setterName = "set";
setterName = setterName + Character.toUpperCase(property.charAt(0));
setterName = setterName + property.substring(1);
CtClass[] params = generateClassField(FileWrapper.class);
CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
clazz.addMethod(newFunc);
} | java | private static void addFileFunction(CtClass clazz, String property)
throws NotFoundException, CannotCompileException {
String wrapperName = property + "wrapper";
String funcName = "set";
funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
funcName = funcName + wrapperName.substring(1);
String setterName = "set";
setterName = setterName + Character.toUpperCase(property.charAt(0));
setterName = setterName + property.substring(1);
CtClass[] params = generateClassField(FileWrapper.class);
CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
clazz.addMethod(newFunc);
} | [
"private",
"static",
"void",
"addFileFunction",
"(",
"CtClass",
"clazz",
",",
"String",
"property",
")",
"throws",
"NotFoundException",
",",
"CannotCompileException",
"{",
"String",
"wrapperName",
"=",
"property",
"+",
"\"wrapper\"",
";",
"String",
"funcName",
"=",
"\"set\"",
";",
"funcName",
"=",
"funcName",
"+",
"Character",
".",
"toUpperCase",
"(",
"wrapperName",
".",
"charAt",
"(",
"0",
")",
")",
";",
"funcName",
"=",
"funcName",
"+",
"wrapperName",
".",
"substring",
"(",
"1",
")",
";",
"String",
"setterName",
"=",
"\"set\"",
";",
"setterName",
"=",
"setterName",
"+",
"Character",
".",
"toUpperCase",
"(",
"property",
".",
"charAt",
"(",
"0",
")",
")",
";",
"setterName",
"=",
"setterName",
"+",
"property",
".",
"substring",
"(",
"1",
")",
";",
"CtClass",
"[",
"]",
"params",
"=",
"generateClassField",
"(",
"FileWrapper",
".",
"class",
")",
";",
"CtMethod",
"newFunc",
"=",
"new",
"CtMethod",
"(",
"CtClass",
".",
"voidType",
",",
"funcName",
",",
"params",
",",
"clazz",
")",
";",
"newFunc",
".",
"setBody",
"(",
"\"{ \"",
"+",
"setterName",
"+",
"\"($1.returnFile());\\n }\"",
")",
";",
"clazz",
".",
"addMethod",
"(",
"newFunc",
")",
";",
"}"
] | Adds the functionality that the models can handle File objects themselves. | [
"Adds",
"the",
"functionality",
"that",
"the",
"models",
"can",
"handle",
"File",
"objects",
"themselves",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java#L498-L511 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java | PcsUtils.buildCStorageException | public static CStorageException buildCStorageException( CResponse response, String message, CPath path ) {
"""
Some common code between providers. Handles the different status codes, and generates a nice exception
@param response The wrapped HTTP response
@param message The error message (provided by the server or by the application)
@param path The file requested (which failed)
@return The exception
"""
switch ( response.getStatus() ) {
case 401:
return new CAuthenticationException( message, response );
case 404:
message = "No file found at URL " + shortenUrl( response.getUri() ) + " (" + message + ")";
return new CFileNotFoundException( message, path );
default:
return new CHttpException( message, response );
}
} | java | public static CStorageException buildCStorageException( CResponse response, String message, CPath path )
{
switch ( response.getStatus() ) {
case 401:
return new CAuthenticationException( message, response );
case 404:
message = "No file found at URL " + shortenUrl( response.getUri() ) + " (" + message + ")";
return new CFileNotFoundException( message, path );
default:
return new CHttpException( message, response );
}
} | [
"public",
"static",
"CStorageException",
"buildCStorageException",
"(",
"CResponse",
"response",
",",
"String",
"message",
",",
"CPath",
"path",
")",
"{",
"switch",
"(",
"response",
".",
"getStatus",
"(",
")",
")",
"{",
"case",
"401",
":",
"return",
"new",
"CAuthenticationException",
"(",
"message",
",",
"response",
")",
";",
"case",
"404",
":",
"message",
"=",
"\"No file found at URL \"",
"+",
"shortenUrl",
"(",
"response",
".",
"getUri",
"(",
")",
")",
"+",
"\" (\"",
"+",
"message",
"+",
"\")\"",
";",
"return",
"new",
"CFileNotFoundException",
"(",
"message",
",",
"path",
")",
";",
"default",
":",
"return",
"new",
"CHttpException",
"(",
"message",
",",
"response",
")",
";",
"}",
"}"
] | Some common code between providers. Handles the different status codes, and generates a nice exception
@param response The wrapped HTTP response
@param message The error message (provided by the server or by the application)
@param path The file requested (which failed)
@return The exception | [
"Some",
"common",
"code",
"between",
"providers",
".",
"Handles",
"the",
"different",
"status",
"codes",
"and",
"generates",
"a",
"nice",
"exception"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java#L117-L130 |
awslabs/amazon-sqs-java-extended-client-lib | src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClient.java | AmazonSQSExtendedClient.changeMessageVisibilityBatch | public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(
String queueUrl,
java.util.List<ChangeMessageVisibilityBatchRequestEntry> entries) {
"""
Simplified method form for invoking the ChangeMessageVisibilityBatch
operation.
@see #changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest)
"""
ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest =
new ChangeMessageVisibilityBatchRequest(queueUrl, entries);
return changeMessageVisibilityBatch(changeMessageVisibilityBatchRequest);
} | java | public ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch(
String queueUrl,
java.util.List<ChangeMessageVisibilityBatchRequestEntry> entries) {
ChangeMessageVisibilityBatchRequest changeMessageVisibilityBatchRequest =
new ChangeMessageVisibilityBatchRequest(queueUrl, entries);
return changeMessageVisibilityBatch(changeMessageVisibilityBatchRequest);
} | [
"public",
"ChangeMessageVisibilityBatchResult",
"changeMessageVisibilityBatch",
"(",
"String",
"queueUrl",
",",
"java",
".",
"util",
".",
"List",
"<",
"ChangeMessageVisibilityBatchRequestEntry",
">",
"entries",
")",
"{",
"ChangeMessageVisibilityBatchRequest",
"changeMessageVisibilityBatchRequest",
"=",
"new",
"ChangeMessageVisibilityBatchRequest",
"(",
"queueUrl",
",",
"entries",
")",
";",
"return",
"changeMessageVisibilityBatch",
"(",
"changeMessageVisibilityBatchRequest",
")",
";",
"}"
] | Simplified method form for invoking the ChangeMessageVisibilityBatch
operation.
@see #changeMessageVisibilityBatch(ChangeMessageVisibilityBatchRequest) | [
"Simplified",
"method",
"form",
"for",
"invoking",
"the",
"ChangeMessageVisibilityBatch",
"operation",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-extended-client-lib/blob/df0c6251b99e682d6179938fe784590e662b84ea/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSExtendedClient.java#L983-L989 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/ChartModelProvider.java | ChartModelProvider.translateMarkerToRange | private static Double translateMarkerToRange(double size, Double min, Double max, Double value) {
"""
Translates marker value to be correct in given range
@param size size of the range
@param min min value
@param max max value
@param value original value
@return translated value
"""
if (value != null && min != null && max != null) {
return (size / (max - min)) * (value - min);
}
return value;
} | java | private static Double translateMarkerToRange(double size, Double min, Double max, Double value) {
if (value != null && min != null && max != null) {
return (size / (max - min)) * (value - min);
}
return value;
} | [
"private",
"static",
"Double",
"translateMarkerToRange",
"(",
"double",
"size",
",",
"Double",
"min",
",",
"Double",
"max",
",",
"Double",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"min",
"!=",
"null",
"&&",
"max",
"!=",
"null",
")",
"{",
"return",
"(",
"size",
"/",
"(",
"max",
"-",
"min",
")",
")",
"*",
"(",
"value",
"-",
"min",
")",
";",
"}",
"return",
"value",
";",
"}"
] | Translates marker value to be correct in given range
@param size size of the range
@param min min value
@param max max value
@param value original value
@return translated value | [
"Translates",
"marker",
"value",
"to",
"be",
"correct",
"in",
"given",
"range"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/ChartModelProvider.java#L781-L787 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java | SimpleScheduleBuilder.repeatMinutelyForTotalCount | @Nonnull
public static SimpleScheduleBuilder repeatMinutelyForTotalCount (final int nCount, final int nMinutes) {
"""
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with an interval of the given number of minutes.
<p>
Note: Total count = 1 (at start time) + repeat count
</p>
@return the new SimpleScheduleBuilder
"""
ValueEnforcer.isGT0 (nCount, "Count");
return simpleSchedule ().withIntervalInMinutes (nMinutes).withRepeatCount (nCount - 1);
} | java | @Nonnull
public static SimpleScheduleBuilder repeatMinutelyForTotalCount (final int nCount, final int nMinutes)
{
ValueEnforcer.isGT0 (nCount, "Count");
return simpleSchedule ().withIntervalInMinutes (nMinutes).withRepeatCount (nCount - 1);
} | [
"@",
"Nonnull",
"public",
"static",
"SimpleScheduleBuilder",
"repeatMinutelyForTotalCount",
"(",
"final",
"int",
"nCount",
",",
"final",
"int",
"nMinutes",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"nCount",
",",
"\"Count\"",
")",
";",
"return",
"simpleSchedule",
"(",
")",
".",
"withIntervalInMinutes",
"(",
"nMinutes",
")",
".",
"withRepeatCount",
"(",
"nCount",
"-",
"1",
")",
";",
"}"
] | Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with an interval of the given number of minutes.
<p>
Note: Total count = 1 (at start time) + repeat count
</p>
@return the new SimpleScheduleBuilder | [
"Create",
"a",
"SimpleScheduleBuilder",
"set",
"to",
"repeat",
"the",
"given",
"number",
"of",
"times",
"-",
"1",
"with",
"an",
"interval",
"of",
"the",
"given",
"number",
"of",
"minutes",
".",
"<p",
">",
"Note",
":",
"Total",
"count",
"=",
"1",
"(",
"at",
"start",
"time",
")",
"+",
"repeat",
"count",
"<",
"/",
"p",
">"
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java#L173-L178 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/DragDropUtil.java | DragDropUtil.onMove | public static void onMove(ItemAdapter itemAdapter, int oldPosition, int newPosition) {
"""
/*
This functions handles the default drag and drop move event
It takes care to move all items one by one within the passed in positions
@param fastAdapter the adapter
@param oldPosition the start position of the move
@param newPosition the end position of the move
"""
// necessary, because the positions passed to this function may be jumping in case of that the recycler view is scrolled while holding an item outside of the recycler view
if (oldPosition < newPosition) {
for (int i = oldPosition + 1; i <= newPosition; i++) {
itemAdapter.move(i, i - 1);
}
} else {
for (int i = oldPosition - 1; i >= newPosition; i--) {
itemAdapter.move(i, i + 1);
}
}
} | java | public static void onMove(ItemAdapter itemAdapter, int oldPosition, int newPosition) {
// necessary, because the positions passed to this function may be jumping in case of that the recycler view is scrolled while holding an item outside of the recycler view
if (oldPosition < newPosition) {
for (int i = oldPosition + 1; i <= newPosition; i++) {
itemAdapter.move(i, i - 1);
}
} else {
for (int i = oldPosition - 1; i >= newPosition; i--) {
itemAdapter.move(i, i + 1);
}
}
} | [
"public",
"static",
"void",
"onMove",
"(",
"ItemAdapter",
"itemAdapter",
",",
"int",
"oldPosition",
",",
"int",
"newPosition",
")",
"{",
"// necessary, because the positions passed to this function may be jumping in case of that the recycler view is scrolled while holding an item outside of the recycler view",
"if",
"(",
"oldPosition",
"<",
"newPosition",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"oldPosition",
"+",
"1",
";",
"i",
"<=",
"newPosition",
";",
"i",
"++",
")",
"{",
"itemAdapter",
".",
"move",
"(",
"i",
",",
"i",
"-",
"1",
")",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"oldPosition",
"-",
"1",
";",
"i",
">=",
"newPosition",
";",
"i",
"--",
")",
"{",
"itemAdapter",
".",
"move",
"(",
"i",
",",
"i",
"+",
"1",
")",
";",
"}",
"}",
"}"
] | /*
This functions handles the default drag and drop move event
It takes care to move all items one by one within the passed in positions
@param fastAdapter the adapter
@param oldPosition the start position of the move
@param newPosition the end position of the move | [
"/",
"*",
"This",
"functions",
"handles",
"the",
"default",
"drag",
"and",
"drop",
"move",
"event",
"It",
"takes",
"care",
"to",
"move",
"all",
"items",
"one",
"by",
"one",
"within",
"the",
"passed",
"in",
"positions"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/DragDropUtil.java#L47-L58 |
codelibs/jcifs | src/main/java/jcifs/smb1/Config.java | Config.getProperty | public static String getProperty( String key, String def ) {
"""
Retrieve a <code>String</code>. If the key cannot be found,
the provided <code>def</code> default parameter will be returned.
"""
return prp.getProperty( key, def );
} | java | public static String getProperty( String key, String def ) {
return prp.getProperty( key, def );
} | [
"public",
"static",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"def",
")",
"{",
"return",
"prp",
".",
"getProperty",
"(",
"key",
",",
"def",
")",
";",
"}"
] | Retrieve a <code>String</code>. If the key cannot be found,
the provided <code>def</code> default parameter will be returned. | [
"Retrieve",
"a",
"<code",
">",
"String<",
"/",
"code",
">",
".",
"If",
"the",
"key",
"cannot",
"be",
"found",
"the",
"provided",
"<code",
">",
"def<",
"/",
"code",
">",
"default",
"parameter",
"will",
"be",
"returned",
"."
] | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L204-L206 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java | SecurityUtils.getPrivateKey | public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass)
throws GeneralSecurityException {
"""
Returns the private key from the key store.
@param keyStore key store
@param alias alias under which the key is stored
@param keyPass password protecting the key
@return private key
"""
return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray());
} | java | public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass)
throws GeneralSecurityException {
return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray());
} | [
"public",
"static",
"PrivateKey",
"getPrivateKey",
"(",
"KeyStore",
"keyStore",
",",
"String",
"alias",
",",
"String",
"keyPass",
")",
"throws",
"GeneralSecurityException",
"{",
"return",
"(",
"PrivateKey",
")",
"keyStore",
".",
"getKey",
"(",
"alias",
",",
"keyPass",
".",
"toCharArray",
"(",
")",
")",
";",
"}"
] | Returns the private key from the key store.
@param keyStore key store
@param alias alias under which the key is stored
@param keyPass password protecting the key
@return private key | [
"Returns",
"the",
"private",
"key",
"from",
"the",
"key",
"store",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/SecurityUtils.java#L92-L95 |
ykrasik/jaci | jaci-core/src/main/java/com/github/ykrasik/jaci/path/ParsedPath.java | ParsedPath.toDirectory | public static ParsedPath toDirectory(String rawPath) {
"""
Create a path that is expected to represent a path to a directory.
This means that if the path ends with a delimiter '/', it is considered the same as if it didn't.
i.e. path/to and path/to/ are considered the same - a path with 2 elements: 'path' and 'to'.
@param rawPath Path to parse.
@return A {@link ParsedPath} out of the given path.
@throws IllegalArgumentException If any element along the path is empty.
"""
final String path = rawPath.trim();
if (path.isEmpty()) {
// TODO: Is This legal?
return EMPTY;
}
if ("/".equals(path)) {
// TODO: Is this special case needed?
return ROOT;
}
final boolean startsWithDelimiter = path.startsWith("/");
// Remove the trailing delimiter.
// This allows us to treat paths that end with a delimiter as paths to the last directory on the path.
// i.e. path/to and path/to/ are the same - a path with 2 elements: 'path' and 'to'.
final List<String> pathElements = splitPath(path, false);
return new ParsedPath(startsWithDelimiter, pathElements);
} | java | public static ParsedPath toDirectory(String rawPath) {
final String path = rawPath.trim();
if (path.isEmpty()) {
// TODO: Is This legal?
return EMPTY;
}
if ("/".equals(path)) {
// TODO: Is this special case needed?
return ROOT;
}
final boolean startsWithDelimiter = path.startsWith("/");
// Remove the trailing delimiter.
// This allows us to treat paths that end with a delimiter as paths to the last directory on the path.
// i.e. path/to and path/to/ are the same - a path with 2 elements: 'path' and 'to'.
final List<String> pathElements = splitPath(path, false);
return new ParsedPath(startsWithDelimiter, pathElements);
} | [
"public",
"static",
"ParsedPath",
"toDirectory",
"(",
"String",
"rawPath",
")",
"{",
"final",
"String",
"path",
"=",
"rawPath",
".",
"trim",
"(",
")",
";",
"if",
"(",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"// TODO: Is This legal?",
"return",
"EMPTY",
";",
"}",
"if",
"(",
"\"/\"",
".",
"equals",
"(",
"path",
")",
")",
"{",
"// TODO: Is this special case needed?",
"return",
"ROOT",
";",
"}",
"final",
"boolean",
"startsWithDelimiter",
"=",
"path",
".",
"startsWith",
"(",
"\"/\"",
")",
";",
"// Remove the trailing delimiter.",
"// This allows us to treat paths that end with a delimiter as paths to the last directory on the path.",
"// i.e. path/to and path/to/ are the same - a path with 2 elements: 'path' and 'to'.",
"final",
"List",
"<",
"String",
">",
"pathElements",
"=",
"splitPath",
"(",
"path",
",",
"false",
")",
";",
"return",
"new",
"ParsedPath",
"(",
"startsWithDelimiter",
",",
"pathElements",
")",
";",
"}"
] | Create a path that is expected to represent a path to a directory.
This means that if the path ends with a delimiter '/', it is considered the same as if it didn't.
i.e. path/to and path/to/ are considered the same - a path with 2 elements: 'path' and 'to'.
@param rawPath Path to parse.
@return A {@link ParsedPath} out of the given path.
@throws IllegalArgumentException If any element along the path is empty. | [
"Create",
"a",
"path",
"that",
"is",
"expected",
"to",
"represent",
"a",
"path",
"to",
"a",
"directory",
".",
"This",
"means",
"that",
"if",
"the",
"path",
"ends",
"with",
"a",
"delimiter",
"/",
"it",
"is",
"considered",
"the",
"same",
"as",
"if",
"it",
"didn",
"t",
".",
"i",
".",
"e",
".",
"path",
"/",
"to",
"and",
"path",
"/",
"to",
"/",
"are",
"considered",
"the",
"same",
"-",
"a",
"path",
"with",
"2",
"elements",
":",
"path",
"and",
"to",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-core/src/main/java/com/github/ykrasik/jaci/path/ParsedPath.java#L150-L168 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java | ThreadEx.setAttribute | public void setAttribute(String name, Object value) {
"""
Sets the named attribute to the specified value.
@param name Name of the attribute.
@param value Value to associate with the attribute.
"""
synchronized (attribute) {
attribute.put(name, value);
}
} | java | public void setAttribute(String name, Object value) {
synchronized (attribute) {
attribute.put(name, value);
}
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"synchronized",
"(",
"attribute",
")",
"{",
"attribute",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
] | Sets the named attribute to the specified value.
@param name Name of the attribute.
@param value Value to associate with the attribute. | [
"Sets",
"the",
"named",
"attribute",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/thread/ThreadEx.java#L216-L220 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT | public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId, OvhOvhPabxDialplanExtensionConditionTime body) throws IOException {
"""
Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required]
@param conditionId [required]
"""
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId, OvhOvhPabxDialplanExtensionConditionTime body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"dialplanId",
",",
"Long",
"extensionId",
",",
"Long",
"conditionId",
",",
"OvhOvhPabxDialplanExtensionConditionTime",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
",",
"dialplanId",
",",
"extensionId",
",",
"conditionId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required]
@param conditionId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7139-L7143 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/ExtensionUtils.java | ExtensionUtils.listToolExtensionDirectories | static private List<File> listToolExtensionDirectories(String extension) {
"""
Compose a list which contains all of directories which need to look into.
The directory may or may not exist.
the list of directories which this method returns is:
1, wlp/bin/tools/extensions,
2. wlp/usr/extension/bin/tools/extensions,
3. all locations returned from ProductExtension.getProductExtensions() with /bin/tools/extensions
"""
List<File> dirs = new ArrayList<File>();
dirs.add(new File(Utils.getInstallDir(), EXTENSION_DIR + extension)); // wlp/bin/tools/extensions
dirs.add(new File(Utils.getInstallDir(), USER_EXTENSION_DIR + extension)); // wlp/usr/extension/bin/tools/extensions
List<File> extDirs = listProductExtensionDirectories();
// add extension directory path and extension name.
for (File extDir : extDirs) {
dirs.add(new File(extDir, EXTENSION_DIR + extension));
}
return dirs;
} | java | static private List<File> listToolExtensionDirectories(String extension) {
List<File> dirs = new ArrayList<File>();
dirs.add(new File(Utils.getInstallDir(), EXTENSION_DIR + extension)); // wlp/bin/tools/extensions
dirs.add(new File(Utils.getInstallDir(), USER_EXTENSION_DIR + extension)); // wlp/usr/extension/bin/tools/extensions
List<File> extDirs = listProductExtensionDirectories();
// add extension directory path and extension name.
for (File extDir : extDirs) {
dirs.add(new File(extDir, EXTENSION_DIR + extension));
}
return dirs;
} | [
"static",
"private",
"List",
"<",
"File",
">",
"listToolExtensionDirectories",
"(",
"String",
"extension",
")",
"{",
"List",
"<",
"File",
">",
"dirs",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"dirs",
".",
"add",
"(",
"new",
"File",
"(",
"Utils",
".",
"getInstallDir",
"(",
")",
",",
"EXTENSION_DIR",
"+",
"extension",
")",
")",
";",
"// wlp/bin/tools/extensions",
"dirs",
".",
"add",
"(",
"new",
"File",
"(",
"Utils",
".",
"getInstallDir",
"(",
")",
",",
"USER_EXTENSION_DIR",
"+",
"extension",
")",
")",
";",
"// wlp/usr/extension/bin/tools/extensions",
"List",
"<",
"File",
">",
"extDirs",
"=",
"listProductExtensionDirectories",
"(",
")",
";",
"// add extension directory path and extension name.",
"for",
"(",
"File",
"extDir",
":",
"extDirs",
")",
"{",
"dirs",
".",
"add",
"(",
"new",
"File",
"(",
"extDir",
",",
"EXTENSION_DIR",
"+",
"extension",
")",
")",
";",
"}",
"return",
"dirs",
";",
"}"
] | Compose a list which contains all of directories which need to look into.
The directory may or may not exist.
the list of directories which this method returns is:
1, wlp/bin/tools/extensions,
2. wlp/usr/extension/bin/tools/extensions,
3. all locations returned from ProductExtension.getProductExtensions() with /bin/tools/extensions | [
"Compose",
"a",
"list",
"which",
"contains",
"all",
"of",
"directories",
"which",
"need",
"to",
"look",
"into",
".",
"The",
"directory",
"may",
"or",
"may",
"not",
"exist",
".",
"the",
"list",
"of",
"directories",
"which",
"this",
"method",
"returns",
"is",
":",
"1",
"wlp",
"/",
"bin",
"/",
"tools",
"/",
"extensions",
"2",
".",
"wlp",
"/",
"usr",
"/",
"extension",
"/",
"bin",
"/",
"tools",
"/",
"extensions",
"3",
".",
"all",
"locations",
"returned",
"from",
"ProductExtension",
".",
"getProductExtensions",
"()",
"with",
"/",
"bin",
"/",
"tools",
"/",
"extensions"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/cmdline/ExtensionUtils.java#L55-L65 |
ZieIony/Carbon | carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java | ShapeAppearanceModel.setTopLeftCorner | public void setTopLeftCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
"""
Sets the corner treatment for the top-left corner.
@param cornerFamily the family to use to create the corner treatment
@param cornerSize the size to use to create the corner treatment
"""
setTopLeftCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | java | public void setTopLeftCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
setTopLeftCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | [
"public",
"void",
"setTopLeftCorner",
"(",
"@",
"CornerFamily",
"int",
"cornerFamily",
",",
"@",
"Dimension",
"int",
"cornerSize",
")",
"{",
"setTopLeftCorner",
"(",
"MaterialShapeUtils",
".",
"createCornerTreatment",
"(",
"cornerFamily",
",",
"cornerSize",
")",
")",
";",
"}"
] | Sets the corner treatment for the top-left corner.
@param cornerFamily the family to use to create the corner treatment
@param cornerSize the size to use to create the corner treatment | [
"Sets",
"the",
"corner",
"treatment",
"for",
"the",
"top",
"-",
"left",
"corner",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java#L232-L234 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.listQueryResultsForResourceGroup | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) {
"""
Queries policy states for the resources under the resource group.
@param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyStatesQueryResultsInner object if successful.
"""
return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body();
} | java | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyStatesQueryResultsInner",
"listQueryResultsForResourceGroup",
"(",
"PolicyStatesResource",
"policyStatesResource",
",",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForResourceGroupWithServiceResponseAsync",
"(",
"policyStatesResource",
",",
"subscriptionId",
",",
"resourceGroupName",
",",
"queryOptions",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Queries policy states for the resources under the resource group.
@param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyStatesQueryResultsInner object if successful. | [
"Queries",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | 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/PolicyStatesInner.java#L982-L984 |
telly/groundy | library/src/main/java/com/telly/groundy/Groundy.java | Groundy.addIntegerArrayList | public Groundy addIntegerArrayList(String key, ArrayList<Integer> value) {
"""
Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<Integer> object, or null
"""
mArgs.putIntegerArrayList(key, value);
return this;
} | java | public Groundy addIntegerArrayList(String key, ArrayList<Integer> value) {
mArgs.putIntegerArrayList(key, value);
return this;
} | [
"public",
"Groundy",
"addIntegerArrayList",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"Integer",
">",
"value",
")",
"{",
"mArgs",
".",
"putIntegerArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an ArrayList<Integer> value into the mapping of this Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<Integer> object, or null | [
"Inserts",
"an",
"ArrayList<Integer",
">",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L560-L563 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java | Objects.deepEquals | public static boolean deepEquals(Object a, Object b) {
"""
Returns {@code true} if the arguments are deeply equal to each other
and {@code false} otherwise.
Two {@code null} values are deeply equal. If both arguments are
arrays, the algorithm in {@link Arrays#deepEquals(Object[],
Object[]) Arrays.deepEquals} is used to determine equality.
Otherwise, equality is determined by using the {@link
Object#equals equals} method of the first argument.
@param a an object
@param b an object to be compared with {@code a} for deep equality
@return {@code true} if the arguments are deeply equal to each other
and {@code false} otherwise
@see Arrays#deepEquals(Object[], Object[])
@see Objects#equals(Object, Object)
"""
if (a == b)
return true;
else if (a == null || b == null)
return false;
else
return Arrays.deepEquals0(a, b);
} | java | public static boolean deepEquals(Object a, Object b) {
if (a == b)
return true;
else if (a == null || b == null)
return false;
else
return Arrays.deepEquals0(a, b);
} | [
"public",
"static",
"boolean",
"deepEquals",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"b",
")",
"return",
"true",
";",
"else",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
")",
"return",
"false",
";",
"else",
"return",
"Arrays",
".",
"deepEquals0",
"(",
"a",
",",
"b",
")",
";",
"}"
] | Returns {@code true} if the arguments are deeply equal to each other
and {@code false} otherwise.
Two {@code null} values are deeply equal. If both arguments are
arrays, the algorithm in {@link Arrays#deepEquals(Object[],
Object[]) Arrays.deepEquals} is used to determine equality.
Otherwise, equality is determined by using the {@link
Object#equals equals} method of the first argument.
@param a an object
@param b an object to be compared with {@code a} for deep equality
@return {@code true} if the arguments are deeply equal to each other
and {@code false} otherwise
@see Arrays#deepEquals(Object[], Object[])
@see Objects#equals(Object, Object) | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"arguments",
"are",
"deeply",
"equal",
"to",
"each",
"other",
"and",
"{",
"@code",
"false",
"}",
"otherwise",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java#L79-L86 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeDate | @Pure
public static Date getAttributeDate(Node document, boolean caseSensitive, String... path) {
"""
Replies the date that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
@param document is the XML document to explore.
@param caseSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the date of the specified attribute or <code>null</code> if
it was node found in the document
"""
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeDateWithDefault(document, caseSensitive, null, path);
} | java | @Pure
public static Date getAttributeDate(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeDateWithDefault(document, caseSensitive, null, path);
} | [
"@",
"Pure",
"public",
"static",
"Date",
"getAttributeDate",
"(",
"Node",
"document",
",",
"boolean",
"caseSensitive",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"return",
"getAttributeDateWithDefault",
"(",
"document",
",",
"caseSensitive",
",",
"null",
",",
"path",
")",
";",
"}"
] | Replies the date that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
@param document is the XML document to explore.
@param caseSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the date of the specified attribute or <code>null</code> if
it was node found in the document | [
"Replies",
"the",
"date",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L498-L502 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_backend_backend_GET | public OvhLoadBalancingBackendIp loadBalancing_serviceName_backend_backend_GET(String serviceName, String backend) throws IOException {
"""
Get this object properties
REST: GET /ip/loadBalancing/{serviceName}/backend/{backend}
@param serviceName [required] The internal name of your IP load balancing
@param backend [required] IP of your backend
"""
String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}";
StringBuilder sb = path(qPath, serviceName, backend);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLoadBalancingBackendIp.class);
} | java | public OvhLoadBalancingBackendIp loadBalancing_serviceName_backend_backend_GET(String serviceName, String backend) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}";
StringBuilder sb = path(qPath, serviceName, backend);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLoadBalancingBackendIp.class);
} | [
"public",
"OvhLoadBalancingBackendIp",
"loadBalancing_serviceName_backend_backend_GET",
"(",
"String",
"serviceName",
",",
"String",
"backend",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/backend/{backend}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"backend",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhLoadBalancingBackendIp",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /ip/loadBalancing/{serviceName}/backend/{backend}
@param serviceName [required] The internal name of your IP load balancing
@param backend [required] IP of your backend | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1398-L1403 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java | ProxiedFileSystemCache.getProxiedFileSystem | @Deprecated
public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties,
URI fsURI) throws IOException {
"""
Gets a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs.
@param userNameToProxyAs The name of the user the super user should proxy as
@param properties {@link java.util.Properties} containing initialization properties.
@param fsURI The {@link URI} for the {@link FileSystem} that should be created.
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
@throws IOException
@deprecated use {@link #fromProperties}
"""
return getProxiedFileSystem(userNameToProxyAs, properties, fsURI, new Configuration());
} | java | @Deprecated
public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties,
URI fsURI) throws IOException {
return getProxiedFileSystem(userNameToProxyAs, properties, fsURI, new Configuration());
} | [
"@",
"Deprecated",
"public",
"static",
"FileSystem",
"getProxiedFileSystem",
"(",
"@",
"NonNull",
"final",
"String",
"userNameToProxyAs",
",",
"Properties",
"properties",
",",
"URI",
"fsURI",
")",
"throws",
"IOException",
"{",
"return",
"getProxiedFileSystem",
"(",
"userNameToProxyAs",
",",
"properties",
",",
"fsURI",
",",
"new",
"Configuration",
"(",
")",
")",
";",
"}"
] | Gets a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs.
@param userNameToProxyAs The name of the user the super user should proxy as
@param properties {@link java.util.Properties} containing initialization properties.
@param fsURI The {@link URI} for the {@link FileSystem} that should be created.
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
@throws IOException
@deprecated use {@link #fromProperties} | [
"Gets",
"a",
"{",
"@link",
"FileSystem",
"}",
"that",
"can",
"perform",
"any",
"operations",
"allowed",
"by",
"the",
"specified",
"userNameToProxyAs",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java#L74-L78 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.optInt | @Override
public final Integer optInt(final String key, final Integer defaultValue) {
"""
Get a property as an int or default value.
@param key the property name
@param defaultValue the default value
"""
Integer result = optInt(key);
return result == null ? defaultValue : result;
} | java | @Override
public final Integer optInt(final String key, final Integer defaultValue) {
Integer result = optInt(key);
return result == null ? defaultValue : result;
} | [
"@",
"Override",
"public",
"final",
"Integer",
"optInt",
"(",
"final",
"String",
"key",
",",
"final",
"Integer",
"defaultValue",
")",
"{",
"Integer",
"result",
"=",
"optInt",
"(",
"key",
")",
";",
"return",
"result",
"==",
"null",
"?",
"defaultValue",
":",
"result",
";",
"}"
] | Get a property as an int or default value.
@param key the property name
@param defaultValue the default value | [
"Get",
"a",
"property",
"as",
"an",
"int",
"or",
"default",
"value",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L65-L69 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.createSheetInFolderFromTemplate | public Sheet createSheetInFolderFromTemplate(long folderId, Sheet sheet, EnumSet<SheetTemplateInclusion> includes) throws SmartsheetException {
"""
Create a sheet in given folder.
It mirrors to the following Smartsheet REST API method: POST /folder/{folderId}/sheets
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param folderId the folder id
@param sheet the sheet
@param includes the includes
@return the sheet to create, limited to the following required
attributes: * name (string) * columns (array of Column objects, limited to the following attributes) - title -
primary - type - symbol - options
@throws SmartsheetException the smartsheet exception
"""
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
String path = QueryUtil.generateUrl("folders/" + folderId + "/sheets", parameters);
return this.createResource(path, Sheet.class, sheet);
} | java | public Sheet createSheetInFolderFromTemplate(long folderId, Sheet sheet, EnumSet<SheetTemplateInclusion> includes) throws SmartsheetException {
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
String path = QueryUtil.generateUrl("folders/" + folderId + "/sheets", parameters);
return this.createResource(path, Sheet.class, sheet);
} | [
"public",
"Sheet",
"createSheetInFolderFromTemplate",
"(",
"long",
"folderId",
",",
"Sheet",
"sheet",
",",
"EnumSet",
"<",
"SheetTemplateInclusion",
">",
"includes",
")",
"throws",
"SmartsheetException",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"include\"",
",",
"QueryUtil",
".",
"generateCommaSeparatedList",
"(",
"includes",
")",
")",
";",
"String",
"path",
"=",
"QueryUtil",
".",
"generateUrl",
"(",
"\"folders/\"",
"+",
"folderId",
"+",
"\"/sheets\"",
",",
"parameters",
")",
";",
"return",
"this",
".",
"createResource",
"(",
"path",
",",
"Sheet",
".",
"class",
",",
"sheet",
")",
";",
"}"
] | Create a sheet in given folder.
It mirrors to the following Smartsheet REST API method: POST /folder/{folderId}/sheets
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param folderId the folder id
@param sheet the sheet
@param includes the includes
@return the sheet to create, limited to the following required
attributes: * name (string) * columns (array of Column objects, limited to the following attributes) - title -
primary - type - symbol - options
@throws SmartsheetException the smartsheet exception | [
"Create",
"a",
"sheet",
"in",
"given",
"folder",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L507-L513 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigCacheState.java | CmsADEConfigCacheState.createUpdatedCopy | public CmsADEConfigCacheState createUpdatedCopy(
Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates,
List<CmsADEConfigDataInternal> moduleUpdates,
Map<CmsUUID, CmsElementView> elementViewUpdates) {
"""
Creates a new object which represents the changed configuration state given some updates, without
changing the current configuration state (this object instance).
@param sitemapUpdates a map containing changed sitemap configurations indexed by structure id (the map values are null if the corresponding sitemap configuration is not valid or could not be found)
@param moduleUpdates the list of *all* module configurations, or null if no module configuration update is needed
@param elementViewUpdates the updated element views, or null if no update needed
@return the new configuration state
"""
Map<CmsUUID, CmsADEConfigDataInternal> newSitemapConfigs = Maps.newHashMap(m_siteConfigurations);
if (sitemapUpdates != null) {
for (Map.Entry<CmsUUID, CmsADEConfigDataInternal> entry : sitemapUpdates.entrySet()) {
CmsUUID key = entry.getKey();
CmsADEConfigDataInternal value = entry.getValue();
if (value != null) {
newSitemapConfigs.put(key, value);
} else {
newSitemapConfigs.remove(key);
}
}
}
List<CmsADEConfigDataInternal> newModuleConfigs = m_moduleConfigurations;
if (moduleUpdates != null) {
newModuleConfigs = moduleUpdates;
}
Map<CmsUUID, CmsElementView> newElementViews = m_elementViews;
if (elementViewUpdates != null) {
newElementViews = elementViewUpdates;
}
return new CmsADEConfigCacheState(m_cms, newSitemapConfigs, newModuleConfigs, newElementViews);
} | java | public CmsADEConfigCacheState createUpdatedCopy(
Map<CmsUUID, CmsADEConfigDataInternal> sitemapUpdates,
List<CmsADEConfigDataInternal> moduleUpdates,
Map<CmsUUID, CmsElementView> elementViewUpdates) {
Map<CmsUUID, CmsADEConfigDataInternal> newSitemapConfigs = Maps.newHashMap(m_siteConfigurations);
if (sitemapUpdates != null) {
for (Map.Entry<CmsUUID, CmsADEConfigDataInternal> entry : sitemapUpdates.entrySet()) {
CmsUUID key = entry.getKey();
CmsADEConfigDataInternal value = entry.getValue();
if (value != null) {
newSitemapConfigs.put(key, value);
} else {
newSitemapConfigs.remove(key);
}
}
}
List<CmsADEConfigDataInternal> newModuleConfigs = m_moduleConfigurations;
if (moduleUpdates != null) {
newModuleConfigs = moduleUpdates;
}
Map<CmsUUID, CmsElementView> newElementViews = m_elementViews;
if (elementViewUpdates != null) {
newElementViews = elementViewUpdates;
}
return new CmsADEConfigCacheState(m_cms, newSitemapConfigs, newModuleConfigs, newElementViews);
} | [
"public",
"CmsADEConfigCacheState",
"createUpdatedCopy",
"(",
"Map",
"<",
"CmsUUID",
",",
"CmsADEConfigDataInternal",
">",
"sitemapUpdates",
",",
"List",
"<",
"CmsADEConfigDataInternal",
">",
"moduleUpdates",
",",
"Map",
"<",
"CmsUUID",
",",
"CmsElementView",
">",
"elementViewUpdates",
")",
"{",
"Map",
"<",
"CmsUUID",
",",
"CmsADEConfigDataInternal",
">",
"newSitemapConfigs",
"=",
"Maps",
".",
"newHashMap",
"(",
"m_siteConfigurations",
")",
";",
"if",
"(",
"sitemapUpdates",
"!=",
"null",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"CmsUUID",
",",
"CmsADEConfigDataInternal",
">",
"entry",
":",
"sitemapUpdates",
".",
"entrySet",
"(",
")",
")",
"{",
"CmsUUID",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"CmsADEConfigDataInternal",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"newSitemapConfigs",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"else",
"{",
"newSitemapConfigs",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"}",
"List",
"<",
"CmsADEConfigDataInternal",
">",
"newModuleConfigs",
"=",
"m_moduleConfigurations",
";",
"if",
"(",
"moduleUpdates",
"!=",
"null",
")",
"{",
"newModuleConfigs",
"=",
"moduleUpdates",
";",
"}",
"Map",
"<",
"CmsUUID",
",",
"CmsElementView",
">",
"newElementViews",
"=",
"m_elementViews",
";",
"if",
"(",
"elementViewUpdates",
"!=",
"null",
")",
"{",
"newElementViews",
"=",
"elementViewUpdates",
";",
"}",
"return",
"new",
"CmsADEConfigCacheState",
"(",
"m_cms",
",",
"newSitemapConfigs",
",",
"newModuleConfigs",
",",
"newElementViews",
")",
";",
"}"
] | Creates a new object which represents the changed configuration state given some updates, without
changing the current configuration state (this object instance).
@param sitemapUpdates a map containing changed sitemap configurations indexed by structure id (the map values are null if the corresponding sitemap configuration is not valid or could not be found)
@param moduleUpdates the list of *all* module configurations, or null if no module configuration update is needed
@param elementViewUpdates the updated element views, or null if no update needed
@return the new configuration state | [
"Creates",
"a",
"new",
"object",
"which",
"represents",
"the",
"changed",
"configuration",
"state",
"given",
"some",
"updates",
"without",
"changing",
"the",
"current",
"configuration",
"state",
"(",
"this",
"object",
"instance",
")",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigCacheState.java#L169-L196 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexReader.java | IndexReader.getBucketOffsets | @VisibleForTesting
CompletableFuture<List<Long>> getBucketOffsets(DirectSegmentAccess segment, TableBucket bucket, TimeoutTimer timer) {
"""
Gets the offsets for all the Table Entries in the given {@link TableBucket}.
@param segment A {@link DirectSegmentAccess}
@param bucket The {@link TableBucket} to get offsets for.
@param timer Timer for the operation.
@return A CompletableFuture that, when completed, will contain a List of offsets, with the first offset being the
{@link TableBucket}'s offset itself, then descending down in the order of backpointers. If the {@link TableBucket}
is partial, then the list will be empty.
"""
val result = new ArrayList<Long>();
AtomicLong offset = new AtomicLong(bucket.getSegmentOffset());
return Futures.loop(
() -> offset.get() >= 0,
() -> {
result.add(offset.get());
return getBackpointerOffset(segment, offset.get(), timer.getRemaining());
},
offset::set,
this.executor)
.thenApply(v -> result);
} | java | @VisibleForTesting
CompletableFuture<List<Long>> getBucketOffsets(DirectSegmentAccess segment, TableBucket bucket, TimeoutTimer timer) {
val result = new ArrayList<Long>();
AtomicLong offset = new AtomicLong(bucket.getSegmentOffset());
return Futures.loop(
() -> offset.get() >= 0,
() -> {
result.add(offset.get());
return getBackpointerOffset(segment, offset.get(), timer.getRemaining());
},
offset::set,
this.executor)
.thenApply(v -> result);
} | [
"@",
"VisibleForTesting",
"CompletableFuture",
"<",
"List",
"<",
"Long",
">",
">",
"getBucketOffsets",
"(",
"DirectSegmentAccess",
"segment",
",",
"TableBucket",
"bucket",
",",
"TimeoutTimer",
"timer",
")",
"{",
"val",
"result",
"=",
"new",
"ArrayList",
"<",
"Long",
">",
"(",
")",
";",
"AtomicLong",
"offset",
"=",
"new",
"AtomicLong",
"(",
"bucket",
".",
"getSegmentOffset",
"(",
")",
")",
";",
"return",
"Futures",
".",
"loop",
"(",
"(",
")",
"->",
"offset",
".",
"get",
"(",
")",
">=",
"0",
",",
"(",
")",
"->",
"{",
"result",
".",
"add",
"(",
"offset",
".",
"get",
"(",
")",
")",
";",
"return",
"getBackpointerOffset",
"(",
"segment",
",",
"offset",
".",
"get",
"(",
")",
",",
"timer",
".",
"getRemaining",
"(",
")",
")",
";",
"}",
",",
"offset",
"::",
"set",
",",
"this",
".",
"executor",
")",
".",
"thenApply",
"(",
"v",
"->",
"result",
")",
";",
"}"
] | Gets the offsets for all the Table Entries in the given {@link TableBucket}.
@param segment A {@link DirectSegmentAccess}
@param bucket The {@link TableBucket} to get offsets for.
@param timer Timer for the operation.
@return A CompletableFuture that, when completed, will contain a List of offsets, with the first offset being the
{@link TableBucket}'s offset itself, then descending down in the order of backpointers. If the {@link TableBucket}
is partial, then the list will be empty. | [
"Gets",
"the",
"offsets",
"for",
"all",
"the",
"Table",
"Entries",
"in",
"the",
"given",
"{",
"@link",
"TableBucket",
"}",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/IndexReader.java#L169-L182 |
infinispan/infinispan | core/src/main/java/org/infinispan/distribution/LocalizedCacheTopology.java | LocalizedCacheTopology.makeSegmentedSingletonTopology | public static LocalizedCacheTopology makeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments,
Address localAddress) {
"""
Creates a new local topology that has a single address but multiple segments. This is useful when the data
storage is segmented in some way (ie. segmented store)
@param keyPartitioner partitioner to decide which segment a given key maps to
@param numSegments how many segments there are
@param localAddress the address of this node
@return segmented topology
"""
return new LocalizedCacheTopology(keyPartitioner, numSegments, localAddress);
} | java | public static LocalizedCacheTopology makeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments,
Address localAddress) {
return new LocalizedCacheTopology(keyPartitioner, numSegments, localAddress);
} | [
"public",
"static",
"LocalizedCacheTopology",
"makeSegmentedSingletonTopology",
"(",
"KeyPartitioner",
"keyPartitioner",
",",
"int",
"numSegments",
",",
"Address",
"localAddress",
")",
"{",
"return",
"new",
"LocalizedCacheTopology",
"(",
"keyPartitioner",
",",
"numSegments",
",",
"localAddress",
")",
";",
"}"
] | Creates a new local topology that has a single address but multiple segments. This is useful when the data
storage is segmented in some way (ie. segmented store)
@param keyPartitioner partitioner to decide which segment a given key maps to
@param numSegments how many segments there are
@param localAddress the address of this node
@return segmented topology | [
"Creates",
"a",
"new",
"local",
"topology",
"that",
"has",
"a",
"single",
"address",
"but",
"multiple",
"segments",
".",
"This",
"is",
"useful",
"when",
"the",
"data",
"storage",
"is",
"segmented",
"in",
"some",
"way",
"(",
"ie",
".",
"segmented",
"store",
")"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/LocalizedCacheTopology.java#L61-L64 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java | PropertiesManagerCore.deleteValue | public boolean deleteValue(String geoPackage, String property, String value) {
"""
Delete the property value from a specified GeoPackage
@param geoPackage
GeoPackage name
@param property
property name
@param value
property value
@return true if deleted
"""
boolean deleted = false;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.get(geoPackage);
if (properties != null) {
deleted = properties.deleteValue(property, value) > 0;
}
return deleted;
} | java | public boolean deleteValue(String geoPackage, String property, String value) {
boolean deleted = false;
PropertiesCoreExtension<T, ?, ?, ?> properties = propertiesMap
.get(geoPackage);
if (properties != null) {
deleted = properties.deleteValue(property, value) > 0;
}
return deleted;
} | [
"public",
"boolean",
"deleteValue",
"(",
"String",
"geoPackage",
",",
"String",
"property",
",",
"String",
"value",
")",
"{",
"boolean",
"deleted",
"=",
"false",
";",
"PropertiesCoreExtension",
"<",
"T",
",",
"?",
",",
"?",
",",
"?",
">",
"properties",
"=",
"propertiesMap",
".",
"get",
"(",
"geoPackage",
")",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"deleted",
"=",
"properties",
".",
"deleteValue",
"(",
"property",
",",
"value",
")",
">",
"0",
";",
"}",
"return",
"deleted",
";",
"}"
] | Delete the property value from a specified GeoPackage
@param geoPackage
GeoPackage name
@param property
property name
@param value
property value
@return true if deleted | [
"Delete",
"the",
"property",
"value",
"from",
"a",
"specified",
"GeoPackage"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/properties/PropertiesManagerCore.java#L492-L500 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java | EventSubscriptionsInner.updateAsync | public Observable<EventSubscriptionInner> updateAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) {
"""
Update an event subscription.
Asynchronously updates an existing event subscription.
@param scope The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic.
@param eventSubscriptionName Name of the event subscription to be updated
@param eventSubscriptionUpdateParameters Updated event subscription information
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() {
@Override
public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) {
return response.body();
}
});
} | java | public Observable<EventSubscriptionInner> updateAsync(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) {
return updateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() {
@Override
public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventSubscriptionInner",
">",
"updateAsync",
"(",
"String",
"scope",
",",
"String",
"eventSubscriptionName",
",",
"EventSubscriptionUpdateParameters",
"eventSubscriptionUpdateParameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"scope",
",",
"eventSubscriptionName",
",",
"eventSubscriptionUpdateParameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"EventSubscriptionInner",
">",
",",
"EventSubscriptionInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"EventSubscriptionInner",
"call",
"(",
"ServiceResponse",
"<",
"EventSubscriptionInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Update an event subscription.
Asynchronously updates an existing event subscription.
@param scope The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic.
@param eventSubscriptionName Name of the event subscription to be updated
@param eventSubscriptionUpdateParameters Updated event subscription information
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Update",
"an",
"event",
"subscription",
".",
"Asynchronously",
"updates",
"an",
"existing",
"event",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L594-L601 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java | SchedulerForType.matchNodeForSession | private MatchedPair matchNodeForSession(
Session session, LocalityLevel level) {
"""
Find a matching pair of node, request by looping through the requests in
the session, looking at the hosts in each request and making look-ups
into the node manager.
@param session The session
@param level The locality level at which we are trying to schedule.
@return A match if found, null if not.
"""
Iterator<ResourceRequestInfo> pendingRequestIterator =
session.getPendingRequestIteratorForType(type);
while (pendingRequestIterator.hasNext()) {
ResourceRequestInfo req = pendingRequestIterator.next();
Set<String> excluded = req.getExcludeHosts();
if (req.getHosts() == null || req.getHosts().size() == 0) {
// No locality requirement
String host = null;
ClusterNode node = nodeManager.getRunnableNode(
host, LocalityLevel.ANY, type, excluded);
if (node != null) {
return new MatchedPair(node, req);
}
continue;
}
for (RequestedNode requestedNode : req.getRequestedNodes()) {
ClusterNode node = nodeManager.getRunnableNode(
requestedNode, level, type, excluded);
if (node != null) {
return new MatchedPair(node, req);
}
}
}
return null;
} | java | private MatchedPair matchNodeForSession(
Session session, LocalityLevel level) {
Iterator<ResourceRequestInfo> pendingRequestIterator =
session.getPendingRequestIteratorForType(type);
while (pendingRequestIterator.hasNext()) {
ResourceRequestInfo req = pendingRequestIterator.next();
Set<String> excluded = req.getExcludeHosts();
if (req.getHosts() == null || req.getHosts().size() == 0) {
// No locality requirement
String host = null;
ClusterNode node = nodeManager.getRunnableNode(
host, LocalityLevel.ANY, type, excluded);
if (node != null) {
return new MatchedPair(node, req);
}
continue;
}
for (RequestedNode requestedNode : req.getRequestedNodes()) {
ClusterNode node = nodeManager.getRunnableNode(
requestedNode, level, type, excluded);
if (node != null) {
return new MatchedPair(node, req);
}
}
}
return null;
} | [
"private",
"MatchedPair",
"matchNodeForSession",
"(",
"Session",
"session",
",",
"LocalityLevel",
"level",
")",
"{",
"Iterator",
"<",
"ResourceRequestInfo",
">",
"pendingRequestIterator",
"=",
"session",
".",
"getPendingRequestIteratorForType",
"(",
"type",
")",
";",
"while",
"(",
"pendingRequestIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"ResourceRequestInfo",
"req",
"=",
"pendingRequestIterator",
".",
"next",
"(",
")",
";",
"Set",
"<",
"String",
">",
"excluded",
"=",
"req",
".",
"getExcludeHosts",
"(",
")",
";",
"if",
"(",
"req",
".",
"getHosts",
"(",
")",
"==",
"null",
"||",
"req",
".",
"getHosts",
"(",
")",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"// No locality requirement",
"String",
"host",
"=",
"null",
";",
"ClusterNode",
"node",
"=",
"nodeManager",
".",
"getRunnableNode",
"(",
"host",
",",
"LocalityLevel",
".",
"ANY",
",",
"type",
",",
"excluded",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"new",
"MatchedPair",
"(",
"node",
",",
"req",
")",
";",
"}",
"continue",
";",
"}",
"for",
"(",
"RequestedNode",
"requestedNode",
":",
"req",
".",
"getRequestedNodes",
"(",
")",
")",
"{",
"ClusterNode",
"node",
"=",
"nodeManager",
".",
"getRunnableNode",
"(",
"requestedNode",
",",
"level",
",",
"type",
",",
"excluded",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"new",
"MatchedPair",
"(",
"node",
",",
"req",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Find a matching pair of node, request by looping through the requests in
the session, looking at the hosts in each request and making look-ups
into the node manager.
@param session The session
@param level The locality level at which we are trying to schedule.
@return A match if found, null if not. | [
"Find",
"a",
"matching",
"pair",
"of",
"node",
"request",
"by",
"looping",
"through",
"the",
"requests",
"in",
"the",
"session",
"looking",
"at",
"the",
"hosts",
"in",
"each",
"request",
"and",
"making",
"look",
"-",
"ups",
"into",
"the",
"node",
"manager",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/SchedulerForType.java#L441-L467 |
Subsets and Splits