repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java | BuildTasksInner.listSourceRepositoryProperties | public SourceRepositoryPropertiesInner listSourceRepositoryProperties(String resourceGroupName, String registryName, String buildTaskName) {
return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).toBlocking().single().body();
} | java | public SourceRepositoryPropertiesInner listSourceRepositoryProperties(String resourceGroupName, String registryName, String buildTaskName) {
return listSourceRepositoryPropertiesWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName).toBlocking().single().body();
} | [
"public",
"SourceRepositoryPropertiesInner",
"listSourceRepositoryProperties",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildTaskName",
")",
"{",
"return",
"listSourceRepositoryPropertiesWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Get the source control properties for a build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@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 SourceRepositoryPropertiesInner object if successful. | [
"Get",
"the",
"source",
"control",
"properties",
"for",
"a",
"build",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildTasksInner.java#L987-L989 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java | CmsReplaceDialog.showErrorReport | public void showErrorReport(final String message, final String stacktrace) {
if (!m_canceled) {
CmsErrorDialog errDialog = new CmsErrorDialog(message, stacktrace);
if (m_handlerReg != null) {
m_handlerReg.removeHandler();
}
if (m_closeHandler != null) {
errDialog.addCloseHandler(m_closeHandler);
}
hide();
errDialog.center();
}
} | java | public void showErrorReport(final String message, final String stacktrace) {
if (!m_canceled) {
CmsErrorDialog errDialog = new CmsErrorDialog(message, stacktrace);
if (m_handlerReg != null) {
m_handlerReg.removeHandler();
}
if (m_closeHandler != null) {
errDialog.addCloseHandler(m_closeHandler);
}
hide();
errDialog.center();
}
} | [
"public",
"void",
"showErrorReport",
"(",
"final",
"String",
"message",
",",
"final",
"String",
"stacktrace",
")",
"{",
"if",
"(",
"!",
"m_canceled",
")",
"{",
"CmsErrorDialog",
"errDialog",
"=",
"new",
"CmsErrorDialog",
"(",
"message",
",",
"stacktrace",
")",... | Shows the error report.<p>
@param message the message to show
@param stacktrace the stacktrace to show | [
"Shows",
"the",
"error",
"report",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/replace/CmsReplaceDialog.java#L250-L263 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.listObjectsV2 | private ListBucketResult listObjectsV2(String bucketName, String continuationToken, String prefix, String delimiter)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Map<String,String> queryParamMap = new HashMap<>();
queryParamMap.put("list-type", "2");
if (continuationToken != null) {
queryParamMap.put("continuation-token", continuationToken);
}
if (prefix != null) {
queryParamMap.put("prefix", prefix);
} else {
queryParamMap.put("prefix", "");
}
if (delimiter != null) {
queryParamMap.put("delimiter", delimiter);
} else {
queryParamMap.put("delimiter", "");
}
HttpResponse response = executeGet(bucketName, null, null, queryParamMap);
ListBucketResult result = new ListBucketResult();
result.parseXml(response.body().charStream());
response.body().close();
return result;
} | java | private ListBucketResult listObjectsV2(String bucketName, String continuationToken, String prefix, String delimiter)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
Map<String,String> queryParamMap = new HashMap<>();
queryParamMap.put("list-type", "2");
if (continuationToken != null) {
queryParamMap.put("continuation-token", continuationToken);
}
if (prefix != null) {
queryParamMap.put("prefix", prefix);
} else {
queryParamMap.put("prefix", "");
}
if (delimiter != null) {
queryParamMap.put("delimiter", delimiter);
} else {
queryParamMap.put("delimiter", "");
}
HttpResponse response = executeGet(bucketName, null, null, queryParamMap);
ListBucketResult result = new ListBucketResult();
result.parseXml(response.body().charStream());
response.body().close();
return result;
} | [
"private",
"ListBucketResult",
"listObjectsV2",
"(",
"String",
"bucketName",
",",
"String",
"continuationToken",
",",
"String",
"prefix",
",",
"String",
"delimiter",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataExceptio... | Returns {@link ListBucketResult} of given bucket, marker, prefix and delimiter.
@param bucketName Bucket name.
@param continuationToken Marker string. List objects whose name is greater than `marker`.
@param prefix Prefix string. List objects whose name starts with `prefix`.
@param delimiter Delimiter string. Group objects whose name contains `delimiter`. | [
"Returns",
"{",
"@link",
"ListBucketResult",
"}",
"of",
"given",
"bucket",
"marker",
"prefix",
"and",
"delimiter",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L3015-L3044 |
lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.writeDocument | public void writeDocument(OutputStream os, MediaType mt, Document document) {
ProvFormat format = mimeTypeRevMap.get(mt.toString());
writeDocument(os, format, document);
} | java | public void writeDocument(OutputStream os, MediaType mt, Document document) {
ProvFormat format = mimeTypeRevMap.get(mt.toString());
writeDocument(os, format, document);
} | [
"public",
"void",
"writeDocument",
"(",
"OutputStream",
"os",
",",
"MediaType",
"mt",
",",
"Document",
"document",
")",
"{",
"ProvFormat",
"format",
"=",
"mimeTypeRevMap",
".",
"get",
"(",
"mt",
".",
"toString",
"(",
")",
")",
";",
"writeDocument",
"(",
"o... | Write a {@link Document} to output stream, according to specified Internet Media Type
@param os an {@link OutputStream} to write the Document to
@param mt a {@link MediaType}
@param document a {@link Document} to serialize | [
"Write",
"a",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L1064-L1067 |
milaboratory/milib | src/main/java/com/milaboratory/core/io/util/IOUtil.java | IOUtil.writeRawVarint32 | public static void writeRawVarint32(OutputStream os, int value) throws IOException {
while (true) {
if ((value & ~0x7F) == 0) {
os.write(value);
return;
} else {
os.write((value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | java | public static void writeRawVarint32(OutputStream os, int value) throws IOException {
while (true) {
if ((value & ~0x7F) == 0) {
os.write(value);
return;
} else {
os.write((value & 0x7F) | 0x80);
value >>>= 7;
}
}
} | [
"public",
"static",
"void",
"writeRawVarint32",
"(",
"OutputStream",
"os",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"(",
"value",
"&",
"~",
"0x7F",
")",
"==",
"0",
")",
"{",
"os",
".",
"write"... | Encode and write a varint. {@code value} is treated as unsigned, so it won't be sign-extended if negative.
<p>Copied from com.google.protobuf.CodedOutputStream from Google's protobuf library.</p> | [
"Encode",
"and",
"write",
"a",
"varint",
".",
"{",
"@code",
"value",
"}",
"is",
"treated",
"as",
"unsigned",
"so",
"it",
"won",
"t",
"be",
"sign",
"-",
"extended",
"if",
"negative",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/IOUtil.java#L84-L94 |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/Regex.java | Regex.startsWith | public boolean startsWith(PushbackReader in, int size) throws IOException
{
InputReader reader = Input.getInstance(in, size);
boolean b = startsWith(reader);
reader.release();
return b;
} | java | public boolean startsWith(PushbackReader in, int size) throws IOException
{
InputReader reader = Input.getInstance(in, size);
boolean b = startsWith(reader);
reader.release();
return b;
} | [
"public",
"boolean",
"startsWith",
"(",
"PushbackReader",
"in",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"InputReader",
"reader",
"=",
"Input",
".",
"getInstance",
"(",
"in",
",",
"size",
")",
";",
"boolean",
"b",
"=",
"startsWith",
"(",
"rea... | Returns true if input start matches the regular expression
@param in
@param size
@return
@throws IOException | [
"Returns",
"true",
"if",
"input",
"start",
"matches",
"the",
"regular",
"expression"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/Regex.java#L505-L511 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java | JSONArray.put | public JSONArray put(int index, Object value) throws JSONException {
if (value instanceof Number) {
// deviate from the original by checking all Numbers, not just floats &
// doubles
JSON.checkDouble(((Number) value).doubleValue());
}
while (this.values.size() <= index) {
this.values.add(null);
}
this.values.set(index, value);
return this;
} | java | public JSONArray put(int index, Object value) throws JSONException {
if (value instanceof Number) {
// deviate from the original by checking all Numbers, not just floats &
// doubles
JSON.checkDouble(((Number) value).doubleValue());
}
while (this.values.size() <= index) {
this.values.add(null);
}
this.values.set(index, value);
return this;
} | [
"public",
"JSONArray",
"put",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"// deviate from the original by checking all Numbers, not just floats &",
"// doubles",
"JSON",
".",
... | Sets the value at {@code index} to {@code value}, null padding this array to the
required length if necessary. If a value already exists at {@code
index}, it will be replaced.
@param index the index to set the value to
@param value a {@link JSONObject}, {@link JSONArray}, String, Boolean, Integer,
Long, Double, {@link JSONObject#NULL}, or {@code null}. May not be
{@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}.
@return this array.
@throws JSONException if processing of json failed | [
"Sets",
"the",
"value",
"at",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONArray.java#L250-L261 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java | FaceListsImpl.addFaceFromUrl | public PersistedFace addFaceFromUrl(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) {
return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).toBlocking().single().body();
} | java | public PersistedFace addFaceFromUrl(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) {
return addFaceFromUrlWithServiceResponseAsync(faceListId, url, addFaceFromUrlOptionalParameter).toBlocking().single().body();
} | [
"public",
"PersistedFace",
"addFaceFromUrl",
"(",
"String",
"faceListId",
",",
"String",
"url",
",",
"AddFaceFromUrlOptionalParameter",
"addFaceFromUrlOptionalParameter",
")",
"{",
"return",
"addFaceFromUrlWithServiceResponseAsync",
"(",
"faceListId",
",",
"url",
",",
"addF... | Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
@param faceListId Id referencing a particular face list.
@param url Publicly reachable URL of an image
@param addFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API
@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 PersistedFace object if successful. | [
"Add",
"a",
"face",
"to",
"a",
"face",
"list",
".",
"The",
"input",
"face",
"is",
"specified",
"as",
"an",
"image",
"with",
"a",
"targetFace",
"rectangle",
".",
"It",
"returns",
"a",
"persistedFaceId",
"representing",
"the",
"added",
"face",
"and",
"persis... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L751-L753 |
apereo/cas | core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java | PolicyBasedAuthenticationManager.getPrincipalResolverLinkedToHandlerIfAny | protected PrincipalResolver getPrincipalResolverLinkedToHandlerIfAny(final AuthenticationHandler handler, final AuthenticationTransaction transaction) {
return this.authenticationEventExecutionPlan.getPrincipalResolverForAuthenticationTransaction(handler, transaction);
} | java | protected PrincipalResolver getPrincipalResolverLinkedToHandlerIfAny(final AuthenticationHandler handler, final AuthenticationTransaction transaction) {
return this.authenticationEventExecutionPlan.getPrincipalResolverForAuthenticationTransaction(handler, transaction);
} | [
"protected",
"PrincipalResolver",
"getPrincipalResolverLinkedToHandlerIfAny",
"(",
"final",
"AuthenticationHandler",
"handler",
",",
"final",
"AuthenticationTransaction",
"transaction",
")",
"{",
"return",
"this",
".",
"authenticationEventExecutionPlan",
".",
"getPrincipalResolve... | Gets principal resolver linked to the handler if any.
@param handler the handler
@param transaction the transaction
@return the principal resolver linked to handler if any, or null. | [
"Gets",
"principal",
"resolver",
"linked",
"to",
"the",
"handler",
"if",
"any",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java#L240-L242 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java | SecondsDescriptor.describe | protected String describe(final On on, final boolean and) {
if (and) {
return nominalValue(on.getTime());
}
return String.format("%s %s ", bundle.getString("at"), nominalValue(on.getTime())) + "%s";
} | java | protected String describe(final On on, final boolean and) {
if (and) {
return nominalValue(on.getTime());
}
return String.format("%s %s ", bundle.getString("at"), nominalValue(on.getTime())) + "%s";
} | [
"protected",
"String",
"describe",
"(",
"final",
"On",
"on",
",",
"final",
"boolean",
"and",
")",
"{",
"if",
"(",
"and",
")",
"{",
"return",
"nominalValue",
"(",
"on",
".",
"getTime",
"(",
")",
")",
";",
"}",
"return",
"String",
".",
"format",
"(",
... | Provide a human readable description for On instance.
@param on - On
@return human readable description - String | [
"Provide",
"a",
"human",
"readable",
"description",
"for",
"On",
"instance",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/refactor/SecondsDescriptor.java#L136-L141 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_ltsolve.java | Dcs_ltsolve.cs_ltsolve | public static boolean cs_ltsolve(Dcs L, double[] x) {
int p, j, n, Lp[], Li[];
double Lx[];
if (!Dcs_util.CS_CSC(L) || x == null)
return (false); /* check inputs */
n = L.n;
Lp = L.p;
Li = L.i;
Lx = L.x;
for (j = n - 1; j >= 0; j--) {
for (p = Lp[j] + 1; p < Lp[j + 1]; p++) {
x[j] -= Lx[p] * x[Li[p]];
}
x[j] /= Lx[Lp[j]];
}
return (true);
} | java | public static boolean cs_ltsolve(Dcs L, double[] x) {
int p, j, n, Lp[], Li[];
double Lx[];
if (!Dcs_util.CS_CSC(L) || x == null)
return (false); /* check inputs */
n = L.n;
Lp = L.p;
Li = L.i;
Lx = L.x;
for (j = n - 1; j >= 0; j--) {
for (p = Lp[j] + 1; p < Lp[j + 1]; p++) {
x[j] -= Lx[p] * x[Li[p]];
}
x[j] /= Lx[Lp[j]];
}
return (true);
} | [
"public",
"static",
"boolean",
"cs_ltsolve",
"(",
"Dcs",
"L",
",",
"double",
"[",
"]",
"x",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Lp",
"[",
"]",
",",
"Li",
"[",
"]",
";",
"double",
"Lx",
"[",
"]",
";",
"if",
"(",
"!",
"Dcs_util",
... | Solves an upper triangular system L'x=b where x and b are dense. x=b on
input, solution on output.
@param L
column-compressed, lower triangular matrix
@param x
size n, right hand side on input, solution on output
@return true if successful, false on error | [
"Solves",
"an",
"upper",
"triangular",
"system",
"L",
"x",
"=",
"b",
"where",
"x",
"and",
"b",
"are",
"dense",
".",
"x",
"=",
"b",
"on",
"input",
"solution",
"on",
"output",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_ltsolve.java#L46-L62 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.foldNonZeroInColumn | public double foldNonZeroInColumn(int j, VectorAccumulator accumulator) {
eachNonZeroInColumn(j, Vectors.asAccumulatorProcedure(accumulator));
return accumulator.accumulate();
} | java | public double foldNonZeroInColumn(int j, VectorAccumulator accumulator) {
eachNonZeroInColumn(j, Vectors.asAccumulatorProcedure(accumulator));
return accumulator.accumulate();
} | [
"public",
"double",
"foldNonZeroInColumn",
"(",
"int",
"j",
",",
"VectorAccumulator",
"accumulator",
")",
"{",
"eachNonZeroInColumn",
"(",
"j",
",",
"Vectors",
".",
"asAccumulatorProcedure",
"(",
"accumulator",
")",
")",
";",
"return",
"accumulator",
".",
"accumul... | Folds non-zero elements of the specified column in this matrix with the given {@code accumulator}.
@param j the column index.
@param accumulator the {@link VectorAccumulator}.
@return the accumulated value. | [
"Folds",
"non",
"-",
"zero",
"elements",
"of",
"the",
"specified",
"column",
"in",
"this",
"matrix",
"with",
"the",
"given",
"{",
"@code",
"accumulator",
"}",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L366-L369 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/reporter/ReportFormatter.java | ReportFormatter.getSubstitutedTemplateContent | protected static String getSubstitutedTemplateContent(String templateContent, NamesValuesList<String, String> namesValues) {
String templateContentSubst = templateContent;
// substitute the name/values
for (NameValue<String, String> nameValue : namesValues) {
templateContentSubst = templateContentSubst.replace(nameValue.name, nameValue.value);
}
return templateContentSubst;
} | java | protected static String getSubstitutedTemplateContent(String templateContent, NamesValuesList<String, String> namesValues) {
String templateContentSubst = templateContent;
// substitute the name/values
for (NameValue<String, String> nameValue : namesValues) {
templateContentSubst = templateContentSubst.replace(nameValue.name, nameValue.value);
}
return templateContentSubst;
} | [
"protected",
"static",
"String",
"getSubstitutedTemplateContent",
"(",
"String",
"templateContent",
",",
"NamesValuesList",
"<",
"String",
",",
"String",
">",
"namesValues",
")",
"{",
"String",
"templateContentSubst",
"=",
"templateContent",
";",
"// substitute the name/v... | Substitutes names by values in template and return result.
@param templateContent content of the template to substitute
@param namesValues list of names/values to substitute
@return result of substitution | [
"Substitutes",
"names",
"by",
"values",
"in",
"template",
"and",
"return",
"result",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/reporter/ReportFormatter.java#L78-L86 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java | PropertiesBasedStyleLibrary.setCached | private <T> void setCached(String prefix, String postfix, T data) {
cache.put(prefix + '.' + postfix, data);
} | java | private <T> void setCached(String prefix, String postfix, T data) {
cache.put(prefix + '.' + postfix, data);
} | [
"private",
"<",
"T",
">",
"void",
"setCached",
"(",
"String",
"prefix",
",",
"String",
"postfix",
",",
"T",
"data",
")",
"{",
"cache",
".",
"put",
"(",
"prefix",
"+",
"'",
"'",
"+",
"postfix",
",",
"data",
")",
";",
"}"
] | Set a cache value
@param <T> Type
@param prefix Tree name
@param postfix Property name
@param data Data | [
"Set",
"a",
"cache",
"value"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java#L181-L183 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.statObject | public ObjectStat statObject(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
HttpResponse response = executeHead(bucketName, objectName);
ResponseHeader header = response.header();
Map<String,List<String>> httpHeaders = response.httpHeaders();
ObjectStat objectStat = new ObjectStat(bucketName, objectName, header, httpHeaders);
return objectStat;
} | java | public ObjectStat statObject(String bucketName, String objectName)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
HttpResponse response = executeHead(bucketName, objectName);
ResponseHeader header = response.header();
Map<String,List<String>> httpHeaders = response.httpHeaders();
ObjectStat objectStat = new ObjectStat(bucketName, objectName, header, httpHeaders);
return objectStat;
} | [
"public",
"ObjectStat",
"statObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException",
",",
"IOException",
",",
"InvalidKeyException",
",",
"NoResponseEx... | Returns meta data information of given object in given bucket.
</p><b>Example:</b><br>
<pre>{@code ObjectStat objectStat = minioClient.statObject("my-bucketname", "my-objectname");
System.out.println(objectStat); }</pre>
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@return Populated object metadata.
@throws InvalidBucketNameException upon invalid bucket name is given
@throws NoSuchAlgorithmException
upon requested algorithm was not found during signature calculation
@throws InsufficientDataException upon getting EOFException while reading given
InputStream even before reading given length
@throws IOException upon connection error
@throws InvalidKeyException
upon an invalid access key or secret key
@throws NoResponseException upon no response from server
@throws XmlPullParserException upon parsing response xml
@throws ErrorResponseException upon unsuccessful execution
@throws InternalException upon internal library error
@see ObjectStat | [
"Returns",
"meta",
"data",
"information",
"of",
"given",
"object",
"in",
"given",
"bucket",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1475-L1485 |
radkovo/SwingBox | src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java | DelegateView.getChildAllocation | @Override
public Shape getChildAllocation(int index, Shape a)
{
if (view != null) return view.getChildAllocation(index, a);
return a;
} | java | @Override
public Shape getChildAllocation(int index, Shape a)
{
if (view != null) return view.getChildAllocation(index, a);
return a;
} | [
"@",
"Override",
"public",
"Shape",
"getChildAllocation",
"(",
"int",
"index",
",",
"Shape",
"a",
")",
"{",
"if",
"(",
"view",
"!=",
"null",
")",
"return",
"view",
".",
"getChildAllocation",
"(",
"index",
",",
"a",
")",
";",
"return",
"a",
";",
"}"
] | Fetches the allocation for the given child view. This enables finding out
where various views are located, without assuming the views store their
location. This returns the given allocation since this view simply acts
as a gateway between the view hierarchy and the associated component.
@param index
the index of the child
@param a
the allocation to this view.
@return the allocation to the child | [
"Fetches",
"the",
"allocation",
"for",
"the",
"given",
"child",
"view",
".",
"This",
"enables",
"finding",
"out",
"where",
"various",
"views",
"are",
"located",
"without",
"assuming",
"the",
"views",
"store",
"their",
"location",
".",
"This",
"returns",
"the",... | train | https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java#L341-L346 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java | GenKUmsAllCamt05200107.createSaldo | private CashBalance8 createSaldo(Saldo saldo, boolean start) throws Exception {
CashBalance8 bal = new CashBalance8();
BalanceType13 bt = new BalanceType13();
bt.setCdOrPrtry(new BalanceType10Choice());
bt.getCdOrPrtry().setCd(start ? "PRCD" : "CLBD");
bal.setTp(bt);
ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
bal.setAmt(amt);
if (saldo != null && saldo.value != null) {
amt.setCcy(saldo.value.getCurr());
amt.setValue(saldo.value.getBigDecimalValue());
}
long ts = saldo != null && saldo.timestamp != null ? saldo.timestamp.getTime() : 0;
// Startsaldo ist in CAMT der Endsaldo vom Vortag. Daher muessen wir noch einen Tag abziehen
if (start && ts > 0)
ts -= 24 * 60 * 60 * 1000L;
DateAndDateTime2Choice date = new DateAndDateTime2Choice();
date.setDt(this.createCalendar(ts));
bal.setDt(date);
return bal;
} | java | private CashBalance8 createSaldo(Saldo saldo, boolean start) throws Exception {
CashBalance8 bal = new CashBalance8();
BalanceType13 bt = new BalanceType13();
bt.setCdOrPrtry(new BalanceType10Choice());
bt.getCdOrPrtry().setCd(start ? "PRCD" : "CLBD");
bal.setTp(bt);
ActiveOrHistoricCurrencyAndAmount amt = new ActiveOrHistoricCurrencyAndAmount();
bal.setAmt(amt);
if (saldo != null && saldo.value != null) {
amt.setCcy(saldo.value.getCurr());
amt.setValue(saldo.value.getBigDecimalValue());
}
long ts = saldo != null && saldo.timestamp != null ? saldo.timestamp.getTime() : 0;
// Startsaldo ist in CAMT der Endsaldo vom Vortag. Daher muessen wir noch einen Tag abziehen
if (start && ts > 0)
ts -= 24 * 60 * 60 * 1000L;
DateAndDateTime2Choice date = new DateAndDateTime2Choice();
date.setDt(this.createCalendar(ts));
bal.setDt(date);
return bal;
} | [
"private",
"CashBalance8",
"createSaldo",
"(",
"Saldo",
"saldo",
",",
"boolean",
"start",
")",
"throws",
"Exception",
"{",
"CashBalance8",
"bal",
"=",
"new",
"CashBalance8",
"(",
")",
";",
"BalanceType13",
"bt",
"=",
"new",
"BalanceType13",
"(",
")",
";",
"b... | Erzeugt ein Saldo-Objekt.
@param saldo das HBCI4Java-Saldo-Objekt.
@param start true, wenn es ein Startsaldo ist.
@return das CAMT-Saldo-Objekt.
@throws Exception | [
"Erzeugt",
"ein",
"Saldo",
"-",
"Objekt",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java#L275-L302 |
SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java | LoadReportAnalysisMetadataHolderStep.checkQualityProfilesConsistency | private void checkQualityProfilesConsistency(ScannerReport.Metadata metadata, Organization organization) {
List<String> profileKeys = metadata.getQprofilesPerLanguage().values().stream()
.map(QProfile::getKey)
.collect(toList(metadata.getQprofilesPerLanguage().size()));
try (DbSession dbSession = dbClient.openSession(false)) {
List<QProfileDto> profiles = dbClient.qualityProfileDao().selectByUuids(dbSession, profileKeys);
String badKeys = profiles.stream()
.filter(p -> !p.getOrganizationUuid().equals(organization.getUuid()))
.map(QProfileDto::getKee)
.collect(MoreCollectors.join(Joiner.on(", ")));
if (!badKeys.isEmpty()) {
throw MessageException.of(format("Quality profiles with following keys don't exist in organization [%s]: %s", organization.getKey(), badKeys));
}
}
} | java | private void checkQualityProfilesConsistency(ScannerReport.Metadata metadata, Organization organization) {
List<String> profileKeys = metadata.getQprofilesPerLanguage().values().stream()
.map(QProfile::getKey)
.collect(toList(metadata.getQprofilesPerLanguage().size()));
try (DbSession dbSession = dbClient.openSession(false)) {
List<QProfileDto> profiles = dbClient.qualityProfileDao().selectByUuids(dbSession, profileKeys);
String badKeys = profiles.stream()
.filter(p -> !p.getOrganizationUuid().equals(organization.getUuid()))
.map(QProfileDto::getKee)
.collect(MoreCollectors.join(Joiner.on(", ")));
if (!badKeys.isEmpty()) {
throw MessageException.of(format("Quality profiles with following keys don't exist in organization [%s]: %s", organization.getKey(), badKeys));
}
}
} | [
"private",
"void",
"checkQualityProfilesConsistency",
"(",
"ScannerReport",
".",
"Metadata",
"metadata",
",",
"Organization",
"organization",
")",
"{",
"List",
"<",
"String",
">",
"profileKeys",
"=",
"metadata",
".",
"getQprofilesPerLanguage",
"(",
")",
".",
"values... | Check that the Quality profiles sent by scanner correctly relate to the project organization. | [
"Check",
"that",
"the",
"Quality",
"profiles",
"sent",
"by",
"scanner",
"correctly",
"relate",
"to",
"the",
"project",
"organization",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java#L177-L191 |
zaproxy/zaproxy | src/org/zaproxy/zap/network/ZapNTLMEngineImpl.java | ZapNTLMEngineImpl.ntlm2SessionResponse | static byte[] ntlm2SessionResponse(final byte[] ntlmHash, final byte[] challenge,
final byte[] clientChallenge) throws AuthenticationException {
try {
final MessageDigest md5 = getMD5();
md5.update(challenge);
md5.update(clientChallenge);
final byte[] digest = md5.digest();
final byte[] sessionHash = new byte[8];
System.arraycopy(digest, 0, sessionHash, 0, 8);
return lmResponse(ntlmHash, sessionHash);
} catch (final Exception e) {
if (e instanceof AuthenticationException) {
throw (AuthenticationException) e;
}
throw new AuthenticationException(e.getMessage(), e);
}
} | java | static byte[] ntlm2SessionResponse(final byte[] ntlmHash, final byte[] challenge,
final byte[] clientChallenge) throws AuthenticationException {
try {
final MessageDigest md5 = getMD5();
md5.update(challenge);
md5.update(clientChallenge);
final byte[] digest = md5.digest();
final byte[] sessionHash = new byte[8];
System.arraycopy(digest, 0, sessionHash, 0, 8);
return lmResponse(ntlmHash, sessionHash);
} catch (final Exception e) {
if (e instanceof AuthenticationException) {
throw (AuthenticationException) e;
}
throw new AuthenticationException(e.getMessage(), e);
}
} | [
"static",
"byte",
"[",
"]",
"ntlm2SessionResponse",
"(",
"final",
"byte",
"[",
"]",
"ntlmHash",
",",
"final",
"byte",
"[",
"]",
"challenge",
",",
"final",
"byte",
"[",
"]",
"clientChallenge",
")",
"throws",
"AuthenticationException",
"{",
"try",
"{",
"final"... | Calculates the NTLM2 Session Response for the given challenge, using the
specified password and client challenge.
@return The NTLM2 Session Response. This is placed in the NTLM response
field of the Type 3 message; the LM response field contains the
client challenge, null-padded to 24 bytes. | [
"Calculates",
"the",
"NTLM2",
"Session",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"password",
"and",
"client",
"challenge",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/network/ZapNTLMEngineImpl.java#L609-L626 |
apigee/usergrid-java-sdk | src/main/java/org/usergrid/java/client/Client.java | Client.postGroupActivity | public ApiResponse postGroupActivity(String groupId, String verb, String title,
String content, String category, User user, Entity object,
String objectType, String objectName, String objectContent) {
Activity activity = Activity.newActivity(verb, title, content,
category, user, object, objectType, objectName, objectContent);
return postGroupActivity(groupId, activity);
} | java | public ApiResponse postGroupActivity(String groupId, String verb, String title,
String content, String category, User user, Entity object,
String objectType, String objectName, String objectContent) {
Activity activity = Activity.newActivity(verb, title, content,
category, user, object, objectType, objectName, objectContent);
return postGroupActivity(groupId, activity);
} | [
"public",
"ApiResponse",
"postGroupActivity",
"(",
"String",
"groupId",
",",
"String",
"verb",
",",
"String",
"title",
",",
"String",
"content",
",",
"String",
"category",
",",
"User",
"user",
",",
"Entity",
"object",
",",
"String",
"objectType",
",",
"String"... | Creates and posts an activity to a group.
@param groupId
@param verb
@param title
@param content
@param category
@param user
@param object
@param objectType
@param objectName
@param objectContent
@return | [
"Creates",
"and",
"posts",
"an",
"activity",
"to",
"a",
"group",
"."
] | train | https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L728-L734 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java | JcrSession.getNonSystemNodeByIdentifier | public AbstractJcrNode getNonSystemNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
checkLive();
if (NodeKey.isValidFormat(id)) {
// Try the identifier as a node key ...
try {
NodeKey key = new NodeKey(id);
return node(key, null);
} catch (ItemNotFoundException e) {
// continue ...
}
}
// Try as node key identifier ...
NodeKey key = this.rootNode.key.withId(id);
return node(key, null);
} | java | public AbstractJcrNode getNonSystemNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
checkLive();
if (NodeKey.isValidFormat(id)) {
// Try the identifier as a node key ...
try {
NodeKey key = new NodeKey(id);
return node(key, null);
} catch (ItemNotFoundException e) {
// continue ...
}
}
// Try as node key identifier ...
NodeKey key = this.rootNode.key.withId(id);
return node(key, null);
} | [
"public",
"AbstractJcrNode",
"getNonSystemNodeByIdentifier",
"(",
"String",
"id",
")",
"throws",
"ItemNotFoundException",
",",
"RepositoryException",
"{",
"checkLive",
"(",
")",
";",
"if",
"(",
"NodeKey",
".",
"isValidFormat",
"(",
"id",
")",
")",
"{",
"// Try the... | A variant of the standard {@link #getNodeByIdentifier(String)} method that does <i>not</i> find nodes within the system
area. This is often needed by the {@link JcrVersionManager} functionality.
@param id the string identifier
@return the node; never null
@throws ItemNotFoundException if a node cannot be found in the non-system content of the repository
@throws RepositoryException if there is another problem
@see #getNodeByIdentifier(String) | [
"A",
"variant",
"of",
"the",
"standard",
"{",
"@link",
"#getNodeByIdentifier",
"(",
"String",
")",
"}",
"method",
"that",
"does",
"<i",
">",
"not<",
"/",
"i",
">",
"find",
"nodes",
"within",
"the",
"system",
"area",
".",
"This",
"is",
"often",
"needed",
... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSession.java#L842-L856 |
ButterFaces/ButterFaces | components/src/main/java/org/butterfaces/component/partrenderer/ReadonlyPartRenderer.java | ReadonlyPartRenderer.getReadonlyDisplayValue | private String getReadonlyDisplayValue(final Object value, final UIInput component, final Converter converter) {
if (value == null || "".equals(value)) {
return "-";
} else if (converter != null) {
final String asString = converter.getAsString(FacesContext.getCurrentInstance(), component, value);
return asString == null ? "-" : asString;
}
return String.valueOf(value);
} | java | private String getReadonlyDisplayValue(final Object value, final UIInput component, final Converter converter) {
if (value == null || "".equals(value)) {
return "-";
} else if (converter != null) {
final String asString = converter.getAsString(FacesContext.getCurrentInstance(), component, value);
return asString == null ? "-" : asString;
}
return String.valueOf(value);
} | [
"private",
"String",
"getReadonlyDisplayValue",
"(",
"final",
"Object",
"value",
",",
"final",
"UIInput",
"component",
",",
"final",
"Converter",
"converter",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"value",
")",
")",
... | Should return value string for the readonly view mode. Can be overridden
for custom components. | [
"Should",
"return",
"value",
"string",
"for",
"the",
"readonly",
"view",
"mode",
".",
"Can",
"be",
"overridden",
"for",
"custom",
"components",
"."
] | train | https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/component/partrenderer/ReadonlyPartRenderer.java#L54-L63 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java | KieServerControllerClientFactory.newRestClient | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password,
final MarshallingFormat format) {
return new RestKieServerControllerClient(controllerUrl,
login,
password,
format);
} | java | public static KieServerControllerClient newRestClient(final String controllerUrl,
final String login,
final String password,
final MarshallingFormat format) {
return new RestKieServerControllerClient(controllerUrl,
login,
password,
format);
} | [
"public",
"static",
"KieServerControllerClient",
"newRestClient",
"(",
"final",
"String",
"controllerUrl",
",",
"final",
"String",
"login",
",",
"final",
"String",
"password",
",",
"final",
"MarshallingFormat",
"format",
")",
"{",
"return",
"new",
"RestKieServerContro... | Creates a new Kie Controller Client using REST based service
@param controllerUrl the URL to the server (e.g.: "http://localhost:8080/kie-server-controller/rest/controller")
@param login user login
@param password user password
@param format marshaling format
@return client instance | [
"Creates",
"a",
"new",
"Kie",
"Controller",
"Client",
"using",
"REST",
"based",
"service"
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-controller/kie-server-controller-client/src/main/java/org/kie/server/controller/client/KieServerControllerClientFactory.java#L54-L62 |
d-michail/jheaps | src/main/java/org/jheaps/tree/BinaryTreeSoftHeap.java | BinaryTreeSoftHeap.meld | @Override
public void meld(MergeableHeap<K> other) {
BinaryTreeSoftHeap<K> h = (BinaryTreeSoftHeap<K>) other;
// check same comparator
if (comparator != null) {
if (h.comparator == null || !h.comparator.equals(comparator)) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
} else if (h.comparator != null) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
if (rankLimit != h.rankLimit) {
throw new IllegalArgumentException("Cannot meld heaps with different error rates!");
}
// perform the meld
mergeInto(h.rootList.head, h.rootList.tail);
size += h.size;
// clear other
h.size = 0;
h.rootList.head = null;
h.rootList.tail = null;
} | java | @Override
public void meld(MergeableHeap<K> other) {
BinaryTreeSoftHeap<K> h = (BinaryTreeSoftHeap<K>) other;
// check same comparator
if (comparator != null) {
if (h.comparator == null || !h.comparator.equals(comparator)) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
} else if (h.comparator != null) {
throw new IllegalArgumentException("Cannot meld heaps using different comparators!");
}
if (rankLimit != h.rankLimit) {
throw new IllegalArgumentException("Cannot meld heaps with different error rates!");
}
// perform the meld
mergeInto(h.rootList.head, h.rootList.tail);
size += h.size;
// clear other
h.size = 0;
h.rootList.head = null;
h.rootList.tail = null;
} | [
"@",
"Override",
"public",
"void",
"meld",
"(",
"MergeableHeap",
"<",
"K",
">",
"other",
")",
"{",
"BinaryTreeSoftHeap",
"<",
"K",
">",
"h",
"=",
"(",
"BinaryTreeSoftHeap",
"<",
"K",
">",
")",
"other",
";",
"// check same comparator",
"if",
"(",
"comparato... | {@inheritDoc}
@throws IllegalArgumentException
if {@code other} has a different error rate | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/BinaryTreeSoftHeap.java#L220-L245 |
aws/aws-sdk-java | aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java | StorageGatewayUtils.getActivationKey | public static String getActivationKey(String gatewayAddress, String activationRegionName) throws AmazonClientException {
try {
HttpParams httpClientParams = new BasicHttpParams();
httpClientParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
DefaultHttpClient client = new DefaultHttpClient(httpClientParams);
String url = "http://" + gatewayAddress;
if (activationRegionName != null) {
url += "/?activationRegion=" + activationRegionName;
}
HttpGet method = new HttpGet(url);
HttpResponse response = client.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 302)
throw new AmazonClientException("Could not fetch activation key. HTTP status code: " + statusCode);
Header[] headers = response.getHeaders("Location");
if (headers.length < 1)
throw new AmazonClientException("Could not fetch activation key, no location header found");
String activationUrl = headers[0].getValue();
String[] parts = activationUrl.split("activationKey=");
if (parts.length < 2 || null == parts[1])
throw new AmazonClientException("Unable to get activation key from : " + activationUrl);
return parts[1];
} catch (IOException ioe) {
throw new AmazonClientException("Unable to get activation key", ioe);
}
} | java | public static String getActivationKey(String gatewayAddress, String activationRegionName) throws AmazonClientException {
try {
HttpParams httpClientParams = new BasicHttpParams();
httpClientParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false);
DefaultHttpClient client = new DefaultHttpClient(httpClientParams);
String url = "http://" + gatewayAddress;
if (activationRegionName != null) {
url += "/?activationRegion=" + activationRegionName;
}
HttpGet method = new HttpGet(url);
HttpResponse response = client.execute(method);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode != 302)
throw new AmazonClientException("Could not fetch activation key. HTTP status code: " + statusCode);
Header[] headers = response.getHeaders("Location");
if (headers.length < 1)
throw new AmazonClientException("Could not fetch activation key, no location header found");
String activationUrl = headers[0].getValue();
String[] parts = activationUrl.split("activationKey=");
if (parts.length < 2 || null == parts[1])
throw new AmazonClientException("Unable to get activation key from : " + activationUrl);
return parts[1];
} catch (IOException ioe) {
throw new AmazonClientException("Unable to get activation key", ioe);
}
} | [
"public",
"static",
"String",
"getActivationKey",
"(",
"String",
"gatewayAddress",
",",
"String",
"activationRegionName",
")",
"throws",
"AmazonClientException",
"{",
"try",
"{",
"HttpParams",
"httpClientParams",
"=",
"new",
"BasicHttpParams",
"(",
")",
";",
"httpClie... | Sends a request to the AWS Storage Gateway server running at the
specified address and activation region, and returns the activation key
for that server.
@param gatewayAddress
The DNS name or IP address of a running AWS Storage Gateway
@param activationRegionName
The name of the region in which the gateway will be activated.
@return The activation key required for some API calls to AWS Storage
Gateway.
@throws AmazonClientException
If any problems are encountered while trying to contact the
remote AWS Storage Gateway server. | [
"Sends",
"a",
"request",
"to",
"the",
"AWS",
"Storage",
"Gateway",
"server",
"running",
"at",
"the",
"specified",
"address",
"and",
"activation",
"region",
"and",
"returns",
"the",
"activation",
"key",
"for",
"that",
"server",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-storagegateway/src/main/java/com/amazonaws/services/storagegateway/StorageGatewayUtils.java#L96-L127 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java | Json.makeStructureTypes | public static String makeStructureTypes( String nameForStructure, Bindings bindings, boolean mutable )
{
JsonStructureType type = (JsonStructureType)transformJsonObject( nameForStructure, null, bindings );
StringBuilder sb = new StringBuilder();
type.render( sb, 0, mutable );
return sb.toString();
} | java | public static String makeStructureTypes( String nameForStructure, Bindings bindings, boolean mutable )
{
JsonStructureType type = (JsonStructureType)transformJsonObject( nameForStructure, null, bindings );
StringBuilder sb = new StringBuilder();
type.render( sb, 0, mutable );
return sb.toString();
} | [
"public",
"static",
"String",
"makeStructureTypes",
"(",
"String",
"nameForStructure",
",",
"Bindings",
"bindings",
",",
"boolean",
"mutable",
")",
"{",
"JsonStructureType",
"type",
"=",
"(",
"JsonStructureType",
")",
"transformJsonObject",
"(",
"nameForStructure",
",... | Makes a tree of structure types reflecting the Bindings.
<p>
A structure type contains a property member for each name/value pair in the Bindings. A property has the same name as the key and follows these rules:
<ul>
<li> If the type of the value is a "simple" type, such as a String or Integer, the type of the property matches the simple type exactly
<li> Otherwise, if the value is a Bindings type, the property type is that of a child structure with the same name as the property and recursively follows these rules
<li> Otherwise, if the value is a List, the property is a List parameterized with the component type, and the component type recursively follows these rules
</ul> | [
"Makes",
"a",
"tree",
"of",
"structure",
"types",
"reflecting",
"the",
"Bindings",
".",
"<p",
">",
"A",
"structure",
"type",
"contains",
"a",
"property",
"member",
"for",
"each",
"name",
"/",
"value",
"pair",
"in",
"the",
"Bindings",
".",
"A",
"property",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/json/Json.java#L78-L84 |
beangle/beangle3 | commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java | HierarchyEntityUtils.sort | public static <T extends HierarchyEntity<T, ?>> Map<T, String> sort(List<T> datas, String property) {
final Map<T, String> sortedMap = tag(datas, property);
Collections.sort(datas, new Comparator<HierarchyEntity<T, ?>>() {
public int compare(HierarchyEntity<T, ?> arg0, HierarchyEntity<T, ?> arg1) {
String tag0 = sortedMap.get(arg0);
String tag1 = sortedMap.get(arg1);
return tag0.compareTo(tag1);
}
});
return sortedMap;
} | java | public static <T extends HierarchyEntity<T, ?>> Map<T, String> sort(List<T> datas, String property) {
final Map<T, String> sortedMap = tag(datas, property);
Collections.sort(datas, new Comparator<HierarchyEntity<T, ?>>() {
public int compare(HierarchyEntity<T, ?> arg0, HierarchyEntity<T, ?> arg1) {
String tag0 = sortedMap.get(arg0);
String tag1 = sortedMap.get(arg1);
return tag0.compareTo(tag1);
}
});
return sortedMap;
} | [
"public",
"static",
"<",
"T",
"extends",
"HierarchyEntity",
"<",
"T",
",",
"?",
">",
">",
"Map",
"<",
"T",
",",
"String",
">",
"sort",
"(",
"List",
"<",
"T",
">",
"datas",
",",
"String",
"property",
")",
"{",
"final",
"Map",
"<",
"T",
",",
"Strin... | 按照上下关系和指定属性排序
@param datas a {@link java.util.List} object.
@param property a {@link java.lang.String} object.
@param <T> a T object.
@return a {@link java.util.Map} object. | [
"按照上下关系和指定属性排序"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/util/HierarchyEntityUtils.java#L90-L100 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/StringUtils.java | StringUtils.replaceAfter | public static String replaceAfter(String str, int start, String rp) {
return replace(str, start, str.length() - 1, rp);
} | java | public static String replaceAfter(String str, int start, String rp) {
return replace(str, start, str.length() - 1, rp);
} | [
"public",
"static",
"String",
"replaceAfter",
"(",
"String",
"str",
",",
"int",
"start",
",",
"String",
"rp",
")",
"{",
"return",
"replace",
"(",
"str",
",",
"start",
",",
"str",
".",
"length",
"(",
")",
"-",
"1",
",",
"rp",
")",
";",
"}"
] | 替换指定起始位置之后的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换3,*,结果为123* | [
"替换指定起始位置之后的所有字符"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L93-L95 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getDeclaredMethodOfObj | public static Method getDeclaredMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
return getDeclaredMethod(obj.getClass(), methodName, getClasses(args));
} | java | public static Method getDeclaredMethodOfObj(Object obj, String methodName, Object... args) throws SecurityException {
return getDeclaredMethod(obj.getClass(), methodName, getClasses(args));
} | [
"public",
"static",
"Method",
"getDeclaredMethodOfObj",
"(",
"Object",
"obj",
",",
"String",
"methodName",
",",
"Object",
"...",
"args",
")",
"throws",
"SecurityException",
"{",
"return",
"getDeclaredMethod",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"methodNa... | 查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法
@param obj 被查找的对象
@param methodName 方法名
@param args 参数
@return 方法
@throws SecurityException 无访问权限抛出异常 | [
"查找指定对象中的所有方法(包括非public方法),也包括父对象和Object类的方法"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L328-L330 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/instance/ServerSocketHelper.java | ServerSocketHelper.createServerSocketChannel | static ServerSocketChannel createServerSocketChannel(ILogger logger, EndpointConfig endpointConfig, InetAddress bindAddress,
int port, int portCount, boolean isPortAutoIncrement,
boolean isReuseAddress, boolean bindAny) {
logger.finest("inet reuseAddress:" + isReuseAddress);
if (port == 0) {
logger.info("No explicit port is given, system will pick up an ephemeral port.");
}
int portTrialCount = port > 0 && isPortAutoIncrement ? portCount : 1;
try {
return tryOpenServerSocketChannel(endpointConfig, bindAddress, port, isReuseAddress, portTrialCount, bindAny, logger);
} catch (IOException e) {
String message = "Cannot bind to a given address: " + bindAddress + ". Hazelcast cannot start. ";
if (isPortAutoIncrement) {
message += "Config-port: " + port + ", latest-port: " + (port + portTrialCount - 1);
} else {
message += "Port [" + port + "] is already in use and auto-increment is disabled.";
}
throw new HazelcastException(message, e);
}
} | java | static ServerSocketChannel createServerSocketChannel(ILogger logger, EndpointConfig endpointConfig, InetAddress bindAddress,
int port, int portCount, boolean isPortAutoIncrement,
boolean isReuseAddress, boolean bindAny) {
logger.finest("inet reuseAddress:" + isReuseAddress);
if (port == 0) {
logger.info("No explicit port is given, system will pick up an ephemeral port.");
}
int portTrialCount = port > 0 && isPortAutoIncrement ? portCount : 1;
try {
return tryOpenServerSocketChannel(endpointConfig, bindAddress, port, isReuseAddress, portTrialCount, bindAny, logger);
} catch (IOException e) {
String message = "Cannot bind to a given address: " + bindAddress + ". Hazelcast cannot start. ";
if (isPortAutoIncrement) {
message += "Config-port: " + port + ", latest-port: " + (port + portTrialCount - 1);
} else {
message += "Port [" + port + "] is already in use and auto-increment is disabled.";
}
throw new HazelcastException(message, e);
}
} | [
"static",
"ServerSocketChannel",
"createServerSocketChannel",
"(",
"ILogger",
"logger",
",",
"EndpointConfig",
"endpointConfig",
",",
"InetAddress",
"bindAddress",
",",
"int",
"port",
",",
"int",
"portCount",
",",
"boolean",
"isPortAutoIncrement",
",",
"boolean",
"isReu... | Creates and binds {@code ServerSocketChannel} using {@code bindAddress} and {@code initialPort}.
<p>
If the {@code initialPort} is in use, then an available port can be selected by doing an incremental port
search if {@link NetworkConfig#isPortAutoIncrement()} allows.
<p>
When both {@code initialPort} and {@link NetworkConfig#getPort()} are zero, then an ephemeral port will be used.
<p>
When {@code bindAny} is {@code false}, {@code ServerSocket} will be bound to specific {@code bindAddress}.
Otherwise, it will be bound to any local address ({@code 0.0.0.0}).
@param logger logger instance
@param endpointConfig the {@link EndpointConfig} that supplies network configuration for the
server socket
@param bindAddress InetAddress to bind created {@code ServerSocket}
@param port initial port number to attempt to bind
@param portCount count of subsequent ports to attempt to bind to if initial port is already bound
@param isPortAutoIncrement when {@code true} attempt to bind to {@code portCount} subsequent ports
after {@code port} is found already bound
@param isReuseAddress sets reuse address socket option
@param bindAny when {@code true} bind any local address otherwise bind given {@code bindAddress}
@return actual port number that created {@code ServerSocketChannel} is bound to | [
"Creates",
"and",
"binds",
"{",
"@code",
"ServerSocketChannel",
"}",
"using",
"{",
"@code",
"bindAddress",
"}",
"and",
"{",
"@code",
"initialPort",
"}",
".",
"<p",
">",
"If",
"the",
"{",
"@code",
"initialPort",
"}",
"is",
"in",
"use",
"then",
"an",
"avai... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/ServerSocketHelper.java#L65-L86 |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java | AsciidocRuleParserPlugin.extractRules | private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException {
for (Object element : blocks) {
if (element instanceof AbstractBlock) {
AbstractBlock block = (AbstractBlock) element;
if (EXECUTABLE_RULE_TYPES.contains(block.getRole())) {
extractExecutableRule(ruleSource, block, builder);
} else if (GROUP.equals(block.getRole())) {
extractGroup(ruleSource, block, builder);
}
extractRules(ruleSource, block.getBlocks(), builder);
} else if (element instanceof Collection<?>) {
extractRules(ruleSource, (Collection<?>) element, builder);
}
}
} | java | private void extractRules(RuleSource ruleSource, Collection<?> blocks, RuleSetBuilder builder) throws RuleException {
for (Object element : blocks) {
if (element instanceof AbstractBlock) {
AbstractBlock block = (AbstractBlock) element;
if (EXECUTABLE_RULE_TYPES.contains(block.getRole())) {
extractExecutableRule(ruleSource, block, builder);
} else if (GROUP.equals(block.getRole())) {
extractGroup(ruleSource, block, builder);
}
extractRules(ruleSource, block.getBlocks(), builder);
} else if (element instanceof Collection<?>) {
extractRules(ruleSource, (Collection<?>) element, builder);
}
}
} | [
"private",
"void",
"extractRules",
"(",
"RuleSource",
"ruleSource",
",",
"Collection",
"<",
"?",
">",
"blocks",
",",
"RuleSetBuilder",
"builder",
")",
"throws",
"RuleException",
"{",
"for",
"(",
"Object",
"element",
":",
"blocks",
")",
"{",
"if",
"(",
"eleme... | Find all content parts representing source code listings with a role that
represents a rule.
@param ruleSource
The rule source.
@param blocks
The content parts of the document.
@param builder
The {@link RuleSetBuilder}. | [
"Find",
"all",
"content",
"parts",
"representing",
"source",
"code",
"listings",
"with",
"a",
"role",
"that",
"represents",
"a",
"rule",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/AsciidocRuleParserPlugin.java#L152-L166 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java | RestClientUtil.mgetDocumentsNew | public String mgetDocumentsNew(String index, Object... ids) throws ElasticSearchException{
return mgetDocuments(index, _doc,ids);
} | java | public String mgetDocumentsNew(String index, Object... ids) throws ElasticSearchException{
return mgetDocuments(index, _doc,ids);
} | [
"public",
"String",
"mgetDocumentsNew",
"(",
"String",
"index",
",",
"Object",
"...",
"ids",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"mgetDocuments",
"(",
"index",
",",
"_doc",
",",
"ids",
")",
";",
"}"
] | For Elasticsearch 7 and 7+
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
@param index _mget
test/_mget
test/type/_mget
test/type/_mget?stored_fields=field1,field2
_mget?routing=key1
@param ids
@return
@throws ElasticSearchException | [
"For",
"Elasticsearch",
"7",
"and",
"7",
"+",
"https",
":",
"//",
"www",
".",
"elastic",
".",
"co",
"/",
"guide",
"/",
"en",
"/",
"elasticsearch",
"/",
"reference",
"/",
"current",
"/",
"docs",
"-",
"multi",
"-",
"get",
".",
"html"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L5100-L5102 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsResourceTypeConfig.java | CmsResourceTypeConfig.checkViewable | public boolean checkViewable(CmsObject cms, String referenceUri) {
try {
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(m_typeName);
CmsResource referenceResource = cms.readResource(referenceUri);
if (settings == null) {
// no explorer type
return false;
}
return settings.getAccess().getPermissions(cms, referenceResource).requiresViewPermission();
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return false;
}
} | java | public boolean checkViewable(CmsObject cms, String referenceUri) {
try {
CmsExplorerTypeSettings settings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(m_typeName);
CmsResource referenceResource = cms.readResource(referenceUri);
if (settings == null) {
// no explorer type
return false;
}
return settings.getAccess().getPermissions(cms, referenceResource).requiresViewPermission();
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
return false;
}
} | [
"public",
"boolean",
"checkViewable",
"(",
"CmsObject",
"cms",
",",
"String",
"referenceUri",
")",
"{",
"try",
"{",
"CmsExplorerTypeSettings",
"settings",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getExplorerTypeSetting",
"(",
"m_typeName",
")",
... | Checks if a resource type is viewable for the current user.
If not, this resource type should not be available at all within the ADE 'add-wizard'.<p>
@param cms the current CMS context
@param referenceUri the resource URI to check permissions for
@return <code>true</code> if the resource type is viewable | [
"Checks",
"if",
"a",
"resource",
"type",
"is",
"viewable",
"for",
"the",
"current",
"user",
".",
"If",
"not",
"this",
"resource",
"type",
"should",
"not",
"be",
"available",
"at",
"all",
"within",
"the",
"ADE",
"add",
"-",
"wizard",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L308-L322 |
FitLayout/segmentation | src/main/java/org/fit/segm/grouping/op/GroupAnalyzer.java | GroupAnalyzer.findSuperArea | public AreaImpl findSuperArea(AreaImpl sub, Vector<AreaImpl> selected)
{
/* This is a simple testing SuperArea implementation. It groups each
* subarea with its first sibling area.*/
AreaImpl ret = new AreaImpl(0, 0, 0, 0);
ret.setPage(sub.getPage());
AreaImpl sibl = (AreaImpl) sub.getNextSibling();
selected.removeAllElements();
selected.add(sub);
if (sibl != null)
{
selected.add(sibl);
}
return ret;
} | java | public AreaImpl findSuperArea(AreaImpl sub, Vector<AreaImpl> selected)
{
/* This is a simple testing SuperArea implementation. It groups each
* subarea with its first sibling area.*/
AreaImpl ret = new AreaImpl(0, 0, 0, 0);
ret.setPage(sub.getPage());
AreaImpl sibl = (AreaImpl) sub.getNextSibling();
selected.removeAllElements();
selected.add(sub);
if (sibl != null)
{
selected.add(sibl);
}
return ret;
} | [
"public",
"AreaImpl",
"findSuperArea",
"(",
"AreaImpl",
"sub",
",",
"Vector",
"<",
"AreaImpl",
">",
"selected",
")",
"{",
"/* This is a simple testing SuperArea implementation. It groups each \n \t * subarea with its first sibling area.*/",
"AreaImpl",
"ret",
"=",
"new",
"Ar... | Starts with a specified subarea and finds all the subareas that
may be joined with the first one. Returns an empty area and the vector
of the areas inside. The subareas are not automatically added to the
new area because this would cause their removal from the parent area.
@param sub the subnode to start with
@param selected a vector that will be filled with the selected subnodes
that should be contained in the new area
@return the new empty area | [
"Starts",
"with",
"a",
"specified",
"subarea",
"and",
"finds",
"all",
"the",
"subareas",
"that",
"may",
"be",
"joined",
"with",
"the",
"first",
"one",
".",
"Returns",
"an",
"empty",
"area",
"and",
"the",
"vector",
"of",
"the",
"areas",
"inside",
".",
"Th... | train | https://github.com/FitLayout/segmentation/blob/12998087d576640c2f2a6360cf6088af95eea5f4/src/main/java/org/fit/segm/grouping/op/GroupAnalyzer.java#L47-L61 |
esigate/esigate | esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java | ExtensionFactory.getExtension | public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) {
T result;
String className = parameter.getValue(properties);
if (className == null) {
return null;
}
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating extension " + className);
}
result = (T) Class.forName(className).newInstance();
result.init(d, properties);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new ConfigurationException(e);
}
return result;
} | java | public static <T extends Extension> T getExtension(Properties properties, Parameter<String> parameter, Driver d) {
T result;
String className = parameter.getValue(properties);
if (className == null) {
return null;
}
try {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating extension " + className);
}
result = (T) Class.forName(className).newInstance();
result.init(d, properties);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
throw new ConfigurationException(e);
}
return result;
} | [
"public",
"static",
"<",
"T",
"extends",
"Extension",
">",
"T",
"getExtension",
"(",
"Properties",
"properties",
",",
"Parameter",
"<",
"String",
">",
"parameter",
",",
"Driver",
"d",
")",
"{",
"T",
"result",
";",
"String",
"className",
"=",
"parameter",
"... | Get an extension as configured in properties.
@param properties
properties
@param parameter
the class name parameter
@param d
driver
@param <T>
class which extends Extension class which extends Extension
@return instance of {@link Extension} or null. | [
"Get",
"an",
"extension",
"as",
"configured",
"in",
"properties",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/extension/ExtensionFactory.java#L57-L73 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/algo/tabu/IDBasedSubsetTabuMemory.java | IDBasedSubsetTabuMemory.registerVisitedSolution | @Override
public void registerVisitedSolution(SubsetSolution visitedSolution, Move<? super SubsetSolution> appliedMove) {
// don't do anything if move is null
if(appliedMove != null){
// check move type
if(appliedMove instanceof SubsetMove){
// cast
SubsetMove sMove = (SubsetMove) appliedMove;
// store involved IDs
memory.addAll(sMove.getAddedIDs());
memory.addAll(sMove.getDeletedIDs());
} else {
// wrong move type
throw new IncompatibleTabuMemoryException("ID based subset tabu memory can only be used in combination with "
+ "neighbourhoods that generate moves of type SubsetMove. Received: "
+ appliedMove.getClass().getName());
}
}
} | java | @Override
public void registerVisitedSolution(SubsetSolution visitedSolution, Move<? super SubsetSolution> appliedMove) {
// don't do anything if move is null
if(appliedMove != null){
// check move type
if(appliedMove instanceof SubsetMove){
// cast
SubsetMove sMove = (SubsetMove) appliedMove;
// store involved IDs
memory.addAll(sMove.getAddedIDs());
memory.addAll(sMove.getDeletedIDs());
} else {
// wrong move type
throw new IncompatibleTabuMemoryException("ID based subset tabu memory can only be used in combination with "
+ "neighbourhoods that generate moves of type SubsetMove. Received: "
+ appliedMove.getClass().getName());
}
}
} | [
"@",
"Override",
"public",
"void",
"registerVisitedSolution",
"(",
"SubsetSolution",
"visitedSolution",
",",
"Move",
"<",
"?",
"super",
"SubsetSolution",
">",
"appliedMove",
")",
"{",
"// don't do anything if move is null",
"if",
"(",
"appliedMove",
"!=",
"null",
")",... | Registers an applied subset move by storing all involved IDs (added or deleted) in the tabu memory. It is required
that the given move is of type {@link SubsetMove}, else an {@link IncompatibleTabuMemoryException} will be thrown.
The argument <code>visitedSolution</code> is ignored, as the applied move contains all necessary information, and
may be <code>null</code>. If <code>appliedMove</code> is <code>null</code>, calling this method does not have any
effect.
@param visitedSolution newly visited solution (not used here, allowed be <code>null</code>)
@param appliedMove applied move of which all involved IDs are stored in the tabu memory
@throws IncompatibleTabuMemoryException if the given move is not of type {@link SubsetMove} | [
"Registers",
"an",
"applied",
"subset",
"move",
"by",
"storing",
"all",
"involved",
"IDs",
"(",
"added",
"or",
"deleted",
")",
"in",
"the",
"tabu",
"memory",
".",
"It",
"is",
"required",
"that",
"the",
"given",
"move",
"is",
"of",
"type",
"{",
"@link",
... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/algo/tabu/IDBasedSubsetTabuMemory.java#L106-L124 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/windows/MultiSourceColumnComboBoxPanel.java | MultiSourceColumnComboBoxPanel.updateSourceComboBoxes | public void updateSourceComboBoxes(final Datastore datastore, final Table table) {
_datastore = datastore;
_table = table;
for (final SourceColumnComboBox sourceColComboBox : _sourceColumnComboBoxes) {
sourceColComboBox.setModel(datastore, table);
}
} | java | public void updateSourceComboBoxes(final Datastore datastore, final Table table) {
_datastore = datastore;
_table = table;
for (final SourceColumnComboBox sourceColComboBox : _sourceColumnComboBoxes) {
sourceColComboBox.setModel(datastore, table);
}
} | [
"public",
"void",
"updateSourceComboBoxes",
"(",
"final",
"Datastore",
"datastore",
",",
"final",
"Table",
"table",
")",
"{",
"_datastore",
"=",
"datastore",
";",
"_table",
"=",
"table",
";",
"for",
"(",
"final",
"SourceColumnComboBox",
"sourceColComboBox",
":",
... | updates the SourceColumnComboBoxes with the provided datastore and table | [
"updates",
"the",
"SourceColumnComboBoxes",
"with",
"the",
"provided",
"datastore",
"and",
"table"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/MultiSourceColumnComboBoxPanel.java#L163-L169 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hll/HllEstimators.java | HllEstimators.hllLowerBound | static final double hllLowerBound(final AbstractHllArray absHllArr, final int numStdDev) {
final int lgConfigK = absHllArr.lgConfigK;
final int configK = 1 << lgConfigK;
final double numNonZeros =
(absHllArr.getCurMin() == 0) ? configK - absHllArr.getNumAtCurMin() : configK;
final double estimate;
final double rseFactor;
final boolean oooFlag = absHllArr.isOutOfOrderFlag();
if (oooFlag) {
estimate = absHllArr.getCompositeEstimate();
rseFactor = HLL_NON_HIP_RSE_FACTOR;
} else {
estimate = absHllArr.getHipAccum();
rseFactor = HLL_HIP_RSE_FACTOR;
}
final double relErr = (lgConfigK > 12)
? (numStdDev * rseFactor) / Math.sqrt(configK)
: RelativeErrorTables.getRelErr(false, oooFlag, lgConfigK, numStdDev);
return Math.max(estimate / (1.0 + relErr), numNonZeros);
} | java | static final double hllLowerBound(final AbstractHllArray absHllArr, final int numStdDev) {
final int lgConfigK = absHllArr.lgConfigK;
final int configK = 1 << lgConfigK;
final double numNonZeros =
(absHllArr.getCurMin() == 0) ? configK - absHllArr.getNumAtCurMin() : configK;
final double estimate;
final double rseFactor;
final boolean oooFlag = absHllArr.isOutOfOrderFlag();
if (oooFlag) {
estimate = absHllArr.getCompositeEstimate();
rseFactor = HLL_NON_HIP_RSE_FACTOR;
} else {
estimate = absHllArr.getHipAccum();
rseFactor = HLL_HIP_RSE_FACTOR;
}
final double relErr = (lgConfigK > 12)
? (numStdDev * rseFactor) / Math.sqrt(configK)
: RelativeErrorTables.getRelErr(false, oooFlag, lgConfigK, numStdDev);
return Math.max(estimate / (1.0 + relErr), numNonZeros);
} | [
"static",
"final",
"double",
"hllLowerBound",
"(",
"final",
"AbstractHllArray",
"absHllArr",
",",
"final",
"int",
"numStdDev",
")",
"{",
"final",
"int",
"lgConfigK",
"=",
"absHllArr",
".",
"lgConfigK",
";",
"final",
"int",
"configK",
"=",
"1",
"<<",
"lgConfigK... | /*
The upper and lower bounds are not symmetric and thus are treated slightly differently.
For the lower bound, when the unique count is <= k, LB >= numNonZeros, where
numNonZeros = k - numAtCurMin AND curMin == 0.
For HLL6 and HLL8, curMin is always 0 and numAtCurMin is initialized to k and is decremented
down for each valid update until it reaches 0, where it stays. Thus, for these two
isomorphs, when numAtCurMin = 0, means the true curMin is > 0 and the unique count must be
greater than k.
HLL4 always maintains both curMin and numAtCurMin dynamically. Nonetheless, the rules for
the very small values <= k where curMin = 0 still apply. | [
"/",
"*",
"The",
"upper",
"and",
"lower",
"bounds",
"are",
"not",
"symmetric",
"and",
"thus",
"are",
"treated",
"slightly",
"differently",
".",
"For",
"the",
"lower",
"bound",
"when",
"the",
"unique",
"count",
"is",
"<",
"=",
"k",
"LB",
">",
"=",
"numN... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllEstimators.java#L34-L53 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isInstanceOf | public static <T> T isInstanceOf(Class<?> type, T obj) {
return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type);
} | java | public static <T> T isInstanceOf(Class<?> type, T obj) {
return isInstanceOf(type, obj, "Object [{}] is not instanceof [{}]", obj, type);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"isInstanceOf",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"T",
"obj",
")",
"{",
"return",
"isInstanceOf",
"(",
"type",
",",
"obj",
",",
"\"Object [{}] is not instanceof [{}]\"",
",",
"obj",
",",
"type",
")",
";",
... | 断言给定对象是否是给定类的实例
<pre class="code">
Assert.instanceOf(Foo.class, foo);
</pre>
@param <T> 被检查对象泛型类型
@param type 被检查对象匹配的类型
@param obj 被检查对象
@return 被检查的对象
@throws IllegalArgumentException if the object is not an instance of clazz
@see Class#isInstance(Object) | [
"断言给定对象是否是给定类的实例"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L429-L431 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/data/AnyValueMap.java | AnyValueMap.getAsStringWithDefault | public String getAsStringWithDefault(String key, String defaultValue) {
Object value = getAsObject(key);
return StringConverter.toStringWithDefault(value, defaultValue);
} | java | public String getAsStringWithDefault(String key, String defaultValue) {
Object value = getAsObject(key);
return StringConverter.toStringWithDefault(value, defaultValue);
} | [
"public",
"String",
"getAsStringWithDefault",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"Object",
"value",
"=",
"getAsObject",
"(",
"key",
")",
";",
"return",
"StringConverter",
".",
"toStringWithDefault",
"(",
"value",
",",
"defaultValue",
... | Converts map element into a string or returns default value if conversion is
not possible.
@param key a key of element to get.
@param defaultValue the default value
@return string value of the element or default value if conversion is not
supported.
@see StringConverter#toStringWithDefault(Object, String) | [
"Converts",
"map",
"element",
"into",
"a",
"string",
"or",
"returns",
"default",
"value",
"if",
"conversion",
"is",
"not",
"possible",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L162-L165 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.addTab | public WTab addTab(final WComponent content, final String tabName, final TabMode mode, final char accessKey) {
return addTab(new WTab(content, tabName, mode, accessKey));
} | java | public WTab addTab(final WComponent content, final String tabName, final TabMode mode, final char accessKey) {
return addTab(new WTab(content, tabName, mode, accessKey));
} | [
"public",
"WTab",
"addTab",
"(",
"final",
"WComponent",
"content",
",",
"final",
"String",
"tabName",
",",
"final",
"TabMode",
"mode",
",",
"final",
"char",
"accessKey",
")",
"{",
"return",
"addTab",
"(",
"new",
"WTab",
"(",
"content",
",",
"tabName",
",",... | Adds a tab to the tab set.
@param content the tab set content.
@param tabName the tab name.
@param mode the tab mode.
@param accessKey the access key used to activate the tab.
@return the tab which was added to the tab set. | [
"Adds",
"a",
"tab",
"to",
"the",
"tab",
"set",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L251-L253 |
mijecu25/dsa | src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java | LinearSearch.searchLast | public static int searchLast(char[] charArray, char value, int occurrence) {
if(occurrence <= 0 || occurrence > charArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = charArray.length-1; i >=0; i--) {
if(charArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} | java | public static int searchLast(char[] charArray, char value, int occurrence) {
if(occurrence <= 0 || occurrence > charArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = charArray.length-1; i >=0; i--) {
if(charArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} | [
"public",
"static",
"int",
"searchLast",
"(",
"char",
"[",
"]",
"charArray",
",",
"char",
"value",
",",
"int",
"occurrence",
")",
"{",
"if",
"(",
"occurrence",
"<=",
"0",
"||",
"occurrence",
">",
"charArray",
".",
"length",
")",
"{",
"throw",
"new",
"I... | Search for the value in the char array and return the index of the first occurrence from the
end of the array.
@param charArray array that we are searching in.
@param value value that is being searched in the array.
@param occurrence number of times we have seen the value before returning the index.
@return the index where the value is found in the array, else -1. | [
"Search",
"for",
"the",
"value",
"in",
"the",
"char",
"array",
"and",
"return",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"from",
"the",
"end",
"of",
"the",
"array",
"."
] | train | https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java#L1560-L1579 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMPath.java | JMPath.extractSubPath | public static Path extractSubPath(Path basePath, Path sourcePath) {
return sourcePath.subpath(basePath.getNameCount() - 1,
sourcePath.getNameCount());
} | java | public static Path extractSubPath(Path basePath, Path sourcePath) {
return sourcePath.subpath(basePath.getNameCount() - 1,
sourcePath.getNameCount());
} | [
"public",
"static",
"Path",
"extractSubPath",
"(",
"Path",
"basePath",
",",
"Path",
"sourcePath",
")",
"{",
"return",
"sourcePath",
".",
"subpath",
"(",
"basePath",
".",
"getNameCount",
"(",
")",
"-",
"1",
",",
"sourcePath",
".",
"getNameCount",
"(",
")",
... | Extract sub path path.
@param basePath the base path
@param sourcePath the source path
@return the path | [
"Extract",
"sub",
"path",
"path",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMPath.java#L833-L836 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/service/WindupJavaConfigurationService.java | WindupJavaConfigurationService.checkIfIgnored | public boolean checkIfIgnored(final GraphRewrite event, FileModel file)
{
List<String> patterns = getIgnoredFileRegexes();
boolean ignored = false;
if (patterns != null && !patterns.isEmpty())
{
for (String pattern : patterns)
{
if (file.getFilePath().matches(pattern))
{
IgnoredFileModel ignoredFileModel = GraphService.addTypeToModel(event.getGraphContext(), file, IgnoredFileModel.class);
ignoredFileModel.setIgnoredRegex(pattern);
LOG.info("File/Directory placed in " + file.getFilePath() + " was ignored, because matched [" + pattern + "].");
ignored = true;
break;
}
}
}
return ignored;
} | java | public boolean checkIfIgnored(final GraphRewrite event, FileModel file)
{
List<String> patterns = getIgnoredFileRegexes();
boolean ignored = false;
if (patterns != null && !patterns.isEmpty())
{
for (String pattern : patterns)
{
if (file.getFilePath().matches(pattern))
{
IgnoredFileModel ignoredFileModel = GraphService.addTypeToModel(event.getGraphContext(), file, IgnoredFileModel.class);
ignoredFileModel.setIgnoredRegex(pattern);
LOG.info("File/Directory placed in " + file.getFilePath() + " was ignored, because matched [" + pattern + "].");
ignored = true;
break;
}
}
}
return ignored;
} | [
"public",
"boolean",
"checkIfIgnored",
"(",
"final",
"GraphRewrite",
"event",
",",
"FileModel",
"file",
")",
"{",
"List",
"<",
"String",
">",
"patterns",
"=",
"getIgnoredFileRegexes",
"(",
")",
";",
"boolean",
"ignored",
"=",
"false",
";",
"if",
"(",
"patter... | Checks if the {@link FileModel#getFilePath()} + {@link FileModel#getFileName()} is ignored by any of the specified regular expressions. | [
"Checks",
"if",
"the",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/service/WindupJavaConfigurationService.java#L50-L70 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.deleteContentsRecursive | @Restricted(NoExternalUse.class)
public static void deleteContentsRecursive(@Nonnull Path path, @Nonnull PathRemover.PathChecker pathChecker) throws IOException {
newPathRemover(pathChecker).forceRemoveDirectoryContents(path);
} | java | @Restricted(NoExternalUse.class)
public static void deleteContentsRecursive(@Nonnull Path path, @Nonnull PathRemover.PathChecker pathChecker) throws IOException {
newPathRemover(pathChecker).forceRemoveDirectoryContents(path);
} | [
"@",
"Restricted",
"(",
"NoExternalUse",
".",
"class",
")",
"public",
"static",
"void",
"deleteContentsRecursive",
"(",
"@",
"Nonnull",
"Path",
"path",
",",
"@",
"Nonnull",
"PathRemover",
".",
"PathChecker",
"pathChecker",
")",
"throws",
"IOException",
"{",
"new... | Deletes the given directory contents (but not the directory itself) recursively using a PathChecker.
@param path a directory to delete
@param pathChecker a security check to validate a path before deleting
@throws IOException if the operation fails | [
"Deletes",
"the",
"given",
"directory",
"contents",
"(",
"but",
"not",
"the",
"directory",
"itself",
")",
"recursively",
"using",
"a",
"PathChecker",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L257-L260 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java | ProxyUtil.createClientProxy | @SuppressWarnings("unchecked")
private static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client, final Map<String, String> extraHeaders) {
return (T) Proxy.newProxyInstance(classLoader, new Class<?>[]{proxyInterface}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (isDeclaringClassAnObject(method)) return proxyObjectMethods(method, proxy, args);
final Object arguments = ReflectionUtil.parseArguments(method, args);
final String methodName = getMethodName(method);
return client.invoke(methodName, arguments, method.getGenericReturnType(), extraHeaders);
}
});
} | java | @SuppressWarnings("unchecked")
private static <T> T createClientProxy(ClassLoader classLoader, Class<T> proxyInterface, final IJsonRpcClient client, final Map<String, String> extraHeaders) {
return (T) Proxy.newProxyInstance(classLoader, new Class<?>[]{proxyInterface}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (isDeclaringClassAnObject(method)) return proxyObjectMethods(method, proxy, args);
final Object arguments = ReflectionUtil.parseArguments(method, args);
final String methodName = getMethodName(method);
return client.invoke(methodName, arguments, method.getGenericReturnType(), extraHeaders);
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"T",
"createClientProxy",
"(",
"ClassLoader",
"classLoader",
",",
"Class",
"<",
"T",
">",
"proxyInterface",
",",
"final",
"IJsonRpcClient",
"client",
",",
"final",
"Map",
"... | Creates a {@link Proxy} of the given {@code proxyInterface}
that uses the given {@link IJsonRpcClient}.
@param <T> the proxy type
@param classLoader the {@link ClassLoader}
@param proxyInterface the interface to proxy
@param client the {@link JsonRpcHttpClient}
@param extraHeaders extra HTTP headers to be added to each response
@return the proxied interface | [
"Creates",
"a",
"{",
"@link",
"Proxy",
"}",
"of",
"the",
"given",
"{",
"@code",
"proxyInterface",
"}",
"that",
"uses",
"the",
"given",
"{",
"@link",
"IJsonRpcClient",
"}",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java#L203-L216 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/LiteralMapList.java | LiteralMapList.selectFirst | public LiteralMap selectFirst(JcPrimitive key, Object value) {
for (LiteralMap lm : this) {
if (isEqual(value, lm.get(ValueAccess.getName(key))))
return lm;
}
return null;
} | java | public LiteralMap selectFirst(JcPrimitive key, Object value) {
for (LiteralMap lm : this) {
if (isEqual(value, lm.get(ValueAccess.getName(key))))
return lm;
}
return null;
} | [
"public",
"LiteralMap",
"selectFirst",
"(",
"JcPrimitive",
"key",
",",
"Object",
"value",
")",
"{",
"for",
"(",
"LiteralMap",
"lm",
":",
"this",
")",
"{",
"if",
"(",
"isEqual",
"(",
"value",
",",
"lm",
".",
"get",
"(",
"ValueAccess",
".",
"getName",
"(... | Answer the first literal map with the given key and value
@param key
@param value
@return | [
"Answer",
"the",
"first",
"literal",
"map",
"with",
"the",
"given",
"key",
"and",
"value"
] | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/LiteralMapList.java#L77-L83 |
roboconf/roboconf-platform | miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java | TargetWsDelegate.associateTarget | public void associateTarget( AbstractApplication app, String instancePathOrComponentName, String targetId, boolean bind )
throws TargetWsException {
if( bind )
this.logger.finer( "Associating " + app + " :: " + instancePathOrComponentName + " with " + targetId );
else
this.logger.finer( "Dissociating " + app + " :: " + instancePathOrComponentName + " from " + targetId );
WebResource path = this.resource.path( UrlConstants.TARGETS )
.path( targetId ).path( "associations" )
.queryParam( "bind", Boolean.toString( bind ))
.queryParam( "name", app.getName());
if( instancePathOrComponentName != null )
path = path.queryParam( "elt", instancePathOrComponentName );
if( app instanceof ApplicationTemplate )
path = path.queryParam( "qualifier", ((ApplicationTemplate) app).getVersion());
ClientResponse response = this.wsClient.createBuilder( path )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
handleResponse( response );
} | java | public void associateTarget( AbstractApplication app, String instancePathOrComponentName, String targetId, boolean bind )
throws TargetWsException {
if( bind )
this.logger.finer( "Associating " + app + " :: " + instancePathOrComponentName + " with " + targetId );
else
this.logger.finer( "Dissociating " + app + " :: " + instancePathOrComponentName + " from " + targetId );
WebResource path = this.resource.path( UrlConstants.TARGETS )
.path( targetId ).path( "associations" )
.queryParam( "bind", Boolean.toString( bind ))
.queryParam( "name", app.getName());
if( instancePathOrComponentName != null )
path = path.queryParam( "elt", instancePathOrComponentName );
if( app instanceof ApplicationTemplate )
path = path.queryParam( "qualifier", ((ApplicationTemplate) app).getVersion());
ClientResponse response = this.wsClient.createBuilder( path )
.accept( MediaType.APPLICATION_JSON )
.post( ClientResponse.class );
handleResponse( response );
} | [
"public",
"void",
"associateTarget",
"(",
"AbstractApplication",
"app",
",",
"String",
"instancePathOrComponentName",
",",
"String",
"targetId",
",",
"boolean",
"bind",
")",
"throws",
"TargetWsException",
"{",
"if",
"(",
"bind",
")",
"this",
".",
"logger",
".",
... | Associates or dissociates an application and a target.
@param app an application or application template
@param targetId a target ID
@param instancePathOrComponentName an instance path or a component name (can be null)
@param bind true to create a binding, false to delete one
@throws TargetWsException | [
"Associates",
"or",
"dissociates",
"an",
"application",
"and",
"a",
"target",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/TargetWsDelegate.java#L136-L160 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/ResourceName.java | ResourceName.parentName | public ResourceName parentName() {
PathTemplate parentTemplate = template.parentTemplate();
return new ResourceName(parentTemplate, values, endpoint);
} | java | public ResourceName parentName() {
PathTemplate parentTemplate = template.parentTemplate();
return new ResourceName(parentTemplate, values, endpoint);
} | [
"public",
"ResourceName",
"parentName",
"(",
")",
"{",
"PathTemplate",
"parentTemplate",
"=",
"template",
".",
"parentTemplate",
"(",
")",
";",
"return",
"new",
"ResourceName",
"(",
"parentTemplate",
",",
"values",
",",
"endpoint",
")",
";",
"}"
] | Returns the parent resource name. For example, if the name is {@code shelves/s1/books/b1}, the
parent is {@code shelves/s1/books}. | [
"Returns",
"the",
"parent",
"resource",
"name",
".",
"For",
"example",
"if",
"the",
"name",
"is",
"{"
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/ResourceName.java#L201-L204 |
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java | SignatureUtil.scanTypeArgumentSignatures | private static int scanTypeArgumentSignatures(String string, int start) {
// need a minimum 2 char "<>"
if (start >= string.length() - 1) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
if (c != C_GENERIC_START) {
throw new IllegalArgumentException();
}
int p = start + 1;
while (true) {
if (p >= string.length()) {
throw new IllegalArgumentException();
}
c = string.charAt(p);
if (c == C_GENERIC_END) {
return p;
}
int e = scanTypeArgumentSignature(string, p);
p = e + 1;
}
} | java | private static int scanTypeArgumentSignatures(String string, int start) {
// need a minimum 2 char "<>"
if (start >= string.length() - 1) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
if (c != C_GENERIC_START) {
throw new IllegalArgumentException();
}
int p = start + 1;
while (true) {
if (p >= string.length()) {
throw new IllegalArgumentException();
}
c = string.charAt(p);
if (c == C_GENERIC_END) {
return p;
}
int e = scanTypeArgumentSignature(string, p);
p = e + 1;
}
} | [
"private",
"static",
"int",
"scanTypeArgumentSignatures",
"(",
"String",
"string",
",",
"int",
"start",
")",
"{",
"// need a minimum 2 char \"<>\"",
"if",
"(",
"start",
">=",
"string",
".",
"length",
"(",
")",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgume... | Scans the given string for a list of type argument signatures starting at
the given index and returns the index of the last character.
<pre>
TypeArgumentSignatures:
<b><</b> TypeArgumentSignature* <b>></b>
</pre>
Note that although there is supposed to be at least one type argument, there
is no syntactic ambiguity if there are none. This method will accept zero
type argument signatures without complaint.
@param string the signature string
@param start the 0-based character index of the first character
@return the 0-based character index of the last character
@exception IllegalArgumentException if this is not a list of type arguments
signatures | [
"Scans",
"the",
"given",
"string",
"for",
"a",
"list",
"of",
"type",
"argument",
"signatures",
"starting",
"at",
"the",
"given",
"index",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"character",
".",
"<pre",
">",
"TypeArgumentSignatures",
":",
"<b... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java#L475-L496 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/hamcrest/HamcrestValidationMatcher.java | HamcrestValidationMatcher.getMap | private Map<String, Object> getMap(String mapString) {
Properties props = new Properties();
try {
props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll(",\\s*", "\n")));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to reconstruct object of type map", e);
}
Map<String, Object> map = new LinkedHashMap<>();
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key;
Object value;
if (entry.getKey() instanceof String) {
key = VariableUtils.cutOffDoubleQuotes(entry.getKey().toString());
} else {
key = entry.getKey().toString();
}
if (entry.getValue() instanceof String) {
value = VariableUtils.cutOffDoubleQuotes(entry.getValue().toString()).trim();
} else {
value = entry.getValue();
}
map.put(key, value);
}
return map;
} | java | private Map<String, Object> getMap(String mapString) {
Properties props = new Properties();
try {
props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll(",\\s*", "\n")));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to reconstruct object of type map", e);
}
Map<String, Object> map = new LinkedHashMap<>();
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String key;
Object value;
if (entry.getKey() instanceof String) {
key = VariableUtils.cutOffDoubleQuotes(entry.getKey().toString());
} else {
key = entry.getKey().toString();
}
if (entry.getValue() instanceof String) {
value = VariableUtils.cutOffDoubleQuotes(entry.getValue().toString()).trim();
} else {
value = entry.getValue();
}
map.put(key, value);
}
return map;
} | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"getMap",
"(",
"String",
"mapString",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"props",
".",
"load",
"(",
"new",
"StringReader",
"(",
"mapString",
".",
"s... | Construct collection from delimited string expression.
@param mapString
@return | [
"Construct",
"collection",
"from",
"delimited",
"string",
"expression",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/hamcrest/HamcrestValidationMatcher.java#L271-L300 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java | CmsFadeAnimation.fadeOut | public static CmsFadeAnimation fadeOut(Element element, Command callback, int duration) {
CmsFadeAnimation animation = new CmsFadeAnimation(element, false, callback);
animation.run(duration);
return animation;
} | java | public static CmsFadeAnimation fadeOut(Element element, Command callback, int duration) {
CmsFadeAnimation animation = new CmsFadeAnimation(element, false, callback);
animation.run(duration);
return animation;
} | [
"public",
"static",
"CmsFadeAnimation",
"fadeOut",
"(",
"Element",
"element",
",",
"Command",
"callback",
",",
"int",
"duration",
")",
"{",
"CmsFadeAnimation",
"animation",
"=",
"new",
"CmsFadeAnimation",
"(",
"element",
",",
"false",
",",
"callback",
")",
";",
... | Fades the given element out of view executing the callback afterwards.<p>
@param element the element to fade out
@param callback the callback
@param duration the animation duration
@return the running animation object | [
"Fades",
"the",
"given",
"element",
"out",
"of",
"view",
"executing",
"the",
"callback",
"afterwards",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java#L85-L90 |
m-m-m/util | sandbox/src/main/java/net/sf/mmm/util/path/base/AbstractPathFactory.java | AbstractPathFactory.createPath | private Path createPath(PathUri uri) {
PathProvider provider = getProvider(uri);
if (provider == null) {
if (uri.getSchemePrefix() == null) {
return Paths.get(uri.getPath());
} else {
try {
return Paths.get(new URI(uri.getUri()));
} catch (URISyntaxException e) {
throw new ResourceUriUndefinedException(e, uri.getUri());
}
}
}
return provider.createResource(uri);
} | java | private Path createPath(PathUri uri) {
PathProvider provider = getProvider(uri);
if (provider == null) {
if (uri.getSchemePrefix() == null) {
return Paths.get(uri.getPath());
} else {
try {
return Paths.get(new URI(uri.getUri()));
} catch (URISyntaxException e) {
throw new ResourceUriUndefinedException(e, uri.getUri());
}
}
}
return provider.createResource(uri);
} | [
"private",
"Path",
"createPath",
"(",
"PathUri",
"uri",
")",
"{",
"PathProvider",
"provider",
"=",
"getProvider",
"(",
"uri",
")",
";",
"if",
"(",
"provider",
"==",
"null",
")",
"{",
"if",
"(",
"uri",
".",
"getSchemePrefix",
"(",
")",
"==",
"null",
")"... | @see #createPath(String)
@param uri is the {@link PathUri}.
@return the according {@link Path}. | [
"@see",
"#createPath",
"(",
"String",
")"
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/sandbox/src/main/java/net/sf/mmm/util/path/base/AbstractPathFactory.java#L119-L134 |
apache/incubator-druid | indexing-service/src/main/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunner.java | SingleTaskBackgroundRunner.shutdown | @Override
public void shutdown(final String taskid, String reason)
{
log.info("Shutdown [%s] because: [%s]", taskid, reason);
if (runningItem != null && runningItem.getTask().getId().equals(taskid)) {
runningItem.getResult().cancel(true);
}
} | java | @Override
public void shutdown(final String taskid, String reason)
{
log.info("Shutdown [%s] because: [%s]", taskid, reason);
if (runningItem != null && runningItem.getTask().getId().equals(taskid)) {
runningItem.getResult().cancel(true);
}
} | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
"final",
"String",
"taskid",
",",
"String",
"reason",
")",
"{",
"log",
".",
"info",
"(",
"\"Shutdown [%s] because: [%s]\"",
",",
"taskid",
",",
"reason",
")",
";",
"if",
"(",
"runningItem",
"!=",
"null",
... | There might be a race between {@link #run(Task)} and this method, but it shouldn't happen in real applications
because this method is called only in unit tests. See TaskLifecycleTest.
@param taskid task ID to clean up resources for | [
"There",
"might",
"be",
"a",
"race",
"between",
"{",
"@link",
"#run",
"(",
"Task",
")",
"}",
"and",
"this",
"method",
"but",
"it",
"shouldn",
"t",
"happen",
"in",
"real",
"applications",
"because",
"this",
"method",
"is",
"called",
"only",
"in",
"unit",
... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunner.java#L277-L284 |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRImporter.java | LRImporter.getExtractDiscriminatorJSONData | public LRResult getExtractDiscriminatorJSONData(String dataServiceName, String viewName, String discriminator, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException
{
String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, discriminator, partial, discriminatorParam);
JSONObject json = getJSONFromPath(path);
return new LRResult(json);
} | java | public LRResult getExtractDiscriminatorJSONData(String dataServiceName, String viewName, String discriminator, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException
{
String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, discriminator, partial, discriminatorParam);
JSONObject json = getJSONFromPath(path);
return new LRResult(json);
} | [
"public",
"LRResult",
"getExtractDiscriminatorJSONData",
"(",
"String",
"dataServiceName",
",",
"String",
"viewName",
",",
"String",
"discriminator",
",",
"Boolean",
"partial",
",",
"Date",
"from",
",",
"Date",
"until",
",",
"Boolean",
"idsOnly",
")",
"throws",
"L... | Get a result from an extract discriminator request
@param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator)
@param viewName the name of the view to request through (e.g. standards-alignment-related)
@param discriminator the discriminator for the request
@param partial true/false if this is a partial start of a discriminator, rather than a full discriminator
@param from the starting date from which to extract items
@param until the ending date from which to extract items
@param idsOnly true/false to only extract ids with this request
@return result of the request | [
"Get",
"a",
"result",
"from",
"an",
"extract",
"discriminator",
"request"
] | train | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L354-L361 |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java | FlowUtils.generateConsumerGroupId | public static long generateConsumerGroupId(String flowId, String flowletId) {
return Hashing.md5().newHasher()
.putString(flowId)
.putString(flowletId).hash().asLong();
} | java | public static long generateConsumerGroupId(String flowId, String flowletId) {
return Hashing.md5().newHasher()
.putString(flowId)
.putString(flowletId).hash().asLong();
} | [
"public",
"static",
"long",
"generateConsumerGroupId",
"(",
"String",
"flowId",
",",
"String",
"flowletId",
")",
"{",
"return",
"Hashing",
".",
"md5",
"(",
")",
".",
"newHasher",
"(",
")",
".",
"putString",
"(",
"flowId",
")",
".",
"putString",
"(",
"flowl... | Generates a queue consumer groupId for the given flowlet in the given program id. | [
"Generates",
"a",
"queue",
"consumer",
"groupId",
"for",
"the",
"given",
"flowlet",
"in",
"the",
"given",
"program",
"id",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java#L57-L61 |
cdapio/tigon | tigon-sql/src/main/java/co/cask/tigon/sql/internal/StreamConfigGenerator.java | StreamConfigGenerator.createProtocol | private String createProtocol(String name, StreamSchema schema) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("PROTOCOL ").append(name).append(" {").append(Constants.NEWLINE);
stringBuilder.append(StreamSchemaCodec.serialize(schema));
stringBuilder.append("}").append(Constants.NEWLINE);
return stringBuilder.toString();
} | java | private String createProtocol(String name, StreamSchema schema) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("PROTOCOL ").append(name).append(" {").append(Constants.NEWLINE);
stringBuilder.append(StreamSchemaCodec.serialize(schema));
stringBuilder.append("}").append(Constants.NEWLINE);
return stringBuilder.toString();
} | [
"private",
"String",
"createProtocol",
"(",
"String",
"name",
",",
"StreamSchema",
"schema",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"stringBuilder",
".",
"append",
"(",
"\"PROTOCOL \"",
")",
".",
"append",
"(",
... | Takes a name for the Schema and the StreamSchema object to create the contents for packet_schema.txt file.
Sample file content :
PROTOCOL name {
ullong timestamp get_gdat_ullong_pos1 (increasing);
uint istream get_gdat_uint_pos2;
} | [
"Takes",
"a",
"name",
"for",
"the",
"Schema",
"and",
"the",
"StreamSchema",
"object",
"to",
"create",
"the",
"contents",
"for",
"packet_schema",
".",
"txt",
"file",
".",
"Sample",
"file",
"content",
":",
"PROTOCOL",
"name",
"{",
"ullong",
"timestamp",
"get_g... | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-sql/src/main/java/co/cask/tigon/sql/internal/StreamConfigGenerator.java#L112-L118 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseMessage | public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
assert (parser.getName().equals(Message.ELEMENT));
XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
final int initialDepth = parser.getDepth();
Message message = new Message();
message.setStanzaId(parser.getAttributeValue("", "id"));
message.setTo(ParserUtils.getJidAttribute(parser, "to"));
message.setFrom(ParserUtils.getJidAttribute(parser, "from"));
String typeString = parser.getAttributeValue("", "type");
if (typeString != null) {
message.setType(Message.Type.fromString(typeString));
}
String language = ParserUtils.getXmlLang(parser);
message.setLanguage(language);
// Parse sub-elements. We include extra logic to make sure the values
// are only read once. This is because it's possible for the names to appear
// in arbitrary sub-elements.
String thread = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String elementName = parser.getName();
String namespace = parser.getNamespace();
switch (elementName) {
case "subject":
String xmlLangSubject = ParserUtils.getXmlLang(parser);
String subject = parseElementText(parser);
if (message.getSubject(xmlLangSubject) == null) {
message.addSubject(xmlLangSubject, subject);
}
break;
case "thread":
if (thread == null) {
thread = parser.nextText();
}
break;
case "error":
message.setError(parseError(parser, messageXmlEnvironment));
break;
default:
PacketParserUtils.addExtensionElement(message, parser, elementName, namespace, messageXmlEnvironment);
break;
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
message.setThread(thread);
// TODO check for duplicate body elements. This means we need to check for duplicate xml:lang pairs and for
// situations where we have a body element with an explicit xml lang set and once where the value is inherited
// and both values are equal.
return message;
} | java | public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
assert (parser.getName().equals(Message.ELEMENT));
XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
final int initialDepth = parser.getDepth();
Message message = new Message();
message.setStanzaId(parser.getAttributeValue("", "id"));
message.setTo(ParserUtils.getJidAttribute(parser, "to"));
message.setFrom(ParserUtils.getJidAttribute(parser, "from"));
String typeString = parser.getAttributeValue("", "type");
if (typeString != null) {
message.setType(Message.Type.fromString(typeString));
}
String language = ParserUtils.getXmlLang(parser);
message.setLanguage(language);
// Parse sub-elements. We include extra logic to make sure the values
// are only read once. This is because it's possible for the names to appear
// in arbitrary sub-elements.
String thread = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String elementName = parser.getName();
String namespace = parser.getNamespace();
switch (elementName) {
case "subject":
String xmlLangSubject = ParserUtils.getXmlLang(parser);
String subject = parseElementText(parser);
if (message.getSubject(xmlLangSubject) == null) {
message.addSubject(xmlLangSubject, subject);
}
break;
case "thread":
if (thread == null) {
thread = parser.nextText();
}
break;
case "error":
message.setError(parseError(parser, messageXmlEnvironment));
break;
default:
PacketParserUtils.addExtensionElement(message, parser, elementName, namespace, messageXmlEnvironment);
break;
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
message.setThread(thread);
// TODO check for duplicate body elements. This means we need to check for duplicate xml:lang pairs and for
// situations where we have a body element with an explicit xml lang set and once where the value is inherited
// and both values are equal.
return message;
} | [
"public",
"static",
"Message",
"parseMessage",
"(",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"SmackParsingException",
"{",
"ParserUtils",
".",
"assertAtStartTag",
"(",
"parse... | Parses a message packet.
@param parser the XML parser, positioned at the start of a message packet.
@param outerXmlEnvironment the outer XML environment (optional).
@return a Message packet.
@throws XmlPullParserException
@throws IOException
@throws SmackParsingException | [
"Parses",
"a",
"message",
"packet",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L230-L294 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/AsyncCacheRequestManager.java | AsyncCacheRequestManager.cacheBlockFromRemoteWorker | private boolean cacheBlockFromRemoteWorker(long blockId, long blockSize,
InetSocketAddress sourceAddress, Protocol.OpenUfsBlockOptions openUfsBlockOptions) {
try {
mBlockWorker.createBlockRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId,
mStorageTierAssoc.getAlias(0), blockSize);
} catch (BlockAlreadyExistsException e) {
// It is already cached
return true;
} catch (AlluxioException | IOException e) {
LOG.warn(
"Failed to async cache block {} from remote worker ({}) on creating the temp block: {}",
blockId, sourceAddress, e.getMessage());
return false;
}
try (BlockReader reader =
new RemoteBlockReader(mFsContext, blockId, blockSize, sourceAddress, openUfsBlockOptions);
BlockWriter writer =
mBlockWorker.getTempBlockWriterRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId)) {
BufferUtils.fastCopy(reader.getChannel(), writer.getChannel());
mBlockWorker.commitBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId);
return true;
} catch (AlluxioException | IOException e) {
LOG.warn("Failed to async cache block {} from remote worker ({}) on copying the block: {}",
blockId, sourceAddress, e.getMessage());
try {
mBlockWorker.abortBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId);
} catch (AlluxioException | IOException ee) {
LOG.warn("Failed to abort block {}: {}", blockId, ee.getMessage());
}
return false;
}
} | java | private boolean cacheBlockFromRemoteWorker(long blockId, long blockSize,
InetSocketAddress sourceAddress, Protocol.OpenUfsBlockOptions openUfsBlockOptions) {
try {
mBlockWorker.createBlockRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId,
mStorageTierAssoc.getAlias(0), blockSize);
} catch (BlockAlreadyExistsException e) {
// It is already cached
return true;
} catch (AlluxioException | IOException e) {
LOG.warn(
"Failed to async cache block {} from remote worker ({}) on creating the temp block: {}",
blockId, sourceAddress, e.getMessage());
return false;
}
try (BlockReader reader =
new RemoteBlockReader(mFsContext, blockId, blockSize, sourceAddress, openUfsBlockOptions);
BlockWriter writer =
mBlockWorker.getTempBlockWriterRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId)) {
BufferUtils.fastCopy(reader.getChannel(), writer.getChannel());
mBlockWorker.commitBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId);
return true;
} catch (AlluxioException | IOException e) {
LOG.warn("Failed to async cache block {} from remote worker ({}) on copying the block: {}",
blockId, sourceAddress, e.getMessage());
try {
mBlockWorker.abortBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId);
} catch (AlluxioException | IOException ee) {
LOG.warn("Failed to abort block {}: {}", blockId, ee.getMessage());
}
return false;
}
} | [
"private",
"boolean",
"cacheBlockFromRemoteWorker",
"(",
"long",
"blockId",
",",
"long",
"blockSize",
",",
"InetSocketAddress",
"sourceAddress",
",",
"Protocol",
".",
"OpenUfsBlockOptions",
"openUfsBlockOptions",
")",
"{",
"try",
"{",
"mBlockWorker",
".",
"createBlockRe... | Caches the block at best effort from a remote worker (possibly from UFS indirectly).
@param blockId block ID
@param blockSize block size
@param sourceAddress the source to read the block previously by client
@param openUfsBlockOptions options to open the UFS file
@return if the block is cached | [
"Caches",
"the",
"block",
"at",
"best",
"effort",
"from",
"a",
"remote",
"worker",
"(",
"possibly",
"from",
"UFS",
"indirectly",
")",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/AsyncCacheRequestManager.java#L196-L227 |
virgo47/javasimon | core/src/main/java/org/javasimon/callback/calltree/CallTreeCallback.java | CallTreeCallback.initCallTree | private CallTree initCallTree() {
final CallTree callTree = new CallTree(logThreshold) {
@Override
protected void onRootStopwatchStop(CallTreeNode rootNode, Split split) {
CallTreeCallback.this.onRootStopwatchStop(this, split);
}
};
threadCallTree.set(callTree);
return callTree;
} | java | private CallTree initCallTree() {
final CallTree callTree = new CallTree(logThreshold) {
@Override
protected void onRootStopwatchStop(CallTreeNode rootNode, Split split) {
CallTreeCallback.this.onRootStopwatchStop(this, split);
}
};
threadCallTree.set(callTree);
return callTree;
} | [
"private",
"CallTree",
"initCallTree",
"(",
")",
"{",
"final",
"CallTree",
"callTree",
"=",
"new",
"CallTree",
"(",
"logThreshold",
")",
"{",
"@",
"Override",
"protected",
"void",
"onRootStopwatchStop",
"(",
"CallTreeNode",
"rootNode",
",",
"Split",
"split",
")"... | Initializes the call tree for current thread.
@return Created call tree | [
"Initializes",
"the",
"call",
"tree",
"for",
"current",
"thread",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeCallback.java#L107-L116 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/PayloadNameRequestWrapper.java | PayloadNameRequestWrapper.scanForChildTag | static boolean scanForChildTag(XMLStreamReader reader, String tagName)
throws XMLStreamException {
assert reader.isStartElement();
int level = -1;
while (reader.hasNext()) {
//keep track of level so we only search children, not descendants
if (reader.isStartElement()) {
level++;
} else if (reader.isEndElement()) {
level--;
}
if (level < 0) {
//end parent tag - no more children
break;
}
reader.next();
if (level == 0 && reader.isStartElement() && reader.getLocalName().equals(tagName)) {
return true; //found
}
}
return false; //got to end of parent element and not found
} | java | static boolean scanForChildTag(XMLStreamReader reader, String tagName)
throws XMLStreamException {
assert reader.isStartElement();
int level = -1;
while (reader.hasNext()) {
//keep track of level so we only search children, not descendants
if (reader.isStartElement()) {
level++;
} else if (reader.isEndElement()) {
level--;
}
if (level < 0) {
//end parent tag - no more children
break;
}
reader.next();
if (level == 0 && reader.isStartElement() && reader.getLocalName().equals(tagName)) {
return true; //found
}
}
return false; //got to end of parent element and not found
} | [
"static",
"boolean",
"scanForChildTag",
"(",
"XMLStreamReader",
"reader",
",",
"String",
"tagName",
")",
"throws",
"XMLStreamException",
"{",
"assert",
"reader",
".",
"isStartElement",
"(",
")",
";",
"int",
"level",
"=",
"-",
"1",
";",
"while",
"(",
"reader",
... | Scan xml for tag child of the current element
@param reader reader, must be at "start element" @nonnull
@param tagName name of child tag to find @nonnull
@return if found tag
@throws XMLStreamException on error | [
"Scan",
"xml",
"for",
"tag",
"child",
"of",
"the",
"current",
"element"
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/PayloadNameRequestWrapper.java#L201-L225 |
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java | diff_match_patch.diff_main | private LinkedList<Diff> diff_main(String text1, String text2,
boolean checklines, long deadline) {
// Check for null inputs.
if (text1 == null || text2 == null) {
throw new IllegalArgumentException("Null inputs. (diff_main)");
}
// Check for equality (speedup).
LinkedList<Diff> diffs;
if (text1.equals(text2)) {
diffs = new LinkedList<Diff>();
if (text1.length() != 0) {
diffs.add(new Diff(Operation.EQUAL, text1));
}
return diffs;
}
// Trim off common prefix (speedup).
int commonlength = diff_commonPrefix(text1, text2);
String commonprefix = text1.substring(0, commonlength);
text1 = text1.substring(commonlength);
text2 = text2.substring(commonlength);
// Trim off common suffix (speedup).
commonlength = diff_commonSuffix(text1, text2);
String commonsuffix = text1.substring(text1.length() - commonlength);
text1 = text1.substring(0, text1.length() - commonlength);
text2 = text2.substring(0, text2.length() - commonlength);
// Compute the diff on the middle block.
diffs = diff_compute(text1, text2, checklines, deadline);
// Restore the prefix and suffix.
if (commonprefix.length() != 0) {
diffs.addFirst(new Diff(Operation.EQUAL, commonprefix));
}
if (commonsuffix.length() != 0) {
diffs.addLast(new Diff(Operation.EQUAL, commonsuffix));
}
diff_cleanupMerge(diffs);
return diffs;
} | java | private LinkedList<Diff> diff_main(String text1, String text2,
boolean checklines, long deadline) {
// Check for null inputs.
if (text1 == null || text2 == null) {
throw new IllegalArgumentException("Null inputs. (diff_main)");
}
// Check for equality (speedup).
LinkedList<Diff> diffs;
if (text1.equals(text2)) {
diffs = new LinkedList<Diff>();
if (text1.length() != 0) {
diffs.add(new Diff(Operation.EQUAL, text1));
}
return diffs;
}
// Trim off common prefix (speedup).
int commonlength = diff_commonPrefix(text1, text2);
String commonprefix = text1.substring(0, commonlength);
text1 = text1.substring(commonlength);
text2 = text2.substring(commonlength);
// Trim off common suffix (speedup).
commonlength = diff_commonSuffix(text1, text2);
String commonsuffix = text1.substring(text1.length() - commonlength);
text1 = text1.substring(0, text1.length() - commonlength);
text2 = text2.substring(0, text2.length() - commonlength);
// Compute the diff on the middle block.
diffs = diff_compute(text1, text2, checklines, deadline);
// Restore the prefix and suffix.
if (commonprefix.length() != 0) {
diffs.addFirst(new Diff(Operation.EQUAL, commonprefix));
}
if (commonsuffix.length() != 0) {
diffs.addLast(new Diff(Operation.EQUAL, commonsuffix));
}
diff_cleanupMerge(diffs);
return diffs;
} | [
"private",
"LinkedList",
"<",
"Diff",
">",
"diff_main",
"(",
"String",
"text1",
",",
"String",
"text2",
",",
"boolean",
"checklines",
",",
"long",
"deadline",
")",
"{",
"// Check for null inputs.",
"if",
"(",
"text1",
"==",
"null",
"||",
"text2",
"==",
"null... | Find the differences between two texts. Simplifies the problem by
stripping any common prefix or suffix off the texts before diffing.
@param text1
Old string to be diffed.
@param text2
New string to be diffed.
@param checklines
Speedup flag. If false, then don't run a line-level diff first
to identify the changed areas. If true, then run a faster
slightly less optimal diff.
@param deadline
Time when the diff should be complete by. Used internally for
recursive calls. Users should set DiffTimeout instead.
@return Linked List of Diff objects. | [
"Find",
"the",
"differences",
"between",
"two",
"texts",
".",
"Simplifies",
"the",
"problem",
"by",
"stripping",
"any",
"common",
"prefix",
"or",
"suffix",
"off",
"the",
"texts",
"before",
"diffing",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L177-L219 |
Jasig/uPortal | uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/provider/BasePersonManager.java | BasePersonManager.createPersonForRequest | protected IPerson createPersonForRequest(HttpServletRequest request) {
/*
* Is there an an identity specified by OIDC Id token?
*/
final Jws<Claims> claims = idTokenFactory.getUserInfo(request);
if (claims != null) {
final String username = claims.getBody().getSubject();
logger.debug("Found OIDC Id token for username='{}'", username);
final IPerson rslt = new PersonImpl();
rslt.setAttribute(IPerson.USERNAME, username);
rslt.setID(userIdentityStore.getPortalUserId(username));
return rslt;
}
/*
* No identity specified; create a 'guest person.'
*/
// First we need to know the guest username
String username = PersonFactory.getGuestUsernames().get(0); // First item is the default
// Pluggable strategy for supporting multiple guest users
for (IGuestUsernameSelector selector : guestUsernameSelectors) {
final String s = selector.selectGuestUsername(request);
if (s != null) {
username = s;
break;
}
}
// Sanity check...
if (!PersonFactory.getGuestUsernames().contains(username)) {
final String msg =
"The specified guest username is not in the configured list: " + username;
throw new IllegalStateException(msg);
}
Integer guestUserId = guestUserIds.get(username);
if (guestUserId == null) {
// Not yet looked up
loadGuestUserId(username, guestUserIds);
guestUserId = guestUserIds.get(username);
}
final IPerson rslt = PersonFactory.createPerson();
rslt.setAttribute(IPerson.USERNAME, username);
rslt.setID(guestUserId);
rslt.setSecurityContext(initialSecurityContextFactory.getInitialContext());
return rslt;
} | java | protected IPerson createPersonForRequest(HttpServletRequest request) {
/*
* Is there an an identity specified by OIDC Id token?
*/
final Jws<Claims> claims = idTokenFactory.getUserInfo(request);
if (claims != null) {
final String username = claims.getBody().getSubject();
logger.debug("Found OIDC Id token for username='{}'", username);
final IPerson rslt = new PersonImpl();
rslt.setAttribute(IPerson.USERNAME, username);
rslt.setID(userIdentityStore.getPortalUserId(username));
return rslt;
}
/*
* No identity specified; create a 'guest person.'
*/
// First we need to know the guest username
String username = PersonFactory.getGuestUsernames().get(0); // First item is the default
// Pluggable strategy for supporting multiple guest users
for (IGuestUsernameSelector selector : guestUsernameSelectors) {
final String s = selector.selectGuestUsername(request);
if (s != null) {
username = s;
break;
}
}
// Sanity check...
if (!PersonFactory.getGuestUsernames().contains(username)) {
final String msg =
"The specified guest username is not in the configured list: " + username;
throw new IllegalStateException(msg);
}
Integer guestUserId = guestUserIds.get(username);
if (guestUserId == null) {
// Not yet looked up
loadGuestUserId(username, guestUserIds);
guestUserId = guestUserIds.get(username);
}
final IPerson rslt = PersonFactory.createPerson();
rslt.setAttribute(IPerson.USERNAME, username);
rslt.setID(guestUserId);
rslt.setSecurityContext(initialSecurityContextFactory.getInitialContext());
return rslt;
} | [
"protected",
"IPerson",
"createPersonForRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"/*\n * Is there an an identity specified by OIDC Id token?\n */",
"final",
"Jws",
"<",
"Claims",
">",
"claims",
"=",
"idTokenFactory",
".",
"getUserInfo",
"(",
"... | Creates a new {@link IPerson} to represent the user based on (1) an OIDC Id token specified
in the Authorization header or (2) the value of the <code>
org.apereo.portal.security.PersonFactory.guest_user_names</code> property in
portal.properties and (optionally) any beans that implement {@link IGuestUsernameSelector}.
This approach supports pluggable, open-ended strategies for multiple guest users who may have
different content.
@since 5.0 | [
"Creates",
"a",
"new",
"{",
"@link",
"IPerson",
"}",
"to",
"represent",
"the",
"user",
"based",
"on",
"(",
"1",
")",
"an",
"OIDC",
"Id",
"token",
"specified",
"in",
"the",
"Authorization",
"header",
"or",
"(",
"2",
")",
"the",
"value",
"of",
"the",
"... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/provider/BasePersonManager.java#L119-L171 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/replicator/PusherInternal.java | PusherInternal.uploadJsonRevision | private void uploadJsonRevision(final RevisionInternal rev) {
// Get the revision's properties:
if (!db.inlineFollowingAttachmentsIn(rev)) {
setError(new CouchbaseLiteException(Status.BAD_ATTACHMENT));
return;
}
final String path = String.format(Locale.ENGLISH, "%s?new_edits=false", encodeDocumentId(rev.getDocID()));
CustomFuture future = sendAsyncRequest("PUT",
path,
rev.getProperties(),
new RemoteRequestCompletion() {
public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
if (e != null) {
setError(e);
} else {
Log.v(TAG, "%s: Sent %s (JSON), response=%s", this, rev, result);
removePending(rev);
}
}
});
future.setQueue(pendingFutures);
pendingFutures.add(future);
} | java | private void uploadJsonRevision(final RevisionInternal rev) {
// Get the revision's properties:
if (!db.inlineFollowingAttachmentsIn(rev)) {
setError(new CouchbaseLiteException(Status.BAD_ATTACHMENT));
return;
}
final String path = String.format(Locale.ENGLISH, "%s?new_edits=false", encodeDocumentId(rev.getDocID()));
CustomFuture future = sendAsyncRequest("PUT",
path,
rev.getProperties(),
new RemoteRequestCompletion() {
public void onCompletion(RemoteRequest remoteRequest, Response httpResponse, Object result, Throwable e) {
if (e != null) {
setError(e);
} else {
Log.v(TAG, "%s: Sent %s (JSON), response=%s", this, rev, result);
removePending(rev);
}
}
});
future.setQueue(pendingFutures);
pendingFutures.add(future);
} | [
"private",
"void",
"uploadJsonRevision",
"(",
"final",
"RevisionInternal",
"rev",
")",
"{",
"// Get the revision's properties:",
"if",
"(",
"!",
"db",
".",
"inlineFollowingAttachmentsIn",
"(",
"rev",
")",
")",
"{",
"setError",
"(",
"new",
"CouchbaseLiteException",
"... | Fallback to upload a revision if uploadMultipartRevision failed due to the server's rejecting
multipart format.
- (void) uploadJSONRevision: (CBL_Revision*)originalRev in CBLRestPusher.m | [
"Fallback",
"to",
"upload",
"a",
"revision",
"if",
"uploadMultipartRevision",
"failed",
"due",
"to",
"the",
"server",
"s",
"rejecting",
"multipart",
"format",
".",
"-",
"(",
"void",
")",
"uploadJSONRevision",
":",
"(",
"CBL_Revision",
"*",
")",
"originalRev",
... | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/PusherInternal.java#L639-L662 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java | WebUtils.doPost | public static String doPost(String url, Map<String, String> params, int connectTimeout, int readTimeout) throws IOException {
return doPost(url, params, DEFAULT_CHARSET, connectTimeout, readTimeout);
} | java | public static String doPost(String url, Map<String, String> params, int connectTimeout, int readTimeout) throws IOException {
return doPost(url, params, DEFAULT_CHARSET, connectTimeout, readTimeout);
} | [
"public",
"static",
"String",
"doPost",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"int",
"connectTimeout",
",",
"int",
"readTimeout",
")",
"throws",
"IOException",
"{",
"return",
"doPost",
"(",
"url",
",",
"params"... | 执行HTTP POST请求。
@param url 请求地址
@param params 请求参数
@return 响应字符串 | [
"执行HTTP",
"POST请求。"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L51-L53 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/event/EventUtils.java | EventUtils.addEventListener | public static <L> void addEventListener(final Object eventSource, final Class<L> listenerType, final L listener) {
try {
MethodUtils.invokeMethod(eventSource, "add" + listenerType.getSimpleName(), listener);
} catch (final NoSuchMethodException e) {
throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
+ " does not have a public add" + listenerType.getSimpleName()
+ " method which takes a parameter of type " + listenerType.getName() + ".");
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
+ " does not have an accessible add" + listenerType.getSimpleName ()
+ " method which takes a parameter of type " + listenerType.getName() + ".");
} catch (final InvocationTargetException e) {
throw new RuntimeException("Unable to add listener.", e.getCause());
}
} | java | public static <L> void addEventListener(final Object eventSource, final Class<L> listenerType, final L listener) {
try {
MethodUtils.invokeMethod(eventSource, "add" + listenerType.getSimpleName(), listener);
} catch (final NoSuchMethodException e) {
throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
+ " does not have a public add" + listenerType.getSimpleName()
+ " method which takes a parameter of type " + listenerType.getName() + ".");
} catch (final IllegalAccessException e) {
throw new IllegalArgumentException("Class " + eventSource.getClass().getName()
+ " does not have an accessible add" + listenerType.getSimpleName ()
+ " method which takes a parameter of type " + listenerType.getName() + ".");
} catch (final InvocationTargetException e) {
throw new RuntimeException("Unable to add listener.", e.getCause());
}
} | [
"public",
"static",
"<",
"L",
">",
"void",
"addEventListener",
"(",
"final",
"Object",
"eventSource",
",",
"final",
"Class",
"<",
"L",
">",
"listenerType",
",",
"final",
"L",
"listener",
")",
"{",
"try",
"{",
"MethodUtils",
".",
"invokeMethod",
"(",
"event... | Adds an event listener to the specified source. This looks for an "add" method corresponding to the event
type (addActionListener, for example).
@param eventSource the event source
@param listenerType the event listener type
@param listener the listener
@param <L> the event listener type
@throws IllegalArgumentException if the object doesn't support the listener type | [
"Adds",
"an",
"event",
"listener",
"to",
"the",
"specified",
"source",
".",
"This",
"looks",
"for",
"an",
"add",
"method",
"corresponding",
"to",
"the",
"event",
"type",
"(",
"addActionListener",
"for",
"example",
")",
".",
"@param",
"eventSource",
"the",
"e... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventUtils.java#L50-L64 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java | ParseUtils.requireAttributes | public static String[] requireAttributes(final XMLExtendedStreamReader reader, final String... attributeNames)
throws XMLStreamException {
final int length = attributeNames.length;
final String[] result = new String[length];
for (int i = 0; i < length; i++) {
final String name = attributeNames[i];
final String value = reader.getAttributeValue(null, name);
if (value == null) {
throw missingRequired(reader, Collections.singleton(name));
}
result[i] = value;
}
return result;
} | java | public static String[] requireAttributes(final XMLExtendedStreamReader reader, final String... attributeNames)
throws XMLStreamException {
final int length = attributeNames.length;
final String[] result = new String[length];
for (int i = 0; i < length; i++) {
final String name = attributeNames[i];
final String value = reader.getAttributeValue(null, name);
if (value == null) {
throw missingRequired(reader, Collections.singleton(name));
}
result[i] = value;
}
return result;
} | [
"public",
"static",
"String",
"[",
"]",
"requireAttributes",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"String",
"...",
"attributeNames",
")",
"throws",
"XMLStreamException",
"{",
"final",
"int",
"length",
"=",
"attributeNames",
".",
"length",... | Require all the named attributes, returning their values in order.
@param reader the reader
@param attributeNames the attribute names
@return the attribute values in order
@throws javax.xml.stream.XMLStreamException if an error occurs | [
"Require",
"all",
"the",
"named",
"attributes",
"returning",
"their",
"values",
"in",
"order",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L514-L527 |
dbracewell/hermes | hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java | WordNet.getHyponyms | public Set<Synset> getHyponyms(@NonNull Synset node) {
return getRelatedSynsets(node, WordNetRelation.HYPONYM);
} | java | public Set<Synset> getHyponyms(@NonNull Synset node) {
return getRelatedSynsets(node, WordNetRelation.HYPONYM);
} | [
"public",
"Set",
"<",
"Synset",
">",
"getHyponyms",
"(",
"@",
"NonNull",
"Synset",
"node",
")",
"{",
"return",
"getRelatedSynsets",
"(",
"node",
",",
"WordNetRelation",
".",
"HYPONYM",
")",
";",
"}"
] | Gets the hyponyms of the given synset.
@param node The synset whose hyponyms we want
@return The hyponyms | [
"Gets",
"the",
"hyponyms",
"of",
"the",
"given",
"synset",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java#L249-L251 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java | ZonedDateTime.create | private static ZonedDateTime create(long epochSecond, int nanoOfSecond, ZoneId zone) {
ZoneRules rules = zone.getRules();
Instant instant = Instant.ofEpochSecond(epochSecond, nanoOfSecond); // TODO: rules should be queryable by epochSeconds
ZoneOffset offset = rules.getOffset(instant);
LocalDateTime ldt = LocalDateTime.ofEpochSecond(epochSecond, nanoOfSecond, offset);
return new ZonedDateTime(ldt, offset, zone);
} | java | private static ZonedDateTime create(long epochSecond, int nanoOfSecond, ZoneId zone) {
ZoneRules rules = zone.getRules();
Instant instant = Instant.ofEpochSecond(epochSecond, nanoOfSecond); // TODO: rules should be queryable by epochSeconds
ZoneOffset offset = rules.getOffset(instant);
LocalDateTime ldt = LocalDateTime.ofEpochSecond(epochSecond, nanoOfSecond, offset);
return new ZonedDateTime(ldt, offset, zone);
} | [
"private",
"static",
"ZonedDateTime",
"create",
"(",
"long",
"epochSecond",
",",
"int",
"nanoOfSecond",
",",
"ZoneId",
"zone",
")",
"{",
"ZoneRules",
"rules",
"=",
"zone",
".",
"getRules",
"(",
")",
";",
"Instant",
"instant",
"=",
"Instant",
".",
"ofEpochSec... | Obtains an instance of {@code ZonedDateTime} using seconds from the
epoch of 1970-01-01T00:00:00Z.
@param epochSecond the number of seconds from the epoch of 1970-01-01T00:00:00Z
@param nanoOfSecond the nanosecond within the second, from 0 to 999,999,999
@param zone the time-zone, not null
@return the zoned date-time, not null
@throws DateTimeException if the result exceeds the supported range | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"ZonedDateTime",
"}",
"using",
"seconds",
"from",
"the",
"epoch",
"of",
"1970",
"-",
"01",
"-",
"01T00",
":",
"00",
":",
"00Z",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L446-L452 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.isTyping | public void isTyping(@NonNull final String conversationId, @Nullable Callback<ComapiResult<Void>> callback) {
adapter.adapt(isTyping(conversationId, true), callback);
} | java | public void isTyping(@NonNull final String conversationId, @Nullable Callback<ComapiResult<Void>> callback) {
adapter.adapt(isTyping(conversationId, true), callback);
} | [
"public",
"void",
"isTyping",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"Void",
">",
">",
"callback",
")",
"{",
"adapter",
".",
"adapt",
"(",
"isTyping",
"(",
"conversationId",
",",
... | Send 'user is typing' message for specified conversation.
@param conversationId ID of a conversation.
@param callback Callback to deliver result. | [
"Send",
"user",
"is",
"typing",
"message",
"for",
"specified",
"conversation",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L929-L931 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java | MirrorTable.setHandle | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
FieldList record = super.setHandle(bookmark, iHandleType);
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
this.syncTables(table, this.getRecord());
}
return record;
} | java | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
FieldList record = super.setHandle(bookmark, iHandleType);
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
this.syncTables(table, this.getRecord());
}
return record;
} | [
"public",
"FieldList",
"setHandle",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"throws",
"DBException",
"{",
"FieldList",
"record",
"=",
"super",
".",
"setHandle",
"(",
"bookmark",
",",
"iHandleType",
")",
";",
"Iterator",
"<",
"BaseTable",
">"... | Reposition to this record Using this bookmark.
@exception DBException File exception. | [
"Reposition",
"to",
"this",
"record",
"Using",
"this",
"bookmark",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java#L295-L306 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java | Scopes.scopeFor | public static IScope scopeFor(Iterable<? extends EObject> elements, IScope outer) {
return scopeFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER), outer);
} | java | public static IScope scopeFor(Iterable<? extends EObject> elements, IScope outer) {
return scopeFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER), outer);
} | [
"public",
"static",
"IScope",
"scopeFor",
"(",
"Iterable",
"<",
"?",
"extends",
"EObject",
">",
"elements",
",",
"IScope",
"outer",
")",
"{",
"return",
"scopeFor",
"(",
"elements",
",",
"QualifiedName",
".",
"wrapper",
"(",
"SimpleAttributeResolver",
".",
"NAM... | creates a scope using {@link SimpleAttributeResolver#NAME_RESOLVER} to compute the names | [
"creates",
"a",
"scope",
"using",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L61-L63 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFolder.java | UtilFolder.getPathSeparator | public static String getPathSeparator(String separator, String... path)
{
Check.notNull(separator);
Check.notNull(path);
final StringBuilder fullPath = new StringBuilder(path.length);
for (int i = 0; i < path.length; i++)
{
if (i == path.length - 1)
{
fullPath.append(path[i]);
}
else if (path[i] != null && path[i].length() > 0)
{
fullPath.append(path[i]);
if (!fullPath.substring(fullPath.length() - 1, fullPath.length()).equals(separator))
{
fullPath.append(separator);
}
}
}
return fullPath.toString();
} | java | public static String getPathSeparator(String separator, String... path)
{
Check.notNull(separator);
Check.notNull(path);
final StringBuilder fullPath = new StringBuilder(path.length);
for (int i = 0; i < path.length; i++)
{
if (i == path.length - 1)
{
fullPath.append(path[i]);
}
else if (path[i] != null && path[i].length() > 0)
{
fullPath.append(path[i]);
if (!fullPath.substring(fullPath.length() - 1, fullPath.length()).equals(separator))
{
fullPath.append(separator);
}
}
}
return fullPath.toString();
} | [
"public",
"static",
"String",
"getPathSeparator",
"(",
"String",
"separator",
",",
"String",
"...",
"path",
")",
"{",
"Check",
".",
"notNull",
"(",
"separator",
")",
";",
"Check",
".",
"notNull",
"(",
"path",
")",
";",
"final",
"StringBuilder",
"fullPath",
... | Construct a usable path using a list of string, automatically separated by the portable separator.
@param separator The separator to use (must not be <code>null</code>).
@param path The list of directories, if has, and file (must not be <code>null</code>).
@return The full media path.
@throws LionEngineException If invalid parameters. | [
"Construct",
"a",
"usable",
"path",
"using",
"a",
"list",
"of",
"string",
"automatically",
"separated",
"by",
"the",
"portable",
"separator",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFolder.java#L82-L104 |
ragunathjawahar/adapter-kit | library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java | InstantAdapterCore.setViewHandler | public void setViewHandler(final int viewId, final ViewHandler<T> viewHandler) {
if (viewHandler == null) {
throw new IllegalArgumentException("'viewHandler' cannot be null.");
}
mViewHandlers.put(viewId, viewHandler);
} | java | public void setViewHandler(final int viewId, final ViewHandler<T> viewHandler) {
if (viewHandler == null) {
throw new IllegalArgumentException("'viewHandler' cannot be null.");
}
mViewHandlers.put(viewId, viewHandler);
} | [
"public",
"void",
"setViewHandler",
"(",
"final",
"int",
"viewId",
",",
"final",
"ViewHandler",
"<",
"T",
">",
"viewHandler",
")",
"{",
"if",
"(",
"viewHandler",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'viewHandler' cannot be ... | Sets an {@link ViewHandler} for a given View id.
@param viewId Designated View id.
@param viewHandler A {@link ViewHandler} for the corresponding View.
@throws IllegalArgumentException If evaluator is {@code null}. | [
"Sets",
"an",
"{",
"@link",
"ViewHandler",
"}",
"for",
"a",
"given",
"View",
"id",
"."
] | train | https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java#L161-L166 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.patchAsync | public Observable<NotificationHubResourceInner> patchAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
return patchWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | java | public Observable<NotificationHubResourceInner> patchAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
return patchWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NotificationHubResourceInner",
">",
"patchAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
")",
"{",
"return",
"patchWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"n... | Patch a NotificationHub in a namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NotificationHubResourceInner object | [
"Patch",
"a",
"NotificationHub",
"in",
"a",
"namespace",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L372-L379 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listUsagesAsync | public Observable<Page<CsmUsageQuotaInner>> listUsagesAsync(final String resourceGroupName, final String name, final String filter) {
return listUsagesWithServiceResponseAsync(resourceGroupName, name, filter)
.map(new Func1<ServiceResponse<Page<CsmUsageQuotaInner>>, Page<CsmUsageQuotaInner>>() {
@Override
public Page<CsmUsageQuotaInner> call(ServiceResponse<Page<CsmUsageQuotaInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<CsmUsageQuotaInner>> listUsagesAsync(final String resourceGroupName, final String name, final String filter) {
return listUsagesWithServiceResponseAsync(resourceGroupName, name, filter)
.map(new Func1<ServiceResponse<Page<CsmUsageQuotaInner>>, Page<CsmUsageQuotaInner>>() {
@Override
public Page<CsmUsageQuotaInner> call(ServiceResponse<Page<CsmUsageQuotaInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"CsmUsageQuotaInner",
">",
">",
"listUsagesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"filter",
")",
"{",
"return",
"listUsagesWithServiceResponseAsync",
"(",... | Gets server farm usage information.
Gets server farm usage information.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of App Service Plan
@param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2').
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CsmUsageQuotaInner> object | [
"Gets",
"server",
"farm",
"usage",
"information",
".",
"Gets",
"server",
"farm",
"usage",
"information",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2895-L2903 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java | Schema.recordOf | public static Schema recordOf(String name) {
Preconditions.checkNotNull(name, "Record name cannot be null.");
return new Schema(Type.RECORD, null, null, null, null, name, null, null);
} | java | public static Schema recordOf(String name) {
Preconditions.checkNotNull(name, "Record name cannot be null.");
return new Schema(Type.RECORD, null, null, null, null, name, null, null);
} | [
"public",
"static",
"Schema",
"recordOf",
"(",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"name",
",",
"\"Record name cannot be null.\"",
")",
";",
"return",
"new",
"Schema",
"(",
"Type",
".",
"RECORD",
",",
"null",
",",
"null",
"... | Creates a {@link Type#RECORD RECORD} {@link Schema} of the given name. The schema created
doesn't carry any record fields, which makes it only useful to be used as a component schema
for other schema type, where the actual schema is resolved from the top level container schema.
@param name Name of the record.
@return A {@link Schema} of {@link Type#RECORD RECORD} type. | [
"Creates",
"a",
"{",
"@link",
"Type#RECORD",
"RECORD",
"}",
"{",
"@link",
"Schema",
"}",
"of",
"the",
"given",
"name",
".",
"The",
"schema",
"created",
"doesn",
"t",
"carry",
"any",
"record",
"fields",
"which",
"makes",
"it",
"only",
"useful",
"to",
"be"... | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L197-L200 |
Netflix/karyon | karyon2-governator/src/main/java/netflix/karyon/Karyon.java | Karyon.forApplication | public static KaryonServer forApplication(Class<?> mainClass, Module... modules) {
return forApplication(mainClass, toBootstrapModule(modules));
} | java | public static KaryonServer forApplication(Class<?> mainClass, Module... modules) {
return forApplication(mainClass, toBootstrapModule(modules));
} | [
"public",
"static",
"KaryonServer",
"forApplication",
"(",
"Class",
"<",
"?",
">",
"mainClass",
",",
"Module",
"...",
"modules",
")",
"{",
"return",
"forApplication",
"(",
"mainClass",
",",
"toBootstrapModule",
"(",
"modules",
")",
")",
";",
"}"
] | Creates a new {@link KaryonServer} which uses the passed class to detect any modules.
@param mainClass Any class/interface containing governator's {@link Bootstrap} annotations.
@param modules Additional modules if any.
@return {@link KaryonServer} which is to be used to start the created server. | [
"Creates",
"a",
"new",
"{",
"@link",
"KaryonServer",
"}",
"which",
"uses",
"the",
"passed",
"class",
"to",
"detect",
"any",
"modules",
"."
] | train | https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L284-L286 |
samskivert/pythagoras | src/main/java/pythagoras/f/RectangularShape.java | RectangularShape.setFrameFromDiagonal | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
} else {
ry = y2;
rh = y1 - y2;
}
setFrame(rx, ry, rw, rh);
} | java | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
} else {
ry = y2;
rh = y1 - y2;
}
setFrame(rx, ry, rw, rh);
} | [
"public",
"void",
"setFrameFromDiagonal",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"rx",
",",
"ry",
",",
"rw",
",",
"rh",
";",
"if",
"(",
"x1",
"<",
"x2",
")",
"{",
"rx",
"=",
"x1",
";",... | Sets the location and size of the framing rectangle of this shape based on the specified
diagonal line. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"specified",
"diagonal",
"line",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RectangularShape.java#L37-L54 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunsInner.java | WorkflowRunsInner.getAsync | public Observable<WorkflowRunInner> getAsync(String resourceGroupName, String workflowName, String runName) {
return getWithServiceResponseAsync(resourceGroupName, workflowName, runName).map(new Func1<ServiceResponse<WorkflowRunInner>, WorkflowRunInner>() {
@Override
public WorkflowRunInner call(ServiceResponse<WorkflowRunInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowRunInner> getAsync(String resourceGroupName, String workflowName, String runName) {
return getWithServiceResponseAsync(resourceGroupName, workflowName, runName).map(new Func1<ServiceResponse<WorkflowRunInner>, WorkflowRunInner>() {
@Override
public WorkflowRunInner call(ServiceResponse<WorkflowRunInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowRunInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"runName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
",",
"runNa... | Gets a workflow run.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param runName The workflow run name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowRunInner object | [
"Gets",
"a",
"workflow",
"run",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunsInner.java#L368-L375 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/FavoritesApi.java | FavoritesApi.getContext | public Context getContext(String photoId, String userId) throws JinxException {
JinxUtils.validateParams(photoId, userId);
Map<String, String> params = new TreeMap<String, String>();
params.put("method", "flickr.favorites.getContext");
params.put("photo_id", photoId);
params.put("user_id", userId);
return jinx.flickrPost(params, Context.class);
} | java | public Context getContext(String photoId, String userId) throws JinxException {
JinxUtils.validateParams(photoId, userId);
Map<String, String> params = new TreeMap<String, String>();
params.put("method", "flickr.favorites.getContext");
params.put("photo_id", photoId);
params.put("user_id", userId);
return jinx.flickrPost(params, Context.class);
} | [
"public",
"Context",
"getContext",
"(",
"String",
"photoId",
",",
"String",
"userId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
",",
"userId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
... | Returns next and previous favorites for a photo in a user's favorites.
<br>
This method does not require authentication.
@param photoId Required. The id of the photo to fetch the context for.
@param userId Required. The user who counts the photo as a favorite.
@return object with context information.
@throws JinxException if required parameters are null or empty, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.favorites.getContext.htm">flickr.favorites.getContext</a> | [
"Returns",
"next",
"and",
"previous",
"favorites",
"for",
"a",
"photo",
"in",
"a",
"user",
"s",
"favorites",
".",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/FavoritesApi.java#L77-L84 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/tiles/ImageUtils.java | ImageUtils.createBufferedImage | public static BufferedImage createBufferedImage(int width, int height,
String imageFormat) {
int imageType;
switch (imageFormat.toLowerCase()) {
case IMAGE_FORMAT_JPG:
case IMAGE_FORMAT_JPEG:
imageType = BufferedImage.TYPE_INT_RGB;
break;
default:
imageType = BufferedImage.TYPE_INT_ARGB;
}
BufferedImage image = new BufferedImage(width, height, imageType);
return image;
} | java | public static BufferedImage createBufferedImage(int width, int height,
String imageFormat) {
int imageType;
switch (imageFormat.toLowerCase()) {
case IMAGE_FORMAT_JPG:
case IMAGE_FORMAT_JPEG:
imageType = BufferedImage.TYPE_INT_RGB;
break;
default:
imageType = BufferedImage.TYPE_INT_ARGB;
}
BufferedImage image = new BufferedImage(width, height, imageType);
return image;
} | [
"public",
"static",
"BufferedImage",
"createBufferedImage",
"(",
"int",
"width",
",",
"int",
"height",
",",
"String",
"imageFormat",
")",
"{",
"int",
"imageType",
";",
"switch",
"(",
"imageFormat",
".",
"toLowerCase",
"(",
")",
")",
"{",
"case",
"IMAGE_FORMAT_... | Create a buffered image for the dimensions and image format
@param width
image width
@param height
image height
@param imageFormat
image format
@return image | [
"Create",
"a",
"buffered",
"image",
"for",
"the",
"dimensions",
"and",
"image",
"format"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/ImageUtils.java#L58-L75 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java | TrueTypeFontUnicode.getFontBaseType | private PdfDictionary getFontBaseType(PdfIndirectReference descendant, String subsetPrefix, PdfIndirectReference toUnicode) {
PdfDictionary dic = new PdfDictionary(PdfName.FONT);
dic.put(PdfName.SUBTYPE, PdfName.TYPE0);
// The PDF Reference manual advises to add -encoding to CID font names
if (cff)
dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName+"-"+encoding));
//dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName));
else
dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName));
//dic.put(PdfName.BASEFONT, new PdfName(fontName));
dic.put(PdfName.ENCODING, new PdfName(encoding));
dic.put(PdfName.DESCENDANTFONTS, new PdfArray(descendant));
if (toUnicode != null)
dic.put(PdfName.TOUNICODE, toUnicode);
return dic;
} | java | private PdfDictionary getFontBaseType(PdfIndirectReference descendant, String subsetPrefix, PdfIndirectReference toUnicode) {
PdfDictionary dic = new PdfDictionary(PdfName.FONT);
dic.put(PdfName.SUBTYPE, PdfName.TYPE0);
// The PDF Reference manual advises to add -encoding to CID font names
if (cff)
dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName+"-"+encoding));
//dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix+fontName));
else
dic.put(PdfName.BASEFONT, new PdfName(subsetPrefix + fontName));
//dic.put(PdfName.BASEFONT, new PdfName(fontName));
dic.put(PdfName.ENCODING, new PdfName(encoding));
dic.put(PdfName.DESCENDANTFONTS, new PdfArray(descendant));
if (toUnicode != null)
dic.put(PdfName.TOUNICODE, toUnicode);
return dic;
} | [
"private",
"PdfDictionary",
"getFontBaseType",
"(",
"PdfIndirectReference",
"descendant",
",",
"String",
"subsetPrefix",
",",
"PdfIndirectReference",
"toUnicode",
")",
"{",
"PdfDictionary",
"dic",
"=",
"new",
"PdfDictionary",
"(",
"PdfName",
".",
"FONT",
")",
";",
"... | Generates the font dictionary.
@param descendant the descendant dictionary
@param subsetPrefix the subset prefix
@param toUnicode the ToUnicode stream
@return the stream | [
"Generates",
"the",
"font",
"dictionary",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L355-L371 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/FTPClient.java | FTPClient.authorize | public void authorize(String user, String password)
throws IOException, ServerException {
Reply userReply = null;
try {
userReply = controlChannel.exchange(new Command("USER", user));
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
if (Reply.isPositiveIntermediate(userReply)) {
Reply passReply = null;
try {
passReply =
controlChannel.exchange(new Command("PASS", password));
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
if (!Reply.isPositiveCompletion(passReply)) {
throw ServerException.embedUnexpectedReplyCodeException(
new UnexpectedReplyCodeException(passReply),
"Bad password.");
}
// i'm logged in
} else if (Reply.isPositiveCompletion(userReply)) {
// i'm logged in
} else {
throw ServerException.embedUnexpectedReplyCodeException(
new UnexpectedReplyCodeException(userReply),
"Bad user.");
}
this.session.authorized = true;
this.username = user;
} | java | public void authorize(String user, String password)
throws IOException, ServerException {
Reply userReply = null;
try {
userReply = controlChannel.exchange(new Command("USER", user));
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
if (Reply.isPositiveIntermediate(userReply)) {
Reply passReply = null;
try {
passReply =
controlChannel.exchange(new Command("PASS", password));
} catch (FTPReplyParseException rpe) {
throw ServerException.embedFTPReplyParseException(rpe);
}
if (!Reply.isPositiveCompletion(passReply)) {
throw ServerException.embedUnexpectedReplyCodeException(
new UnexpectedReplyCodeException(passReply),
"Bad password.");
}
// i'm logged in
} else if (Reply.isPositiveCompletion(userReply)) {
// i'm logged in
} else {
throw ServerException.embedUnexpectedReplyCodeException(
new UnexpectedReplyCodeException(userReply),
"Bad user.");
}
this.session.authorized = true;
this.username = user;
} | [
"public",
"void",
"authorize",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"IOException",
",",
"ServerException",
"{",
"Reply",
"userReply",
"=",
"null",
";",
"try",
"{",
"userReply",
"=",
"controlChannel",
".",
"exchange",
"(",
"new",
"... | Performs user authorization with specified
user and password.
@param user username
@param password user password
@exception ServerException on server refusal | [
"Performs",
"user",
"authorization",
"with",
"specified",
"user",
"and",
"password",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1193-L1232 |
Red5/red5-server-common | src/main/java/org/red5/server/Server.java | Server.lookupGlobal | public IGlobalScope lookupGlobal(String hostName, String contextPath) {
log.trace("{}", this);
log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath);
// Init mappings key
String key = getKey(hostName, contextPath);
// If context path contains slashes get complex key and look for it in mappings
while (contextPath.indexOf(SLASH) != -1) {
key = getKey(hostName, contextPath);
log.trace("Check: {}", key);
String globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
final int slashIndex = contextPath.lastIndexOf(SLASH);
// Context path is substring from the beginning and till last slash index
contextPath = contextPath.substring(0, slashIndex);
}
// Get global scope key
key = getKey(hostName, contextPath);
log.trace("Check host and path: {}", key);
// Look up for global scope switching keys if still not found
String globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(EMPTY, contextPath);
log.trace("Check wildcard host with path: {}", key);
globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(hostName, EMPTY);
log.trace("Check host with no path: {}", key);
globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(EMPTY, EMPTY);
log.trace("Check default host, default path: {}", key);
return getGlobal(mapping.get(key));
} | java | public IGlobalScope lookupGlobal(String hostName, String contextPath) {
log.trace("{}", this);
log.debug("Lookup global scope - host name: {} context path: {}", hostName, contextPath);
// Init mappings key
String key = getKey(hostName, contextPath);
// If context path contains slashes get complex key and look for it in mappings
while (contextPath.indexOf(SLASH) != -1) {
key = getKey(hostName, contextPath);
log.trace("Check: {}", key);
String globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
final int slashIndex = contextPath.lastIndexOf(SLASH);
// Context path is substring from the beginning and till last slash index
contextPath = contextPath.substring(0, slashIndex);
}
// Get global scope key
key = getKey(hostName, contextPath);
log.trace("Check host and path: {}", key);
// Look up for global scope switching keys if still not found
String globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(EMPTY, contextPath);
log.trace("Check wildcard host with path: {}", key);
globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(hostName, EMPTY);
log.trace("Check host with no path: {}", key);
globalName = mapping.get(key);
if (globalName != null) {
return getGlobal(globalName);
}
key = getKey(EMPTY, EMPTY);
log.trace("Check default host, default path: {}", key);
return getGlobal(mapping.get(key));
} | [
"public",
"IGlobalScope",
"lookupGlobal",
"(",
"String",
"hostName",
",",
"String",
"contextPath",
")",
"{",
"log",
".",
"trace",
"(",
"\"{}\"",
",",
"this",
")",
";",
"log",
".",
"debug",
"(",
"\"Lookup global scope - host name: {} context path: {}\"",
",",
"host... | Does global scope lookup for host name and context path
@param hostName
Host name
@param contextPath
Context path
@return Global scope | [
"Does",
"global",
"scope",
"lookup",
"for",
"host",
"name",
"and",
"context",
"path"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Server.java#L131-L171 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java | TilesExtractor.getTilesNumber | private static int getTilesNumber(int tileWidth, int tileHeight, Collection<Media> levelRips)
{
int tiles = 0;
for (final Media levelRip : levelRips)
{
final ImageHeader info = ImageInfo.get(levelRip);
final int horizontalTiles = info.getWidth() / tileWidth;
final int verticalTiles = info.getHeight() / tileHeight;
tiles += horizontalTiles * verticalTiles;
}
return tiles;
} | java | private static int getTilesNumber(int tileWidth, int tileHeight, Collection<Media> levelRips)
{
int tiles = 0;
for (final Media levelRip : levelRips)
{
final ImageHeader info = ImageInfo.get(levelRip);
final int horizontalTiles = info.getWidth() / tileWidth;
final int verticalTiles = info.getHeight() / tileHeight;
tiles += horizontalTiles * verticalTiles;
}
return tiles;
} | [
"private",
"static",
"int",
"getTilesNumber",
"(",
"int",
"tileWidth",
",",
"int",
"tileHeight",
",",
"Collection",
"<",
"Media",
">",
"levelRips",
")",
"{",
"int",
"tiles",
"=",
"0",
";",
"for",
"(",
"final",
"Media",
"levelRip",
":",
"levelRips",
")",
... | Get the total number of tiles.
@param tileWidth The tile width.
@param tileHeight The tile height.
@param levelRips The levels rip used.
@return The total number of tiles. | [
"Get",
"the",
"total",
"number",
"of",
"tiles",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java#L132-L143 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.join | public static <T> String join(T[] array, CharSequence conjunction) {
return join(array, conjunction, null, null);
} | java | public static <T> String join(T[] array, CharSequence conjunction) {
return join(array, conjunction, null, null);
} | [
"public",
"static",
"<",
"T",
">",
"String",
"join",
"(",
"T",
"[",
"]",
"array",
",",
"CharSequence",
"conjunction",
")",
"{",
"return",
"join",
"(",
"array",
",",
"conjunction",
",",
"null",
",",
"null",
")",
";",
"}"
] | 以 conjunction 为分隔符将数组转换为字符串
@param <T> 被处理的集合
@param array 数组
@param conjunction 分隔符
@return 连接后的字符串 | [
"以",
"conjunction",
"为分隔符将数组转换为字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2293-L2295 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.rebootAsync | public Observable<Void> rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) {
return rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> rebootAsync(String poolId, String nodeId, ComputeNodeRebootOption nodeRebootOption, ComputeNodeRebootOptions computeNodeRebootOptions) {
return rebootWithServiceResponseAsync(poolId, nodeId, nodeRebootOption, computeNodeRebootOptions).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeRebootHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"rebootAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"ComputeNodeRebootOption",
"nodeRebootOption",
",",
"ComputeNodeRebootOptions",
"computeNodeRebootOptions",
")",
"{",
"return",
"rebootWithServiceResponseAsync",
... | Restarts the specified compute node.
You can restart a node only if it is in an idle or running state.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node that you want to restart.
@param nodeRebootOption When to reboot the compute node and what to do with currently running tasks. The default value is requeue. Possible values include: 'requeue', 'terminate', 'taskCompletion', 'retainedData'
@param computeNodeRebootOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Restarts",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"restart",
"a",
"node",
"only",
"if",
"it",
"is",
"in",
"an",
"idle",
"or",
"running",
"state",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1192-L1199 |
OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/solver/SolverWorldModelInterface.java | SolverWorldModelInterface.expireId | public boolean expireId(final String identifier, final long expirationTime) {
if (identifier == null) {
log.error("Unable to expire a null Identifier value.");
return false;
}
if (this.originString == null) {
log.error("Origin has not been set. Cannot expire Ids without a valid origin.");
return false;
}
ExpireIdentifierMessage message = new ExpireIdentifierMessage();
message.setOrigin(this.originString);
message.setId(identifier);
message.setExpirationTime(expirationTime);
this.session.write(message);
log.debug("Sent {}", message);
return true;
} | java | public boolean expireId(final String identifier, final long expirationTime) {
if (identifier == null) {
log.error("Unable to expire a null Identifier value.");
return false;
}
if (this.originString == null) {
log.error("Origin has not been set. Cannot expire Ids without a valid origin.");
return false;
}
ExpireIdentifierMessage message = new ExpireIdentifierMessage();
message.setOrigin(this.originString);
message.setId(identifier);
message.setExpirationTime(expirationTime);
this.session.write(message);
log.debug("Sent {}", message);
return true;
} | [
"public",
"boolean",
"expireId",
"(",
"final",
"String",
"identifier",
",",
"final",
"long",
"expirationTime",
")",
"{",
"if",
"(",
"identifier",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to expire a null Identifier value.\"",
")",
";",
"return... | Expires all Attributes for an Identifier in the world model.
@param identifier
the identifier to expire.
@param expirationTime
the expiration timestamp.
@return {@code true} if the message is sent successfully, else
{@code false}. | [
"Expires",
"all",
"Attributes",
"for",
"an",
"Identifier",
"in",
"the",
"world",
"model",
"."
] | train | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/solver/SolverWorldModelInterface.java#L1005-L1025 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatterBuilder.java | MoneyFormatterBuilder.appendLiteral | public MoneyFormatterBuilder appendLiteral(CharSequence literal) {
if (literal == null || literal.length() == 0) {
return this;
}
LiteralPrinterParser pp = new LiteralPrinterParser(literal.toString());
return appendInternal(pp, pp);
} | java | public MoneyFormatterBuilder appendLiteral(CharSequence literal) {
if (literal == null || literal.length() == 0) {
return this;
}
LiteralPrinterParser pp = new LiteralPrinterParser(literal.toString());
return appendInternal(pp, pp);
} | [
"public",
"MoneyFormatterBuilder",
"appendLiteral",
"(",
"CharSequence",
"literal",
")",
"{",
"if",
"(",
"literal",
"==",
"null",
"||",
"literal",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"LiteralPrinterParser",
"pp",
"=",
... | Appends a literal to the builder.
<p>
The localized currency symbol is the symbol as chosen by the locale
of the formatter.
@param literal the literal to append, null or empty ignored
@return this, for chaining, never null | [
"Appends",
"a",
"literal",
"to",
"the",
"builder",
".",
"<p",
">",
"The",
"localized",
"currency",
"symbol",
"is",
"the",
"symbol",
"as",
"chosen",
"by",
"the",
"locale",
"of",
"the",
"formatter",
"."
] | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L156-L162 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.showMessageCenter | public static void showMessageCenter(final Context context, final BooleanCallback callback, final Map<String, Object> customData) {
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveInternal.getInstance().showMessageCenterInternal(context, customData);
}
}, "show message center");
} | java | public static void showMessageCenter(final Context context, final BooleanCallback callback, final Map<String, Object> customData) {
dispatchConversationTask(new ConversationDispatchTask(callback, DispatchQueue.mainQueue()) {
@Override
protected boolean execute(Conversation conversation) {
return ApptentiveInternal.getInstance().showMessageCenterInternal(context, customData);
}
}, "show message center");
} | [
"public",
"static",
"void",
"showMessageCenter",
"(",
"final",
"Context",
"context",
",",
"final",
"BooleanCallback",
"callback",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"customData",
")",
"{",
"dispatchConversationTask",
"(",
"new",
"ConversationD... | Opens the Apptentive Message Center UI Activity, and allows custom data to be sent with the
next message the user sends. If the user sends multiple messages, this data will only be sent
with the first message sent after this method is invoked. Additional invocations of this method
with custom data will repeat this process. If Message Center is closed without a message being
sent, the custom data is cleared. This task is performed asynchronously. Message Center
configuration may not have been downloaded yet when this is called.
@param context The context from which to launch the Message Center. This should be an
Activity, except in rare cases where you don't have access to one, in which
case Apptentive Message Center will launch in a new task.
@param callback Called after we check to see if Message Center can be displayed, but before
it is displayed. Called with true if an Interaction will be displayed, else
false.
@param customData A Map of String keys to Object values. Objects may be Strings, Numbers, or
Booleans. If any message is sent by the Person, this data is sent with it,
and then cleared. If no message is sent, this data is discarded. | [
"Opens",
"the",
"Apptentive",
"Message",
"Center",
"UI",
"Activity",
"and",
"allows",
"custom",
"data",
"to",
"be",
"sent",
"with",
"the",
"next",
"message",
"the",
"user",
"sends",
".",
"If",
"the",
"user",
"sends",
"multiple",
"messages",
"this",
"data",
... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L953-L960 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.lengthPerSlice | public static long lengthPerSlice(INDArray arr, int... dimension) {
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | java | public static long lengthPerSlice(INDArray arr, int... dimension) {
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | [
"public",
"static",
"long",
"lengthPerSlice",
"(",
"INDArray",
"arr",
",",
"int",
"...",
"dimension",
")",
"{",
"long",
"[",
"]",
"remove",
"=",
"ArrayUtil",
".",
"removeIndex",
"(",
"arr",
".",
"shape",
"(",
")",
",",
"dimension",
")",
";",
"return",
... | The number of elements in a slice
along a set of dimensions
@param arr the array
to calculate the length per slice for
@param dimension the dimensions to do the calculations along
@return the number of elements in a slice along
arbitrary dimensions | [
"The",
"number",
"of",
"elements",
"in",
"a",
"slice",
"along",
"a",
"set",
"of",
"dimensions"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L49-L52 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java | ParticleIO.loadConfiguredSystem | public static ParticleSystem loadConfiguredSystem(InputStream ref)
throws IOException {
return loadConfiguredSystem(ref, null, null, null);
} | java | public static ParticleSystem loadConfiguredSystem(InputStream ref)
throws IOException {
return loadConfiguredSystem(ref, null, null, null);
} | [
"public",
"static",
"ParticleSystem",
"loadConfiguredSystem",
"(",
"InputStream",
"ref",
")",
"throws",
"IOException",
"{",
"return",
"loadConfiguredSystem",
"(",
"ref",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Load a set of configured emitters into a single system
@param ref
The stream to read the XML from
@return A configured particle system
@throws IOException
Indicates a failure to find, read or parse the XML file | [
"Load",
"a",
"set",
"of",
"configured",
"emitters",
"into",
"a",
"single",
"system"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L109-L112 |
kiswanij/jk-util | src/main/java/com/jk/util/JKObjectUtil.java | JKObjectUtil.getPropertyValue | public static <T> T getPropertyValue(final Object instance, final String fieldName) {
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
} catch (final Exception e) {
throw new RuntimeException(e);
}
} | java | public static <T> T getPropertyValue(final Object instance, final String fieldName) {
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
} catch (final Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getPropertyValue",
"(",
"final",
"Object",
"instance",
",",
"final",
"String",
"fieldName",
")",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"PropertyUtils",
".",
"getProperty",
"(",
"instance",
",",
"fieldName",
")",... | Gets the property value.
@param <T> the generic type
@param instance the instance
@param fieldName the field name
@return the property value | [
"Gets",
"the",
"property",
"value",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L119-L125 |
osglworks/java-di | src/main/java/org/osgl/inject/util/AnnotationUtil.java | AnnotationUtil.hashMember | static int hashMember(String name, Object value) {
int part1 = name.hashCode() * 127;
if (value.getClass().isArray()) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
return part1 ^ hashCode((Annotation) value);
}
return part1 ^ value.hashCode();
} | java | static int hashMember(String name, Object value) {
int part1 = name.hashCode() * 127;
if (value.getClass().isArray()) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
return part1 ^ hashCode((Annotation) value);
}
return part1 ^ value.hashCode();
} | [
"static",
"int",
"hashMember",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"int",
"part1",
"=",
"name",
".",
"hashCode",
"(",
")",
"*",
"127",
";",
"if",
"(",
"value",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
"{",
"r... | Helper method for generating a hash code for a member of an annotation.
@param name
the name of the member
@param value
the value of the member
@return
a hash code for this member | [
"Helper",
"method",
"for",
"generating",
"a",
"hash",
"code",
"for",
"a",
"member",
"of",
"an",
"annotation",
"."
] | train | https://github.com/osglworks/java-di/blob/d89871c62ff508733bfa645425596f6c917fd7ee/src/main/java/org/osgl/inject/util/AnnotationUtil.java#L144-L153 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java | CareWebShellEx.pluginById | private PluginDefinition pluginById(String id) {
PluginDefinition def = pluginRegistry.get(id);
if (def == null) {
throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id);
}
return def;
} | java | private PluginDefinition pluginById(String id) {
PluginDefinition def = pluginRegistry.get(id);
if (def == null) {
throw new PluginException(EXC_UNKNOWN_PLUGIN, null, null, id);
}
return def;
} | [
"private",
"PluginDefinition",
"pluginById",
"(",
"String",
"id",
")",
"{",
"PluginDefinition",
"def",
"=",
"pluginRegistry",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"def",
"==",
"null",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"EXC_UNKNOWN_PLUG... | Lookup a plugin definition by its id. Raises a runtime exception if the plugin is not found.
@param id Plugin id.
@return The plugin definition. | [
"Lookup",
"a",
"plugin",
"definition",
"by",
"its",
"id",
".",
"Raises",
"a",
"runtime",
"exception",
"if",
"the",
"plugin",
"is",
"not",
"found",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L172-L180 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java | SarlBatchCompiler.createClassLoader | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | java | @SuppressWarnings("static-method")
protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
try {
final URL url = from.toURI().toURL();
assert url != null;
return url;
} catch (Exception e) {
throw new RuntimeException(e);
}
}), URL.class), parentClassLoader);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ClassLoader",
"createClassLoader",
"(",
"Iterable",
"<",
"File",
">",
"jarsAndFolders",
",",
"ClassLoader",
"parentClassLoader",
")",
"{",
"return",
"new",
"URLClassLoader",
"(",
"Iterables",
".",
... | Create the project class loader.
@param jarsAndFolders the project class path.
@param parentClassLoader the parent class loader.
@return the class loader for the project. | [
"Create",
"the",
"project",
"class",
"loader",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L2231-L2242 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/cql3/MultiColumnRelation.java | MultiColumnRelation.createInRelation | public static MultiColumnRelation createInRelation(List<ColumnIdentifier.Raw> entities, List<? extends Term.MultiColumnRaw> inValues)
{
return new MultiColumnRelation(entities, Operator.IN, null, inValues, null);
} | java | public static MultiColumnRelation createInRelation(List<ColumnIdentifier.Raw> entities, List<? extends Term.MultiColumnRaw> inValues)
{
return new MultiColumnRelation(entities, Operator.IN, null, inValues, null);
} | [
"public",
"static",
"MultiColumnRelation",
"createInRelation",
"(",
"List",
"<",
"ColumnIdentifier",
".",
"Raw",
">",
"entities",
",",
"List",
"<",
"?",
"extends",
"Term",
".",
"MultiColumnRaw",
">",
"inValues",
")",
"{",
"return",
"new",
"MultiColumnRelation",
... | Creates a multi-column IN relation with a list of IN values or markers.
For example: "SELECT ... WHERE (a, b) IN ((0, 1), (2, 3))"
@param entities the columns on the LHS of the relation
@param inValues a list of Tuples.Literal instances or a Tuples.Raw markers | [
"Creates",
"a",
"multi",
"-",
"column",
"IN",
"relation",
"with",
"a",
"list",
"of",
"IN",
"values",
"or",
"markers",
".",
"For",
"example",
":",
"SELECT",
"...",
"WHERE",
"(",
"a",
"b",
")",
"IN",
"((",
"0",
"1",
")",
"(",
"2",
"3",
"))"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/MultiColumnRelation.java#L71-L74 |
MaxLeap/SDK-CloudCode-Java | cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java | WebUtils.doRequestWithBody | private static String doRequestWithBody(String url, String method, Map<String, String> header, String ctype, byte[] content, int connectTimeout, int readTimeout) throws IOException {
HttpURLConnection conn = null;
OutputStream out = null;
String rsp = null;
try {
try {
conn = getConnection(new URL(url), method, header, ctype);
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
} catch (IOException e) {
throw e;
}
try {
out = conn.getOutputStream();
out.write(content);
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (out != null) {
out.close();
}
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | java | private static String doRequestWithBody(String url, String method, Map<String, String> header, String ctype, byte[] content, int connectTimeout, int readTimeout) throws IOException {
HttpURLConnection conn = null;
OutputStream out = null;
String rsp = null;
try {
try {
conn = getConnection(new URL(url), method, header, ctype);
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
} catch (IOException e) {
throw e;
}
try {
out = conn.getOutputStream();
out.write(content);
rsp = getResponseAsString(conn);
} catch (IOException e) {
throw e;
}
} finally {
if (out != null) {
out.close();
}
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | [
"private",
"static",
"String",
"doRequestWithBody",
"(",
"String",
"url",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"String",
">",
"header",
",",
"String",
"ctype",
",",
"byte",
"[",
"]",
"content",
",",
"int",
"connectTimeout",
",",
"int",
... | 执行HTTP POST请求。
@param url 请求地址
@param ctype 请求类型
@param content 请求字节数组
@return 响应字符串
@throws IOException | [
"执行HTTP",
"POST请求。"
] | train | https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L99-L128 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.streamOut | protected /*HttpBuilder*/void streamOut(InputStream in) {
// StreamResponse resp = new StreamResponse(context, in);
// context.setControllerResponse(resp);
// return new HttpBuilder(resp);
//TODO finish and TEST the god damn method
//------------------
Result r = ResultBuilder.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.renderable(in);
// context.setControllerResponse(r);
result = r;
} | java | protected /*HttpBuilder*/void streamOut(InputStream in) {
// StreamResponse resp = new StreamResponse(context, in);
// context.setControllerResponse(resp);
// return new HttpBuilder(resp);
//TODO finish and TEST the god damn method
//------------------
Result r = ResultBuilder.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.renderable(in);
// context.setControllerResponse(r);
result = r;
} | [
"protected",
"/*HttpBuilder*/",
"void",
"streamOut",
"(",
"InputStream",
"in",
")",
"{",
"// StreamResponse resp = new StreamResponse(context, in);",
"// context.setControllerResponse(resp);",
"// return new HttpBuilder(resp);",
"//TODO finish and TEST the god damn metho... | Streams content of the <code>reader</code> to the HTTP client.
@param in input stream to read bytes from.
@return {@link HttpSupport.HttpBuilder}, to accept additional information. | [
"Streams",
"content",
"of",
"the",
"<code",
">",
"reader<",
"/",
"code",
">",
"to",
"the",
"HTTP",
"client",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L1457-L1468 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.