repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
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) {
"""
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
"""
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",
".",
"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",
")",
";",
"}"
]
| 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 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobInfo.java | JobInfo.of | public static JobInfo of(JobId jobId, JobConfiguration configuration) {
"""
Returns a builder for a {@code JobInfo} object given the job identity and configuration. Use
{@link CopyJobConfiguration} for a job that copies an existing table. Use {@link
ExtractJobConfiguration} for a job that exports a table to Google Cloud Storage. Use {@link
LoadJobConfiguration} for a job that loads data from Google Cloud Storage into a table. Use
{@link QueryJobConfiguration} for a job that runs a query.
"""
return newBuilder(configuration).setJobId(jobId).build();
} | java | public static JobInfo of(JobId jobId, JobConfiguration configuration) {
return newBuilder(configuration).setJobId(jobId).build();
} | [
"public",
"static",
"JobInfo",
"of",
"(",
"JobId",
"jobId",
",",
"JobConfiguration",
"configuration",
")",
"{",
"return",
"newBuilder",
"(",
"configuration",
")",
".",
"setJobId",
"(",
"jobId",
")",
".",
"build",
"(",
")",
";",
"}"
]
| Returns a builder for a {@code JobInfo} object given the job identity and configuration. Use
{@link CopyJobConfiguration} for a job that copies an existing table. Use {@link
ExtractJobConfiguration} for a job that exports a table to Google Cloud Storage. Use {@link
LoadJobConfiguration} for a job that loads data from Google Cloud Storage into a table. Use
{@link QueryJobConfiguration} for a job that runs a query. | [
"Returns",
"a",
"builder",
"for",
"a",
"{"
]
| train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobInfo.java#L365-L367 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java | AbstractLoader.loadConfig | public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket,
final String password) {
"""
Initiate the config loading process.
@param seedNode the seed node.
@param bucket the name of the bucket.
@param password the password of the bucket.
@return a valid {@link BucketConfig}.
"""
LOGGER.debug("Loading Config for bucket {}", bucket);
return loadConfig(seedNode, bucket, bucket, password);
} | java | public Observable<Tuple2<LoaderType, BucketConfig>> loadConfig(final NetworkAddress seedNode, final String bucket,
final String password) {
LOGGER.debug("Loading Config for bucket {}", bucket);
return loadConfig(seedNode, bucket, bucket, password);
} | [
"public",
"Observable",
"<",
"Tuple2",
"<",
"LoaderType",
",",
"BucketConfig",
">",
">",
"loadConfig",
"(",
"final",
"NetworkAddress",
"seedNode",
",",
"final",
"String",
"bucket",
",",
"final",
"String",
"password",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Loading Config for bucket {}\"",
",",
"bucket",
")",
";",
"return",
"loadConfig",
"(",
"seedNode",
",",
"bucket",
",",
"bucket",
",",
"password",
")",
";",
"}"
]
| Initiate the config loading process.
@param seedNode the seed node.
@param bucket the name of the bucket.
@param password the password of the bucket.
@return a valid {@link BucketConfig}. | [
"Initiate",
"the",
"config",
"loading",
"process",
"."
]
| train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/loader/AbstractLoader.java#L121-L125 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GroupApi.java | GroupApi.getVariable | public Variable getVariable(Object groupIdOrPath, String key) throws GitLabApiException {
"""
Get the details of a group variable.
<pre><code>GitLab Endpoint: GET /groups/:id/variables/:key</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param key the key of an existing variable, required
@return the Variable instance for the specified group variable
@throws GitLabApiException if any exception occurs
"""
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "variables", key);
return (response.readEntity(Variable.class));
} | java | public Variable getVariable(Object groupIdOrPath, String key) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "variables", key);
return (response.readEntity(Variable.class));
} | [
"public",
"Variable",
"getVariable",
"(",
"Object",
"groupIdOrPath",
",",
"String",
"key",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"groups\"",
",",
"getGroupIdOrPath",
"(",
"groupIdOrPath",
")",
",",
"\"variables\"",
",",
"key",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"Variable",
".",
"class",
")",
")",
";",
"}"
]
| Get the details of a group variable.
<pre><code>GitLab Endpoint: GET /groups/:id/variables/:key</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param key the key of an existing variable, required
@return the Variable instance for the specified group variable
@throws GitLabApiException if any exception occurs | [
"Get",
"the",
"details",
"of",
"a",
"group",
"variable",
"."
]
| train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L1059-L1062 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.formatSpecific | private String formatSpecific(TimeZone tz, NameType stdType, NameType dstType, long date, Output<TimeType> timeType) {
"""
Private method returning the time zone's specific format string.
@param tz the time zone
@param stdType the name type used for standard time
@param dstType the name type used for daylight time
@param date the date
@param timeType when null, actual time type is set
@return the time zone's specific format name string
"""
assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD);
assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT);
boolean isDaylight = tz.inDaylightTime(new Date(date));
String name = isDaylight?
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), dstType, date) :
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), stdType, date);
if (name != null && timeType != null) {
timeType.value = isDaylight ? TimeType.DAYLIGHT : TimeType.STANDARD;
}
return name;
} | java | private String formatSpecific(TimeZone tz, NameType stdType, NameType dstType, long date, Output<TimeType> timeType) {
assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD);
assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT);
boolean isDaylight = tz.inDaylightTime(new Date(date));
String name = isDaylight?
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), dstType, date) :
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), stdType, date);
if (name != null && timeType != null) {
timeType.value = isDaylight ? TimeType.DAYLIGHT : TimeType.STANDARD;
}
return name;
} | [
"private",
"String",
"formatSpecific",
"(",
"TimeZone",
"tz",
",",
"NameType",
"stdType",
",",
"NameType",
"dstType",
",",
"long",
"date",
",",
"Output",
"<",
"TimeType",
">",
"timeType",
")",
"{",
"assert",
"(",
"stdType",
"==",
"NameType",
".",
"LONG_STANDARD",
"||",
"stdType",
"==",
"NameType",
".",
"SHORT_STANDARD",
")",
";",
"assert",
"(",
"dstType",
"==",
"NameType",
".",
"LONG_DAYLIGHT",
"||",
"dstType",
"==",
"NameType",
".",
"SHORT_DAYLIGHT",
")",
";",
"boolean",
"isDaylight",
"=",
"tz",
".",
"inDaylightTime",
"(",
"new",
"Date",
"(",
"date",
")",
")",
";",
"String",
"name",
"=",
"isDaylight",
"?",
"getTimeZoneNames",
"(",
")",
".",
"getDisplayName",
"(",
"ZoneMeta",
".",
"getCanonicalCLDRID",
"(",
"tz",
")",
",",
"dstType",
",",
"date",
")",
":",
"getTimeZoneNames",
"(",
")",
".",
"getDisplayName",
"(",
"ZoneMeta",
".",
"getCanonicalCLDRID",
"(",
"tz",
")",
",",
"stdType",
",",
"date",
")",
";",
"if",
"(",
"name",
"!=",
"null",
"&&",
"timeType",
"!=",
"null",
")",
"{",
"timeType",
".",
"value",
"=",
"isDaylight",
"?",
"TimeType",
".",
"DAYLIGHT",
":",
"TimeType",
".",
"STANDARD",
";",
"}",
"return",
"name",
";",
"}"
]
| Private method returning the time zone's specific format string.
@param tz the time zone
@param stdType the name type used for standard time
@param dstType the name type used for daylight time
@param date the date
@param timeType when null, actual time type is set
@return the time zone's specific format name string | [
"Private",
"method",
"returning",
"the",
"time",
"zone",
"s",
"specific",
"format",
"string",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1710-L1723 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java | AbstractHeaderFile.openChannel | protected void openChannel(boolean readHeader) throws FileLockException, IOException {
"""
opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header.
@param should
the header be read
@throws IOException
"""
logger.debug("[OFile.openChannel] Opening channel for file: " + osFile);
accessFile = new RandomAccessFile(osFile, (mode == AccessMode.READ_ONLY) ? "r" : "rw");
accessFile.seek(0);
channel = accessFile.getChannel();
lock();
if (mode == AccessMode.READ_ONLY) {
headerBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, HEADER_SIZE);
} else {
headerBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, HEADER_SIZE);
}
if (readHeader) {
readHeader();
}
} | java | protected void openChannel(boolean readHeader) throws FileLockException, IOException {
logger.debug("[OFile.openChannel] Opening channel for file: " + osFile);
accessFile = new RandomAccessFile(osFile, (mode == AccessMode.READ_ONLY) ? "r" : "rw");
accessFile.seek(0);
channel = accessFile.getChannel();
lock();
if (mode == AccessMode.READ_ONLY) {
headerBuffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, HEADER_SIZE);
} else {
headerBuffer = channel.map(FileChannel.MapMode.READ_WRITE, 0, HEADER_SIZE);
}
if (readHeader) {
readHeader();
}
} | [
"protected",
"void",
"openChannel",
"(",
"boolean",
"readHeader",
")",
"throws",
"FileLockException",
",",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"[OFile.openChannel] Opening channel for file: \"",
"+",
"osFile",
")",
";",
"accessFile",
"=",
"new",
"RandomAccessFile",
"(",
"osFile",
",",
"(",
"mode",
"==",
"AccessMode",
".",
"READ_ONLY",
")",
"?",
"\"r\"",
":",
"\"rw\"",
")",
";",
"accessFile",
".",
"seek",
"(",
"0",
")",
";",
"channel",
"=",
"accessFile",
".",
"getChannel",
"(",
")",
";",
"lock",
"(",
")",
";",
"if",
"(",
"mode",
"==",
"AccessMode",
".",
"READ_ONLY",
")",
"{",
"headerBuffer",
"=",
"channel",
".",
"map",
"(",
"FileChannel",
".",
"MapMode",
".",
"READ_ONLY",
",",
"0",
",",
"HEADER_SIZE",
")",
";",
"}",
"else",
"{",
"headerBuffer",
"=",
"channel",
".",
"map",
"(",
"FileChannel",
".",
"MapMode",
".",
"READ_WRITE",
",",
"0",
",",
"HEADER_SIZE",
")",
";",
"}",
"if",
"(",
"readHeader",
")",
"{",
"readHeader",
"(",
")",
";",
"}",
"}"
]
| opens the {@link RandomAccessFile} and the corresponding {@link FileChannel}. Optionally reads the header.
@param should
the header be read
@throws IOException | [
"opens",
"the",
"{",
"@link",
"RandomAccessFile",
"}",
"and",
"the",
"corresponding",
"{",
"@link",
"FileChannel",
"}",
".",
"Optionally",
"reads",
"the",
"header",
"."
]
| train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/AbstractHeaderFile.java#L211-L225 |
geomajas/geomajas-project-server | api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java | AssociationValue.setManyToOneAttribute | public void setManyToOneAttribute(String name, AssociationValue value) {
"""
Sets the specified many-to-one attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0
"""
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | java | public void setManyToOneAttribute(String name, AssociationValue value) {
ensureAttributes();
Attribute attribute = new ManyToOneAttribute(value);
attribute.setEditable(isEditable(name));
getAllAttributes().put(name, attribute);
} | [
"public",
"void",
"setManyToOneAttribute",
"(",
"String",
"name",
",",
"AssociationValue",
"value",
")",
"{",
"ensureAttributes",
"(",
")",
";",
"Attribute",
"attribute",
"=",
"new",
"ManyToOneAttribute",
"(",
"value",
")",
";",
"attribute",
".",
"setEditable",
"(",
"isEditable",
"(",
"name",
")",
")",
";",
"getAllAttributes",
"(",
")",
".",
"put",
"(",
"name",
",",
"attribute",
")",
";",
"}"
]
| Sets the specified many-to-one attribute to the specified value.
@param name name of the attribute
@param value value of the attribute
@since 1.9.0 | [
"Sets",
"the",
"specified",
"many",
"-",
"to",
"-",
"one",
"attribute",
"to",
"the",
"specified",
"value",
"."
]
| train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L380-L386 |
Erudika/para | para-server/src/main/java/com/erudika/para/utils/HttpUtils.java | HttpUtils.setStateParam | public static void setStateParam(String name, String value, HttpServletRequest req, HttpServletResponse res) {
"""
Sets a cookie.
@param name the name
@param value the value
@param req HTTP request
@param res HTTP response
"""
setStateParam(name, value, req, res, false);
} | java | public static void setStateParam(String name, String value, HttpServletRequest req, HttpServletResponse res) {
setStateParam(name, value, req, res, false);
} | [
"public",
"static",
"void",
"setStateParam",
"(",
"String",
"name",
",",
"String",
"value",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"{",
"setStateParam",
"(",
"name",
",",
"value",
",",
"req",
",",
"res",
",",
"false",
")",
";",
"}"
]
| Sets a cookie.
@param name the name
@param value the value
@param req HTTP request
@param res HTTP response | [
"Sets",
"a",
"cookie",
"."
]
| train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/utils/HttpUtils.java#L57-L59 |
amplexus/java-flac-encoder | src/main/java/net/sourceforge/javaflacencoder/FLACEncoder.java | FLACEncoder.addSamples | public void addSamples(int[] samples, int count) {
"""
Add samples to the encoder, so they may then be encoded. This method uses
breaks the samples into blocks, which will then be made available to
encode.
@param samples Array holding the samples to encode. For all multi-channel
audio, the samples must be interleaved in this array. For example, with
stereo: sample 0 will belong to the first channel, 1 the second, 2 the
first, 3 the second, etc. Samples are interpreted according to the
current configuration(for things such as channel and bits-per-sample).
@param count Number of interchannel samples to add. For example, with
stero: if this is 4000, then "samples" must contain 4000 left samples and
4000 right samples, interleaved in the array.
"""
assert(count*streamConfig.getChannelCount() <= samples.length);
if(samples.length < count*streamConfig.getChannelCount())
throw new IllegalArgumentException("count given exceeds samples array bounds");
sampleLock.lock();
try {
//get number of channels
int channels = streamConfig.getChannelCount();
int maxBlock = streamConfig.getMaxBlockSize();
if(unfilledRequest == null)
unfilledRequest = prepareRequest(maxBlock,channels);
int remaining = count;
int offset = 0;
while(remaining > 0) {
int newRemaining = unfilledRequest.addInterleavedSamples(samples, offset, remaining, maxBlock);
offset += (remaining-newRemaining)*channels;
remaining = newRemaining;
if(unfilledRequest.isFull(maxBlock)) {
this.preparedRequests.add(unfilledRequest);
unfilledRequest = null;
}
if(remaining > 0) {
unfilledRequest = prepareRequest(maxBlock, channels);
}
}
}finally {
sampleLock.unlock();
}
} | java | public void addSamples(int[] samples, int count) {
assert(count*streamConfig.getChannelCount() <= samples.length);
if(samples.length < count*streamConfig.getChannelCount())
throw new IllegalArgumentException("count given exceeds samples array bounds");
sampleLock.lock();
try {
//get number of channels
int channels = streamConfig.getChannelCount();
int maxBlock = streamConfig.getMaxBlockSize();
if(unfilledRequest == null)
unfilledRequest = prepareRequest(maxBlock,channels);
int remaining = count;
int offset = 0;
while(remaining > 0) {
int newRemaining = unfilledRequest.addInterleavedSamples(samples, offset, remaining, maxBlock);
offset += (remaining-newRemaining)*channels;
remaining = newRemaining;
if(unfilledRequest.isFull(maxBlock)) {
this.preparedRequests.add(unfilledRequest);
unfilledRequest = null;
}
if(remaining > 0) {
unfilledRequest = prepareRequest(maxBlock, channels);
}
}
}finally {
sampleLock.unlock();
}
} | [
"public",
"void",
"addSamples",
"(",
"int",
"[",
"]",
"samples",
",",
"int",
"count",
")",
"{",
"assert",
"(",
"count",
"*",
"streamConfig",
".",
"getChannelCount",
"(",
")",
"<=",
"samples",
".",
"length",
")",
";",
"if",
"(",
"samples",
".",
"length",
"<",
"count",
"*",
"streamConfig",
".",
"getChannelCount",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"count given exceeds samples array bounds\"",
")",
";",
"sampleLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"//get number of channels",
"int",
"channels",
"=",
"streamConfig",
".",
"getChannelCount",
"(",
")",
";",
"int",
"maxBlock",
"=",
"streamConfig",
".",
"getMaxBlockSize",
"(",
")",
";",
"if",
"(",
"unfilledRequest",
"==",
"null",
")",
"unfilledRequest",
"=",
"prepareRequest",
"(",
"maxBlock",
",",
"channels",
")",
";",
"int",
"remaining",
"=",
"count",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"(",
"remaining",
">",
"0",
")",
"{",
"int",
"newRemaining",
"=",
"unfilledRequest",
".",
"addInterleavedSamples",
"(",
"samples",
",",
"offset",
",",
"remaining",
",",
"maxBlock",
")",
";",
"offset",
"+=",
"(",
"remaining",
"-",
"newRemaining",
")",
"*",
"channels",
";",
"remaining",
"=",
"newRemaining",
";",
"if",
"(",
"unfilledRequest",
".",
"isFull",
"(",
"maxBlock",
")",
")",
"{",
"this",
".",
"preparedRequests",
".",
"add",
"(",
"unfilledRequest",
")",
";",
"unfilledRequest",
"=",
"null",
";",
"}",
"if",
"(",
"remaining",
">",
"0",
")",
"{",
"unfilledRequest",
"=",
"prepareRequest",
"(",
"maxBlock",
",",
"channels",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"sampleLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| Add samples to the encoder, so they may then be encoded. This method uses
breaks the samples into blocks, which will then be made available to
encode.
@param samples Array holding the samples to encode. For all multi-channel
audio, the samples must be interleaved in this array. For example, with
stereo: sample 0 will belong to the first channel, 1 the second, 2 the
first, 3 the second, etc. Samples are interpreted according to the
current configuration(for things such as channel and bits-per-sample).
@param count Number of interchannel samples to add. For example, with
stero: if this is 4000, then "samples" must contain 4000 left samples and
4000 right samples, interleaved in the array. | [
"Add",
"samples",
"to",
"the",
"encoder",
"so",
"they",
"may",
"then",
"be",
"encoded",
".",
"This",
"method",
"uses",
"breaks",
"the",
"samples",
"into",
"blocks",
"which",
"will",
"then",
"be",
"made",
"available",
"to",
"encode",
"."
]
| train | https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/FLACEncoder.java#L386-L414 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GatewayResponse.java | GatewayResponse.withResponseParameters | public GatewayResponse withResponseParameters(java.util.Map<String, String> responseParameters) {
"""
<p>
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string map of
key-value pairs.
</p>
@param responseParameters
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string
map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together.
"""
setResponseParameters(responseParameters);
return this;
} | java | public GatewayResponse withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | [
"public",
"GatewayResponse",
"withResponseParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseParameters",
")",
"{",
"setResponseParameters",
"(",
"responseParameters",
")",
";",
"return",
"this",
";",
"}"
]
| <p>
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string map of
key-value pairs.
</p>
@param responseParameters
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string
map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Response",
"parameters",
"(",
"paths",
"query",
"strings",
"and",
"headers",
")",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GatewayResponse.java#L485-L488 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.foldNonZeroInColumn | public double foldNonZeroInColumn(int j, VectorAccumulator accumulator) {
"""
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.
"""
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",
".",
"accumulate",
"(",
")",
";",
"}"
]
| 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 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/builder/LazyBeanMappingFactory.java | LazyBeanMappingFactory.buildColumnMappingList | @Override
protected <T> void buildColumnMappingList(final BeanMapping<T> beanMapping, final Class<T> beanType, final Class<?>[] groups) {
"""
アノテーション{@link CsvColumn}を元に、カラムのマッピング情報を組み立てる。
<p>カラム番号の検証や、部分的なカラムのカラムの組み立てはスキップ。</p>
@param beanMapping Beanのマッピング情報
@param beanType Beanのクラスタイプ
@param groups グループ情報
"""
final List<ColumnMapping> columnMappingList = new ArrayList<>();
for(Field field : beanType.getDeclaredFields()) {
final CsvColumn columnAnno = field.getAnnotation(CsvColumn.class);
if(columnAnno != null) {
columnMappingList.add(createColumnMapping(field, columnAnno, groups));
}
}
beanMapping.addAllColumns(columnMappingList);
} | java | @Override
protected <T> void buildColumnMappingList(final BeanMapping<T> beanMapping, final Class<T> beanType, final Class<?>[] groups) {
final List<ColumnMapping> columnMappingList = new ArrayList<>();
for(Field field : beanType.getDeclaredFields()) {
final CsvColumn columnAnno = field.getAnnotation(CsvColumn.class);
if(columnAnno != null) {
columnMappingList.add(createColumnMapping(field, columnAnno, groups));
}
}
beanMapping.addAllColumns(columnMappingList);
} | [
"@",
"Override",
"protected",
"<",
"T",
">",
"void",
"buildColumnMappingList",
"(",
"final",
"BeanMapping",
"<",
"T",
">",
"beanMapping",
",",
"final",
"Class",
"<",
"T",
">",
"beanType",
",",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"groups",
")",
"{",
"final",
"List",
"<",
"ColumnMapping",
">",
"columnMappingList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":",
"beanType",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"final",
"CsvColumn",
"columnAnno",
"=",
"field",
".",
"getAnnotation",
"(",
"CsvColumn",
".",
"class",
")",
";",
"if",
"(",
"columnAnno",
"!=",
"null",
")",
"{",
"columnMappingList",
".",
"add",
"(",
"createColumnMapping",
"(",
"field",
",",
"columnAnno",
",",
"groups",
")",
")",
";",
"}",
"}",
"beanMapping",
".",
"addAllColumns",
"(",
"columnMappingList",
")",
";",
"}"
]
| アノテーション{@link CsvColumn}を元に、カラムのマッピング情報を組み立てる。
<p>カラム番号の検証や、部分的なカラムのカラムの組み立てはスキップ。</p>
@param beanMapping Beanのマッピング情報
@param beanType Beanのクラスタイプ
@param groups グループ情報 | [
"アノテーション",
"{"
]
| train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/LazyBeanMappingFactory.java#L82-L97 |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java | GatewayConfigParser.bufferToTraceLog | private static InputStream bufferToTraceLog(InputStream input, String message, Logger log) {
"""
Buffer a stream, flushing it to <code>log</code> and returning it as input
@param input
@param message
@param log
@return
"""
InputStream output;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int read;
byte[] data = new byte[16384];
while ((read = input.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, read);
}
buffer.flush();
log.trace(message + "\n\n\n" + new String(buffer.toByteArray(), CHARSET_OUTPUT) + "\n\n\n");
output = new ByteArrayInputStream(buffer.toByteArray());
} catch (Exception e) {
throw new RuntimeException("could not buffer stream", e);
}
return output;
} | java | private static InputStream bufferToTraceLog(InputStream input, String message, Logger log) {
InputStream output;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int read;
byte[] data = new byte[16384];
while ((read = input.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, read);
}
buffer.flush();
log.trace(message + "\n\n\n" + new String(buffer.toByteArray(), CHARSET_OUTPUT) + "\n\n\n");
output = new ByteArrayInputStream(buffer.toByteArray());
} catch (Exception e) {
throw new RuntimeException("could not buffer stream", e);
}
return output;
} | [
"private",
"static",
"InputStream",
"bufferToTraceLog",
"(",
"InputStream",
"input",
",",
"String",
"message",
",",
"Logger",
"log",
")",
"{",
"InputStream",
"output",
";",
"try",
"{",
"ByteArrayOutputStream",
"buffer",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"int",
"read",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"16384",
"]",
";",
"while",
"(",
"(",
"read",
"=",
"input",
".",
"read",
"(",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
")",
"!=",
"-",
"1",
")",
"{",
"buffer",
".",
"write",
"(",
"data",
",",
"0",
",",
"read",
")",
";",
"}",
"buffer",
".",
"flush",
"(",
")",
";",
"log",
".",
"trace",
"(",
"message",
"+",
"\"\\n\\n\\n\"",
"+",
"new",
"String",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
",",
"CHARSET_OUTPUT",
")",
"+",
"\"\\n\\n\\n\"",
")",
";",
"output",
"=",
"new",
"ByteArrayInputStream",
"(",
"buffer",
".",
"toByteArray",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"could not buffer stream\"",
",",
"e",
")",
";",
"}",
"return",
"output",
";",
"}"
]
| Buffer a stream, flushing it to <code>log</code> and returning it as input
@param input
@param message
@param log
@return | [
"Buffer",
"a",
"stream",
"flushing",
"it",
"to",
"<code",
">",
"log<",
"/",
"code",
">",
"and",
"returning",
"it",
"as",
"input"
]
| train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java#L436-L452 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabAreaPainter.java | TabbedPaneTabAreaPainter.paintHorizontalLine | private void paintHorizontalLine(Graphics2D g, JComponent c, int x, int y, int width, int height) {
"""
DOCUMENT ME!
@param g DOCUMENT ME!
@param c DOCUMENT ME!
@param x DOCUMENT ME!
@param y DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME!
"""
paintLine(g, width, height);
} | java | private void paintHorizontalLine(Graphics2D g, JComponent c, int x, int y, int width, int height) {
paintLine(g, width, height);
} | [
"private",
"void",
"paintHorizontalLine",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"paintLine",
"(",
"g",
",",
"width",
",",
"height",
")",
";",
"}"
]
| DOCUMENT ME!
@param g DOCUMENT ME!
@param c DOCUMENT ME!
@param x DOCUMENT ME!
@param y DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME! | [
"DOCUMENT",
"ME!"
]
| train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabAreaPainter.java#L118-L120 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/error/ErrorTextProvider.java | ErrorTextProvider.addItem | @Nonnull
public ErrorTextProvider addItem (@Nonnull final EField eField, @Nonnull @Nonempty final String sText) {
"""
Add an error item to be disabled.
@param eField
The field to be used. May not be <code>null</code>.
@param sText
The text that should contain the placeholder ({@value #PLACEHOLDER})
that will be replaced
@return this for chaining
"""
return addItem (new FormattableItem (eField, sText));
} | java | @Nonnull
public ErrorTextProvider addItem (@Nonnull final EField eField, @Nonnull @Nonempty final String sText)
{
return addItem (new FormattableItem (eField, sText));
} | [
"@",
"Nonnull",
"public",
"ErrorTextProvider",
"addItem",
"(",
"@",
"Nonnull",
"final",
"EField",
"eField",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sText",
")",
"{",
"return",
"addItem",
"(",
"new",
"FormattableItem",
"(",
"eField",
",",
"sText",
")",
")",
";",
"}"
]
| Add an error item to be disabled.
@param eField
The field to be used. May not be <code>null</code>.
@param sText
The text that should contain the placeholder ({@value #PLACEHOLDER})
that will be replaced
@return this for chaining | [
"Add",
"an",
"error",
"item",
"to",
"be",
"disabled",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/error/ErrorTextProvider.java#L205-L209 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/locking/AbstractLockingInterceptor.java | AbstractLockingInterceptor.nonTxLockAndInvokeNext | protected final Object nonTxLockAndInvokeNext(InvocationContext ctx, VisitableCommand command,
LockPromise lockPromise, InvocationFinallyAction finallyFunction) {
"""
Locks and invoke the next interceptor for non-transactional commands.
"""
return lockPromise.toInvocationStage().andHandle(ctx, command, (rCtx, rCommand, rv, throwable) -> {
if (throwable != null) {
lockManager.unlockAll(rCtx);
throw throwable;
} else {
return invokeNextAndFinally(rCtx, rCommand, finallyFunction);
}
});
} | java | protected final Object nonTxLockAndInvokeNext(InvocationContext ctx, VisitableCommand command,
LockPromise lockPromise, InvocationFinallyAction finallyFunction) {
return lockPromise.toInvocationStage().andHandle(ctx, command, (rCtx, rCommand, rv, throwable) -> {
if (throwable != null) {
lockManager.unlockAll(rCtx);
throw throwable;
} else {
return invokeNextAndFinally(rCtx, rCommand, finallyFunction);
}
});
} | [
"protected",
"final",
"Object",
"nonTxLockAndInvokeNext",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
",",
"LockPromise",
"lockPromise",
",",
"InvocationFinallyAction",
"finallyFunction",
")",
"{",
"return",
"lockPromise",
".",
"toInvocationStage",
"(",
")",
".",
"andHandle",
"(",
"ctx",
",",
"command",
",",
"(",
"rCtx",
",",
"rCommand",
",",
"rv",
",",
"throwable",
")",
"->",
"{",
"if",
"(",
"throwable",
"!=",
"null",
")",
"{",
"lockManager",
".",
"unlockAll",
"(",
"rCtx",
")",
";",
"throw",
"throwable",
";",
"}",
"else",
"{",
"return",
"invokeNextAndFinally",
"(",
"rCtx",
",",
"rCommand",
",",
"finallyFunction",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Locks and invoke the next interceptor for non-transactional commands. | [
"Locks",
"and",
"invoke",
"the",
"next",
"interceptor",
"for",
"non",
"-",
"transactional",
"commands",
"."
]
| train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/locking/AbstractLockingInterceptor.java#L292-L302 |
benjamin-bader/droptools | dropwizard-jooq/src/main/java/com/bendb/dropwizard/jooq/PostgresSupport.java | PostgresSupport.arrayAggNoNulls | @Support( {
"""
Like {@link #arrayAgg}, but uses {@code array_remove} to eliminate
SQL {@code NULL} values from the result.
@param field the field to be aggregated
@param <T> the type of the field
@return a {@link Field} representing the array aggregate
@see <a href="http://www.postgresql.org/docs/9.3/static/functions-aggregate.html"/>
"""SQLDialect.POSTGRES})
public static <T> Field<T[]> arrayAggNoNulls(Field<T> field) {
return DSL.field("array_remove(array_agg({0}), NULL)", field.getDataType().getArrayType(), field);
} | java | @Support({SQLDialect.POSTGRES})
public static <T> Field<T[]> arrayAggNoNulls(Field<T> field) {
return DSL.field("array_remove(array_agg({0}), NULL)", field.getDataType().getArrayType(), field);
} | [
"@",
"Support",
"(",
"{",
"SQLDialect",
".",
"POSTGRES",
"}",
")",
"public",
"static",
"<",
"T",
">",
"Field",
"<",
"T",
"[",
"]",
">",
"arrayAggNoNulls",
"(",
"Field",
"<",
"T",
">",
"field",
")",
"{",
"return",
"DSL",
".",
"field",
"(",
"\"array_remove(array_agg({0}), NULL)\"",
",",
"field",
".",
"getDataType",
"(",
")",
".",
"getArrayType",
"(",
")",
",",
"field",
")",
";",
"}"
]
| Like {@link #arrayAgg}, but uses {@code array_remove} to eliminate
SQL {@code NULL} values from the result.
@param field the field to be aggregated
@param <T> the type of the field
@return a {@link Field} representing the array aggregate
@see <a href="http://www.postgresql.org/docs/9.3/static/functions-aggregate.html"/> | [
"Like",
"{",
"@link",
"#arrayAgg",
"}",
"but",
"uses",
"{",
"@code",
"array_remove",
"}",
"to",
"eliminate",
"SQL",
"{",
"@code",
"NULL",
"}",
"values",
"from",
"the",
"result",
"."
]
| train | https://github.com/benjamin-bader/droptools/blob/f1964465d725dfb07a5b6eb16f7bbe794896d1e0/dropwizard-jooq/src/main/java/com/bendb/dropwizard/jooq/PostgresSupport.java#L41-L44 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/PartitionedRootResource.java | PartitionedRootResource.getPartitions | @GET
@Timed
public Response getPartitions(@Context final UriInfo uriInfo, @Context final HttpHeaders headers) {
"""
Get a representation of the root resource
@param uriInfo information about the URI
@param headers the request headers
@return the root resource
"""
final IRI identifier = rdf.createIRI(
properties.getProperty("baseUrl", uriInfo.getBaseUri().toString()));
LOGGER.debug("Request for root resource at: {}", identifier.getIRIString());
final List<Triple> graph = new ArrayList<>();
partitions.entrySet().stream().map(e -> rdf.createIRI(e.getValue() + e.getKey()))
.map(obj -> rdf.createTriple(identifier, LDP.contains, obj)).forEach(graph::add);
properties.stringPropertyNames().stream().filter(propMapping::containsKey)
.map(name -> rdf.createTriple(identifier, propMapping.get(name), isUrl(properties.getProperty(name)) ?
rdf.createIRI(properties.getProperty(name)) :
rdf.createLiteral(properties.getProperty(name))))
.forEach(graph::add);
final RDFSyntax syntax = getSyntax(headers.getAcceptableMediaTypes(), empty())
.orElseThrow(NotAcceptableException::new);
final IRI profile = ofNullable(getProfile(headers.getAcceptableMediaTypes(), syntax))
.orElseGet(() -> getDefaultProfile(syntax, identifier));
final StreamingOutput stream = new StreamingOutput() {
@Override
public void write(final OutputStream out) throws IOException {
ioService.write(graph.stream(), out, syntax, profile);
}
};
return ok().header(ALLOW, join(",", HttpMethod.GET, HEAD, OPTIONS))
.link(LDP.Resource.getIRIString(), "type")
.link(LDP.RDFSource.getIRIString(), "type")
.type(syntax.mediaType).entity(stream).build();
} | java | @GET
@Timed
public Response getPartitions(@Context final UriInfo uriInfo, @Context final HttpHeaders headers) {
final IRI identifier = rdf.createIRI(
properties.getProperty("baseUrl", uriInfo.getBaseUri().toString()));
LOGGER.debug("Request for root resource at: {}", identifier.getIRIString());
final List<Triple> graph = new ArrayList<>();
partitions.entrySet().stream().map(e -> rdf.createIRI(e.getValue() + e.getKey()))
.map(obj -> rdf.createTriple(identifier, LDP.contains, obj)).forEach(graph::add);
properties.stringPropertyNames().stream().filter(propMapping::containsKey)
.map(name -> rdf.createTriple(identifier, propMapping.get(name), isUrl(properties.getProperty(name)) ?
rdf.createIRI(properties.getProperty(name)) :
rdf.createLiteral(properties.getProperty(name))))
.forEach(graph::add);
final RDFSyntax syntax = getSyntax(headers.getAcceptableMediaTypes(), empty())
.orElseThrow(NotAcceptableException::new);
final IRI profile = ofNullable(getProfile(headers.getAcceptableMediaTypes(), syntax))
.orElseGet(() -> getDefaultProfile(syntax, identifier));
final StreamingOutput stream = new StreamingOutput() {
@Override
public void write(final OutputStream out) throws IOException {
ioService.write(graph.stream(), out, syntax, profile);
}
};
return ok().header(ALLOW, join(",", HttpMethod.GET, HEAD, OPTIONS))
.link(LDP.Resource.getIRIString(), "type")
.link(LDP.RDFSource.getIRIString(), "type")
.type(syntax.mediaType).entity(stream).build();
} | [
"@",
"GET",
"@",
"Timed",
"public",
"Response",
"getPartitions",
"(",
"@",
"Context",
"final",
"UriInfo",
"uriInfo",
",",
"@",
"Context",
"final",
"HttpHeaders",
"headers",
")",
"{",
"final",
"IRI",
"identifier",
"=",
"rdf",
".",
"createIRI",
"(",
"properties",
".",
"getProperty",
"(",
"\"baseUrl\"",
",",
"uriInfo",
".",
"getBaseUri",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Request for root resource at: {}\"",
",",
"identifier",
".",
"getIRIString",
"(",
")",
")",
";",
"final",
"List",
"<",
"Triple",
">",
"graph",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"partitions",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"e",
"->",
"rdf",
".",
"createIRI",
"(",
"e",
".",
"getValue",
"(",
")",
"+",
"e",
".",
"getKey",
"(",
")",
")",
")",
".",
"map",
"(",
"obj",
"->",
"rdf",
".",
"createTriple",
"(",
"identifier",
",",
"LDP",
".",
"contains",
",",
"obj",
")",
")",
".",
"forEach",
"(",
"graph",
"::",
"add",
")",
";",
"properties",
".",
"stringPropertyNames",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"propMapping",
"::",
"containsKey",
")",
".",
"map",
"(",
"name",
"->",
"rdf",
".",
"createTriple",
"(",
"identifier",
",",
"propMapping",
".",
"get",
"(",
"name",
")",
",",
"isUrl",
"(",
"properties",
".",
"getProperty",
"(",
"name",
")",
")",
"?",
"rdf",
".",
"createIRI",
"(",
"properties",
".",
"getProperty",
"(",
"name",
")",
")",
":",
"rdf",
".",
"createLiteral",
"(",
"properties",
".",
"getProperty",
"(",
"name",
")",
")",
")",
")",
".",
"forEach",
"(",
"graph",
"::",
"add",
")",
";",
"final",
"RDFSyntax",
"syntax",
"=",
"getSyntax",
"(",
"headers",
".",
"getAcceptableMediaTypes",
"(",
")",
",",
"empty",
"(",
")",
")",
".",
"orElseThrow",
"(",
"NotAcceptableException",
"::",
"new",
")",
";",
"final",
"IRI",
"profile",
"=",
"ofNullable",
"(",
"getProfile",
"(",
"headers",
".",
"getAcceptableMediaTypes",
"(",
")",
",",
"syntax",
")",
")",
".",
"orElseGet",
"(",
"(",
")",
"->",
"getDefaultProfile",
"(",
"syntax",
",",
"identifier",
")",
")",
";",
"final",
"StreamingOutput",
"stream",
"=",
"new",
"StreamingOutput",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"ioService",
".",
"write",
"(",
"graph",
".",
"stream",
"(",
")",
",",
"out",
",",
"syntax",
",",
"profile",
")",
";",
"}",
"}",
";",
"return",
"ok",
"(",
")",
".",
"header",
"(",
"ALLOW",
",",
"join",
"(",
"\",\"",
",",
"HttpMethod",
".",
"GET",
",",
"HEAD",
",",
"OPTIONS",
")",
")",
".",
"link",
"(",
"LDP",
".",
"Resource",
".",
"getIRIString",
"(",
")",
",",
"\"type\"",
")",
".",
"link",
"(",
"LDP",
".",
"RDFSource",
".",
"getIRIString",
"(",
")",
",",
"\"type\"",
")",
".",
"type",
"(",
"syntax",
".",
"mediaType",
")",
".",
"entity",
"(",
"stream",
")",
".",
"build",
"(",
")",
";",
"}"
]
| Get a representation of the root resource
@param uriInfo information about the URI
@param headers the request headers
@return the root resource | [
"Get",
"a",
"representation",
"of",
"the",
"root",
"resource"
]
| train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/PartitionedRootResource.java#L93-L129 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java | AddressDivisionGrouping.increment | protected static <R extends AddressSection, S extends AddressSegment> R increment(
R section,
long increment,
BigInteger bigIncrement,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
"""
this does not handle overflow, overflow should be checked before calling this
"""
if(!section.isMultiple()) {
return add(section, bigIncrement, addrCreator, prefixLength);
}
boolean isDecrement = increment <= 0;
if(isDecrement) {
return add(lowerProducer.get(), bigIncrement, addrCreator, prefixLength);
}
BigInteger count = section.getCount();
BigInteger incrementPlus1 = bigIncrement.add(BigInteger.ONE);
int countCompare = count.compareTo(incrementPlus1);
if(countCompare <= 0) {
if(countCompare == 0) {
return upperProducer.get();
}
return add(upperProducer.get(), incrementPlus1.subtract(count), addrCreator, prefixLength);
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);
} | java | protected static <R extends AddressSection, S extends AddressSegment> R increment(
R section,
long increment,
BigInteger bigIncrement,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(!section.isMultiple()) {
return add(section, bigIncrement, addrCreator, prefixLength);
}
boolean isDecrement = increment <= 0;
if(isDecrement) {
return add(lowerProducer.get(), bigIncrement, addrCreator, prefixLength);
}
BigInteger count = section.getCount();
BigInteger incrementPlus1 = bigIncrement.add(BigInteger.ONE);
int countCompare = count.compareTo(incrementPlus1);
if(countCompare <= 0) {
if(countCompare == 0) {
return upperProducer.get();
}
return add(upperProducer.get(), incrementPlus1.subtract(count), addrCreator, prefixLength);
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);
} | [
"protected",
"static",
"<",
"R",
"extends",
"AddressSection",
",",
"S",
"extends",
"AddressSegment",
">",
"R",
"increment",
"(",
"R",
"section",
",",
"long",
"increment",
",",
"BigInteger",
"bigIncrement",
",",
"AddressCreator",
"<",
"?",
",",
"R",
",",
"?",
",",
"S",
">",
"addrCreator",
",",
"Supplier",
"<",
"R",
">",
"lowerProducer",
",",
"Supplier",
"<",
"R",
">",
"upperProducer",
",",
"Integer",
"prefixLength",
")",
"{",
"if",
"(",
"!",
"section",
".",
"isMultiple",
"(",
")",
")",
"{",
"return",
"add",
"(",
"section",
",",
"bigIncrement",
",",
"addrCreator",
",",
"prefixLength",
")",
";",
"}",
"boolean",
"isDecrement",
"=",
"increment",
"<=",
"0",
";",
"if",
"(",
"isDecrement",
")",
"{",
"return",
"add",
"(",
"lowerProducer",
".",
"get",
"(",
")",
",",
"bigIncrement",
",",
"addrCreator",
",",
"prefixLength",
")",
";",
"}",
"BigInteger",
"count",
"=",
"section",
".",
"getCount",
"(",
")",
";",
"BigInteger",
"incrementPlus1",
"=",
"bigIncrement",
".",
"add",
"(",
"BigInteger",
".",
"ONE",
")",
";",
"int",
"countCompare",
"=",
"count",
".",
"compareTo",
"(",
"incrementPlus1",
")",
";",
"if",
"(",
"countCompare",
"<=",
"0",
")",
"{",
"if",
"(",
"countCompare",
"==",
"0",
")",
"{",
"return",
"upperProducer",
".",
"get",
"(",
")",
";",
"}",
"return",
"add",
"(",
"upperProducer",
".",
"get",
"(",
")",
",",
"incrementPlus1",
".",
"subtract",
"(",
"count",
")",
",",
"addrCreator",
",",
"prefixLength",
")",
";",
"}",
"return",
"incrementRange",
"(",
"section",
",",
"increment",
",",
"addrCreator",
",",
"lowerProducer",
",",
"prefixLength",
")",
";",
"}"
]
| this does not handle overflow, overflow should be checked before calling this | [
"this",
"does",
"not",
"handle",
"overflow",
"overflow",
"should",
"be",
"checked",
"before",
"calling",
"this"
]
| train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java#L1163-L1188 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getPausedSingularityRequests | public Collection<SingularityRequestParent> getPausedSingularityRequests() {
"""
Get all requests that their state is PAUSED
ACTIVE requests are paused by users, which is equivalent to stop their tasks from running without undeploying them
@return
All PAUSED {@link SingularityRequestParent} instances
"""
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PAUSED_FORMAT, getApiBase(host));
return getCollection(requestUri, "PAUSED requests", REQUESTS_COLLECTION);
} | java | public Collection<SingularityRequestParent> getPausedSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PAUSED_FORMAT, getApiBase(host));
return getCollection(requestUri, "PAUSED requests", REQUESTS_COLLECTION);
} | [
"public",
"Collection",
"<",
"SingularityRequestParent",
">",
"getPausedSingularityRequests",
"(",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"REQUESTS_GET_PAUSED_FORMAT",
",",
"getApiBase",
"(",
"host",
")",
")",
";",
"return",
"getCollection",
"(",
"requestUri",
",",
"\"PAUSED requests\"",
",",
"REQUESTS_COLLECTION",
")",
";",
"}"
]
| Get all requests that their state is PAUSED
ACTIVE requests are paused by users, which is equivalent to stop their tasks from running without undeploying them
@return
All PAUSED {@link SingularityRequestParent} instances | [
"Get",
"all",
"requests",
"that",
"their",
"state",
"is",
"PAUSED",
"ACTIVE",
"requests",
"are",
"paused",
"by",
"users",
"which",
"is",
"equivalent",
"to",
"stop",
"their",
"tasks",
"from",
"running",
"without",
"undeploying",
"them"
]
| train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L778-L782 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/reporter/ReportFormatter.java | ReportFormatter.getSubstitutedTemplateContent | protected static String getSubstitutedTemplateContent(String templateContent, NamesValuesList<String, String> namesValues) {
"""
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
"""
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/values",
"for",
"(",
"NameValue",
"<",
"String",
",",
"String",
">",
"nameValue",
":",
"namesValues",
")",
"{",
"templateContentSubst",
"=",
"templateContentSubst",
".",
"replace",
"(",
"nameValue",
".",
"name",
",",
"nameValue",
".",
"value",
")",
";",
"}",
"return",
"templateContentSubst",
";",
"}"
]
| 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 |
Cornutum/tcases | tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java | SystemInputJson.asVarDef | private static IVarDef asVarDef( String varName, String varType, Annotated groupAnnotations, JsonObject json) {
"""
Returns the variable definition represented by the given JSON object.
"""
try
{
validIdentifier( varName);
AbstractVarDef varDef =
json.containsKey( MEMBERS_KEY)
? new VarSet( varName)
: new VarDef( varName);
varDef.setType( varType);
// Get annotations for this variable
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> varDef.setAnnotation( key, has.getString( key))));
// Get the condition for this variable
Optional.ofNullable( json.getJsonObject( WHEN_KEY))
.ifPresent( object -> varDef.setCondition( asValidCondition( object)));
if( json.containsKey( MEMBERS_KEY))
{
VarSet varSet = (VarSet) varDef;
getVarDefs( varType, json.getJsonObject( MEMBERS_KEY))
.forEach( member -> varSet.addMember( member));
if( !varSet.getMembers().hasNext())
{
throw new SystemInputException( String.format( "No members defined for VarSet=%s", varName));
}
}
else
{
VarDef var = (VarDef) varDef;
getValueDefs( json.getJsonObject( VALUES_KEY))
.forEach( valueDef -> var.addValue( valueDef));
if( !var.getValidValues().hasNext())
{
throw new SystemInputException( String.format( "No valid values defined for Var=%s", varName));
}
}
// Add any group annotations
varDef.addAnnotations( groupAnnotations);
return varDef;
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining variable=%s", varName), e);
}
} | java | private static IVarDef asVarDef( String varName, String varType, Annotated groupAnnotations, JsonObject json)
{
try
{
validIdentifier( varName);
AbstractVarDef varDef =
json.containsKey( MEMBERS_KEY)
? new VarSet( varName)
: new VarDef( varName);
varDef.setType( varType);
// Get annotations for this variable
Optional.ofNullable( json.getJsonObject( HAS_KEY))
.ifPresent( has -> has.keySet().stream().forEach( key -> varDef.setAnnotation( key, has.getString( key))));
// Get the condition for this variable
Optional.ofNullable( json.getJsonObject( WHEN_KEY))
.ifPresent( object -> varDef.setCondition( asValidCondition( object)));
if( json.containsKey( MEMBERS_KEY))
{
VarSet varSet = (VarSet) varDef;
getVarDefs( varType, json.getJsonObject( MEMBERS_KEY))
.forEach( member -> varSet.addMember( member));
if( !varSet.getMembers().hasNext())
{
throw new SystemInputException( String.format( "No members defined for VarSet=%s", varName));
}
}
else
{
VarDef var = (VarDef) varDef;
getValueDefs( json.getJsonObject( VALUES_KEY))
.forEach( valueDef -> var.addValue( valueDef));
if( !var.getValidValues().hasNext())
{
throw new SystemInputException( String.format( "No valid values defined for Var=%s", varName));
}
}
// Add any group annotations
varDef.addAnnotations( groupAnnotations);
return varDef;
}
catch( SystemInputException e)
{
throw new SystemInputException( String.format( "Error defining variable=%s", varName), e);
}
} | [
"private",
"static",
"IVarDef",
"asVarDef",
"(",
"String",
"varName",
",",
"String",
"varType",
",",
"Annotated",
"groupAnnotations",
",",
"JsonObject",
"json",
")",
"{",
"try",
"{",
"validIdentifier",
"(",
"varName",
")",
";",
"AbstractVarDef",
"varDef",
"=",
"json",
".",
"containsKey",
"(",
"MEMBERS_KEY",
")",
"?",
"new",
"VarSet",
"(",
"varName",
")",
":",
"new",
"VarDef",
"(",
"varName",
")",
";",
"varDef",
".",
"setType",
"(",
"varType",
")",
";",
"// Get annotations for this variable",
"Optional",
".",
"ofNullable",
"(",
"json",
".",
"getJsonObject",
"(",
"HAS_KEY",
")",
")",
".",
"ifPresent",
"(",
"has",
"->",
"has",
".",
"keySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"varDef",
".",
"setAnnotation",
"(",
"key",
",",
"has",
".",
"getString",
"(",
"key",
")",
")",
")",
")",
";",
"// Get the condition for this variable",
"Optional",
".",
"ofNullable",
"(",
"json",
".",
"getJsonObject",
"(",
"WHEN_KEY",
")",
")",
".",
"ifPresent",
"(",
"object",
"->",
"varDef",
".",
"setCondition",
"(",
"asValidCondition",
"(",
"object",
")",
")",
")",
";",
"if",
"(",
"json",
".",
"containsKey",
"(",
"MEMBERS_KEY",
")",
")",
"{",
"VarSet",
"varSet",
"=",
"(",
"VarSet",
")",
"varDef",
";",
"getVarDefs",
"(",
"varType",
",",
"json",
".",
"getJsonObject",
"(",
"MEMBERS_KEY",
")",
")",
".",
"forEach",
"(",
"member",
"->",
"varSet",
".",
"addMember",
"(",
"member",
")",
")",
";",
"if",
"(",
"!",
"varSet",
".",
"getMembers",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"throw",
"new",
"SystemInputException",
"(",
"String",
".",
"format",
"(",
"\"No members defined for VarSet=%s\"",
",",
"varName",
")",
")",
";",
"}",
"}",
"else",
"{",
"VarDef",
"var",
"=",
"(",
"VarDef",
")",
"varDef",
";",
"getValueDefs",
"(",
"json",
".",
"getJsonObject",
"(",
"VALUES_KEY",
")",
")",
".",
"forEach",
"(",
"valueDef",
"->",
"var",
".",
"addValue",
"(",
"valueDef",
")",
")",
";",
"if",
"(",
"!",
"var",
".",
"getValidValues",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"throw",
"new",
"SystemInputException",
"(",
"String",
".",
"format",
"(",
"\"No valid values defined for Var=%s\"",
",",
"varName",
")",
")",
";",
"}",
"}",
"// Add any group annotations",
"varDef",
".",
"addAnnotations",
"(",
"groupAnnotations",
")",
";",
"return",
"varDef",
";",
"}",
"catch",
"(",
"SystemInputException",
"e",
")",
"{",
"throw",
"new",
"SystemInputException",
"(",
"String",
".",
"format",
"(",
"\"Error defining variable=%s\"",
",",
"varName",
")",
",",
"e",
")",
";",
"}",
"}"
]
| Returns the variable definition represented by the given JSON object. | [
"Returns",
"the",
"variable",
"definition",
"represented",
"by",
"the",
"given",
"JSON",
"object",
"."
]
| train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputJson.java#L274-L327 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java | AbstractRestClient.addBasicAuthHeader | protected void addBasicAuthHeader(HttpHeaders headers, String key) {
"""
Add HTTP Basic Auth header
@param headers the headers, it must not be a read-only one, if it is, use {@link #copy(HttpHeaders)} to make a writable copy first
@param key the API key
"""
headers.add(HEADER_AUTHORIZATION, buildBasicAuthValue(key));
} | java | protected void addBasicAuthHeader(HttpHeaders headers, String key){
headers.add(HEADER_AUTHORIZATION, buildBasicAuthValue(key));
} | [
"protected",
"void",
"addBasicAuthHeader",
"(",
"HttpHeaders",
"headers",
",",
"String",
"key",
")",
"{",
"headers",
".",
"add",
"(",
"HEADER_AUTHORIZATION",
",",
"buildBasicAuthValue",
"(",
"key",
")",
")",
";",
"}"
]
| Add HTTP Basic Auth header
@param headers the headers, it must not be a read-only one, if it is, use {@link #copy(HttpHeaders)} to make a writable copy first
@param key the API key | [
"Add",
"HTTP",
"Basic",
"Auth",
"header"
]
| train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L659-L661 |
Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java | GrpcServerBuilder.withChildOption | public <T> GrpcServerBuilder withChildOption(ChannelOption<T> option, T value) {
"""
Sets a netty channel option.
@param <T> channel option type
@param option the option to be set
@param value the new value
@return an updated instance of this {@link GrpcServerBuilder}
"""
mNettyServerBuilder = mNettyServerBuilder.withChildOption(option, value);
return this;
} | java | public <T> GrpcServerBuilder withChildOption(ChannelOption<T> option, T value) {
mNettyServerBuilder = mNettyServerBuilder.withChildOption(option, value);
return this;
} | [
"public",
"<",
"T",
">",
"GrpcServerBuilder",
"withChildOption",
"(",
"ChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"mNettyServerBuilder",
"=",
"mNettyServerBuilder",
".",
"withChildOption",
"(",
"option",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
]
| Sets a netty channel option.
@param <T> channel option type
@param option the option to be set
@param value the new value
@return an updated instance of this {@link GrpcServerBuilder} | [
"Sets",
"a",
"netty",
"channel",
"option",
"."
]
| train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java#L158-L161 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java | JsonUtils.renderException | public static void renderException(final Exception ex, final HttpServletResponse response) {
"""
Render exceptions. Adds error messages and the stack trace to the json model
and sets the response status accordingly to note bad requests.
@param ex the ex
@param response the response
"""
val map = new HashMap<String, String>();
map.put("error", ex.getMessage());
map.put("stacktrace", Arrays.deepToString(ex.getStackTrace()));
renderException(map, response);
} | java | public static void renderException(final Exception ex, final HttpServletResponse response) {
val map = new HashMap<String, String>();
map.put("error", ex.getMessage());
map.put("stacktrace", Arrays.deepToString(ex.getStackTrace()));
renderException(map, response);
} | [
"public",
"static",
"void",
"renderException",
"(",
"final",
"Exception",
"ex",
",",
"final",
"HttpServletResponse",
"response",
")",
"{",
"val",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"error\"",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"map",
".",
"put",
"(",
"\"stacktrace\"",
",",
"Arrays",
".",
"deepToString",
"(",
"ex",
".",
"getStackTrace",
"(",
")",
")",
")",
";",
"renderException",
"(",
"map",
",",
"response",
")",
";",
"}"
]
| Render exceptions. Adds error messages and the stack trace to the json model
and sets the response status accordingly to note bad requests.
@param ex the ex
@param response the response | [
"Render",
"exceptions",
".",
"Adds",
"error",
"messages",
"and",
"the",
"stack",
"trace",
"to",
"the",
"json",
"model",
"and",
"sets",
"the",
"response",
"status",
"accordingly",
"to",
"note",
"bad",
"requests",
"."
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java#L54-L59 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java | LoadingWorkObject.addTypeBindError | public void addTypeBindError(final TypeBindException bindException, final Cell cell, final String fieldName, final String label) {
"""
型変換エラーを追加します。
@param bindException 型変換エラー
@param cell マッピング元となったセル
@param fieldName マッピング先のフィールド名
@param label ラベル。省略する場合は、nullを指定します。
"""
addTypeBindError(bindException, CellPosition.of(cell), fieldName, label);
} | java | public void addTypeBindError(final TypeBindException bindException, final Cell cell, final String fieldName, final String label) {
addTypeBindError(bindException, CellPosition.of(cell), fieldName, label);
} | [
"public",
"void",
"addTypeBindError",
"(",
"final",
"TypeBindException",
"bindException",
",",
"final",
"Cell",
"cell",
",",
"final",
"String",
"fieldName",
",",
"final",
"String",
"label",
")",
"{",
"addTypeBindError",
"(",
"bindException",
",",
"CellPosition",
".",
"of",
"(",
"cell",
")",
",",
"fieldName",
",",
"label",
")",
";",
"}"
]
| 型変換エラーを追加します。
@param bindException 型変換エラー
@param cell マッピング元となったセル
@param fieldName マッピング先のフィールド名
@param label ラベル。省略する場合は、nullを指定します。 | [
"型変換エラーを追加します。"
]
| train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/LoadingWorkObject.java#L57-L59 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectLineSegmentAab | public static int intersectLineSegmentAab(Vector3fc p0, Vector3fc p1, Vector3fc min, Vector3fc max, Vector2f result) {
"""
Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code>
intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>,
and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection.
<p>
This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@see #intersectLineSegmentAab(Vector3fc, Vector3fc, Vector3fc, Vector3fc, Vector2f)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param min
the minimum corner of the axis-aligned box
@param max
the maximum corner of the axis-aligned box
@param result
a vector which will hold the resulting values of the parameter
<i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection
iff the line segment intersects the axis-aligned box
@return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or
{@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or
{@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or
{@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box
or lies on an edge or a side of the box
"""
return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result);
} | java | public static int intersectLineSegmentAab(Vector3fc p0, Vector3fc p1, Vector3fc min, Vector3fc max, Vector2f result) {
return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result);
} | [
"public",
"static",
"int",
"intersectLineSegmentAab",
"(",
"Vector3fc",
"p0",
",",
"Vector3fc",
"p1",
",",
"Vector3fc",
"min",
",",
"Vector3fc",
"max",
",",
"Vector2f",
"result",
")",
"{",
"return",
"intersectLineSegmentAab",
"(",
"p0",
".",
"x",
"(",
")",
",",
"p0",
".",
"y",
"(",
")",
",",
"p0",
".",
"z",
"(",
")",
",",
"p1",
".",
"x",
"(",
")",
",",
"p1",
".",
"y",
"(",
")",
",",
"p1",
".",
"z",
"(",
")",
",",
"min",
".",
"x",
"(",
")",
",",
"min",
".",
"y",
"(",
")",
",",
"min",
".",
"z",
"(",
")",
",",
"max",
".",
"x",
"(",
")",
",",
"max",
".",
"y",
"(",
")",
",",
"max",
".",
"z",
"(",
")",
",",
"result",
")",
";",
"}"
]
| Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code>
intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>,
and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection.
<p>
This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@see #intersectLineSegmentAab(Vector3fc, Vector3fc, Vector3fc, Vector3fc, Vector2f)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param min
the minimum corner of the axis-aligned box
@param max
the maximum corner of the axis-aligned box
@param result
a vector which will hold the resulting values of the parameter
<i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection
iff the line segment intersects the axis-aligned box
@return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or
{@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or
{@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or
{@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box
or lies on an edge or a side of the box | [
"Determine",
"whether",
"the",
"undirected",
"line",
"segment",
"with",
"the",
"end",
"points",
"<code",
">",
"p0<",
"/",
"code",
">",
"and",
"<code",
">",
"p1<",
"/",
"code",
">",
"intersects",
"the",
"axis",
"-",
"aligned",
"box",
"given",
"as",
"its",
"minimum",
"corner",
"<code",
">",
"min<",
"/",
"code",
">",
"and",
"maximum",
"corner",
"<code",
">",
"max<",
"/",
"code",
">",
"and",
"return",
"the",
"values",
"of",
"the",
"parameter",
"<i",
">",
"t<",
"/",
"i",
">",
"in",
"the",
"ray",
"equation",
"<i",
">",
"p",
"(",
"t",
")",
"=",
"origin",
"+",
"p0",
"*",
"(",
"p1",
"-",
"p0",
")",
"<",
"/",
"i",
">",
"of",
"the",
"near",
"and",
"far",
"point",
"of",
"intersection",
".",
"<p",
">",
"This",
"method",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"for",
"a",
"line",
"segment",
"whose",
"either",
"end",
"point",
"lies",
"inside",
"the",
"axis",
"-",
"aligned",
"box",
".",
"<p",
">",
"Reference",
":",
"<a",
"href",
"=",
"https",
":",
"//",
"dl",
".",
"acm",
".",
"org",
"/",
"citation",
".",
"cfm?id",
"=",
"1198748",
">",
"An",
"Efficient",
"and",
"Robust",
"Ray–Box",
"Intersection<",
"/",
"a",
">"
]
| train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L2569-L2571 |
beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeEncodedWord | public static String encodeEncodedWord(String text, Usage usage) {
"""
Encodes the specified text into an encoded word or a sequence of encoded
words separated by space. The text is separated into a sequence of encoded
words if it does not fit in a single one.
<p>
The charset to encode the specified text into a byte array and the encoding
to use for the encoded-word are detected automatically.
<p>
This method assumes that zero characters have already been used up in the
current line.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC 822).
@return the encoded word (or sequence of encoded words if the given text
does not fit in a single encoded word).
@see #hasToBeEncoded(String, int)
"""
return encodeEncodedWord(text, usage, 0, null, null);
} | java | public static String encodeEncodedWord(String text, Usage usage) {
return encodeEncodedWord(text, usage, 0, null, null);
} | [
"public",
"static",
"String",
"encodeEncodedWord",
"(",
"String",
"text",
",",
"Usage",
"usage",
")",
"{",
"return",
"encodeEncodedWord",
"(",
"text",
",",
"usage",
",",
"0",
",",
"null",
",",
"null",
")",
";",
"}"
]
| Encodes the specified text into an encoded word or a sequence of encoded
words separated by space. The text is separated into a sequence of encoded
words if it does not fit in a single one.
<p>
The charset to encode the specified text into a byte array and the encoding
to use for the encoded-word are detected automatically.
<p>
This method assumes that zero characters have already been used up in the
current line.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC 822).
@return the encoded word (or sequence of encoded words if the given text
does not fit in a single encoded word).
@see #hasToBeEncoded(String, int) | [
"Encodes",
"the",
"specified",
"text",
"into",
"an",
"encoded",
"word",
"or",
"a",
"sequence",
"of",
"encoded",
"words",
"separated",
"by",
"space",
".",
"The",
"text",
"is",
"separated",
"into",
"a",
"sequence",
"of",
"encoded",
"words",
"if",
"it",
"does",
"not",
"fit",
"in",
"a",
"single",
"one",
".",
"<p",
">",
"The",
"charset",
"to",
"encode",
"the",
"specified",
"text",
"into",
"a",
"byte",
"array",
"and",
"the",
"encoding",
"to",
"use",
"for",
"the",
"encoded",
"-",
"word",
"are",
"detected",
"automatically",
".",
"<p",
">",
"This",
"method",
"assumes",
"that",
"zero",
"characters",
"have",
"already",
"been",
"used",
"up",
"in",
"the",
"current",
"line",
"."
]
| train | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L264-L266 |
VoltDB/voltdb | src/frontend/org/voltdb/largequery/LargeBlockManager.java | LargeBlockManager.storeBlock | void storeBlock(BlockId blockId, ByteBuffer block) throws IOException {
"""
Store the given block with the given ID to disk.
@param blockId the ID of the block
@param block the bytes for the block
@throws IOException
"""
synchronized (m_accessLock) {
if (m_blockPathMap.containsKey(blockId)) {
throw new IllegalArgumentException("Request to store block that is already stored: "
+ blockId.toString());
}
int origPosition = block.position();
block.position(0);
Path blockPath = makeBlockPath(blockId);
try (SeekableByteChannel channel = Files.newByteChannel(blockPath, OPEN_OPTIONS, PERMISSIONS)) {
channel.write(block);
}
finally {
block.position(origPosition);
}
m_blockPathMap.put(blockId, blockPath);
}
} | java | void storeBlock(BlockId blockId, ByteBuffer block) throws IOException {
synchronized (m_accessLock) {
if (m_blockPathMap.containsKey(blockId)) {
throw new IllegalArgumentException("Request to store block that is already stored: "
+ blockId.toString());
}
int origPosition = block.position();
block.position(0);
Path blockPath = makeBlockPath(blockId);
try (SeekableByteChannel channel = Files.newByteChannel(blockPath, OPEN_OPTIONS, PERMISSIONS)) {
channel.write(block);
}
finally {
block.position(origPosition);
}
m_blockPathMap.put(blockId, blockPath);
}
} | [
"void",
"storeBlock",
"(",
"BlockId",
"blockId",
",",
"ByteBuffer",
"block",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"m_accessLock",
")",
"{",
"if",
"(",
"m_blockPathMap",
".",
"containsKey",
"(",
"blockId",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Request to store block that is already stored: \"",
"+",
"blockId",
".",
"toString",
"(",
")",
")",
";",
"}",
"int",
"origPosition",
"=",
"block",
".",
"position",
"(",
")",
";",
"block",
".",
"position",
"(",
"0",
")",
";",
"Path",
"blockPath",
"=",
"makeBlockPath",
"(",
"blockId",
")",
";",
"try",
"(",
"SeekableByteChannel",
"channel",
"=",
"Files",
".",
"newByteChannel",
"(",
"blockPath",
",",
"OPEN_OPTIONS",
",",
"PERMISSIONS",
")",
")",
"{",
"channel",
".",
"write",
"(",
"block",
")",
";",
"}",
"finally",
"{",
"block",
".",
"position",
"(",
"origPosition",
")",
";",
"}",
"m_blockPathMap",
".",
"put",
"(",
"blockId",
",",
"blockPath",
")",
";",
"}",
"}"
]
| Store the given block with the given ID to disk.
@param blockId the ID of the block
@param block the bytes for the block
@throws IOException | [
"Store",
"the",
"given",
"block",
"with",
"the",
"given",
"ID",
"to",
"disk",
"."
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/largequery/LargeBlockManager.java#L172-L191 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/generator/ManifestFileProcessor.java | ManifestFileProcessor.getCorePlatformDir | public File getCorePlatformDir() {
"""
Retrieves the Liberty core platform directory.
@return The Liberty core platform directory
"""
File platformDir = null;
File installDir = Utils.getInstallDir();
if (installDir != null) {
platformDir = new File(installDir, PLATFORM_DIR);
}
if (platformDir == null) {
throw new RuntimeException("Platform Directory not found");
}
return platformDir;
} | java | public File getCorePlatformDir() {
File platformDir = null;
File installDir = Utils.getInstallDir();
if (installDir != null) {
platformDir = new File(installDir, PLATFORM_DIR);
}
if (platformDir == null) {
throw new RuntimeException("Platform Directory not found");
}
return platformDir;
} | [
"public",
"File",
"getCorePlatformDir",
"(",
")",
"{",
"File",
"platformDir",
"=",
"null",
";",
"File",
"installDir",
"=",
"Utils",
".",
"getInstallDir",
"(",
")",
";",
"if",
"(",
"installDir",
"!=",
"null",
")",
"{",
"platformDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"PLATFORM_DIR",
")",
";",
"}",
"if",
"(",
"platformDir",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Platform Directory not found\"",
")",
";",
"}",
"return",
"platformDir",
";",
"}"
]
| Retrieves the Liberty core platform directory.
@return The Liberty core platform directory | [
"Retrieves",
"the",
"Liberty",
"core",
"platform",
"directory",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/generator/ManifestFileProcessor.java#L459-L472 |
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) {
"""
Set a cache value
@param <T> Type
@param prefix Tree name
@param postfix Property name
@param data 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 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/widget/FacebookDialog.java | FacebookDialog.canPresentOpenGraphActionDialog | public static boolean canPresentOpenGraphActionDialog(Context context, OpenGraphActionDialogFeature... features) {
"""
Determines whether the version of the Facebook application installed on the user's device is recent
enough to support specific features of the native Open Graph action dialog, which in turn may be used to
determine which UI, etc., to present to the user.
@param context the calling Context
@param features zero or more features to check for; {@link OpenGraphActionDialogFeature#OG_ACTION_DIALOG} is implicitly
checked if not explicitly specified
@return true if all of the specified features are supported by the currently installed version of the
Facebook application; false if any of the features are not supported
"""
return handleCanPresent(context, EnumSet.of(OpenGraphActionDialogFeature.OG_ACTION_DIALOG, features));
} | java | public static boolean canPresentOpenGraphActionDialog(Context context, OpenGraphActionDialogFeature... features) {
return handleCanPresent(context, EnumSet.of(OpenGraphActionDialogFeature.OG_ACTION_DIALOG, features));
} | [
"public",
"static",
"boolean",
"canPresentOpenGraphActionDialog",
"(",
"Context",
"context",
",",
"OpenGraphActionDialogFeature",
"...",
"features",
")",
"{",
"return",
"handleCanPresent",
"(",
"context",
",",
"EnumSet",
".",
"of",
"(",
"OpenGraphActionDialogFeature",
".",
"OG_ACTION_DIALOG",
",",
"features",
")",
")",
";",
"}"
]
| Determines whether the version of the Facebook application installed on the user's device is recent
enough to support specific features of the native Open Graph action dialog, which in turn may be used to
determine which UI, etc., to present to the user.
@param context the calling Context
@param features zero or more features to check for; {@link OpenGraphActionDialogFeature#OG_ACTION_DIALOG} is implicitly
checked if not explicitly specified
@return true if all of the specified features are supported by the currently installed version of the
Facebook application; false if any of the features are not supported | [
"Determines",
"whether",
"the",
"version",
"of",
"the",
"Facebook",
"application",
"installed",
"on",
"the",
"user",
"s",
"device",
"is",
"recent",
"enough",
"to",
"support",
"specific",
"features",
"of",
"the",
"native",
"Open",
"Graph",
"action",
"dialog",
"which",
"in",
"turn",
"may",
"be",
"used",
"to",
"determine",
"which",
"UI",
"etc",
".",
"to",
"present",
"to",
"the",
"user",
"."
]
| train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/widget/FacebookDialog.java#L399-L401 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java | EntityIntrospector.initEntityMetadata | private void initEntityMetadata(Entity entity) {
"""
Initializes the metadata using the given {@link Entity} annotation.
@param entity
the {@link Entity} annotation.
"""
String kind = entity.kind();
if (kind.trim().length() == 0) {
kind = entityClass.getSimpleName();
}
entityMetadata = new EntityMetadata(entityClass, kind);
} | java | private void initEntityMetadata(Entity entity) {
String kind = entity.kind();
if (kind.trim().length() == 0) {
kind = entityClass.getSimpleName();
}
entityMetadata = new EntityMetadata(entityClass, kind);
} | [
"private",
"void",
"initEntityMetadata",
"(",
"Entity",
"entity",
")",
"{",
"String",
"kind",
"=",
"entity",
".",
"kind",
"(",
")",
";",
"if",
"(",
"kind",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"kind",
"=",
"entityClass",
".",
"getSimpleName",
"(",
")",
";",
"}",
"entityMetadata",
"=",
"new",
"EntityMetadata",
"(",
"entityClass",
",",
"kind",
")",
";",
"}"
]
| Initializes the metadata using the given {@link Entity} annotation.
@param entity
the {@link Entity} annotation. | [
"Initializes",
"the",
"metadata",
"using",
"the",
"given",
"{",
"@link",
"Entity",
"}",
"annotation",
"."
]
| train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityIntrospector.java#L177-L183 |
google/closure-compiler | src/com/google/javascript/jscomp/ChangeVerifier.java | ChangeVerifier.verifyScopeChangesHaveBeenRecorded | private void verifyScopeChangesHaveBeenRecorded(String passName, Node root) {
"""
Checks that the scope roots marked as changed have indeed changed
"""
final String passNameMsg = passName.isEmpty() ? "" : passName + ": ";
// Gather all the scope nodes that existed when the snapshot was taken.
final Set<Node> snapshotScopeNodes = new HashSet<>();
NodeUtil.visitPreOrder(
clonesByCurrent.get(root),
new Visitor() {
@Override
public void visit(Node oldNode) {
if (NodeUtil.isChangeScopeRoot(oldNode)) {
snapshotScopeNodes.add(oldNode);
}
}
});
NodeUtil.visitPreOrder(
root,
new Visitor() {
@Override
public void visit(Node n) {
if (n.isRoot()) {
verifyRoot(n);
} else if (NodeUtil.isChangeScopeRoot(n)) {
Node clone = clonesByCurrent.get(n);
// Remove any scope nodes that still exist.
snapshotScopeNodes.remove(clone);
verifyNode(passNameMsg, n);
if (clone == null) {
verifyNewNode(passNameMsg, n);
} else {
verifyNodeChange(passNameMsg, n, clone);
}
}
}
});
// Only actually deleted snapshot scope nodes should remain.
verifyDeletedScopeNodes(passNameMsg, snapshotScopeNodes);
} | java | private void verifyScopeChangesHaveBeenRecorded(String passName, Node root) {
final String passNameMsg = passName.isEmpty() ? "" : passName + ": ";
// Gather all the scope nodes that existed when the snapshot was taken.
final Set<Node> snapshotScopeNodes = new HashSet<>();
NodeUtil.visitPreOrder(
clonesByCurrent.get(root),
new Visitor() {
@Override
public void visit(Node oldNode) {
if (NodeUtil.isChangeScopeRoot(oldNode)) {
snapshotScopeNodes.add(oldNode);
}
}
});
NodeUtil.visitPreOrder(
root,
new Visitor() {
@Override
public void visit(Node n) {
if (n.isRoot()) {
verifyRoot(n);
} else if (NodeUtil.isChangeScopeRoot(n)) {
Node clone = clonesByCurrent.get(n);
// Remove any scope nodes that still exist.
snapshotScopeNodes.remove(clone);
verifyNode(passNameMsg, n);
if (clone == null) {
verifyNewNode(passNameMsg, n);
} else {
verifyNodeChange(passNameMsg, n, clone);
}
}
}
});
// Only actually deleted snapshot scope nodes should remain.
verifyDeletedScopeNodes(passNameMsg, snapshotScopeNodes);
} | [
"private",
"void",
"verifyScopeChangesHaveBeenRecorded",
"(",
"String",
"passName",
",",
"Node",
"root",
")",
"{",
"final",
"String",
"passNameMsg",
"=",
"passName",
".",
"isEmpty",
"(",
")",
"?",
"\"\"",
":",
"passName",
"+",
"\": \"",
";",
"// Gather all the scope nodes that existed when the snapshot was taken.",
"final",
"Set",
"<",
"Node",
">",
"snapshotScopeNodes",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"NodeUtil",
".",
"visitPreOrder",
"(",
"clonesByCurrent",
".",
"get",
"(",
"root",
")",
",",
"new",
"Visitor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"visit",
"(",
"Node",
"oldNode",
")",
"{",
"if",
"(",
"NodeUtil",
".",
"isChangeScopeRoot",
"(",
"oldNode",
")",
")",
"{",
"snapshotScopeNodes",
".",
"add",
"(",
"oldNode",
")",
";",
"}",
"}",
"}",
")",
";",
"NodeUtil",
".",
"visitPreOrder",
"(",
"root",
",",
"new",
"Visitor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"visit",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"n",
".",
"isRoot",
"(",
")",
")",
"{",
"verifyRoot",
"(",
"n",
")",
";",
"}",
"else",
"if",
"(",
"NodeUtil",
".",
"isChangeScopeRoot",
"(",
"n",
")",
")",
"{",
"Node",
"clone",
"=",
"clonesByCurrent",
".",
"get",
"(",
"n",
")",
";",
"// Remove any scope nodes that still exist.",
"snapshotScopeNodes",
".",
"remove",
"(",
"clone",
")",
";",
"verifyNode",
"(",
"passNameMsg",
",",
"n",
")",
";",
"if",
"(",
"clone",
"==",
"null",
")",
"{",
"verifyNewNode",
"(",
"passNameMsg",
",",
"n",
")",
";",
"}",
"else",
"{",
"verifyNodeChange",
"(",
"passNameMsg",
",",
"n",
",",
"clone",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"// Only actually deleted snapshot scope nodes should remain.",
"verifyDeletedScopeNodes",
"(",
"passNameMsg",
",",
"snapshotScopeNodes",
")",
";",
"}"
]
| Checks that the scope roots marked as changed have indeed changed | [
"Checks",
"that",
"the",
"scope",
"roots",
"marked",
"as",
"changed",
"have",
"indeed",
"changed"
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ChangeVerifier.java#L78-L117 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java | SourceToHTMLConverter.convertPackage | public void convertPackage(PackageDoc pd, DocPath outputdir) {
"""
Convert the Classes in the given Package to an HTML.
@param pd the Package to convert.
@param outputdir the name of the directory to output to.
"""
if (pd == null) {
return;
}
for (ClassDoc cd : pd.allClasses()) {
// If -nodeprecated option is set and the class is marked as deprecated,
// do not convert the package files to HTML. We do not check for
// containing package deprecation since it is already check in
// the calling method above.
if (!(configuration.nodeprecated && utils.isDeprecated(cd)))
convertClass(cd, outputdir);
}
} | java | public void convertPackage(PackageDoc pd, DocPath outputdir) {
if (pd == null) {
return;
}
for (ClassDoc cd : pd.allClasses()) {
// If -nodeprecated option is set and the class is marked as deprecated,
// do not convert the package files to HTML. We do not check for
// containing package deprecation since it is already check in
// the calling method above.
if (!(configuration.nodeprecated && utils.isDeprecated(cd)))
convertClass(cd, outputdir);
}
} | [
"public",
"void",
"convertPackage",
"(",
"PackageDoc",
"pd",
",",
"DocPath",
"outputdir",
")",
"{",
"if",
"(",
"pd",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"ClassDoc",
"cd",
":",
"pd",
".",
"allClasses",
"(",
")",
")",
"{",
"// If -nodeprecated option is set and the class is marked as deprecated,",
"// do not convert the package files to HTML. We do not check for",
"// containing package deprecation since it is already check in",
"// the calling method above.",
"if",
"(",
"!",
"(",
"configuration",
".",
"nodeprecated",
"&&",
"utils",
".",
"isDeprecated",
"(",
"cd",
")",
")",
")",
"convertClass",
"(",
"cd",
",",
"outputdir",
")",
";",
"}",
"}"
]
| Convert the Classes in the given Package to an HTML.
@param pd the Package to convert.
@param outputdir the name of the directory to output to. | [
"Convert",
"the",
"Classes",
"in",
"the",
"given",
"Package",
"to",
"an",
"HTML",
"."
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java#L124-L136 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java | WriteFileExtensions.write2File | public static void write2File(final String inputFile, final String outputFile)
throws FileNotFoundException, IOException {
"""
The Method write2File(String, String) copys a file from one filename to another.
@param inputFile
The Name from the File to read and copy.
@param outputFile
The Name from the File to write into.
@throws FileNotFoundException
is thrown if an attempt to open the file denoted by a specified pathname has
failed.
@throws IOException
Signals that an I/O exception has occurred.
"""
try (FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
StreamExtensions.writeInputStreamToOutputStream(bis, bos);
}
} | java | public static void write2File(final String inputFile, final String outputFile)
throws FileNotFoundException, IOException
{
try (FileInputStream fis = new FileInputStream(inputFile);
FileOutputStream fos = new FileOutputStream(outputFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
StreamExtensions.writeInputStreamToOutputStream(bis, bos);
}
} | [
"public",
"static",
"void",
"write2File",
"(",
"final",
"String",
"inputFile",
",",
"final",
"String",
"outputFile",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"inputFile",
")",
";",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"BufferedInputStream",
"bis",
"=",
"new",
"BufferedInputStream",
"(",
"fis",
")",
";",
"BufferedOutputStream",
"bos",
"=",
"new",
"BufferedOutputStream",
"(",
"fos",
")",
";",
")",
"{",
"StreamExtensions",
".",
"writeInputStreamToOutputStream",
"(",
"bis",
",",
"bos",
")",
";",
"}",
"}"
]
| The Method write2File(String, String) copys a file from one filename to another.
@param inputFile
The Name from the File to read and copy.
@param outputFile
The Name from the File to write into.
@throws FileNotFoundException
is thrown if an attempt to open the file denoted by a specified pathname has
failed.
@throws IOException
Signals that an I/O exception has occurred. | [
"The",
"Method",
"write2File",
"(",
"String",
"String",
")",
"copys",
"a",
"file",
"from",
"one",
"filename",
"to",
"another",
"."
]
| train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L230-L240 |
paymill/paymill-java | src/main/java/com/paymill/services/SubscriptionService.java | SubscriptionService.changeOfferKeepCaptureDateAndRefund | public Subscription changeOfferKeepCaptureDateAndRefund( String subscription, Offer offer ) {
"""
Change the offer of a subscription.<br>
<br>
The plan will be changed immediately.The next_capture_at date will remain unchanged. A refund will be given if
due.<br>
If the new amount is higher than the old one, there will be no additional charge. The next charge date will not
change. If the new amount is less then the old one, a refund happens. The next charge date will not change.<br>
<strong>IMPORTANT</strong><br>
Permitted up only until one day (24 hours) before the next charge date.<br>
@param subscription the subscription
@param offer the new offer
@return the updated subscription
"""
return changeOfferKeepCaptureDateAndRefund( new Subscription( subscription ), offer );
} | java | public Subscription changeOfferKeepCaptureDateAndRefund( String subscription, Offer offer ) {
return changeOfferKeepCaptureDateAndRefund( new Subscription( subscription ), offer );
} | [
"public",
"Subscription",
"changeOfferKeepCaptureDateAndRefund",
"(",
"String",
"subscription",
",",
"Offer",
"offer",
")",
"{",
"return",
"changeOfferKeepCaptureDateAndRefund",
"(",
"new",
"Subscription",
"(",
"subscription",
")",
",",
"offer",
")",
";",
"}"
]
| Change the offer of a subscription.<br>
<br>
The plan will be changed immediately.The next_capture_at date will remain unchanged. A refund will be given if
due.<br>
If the new amount is higher than the old one, there will be no additional charge. The next charge date will not
change. If the new amount is less then the old one, a refund happens. The next charge date will not change.<br>
<strong>IMPORTANT</strong><br>
Permitted up only until one day (24 hours) before the next charge date.<br>
@param subscription the subscription
@param offer the new offer
@return the updated subscription | [
"Change",
"the",
"offer",
"of",
"a",
"subscription",
".",
"<br",
">",
"<br",
">",
"The",
"plan",
"will",
"be",
"changed",
"immediately",
".",
"The",
"next_capture_at",
"date",
"will",
"remain",
"unchanged",
".",
"A",
"refund",
"will",
"be",
"given",
"if",
"due",
".",
"<br",
">",
"If",
"the",
"new",
"amount",
"is",
"higher",
"than",
"the",
"old",
"one",
"there",
"will",
"be",
"no",
"additional",
"charge",
".",
"The",
"next",
"charge",
"date",
"will",
"not",
"change",
".",
"If",
"the",
"new",
"amount",
"is",
"less",
"then",
"the",
"old",
"one",
"a",
"refund",
"happens",
".",
"The",
"next",
"charge",
"date",
"will",
"not",
"change",
".",
"<br",
">",
"<strong",
">",
"IMPORTANT<",
"/",
"strong",
">",
"<br",
">",
"Permitted",
"up",
"only",
"until",
"one",
"day",
"(",
"24",
"hours",
")",
"before",
"the",
"next",
"charge",
"date",
".",
"<br",
">"
]
| train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L456-L458 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.findAndModify | public T findAndModify(DBObject query, DBObject fields, DBObject sort, boolean remove, DBUpdate.Builder update, boolean returnNew, boolean upsert) {
"""
Finds the first document in the query and updates it.
@param query query to match
@param fields fields to be returned
@param sort sort to apply before picking first document
@param remove if true, document found will be removed
@param update update to apply
@param returnNew if true, the updated document is returned, otherwise the old document is returned (or it would be lost forever)
@param upsert do upsert (insert if document not present)
@return the object
"""
return convertFromDbObject(dbCollection.findAndModify(serializeFields(query), fields, sort, remove, update.serialiseAndGet(objectMapper), returnNew, upsert));
} | java | public T findAndModify(DBObject query, DBObject fields, DBObject sort, boolean remove, DBUpdate.Builder update, boolean returnNew, boolean upsert) {
return convertFromDbObject(dbCollection.findAndModify(serializeFields(query), fields, sort, remove, update.serialiseAndGet(objectMapper), returnNew, upsert));
} | [
"public",
"T",
"findAndModify",
"(",
"DBObject",
"query",
",",
"DBObject",
"fields",
",",
"DBObject",
"sort",
",",
"boolean",
"remove",
",",
"DBUpdate",
".",
"Builder",
"update",
",",
"boolean",
"returnNew",
",",
"boolean",
"upsert",
")",
"{",
"return",
"convertFromDbObject",
"(",
"dbCollection",
".",
"findAndModify",
"(",
"serializeFields",
"(",
"query",
")",
",",
"fields",
",",
"sort",
",",
"remove",
",",
"update",
".",
"serialiseAndGet",
"(",
"objectMapper",
")",
",",
"returnNew",
",",
"upsert",
")",
")",
";",
"}"
]
| Finds the first document in the query and updates it.
@param query query to match
@param fields fields to be returned
@param sort sort to apply before picking first document
@param remove if true, document found will be removed
@param update update to apply
@param returnNew if true, the updated document is returned, otherwise the old document is returned (or it would be lost forever)
@param upsert do upsert (insert if document not present)
@return the object | [
"Finds",
"the",
"first",
"document",
"in",
"the",
"query",
"and",
"updates",
"it",
"."
]
| train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L597-L599 |
Hygieia/Hygieia | api/src/main/java/com/capitalone/dashboard/service/DynamicPipelineServiceImpl.java | DynamicPipelineServiceImpl.applyStageTimestamps | private PipelineResponseCommit applyStageTimestamps(PipelineResponseCommit commit, Dashboard dashboard, Pipeline pipeline,List<PipelineStage> pipelineStageList) {
"""
For a given commit, will traverse the pipeline and find the time it entered in each stage of the pipeline
@param commit
@param dashboard
@param pipeline
@return
"""
PipelineResponseCommit returnCommit = new PipelineResponseCommit(commit);
for(PipelineStage systemStage : pipelineStageList) {
//get commits for a given stage
Map<String, PipelineCommit> commitMap = findCommitsForStage(dashboard, pipeline, systemStage);
//if this commit doesnt have a processed timestamp for this stage, add one
PipelineCommit pipelineCommit = commitMap.get(commit.getScmRevisionNumber());
if(pipelineCommit != null && !returnCommit.getProcessedTimestamps().containsKey(systemStage.getName())){
Long timestamp = pipelineCommit.getTimestamp();
returnCommit.addNewPipelineProcessedTimestamp(systemStage, timestamp);
}
}
return returnCommit;
} | java | private PipelineResponseCommit applyStageTimestamps(PipelineResponseCommit commit, Dashboard dashboard, Pipeline pipeline,List<PipelineStage> pipelineStageList){
PipelineResponseCommit returnCommit = new PipelineResponseCommit(commit);
for(PipelineStage systemStage : pipelineStageList) {
//get commits for a given stage
Map<String, PipelineCommit> commitMap = findCommitsForStage(dashboard, pipeline, systemStage);
//if this commit doesnt have a processed timestamp for this stage, add one
PipelineCommit pipelineCommit = commitMap.get(commit.getScmRevisionNumber());
if(pipelineCommit != null && !returnCommit.getProcessedTimestamps().containsKey(systemStage.getName())){
Long timestamp = pipelineCommit.getTimestamp();
returnCommit.addNewPipelineProcessedTimestamp(systemStage, timestamp);
}
}
return returnCommit;
} | [
"private",
"PipelineResponseCommit",
"applyStageTimestamps",
"(",
"PipelineResponseCommit",
"commit",
",",
"Dashboard",
"dashboard",
",",
"Pipeline",
"pipeline",
",",
"List",
"<",
"PipelineStage",
">",
"pipelineStageList",
")",
"{",
"PipelineResponseCommit",
"returnCommit",
"=",
"new",
"PipelineResponseCommit",
"(",
"commit",
")",
";",
"for",
"(",
"PipelineStage",
"systemStage",
":",
"pipelineStageList",
")",
"{",
"//get commits for a given stage\r",
"Map",
"<",
"String",
",",
"PipelineCommit",
">",
"commitMap",
"=",
"findCommitsForStage",
"(",
"dashboard",
",",
"pipeline",
",",
"systemStage",
")",
";",
"//if this commit doesnt have a processed timestamp for this stage, add one\r",
"PipelineCommit",
"pipelineCommit",
"=",
"commitMap",
".",
"get",
"(",
"commit",
".",
"getScmRevisionNumber",
"(",
")",
")",
";",
"if",
"(",
"pipelineCommit",
"!=",
"null",
"&&",
"!",
"returnCommit",
".",
"getProcessedTimestamps",
"(",
")",
".",
"containsKey",
"(",
"systemStage",
".",
"getName",
"(",
")",
")",
")",
"{",
"Long",
"timestamp",
"=",
"pipelineCommit",
".",
"getTimestamp",
"(",
")",
";",
"returnCommit",
".",
"addNewPipelineProcessedTimestamp",
"(",
"systemStage",
",",
"timestamp",
")",
";",
"}",
"}",
"return",
"returnCommit",
";",
"}"
]
| For a given commit, will traverse the pipeline and find the time it entered in each stage of the pipeline
@param commit
@param dashboard
@param pipeline
@return | [
"For",
"a",
"given",
"commit",
"will",
"traverse",
"the",
"pipeline",
"and",
"find",
"the",
"time",
"it",
"entered",
"in",
"each",
"stage",
"of",
"the",
"pipeline"
]
| train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/DynamicPipelineServiceImpl.java#L873-L888 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java | GVRTransform.setScale | public GVRTransform setScale(float x, float y, float z) {
"""
Set [X, Y, Z] current scale
@param x
Scaling factor on the 'X' axis.
@param y
Scaling factor on the 'Y' axis.
@param z
Scaling factor on the 'Z' axis.
"""
NativeTransform.setScale(getNative(), x, y, z);
return this;
} | java | public GVRTransform setScale(float x, float y, float z) {
NativeTransform.setScale(getNative(), x, y, z);
return this;
} | [
"public",
"GVRTransform",
"setScale",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"NativeTransform",
".",
"setScale",
"(",
"getNative",
"(",
")",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"return",
"this",
";",
"}"
]
| Set [X, Y, Z] current scale
@param x
Scaling factor on the 'X' axis.
@param y
Scaling factor on the 'Y' axis.
@param z
Scaling factor on the 'Z' axis. | [
"Set",
"[",
"X",
"Y",
"Z",
"]",
"current",
"scale"
]
| train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java#L263-L266 |
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 {
"""
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
"""
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",
",",
"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",
";",
"}"
]
| 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 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLSchemaManager.java | CQLSchemaManager.modifyKeyspace | public void modifyKeyspace(Map<String, String> options) {
"""
Modify the keyspace with the given name with the given options. The only option
that can be modified is ReplicationFactor. If it is present, the keyspace is
altered with the following CQL command:
<pre>
ALTER KEYSPACE "<i>keyspace</i>" WITH REPLICATION = {'class':'SimpleStrategy',
'replication_factor' : <i>replication_factor</i> };
</pre>
@param options Modified options to use for keyspace. Only the option
"replication_factor" is examined.
"""
if (!options.containsKey("ReplicationFactor")) {
return;
}
String cqlKeyspace = m_dbservice.getKeyspace();
m_logger.info("Modifying keyspace: {}", cqlKeyspace);
StringBuilder cql = new StringBuilder();
cql.append("ALTER KEYSPACE ");
cql.append(cqlKeyspace);
cql.append(" WITH REPLICATION = {'class':'");
String strategyClass = "SimpleStrategy";
Map<String, Object> ksDefs = m_dbservice.getParamMap("ks_defaults");
if (ksDefs != null && ksDefs.containsKey("strategy_class")) {
strategyClass = ksDefs.get("strategy_class").toString();
}
cql.append(strategyClass);
cql.append("','replication_factor':");
cql.append(options.get("ReplicationFactor"));
cql.append("};");
executeCQL(cql.toString());
} | java | public void modifyKeyspace(Map<String, String> options) {
if (!options.containsKey("ReplicationFactor")) {
return;
}
String cqlKeyspace = m_dbservice.getKeyspace();
m_logger.info("Modifying keyspace: {}", cqlKeyspace);
StringBuilder cql = new StringBuilder();
cql.append("ALTER KEYSPACE ");
cql.append(cqlKeyspace);
cql.append(" WITH REPLICATION = {'class':'");
String strategyClass = "SimpleStrategy";
Map<String, Object> ksDefs = m_dbservice.getParamMap("ks_defaults");
if (ksDefs != null && ksDefs.containsKey("strategy_class")) {
strategyClass = ksDefs.get("strategy_class").toString();
}
cql.append(strategyClass);
cql.append("','replication_factor':");
cql.append(options.get("ReplicationFactor"));
cql.append("};");
executeCQL(cql.toString());
} | [
"public",
"void",
"modifyKeyspace",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"containsKey",
"(",
"\"ReplicationFactor\"",
")",
")",
"{",
"return",
";",
"}",
"String",
"cqlKeyspace",
"=",
"m_dbservice",
".",
"getKeyspace",
"(",
")",
";",
"m_logger",
".",
"info",
"(",
"\"Modifying keyspace: {}\"",
",",
"cqlKeyspace",
")",
";",
"StringBuilder",
"cql",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"cql",
".",
"append",
"(",
"\"ALTER KEYSPACE \"",
")",
";",
"cql",
".",
"append",
"(",
"cqlKeyspace",
")",
";",
"cql",
".",
"append",
"(",
"\" WITH REPLICATION = {'class':'\"",
")",
";",
"String",
"strategyClass",
"=",
"\"SimpleStrategy\"",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"ksDefs",
"=",
"m_dbservice",
".",
"getParamMap",
"(",
"\"ks_defaults\"",
")",
";",
"if",
"(",
"ksDefs",
"!=",
"null",
"&&",
"ksDefs",
".",
"containsKey",
"(",
"\"strategy_class\"",
")",
")",
"{",
"strategyClass",
"=",
"ksDefs",
".",
"get",
"(",
"\"strategy_class\"",
")",
".",
"toString",
"(",
")",
";",
"}",
"cql",
".",
"append",
"(",
"strategyClass",
")",
";",
"cql",
".",
"append",
"(",
"\"','replication_factor':\"",
")",
";",
"cql",
".",
"append",
"(",
"options",
".",
"get",
"(",
"\"ReplicationFactor\"",
")",
")",
";",
"cql",
".",
"append",
"(",
"\"};\"",
")",
";",
"executeCQL",
"(",
"cql",
".",
"toString",
"(",
")",
")",
";",
"}"
]
| Modify the keyspace with the given name with the given options. The only option
that can be modified is ReplicationFactor. If it is present, the keyspace is
altered with the following CQL command:
<pre>
ALTER KEYSPACE "<i>keyspace</i>" WITH REPLICATION = {'class':'SimpleStrategy',
'replication_factor' : <i>replication_factor</i> };
</pre>
@param options Modified options to use for keyspace. Only the option
"replication_factor" is examined. | [
"Modify",
"the",
"keyspace",
"with",
"the",
"given",
"name",
"with",
"the",
"given",
"options",
".",
"The",
"only",
"option",
"that",
"can",
"be",
"modified",
"is",
"ReplicationFactor",
".",
"If",
"it",
"is",
"present",
"the",
"keyspace",
"is",
"altered",
"with",
"the",
"following",
"CQL",
"command",
":",
"<pre",
">",
"ALTER",
"KEYSPACE",
"<i",
">",
"keyspace<",
"/",
"i",
">",
"WITH",
"REPLICATION",
"=",
"{",
"class",
":",
"SimpleStrategy",
"replication_factor",
":",
"<i",
">",
"replication_factor<",
"/",
"i",
">",
"}",
";",
"<",
"/",
"pre",
">"
]
| train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLSchemaManager.java#L72-L92 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/RadioCheckField.java | RadioCheckField.getRadioGroup | public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison) {
"""
Gets a radio group. It's composed of the field specific keys, without the widget
ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) addKid()}.
@param noToggleToOff if <CODE>true</CODE>, exactly one radio button must be selected at all
times; clicking the currently selected button has no effect.
If <CODE>false</CODE>, clicking
the selected button deselects it, leaving no button selected.
@param radiosInUnison if <CODE>true</CODE>, a group of radio buttons within a radio button field that
use the same value for the on state will turn on and off in unison; that is if
one is checked, they are all checked. If <CODE>false</CODE>, the buttons are mutually exclusive
(the same behavior as HTML radio buttons)
@return the radio group
"""
PdfFormField field = PdfFormField.createRadioButton(writer, noToggleToOff);
if (radiosInUnison)
field.setFieldFlags(PdfFormField.FF_RADIOSINUNISON);
field.setFieldName(fieldName);
if ((options & READ_ONLY) != 0)
field.setFieldFlags(PdfFormField.FF_READ_ONLY);
if ((options & REQUIRED) != 0)
field.setFieldFlags(PdfFormField.FF_REQUIRED);
field.setValueAsName(checked ? onValue : "Off");
return field;
} | java | public PdfFormField getRadioGroup(boolean noToggleToOff, boolean radiosInUnison) {
PdfFormField field = PdfFormField.createRadioButton(writer, noToggleToOff);
if (radiosInUnison)
field.setFieldFlags(PdfFormField.FF_RADIOSINUNISON);
field.setFieldName(fieldName);
if ((options & READ_ONLY) != 0)
field.setFieldFlags(PdfFormField.FF_READ_ONLY);
if ((options & REQUIRED) != 0)
field.setFieldFlags(PdfFormField.FF_REQUIRED);
field.setValueAsName(checked ? onValue : "Off");
return field;
} | [
"public",
"PdfFormField",
"getRadioGroup",
"(",
"boolean",
"noToggleToOff",
",",
"boolean",
"radiosInUnison",
")",
"{",
"PdfFormField",
"field",
"=",
"PdfFormField",
".",
"createRadioButton",
"(",
"writer",
",",
"noToggleToOff",
")",
";",
"if",
"(",
"radiosInUnison",
")",
"field",
".",
"setFieldFlags",
"(",
"PdfFormField",
".",
"FF_RADIOSINUNISON",
")",
";",
"field",
".",
"setFieldName",
"(",
"fieldName",
")",
";",
"if",
"(",
"(",
"options",
"&",
"READ_ONLY",
")",
"!=",
"0",
")",
"field",
".",
"setFieldFlags",
"(",
"PdfFormField",
".",
"FF_READ_ONLY",
")",
";",
"if",
"(",
"(",
"options",
"&",
"REQUIRED",
")",
"!=",
"0",
")",
"field",
".",
"setFieldFlags",
"(",
"PdfFormField",
".",
"FF_REQUIRED",
")",
";",
"field",
".",
"setValueAsName",
"(",
"checked",
"?",
"onValue",
":",
"\"Off\"",
")",
";",
"return",
"field",
";",
"}"
]
| Gets a radio group. It's composed of the field specific keys, without the widget
ones. This field is to be used as a field aggregator with {@link PdfFormField#addKid(PdfFormField) addKid()}.
@param noToggleToOff if <CODE>true</CODE>, exactly one radio button must be selected at all
times; clicking the currently selected button has no effect.
If <CODE>false</CODE>, clicking
the selected button deselects it, leaving no button selected.
@param radiosInUnison if <CODE>true</CODE>, a group of radio buttons within a radio button field that
use the same value for the on state will turn on and off in unison; that is if
one is checked, they are all checked. If <CODE>false</CODE>, the buttons are mutually exclusive
(the same behavior as HTML radio buttons)
@return the radio group | [
"Gets",
"a",
"radio",
"group",
".",
"It",
"s",
"composed",
"of",
"the",
"field",
"specific",
"keys",
"without",
"the",
"widget",
"ones",
".",
"This",
"field",
"is",
"to",
"be",
"used",
"as",
"a",
"field",
"aggregator",
"with",
"{"
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/RadioCheckField.java#L324-L335 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java | RamlTypeHelper.annotateDateWithPattern | public static void annotateDateWithPattern(JAnnotationUse jAnnotationUse, String type, String format) {
"""
Adds appropriate <code>pattern</code> attribute to provided annotation on
{@link Date} property.
@param jAnnotationUse
annotation to add pattern. Can be for: {@link JsonFormat} or
{@link DateTimeFormat}
@param type
RAML type of the property
@param format
of date if specified
"""
String param = type.toUpperCase();
switch (param) {
case "DATE-ONLY":
// example: 2013-09-29
jAnnotationUse.param("pattern", "yyyy-MM-dd");
break;
case "TIME-ONLY":
// example: 19:46:19
jAnnotationUse.param("pattern", "HH:mm:ss");
break;
case "DATETIME-ONLY":
// example: 2013-09-29T19:46:19
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ss");
break;
case "DATETIME":
if ("rfc2616".equalsIgnoreCase(format)) {
// example: Tue, 15 Nov 1994 12:45:26 GMT
jAnnotationUse.param("pattern", "EEE, dd MMM yyyy HH:mm:ss z");
} else {
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ssXXX");
}
break;
default:
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ss");
}
} | java | public static void annotateDateWithPattern(JAnnotationUse jAnnotationUse, String type, String format) {
String param = type.toUpperCase();
switch (param) {
case "DATE-ONLY":
// example: 2013-09-29
jAnnotationUse.param("pattern", "yyyy-MM-dd");
break;
case "TIME-ONLY":
// example: 19:46:19
jAnnotationUse.param("pattern", "HH:mm:ss");
break;
case "DATETIME-ONLY":
// example: 2013-09-29T19:46:19
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ss");
break;
case "DATETIME":
if ("rfc2616".equalsIgnoreCase(format)) {
// example: Tue, 15 Nov 1994 12:45:26 GMT
jAnnotationUse.param("pattern", "EEE, dd MMM yyyy HH:mm:ss z");
} else {
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ssXXX");
}
break;
default:
jAnnotationUse.param("pattern", "yyyy-MM-dd'T'HH:mm:ss");
}
} | [
"public",
"static",
"void",
"annotateDateWithPattern",
"(",
"JAnnotationUse",
"jAnnotationUse",
",",
"String",
"type",
",",
"String",
"format",
")",
"{",
"String",
"param",
"=",
"type",
".",
"toUpperCase",
"(",
")",
";",
"switch",
"(",
"param",
")",
"{",
"case",
"\"DATE-ONLY\"",
":",
"// example: 2013-09-29",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"yyyy-MM-dd\"",
")",
";",
"break",
";",
"case",
"\"TIME-ONLY\"",
":",
"// example: 19:46:19",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"HH:mm:ss\"",
")",
";",
"break",
";",
"case",
"\"DATETIME-ONLY\"",
":",
"// example: 2013-09-29T19:46:19",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"yyyy-MM-dd'T'HH:mm:ss\"",
")",
";",
"break",
";",
"case",
"\"DATETIME\"",
":",
"if",
"(",
"\"rfc2616\"",
".",
"equalsIgnoreCase",
"(",
"format",
")",
")",
"{",
"// example: Tue, 15 Nov 1994 12:45:26 GMT",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"EEE, dd MMM yyyy HH:mm:ss z\"",
")",
";",
"}",
"else",
"{",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"yyyy-MM-dd'T'HH:mm:ssXXX\"",
")",
";",
"}",
"break",
";",
"default",
":",
"jAnnotationUse",
".",
"param",
"(",
"\"pattern\"",
",",
"\"yyyy-MM-dd'T'HH:mm:ss\"",
")",
";",
"}",
"}"
]
| Adds appropriate <code>pattern</code> attribute to provided annotation on
{@link Date} property.
@param jAnnotationUse
annotation to add pattern. Can be for: {@link JsonFormat} or
{@link DateTimeFormat}
@param type
RAML type of the property
@param format
of date if specified | [
"Adds",
"appropriate",
"<code",
">",
"pattern<",
"/",
"code",
">",
"attribute",
"to",
"provided",
"annotation",
"on",
"{",
"@link",
"Date",
"}",
"property",
"."
]
| train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/RamlTypeHelper.java#L243-L270 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CECalendar.java | CECalendar.ceToJD | public static int ceToJD(long year, int month, int day, int jdEpochOffset) {
"""
Convert an Coptic/Ethiopic year, month and day to a Julian day
@param year the extended year
@param month the month
@param day the day
@return Julian day
@hide unsupported on Android
"""
// Julian<->Ethiopic algorithms from:
// "Calendars in Ethiopia", Berhanu Beyene, Manfred Kudlek, International Conference
// of Ethiopian Studies XV, Hamburg, 2003
// handle month > 12, < 0 (e.g. from add/set)
if ( month >= 0 ) {
year += month/13;
month %= 13;
} else {
++month;
year += month/13 - 1;
month = month%13 + 12;
}
return (int) (
jdEpochOffset // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ floorDivide(year, 4) // extra day of leap year
+ 30 * month // number of days from months (months are 0-based)
+ day - 1 // number of days for present month (1 based)
);
} | java | public static int ceToJD(long year, int month, int day, int jdEpochOffset) {
// Julian<->Ethiopic algorithms from:
// "Calendars in Ethiopia", Berhanu Beyene, Manfred Kudlek, International Conference
// of Ethiopian Studies XV, Hamburg, 2003
// handle month > 12, < 0 (e.g. from add/set)
if ( month >= 0 ) {
year += month/13;
month %= 13;
} else {
++month;
year += month/13 - 1;
month = month%13 + 12;
}
return (int) (
jdEpochOffset // difference from Julian epoch to 1,1,1
+ 365 * year // number of days from years
+ floorDivide(year, 4) // extra day of leap year
+ 30 * month // number of days from months (months are 0-based)
+ day - 1 // number of days for present month (1 based)
);
} | [
"public",
"static",
"int",
"ceToJD",
"(",
"long",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"jdEpochOffset",
")",
"{",
"// Julian<->Ethiopic algorithms from:",
"// \"Calendars in Ethiopia\", Berhanu Beyene, Manfred Kudlek, International Conference",
"// of Ethiopian Studies XV, Hamburg, 2003",
"// handle month > 12, < 0 (e.g. from add/set)",
"if",
"(",
"month",
">=",
"0",
")",
"{",
"year",
"+=",
"month",
"/",
"13",
";",
"month",
"%=",
"13",
";",
"}",
"else",
"{",
"++",
"month",
";",
"year",
"+=",
"month",
"/",
"13",
"-",
"1",
";",
"month",
"=",
"month",
"%",
"13",
"+",
"12",
";",
"}",
"return",
"(",
"int",
")",
"(",
"jdEpochOffset",
"// difference from Julian epoch to 1,1,1",
"+",
"365",
"*",
"year",
"// number of days from years",
"+",
"floorDivide",
"(",
"year",
",",
"4",
")",
"// extra day of leap year",
"+",
"30",
"*",
"month",
"// number of days from months (months are 0-based)",
"+",
"day",
"-",
"1",
"// number of days for present month (1 based)",
")",
";",
"}"
]
| Convert an Coptic/Ethiopic year, month and day to a Julian day
@param year the extended year
@param month the month
@param day the day
@return Julian day
@hide unsupported on Android | [
"Convert",
"an",
"Coptic",
"/",
"Ethiopic",
"year",
"month",
"and",
"day",
"to",
"a",
"Julian",
"day"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CECalendar.java#L236-L258 |
twitter/chill | chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java | ConfiguredInstantiator.setSerialized | public static void setSerialized(Config conf, KryoInstantiator ki)
throws ConfigurationException {
"""
Use the default KryoInstantiator to serialize the KryoInstantiator ki
same as: setSerialized(conf, KryoInstantiator.class, ki)
"""
setSerialized(conf, KryoInstantiator.class, ki);
} | java | public static void setSerialized(Config conf, KryoInstantiator ki)
throws ConfigurationException {
setSerialized(conf, KryoInstantiator.class, ki);
} | [
"public",
"static",
"void",
"setSerialized",
"(",
"Config",
"conf",
",",
"KryoInstantiator",
"ki",
")",
"throws",
"ConfigurationException",
"{",
"setSerialized",
"(",
"conf",
",",
"KryoInstantiator",
".",
"class",
",",
"ki",
")",
";",
"}"
]
| Use the default KryoInstantiator to serialize the KryoInstantiator ki
same as: setSerialized(conf, KryoInstantiator.class, ki) | [
"Use",
"the",
"default",
"KryoInstantiator",
"to",
"serialize",
"the",
"KryoInstantiator",
"ki",
"same",
"as",
":",
"setSerialized",
"(",
"conf",
"KryoInstantiator",
".",
"class",
"ki",
")"
]
| train | https://github.com/twitter/chill/blob/0919984ec3aeb320ff522911c726425e9f18ea41/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java#L120-L123 |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java | VicariousThreadLocal.runWith | public void runWith(T value, Runnable doRun) {
"""
Executes task with thread-local set to the specified value. The state is restored however the task exits. If
uninitialised before running the task, it will remain so upon exiting. Setting the thread-local within the task
does not affect the state after exitign.
"""
WeakReference<Holder> ref = local.get();
Holder holder = ref != null ? ref.get() : createHolder();
Object oldValue = holder.value;
holder.value = value;
try {
doRun.run();
} finally {
holder.value = oldValue;
}
} | java | public void runWith(T value, Runnable doRun) {
WeakReference<Holder> ref = local.get();
Holder holder = ref != null ? ref.get() : createHolder();
Object oldValue = holder.value;
holder.value = value;
try {
doRun.run();
} finally {
holder.value = oldValue;
}
} | [
"public",
"void",
"runWith",
"(",
"T",
"value",
",",
"Runnable",
"doRun",
")",
"{",
"WeakReference",
"<",
"Holder",
">",
"ref",
"=",
"local",
".",
"get",
"(",
")",
";",
"Holder",
"holder",
"=",
"ref",
"!=",
"null",
"?",
"ref",
".",
"get",
"(",
")",
":",
"createHolder",
"(",
")",
";",
"Object",
"oldValue",
"=",
"holder",
".",
"value",
";",
"holder",
".",
"value",
"=",
"value",
";",
"try",
"{",
"doRun",
".",
"run",
"(",
")",
";",
"}",
"finally",
"{",
"holder",
".",
"value",
"=",
"oldValue",
";",
"}",
"}"
]
| Executes task with thread-local set to the specified value. The state is restored however the task exits. If
uninitialised before running the task, it will remain so upon exiting. Setting the thread-local within the task
does not affect the state after exitign. | [
"Executes",
"task",
"with",
"thread",
"-",
"local",
"set",
"to",
"the",
"specified",
"value",
".",
"The",
"state",
"is",
"restored",
"however",
"the",
"task",
"exits",
".",
"If",
"uninitialised",
"before",
"running",
"the",
"task",
"it",
"will",
"remain",
"so",
"upon",
"exiting",
".",
"Setting",
"the",
"thread",
"-",
"local",
"within",
"the",
"task",
"does",
"not",
"affect",
"the",
"state",
"after",
"exitign",
"."
]
| train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L241-L251 |
elki-project/elki | elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java | DBIDUtil.randomSample | public static ModifiableDBIDs randomSample(DBIDs source, int k, int seed) {
"""
Produce a random sample of the given DBIDs.
@param source Original DBIDs, no duplicates allowed
@param k k Parameter
@param seed Random generator seed
@return new DBIDs
"""
return randomSample(source, k, new Random(seed));
} | java | public static ModifiableDBIDs randomSample(DBIDs source, int k, int seed) {
return randomSample(source, k, new Random(seed));
} | [
"public",
"static",
"ModifiableDBIDs",
"randomSample",
"(",
"DBIDs",
"source",
",",
"int",
"k",
",",
"int",
"seed",
")",
"{",
"return",
"randomSample",
"(",
"source",
",",
"k",
",",
"new",
"Random",
"(",
"seed",
")",
")",
";",
"}"
]
| Produce a random sample of the given DBIDs.
@param source Original DBIDs, no duplicates allowed
@param k k Parameter
@param seed Random generator seed
@return new DBIDs | [
"Produce",
"a",
"random",
"sample",
"of",
"the",
"given",
"DBIDs",
"."
]
| train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L549-L551 |
apigee/usergrid-java-sdk | src/main/java/org/usergrid/java/client/Client.java | Client.createGroup | public ApiResponse createGroup(String groupPath, String groupTitle) {
"""
Creates a group with the specified group path and group title. Group
paths can be slash ("/") delimited like file paths for hierarchical group
relationships.
@param groupPath
@param groupTitle
@return
"""
return createGroup(groupPath, groupTitle, null);
} | java | public ApiResponse createGroup(String groupPath, String groupTitle) {
return createGroup(groupPath, groupTitle, null);
} | [
"public",
"ApiResponse",
"createGroup",
"(",
"String",
"groupPath",
",",
"String",
"groupTitle",
")",
"{",
"return",
"createGroup",
"(",
"groupPath",
",",
"groupTitle",
",",
"null",
")",
";",
"}"
]
| Creates a group with the specified group path and group title. Group
paths can be slash ("/") delimited like file paths for hierarchical group
relationships.
@param groupPath
@param groupTitle
@return | [
"Creates",
"a",
"group",
"with",
"the",
"specified",
"group",
"path",
"and",
"group",
"title",
".",
"Group",
"paths",
"can",
"be",
"slash",
"(",
"/",
")",
"delimited",
"like",
"file",
"paths",
"for",
"hierarchical",
"group",
"relationships",
"."
]
| train | https://github.com/apigee/usergrid-java-sdk/blob/6202745f184754defff13962dfc3d830bc7d8c63/src/main/java/org/usergrid/java/client/Client.java#L901-L903 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ItemLevelRecoveryConnectionsInner.java | ItemLevelRecoveryConnectionsInner.provisionAsync | public Observable<Void> provisionAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, ILRRequestResource resourceILRRequest) {
"""
Provisions a script which invokes an iSCSI connection to the backup data. Executing this script opens File Explorer which displays the recoverable files and folders. This is an asynchronous operation. To get the provisioning status, call GetProtectedItemOperationResult API.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param fabricName The fabric name associated with the backup items.
@param containerName The container name associated with the backup items.
@param protectedItemName The name of the backup item whose files or folders are to be restored.
@param recoveryPointId The recovery point ID for backup data. The iSCSI connection will be provisioned for this backup data.
@param resourceILRRequest The resource Item Level Recovery (ILR) request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return provisionWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId, resourceILRRequest).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> provisionAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId, ILRRequestResource resourceILRRequest) {
return provisionWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId, resourceILRRequest).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"provisionAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"fabricName",
",",
"String",
"containerName",
",",
"String",
"protectedItemName",
",",
"String",
"recoveryPointId",
",",
"ILRRequestResource",
"resourceILRRequest",
")",
"{",
"return",
"provisionWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName",
",",
"fabricName",
",",
"containerName",
",",
"protectedItemName",
",",
"recoveryPointId",
",",
"resourceILRRequest",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Provisions a script which invokes an iSCSI connection to the backup data. Executing this script opens File Explorer which displays the recoverable files and folders. This is an asynchronous operation. To get the provisioning status, call GetProtectedItemOperationResult API.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param fabricName The fabric name associated with the backup items.
@param containerName The container name associated with the backup items.
@param protectedItemName The name of the backup item whose files or folders are to be restored.
@param recoveryPointId The recovery point ID for backup data. The iSCSI connection will be provisioned for this backup data.
@param resourceILRRequest The resource Item Level Recovery (ILR) request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Provisions",
"a",
"script",
"which",
"invokes",
"an",
"iSCSI",
"connection",
"to",
"the",
"backup",
"data",
".",
"Executing",
"this",
"script",
"opens",
"File",
"Explorer",
"which",
"displays",
"the",
"recoverable",
"files",
"and",
"folders",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"To",
"get",
"the",
"provisioning",
"status",
"call",
"GetProtectedItemOperationResult",
"API",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ItemLevelRecoveryConnectionsInner.java#L229-L236 |
radkovo/SwingBox | src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java | DelegateView.getChildAllocation | @Override
public Shape getChildAllocation(int index, Shape 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
"""
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",
"given",
"allocation",
"since",
"this",
"view",
"simply",
"acts",
"as",
"a",
"gateway",
"between",
"the",
"view",
"hierarchy",
"and",
"the",
"associated",
"component",
"."
]
| train | https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/view/DelegateView.java#L341-L346 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getKeyAsync | public ServiceFuture<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, final ServiceCallback<KeyBundle> serviceCallback) {
"""
Gets the public part of a stored key.
The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. This operation requires the keys/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to get.
@param keyVersion Adding the version parameter retrieves a specific version of a key.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion), serviceCallback);
} | java | public ServiceFuture<KeyBundle> getKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, final ServiceCallback<KeyBundle> serviceCallback) {
return ServiceFuture.fromResponse(getKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"KeyBundle",
">",
"getKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
",",
"final",
"ServiceCallback",
"<",
"KeyBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"getKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"keyVersion",
")",
",",
"serviceCallback",
")",
";",
"}"
]
| Gets the public part of a stored key.
The get key operation is applicable to all key types. If the requested key is symmetric, then no key material is released in the response. This operation requires the keys/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key to get.
@param keyVersion Adding the version parameter retrieves a specific version of a key.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Gets",
"the",
"public",
"part",
"of",
"a",
"stored",
"key",
".",
"The",
"get",
"key",
"operation",
"is",
"applicable",
"to",
"all",
"key",
"types",
".",
"If",
"the",
"requested",
"key",
"is",
"symmetric",
"then",
"no",
"key",
"material",
"is",
"released",
"in",
"the",
"response",
".",
"This",
"operation",
"requires",
"the",
"keys",
"/",
"get",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1400-L1402 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java | VirtualMachinesInner.convertToManagedDisksAsync | public Observable<OperationStatusResponseInner> convertToManagedDisksAsync(String resourceGroupName, String vmName) {
"""
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> convertToManagedDisksAsync(String resourceGroupName, String vmName) {
return convertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"convertToManagedDisksAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmName",
")",
"{",
"return",
"convertToManagedDisksWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
",",
"OperationStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation.
@param resourceGroupName The name of the resource group.
@param vmName The name of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Converts",
"virtual",
"machine",
"disks",
"from",
"blob",
"-",
"based",
"to",
"managed",
"disks",
".",
"Virtual",
"machine",
"must",
"be",
"stop",
"-",
"deallocated",
"before",
"invoking",
"this",
"operation",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1159-L1166 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.removeAll | public static boolean removeAll(Collection self, Object[] items) {
"""
Modifies this collection by removing its elements that are contained
within the specified object array.
See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
containing items which don't match some criteria while leaving the original collection unchanged.
@param self a Collection to be modified
@param items array containing elements to be removed from this collection
@return <tt>true</tt> if this collection changed as a result of the call
@see Collection#removeAll(Collection)
@since 1.7.2
"""
Collection pickFrom = new TreeSet(new NumberAwareComparator());
pickFrom.addAll(Arrays.asList(items));
return self.removeAll(pickFrom);
} | java | public static boolean removeAll(Collection self, Object[] items) {
Collection pickFrom = new TreeSet(new NumberAwareComparator());
pickFrom.addAll(Arrays.asList(items));
return self.removeAll(pickFrom);
} | [
"public",
"static",
"boolean",
"removeAll",
"(",
"Collection",
"self",
",",
"Object",
"[",
"]",
"items",
")",
"{",
"Collection",
"pickFrom",
"=",
"new",
"TreeSet",
"(",
"new",
"NumberAwareComparator",
"(",
")",
")",
";",
"pickFrom",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"items",
")",
")",
";",
"return",
"self",
".",
"removeAll",
"(",
"pickFrom",
")",
";",
"}"
]
| Modifies this collection by removing its elements that are contained
within the specified object array.
See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
containing items which don't match some criteria while leaving the original collection unchanged.
@param self a Collection to be modified
@param items array containing elements to be removed from this collection
@return <tt>true</tt> if this collection changed as a result of the call
@see Collection#removeAll(Collection)
@since 1.7.2 | [
"Modifies",
"this",
"collection",
"by",
"removing",
"its",
"elements",
"that",
"are",
"contained",
"within",
"the",
"specified",
"object",
"array",
"."
]
| train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4968-L4972 |
Red5/red5-client | src/main/java/org/red5/client/net/rtmp/RTMPClient.java | RTMPClient.setProtocol | @Override
public void setProtocol(String protocol) throws Exception {
"""
Sets the RTMP protocol, the default is "rtmp". If "rtmps" or "rtmpt" are required, the appropriate client type should be selected.
@param protocol
the protocol to set
@throws Exception
"""
this.protocol = protocol;
if ("rtmps".equals(protocol) || "rtmpt".equals(protocol) || "rtmpte".equals(protocol) || "rtmfp".equals(protocol)) {
throw new Exception("Unsupported protocol specified, please use the correct client for the intended protocol.");
}
} | java | @Override
public void setProtocol(String protocol) throws Exception {
this.protocol = protocol;
if ("rtmps".equals(protocol) || "rtmpt".equals(protocol) || "rtmpte".equals(protocol) || "rtmfp".equals(protocol)) {
throw new Exception("Unsupported protocol specified, please use the correct client for the intended protocol.");
}
} | [
"@",
"Override",
"public",
"void",
"setProtocol",
"(",
"String",
"protocol",
")",
"throws",
"Exception",
"{",
"this",
".",
"protocol",
"=",
"protocol",
";",
"if",
"(",
"\"rtmps\"",
".",
"equals",
"(",
"protocol",
")",
"||",
"\"rtmpt\"",
".",
"equals",
"(",
"protocol",
")",
"||",
"\"rtmpte\"",
".",
"equals",
"(",
"protocol",
")",
"||",
"\"rtmfp\"",
".",
"equals",
"(",
"protocol",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Unsupported protocol specified, please use the correct client for the intended protocol.\"",
")",
";",
"}",
"}"
]
| Sets the RTMP protocol, the default is "rtmp". If "rtmps" or "rtmpt" are required, the appropriate client type should be selected.
@param protocol
the protocol to set
@throws Exception | [
"Sets",
"the",
"RTMP",
"protocol",
"the",
"default",
"is",
"rtmp",
".",
"If",
"rtmps",
"or",
"rtmpt",
"are",
"required",
"the",
"appropriate",
"client",
"type",
"should",
"be",
"selected",
"."
]
| train | https://github.com/Red5/red5-client/blob/f894495b60e59d7cfba647abd9b934237cac9d45/src/main/java/org/red5/client/net/rtmp/RTMPClient.java#L140-L146 |
jayantk/jklol | src/com/jayantkrish/jklol/models/TableFactor.java | TableFactor.logPointDistribution | public static TableFactor logPointDistribution(VariableNumMap vars, Assignment assignment) {
"""
Gets a {@code TableFactor} over {@code vars} which assigns unit weight to
{@code assignment} and 0 to all other assignments. Requires
{@code assignment} to contain all of {@code vars}. The weights in the
returned factor are represented in logspace.
@param vars
@param assignment
@return
"""
DenseTensorBuilder builder = new DenseTensorBuilder(vars.getVariableNumsArray(),
vars.getVariableSizes(), Double.NEGATIVE_INFINITY);
builder.put(vars.assignmentToIntArray(assignment), 0.0);
return new TableFactor(vars, new LogSpaceTensorAdapter(builder.build()));
} | java | public static TableFactor logPointDistribution(VariableNumMap vars, Assignment assignment) {
DenseTensorBuilder builder = new DenseTensorBuilder(vars.getVariableNumsArray(),
vars.getVariableSizes(), Double.NEGATIVE_INFINITY);
builder.put(vars.assignmentToIntArray(assignment), 0.0);
return new TableFactor(vars, new LogSpaceTensorAdapter(builder.build()));
} | [
"public",
"static",
"TableFactor",
"logPointDistribution",
"(",
"VariableNumMap",
"vars",
",",
"Assignment",
"assignment",
")",
"{",
"DenseTensorBuilder",
"builder",
"=",
"new",
"DenseTensorBuilder",
"(",
"vars",
".",
"getVariableNumsArray",
"(",
")",
",",
"vars",
".",
"getVariableSizes",
"(",
")",
",",
"Double",
".",
"NEGATIVE_INFINITY",
")",
";",
"builder",
".",
"put",
"(",
"vars",
".",
"assignmentToIntArray",
"(",
"assignment",
")",
",",
"0.0",
")",
";",
"return",
"new",
"TableFactor",
"(",
"vars",
",",
"new",
"LogSpaceTensorAdapter",
"(",
"builder",
".",
"build",
"(",
")",
")",
")",
";",
"}"
]
| Gets a {@code TableFactor} over {@code vars} which assigns unit weight to
{@code assignment} and 0 to all other assignments. Requires
{@code assignment} to contain all of {@code vars}. The weights in the
returned factor are represented in logspace.
@param vars
@param assignment
@return | [
"Gets",
"a",
"{",
"@code",
"TableFactor",
"}",
"over",
"{",
"@code",
"vars",
"}",
"which",
"assigns",
"unit",
"weight",
"to",
"{",
"@code",
"assignment",
"}",
"and",
"0",
"to",
"all",
"other",
"assignments",
".",
"Requires",
"{",
"@code",
"assignment",
"}",
"to",
"contain",
"all",
"of",
"{",
"@code",
"vars",
"}",
".",
"The",
"weights",
"in",
"the",
"returned",
"factor",
"are",
"represented",
"in",
"logspace",
"."
]
| train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L93-L98 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.retrieveReferences | public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException {
"""
Retrieve all References
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true loading is forced even if cld differs.
"""
Iterator i = cld.getObjectReferenceDescriptors().iterator();
// turn off auto prefetching for related proxies
final Class saveClassToPrefetch = classToPrefetch;
classToPrefetch = null;
pb.getInternalCache().enableMaterializationCache();
try
{
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
retrieveReference(newObj, cld, rds, forced);
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
finally
{
classToPrefetch = saveClassToPrefetch;
}
} | java | public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException
{
Iterator i = cld.getObjectReferenceDescriptors().iterator();
// turn off auto prefetching for related proxies
final Class saveClassToPrefetch = classToPrefetch;
classToPrefetch = null;
pb.getInternalCache().enableMaterializationCache();
try
{
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
retrieveReference(newObj, cld, rds, forced);
}
pb.getInternalCache().disableMaterializationCache();
}
catch(RuntimeException e)
{
pb.getInternalCache().doLocalClear();
throw e;
}
finally
{
classToPrefetch = saveClassToPrefetch;
}
} | [
"public",
"void",
"retrieveReferences",
"(",
"Object",
"newObj",
",",
"ClassDescriptor",
"cld",
",",
"boolean",
"forced",
")",
"throws",
"PersistenceBrokerException",
"{",
"Iterator",
"i",
"=",
"cld",
".",
"getObjectReferenceDescriptors",
"(",
")",
".",
"iterator",
"(",
")",
";",
"// turn off auto prefetching for related proxies\r",
"final",
"Class",
"saveClassToPrefetch",
"=",
"classToPrefetch",
";",
"classToPrefetch",
"=",
"null",
";",
"pb",
".",
"getInternalCache",
"(",
")",
".",
"enableMaterializationCache",
"(",
")",
";",
"try",
"{",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"ObjectReferenceDescriptor",
"rds",
"=",
"(",
"ObjectReferenceDescriptor",
")",
"i",
".",
"next",
"(",
")",
";",
"retrieveReference",
"(",
"newObj",
",",
"cld",
",",
"rds",
",",
"forced",
")",
";",
"}",
"pb",
".",
"getInternalCache",
"(",
")",
".",
"disableMaterializationCache",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"pb",
".",
"getInternalCache",
"(",
")",
".",
"doLocalClear",
"(",
")",
";",
"throw",
"e",
";",
"}",
"finally",
"{",
"classToPrefetch",
"=",
"saveClassToPrefetch",
";",
"}",
"}"
]
| Retrieve all References
@param newObj the instance to be loaded or refreshed
@param cld the ClassDescriptor of the instance
@param forced if set to true loading is forced even if cld differs. | [
"Retrieve",
"all",
"References"
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L524-L552 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/security/DefaultSecurityManager.java | DefaultSecurityManager.setSecurityContext | @Api
public boolean setSecurityContext(String authenticationToken, List<Authentication> authentications) {
"""
Method which sets the authorizations in the {@link SecurityContext}. To be overwritten when adding custom
policies.
@param authenticationToken authentication token
@param authentications authorizations for this token
@return true when a valid context was created, false when the token is not authenticated
"""
if (!authentications.isEmpty()) {
// build authorization and build thread local SecurityContext
((DefaultSecurityContext) securityContext).setAuthentications(authenticationToken, authentications);
return true;
}
return false;
} | java | @Api
public boolean setSecurityContext(String authenticationToken, List<Authentication> authentications) {
if (!authentications.isEmpty()) {
// build authorization and build thread local SecurityContext
((DefaultSecurityContext) securityContext).setAuthentications(authenticationToken, authentications);
return true;
}
return false;
} | [
"@",
"Api",
"public",
"boolean",
"setSecurityContext",
"(",
"String",
"authenticationToken",
",",
"List",
"<",
"Authentication",
">",
"authentications",
")",
"{",
"if",
"(",
"!",
"authentications",
".",
"isEmpty",
"(",
")",
")",
"{",
"// build authorization and build thread local SecurityContext",
"(",
"(",
"DefaultSecurityContext",
")",
"securityContext",
")",
".",
"setAuthentications",
"(",
"authenticationToken",
",",
"authentications",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| Method which sets the authorizations in the {@link SecurityContext}. To be overwritten when adding custom
policies.
@param authenticationToken authentication token
@param authentications authorizations for this token
@return true when a valid context was created, false when the token is not authenticated | [
"Method",
"which",
"sets",
"the",
"authorizations",
"in",
"the",
"{",
"@link",
"SecurityContext",
"}",
".",
"To",
"be",
"overwritten",
"when",
"adding",
"custom",
"policies",
"."
]
| train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/security/DefaultSecurityManager.java#L73-L81 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java | ContentPackage.addPage | public void addPage(String path, ContentElement content) throws IOException {
"""
Adds a page with given content. The "cq:Page/cq:PageContent envelope" is added automatically.
@param path Full content path of page.
@param content Hierarchy of content elements.
@throws IOException I/O exception
"""
String fullPath = buildJcrPathForZip(path) + "/" + DOT_CONTENT_XML;
Document doc = xmlContentBuilder.buildPage(content);
writeXmlDocument(fullPath, doc);
} | java | public void addPage(String path, ContentElement content) throws IOException {
String fullPath = buildJcrPathForZip(path) + "/" + DOT_CONTENT_XML;
Document doc = xmlContentBuilder.buildPage(content);
writeXmlDocument(fullPath, doc);
} | [
"public",
"void",
"addPage",
"(",
"String",
"path",
",",
"ContentElement",
"content",
")",
"throws",
"IOException",
"{",
"String",
"fullPath",
"=",
"buildJcrPathForZip",
"(",
"path",
")",
"+",
"\"/\"",
"+",
"DOT_CONTENT_XML",
";",
"Document",
"doc",
"=",
"xmlContentBuilder",
".",
"buildPage",
"(",
"content",
")",
";",
"writeXmlDocument",
"(",
"fullPath",
",",
"doc",
")",
";",
"}"
]
| Adds a page with given content. The "cq:Page/cq:PageContent envelope" is added automatically.
@param path Full content path of page.
@param content Hierarchy of content elements.
@throws IOException I/O exception | [
"Adds",
"a",
"page",
"with",
"given",
"content",
".",
"The",
"cq",
":",
"Page",
"/",
"cq",
":",
"PageContent",
"envelope",
"is",
"added",
"automatically",
"."
]
| train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L125-L129 |
webjars/webjars-locator | src/main/java/org/webjars/RequireJS.java | RequireJS.getWebJarConfig | @Deprecated
public static String getWebJarConfig(Map.Entry<String, String> webJar) {
"""
The legacy webJars-requirejs.js based RequireJS config for a WebJar.
@param webJar A tuple (artifactId -> version) representing the WebJar.
@return The contents of the webJars-requirejs.js file.
"""
String webJarConfig = "";
// read the webJarConfigs
String filename = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "webjars-requirejs.js";
InputStream inputStream = RequireJS.class.getClassLoader().getResourceAsStream(filename);
if (inputStream != null) {
log.warn("The " + webJar.getKey() + " " + webJar.getValue() + " WebJar is using the legacy RequireJS config.\n" +
"Please try a new version of the WebJar or file or file an issue at:\n" +
"http://github.com/webjars/" + webJar.getKey() + "/issues/new");
StringBuilder webJarConfigBuilder = new StringBuilder("// WebJar config for " + webJar.getKey() + "\n");
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
try {
String line;
while ((line = br.readLine()) != null) {
webJarConfigBuilder.append(line).append("\n");
}
webJarConfig = webJarConfigBuilder.toString();
} catch (IOException e) {
log.warn(filename + " could not be read.");
} finally {
try {
br.close();
} catch (IOException e) {
// really?
}
}
}
return webJarConfig;
} | java | @Deprecated
public static String getWebJarConfig(Map.Entry<String, String> webJar) {
String webJarConfig = "";
// read the webJarConfigs
String filename = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "webjars-requirejs.js";
InputStream inputStream = RequireJS.class.getClassLoader().getResourceAsStream(filename);
if (inputStream != null) {
log.warn("The " + webJar.getKey() + " " + webJar.getValue() + " WebJar is using the legacy RequireJS config.\n" +
"Please try a new version of the WebJar or file or file an issue at:\n" +
"http://github.com/webjars/" + webJar.getKey() + "/issues/new");
StringBuilder webJarConfigBuilder = new StringBuilder("// WebJar config for " + webJar.getKey() + "\n");
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
try {
String line;
while ((line = br.readLine()) != null) {
webJarConfigBuilder.append(line).append("\n");
}
webJarConfig = webJarConfigBuilder.toString();
} catch (IOException e) {
log.warn(filename + " could not be read.");
} finally {
try {
br.close();
} catch (IOException e) {
// really?
}
}
}
return webJarConfig;
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"getWebJarConfig",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"webJar",
")",
"{",
"String",
"webJarConfig",
"=",
"\"\"",
";",
"// read the webJarConfigs",
"String",
"filename",
"=",
"WebJarAssetLocator",
".",
"WEBJARS_PATH_PREFIX",
"+",
"\"/\"",
"+",
"webJar",
".",
"getKey",
"(",
")",
"+",
"\"/\"",
"+",
"webJar",
".",
"getValue",
"(",
")",
"+",
"\"/\"",
"+",
"\"webjars-requirejs.js\"",
";",
"InputStream",
"inputStream",
"=",
"RequireJS",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"filename",
")",
";",
"if",
"(",
"inputStream",
"!=",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"The \"",
"+",
"webJar",
".",
"getKey",
"(",
")",
"+",
"\" \"",
"+",
"webJar",
".",
"getValue",
"(",
")",
"+",
"\" WebJar is using the legacy RequireJS config.\\n\"",
"+",
"\"Please try a new version of the WebJar or file or file an issue at:\\n\"",
"+",
"\"http://github.com/webjars/\"",
"+",
"webJar",
".",
"getKey",
"(",
")",
"+",
"\"/issues/new\"",
")",
";",
"StringBuilder",
"webJarConfigBuilder",
"=",
"new",
"StringBuilder",
"(",
"\"// WebJar config for \"",
"+",
"webJar",
".",
"getKey",
"(",
")",
"+",
"\"\\n\"",
")",
";",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
")",
";",
"try",
"{",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"br",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"webJarConfigBuilder",
".",
"append",
"(",
"line",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"webJarConfig",
"=",
"webJarConfigBuilder",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"filename",
"+",
"\" could not be read.\"",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"br",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// really?",
"}",
"}",
"}",
"return",
"webJarConfig",
";",
"}"
]
| The legacy webJars-requirejs.js based RequireJS config for a WebJar.
@param webJar A tuple (artifactId -> version) representing the WebJar.
@return The contents of the webJars-requirejs.js file. | [
"The",
"legacy",
"webJars",
"-",
"requirejs",
".",
"js",
"based",
"RequireJS",
"config",
"for",
"a",
"WebJar",
"."
]
| train | https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L606-L640 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/GenKUmsAllCamt05200107.java | GenKUmsAllCamt05200107.createSaldo | private CashBalance8 createSaldo(Saldo saldo, boolean start) throws Exception {
"""
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
"""
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",
"(",
")",
";",
"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",
";",
"}"
]
| 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 |
carewebframework/carewebframework-vista | org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java | AsyncRPCEventDispatcher.callRPCAsync | public int callRPCAsync(String rpcName, Object... args) {
"""
Make an asynchronous call.
@param rpcName The RPC name.
@param args The RPC arguments.
@return The async handle.
"""
abort();
this.rpcName = rpcName;
asyncHandle = broker.callRPCAsync(rpcName, this, args);
return asyncHandle;
} | java | public int callRPCAsync(String rpcName, Object... args) {
abort();
this.rpcName = rpcName;
asyncHandle = broker.callRPCAsync(rpcName, this, args);
return asyncHandle;
} | [
"public",
"int",
"callRPCAsync",
"(",
"String",
"rpcName",
",",
"Object",
"...",
"args",
")",
"{",
"abort",
"(",
")",
";",
"this",
".",
"rpcName",
"=",
"rpcName",
";",
"asyncHandle",
"=",
"broker",
".",
"callRPCAsync",
"(",
"rpcName",
",",
"this",
",",
"args",
")",
";",
"return",
"asyncHandle",
";",
"}"
]
| Make an asynchronous call.
@param rpcName The RPC name.
@param args The RPC arguments.
@return The async handle. | [
"Make",
"an",
"asynchronous",
"call",
"."
]
| train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.ui-parent/org.carewebframework.vista.ui.core/src/main/java/org/carewebframework/vista/ui/mbroker/AsyncRPCEventDispatcher.java#L66-L71 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java | RDBMEntityGroupStore.findEntitiesForGroup | @Override
public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {
"""
Find the <code>IEntities</code> that are members of the <code>IEntityGroup</code>.
@param group the entity group in question
@return java.util.Iterator
"""
Collection entities = new ArrayList();
Connection conn = null;
String groupID = group.getLocalKey();
Class cls = group.getLeafType();
try {
conn = RDBMServices.getConnection();
Statement stmnt = conn.createStatement();
try {
String query =
"SELECT "
+ MEMBER_MEMBER_KEY_COLUMN
+ " FROM "
+ MEMBER_TABLE
+ " WHERE "
+ MEMBER_GROUP_ID_COLUMN
+ " = '"
+ groupID
+ "' AND "
+ MEMBER_IS_GROUP_COLUMN
+ " = '"
+ MEMBER_IS_ENTITY
+ "'";
ResultSet rs = stmnt.executeQuery(query);
try {
while (rs.next()) {
String key = rs.getString(1);
IEntity e = newEntity(cls, key);
entities.add(e);
}
} finally {
rs.close();
}
} finally {
stmnt.close();
}
} catch (SQLException sqle) {
LOG.error("Problem retrieving Entities for Group: " + group, sqle);
throw new GroupsException("Problem retrieving Entities for Group", sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
return entities.iterator();
} | java | @Override
public Iterator findEntitiesForGroup(IEntityGroup group) throws GroupsException {
Collection entities = new ArrayList();
Connection conn = null;
String groupID = group.getLocalKey();
Class cls = group.getLeafType();
try {
conn = RDBMServices.getConnection();
Statement stmnt = conn.createStatement();
try {
String query =
"SELECT "
+ MEMBER_MEMBER_KEY_COLUMN
+ " FROM "
+ MEMBER_TABLE
+ " WHERE "
+ MEMBER_GROUP_ID_COLUMN
+ " = '"
+ groupID
+ "' AND "
+ MEMBER_IS_GROUP_COLUMN
+ " = '"
+ MEMBER_IS_ENTITY
+ "'";
ResultSet rs = stmnt.executeQuery(query);
try {
while (rs.next()) {
String key = rs.getString(1);
IEntity e = newEntity(cls, key);
entities.add(e);
}
} finally {
rs.close();
}
} finally {
stmnt.close();
}
} catch (SQLException sqle) {
LOG.error("Problem retrieving Entities for Group: " + group, sqle);
throw new GroupsException("Problem retrieving Entities for Group", sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
return entities.iterator();
} | [
"@",
"Override",
"public",
"Iterator",
"findEntitiesForGroup",
"(",
"IEntityGroup",
"group",
")",
"throws",
"GroupsException",
"{",
"Collection",
"entities",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Connection",
"conn",
"=",
"null",
";",
"String",
"groupID",
"=",
"group",
".",
"getLocalKey",
"(",
")",
";",
"Class",
"cls",
"=",
"group",
".",
"getLeafType",
"(",
")",
";",
"try",
"{",
"conn",
"=",
"RDBMServices",
".",
"getConnection",
"(",
")",
";",
"Statement",
"stmnt",
"=",
"conn",
".",
"createStatement",
"(",
")",
";",
"try",
"{",
"String",
"query",
"=",
"\"SELECT \"",
"+",
"MEMBER_MEMBER_KEY_COLUMN",
"+",
"\" FROM \"",
"+",
"MEMBER_TABLE",
"+",
"\" WHERE \"",
"+",
"MEMBER_GROUP_ID_COLUMN",
"+",
"\" = '\"",
"+",
"groupID",
"+",
"\"' AND \"",
"+",
"MEMBER_IS_GROUP_COLUMN",
"+",
"\" = '\"",
"+",
"MEMBER_IS_ENTITY",
"+",
"\"'\"",
";",
"ResultSet",
"rs",
"=",
"stmnt",
".",
"executeQuery",
"(",
"query",
")",
";",
"try",
"{",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"String",
"key",
"=",
"rs",
".",
"getString",
"(",
"1",
")",
";",
"IEntity",
"e",
"=",
"newEntity",
"(",
"cls",
",",
"key",
")",
";",
"entities",
".",
"add",
"(",
"e",
")",
";",
"}",
"}",
"finally",
"{",
"rs",
".",
"close",
"(",
")",
";",
"}",
"}",
"finally",
"{",
"stmnt",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"sqle",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Problem retrieving Entities for Group: \"",
"+",
"group",
",",
"sqle",
")",
";",
"throw",
"new",
"GroupsException",
"(",
"\"Problem retrieving Entities for Group\"",
",",
"sqle",
")",
";",
"}",
"finally",
"{",
"RDBMServices",
".",
"releaseConnection",
"(",
"conn",
")",
";",
"}",
"return",
"entities",
".",
"iterator",
"(",
")",
";",
"}"
]
| Find the <code>IEntities</code> that are members of the <code>IEntityGroup</code>.
@param group the entity group in question
@return java.util.Iterator | [
"Find",
"the",
"<code",
">",
"IEntities<",
"/",
"code",
">",
"that",
"are",
"members",
"of",
"the",
"<code",
">",
"IEntityGroup<",
"/",
"code",
">",
"."
]
| train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L446-L494 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/element/table/PLTable.java | PLTable.addRow | @Nonnull
public PLTable addRow (@Nonnull final Iterable <? extends PLTableCell> aCells) {
"""
Add a new table row with auto height. All contained elements are added with
the specified width in the constructor. <code>null</code> elements are
represented as empty cells.
@param aCells
The cells to add. May not be <code>null</code>.
@return this
"""
return addRow (aCells, m_aRows.getDefaultHeight ());
} | java | @Nonnull
public PLTable addRow (@Nonnull final Iterable <? extends PLTableCell> aCells)
{
return addRow (aCells, m_aRows.getDefaultHeight ());
} | [
"@",
"Nonnull",
"public",
"PLTable",
"addRow",
"(",
"@",
"Nonnull",
"final",
"Iterable",
"<",
"?",
"extends",
"PLTableCell",
">",
"aCells",
")",
"{",
"return",
"addRow",
"(",
"aCells",
",",
"m_aRows",
".",
"getDefaultHeight",
"(",
")",
")",
";",
"}"
]
| Add a new table row with auto height. All contained elements are added with
the specified width in the constructor. <code>null</code> elements are
represented as empty cells.
@param aCells
The cells to add. May not be <code>null</code>.
@return this | [
"Add",
"a",
"new",
"table",
"row",
"with",
"auto",
"height",
".",
"All",
"contained",
"elements",
"are",
"added",
"with",
"the",
"specified",
"width",
"in",
"the",
"constructor",
".",
"<code",
">",
"null<",
"/",
"code",
">",
"elements",
"are",
"represented",
"as",
"empty",
"cells",
"."
]
| train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/element/table/PLTable.java#L312-L316 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/filesystem/MetricsFileSystemInstrumentation.java | MetricsFileSystemInstrumentation.setTimes | public void setTimes (Path f, long t, long a) throws IOException {
"""
Add timer metrics to {@link DistributedFileSystem#setTimes(Path, long, long)}
"""
try (Closeable context = new TimerContextWithLog(this.setTimesTimer.time(), "setTimes", f, t, a)) {
super.setTimes(f, t, a);
}
} | java | public void setTimes (Path f, long t, long a) throws IOException {
try (Closeable context = new TimerContextWithLog(this.setTimesTimer.time(), "setTimes", f, t, a)) {
super.setTimes(f, t, a);
}
} | [
"public",
"void",
"setTimes",
"(",
"Path",
"f",
",",
"long",
"t",
",",
"long",
"a",
")",
"throws",
"IOException",
"{",
"try",
"(",
"Closeable",
"context",
"=",
"new",
"TimerContextWithLog",
"(",
"this",
".",
"setTimesTimer",
".",
"time",
"(",
")",
",",
"\"setTimes\"",
",",
"f",
",",
"t",
",",
"a",
")",
")",
"{",
"super",
".",
"setTimes",
"(",
"f",
",",
"t",
",",
"a",
")",
";",
"}",
"}"
]
| Add timer metrics to {@link DistributedFileSystem#setTimes(Path, long, long)} | [
"Add",
"timer",
"metrics",
"to",
"{"
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/filesystem/MetricsFileSystemInstrumentation.java#L316-L320 |
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java | Algorithm.ECDSA512 | public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException {
"""
Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512".
@param publicKey the key to use in the verify instance.
@param privateKey the key to use in the signing instance.
@return a valid ECDSA512 Algorithm.
@throws IllegalArgumentException if the provided Key is null.
"""
return ECDSA512(ECDSAAlgorithm.providerForKeys(publicKey, privateKey));
} | java | public static Algorithm ECDSA512(ECPublicKey publicKey, ECPrivateKey privateKey) throws IllegalArgumentException {
return ECDSA512(ECDSAAlgorithm.providerForKeys(publicKey, privateKey));
} | [
"public",
"static",
"Algorithm",
"ECDSA512",
"(",
"ECPublicKey",
"publicKey",
",",
"ECPrivateKey",
"privateKey",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"ECDSA512",
"(",
"ECDSAAlgorithm",
".",
"providerForKeys",
"(",
"publicKey",
",",
"privateKey",
")",
")",
";",
"}"
]
| Creates a new Algorithm instance using SHA512withECDSA. Tokens specify this as "ES512".
@param publicKey the key to use in the verify instance.
@param privateKey the key to use in the signing instance.
@return a valid ECDSA512 Algorithm.
@throws IllegalArgumentException if the provided Key is null. | [
"Creates",
"a",
"new",
"Algorithm",
"instance",
"using",
"SHA512withECDSA",
".",
"Tokens",
"specify",
"this",
"as",
"ES512",
"."
]
| train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/Algorithm.java#L296-L298 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/References.java | References.getOneRequired | public <T> T getOneRequired(Class<T> type, Object locator) throws ReferenceException {
"""
Gets a required component reference that matches specified locator and
matching to the specified type.
@param type the Class type that defined the type of the result.
@param locator the locator to find a reference by.
@return a matching component reference.
@throws ReferenceException when no references found.
"""
List<T> components = find(type, locator, true);
return components.size() > 0 ? components.get(0) : null;
} | java | public <T> T getOneRequired(Class<T> type, Object locator) throws ReferenceException {
List<T> components = find(type, locator, true);
return components.size() > 0 ? components.get(0) : null;
} | [
"public",
"<",
"T",
">",
"T",
"getOneRequired",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"locator",
")",
"throws",
"ReferenceException",
"{",
"List",
"<",
"T",
">",
"components",
"=",
"find",
"(",
"type",
",",
"locator",
",",
"true",
")",
";",
"return",
"components",
".",
"size",
"(",
")",
">",
"0",
"?",
"components",
".",
"get",
"(",
"0",
")",
":",
"null",
";",
"}"
]
| Gets a required component reference that matches specified locator and
matching to the specified type.
@param type the Class type that defined the type of the result.
@param locator the locator to find a reference by.
@return a matching component reference.
@throws ReferenceException when no references found. | [
"Gets",
"a",
"required",
"component",
"reference",
"that",
"matches",
"specified",
"locator",
"and",
"matching",
"to",
"the",
"specified",
"type",
"."
]
| train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/References.java#L214-L217 |
Red5/red5-io | src/main/java/org/red5/io/utils/XMLUtils.java | XMLUtils.docToString2 | public static String docToString2(Document domDoc) throws IOException {
"""
Convert a DOM tree into a String using transform
@param domDoc
DOM object
@throws java.io.IOException
I/O exception
@return XML as String
"""
try {
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer();
trans.setOutputProperty(OutputKeys.INDENT, "no");
StringWriter sw = new StringWriter();
Result result = new StreamResult(sw);
trans.transform(new DOMSource(domDoc), result);
return sw.toString();
} catch (Exception ex) {
throw new IOException(String.format("Error converting from doc to string %s", ex.getMessage()));
}
} | java | public static String docToString2(Document domDoc) throws IOException {
try {
TransformerFactory transFact = TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer();
trans.setOutputProperty(OutputKeys.INDENT, "no");
StringWriter sw = new StringWriter();
Result result = new StreamResult(sw);
trans.transform(new DOMSource(domDoc), result);
return sw.toString();
} catch (Exception ex) {
throw new IOException(String.format("Error converting from doc to string %s", ex.getMessage()));
}
} | [
"public",
"static",
"String",
"docToString2",
"(",
"Document",
"domDoc",
")",
"throws",
"IOException",
"{",
"try",
"{",
"TransformerFactory",
"transFact",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"Transformer",
"trans",
"=",
"transFact",
".",
"newTransformer",
"(",
")",
";",
"trans",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"INDENT",
",",
"\"no\"",
")",
";",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"Result",
"result",
"=",
"new",
"StreamResult",
"(",
"sw",
")",
";",
"trans",
".",
"transform",
"(",
"new",
"DOMSource",
"(",
"domDoc",
")",
",",
"result",
")",
";",
"return",
"sw",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"String",
".",
"format",
"(",
"\"Error converting from doc to string %s\"",
",",
"ex",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"}"
]
| Convert a DOM tree into a String using transform
@param domDoc
DOM object
@throws java.io.IOException
I/O exception
@return XML as String | [
"Convert",
"a",
"DOM",
"tree",
"into",
"a",
"String",
"using",
"transform"
]
| train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/XMLUtils.java#L112-L124 |
OpenBEL/openbel-framework | org.openbel.framework.compiler/src/main/java/org/openbel/framework/compiler/PhaseThreeImpl.java | PhaseThreeImpl.search | private Set<TableEntry> search(final ProtoNetwork pn, String... literals) {
"""
Aggregate the set of all table entries for a proto-network that match at
least one of the provided term literals.
@param literals Literals, e.g., {@code proteinAbundance(#)}
@return Table entry set
"""
Set<TableEntry> ret;
if (noItems(literals)) {
return emptySet();
}
// An initial capacity would be ideal for this set, but we don't
// have any reasonable estimations.
ret = new HashSet<TableEntry>();
// Establish access to the relevant table objects
final ParameterTable paramTbl = pn.getParameterTable();
final TermTable termTbl = pn.getTermTable();
final List<String> terms = termTbl.getTermValues();
final NamespaceTable nsTbl = pn.getNamespaceTable();
final int[][] indata = pn.getTermIndices();
final Set<String> literalSet = constrainedHashSet(literals.length);
for (final String s : literals) {
literalSet.add(s);
}
// Search indata for elements of the term literal set
for (int i = 0; i < indata.length; i++) {
int tid = indata[i][TERM_INDEX];
String string = terms.get(tid);
if (!literalSet.contains(string)) {
continue;
}
int pid = indata[i][PARAM_INDEX];
final TableParameter tp = paramTbl.getTableParameter(pid);
final String inval = tp.getValue();
int nid = indata[i][NAMESPACE_INDEX];
final TableNamespace tns = nsTbl.getTableNamespace(nid);
String inrl = null;
if (tns != null) inrl = tns.getResourceLocation();
final TableEntry te = new TableEntry(inval, inrl);
ret.add(te);
}
return ret;
} | java | private Set<TableEntry> search(final ProtoNetwork pn, String... literals) {
Set<TableEntry> ret;
if (noItems(literals)) {
return emptySet();
}
// An initial capacity would be ideal for this set, but we don't
// have any reasonable estimations.
ret = new HashSet<TableEntry>();
// Establish access to the relevant table objects
final ParameterTable paramTbl = pn.getParameterTable();
final TermTable termTbl = pn.getTermTable();
final List<String> terms = termTbl.getTermValues();
final NamespaceTable nsTbl = pn.getNamespaceTable();
final int[][] indata = pn.getTermIndices();
final Set<String> literalSet = constrainedHashSet(literals.length);
for (final String s : literals) {
literalSet.add(s);
}
// Search indata for elements of the term literal set
for (int i = 0; i < indata.length; i++) {
int tid = indata[i][TERM_INDEX];
String string = terms.get(tid);
if (!literalSet.contains(string)) {
continue;
}
int pid = indata[i][PARAM_INDEX];
final TableParameter tp = paramTbl.getTableParameter(pid);
final String inval = tp.getValue();
int nid = indata[i][NAMESPACE_INDEX];
final TableNamespace tns = nsTbl.getTableNamespace(nid);
String inrl = null;
if (tns != null) inrl = tns.getResourceLocation();
final TableEntry te = new TableEntry(inval, inrl);
ret.add(te);
}
return ret;
} | [
"private",
"Set",
"<",
"TableEntry",
">",
"search",
"(",
"final",
"ProtoNetwork",
"pn",
",",
"String",
"...",
"literals",
")",
"{",
"Set",
"<",
"TableEntry",
">",
"ret",
";",
"if",
"(",
"noItems",
"(",
"literals",
")",
")",
"{",
"return",
"emptySet",
"(",
")",
";",
"}",
"// An initial capacity would be ideal for this set, but we don't",
"// have any reasonable estimations.",
"ret",
"=",
"new",
"HashSet",
"<",
"TableEntry",
">",
"(",
")",
";",
"// Establish access to the relevant table objects",
"final",
"ParameterTable",
"paramTbl",
"=",
"pn",
".",
"getParameterTable",
"(",
")",
";",
"final",
"TermTable",
"termTbl",
"=",
"pn",
".",
"getTermTable",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"terms",
"=",
"termTbl",
".",
"getTermValues",
"(",
")",
";",
"final",
"NamespaceTable",
"nsTbl",
"=",
"pn",
".",
"getNamespaceTable",
"(",
")",
";",
"final",
"int",
"[",
"]",
"[",
"]",
"indata",
"=",
"pn",
".",
"getTermIndices",
"(",
")",
";",
"final",
"Set",
"<",
"String",
">",
"literalSet",
"=",
"constrainedHashSet",
"(",
"literals",
".",
"length",
")",
";",
"for",
"(",
"final",
"String",
"s",
":",
"literals",
")",
"{",
"literalSet",
".",
"add",
"(",
"s",
")",
";",
"}",
"// Search indata for elements of the term literal set",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indata",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"tid",
"=",
"indata",
"[",
"i",
"]",
"[",
"TERM_INDEX",
"]",
";",
"String",
"string",
"=",
"terms",
".",
"get",
"(",
"tid",
")",
";",
"if",
"(",
"!",
"literalSet",
".",
"contains",
"(",
"string",
")",
")",
"{",
"continue",
";",
"}",
"int",
"pid",
"=",
"indata",
"[",
"i",
"]",
"[",
"PARAM_INDEX",
"]",
";",
"final",
"TableParameter",
"tp",
"=",
"paramTbl",
".",
"getTableParameter",
"(",
"pid",
")",
";",
"final",
"String",
"inval",
"=",
"tp",
".",
"getValue",
"(",
")",
";",
"int",
"nid",
"=",
"indata",
"[",
"i",
"]",
"[",
"NAMESPACE_INDEX",
"]",
";",
"final",
"TableNamespace",
"tns",
"=",
"nsTbl",
".",
"getTableNamespace",
"(",
"nid",
")",
";",
"String",
"inrl",
"=",
"null",
";",
"if",
"(",
"tns",
"!=",
"null",
")",
"inrl",
"=",
"tns",
".",
"getResourceLocation",
"(",
")",
";",
"final",
"TableEntry",
"te",
"=",
"new",
"TableEntry",
"(",
"inval",
",",
"inrl",
")",
";",
"ret",
".",
"add",
"(",
"te",
")",
";",
"}",
"return",
"ret",
";",
"}"
]
| Aggregate the set of all table entries for a proto-network that match at
least one of the provided term literals.
@param literals Literals, e.g., {@code proteinAbundance(#)}
@return Table entry set | [
"Aggregate",
"the",
"set",
"of",
"all",
"table",
"entries",
"for",
"a",
"proto",
"-",
"network",
"that",
"match",
"at",
"least",
"one",
"of",
"the",
"provided",
"term",
"literals",
"."
]
| train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.compiler/src/main/java/org/openbel/framework/compiler/PhaseThreeImpl.java#L826-L872 |
Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java | BlockOutStream.createReplicatedBlockOutStream | public static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context,
long blockId, long blockSize, java.util.List<WorkerNetAddress> workerNetAddresses,
OutStreamOptions options) throws IOException {
"""
Creates a new remote block output stream.
@param context the file system context
@param blockId the block id
@param blockSize the block size
@param workerNetAddresses the worker network addresses
@param options the options
@return the {@link BlockOutStream} instance created
"""
List<DataWriter> dataWriters = new ArrayList<>();
for (WorkerNetAddress address: workerNetAddresses) {
DataWriter dataWriter =
DataWriter.Factory.create(context, blockId, blockSize, address, options);
dataWriters.add(dataWriter);
}
return new BlockOutStream(dataWriters, blockSize, workerNetAddresses);
} | java | public static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context,
long blockId, long blockSize, java.util.List<WorkerNetAddress> workerNetAddresses,
OutStreamOptions options) throws IOException {
List<DataWriter> dataWriters = new ArrayList<>();
for (WorkerNetAddress address: workerNetAddresses) {
DataWriter dataWriter =
DataWriter.Factory.create(context, blockId, blockSize, address, options);
dataWriters.add(dataWriter);
}
return new BlockOutStream(dataWriters, blockSize, workerNetAddresses);
} | [
"public",
"static",
"BlockOutStream",
"createReplicatedBlockOutStream",
"(",
"FileSystemContext",
"context",
",",
"long",
"blockId",
",",
"long",
"blockSize",
",",
"java",
".",
"util",
".",
"List",
"<",
"WorkerNetAddress",
">",
"workerNetAddresses",
",",
"OutStreamOptions",
"options",
")",
"throws",
"IOException",
"{",
"List",
"<",
"DataWriter",
">",
"dataWriters",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"WorkerNetAddress",
"address",
":",
"workerNetAddresses",
")",
"{",
"DataWriter",
"dataWriter",
"=",
"DataWriter",
".",
"Factory",
".",
"create",
"(",
"context",
",",
"blockId",
",",
"blockSize",
",",
"address",
",",
"options",
")",
";",
"dataWriters",
".",
"add",
"(",
"dataWriter",
")",
";",
"}",
"return",
"new",
"BlockOutStream",
"(",
"dataWriters",
",",
"blockSize",
",",
"workerNetAddresses",
")",
";",
"}"
]
| Creates a new remote block output stream.
@param context the file system context
@param blockId the block id
@param blockSize the block size
@param workerNetAddresses the worker network addresses
@param options the options
@return the {@link BlockOutStream} instance created | [
"Creates",
"a",
"new",
"remote",
"block",
"output",
"stream",
"."
]
| train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/block/stream/BlockOutStream.java#L108-L118 |
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) {
"""
Check that the Quality profiles sent by scanner correctly relate to the project 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",
"(",
")",
".",
"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",
")",
")",
";",
"}",
"}",
"}"
]
| 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 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java | EditableComboBoxAutoCompletion.startsWithIgnoreCase | private boolean startsWithIgnoreCase(String str1, String str2) {
"""
See if one string begins with another, ignoring case.
@param str1 The string to test
@param str2 The prefix to test for
@return true if str1 starts with str2, ingnoring case
"""
return str1 != null && str2 != null && str1.toUpperCase().startsWith(str2.toUpperCase());
} | java | private boolean startsWithIgnoreCase(String str1, String str2) {
return str1 != null && str2 != null && str1.toUpperCase().startsWith(str2.toUpperCase());
} | [
"private",
"boolean",
"startsWithIgnoreCase",
"(",
"String",
"str1",
",",
"String",
"str2",
")",
"{",
"return",
"str1",
"!=",
"null",
"&&",
"str2",
"!=",
"null",
"&&",
"str1",
".",
"toUpperCase",
"(",
")",
".",
"startsWith",
"(",
"str2",
".",
"toUpperCase",
"(",
")",
")",
";",
"}"
]
| See if one string begins with another, ignoring case.
@param str1 The string to test
@param str2 The prefix to test for
@return true if str1 starts with str2, ingnoring case | [
"See",
"if",
"one",
"string",
"begins",
"with",
"another",
"ignoring",
"case",
"."
]
| train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/list/EditableComboBoxAutoCompletion.java#L98-L100 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/CompilerExecutor.java | CompilerExecutor.getLongMessage | public static String getLongMessage(AbstractWisdomMojo mojo, Object exception) {
"""
We can't access the {@link org.apache.maven.plugin.compiler.CompilationFailureException} directly,
because the mojo is loaded in another classloader. So, we have to use this method to retrieve the 'compilation
failures'.
@param mojo the mojo
@param exception the exception that must be a {@link org.apache.maven.plugin.compile.CompilationFailureException}
@return the long message, {@literal null} if it can't be extracted from the exception
"""
try {
return (String) exception.getClass().getMethod("getLongMessage").invoke(exception);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
mojo.getLog().error("Cannot extract the long message from the Compilation Failure Exception "
+ exception, e);
}
return null;
} | java | public static String getLongMessage(AbstractWisdomMojo mojo, Object exception) {
try {
return (String) exception.getClass().getMethod("getLongMessage").invoke(exception);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
mojo.getLog().error("Cannot extract the long message from the Compilation Failure Exception "
+ exception, e);
}
return null;
} | [
"public",
"static",
"String",
"getLongMessage",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"Object",
"exception",
")",
"{",
"try",
"{",
"return",
"(",
"String",
")",
"exception",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"getLongMessage\"",
")",
".",
"invoke",
"(",
"exception",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"InvocationTargetException",
"|",
"NoSuchMethodException",
"e",
")",
"{",
"mojo",
".",
"getLog",
"(",
")",
".",
"error",
"(",
"\"Cannot extract the long message from the Compilation Failure Exception \"",
"+",
"exception",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| We can't access the {@link org.apache.maven.plugin.compiler.CompilationFailureException} directly,
because the mojo is loaded in another classloader. So, we have to use this method to retrieve the 'compilation
failures'.
@param mojo the mojo
@param exception the exception that must be a {@link org.apache.maven.plugin.compile.CompilationFailureException}
@return the long message, {@literal null} if it can't be extracted from the exception | [
"We",
"can",
"t",
"access",
"the",
"{",
"@link",
"org",
".",
"apache",
".",
"maven",
".",
"plugin",
".",
"compiler",
".",
"CompilationFailureException",
"}",
"directly",
"because",
"the",
"mojo",
"is",
"loaded",
"in",
"another",
"classloader",
".",
"So",
"we",
"have",
"to",
"use",
"this",
"method",
"to",
"retrieve",
"the",
"compilation",
"failures",
"."
]
| train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/CompilerExecutor.java#L190-L198 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java | MeshGenerator.generateCylinder | public static void generateCylinder(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) {
"""
Generates a cylindrical solid mesh. The center is at middle of the of the cylinder.
@param positions Where to save the position information
@param normals Where to save the normal information, can be null to ignore the attribute
@param indices Where to save the indices
@param radius The radius of the base and top
@param height The height (distance from the base to the top)
"""
// 0,0,0 will be halfway up the cylinder in the middle
final float halfHeight = height / 2;
// The positions at the rims of the cylinders
final List<Vector3f> rims = new ArrayList<>();
for (int angle = 0; angle < 360; angle += 15) {
final double angleRads = Math.toRadians(angle);
rims.add(new Vector3f(
radius * TrigMath.cos(angleRads),
halfHeight,
radius * -TrigMath.sin(angleRads)));
}
// The normals for the triangles of the top and bottom faces
final Vector3f topNormal = new Vector3f(0, 1, 0);
final Vector3f bottomNormal = new Vector3f(0, -1, 0);
// Add the top and bottom face center vertices
addVector(positions, new Vector3f(0, halfHeight, 0));// 0
addVector(normals, topNormal);
addVector(positions, new Vector3f(0, -halfHeight, 0));// 1
addVector(normals, bottomNormal);
// Add all the faces section by section, turning around the y axis
final int rimsSize = rims.size();
for (int i = 0; i < rimsSize; i++) {
// Get the top and bottom vertex positions and the side normal
final Vector3f t = rims.get(i);
final Vector3f b = new Vector3f(t.getX(), -t.getY(), t.getZ());
final Vector3f n = new Vector3f(t.getX(), 0, t.getZ()).normalize();
// Top face vertex
addVector(positions, t);// index
addVector(normals, topNormal);
// Bottom face vertex
addVector(positions, b);// index + 1
addVector(normals, bottomNormal);
// Side top vertex
addVector(positions, t);// index + 2
addVector(normals, n);
// Side bottom vertex
addVector(positions, b);// index + 3
addVector(normals, n);
// Get the current index for our vertices
final int currentIndex = i * 4 + 2;
// Get the index for the next iteration, wrapping around at the end
final int nextIndex = (i == rimsSize - 1 ? 0 : i + 1) * 4 + 2;
// Add the 4 triangles (1 top, 1 bottom, 2 for the side)
addAll(indices, 0, currentIndex, nextIndex);
addAll(indices, 1, nextIndex + 1, currentIndex + 1);
addAll(indices, currentIndex + 2, currentIndex + 3, nextIndex + 2);
addAll(indices, currentIndex + 3, nextIndex + 3, nextIndex + 2);
}
} | java | public static void generateCylinder(TFloatList positions, TFloatList normals, TIntList indices, float radius, float height) {
// 0,0,0 will be halfway up the cylinder in the middle
final float halfHeight = height / 2;
// The positions at the rims of the cylinders
final List<Vector3f> rims = new ArrayList<>();
for (int angle = 0; angle < 360; angle += 15) {
final double angleRads = Math.toRadians(angle);
rims.add(new Vector3f(
radius * TrigMath.cos(angleRads),
halfHeight,
radius * -TrigMath.sin(angleRads)));
}
// The normals for the triangles of the top and bottom faces
final Vector3f topNormal = new Vector3f(0, 1, 0);
final Vector3f bottomNormal = new Vector3f(0, -1, 0);
// Add the top and bottom face center vertices
addVector(positions, new Vector3f(0, halfHeight, 0));// 0
addVector(normals, topNormal);
addVector(positions, new Vector3f(0, -halfHeight, 0));// 1
addVector(normals, bottomNormal);
// Add all the faces section by section, turning around the y axis
final int rimsSize = rims.size();
for (int i = 0; i < rimsSize; i++) {
// Get the top and bottom vertex positions and the side normal
final Vector3f t = rims.get(i);
final Vector3f b = new Vector3f(t.getX(), -t.getY(), t.getZ());
final Vector3f n = new Vector3f(t.getX(), 0, t.getZ()).normalize();
// Top face vertex
addVector(positions, t);// index
addVector(normals, topNormal);
// Bottom face vertex
addVector(positions, b);// index + 1
addVector(normals, bottomNormal);
// Side top vertex
addVector(positions, t);// index + 2
addVector(normals, n);
// Side bottom vertex
addVector(positions, b);// index + 3
addVector(normals, n);
// Get the current index for our vertices
final int currentIndex = i * 4 + 2;
// Get the index for the next iteration, wrapping around at the end
final int nextIndex = (i == rimsSize - 1 ? 0 : i + 1) * 4 + 2;
// Add the 4 triangles (1 top, 1 bottom, 2 for the side)
addAll(indices, 0, currentIndex, nextIndex);
addAll(indices, 1, nextIndex + 1, currentIndex + 1);
addAll(indices, currentIndex + 2, currentIndex + 3, nextIndex + 2);
addAll(indices, currentIndex + 3, nextIndex + 3, nextIndex + 2);
}
} | [
"public",
"static",
"void",
"generateCylinder",
"(",
"TFloatList",
"positions",
",",
"TFloatList",
"normals",
",",
"TIntList",
"indices",
",",
"float",
"radius",
",",
"float",
"height",
")",
"{",
"// 0,0,0 will be halfway up the cylinder in the middle",
"final",
"float",
"halfHeight",
"=",
"height",
"/",
"2",
";",
"// The positions at the rims of the cylinders",
"final",
"List",
"<",
"Vector3f",
">",
"rims",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"angle",
"=",
"0",
";",
"angle",
"<",
"360",
";",
"angle",
"+=",
"15",
")",
"{",
"final",
"double",
"angleRads",
"=",
"Math",
".",
"toRadians",
"(",
"angle",
")",
";",
"rims",
".",
"add",
"(",
"new",
"Vector3f",
"(",
"radius",
"*",
"TrigMath",
".",
"cos",
"(",
"angleRads",
")",
",",
"halfHeight",
",",
"radius",
"*",
"-",
"TrigMath",
".",
"sin",
"(",
"angleRads",
")",
")",
")",
";",
"}",
"// The normals for the triangles of the top and bottom faces",
"final",
"Vector3f",
"topNormal",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"1",
",",
"0",
")",
";",
"final",
"Vector3f",
"bottomNormal",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"-",
"1",
",",
"0",
")",
";",
"// Add the top and bottom face center vertices",
"addVector",
"(",
"positions",
",",
"new",
"Vector3f",
"(",
"0",
",",
"halfHeight",
",",
"0",
")",
")",
";",
"// 0",
"addVector",
"(",
"normals",
",",
"topNormal",
")",
";",
"addVector",
"(",
"positions",
",",
"new",
"Vector3f",
"(",
"0",
",",
"-",
"halfHeight",
",",
"0",
")",
")",
";",
"// 1",
"addVector",
"(",
"normals",
",",
"bottomNormal",
")",
";",
"// Add all the faces section by section, turning around the y axis",
"final",
"int",
"rimsSize",
"=",
"rims",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rimsSize",
";",
"i",
"++",
")",
"{",
"// Get the top and bottom vertex positions and the side normal",
"final",
"Vector3f",
"t",
"=",
"rims",
".",
"get",
"(",
"i",
")",
";",
"final",
"Vector3f",
"b",
"=",
"new",
"Vector3f",
"(",
"t",
".",
"getX",
"(",
")",
",",
"-",
"t",
".",
"getY",
"(",
")",
",",
"t",
".",
"getZ",
"(",
")",
")",
";",
"final",
"Vector3f",
"n",
"=",
"new",
"Vector3f",
"(",
"t",
".",
"getX",
"(",
")",
",",
"0",
",",
"t",
".",
"getZ",
"(",
")",
")",
".",
"normalize",
"(",
")",
";",
"// Top face vertex",
"addVector",
"(",
"positions",
",",
"t",
")",
";",
"// index",
"addVector",
"(",
"normals",
",",
"topNormal",
")",
";",
"// Bottom face vertex",
"addVector",
"(",
"positions",
",",
"b",
")",
";",
"// index + 1",
"addVector",
"(",
"normals",
",",
"bottomNormal",
")",
";",
"// Side top vertex",
"addVector",
"(",
"positions",
",",
"t",
")",
";",
"// index + 2",
"addVector",
"(",
"normals",
",",
"n",
")",
";",
"// Side bottom vertex",
"addVector",
"(",
"positions",
",",
"b",
")",
";",
"// index + 3",
"addVector",
"(",
"normals",
",",
"n",
")",
";",
"// Get the current index for our vertices",
"final",
"int",
"currentIndex",
"=",
"i",
"*",
"4",
"+",
"2",
";",
"// Get the index for the next iteration, wrapping around at the end",
"final",
"int",
"nextIndex",
"=",
"(",
"i",
"==",
"rimsSize",
"-",
"1",
"?",
"0",
":",
"i",
"+",
"1",
")",
"*",
"4",
"+",
"2",
";",
"// Add the 4 triangles (1 top, 1 bottom, 2 for the side)",
"addAll",
"(",
"indices",
",",
"0",
",",
"currentIndex",
",",
"nextIndex",
")",
";",
"addAll",
"(",
"indices",
",",
"1",
",",
"nextIndex",
"+",
"1",
",",
"currentIndex",
"+",
"1",
")",
";",
"addAll",
"(",
"indices",
",",
"currentIndex",
"+",
"2",
",",
"currentIndex",
"+",
"3",
",",
"nextIndex",
"+",
"2",
")",
";",
"addAll",
"(",
"indices",
",",
"currentIndex",
"+",
"3",
",",
"nextIndex",
"+",
"3",
",",
"nextIndex",
"+",
"2",
")",
";",
"}",
"}"
]
| Generates a cylindrical solid mesh. The center is at middle of the of the cylinder.
@param positions Where to save the position information
@param normals Where to save the normal information, can be null to ignore the attribute
@param indices Where to save the indices
@param radius The radius of the base and top
@param height The height (distance from the base to the top) | [
"Generates",
"a",
"cylindrical",
"solid",
"mesh",
".",
"The",
"center",
"is",
"at",
"middle",
"of",
"the",
"of",
"the",
"cylinder",
"."
]
| train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L941-L990 |
rimerosolutions/ant-git-tasks | src/main/java/com/rimerosolutions/ant/git/tasks/BranchListTask.java | BranchListTask.setListMode | public void setListMode(String listMode) {
"""
Sets the listing mode
@antdoc.notrequired
@param listMode - optional: corresponds to the -r/-a options; by default, only local branches will be listed
"""
if (!GitTaskUtils.isNullOrBlankString(listMode)) {
try {
this.listMode = ListBranchCommand.ListMode.valueOf(listMode);
}
catch (IllegalArgumentException e) {
ListBranchCommand.ListMode[] listModes = ListBranchCommand.ListMode.values();
List<String> listModeValidValues = new ArrayList<String>(listModes.length);
for (ListBranchCommand.ListMode aListMode : listModes) {
listModeValidValues.add(aListMode.name());
}
String validModes = listModeValidValues.toString();
throw new BuildException(String.format("Valid listMode options are: %s.", validModes));
}
}
} | java | public void setListMode(String listMode) {
if (!GitTaskUtils.isNullOrBlankString(listMode)) {
try {
this.listMode = ListBranchCommand.ListMode.valueOf(listMode);
}
catch (IllegalArgumentException e) {
ListBranchCommand.ListMode[] listModes = ListBranchCommand.ListMode.values();
List<String> listModeValidValues = new ArrayList<String>(listModes.length);
for (ListBranchCommand.ListMode aListMode : listModes) {
listModeValidValues.add(aListMode.name());
}
String validModes = listModeValidValues.toString();
throw new BuildException(String.format("Valid listMode options are: %s.", validModes));
}
}
} | [
"public",
"void",
"setListMode",
"(",
"String",
"listMode",
")",
"{",
"if",
"(",
"!",
"GitTaskUtils",
".",
"isNullOrBlankString",
"(",
"listMode",
")",
")",
"{",
"try",
"{",
"this",
".",
"listMode",
"=",
"ListBranchCommand",
".",
"ListMode",
".",
"valueOf",
"(",
"listMode",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"ListBranchCommand",
".",
"ListMode",
"[",
"]",
"listModes",
"=",
"ListBranchCommand",
".",
"ListMode",
".",
"values",
"(",
")",
";",
"List",
"<",
"String",
">",
"listModeValidValues",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"listModes",
".",
"length",
")",
";",
"for",
"(",
"ListBranchCommand",
".",
"ListMode",
"aListMode",
":",
"listModes",
")",
"{",
"listModeValidValues",
".",
"add",
"(",
"aListMode",
".",
"name",
"(",
")",
")",
";",
"}",
"String",
"validModes",
"=",
"listModeValidValues",
".",
"toString",
"(",
")",
";",
"throw",
"new",
"BuildException",
"(",
"String",
".",
"format",
"(",
"\"Valid listMode options are: %s.\"",
",",
"validModes",
")",
")",
";",
"}",
"}",
"}"
]
| Sets the listing mode
@antdoc.notrequired
@param listMode - optional: corresponds to the -r/-a options; by default, only local branches will be listed | [
"Sets",
"the",
"listing",
"mode"
]
| train | https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/tasks/BranchListTask.java#L59-L78 |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyObject.java | LazyObject.getJSONArray | public LazyArray getJSONArray(String key) throws LazyException {
"""
Returns the JSON array stored in this object for the given key.
@param key the name of the field on this object
@return an array value
@throws LazyException if the value for the given key was not an array.
"""
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | java | public LazyArray getJSONArray(String key) throws LazyException{
LazyNode token=getFieldToken(key);
if(token.type!=LazyNode.ARRAY)throw new LazyException("Requested value is not an array",token);
LazyArray arr=new LazyArray(token);
arr.parent=this;
return arr;
} | [
"public",
"LazyArray",
"getJSONArray",
"(",
"String",
"key",
")",
"throws",
"LazyException",
"{",
"LazyNode",
"token",
"=",
"getFieldToken",
"(",
"key",
")",
";",
"if",
"(",
"token",
".",
"type",
"!=",
"LazyNode",
".",
"ARRAY",
")",
"throw",
"new",
"LazyException",
"(",
"\"Requested value is not an array\"",
",",
"token",
")",
";",
"LazyArray",
"arr",
"=",
"new",
"LazyArray",
"(",
"token",
")",
";",
"arr",
".",
"parent",
"=",
"this",
";",
"return",
"arr",
";",
"}"
]
| Returns the JSON array stored in this object for the given key.
@param key the name of the field on this object
@return an array value
@throws LazyException if the value for the given key was not an array. | [
"Returns",
"the",
"JSON",
"array",
"stored",
"in",
"this",
"object",
"for",
"the",
"given",
"key",
"."
]
| train | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyObject.java#L610-L616 |
danielnorberg/rut | rut/src/main/java/io/norberg/rut/Encoding.java | Encoding.utf8Read4 | private static int utf8Read4(int cu1, int cu2, int cu3, int cu4) {
"""
Read a 4 byte UTF8 sequence.
@return the resulting code point or {@link #INVALID} if invalid.
"""
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xF0 && cu2 < 0x90) {
return INVALID; // overlong
}
if (cu1 == 0xF4 && cu2 >= 0x90) {
return INVALID; // > U+10FFFF
}
if ((cu3 & 0xC0) != 0x80) {
return INVALID;
}
if ((cu4 & 0xC0) != 0x80) {
return INVALID;
}
return (cu1 << 18) + (cu2 << 12) + (cu3 << 6) + cu4 - 0x3C82080;
} | java | private static int utf8Read4(int cu1, int cu2, int cu3, int cu4) {
if ((cu2 & 0xC0) != 0x80) {
return INVALID;
}
if (cu1 == 0xF0 && cu2 < 0x90) {
return INVALID; // overlong
}
if (cu1 == 0xF4 && cu2 >= 0x90) {
return INVALID; // > U+10FFFF
}
if ((cu3 & 0xC0) != 0x80) {
return INVALID;
}
if ((cu4 & 0xC0) != 0x80) {
return INVALID;
}
return (cu1 << 18) + (cu2 << 12) + (cu3 << 6) + cu4 - 0x3C82080;
} | [
"private",
"static",
"int",
"utf8Read4",
"(",
"int",
"cu1",
",",
"int",
"cu2",
",",
"int",
"cu3",
",",
"int",
"cu4",
")",
"{",
"if",
"(",
"(",
"cu2",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"return",
"INVALID",
";",
"}",
"if",
"(",
"cu1",
"==",
"0xF0",
"&&",
"cu2",
"<",
"0x90",
")",
"{",
"return",
"INVALID",
";",
"// overlong",
"}",
"if",
"(",
"cu1",
"==",
"0xF4",
"&&",
"cu2",
">=",
"0x90",
")",
"{",
"return",
"INVALID",
";",
"// > U+10FFFF",
"}",
"if",
"(",
"(",
"cu3",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"return",
"INVALID",
";",
"}",
"if",
"(",
"(",
"cu4",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"return",
"INVALID",
";",
"}",
"return",
"(",
"cu1",
"<<",
"18",
")",
"+",
"(",
"cu2",
"<<",
"12",
")",
"+",
"(",
"cu3",
"<<",
"6",
")",
"+",
"cu4",
"-",
"0x3C82080",
";",
"}"
]
| Read a 4 byte UTF8 sequence.
@return the resulting code point or {@link #INVALID} if invalid. | [
"Read",
"a",
"4",
"byte",
"UTF8",
"sequence",
"."
]
| train | https://github.com/danielnorberg/rut/blob/6cd99e0d464da934d446b554ab5bbecaf294fcdc/rut/src/main/java/io/norberg/rut/Encoding.java#L243-L260 |
Red5/red5-io | src/main/java/org/red5/io/utils/DOM2Writer.java | DOM2Writer.serializeAsXML | public static void serializeAsXML(Node node, Writer writer) {
"""
Serialize this node into the writer as XML.
@param writer
Writer object
@param node
DOM node
"""
PrintWriter out = new PrintWriter(writer);
print(node, out);
out.flush();
} | java | public static void serializeAsXML(Node node, Writer writer) {
PrintWriter out = new PrintWriter(writer);
print(node, out);
out.flush();
} | [
"public",
"static",
"void",
"serializeAsXML",
"(",
"Node",
"node",
",",
"Writer",
"writer",
")",
"{",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"writer",
")",
";",
"print",
"(",
"node",
",",
"out",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}"
]
| Serialize this node into the writer as XML.
@param writer
Writer object
@param node
DOM node | [
"Serialize",
"this",
"node",
"into",
"the",
"writer",
"as",
"XML",
"."
]
| train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/DOM2Writer.java#L47-L51 |
berkesa/datatree | src/main/java/io/datatree/Tree.java | Tree.getObject | private <TO> TO getObject(String path, Class<TO> to) {
"""
Returns the Object (or null) to which the specified path is mapped.
@param path
path (e.g. "path.to.node[0]")
@param to
target type
@return the value of the node (or null)
"""
Tree child = getChild(path, false);
if (child == null) {
return null;
}
return DataConverterRegistry.convert(to, child.value);
} | java | private <TO> TO getObject(String path, Class<TO> to) {
Tree child = getChild(path, false);
if (child == null) {
return null;
}
return DataConverterRegistry.convert(to, child.value);
} | [
"private",
"<",
"TO",
">",
"TO",
"getObject",
"(",
"String",
"path",
",",
"Class",
"<",
"TO",
">",
"to",
")",
"{",
"Tree",
"child",
"=",
"getChild",
"(",
"path",
",",
"false",
")",
";",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"DataConverterRegistry",
".",
"convert",
"(",
"to",
",",
"child",
".",
"value",
")",
";",
"}"
]
| Returns the Object (or null) to which the specified path is mapped.
@param path
path (e.g. "path.to.node[0]")
@param to
target type
@return the value of the node (or null) | [
"Returns",
"the",
"Object",
"(",
"or",
"null",
")",
"to",
"which",
"the",
"specified",
"path",
"is",
"mapped",
"."
]
| train | https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2988-L2994 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java | I18N.writeTo | public static void writeTo(String html, Writer writer) throws IOException {
"""
Écrit un texte dans un flux en remplaçant dans le texte les clés entourées de deux '#'
par leurs traductions dans la locale courante.
@param html texte html avec éventuellement des #clé#
@param writer flux
@throws IOException e
"""
int index = html.indexOf('#');
if (index == -1) {
writer.write(html);
} else {
final ResourceBundle resourceBundle = getResourceBundle();
int begin = 0;
while (index != -1) {
writer.write(html, begin, index - begin);
final int nextIndex = html.indexOf('#', index + 1);
final String key = html.substring(index + 1, nextIndex);
writer.write(resourceBundle.getString(key));
begin = nextIndex + 1;
index = html.indexOf('#', begin);
}
writer.write(html, begin, html.length() - begin);
}
} | java | public static void writeTo(String html, Writer writer) throws IOException {
int index = html.indexOf('#');
if (index == -1) {
writer.write(html);
} else {
final ResourceBundle resourceBundle = getResourceBundle();
int begin = 0;
while (index != -1) {
writer.write(html, begin, index - begin);
final int nextIndex = html.indexOf('#', index + 1);
final String key = html.substring(index + 1, nextIndex);
writer.write(resourceBundle.getString(key));
begin = nextIndex + 1;
index = html.indexOf('#', begin);
}
writer.write(html, begin, html.length() - begin);
}
} | [
"public",
"static",
"void",
"writeTo",
"(",
"String",
"html",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"int",
"index",
"=",
"html",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"writer",
".",
"write",
"(",
"html",
")",
";",
"}",
"else",
"{",
"final",
"ResourceBundle",
"resourceBundle",
"=",
"getResourceBundle",
"(",
")",
";",
"int",
"begin",
"=",
"0",
";",
"while",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"writer",
".",
"write",
"(",
"html",
",",
"begin",
",",
"index",
"-",
"begin",
")",
";",
"final",
"int",
"nextIndex",
"=",
"html",
".",
"indexOf",
"(",
"'",
"'",
",",
"index",
"+",
"1",
")",
";",
"final",
"String",
"key",
"=",
"html",
".",
"substring",
"(",
"index",
"+",
"1",
",",
"nextIndex",
")",
";",
"writer",
".",
"write",
"(",
"resourceBundle",
".",
"getString",
"(",
"key",
")",
")",
";",
"begin",
"=",
"nextIndex",
"+",
"1",
";",
"index",
"=",
"html",
".",
"indexOf",
"(",
"'",
"'",
",",
"begin",
")",
";",
"}",
"writer",
".",
"write",
"(",
"html",
",",
"begin",
",",
"html",
".",
"length",
"(",
")",
"-",
"begin",
")",
";",
"}",
"}"
]
| Écrit un texte dans un flux en remplaçant dans le texte les clés entourées de deux '#'
par leurs traductions dans la locale courante.
@param html texte html avec éventuellement des #clé#
@param writer flux
@throws IOException e | [
"Écrit",
"un",
"texte",
"dans",
"un",
"flux",
"en",
"remplaçant",
"dans",
"le",
"texte",
"les",
"clés",
"entourées",
"de",
"deux",
"#",
"par",
"leurs",
"traductions",
"dans",
"la",
"locale",
"courante",
"."
]
| train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java#L173-L190 |
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 {
"""
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.
"""
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",
"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",
")",
";",
"}",
"}"
]
| 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 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java | ArrayMap.putAll | public void putAll(ArrayMap<? extends K, ? extends V> array) {
"""
Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var>
@param array The array whose contents are to be retrieved.
"""
final int N = array.mSize;
ensureCapacity(mSize + N);
if (mSize == 0) {
if (N > 0) {
System.arraycopy(array.mHashes, 0, mHashes, 0, N);
System.arraycopy(array.mArray, 0, mArray, 0, N<<1);
mSize = N;
}
} else {
for (int i=0; i<N; i++) {
put(array.keyAt(i), array.valueAt(i));
}
}
} | java | public void putAll(ArrayMap<? extends K, ? extends V> array) {
final int N = array.mSize;
ensureCapacity(mSize + N);
if (mSize == 0) {
if (N > 0) {
System.arraycopy(array.mHashes, 0, mHashes, 0, N);
System.arraycopy(array.mArray, 0, mArray, 0, N<<1);
mSize = N;
}
} else {
for (int i=0; i<N; i++) {
put(array.keyAt(i), array.valueAt(i));
}
}
} | [
"public",
"void",
"putAll",
"(",
"ArrayMap",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"array",
")",
"{",
"final",
"int",
"N",
"=",
"array",
".",
"mSize",
";",
"ensureCapacity",
"(",
"mSize",
"+",
"N",
")",
";",
"if",
"(",
"mSize",
"==",
"0",
")",
"{",
"if",
"(",
"N",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"array",
".",
"mHashes",
",",
"0",
",",
"mHashes",
",",
"0",
",",
"N",
")",
";",
"System",
".",
"arraycopy",
"(",
"array",
".",
"mArray",
",",
"0",
",",
"mArray",
",",
"0",
",",
"N",
"<<",
"1",
")",
";",
"mSize",
"=",
"N",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"put",
"(",
"array",
".",
"keyAt",
"(",
"i",
")",
",",
"array",
".",
"valueAt",
"(",
"i",
")",
")",
";",
"}",
"}",
"}"
]
| Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var>
@param array The array whose contents are to be retrieved. | [
"Perform",
"a",
"{"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java#L502-L516 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java | RoadPolyline.getBeginPoint | @Pure
<CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass) {
"""
Replies the first point of this segment.
@param <CT> is the type of the connection to reply
@param connectionClass is the type of the connection to reply
@return the first point of <code>null</code>
"""
final StandardRoadConnection connection = this.firstConnection;
if (connection == null) {
return null;
}
if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) {
return connectionClass.cast(connection);
}
if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) {
return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, true));
}
throw new IllegalArgumentException("unsupported RoadConnection class"); //$NON-NLS-1$
} | java | @Pure
<CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass) {
final StandardRoadConnection connection = this.firstConnection;
if (connection == null) {
return null;
}
if (connectionClass.isAssignableFrom(StandardRoadConnection.class)) {
return connectionClass.cast(connection);
}
if (connectionClass.isAssignableFrom(RoadConnectionWithArrivalSegment.class)) {
return connectionClass.cast(new RoadConnectionWithArrivalSegment(connection, this, true));
}
throw new IllegalArgumentException("unsupported RoadConnection class"); //$NON-NLS-1$
} | [
"@",
"Pure",
"<",
"CT",
"extends",
"RoadConnection",
">",
"CT",
"getBeginPoint",
"(",
"Class",
"<",
"CT",
">",
"connectionClass",
")",
"{",
"final",
"StandardRoadConnection",
"connection",
"=",
"this",
".",
"firstConnection",
";",
"if",
"(",
"connection",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"connectionClass",
".",
"isAssignableFrom",
"(",
"StandardRoadConnection",
".",
"class",
")",
")",
"{",
"return",
"connectionClass",
".",
"cast",
"(",
"connection",
")",
";",
"}",
"if",
"(",
"connectionClass",
".",
"isAssignableFrom",
"(",
"RoadConnectionWithArrivalSegment",
".",
"class",
")",
")",
"{",
"return",
"connectionClass",
".",
"cast",
"(",
"new",
"RoadConnectionWithArrivalSegment",
"(",
"connection",
",",
"this",
",",
"true",
")",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"unsupported RoadConnection class\"",
")",
";",
"//$NON-NLS-1$",
"}"
]
| Replies the first point of this segment.
@param <CT> is the type of the connection to reply
@param connectionClass is the type of the connection to reply
@return the first point of <code>null</code> | [
"Replies",
"the",
"first",
"point",
"of",
"this",
"segment",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java#L242-L255 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.prepareAttachment | public static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory,
Attachment attachment)
throws AttachmentException {
"""
Creates a PreparedAttachment from {@code attachment}, preparing it for insertion into
the DocumentStore.
@param attachmentStreamFactory
@param attachment Attachment to prepare for insertion into DocumentStore
@return PreparedAttachment, which can be used in addAttachment methods
@throws AttachmentException if there was an error preparing the attachment, e.g., reading
attachment data.
"""
if (attachment.encoding != Attachment.Encoding.Plain) {
throw new AttachmentNotSavedException("Encoded attachments can only be prepared if the value of \"length\" is known");
}
return new PreparedAttachment(attachment, attachmentsDir, 0, attachmentStreamFactory);
} | java | public static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory,
Attachment attachment)
throws AttachmentException {
if (attachment.encoding != Attachment.Encoding.Plain) {
throw new AttachmentNotSavedException("Encoded attachments can only be prepared if the value of \"length\" is known");
}
return new PreparedAttachment(attachment, attachmentsDir, 0, attachmentStreamFactory);
} | [
"public",
"static",
"PreparedAttachment",
"prepareAttachment",
"(",
"String",
"attachmentsDir",
",",
"AttachmentStreamFactory",
"attachmentStreamFactory",
",",
"Attachment",
"attachment",
")",
"throws",
"AttachmentException",
"{",
"if",
"(",
"attachment",
".",
"encoding",
"!=",
"Attachment",
".",
"Encoding",
".",
"Plain",
")",
"{",
"throw",
"new",
"AttachmentNotSavedException",
"(",
"\"Encoded attachments can only be prepared if the value of \\\"length\\\" is known\"",
")",
";",
"}",
"return",
"new",
"PreparedAttachment",
"(",
"attachment",
",",
"attachmentsDir",
",",
"0",
",",
"attachmentStreamFactory",
")",
";",
"}"
]
| Creates a PreparedAttachment from {@code attachment}, preparing it for insertion into
the DocumentStore.
@param attachmentStreamFactory
@param attachment Attachment to prepare for insertion into DocumentStore
@return PreparedAttachment, which can be used in addAttachment methods
@throws AttachmentException if there was an error preparing the attachment, e.g., reading
attachment data. | [
"Creates",
"a",
"PreparedAttachment",
"from",
"{",
"@code",
"attachment",
"}",
"preparing",
"it",
"for",
"insertion",
"into",
"the",
"DocumentStore",
"."
]
| train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L201-L209 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.exclusiveBetween | @SuppressWarnings("boxing")
public static void exclusiveBetween(final long start, final long end, final long value) {
"""
Validate that the specified primitive value falls between the two
exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0, 2, 1);</pre>
@param start the exclusive start value
@param end the exclusive end value
@param value the value to validate
@throws IllegalArgumentException if the value falls out of the boundaries
@since 3.3
"""
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
} | java | @SuppressWarnings("boxing")
public static void exclusiveBetween(final long start, final long end, final long value) {
// TODO when breaking BC, consider returning value
if (value <= start || value >= end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"boxing\"",
")",
"public",
"static",
"void",
"exclusiveBetween",
"(",
"final",
"long",
"start",
",",
"final",
"long",
"end",
",",
"final",
"long",
"value",
")",
"{",
"// TODO when breaking BC, consider returning value",
"if",
"(",
"value",
"<=",
"start",
"||",
"value",
">=",
"end",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"StringUtils",
".",
"simpleFormat",
"(",
"DEFAULT_EXCLUSIVE_BETWEEN_EX_MESSAGE",
",",
"value",
",",
"start",
",",
"end",
")",
")",
";",
"}",
"}"
]
| Validate that the specified primitive value falls between the two
exclusive values specified; otherwise, throws an exception.
<pre>Validate.exclusiveBetween(0, 2, 1);</pre>
@param start the exclusive start value
@param end the exclusive end value
@param value the value to validate
@throws IllegalArgumentException if the value falls out of the boundaries
@since 3.3 | [
"Validate",
"that",
"the",
"specified",
"primitive",
"value",
"falls",
"between",
"the",
"two",
"exclusive",
"values",
"specified",
";",
"otherwise",
"throws",
"an",
"exception",
"."
]
| train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1172-L1178 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.removePTableOwner | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty) {
"""
Free this table if it is no longer being used.
@param pTableOwner The table owner to remove.
"""
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | java | public synchronized int removePTableOwner(ThinPhysicalTableOwner pTableOwner, boolean bFreeIfEmpty)
{
if (pTableOwner != null)
{
m_setPTableOwners.remove(pTableOwner);
pTableOwner.setPTable(null);
}
if (m_setPTableOwners.size() == 0)
if (bFreeIfEmpty)
{
this.free();
return 0;
}
m_lTimeLastUsed = System.currentTimeMillis();
return m_setPTableOwners.size();
} | [
"public",
"synchronized",
"int",
"removePTableOwner",
"(",
"ThinPhysicalTableOwner",
"pTableOwner",
",",
"boolean",
"bFreeIfEmpty",
")",
"{",
"if",
"(",
"pTableOwner",
"!=",
"null",
")",
"{",
"m_setPTableOwners",
".",
"remove",
"(",
"pTableOwner",
")",
";",
"pTableOwner",
".",
"setPTable",
"(",
"null",
")",
";",
"}",
"if",
"(",
"m_setPTableOwners",
".",
"size",
"(",
")",
"==",
"0",
")",
"if",
"(",
"bFreeIfEmpty",
")",
"{",
"this",
".",
"free",
"(",
")",
";",
"return",
"0",
";",
"}",
"m_lTimeLastUsed",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"return",
"m_setPTableOwners",
".",
"size",
"(",
")",
";",
"}"
]
| Free this table if it is no longer being used.
@param pTableOwner The table owner to remove. | [
"Free",
"this",
"table",
"if",
"it",
"is",
"no",
"longer",
"being",
"used",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L148-L163 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java | URLRewriterService.dumpURLRewriters | public static void dumpURLRewriters( ServletRequest request, PrintStream output ) {
"""
Print out information about the chain of URLRewriters in this request.
@param request the current HttpServletRequest.
@param output a PrintStream to output chain of URLRewriters in this request.
If <code>null</null>, <code>System.err</code> is used.
"""
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( output == null ) output = System.err;
output.println( "*** List of URLRewriter objects: " + rewriters );
if ( rewriters != null )
{
int count = 0;
for ( Iterator i = rewriters.iterator(); i.hasNext(); )
{
URLRewriter rewriter = ( URLRewriter ) i.next();
output.println( " " + count++ + ". " + rewriter.getClass().getName() );
output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() );
output.println( " rewriter: " + rewriter );
}
}
else
{
output.println( " No URLRewriter objects are registered with this request." );
}
} | java | public static void dumpURLRewriters( ServletRequest request, PrintStream output )
{
ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
if ( output == null ) output = System.err;
output.println( "*** List of URLRewriter objects: " + rewriters );
if ( rewriters != null )
{
int count = 0;
for ( Iterator i = rewriters.iterator(); i.hasNext(); )
{
URLRewriter rewriter = ( URLRewriter ) i.next();
output.println( " " + count++ + ". " + rewriter.getClass().getName() );
output.println( " allows other rewriters: " + rewriter.allowOtherRewriters() );
output.println( " rewriter: " + rewriter );
}
}
else
{
output.println( " No URLRewriter objects are registered with this request." );
}
} | [
"public",
"static",
"void",
"dumpURLRewriters",
"(",
"ServletRequest",
"request",
",",
"PrintStream",
"output",
")",
"{",
"ArrayList",
"/*< URLRewriter >*/",
"rewriters",
"=",
"getRewriters",
"(",
"request",
")",
";",
"if",
"(",
"output",
"==",
"null",
")",
"output",
"=",
"System",
".",
"err",
";",
"output",
".",
"println",
"(",
"\"*** List of URLRewriter objects: \"",
"+",
"rewriters",
")",
";",
"if",
"(",
"rewriters",
"!=",
"null",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Iterator",
"i",
"=",
"rewriters",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"URLRewriter",
"rewriter",
"=",
"(",
"URLRewriter",
")",
"i",
".",
"next",
"(",
")",
";",
"output",
".",
"println",
"(",
"\" \"",
"+",
"count",
"++",
"+",
"\". \"",
"+",
"rewriter",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"output",
".",
"println",
"(",
"\" allows other rewriters: \"",
"+",
"rewriter",
".",
"allowOtherRewriters",
"(",
")",
")",
";",
"output",
".",
"println",
"(",
"\" rewriter: \"",
"+",
"rewriter",
")",
";",
"}",
"}",
"else",
"{",
"output",
".",
"println",
"(",
"\" No URLRewriter objects are registered with this request.\"",
")",
";",
"}",
"}"
]
| Print out information about the chain of URLRewriters in this request.
@param request the current HttpServletRequest.
@param output a PrintStream to output chain of URLRewriters in this request.
If <code>null</null>, <code>System.err</code> is used. | [
"Print",
"out",
"information",
"about",
"the",
"chain",
"of",
"URLRewriters",
"in",
"this",
"request",
"."
]
| train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L355-L377 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java | MsgSettingController.annotationScan | @GetMapping("/setting/scan/ {
"""
Annotation scan.
@param maxdeeplevel the maxdeeplevel
@param req the req
@param res the res
"""maxdeeplevel}")
public void annotationScan(@PathVariable int maxdeeplevel, HttpServletRequest req, HttpServletResponse res) {
this.validationSessionComponent.sessionCheck(req);
this.msgSaver.annotationScan(maxdeeplevel);
} | java | @GetMapping("/setting/scan/{maxdeeplevel}")
public void annotationScan(@PathVariable int maxdeeplevel, HttpServletRequest req, HttpServletResponse res) {
this.validationSessionComponent.sessionCheck(req);
this.msgSaver.annotationScan(maxdeeplevel);
} | [
"@",
"GetMapping",
"(",
"\"/setting/scan/{maxdeeplevel}\"",
")",
"public",
"void",
"annotationScan",
"(",
"@",
"PathVariable",
"int",
"maxdeeplevel",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"{",
"this",
".",
"validationSessionComponent",
".",
"sessionCheck",
"(",
"req",
")",
";",
"this",
".",
"msgSaver",
".",
"annotationScan",
"(",
"maxdeeplevel",
")",
";",
"}"
]
| Annotation scan.
@param maxdeeplevel the maxdeeplevel
@param req the req
@param res the res | [
"Annotation",
"scan",
"."
]
| train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L62-L66 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/relatedsamples/SpearmanCorrelation.java | SpearmanCorrelation.scoreToPvalue | private static double scoreToPvalue(double score, int n) {
"""
Returns the Pvalue for a particular score.
@param score
@param n
@return
"""
double Zs= score*Math.sqrt(n-1.0);
double Ts= score*Math.sqrt((n-Zs)/(1.0-score*score));
return ContinuousDistributions.studentsCdf(Ts, n-2);
} | java | private static double scoreToPvalue(double score, int n) {
double Zs= score*Math.sqrt(n-1.0);
double Ts= score*Math.sqrt((n-Zs)/(1.0-score*score));
return ContinuousDistributions.studentsCdf(Ts, n-2);
} | [
"private",
"static",
"double",
"scoreToPvalue",
"(",
"double",
"score",
",",
"int",
"n",
")",
"{",
"double",
"Zs",
"=",
"score",
"*",
"Math",
".",
"sqrt",
"(",
"n",
"-",
"1.0",
")",
";",
"double",
"Ts",
"=",
"score",
"*",
"Math",
".",
"sqrt",
"(",
"(",
"n",
"-",
"Zs",
")",
"/",
"(",
"1.0",
"-",
"score",
"*",
"score",
")",
")",
";",
"return",
"ContinuousDistributions",
".",
"studentsCdf",
"(",
"Ts",
",",
"n",
"-",
"2",
")",
";",
"}"
]
| Returns the Pvalue for a particular score.
@param score
@param n
@return | [
"Returns",
"the",
"Pvalue",
"for",
"a",
"particular",
"score",
"."
]
| train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/relatedsamples/SpearmanCorrelation.java#L137-L141 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java | MediaServicesInner.updateAsync | public Observable<MediaServiceInner> updateAsync(String resourceGroupName, String mediaServiceName, MediaServiceInner parameters) {
"""
Updates a Media Service.
@param resourceGroupName Name of the resource group within the Azure subscription.
@param mediaServiceName Name of the Media Service.
@param parameters Media Service properties needed for update.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the MediaServiceInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, mediaServiceName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() {
@Override
public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) {
return response.body();
}
});
} | java | public Observable<MediaServiceInner> updateAsync(String resourceGroupName, String mediaServiceName, MediaServiceInner parameters) {
return updateWithServiceResponseAsync(resourceGroupName, mediaServiceName, parameters).map(new Func1<ServiceResponse<MediaServiceInner>, MediaServiceInner>() {
@Override
public MediaServiceInner call(ServiceResponse<MediaServiceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"MediaServiceInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"mediaServiceName",
",",
"MediaServiceInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"mediaServiceName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"MediaServiceInner",
">",
",",
"MediaServiceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"MediaServiceInner",
"call",
"(",
"ServiceResponse",
"<",
"MediaServiceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Updates a Media Service.
@param resourceGroupName Name of the resource group within the Azure subscription.
@param mediaServiceName Name of the Media Service.
@param parameters Media Service properties needed for update.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the MediaServiceInner object | [
"Updates",
"a",
"Media",
"Service",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L580-L587 |
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) {
"""
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
"""
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",
"objectName",
",",
"String",
"objectContent",
")",
"{",
"Activity",
"activity",
"=",
"Activity",
".",
"newActivity",
"(",
"verb",
",",
"title",
",",
"content",
",",
"category",
",",
"user",
",",
"object",
",",
"objectType",
",",
"objectName",
",",
"objectContent",
")",
";",
"return",
"postGroupActivity",
"(",
"groupId",
",",
"activity",
")",
";",
"}"
]
| 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 |
jayantk/jklol | src/com/jayantkrish/jklol/util/HeapUtils.java | HeapUtils.removeMin | public static final void removeMin(long[] heapKeys, double[] heapValues, int heapSize) {
"""
Removes the smallest key/value pair from the heap represented by
{@code heapKeys} and {@code heapValues}. After calling this method, the
size of the heap shrinks by 1.
@param heapKeys
@param heapValues
@param heapSize
"""
heapValues[0] = heapValues[heapSize - 1];
heapKeys[0] = heapKeys[heapSize - 1];
int curIndex = 0;
int leftIndex, rightIndex, minIndex;
boolean done = false;
while (!done) {
done = true;
leftIndex = 1 + (curIndex * 2);
rightIndex = leftIndex + 1;
minIndex = -1;
if (rightIndex < heapSize) {
minIndex = heapValues[leftIndex] <= heapValues[rightIndex] ? leftIndex : rightIndex;
} else if (leftIndex < heapSize) {
minIndex = leftIndex;
}
if (minIndex != -1 && heapValues[minIndex] < heapValues[curIndex]) {
swap(heapKeys, heapValues, curIndex, minIndex);
done = false;
curIndex = minIndex;
}
}
} | java | public static final void removeMin(long[] heapKeys, double[] heapValues, int heapSize) {
heapValues[0] = heapValues[heapSize - 1];
heapKeys[0] = heapKeys[heapSize - 1];
int curIndex = 0;
int leftIndex, rightIndex, minIndex;
boolean done = false;
while (!done) {
done = true;
leftIndex = 1 + (curIndex * 2);
rightIndex = leftIndex + 1;
minIndex = -1;
if (rightIndex < heapSize) {
minIndex = heapValues[leftIndex] <= heapValues[rightIndex] ? leftIndex : rightIndex;
} else if (leftIndex < heapSize) {
minIndex = leftIndex;
}
if (minIndex != -1 && heapValues[minIndex] < heapValues[curIndex]) {
swap(heapKeys, heapValues, curIndex, minIndex);
done = false;
curIndex = minIndex;
}
}
} | [
"public",
"static",
"final",
"void",
"removeMin",
"(",
"long",
"[",
"]",
"heapKeys",
",",
"double",
"[",
"]",
"heapValues",
",",
"int",
"heapSize",
")",
"{",
"heapValues",
"[",
"0",
"]",
"=",
"heapValues",
"[",
"heapSize",
"-",
"1",
"]",
";",
"heapKeys",
"[",
"0",
"]",
"=",
"heapKeys",
"[",
"heapSize",
"-",
"1",
"]",
";",
"int",
"curIndex",
"=",
"0",
";",
"int",
"leftIndex",
",",
"rightIndex",
",",
"minIndex",
";",
"boolean",
"done",
"=",
"false",
";",
"while",
"(",
"!",
"done",
")",
"{",
"done",
"=",
"true",
";",
"leftIndex",
"=",
"1",
"+",
"(",
"curIndex",
"*",
"2",
")",
";",
"rightIndex",
"=",
"leftIndex",
"+",
"1",
";",
"minIndex",
"=",
"-",
"1",
";",
"if",
"(",
"rightIndex",
"<",
"heapSize",
")",
"{",
"minIndex",
"=",
"heapValues",
"[",
"leftIndex",
"]",
"<=",
"heapValues",
"[",
"rightIndex",
"]",
"?",
"leftIndex",
":",
"rightIndex",
";",
"}",
"else",
"if",
"(",
"leftIndex",
"<",
"heapSize",
")",
"{",
"minIndex",
"=",
"leftIndex",
";",
"}",
"if",
"(",
"minIndex",
"!=",
"-",
"1",
"&&",
"heapValues",
"[",
"minIndex",
"]",
"<",
"heapValues",
"[",
"curIndex",
"]",
")",
"{",
"swap",
"(",
"heapKeys",
",",
"heapValues",
",",
"curIndex",
",",
"minIndex",
")",
";",
"done",
"=",
"false",
";",
"curIndex",
"=",
"minIndex",
";",
"}",
"}",
"}"
]
| Removes the smallest key/value pair from the heap represented by
{@code heapKeys} and {@code heapValues}. After calling this method, the
size of the heap shrinks by 1.
@param heapKeys
@param heapValues
@param heapSize | [
"Removes",
"the",
"smallest",
"key",
"/",
"value",
"pair",
"from",
"the",
"heap",
"represented",
"by",
"{",
"@code",
"heapKeys",
"}",
"and",
"{",
"@code",
"heapValues",
"}",
".",
"After",
"calling",
"this",
"method",
"the",
"size",
"of",
"the",
"heap",
"shrinks",
"by",
"1",
"."
]
| train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/HeapUtils.java#L75-L100 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.writeGroup | public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException {
"""
Writes an already existing group.<p>
The group id has to be a valid OpenCms group id.<br>
The group with the given id will be completely overridden
by the given data.<p>
@param context the current request context
@param group the group that should be written
@throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#ACCOUNT_MANAGER} for the current project
@throws CmsException if operation was not successful
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName())));
m_driverManager.writeGroup(dbc, group);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e);
} finally {
dbc.clear();
}
} | java | public void writeGroup(CmsRequestContext context, CmsGroup group) throws CmsException, CmsRoleViolationException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName())));
m_driverManager.writeGroup(dbc, group);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_GROUP_1, group.getName()), e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"writeGroup",
"(",
"CmsRequestContext",
"context",
",",
"CmsGroup",
"group",
")",
"throws",
"CmsException",
",",
"CmsRoleViolationException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"try",
"{",
"checkRole",
"(",
"dbc",
",",
"CmsRole",
".",
"ACCOUNT_MANAGER",
".",
"forOrgUnit",
"(",
"getParentOrganizationalUnit",
"(",
"group",
".",
"getName",
"(",
")",
")",
")",
")",
";",
"m_driverManager",
".",
"writeGroup",
"(",
"dbc",
",",
"group",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_WRITE_GROUP_1",
",",
"group",
".",
"getName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"}"
]
| Writes an already existing group.<p>
The group id has to be a valid OpenCms group id.<br>
The group with the given id will be completely overridden
by the given data.<p>
@param context the current request context
@param group the group that should be written
@throws CmsRoleViolationException if the current user does not own the role {@link CmsRole#ACCOUNT_MANAGER} for the current project
@throws CmsException if operation was not successful | [
"Writes",
"an",
"already",
"existing",
"group",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6666-L6677 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntIntDenseVector.java | IntIntDenseVector.add | public void add(IntIntVector other) {
"""
Updates this vector to be the entrywise sum of this vector with the other.
"""
if (other instanceof IntIntUnsortedVector) {
IntIntUnsortedVector vec = (IntIntUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntIntDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.IntAdd()));
}
} | java | public void add(IntIntVector other) {
if (other instanceof IntIntUnsortedVector) {
IntIntUnsortedVector vec = (IntIntUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntIntDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.IntAdd()));
}
} | [
"public",
"void",
"add",
"(",
"IntIntVector",
"other",
")",
"{",
"if",
"(",
"other",
"instanceof",
"IntIntUnsortedVector",
")",
"{",
"IntIntUnsortedVector",
"vec",
"=",
"(",
"IntIntUnsortedVector",
")",
"other",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vec",
".",
"top",
";",
"i",
"++",
")",
"{",
"this",
".",
"add",
"(",
"vec",
".",
"idx",
"[",
"i",
"]",
",",
"vec",
".",
"vals",
"[",
"i",
"]",
")",
";",
"}",
"}",
"else",
"{",
"// TODO: Add special case for IntIntDenseVector.",
"other",
".",
"iterate",
"(",
"new",
"SparseBinaryOpApplier",
"(",
"this",
",",
"new",
"Lambda",
".",
"IntAdd",
"(",
")",
")",
")",
";",
"}",
"}"
]
| Updates this vector to be the entrywise sum of this vector with the other. | [
"Updates",
"this",
"vector",
"to",
"be",
"the",
"entrywise",
"sum",
"of",
"this",
"vector",
"with",
"the",
"other",
"."
]
| train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntIntDenseVector.java#L143-L153 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.getNewResourceInfos | private List<CmsNewResourceInfo> getNewResourceInfos(CmsObject cms, CmsADEConfigData configData, Locale locale) {
"""
Returns the new resource infos.<p>
@param cms the current CMS context
@param configData the configuration data from which the new resource infos should be read
@param locale locale used for retrieving descriptions/titles
@return the new resource infos
"""
List<CmsNewResourceInfo> result = new ArrayList<CmsNewResourceInfo>();
for (CmsModelPageConfig modelConfig : configData.getModelPages()) {
try {
CmsNewResourceInfo info = createNewResourceInfo(cms, modelConfig.getResource(), locale);
info.setDefault(modelConfig.isDefault());
result.add(info);
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
}
}
Collections.sort(result, new Comparator<CmsNewResourceInfo>() {
public int compare(CmsNewResourceInfo a, CmsNewResourceInfo b) {
return ComparisonChain.start().compareTrueFirst(a.isDefault(), b.isDefault()).compare(
a.getNavPos(),
b.getNavPos(),
Ordering.natural().nullsLast()).result();
}
});
return result;
} | java | private List<CmsNewResourceInfo> getNewResourceInfos(CmsObject cms, CmsADEConfigData configData, Locale locale) {
List<CmsNewResourceInfo> result = new ArrayList<CmsNewResourceInfo>();
for (CmsModelPageConfig modelConfig : configData.getModelPages()) {
try {
CmsNewResourceInfo info = createNewResourceInfo(cms, modelConfig.getResource(), locale);
info.setDefault(modelConfig.isDefault());
result.add(info);
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
}
}
Collections.sort(result, new Comparator<CmsNewResourceInfo>() {
public int compare(CmsNewResourceInfo a, CmsNewResourceInfo b) {
return ComparisonChain.start().compareTrueFirst(a.isDefault(), b.isDefault()).compare(
a.getNavPos(),
b.getNavPos(),
Ordering.natural().nullsLast()).result();
}
});
return result;
} | [
"private",
"List",
"<",
"CmsNewResourceInfo",
">",
"getNewResourceInfos",
"(",
"CmsObject",
"cms",
",",
"CmsADEConfigData",
"configData",
",",
"Locale",
"locale",
")",
"{",
"List",
"<",
"CmsNewResourceInfo",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsNewResourceInfo",
">",
"(",
")",
";",
"for",
"(",
"CmsModelPageConfig",
"modelConfig",
":",
"configData",
".",
"getModelPages",
"(",
")",
")",
"{",
"try",
"{",
"CmsNewResourceInfo",
"info",
"=",
"createNewResourceInfo",
"(",
"cms",
",",
"modelConfig",
".",
"getResource",
"(",
")",
",",
"locale",
")",
";",
"info",
".",
"setDefault",
"(",
"modelConfig",
".",
"isDefault",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"info",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"Collections",
".",
"sort",
"(",
"result",
",",
"new",
"Comparator",
"<",
"CmsNewResourceInfo",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"CmsNewResourceInfo",
"a",
",",
"CmsNewResourceInfo",
"b",
")",
"{",
"return",
"ComparisonChain",
".",
"start",
"(",
")",
".",
"compareTrueFirst",
"(",
"a",
".",
"isDefault",
"(",
")",
",",
"b",
".",
"isDefault",
"(",
")",
")",
".",
"compare",
"(",
"a",
".",
"getNavPos",
"(",
")",
",",
"b",
".",
"getNavPos",
"(",
")",
",",
"Ordering",
".",
"natural",
"(",
")",
".",
"nullsLast",
"(",
")",
")",
".",
"result",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"result",
";",
"}"
]
| Returns the new resource infos.<p>
@param cms the current CMS context
@param configData the configuration data from which the new resource infos should be read
@param locale locale used for retrieving descriptions/titles
@return the new resource infos | [
"Returns",
"the",
"new",
"resource",
"infos",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2441-L2464 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java | ClassUtil.getResourceUrl | public static URL getResourceUrl(String resource, Class<?> baseClass) {
"""
获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL}
@see ResourceUtil#getResource(String, Class)
"""
return ResourceUtil.getResource(resource, baseClass);
} | java | public static URL getResourceUrl(String resource, Class<?> baseClass) {
return ResourceUtil.getResource(resource, baseClass);
} | [
"public",
"static",
"URL",
"getResourceUrl",
"(",
"String",
"resource",
",",
"Class",
"<",
"?",
">",
"baseClass",
")",
"{",
"return",
"ResourceUtil",
".",
"getResource",
"(",
"resource",
",",
"baseClass",
")",
";",
"}"
]
| 获得资源相对路径对应的URL
@param resource 资源相对路径
@param baseClass 基准Class,获得的相对路径相对于此Class所在路径,如果为{@code null}则相对ClassPath
@return {@link URL}
@see ResourceUtil#getResource(String, Class) | [
"获得资源相对路径对应的URL"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L510-L512 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bmr/BmrClient.java | BmrClient.getStep | public GetStepResponse getStep(String clusterId, String stepId) {
"""
Describe the detail information of the target step.
@param clusterId The ID of the cluster which owns the step.
@param stepId The ID of the target step.
@return The response containing the detail information of the target step.
"""
return getStep(new GetStepRequest().withClusterId(clusterId).withStepId(stepId));
} | java | public GetStepResponse getStep(String clusterId, String stepId) {
return getStep(new GetStepRequest().withClusterId(clusterId).withStepId(stepId));
} | [
"public",
"GetStepResponse",
"getStep",
"(",
"String",
"clusterId",
",",
"String",
"stepId",
")",
"{",
"return",
"getStep",
"(",
"new",
"GetStepRequest",
"(",
")",
".",
"withClusterId",
"(",
"clusterId",
")",
".",
"withStepId",
"(",
"stepId",
")",
")",
";",
"}"
]
| Describe the detail information of the target step.
@param clusterId The ID of the cluster which owns the step.
@param stepId The ID of the target step.
@return The response containing the detail information of the target step. | [
"Describe",
"the",
"detail",
"information",
"of",
"the",
"target",
"step",
"."
]
| train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bmr/BmrClient.java#L566-L568 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java | DiscreteDistributions.approxBinomialCdf | private static double approxBinomialCdf(int k, double p, int n) {
"""
Returns the a good approximation of cumulative probability of k of a specific number of tries n and probability p
@param k
@param p
@param n
@return
"""
//use an approximation as described at http://www.math.ucla.edu/~tom/distributions/binomial.html
double Z = p;
double A=k+1;
double B=n-k;
double S=A+B;
double BT=Math.exp(ContinuousDistributions.logGamma(S)-ContinuousDistributions.logGamma(B)-ContinuousDistributions.logGamma(A)+A*Math.log(Z)+B*Math.log(1-Z));
double probabilitySum;
if (Z<(A+1)/(S+2)) {
probabilitySum=BT*ContinuousDistributions.betinc(Z,A,B);
}
else {
probabilitySum=1.0-BT*ContinuousDistributions.betinc(1.0-Z,B,A);
}
probabilitySum=1.0-probabilitySum;
return probabilitySum;
} | java | private static double approxBinomialCdf(int k, double p, int n) {
//use an approximation as described at http://www.math.ucla.edu/~tom/distributions/binomial.html
double Z = p;
double A=k+1;
double B=n-k;
double S=A+B;
double BT=Math.exp(ContinuousDistributions.logGamma(S)-ContinuousDistributions.logGamma(B)-ContinuousDistributions.logGamma(A)+A*Math.log(Z)+B*Math.log(1-Z));
double probabilitySum;
if (Z<(A+1)/(S+2)) {
probabilitySum=BT*ContinuousDistributions.betinc(Z,A,B);
}
else {
probabilitySum=1.0-BT*ContinuousDistributions.betinc(1.0-Z,B,A);
}
probabilitySum=1.0-probabilitySum;
return probabilitySum;
} | [
"private",
"static",
"double",
"approxBinomialCdf",
"(",
"int",
"k",
",",
"double",
"p",
",",
"int",
"n",
")",
"{",
"//use an approximation as described at http://www.math.ucla.edu/~tom/distributions/binomial.html",
"double",
"Z",
"=",
"p",
";",
"double",
"A",
"=",
"k",
"+",
"1",
";",
"double",
"B",
"=",
"n",
"-",
"k",
";",
"double",
"S",
"=",
"A",
"+",
"B",
";",
"double",
"BT",
"=",
"Math",
".",
"exp",
"(",
"ContinuousDistributions",
".",
"logGamma",
"(",
"S",
")",
"-",
"ContinuousDistributions",
".",
"logGamma",
"(",
"B",
")",
"-",
"ContinuousDistributions",
".",
"logGamma",
"(",
"A",
")",
"+",
"A",
"*",
"Math",
".",
"log",
"(",
"Z",
")",
"+",
"B",
"*",
"Math",
".",
"log",
"(",
"1",
"-",
"Z",
")",
")",
";",
"double",
"probabilitySum",
";",
"if",
"(",
"Z",
"<",
"(",
"A",
"+",
"1",
")",
"/",
"(",
"S",
"+",
"2",
")",
")",
"{",
"probabilitySum",
"=",
"BT",
"*",
"ContinuousDistributions",
".",
"betinc",
"(",
"Z",
",",
"A",
",",
"B",
")",
";",
"}",
"else",
"{",
"probabilitySum",
"=",
"1.0",
"-",
"BT",
"*",
"ContinuousDistributions",
".",
"betinc",
"(",
"1.0",
"-",
"Z",
",",
"B",
",",
"A",
")",
";",
"}",
"probabilitySum",
"=",
"1.0",
"-",
"probabilitySum",
";",
"return",
"probabilitySum",
";",
"}"
]
| Returns the a good approximation of cumulative probability of k of a specific number of tries n and probability p
@param k
@param p
@param n
@return | [
"Returns",
"the",
"a",
"good",
"approximation",
"of",
"cumulative",
"probability",
"of",
"k",
"of",
"a",
"specific",
"number",
"of",
"tries",
"n",
"and",
"probability",
"p"
]
| train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L126-L144 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.toList | @NotNull
public static <T> Collector<T, ?, List<T>> toList() {
"""
Returns a {@code Collector} that fills new {@code List} with input elements.
@param <T> the type of the input elements
@return a {@code Collector}
"""
return new CollectorsImpl<T, List<T>, List<T>>(
new Supplier<List<T>>() {
@NotNull
@Override
public List<T> get() {
return new ArrayList<T>();
}
},
new BiConsumer<List<T>, T>() {
@Override
public void accept(@NotNull List<T> t, T u) {
t.add(u);
}
}
);
} | java | @NotNull
public static <T> Collector<T, ?, List<T>> toList() {
return new CollectorsImpl<T, List<T>, List<T>>(
new Supplier<List<T>>() {
@NotNull
@Override
public List<T> get() {
return new ArrayList<T>();
}
},
new BiConsumer<List<T>, T>() {
@Override
public void accept(@NotNull List<T> t, T u) {
t.add(u);
}
}
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"List",
"<",
"T",
">",
">",
"toList",
"(",
")",
"{",
"return",
"new",
"CollectorsImpl",
"<",
"T",
",",
"List",
"<",
"T",
">",
",",
"List",
"<",
"T",
">",
">",
"(",
"new",
"Supplier",
"<",
"List",
"<",
"T",
">",
">",
"(",
")",
"{",
"@",
"NotNull",
"@",
"Override",
"public",
"List",
"<",
"T",
">",
"get",
"(",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"}",
"}",
",",
"new",
"BiConsumer",
"<",
"List",
"<",
"T",
">",
",",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"accept",
"(",
"@",
"NotNull",
"List",
"<",
"T",
">",
"t",
",",
"T",
"u",
")",
"{",
"t",
".",
"add",
"(",
"u",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Returns a {@code Collector} that fills new {@code List} with input elements.
@param <T> the type of the input elements
@return a {@code Collector} | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"fills",
"new",
"{",
"@code",
"List",
"}",
"with",
"input",
"elements",
"."
]
| train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L72-L91 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/dense/Basic2DMatrix.java | Basic2DMatrix.from1DArray | public static Basic2DMatrix from1DArray(int rows, int columns, double[] array) {
"""
Creates a {@link Basic2DMatrix} of the given 1D {@code array} with
copying the underlying array.
"""
double[][] array2D = new double[rows][columns];
for (int i = 0; i < rows; i++) {
System.arraycopy(array, i * columns, array2D[i], 0, columns);
}
return new Basic2DMatrix(array2D);
} | java | public static Basic2DMatrix from1DArray(int rows, int columns, double[] array) {
double[][] array2D = new double[rows][columns];
for (int i = 0; i < rows; i++) {
System.arraycopy(array, i * columns, array2D[i], 0, columns);
}
return new Basic2DMatrix(array2D);
} | [
"public",
"static",
"Basic2DMatrix",
"from1DArray",
"(",
"int",
"rows",
",",
"int",
"columns",
",",
"double",
"[",
"]",
"array",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"array2D",
"=",
"new",
"double",
"[",
"rows",
"]",
"[",
"columns",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
";",
"i",
"++",
")",
"{",
"System",
".",
"arraycopy",
"(",
"array",
",",
"i",
"*",
"columns",
",",
"array2D",
"[",
"i",
"]",
",",
"0",
",",
"columns",
")",
";",
"}",
"return",
"new",
"Basic2DMatrix",
"(",
"array2D",
")",
";",
"}"
]
| Creates a {@link Basic2DMatrix} of the given 1D {@code array} with
copying the underlying array. | [
"Creates",
"a",
"{"
]
| train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/dense/Basic2DMatrix.java#L143-L151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.