repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/records/RetentionSet.java | RetentionSet.removeStreamCutBefore | public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set;
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of());
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} | java | public static RetentionSet removeStreamCutBefore(RetentionSet set, StreamCutReferenceRecord record) {
Preconditions.checkNotNull(record);
// remove all stream cuts with recordingTime before supplied cut
int beforeIndex = getGreatestLowerBound(set, record.getRecordingTime(), StreamCutReferenceRecord::getRecordingTime);
if (beforeIndex < 0) {
return set;
}
if (beforeIndex + 1 == set.retentionRecords.size()) {
return new RetentionSet(ImmutableList.of());
}
return new RetentionSet(set.retentionRecords.subList(beforeIndex + 1, set.retentionRecords.size()));
} | [
"public",
"static",
"RetentionSet",
"removeStreamCutBefore",
"(",
"RetentionSet",
"set",
",",
"StreamCutReferenceRecord",
"record",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"record",
")",
";",
"// remove all stream cuts with recordingTime before supplied cut",
"in... | Creates a new retention set object by removing all records on or before given record.
@param set retention set to update
@param record reference record
@return updated retention set record after removing all elements before given reference record. | [
"Creates",
"a",
"new",
"retention",
"set",
"object",
"by",
"removing",
"all",
"records",
"on",
"or",
"before",
"given",
"record",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/RetentionSet.java#L109-L122 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java | DeLiClu.reinsertExpanded | private void reinsertExpanded(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluTree index, IndexTreePath<DeLiCluEntry> path, DataStore<KNNList> knns) {
int l = 0; // Count the number of components.
for(IndexTreePath<DeLiCluEntry> it = path; it != null; it = it.getParentPath()) {
l++;
}
ArrayList<IndexTreePath<DeLiCluEntry>> p = new ArrayList<>(l - 1);
// All except the last (= root).
IndexTreePath<DeLiCluEntry> it = path;
for(; it.getParentPath() != null; it = it.getParentPath()) {
p.add(it);
}
assert (p.size() == l - 1);
DeLiCluEntry rootEntry = it.getEntry();
reinsertExpanded(distFunction, index, p, l - 2, rootEntry, knns);
} | java | private void reinsertExpanded(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluTree index, IndexTreePath<DeLiCluEntry> path, DataStore<KNNList> knns) {
int l = 0; // Count the number of components.
for(IndexTreePath<DeLiCluEntry> it = path; it != null; it = it.getParentPath()) {
l++;
}
ArrayList<IndexTreePath<DeLiCluEntry>> p = new ArrayList<>(l - 1);
// All except the last (= root).
IndexTreePath<DeLiCluEntry> it = path;
for(; it.getParentPath() != null; it = it.getParentPath()) {
p.add(it);
}
assert (p.size() == l - 1);
DeLiCluEntry rootEntry = it.getEntry();
reinsertExpanded(distFunction, index, p, l - 2, rootEntry, knns);
} | [
"private",
"void",
"reinsertExpanded",
"(",
"SpatialPrimitiveDistanceFunction",
"<",
"V",
">",
"distFunction",
",",
"DeLiCluTree",
"index",
",",
"IndexTreePath",
"<",
"DeLiCluEntry",
">",
"path",
",",
"DataStore",
"<",
"KNNList",
">",
"knns",
")",
"{",
"int",
"l... | Reinserts the objects of the already expanded nodes.
@param distFunction the spatial distance function of this algorithm
@param index the index storing the objects
@param path the path of the object inserted last
@param knns the knn list | [
"Reinserts",
"the",
"objects",
"of",
"the",
"already",
"expanded",
"nodes",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java#L299-L313 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java | BTools.getSDbl | public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ) {
//
String PlusSign = "";
//
if ( ShowPlusSign && Value > 0 ) PlusSign = "+";
if ( ShowPlusSign && Value == 0 ) PlusSign = " ";
//
return PlusSign + getSDbl( Value, DecPrec );
} | java | public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ) {
//
String PlusSign = "";
//
if ( ShowPlusSign && Value > 0 ) PlusSign = "+";
if ( ShowPlusSign && Value == 0 ) PlusSign = " ";
//
return PlusSign + getSDbl( Value, DecPrec );
} | [
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
",",
"int",
"DecPrec",
",",
"boolean",
"ShowPlusSign",
")",
"{",
"//",
"String",
"PlusSign",
"=",
"\"\"",
";",
"//",
"if",
"(",
"ShowPlusSign",
"&&",
"Value",
">",
"0",
")",
"PlusSign",
"="... | <b>getSDbl</b><br>
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign )<br>
Returns double converted to string.<br>
If Value is Double.NaN returns "NaN".<br>
If DecPrec is < 0 is DecPrec set 0.<br>
If ShowPlusSign is true:<br>
- If Value is > 0 sign is '+'.<br>
- If Value is 0 sign is ' '.<br>
@param Value - value
@param DecPrec - decimal precision
@param ShowPlusSign - show plus sign
@return double as string | [
"<b",
">",
"getSDbl<",
"/",
"b",
">",
"<br",
">",
"public",
"static",
"String",
"getSDbl",
"(",
"double",
"Value",
"int",
"DecPrec",
"boolean",
"ShowPlusSign",
")",
"<br",
">",
"Returns",
"double",
"converted",
"to",
"string",
".",
"<br",
">",
"If",
"Val... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java#L193-L201 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.put | public static void put(Writer writer, Enum<?> value) throws IOException {
if (value == null) {
writer.write("null");
} else {
writer.write("\"");
writer.write(sanitize(value.name()));
writer.write("\"");
}
} | java | public static void put(Writer writer, Enum<?> value) throws IOException {
if (value == null) {
writer.write("null");
} else {
writer.write("\"");
writer.write(sanitize(value.name()));
writer.write("\"");
}
} | [
"public",
"static",
"void",
"put",
"(",
"Writer",
"writer",
",",
"Enum",
"<",
"?",
">",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"wr... | Writes the given value with the given writer.
@param writer
@param value
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L585-L593 |
google/auto | value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java | AutoValueOrOneOfProcessor.fixReservedIdentifiers | static void fixReservedIdentifiers(Map<?, String> methodToIdentifier) {
for (Map.Entry<?, String> entry : methodToIdentifier.entrySet()) {
if (SourceVersion.isKeyword(entry.getValue())) {
entry.setValue(disambiguate(entry.getValue(), methodToIdentifier.values()));
}
}
} | java | static void fixReservedIdentifiers(Map<?, String> methodToIdentifier) {
for (Map.Entry<?, String> entry : methodToIdentifier.entrySet()) {
if (SourceVersion.isKeyword(entry.getValue())) {
entry.setValue(disambiguate(entry.getValue(), methodToIdentifier.values()));
}
}
} | [
"static",
"void",
"fixReservedIdentifiers",
"(",
"Map",
"<",
"?",
",",
"String",
">",
"methodToIdentifier",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
",",
"String",
">",
"entry",
":",
"methodToIdentifier",
".",
"entrySet",
"(",
")",
")",
"{",
... | Modifies the values of the given map to avoid reserved words. If we have a getter called {@code
getPackage()} then we can't use the identifier {@code package} to represent its value since
that's a reserved word. | [
"Modifies",
"the",
"values",
"of",
"the",
"given",
"map",
"to",
"avoid",
"reserved",
"words",
".",
"If",
"we",
"have",
"a",
"getter",
"called",
"{"
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AutoValueOrOneOfProcessor.java#L639-L645 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.importMethodWithServiceResponseAsync | public Observable<ServiceResponse<String>> importMethodWithServiceResponseAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (luisApp == null) {
throw new IllegalArgumentException("Parameter luisApp is required and cannot be null.");
}
Validator.validate(luisApp);
final String versionId = importMethodOptionalParameter != null ? importMethodOptionalParameter.versionId() : null;
return importMethodWithServiceResponseAsync(appId, luisApp, versionId);
} | java | public Observable<ServiceResponse<String>> importMethodWithServiceResponseAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (luisApp == null) {
throw new IllegalArgumentException("Parameter luisApp is required and cannot be null.");
}
Validator.validate(luisApp);
final String versionId = importMethodOptionalParameter != null ? importMethodOptionalParameter.versionId() : null;
return importMethodWithServiceResponseAsync(appId, luisApp, versionId);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"String",
">",
">",
"importMethodWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"LuisApp",
"luisApp",
",",
"ImportMethodVersionsOptionalParameter",
"importMethodOptionalParameter",
")",
"{",
"if",
"(",
"this",
... | Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the String object | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L919-L933 |
tdunning/t-digest | core/src/main/java/com/tdunning/math/stats/Sort.java | Sort.insertionSort | @SuppressWarnings("SameParameterValue")
private static void insertionSort(int[] order, double[] values, int start, int n, int limit) {
for (int i = start + 1; i < n; i++) {
int t = order[i];
double v = values[order[i]];
int m = Math.max(i - limit, start);
for (int j = i; j >= m; j--) {
if (j == 0 || values[order[j - 1]] <= v) {
if (j < i) {
System.arraycopy(order, j, order, j + 1, i - j);
order[j] = t;
}
break;
}
}
}
} | java | @SuppressWarnings("SameParameterValue")
private static void insertionSort(int[] order, double[] values, int start, int n, int limit) {
for (int i = start + 1; i < n; i++) {
int t = order[i];
double v = values[order[i]];
int m = Math.max(i - limit, start);
for (int j = i; j >= m; j--) {
if (j == 0 || values[order[j - 1]] <= v) {
if (j < i) {
System.arraycopy(order, j, order, j + 1, i - j);
order[j] = t;
}
break;
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"private",
"static",
"void",
"insertionSort",
"(",
"int",
"[",
"]",
"order",
",",
"double",
"[",
"]",
"values",
",",
"int",
"start",
",",
"int",
"n",
",",
"int",
"limit",
")",
"{",
"for",
"(",
... | Limited range insertion sort. We assume that no element has to move more than limit steps
because quick sort has done its thing.
@param order The permutation index
@param values The values we are sorting
@param start Where to start the sort
@param n How many elements to sort
@param limit The largest amount of disorder | [
"Limited",
"range",
"insertion",
"sort",
".",
"We",
"assume",
"that",
"no",
"element",
"has",
"to",
"move",
"more",
"than",
"limit",
"steps",
"because",
"quick",
"sort",
"has",
"done",
"its",
"thing",
"."
] | train | https://github.com/tdunning/t-digest/blob/0820b016fefc1f66fe3b089cec9b4ba220da4ef1/core/src/main/java/com/tdunning/math/stats/Sort.java#L423-L439 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSasDefinitionAsync | public Observable<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() {
@Override
public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) {
return response.body();
}
});
} | java | public Observable<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<DeletedSasDefinitionBundle>, DeletedSasDefinitionBundle>() {
@Override
public DeletedSasDefinitionBundle call(ServiceResponse<DeletedSasDefinitionBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DeletedSasDefinitionBundle",
">",
"getDeletedSasDefinitionAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
")",
"{",
"return",
"getDeletedSasDefinitionWithServiceResponseAsync",
"(",
... | Gets the specified deleted sas definition.
The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DeletedSasDefinitionBundle object | [
"Gets",
"the",
"specified",
"deleted",
"sas",
"definition",
".",
"The",
"Get",
"Deleted",
"SAS",
"Definition",
"operation",
"returns",
"the",
"specified",
"deleted",
"SAS",
"definition",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10909-L10916 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java | PdfFileSpecification.fileEmbedded | public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[]) throws IOException {
return fileEmbedded(writer, filePath, fileDisplay, fileStore, PdfStream.BEST_COMPRESSION);
} | java | public static PdfFileSpecification fileEmbedded(PdfWriter writer, String filePath, String fileDisplay, byte fileStore[]) throws IOException {
return fileEmbedded(writer, filePath, fileDisplay, fileStore, PdfStream.BEST_COMPRESSION);
} | [
"public",
"static",
"PdfFileSpecification",
"fileEmbedded",
"(",
"PdfWriter",
"writer",
",",
"String",
"filePath",
",",
"String",
"fileDisplay",
",",
"byte",
"fileStore",
"[",
"]",
")",
"throws",
"IOException",
"{",
"return",
"fileEmbedded",
"(",
"writer",
",",
... | Creates a file specification with the file embedded. The file may
come from the file system or from a byte array. The data is flate compressed.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@param fileDisplay the file information that is presented to the user
@param fileStore the byte array with the file. If it is not <CODE>null</CODE>
it takes precedence over <CODE>filePath</CODE>
@throws IOException on error
@return the file specification | [
"Creates",
"a",
"file",
"specification",
"with",
"the",
"file",
"embedded",
".",
"The",
"file",
"may",
"come",
"from",
"the",
"file",
"system",
"or",
"from",
"a",
"byte",
"array",
".",
"The",
"data",
"is",
"flate",
"compressed",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L95-L97 |
pietermartin/sqlg | sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java | AbstractLabel.removeColumn | void removeColumn(String schema, String table, String column) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema));
sql.append(".");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table));
sql.append(" DROP COLUMN IF EXISTS ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(column));
if (sqlgGraph.getSqlDialect().supportsCascade()) {
sql.append(" CASCADE");
}
if (sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";");
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
Connection conn = sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | java | void removeColumn(String schema, String table, String column) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema));
sql.append(".");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table));
sql.append(" DROP COLUMN IF EXISTS ");
sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(column));
if (sqlgGraph.getSqlDialect().supportsCascade()) {
sql.append(" CASCADE");
}
if (sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";");
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
Connection conn = sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | [
"void",
"removeColumn",
"(",
"String",
"schema",
",",
"String",
"table",
",",
"String",
"column",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"ALTER TABLE \"",
")",
";",
"sql",
".",
"append",
"(",
"sqlgGraph",
".",
"getSqlDialect",
... | remove a column from the table
@param schema the schema
@param table the table name
@param column the column name | [
"remove",
"a",
"column",
"from",
"the",
"table"
] | train | https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1002-L1024 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationImpl_CustomFieldSerializer.java | OWLAnnotationImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnnotationImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLAnnotationImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnnotationImpl_CustomFieldSerializer.java#L71-L74 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java | JobStreamsInner.getAsync | public Observable<JobStreamInner> getAsync(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).map(new Func1<ServiceResponse<JobStreamInner>, JobStreamInner>() {
@Override
public JobStreamInner call(ServiceResponse<JobStreamInner> response) {
return response.body();
}
});
} | java | public Observable<JobStreamInner> getAsync(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).map(new Func1<ServiceResponse<JobStreamInner>, JobStreamInner>() {
@Override
public JobStreamInner call(ServiceResponse<JobStreamInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobStreamInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"jobId",
",",
"String",
"jobStreamId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",... | Retrieve the job stream identified by job stream id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@param jobStreamId The job stream id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobStreamInner object | [
"Retrieve",
"the",
"job",
"stream",
"identified",
"by",
"job",
"stream",
"id",
"."
] | 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/JobStreamsInner.java#L115-L122 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java | DatabaseURIHelper.changesUri | public URI changesUri(String queryKey, Object queryValue) {
if(queryKey.equals("since")){
if(!(queryValue instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
queryValue = gson.toJson(queryValue);
}
}
return this.path("_changes").query(queryKey, queryValue).build();
} | java | public URI changesUri(String queryKey, Object queryValue) {
if(queryKey.equals("since")){
if(!(queryValue instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
queryValue = gson.toJson(queryValue);
}
}
return this.path("_changes").query(queryKey, queryValue).build();
} | [
"public",
"URI",
"changesUri",
"(",
"String",
"queryKey",
",",
"Object",
"queryValue",
")",
"{",
"if",
"(",
"queryKey",
".",
"equals",
"(",
"\"since\"",
")",
")",
"{",
"if",
"(",
"!",
"(",
"queryValue",
"instanceof",
"String",
")",
")",
"{",
"//json enco... | Returns URI for {@code _changes} endpoint using passed
{@code query}. | [
"Returns",
"URI",
"for",
"{"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java#L91-L101 |
autermann/yaml | src/main/java/com/github/autermann/yaml/YamlNodeRepresenter.java | YamlNodeRepresenter.delegate | private MappingNode delegate(Tag tag,
Iterable<Entry<YamlNode, YamlNode>> mapping) {
List<NodeTuple> value = new LinkedList<>();
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(objectToRepresent, node);
boolean bestStyle = true;
for (Map.Entry<?, ?> entry : mapping) {
Node nodeKey = representData(entry.getKey());
Node nodeValue = representData(entry.getValue());
bestStyle = bestStyle(nodeKey, bestStyle);
bestStyle = bestStyle(nodeValue, bestStyle);
value.add(new NodeTuple(nodeKey, nodeValue));
}
if (getDefaultFlowStyle() != FlowStyle.AUTO) {
node.setFlowStyle(getDefaultFlowStyle().getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
} | java | private MappingNode delegate(Tag tag,
Iterable<Entry<YamlNode, YamlNode>> mapping) {
List<NodeTuple> value = new LinkedList<>();
MappingNode node = new MappingNode(tag, value, null);
representedObjects.put(objectToRepresent, node);
boolean bestStyle = true;
for (Map.Entry<?, ?> entry : mapping) {
Node nodeKey = representData(entry.getKey());
Node nodeValue = representData(entry.getValue());
bestStyle = bestStyle(nodeKey, bestStyle);
bestStyle = bestStyle(nodeValue, bestStyle);
value.add(new NodeTuple(nodeKey, nodeValue));
}
if (getDefaultFlowStyle() != FlowStyle.AUTO) {
node.setFlowStyle(getDefaultFlowStyle().getStyleBoolean());
} else {
node.setFlowStyle(bestStyle);
}
return node;
} | [
"private",
"MappingNode",
"delegate",
"(",
"Tag",
"tag",
",",
"Iterable",
"<",
"Entry",
"<",
"YamlNode",
",",
"YamlNode",
">",
">",
"mapping",
")",
"{",
"List",
"<",
"NodeTuple",
">",
"value",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"MappingNode",... | Create a {@link MappingNode} from the specified entries and tag.
@param tag the tag
@param mapping the entries
@return the mapping node | [
"Create",
"a",
"{",
"@link",
"MappingNode",
"}",
"from",
"the",
"specified",
"entries",
"and",
"tag",
"."
] | train | https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/YamlNodeRepresenter.java#L162-L182 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/ui/A_CmsPreviewDialog.java | A_CmsPreviewDialog.confirmSaveChanges | public void confirmSaveChanges(String message, final Command onConfirm, final Command onCancel) {
CmsConfirmDialog confirmDialog = new CmsConfirmDialog("Confirm", message);
confirmDialog.setHandler(new I_CmsConfirmDialogHandler() {
/**
* @see org.opencms.gwt.client.ui.I_CmsCloseDialogHandler#onClose()
*/
public void onClose() {
if (onCancel != null) {
onCancel.execute();
}
}
/**
* @see org.opencms.gwt.client.ui.I_CmsConfirmDialogHandler#onOk()
*/
public void onOk() {
if (onConfirm != null) {
onConfirm.execute();
}
}
});
confirmDialog.center();
} | java | public void confirmSaveChanges(String message, final Command onConfirm, final Command onCancel) {
CmsConfirmDialog confirmDialog = new CmsConfirmDialog("Confirm", message);
confirmDialog.setHandler(new I_CmsConfirmDialogHandler() {
/**
* @see org.opencms.gwt.client.ui.I_CmsCloseDialogHandler#onClose()
*/
public void onClose() {
if (onCancel != null) {
onCancel.execute();
}
}
/**
* @see org.opencms.gwt.client.ui.I_CmsConfirmDialogHandler#onOk()
*/
public void onOk() {
if (onConfirm != null) {
onConfirm.execute();
}
}
});
confirmDialog.center();
} | [
"public",
"void",
"confirmSaveChanges",
"(",
"String",
"message",
",",
"final",
"Command",
"onConfirm",
",",
"final",
"Command",
"onCancel",
")",
"{",
"CmsConfirmDialog",
"confirmDialog",
"=",
"new",
"CmsConfirmDialog",
"(",
"\"Confirm\"",
",",
"message",
")",
";"... | Displays a confirm save changes dialog with the given message.
May insert individual message before the given one for further information.<p>
Will call the appropriate command after saving/cancel.<p>
@param message the message to display
@param onConfirm the command executed after saving
@param onCancel the command executed on cancel | [
"Displays",
"a",
"confirm",
"save",
"changes",
"dialog",
"with",
"the",
"given",
"message",
".",
"May",
"insert",
"individual",
"message",
"before",
"the",
"given",
"one",
"for",
"further",
"information",
".",
"<p",
">",
"Will",
"call",
"the",
"appropriate",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/A_CmsPreviewDialog.java#L181-L207 |
micronaut-projects/micronaut-core | http/src/main/java/io/micronaut/http/context/ServerRequestContext.java | ServerRequestContext.with | public static <T> T with(HttpRequest request, Supplier<T> callable) {
HttpRequest existing = REQUEST.get();
boolean isSet = false;
try {
if (request != existing) {
isSet = true;
REQUEST.set(request);
}
return callable.get();
} finally {
if (isSet) {
REQUEST.remove();
}
}
} | java | public static <T> T with(HttpRequest request, Supplier<T> callable) {
HttpRequest existing = REQUEST.get();
boolean isSet = false;
try {
if (request != existing) {
isSet = true;
REQUEST.set(request);
}
return callable.get();
} finally {
if (isSet) {
REQUEST.remove();
}
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"with",
"(",
"HttpRequest",
"request",
",",
"Supplier",
"<",
"T",
">",
"callable",
")",
"{",
"HttpRequest",
"existing",
"=",
"REQUEST",
".",
"get",
"(",
")",
";",
"boolean",
"isSet",
"=",
"false",
";",
"try",
"... | Wrap the execution of the given callable in request context processing.
@param request The request
@param callable The callable
@param <T> The return type of the callable
@return The return value of the callable | [
"Wrap",
"the",
"execution",
"of",
"the",
"given",
"callable",
"in",
"request",
"context",
"processing",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http/src/main/java/io/micronaut/http/context/ServerRequestContext.java#L79-L93 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java | PassthroughResourcesImpl.deleteRequest | public String deleteRequest(String endpoint) throws SmartsheetException {
return passthroughRequest(HttpMethod.DELETE, endpoint, null, null);
} | java | public String deleteRequest(String endpoint) throws SmartsheetException {
return passthroughRequest(HttpMethod.DELETE, endpoint, null, null);
} | [
"public",
"String",
"deleteRequest",
"(",
"String",
"endpoint",
")",
"throws",
"SmartsheetException",
"{",
"return",
"passthroughRequest",
"(",
"HttpMethod",
".",
"DELETE",
",",
"endpoint",
",",
"null",
",",
"null",
")",
";",
"}"
] | Issue an HTTP DELETE request.
@param endpoint the API endpoint
@return a JSON response string
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Issue",
"an",
"HTTP",
"DELETE",
"request",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L114-L116 |
facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java | PoolManager.getMaxSlots | int getMaxSlots(String poolName, TaskType taskType) {
Map<String, Integer> maxMap = (taskType == TaskType.MAP ?
poolMaxMaps : poolMaxReduces);
if (maxMap.containsKey(poolName)) {
return maxMap.get(poolName);
} else {
return Integer.MAX_VALUE;
}
} | java | int getMaxSlots(String poolName, TaskType taskType) {
Map<String, Integer> maxMap = (taskType == TaskType.MAP ?
poolMaxMaps : poolMaxReduces);
if (maxMap.containsKey(poolName)) {
return maxMap.get(poolName);
} else {
return Integer.MAX_VALUE;
}
} | [
"int",
"getMaxSlots",
"(",
"String",
"poolName",
",",
"TaskType",
"taskType",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"maxMap",
"=",
"(",
"taskType",
"==",
"TaskType",
".",
"MAP",
"?",
"poolMaxMaps",
":",
"poolMaxReduces",
")",
";",
"if",
"(... | Get the maximum map or reduce slots for the given pool.
@return the cap set on this pool, or Integer.MAX_VALUE if not set. | [
"Get",
"the",
"maximum",
"map",
"or",
"reduce",
"slots",
"for",
"the",
"given",
"pool",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/PoolManager.java#L693-L701 |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsResourceTypesTable.java | CmsResourceTypesTable.onItemClick | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
m_menu.setEntries(getMenuEntries(), (Set<String>)getValue());
m_menu.openForTable(event, itemId, propertyId, this);
} else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.Name.equals(propertyId)) {
String typeName = (String)itemId;
openEditDialog(typeName);
}
}
} | java | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
m_menu.setEntries(getMenuEntries(), (Set<String>)getValue());
m_menu.openForTable(event, itemId, propertyId, this);
} else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.Name.equals(propertyId)) {
String typeName = (String)itemId;
openEditDialog(typeName);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"onItemClick",
"(",
"MouseEvents",
".",
"ClickEvent",
"event",
",",
"Object",
"itemId",
",",
"Object",
"propertyId",
")",
"{",
"if",
"(",
"!",
"event",
".",
"isCtrlKey",
"(",
")",
"&&",
"!",
"even... | Handles the table item clicks, including clicks on images inside of a table item.<p>
@param event the click event
@param itemId of the clicked row
@param propertyId column id | [
"Handles",
"the",
"table",
"item",
"clicks",
"including",
"clicks",
"on",
"images",
"inside",
"of",
"a",
"table",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsResourceTypesTable.java#L701-L715 |
mongodb/stitch-android-sdk | core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/BsonUtils.java | BsonUtils.parseValue | public static <T> T parseValue(final String json, final Class<T> valueClass) {
final JsonReader bsonReader = new JsonReader(json);
bsonReader.readBsonType();
return DEFAULT_CODEC_REGISTRY
.get(valueClass)
.decode(bsonReader, DecoderContext.builder().build());
} | java | public static <T> T parseValue(final String json, final Class<T> valueClass) {
final JsonReader bsonReader = new JsonReader(json);
bsonReader.readBsonType();
return DEFAULT_CODEC_REGISTRY
.get(valueClass)
.decode(bsonReader, DecoderContext.builder().build());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"parseValue",
"(",
"final",
"String",
"json",
",",
"final",
"Class",
"<",
"T",
">",
"valueClass",
")",
"{",
"final",
"JsonReader",
"bsonReader",
"=",
"new",
"JsonReader",
"(",
"json",
")",
";",
"bsonReader",
".",
... | Parses the provided extended JSON string and decodes it into a T value as specified by the
provided class type. The type will decoded using the codec found for the type in the default
codec registry. If the provided type is not supported by the default codec registry, the method
will throw a {@link org.bson.codecs.configuration.CodecConfigurationException}.
@param json the JSON string to parse.
@param valueClass the class that the JSON string should be decoded into.
@param <T> the type into which the JSON string is decoded.
@return the decoded value. | [
"Parses",
"the",
"provided",
"extended",
"JSON",
"string",
"and",
"decodes",
"it",
"into",
"a",
"T",
"value",
"as",
"specified",
"by",
"the",
"provided",
"class",
"type",
".",
"The",
"type",
"will",
"decoded",
"using",
"the",
"codec",
"found",
"for",
"the"... | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/BsonUtils.java#L80-L86 |
azkaban/azkaban | az-core/src/main/java/azkaban/utils/Utils.java | Utils.callConstructor | public static Object callConstructor(final Class<?> cls, final Object... args) {
return callConstructor(cls, getTypes(args), args);
} | java | public static Object callConstructor(final Class<?> cls, final Object... args) {
return callConstructor(cls, getTypes(args), args);
} | [
"public",
"static",
"Object",
"callConstructor",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"return",
"callConstructor",
"(",
"cls",
",",
"getTypes",
"(",
"args",
")",
",",
"args",
")",
";",
"}"
] | Construct a class object with the given arguments
@param cls The class
@param args The arguments
@return Constructed Object | [
"Construct",
"a",
"class",
"object",
"with",
"the",
"given",
"arguments"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/Utils.java#L277-L279 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Main.java | Main.run | public static int run(String[] args, PrintWriter out) {
JdepsTask t = new JdepsTask();
t.setLog(out);
return t.run(args);
} | java | public static int run(String[] args, PrintWriter out) {
JdepsTask t = new JdepsTask();
t.setLog(out);
return t.run(args);
} | [
"public",
"static",
"int",
"run",
"(",
"String",
"[",
"]",
"args",
",",
"PrintWriter",
"out",
")",
"{",
"JdepsTask",
"t",
"=",
"new",
"JdepsTask",
"(",
")",
";",
"t",
".",
"setLog",
"(",
"out",
")",
";",
"return",
"t",
".",
"run",
"(",
"args",
")... | Entry point that does <i>not</i> call System.exit.
@param args command line arguments
@param out output stream
@return an exit code. 0 means success, non-zero means an error occurred. | [
"Entry",
"point",
"that",
"does",
"<i",
">",
"not<",
"/",
"i",
">",
"call",
"System",
".",
"exit",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Main.java#L61-L65 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/tsdb/model/Datapoint.java | Datapoint.addTag | public Datapoint addTag(String tagKey, String tagValue) {
initialTags();
tags.put(tagKey, tagValue);
return this;
} | java | public Datapoint addTag(String tagKey, String tagValue) {
initialTags();
tags.put(tagKey, tagValue);
return this;
} | [
"public",
"Datapoint",
"addTag",
"(",
"String",
"tagKey",
",",
"String",
"tagValue",
")",
"{",
"initialTags",
"(",
")",
";",
"tags",
".",
"put",
"(",
"tagKey",
",",
"tagValue",
")",
";",
"return",
"this",
";",
"}"
] | Add tag for the datapoint.
@param tagKey
@param tagValue
@return Datapoint | [
"Add",
"tag",
"for",
"the",
"datapoint",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L166-L170 |
looly/hutool | hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java | CaptchaUtil.createCircleCaptcha | public static CircleCaptcha createCircleCaptcha(int width, int height, int codeCount, int circleCount) {
return new CircleCaptcha(width, height, codeCount, circleCount);
} | java | public static CircleCaptcha createCircleCaptcha(int width, int height, int codeCount, int circleCount) {
return new CircleCaptcha(width, height, codeCount, circleCount);
} | [
"public",
"static",
"CircleCaptcha",
"createCircleCaptcha",
"(",
"int",
"width",
",",
"int",
"height",
",",
"int",
"codeCount",
",",
"int",
"circleCount",
")",
"{",
"return",
"new",
"CircleCaptcha",
"(",
"width",
",",
"height",
",",
"codeCount",
",",
"circleCo... | 创建圆圈干扰的验证码
@param width 图片宽
@param height 图片高
@param codeCount 字符个数
@param circleCount 干扰圆圈条数
@return {@link CircleCaptcha}
@since 3.2.3 | [
"创建圆圈干扰的验证码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L57-L59 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java | CmsGalleryController.saveTreeState | public void saveTreeState(final String treeName, final String siteRoot, final Set<CmsUUID> openItemIds) {
CmsRpcAction<Void> treeStateAction = new CmsRpcAction<Void>() {
@Override
public void execute() {
start(600, false);
getGalleryService().saveTreeOpenState(treeName, getTreeToken(), siteRoot, openItemIds, this);
}
@Override
protected void onResponse(Void result) {
stop(false);
}
};
treeStateAction.execute();
} | java | public void saveTreeState(final String treeName, final String siteRoot, final Set<CmsUUID> openItemIds) {
CmsRpcAction<Void> treeStateAction = new CmsRpcAction<Void>() {
@Override
public void execute() {
start(600, false);
getGalleryService().saveTreeOpenState(treeName, getTreeToken(), siteRoot, openItemIds, this);
}
@Override
protected void onResponse(Void result) {
stop(false);
}
};
treeStateAction.execute();
} | [
"public",
"void",
"saveTreeState",
"(",
"final",
"String",
"treeName",
",",
"final",
"String",
"siteRoot",
",",
"final",
"Set",
"<",
"CmsUUID",
">",
"openItemIds",
")",
"{",
"CmsRpcAction",
"<",
"Void",
">",
"treeStateAction",
"=",
"new",
"CmsRpcAction",
"<",
... | Saves the tree state for a given tree on the server.<p>
@param treeName the tree name
@param siteRoot the site root
@param openItemIds the structure ids of opened items | [
"Saves",
"the",
"tree",
"state",
"for",
"a",
"given",
"tree",
"on",
"the",
"server",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1181-L1200 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java | MetadataStore.failAssignment | private void failAssignment(String streamSegmentName, Throwable reason) {
finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason);
} | java | private void failAssignment(String streamSegmentName, Throwable reason) {
finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason);
} | [
"private",
"void",
"failAssignment",
"(",
"String",
"streamSegmentName",
",",
"Throwable",
"reason",
")",
"{",
"finishPendingRequests",
"(",
"streamSegmentName",
",",
"PendingRequest",
"::",
"completeExceptionally",
",",
"reason",
")",
";",
"}"
] | Fails the assignment for the given StreamSegment Id with the given reason. | [
"Fails",
"the",
"assignment",
"for",
"the",
"given",
"StreamSegment",
"Id",
"with",
"the",
"given",
"reason",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L447-L449 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.removeAll | @Inline(value="$3.$4removeAll($1, $2)", imported=Iterables.class)
public static <T> boolean removeAll(Collection<T> collection, Collection<? extends T> elements) {
return Iterables.removeAll(collection, elements);
} | java | @Inline(value="$3.$4removeAll($1, $2)", imported=Iterables.class)
public static <T> boolean removeAll(Collection<T> collection, Collection<? extends T> elements) {
return Iterables.removeAll(collection, elements);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$3.$4removeAll($1, $2)\"",
",",
"imported",
"=",
"Iterables",
".",
"class",
")",
"public",
"static",
"<",
"T",
">",
"boolean",
"removeAll",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"Collection",
"<",
"?",
"e... | Removes all of the specified elements from the specified collection.
@param collection
the collection from which the {@code elements} are to be removed. May not be <code>null</code>.
@param elements
the elements to remove from the {@code collection}. May not be <code>null</code> but may contain
<code>null</code> entries if the {@code collection} allows that.
@return <code>true</code> if the collection changed as a result of the call
@since 2.4 | [
"Removes",
"all",
"of",
"the",
"specified",
"elements",
"from",
"the",
"specified",
"collection",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L300-L303 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java | ChunkBlockHandler.removeCoord | private void removeCoord(Chunk chunk, BlockPos pos)
{
chunks(chunk).remove(chunk, pos);
} | java | private void removeCoord(Chunk chunk, BlockPos pos)
{
chunks(chunk).remove(chunk, pos);
} | [
"private",
"void",
"removeCoord",
"(",
"Chunk",
"chunk",
",",
"BlockPos",
"pos",
")",
"{",
"chunks",
"(",
"chunk",
")",
".",
"remove",
"(",
"chunk",
",",
"pos",
")",
";",
"}"
] | Removes a coordinate from the specified {@link Chunk}.
@param chunk the chunk
@param pos the pos | [
"Removes",
"a",
"coordinate",
"from",
"the",
"specified",
"{",
"@link",
"Chunk",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java#L182-L185 |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.addResponsesToAction | private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
// if no mimeTypes defined, no response specifications
if(mimes.isEmpty()){
return;
}
int i=0;
// iterate over @response.code javadoc annotation
for (String code : elem.getResponseCodes()) {
LOGGER.debug("code:"+code);
// get mimeType in order of declaration, else get first
String mime;
if(mimes.size()>i){
mime = mimes.get(i);
} else {
mime = mimes.get(0);
}
Response resp = new Response();
// add @response.description javadoc annotation if exist
if(elem.getResponseDescriptions().size()>i){
resp.setDescription(elem.getResponseDescriptions().get(i));
}
// add @response.body javadoc annotation if exist
if(elem.getResponseBodies().size()>i){
MimeType mimeType = new MimeType(mime);
mimeType.setExample(elem.getResponseBodies().get(i).toString());
resp.setBody(Collections.singletonMap(mime, mimeType));
}
action.getResponses().put(code, resp);
i++;
}
} | java | private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
// if no mimeTypes defined, no response specifications
if(mimes.isEmpty()){
return;
}
int i=0;
// iterate over @response.code javadoc annotation
for (String code : elem.getResponseCodes()) {
LOGGER.debug("code:"+code);
// get mimeType in order of declaration, else get first
String mime;
if(mimes.size()>i){
mime = mimes.get(i);
} else {
mime = mimes.get(0);
}
Response resp = new Response();
// add @response.description javadoc annotation if exist
if(elem.getResponseDescriptions().size()>i){
resp.setDescription(elem.getResponseDescriptions().get(i));
}
// add @response.body javadoc annotation if exist
if(elem.getResponseBodies().size()>i){
MimeType mimeType = new MimeType(mime);
mimeType.setExample(elem.getResponseBodies().get(i).toString());
resp.setBody(Collections.singletonMap(mime, mimeType));
}
action.getResponses().put(code, resp);
i++;
}
} | [
"private",
"void",
"addResponsesToAction",
"(",
"ControllerRouteModel",
"<",
"Raml",
">",
"elem",
",",
"Action",
"action",
")",
"{",
"// get all mimeTypes defined in @Route.produces",
"LOGGER",
".",
"debug",
"(",
"\"responsesMimes.size:\"",
"+",
"elem",
".",
"getRespons... | Add the response specification to the given action.
@param elem The ControllerRouteModel that contains the response specification.
@param action The Action on which to add the response specification. | [
"Add",
"the",
"response",
"specification",
"to",
"the",
"given",
"action",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L294-L337 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublishingService.java | MapEventPublishingService.dispatchLocalEventData | private void dispatchLocalEventData(EventData eventData, ListenerAdapter listener) {
IMapEvent event = createIMapEvent(eventData, null, nodeEngine.getLocalMember(), serializationService);
listener.onEvent(event);
} | java | private void dispatchLocalEventData(EventData eventData, ListenerAdapter listener) {
IMapEvent event = createIMapEvent(eventData, null, nodeEngine.getLocalMember(), serializationService);
listener.onEvent(event);
} | [
"private",
"void",
"dispatchLocalEventData",
"(",
"EventData",
"eventData",
",",
"ListenerAdapter",
"listener",
")",
"{",
"IMapEvent",
"event",
"=",
"createIMapEvent",
"(",
"eventData",
",",
"null",
",",
"nodeEngine",
".",
"getLocalMember",
"(",
")",
",",
"seriali... | Dispatches an event-data to {@link com.hazelcast.map.QueryCache QueryCache} listeners on this local
node.
@param eventData {@link EventData} to be dispatched
@param listener the listener which the event will be dispatched from | [
"Dispatches",
"an",
"event",
"-",
"data",
"to",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"map",
".",
"QueryCache",
"QueryCache",
"}",
"listeners",
"on",
"this",
"local",
"node",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublishingService.java#L156-L159 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/MDateDocument.java | MDateDocument.getDisplayDateFormat | public static SimpleDateFormat getDisplayDateFormat() {
if (displayDateFormat == null) { // NOPMD
String pattern = getDateFormat().toPattern();
// si le pattern contient seulement 2 chiffres pour l'année on en met 4
// parce que c'est plus clair à l'affichage
// mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle)
if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) {
pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString();
}
displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD
}
return displayDateFormat; // NOPMD
} | java | public static SimpleDateFormat getDisplayDateFormat() {
if (displayDateFormat == null) { // NOPMD
String pattern = getDateFormat().toPattern();
// si le pattern contient seulement 2 chiffres pour l'année on en met 4
// parce que c'est plus clair à l'affichage
// mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle)
if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) {
pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString();
}
displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD
}
return displayDateFormat; // NOPMD
} | [
"public",
"static",
"SimpleDateFormat",
"getDisplayDateFormat",
"(",
")",
"{",
"if",
"(",
"displayDateFormat",
"==",
"null",
")",
"{",
"// NOPMD\r",
"String",
"pattern",
"=",
"getDateFormat",
"(",
")",
".",
"toPattern",
"(",
")",
";",
"// si le pattern contient se... | Retourne la valeur de la propriété displayDateFormat.
@return SimpleDateFormat | [
"Retourne",
"la",
"valeur",
"de",
"la",
"propriété",
"displayDateFormat",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/MDateDocument.java#L141-L155 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfCopy.java | PdfCopy.copyStream | protected PdfStream copyStream(PRStream in) throws IOException, BadPdfFormatException {
PRStream out = new PRStream(in, null);
for (Iterator it = in.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
PdfObject value = in.get(key);
out.put(key, copyObject(value));
}
return out;
} | java | protected PdfStream copyStream(PRStream in) throws IOException, BadPdfFormatException {
PRStream out = new PRStream(in, null);
for (Iterator it = in.getKeys().iterator(); it.hasNext();) {
PdfName key = (PdfName) it.next();
PdfObject value = in.get(key);
out.put(key, copyObject(value));
}
return out;
} | [
"protected",
"PdfStream",
"copyStream",
"(",
"PRStream",
"in",
")",
"throws",
"IOException",
",",
"BadPdfFormatException",
"{",
"PRStream",
"out",
"=",
"new",
"PRStream",
"(",
"in",
",",
"null",
")",
";",
"for",
"(",
"Iterator",
"it",
"=",
"in",
".",
"getK... | Translate a PRStream to a PdfStream. The data part copies itself. | [
"Translate",
"a",
"PRStream",
"to",
"a",
"PdfStream",
".",
"The",
"data",
"part",
"copies",
"itself",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopy.java#L243-L253 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java | JSONUtil.toBean | public static <T> T toBean(String jsonStr, Class<T> beanClass) {
requireNonNull(jsonStr, "jsonStr is null");
JSONObject jo = JSON.parseObject(jsonStr);
jo.put(JSON.DEFAULT_TYPE_KEY, beanClass.getName());
return JSON.parseObject(jo.toJSONString(), beanClass);
} | java | public static <T> T toBean(String jsonStr, Class<T> beanClass) {
requireNonNull(jsonStr, "jsonStr is null");
JSONObject jo = JSON.parseObject(jsonStr);
jo.put(JSON.DEFAULT_TYPE_KEY, beanClass.getName());
return JSON.parseObject(jo.toJSONString(), beanClass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"toBean",
"(",
"String",
"jsonStr",
",",
"Class",
"<",
"T",
">",
"beanClass",
")",
"{",
"requireNonNull",
"(",
"jsonStr",
",",
"\"jsonStr is null\"",
")",
";",
"JSONObject",
"jo",
"=",
"JSON",
".",
"parseObject",
"... | 将json字符串,转换成指定java bean
@param jsonStr json串对象
@param beanClass 指定的bean
@param <T> 任意bean的类型
@return 转换后的java bean对象 | [
"将json字符串,转换成指定java",
"bean"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java#L62-L67 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.mandatoryWarning | public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) {
report(diags.mandatoryWarning(lc, source, pos, warningKey));
} | java | public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) {
report(diags.mandatoryWarning(lc, source, pos, warningKey));
} | [
"public",
"void",
"mandatoryWarning",
"(",
"LintCategory",
"lc",
",",
"DiagnosticPosition",
"pos",
",",
"Warning",
"warningKey",
")",
"{",
"report",
"(",
"diags",
".",
"mandatoryWarning",
"(",
"lc",
",",
"source",
",",
"pos",
",",
"warningKey",
")",
")",
";"... | Report a warning.
@param lc The lint category for the diagnostic
@param pos The source position at which to report the warning.
@param warningKey The key for the localized warning message. | [
"Report",
"a",
"warning",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L317-L319 |
codescape/bitvunit | bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java | XmlReportWriter.printHeader | private void printHeader(HtmlPage htmlPage, PrintWriter out) {
out.println("<?xml version='1.0'?>");
out.println("<BitvUnit version='" + getBitvUnitVersion() + "'>");
out.println("<Report time='" + getFormattedDate() + "' url='" + htmlPage.getUrl().toString() + "'/>");
} | java | private void printHeader(HtmlPage htmlPage, PrintWriter out) {
out.println("<?xml version='1.0'?>");
out.println("<BitvUnit version='" + getBitvUnitVersion() + "'>");
out.println("<Report time='" + getFormattedDate() + "' url='" + htmlPage.getUrl().toString() + "'/>");
} | [
"private",
"void",
"printHeader",
"(",
"HtmlPage",
"htmlPage",
",",
"PrintWriter",
"out",
")",
"{",
"out",
".",
"println",
"(",
"\"<?xml version='1.0'?>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<BitvUnit version='\"",
"+",
"getBitvUnitVersion",
"(",
")",
"+"... | Writes the header.
@param htmlPage {@link HtmlPage} that was inspected
@param out target where the report is written to | [
"Writes",
"the",
"header",
"."
] | train | https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java#L50-L54 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.setProperties | public int setProperties(Map<String,Object> properties, boolean bDisplayOption, int iMoveMode)
{
m_propertiesCache = properties;
if ((properties == null) || (properties.size() == 0))
m_propertiesCache = null;
String strProperties = null;
if (m_propertiesCache != null)
strProperties = this.propertiesToInternalString(m_propertiesCache);
Map<String,Object> propertiesSave = m_propertiesCache;
int iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode);
m_propertiesCache = propertiesSave; // Zeroed out in set String
return iErrorCode;
} | java | public int setProperties(Map<String,Object> properties, boolean bDisplayOption, int iMoveMode)
{
m_propertiesCache = properties;
if ((properties == null) || (properties.size() == 0))
m_propertiesCache = null;
String strProperties = null;
if (m_propertiesCache != null)
strProperties = this.propertiesToInternalString(m_propertiesCache);
Map<String,Object> propertiesSave = m_propertiesCache;
int iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode);
m_propertiesCache = propertiesSave; // Zeroed out in set String
return iErrorCode;
} | [
"public",
"int",
"setProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"m_propertiesCache",
"=",
"properties",
";",
"if",
"(",
"(",
"properties",
"==",
"null",
")",
... | Set this property in the user's property area.
@param strProperty The property key.
@param strValue The property value.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success). | [
"Set",
"this",
"property",
"in",
"the",
"user",
"s",
"property",
"area",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L189-L201 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Observable.java | Observable.fromFuture | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
Observable<T> o = fromFuture(future, timeout, unit);
return o.subscribeOn(scheduler);
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
Observable<T> o = fromFuture(future, timeout, unit);
return o.subscribeOn(scheduler);
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"CUSTOM",
")",
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"fromFuture",
"(",
"Future",
"<",
"?",
"extends",
"T",
">",
"future",
",",
"long",
"timeout",
","... | Converts a {@link Future} into an ObservableSource, with a timeout on the Future.
<p>
<img width="640" height="287" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromFuture.timeout.scheduler.png" alt="">
<p>
You can convert any object that supports the {@link Future} interface into an ObservableSource that emits the
return value of the {@link Future#get} method of that object, by passing the object into the {@code from}
method.
<p>
Unlike 1.x, disposing the Observable won't cancel the future. If necessary, one can use composition to achieve the
cancellation effect: {@code futureObservableSource.doOnDispose(() -> future.cancel(true));}.
<p>
<em>Important note:</em> This ObservableSource is blocking; you cannot dispose it.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param future
the source {@link Future}
@param timeout
the maximum time to wait before calling {@code get}
@param unit
the {@link TimeUnit} of the {@code timeout} argument
@param scheduler
the {@link Scheduler} to wait for the Future on. Use a Scheduler such as
{@link Schedulers#io()} that can block and wait on the Future
@param <T>
the type of object that the {@link Future} returns, and also the type of item to be emitted by
the resulting ObservableSource
@return an Observable that emits the item from the source {@link Future}
@see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> | [
"Converts",
"a",
"{",
"@link",
"Future",
"}",
"into",
"an",
"ObservableSource",
"with",
"a",
"timeout",
"on",
"the",
"Future",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"287",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Observable.java#L1888-L1894 |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java | Animate.removeAnimationOnEnd | public static final <T extends UIObject> void removeAnimationOnEnd(final T widget, final String animation) {
if (widget != null && animation != null) {
removeAnimationOnEnd(widget.getElement(), animation);
}
} | java | public static final <T extends UIObject> void removeAnimationOnEnd(final T widget, final String animation) {
if (widget != null && animation != null) {
removeAnimationOnEnd(widget.getElement(), animation);
}
} | [
"public",
"static",
"final",
"<",
"T",
"extends",
"UIObject",
">",
"void",
"removeAnimationOnEnd",
"(",
"final",
"T",
"widget",
",",
"final",
"String",
"animation",
")",
"{",
"if",
"(",
"widget",
"!=",
"null",
"&&",
"animation",
"!=",
"null",
")",
"{",
"... | Removes custom animation class on animation end.
@param widget Element to remove style from.
@param animation Animation CSS class to remove. | [
"Removes",
"custom",
"animation",
"class",
"on",
"animation",
"end",
"."
] | train | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java#L307-L311 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Collections.java | Collections.findValueOfType | public static Object findValueOfType(Collection<?> collection, Class<?>[] types) {
if (isEmpty(collection) || Objects.isEmpty(types)) {
return null;
}
for (Class<?> type : types) {
Object value = findValueOfType(collection, type);
if (value != null) {
return value;
}
}
return null;
} | java | public static Object findValueOfType(Collection<?> collection, Class<?>[] types) {
if (isEmpty(collection) || Objects.isEmpty(types)) {
return null;
}
for (Class<?> type : types) {
Object value = findValueOfType(collection, type);
if (value != null) {
return value;
}
}
return null;
} | [
"public",
"static",
"Object",
"findValueOfType",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"collection",
")",
"||",
"Objects",
".",
"isEmpty",
"(",
"types",
")",... | Find a single value of one of the given types in the given Collection:
searching the Collection for a value of the first type, then
searching for a value of the second type, etc.
@param collection the collection to search
@param types the types to look for, in prioritized order
@return a value of one of the given types found if there is a clear match,
or <code>null</code> if none or more than one such value found | [
"Find",
"a",
"single",
"value",
"of",
"one",
"of",
"the",
"given",
"types",
"in",
"the",
"given",
"Collection",
":",
"searching",
"the",
"Collection",
"for",
"a",
"value",
"of",
"the",
"first",
"type",
"then",
"searching",
"for",
"a",
"value",
"of",
"the... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Collections.java#L258-L269 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java | OQueryDataProvider.setSort | public void setSort(String property, Boolean order) {
SortOrder sortOrder = order==null?SortOrder.ASCENDING:(order?SortOrder.ASCENDING:SortOrder.DESCENDING);
if(property==null) {
if(order==null) setSort(null);
else setSort("@rid", sortOrder);
} else {
super.setSort(property, sortOrder);
}
} | java | public void setSort(String property, Boolean order) {
SortOrder sortOrder = order==null?SortOrder.ASCENDING:(order?SortOrder.ASCENDING:SortOrder.DESCENDING);
if(property==null) {
if(order==null) setSort(null);
else setSort("@rid", sortOrder);
} else {
super.setSort(property, sortOrder);
}
} | [
"public",
"void",
"setSort",
"(",
"String",
"property",
",",
"Boolean",
"order",
")",
"{",
"SortOrder",
"sortOrder",
"=",
"order",
"==",
"null",
"?",
"SortOrder",
".",
"ASCENDING",
":",
"(",
"order",
"?",
"SortOrder",
".",
"ASCENDING",
":",
"SortOrder",
".... | Set sort
@param property property to sort on
@param order order to apply: true is for ascending, false is for descending | [
"Set",
"sort"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java#L107-L115 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.setCMYKColorFill | public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
content.append((float)(cyan & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(magenta & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(yellow & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(black & 0xFF) / 0xFF);
content.append(" k").append_i(separator);
} | java | public void setCMYKColorFill(int cyan, int magenta, int yellow, int black) {
content.append((float)(cyan & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(magenta & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(yellow & 0xFF) / 0xFF);
content.append(' ');
content.append((float)(black & 0xFF) / 0xFF);
content.append(" k").append_i(separator);
} | [
"public",
"void",
"setCMYKColorFill",
"(",
"int",
"cyan",
",",
"int",
"magenta",
",",
"int",
"yellow",
",",
"int",
"black",
")",
"{",
"content",
".",
"append",
"(",
"(",
"float",
")",
"(",
"cyan",
"&",
"0xFF",
")",
"/",
"0xFF",
")",
";",
"content",
... | Changes the current color for filling paths (device dependent colors!).
<P>
Sets the color space to <B>DeviceCMYK</B> (or the <B>DefaultCMYK</B> color space),
and sets the color to use for filling paths.</P>
<P>
This method is described in the 'Portable Document Format Reference Manual version 1.3'
section 8.5.2.1 (page 331).</P>
<P>
Following the PDF manual, each operand must be a number between 0 (no ink) and
1 (maximum ink). This method however accepts only integers between 0x00 and 0xFF.</P>
@param cyan the intensity of cyan
@param magenta the intensity of magenta
@param yellow the intensity of yellow
@param black the intensity of black | [
"Changes",
"the",
"current",
"color",
"for",
"filling",
"paths",
"(",
"device",
"dependent",
"colors!",
")",
".",
"<P",
">",
"Sets",
"the",
"color",
"space",
"to",
"<B",
">",
"DeviceCMYK<",
"/",
"B",
">",
"(",
"or",
"the",
"<B",
">",
"DefaultCMYK<",
"/... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2108-L2117 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.loadStringToFileListMultimap | public static ImmutableListMultimap<String, File> loadStringToFileListMultimap(
final CharSource source) throws IOException {
return loadMultimap(source, Functions.<String>identity(), FileFunction.INSTANCE,
IsCommentLine.INSTANCE);
} | java | public static ImmutableListMultimap<String, File> loadStringToFileListMultimap(
final CharSource source) throws IOException {
return loadMultimap(source, Functions.<String>identity(), FileFunction.INSTANCE,
IsCommentLine.INSTANCE);
} | [
"public",
"static",
"ImmutableListMultimap",
"<",
"String",
",",
"File",
">",
"loadStringToFileListMultimap",
"(",
"final",
"CharSource",
"source",
")",
"throws",
"IOException",
"{",
"return",
"loadMultimap",
"(",
"source",
",",
"Functions",
".",
"<",
"String",
">... | Reads an {@link ImmutableListMultimap} from a {@link CharSource}, where each line is a
key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored. | [
"Reads",
"an",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L292-L296 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/KeenClient.java | KeenClient.addEventAsync | public void addEventAsync(String eventCollection, Map<String, Object> event) {
addEventAsync(eventCollection, event, null);
} | java | public void addEventAsync(String eventCollection, Map<String, Object> event) {
addEventAsync(eventCollection, event, null);
} | [
"public",
"void",
"addEventAsync",
"(",
"String",
"eventCollection",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"event",
")",
"{",
"addEventAsync",
"(",
"eventCollection",
",",
"event",
",",
"null",
")",
";",
"}"
] | Adds an event to the default project with default Keen properties and no callbacks.
@see #addEvent(KeenProject, String, java.util.Map, java.util.Map, KeenCallback)
@param eventCollection The name of the collection in which to publish the event.
@param event A Map that consists of key/value pairs. Keen naming conventions apply (see
docs). Nested Maps and lists are acceptable (and encouraged!). | [
"Adds",
"an",
"event",
"to",
"the",
"default",
"project",
"with",
"default",
"Keen",
"properties",
"and",
"no",
"callbacks",
"."
] | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L186-L188 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java | AbstractVersionEnforcer.enforceVersion | public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException
{
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
} | java | public void enforceVersion( Log log, String variableName, String requiredVersionRange, ArtifactVersion actualVersion )
throws EnforcerRuleException
{
if ( StringUtils.isEmpty( requiredVersionRange ) )
{
throw new EnforcerRuleException( variableName + " version can't be empty." );
}
else
{
VersionRange vr;
String msg = "Detected " + variableName + " Version: " + actualVersion;
// short circuit check if the strings are exactly equal
if ( actualVersion.toString().equals( requiredVersionRange ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
try
{
vr = VersionRange.createFromVersionSpec( requiredVersionRange );
if ( containsVersion( vr, actualVersion ) )
{
log.debug( msg + " is allowed in the range " + requiredVersionRange + "." );
}
else
{
String message = getMessage();
if ( StringUtils.isEmpty( message ) )
{
message = msg + " is not in the allowed range " + vr + ".";
}
throw new EnforcerRuleException( message );
}
}
catch ( InvalidVersionSpecificationException e )
{
throw new EnforcerRuleException( "The requested " + variableName + " version "
+ requiredVersionRange + " is invalid.", e );
}
}
}
} | [
"public",
"void",
"enforceVersion",
"(",
"Log",
"log",
",",
"String",
"variableName",
",",
"String",
"requiredVersionRange",
",",
"ArtifactVersion",
"actualVersion",
")",
"throws",
"EnforcerRuleException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"require... | Compares the specified version to see if it is allowed by the defined version range.
@param log the log
@param variableName name of variable to use in messages (Example: "Maven" or "Java" etc).
@param requiredVersionRange range of allowed versions.
@param actualVersion the version to be checked.
@throws EnforcerRuleException the enforcer rule exception | [
"Compares",
"the",
"specified",
"version",
"to",
"see",
"if",
"it",
"is",
"allowed",
"by",
"the",
"defined",
"version",
"range",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java#L69-L116 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java | ASegment.getNextMatch | protected IWord[] getNextMatch(char[] chars, int index)
{
ArrayList<IWord> mList = new ArrayList<IWord>(8);
//StringBuilder isb = new StringBuilder();
isb.clear();
char c = chars[index];
isb.append(c);
String temp = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, temp) ) {
mList.add(dic.get(ILexicon.CJK_WORD, temp));
}
String _key = null;
for ( int j = 1;
j < config.MAX_LENGTH && ((j+index) < chars.length); j++ ) {
isb.append(chars[j+index]);
_key = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, _key) ) {
mList.add(dic.get(ILexicon.CJK_WORD, _key));
}
}
/*
* if match no words from the current position
* to idx+Config.MAX_LENGTH, just return the Word with
* a value of temp as a unrecognited word.
*/
if ( mList.isEmpty() ) {
mList.add(new Word(temp, ILexicon.UNMATCH_CJK_WORD));
}
/* for ( int j = 0; j < mList.size(); j++ ) {
System.out.println(mList.get(j));
}*/
IWord[] words = new IWord[mList.size()];
mList.toArray(words);
mList.clear();
return words;
} | java | protected IWord[] getNextMatch(char[] chars, int index)
{
ArrayList<IWord> mList = new ArrayList<IWord>(8);
//StringBuilder isb = new StringBuilder();
isb.clear();
char c = chars[index];
isb.append(c);
String temp = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, temp) ) {
mList.add(dic.get(ILexicon.CJK_WORD, temp));
}
String _key = null;
for ( int j = 1;
j < config.MAX_LENGTH && ((j+index) < chars.length); j++ ) {
isb.append(chars[j+index]);
_key = isb.toString();
if ( dic.match(ILexicon.CJK_WORD, _key) ) {
mList.add(dic.get(ILexicon.CJK_WORD, _key));
}
}
/*
* if match no words from the current position
* to idx+Config.MAX_LENGTH, just return the Word with
* a value of temp as a unrecognited word.
*/
if ( mList.isEmpty() ) {
mList.add(new Word(temp, ILexicon.UNMATCH_CJK_WORD));
}
/* for ( int j = 0; j < mList.size(); j++ ) {
System.out.println(mList.get(j));
}*/
IWord[] words = new IWord[mList.size()];
mList.toArray(words);
mList.clear();
return words;
} | [
"protected",
"IWord",
"[",
"]",
"getNextMatch",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"index",
")",
"{",
"ArrayList",
"<",
"IWord",
">",
"mList",
"=",
"new",
"ArrayList",
"<",
"IWord",
">",
"(",
"8",
")",
";",
"//StringBuilder isb = new StringBuilder... | match the next CJK word in the dictionary
@param chars
@param index
@return IWord[] | [
"match",
"the",
"next",
"CJK",
"word",
"in",
"the",
"dictionary"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java#L882-L923 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java | FirewallRulesInner.listByServerAsync | public Observable<Page<FirewallRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FirewallRuleInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Page<FirewallRuleInner>>() {
@Override
public Page<FirewallRuleInner> call(ServiceResponse<Page<FirewallRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FirewallRuleInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets a list of firewall rules.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FirewallRuleInner> object | [
"Gets",
"a",
"list",
"of",
"firewall",
"rules",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java#L428-L436 |
samskivert/pythagoras | src/main/java/pythagoras/d/Frustum.java | Frustum.setToFrustum | public Frustum setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToProjection(left, right, bottom, top, near, far, Vector3.UNIT_Z, false, false);
} | java | public Frustum setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToProjection(left, right, bottom, top, near, far, Vector3.UNIT_Z, false, false);
} | [
"public",
"Frustum",
"setToFrustum",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
")",
"{",
"return",
"setToProjection",
"(",
"left",
",",
"right",
",",
"bottom",... | Sets this frustum to one pointing in the Z- direction with the specified parameters
determining its size and shape (see the OpenGL documentation for <code>glFrustum</code>).
@return a reference to this frustum, for chaining. | [
"Sets",
"this",
"frustum",
"to",
"one",
"pointing",
"in",
"the",
"Z",
"-",
"direction",
"with",
"the",
"specified",
"parameters",
"determining",
"its",
"size",
"and",
"shape",
"(",
"see",
"the",
"OpenGL",
"documentation",
"for",
"<code",
">",
"glFrustum<",
"... | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Frustum.java#L66-L69 |
threerings/nenya | core/src/main/java/com/threerings/media/tile/Tile.java | Tile.paint | public void paint (Graphics2D gfx, int x, int y)
{
_mirage.paint(gfx, x, y);
} | java | public void paint (Graphics2D gfx, int x, int y)
{
_mirage.paint(gfx, x, y);
} | [
"public",
"void",
"paint",
"(",
"Graphics2D",
"gfx",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"_mirage",
".",
"paint",
"(",
"gfx",
",",
"x",
",",
"y",
")",
";",
"}"
] | Render the tile image at the specified position in the given
graphics context. | [
"Render",
"the",
"tile",
"image",
"at",
"the",
"specified",
"position",
"in",
"the",
"given",
"graphics",
"context",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/Tile.java#L119-L122 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.createAsync | public Observable<LiveEventInner> createAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters, Boolean autoStart) {
return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters, autoStart).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | java | public Observable<LiveEventInner> createAsync(String resourceGroupName, String accountName, String liveEventName, LiveEventInner parameters, Boolean autoStart) {
return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, parameters, autoStart).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LiveEventInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"LiveEventInner",
"parameters",
",",
"Boolean",
"autoStart",
")",
"{",
"return",
"createWithServic... | Create Live Event.
Creates a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param parameters Live Event properties needed for creation.
@param autoStart The flag indicates if auto start the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"Live",
"Event",
".",
"Creates",
"a",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L490-L497 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java | AbstractProperty.encodeFromRaw | public VALUETO encodeFromRaw(Object o, Optional<CassandraOptions> cassandraOptions) {
if (o == null) return null;
return encodeFromRawInternal(o, cassandraOptions);
} | java | public VALUETO encodeFromRaw(Object o, Optional<CassandraOptions> cassandraOptions) {
if (o == null) return null;
return encodeFromRawInternal(o, cassandraOptions);
} | [
"public",
"VALUETO",
"encodeFromRaw",
"(",
"Object",
"o",
",",
"Optional",
"<",
"CassandraOptions",
">",
"cassandraOptions",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"return",
"null",
";",
"return",
"encodeFromRawInternal",
"(",
"o",
",",
"cassandraOptions... | Encode given java raw object to CQL-compatible value using Achilles codec system and a CassandraOptions
containing a runtime SchemaNameProvider. Use the
<br/>
<br/>
<pre class="code"><code class="java">
CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider)
</code></pre>
<br/>
static method to build such a CassandraOptions instance
@param o
@param cassandraOptions
@return | [
"Encode",
"given",
"java",
"raw",
"object",
"to",
"CQL",
"-",
"compatible",
"value",
"using",
"Achilles",
"codec",
"system",
"and",
"a",
"CassandraOptions",
"containing",
"a",
"runtime",
"SchemaNameProvider",
".",
"Use",
"the",
"<br",
"/",
">",
"<br",
"/",
"... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L118-L121 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.deleteResource | public void deleteResource(String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException {
// throw the exception if resource name is an empty string
if (CmsStringUtil.isEmptyOrWhitespaceOnly(resourcename)) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(Messages.ERR_DELETE_RESOURCE_1, resourcename));
}
CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
getResourceType(resource).deleteResource(this, m_securityManager, resource, siblingMode);
} | java | public void deleteResource(String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException {
// throw the exception if resource name is an empty string
if (CmsStringUtil.isEmptyOrWhitespaceOnly(resourcename)) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(Messages.ERR_DELETE_RESOURCE_1, resourcename));
}
CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
getResourceType(resource).deleteResource(this, m_securityManager, resource, siblingMode);
} | [
"public",
"void",
"deleteResource",
"(",
"String",
"resourcename",
",",
"CmsResource",
".",
"CmsResourceDeleteMode",
"siblingMode",
")",
"throws",
"CmsException",
"{",
"// throw the exception if resource name is an empty string",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhi... | Deletes a resource given its name.<p>
The <code>siblingMode</code> parameter controls how to handle siblings
during the delete operation.<br>
Possible values for this parameter are: <br>
<ul>
<li><code>{@link CmsResource#DELETE_REMOVE_SIBLINGS}</code></li>
<li><code>{@link CmsResource#DELETE_PRESERVE_SIBLINGS}</code></li>
</ul><p>
@param resourcename the name of the resource to delete (full current site relative path)
@param siblingMode indicates how to handle siblings of the deleted resource
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"resource",
"given",
"its",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1063-L1073 |
mozilla/rhino | src/org/mozilla/javascript/ScriptableObject.java | ScriptableObject.defineConstProperty | public static void defineConstProperty(Scriptable destination,
String propertyName)
{
if (destination instanceof ConstProperties) {
ConstProperties cp = (ConstProperties)destination;
cp.defineConst(propertyName, destination);
} else
defineProperty(destination, propertyName, Undefined.instance, CONST);
} | java | public static void defineConstProperty(Scriptable destination,
String propertyName)
{
if (destination instanceof ConstProperties) {
ConstProperties cp = (ConstProperties)destination;
cp.defineConst(propertyName, destination);
} else
defineProperty(destination, propertyName, Undefined.instance, CONST);
} | [
"public",
"static",
"void",
"defineConstProperty",
"(",
"Scriptable",
"destination",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"destination",
"instanceof",
"ConstProperties",
")",
"{",
"ConstProperties",
"cp",
"=",
"(",
"ConstProperties",
")",
"destination... | Utility method to add properties to arbitrary Scriptable object.
If destination is instance of ScriptableObject, calls
defineProperty there, otherwise calls put in destination
ignoring attributes
@param destination ScriptableObject to define the property on
@param propertyName the name of the property to define. | [
"Utility",
"method",
"to",
"add",
"properties",
"to",
"arbitrary",
"Scriptable",
"object",
".",
"If",
"destination",
"is",
"instance",
"of",
"ScriptableObject",
"calls",
"defineProperty",
"there",
"otherwise",
"calls",
"put",
"in",
"destination",
"ignoring",
"attrib... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L1686-L1694 |
evernote/android-job | library/src/main/java/com/evernote/android/job/DailyJob.java | DailyJob.scheduleAsync | public static void scheduleAsync(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) {
scheduleAsync(baseBuilder, startMs, endMs, JobRequest.DEFAULT_JOB_SCHEDULED_CALLBACK);
} | java | public static void scheduleAsync(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) {
scheduleAsync(baseBuilder, startMs, endMs, JobRequest.DEFAULT_JOB_SCHEDULED_CALLBACK);
} | [
"public",
"static",
"void",
"scheduleAsync",
"(",
"@",
"NonNull",
"JobRequest",
".",
"Builder",
"baseBuilder",
",",
"long",
"startMs",
",",
"long",
"endMs",
")",
"{",
"scheduleAsync",
"(",
"baseBuilder",
",",
"startMs",
",",
"endMs",
",",
"JobRequest",
".",
... | Helper method to schedule a daily job on a background thread. This is helpful to avoid IO operations
on the main thread. For more information about scheduling daily jobs see {@link #schedule(JobRequest.Builder, long, long)}.
<br>
<br>
In case of a failure an error is logged, but the application doesn't crash. | [
"Helper",
"method",
"to",
"schedule",
"a",
"daily",
"job",
"on",
"a",
"background",
"thread",
".",
"This",
"is",
"helpful",
"to",
"avoid",
"IO",
"operations",
"on",
"the",
"main",
"thread",
".",
"For",
"more",
"information",
"about",
"scheduling",
"daily",
... | train | https://github.com/evernote/android-job/blob/5ae3d776ad9d80b5b7f60ae3e382d44d0d193faf/library/src/main/java/com/evernote/android/job/DailyJob.java#L94-L96 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java | AgentPoolsInner.getAsync | public Observable<AgentPoolInner> getAsync(String resourceGroupName, String managedClusterName, String agentPoolName) {
return getWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName).map(new Func1<ServiceResponse<AgentPoolInner>, AgentPoolInner>() {
@Override
public AgentPoolInner call(ServiceResponse<AgentPoolInner> response) {
return response.body();
}
});
} | java | public Observable<AgentPoolInner> getAsync(String resourceGroupName, String managedClusterName, String agentPoolName) {
return getWithServiceResponseAsync(resourceGroupName, managedClusterName, agentPoolName).map(new Func1<ServiceResponse<AgentPoolInner>, AgentPoolInner>() {
@Override
public AgentPoolInner call(ServiceResponse<AgentPoolInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgentPoolInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedClusterName",
",",
"String",
"agentPoolName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedClusterName",... | Gets the agent pool.
Gets the details of the agent pool by managed cluster and resource group.
@param resourceGroupName The name of the resource group.
@param managedClusterName The name of the managed cluster resource.
@param agentPoolName The name of the agent pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgentPoolInner object | [
"Gets",
"the",
"agent",
"pool",
".",
"Gets",
"the",
"details",
"of",
"the",
"agent",
"pool",
"by",
"managed",
"cluster",
"and",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/AgentPoolsInner.java#L261-L268 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.createMetadata | public Metadata createMetadata(String templateName, Metadata metadata) {
String scope = Metadata.scopeBasedOnType(templateName);
return this.createMetadata(templateName, scope, metadata);
} | java | public Metadata createMetadata(String templateName, Metadata metadata) {
String scope = Metadata.scopeBasedOnType(templateName);
return this.createMetadata(templateName, scope, metadata);
} | [
"public",
"Metadata",
"createMetadata",
"(",
"String",
"templateName",
",",
"Metadata",
"metadata",
")",
"{",
"String",
"scope",
"=",
"Metadata",
".",
"scopeBasedOnType",
"(",
"templateName",
")",
";",
"return",
"this",
".",
"createMetadata",
"(",
"templateName",
... | Creates metadata on this folder using a specified template.
@param templateName the name of the metadata template.
@param metadata the new metadata values.
@return the metadata returned from the server. | [
"Creates",
"metadata",
"on",
"this",
"folder",
"using",
"a",
"specified",
"template",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L837-L840 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.listAvailableProviders | public AvailableProvidersListInner listAvailableProviders(String resourceGroupName, String networkWatcherName, AvailableProvidersListParameters parameters) {
return listAvailableProvidersWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | java | public AvailableProvidersListInner listAvailableProviders(String resourceGroupName, String networkWatcherName, AvailableProvidersListParameters parameters) {
return listAvailableProvidersWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | [
"public",
"AvailableProvidersListInner",
"listAvailableProviders",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"AvailableProvidersListParameters",
"parameters",
")",
"{",
"return",
"listAvailableProvidersWithServiceResponseAsync",
"(",
"resourceGro... | Lists all available internet service providers for a specified Azure region.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that scope the list of available providers.
@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 AvailableProvidersListInner object if successful. | [
"Lists",
"all",
"available",
"internet",
"service",
"providers",
"for",
"a",
"specified",
"Azure",
"region",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2476-L2478 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.readUnsignedInt | public static int readUnsignedInt(byte[] bytes, int offset) {
byte b = bytes[offset++];
int i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | java | public static int readUnsignedInt(byte[] bytes, int offset) {
byte b = bytes[offset++];
int i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | [
"public",
"static",
"int",
"readUnsignedInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"byte",
"b",
"=",
"bytes",
"[",
"offset",
"++",
"]",
";",
"int",
"i",
"=",
"b",
"&",
"0x7F",
";",
"for",
"(",
"int",
"shift",
"=",
"7",
... | Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer
bytes. Negative numbers are not supported. | [
"Reads",
"an",
"int",
"stored",
"in",
"variable",
"-",
"length",
"format",
".",
"Reads",
"between",
"one",
"and",
"five",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L157-L165 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.setLastPoint | public void setLastPoint(double x, double y, double z) {
if (this.numCoordsProperty.get()>=3) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x);
this.coordsProperty[this.numCoordsProperty.get()-2].set(y);
this.coordsProperty[this.numCoordsProperty.get()-1].set(z);
this.graphicalBounds = null;
this.logicalBounds = null;
}
} | java | public void setLastPoint(double x, double y, double z) {
if (this.numCoordsProperty.get()>=3) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x);
this.coordsProperty[this.numCoordsProperty.get()-2].set(y);
this.coordsProperty[this.numCoordsProperty.get()-1].set(z);
this.graphicalBounds = null;
this.logicalBounds = null;
}
} | [
"public",
"void",
"setLastPoint",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"if",
"(",
"this",
".",
"numCoordsProperty",
".",
"get",
"(",
")",
">=",
"3",
")",
"{",
"this",
".",
"coordsProperty",
"[",
"this",
".",
"numCoord... | Change the coordinates of the last inserted point.
@param x
@param y
@param z | [
"Change",
"the",
"coordinates",
"of",
"the",
"last",
"inserted",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L1960-L1968 |
dwdyer/watchmaker | framework/src/java/main/org/uncommons/watchmaker/framework/operators/BitStringMutation.java | BitStringMutation.mutateBitString | private BitString mutateBitString(BitString bitString, Random rng)
{
if (mutationProbability.nextValue().nextEvent(rng))
{
BitString mutatedBitString = bitString.clone();
int mutations = mutationCount.nextValue();
for (int i = 0; i < mutations; i++)
{
mutatedBitString.flipBit(rng.nextInt(mutatedBitString.getLength()));
}
return mutatedBitString;
}
return bitString;
} | java | private BitString mutateBitString(BitString bitString, Random rng)
{
if (mutationProbability.nextValue().nextEvent(rng))
{
BitString mutatedBitString = bitString.clone();
int mutations = mutationCount.nextValue();
for (int i = 0; i < mutations; i++)
{
mutatedBitString.flipBit(rng.nextInt(mutatedBitString.getLength()));
}
return mutatedBitString;
}
return bitString;
} | [
"private",
"BitString",
"mutateBitString",
"(",
"BitString",
"bitString",
",",
"Random",
"rng",
")",
"{",
"if",
"(",
"mutationProbability",
".",
"nextValue",
"(",
")",
".",
"nextEvent",
"(",
"rng",
")",
")",
"{",
"BitString",
"mutatedBitString",
"=",
"bitStrin... | Mutate a single bit string. Zero or more bits may be flipped. The
probability of any given bit being flipped is governed by the probability
generator configured for this mutation operator.
@param bitString The bit string to mutate.
@param rng A source of randomness.
@return The mutated bit string. | [
"Mutate",
"a",
"single",
"bit",
"string",
".",
"Zero",
"or",
"more",
"bits",
"may",
"be",
"flipped",
".",
"The",
"probability",
"of",
"any",
"given",
"bit",
"being",
"flipped",
"is",
"governed",
"by",
"the",
"probability",
"generator",
"configured",
"for",
... | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/framework/src/java/main/org/uncommons/watchmaker/framework/operators/BitStringMutation.java#L86-L99 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitValue | @Override
public R visitValue(ValueTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitValue(ValueTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitValue",
"(",
"ValueTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L465-L468 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/TimeStampUtils.java | TimeStampUtils.getTimeStampedMessage | public static String getTimeStampedMessage(String message, String format){
StringBuilder timeStampedMessage = new StringBuilder(format.length()+TIME_STAMP_DELIMITER.length()+message.length()+2);
timeStampedMessage.append(currentFormattedTimeStamp(format)); //Timestamp
timeStampedMessage.append(' ').append(TIME_STAMP_DELIMITER).append(' '); //Padded Delimiter
timeStampedMessage.append(message); //Original message
return timeStampedMessage.toString();
} | java | public static String getTimeStampedMessage(String message, String format){
StringBuilder timeStampedMessage = new StringBuilder(format.length()+TIME_STAMP_DELIMITER.length()+message.length()+2);
timeStampedMessage.append(currentFormattedTimeStamp(format)); //Timestamp
timeStampedMessage.append(' ').append(TIME_STAMP_DELIMITER).append(' '); //Padded Delimiter
timeStampedMessage.append(message); //Original message
return timeStampedMessage.toString();
} | [
"public",
"static",
"String",
"getTimeStampedMessage",
"(",
"String",
"message",
",",
"String",
"format",
")",
"{",
"StringBuilder",
"timeStampedMessage",
"=",
"new",
"StringBuilder",
"(",
"format",
".",
"length",
"(",
")",
"+",
"TIME_STAMP_DELIMITER",
".",
"lengt... | Returns the provided {@code message} along with a date/time based
on the provided {@code format} which is a SimpleDateFormat string.
If application of the provided {@code format} fails a default format is used.
The DEFAULT format is defined in Messages.properties.
@param message the message to be time stamped
@param format the format to be used in creating the time stamp
@return a time stamp in the designated format along with the original message
@see SimpleDateFormat | [
"Returns",
"the",
"provided",
"{",
"@code",
"message",
"}",
"along",
"with",
"a",
"date",
"/",
"time",
"based",
"on",
"the",
"provided",
"{",
"@code",
"format",
"}",
"which",
"is",
"a",
"SimpleDateFormat",
"string",
".",
"If",
"application",
"of",
"the",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/TimeStampUtils.java#L91-L99 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/common/DefaultAgenda.java | DefaultAgenda.addItemToActivationGroup | public void addItemToActivationGroup(final AgendaItem item) {
if ( item.isRuleAgendaItem() ) {
throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing");
}
String group = item.getRule().getActivationGroup();
if ( group != null && group.length() > 0 ) {
InternalActivationGroup actgroup = getActivationGroup( group );
// Don't allow lazy activations to activate, from before it's last trigger point
if ( actgroup.getTriggeredForRecency() != 0 &&
actgroup.getTriggeredForRecency() >= item.getPropagationContext().getFactHandle().getRecency() ) {
return;
}
actgroup.addActivation( item );
}
} | java | public void addItemToActivationGroup(final AgendaItem item) {
if ( item.isRuleAgendaItem() ) {
throw new UnsupportedOperationException("defensive programming, making sure this isn't called, before removing");
}
String group = item.getRule().getActivationGroup();
if ( group != null && group.length() > 0 ) {
InternalActivationGroup actgroup = getActivationGroup( group );
// Don't allow lazy activations to activate, from before it's last trigger point
if ( actgroup.getTriggeredForRecency() != 0 &&
actgroup.getTriggeredForRecency() >= item.getPropagationContext().getFactHandle().getRecency() ) {
return;
}
actgroup.addActivation( item );
}
} | [
"public",
"void",
"addItemToActivationGroup",
"(",
"final",
"AgendaItem",
"item",
")",
"{",
"if",
"(",
"item",
".",
"isRuleAgendaItem",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"defensive programming, making sure this isn't called, befor... | If the item belongs to an activation group, add it
@param item | [
"If",
"the",
"item",
"belongs",
"to",
"an",
"activation",
"group",
"add",
"it"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/common/DefaultAgenda.java#L319-L335 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/PromptX509TrustManager.java | PromptX509TrustManager.generateDigest | private String generateDigest(String algorithmName, X509Certificate cert) {
try {
MessageDigest md = MessageDigest.getInstance(algorithmName);
md.update(cert.getEncoded());
byte data[] = md.digest();
StringBuilder buffer = new StringBuilder(3 * data.length);
int i = 0;
buffer.append(HEX_CHARS[(data[i] >> 4) & 0xF]);
buffer.append(HEX_CHARS[(data[i] % 16) & 0xF]);
for (++i; i < data.length; i++) {
buffer.append(':');
buffer.append(HEX_CHARS[(data[i] >> 4) & 0xF]);
buffer.append(HEX_CHARS[(data[i] % 16) & 0xF]);
}
return buffer.toString();
} catch (NoClassDefFoundError e) {
return getMessage("sslTrust.genDigestError", algorithmName, e.getMessage());
} catch (Exception e) {
return getMessage("sslTrust.genDigestError", algorithmName, e.getMessage());
}
} | java | private String generateDigest(String algorithmName, X509Certificate cert) {
try {
MessageDigest md = MessageDigest.getInstance(algorithmName);
md.update(cert.getEncoded());
byte data[] = md.digest();
StringBuilder buffer = new StringBuilder(3 * data.length);
int i = 0;
buffer.append(HEX_CHARS[(data[i] >> 4) & 0xF]);
buffer.append(HEX_CHARS[(data[i] % 16) & 0xF]);
for (++i; i < data.length; i++) {
buffer.append(':');
buffer.append(HEX_CHARS[(data[i] >> 4) & 0xF]);
buffer.append(HEX_CHARS[(data[i] % 16) & 0xF]);
}
return buffer.toString();
} catch (NoClassDefFoundError e) {
return getMessage("sslTrust.genDigestError", algorithmName, e.getMessage());
} catch (Exception e) {
return getMessage("sslTrust.genDigestError", algorithmName, e.getMessage());
}
} | [
"private",
"String",
"generateDigest",
"(",
"String",
"algorithmName",
",",
"X509Certificate",
"cert",
")",
"{",
"try",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithmName",
")",
";",
"md",
".",
"update",
"(",
"cert",
".",... | This method is used to create a "SHA-1" or "MD5" digest on an
X509Certificate as the "fingerprint".
@param algorithmName
@param cert
@return String | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"SHA",
"-",
"1",
"or",
"MD5",
"digest",
"on",
"an",
"X509Certificate",
"as",
"the",
"fingerprint",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/PromptX509TrustManager.java#L72-L94 |
hal/core | flow/core/src/main/java/org/jboss/gwt/flow/client/Async.java | Async.whilst | public void whilst(Precondition condition, final Outcome outcome, final Function function) {
whilst(condition, outcome, function, -1);
} | java | public void whilst(Precondition condition, final Outcome outcome, final Function function) {
whilst(condition, outcome, function, -1);
} | [
"public",
"void",
"whilst",
"(",
"Precondition",
"condition",
",",
"final",
"Outcome",
"outcome",
",",
"final",
"Function",
"function",
")",
"{",
"whilst",
"(",
"condition",
",",
"outcome",
",",
"function",
",",
"-",
"1",
")",
";",
"}"
] | Repeatedly call function, while condition is met. Calls the callback when stopped, or an error occurs. | [
"Repeatedly",
"call",
"function",
"while",
"condition",
"is",
"met",
".",
"Calls",
"the",
"callback",
"when",
"stopped",
"or",
"an",
"error",
"occurs",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/flow/core/src/main/java/org/jboss/gwt/flow/client/Async.java#L157-L159 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java | SLINKHDBSCANLinearMemory.step2 | private void step2(DBIDRef id, DBIDs processedIDs, DistanceQuery<? super O> distQuery, DoubleDataStore coredists, WritableDoubleDataStore m) {
double coreP = coredists.doubleValue(id);
for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) {
// M(i) = dist(i, n+1)
double coreQ = coredists.doubleValue(it);
double dist = MathUtil.max(coreP, coreQ, distQuery.distance(id, it));
m.putDouble(it, dist);
}
} | java | private void step2(DBIDRef id, DBIDs processedIDs, DistanceQuery<? super O> distQuery, DoubleDataStore coredists, WritableDoubleDataStore m) {
double coreP = coredists.doubleValue(id);
for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) {
// M(i) = dist(i, n+1)
double coreQ = coredists.doubleValue(it);
double dist = MathUtil.max(coreP, coreQ, distQuery.distance(id, it));
m.putDouble(it, dist);
}
} | [
"private",
"void",
"step2",
"(",
"DBIDRef",
"id",
",",
"DBIDs",
"processedIDs",
",",
"DistanceQuery",
"<",
"?",
"super",
"O",
">",
"distQuery",
",",
"DoubleDataStore",
"coredists",
",",
"WritableDoubleDataStore",
"m",
")",
"{",
"double",
"coreP",
"=",
"coredis... | Second step: Determine the pairwise distances from all objects in the
pointer representation to the new object with the specified id.
@param id the id of the object to be inserted into the pointer
representation
@param processedIDs the already processed ids
@param distQuery Distance query
@param m Data store | [
"Second",
"step",
":",
"Determine",
"the",
"pairwise",
"distances",
"from",
"all",
"objects",
"in",
"the",
"pointer",
"representation",
"to",
"the",
"new",
"object",
"with",
"the",
"specified",
"id",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java#L156-L164 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java | HashUtils.getMD5String | public static String getMD5String(String str) {
MessageDigest messageDigest = getMessageDigest(MD5);
return getHashString(str, messageDigest);
} | java | public static String getMD5String(String str) {
MessageDigest messageDigest = getMessageDigest(MD5);
return getHashString(str, messageDigest);
} | [
"public",
"static",
"String",
"getMD5String",
"(",
"String",
"str",
")",
"{",
"MessageDigest",
"messageDigest",
"=",
"getMessageDigest",
"(",
"MD5",
")",
";",
"return",
"getHashString",
"(",
"str",
",",
"messageDigest",
")",
";",
"}"
] | Calculate MD5 hash of a String
@param str - the String to hash
@return the MD5 hash value | [
"Calculate",
"MD5",
"hash",
"of",
"a",
"String"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java#L35-L38 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.plus | public static void plus(Complex_F64 a , Complex_F64 b , Complex_F64 result ) {
result.real = a.real + b.real;
result.imaginary = a.imaginary + b.imaginary;
} | java | public static void plus(Complex_F64 a , Complex_F64 b , Complex_F64 result ) {
result.real = a.real + b.real;
result.imaginary = a.imaginary + b.imaginary;
} | [
"public",
"static",
"void",
"plus",
"(",
"Complex_F64",
"a",
",",
"Complex_F64",
"b",
",",
"Complex_F64",
"result",
")",
"{",
"result",
".",
"real",
"=",
"a",
".",
"real",
"+",
"b",
".",
"real",
";",
"result",
".",
"imaginary",
"=",
"a",
".",
"imagin... | <p>
Addition: result = a + b
</p>
@param a Complex number. Not modified.
@param b Complex number. Not modified.
@param result Storage for output | [
"<p",
">",
"Addition",
":",
"result",
"=",
"a",
"+",
"b",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L52-L55 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java | DemuxingIoHandler.messageReceived | @Override
public void messageReceived(IoSession session, Object message)
throws Exception {
MessageHandler<Object> handler = findReceivedMessageHandler(message.getClass());
if (handler != null) {
handler.handleMessage(session, message);
} else {
throw new UnknownMessageTypeException(
"No message handler found for message type: " +
message.getClass().getSimpleName());
}
} | java | @Override
public void messageReceived(IoSession session, Object message)
throws Exception {
MessageHandler<Object> handler = findReceivedMessageHandler(message.getClass());
if (handler != null) {
handler.handleMessage(session, message);
} else {
throw new UnknownMessageTypeException(
"No message handler found for message type: " +
message.getClass().getSimpleName());
}
} | [
"@",
"Override",
"public",
"void",
"messageReceived",
"(",
"IoSession",
"session",
",",
"Object",
"message",
")",
"throws",
"Exception",
"{",
"MessageHandler",
"<",
"Object",
">",
"handler",
"=",
"findReceivedMessageHandler",
"(",
"message",
".",
"getClass",
"(",
... | Forwards the received events into the appropriate {@link MessageHandler}
which is registered by {@link #addReceivedMessageHandler(Class, MessageHandler)}.
<b>Warning !</b> If you are to overload this method, be aware that you
_must_ call the messageHandler in your own method, otherwise it won't
be called. | [
"Forwards",
"the",
"received",
"events",
"into",
"the",
"appropriate",
"{",
"@link",
"MessageHandler",
"}",
"which",
"is",
"registered",
"by",
"{",
"@link",
"#addReceivedMessageHandler",
"(",
"Class",
"MessageHandler",
")",
"}",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java#L223-L234 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java | IssueCategoryRegistry.addDefaults | private void addDefaults()
{
this.issueCategories.putIfAbsent(MANDATORY, new IssueCategory(MANDATORY, IssueCategoryRegistry.class.getCanonicalName(), "Mandatory", MANDATORY, 1000, true));
this.issueCategories.putIfAbsent(OPTIONAL, new IssueCategory(OPTIONAL, IssueCategoryRegistry.class.getCanonicalName(), "Optional", OPTIONAL, 1000, true));
this.issueCategories.putIfAbsent(POTENTIAL, new IssueCategory(POTENTIAL, IssueCategoryRegistry.class.getCanonicalName(), "Potential Issues", POTENTIAL, 1000, true));
this.issueCategories.putIfAbsent(CLOUD_MANDATORY, new IssueCategory(CLOUD_MANDATORY, IssueCategoryRegistry.class.getCanonicalName(), "Cloud Mandatory", CLOUD_MANDATORY, 1000, true));
this.issueCategories.putIfAbsent(INFORMATION, new IssueCategory(INFORMATION, IssueCategoryRegistry.class.getCanonicalName(), "Information", INFORMATION, 1000, true));
} | java | private void addDefaults()
{
this.issueCategories.putIfAbsent(MANDATORY, new IssueCategory(MANDATORY, IssueCategoryRegistry.class.getCanonicalName(), "Mandatory", MANDATORY, 1000, true));
this.issueCategories.putIfAbsent(OPTIONAL, new IssueCategory(OPTIONAL, IssueCategoryRegistry.class.getCanonicalName(), "Optional", OPTIONAL, 1000, true));
this.issueCategories.putIfAbsent(POTENTIAL, new IssueCategory(POTENTIAL, IssueCategoryRegistry.class.getCanonicalName(), "Potential Issues", POTENTIAL, 1000, true));
this.issueCategories.putIfAbsent(CLOUD_MANDATORY, new IssueCategory(CLOUD_MANDATORY, IssueCategoryRegistry.class.getCanonicalName(), "Cloud Mandatory", CLOUD_MANDATORY, 1000, true));
this.issueCategories.putIfAbsent(INFORMATION, new IssueCategory(INFORMATION, IssueCategoryRegistry.class.getCanonicalName(), "Information", INFORMATION, 1000, true));
} | [
"private",
"void",
"addDefaults",
"(",
")",
"{",
"this",
".",
"issueCategories",
".",
"putIfAbsent",
"(",
"MANDATORY",
",",
"new",
"IssueCategory",
"(",
"MANDATORY",
",",
"IssueCategoryRegistry",
".",
"class",
".",
"getCanonicalName",
"(",
")",
",",
"\"Mandatory... | Make sure that we have some reasonable defaults available. These would typically be provided by the rulesets
in the real world. | [
"Make",
"sure",
"that",
"we",
"have",
"some",
"reasonable",
"defaults",
"available",
".",
"These",
"would",
"typically",
"be",
"provided",
"by",
"the",
"rulesets",
"in",
"the",
"real",
"world",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java#L165-L172 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java | DockerAgentUtils.pullImage | public static boolean pullImage(Launcher launcher, final String imageTag, final String username, final String password, final String host)
throws IOException, InterruptedException {
return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {
public Boolean call() throws IOException {
DockerUtils.pullImage(imageTag, username, password, host);
return true;
}
});
} | java | public static boolean pullImage(Launcher launcher, final String imageTag, final String username, final String password, final String host)
throws IOException, InterruptedException {
return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {
public Boolean call() throws IOException {
DockerUtils.pullImage(imageTag, username, password, host);
return true;
}
});
} | [
"public",
"static",
"boolean",
"pullImage",
"(",
"Launcher",
"launcher",
",",
"final",
"String",
"imageTag",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"String",
"host",
")",
"throws",
"IOException",
",",
"InterruptedEx... | Execute pull docker image on agent
@param launcher
@param imageTag
@param username
@param password
@param host
@return
@throws IOException
@throws InterruptedException | [
"Execute",
"pull",
"docker",
"image",
"on",
"agent"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L205-L214 |
infinispan/infinispan | server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ClusteredCacheConfigurationAdd.java | ClusteredCacheConfigurationAdd.processModelNode | @Override
void processModelNode(OperationContext context, String containerName, ModelNode cache, ConfigurationBuilder builder, List<Dependency<?>> dependencies)
throws OperationFailedException {
// process cache attributes and elements
super.processModelNode(context, containerName, cache, builder, dependencies);
// adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource.MODE.resolveModelAttribute(context, cache);
CacheMode cacheMode = modeModel.isDefined() ? Mode.valueOf(modeModel.asString()).apply(this.mode) : this.mode;
builder.clustering().cacheMode(cacheMode);
final long remoteTimeout = ClusteredCacheConfigurationResource.REMOTE_TIMEOUT.resolveModelAttribute(context, cache).asLong();
// process clustered cache attributes and elements
if (cacheMode.isSynchronous()) {
builder.clustering().remoteTimeout(remoteTimeout);
}
} | java | @Override
void processModelNode(OperationContext context, String containerName, ModelNode cache, ConfigurationBuilder builder, List<Dependency<?>> dependencies)
throws OperationFailedException {
// process cache attributes and elements
super.processModelNode(context, containerName, cache, builder, dependencies);
// adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource.MODE.resolveModelAttribute(context, cache);
CacheMode cacheMode = modeModel.isDefined() ? Mode.valueOf(modeModel.asString()).apply(this.mode) : this.mode;
builder.clustering().cacheMode(cacheMode);
final long remoteTimeout = ClusteredCacheConfigurationResource.REMOTE_TIMEOUT.resolveModelAttribute(context, cache).asLong();
// process clustered cache attributes and elements
if (cacheMode.isSynchronous()) {
builder.clustering().remoteTimeout(remoteTimeout);
}
} | [
"@",
"Override",
"void",
"processModelNode",
"(",
"OperationContext",
"context",
",",
"String",
"containerName",
",",
"ModelNode",
"cache",
",",
"ConfigurationBuilder",
"builder",
",",
"List",
"<",
"Dependency",
"<",
"?",
">",
">",
"dependencies",
")",
"throws",
... | Create a Configuration object initialized from the data in the operation.
@param cache data representing cache configuration
@param builder
@param dependencies
@return initialised Configuration object | [
"Create",
"a",
"Configuration",
"object",
"initialized",
"from",
"the",
"data",
"in",
"the",
"operation",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ClusteredCacheConfigurationAdd.java#L63-L80 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_addressMove_move_POST | public OvhAsyncTask<Long> packName_addressMove_move_POST(String packName, OvhCreation creation, Boolean keepCurrentNumber, OvhLandline landline, Date moveOutDate, String offerCode, OvhProviderEnum provider) throws IOException {
String qPath = "/pack/xdsl/{packName}/addressMove/move";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "creation", creation);
addBody(o, "keepCurrentNumber", keepCurrentNumber);
addBody(o, "landline", landline);
addBody(o, "moveOutDate", moveOutDate);
addBody(o, "offerCode", offerCode);
addBody(o, "provider", provider);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t7);
} | java | public OvhAsyncTask<Long> packName_addressMove_move_POST(String packName, OvhCreation creation, Boolean keepCurrentNumber, OvhLandline landline, Date moveOutDate, String offerCode, OvhProviderEnum provider) throws IOException {
String qPath = "/pack/xdsl/{packName}/addressMove/move";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "creation", creation);
addBody(o, "keepCurrentNumber", keepCurrentNumber);
addBody(o, "landline", landline);
addBody(o, "moveOutDate", moveOutDate);
addBody(o, "offerCode", offerCode);
addBody(o, "provider", provider);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t7);
} | [
"public",
"OvhAsyncTask",
"<",
"Long",
">",
"packName_addressMove_move_POST",
"(",
"String",
"packName",
",",
"OvhCreation",
"creation",
",",
"Boolean",
"keepCurrentNumber",
",",
"OvhLandline",
"landline",
",",
"Date",
"moveOutDate",
",",
"String",
"offerCode",
",",
... | Move the access to another address
REST: POST /pack/xdsl/{packName}/addressMove/move
@param moveOutDate [required] The date when the customer is no longer at the current address. Must be between now and +30 days
@param offerCode [required] The offerCode from addressMove/eligibility
@param keepCurrentNumber [required] Whether or not the current number should be kept
@param creation [required] The data to create a new line if lineNumber is not available
@param landline [required] Data identifying the landline at the new address, if available
@param provider [required] Provider of the new line
@param packName [required] The internal name of your pack | [
"Move",
"the",
"access",
"to",
"another",
"address"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L364-L376 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java | BaiduMessage.withSubstitutions | public BaiduMessage withSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
setSubstitutions(substitutions);
return this;
} | java | public BaiduMessage withSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
setSubstitutions(substitutions);
return this;
} | [
"public",
"BaiduMessage",
"withSubstitutions",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"substitutions",
")",
"{",
"setSubstitutions",
"(",
"substitutions",
")",
";",
"return",
"th... | Default message substitutions. Can be overridden by individual address substitutions.
@param substitutions
Default message substitutions. Can be overridden by individual address substitutions.
@return Returns a reference to this object so that method calls can be chained together. | [
"Default",
"message",
"substitutions",
".",
"Can",
"be",
"overridden",
"by",
"individual",
"address",
"substitutions",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java#L554-L557 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.getTabbedStatus | public TabbedPanel2 getTabbedStatus() {
if (tabbedStatus == null) {
tabbedStatus = new TabbedPanel2();
tabbedStatus.setPreferredSize(new Dimension(800, 200));
// ZAP: Move tabs to the top of the panel
tabbedStatus.setTabPlacement(JTabbedPane.TOP);
tabbedStatus.setName("tabbedStatus");
tabbedStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
return tabbedStatus;
} | java | public TabbedPanel2 getTabbedStatus() {
if (tabbedStatus == null) {
tabbedStatus = new TabbedPanel2();
tabbedStatus.setPreferredSize(new Dimension(800, 200));
// ZAP: Move tabs to the top of the panel
tabbedStatus.setTabPlacement(JTabbedPane.TOP);
tabbedStatus.setName("tabbedStatus");
tabbedStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
return tabbedStatus;
} | [
"public",
"TabbedPanel2",
"getTabbedStatus",
"(",
")",
"{",
"if",
"(",
"tabbedStatus",
"==",
"null",
")",
"{",
"tabbedStatus",
"=",
"new",
"TabbedPanel2",
"(",
")",
";",
"tabbedStatus",
".",
"setPreferredSize",
"(",
"new",
"Dimension",
"(",
"800",
",",
"200"... | Gets the tabbed panel that has the {@link PanelType#STATUS STATUS} panels.
<p>
Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing
layouts.
@return the tabbed panel of the {@code status} panels, never {@code null}
@see #addPanel(AbstractPanel, PanelType) | [
"Gets",
"the",
"tabbed",
"panel",
"that",
"has",
"the",
"{",
"@link",
"PanelType#STATUS",
"STATUS",
"}",
"panels",
".",
"<p",
">",
"Direct",
"access",
"/",
"manipulation",
"of",
"the",
"tabbed",
"panel",
"is",
"discouraged",
"the",
"changes",
"done",
"to",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L708-L718 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatterBuilder.java | MoneyFormatterBuilder.appendInternal | private MoneyFormatterBuilder appendInternal(MoneyPrinter printer, MoneyParser parser) {
printers.add(printer);
parsers.add(parser);
return this;
} | java | private MoneyFormatterBuilder appendInternal(MoneyPrinter printer, MoneyParser parser) {
printers.add(printer);
parsers.add(parser);
return this;
} | [
"private",
"MoneyFormatterBuilder",
"appendInternal",
"(",
"MoneyPrinter",
"printer",
",",
"MoneyParser",
"parser",
")",
"{",
"printers",
".",
"add",
"(",
"printer",
")",
";",
"parsers",
".",
"add",
"(",
"parser",
")",
";",
"return",
"this",
";",
"}"
] | Appends the specified printer and parser to this builder.
<p>
Either the printer or parser must be non-null.
@param printer the printer to append, null makes the formatter unable to print
@param parser the parser to append, null makes the formatter unable to parse
@return this for chaining, never null | [
"Appends",
"the",
"specified",
"printer",
"and",
"parser",
"to",
"this",
"builder",
".",
"<p",
">",
"Either",
"the",
"printer",
"or",
"parser",
"must",
"be",
"non",
"-",
"null",
"."
] | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L263-L267 |
code4everything/util | src/main/java/com/zhazhapan/util/MailSender.java | MailSender.config | public static void config(MailHost mailHost, String personal, String from, String key, int port) {
config(mailHost, personal, from, key);
setPort(port);
} | java | public static void config(MailHost mailHost, String personal, String from, String key, int port) {
config(mailHost, personal, from, key);
setPort(port);
} | [
"public",
"static",
"void",
"config",
"(",
"MailHost",
"mailHost",
",",
"String",
"personal",
",",
"String",
"from",
",",
"String",
"key",
",",
"int",
"port",
")",
"{",
"config",
"(",
"mailHost",
",",
"personal",
",",
"from",
",",
"key",
")",
";",
"set... | 配置邮箱
@param mailHost 邮件服务器
@param personal 个人名称
@param from 发件箱
@param key 密码
@param port 端口 | [
"配置邮箱"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/MailSender.java#L93-L96 |
nemerosa/ontrack | ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/NameDescription.java | NameDescription.escapeName | public static String escapeName(String name) {
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("Blank or null is not a valid name.");
} else if (java.util.regex.Pattern.matches(NAME, name)) {
return name;
} else {
return name.replaceAll("[^A-Za-z0-9\\.\\-_]", "-");
}
} | java | public static String escapeName(String name) {
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("Blank or null is not a valid name.");
} else if (java.util.regex.Pattern.matches(NAME, name)) {
return name;
} else {
return name.replaceAll("[^A-Za-z0-9\\.\\-_]", "-");
}
} | [
"public",
"static",
"String",
"escapeName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Blank or null is not a valid name.\"",
")",
";",
"}",
"else",
... | Makes sure the given <code>name</code> is escaped properly before being used as a valid name.
@param name Name to convert
@return Name which is safe to use
@see #NAME | [
"Makes",
"sure",
"the",
"given",
"<code",
">",
"name<",
"/",
"code",
">",
"is",
"escaped",
"properly",
"before",
"being",
"used",
"as",
"a",
"valid",
"name",
"."
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/NameDescription.java#L49-L57 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java | Util.findMethod | public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
MethodDoc[] methods = cd.methods();
for (int i = 0; i < methods.length; i++) {
if (executableMembersEqual(method, methods[i])) {
return methods[i];
}
}
return null;
} | java | public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
MethodDoc[] methods = cd.methods();
for (int i = 0; i < methods.length; i++) {
if (executableMembersEqual(method, methods[i])) {
return methods[i];
}
}
return null;
} | [
"public",
"static",
"MethodDoc",
"findMethod",
"(",
"ClassDoc",
"cd",
",",
"MethodDoc",
"method",
")",
"{",
"MethodDoc",
"[",
"]",
"methods",
"=",
"cd",
".",
"methods",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
... | Search for the given method in the given class.
@param cd Class to search into.
@param method Method to be searched.
@return MethodDoc Method found, null otherwise. | [
"Search",
"for",
"the",
"given",
"method",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java#L120-L129 |
craftercms/deployer | src/main/java/org/craftercms/deployer/utils/ConfigUtils.java | ConfigUtils.getIntegerProperty | public static Integer getIntegerProperty(Configuration config, String key,
Integer defaultValue) throws DeployerConfigurationException {
try {
return config.getInteger(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | java | public static Integer getIntegerProperty(Configuration config, String key,
Integer defaultValue) throws DeployerConfigurationException {
try {
return config.getInteger(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | [
"public",
"static",
"Integer",
"getIntegerProperty",
"(",
"Configuration",
"config",
",",
"String",
"key",
",",
"Integer",
"defaultValue",
")",
"throws",
"DeployerConfigurationException",
"{",
"try",
"{",
"return",
"config",
".",
"getInteger",
"(",
"key",
",",
"de... | Returns the specified Integer property from the configuration
@param config the configuration
@param key the key of the property
@param defaultValue the default value if the property is not found
@return the Integer value of the property, or the default value if not found
@throws DeployerConfigurationException if an error occurred | [
"Returns",
"the",
"specified",
"Integer",
"property",
"from",
"the",
"configuration"
] | train | https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L183-L190 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java | AccountFiltersInner.createOrUpdate | public AccountFilterInner createOrUpdate(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).toBlocking().single().body();
} | java | public AccountFilterInner createOrUpdate(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).toBlocking().single().body();
} | [
"public",
"AccountFilterInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"filterName",
",",
"AccountFilterInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Create or update an Account Filter.
Creates or updates an Account Filter in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param filterName The Account Filter name
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AccountFilterInner object if successful. | [
"Create",
"or",
"update",
"an",
"Account",
"Filter",
".",
"Creates",
"or",
"updates",
"an",
"Account",
"Filter",
"in",
"the",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java#L330-L332 |
tomgibara/streams | src/main/java/com/tomgibara/streams/StreamBytes.java | StreamBytes.writeStream | public WriteStream writeStream() {
detachReader();
if (writer == null) {
writer = new BytesWriteStream(bytes, maxCapacity);
}
return writer;
} | java | public WriteStream writeStream() {
detachReader();
if (writer == null) {
writer = new BytesWriteStream(bytes, maxCapacity);
}
return writer;
} | [
"public",
"WriteStream",
"writeStream",
"(",
")",
"{",
"detachReader",
"(",
")",
";",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"writer",
"=",
"new",
"BytesWriteStream",
"(",
"bytes",
",",
"maxCapacity",
")",
";",
"}",
"return",
"writer",
";",
"}"
] | Attaches a writer to the object. If there is already an attached writer,
the existing writer is returned. If a reader is attached to the object
when this method is called, the reader is closed and immediately detached
before a writer is created.
@return the writer attached to this object | [
"Attaches",
"a",
"writer",
"to",
"the",
"object",
".",
"If",
"there",
"is",
"already",
"an",
"attached",
"writer",
"the",
"existing",
"writer",
"is",
"returned",
".",
"If",
"a",
"reader",
"is",
"attached",
"to",
"the",
"object",
"when",
"this",
"method",
... | train | https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamBytes.java#L108-L114 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/view/WeekView.java | WeekView.setWeekDayViewFactory | public final void setWeekDayViewFactory(Callback<WeekDayParameter, WeekDayView> factory) {
requireNonNull(factory);
weekDayViewFactoryProperty().set(factory);
} | java | public final void setWeekDayViewFactory(Callback<WeekDayParameter, WeekDayView> factory) {
requireNonNull(factory);
weekDayViewFactoryProperty().set(factory);
} | [
"public",
"final",
"void",
"setWeekDayViewFactory",
"(",
"Callback",
"<",
"WeekDayParameter",
",",
"WeekDayView",
">",
"factory",
")",
"{",
"requireNonNull",
"(",
"factory",
")",
";",
"weekDayViewFactoryProperty",
"(",
")",
".",
"set",
"(",
"factory",
")",
";",
... | Sets the value of {@link #weekDayViewFactoryProperty()}.
@param factory the new factory | [
"Sets",
"the",
"value",
"of",
"{",
"@link",
"#weekDayViewFactoryProperty",
"()",
"}",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/WeekView.java#L245-L248 |
mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java | ExpandableExtension.getExpandedItemsCount | public int getExpandedItemsCount(int from, int position) {
int totalAddedItems = 0;
//first we find out how many items were added in total
//also counting subItems
Item tmp;
for (int i = from; i < position; i++) {
tmp = mFastAdapter.getItem(i);
if (tmp instanceof IExpandable) {
IExpandable tmpExpandable = ((IExpandable) tmp);
if (tmpExpandable.getSubItems() != null && tmpExpandable.isExpanded()) {
totalAddedItems = totalAddedItems + tmpExpandable.getSubItems().size();
}
}
}
return totalAddedItems;
} | java | public int getExpandedItemsCount(int from, int position) {
int totalAddedItems = 0;
//first we find out how many items were added in total
//also counting subItems
Item tmp;
for (int i = from; i < position; i++) {
tmp = mFastAdapter.getItem(i);
if (tmp instanceof IExpandable) {
IExpandable tmpExpandable = ((IExpandable) tmp);
if (tmpExpandable.getSubItems() != null && tmpExpandable.isExpanded()) {
totalAddedItems = totalAddedItems + tmpExpandable.getSubItems().size();
}
}
}
return totalAddedItems;
} | [
"public",
"int",
"getExpandedItemsCount",
"(",
"int",
"from",
",",
"int",
"position",
")",
"{",
"int",
"totalAddedItems",
"=",
"0",
";",
"//first we find out how many items were added in total",
"//also counting subItems",
"Item",
"tmp",
";",
"for",
"(",
"int",
"i",
... | calculates the count of expandable items before a given position
@param from the global start position you should pass here the count of items of the previous adapters (or 0 if you want to start from the beginning)
@param position the global position
@return the count of expandable items before a given position | [
"calculates",
"the",
"count",
"of",
"expandable",
"items",
"before",
"a",
"given",
"position"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/expandable/ExpandableExtension.java#L465-L480 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.isFalse | public static void isFalse (final boolean bValue, @Nonnull final Supplier <? extends String> aMsg)
{
if (isEnabled ())
if (bValue)
throw new IllegalArgumentException ("The expression must be false but it is not: " + aMsg.get ());
} | java | public static void isFalse (final boolean bValue, @Nonnull final Supplier <? extends String> aMsg)
{
if (isEnabled ())
if (bValue)
throw new IllegalArgumentException ("The expression must be false but it is not: " + aMsg.get ());
} | [
"public",
"static",
"void",
"isFalse",
"(",
"final",
"boolean",
"bValue",
",",
"@",
"Nonnull",
"final",
"Supplier",
"<",
"?",
"extends",
"String",
">",
"aMsg",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"if",
"(",
"bValue",
")",
"throw",
"new",
... | Check that the passed value is <code>false</code>.
@param bValue
The value to check.
@param aMsg
The message to be emitted in case the value is <code>true</code>
@throws IllegalArgumentException
if the passed value is not <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"<code",
">",
"false<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L168-L173 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java | Indices.isContiguous | public static boolean isContiguous(int[] indices, int diff) {
if (indices.length < 1)
return true;
for (int i = 1; i < indices.length; i++) {
if (Math.abs(indices[i] - indices[i - 1]) > diff)
return false;
}
return true;
} | java | public static boolean isContiguous(int[] indices, int diff) {
if (indices.length < 1)
return true;
for (int i = 1; i < indices.length; i++) {
if (Math.abs(indices[i] - indices[i - 1]) > diff)
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isContiguous",
"(",
"int",
"[",
"]",
"indices",
",",
"int",
"diff",
")",
"{",
"if",
"(",
"indices",
".",
"length",
"<",
"1",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"indices",
"... | Returns whether indices are contiguous
by a certain amount or not
@param indices the indices to test
@param diff the difference considered to be contiguous
@return whether the given indices are contiguous or not | [
"Returns",
"whether",
"indices",
"are",
"contiguous",
"by",
"a",
"certain",
"amount",
"or",
"not"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L276-L285 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/HybridRunbookWorkerGroupsInner.java | HybridRunbookWorkerGroupsInner.get | public HybridRunbookWorkerGroupInner get(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName).toBlocking().single().body();
} | java | public HybridRunbookWorkerGroupInner get(String resourceGroupName, String automationAccountName, String hybridRunbookWorkerGroupName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName).toBlocking().single().body();
} | [
"public",
"HybridRunbookWorkerGroupInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"hybridRunbookWorkerGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName"... | Retrieve a hybrid runbook worker group.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param hybridRunbookWorkerGroupName The hybrid runbook worker group name
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the HybridRunbookWorkerGroupInner object if successful. | [
"Retrieve",
"a",
"hybrid",
"runbook",
"worker",
"group",
"."
] | 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/HybridRunbookWorkerGroupsInner.java#L189-L191 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java | RowReaderDefaultImpl.readPkValuesFrom | public void readPkValuesFrom(ResultSetAndStatement rs_stmt, Map row)
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
ClassDescriptor cld;
if (ojbClass != null)
{
cld = m_cld.getRepository().getDescriptorFor(ojbClass);
}
else
{
cld = m_cld;
}
FieldDescriptor[] pkFields = cld.getPkFields();
readValuesFrom(rs_stmt, row, pkFields);
} | java | public void readPkValuesFrom(ResultSetAndStatement rs_stmt, Map row)
{
String ojbClass = SqlHelper.getOjbClassName(rs_stmt.m_rs);
ClassDescriptor cld;
if (ojbClass != null)
{
cld = m_cld.getRepository().getDescriptorFor(ojbClass);
}
else
{
cld = m_cld;
}
FieldDescriptor[] pkFields = cld.getPkFields();
readValuesFrom(rs_stmt, row, pkFields);
} | [
"public",
"void",
"readPkValuesFrom",
"(",
"ResultSetAndStatement",
"rs_stmt",
",",
"Map",
"row",
")",
"{",
"String",
"ojbClass",
"=",
"SqlHelper",
".",
"getOjbClassName",
"(",
"rs_stmt",
".",
"m_rs",
")",
";",
"ClassDescriptor",
"cld",
";",
"if",
"(",
"ojbCla... | /*
@see RowReader#readPkValuesFrom(ResultSet, ClassDescriptor, Map)
@throws PersistenceBrokerException if there is an error accessing the access layer | [
"/",
"*"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java#L215-L231 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java | DefaultPageShell.addCssHeadlines | private void addCssHeadlines(final PrintWriter writer, final List cssHeadlines) {
if (cssHeadlines == null || cssHeadlines.isEmpty()) {
return;
}
writer.write("<!-- Start css headlines -->"
+ "\n<style type=\"" + WebUtilities.CONTENT_TYPE_CSS + "\" media=\"screen\">");
for (Object line : cssHeadlines) {
writer.write("\n" + line);
}
writer.write("\n</style>"
+ "<!-- End css headlines -->");
} | java | private void addCssHeadlines(final PrintWriter writer, final List cssHeadlines) {
if (cssHeadlines == null || cssHeadlines.isEmpty()) {
return;
}
writer.write("<!-- Start css headlines -->"
+ "\n<style type=\"" + WebUtilities.CONTENT_TYPE_CSS + "\" media=\"screen\">");
for (Object line : cssHeadlines) {
writer.write("\n" + line);
}
writer.write("\n</style>"
+ "<!-- End css headlines -->");
} | [
"private",
"void",
"addCssHeadlines",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"List",
"cssHeadlines",
")",
"{",
"if",
"(",
"cssHeadlines",
"==",
"null",
"||",
"cssHeadlines",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"writer",
".... | Add a list of css headline entries intended to be added only once to the page.
@param writer the writer to write to.
@param cssHeadlines a list of css entries to be added to the page as a whole. | [
"Add",
"a",
"list",
"of",
"css",
"headline",
"entries",
"intended",
"to",
"be",
"added",
"only",
"once",
"to",
"the",
"page",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/DefaultPageShell.java#L185-L199 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java | KunderaMetadataManager.getEntityMetadata | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, String persistenceUnit,
Class entityClass)
{
return getMetamodel(kunderaMetadata, persistenceUnit).getEntityMetadata(entityClass);
} | java | public static EntityMetadata getEntityMetadata(final KunderaMetadata kunderaMetadata, String persistenceUnit,
Class entityClass)
{
return getMetamodel(kunderaMetadata, persistenceUnit).getEntityMetadata(entityClass);
} | [
"public",
"static",
"EntityMetadata",
"getEntityMetadata",
"(",
"final",
"KunderaMetadata",
"kunderaMetadata",
",",
"String",
"persistenceUnit",
",",
"Class",
"entityClass",
")",
"{",
"return",
"getMetamodel",
"(",
"kunderaMetadata",
",",
"persistenceUnit",
")",
".",
... | Gets the entity metadata.
@param persistenceUnit
the persistence unit
@param entityClass
the entity class
@return the entity metadata | [
"Gets",
"the",
"entity",
"metadata",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java#L111-L115 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/kafka/serialize/MD5Digest.java | MD5Digest.fromString | public static MD5Digest fromString(String md5String) {
byte[] bytes;
try {
bytes = Hex.decodeHex(md5String.toCharArray());
return new MD5Digest(md5String, bytes);
} catch (DecoderException e) {
throw new IllegalArgumentException("Unable to convert md5string", e);
}
} | java | public static MD5Digest fromString(String md5String) {
byte[] bytes;
try {
bytes = Hex.decodeHex(md5String.toCharArray());
return new MD5Digest(md5String, bytes);
} catch (DecoderException e) {
throw new IllegalArgumentException("Unable to convert md5string", e);
}
} | [
"public",
"static",
"MD5Digest",
"fromString",
"(",
"String",
"md5String",
")",
"{",
"byte",
"[",
"]",
"bytes",
";",
"try",
"{",
"bytes",
"=",
"Hex",
".",
"decodeHex",
"(",
"md5String",
".",
"toCharArray",
"(",
")",
")",
";",
"return",
"new",
"MD5Digest"... | Static method to get an MD5Digest from a human-readable string representation
@param md5String
@return a filled out MD5Digest | [
"Static",
"method",
"to",
"get",
"an",
"MD5Digest",
"from",
"a",
"human",
"-",
"readable",
"string",
"representation"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/kafka/serialize/MD5Digest.java#L57-L65 |
jamesagnew/hapi-fhir | hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java | AdditionalRequestHeadersInterceptor.addHeaderValue | public void addHeaderValue(String headerName, String headerValue) {
Objects.requireNonNull(headerName, "headerName cannot be null");
Objects.requireNonNull(headerValue, "headerValue cannot be null");
getHeaderValues(headerName).add(headerValue);
} | java | public void addHeaderValue(String headerName, String headerValue) {
Objects.requireNonNull(headerName, "headerName cannot be null");
Objects.requireNonNull(headerValue, "headerValue cannot be null");
getHeaderValues(headerName).add(headerValue);
} | [
"public",
"void",
"addHeaderValue",
"(",
"String",
"headerName",
",",
"String",
"headerValue",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"headerName",
",",
"\"headerName cannot be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"headerValue",
",",
... | Adds the given header value.
Note that {@code headerName} and {@code headerValue} cannot be null.
@param headerName the name of the header
@param headerValue the value to add for the header
@throws NullPointerException if either parameter is {@code null} | [
"Adds",
"the",
"given",
"header",
"value",
".",
"Note",
"that",
"{"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java#L58-L63 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.rnnSetPreviousStates | public void rnnSetPreviousStates(Map<String, Map<String, INDArray>> previousStates) {
for (Map.Entry<String, Map<String, INDArray>> entry : previousStates.entrySet()) {
rnnSetPreviousState(entry.getKey(), entry.getValue());
}
} | java | public void rnnSetPreviousStates(Map<String, Map<String, INDArray>> previousStates) {
for (Map.Entry<String, Map<String, INDArray>> entry : previousStates.entrySet()) {
rnnSetPreviousState(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"rnnSetPreviousStates",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"INDArray",
">",
">",
"previousStates",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"INDArray",
">",
">",... | Set the states for all RNN layers, for use in {@link #rnnTimeStep(INDArray...)}
@param previousStates The previous time step states for all layers (key: layer name. Value: layer states)
@see #rnnGetPreviousStates() | [
"Set",
"the",
"states",
"for",
"all",
"RNN",
"layers",
"for",
"use",
"in",
"{",
"@link",
"#rnnTimeStep",
"(",
"INDArray",
"...",
")",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3533-L3537 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.setStructuralFeature | public static void setStructuralFeature(EObject object, EStructuralFeature property, Object value) {
assert object != null;
assert property != null;
if (value == null) {
object.eUnset(property);
} else {
object.eSet(property, value);
}
} | java | public static void setStructuralFeature(EObject object, EStructuralFeature property, Object value) {
assert object != null;
assert property != null;
if (value == null) {
object.eUnset(property);
} else {
object.eSet(property, value);
}
} | [
"public",
"static",
"void",
"setStructuralFeature",
"(",
"EObject",
"object",
",",
"EStructuralFeature",
"property",
",",
"Object",
"value",
")",
"{",
"assert",
"object",
"!=",
"null",
";",
"assert",
"property",
"!=",
"null",
";",
"if",
"(",
"value",
"==",
"... | Set the given structure feature with the given value.
@param object the object that contains the feature.
@param property the feature to change.
@param value the value of the feature. | [
"Set",
"the",
"given",
"structure",
"feature",
"with",
"the",
"given",
"value",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1696-L1704 |
spring-projects/spring-social-facebook | spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java | SignedRequestDecoder.decodeSignedRequest | public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException {
String[] split = signedRequest.split("\\.");
String encodedSignature = split[0];
String payload = split[1];
String decoded = base64DecodeToString(payload);
byte[] signature = base64DecodeToBytes(encodedSignature);
try {
T data = objectMapper.readValue(decoded, type);
String algorithm = objectMapper.readTree(decoded).get("algorithm").textValue();
if (algorithm == null || !algorithm.equals("HMAC-SHA256")) {
throw new SignedRequestException("Unknown encryption algorithm: " + algorithm);
}
byte[] expectedSignature = encrypt(payload, secret);
if (!Arrays.equals(expectedSignature, signature)) {
throw new SignedRequestException("Invalid signature.");
}
return data;
} catch (IOException e) {
throw new SignedRequestException("Error parsing payload.", e);
}
} | java | public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException {
String[] split = signedRequest.split("\\.");
String encodedSignature = split[0];
String payload = split[1];
String decoded = base64DecodeToString(payload);
byte[] signature = base64DecodeToBytes(encodedSignature);
try {
T data = objectMapper.readValue(decoded, type);
String algorithm = objectMapper.readTree(decoded).get("algorithm").textValue();
if (algorithm == null || !algorithm.equals("HMAC-SHA256")) {
throw new SignedRequestException("Unknown encryption algorithm: " + algorithm);
}
byte[] expectedSignature = encrypt(payload, secret);
if (!Arrays.equals(expectedSignature, signature)) {
throw new SignedRequestException("Invalid signature.");
}
return data;
} catch (IOException e) {
throw new SignedRequestException("Error parsing payload.", e);
}
} | [
"public",
"<",
"T",
">",
"T",
"decodeSignedRequest",
"(",
"String",
"signedRequest",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"SignedRequestException",
"{",
"String",
"[",
"]",
"split",
"=",
"signedRequest",
".",
"split",
"(",
"\"\\\\.\"",
")",
... | Decodes a signed request, returning the payload of the signed request as a specified type.
@param signedRequest the value of the signed_request parameter sent by Facebook.
@param type the type to bind the signed_request to.
@param <T> the Java type to bind the signed_request to.
@return the payload of the signed request as an object
@throws SignedRequestException if there is an error decoding the signed request | [
"Decodes",
"a",
"signed",
"request",
"returning",
"the",
"payload",
"of",
"the",
"signed",
"request",
"as",
"a",
"specified",
"type",
"."
] | train | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java#L71-L91 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.setItem | public String setItem(String iid, Map<String, Object> properties)
throws ExecutionException, InterruptedException, IOException {
return setItem(iid, properties, new DateTime());
} | java | public String setItem(String iid, Map<String, Object> properties)
throws ExecutionException, InterruptedException, IOException {
return setItem(iid, properties, new DateTime());
} | [
"public",
"String",
"setItem",
"(",
"String",
"iid",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"IOException",
"{",
"return",
"setItem",
"(",
"iid",
",",
"properties",
","... | Sets properties of a item. Same as {@link #setItem(String, Map, DateTime) setItem(String,
Map<String, Object>, DateTime)} except event time is not specified and recorded as the
time when the function is called. | [
"Sets",
"properties",
"of",
"a",
"item",
".",
"Same",
"as",
"{"
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L493-L496 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/QuickSelect.java | QuickSelect.selectExcludingZeros | public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) {
if (pivot > nonZeros) {
return 0L;
}
final int arrSize = arr.length;
final int zeros = arrSize - nonZeros;
final int adjK = (pivot + zeros) - 1;
return select(arr, 0, arrSize - 1, adjK);
} | java | public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) {
if (pivot > nonZeros) {
return 0L;
}
final int arrSize = arr.length;
final int zeros = arrSize - nonZeros;
final int adjK = (pivot + zeros) - 1;
return select(arr, 0, arrSize - 1, adjK);
} | [
"public",
"static",
"double",
"selectExcludingZeros",
"(",
"final",
"double",
"[",
"]",
"arr",
",",
"final",
"int",
"nonZeros",
",",
"final",
"int",
"pivot",
")",
"{",
"if",
"(",
"pivot",
">",
"nonZeros",
")",
"{",
"return",
"0L",
";",
"}",
"final",
"i... | Gets the 1-based kth order statistic from the array excluding any zero values in the
array. Warning! This changes the ordering of elements in the given array!
@param arr The hash array.
@param nonZeros The number of non-zero values in the array.
@param pivot The 1-based index of the value that is chosen as the pivot for the array.
After the operation all values below this 1-based index will be less than this value
and all values above this index will be greater. The 0-based index of the pivot will be
pivot+arr.length-nonZeros-1.
@return The value of the smallest (N)th element excluding zeros, where N is 1-based. | [
"Gets",
"the",
"1",
"-",
"based",
"kth",
"order",
"statistic",
"from",
"the",
"array",
"excluding",
"any",
"zero",
"values",
"in",
"the",
"array",
".",
"Warning!",
"This",
"changes",
"the",
"ordering",
"of",
"elements",
"in",
"the",
"given",
"array!"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L181-L189 |
alkacon/opencms-core | src/org/opencms/db/CmsExportPointDriver.java | CmsExportPointDriver.getExportPointFile | protected File getExportPointFile(String rootPath, String exportpoint) {
StringBuffer exportpath = new StringBuffer(128);
exportpath.append(m_exportpointLookupMap.get(exportpoint));
exportpath.append(rootPath.substring(exportpoint.length()));
return new File(exportpath.toString());
} | java | protected File getExportPointFile(String rootPath, String exportpoint) {
StringBuffer exportpath = new StringBuffer(128);
exportpath.append(m_exportpointLookupMap.get(exportpoint));
exportpath.append(rootPath.substring(exportpoint.length()));
return new File(exportpath.toString());
} | [
"protected",
"File",
"getExportPointFile",
"(",
"String",
"rootPath",
",",
"String",
"exportpoint",
")",
"{",
"StringBuffer",
"exportpath",
"=",
"new",
"StringBuffer",
"(",
"128",
")",
";",
"exportpath",
".",
"append",
"(",
"m_exportpointLookupMap",
".",
"get",
... | Returns the File for the given export point resource.<p>
@param rootPath name of a file in the VFS
@param exportpoint the name of the export point
@return the File for the given export point resource | [
"Returns",
"the",
"File",
"for",
"the",
"given",
"export",
"point",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsExportPointDriver.java#L174-L180 |
landawn/AbacusUtil | src/com/landawn/abacus/util/IOUtil.java | IOUtil.map | public static MappedByteBuffer map(File file) {
N.checkArgNotNull(file);
return map(file, MapMode.READ_ONLY);
} | java | public static MappedByteBuffer map(File file) {
N.checkArgNotNull(file);
return map(file, MapMode.READ_ONLY);
} | [
"public",
"static",
"MappedByteBuffer",
"map",
"(",
"File",
"file",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"file",
")",
";",
"return",
"map",
"(",
"file",
",",
"MapMode",
".",
"READ_ONLY",
")",
";",
"}"
] | Note: copied from Google Guava under Apache License v2.
@param file
@return | [
"Note",
":",
"copied",
"from",
"Google",
"Guava",
"under",
"Apache",
"License",
"v2",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L2317-L2321 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java | JdbcAccessImpl.materializeObject | public Object materializeObject(ClassDescriptor cld, Identity oid)
throws PersistenceBrokerException
{
final StatementManagerIF sm = broker.serviceStatementManager();
final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectByPkStatement(cld);
Object result = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try
{
stmt = sm.getSelectByPKStatement(cld);
if (stmt == null)
{
logger.error("getSelectByPKStatement returned a null statement");
throw new PersistenceBrokerException("getSelectByPKStatement returned a null statement");
}
/*
arminw: currently a select by PK could never be a stored procedure,
thus we can always set 'false'. Is this correct??
*/
sm.bindSelect(stmt, oid, cld, false);
rs = stmt.executeQuery();
// data available read object, else return null
ResultSetAndStatement rs_stmt = new ResultSetAndStatement(broker.serviceStatementManager(), stmt, rs, sql);
if (rs.next())
{
Map row = new HashMap();
cld.getRowReader().readObjectArrayFrom(rs_stmt, row);
result = cld.getRowReader().readObjectFrom(row);
}
// close resources
rs_stmt.close();
}
catch (PersistenceBrokerException e)
{
// release resources on exception
sm.closeResources(stmt, rs);
logger.error("PersistenceBrokerException during the execution of materializeObject: " + e.getMessage(), e);
throw e;
}
catch (SQLException e)
{
// release resources on exception
sm.closeResources(stmt, rs);
throw ExceptionHelper.generateException(e, sql.getStatement(), cld, logger, null);
}
return result;
} | java | public Object materializeObject(ClassDescriptor cld, Identity oid)
throws PersistenceBrokerException
{
final StatementManagerIF sm = broker.serviceStatementManager();
final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectByPkStatement(cld);
Object result = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try
{
stmt = sm.getSelectByPKStatement(cld);
if (stmt == null)
{
logger.error("getSelectByPKStatement returned a null statement");
throw new PersistenceBrokerException("getSelectByPKStatement returned a null statement");
}
/*
arminw: currently a select by PK could never be a stored procedure,
thus we can always set 'false'. Is this correct??
*/
sm.bindSelect(stmt, oid, cld, false);
rs = stmt.executeQuery();
// data available read object, else return null
ResultSetAndStatement rs_stmt = new ResultSetAndStatement(broker.serviceStatementManager(), stmt, rs, sql);
if (rs.next())
{
Map row = new HashMap();
cld.getRowReader().readObjectArrayFrom(rs_stmt, row);
result = cld.getRowReader().readObjectFrom(row);
}
// close resources
rs_stmt.close();
}
catch (PersistenceBrokerException e)
{
// release resources on exception
sm.closeResources(stmt, rs);
logger.error("PersistenceBrokerException during the execution of materializeObject: " + e.getMessage(), e);
throw e;
}
catch (SQLException e)
{
// release resources on exception
sm.closeResources(stmt, rs);
throw ExceptionHelper.generateException(e, sql.getStatement(), cld, logger, null);
}
return result;
} | [
"public",
"Object",
"materializeObject",
"(",
"ClassDescriptor",
"cld",
",",
"Identity",
"oid",
")",
"throws",
"PersistenceBrokerException",
"{",
"final",
"StatementManagerIF",
"sm",
"=",
"broker",
".",
"serviceStatementManager",
"(",
")",
";",
"final",
"SelectStateme... | performs a primary key lookup operation against RDBMS and materializes
an object from the resulting row. Only skalar attributes are filled from
the row, references are not resolved.
@param oid contains the primary key info.
@param cld ClassDescriptor providing mapping information.
@return the materialized object, null if no matching row was found or if
any error occured. | [
"performs",
"a",
"primary",
"key",
"lookup",
"operation",
"against",
"RDBMS",
"and",
"materializes",
"an",
"object",
"from",
"the",
"resulting",
"row",
".",
"Only",
"skalar",
"attributes",
"are",
"filled",
"from",
"the",
"row",
"references",
"are",
"not",
"res... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java#L570-L617 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java | RuleTagHelper.applyTags | static boolean applyTags(RuleDto rule, Set<String> tags) {
for (String tag : tags) {
RuleTagFormat.validate(tag);
}
Set<String> initialTags = rule.getTags();
final Set<String> systemTags = rule.getSystemTags();
Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !systemTags.contains(input));
rule.setTags(withoutSystemTags);
return withoutSystemTags.size() != initialTags.size() || !withoutSystemTags.containsAll(initialTags);
} | java | static boolean applyTags(RuleDto rule, Set<String> tags) {
for (String tag : tags) {
RuleTagFormat.validate(tag);
}
Set<String> initialTags = rule.getTags();
final Set<String> systemTags = rule.getSystemTags();
Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !systemTags.contains(input));
rule.setTags(withoutSystemTags);
return withoutSystemTags.size() != initialTags.size() || !withoutSystemTags.containsAll(initialTags);
} | [
"static",
"boolean",
"applyTags",
"(",
"RuleDto",
"rule",
",",
"Set",
"<",
"String",
">",
"tags",
")",
"{",
"for",
"(",
"String",
"tag",
":",
"tags",
")",
"{",
"RuleTagFormat",
".",
"validate",
"(",
"tag",
")",
";",
"}",
"Set",
"<",
"String",
">",
... | Validates tags and resolves conflicts between user and system tags. | [
"Validates",
"tags",
"and",
"resolves",
"conflicts",
"between",
"user",
"and",
"system",
"tags",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java#L36-L46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.