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
|
---|---|---|---|---|---|---|---|---|---|---|
chrisjenx/Calligraphy | calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java | CalligraphyFactory.matchesResourceIdName | protected static boolean matchesResourceIdName(View view, String matches) {
"""
Use to match a view against a potential view id. Such as ActionBar title etc.
@param view not null view you want to see has resource matching name.
@param matches not null resource name to match against. Its not case sensitive.
@return true if matches false otherwise.
"""
if (view.getId() == View.NO_ID) return false;
final String resourceEntryName = view.getResources().getResourceEntryName(view.getId());
return resourceEntryName.equalsIgnoreCase(matches);
} | java | protected static boolean matchesResourceIdName(View view, String matches) {
if (view.getId() == View.NO_ID) return false;
final String resourceEntryName = view.getResources().getResourceEntryName(view.getId());
return resourceEntryName.equalsIgnoreCase(matches);
} | [
"protected",
"static",
"boolean",
"matchesResourceIdName",
"(",
"View",
"view",
",",
"String",
"matches",
")",
"{",
"if",
"(",
"view",
".",
"getId",
"(",
")",
"==",
"View",
".",
"NO_ID",
")",
"return",
"false",
";",
"final",
"String",
"resourceEntryName",
"=",
"view",
".",
"getResources",
"(",
")",
".",
"getResourceEntryName",
"(",
"view",
".",
"getId",
"(",
")",
")",
";",
"return",
"resourceEntryName",
".",
"equalsIgnoreCase",
"(",
"matches",
")",
";",
"}"
] | Use to match a view against a potential view id. Such as ActionBar title etc.
@param view not null view you want to see has resource matching name.
@param matches not null resource name to match against. Its not case sensitive.
@return true if matches false otherwise. | [
"Use",
"to",
"match",
"a",
"view",
"against",
"a",
"potential",
"view",
"id",
".",
"Such",
"as",
"ActionBar",
"title",
"etc",
"."
] | train | https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L87-L91 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/ServiceConfigUtil.java | ServiceConfigUtil.getHealthCheckedServiceName | @Nullable
public static String getHealthCheckedServiceName(@Nullable Map<String, ?> serviceConfig) {
"""
Fetch the health-checked service name from service config. {@code null} if can't find one.
"""
String healthCheckKey = "healthCheckConfig";
String serviceNameKey = "serviceName";
if (serviceConfig == null || !serviceConfig.containsKey(healthCheckKey)) {
return null;
}
/* schema as follows
{
"healthCheckConfig": {
// Service name to use in the health-checking request.
"serviceName": string
}
}
*/
Map<String, ?> healthCheck = getObject(serviceConfig, healthCheckKey);
if (!healthCheck.containsKey(serviceNameKey)) {
return null;
}
return getString(healthCheck, "serviceName");
} | java | @Nullable
public static String getHealthCheckedServiceName(@Nullable Map<String, ?> serviceConfig) {
String healthCheckKey = "healthCheckConfig";
String serviceNameKey = "serviceName";
if (serviceConfig == null || !serviceConfig.containsKey(healthCheckKey)) {
return null;
}
/* schema as follows
{
"healthCheckConfig": {
// Service name to use in the health-checking request.
"serviceName": string
}
}
*/
Map<String, ?> healthCheck = getObject(serviceConfig, healthCheckKey);
if (!healthCheck.containsKey(serviceNameKey)) {
return null;
}
return getString(healthCheck, "serviceName");
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getHealthCheckedServiceName",
"(",
"@",
"Nullable",
"Map",
"<",
"String",
",",
"?",
">",
"serviceConfig",
")",
"{",
"String",
"healthCheckKey",
"=",
"\"healthCheckConfig\"",
";",
"String",
"serviceNameKey",
"=",
"\"serviceName\"",
";",
"if",
"(",
"serviceConfig",
"==",
"null",
"||",
"!",
"serviceConfig",
".",
"containsKey",
"(",
"healthCheckKey",
")",
")",
"{",
"return",
"null",
";",
"}",
"/* schema as follows\n {\n \"healthCheckConfig\": {\n // Service name to use in the health-checking request.\n \"serviceName\": string\n }\n }\n */",
"Map",
"<",
"String",
",",
"?",
">",
"healthCheck",
"=",
"getObject",
"(",
"serviceConfig",
",",
"healthCheckKey",
")",
";",
"if",
"(",
"!",
"healthCheck",
".",
"containsKey",
"(",
"serviceNameKey",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getString",
"(",
"healthCheck",
",",
"\"serviceName\"",
")",
";",
"}"
] | Fetch the health-checked service name from service config. {@code null} if can't find one. | [
"Fetch",
"the",
"health",
"-",
"checked",
"service",
"name",
"from",
"service",
"config",
".",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L78-L99 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java | VariablesInner.getAsync | public Observable<VariableInner> getAsync(String resourceGroupName, String automationAccountName, String variableName) {
"""
Retrieve the variable identified by variable name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param variableName The name of variable.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VariableInner object
"""
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() {
@Override
public VariableInner call(ServiceResponse<VariableInner> response) {
return response.body();
}
});
} | java | public Observable<VariableInner> getAsync(String resourceGroupName, String automationAccountName, String variableName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() {
@Override
public VariableInner call(ServiceResponse<VariableInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VariableInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"variableName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"variableName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VariableInner",
">",
",",
"VariableInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VariableInner",
"call",
"(",
"ServiceResponse",
"<",
"VariableInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Retrieve the variable identified by variable name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param variableName The name of variable.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VariableInner object | [
"Retrieve",
"the",
"variable",
"identified",
"by",
"variable",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java#L420-L427 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getInstance | public static synchronized SailthruClient getInstance(String apiKey, String apiSecret, String apiUrl) {
"""
Synchronized singleton instance method using default URL string
@param apiKey Sailthru API key string
@param apiSecret Sailthru API secret string
@param apiUrl Sailthru API URL
@return singleton instance of SailthruClient
@deprecated
"""
if (_instance == null) {
_instance = new SailthruClient(apiKey, apiSecret, apiUrl);
}
return _instance;
} | java | public static synchronized SailthruClient getInstance(String apiKey, String apiSecret, String apiUrl) {
if (_instance == null) {
_instance = new SailthruClient(apiKey, apiSecret, apiUrl);
}
return _instance;
} | [
"public",
"static",
"synchronized",
"SailthruClient",
"getInstance",
"(",
"String",
"apiKey",
",",
"String",
"apiSecret",
",",
"String",
"apiUrl",
")",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"new",
"SailthruClient",
"(",
"apiKey",
",",
"apiSecret",
",",
"apiUrl",
")",
";",
"}",
"return",
"_instance",
";",
"}"
] | Synchronized singleton instance method using default URL string
@param apiKey Sailthru API key string
@param apiSecret Sailthru API secret string
@param apiUrl Sailthru API URL
@return singleton instance of SailthruClient
@deprecated | [
"Synchronized",
"singleton",
"instance",
"method",
"using",
"default",
"URL",
"string"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L71-L76 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRLSelector.java | X509CRLSelector.addIssuerNameInternal | private void addIssuerNameInternal(Object name, X500Principal principal) {
"""
A private method that adds a name (String or byte array) to the
issuerNames criterion. The issuer distinguished
name in the {@code X509CRL} must match at least one of the specified
distinguished names.
@param name the name in string or byte array form
@param principal the name in X500Principal form
@throws IOException if a parsing error occurs
"""
if (issuerNames == null) {
issuerNames = new HashSet<Object>();
}
if (issuerX500Principals == null) {
issuerX500Principals = new HashSet<X500Principal>();
}
issuerNames.add(name);
issuerX500Principals.add(principal);
} | java | private void addIssuerNameInternal(Object name, X500Principal principal) {
if (issuerNames == null) {
issuerNames = new HashSet<Object>();
}
if (issuerX500Principals == null) {
issuerX500Principals = new HashSet<X500Principal>();
}
issuerNames.add(name);
issuerX500Principals.add(principal);
} | [
"private",
"void",
"addIssuerNameInternal",
"(",
"Object",
"name",
",",
"X500Principal",
"principal",
")",
"{",
"if",
"(",
"issuerNames",
"==",
"null",
")",
"{",
"issuerNames",
"=",
"new",
"HashSet",
"<",
"Object",
">",
"(",
")",
";",
"}",
"if",
"(",
"issuerX500Principals",
"==",
"null",
")",
"{",
"issuerX500Principals",
"=",
"new",
"HashSet",
"<",
"X500Principal",
">",
"(",
")",
";",
"}",
"issuerNames",
".",
"add",
"(",
"name",
")",
";",
"issuerX500Principals",
".",
"add",
"(",
"principal",
")",
";",
"}"
] | A private method that adds a name (String or byte array) to the
issuerNames criterion. The issuer distinguished
name in the {@code X509CRL} must match at least one of the specified
distinguished names.
@param name the name in string or byte array form
@param principal the name in X500Principal form
@throws IOException if a parsing error occurs | [
"A",
"private",
"method",
"that",
"adds",
"a",
"name",
"(",
"String",
"or",
"byte",
"array",
")",
"to",
"the",
"issuerNames",
"criterion",
".",
"The",
"issuer",
"distinguished",
"name",
"in",
"the",
"{",
"@code",
"X509CRL",
"}",
"must",
"match",
"at",
"least",
"one",
"of",
"the",
"specified",
"distinguished",
"names",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CRLSelector.java#L289-L298 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getFormatterDate | @Nonnull
public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode) {
"""
Get the date formatter for the passed locale.
@param eStyle
The format style to be used. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@param eMode
Print or parse? May not be <code>null</code>.
@return The created date formatter. Never <code>null</code>.
@since 8.5.6
"""
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | java | @Nonnull
public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle,
@Nullable final Locale aDisplayLocale,
@Nonnull final EDTFormatterMode eMode)
{
return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getFormatterDate",
"(",
"@",
"Nonnull",
"final",
"FormatStyle",
"eStyle",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
",",
"@",
"Nonnull",
"final",
"EDTFormatterMode",
"eMode",
")",
"{",
"return",
"_getFormatter",
"(",
"new",
"CacheKey",
"(",
"EDTType",
".",
"LOCAL_DATE",
",",
"aDisplayLocale",
",",
"eStyle",
",",
"eMode",
")",
",",
"aDisplayLocale",
")",
";",
"}"
] | Get the date formatter for the passed locale.
@param eStyle
The format style to be used. May not be <code>null</code>.
@param aDisplayLocale
The display locale to be used. May be <code>null</code>.
@param eMode
Print or parse? May not be <code>null</code>.
@return The created date formatter. Never <code>null</code>.
@since 8.5.6 | [
"Get",
"the",
"date",
"formatter",
"for",
"the",
"passed",
"locale",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L257-L263 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java | ByteBuffer.checkOffsetLength | static protected void checkOffsetLength(int bytesLength, int offset, int length)
throws IllegalArgumentException {
"""
Helper method for validating if an offset and length are valid for a given
byte array. Checks if the offset or length is negative or if the offset+length
would cause a read past the end of the byte array.
@param bytesLength The length of the byte array to validate against
@param offset The offset within the byte array
@param length The length to read starting from the offset
@throws java.lang.IllegalArgumentException If any of the above conditions
are violated.
"""
// offset cannot be negative
if (offset < 0) {
throw new IllegalArgumentException("The byte[] offset parameter cannot be negative");
}
// length cannot be negative either
if (length < 0) {
throw new IllegalArgumentException("The byte[] length parameter cannot be negative");
}
// is it a valid offset? Must be < bytes.length if non-zero
// if its zero, then the check below will validate if it would cause
// a read past the length of the byte array
if (offset != 0 && offset >= bytesLength) {
throw new IllegalArgumentException("The byte[] offset (" + offset + ") must be < the length of the byte[] length (" + bytesLength + ")");
}
if (offset+length > bytesLength) {
throw new IllegalArgumentException("The offset+length (" + (offset+length) + ") would read past the end of the byte[] (length=" + bytesLength + ")");
}
} | java | static protected void checkOffsetLength(int bytesLength, int offset, int length)
throws IllegalArgumentException {
// offset cannot be negative
if (offset < 0) {
throw new IllegalArgumentException("The byte[] offset parameter cannot be negative");
}
// length cannot be negative either
if (length < 0) {
throw new IllegalArgumentException("The byte[] length parameter cannot be negative");
}
// is it a valid offset? Must be < bytes.length if non-zero
// if its zero, then the check below will validate if it would cause
// a read past the length of the byte array
if (offset != 0 && offset >= bytesLength) {
throw new IllegalArgumentException("The byte[] offset (" + offset + ") must be < the length of the byte[] length (" + bytesLength + ")");
}
if (offset+length > bytesLength) {
throw new IllegalArgumentException("The offset+length (" + (offset+length) + ") would read past the end of the byte[] (length=" + bytesLength + ")");
}
} | [
"static",
"protected",
"void",
"checkOffsetLength",
"(",
"int",
"bytesLength",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IllegalArgumentException",
"{",
"// offset cannot be negative",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The byte[] offset parameter cannot be negative\"",
")",
";",
"}",
"// length cannot be negative either",
"if",
"(",
"length",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The byte[] length parameter cannot be negative\"",
")",
";",
"}",
"// is it a valid offset? Must be < bytes.length if non-zero",
"// if its zero, then the check below will validate if it would cause",
"// a read past the length of the byte array",
"if",
"(",
"offset",
"!=",
"0",
"&&",
"offset",
">=",
"bytesLength",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The byte[] offset (\"",
"+",
"offset",
"+",
"\") must be < the length of the byte[] length (\"",
"+",
"bytesLength",
"+",
"\")\"",
")",
";",
"}",
"if",
"(",
"offset",
"+",
"length",
">",
"bytesLength",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The offset+length (\"",
"+",
"(",
"offset",
"+",
"length",
")",
"+",
"\") would read past the end of the byte[] (length=\"",
"+",
"bytesLength",
"+",
"\")\"",
")",
";",
"}",
"}"
] | Helper method for validating if an offset and length are valid for a given
byte array. Checks if the offset or length is negative or if the offset+length
would cause a read past the end of the byte array.
@param bytesLength The length of the byte array to validate against
@param offset The offset within the byte array
@param length The length to read starting from the offset
@throws java.lang.IllegalArgumentException If any of the above conditions
are violated. | [
"Helper",
"method",
"for",
"validating",
"if",
"an",
"offset",
"and",
"length",
"are",
"valid",
"for",
"a",
"given",
"byte",
"array",
".",
"Checks",
"if",
"the",
"offset",
"or",
"length",
"is",
"negative",
"or",
"if",
"the",
"offset",
"+",
"length",
"would",
"cause",
"a",
"read",
"past",
"the",
"end",
"of",
"the",
"byte",
"array",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ByteBuffer.java#L400-L419 |
facebookarchive/hive-dwrf | hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java | Slice.setLong | public void setLong(int index, long value) {
"""
Sets the specified 64-bit long integer at the specified absolute
{@code index} in this buffer.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
{@code index + 8} is greater than {@code this.length()}
"""
checkIndexLength(index, SizeOf.SIZE_OF_LONG);
unsafe.putLong(base, address + index, value);
} | java | public void setLong(int index, long value)
{
checkIndexLength(index, SizeOf.SIZE_OF_LONG);
unsafe.putLong(base, address + index, value);
} | [
"public",
"void",
"setLong",
"(",
"int",
"index",
",",
"long",
"value",
")",
"{",
"checkIndexLength",
"(",
"index",
",",
"SizeOf",
".",
"SIZE_OF_LONG",
")",
";",
"unsafe",
".",
"putLong",
"(",
"base",
",",
"address",
"+",
"index",
",",
"value",
")",
";",
"}"
] | Sets the specified 64-bit long integer at the specified absolute
{@code index} in this buffer.
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
{@code index + 8} is greater than {@code this.length()} | [
"Sets",
"the",
"specified",
"64",
"-",
"bit",
"long",
"integer",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"in",
"this",
"buffer",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L446-L450 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/datamovement/FilteredForestConfiguration.java | FilteredForestConfiguration.withRenamedHost | public FilteredForestConfiguration withRenamedHost(String hostName, String targetHostName) {
"""
Rename hosts to network-addressable names rather than the host names known
to the MarkLogic cluster.
@param hostName the host to rename
@param targetHostName the network-addressable host name to use
@return this instance (for method chaining)
"""
if ( hostName == null ) throw new IllegalArgumentException("hostName must not be null");
if ( targetHostName == null ) throw new IllegalArgumentException("targetHostName must not be null");
renames.put(hostName.toLowerCase(), targetHostName.toLowerCase());
return this;
} | java | public FilteredForestConfiguration withRenamedHost(String hostName, String targetHostName) {
if ( hostName == null ) throw new IllegalArgumentException("hostName must not be null");
if ( targetHostName == null ) throw new IllegalArgumentException("targetHostName must not be null");
renames.put(hostName.toLowerCase(), targetHostName.toLowerCase());
return this;
} | [
"public",
"FilteredForestConfiguration",
"withRenamedHost",
"(",
"String",
"hostName",
",",
"String",
"targetHostName",
")",
"{",
"if",
"(",
"hostName",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"hostName must not be null\"",
")",
";",
"if",
"(",
"targetHostName",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"targetHostName must not be null\"",
")",
";",
"renames",
".",
"put",
"(",
"hostName",
".",
"toLowerCase",
"(",
")",
",",
"targetHostName",
".",
"toLowerCase",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | Rename hosts to network-addressable names rather than the host names known
to the MarkLogic cluster.
@param hostName the host to rename
@param targetHostName the network-addressable host name to use
@return this instance (for method chaining) | [
"Rename",
"hosts",
"to",
"network",
"-",
"addressable",
"names",
"rather",
"than",
"the",
"host",
"names",
"known",
"to",
"the",
"MarkLogic",
"cluster",
"."
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/FilteredForestConfiguration.java#L242-L247 |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java | DataFrameJoiner.withMissingLeftJoin | @SuppressWarnings( {
"""
Adds rows to destination for each row in table1, with the columns from table2 added as missing values in each
""""rawtypes", "unchecked"})
private void withMissingLeftJoin(Table destination, Table table1) {
for (int c = 0; c < destination.columnCount(); c++) {
if (c < table1.columnCount()) {
Column t1Col = table1.column(c);
destination.column(c).append(t1Col);
} else {
for (int r1 = 0; r1 < table1.rowCount(); r1++) {
destination.column(c).appendMissing();
}
}
}
} | java | @SuppressWarnings({"rawtypes", "unchecked"})
private void withMissingLeftJoin(Table destination, Table table1) {
for (int c = 0; c < destination.columnCount(); c++) {
if (c < table1.columnCount()) {
Column t1Col = table1.column(c);
destination.column(c).append(t1Col);
} else {
for (int r1 = 0; r1 < table1.rowCount(); r1++) {
destination.column(c).appendMissing();
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"void",
"withMissingLeftJoin",
"(",
"Table",
"destination",
",",
"Table",
"table1",
")",
"{",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"c",
"<",
"destination",
".",
"columnCount",
"(",
")",
";",
"c",
"++",
")",
"{",
"if",
"(",
"c",
"<",
"table1",
".",
"columnCount",
"(",
")",
")",
"{",
"Column",
"t1Col",
"=",
"table1",
".",
"column",
"(",
"c",
")",
";",
"destination",
".",
"column",
"(",
"c",
")",
".",
"append",
"(",
"t1Col",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"r1",
"=",
"0",
";",
"r1",
"<",
"table1",
".",
"rowCount",
"(",
")",
";",
"r1",
"++",
")",
"{",
"destination",
".",
"column",
"(",
"c",
")",
".",
"appendMissing",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Adds rows to destination for each row in table1, with the columns from table2 added as missing values in each | [
"Adds",
"rows",
"to",
"destination",
"for",
"each",
"row",
"in",
"table1",
"with",
"the",
"columns",
"from",
"table2",
"added",
"as",
"missing",
"values",
"in",
"each"
] | train | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L656-L668 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java | InternalCache2kBuilder.constructEviction | private Eviction constructEviction(HeapCache hc, HeapCacheListener l, Cache2kConfiguration config) {
"""
Construct segmented or queued eviction. For the moment hard coded.
If capacity is at least 1000 we use 2 segments if 2 or more CPUs are available.
Segmenting the eviction only improves for lots of concurrent inserts or evictions,
there is no effect on read performance.
"""
final boolean _strictEviction = config.isStrictEviction();
final int _availableProcessors = Runtime.getRuntime().availableProcessors();
final boolean _boostConcurrency = config.isBoostConcurrency();
final long _maximumWeight = config.getMaximumWeight();
long _entryCapacity = config.getEntryCapacity();
if (_entryCapacity < 0 && _maximumWeight < 0) {
_entryCapacity = 2000;
}
final int _segmentCountOverride = HeapCache.TUNABLE.segmentCountOverride;
int _segmentCount = determineSegmentCount(_strictEviction, _availableProcessors, _boostConcurrency, _entryCapacity, _segmentCountOverride);
Eviction[] _segments = new Eviction[_segmentCount];
long _maxSize = determineMaxSize(_entryCapacity, _segmentCount);
long _maxWeight = determineMaxWeight(_maximumWeight, _segmentCount);
final Weigher _weigher = (Weigher) hc.createCustomization(config.getWeigher());
for (int i = 0; i < _segments.length; i++) {
Eviction ev = new ClockProPlusEviction(hc, l, _maxSize, _weigher, _maxWeight);
_segments[i] = ev;
}
if (_segmentCount == 1) {
return _segments[0];
}
return new SegmentedEviction(_segments);
} | java | private Eviction constructEviction(HeapCache hc, HeapCacheListener l, Cache2kConfiguration config) {
final boolean _strictEviction = config.isStrictEviction();
final int _availableProcessors = Runtime.getRuntime().availableProcessors();
final boolean _boostConcurrency = config.isBoostConcurrency();
final long _maximumWeight = config.getMaximumWeight();
long _entryCapacity = config.getEntryCapacity();
if (_entryCapacity < 0 && _maximumWeight < 0) {
_entryCapacity = 2000;
}
final int _segmentCountOverride = HeapCache.TUNABLE.segmentCountOverride;
int _segmentCount = determineSegmentCount(_strictEviction, _availableProcessors, _boostConcurrency, _entryCapacity, _segmentCountOverride);
Eviction[] _segments = new Eviction[_segmentCount];
long _maxSize = determineMaxSize(_entryCapacity, _segmentCount);
long _maxWeight = determineMaxWeight(_maximumWeight, _segmentCount);
final Weigher _weigher = (Weigher) hc.createCustomization(config.getWeigher());
for (int i = 0; i < _segments.length; i++) {
Eviction ev = new ClockProPlusEviction(hc, l, _maxSize, _weigher, _maxWeight);
_segments[i] = ev;
}
if (_segmentCount == 1) {
return _segments[0];
}
return new SegmentedEviction(_segments);
} | [
"private",
"Eviction",
"constructEviction",
"(",
"HeapCache",
"hc",
",",
"HeapCacheListener",
"l",
",",
"Cache2kConfiguration",
"config",
")",
"{",
"final",
"boolean",
"_strictEviction",
"=",
"config",
".",
"isStrictEviction",
"(",
")",
";",
"final",
"int",
"_availableProcessors",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
";",
"final",
"boolean",
"_boostConcurrency",
"=",
"config",
".",
"isBoostConcurrency",
"(",
")",
";",
"final",
"long",
"_maximumWeight",
"=",
"config",
".",
"getMaximumWeight",
"(",
")",
";",
"long",
"_entryCapacity",
"=",
"config",
".",
"getEntryCapacity",
"(",
")",
";",
"if",
"(",
"_entryCapacity",
"<",
"0",
"&&",
"_maximumWeight",
"<",
"0",
")",
"{",
"_entryCapacity",
"=",
"2000",
";",
"}",
"final",
"int",
"_segmentCountOverride",
"=",
"HeapCache",
".",
"TUNABLE",
".",
"segmentCountOverride",
";",
"int",
"_segmentCount",
"=",
"determineSegmentCount",
"(",
"_strictEviction",
",",
"_availableProcessors",
",",
"_boostConcurrency",
",",
"_entryCapacity",
",",
"_segmentCountOverride",
")",
";",
"Eviction",
"[",
"]",
"_segments",
"=",
"new",
"Eviction",
"[",
"_segmentCount",
"]",
";",
"long",
"_maxSize",
"=",
"determineMaxSize",
"(",
"_entryCapacity",
",",
"_segmentCount",
")",
";",
"long",
"_maxWeight",
"=",
"determineMaxWeight",
"(",
"_maximumWeight",
",",
"_segmentCount",
")",
";",
"final",
"Weigher",
"_weigher",
"=",
"(",
"Weigher",
")",
"hc",
".",
"createCustomization",
"(",
"config",
".",
"getWeigher",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_segments",
".",
"length",
";",
"i",
"++",
")",
"{",
"Eviction",
"ev",
"=",
"new",
"ClockProPlusEviction",
"(",
"hc",
",",
"l",
",",
"_maxSize",
",",
"_weigher",
",",
"_maxWeight",
")",
";",
"_segments",
"[",
"i",
"]",
"=",
"ev",
";",
"}",
"if",
"(",
"_segmentCount",
"==",
"1",
")",
"{",
"return",
"_segments",
"[",
"0",
"]",
";",
"}",
"return",
"new",
"SegmentedEviction",
"(",
"_segments",
")",
";",
"}"
] | Construct segmented or queued eviction. For the moment hard coded.
If capacity is at least 1000 we use 2 segments if 2 or more CPUs are available.
Segmenting the eviction only improves for lots of concurrent inserts or evictions,
there is no effect on read performance. | [
"Construct",
"segmented",
"or",
"queued",
"eviction",
".",
"For",
"the",
"moment",
"hard",
"coded",
".",
"If",
"capacity",
"is",
"at",
"least",
"1000",
"we",
"use",
"2",
"segments",
"if",
"2",
"or",
"more",
"CPUs",
"are",
"available",
".",
"Segmenting",
"the",
"eviction",
"only",
"improves",
"for",
"lots",
"of",
"concurrent",
"inserts",
"or",
"evictions",
"there",
"is",
"no",
"effect",
"on",
"read",
"performance",
"."
] | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/InternalCache2kBuilder.java#L366-L389 |
tomasbjerre/git-changelog-lib | src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java | GitChangelogApi.toMediaWiki | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
"""
Create MediaWiki page with changelog.
@throws GitChangelogRepositoryException
@throws GitChangelogIntegrationException
"""
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
} | java | public void toMediaWiki(
final String username, final String password, final String url, final String title)
throws GitChangelogRepositoryException, GitChangelogIntegrationException {
new MediaWikiClient(url, title, render()) //
.withUser(username, password) //
.createMediaWikiPage();
} | [
"public",
"void",
"toMediaWiki",
"(",
"final",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"String",
"url",
",",
"final",
"String",
"title",
")",
"throws",
"GitChangelogRepositoryException",
",",
"GitChangelogIntegrationException",
"{",
"new",
"MediaWikiClient",
"(",
"url",
",",
"title",
",",
"render",
"(",
")",
")",
"//",
".",
"withUser",
"(",
"username",
",",
"password",
")",
"//",
".",
"createMediaWikiPage",
"(",
")",
";",
"}"
] | Create MediaWiki page with changelog.
@throws GitChangelogRepositoryException
@throws GitChangelogIntegrationException | [
"Create",
"MediaWiki",
"page",
"with",
"changelog",
"."
] | train | https://github.com/tomasbjerre/git-changelog-lib/blob/e6b26d29592a57bd53fe98fbe4a56d8c2267a192/src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java#L144-L150 |
sarxos/webcam-capture | webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/PNGDecoder.java | PNGDecoder.decode | public final BufferedImage decode() throws IOException {
"""
read just one png file, if invalid, return null
@return
@throws IOException
"""
if (!validPNG) {
return null;
}
ColorModel cmodel = new ComponentColorModel(COLOR_SPACE, BITS, false, false, Transparency.OPAQUE, DATA_TYPE);
SampleModel smodel = new ComponentSampleModel(DATA_TYPE, width, height, 3, width * 3, BAND_OFFSETS);
byte[] bytes = new byte[width * height * 3];// must new each time!
byte[][] data = new byte[][] { bytes };
ByteBuffer buffer = ByteBuffer.wrap(bytes);
decode(buffer, TextureFormat.RGB);
DataBufferByte dbuf = new DataBufferByte(data, bytes.length, OFFSET);
WritableRaster raster = Raster.createWritableRaster(smodel, dbuf, null);
BufferedImage bi = new BufferedImage(cmodel, raster, false, null);
bi.flush();
return bi;
} | java | public final BufferedImage decode() throws IOException {
if (!validPNG) {
return null;
}
ColorModel cmodel = new ComponentColorModel(COLOR_SPACE, BITS, false, false, Transparency.OPAQUE, DATA_TYPE);
SampleModel smodel = new ComponentSampleModel(DATA_TYPE, width, height, 3, width * 3, BAND_OFFSETS);
byte[] bytes = new byte[width * height * 3];// must new each time!
byte[][] data = new byte[][] { bytes };
ByteBuffer buffer = ByteBuffer.wrap(bytes);
decode(buffer, TextureFormat.RGB);
DataBufferByte dbuf = new DataBufferByte(data, bytes.length, OFFSET);
WritableRaster raster = Raster.createWritableRaster(smodel, dbuf, null);
BufferedImage bi = new BufferedImage(cmodel, raster, false, null);
bi.flush();
return bi;
} | [
"public",
"final",
"BufferedImage",
"decode",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"validPNG",
")",
"{",
"return",
"null",
";",
"}",
"ColorModel",
"cmodel",
"=",
"new",
"ComponentColorModel",
"(",
"COLOR_SPACE",
",",
"BITS",
",",
"false",
",",
"false",
",",
"Transparency",
".",
"OPAQUE",
",",
"DATA_TYPE",
")",
";",
"SampleModel",
"smodel",
"=",
"new",
"ComponentSampleModel",
"(",
"DATA_TYPE",
",",
"width",
",",
"height",
",",
"3",
",",
"width",
"*",
"3",
",",
"BAND_OFFSETS",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"width",
"*",
"height",
"*",
"3",
"]",
";",
"// must new each time!",
"byte",
"[",
"]",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"]",
"[",
"]",
"{",
"bytes",
"}",
";",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"wrap",
"(",
"bytes",
")",
";",
"decode",
"(",
"buffer",
",",
"TextureFormat",
".",
"RGB",
")",
";",
"DataBufferByte",
"dbuf",
"=",
"new",
"DataBufferByte",
"(",
"data",
",",
"bytes",
".",
"length",
",",
"OFFSET",
")",
";",
"WritableRaster",
"raster",
"=",
"Raster",
".",
"createWritableRaster",
"(",
"smodel",
",",
"dbuf",
",",
"null",
")",
";",
"BufferedImage",
"bi",
"=",
"new",
"BufferedImage",
"(",
"cmodel",
",",
"raster",
",",
"false",
",",
"null",
")",
";",
"bi",
".",
"flush",
"(",
")",
";",
"return",
"bi",
";",
"}"
] | read just one png file, if invalid, return null
@return
@throws IOException | [
"read",
"just",
"one",
"png",
"file",
"if",
"invalid",
"return",
"null"
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/PNGDecoder.java#L134-L151 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java | KunderaMetadataManager.getEntityMetadata | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, Class entityClass) {
"""
Finds ands returns Entity metadata for a given array of PUs.
@param entityClass
the entity class
@param persistenceUnits
the persistence units
@return the entity metadata
"""
if (entityClass == null)
{
throw new KunderaException("Invalid class provided " + entityClass);
}
List<String> persistenceUnits = kunderaMetadata.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
// persistence units will only have more than 1 persistence unit in case
// of RDBMS.
if (persistenceUnits != null)
{
for (String pu : persistenceUnits)
{
MetamodelImpl metamodel = getMetamodel(kunderaMetadata, pu);
EntityMetadata metadata = metamodel.getEntityMetadata(entityClass);
if (metadata != null && metadata.getPersistenceUnit().equals(pu))
{
return metadata;
}
}
}
if (log.isDebugEnabled())
log.warn("No Entity metadata found for the class " + entityClass
+ ". Any CRUD operation on this entity will fail."
+ "If your entity is for RDBMS, make sure you put fully qualified entity class"
+ " name under <class></class> tag in persistence.xml for RDBMS "
+ "persistence unit. Returning null value.");
return null;
// throw new KunderaException("Unable to load entity metadata for :" +
// entityClass);
} | java | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, Class entityClass)
{
if (entityClass == null)
{
throw new KunderaException("Invalid class provided " + entityClass);
}
List<String> persistenceUnits = kunderaMetadata.getApplicationMetadata().getMappedPersistenceUnit(entityClass);
// persistence units will only have more than 1 persistence unit in case
// of RDBMS.
if (persistenceUnits != null)
{
for (String pu : persistenceUnits)
{
MetamodelImpl metamodel = getMetamodel(kunderaMetadata, pu);
EntityMetadata metadata = metamodel.getEntityMetadata(entityClass);
if (metadata != null && metadata.getPersistenceUnit().equals(pu))
{
return metadata;
}
}
}
if (log.isDebugEnabled())
log.warn("No Entity metadata found for the class " + entityClass
+ ". Any CRUD operation on this entity will fail."
+ "If your entity is for RDBMS, make sure you put fully qualified entity class"
+ " name under <class></class> tag in persistence.xml for RDBMS "
+ "persistence unit. Returning null value.");
return null;
// throw new KunderaException("Unable to load entity metadata for :" +
// entityClass);
} | [
"public",
"static",
"EntityMetadata",
"getEntityMetadata",
"(",
"final",
"KunderaMetadata",
"kunderaMetadata",
",",
"Class",
"entityClass",
")",
"{",
"if",
"(",
"entityClass",
"==",
"null",
")",
"{",
"throw",
"new",
"KunderaException",
"(",
"\"Invalid class provided \"",
"+",
"entityClass",
")",
";",
"}",
"List",
"<",
"String",
">",
"persistenceUnits",
"=",
"kunderaMetadata",
".",
"getApplicationMetadata",
"(",
")",
".",
"getMappedPersistenceUnit",
"(",
"entityClass",
")",
";",
"// persistence units will only have more than 1 persistence unit in case\r",
"// of RDBMS.\r",
"if",
"(",
"persistenceUnits",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"pu",
":",
"persistenceUnits",
")",
"{",
"MetamodelImpl",
"metamodel",
"=",
"getMetamodel",
"(",
"kunderaMetadata",
",",
"pu",
")",
";",
"EntityMetadata",
"metadata",
"=",
"metamodel",
".",
"getEntityMetadata",
"(",
"entityClass",
")",
";",
"if",
"(",
"metadata",
"!=",
"null",
"&&",
"metadata",
".",
"getPersistenceUnit",
"(",
")",
".",
"equals",
"(",
"pu",
")",
")",
"{",
"return",
"metadata",
";",
"}",
"}",
"}",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"warn",
"(",
"\"No Entity metadata found for the class \"",
"+",
"entityClass",
"+",
"\". Any CRUD operation on this entity will fail.\"",
"+",
"\"If your entity is for RDBMS, make sure you put fully qualified entity class\"",
"+",
"\" name under <class></class> tag in persistence.xml for RDBMS \"",
"+",
"\"persistence unit. Returning null value.\"",
")",
";",
"return",
"null",
";",
"// throw new KunderaException(\"Unable to load entity metadata for :\" +\r",
"// entityClass);\r",
"}"
] | Finds ands returns Entity metadata for a given array of PUs.
@param entityClass
the entity class
@param persistenceUnits
the persistence units
@return the entity metadata | [
"Finds",
"ands",
"returns",
"Entity",
"metadata",
"for",
"a",
"given",
"array",
"of",
"PUs",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java#L126-L158 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java | AxiomType_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, AxiomType instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, AxiomType instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"AxiomType",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/AxiomType_CustomFieldSerializer.java#L82-L85 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java | PathPattern.matches | public boolean matches(String[] path) {
"""
Return true if the given list of path elements is matching this pattern.
"""
if (nbAny == 0 && path.length != nbWildcards)
return false;
if (path.length < nbWildcards)
return false;
return check(path, 0, 0, nbWildcards, nbAny);
} | java | public boolean matches(String[] path) {
if (nbAny == 0 && path.length != nbWildcards)
return false;
if (path.length < nbWildcards)
return false;
return check(path, 0, 0, nbWildcards, nbAny);
} | [
"public",
"boolean",
"matches",
"(",
"String",
"[",
"]",
"path",
")",
"{",
"if",
"(",
"nbAny",
"==",
"0",
"&&",
"path",
".",
"length",
"!=",
"nbWildcards",
")",
"return",
"false",
";",
"if",
"(",
"path",
".",
"length",
"<",
"nbWildcards",
")",
"return",
"false",
";",
"return",
"check",
"(",
"path",
",",
"0",
",",
"0",
",",
"nbWildcards",
",",
"nbAny",
")",
";",
"}"
] | Return true if the given list of path elements is matching this pattern. | [
"Return",
"true",
"if",
"the",
"given",
"list",
"of",
"path",
"elements",
"is",
"matching",
"this",
"pattern",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java#L55-L61 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.getParent | public static String getParent(String filePath, int level) {
"""
获取指定层级的父路径
<pre>
getParent("d:/aaa/bbb/cc/ddd", 0) -> "d:/aaa/bbb/cc/ddd"
getParent("d:/aaa/bbb/cc/ddd", 2) -> "d:/aaa/bbb"
getParent("d:/aaa/bbb/cc/ddd", 4) -> "d:/"
getParent("d:/aaa/bbb/cc/ddd", 5) -> null
</pre>
@param filePath 目录或文件路径
@param level 层级
@return 路径File,如果不存在返回null
@since 4.1.2
"""
final File parent = getParent(file(filePath), level);
try {
return null == parent ? null : parent.getCanonicalPath();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static String getParent(String filePath, int level) {
final File parent = getParent(file(filePath), level);
try {
return null == parent ? null : parent.getCanonicalPath();
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"String",
"getParent",
"(",
"String",
"filePath",
",",
"int",
"level",
")",
"{",
"final",
"File",
"parent",
"=",
"getParent",
"(",
"file",
"(",
"filePath",
")",
",",
"level",
")",
";",
"try",
"{",
"return",
"null",
"==",
"parent",
"?",
"null",
":",
"parent",
".",
"getCanonicalPath",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IORuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | 获取指定层级的父路径
<pre>
getParent("d:/aaa/bbb/cc/ddd", 0) -> "d:/aaa/bbb/cc/ddd"
getParent("d:/aaa/bbb/cc/ddd", 2) -> "d:/aaa/bbb"
getParent("d:/aaa/bbb/cc/ddd", 4) -> "d:/"
getParent("d:/aaa/bbb/cc/ddd", 5) -> null
</pre>
@param filePath 目录或文件路径
@param level 层级
@return 路径File,如果不存在返回null
@since 4.1.2 | [
"获取指定层级的父路径"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3333-L3340 |
jbundle/jbundle | app/program/script/src/main/java/org/jbundle/app/program/script/scan/DeleteScanListener.java | DeleteScanListener.postProcessThisDirectory | public void postProcessThisDirectory(File fileDir, Object objDirID) {
"""
Do whatever processing that needs to be done on this directory.
@return caller specific information about this directory.
"""
if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty("deleteDir")))
fileDir.delete();
} | java | public void postProcessThisDirectory(File fileDir, Object objDirID)
{
if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty("deleteDir")))
fileDir.delete();
} | [
"public",
"void",
"postProcessThisDirectory",
"(",
"File",
"fileDir",
",",
"Object",
"objDirID",
")",
"{",
"if",
"(",
"DBConstants",
".",
"TRUE",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getProperty",
"(",
"\"deleteDir\"",
")",
")",
")",
"fileDir",
".",
"delete",
"(",
")",
";",
"}"
] | Do whatever processing that needs to be done on this directory.
@return caller specific information about this directory. | [
"Do",
"whatever",
"processing",
"that",
"needs",
"to",
"be",
"done",
"on",
"this",
"directory",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/DeleteScanListener.java#L63-L67 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java | ProxyReceiveListener.getThreadContext | public Dispatchable getThreadContext(Conversation conversation, WsByteBuffer buff, int segType) {
"""
Gives us the oppurtunity to pick a thread for use in the JFap receive listener dispatcher. As
the dispatcher is not used on the client, this is not required (or even called for that
matter).
@param conversation
@param buff
@param segType
@return Returns null
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getThreadContext", new Object[]{conversation, buff, segType});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getThreadContext", null);
return null;
} | java | public Dispatchable getThreadContext(Conversation conversation, WsByteBuffer buff, int segType)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getThreadContext", new Object[]{conversation, buff, segType});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getThreadContext", null);
return null;
} | [
"public",
"Dispatchable",
"getThreadContext",
"(",
"Conversation",
"conversation",
",",
"WsByteBuffer",
"buff",
",",
"int",
"segType",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"getThreadContext\"",
",",
"new",
"Object",
"[",
"]",
"{",
"conversation",
",",
"buff",
",",
"segType",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"getThreadContext\"",
",",
"null",
")",
";",
"return",
"null",
";",
"}"
] | Gives us the oppurtunity to pick a thread for use in the JFap receive listener dispatcher. As
the dispatcher is not used on the client, this is not required (or even called for that
matter).
@param conversation
@param buff
@param segType
@return Returns null | [
"Gives",
"us",
"the",
"oppurtunity",
"to",
"pick",
"a",
"thread",
"for",
"use",
"in",
"the",
"JFap",
"receive",
"listener",
"dispatcher",
".",
"As",
"the",
"dispatcher",
"is",
"not",
"used",
"on",
"the",
"client",
"this",
"is",
"not",
"required",
"(",
"or",
"even",
"called",
"for",
"that",
"matter",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ProxyReceiveListener.java#L320-L325 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java | RotationAxisAligner.getGeometricCenter | @Override
public Point3d getGeometricCenter() {
"""
Returns the geometric center of polyhedron. In the case of the Cn
point group, the centroid and geometric center are usually not
identical.
@return
"""
run();
Point3d geometricCenter = new Point3d();
Vector3d translation = new Vector3d();
reverseTransformationMatrix.get(translation);
// calculate adjustment around z-axis and transform adjustment to
// original coordinate frame with the reverse transformation
if (rotationGroup.getPointGroup().startsWith("C")) {
Vector3d corr = new Vector3d(0,0, minBoundary.z+getDimension().z);
reverseTransformationMatrix.transform(corr);
geometricCenter.set(corr);
}
geometricCenter.add(translation);
return geometricCenter;
} | java | @Override
public Point3d getGeometricCenter() {
run();
Point3d geometricCenter = new Point3d();
Vector3d translation = new Vector3d();
reverseTransformationMatrix.get(translation);
// calculate adjustment around z-axis and transform adjustment to
// original coordinate frame with the reverse transformation
if (rotationGroup.getPointGroup().startsWith("C")) {
Vector3d corr = new Vector3d(0,0, minBoundary.z+getDimension().z);
reverseTransformationMatrix.transform(corr);
geometricCenter.set(corr);
}
geometricCenter.add(translation);
return geometricCenter;
} | [
"@",
"Override",
"public",
"Point3d",
"getGeometricCenter",
"(",
")",
"{",
"run",
"(",
")",
";",
"Point3d",
"geometricCenter",
"=",
"new",
"Point3d",
"(",
")",
";",
"Vector3d",
"translation",
"=",
"new",
"Vector3d",
"(",
")",
";",
"reverseTransformationMatrix",
".",
"get",
"(",
"translation",
")",
";",
"// calculate adjustment around z-axis and transform adjustment to",
"// original coordinate frame with the reverse transformation",
"if",
"(",
"rotationGroup",
".",
"getPointGroup",
"(",
")",
".",
"startsWith",
"(",
"\"C\"",
")",
")",
"{",
"Vector3d",
"corr",
"=",
"new",
"Vector3d",
"(",
"0",
",",
"0",
",",
"minBoundary",
".",
"z",
"+",
"getDimension",
"(",
")",
".",
"z",
")",
";",
"reverseTransformationMatrix",
".",
"transform",
"(",
"corr",
")",
";",
"geometricCenter",
".",
"set",
"(",
"corr",
")",
";",
"}",
"geometricCenter",
".",
"add",
"(",
"translation",
")",
";",
"return",
"geometricCenter",
";",
"}"
] | Returns the geometric center of polyhedron. In the case of the Cn
point group, the centroid and geometric center are usually not
identical.
@return | [
"Returns",
"the",
"geometric",
"center",
"of",
"polyhedron",
".",
"In",
"the",
"case",
"of",
"the",
"Cn",
"point",
"group",
"the",
"centroid",
"and",
"geometric",
"center",
"are",
"usually",
"not",
"identical",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L164-L182 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.gt | public SDVariable gt(String name, SDVariable other) {
"""
Greater than operation: elementwise {@code this > y}<br>
If x and y arrays have equal shape, the output shape is the same as the inputs.<br>
Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param name Name of the output variable
@param other Variable to compare values against
@return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied)
"""
return sameDiff.gt(name, this, other);
} | java | public SDVariable gt(String name, SDVariable other){
return sameDiff.gt(name, this, other);
} | [
"public",
"SDVariable",
"gt",
"(",
"String",
"name",
",",
"SDVariable",
"other",
")",
"{",
"return",
"sameDiff",
".",
"gt",
"(",
"name",
",",
"this",
",",
"other",
")",
";",
"}"
] | Greater than operation: elementwise {@code this > y}<br>
If x and y arrays have equal shape, the output shape is the same as the inputs.<br>
Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param name Name of the output variable
@param other Variable to compare values against
@return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied) | [
"Greater",
"than",
"operation",
":",
"elementwise",
"{",
"@code",
"this",
">",
"y",
"}",
"<br",
">",
"If",
"x",
"and",
"y",
"arrays",
"have",
"equal",
"shape",
"the",
"output",
"shape",
"is",
"the",
"same",
"as",
"the",
"inputs",
".",
"<br",
">",
"Supports",
"broadcasting",
":",
"if",
"x",
"and",
"y",
"have",
"different",
"shapes",
"and",
"are",
"broadcastable",
"the",
"output",
"shape",
"is",
"broadcast",
".",
"<br",
">",
"Returns",
"an",
"array",
"with",
"values",
"1",
"where",
"condition",
"is",
"satisfied",
"or",
"value",
"0",
"otherwise",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L546-L548 |
groovy/groovy-core | src/main/org/codehaus/groovy/control/ClassNodeResolver.java | ClassNodeResolver.isSourceNewer | private boolean isSourceNewer(URL source, ClassNode cls) {
"""
returns true if the source in URL is newer than the class
NOTE: copied from GroovyClassLoader
"""
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
return lastMod > getTimeStamp(cls);
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
}
} | java | private boolean isSourceNewer(URL source, ClassNode cls) {
try {
long lastMod;
// Special handling for file:// protocol, as getLastModified() often reports
// incorrect results (-1)
if (source.getProtocol().equals("file")) {
// Coerce the file URL to a File
String path = source.getPath().replace('/', File.separatorChar).replace('|', ':');
File file = new File(path);
lastMod = file.lastModified();
} else {
URLConnection conn = source.openConnection();
lastMod = conn.getLastModified();
conn.getInputStream().close();
}
return lastMod > getTimeStamp(cls);
} catch (IOException e) {
// if the stream can't be opened, let's keep the old reference
return false;
}
} | [
"private",
"boolean",
"isSourceNewer",
"(",
"URL",
"source",
",",
"ClassNode",
"cls",
")",
"{",
"try",
"{",
"long",
"lastMod",
";",
"// Special handling for file:// protocol, as getLastModified() often reports",
"// incorrect results (-1)",
"if",
"(",
"source",
".",
"getProtocol",
"(",
")",
".",
"equals",
"(",
"\"file\"",
")",
")",
"{",
"// Coerce the file URL to a File",
"String",
"path",
"=",
"source",
".",
"getPath",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"File",
".",
"separatorChar",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"lastMod",
"=",
"file",
".",
"lastModified",
"(",
")",
";",
"}",
"else",
"{",
"URLConnection",
"conn",
"=",
"source",
".",
"openConnection",
"(",
")",
";",
"lastMod",
"=",
"conn",
".",
"getLastModified",
"(",
")",
";",
"conn",
".",
"getInputStream",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"return",
"lastMod",
">",
"getTimeStamp",
"(",
"cls",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// if the stream can't be opened, let's keep the old reference",
"return",
"false",
";",
"}",
"}"
] | returns true if the source in URL is newer than the class
NOTE: copied from GroovyClassLoader | [
"returns",
"true",
"if",
"the",
"source",
"in",
"URL",
"is",
"newer",
"than",
"the",
"class",
"NOTE",
":",
"copied",
"from",
"GroovyClassLoader"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/control/ClassNodeResolver.java#L323-L344 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/help/DocletUtils.java | DocletUtils.getClassName | protected static String getClassName(ProgramElementDoc doc, boolean binaryName) {
"""
Reconstitute the class name from the given class JavaDoc object.
@param doc the Javadoc model for the given class.
@return The (string) class name of the given class.
"""
PackageDoc containingPackage = doc.containingPackage();
String className = doc.name();
if (binaryName) {
className = className.replaceAll("\\.", "\\$");
}
return containingPackage.name().length() > 0 ?
String.format("%s.%s", containingPackage.name(), className) :
String.format("%s", className);
} | java | protected static String getClassName(ProgramElementDoc doc, boolean binaryName) {
PackageDoc containingPackage = doc.containingPackage();
String className = doc.name();
if (binaryName) {
className = className.replaceAll("\\.", "\\$");
}
return containingPackage.name().length() > 0 ?
String.format("%s.%s", containingPackage.name(), className) :
String.format("%s", className);
} | [
"protected",
"static",
"String",
"getClassName",
"(",
"ProgramElementDoc",
"doc",
",",
"boolean",
"binaryName",
")",
"{",
"PackageDoc",
"containingPackage",
"=",
"doc",
".",
"containingPackage",
"(",
")",
";",
"String",
"className",
"=",
"doc",
".",
"name",
"(",
")",
";",
"if",
"(",
"binaryName",
")",
"{",
"className",
"=",
"className",
".",
"replaceAll",
"(",
"\"\\\\.\"",
",",
"\"\\\\$\"",
")",
";",
"}",
"return",
"containingPackage",
".",
"name",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
"?",
"String",
".",
"format",
"(",
"\"%s.%s\"",
",",
"containingPackage",
".",
"name",
"(",
")",
",",
"className",
")",
":",
"String",
".",
"format",
"(",
"\"%s\"",
",",
"className",
")",
";",
"}"
] | Reconstitute the class name from the given class JavaDoc object.
@param doc the Javadoc model for the given class.
@return The (string) class name of the given class. | [
"Reconstitute",
"the",
"class",
"name",
"from",
"the",
"given",
"class",
"JavaDoc",
"object",
"."
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/DocletUtils.java#L35-L44 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java | SetDirtyOnChangeHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode) {
"""
The Field has Changed.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
"""
int result = DBConstants.NORMAL_RETURN;
Record record = m_fldTarget.getRecord();
boolean bSetDirty = true;
if (m_bIfNewRecord) if (record.getEditMode() == Constants.EDIT_ADD)
bSetDirty = true;
if (m_bIfCurrentRecord) if ((record.getEditMode() == Constants.EDIT_CURRENT) || (record.getEditMode() == Constants.EDIT_IN_PROGRESS))
bSetDirty = true;
if (bSetDirty)
{
m_fldTarget.setModified(true);
result = record.handleRecordChange(m_fldTarget, DBConstants.FIELD_CHANGED_TYPE, bDisplayOption); // Tell table that I'm getting changed (if not locked)
}
return result;
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int result = DBConstants.NORMAL_RETURN;
Record record = m_fldTarget.getRecord();
boolean bSetDirty = true;
if (m_bIfNewRecord) if (record.getEditMode() == Constants.EDIT_ADD)
bSetDirty = true;
if (m_bIfCurrentRecord) if ((record.getEditMode() == Constants.EDIT_CURRENT) || (record.getEditMode() == Constants.EDIT_IN_PROGRESS))
bSetDirty = true;
if (bSetDirty)
{
m_fldTarget.setModified(true);
result = record.handleRecordChange(m_fldTarget, DBConstants.FIELD_CHANGED_TYPE, bDisplayOption); // Tell table that I'm getting changed (if not locked)
}
return result;
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"result",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"Record",
"record",
"=",
"m_fldTarget",
".",
"getRecord",
"(",
")",
";",
"boolean",
"bSetDirty",
"=",
"true",
";",
"if",
"(",
"m_bIfNewRecord",
")",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"bSetDirty",
"=",
"true",
";",
"if",
"(",
"m_bIfCurrentRecord",
")",
"if",
"(",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"bSetDirty",
"=",
"true",
";",
"if",
"(",
"bSetDirty",
")",
"{",
"m_fldTarget",
".",
"setModified",
"(",
"true",
")",
";",
"result",
"=",
"record",
".",
"handleRecordChange",
"(",
"m_fldTarget",
",",
"DBConstants",
".",
"FIELD_CHANGED_TYPE",
",",
"bDisplayOption",
")",
";",
"// Tell table that I'm getting changed (if not locked)",
"}",
"return",
"result",
";",
"}"
] | The Field has Changed.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java#L93-L108 |
opoo/opoopress | core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java | SiteConfigImpl.resolveConfigFiles | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
"""
Find all config files.
@param base site base site
@param override command options, system properties, etc.
@return
"""
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configFilesString)) {
log.info("Using config files: {}", configFilesString);
String[] strings = StringUtils.split(configFilesString, ',');
File[] files = new File[strings.length];
for (int i = 0; i < strings.length; i++) {
files[i] = new File(base, strings[i]);
}
return files;
}
}
//default
useDefaultConfigFiles = true;
return base.listFiles(DEFAULT_CONFIG_FILES_FILTER);
} | java | private File[] resolveConfigFiles(File base, Map<String, Object> override) {
//system properties
//-Dconfig=config.json -> override
//Override
if (override != null) {
String configFilesString = (String) override.remove("config");
if (StringUtils.isNotBlank(configFilesString)) {
log.info("Using config files: {}", configFilesString);
String[] strings = StringUtils.split(configFilesString, ',');
File[] files = new File[strings.length];
for (int i = 0; i < strings.length; i++) {
files[i] = new File(base, strings[i]);
}
return files;
}
}
//default
useDefaultConfigFiles = true;
return base.listFiles(DEFAULT_CONFIG_FILES_FILTER);
} | [
"private",
"File",
"[",
"]",
"resolveConfigFiles",
"(",
"File",
"base",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"override",
")",
"{",
"//system properties",
"//-Dconfig=config.json -> override",
"//Override",
"if",
"(",
"override",
"!=",
"null",
")",
"{",
"String",
"configFilesString",
"=",
"(",
"String",
")",
"override",
".",
"remove",
"(",
"\"config\"",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"configFilesString",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Using config files: {}\"",
",",
"configFilesString",
")",
";",
"String",
"[",
"]",
"strings",
"=",
"StringUtils",
".",
"split",
"(",
"configFilesString",
",",
"'",
"'",
")",
";",
"File",
"[",
"]",
"files",
"=",
"new",
"File",
"[",
"strings",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
"length",
";",
"i",
"++",
")",
"{",
"files",
"[",
"i",
"]",
"=",
"new",
"File",
"(",
"base",
",",
"strings",
"[",
"i",
"]",
")",
";",
"}",
"return",
"files",
";",
"}",
"}",
"//default",
"useDefaultConfigFiles",
"=",
"true",
";",
"return",
"base",
".",
"listFiles",
"(",
"DEFAULT_CONFIG_FILES_FILTER",
")",
";",
"}"
] | Find all config files.
@param base site base site
@param override command options, system properties, etc.
@return | [
"Find",
"all",
"config",
"files",
"."
] | train | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/impl/SiteConfigImpl.java#L173-L194 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java | Streams.copy | public static void copy(final InputStream inputStream, final OutputStream outputStream)
throws IOException {
"""
Copies the {@code inputStream} into the {@code outputSteam} and finally
closes the both streams.
"""
new ByteSource() {
@Override
public InputStream openStream() {
return inputStream;
}
}.copyTo(new ByteSink() {
@Override
public OutputStream openStream() {
return outputStream;
}
});
} | java | public static void copy(final InputStream inputStream, final OutputStream outputStream)
throws IOException {
new ByteSource() {
@Override
public InputStream openStream() {
return inputStream;
}
}.copyTo(new ByteSink() {
@Override
public OutputStream openStream() {
return outputStream;
}
});
} | [
"public",
"static",
"void",
"copy",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"new",
"ByteSource",
"(",
")",
"{",
"@",
"Override",
"public",
"InputStream",
"openStream",
"(",
")",
"{",
"return",
"inputStream",
";",
"}",
"}",
".",
"copyTo",
"(",
"new",
"ByteSink",
"(",
")",
"{",
"@",
"Override",
"public",
"OutputStream",
"openStream",
"(",
")",
"{",
"return",
"outputStream",
";",
"}",
"}",
")",
";",
"}"
] | Copies the {@code inputStream} into the {@code outputSteam} and finally
closes the both streams. | [
"Copies",
"the",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java#L131-L144 |
jbundle/jbundle | main/db/src/main/java/org/jbundle/main/db/Company.java | Company.addListeners | public void addListeners() {
"""
Add all standard file & field behaviors.
Override this to add record listeners and filters.
"""
super.addListeners();
this.getField(Person.NAME).removeListener(this.getField(Person.NAME).getListener(CopyLastHandler.class), true); // Only if dest is null (ie., company name is null)
this.getField(Person.NAME).addListener(new CopyFieldHandler(this.getField(Person.NAME_SORT)));
this.getField(Company.NAME_SORT).addListener(new CheckForTheHandler(null));
CopyLastHandler listener = new CopyLastHandler(this.getField(Company.NAME_SORT));
this.getField(Company.CONTACT).addListener(listener); // Only if dest is null (ie., company name is null)
listener.setOnlyIfDestNull(true);
} | java | public void addListeners()
{
super.addListeners();
this.getField(Person.NAME).removeListener(this.getField(Person.NAME).getListener(CopyLastHandler.class), true); // Only if dest is null (ie., company name is null)
this.getField(Person.NAME).addListener(new CopyFieldHandler(this.getField(Person.NAME_SORT)));
this.getField(Company.NAME_SORT).addListener(new CheckForTheHandler(null));
CopyLastHandler listener = new CopyLastHandler(this.getField(Company.NAME_SORT));
this.getField(Company.CONTACT).addListener(listener); // Only if dest is null (ie., company name is null)
listener.setOnlyIfDestNull(true);
} | [
"public",
"void",
"addListeners",
"(",
")",
"{",
"super",
".",
"addListeners",
"(",
")",
";",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME",
")",
".",
"removeListener",
"(",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME",
")",
".",
"getListener",
"(",
"CopyLastHandler",
".",
"class",
")",
",",
"true",
")",
";",
"// Only if dest is null (ie., company name is null)",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME",
")",
".",
"addListener",
"(",
"new",
"CopyFieldHandler",
"(",
"this",
".",
"getField",
"(",
"Person",
".",
"NAME_SORT",
")",
")",
")",
";",
"this",
".",
"getField",
"(",
"Company",
".",
"NAME_SORT",
")",
".",
"addListener",
"(",
"new",
"CheckForTheHandler",
"(",
"null",
")",
")",
";",
"CopyLastHandler",
"listener",
"=",
"new",
"CopyLastHandler",
"(",
"this",
".",
"getField",
"(",
"Company",
".",
"NAME_SORT",
")",
")",
";",
"this",
".",
"getField",
"(",
"Company",
".",
"CONTACT",
")",
".",
"addListener",
"(",
"listener",
")",
";",
"// Only if dest is null (ie., company name is null)",
"listener",
".",
"setOnlyIfDestNull",
"(",
"true",
")",
";",
"}"
] | Add all standard file & field behaviors.
Override this to add record listeners and filters. | [
"Add",
"all",
"standard",
"file",
"&",
"field",
"behaviors",
".",
"Override",
"this",
"to",
"add",
"record",
"listeners",
"and",
"filters",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/Company.java#L130-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.propertiesIncluded | private boolean propertiesIncluded(Map<Object, Object> inputMap, Map<Object, Object> existingMap) {
"""
This method returns whether all the properties in the first Map are in
the second Map.
@param inputMap
of properties to search for.
@param existingMap
of properties to search in.
@return true if all properties of first Map are found in second Map
"""
if (inputMap == null) {
// If no properties are specified, then success.
return true;
} else if (existingMap == null || inputMap.size() > existingMap.size()) {
// If properties are specified, but none exist in the current map,
// then fail.
return false;
}
// Loop through input list and search in the search list.
Object existingValue;
for (Entry<Object, Object> entry : inputMap.entrySet()) {
existingValue = existingMap.get(entry.getKey());
if (existingValue == null || !existingValue.equals(entry.getValue())) {
return false;
}
}
return true;
} | java | private boolean propertiesIncluded(Map<Object, Object> inputMap, Map<Object, Object> existingMap) {
if (inputMap == null) {
// If no properties are specified, then success.
return true;
} else if (existingMap == null || inputMap.size() > existingMap.size()) {
// If properties are specified, but none exist in the current map,
// then fail.
return false;
}
// Loop through input list and search in the search list.
Object existingValue;
for (Entry<Object, Object> entry : inputMap.entrySet()) {
existingValue = existingMap.get(entry.getKey());
if (existingValue == null || !existingValue.equals(entry.getValue())) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"propertiesIncluded",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"inputMap",
",",
"Map",
"<",
"Object",
",",
"Object",
">",
"existingMap",
")",
"{",
"if",
"(",
"inputMap",
"==",
"null",
")",
"{",
"// If no properties are specified, then success.",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"existingMap",
"==",
"null",
"||",
"inputMap",
".",
"size",
"(",
")",
">",
"existingMap",
".",
"size",
"(",
")",
")",
"{",
"// If properties are specified, but none exist in the current map,",
"// then fail.",
"return",
"false",
";",
"}",
"// Loop through input list and search in the search list.",
"Object",
"existingValue",
";",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"inputMap",
".",
"entrySet",
"(",
")",
")",
"{",
"existingValue",
"=",
"existingMap",
".",
"get",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"existingValue",
"==",
"null",
"||",
"!",
"existingValue",
".",
"equals",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | This method returns whether all the properties in the first Map are in
the second Map.
@param inputMap
of properties to search for.
@param existingMap
of properties to search in.
@return true if all properties of first Map are found in second Map | [
"This",
"method",
"returns",
"whether",
"all",
"the",
"properties",
"in",
"the",
"first",
"Map",
"are",
"in",
"the",
"second",
"Map",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L5054-L5073 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/MiscSpec.java | MiscSpec.sortElements | @When("^I sort elements in '(.+?)' by '(.+?)' criteria in '(.+?)' order$")
public void sortElements(String envVar, String criteria, String order) {
"""
Sort elements in envVar by a criteria and order.
@param envVar Environment variable to be sorted
@param criteria alphabetical,...
@param order ascending or descending
"""
String value = ThreadProperty.get(envVar);
JsonArray jsonArr = JsonValue.readHjson(value).asArray();
List<JsonValue> jsonValues = new ArrayList<JsonValue>();
for (int i = 0; i < jsonArr.size(); i++) {
jsonValues.add(jsonArr.get(i));
}
Comparator<JsonValue> comparator;
switch (criteria) {
case "alphabetical":
commonspec.getLogger().debug("Alphabetical criteria selected.");
comparator = new Comparator<JsonValue>() {
public int compare(JsonValue json1, JsonValue json2) {
int res = String.CASE_INSENSITIVE_ORDER.compare(json1.toString(), json2.toString());
if (res == 0) {
res = json1.toString().compareTo(json2.toString());
}
return res;
}
};
break;
default:
commonspec.getLogger().debug("No criteria selected.");
comparator = null;
}
if ("ascending".equals(order)) {
Collections.sort(jsonValues, comparator);
} else {
Collections.sort(jsonValues, comparator.reversed());
}
ThreadProperty.set(envVar, jsonValues.toString());
} | java | @When("^I sort elements in '(.+?)' by '(.+?)' criteria in '(.+?)' order$")
public void sortElements(String envVar, String criteria, String order) {
String value = ThreadProperty.get(envVar);
JsonArray jsonArr = JsonValue.readHjson(value).asArray();
List<JsonValue> jsonValues = new ArrayList<JsonValue>();
for (int i = 0; i < jsonArr.size(); i++) {
jsonValues.add(jsonArr.get(i));
}
Comparator<JsonValue> comparator;
switch (criteria) {
case "alphabetical":
commonspec.getLogger().debug("Alphabetical criteria selected.");
comparator = new Comparator<JsonValue>() {
public int compare(JsonValue json1, JsonValue json2) {
int res = String.CASE_INSENSITIVE_ORDER.compare(json1.toString(), json2.toString());
if (res == 0) {
res = json1.toString().compareTo(json2.toString());
}
return res;
}
};
break;
default:
commonspec.getLogger().debug("No criteria selected.");
comparator = null;
}
if ("ascending".equals(order)) {
Collections.sort(jsonValues, comparator);
} else {
Collections.sort(jsonValues, comparator.reversed());
}
ThreadProperty.set(envVar, jsonValues.toString());
} | [
"@",
"When",
"(",
"\"^I sort elements in '(.+?)' by '(.+?)' criteria in '(.+?)' order$\"",
")",
"public",
"void",
"sortElements",
"(",
"String",
"envVar",
",",
"String",
"criteria",
",",
"String",
"order",
")",
"{",
"String",
"value",
"=",
"ThreadProperty",
".",
"get",
"(",
"envVar",
")",
";",
"JsonArray",
"jsonArr",
"=",
"JsonValue",
".",
"readHjson",
"(",
"value",
")",
".",
"asArray",
"(",
")",
";",
"List",
"<",
"JsonValue",
">",
"jsonValues",
"=",
"new",
"ArrayList",
"<",
"JsonValue",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jsonArr",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"jsonValues",
".",
"add",
"(",
"jsonArr",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"Comparator",
"<",
"JsonValue",
">",
"comparator",
";",
"switch",
"(",
"criteria",
")",
"{",
"case",
"\"alphabetical\"",
":",
"commonspec",
".",
"getLogger",
"(",
")",
".",
"debug",
"(",
"\"Alphabetical criteria selected.\"",
")",
";",
"comparator",
"=",
"new",
"Comparator",
"<",
"JsonValue",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"JsonValue",
"json1",
",",
"JsonValue",
"json2",
")",
"{",
"int",
"res",
"=",
"String",
".",
"CASE_INSENSITIVE_ORDER",
".",
"compare",
"(",
"json1",
".",
"toString",
"(",
")",
",",
"json2",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"res",
"==",
"0",
")",
"{",
"res",
"=",
"json1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"json2",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"res",
";",
"}",
"}",
";",
"break",
";",
"default",
":",
"commonspec",
".",
"getLogger",
"(",
")",
".",
"debug",
"(",
"\"No criteria selected.\"",
")",
";",
"comparator",
"=",
"null",
";",
"}",
"if",
"(",
"\"ascending\"",
".",
"equals",
"(",
"order",
")",
")",
"{",
"Collections",
".",
"sort",
"(",
"jsonValues",
",",
"comparator",
")",
";",
"}",
"else",
"{",
"Collections",
".",
"sort",
"(",
"jsonValues",
",",
"comparator",
".",
"reversed",
"(",
")",
")",
";",
"}",
"ThreadProperty",
".",
"set",
"(",
"envVar",
",",
"jsonValues",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Sort elements in envVar by a criteria and order.
@param envVar Environment variable to be sorted
@param criteria alphabetical,...
@param order ascending or descending | [
"Sort",
"elements",
"in",
"envVar",
"by",
"a",
"criteria",
"and",
"order",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/MiscSpec.java#L128-L165 |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java | MinorCompactionTask.checkEntry | private void checkEntry(long index, Segment segment, Segment compactSegment) {
"""
Compacts the entry at the given index.
@param index The index at which to compact the entry.
@param segment The segment to compact.
@param compactSegment The segment to which to write the compacted segment.
"""
try (Entry entry = segment.get(index)) {
// If an entry was found, only remove the entry from the segment if it's not a tombstone that has been released.
if (entry != null) {
checkEntry(index, entry, segment, compactSegment);
} else {
compactSegment.skip(1);
}
}
} | java | private void checkEntry(long index, Segment segment, Segment compactSegment) {
try (Entry entry = segment.get(index)) {
// If an entry was found, only remove the entry from the segment if it's not a tombstone that has been released.
if (entry != null) {
checkEntry(index, entry, segment, compactSegment);
} else {
compactSegment.skip(1);
}
}
} | [
"private",
"void",
"checkEntry",
"(",
"long",
"index",
",",
"Segment",
"segment",
",",
"Segment",
"compactSegment",
")",
"{",
"try",
"(",
"Entry",
"entry",
"=",
"segment",
".",
"get",
"(",
"index",
")",
")",
"{",
"// If an entry was found, only remove the entry from the segment if it's not a tombstone that has been released.",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"checkEntry",
"(",
"index",
",",
"entry",
",",
"segment",
",",
"compactSegment",
")",
";",
"}",
"else",
"{",
"compactSegment",
".",
"skip",
"(",
"1",
")",
";",
"}",
"}",
"}"
] | Compacts the entry at the given index.
@param index The index at which to compact the entry.
@param segment The segment to compact.
@param compactSegment The segment to which to write the compacted segment. | [
"Compacts",
"the",
"entry",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionTask.java#L112-L121 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java | DatabaseTableMetrics.monitor | public static void monitor(MeterRegistry registry, String tableName, String dataSourceName, DataSource dataSource, String... tags) {
"""
Record the row count for an individual database table.
@param registry The registry to bind metrics to.
@param tableName The name of the table to report table size for.
@param dataSourceName Will be used to tag metrics with "db".
@param dataSource The data source to use to run the row count query.
@param tags Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.
"""
monitor(registry, dataSource, dataSourceName, tableName, Tags.of(tags));
} | java | public static void monitor(MeterRegistry registry, String tableName, String dataSourceName, DataSource dataSource, String... tags) {
monitor(registry, dataSource, dataSourceName, tableName, Tags.of(tags));
} | [
"public",
"static",
"void",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"String",
"tableName",
",",
"String",
"dataSourceName",
",",
"DataSource",
"dataSource",
",",
"String",
"...",
"tags",
")",
"{",
"monitor",
"(",
"registry",
",",
"dataSource",
",",
"dataSourceName",
",",
"tableName",
",",
"Tags",
".",
"of",
"(",
"tags",
")",
")",
";",
"}"
] | Record the row count for an individual database table.
@param registry The registry to bind metrics to.
@param tableName The name of the table to report table size for.
@param dataSourceName Will be used to tag metrics with "db".
@param dataSource The data source to use to run the row count query.
@param tags Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags. | [
"Record",
"the",
"row",
"count",
"for",
"an",
"individual",
"database",
"table",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/db/DatabaseTableMetrics.java#L84-L86 |
apache/flink | flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java | MessageSerializer.writeHeader | private static void writeHeader(final ByteBuf buf, final MessageType messageType) {
"""
Helper for serializing the header.
@param buf The {@link ByteBuf} to serialize the header into.
@param messageType The {@link MessageType} of the message this header refers to.
"""
buf.writeInt(VERSION);
buf.writeInt(messageType.ordinal());
} | java | private static void writeHeader(final ByteBuf buf, final MessageType messageType) {
buf.writeInt(VERSION);
buf.writeInt(messageType.ordinal());
} | [
"private",
"static",
"void",
"writeHeader",
"(",
"final",
"ByteBuf",
"buf",
",",
"final",
"MessageType",
"messageType",
")",
"{",
"buf",
".",
"writeInt",
"(",
"VERSION",
")",
";",
"buf",
".",
"writeInt",
"(",
"messageType",
".",
"ordinal",
"(",
")",
")",
";",
"}"
] | Helper for serializing the header.
@param buf The {@link ByteBuf} to serialize the header into.
@param messageType The {@link MessageType} of the message this header refers to. | [
"Helper",
"for",
"serializing",
"the",
"header",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/messages/MessageSerializer.java#L185-L188 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java | JCusolverSp.cusolverSpScsreigvsiHost | public static int cusolverSpScsreigvsiHost(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
float mu0,
Pointer x0,
int maxite,
float tol,
Pointer mu,
Pointer x) {
"""
<pre>
--------- CPU eigenvalue solver by shift inverse
solve A*x = lambda * x
where lambda is the eigenvalue nearest mu0.
[eig] stands for eigenvalue solver
[si] stands for shift-inverse
</pre>
"""
return checkResult(cusolverSpScsreigvsiHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x));
} | java | public static int cusolverSpScsreigvsiHost(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
float mu0,
Pointer x0,
int maxite,
float tol,
Pointer mu,
Pointer x)
{
return checkResult(cusolverSpScsreigvsiHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x));
} | [
"public",
"static",
"int",
"cusolverSpScsreigvsiHost",
"(",
"cusolverSpHandle",
"handle",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrValA",
",",
"Pointer",
"csrRowPtrA",
",",
"Pointer",
"csrColIndA",
",",
"float",
"mu0",
",",
"Pointer",
"x0",
",",
"int",
"maxite",
",",
"float",
"tol",
",",
"Pointer",
"mu",
",",
"Pointer",
"x",
")",
"{",
"return",
"checkResult",
"(",
"cusolverSpScsreigvsiHostNative",
"(",
"handle",
",",
"m",
",",
"nnz",
",",
"descrA",
",",
"csrValA",
",",
"csrRowPtrA",
",",
"csrColIndA",
",",
"mu0",
",",
"x0",
",",
"maxite",
",",
"tol",
",",
"mu",
",",
"x",
")",
")",
";",
"}"
] | <pre>
--------- CPU eigenvalue solver by shift inverse
solve A*x = lambda * x
where lambda is the eigenvalue nearest mu0.
[eig] stands for eigenvalue solver
[si] stands for shift-inverse
</pre> | [
"<pre",
">",
"---------",
"CPU",
"eigenvalue",
"solver",
"by",
"shift",
"inverse",
"solve",
"A",
"*",
"x",
"=",
"lambda",
"*",
"x",
"where",
"lambda",
"is",
"the",
"eigenvalue",
"nearest",
"mu0",
".",
"[",
"eig",
"]",
"stands",
"for",
"eigenvalue",
"solver",
"[",
"si",
"]",
"stands",
"for",
"shift",
"-",
"inverse",
"<",
"/",
"pre",
">"
] | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L965-L981 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/EnumFacingUtils.java | EnumFacingUtils.rotateFacing | public static EnumFacing rotateFacing(EnumFacing facing, int count) {
"""
Rotates facing {@code count} times.
@param facing the facing
@param count the count
@return the enum facing
"""
if (facing == null)
return null;
while (count-- > 0)
facing = facing.rotateAround(EnumFacing.Axis.Y);
return facing;
} | java | public static EnumFacing rotateFacing(EnumFacing facing, int count)
{
if (facing == null)
return null;
while (count-- > 0)
facing = facing.rotateAround(EnumFacing.Axis.Y);
return facing;
} | [
"public",
"static",
"EnumFacing",
"rotateFacing",
"(",
"EnumFacing",
"facing",
",",
"int",
"count",
")",
"{",
"if",
"(",
"facing",
"==",
"null",
")",
"return",
"null",
";",
"while",
"(",
"count",
"--",
">",
"0",
")",
"facing",
"=",
"facing",
".",
"rotateAround",
"(",
"EnumFacing",
".",
"Axis",
".",
"Y",
")",
";",
"return",
"facing",
";",
"}"
] | Rotates facing {@code count} times.
@param facing the facing
@param count the count
@return the enum facing | [
"Rotates",
"facing",
"{",
"@code",
"count",
"}",
"times",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EnumFacingUtils.java#L82-L90 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java | SshUtil.checkPassPhrase | public static boolean checkPassPhrase(File keyFilePath, String passPhrase) {
"""
Checks to see if the passPhrase is valid for the private key file.
@param keyFilePath the private key file.
@param passPhrase the password for the file.
@return true if it is valid.
"""
KeyPair key = parsePrivateKeyFile(keyFilePath);
boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty();
if (key == null) {
return false;
} else if (key.isEncrypted() != isValidPhrase) {
return false;
} else if (key.isEncrypted()) {
return key.decrypt(passPhrase);
}
return true;
} | java | public static boolean checkPassPhrase(File keyFilePath, String passPhrase) {
KeyPair key = parsePrivateKeyFile(keyFilePath);
boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty();
if (key == null) {
return false;
} else if (key.isEncrypted() != isValidPhrase) {
return false;
} else if (key.isEncrypted()) {
return key.decrypt(passPhrase);
}
return true;
} | [
"public",
"static",
"boolean",
"checkPassPhrase",
"(",
"File",
"keyFilePath",
",",
"String",
"passPhrase",
")",
"{",
"KeyPair",
"key",
"=",
"parsePrivateKeyFile",
"(",
"keyFilePath",
")",
";",
"boolean",
"isValidPhrase",
"=",
"passPhrase",
"!=",
"null",
"&&",
"!",
"passPhrase",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"key",
".",
"isEncrypted",
"(",
")",
"!=",
"isValidPhrase",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"key",
".",
"isEncrypted",
"(",
")",
")",
"{",
"return",
"key",
".",
"decrypt",
"(",
"passPhrase",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Checks to see if the passPhrase is valid for the private key file.
@param keyFilePath the private key file.
@param passPhrase the password for the file.
@return true if it is valid. | [
"Checks",
"to",
"see",
"if",
"the",
"passPhrase",
"is",
"valid",
"for",
"the",
"private",
"key",
"file",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java#L79-L90 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java | ApiOvhVps.serviceName_use_GET | public OvhUnitAndValue<Double> serviceName_use_GET(String serviceName, OvhVpsStatisticTypeEnum type) throws IOException {
"""
Return many statistics about the virtual machine at that time
REST: GET /vps/{serviceName}/use
@param type [required] The type of statistic to be fetched
@param serviceName [required] The internal name of your VPS offer
"""
String qPath = "/vps/{serviceName}/use";
StringBuilder sb = path(qPath, serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public OvhUnitAndValue<Double> serviceName_use_GET(String serviceName, OvhVpsStatisticTypeEnum type) throws IOException {
String qPath = "/vps/{serviceName}/use";
StringBuilder sb = path(qPath, serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"OvhUnitAndValue",
"<",
"Double",
">",
"serviceName_use_GET",
"(",
"String",
"serviceName",
",",
"OvhVpsStatisticTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vps/{serviceName}/use\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"type\"",
",",
"type",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t5",
")",
";",
"}"
] | Return many statistics about the virtual machine at that time
REST: GET /vps/{serviceName}/use
@param type [required] The type of statistic to be fetched
@param serviceName [required] The internal name of your VPS offer | [
"Return",
"many",
"statistics",
"about",
"the",
"virtual",
"machine",
"at",
"that",
"time"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L357-L363 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java | ElasticPoolsInner.beginCreateOrUpdate | public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
"""
Creates a new elastic pool or updates an existing elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool to be operated on (updated or created).
@param parameters The required parameters for creating or updating an elastic pool.
@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 ElasticPoolInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body();
} | java | public ElasticPoolInner beginCreateOrUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body();
} | [
"public",
"ElasticPoolInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"elasticPoolName",
",",
"ElasticPoolInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"elasticPoolName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a new elastic pool or updates an existing elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool to be operated on (updated or created).
@param parameters The required parameters for creating or updating an elastic pool.
@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 ElasticPoolInner object if successful. | [
"Creates",
"a",
"new",
"elastic",
"pool",
"or",
"updates",
"an",
"existing",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L195-L197 |
GoogleCloudPlatform/appengine-gcs-client | java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java | OauthRawGcsService.putAsync | private Future<RawGcsCreationToken> putAsync(final GcsRestCreationToken token,
ByteBuffer chunk, final boolean isFinalChunk, long timeoutMillis) {
"""
Same as {@link #put} but is runs asynchronously and returns a future. In the event of an error
the exception out of the future will be an ExecutionException with the cause set to the same
exception that would have been thrown by put.
"""
final int length = chunk.remaining();
HTTPRequest request = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
final HTTPRequestInfo info = new HTTPRequestInfo(request);
return new FutureWrapper<HTTPResponse, RawGcsCreationToken>(urlfetch.fetchAsync(request)) {
@Override
protected Throwable convertException(Throwable e) {
return OauthRawGcsService.convertException(info, e);
}
@Override
protected GcsRestCreationToken wrap(HTTPResponse resp) throws Exception {
return handlePutResponse(token, isFinalChunk, length, info, resp);
}
};
} | java | private Future<RawGcsCreationToken> putAsync(final GcsRestCreationToken token,
ByteBuffer chunk, final boolean isFinalChunk, long timeoutMillis) {
final int length = chunk.remaining();
HTTPRequest request = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length);
final HTTPRequestInfo info = new HTTPRequestInfo(request);
return new FutureWrapper<HTTPResponse, RawGcsCreationToken>(urlfetch.fetchAsync(request)) {
@Override
protected Throwable convertException(Throwable e) {
return OauthRawGcsService.convertException(info, e);
}
@Override
protected GcsRestCreationToken wrap(HTTPResponse resp) throws Exception {
return handlePutResponse(token, isFinalChunk, length, info, resp);
}
};
} | [
"private",
"Future",
"<",
"RawGcsCreationToken",
">",
"putAsync",
"(",
"final",
"GcsRestCreationToken",
"token",
",",
"ByteBuffer",
"chunk",
",",
"final",
"boolean",
"isFinalChunk",
",",
"long",
"timeoutMillis",
")",
"{",
"final",
"int",
"length",
"=",
"chunk",
".",
"remaining",
"(",
")",
";",
"HTTPRequest",
"request",
"=",
"createPutRequest",
"(",
"token",
",",
"chunk",
",",
"isFinalChunk",
",",
"timeoutMillis",
",",
"length",
")",
";",
"final",
"HTTPRequestInfo",
"info",
"=",
"new",
"HTTPRequestInfo",
"(",
"request",
")",
";",
"return",
"new",
"FutureWrapper",
"<",
"HTTPResponse",
",",
"RawGcsCreationToken",
">",
"(",
"urlfetch",
".",
"fetchAsync",
"(",
"request",
")",
")",
"{",
"@",
"Override",
"protected",
"Throwable",
"convertException",
"(",
"Throwable",
"e",
")",
"{",
"return",
"OauthRawGcsService",
".",
"convertException",
"(",
"info",
",",
"e",
")",
";",
"}",
"@",
"Override",
"protected",
"GcsRestCreationToken",
"wrap",
"(",
"HTTPResponse",
"resp",
")",
"throws",
"Exception",
"{",
"return",
"handlePutResponse",
"(",
"token",
",",
"isFinalChunk",
",",
"length",
",",
"info",
",",
"resp",
")",
";",
"}",
"}",
";",
"}"
] | Same as {@link #put} but is runs asynchronously and returns a future. In the event of an error
the exception out of the future will be an ExecutionException with the cause set to the same
exception that would have been thrown by put. | [
"Same",
"as",
"{"
] | train | https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L424-L440 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.fill | public SDVariable fill(String name, SDVariable shape, org.nd4j.linalg.api.buffer.DataType dataType, double value) {
"""
Generate an output variable with the specified (dynamic) shape with all elements set to the specified value
@param name Name of the output variable
@param shape Shape: must be a 1D array/variable
@param value Value to set all elements to
@return Output variable
"""
SDVariable result = f().fill(shape, dataType, value);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable fill(String name, SDVariable shape, org.nd4j.linalg.api.buffer.DataType dataType, double value) {
SDVariable result = f().fill(shape, dataType, value);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"fill",
"(",
"String",
"name",
",",
"SDVariable",
"shape",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"buffer",
".",
"DataType",
"dataType",
",",
"double",
"value",
")",
"{",
"SDVariable",
"result",
"=",
"f",
"(",
")",
".",
"fill",
"(",
"shape",
",",
"dataType",
",",
"value",
")",
";",
"return",
"updateVariableNameAndReference",
"(",
"result",
",",
"name",
")",
";",
"}"
] | Generate an output variable with the specified (dynamic) shape with all elements set to the specified value
@param name Name of the output variable
@param shape Shape: must be a 1D array/variable
@param value Value to set all elements to
@return Output variable | [
"Generate",
"an",
"output",
"variable",
"with",
"the",
"specified",
"(",
"dynamic",
")",
"shape",
"with",
"all",
"elements",
"set",
"to",
"the",
"specified",
"value"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L538-L541 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/images/ImageUtil.java | ImageUtil.getImageSize | public static int[] getImageSize(
InputStream input,
int maxWidth,
int maxHeight) throws IOException {
"""
Returns the possible size of an image from the given input stream; the
returned size does not overcome the specified maximal borders but keeps
the ratio of the image. This method closes the given stream.
@param input the input stream with an image
@param maxWidth the maximal width
@param maxHeight the maximal height
@return the possible size of an image from the given input stream; the
returned size does not overcome the specified maximal borders but
keeps the ratio of the image
"""
int[] size = getImageSize(input);
return getNewSize(size[0], size[1], maxWidth, maxHeight);
} | java | public static int[] getImageSize(
InputStream input,
int maxWidth,
int maxHeight) throws IOException
{
int[] size = getImageSize(input);
return getNewSize(size[0], size[1], maxWidth, maxHeight);
} | [
"public",
"static",
"int",
"[",
"]",
"getImageSize",
"(",
"InputStream",
"input",
",",
"int",
"maxWidth",
",",
"int",
"maxHeight",
")",
"throws",
"IOException",
"{",
"int",
"[",
"]",
"size",
"=",
"getImageSize",
"(",
"input",
")",
";",
"return",
"getNewSize",
"(",
"size",
"[",
"0",
"]",
",",
"size",
"[",
"1",
"]",
",",
"maxWidth",
",",
"maxHeight",
")",
";",
"}"
] | Returns the possible size of an image from the given input stream; the
returned size does not overcome the specified maximal borders but keeps
the ratio of the image. This method closes the given stream.
@param input the input stream with an image
@param maxWidth the maximal width
@param maxHeight the maximal height
@return the possible size of an image from the given input stream; the
returned size does not overcome the specified maximal borders but
keeps the ratio of the image | [
"Returns",
"the",
"possible",
"size",
"of",
"an",
"image",
"from",
"the",
"given",
"input",
"stream",
";",
"the",
"returned",
"size",
"does",
"not",
"overcome",
"the",
"specified",
"maximal",
"borders",
"but",
"keeps",
"the",
"ratio",
"of",
"the",
"image",
".",
"This",
"method",
"closes",
"the",
"given",
"stream",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/images/ImageUtil.java#L153-L160 |
telly/groundy | library/src/main/java/com/telly/groundy/TaskResult.java | TaskResult.addParcelableArrayList | public TaskResult addParcelableArrayList(String key, ArrayList<? extends Parcelable> value) {
"""
Inserts a List of Parcelable values 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 of Parcelable objects, or null
"""
mBundle.putParcelableArrayList(key, value);
return this;
} | java | public TaskResult addParcelableArrayList(String key, ArrayList<? extends Parcelable> value) {
mBundle.putParcelableArrayList(key, value);
return this;
} | [
"public",
"TaskResult",
"addParcelableArrayList",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"?",
"extends",
"Parcelable",
">",
"value",
")",
"{",
"mBundle",
".",
"putParcelableArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a List of Parcelable values 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 of Parcelable objects, or null | [
"Inserts",
"a",
"List",
"of",
"Parcelable",
"values",
"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/TaskResult.java#L203-L206 |
samskivert/samskivert | src/main/java/com/samskivert/util/FileUtil.java | FileUtil.resuffix | public static String resuffix (File file, String ext, String newext) {
"""
Replaces <code>ext</code> with the supplied new extention if the
supplied file path ends in <code>ext</code>. Otherwise the new
extension is appended to the whole existing file path.
"""
String path = file.getPath();
if (path.endsWith(ext)) {
path = path.substring(0, path.length()-ext.length());
}
return path + newext;
} | java | public static String resuffix (File file, String ext, String newext)
{
String path = file.getPath();
if (path.endsWith(ext)) {
path = path.substring(0, path.length()-ext.length());
}
return path + newext;
} | [
"public",
"static",
"String",
"resuffix",
"(",
"File",
"file",
",",
"String",
"ext",
",",
"String",
"newext",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"ext",
")",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"ext",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"path",
"+",
"newext",
";",
"}"
] | Replaces <code>ext</code> with the supplied new extention if the
supplied file path ends in <code>ext</code>. Otherwise the new
extension is appended to the whole existing file path. | [
"Replaces",
"<code",
">",
"ext<",
"/",
"code",
">",
"with",
"the",
"supplied",
"new",
"extention",
"if",
"the",
"supplied",
"file",
"path",
"ends",
"in",
"<code",
">",
"ext<",
"/",
"code",
">",
".",
"Otherwise",
"the",
"new",
"extension",
"is",
"appended",
"to",
"the",
"whole",
"existing",
"file",
"path",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/FileUtil.java#L63-L70 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_emailPro_services_POST | public OvhTask packName_emailPro_services_POST(String packName, String email, String password) throws IOException {
"""
Activate an Email Pro service
REST: POST /pack/xdsl/{packName}/emailPro/services
@param email [required] The email address
@param password [required] The password
@param packName [required] The internal name of your pack
"""
String qPath = "/pack/xdsl/{packName}/emailPro/services";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask packName_emailPro_services_POST(String packName, String email, String password) throws IOException {
String qPath = "/pack/xdsl/{packName}/emailPro/services";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"packName_emailPro_services_POST",
"(",
"String",
"packName",
",",
"String",
"email",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/emailPro/services\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"packName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"email\"",
",",
"email",
")",
";",
"addBody",
"(",
"o",
",",
"\"password\"",
",",
"password",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Activate an Email Pro service
REST: POST /pack/xdsl/{packName}/emailPro/services
@param email [required] The email address
@param password [required] The password
@param packName [required] The internal name of your pack | [
"Activate",
"an",
"Email",
"Pro",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L190-L198 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java | FormatUtil.format | public static String format(double[][] m, String pre) {
"""
Returns a string representation of this matrix. In each line the specified
String <code>pre</code> is prefixed.
@param pre the prefix of each line
@return a string representation of this matrix
"""
StringBuilder output = new StringBuilder() //
.append(pre).append("[\n").append(pre);
for(int i = 0; i < m.length; i++) {
formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
}
return output.append("]\n").toString();
} | java | public static String format(double[][] m, String pre) {
StringBuilder output = new StringBuilder() //
.append(pre).append("[\n").append(pre);
for(int i = 0; i < m.length; i++) {
formatTo(output.append(" ["), m[i], ", ").append("]\n").append(pre);
}
return output.append("]\n").toString();
} | [
"public",
"static",
"String",
"format",
"(",
"double",
"[",
"]",
"[",
"]",
"m",
",",
"String",
"pre",
")",
"{",
"StringBuilder",
"output",
"=",
"new",
"StringBuilder",
"(",
")",
"//",
".",
"append",
"(",
"pre",
")",
".",
"append",
"(",
"\"[\\n\"",
")",
".",
"append",
"(",
"pre",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m",
".",
"length",
";",
"i",
"++",
")",
"{",
"formatTo",
"(",
"output",
".",
"append",
"(",
"\" [\"",
")",
",",
"m",
"[",
"i",
"]",
",",
"\", \"",
")",
".",
"append",
"(",
"\"]\\n\"",
")",
".",
"append",
"(",
"pre",
")",
";",
"}",
"return",
"output",
".",
"append",
"(",
"\"]\\n\"",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Returns a string representation of this matrix. In each line the specified
String <code>pre</code> is prefixed.
@param pre the prefix of each line
@return a string representation of this matrix | [
"Returns",
"a",
"string",
"representation",
"of",
"this",
"matrix",
".",
"In",
"each",
"line",
"the",
"specified",
"String",
"<code",
">",
"pre<",
"/",
"code",
">",
"is",
"prefixed",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L677-L684 |
mjdbc/mjdbc | src/main/java/com/github/mjdbc/DbPreparedStatement.java | DbPreparedStatement.bindBean | @NotNull
public DbPreparedStatement<T> bindBean(@NotNull Db db, @NotNull Object bean, boolean allowCustomFields) throws SQLException {
"""
Sets all bean properties to named parameters.
@param db database to use. This method call relies on binders registered in this database instance.
@param bean bean to map to named SQL parameters.
@param allowCustomFields if false and SQL contains keys not resolved with this bean -> SQLException will be thrown.
@return this.
@throws SQLException if anything bad happens during SQL operations or bean field accessors calls.
"""
List<BindInfo> binders = ((DbImpl) db).getBeanBinders(bean.getClass());
for (String key : parametersMapping.keySet()) {
BindInfo info = binders.stream().filter(i -> i.mappedName.equals(key)).findFirst().orElse(null);
if (info == null) {
if (allowCustomFields) {
continue;
}
throw new SQLException("No mapping found for field: " + key);
}
try {
bindArg(this, info, getIndexes(key), bean);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SQLException("Error applying bean properties: " + bean, e);
}
}
return this;
} | java | @NotNull
public DbPreparedStatement<T> bindBean(@NotNull Db db, @NotNull Object bean, boolean allowCustomFields) throws SQLException {
List<BindInfo> binders = ((DbImpl) db).getBeanBinders(bean.getClass());
for (String key : parametersMapping.keySet()) {
BindInfo info = binders.stream().filter(i -> i.mappedName.equals(key)).findFirst().orElse(null);
if (info == null) {
if (allowCustomFields) {
continue;
}
throw new SQLException("No mapping found for field: " + key);
}
try {
bindArg(this, info, getIndexes(key), bean);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new SQLException("Error applying bean properties: " + bean, e);
}
}
return this;
} | [
"@",
"NotNull",
"public",
"DbPreparedStatement",
"<",
"T",
">",
"bindBean",
"(",
"@",
"NotNull",
"Db",
"db",
",",
"@",
"NotNull",
"Object",
"bean",
",",
"boolean",
"allowCustomFields",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"BindInfo",
">",
"binders",
"=",
"(",
"(",
"DbImpl",
")",
"db",
")",
".",
"getBeanBinders",
"(",
"bean",
".",
"getClass",
"(",
")",
")",
";",
"for",
"(",
"String",
"key",
":",
"parametersMapping",
".",
"keySet",
"(",
")",
")",
"{",
"BindInfo",
"info",
"=",
"binders",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"i",
"->",
"i",
".",
"mappedName",
".",
"equals",
"(",
"key",
")",
")",
".",
"findFirst",
"(",
")",
".",
"orElse",
"(",
"null",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"if",
"(",
"allowCustomFields",
")",
"{",
"continue",
";",
"}",
"throw",
"new",
"SQLException",
"(",
"\"No mapping found for field: \"",
"+",
"key",
")",
";",
"}",
"try",
"{",
"bindArg",
"(",
"this",
",",
"info",
",",
"getIndexes",
"(",
"key",
")",
",",
"bean",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"Error applying bean properties: \"",
"+",
"bean",
",",
"e",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] | Sets all bean properties to named parameters.
@param db database to use. This method call relies on binders registered in this database instance.
@param bean bean to map to named SQL parameters.
@param allowCustomFields if false and SQL contains keys not resolved with this bean -> SQLException will be thrown.
@return this.
@throws SQLException if anything bad happens during SQL operations or bean field accessors calls. | [
"Sets",
"all",
"bean",
"properties",
"to",
"named",
"parameters",
"."
] | train | https://github.com/mjdbc/mjdbc/blob/9db720a5b3218df38a1e5e59459045234bb6386b/src/main/java/com/github/mjdbc/DbPreparedStatement.java#L255-L273 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Types.java | Types.makeIntersectionType | public Type makeIntersectionType(Type bound1, Type bound2) {
"""
A convenience wrapper for {@link #makeIntersectionType(List)}; the
arguments are converted to a list and passed to the other
method. Note that this might cause a symbol completion.
Hence, this version of makeIntersectionType may not be called
during a classfile read.
"""
return makeIntersectionType(List.of(bound1, bound2));
} | java | public Type makeIntersectionType(Type bound1, Type bound2) {
return makeIntersectionType(List.of(bound1, bound2));
} | [
"public",
"Type",
"makeIntersectionType",
"(",
"Type",
"bound1",
",",
"Type",
"bound2",
")",
"{",
"return",
"makeIntersectionType",
"(",
"List",
".",
"of",
"(",
"bound1",
",",
"bound2",
")",
")",
";",
"}"
] | A convenience wrapper for {@link #makeIntersectionType(List)}; the
arguments are converted to a list and passed to the other
method. Note that this might cause a symbol completion.
Hence, this version of makeIntersectionType may not be called
during a classfile read. | [
"A",
"convenience",
"wrapper",
"for",
"{"
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L2308-L2310 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java | SortOrderHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode) {
"""
The Field has Changed.
Change the key order to match this field's value.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
"""
int iErrorCode = this.setupGridOrder();
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
return super.fieldChanged(bDisplayOption, iMoveMode);
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = this.setupGridOrder();
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
return super.fieldChanged(bDisplayOption, iMoveMode);
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"this",
".",
"setupGridOrder",
"(",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"iErrorCode",
";",
"return",
"super",
".",
"fieldChanged",
"(",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] | The Field has Changed.
Change the key order to match this field's value.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay). | [
"The",
"Field",
"has",
"Changed",
".",
"Change",
"the",
"key",
"order",
"to",
"match",
"this",
"field",
"s",
"value",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SortOrderHandler.java#L272-L278 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.arrayAppendAll | @Deprecated
public <T> AsyncMutateInBuilder arrayAppendAll(String path, Collection<T> values, boolean createPath) {
"""
Append multiple values at once in an existing array, pushing all values in the collection's iteration order to
the back/end of the array.
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual {@link #arrayAppend(String, Object, boolean)} by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].
@param path the path of the array.
@param values the collection of values to individually insert at the back of the array.
@param createPath true to create missing intermediary nodes.
@param <T> the type of data in the collection (must be JSON serializable).
@deprecated Use {@link #arrayAppendAll(String, Collection, SubdocOptionsBuilder)} instead.
"""
return arrayAppendAll(path, values, new SubdocOptionsBuilder().createPath(createPath));
} | java | @Deprecated
public <T> AsyncMutateInBuilder arrayAppendAll(String path, Collection<T> values, boolean createPath) {
return arrayAppendAll(path, values, new SubdocOptionsBuilder().createPath(createPath));
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"arrayAppendAll",
"(",
"String",
"path",
",",
"Collection",
"<",
"T",
">",
"values",
",",
"boolean",
"createPath",
")",
"{",
"return",
"arrayAppendAll",
"(",
"path",
",",
"values",
",",
"new",
"SubdocOptionsBuilder",
"(",
")",
".",
"createPath",
"(",
"createPath",
")",
")",
";",
"}"
] | Append multiple values at once in an existing array, pushing all values in the collection's iteration order to
the back/end of the array.
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual {@link #arrayAppend(String, Object, boolean)} by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].
@param path the path of the array.
@param values the collection of values to individually insert at the back of the array.
@param createPath true to create missing intermediary nodes.
@param <T> the type of data in the collection (must be JSON serializable).
@deprecated Use {@link #arrayAppendAll(String, Collection, SubdocOptionsBuilder)} instead. | [
"Append",
"multiple",
"values",
"at",
"once",
"in",
"an",
"existing",
"array",
"pushing",
"all",
"values",
"in",
"the",
"collection",
"s",
"iteration",
"order",
"to",
"the",
"back",
"/",
"end",
"of",
"the",
"array",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L1019-L1022 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToShort | public static short convertToShort (@Nonnull final Object aSrcValue) {
"""
Convert the passed source value to short
@param aSrcValue
The source value. May not be <code>null</code>.
@return The converted value.
@throws TypeConverterException
if the source value is <code>null</code> or if no converter was
found or if the converter returned a <code>null</code> object.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch
"""
if (aSrcValue == null)
throw new TypeConverterException (short.class, EReason.NULL_SOURCE_NOT_ALLOWED);
final Short aValue = convert (aSrcValue, Short.class);
return aValue.shortValue ();
} | java | public static short convertToShort (@Nonnull final Object aSrcValue)
{
if (aSrcValue == null)
throw new TypeConverterException (short.class, EReason.NULL_SOURCE_NOT_ALLOWED);
final Short aValue = convert (aSrcValue, Short.class);
return aValue.shortValue ();
} | [
"public",
"static",
"short",
"convertToShort",
"(",
"@",
"Nonnull",
"final",
"Object",
"aSrcValue",
")",
"{",
"if",
"(",
"aSrcValue",
"==",
"null",
")",
"throw",
"new",
"TypeConverterException",
"(",
"short",
".",
"class",
",",
"EReason",
".",
"NULL_SOURCE_NOT_ALLOWED",
")",
";",
"final",
"Short",
"aValue",
"=",
"convert",
"(",
"aSrcValue",
",",
"Short",
".",
"class",
")",
";",
"return",
"aValue",
".",
"shortValue",
"(",
")",
";",
"}"
] | Convert the passed source value to short
@param aSrcValue
The source value. May not be <code>null</code>.
@return The converted value.
@throws TypeConverterException
if the source value is <code>null</code> or if no converter was
found or if the converter returned a <code>null</code> object.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"short"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L394-L400 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java | GccProcessor.getSpecs | public static String[] getSpecs() {
"""
Returns the contents of the gcc specs file.
The implementation locates gcc.exe in the executable path and then
builds a relative path name from the results of -dumpmachine and
-dumpversion. Attempts to use gcc -dumpspecs to provide this information
resulted in stalling on the Execute.run
@return contents of the specs file
"""
if (specs == null) {
final File gccParent = CUtil.getExecutableLocation(GccCCompiler.CMD_PREFIX + "gcc.exe");
if (gccParent != null) {
//
// build a relative path like
// ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
//
//
// resolve it relative to the location of gcc.exe
//
final String relativePath = "../lib/gcc-lib/" + getMachine() +
'/' +
getVersion() +
"/specs";
final File specsFile = new File(gccParent, relativePath);
//
// found the specs file
//
try {
//
// read the lines in the file
//
final BufferedReader reader = new BufferedReader(new FileReader(specsFile));
final Vector<String> lines = new Vector<>(100);
String line = reader.readLine();
while (line != null) {
lines.addElement(line);
line = reader.readLine();
}
specs = new String[lines.size()];
lines.copyInto(specs);
} catch (final IOException ex) {
}
}
}
if (specs == null) {
specs = new String[0];
}
return specs;
} | java | public static String[] getSpecs() {
if (specs == null) {
final File gccParent = CUtil.getExecutableLocation(GccCCompiler.CMD_PREFIX + "gcc.exe");
if (gccParent != null) {
//
// build a relative path like
// ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
//
//
// resolve it relative to the location of gcc.exe
//
final String relativePath = "../lib/gcc-lib/" + getMachine() +
'/' +
getVersion() +
"/specs";
final File specsFile = new File(gccParent, relativePath);
//
// found the specs file
//
try {
//
// read the lines in the file
//
final BufferedReader reader = new BufferedReader(new FileReader(specsFile));
final Vector<String> lines = new Vector<>(100);
String line = reader.readLine();
while (line != null) {
lines.addElement(line);
line = reader.readLine();
}
specs = new String[lines.size()];
lines.copyInto(specs);
} catch (final IOException ex) {
}
}
}
if (specs == null) {
specs = new String[0];
}
return specs;
} | [
"public",
"static",
"String",
"[",
"]",
"getSpecs",
"(",
")",
"{",
"if",
"(",
"specs",
"==",
"null",
")",
"{",
"final",
"File",
"gccParent",
"=",
"CUtil",
".",
"getExecutableLocation",
"(",
"GccCCompiler",
".",
"CMD_PREFIX",
"+",
"\"gcc.exe\"",
")",
";",
"if",
"(",
"gccParent",
"!=",
"null",
")",
"{",
"//",
"// build a relative path like",
"// ../lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs",
"//",
"//",
"// resolve it relative to the location of gcc.exe",
"//",
"final",
"String",
"relativePath",
"=",
"\"../lib/gcc-lib/\"",
"+",
"getMachine",
"(",
")",
"+",
"'",
"'",
"+",
"getVersion",
"(",
")",
"+",
"\"/specs\"",
";",
"final",
"File",
"specsFile",
"=",
"new",
"File",
"(",
"gccParent",
",",
"relativePath",
")",
";",
"//",
"// found the specs file",
"//",
"try",
"{",
"//",
"// read the lines in the file",
"//",
"final",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"specsFile",
")",
")",
";",
"final",
"Vector",
"<",
"String",
">",
"lines",
"=",
"new",
"Vector",
"<>",
"(",
"100",
")",
";",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"line",
"!=",
"null",
")",
"{",
"lines",
".",
"addElement",
"(",
"line",
")",
";",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"}",
"specs",
"=",
"new",
"String",
"[",
"lines",
".",
"size",
"(",
")",
"]",
";",
"lines",
".",
"copyInto",
"(",
"specs",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"ex",
")",
"{",
"}",
"}",
"}",
"if",
"(",
"specs",
"==",
"null",
")",
"{",
"specs",
"=",
"new",
"String",
"[",
"0",
"]",
";",
"}",
"return",
"specs",
";",
"}"
] | Returns the contents of the gcc specs file.
The implementation locates gcc.exe in the executable path and then
builds a relative path name from the results of -dumpmachine and
-dumpversion. Attempts to use gcc -dumpspecs to provide this information
resulted in stalling on the Execute.run
@return contents of the specs file | [
"Returns",
"the",
"contents",
"of",
"the",
"gcc",
"specs",
"file",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/gcc/cross/sparc_sun_solaris2/GccProcessor.java#L136-L176 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java | NamespaceDataPersister.addNamespace | public void addNamespace(String prefix, String uri) throws RepositoryException {
"""
Add new namespace.
@param prefix
NS prefix
@param uri
NS URI
@throws RepositoryException
Repository error
"""
if (!started)
{
if (log.isDebugEnabled())
log.debug("Unable save namespace " + uri + "=" + prefix + " in to the storage. Storage not initialized");
return;
}
PlainChangesLog changesLog = new PlainChangesLogImpl();
internallAdd(changesLog, prefix, uri);
dataManager.save(new TransactionChangesLog(changesLog));
} | java | public void addNamespace(String prefix, String uri) throws RepositoryException
{
if (!started)
{
if (log.isDebugEnabled())
log.debug("Unable save namespace " + uri + "=" + prefix + " in to the storage. Storage not initialized");
return;
}
PlainChangesLog changesLog = new PlainChangesLogImpl();
internallAdd(changesLog, prefix, uri);
dataManager.save(new TransactionChangesLog(changesLog));
} | [
"public",
"void",
"addNamespace",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"!",
"started",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"Unable save namespace \"",
"+",
"uri",
"+",
"\"=\"",
"+",
"prefix",
"+",
"\" in to the storage. Storage not initialized\"",
")",
";",
"return",
";",
"}",
"PlainChangesLog",
"changesLog",
"=",
"new",
"PlainChangesLogImpl",
"(",
")",
";",
"internallAdd",
"(",
"changesLog",
",",
"prefix",
",",
"uri",
")",
";",
"dataManager",
".",
"save",
"(",
"new",
"TransactionChangesLog",
"(",
"changesLog",
")",
")",
";",
"}"
] | Add new namespace.
@param prefix
NS prefix
@param uri
NS URI
@throws RepositoryException
Repository error | [
"Add",
"new",
"namespace",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java#L94-L107 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.findAll | @Override
public List<CPDefinition> findAll(int start, int end) {
"""
Returns a range of all the cp definitions.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@return the range of cp definitions
"""
return findAll(start, end, null);
} | java | @Override
public List<CPDefinition> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinition",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definitions.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definitions
@param end the upper bound of the range of cp definitions (not inclusive)
@return the range of cp definitions | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definitions",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L6215-L6218 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/math/ArrayMath.java | ArrayMath.addInPlace | public static void addInPlace(double[] a, double b) {
"""
Increases the values in this array by b. Does it in place.
@param a The array
@param b The amount by which to increase each item
"""
for (int i = 0; i < a.length; i++) {
a[i] = a[i] + b;
}
} | java | public static void addInPlace(double[] a, double b) {
for (int i = 0; i < a.length; i++) {
a[i] = a[i] + b;
}
} | [
"public",
"static",
"void",
"addInPlace",
"(",
"double",
"[",
"]",
"a",
",",
"double",
"b",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
";",
"i",
"++",
")",
"{",
"a",
"[",
"i",
"]",
"=",
"a",
"[",
"i",
"]",
"+",
"b",
";",
"}",
"}"
] | Increases the values in this array by b. Does it in place.
@param a The array
@param b The amount by which to increase each item | [
"Increases",
"the",
"values",
"in",
"this",
"array",
"by",
"b",
".",
"Does",
"it",
"in",
"place",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L121-L125 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonTaggedImages | public ResultList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
"""
Get the images that have been tagged with a specific person id.
We return all of the image results with a media object mapped for each
image.
@param personId
@param page
@param language
@return
@throws com.omertron.themoviedbapi.MovieDbException
"""
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TAGGED_IMAGES).buildUrl(parameters);
WrapperGenericList<ArtworkMedia> wrapper = processWrapper(getTypeReference(ArtworkMedia.class), url, "tagged images");
return wrapper.getResultsList();
} | java | public ResultList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TAGGED_IMAGES).buildUrl(parameters);
WrapperGenericList<ArtworkMedia> wrapper = processWrapper(getTypeReference(ArtworkMedia.class), url, "tagged images");
return wrapper.getResultsList();
} | [
"public",
"ResultList",
"<",
"ArtworkMedia",
">",
"getPersonTaggedImages",
"(",
"int",
"personId",
",",
"Integer",
"page",
",",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",
"personId",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"PAGE",
",",
"page",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"LANGUAGE",
",",
"language",
")",
";",
"URL",
"url",
"=",
"new",
"ApiUrl",
"(",
"apiKey",
",",
"MethodBase",
".",
"PERSON",
")",
".",
"subMethod",
"(",
"MethodSub",
".",
"TAGGED_IMAGES",
")",
".",
"buildUrl",
"(",
"parameters",
")",
";",
"WrapperGenericList",
"<",
"ArtworkMedia",
">",
"wrapper",
"=",
"processWrapper",
"(",
"getTypeReference",
"(",
"ArtworkMedia",
".",
"class",
")",
",",
"url",
",",
"\"tagged images\"",
")",
";",
"return",
"wrapper",
".",
"getResultsList",
"(",
")",
";",
"}"
] | Get the images that have been tagged with a specific person id.
We return all of the image results with a media object mapped for each
image.
@param personId
@param page
@param language
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"Get",
"the",
"images",
"that",
"have",
"been",
"tagged",
"with",
"a",
"specific",
"person",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L245-L254 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/jmx/JMXUtils.java | JMXUtils.getObjectName | static ObjectName getObjectName(String type, String name) {
"""
Gets the object name.
@param type the type
@param name the name
@return the object name
"""
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | static ObjectName getObjectName(String type, String name) {
try {
return new ObjectName(JMXUtils.class.getPackage().getName() + ":type=" + type + ",name=" + name);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"static",
"ObjectName",
"getObjectName",
"(",
"String",
"type",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"new",
"ObjectName",
"(",
"JMXUtils",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\":type=\"",
"+",
"type",
"+",
"\",name=\"",
"+",
"name",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | Gets the object name.
@param type the type
@param name the name
@return the object name | [
"Gets",
"the",
"object",
"name",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/jmx/JMXUtils.java#L46-L52 |
samskivert/samskivert | src/main/java/com/samskivert/util/ConfigUtil.java | ConfigUtil.loadProperties | public static Properties loadProperties (String path, ClassLoader loader)
throws IOException {
"""
Like {@link #loadProperties(String)} but this method uses the supplied class loader rather
than the class loader used to load the <code>ConfigUtil</code> class.
"""
Properties props = new Properties();
loadProperties(path, loader, props);
return props;
} | java | public static Properties loadProperties (String path, ClassLoader loader)
throws IOException
{
Properties props = new Properties();
loadProperties(path, loader, props);
return props;
} | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"String",
"path",
",",
"ClassLoader",
"loader",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"loadProperties",
"(",
"path",
",",
"loader",
",",
"props",
")",
";",
"return",
"props",
";",
"}"
] | Like {@link #loadProperties(String)} but this method uses the supplied class loader rather
than the class loader used to load the <code>ConfigUtil</code> class. | [
"Like",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L66-L72 |
NessComputing/components-ness-core | src/main/java/com/nesscomputing/util/Sizes.java | Sizes.formatRate | public static String formatRate(long count, long time, TimeUnit units) {
"""
Given a size in bytes and a duration, format as a pretty
throughput string. The output will look like "15.4 MB/s".
"""
double rate = count * 1000.0;
rate /= TimeUnit.MILLISECONDS.convert(time, units);
return formatSize((long) rate) + "/s";
} | java | public static String formatRate(long count, long time, TimeUnit units)
{
double rate = count * 1000.0;
rate /= TimeUnit.MILLISECONDS.convert(time, units);
return formatSize((long) rate) + "/s";
} | [
"public",
"static",
"String",
"formatRate",
"(",
"long",
"count",
",",
"long",
"time",
",",
"TimeUnit",
"units",
")",
"{",
"double",
"rate",
"=",
"count",
"*",
"1000.0",
";",
"rate",
"/=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"time",
",",
"units",
")",
";",
"return",
"formatSize",
"(",
"(",
"long",
")",
"rate",
")",
"+",
"\"/s\"",
";",
"}"
] | Given a size in bytes and a duration, format as a pretty
throughput string. The output will look like "15.4 MB/s". | [
"Given",
"a",
"size",
"in",
"bytes",
"and",
"a",
"duration",
"format",
"as",
"a",
"pretty",
"throughput",
"string",
".",
"The",
"output",
"will",
"look",
"like",
"15",
".",
"4",
"MB",
"/",
"s",
"."
] | train | https://github.com/NessComputing/components-ness-core/blob/980db2925e5f9085c75ad3682d5314a973209297/src/main/java/com/nesscomputing/util/Sizes.java#L40-L45 |
paypal/SeLion | server/src/main/java/com/paypal/selion/utils/ServletHelper.java | ServletHelper.respondAsHtmlUsingTemplate | public static void respondAsHtmlUsingTemplate(HttpServletResponse resp, String resourcePageTemplate)
throws IOException {
"""
Sends a HTTP response as a text/html document. Replies with HTTP status code 200 OK
@param resp
A {@link HttpServletResponse} object that the servlet is responding on.
@param resourcePageTemplate
The HTML template to use which is loaded as a classpath resource.
@throws IOException
"""
respondAsHtmlUsingTemplateWithHttpStatus(resp, resourcePageTemplate, HttpStatus.SC_OK);
} | java | public static void respondAsHtmlUsingTemplate(HttpServletResponse resp, String resourcePageTemplate)
throws IOException {
respondAsHtmlUsingTemplateWithHttpStatus(resp, resourcePageTemplate, HttpStatus.SC_OK);
} | [
"public",
"static",
"void",
"respondAsHtmlUsingTemplate",
"(",
"HttpServletResponse",
"resp",
",",
"String",
"resourcePageTemplate",
")",
"throws",
"IOException",
"{",
"respondAsHtmlUsingTemplateWithHttpStatus",
"(",
"resp",
",",
"resourcePageTemplate",
",",
"HttpStatus",
".",
"SC_OK",
")",
";",
"}"
] | Sends a HTTP response as a text/html document. Replies with HTTP status code 200 OK
@param resp
A {@link HttpServletResponse} object that the servlet is responding on.
@param resourcePageTemplate
The HTML template to use which is loaded as a classpath resource.
@throws IOException | [
"Sends",
"a",
"HTTP",
"response",
"as",
"a",
"text",
"/",
"html",
"document",
".",
"Replies",
"with",
"HTTP",
"status",
"code",
"200",
"OK"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/ServletHelper.java#L165-L168 |
hawkular/hawkular-apm | client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java | FragmentBuilder.getState | public Object getState(Object context, String name) {
"""
This method returns the state associated with the name and optional
context.
@param context The optional context
@param name The name
@return The state, or null if not found
"""
StateInformation si = stateInformation.get(name);
if (si == null) {
return null;
}
return si.get(context);
} | java | public Object getState(Object context, String name) {
StateInformation si = stateInformation.get(name);
if (si == null) {
return null;
}
return si.get(context);
} | [
"public",
"Object",
"getState",
"(",
"Object",
"context",
",",
"String",
"name",
")",
"{",
"StateInformation",
"si",
"=",
"stateInformation",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"si",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"si",
".",
"get",
"(",
"context",
")",
";",
"}"
] | This method returns the state associated with the name and optional
context.
@param context The optional context
@param name The name
@return The state, or null if not found | [
"This",
"method",
"returns",
"the",
"state",
"associated",
"with",
"the",
"name",
"and",
"optional",
"context",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L615-L621 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glColorMask | public static void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
"""
<p>glColorMask specifies whether the individual color components in the frame buffer can or cannot be written. If
red is {@code false}, for example, no change is made to the red component of any pixel in any of the color
buffers, regardless of the drawing operation attempted.</p>
@param red Specifies whether red can or cannot be written into the framebuffer.
@param green Specifies whether green can or cannot be written into the framebuffer.
@param blue Specifies whether blue can or cannot be written into the framebuffer.
@param alpha Specifies whether alpha can or cannot be written into the framebuffer.
"""
checkContextCompatibility();
nglColorMask(red, green, blue, alpha);
} | java | public static void glColorMask(boolean red, boolean green, boolean blue, boolean alpha)
{
checkContextCompatibility();
nglColorMask(red, green, blue, alpha);
} | [
"public",
"static",
"void",
"glColorMask",
"(",
"boolean",
"red",
",",
"boolean",
"green",
",",
"boolean",
"blue",
",",
"boolean",
"alpha",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"nglColorMask",
"(",
"red",
",",
"green",
",",
"blue",
",",
"alpha",
")",
";",
"}"
] | <p>glColorMask specifies whether the individual color components in the frame buffer can or cannot be written. If
red is {@code false}, for example, no change is made to the red component of any pixel in any of the color
buffers, regardless of the drawing operation attempted.</p>
@param red Specifies whether red can or cannot be written into the framebuffer.
@param green Specifies whether green can or cannot be written into the framebuffer.
@param blue Specifies whether blue can or cannot be written into the framebuffer.
@param alpha Specifies whether alpha can or cannot be written into the framebuffer. | [
"<p",
">",
"glColorMask",
"specifies",
"whether",
"the",
"individual",
"color",
"components",
"in",
"the",
"frame",
"buffer",
"can",
"or",
"cannot",
"be",
"written",
".",
"If",
"red",
"is",
"{",
"@code",
"false",
"}",
"for",
"example",
"no",
"change",
"is",
"made",
"to",
"the",
"red",
"component",
"of",
"any",
"pixel",
"in",
"any",
"of",
"the",
"color",
"buffers",
"regardless",
"of",
"the",
"drawing",
"operation",
"attempted",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L1250-L1254 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | Sort.mergeSort | private static <T extends Comparable<? super T>>
void mergeSort( T[] arr, T[] tmpArr, int left, int right ) {
"""
internal method to make a recursive call
@param arr an array of Comparable items
@param tmpArr temp array to placed the merged result
@param left left-most index of the subarray
@param right right-most index of the subarray
"""
//recursive way
if ( left < right ) {
int center = ( left + right ) / 2;
mergeSort(arr, tmpArr, left, center);
mergeSort(arr, tmpArr, center + 1, right);
merge(arr, tmpArr, left, center + 1, right);
}
//loop instead
/* int len = 2, pos;
int rpos, offset, cut;
while ( len <= right ) {
pos = 0;
offset = len / 2;
while ( pos + len <= right ) {
rpos = pos + offset;
merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );
pos += len;
}
//merge the rest
cut = pos + offset;
if ( cut <= right )
merge( arr, tmpArr, pos, cut, right );
len *= 2;
}
merge( arr, tmpArr, 0, len / 2, right );*/
} | java | private static <T extends Comparable<? super T>>
void mergeSort( T[] arr, T[] tmpArr, int left, int right )
{
//recursive way
if ( left < right ) {
int center = ( left + right ) / 2;
mergeSort(arr, tmpArr, left, center);
mergeSort(arr, tmpArr, center + 1, right);
merge(arr, tmpArr, left, center + 1, right);
}
//loop instead
/* int len = 2, pos;
int rpos, offset, cut;
while ( len <= right ) {
pos = 0;
offset = len / 2;
while ( pos + len <= right ) {
rpos = pos + offset;
merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );
pos += len;
}
//merge the rest
cut = pos + offset;
if ( cut <= right )
merge( arr, tmpArr, pos, cut, right );
len *= 2;
}
merge( arr, tmpArr, 0, len / 2, right );*/
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"mergeSort",
"(",
"T",
"[",
"]",
"arr",
",",
"T",
"[",
"]",
"tmpArr",
",",
"int",
"left",
",",
"int",
"right",
")",
"{",
"//recursive way",
"if",
"(",
"left",
"<",
"right",
")",
"{",
"int",
"center",
"=",
"(",
"left",
"+",
"right",
")",
"/",
"2",
";",
"mergeSort",
"(",
"arr",
",",
"tmpArr",
",",
"left",
",",
"center",
")",
";",
"mergeSort",
"(",
"arr",
",",
"tmpArr",
",",
"center",
"+",
"1",
",",
"right",
")",
";",
"merge",
"(",
"arr",
",",
"tmpArr",
",",
"left",
",",
"center",
"+",
"1",
",",
"right",
")",
";",
"}",
"//loop instead",
"/* int len = 2, pos;\n int rpos, offset, cut;\n while ( len <= right ) {\n pos = 0;\n offset = len / 2;\n while ( pos + len <= right ) {\n rpos = pos + offset;\n merge( arr, tmpArr, pos, rpos, rpos + offset - 1 );\n pos += len;\n }\n \n //merge the rest\n cut = pos + offset;\n if ( cut <= right ) \n merge( arr, tmpArr, pos, cut, right );\n \n len *= 2;\n }\n merge( arr, tmpArr, 0, len / 2, right );*/",
"}"
] | internal method to make a recursive call
@param arr an array of Comparable items
@param tmpArr temp array to placed the merged result
@param left left-most index of the subarray
@param right right-most index of the subarray | [
"internal",
"method",
"to",
"make",
"a",
"recursive",
"call"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L111-L142 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java | Base64Util.decodeString | public static String decodeString(final String string) {
"""
Decodes a string from Base64 format.
@param string a Base64 String to be decoded.
@return A String containing the decoded data.
@throws IllegalArgumentException if the input is not valid Base64 encoded data.
"""
String decodedString = null;
try {
byte[] decodedBytes = decode(string);
decodedString = new String(decodedBytes, "UTF-8");
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
}
return decodedString;
} | java | public static String decodeString(final String string) {
String decodedString = null;
try {
byte[] decodedBytes = decode(string);
decodedString = new String(decodedBytes, "UTF-8");
} catch (UnsupportedEncodingException uue) {
// Should never happen, java has to support "UTF-8".
}
return decodedString;
} | [
"public",
"static",
"String",
"decodeString",
"(",
"final",
"String",
"string",
")",
"{",
"String",
"decodedString",
"=",
"null",
";",
"try",
"{",
"byte",
"[",
"]",
"decodedBytes",
"=",
"decode",
"(",
"string",
")",
";",
"decodedString",
"=",
"new",
"String",
"(",
"decodedBytes",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"uue",
")",
"{",
"// Should never happen, java has to support \"UTF-8\".",
"}",
"return",
"decodedString",
";",
"}"
] | Decodes a string from Base64 format.
@param string a Base64 String to be decoded.
@return A String containing the decoded data.
@throws IllegalArgumentException if the input is not valid Base64 encoded data. | [
"Decodes",
"a",
"string",
"from",
"Base64",
"format",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/Base64Util.java#L161-L172 |
mozilla/rhino | src/org/mozilla/javascript/NativeSymbol.java | NativeSymbol.put | @Override
public void put(String name, Scriptable start, Object value) {
"""
Symbol objects have a special property that one cannot add properties.
"""
if (!isSymbol()) {
super.put(name, start, value);
} else if (Context.getCurrentContext().isStrictMode()) {
throw ScriptRuntime.typeError0("msg.no.assign.symbol.strict");
}
} | java | @Override
public void put(String name, Scriptable start, Object value)
{
if (!isSymbol()) {
super.put(name, start, value);
} else if (Context.getCurrentContext().isStrictMode()) {
throw ScriptRuntime.typeError0("msg.no.assign.symbol.strict");
}
} | [
"@",
"Override",
"public",
"void",
"put",
"(",
"String",
"name",
",",
"Scriptable",
"start",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"isSymbol",
"(",
")",
")",
"{",
"super",
".",
"put",
"(",
"name",
",",
"start",
",",
"value",
")",
";",
"}",
"else",
"if",
"(",
"Context",
".",
"getCurrentContext",
"(",
")",
".",
"isStrictMode",
"(",
")",
")",
"{",
"throw",
"ScriptRuntime",
".",
"typeError0",
"(",
"\"msg.no.assign.symbol.strict\"",
")",
";",
"}",
"}"
] | Symbol objects have a special property that one cannot add properties. | [
"Symbol",
"objects",
"have",
"a",
"special",
"property",
"that",
"one",
"cannot",
"add",
"properties",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeSymbol.java#L283-L291 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.illegalCode | public static void illegalCode(Exception e, String methodName, String className) {
"""
Thrown when the explicit conversion method defined has a null pointer.<br>
Used in the generated code, in case of dynamic methods defined.
@param e byteCode library exception
@param methodName method name
@param className class name
"""
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointer,methodName,className,e.getClass().getSimpleName(),""+e.getMessage()));
} | java | public static void illegalCode(Exception e, String methodName, String className){
throw new IllegalCodeException(MSG.INSTANCE.message(nullPointer,methodName,className,e.getClass().getSimpleName(),""+e.getMessage()));
} | [
"public",
"static",
"void",
"illegalCode",
"(",
"Exception",
"e",
",",
"String",
"methodName",
",",
"String",
"className",
")",
"{",
"throw",
"new",
"IllegalCodeException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"nullPointer",
",",
"methodName",
",",
"className",
",",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"\"\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}"
] | Thrown when the explicit conversion method defined has a null pointer.<br>
Used in the generated code, in case of dynamic methods defined.
@param e byteCode library exception
@param methodName method name
@param className class name | [
"Thrown",
"when",
"the",
"explicit",
"conversion",
"method",
"defined",
"has",
"a",
"null",
"pointer",
".",
"<br",
">",
"Used",
"in",
"the",
"generated",
"code",
"in",
"case",
"of",
"dynamic",
"methods",
"defined",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L145-L147 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.createWebOU | public CmsOrganizationalUnit createWebOU(String ouFqn, String description, boolean hideLogin) {
"""
Create a web OU
@param ouFqn the fully qualified name of the OU
@param description the description of the OU
@param hideLogin flag, indicating if the OU should be hidden from the login form.
@return the created OU, or <code>null</code> if creation fails.
"""
try {
return OpenCms.getOrgUnitManager().createOrganizationalUnit(
m_cms,
ouFqn,
description,
(hideLogin ? CmsOrganizationalUnit.FLAG_HIDE_LOGIN : 0) | CmsOrganizationalUnit.FLAG_WEBUSERS,
null);
} catch (CmsException e) {
// TODO Auto-generated catch block
m_shell.getOut().println(
getMessages().key(Messages.GUI_SHELL_WEB_OU_CREATION_FAILED_2, ouFqn, description));
return null;
}
} | java | public CmsOrganizationalUnit createWebOU(String ouFqn, String description, boolean hideLogin) {
try {
return OpenCms.getOrgUnitManager().createOrganizationalUnit(
m_cms,
ouFqn,
description,
(hideLogin ? CmsOrganizationalUnit.FLAG_HIDE_LOGIN : 0) | CmsOrganizationalUnit.FLAG_WEBUSERS,
null);
} catch (CmsException e) {
// TODO Auto-generated catch block
m_shell.getOut().println(
getMessages().key(Messages.GUI_SHELL_WEB_OU_CREATION_FAILED_2, ouFqn, description));
return null;
}
} | [
"public",
"CmsOrganizationalUnit",
"createWebOU",
"(",
"String",
"ouFqn",
",",
"String",
"description",
",",
"boolean",
"hideLogin",
")",
"{",
"try",
"{",
"return",
"OpenCms",
".",
"getOrgUnitManager",
"(",
")",
".",
"createOrganizationalUnit",
"(",
"m_cms",
",",
"ouFqn",
",",
"description",
",",
"(",
"hideLogin",
"?",
"CmsOrganizationalUnit",
".",
"FLAG_HIDE_LOGIN",
":",
"0",
")",
"|",
"CmsOrganizationalUnit",
".",
"FLAG_WEBUSERS",
",",
"null",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"// TODO Auto-generated catch block",
"m_shell",
".",
"getOut",
"(",
")",
".",
"println",
"(",
"getMessages",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SHELL_WEB_OU_CREATION_FAILED_2",
",",
"ouFqn",
",",
"description",
")",
")",
";",
"return",
"null",
";",
"}",
"}"
] | Create a web OU
@param ouFqn the fully qualified name of the OU
@param description the description of the OU
@param hideLogin flag, indicating if the OU should be hidden from the login form.
@return the created OU, or <code>null</code> if creation fails. | [
"Create",
"a",
"web",
"OU",
"@param",
"ouFqn",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"OU",
"@param",
"description",
"the",
"description",
"of",
"the",
"OU",
"@param",
"hideLogin",
"flag",
"indicating",
"if",
"the",
"OU",
"should",
"be",
"hidden",
"from",
"the",
"login",
"form",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L434-L449 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java | ElemLiteralResult.callChildVisitors | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) {
"""
Call the children visitors.
@param visitor The visitor whose appropriate method will be called.
"""
if (callAttrs && null != m_avts)
{
int nAttrs = m_avts.size();
for (int i = (nAttrs - 1); i >= 0; i--)
{
AVT avt = (AVT) m_avts.get(i);
avt.callVisitors(visitor);
}
}
super.callChildVisitors(visitor, callAttrs);
} | java | protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
{
if (callAttrs && null != m_avts)
{
int nAttrs = m_avts.size();
for (int i = (nAttrs - 1); i >= 0; i--)
{
AVT avt = (AVT) m_avts.get(i);
avt.callVisitors(visitor);
}
}
super.callChildVisitors(visitor, callAttrs);
} | [
"protected",
"void",
"callChildVisitors",
"(",
"XSLTVisitor",
"visitor",
",",
"boolean",
"callAttrs",
")",
"{",
"if",
"(",
"callAttrs",
"&&",
"null",
"!=",
"m_avts",
")",
"{",
"int",
"nAttrs",
"=",
"m_avts",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"(",
"nAttrs",
"-",
"1",
")",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"AVT",
"avt",
"=",
"(",
"AVT",
")",
"m_avts",
".",
"get",
"(",
"i",
")",
";",
"avt",
".",
"callVisitors",
"(",
"visitor",
")",
";",
"}",
"}",
"super",
".",
"callChildVisitors",
"(",
"visitor",
",",
"callAttrs",
")",
";",
"}"
] | Call the children visitors.
@param visitor The visitor whose appropriate method will be called. | [
"Call",
"the",
"children",
"visitors",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java#L1450-L1463 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_dynHost_login_GET | public ArrayList<String> zone_zoneName_dynHost_login_GET(String zoneName, String login, String subDomain) throws IOException {
"""
DynHost' logins
REST: GET /domain/zone/{zoneName}/dynHost/login
@param login [required] Filter the value of login property (like)
@param subDomain [required] Filter the value of subDomain property (like)
@param zoneName [required] The internal name of your zone
"""
String qPath = "/domain/zone/{zoneName}/dynHost/login";
StringBuilder sb = path(qPath, zoneName);
query(sb, "login", login);
query(sb, "subDomain", subDomain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<String> zone_zoneName_dynHost_login_GET(String zoneName, String login, String subDomain) throws IOException {
String qPath = "/domain/zone/{zoneName}/dynHost/login";
StringBuilder sb = path(qPath, zoneName);
query(sb, "login", login);
query(sb, "subDomain", subDomain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"zone_zoneName_dynHost_login_GET",
"(",
"String",
"zoneName",
",",
"String",
"login",
",",
"String",
"subDomain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/dynHost/login\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"zoneName",
")",
";",
"query",
"(",
"sb",
",",
"\"login\"",
",",
"login",
")",
";",
"query",
"(",
"sb",
",",
"\"subDomain\"",
",",
"subDomain",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t2",
")",
";",
"}"
] | DynHost' logins
REST: GET /domain/zone/{zoneName}/dynHost/login
@param login [required] Filter the value of login property (like)
@param subDomain [required] Filter the value of subDomain property (like)
@param zoneName [required] The internal name of your zone | [
"DynHost",
"logins"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L496-L503 |
h2oai/h2o-2 | src/main/java/water/Value.java | Value.initReplicaHome | void initReplicaHome( H2ONode h2o, Key key ) {
"""
Initialize the _replicas field for a PUT. On the Home node (for remote
PUTs), it is initialized to the one replica we know about, and not
read-locked. Used on a new Value about to be PUT on the Home node.
"""
assert key.home();
assert _key == null; // This is THE initializing key write for serialized Values
assert h2o != H2O.SELF; // Do not track self as a replica
_key = key;
// Set the replica bit for the one node we know about, and leave the
// rest clear.
_replicas.add(h2o._unique_idx);
_rwlock.set(0); // No GETs are in-flight at this time.
//System.out.println(key+", init "+_rwlock.get());
} | java | void initReplicaHome( H2ONode h2o, Key key ) {
assert key.home();
assert _key == null; // This is THE initializing key write for serialized Values
assert h2o != H2O.SELF; // Do not track self as a replica
_key = key;
// Set the replica bit for the one node we know about, and leave the
// rest clear.
_replicas.add(h2o._unique_idx);
_rwlock.set(0); // No GETs are in-flight at this time.
//System.out.println(key+", init "+_rwlock.get());
} | [
"void",
"initReplicaHome",
"(",
"H2ONode",
"h2o",
",",
"Key",
"key",
")",
"{",
"assert",
"key",
".",
"home",
"(",
")",
";",
"assert",
"_key",
"==",
"null",
";",
"// This is THE initializing key write for serialized Values",
"assert",
"h2o",
"!=",
"H2O",
".",
"SELF",
";",
"// Do not track self as a replica",
"_key",
"=",
"key",
";",
"// Set the replica bit for the one node we know about, and leave the",
"// rest clear.",
"_replicas",
".",
"add",
"(",
"h2o",
".",
"_unique_idx",
")",
";",
"_rwlock",
".",
"set",
"(",
"0",
")",
";",
"// No GETs are in-flight at this time.",
"//System.out.println(key+\", init \"+_rwlock.get());",
"}"
] | Initialize the _replicas field for a PUT. On the Home node (for remote
PUTs), it is initialized to the one replica we know about, and not
read-locked. Used on a new Value about to be PUT on the Home node. | [
"Initialize",
"the",
"_replicas",
"field",
"for",
"a",
"PUT",
".",
"On",
"the",
"Home",
"node",
"(",
"for",
"remote",
"PUTs",
")",
"it",
"is",
"initialized",
"to",
"the",
"one",
"replica",
"we",
"know",
"about",
"and",
"not",
"read",
"-",
"locked",
".",
"Used",
"on",
"a",
"new",
"Value",
"about",
"to",
"be",
"PUT",
"on",
"the",
"Home",
"node",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Value.java#L550-L560 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java | VectorPackingHeapDecorator.filterLoads | @SuppressWarnings("squid:S3346")
private int filterLoads(int d, int delta, boolean isSup) throws ContradictionException {
"""
check each rule 1.1 (lower or upper bound) against the bin with the maximum loadSlack
possibly filter the bound of the binLoad variable, update the heap
and continue until the rule does not apply
@param d the dimension
@param delta the global slack to subtract from the bound
@param isSup is the bound the upper bound ?
@return the number of bound updates
@throws ContradictionException if a contradiction (rule 1.1) is raised
"""
assert maxSlackBinHeap != null;
int nChanges = 0;
if (loadSlack(d, maxSlackBinHeap.get(d).peek()) > delta) {
do {
int b = maxSlackBinHeap.get(d).poll();
if (isSup) {
p.filterLoadSup(d, b, delta + p.loads[d][b].getLB());
} else {
p.filterLoadInf(d, b, p.loads[d][b].getUB() - delta);
}
assert loadSlack(d, b) == delta;
maxSlackBinHeap.get(d).offer(b);
nChanges++;
} while (!maxSlackBinHeap.get(d).isEmpty() && loadSlack(d, maxSlackBinHeap.get(d).peek()) > delta);
}
return nChanges;
} | java | @SuppressWarnings("squid:S3346")
private int filterLoads(int d, int delta, boolean isSup) throws ContradictionException {
assert maxSlackBinHeap != null;
int nChanges = 0;
if (loadSlack(d, maxSlackBinHeap.get(d).peek()) > delta) {
do {
int b = maxSlackBinHeap.get(d).poll();
if (isSup) {
p.filterLoadSup(d, b, delta + p.loads[d][b].getLB());
} else {
p.filterLoadInf(d, b, p.loads[d][b].getUB() - delta);
}
assert loadSlack(d, b) == delta;
maxSlackBinHeap.get(d).offer(b);
nChanges++;
} while (!maxSlackBinHeap.get(d).isEmpty() && loadSlack(d, maxSlackBinHeap.get(d).peek()) > delta);
}
return nChanges;
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3346\"",
")",
"private",
"int",
"filterLoads",
"(",
"int",
"d",
",",
"int",
"delta",
",",
"boolean",
"isSup",
")",
"throws",
"ContradictionException",
"{",
"assert",
"maxSlackBinHeap",
"!=",
"null",
";",
"int",
"nChanges",
"=",
"0",
";",
"if",
"(",
"loadSlack",
"(",
"d",
",",
"maxSlackBinHeap",
".",
"get",
"(",
"d",
")",
".",
"peek",
"(",
")",
")",
">",
"delta",
")",
"{",
"do",
"{",
"int",
"b",
"=",
"maxSlackBinHeap",
".",
"get",
"(",
"d",
")",
".",
"poll",
"(",
")",
";",
"if",
"(",
"isSup",
")",
"{",
"p",
".",
"filterLoadSup",
"(",
"d",
",",
"b",
",",
"delta",
"+",
"p",
".",
"loads",
"[",
"d",
"]",
"[",
"b",
"]",
".",
"getLB",
"(",
")",
")",
";",
"}",
"else",
"{",
"p",
".",
"filterLoadInf",
"(",
"d",
",",
"b",
",",
"p",
".",
"loads",
"[",
"d",
"]",
"[",
"b",
"]",
".",
"getUB",
"(",
")",
"-",
"delta",
")",
";",
"}",
"assert",
"loadSlack",
"(",
"d",
",",
"b",
")",
"==",
"delta",
";",
"maxSlackBinHeap",
".",
"get",
"(",
"d",
")",
".",
"offer",
"(",
"b",
")",
";",
"nChanges",
"++",
";",
"}",
"while",
"(",
"!",
"maxSlackBinHeap",
".",
"get",
"(",
"d",
")",
".",
"isEmpty",
"(",
")",
"&&",
"loadSlack",
"(",
"d",
",",
"maxSlackBinHeap",
".",
"get",
"(",
"d",
")",
".",
"peek",
"(",
")",
")",
">",
"delta",
")",
";",
"}",
"return",
"nChanges",
";",
"}"
] | check each rule 1.1 (lower or upper bound) against the bin with the maximum loadSlack
possibly filter the bound of the binLoad variable, update the heap
and continue until the rule does not apply
@param d the dimension
@param delta the global slack to subtract from the bound
@param isSup is the bound the upper bound ?
@return the number of bound updates
@throws ContradictionException if a contradiction (rule 1.1) is raised | [
"check",
"each",
"rule",
"1",
".",
"1",
"(",
"lower",
"or",
"upper",
"bound",
")",
"against",
"the",
"bin",
"with",
"the",
"maximum",
"loadSlack",
"possibly",
"filter",
"the",
"bound",
"of",
"the",
"binLoad",
"variable",
"update",
"the",
"heap",
"and",
"continue",
"until",
"the",
"rule",
"does",
"not",
"apply"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingHeapDecorator.java#L178-L196 |
RestComm/jss7 | m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java | M3UARouteManagement.getAsForRoute | protected AsImpl getAsForRoute(int dpc, int opc, int si, int sls) {
"""
<p>
Get {@link AsImpl} that is serving key (combination DPC:OPC:SI). It can return null if no key configured or all the
{@link AsImpl} are INACTIVE
</p>
<p>
If two or more {@link AsImpl} are active and {@link TrafficModeType} configured is load-shared, load is configured
between each {@link AsImpl} depending on SLS
</p>
@param dpc
@param opc
@param si
@param sls
@return
"""
// TODO : Loadsharing needs to be implemented
String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si))
.toString();
RouteAsImpl routeAs = route.get(key);
if (routeAs == null) {
key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(WILDCARD))
.toString();
routeAs = route.get(key);
if (routeAs == null) {
key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(WILDCARD).append(KEY_SEPARATOR)
.append(WILDCARD)).toString();
routeAs = route.get(key);
}
}
if (routeAs == null) {
return null;
}
int count = (sls & this.asSelectionMask);
count = (count >> this.asSlsShiftPlaces);
return routeAs.getAsForRoute(count);
} | java | protected AsImpl getAsForRoute(int dpc, int opc, int si, int sls) {
// TODO : Loadsharing needs to be implemented
String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si))
.toString();
RouteAsImpl routeAs = route.get(key);
if (routeAs == null) {
key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(WILDCARD))
.toString();
routeAs = route.get(key);
if (routeAs == null) {
key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(WILDCARD).append(KEY_SEPARATOR)
.append(WILDCARD)).toString();
routeAs = route.get(key);
}
}
if (routeAs == null) {
return null;
}
int count = (sls & this.asSelectionMask);
count = (count >> this.asSlsShiftPlaces);
return routeAs.getAsForRoute(count);
} | [
"protected",
"AsImpl",
"getAsForRoute",
"(",
"int",
"dpc",
",",
"int",
"opc",
",",
"int",
"si",
",",
"int",
"sls",
")",
"{",
"// TODO : Loadsharing needs to be implemented",
"String",
"key",
"=",
"(",
"new",
"StringBuffer",
"(",
")",
".",
"append",
"(",
"dpc",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"opc",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"si",
")",
")",
".",
"toString",
"(",
")",
";",
"RouteAsImpl",
"routeAs",
"=",
"route",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"routeAs",
"==",
"null",
")",
"{",
"key",
"=",
"(",
"new",
"StringBuffer",
"(",
")",
".",
"append",
"(",
"dpc",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"opc",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"WILDCARD",
")",
")",
".",
"toString",
"(",
")",
";",
"routeAs",
"=",
"route",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"routeAs",
"==",
"null",
")",
"{",
"key",
"=",
"(",
"new",
"StringBuffer",
"(",
")",
".",
"append",
"(",
"dpc",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"WILDCARD",
")",
".",
"append",
"(",
"KEY_SEPARATOR",
")",
".",
"append",
"(",
"WILDCARD",
")",
")",
".",
"toString",
"(",
")",
";",
"routeAs",
"=",
"route",
".",
"get",
"(",
"key",
")",
";",
"}",
"}",
"if",
"(",
"routeAs",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"count",
"=",
"(",
"sls",
"&",
"this",
".",
"asSelectionMask",
")",
";",
"count",
"=",
"(",
"count",
">>",
"this",
".",
"asSlsShiftPlaces",
")",
";",
"return",
"routeAs",
".",
"getAsForRoute",
"(",
"count",
")",
";",
"}"
] | <p>
Get {@link AsImpl} that is serving key (combination DPC:OPC:SI). It can return null if no key configured or all the
{@link AsImpl} are INACTIVE
</p>
<p>
If two or more {@link AsImpl} are active and {@link TrafficModeType} configured is load-shared, load is configured
between each {@link AsImpl} depending on SLS
</p>
@param dpc
@param opc
@param si
@param sls
@return | [
"<p",
">",
"Get",
"{",
"@link",
"AsImpl",
"}",
"that",
"is",
"serving",
"key",
"(",
"combination",
"DPC",
":",
"OPC",
":",
"SI",
")",
".",
"It",
"can",
"return",
"null",
"if",
"no",
"key",
"configured",
"or",
"all",
"the",
"{",
"@link",
"AsImpl",
"}",
"are",
"INACTIVE",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"two",
"or",
"more",
"{",
"@link",
"AsImpl",
"}",
"are",
"active",
"and",
"{",
"@link",
"TrafficModeType",
"}",
"configured",
"is",
"load",
"-",
"shared",
"load",
"is",
"configured",
"between",
"each",
"{",
"@link",
"AsImpl",
"}",
"depending",
"on",
"SLS",
"<",
"/",
"p",
">"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java#L283-L312 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setSetConfigs | public Config setSetConfigs(Map<String, SetConfig> setConfigs) {
"""
Sets the map of {@link com.hazelcast.core.ISet} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param setConfigs the set configuration map to set
@return this config instance
"""
this.setConfigs.clear();
this.setConfigs.putAll(setConfigs);
for (Entry<String, SetConfig> entry : setConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setSetConfigs(Map<String, SetConfig> setConfigs) {
this.setConfigs.clear();
this.setConfigs.putAll(setConfigs);
for (Entry<String, SetConfig> entry : setConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setSetConfigs",
"(",
"Map",
"<",
"String",
",",
"SetConfig",
">",
"setConfigs",
")",
"{",
"this",
".",
"setConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"setConfigs",
".",
"putAll",
"(",
"setConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"SetConfig",
">",
"entry",
":",
"setConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the map of {@link com.hazelcast.core.ISet} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param setConfigs the set configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"core",
".",
"ISet",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1000-L1007 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getPropertyType | public static Type getPropertyType(EntityDataModel entityDataModel, StructuralProperty property) {
"""
Gets the OData type of the property; if the property is a collection, gets the OData type of the elements of the
collection.
@param entityDataModel The entity data model
@param property The property.
@return The OData type of the property; if the property is a collection, the OData type of the elements of the
collection.
"""
return getAndCheckType(entityDataModel, getPropertyTypeName(property));
} | java | public static Type getPropertyType(EntityDataModel entityDataModel, StructuralProperty property) {
return getAndCheckType(entityDataModel, getPropertyTypeName(property));
} | [
"public",
"static",
"Type",
"getPropertyType",
"(",
"EntityDataModel",
"entityDataModel",
",",
"StructuralProperty",
"property",
")",
"{",
"return",
"getAndCheckType",
"(",
"entityDataModel",
",",
"getPropertyTypeName",
"(",
"property",
")",
")",
";",
"}"
] | Gets the OData type of the property; if the property is a collection, gets the OData type of the elements of the
collection.
@param entityDataModel The entity data model
@param property The property.
@return The OData type of the property; if the property is a collection, the OData type of the elements of the
collection. | [
"Gets",
"the",
"OData",
"type",
"of",
"the",
"property",
";",
"if",
"the",
"property",
"is",
"a",
"collection",
"gets",
"the",
"OData",
"type",
"of",
"the",
"elements",
"of",
"the",
"collection",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L300-L302 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getKeywordValue | public static String getKeywordValue(String localeID, String keywordName) {
"""
<strong>[icu]</strong> Returns the value for a keyword in the specified locale. If the keyword is
not defined, returns null. The locale name does not need to be normalized.
@param keywordName name of the keyword whose value is desired. Case insensitive.
@return String the value of the keyword as a string
"""
return new LocaleIDParser(localeID).getKeywordValue(keywordName);
} | java | public static String getKeywordValue(String localeID, String keywordName) {
return new LocaleIDParser(localeID).getKeywordValue(keywordName);
} | [
"public",
"static",
"String",
"getKeywordValue",
"(",
"String",
"localeID",
",",
"String",
"keywordName",
")",
"{",
"return",
"new",
"LocaleIDParser",
"(",
"localeID",
")",
".",
"getKeywordValue",
"(",
"keywordName",
")",
";",
"}"
] | <strong>[icu]</strong> Returns the value for a keyword in the specified locale. If the keyword is
not defined, returns null. The locale name does not need to be normalized.
@param keywordName name of the keyword whose value is desired. Case insensitive.
@return String the value of the keyword as a string | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"value",
"for",
"a",
"keyword",
"in",
"the",
"specified",
"locale",
".",
"If",
"the",
"keyword",
"is",
"not",
"defined",
"returns",
"null",
".",
"The",
"locale",
"name",
"does",
"not",
"need",
"to",
"be",
"normalized",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1149-L1151 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.replaceAll | public static String replaceAll(final String input, final String regex,
final Function<MatchResult, String> replacementFunction) {
"""
Returns a string which is the result of replacing every match of regex in the input string with
the results of applying replacementFunction to the matched string. This is a candidate to be
moved to a more general utility package.
@param replacementFunction May not return null.
"""
return replaceAll(input, Pattern.compile(regex), replacementFunction);
} | java | public static String replaceAll(final String input, final String regex,
final Function<MatchResult, String> replacementFunction) {
return replaceAll(input, Pattern.compile(regex), replacementFunction);
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"final",
"String",
"input",
",",
"final",
"String",
"regex",
",",
"final",
"Function",
"<",
"MatchResult",
",",
"String",
">",
"replacementFunction",
")",
"{",
"return",
"replaceAll",
"(",
"input",
",",
"Pattern",
".",
"compile",
"(",
"regex",
")",
",",
"replacementFunction",
")",
";",
"}"
] | Returns a string which is the result of replacing every match of regex in the input string with
the results of applying replacementFunction to the matched string. This is a candidate to be
moved to a more general utility package.
@param replacementFunction May not return null. | [
"Returns",
"a",
"string",
"which",
"is",
"the",
"result",
"of",
"replacing",
"every",
"match",
"of",
"regex",
"in",
"the",
"input",
"string",
"with",
"the",
"results",
"of",
"applying",
"replacementFunction",
"to",
"the",
"matched",
"string",
".",
"This",
"is",
"a",
"candidate",
"to",
"be",
"moved",
"to",
"a",
"more",
"general",
"utility",
"package",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L102-L105 |
AgNO3/jcifs-ng | src/main/java/jcifs/Config.java | Config.getLong | public static long getLong ( Properties props, String key, long def ) {
"""
Retrieve a <code>long</code>. If the key does not exist or
cannot be converted to a <code>long</code>, the provided default
argument will be returned.
"""
String s = props.getProperty(key);
if ( s != null ) {
try {
def = Long.parseLong(s);
}
catch ( NumberFormatException nfe ) {
log.error("Not a number", nfe);
}
}
return def;
} | java | public static long getLong ( Properties props, String key, long def ) {
String s = props.getProperty(key);
if ( s != null ) {
try {
def = Long.parseLong(s);
}
catch ( NumberFormatException nfe ) {
log.error("Not a number", nfe);
}
}
return def;
} | [
"public",
"static",
"long",
"getLong",
"(",
"Properties",
"props",
",",
"String",
"key",
",",
"long",
"def",
")",
"{",
"String",
"s",
"=",
"props",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"try",
"{",
"def",
"=",
"Long",
".",
"parseLong",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"log",
".",
"error",
"(",
"\"Not a number\"",
",",
"nfe",
")",
";",
"}",
"}",
"return",
"def",
";",
"}"
] | Retrieve a <code>long</code>. If the key does not exist or
cannot be converted to a <code>long</code>, the provided default
argument will be returned. | [
"Retrieve",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
".",
"If",
"the",
"key",
"does",
"not",
"exist",
"or",
"cannot",
"be",
"converted",
"to",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
"the",
"provided",
"default",
"argument",
"will",
"be",
"returned",
"."
] | train | https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/Config.java#L116-L127 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java | BaseFileManager.handleOption | public boolean handleOption(Option option, String value) {
"""
Common back end for OptionHelper handleFileManagerOption.
@param option the option whose value to be set
@param value the value for the option
@return true if successful, and false otherwise
"""
switch (option) {
case ENCODING:
encodingName = value;
return true;
case MULTIRELEASE:
multiReleaseValue = value;
locations.setMultiReleaseValue(value);
return true;
default:
return locations.handleOption(option, value);
}
} | java | public boolean handleOption(Option option, String value) {
switch (option) {
case ENCODING:
encodingName = value;
return true;
case MULTIRELEASE:
multiReleaseValue = value;
locations.setMultiReleaseValue(value);
return true;
default:
return locations.handleOption(option, value);
}
} | [
"public",
"boolean",
"handleOption",
"(",
"Option",
"option",
",",
"String",
"value",
")",
"{",
"switch",
"(",
"option",
")",
"{",
"case",
"ENCODING",
":",
"encodingName",
"=",
"value",
";",
"return",
"true",
";",
"case",
"MULTIRELEASE",
":",
"multiReleaseValue",
"=",
"value",
";",
"locations",
".",
"setMultiReleaseValue",
"(",
"value",
")",
";",
"return",
"true",
";",
"default",
":",
"return",
"locations",
".",
"handleOption",
"(",
"option",
",",
"value",
")",
";",
"}",
"}"
] | Common back end for OptionHelper handleFileManagerOption.
@param option the option whose value to be set
@param value the value for the option
@return true if successful, and false otherwise | [
"Common",
"back",
"end",
"for",
"OptionHelper",
"handleFileManagerOption",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java#L257-L271 |
michaelquigley/zabbixj | zabbixj-core/src/main/java/com/quigley/zabbixj/metrics/MetricsContainer.java | MetricsContainer.addProvider | public void addProvider(String name, MetricsProvider provider) {
"""
Add a MetricsProvider to this container.
@param name the name of the MetricsProvider.
@param provider the MetricsProvider instance.
"""
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name);
}
container.put(name, provider);
} | java | public void addProvider(String name, MetricsProvider provider) {
if(log.isInfoEnabled()) {
log.info("Adding Provider: " + provider.getClass().getName() + "=" + name);
}
container.put(name, provider);
} | [
"public",
"void",
"addProvider",
"(",
"String",
"name",
",",
"MetricsProvider",
"provider",
")",
"{",
"if",
"(",
"log",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Adding Provider: \"",
"+",
"provider",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"=\"",
"+",
"name",
")",
";",
"}",
"container",
".",
"put",
"(",
"name",
",",
"provider",
")",
";",
"}"
] | Add a MetricsProvider to this container.
@param name the name of the MetricsProvider.
@param provider the MetricsProvider instance. | [
"Add",
"a",
"MetricsProvider",
"to",
"this",
"container",
"."
] | train | https://github.com/michaelquigley/zabbixj/blob/15cfe46e45750b3857bec7eecc75ff5e5a3d774d/zabbixj-core/src/main/java/com/quigley/zabbixj/metrics/MetricsContainer.java#L52-L58 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateIf | private Context translateIf(WyilFile.Stmt.IfElse stmt, Context context) {
"""
Translate an if statement. This translates the true and false branches and
then recombines them together to form an updated environment. This is
challenging when the environments are updated independently in both branches.
@param stmt
@param wyalFile
"""
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr trueCondition = p.first();
// FIXME: this is broken as includes assumptions propagated through
// logical &&'s
context = p.second();
Expr falseCondition = invertCondition(trueCondition, stmt.getCondition());
//
Context trueContext = context.assume(trueCondition);
Context falseContext = context.assume(falseCondition);
//
trueContext = translateStatementBlock(stmt.getTrueBranch(), trueContext);
if (stmt.hasFalseBranch()) {
falseContext = translateStatementBlock(stmt.getFalseBranch(), falseContext);
}
// Finally, we must join the two context's back together. This ensures
// that information from either side is properly preserved
return joinDescendants(context, new Context[] { trueContext, falseContext });
} | java | private Context translateIf(WyilFile.Stmt.IfElse stmt, Context context) {
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr trueCondition = p.first();
// FIXME: this is broken as includes assumptions propagated through
// logical &&'s
context = p.second();
Expr falseCondition = invertCondition(trueCondition, stmt.getCondition());
//
Context trueContext = context.assume(trueCondition);
Context falseContext = context.assume(falseCondition);
//
trueContext = translateStatementBlock(stmt.getTrueBranch(), trueContext);
if (stmt.hasFalseBranch()) {
falseContext = translateStatementBlock(stmt.getFalseBranch(), falseContext);
}
// Finally, we must join the two context's back together. This ensures
// that information from either side is properly preserved
return joinDescendants(context, new Context[] { trueContext, falseContext });
} | [
"private",
"Context",
"translateIf",
"(",
"WyilFile",
".",
"Stmt",
".",
"IfElse",
"stmt",
",",
"Context",
"context",
")",
"{",
"//",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p",
"=",
"translateExpressionWithChecks",
"(",
"stmt",
".",
"getCondition",
"(",
")",
",",
"null",
",",
"context",
")",
";",
"Expr",
"trueCondition",
"=",
"p",
".",
"first",
"(",
")",
";",
"// FIXME: this is broken as includes assumptions propagated through",
"// logical &&'s",
"context",
"=",
"p",
".",
"second",
"(",
")",
";",
"Expr",
"falseCondition",
"=",
"invertCondition",
"(",
"trueCondition",
",",
"stmt",
".",
"getCondition",
"(",
")",
")",
";",
"//",
"Context",
"trueContext",
"=",
"context",
".",
"assume",
"(",
"trueCondition",
")",
";",
"Context",
"falseContext",
"=",
"context",
".",
"assume",
"(",
"falseCondition",
")",
";",
"//",
"trueContext",
"=",
"translateStatementBlock",
"(",
"stmt",
".",
"getTrueBranch",
"(",
")",
",",
"trueContext",
")",
";",
"if",
"(",
"stmt",
".",
"hasFalseBranch",
"(",
")",
")",
"{",
"falseContext",
"=",
"translateStatementBlock",
"(",
"stmt",
".",
"getFalseBranch",
"(",
")",
",",
"falseContext",
")",
";",
"}",
"// Finally, we must join the two context's back together. This ensures",
"// that information from either side is properly preserved",
"return",
"joinDescendants",
"(",
"context",
",",
"new",
"Context",
"[",
"]",
"{",
"trueContext",
",",
"falseContext",
"}",
")",
";",
"}"
] | Translate an if statement. This translates the true and false branches and
then recombines them together to form an updated environment. This is
challenging when the environments are updated independently in both branches.
@param stmt
@param wyalFile | [
"Translate",
"an",
"if",
"statement",
".",
"This",
"translates",
"the",
"true",
"and",
"false",
"branches",
"and",
"then",
"recombines",
"them",
"together",
"to",
"form",
"an",
"updated",
"environment",
".",
"This",
"is",
"challenging",
"when",
"the",
"environments",
"are",
"updated",
"independently",
"in",
"both",
"branches",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L842-L861 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java | ShortExtensions.operator_divide | @Pure
@Inline(value="($1 / $2)", constantExpression=true)
public static long operator_divide(short a, long b) {
"""
The binary <code>divide</code> operator. This is the equivalent to the Java <code>/</code> operator.
@param a a short.
@param b a long.
@return <code>a/b</code>
@since 2.3
"""
return a / b;
} | java | @Pure
@Inline(value="($1 / $2)", constantExpression=true)
public static long operator_divide(short a, long b) {
return a / b;
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"($1 / $2)\"",
",",
"constantExpression",
"=",
"true",
")",
"public",
"static",
"long",
"operator_divide",
"(",
"short",
"a",
",",
"long",
"b",
")",
"{",
"return",
"a",
"/",
"b",
";",
"}"
] | The binary <code>divide</code> operator. This is the equivalent to the Java <code>/</code> operator.
@param a a short.
@param b a long.
@return <code>a/b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"divide<",
"/",
"code",
">",
"operator",
".",
"This",
"is",
"the",
"equivalent",
"to",
"the",
"Java",
"<code",
">",
"/",
"<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java#L527-L531 |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ProxyFilter.java | ProxyFilter.rewriteURI | public URI rewriteURI(RequestContext rc) throws URISyntaxException {
"""
Computes the URI where the request need to be transferred.
@param rc the request content
@return the URI
@throws URISyntaxException if the URI cannot be computed
"""
Request request = rc.request();
String path = request.path();
if (!path.startsWith(prefix)) {
return null;
}
return computeDestinationURI(request, path, proxyTo, prefix);
} | java | public URI rewriteURI(RequestContext rc) throws URISyntaxException {
Request request = rc.request();
String path = request.path();
if (!path.startsWith(prefix)) {
return null;
}
return computeDestinationURI(request, path, proxyTo, prefix);
} | [
"public",
"URI",
"rewriteURI",
"(",
"RequestContext",
"rc",
")",
"throws",
"URISyntaxException",
"{",
"Request",
"request",
"=",
"rc",
".",
"request",
"(",
")",
";",
"String",
"path",
"=",
"request",
".",
"path",
"(",
")",
";",
"if",
"(",
"!",
"path",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"computeDestinationURI",
"(",
"request",
",",
"path",
",",
"proxyTo",
",",
"prefix",
")",
";",
"}"
] | Computes the URI where the request need to be transferred.
@param rc the request content
@return the URI
@throws URISyntaxException if the URI cannot be computed | [
"Computes",
"the",
"URI",
"where",
"the",
"request",
"need",
"to",
"be",
"transferred",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/filters/ProxyFilter.java#L310-L318 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java | OptionsApi.optionsPutAsync | public com.squareup.okhttp.Call optionsPutAsync(OptionsPut body, final ApiCallback<OptionsPutResponseStatusSuccess> callback) throws ApiException {
"""
Add/Change/Delete options. (asynchronously)
The PUT operation will add, change or delete values in CloudCluster/Options.
@param body Body Data (required)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object
"""
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = optionsPutValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<OptionsPutResponseStatusSuccess>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call optionsPutAsync(OptionsPut body, final ApiCallback<OptionsPutResponseStatusSuccess> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = optionsPutValidateBeforeCall(body, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<OptionsPutResponseStatusSuccess>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"optionsPutAsync",
"(",
"OptionsPut",
"body",
",",
"final",
"ApiCallback",
"<",
"OptionsPutResponseStatusSuccess",
">",
"callback",
")",
"throws",
"ApiException",
"{",
"ProgressResponseBody",
".",
"ProgressListener",
"progressListener",
"=",
"null",
";",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"progressRequestListener",
"=",
"null",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"progressListener",
"=",
"new",
"ProgressResponseBody",
".",
"ProgressListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"update",
"(",
"long",
"bytesRead",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onDownloadProgress",
"(",
"bytesRead",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"progressRequestListener",
"=",
"new",
"ProgressRequestBody",
".",
"ProgressRequestListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onRequestProgress",
"(",
"long",
"bytesWritten",
",",
"long",
"contentLength",
",",
"boolean",
"done",
")",
"{",
"callback",
".",
"onUploadProgress",
"(",
"bytesWritten",
",",
"contentLength",
",",
"done",
")",
";",
"}",
"}",
";",
"}",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"optionsPutValidateBeforeCall",
"(",
"body",
",",
"progressListener",
",",
"progressRequestListener",
")",
";",
"Type",
"localVarReturnType",
"=",
"new",
"TypeToken",
"<",
"OptionsPutResponseStatusSuccess",
">",
"(",
")",
"{",
"}",
".",
"getType",
"(",
")",
";",
"apiClient",
".",
"executeAsync",
"(",
"call",
",",
"localVarReturnType",
",",
"callback",
")",
";",
"return",
"call",
";",
"}"
] | Add/Change/Delete options. (asynchronously)
The PUT operation will add, change or delete values in CloudCluster/Options.
@param body Body Data (required)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Add",
"/",
"Change",
"/",
"Delete",
"options",
".",
"(",
"asynchronously",
")",
"The",
"PUT",
"operation",
"will",
"add",
"change",
"or",
"delete",
"values",
"in",
"CloudCluster",
"/",
"Options",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java#L407-L432 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getBicubicInterpolationValue | protected Double getBicubicInterpolationValue(Double[][] values,
CoverageDataSourcePixel sourcePixelX,
CoverageDataSourcePixel sourcePixelY) {
"""
Get the bicubic interpolation coverage data value from the 4 x 4 coverage
data values
@param values
coverage data values
@param sourcePixelX
source pixel x
@param sourcePixelY
source pixel y
@return bicubic coverage data value
"""
return getBicubicInterpolationValue(values, sourcePixelX.getOffset(),
sourcePixelY.getOffset());
} | java | protected Double getBicubicInterpolationValue(Double[][] values,
CoverageDataSourcePixel sourcePixelX,
CoverageDataSourcePixel sourcePixelY) {
return getBicubicInterpolationValue(values, sourcePixelX.getOffset(),
sourcePixelY.getOffset());
} | [
"protected",
"Double",
"getBicubicInterpolationValue",
"(",
"Double",
"[",
"]",
"[",
"]",
"values",
",",
"CoverageDataSourcePixel",
"sourcePixelX",
",",
"CoverageDataSourcePixel",
"sourcePixelY",
")",
"{",
"return",
"getBicubicInterpolationValue",
"(",
"values",
",",
"sourcePixelX",
".",
"getOffset",
"(",
")",
",",
"sourcePixelY",
".",
"getOffset",
"(",
")",
")",
";",
"}"
] | Get the bicubic interpolation coverage data value from the 4 x 4 coverage
data values
@param values
coverage data values
@param sourcePixelX
source pixel x
@param sourcePixelY
source pixel y
@return bicubic coverage data value | [
"Get",
"the",
"bicubic",
"interpolation",
"coverage",
"data",
"value",
"from",
"the",
"4",
"x",
"4",
"coverage",
"data",
"values"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1191-L1196 |
Azure/azure-sdk-for-java | marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java | MarketplaceAgreementsInner.cancelAsync | public Observable<AgreementTermsInner> cancelAsync(String publisherId, String offerId, String planId) {
"""
Cancel marketplace terms.
@param publisherId Publisher identifier string of image being deployed.
@param offerId Offer identifier string of image being deployed.
@param planId Plan identifier string of image being deployed.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgreementTermsInner object
"""
return cancelWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | java | public Observable<AgreementTermsInner> cancelAsync(String publisherId, String offerId, String planId) {
return cancelWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() {
@Override
public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgreementTermsInner",
">",
"cancelAsync",
"(",
"String",
"publisherId",
",",
"String",
"offerId",
",",
"String",
"planId",
")",
"{",
"return",
"cancelWithServiceResponseAsync",
"(",
"publisherId",
",",
"offerId",
",",
"planId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"AgreementTermsInner",
">",
",",
"AgreementTermsInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"AgreementTermsInner",
"call",
"(",
"ServiceResponse",
"<",
"AgreementTermsInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Cancel marketplace terms.
@param publisherId Publisher identifier string of image being deployed.
@param offerId Offer identifier string of image being deployed.
@param planId Plan identifier string of image being deployed.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgreementTermsInner object | [
"Cancel",
"marketplace",
"terms",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java#L415-L422 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java | ArmeriaHttpUtil.toArmeria | public static HttpHeaders toArmeria(HttpResponse in) {
"""
Converts the headers of the given Netty HTTP/1.x response into Armeria HTTP/2 headers.
"""
final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
out.status(in.status().code());
// Add the HTTP headers which have not been consumed above
toArmeria(inHeaders, out);
return out;
} | java | public static HttpHeaders toArmeria(HttpResponse in) {
final io.netty.handler.codec.http.HttpHeaders inHeaders = in.headers();
final HttpHeaders out = new DefaultHttpHeaders(true, inHeaders.size());
out.status(in.status().code());
// Add the HTTP headers which have not been consumed above
toArmeria(inHeaders, out);
return out;
} | [
"public",
"static",
"HttpHeaders",
"toArmeria",
"(",
"HttpResponse",
"in",
")",
"{",
"final",
"io",
".",
"netty",
".",
"handler",
".",
"codec",
".",
"http",
".",
"HttpHeaders",
"inHeaders",
"=",
"in",
".",
"headers",
"(",
")",
";",
"final",
"HttpHeaders",
"out",
"=",
"new",
"DefaultHttpHeaders",
"(",
"true",
",",
"inHeaders",
".",
"size",
"(",
")",
")",
";",
"out",
".",
"status",
"(",
"in",
".",
"status",
"(",
")",
".",
"code",
"(",
")",
")",
";",
"// Add the HTTP headers which have not been consumed above",
"toArmeria",
"(",
"inHeaders",
",",
"out",
")",
";",
"return",
"out",
";",
"}"
] | Converts the headers of the given Netty HTTP/1.x response into Armeria HTTP/2 headers. | [
"Converts",
"the",
"headers",
"of",
"the",
"given",
"Netty",
"HTTP",
"/",
"1",
".",
"x",
"response",
"into",
"Armeria",
"HTTP",
"/",
"2",
"headers",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java#L551-L559 |
tomgibara/streams | src/main/java/com/tomgibara/streams/StreamBytes.java | StreamBytes.readStream | public ReadStream readStream() {
"""
Attaches a reader to the object. If there is already any attached reader,
the existing reader is returned. If a writer is attached to the object
when this method is called, the writer is closed and immediately detached
before the reader is created.
@return the reader attached to this object
"""
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | java | public ReadStream readStream() {
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | [
"public",
"ReadStream",
"readStream",
"(",
")",
"{",
"detachWriter",
"(",
")",
";",
"if",
"(",
"reader",
"==",
"null",
")",
"{",
"reader",
"=",
"new",
"BytesReadStream",
"(",
"bytes",
",",
"0",
",",
"length",
")",
";",
"}",
"return",
"reader",
";",
"}"
] | Attaches a reader to the object. If there is already any attached reader,
the existing reader is returned. If a writer is attached to the object
when this method is called, the writer is closed and immediately detached
before the reader is created.
@return the reader attached to this object | [
"Attaches",
"a",
"reader",
"to",
"the",
"object",
".",
"If",
"there",
"is",
"already",
"any",
"attached",
"reader",
"the",
"existing",
"reader",
"is",
"returned",
".",
"If",
"a",
"writer",
"is",
"attached",
"to",
"the",
"object",
"when",
"this",
"method",
"is",
"called",
"the",
"writer",
"is",
"closed",
"and",
"immediately",
"detached",
"before",
"the",
"reader",
"is",
"created",
"."
] | train | https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamBytes.java#L125-L131 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.startStandalone | public static ClusteringService startStandalone(String clusterName, Channel channel) {
"""
Starts a standalone clustering service which uses the supplied channel.
@param clusterName the name of the cluster to which the JGroups channel should connect; may not be null
@param channel a {@link Channel} instance, may not be {@code null}
@return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null
"""
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel);
clusteringService.init();
return clusteringService;
} | java | public static ClusteringService startStandalone(String clusterName, Channel channel) {
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel);
clusteringService.init();
return clusteringService;
} | [
"public",
"static",
"ClusteringService",
"startStandalone",
"(",
"String",
"clusterName",
",",
"Channel",
"channel",
")",
"{",
"ClusteringService",
"clusteringService",
"=",
"new",
"StandaloneClusteringService",
"(",
"clusterName",
",",
"channel",
")",
";",
"clusteringService",
".",
"init",
"(",
")",
";",
"return",
"clusteringService",
";",
"}"
] | Starts a standalone clustering service which uses the supplied channel.
@param clusterName the name of the cluster to which the JGroups channel should connect; may not be null
@param channel a {@link Channel} instance, may not be {@code null}
@return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null | [
"Starts",
"a",
"standalone",
"clustering",
"service",
"which",
"uses",
"the",
"supplied",
"channel",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L275-L279 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/formula/MassToFormulaTool.java | MassToFormulaTool.getMaxOccurence | private int getMaxOccurence(double massTo, int element_pos, int[] matrix, List<IIsotope> isoToCond_new) {
"""
Get the maximal occurrence of this List.
@param massTo
@param element_pos
@param matrix
@param elemToCond_new
@return The occurrence value
"""
double massIn = isoToCond_new.get(element_pos).getExactMass();
double massToM = massTo;
for (int i = 0; i < matrix.length; i++)
if (i != element_pos) if (matrix[i] != 0) massToM -= isoToCond_new.get(i).getExactMass() * matrix[i];
int value = (int) ((massToM + 1) / massIn);
return value;
} | java | private int getMaxOccurence(double massTo, int element_pos, int[] matrix, List<IIsotope> isoToCond_new) {
double massIn = isoToCond_new.get(element_pos).getExactMass();
double massToM = massTo;
for (int i = 0; i < matrix.length; i++)
if (i != element_pos) if (matrix[i] != 0) massToM -= isoToCond_new.get(i).getExactMass() * matrix[i];
int value = (int) ((massToM + 1) / massIn);
return value;
} | [
"private",
"int",
"getMaxOccurence",
"(",
"double",
"massTo",
",",
"int",
"element_pos",
",",
"int",
"[",
"]",
"matrix",
",",
"List",
"<",
"IIsotope",
">",
"isoToCond_new",
")",
"{",
"double",
"massIn",
"=",
"isoToCond_new",
".",
"get",
"(",
"element_pos",
")",
".",
"getExactMass",
"(",
")",
";",
"double",
"massToM",
"=",
"massTo",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"matrix",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"i",
"!=",
"element_pos",
")",
"if",
"(",
"matrix",
"[",
"i",
"]",
"!=",
"0",
")",
"massToM",
"-=",
"isoToCond_new",
".",
"get",
"(",
"i",
")",
".",
"getExactMass",
"(",
")",
"*",
"matrix",
"[",
"i",
"]",
";",
"int",
"value",
"=",
"(",
"int",
")",
"(",
"(",
"massToM",
"+",
"1",
")",
"/",
"massIn",
")",
";",
"return",
"value",
";",
"}"
] | Get the maximal occurrence of this List.
@param massTo
@param element_pos
@param matrix
@param elemToCond_new
@return The occurrence value | [
"Get",
"the",
"maximal",
"occurrence",
"of",
"this",
"List",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/formula/MassToFormulaTool.java#L469-L477 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/GeometryMetaData.java | GeometryMetaData.getMetaDataFromWKB | public static GeometryMetaData getMetaDataFromWKB(byte[] bytes) throws IOException {
"""
Read the first bytes of Geometry WKB.
@param bytes WKB Bytes
@return Geometry MetaData
@throws IOException If WKB meta is invalid (do not check the Geometry)
"""
ByteOrderDataInStream dis = new ByteOrderDataInStream();
dis.setInStream(new ByteArrayInStream(bytes));
// determine byte order
byte byteOrderWKB = dis.readByte();
// always set byte order, since it may change from geometry to geometry
int byteOrder = byteOrderWKB == WKBConstants.wkbNDR ? ByteOrderValues.LITTLE_ENDIAN : ByteOrderValues.BIG_ENDIAN;
dis.setOrder(byteOrder);
int typeInt = dis.readInt();
int geometryType = typeInt & 0xff;
// determine if Z values are present
boolean hasZ = (typeInt & 0x80000000) != 0;
int inputDimension = hasZ ? 3 : 2;
// determine if SRIDs are present
boolean hasSRID = (typeInt & 0x20000000) != 0;
int SRID = 0;
if (hasSRID) {
SRID = dis.readInt();
}
return new GeometryMetaData(inputDimension, hasSRID, hasZ, geometryType, SRID);
} | java | public static GeometryMetaData getMetaDataFromWKB(byte[] bytes) throws IOException {
ByteOrderDataInStream dis = new ByteOrderDataInStream();
dis.setInStream(new ByteArrayInStream(bytes));
// determine byte order
byte byteOrderWKB = dis.readByte();
// always set byte order, since it may change from geometry to geometry
int byteOrder = byteOrderWKB == WKBConstants.wkbNDR ? ByteOrderValues.LITTLE_ENDIAN : ByteOrderValues.BIG_ENDIAN;
dis.setOrder(byteOrder);
int typeInt = dis.readInt();
int geometryType = typeInt & 0xff;
// determine if Z values are present
boolean hasZ = (typeInt & 0x80000000) != 0;
int inputDimension = hasZ ? 3 : 2;
// determine if SRIDs are present
boolean hasSRID = (typeInt & 0x20000000) != 0;
int SRID = 0;
if (hasSRID) {
SRID = dis.readInt();
}
return new GeometryMetaData(inputDimension, hasSRID, hasZ, geometryType, SRID);
} | [
"public",
"static",
"GeometryMetaData",
"getMetaDataFromWKB",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"ByteOrderDataInStream",
"dis",
"=",
"new",
"ByteOrderDataInStream",
"(",
")",
";",
"dis",
".",
"setInStream",
"(",
"new",
"ByteArrayInStream",
"(",
"bytes",
")",
")",
";",
"// determine byte order",
"byte",
"byteOrderWKB",
"=",
"dis",
".",
"readByte",
"(",
")",
";",
"// always set byte order, since it may change from geometry to geometry",
"int",
"byteOrder",
"=",
"byteOrderWKB",
"==",
"WKBConstants",
".",
"wkbNDR",
"?",
"ByteOrderValues",
".",
"LITTLE_ENDIAN",
":",
"ByteOrderValues",
".",
"BIG_ENDIAN",
";",
"dis",
".",
"setOrder",
"(",
"byteOrder",
")",
";",
"int",
"typeInt",
"=",
"dis",
".",
"readInt",
"(",
")",
";",
"int",
"geometryType",
"=",
"typeInt",
"&",
"0xff",
";",
"// determine if Z values are present",
"boolean",
"hasZ",
"=",
"(",
"typeInt",
"&",
"0x80000000",
")",
"!=",
"0",
";",
"int",
"inputDimension",
"=",
"hasZ",
"?",
"3",
":",
"2",
";",
"// determine if SRIDs are present",
"boolean",
"hasSRID",
"=",
"(",
"typeInt",
"&",
"0x20000000",
")",
"!=",
"0",
";",
"int",
"SRID",
"=",
"0",
";",
"if",
"(",
"hasSRID",
")",
"{",
"SRID",
"=",
"dis",
".",
"readInt",
"(",
")",
";",
"}",
"return",
"new",
"GeometryMetaData",
"(",
"inputDimension",
",",
"hasSRID",
",",
"hasZ",
",",
"geometryType",
",",
"SRID",
")",
";",
"}"
] | Read the first bytes of Geometry WKB.
@param bytes WKB Bytes
@return Geometry MetaData
@throws IOException If WKB meta is invalid (do not check the Geometry) | [
"Read",
"the",
"first",
"bytes",
"of",
"Geometry",
"WKB",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/GeometryMetaData.java#L60-L82 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java | BcUtils.convertCertificate | public static CertifiedPublicKey convertCertificate(CertificateFactory certFactory, X509CertificateHolder cert) {
"""
Convert a Bouncy Castle certificate holder into a certified public key.
@param certFactory the certificate factory to be used for conversion.
@param cert the certificate to convert.
@return a certified public key wrapping equivalent to the provided holder.
@since 6.0M1
"""
if (cert == null) {
return null;
}
if (certFactory instanceof BcX509CertificateFactory) {
return ((BcX509CertificateFactory) certFactory).convert(cert);
} else {
try {
return certFactory.decode(cert.getEncoded());
} catch (IOException e) {
// Very unlikely
throw new IllegalArgumentException("Invalid Certificate, unable to encode", e);
}
}
} | java | public static CertifiedPublicKey convertCertificate(CertificateFactory certFactory, X509CertificateHolder cert)
{
if (cert == null) {
return null;
}
if (certFactory instanceof BcX509CertificateFactory) {
return ((BcX509CertificateFactory) certFactory).convert(cert);
} else {
try {
return certFactory.decode(cert.getEncoded());
} catch (IOException e) {
// Very unlikely
throw new IllegalArgumentException("Invalid Certificate, unable to encode", e);
}
}
} | [
"public",
"static",
"CertifiedPublicKey",
"convertCertificate",
"(",
"CertificateFactory",
"certFactory",
",",
"X509CertificateHolder",
"cert",
")",
"{",
"if",
"(",
"cert",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"certFactory",
"instanceof",
"BcX509CertificateFactory",
")",
"{",
"return",
"(",
"(",
"BcX509CertificateFactory",
")",
"certFactory",
")",
".",
"convert",
"(",
"cert",
")",
";",
"}",
"else",
"{",
"try",
"{",
"return",
"certFactory",
".",
"decode",
"(",
"cert",
".",
"getEncoded",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Very unlikely",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid Certificate, unable to encode\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Convert a Bouncy Castle certificate holder into a certified public key.
@param certFactory the certificate factory to be used for conversion.
@param cert the certificate to convert.
@return a certified public key wrapping equivalent to the provided holder.
@since 6.0M1 | [
"Convert",
"a",
"Bouncy",
"Castle",
"certificate",
"holder",
"into",
"a",
"certified",
"public",
"key",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java#L228-L244 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/convert/Convert.java | Convert.toCollection | public static Collection<?> toCollection(Class<?> collectionType, Class<?> elementType, Object value) {
"""
转换为集合类
@param collectionType 集合类型
@param elementType 集合中元素类型
@param value 被转换的值
@return {@link Collection}
@since 3.0.8
"""
return new CollectionConverter(collectionType, elementType).convert(value, null);
} | java | public static Collection<?> toCollection(Class<?> collectionType, Class<?> elementType, Object value) {
return new CollectionConverter(collectionType, elementType).convert(value, null);
} | [
"public",
"static",
"Collection",
"<",
"?",
">",
"toCollection",
"(",
"Class",
"<",
"?",
">",
"collectionType",
",",
"Class",
"<",
"?",
">",
"elementType",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"CollectionConverter",
"(",
"collectionType",
",",
"elementType",
")",
".",
"convert",
"(",
"value",
",",
"null",
")",
";",
"}"
] | 转换为集合类
@param collectionType 集合类型
@param elementType 集合中元素类型
@param value 被转换的值
@return {@link Collection}
@since 3.0.8 | [
"转换为集合类"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L500-L502 |
JoeKerouac/utils | src/main/java/com/joe/utils/poi/ExcelExecutor.java | ExcelExecutor.writeToExcel | public Workbook writeToExcel(List<? extends Object> datas, boolean hasTitle,
Workbook workbook) {
"""
将pojo集合写入excel
@param datas pojo集合,空元素将被忽略
@param hasTitle 是否需要title
@param workbook 工作簿
@return 写入后的工作簿
"""
return writeToExcel(datas, hasTitle, workbook, false);
} | java | public Workbook writeToExcel(List<? extends Object> datas, boolean hasTitle,
Workbook workbook) {
return writeToExcel(datas, hasTitle, workbook, false);
} | [
"public",
"Workbook",
"writeToExcel",
"(",
"List",
"<",
"?",
"extends",
"Object",
">",
"datas",
",",
"boolean",
"hasTitle",
",",
"Workbook",
"workbook",
")",
"{",
"return",
"writeToExcel",
"(",
"datas",
",",
"hasTitle",
",",
"workbook",
",",
"false",
")",
";",
"}"
] | 将pojo集合写入excel
@param datas pojo集合,空元素将被忽略
@param hasTitle 是否需要title
@param workbook 工作簿
@return 写入后的工作簿 | [
"将pojo集合写入excel"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/poi/ExcelExecutor.java#L262-L265 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java | ServerDnsAliasesInner.listByServerAsync | public Observable<Page<ServerDnsAliasInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
"""
Gets a list of server DNS aliases for a server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server that the alias is pointing to.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ServerDnsAliasInner> object
"""
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerDnsAliasInner>>, Page<ServerDnsAliasInner>>() {
@Override
public Page<ServerDnsAliasInner> call(ServiceResponse<Page<ServerDnsAliasInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ServerDnsAliasInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerDnsAliasInner>>, Page<ServerDnsAliasInner>>() {
@Override
public Page<ServerDnsAliasInner> call(ServiceResponse<Page<ServerDnsAliasInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ServerDnsAliasInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ServerDnsAliasInner",
">",
">",
",",
"Page",
"<",
"ServerDnsAliasInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"ServerDnsAliasInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"ServerDnsAliasInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a list of server DNS aliases for a server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server that the alias is pointing to.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ServerDnsAliasInner> object | [
"Gets",
"a",
"list",
"of",
"server",
"DNS",
"aliases",
"for",
"a",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L585-L593 |
petergeneric/stdlib | guice/common/src/main/java/com/peterphi/std/guice/restclient/exception/RestExceptionFactory.java | RestExceptionFactory.buildKnown | private RestException buildKnown(Constructor<RestException> constructor, RestFailure failure) {
"""
Build an exception for a known exception type
@param constructor
@param failure
@return
"""
try
{
return constructor.newInstance(failure.exception.detail, null);
}
catch (Exception e)
{
return buildUnknown(failure);
}
} | java | private RestException buildKnown(Constructor<RestException> constructor, RestFailure failure)
{
try
{
return constructor.newInstance(failure.exception.detail, null);
}
catch (Exception e)
{
return buildUnknown(failure);
}
} | [
"private",
"RestException",
"buildKnown",
"(",
"Constructor",
"<",
"RestException",
">",
"constructor",
",",
"RestFailure",
"failure",
")",
"{",
"try",
"{",
"return",
"constructor",
".",
"newInstance",
"(",
"failure",
".",
"exception",
".",
"detail",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"buildUnknown",
"(",
"failure",
")",
";",
"}",
"}"
] | Build an exception for a known exception type
@param constructor
@param failure
@return | [
"Build",
"an",
"exception",
"for",
"a",
"known",
"exception",
"type"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/restclient/exception/RestExceptionFactory.java#L70-L80 |
johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.setAnimation | public AppMsg setAnimation(Animation inAnimation, Animation outAnimation) {
"""
Sets the Animations to be used when displaying/removing the Crouton.
@param inAnimation the Animation to be used when displaying.
@param outAnimation the Animation to be used when removing.
"""
mInAnimation = inAnimation;
mOutAnimation = outAnimation;
return this;
} | java | public AppMsg setAnimation(Animation inAnimation, Animation outAnimation) {
mInAnimation = inAnimation;
mOutAnimation = outAnimation;
return this;
} | [
"public",
"AppMsg",
"setAnimation",
"(",
"Animation",
"inAnimation",
",",
"Animation",
"outAnimation",
")",
"{",
"mInAnimation",
"=",
"inAnimation",
";",
"mOutAnimation",
"=",
"outAnimation",
";",
"return",
"this",
";",
"}"
] | Sets the Animations to be used when displaying/removing the Crouton.
@param inAnimation the Animation to be used when displaying.
@param outAnimation the Animation to be used when removing. | [
"Sets",
"the",
"Animations",
"to",
"be",
"used",
"when",
"displaying",
"/",
"removing",
"the",
"Crouton",
"."
] | train | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L612-L616 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/NormalizationPoint2D.java | NormalizationPoint2D.apply | public void apply( DMatrixRMaj H , DMatrixRMaj output ) {
"""
Applies normalization to a H=3xN matrix
out = Norm*H
@param H 3xN matrix. Can be same as input matrix
"""
output.reshape(3,H.numCols);
int stride = H.numCols;
for (int col = 0; col < H.numCols; col++) {
// This column in H
double h1 = H.data[col], h2 = H.data[col+stride], h3 = H.data[col+2*stride];
output.data[col] = h1/stdX - meanX*h3/stdX;
output.data[col+stride] = h2/stdY - meanY*h3/stdY;
output.data[col+2*stride] = h3;
}
} | java | public void apply( DMatrixRMaj H , DMatrixRMaj output ) {
output.reshape(3,H.numCols);
int stride = H.numCols;
for (int col = 0; col < H.numCols; col++) {
// This column in H
double h1 = H.data[col], h2 = H.data[col+stride], h3 = H.data[col+2*stride];
output.data[col] = h1/stdX - meanX*h3/stdX;
output.data[col+stride] = h2/stdY - meanY*h3/stdY;
output.data[col+2*stride] = h3;
}
} | [
"public",
"void",
"apply",
"(",
"DMatrixRMaj",
"H",
",",
"DMatrixRMaj",
"output",
")",
"{",
"output",
".",
"reshape",
"(",
"3",
",",
"H",
".",
"numCols",
")",
";",
"int",
"stride",
"=",
"H",
".",
"numCols",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"H",
".",
"numCols",
";",
"col",
"++",
")",
"{",
"// This column in H",
"double",
"h1",
"=",
"H",
".",
"data",
"[",
"col",
"]",
",",
"h2",
"=",
"H",
".",
"data",
"[",
"col",
"+",
"stride",
"]",
",",
"h3",
"=",
"H",
".",
"data",
"[",
"col",
"+",
"2",
"*",
"stride",
"]",
";",
"output",
".",
"data",
"[",
"col",
"]",
"=",
"h1",
"/",
"stdX",
"-",
"meanX",
"*",
"h3",
"/",
"stdX",
";",
"output",
".",
"data",
"[",
"col",
"+",
"stride",
"]",
"=",
"h2",
"/",
"stdY",
"-",
"meanY",
"*",
"h3",
"/",
"stdY",
";",
"output",
".",
"data",
"[",
"col",
"+",
"2",
"*",
"stride",
"]",
"=",
"h3",
";",
"}",
"}"
] | Applies normalization to a H=3xN matrix
out = Norm*H
@param H 3xN matrix. Can be same as input matrix | [
"Applies",
"normalization",
"to",
"a",
"H",
"=",
"3xN",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/NormalizationPoint2D.java#L76-L87 |
alkacon/opencms-core | src/org/opencms/db/oracle/CmsUserDriver.java | CmsUserDriver.internalWriteUserInfo | @Override
protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value)
throws CmsDataAccessException {
"""
Writes a new additional user info.<p>
@param dbc the current dbc
@param userId the user id to add the user info for
@param key the name of the additional user info
@param value the value of the additional user info
@throws CmsDataAccessException if something goes wrong
"""
PreparedStatement stmt = null;
Connection conn = null;
try {
// get connection
conn = m_sqlManager.getConnection(dbc);
// write data to database
stmt = m_sqlManager.getPreparedStatement(conn, "C_ORACLE_USERDATA_WRITE_3");
stmt.setString(1, userId.toString());
stmt.setString(2, key);
stmt.setString(3, value.getClass().getName());
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
org.opencms.db.generic.Messages.get().container(
org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1,
CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
internalUpdateUserInfoData(dbc, userId, key, value);
} | java | @Override
protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value)
throws CmsDataAccessException {
PreparedStatement stmt = null;
Connection conn = null;
try {
// get connection
conn = m_sqlManager.getConnection(dbc);
// write data to database
stmt = m_sqlManager.getPreparedStatement(conn, "C_ORACLE_USERDATA_WRITE_3");
stmt.setString(1, userId.toString());
stmt.setString(2, key);
stmt.setString(3, value.getClass().getName());
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
org.opencms.db.generic.Messages.get().container(
org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1,
CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
internalUpdateUserInfoData(dbc, userId, key, value);
} | [
"@",
"Override",
"protected",
"void",
"internalWriteUserInfo",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"userId",
",",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"CmsDataAccessException",
"{",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"// get connection",
"conn",
"=",
"m_sqlManager",
".",
"getConnection",
"(",
"dbc",
")",
";",
"// write data to database",
"stmt",
"=",
"m_sqlManager",
".",
"getPreparedStatement",
"(",
"conn",
",",
"\"C_ORACLE_USERDATA_WRITE_3\"",
")",
";",
"stmt",
".",
"setString",
"(",
"1",
",",
"userId",
".",
"toString",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"key",
")",
";",
"stmt",
".",
"setString",
"(",
"3",
",",
"value",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"stmt",
".",
"executeUpdate",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"CmsDbSqlException",
"(",
"org",
".",
"opencms",
".",
"db",
".",
"generic",
".",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"org",
".",
"opencms",
".",
"db",
".",
"generic",
".",
"Messages",
".",
"ERR_GENERIC_SQL_1",
",",
"CmsDbSqlException",
".",
"getErrorQuery",
"(",
"stmt",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"m_sqlManager",
".",
"closeAll",
"(",
"dbc",
",",
"conn",
",",
"stmt",
",",
"null",
")",
";",
"}",
"internalUpdateUserInfoData",
"(",
"dbc",
",",
"userId",
",",
"key",
",",
"value",
")",
";",
"}"
] | Writes a new additional user info.<p>
@param dbc the current dbc
@param userId the user id to add the user info for
@param key the name of the additional user info
@param value the value of the additional user info
@throws CmsDataAccessException if something goes wrong | [
"Writes",
"a",
"new",
"additional",
"user",
"info",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/oracle/CmsUserDriver.java#L261-L289 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.getEmbeddedIPv4AddressSection | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
"""
Produces an IPv4 address section from any sequence of bytes in this IPv6 address section
@param startIndex the byte index in this section to start from
@param endIndex the byte index in this section to end at
@throws IndexOutOfBoundsException
@return
@see #getEmbeddedIPv4AddressSection()
@see #getMixedAddressSection()
"""
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
IPv4AddressSegment[] segments = creator.createSegmentArray((endIndex - startIndex) >> 1);
int i = startIndex, j = 0;
if(i % IPv6Address.BYTES_PER_SEGMENT == 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
i++;
ipv6Segment.getSplitSegments(segments, j - 1, creator);
j++;
}
for(; i < endIndex; i <<= 1, j <<= 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
ipv6Segment.getSplitSegments(segments, j, creator);
}
return createEmbeddedSection(creator, segments, this);
} | java | public IPv4AddressSection getEmbeddedIPv4AddressSection(int startIndex, int endIndex) {
if(startIndex == ((IPv6Address.MIXED_ORIGINAL_SEGMENT_COUNT - this.addressSegmentIndex) << 1) && endIndex == (getSegmentCount() << 1)) {
return getEmbeddedIPv4AddressSection();
}
IPv4AddressCreator creator = getIPv4Network().getAddressCreator();
IPv4AddressSegment[] segments = creator.createSegmentArray((endIndex - startIndex) >> 1);
int i = startIndex, j = 0;
if(i % IPv6Address.BYTES_PER_SEGMENT == 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
i++;
ipv6Segment.getSplitSegments(segments, j - 1, creator);
j++;
}
for(; i < endIndex; i <<= 1, j <<= 1) {
IPv6AddressSegment ipv6Segment = getSegment(i >> 1);
ipv6Segment.getSplitSegments(segments, j, creator);
}
return createEmbeddedSection(creator, segments, this);
} | [
"public",
"IPv4AddressSection",
"getEmbeddedIPv4AddressSection",
"(",
"int",
"startIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"startIndex",
"==",
"(",
"(",
"IPv6Address",
".",
"MIXED_ORIGINAL_SEGMENT_COUNT",
"-",
"this",
".",
"addressSegmentIndex",
")",
"<<",
"1",
")",
"&&",
"endIndex",
"==",
"(",
"getSegmentCount",
"(",
")",
"<<",
"1",
")",
")",
"{",
"return",
"getEmbeddedIPv4AddressSection",
"(",
")",
";",
"}",
"IPv4AddressCreator",
"creator",
"=",
"getIPv4Network",
"(",
")",
".",
"getAddressCreator",
"(",
")",
";",
"IPv4AddressSegment",
"[",
"]",
"segments",
"=",
"creator",
".",
"createSegmentArray",
"(",
"(",
"endIndex",
"-",
"startIndex",
")",
">>",
"1",
")",
";",
"int",
"i",
"=",
"startIndex",
",",
"j",
"=",
"0",
";",
"if",
"(",
"i",
"%",
"IPv6Address",
".",
"BYTES_PER_SEGMENT",
"==",
"1",
")",
"{",
"IPv6AddressSegment",
"ipv6Segment",
"=",
"getSegment",
"(",
"i",
">>",
"1",
")",
";",
"i",
"++",
";",
"ipv6Segment",
".",
"getSplitSegments",
"(",
"segments",
",",
"j",
"-",
"1",
",",
"creator",
")",
";",
"j",
"++",
";",
"}",
"for",
"(",
";",
"i",
"<",
"endIndex",
";",
"i",
"<<=",
"1",
",",
"j",
"<<=",
"1",
")",
"{",
"IPv6AddressSegment",
"ipv6Segment",
"=",
"getSegment",
"(",
"i",
">>",
"1",
")",
";",
"ipv6Segment",
".",
"getSplitSegments",
"(",
"segments",
",",
"j",
",",
"creator",
")",
";",
"}",
"return",
"createEmbeddedSection",
"(",
"creator",
",",
"segments",
",",
"this",
")",
";",
"}"
] | Produces an IPv4 address section from any sequence of bytes in this IPv6 address section
@param startIndex the byte index in this section to start from
@param endIndex the byte index in this section to end at
@throws IndexOutOfBoundsException
@return
@see #getEmbeddedIPv4AddressSection()
@see #getMixedAddressSection() | [
"Produces",
"an",
"IPv4",
"address",
"section",
"from",
"any",
"sequence",
"of",
"bytes",
"in",
"this",
"IPv6",
"address",
"section"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1258-L1276 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.daysBetween | @Restricted(NoExternalUse.class)
public static long daysBetween(@Nonnull Date a, @Nonnull Date b) {
"""
Compute the number of calendar days elapsed since the given date.
As it's only the calendar days difference that matter, "11.00pm" to "2.00am the day after" returns 1,
even if there are only 3 hours between. As well as "10am" to "2pm" both on the same day, returns 0.
"""
LocalDate aLocal = a.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate bLocal = b.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return ChronoUnit.DAYS.between(aLocal, bLocal);
} | java | @Restricted(NoExternalUse.class)
public static long daysBetween(@Nonnull Date a, @Nonnull Date b){
LocalDate aLocal = a.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
LocalDate bLocal = b.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
return ChronoUnit.DAYS.between(aLocal, bLocal);
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"static",
"long",
"daysBetween",
"(",
"@",
"Nonnull",
"Date",
"a",
",",
"@",
"Nonnull",
"Date",
"b",
")",
"{",
"LocalDate",
"aLocal",
"=",
"a",
".",
"toInstant",
"(",
")",
".",
"atZone",
"(",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
".",
"toLocalDate",
"(",
")",
";",
"LocalDate",
"bLocal",
"=",
"b",
".",
"toInstant",
"(",
")",
".",
"atZone",
"(",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
".",
"toLocalDate",
"(",
")",
";",
"return",
"ChronoUnit",
".",
"DAYS",
".",
"between",
"(",
"aLocal",
",",
"bLocal",
")",
";",
"}"
] | Compute the number of calendar days elapsed since the given date.
As it's only the calendar days difference that matter, "11.00pm" to "2.00am the day after" returns 1,
even if there are only 3 hours between. As well as "10am" to "2pm" both on the same day, returns 0. | [
"Compute",
"the",
"number",
"of",
"calendar",
"days",
"elapsed",
"since",
"the",
"given",
"date",
".",
"As",
"it",
"s",
"only",
"the",
"calendar",
"days",
"difference",
"that",
"matter",
"11",
".",
"00pm",
"to",
"2",
".",
"00am",
"the",
"day",
"after",
"returns",
"1",
"even",
"if",
"there",
"are",
"only",
"3",
"hours",
"between",
".",
"As",
"well",
"as",
"10am",
"to",
"2pm",
"both",
"on",
"the",
"same",
"day",
"returns",
"0",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L1512-L1517 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.bean2Another | public static <T> T bean2Another(Object object, T another) throws InvocationTargetException,
IllegalAccessException {
"""
将一个Bean的数据装换到另外一个(需实现setter和getter)
@param object 一个Bean
@param another 另外一个Bean对象
@param <T> 另外Bean类型
@return {@link T}
@throws IllegalAccessException 异常
@throws InvocationTargetException 异常
@since 1.1.1
"""
return bean2Another(object, another.getClass(), another);
} | java | public static <T> T bean2Another(Object object, T another) throws InvocationTargetException,
IllegalAccessException {
return bean2Another(object, another.getClass(), another);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"bean2Another",
"(",
"Object",
"object",
",",
"T",
"another",
")",
"throws",
"InvocationTargetException",
",",
"IllegalAccessException",
"{",
"return",
"bean2Another",
"(",
"object",
",",
"another",
".",
"getClass",
"(",
")",
",",
"another",
")",
";",
"}"
] | 将一个Bean的数据装换到另外一个(需实现setter和getter)
@param object 一个Bean
@param another 另外一个Bean对象
@param <T> 另外Bean类型
@return {@link T}
@throws IllegalAccessException 异常
@throws InvocationTargetException 异常
@since 1.1.1 | [
"将一个Bean的数据装换到另外一个(需实现setter和getter)"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L44-L47 |
centic9/commons-dost | src/main/java/org/dstadler/commons/net/UrlUtils.java | UrlUtils.retrieveData | public static String retrieveData(String sUrl, String encoding, int timeout, SSLSocketFactory sslFactory) throws IOException {
"""
Download data from an URL, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param timeout The timeout in milliseconds that is used for both
connection timeout and read timeout.
@param sslFactory The SSLFactory to use for the connection, this allows to support custom SSL certificates
@return The resulting data, e.g. a HTML string.
@throws IOException If accessing the resource fails.
"""
byte[] rawData = retrieveRawData(sUrl, timeout, sslFactory);
if(encoding == null) {
return new String(rawData); // NOSONAR
}
return new String(rawData, encoding);
} | java | public static String retrieveData(String sUrl, String encoding, int timeout, SSLSocketFactory sslFactory) throws IOException {
byte[] rawData = retrieveRawData(sUrl, timeout, sslFactory);
if(encoding == null) {
return new String(rawData); // NOSONAR
}
return new String(rawData, encoding);
} | [
"public",
"static",
"String",
"retrieveData",
"(",
"String",
"sUrl",
",",
"String",
"encoding",
",",
"int",
"timeout",
",",
"SSLSocketFactory",
"sslFactory",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"rawData",
"=",
"retrieveRawData",
"(",
"sUrl",
",",
"timeout",
",",
"sslFactory",
")",
";",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"rawData",
")",
";",
"// NOSONAR",
"}",
"return",
"new",
"String",
"(",
"rawData",
",",
"encoding",
")",
";",
"}"
] | Download data from an URL, if necessary converting from a character encoding.
@param sUrl The full URL used to download the content.
@param encoding An encoding, e.g. UTF-8, ISO-8859-15. Can be null.
@param timeout The timeout in milliseconds that is used for both
connection timeout and read timeout.
@param sslFactory The SSLFactory to use for the connection, this allows to support custom SSL certificates
@return The resulting data, e.g. a HTML string.
@throws IOException If accessing the resource fails. | [
"Download",
"data",
"from",
"an",
"URL",
"if",
"necessary",
"converting",
"from",
"a",
"character",
"encoding",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/UrlUtils.java#L81-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.