repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
amzn/ion-java | src/com/amazon/ion/Timestamp.java | Timestamp.addDay | public final Timestamp addDay(int amount)
{
long delta = (long) amount * 24 * 60 * 60 * 1000;
return addMillisForPrecision(delta, Precision.DAY, false);
} | java | public final Timestamp addDay(int amount)
{
long delta = (long) amount * 24 * 60 * 60 * 1000;
return addMillisForPrecision(delta, Precision.DAY, false);
} | [
"public",
"final",
"Timestamp",
"addDay",
"(",
"int",
"amount",
")",
"{",
"long",
"delta",
"=",
"(",
"long",
")",
"amount",
"*",
"24",
"*",
"60",
"*",
"60",
"*",
"1000",
";",
"return",
"addMillisForPrecision",
"(",
"delta",
",",
"Precision",
".",
"DAY"... | Returns a timestamp relative to this one by the given number of days.
@param amount a number of days. | [
"Returns",
"a",
"timestamp",
"relative",
"to",
"this",
"one",
"by",
"the",
"given",
"number",
"of",
"days",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2443-L2447 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java | AppSummaryService.getNumberRunsScratch | long getNumberRunsScratch(Map<byte[], byte[]> rawFamily) {
long numberRuns = 0L;
if (rawFamily != null) {
numberRuns = rawFamily.size();
}
if (numberRuns == 0L) {
LOG.error("Number of runs in scratch column family can't be 0,"
+ " if processing within TTL");
throw new ProcessingException("Number of runs is 0");
}
return numberRuns;
} | java | long getNumberRunsScratch(Map<byte[], byte[]> rawFamily) {
long numberRuns = 0L;
if (rawFamily != null) {
numberRuns = rawFamily.size();
}
if (numberRuns == 0L) {
LOG.error("Number of runs in scratch column family can't be 0,"
+ " if processing within TTL");
throw new ProcessingException("Number of runs is 0");
}
return numberRuns;
} | [
"long",
"getNumberRunsScratch",
"(",
"Map",
"<",
"byte",
"[",
"]",
",",
"byte",
"[",
"]",
">",
"rawFamily",
")",
"{",
"long",
"numberRuns",
"=",
"0L",
";",
"if",
"(",
"rawFamily",
"!=",
"null",
")",
"{",
"numberRuns",
"=",
"rawFamily",
".",
"size",
"... | interprets the number of runs based on number of columns in raw col family
@param {@link Result}
@return number of runs | [
"interprets",
"the",
"number",
"of",
"runs",
"based",
"on",
"number",
"of",
"columns",
"in",
"raw",
"col",
"family"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java#L288-L299 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.convertNormToPixel | public static Point2D_F64 convertNormToPixel(CameraModel param , Point2D_F64 norm , Point2D_F64 pixel ) {
return convertNormToPixel(param,norm.x,norm.y,pixel);
} | java | public static Point2D_F64 convertNormToPixel(CameraModel param , Point2D_F64 norm , Point2D_F64 pixel ) {
return convertNormToPixel(param,norm.x,norm.y,pixel);
} | [
"public",
"static",
"Point2D_F64",
"convertNormToPixel",
"(",
"CameraModel",
"param",
",",
"Point2D_F64",
"norm",
",",
"Point2D_F64",
"pixel",
")",
"{",
"return",
"convertNormToPixel",
"(",
"param",
",",
"norm",
".",
"x",
",",
"norm",
".",
"y",
",",
"pixel",
... | <p>
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then {@link PinholeNtoP_F64} should be used instead.
</p>
NOTE: norm and pixel can be the same instance.
@param param Intrinsic camera parameters
@param norm Normalized image coordinate.
@param pixel Optional storage for output. If null a new instance will be declared.
@return pixel image coordinate | [
"<p",
">",
"Convenient",
"function",
"for",
"converting",
"from",
"normalized",
"image",
"coordinates",
"to",
"the",
"original",
"image",
"pixel",
"coordinate",
".",
"If",
"speed",
"is",
"a",
"concern",
"then",
"{",
"@link",
"PinholeNtoP_F64",
"}",
"should",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L410-L412 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.if_tcmpne | public void if_tcmpne(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmpne(target);
popType();
} | java | public void if_tcmpne(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmpne(target);
popType();
} | [
"public",
"void",
"if_tcmpne",
"(",
"TypeMirror",
"type",
",",
"String",
"target",
")",
"throws",
"IOException",
"{",
"pushType",
"(",
"type",
")",
";",
"if_tcmpne",
"(",
"target",
")",
";",
"popType",
"(",
")",
";",
"}"
] | ne succeeds if and only if value1 != value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException | [
"ne",
"succeeds",
"if",
"and",
"only",
"if",
"value1",
"!",
"=",
"value2",
"<p",
">",
"Stack",
":",
"...",
"value1",
"value2",
"=",
">",
";",
"..."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L572-L577 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.beginMerge | void beginMerge(long offset, StreamSegmentReadIndex sourceStreamSegmentIndex) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "beginMerge", offset, sourceStreamSegmentIndex.traceObjectId);
Exceptions.checkNotClosed(this.closed, this);
Exceptions.checkArgument(!sourceStreamSegmentIndex.isMerged(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged.");
SegmentMetadata sourceMetadata = sourceStreamSegmentIndex.metadata;
Exceptions.checkArgument(sourceMetadata.isSealed(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex refers to a StreamSegment that is not sealed.");
long sourceLength = sourceStreamSegmentIndex.getSegmentLength();
RedirectIndexEntry newEntry = new RedirectIndexEntry(offset, sourceStreamSegmentIndex);
if (sourceLength == 0) {
// Nothing to do. Just record that there is a merge for this source Segment id.
return;
}
// Metadata check can be done outside the write lock.
// Adding at the end means that we always need to "catch-up" with Length. Check to see if adding
// this entry will make us catch up to it or not.
long ourLength = getSegmentLength();
long endOffset = offset + sourceLength;
Exceptions.checkArgument(endOffset <= ourLength, "offset", "The given range of bytes(%d-%d) is beyond the StreamSegment Length (%d).", offset, endOffset, ourLength);
// Check and record the merger (optimistically).
synchronized (this.lock) {
Exceptions.checkArgument(!this.pendingMergers.containsKey(sourceMetadata.getId()), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged or in the process of being merged into this one.");
this.pendingMergers.put(sourceMetadata.getId(), new PendingMerge(newEntry.key()));
}
try {
appendEntry(newEntry);
} catch (Exception ex) {
// If the merger failed, roll back the markers.
synchronized (this.lock) {
this.pendingMergers.remove(sourceMetadata.getId());
}
throw ex;
}
LoggerHelpers.traceLeave(log, this.traceObjectId, "beginMerge", traceId);
} | java | void beginMerge(long offset, StreamSegmentReadIndex sourceStreamSegmentIndex) {
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "beginMerge", offset, sourceStreamSegmentIndex.traceObjectId);
Exceptions.checkNotClosed(this.closed, this);
Exceptions.checkArgument(!sourceStreamSegmentIndex.isMerged(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged.");
SegmentMetadata sourceMetadata = sourceStreamSegmentIndex.metadata;
Exceptions.checkArgument(sourceMetadata.isSealed(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex refers to a StreamSegment that is not sealed.");
long sourceLength = sourceStreamSegmentIndex.getSegmentLength();
RedirectIndexEntry newEntry = new RedirectIndexEntry(offset, sourceStreamSegmentIndex);
if (sourceLength == 0) {
// Nothing to do. Just record that there is a merge for this source Segment id.
return;
}
// Metadata check can be done outside the write lock.
// Adding at the end means that we always need to "catch-up" with Length. Check to see if adding
// this entry will make us catch up to it or not.
long ourLength = getSegmentLength();
long endOffset = offset + sourceLength;
Exceptions.checkArgument(endOffset <= ourLength, "offset", "The given range of bytes(%d-%d) is beyond the StreamSegment Length (%d).", offset, endOffset, ourLength);
// Check and record the merger (optimistically).
synchronized (this.lock) {
Exceptions.checkArgument(!this.pendingMergers.containsKey(sourceMetadata.getId()), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged or in the process of being merged into this one.");
this.pendingMergers.put(sourceMetadata.getId(), new PendingMerge(newEntry.key()));
}
try {
appendEntry(newEntry);
} catch (Exception ex) {
// If the merger failed, roll back the markers.
synchronized (this.lock) {
this.pendingMergers.remove(sourceMetadata.getId());
}
throw ex;
}
LoggerHelpers.traceLeave(log, this.traceObjectId, "beginMerge", traceId);
} | [
"void",
"beginMerge",
"(",
"long",
"offset",
",",
"StreamSegmentReadIndex",
"sourceStreamSegmentIndex",
")",
"{",
"long",
"traceId",
"=",
"LoggerHelpers",
".",
"traceEnterWithContext",
"(",
"log",
",",
"this",
".",
"traceObjectId",
",",
"\"beginMerge\"",
",",
"offse... | Executes Step 1 of the 2-Step Merge Process.
The StreamSegments are merged (Source->Target@Offset) in Metadata and a ReadIndex Redirection is put in place.
At this stage, the Source still exists as a physical object in Storage, and we need to keep its ReadIndex around, pointing
to the old object.
@param offset The offset within the StreamSegment to merge at.
@param sourceStreamSegmentIndex The Read Index to begin merging.
@throws NullPointerException If data is null.
@throws IllegalStateException If the current StreamSegment is a child StreamSegment.
@throws IllegalArgumentException If the operation would cause writing beyond the StreamSegment's Length.
@throws IllegalArgumentException If the offset is invalid (does not match the previous append offset).
@throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that is already merged.
@throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that has a different parent
StreamSegment than the current index's one. | [
"Executes",
"Step",
"1",
"of",
"the",
"2",
"-",
"Step",
"Merge",
"Process",
".",
"The",
"StreamSegments",
"are",
"merged",
"(",
"Source",
"-",
">",
"Target@Offset",
")",
"in",
"Metadata",
"and",
"a",
"ReadIndex",
"Redirection",
"is",
"put",
"in",
"place",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L374-L414 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/utility/UI/CurvedArrow.java | CurvedArrow.setStart | public void setStart(int x1, int y1) {
start.x = x1;
start.y = y1;
needsRefresh = true;
} | java | public void setStart(int x1, int y1) {
start.x = x1;
start.y = y1;
needsRefresh = true;
} | [
"public",
"void",
"setStart",
"(",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"start",
".",
"x",
"=",
"x1",
";",
"start",
".",
"y",
"=",
"y1",
";",
"needsRefresh",
"=",
"true",
";",
"}"
] | Sets the start point.
@param x1
the x coordinate of the start point
@param y1
the y coordinate of the start point | [
"Sets",
"the",
"start",
"point",
"."
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/UI/CurvedArrow.java#L90-L94 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/PipelineApi.java | PipelineApi.createPipelineSchedule | public PipelineSchedule createPipelineSchedule(Object projectIdOrPath, PipelineSchedule pipelineSchedule)
throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("description", pipelineSchedule.getDescription(), true)
.withParam("ref", pipelineSchedule.getRef(), true)
.withParam("cron", pipelineSchedule.getCron(), true)
.withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false)
.withParam("active", pipelineSchedule.getActive(), false);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules");
return (response.readEntity(PipelineSchedule.class));
} | java | public PipelineSchedule createPipelineSchedule(Object projectIdOrPath, PipelineSchedule pipelineSchedule)
throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("description", pipelineSchedule.getDescription(), true)
.withParam("ref", pipelineSchedule.getRef(), true)
.withParam("cron", pipelineSchedule.getCron(), true)
.withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false)
.withParam("active", pipelineSchedule.getActive(), false);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules");
return (response.readEntity(PipelineSchedule.class));
} | [
"public",
"PipelineSchedule",
"createPipelineSchedule",
"(",
"Object",
"projectIdOrPath",
",",
"PipelineSchedule",
"pipelineSchedule",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\... | create a pipeline schedule for a project.
<pre><code>POST /projects/:id/pipeline_schedules</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param pipelineSchedule a PipelineSchedule instance to create
@return the added PipelineSchedule instance
@throws GitLabApiException if any exception occurs | [
"create",
"a",
"pipeline",
"schedule",
"for",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L395-L406 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java | TextureAtlas.findUsableRegion | private RegionData findUsableRegion(int width, int height) {
final int imageWidth = image.getWidth();
final int imageHeight = image.getHeight();
for (int y = 0; y < imageHeight - height; y++) {
for (int x = 0; x < imageWidth - width; x++) {
final RegionData data = new RegionData(x, y, width, height);
if (!intersectsOtherTexture(data)) {
return data;
}
}
}
return null;
} | java | private RegionData findUsableRegion(int width, int height) {
final int imageWidth = image.getWidth();
final int imageHeight = image.getHeight();
for (int y = 0; y < imageHeight - height; y++) {
for (int x = 0; x < imageWidth - width; x++) {
final RegionData data = new RegionData(x, y, width, height);
if (!intersectsOtherTexture(data)) {
return data;
}
}
}
return null;
} | [
"private",
"RegionData",
"findUsableRegion",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"int",
"imageWidth",
"=",
"image",
".",
"getWidth",
"(",
")",
";",
"final",
"int",
"imageHeight",
"=",
"image",
".",
"getHeight",
"(",
")",
";",
"f... | Attempts to find a usable region of this {@link TextureAtlas}
@param width Width of the region
@param height Height of the region
@return The data for a valid region, null if none found. | [
"Attempts",
"to",
"find",
"a",
"usable",
"region",
"of",
"this",
"{",
"@link",
"TextureAtlas",
"}"
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java#L108-L120 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java | VelocityParser.isVarEscaped | private boolean isVarEscaped(char[] array, int currentIndex)
{
int i = currentIndex - 1;
while (i >= 0 && array[i] == '\\') {
--i;
}
return (currentIndex - i) % 2 == 0;
} | java | private boolean isVarEscaped(char[] array, int currentIndex)
{
int i = currentIndex - 1;
while (i >= 0 && array[i] == '\\') {
--i;
}
return (currentIndex - i) % 2 == 0;
} | [
"private",
"boolean",
"isVarEscaped",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"currentIndex",
")",
"{",
"int",
"i",
"=",
"currentIndex",
"-",
"1",
";",
"while",
"(",
"i",
">=",
"0",
"&&",
"array",
"[",
"i",
"]",
"==",
"'",
"'",
")",
"{",
"--"... | Look in previous characters of the array to find if the current var is escaped (like \$var).
@param array the source to parse
@param currentIndex the current index in the <code>array</code>
@return the parser context to put some informations | [
"Look",
"in",
"previous",
"characters",
"of",
"the",
"array",
"to",
"find",
"if",
"the",
"current",
"var",
"is",
"escaped",
"(",
"like",
"\\",
"$var",
")",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java#L426-L435 |
jinahya/hex-codec | src/main/java/com/github/jinahya/codec/HexDecoder.java | HexDecoder.decodeSingle | public static int decodeSingle(final byte[] input, final int inoff) {
if (input == null) {
throw new NullPointerException("input");
}
if (input.length < 2) {
// not required by (inoff >= input.length -1) checked below
throw new IllegalArgumentException(
"input.length(" + input.length + ") < 2");
}
if (inoff < 0) {
throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
}
if (inoff >= input.length - 1) {
throw new IllegalArgumentException(
"inoff(" + inoff + ") >= input.length(" + input.length
+ ") - 1");
}
return (decodeHalf(input[inoff] & 0xFF) << 4)
| decodeHalf(input[inoff + 1] & 0xFF);
} | java | public static int decodeSingle(final byte[] input, final int inoff) {
if (input == null) {
throw new NullPointerException("input");
}
if (input.length < 2) {
// not required by (inoff >= input.length -1) checked below
throw new IllegalArgumentException(
"input.length(" + input.length + ") < 2");
}
if (inoff < 0) {
throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
}
if (inoff >= input.length - 1) {
throw new IllegalArgumentException(
"inoff(" + inoff + ") >= input.length(" + input.length
+ ") - 1");
}
return (decodeHalf(input[inoff] & 0xFF) << 4)
| decodeHalf(input[inoff + 1] & 0xFF);
} | [
"public",
"static",
"int",
"decodeSingle",
"(",
"final",
"byte",
"[",
"]",
"input",
",",
"final",
"int",
"inoff",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input\"",
")",
";",
"}",
"if",
"(",
... | Decodes two nibbles in given input array and returns the decoded octet.
@param input the input array of nibbles.
@param inoff the offset in the array.
@return the decoded octet. | [
"Decodes",
"two",
"nibbles",
"in",
"given",
"input",
"array",
"and",
"returns",
"the",
"decoded",
"octet",
"."
] | train | https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L91-L115 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.collectEntries | public static <K,V> Map<?, ?> collectEntries(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> transform) {
return collectEntries(self, createSimilarMap(self), transform);
} | java | public static <K,V> Map<?, ?> collectEntries(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> transform) {
return collectEntries(self, createSimilarMap(self), transform);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"?",
",",
"?",
">",
"collectEntries",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"MapEntryOrKeyValue",
".",
"class",
")",
"Closure",
"<",
"?",
">",
"transfor... | Iterates through this Map transforming each entry using the <code>transform</code> closure
and returning a map of the transformed entries.
<pre class="groovyTestCase">
assert [a:1, b:2].collectEntries { key, value {@code ->} [value, key] } == [1:'a', 2:'b']
assert [a:1, b:2].collectEntries { key, value {@code ->}
[(value*10): key.toUpperCase()] } == [10:'A', 20:'B']
</pre>
Note: When using the list-style of result, the behavior is '<code>def (key, value) = listResultFromClosure</code>'.
While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case;
throwing away elements after the second one and using null for the key or value for the case of a shortened list.
If your Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException.
@param self a Map
@param transform the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and
should return a Map.Entry, a Map or a two-element list containing the resulting key and value
@return a Map of the transformed entries
@see #collect(Map, Collection, Closure)
@since 1.7.9 | [
"Iterates",
"through",
"this",
"Map",
"transforming",
"each",
"entry",
"using",
"the",
"<code",
">",
"transform<",
"/",
"code",
">",
"closure",
"and",
"returning",
"a",
"map",
"of",
"the",
"transformed",
"entries",
".",
"<pre",
"class",
"=",
"groovyTestCase",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3998-L4000 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java | CacheOnDisk.delTemplateEntry | public void delTemplateEntry(String template, Object entry) {
if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | java | public void delTemplateEntry(String template, Object entry) {
if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) {
stopOnError(this.htod.diskCacheException);
}
} | [
"public",
"void",
"delTemplateEntry",
"(",
"String",
"template",
",",
"Object",
"entry",
")",
"{",
"if",
"(",
"htod",
".",
"delTemplateEntry",
"(",
"template",
",",
"entry",
")",
"==",
"HTODDynacache",
".",
"DISK_EXCEPTION",
")",
"{",
"stopOnError",
"(",
"th... | Call this method to delete a cache id from a specified template in the disk.
@param template
- template id.
@param entry
- cache id. | [
"Call",
"this",
"method",
"to",
"delete",
"a",
"cache",
"id",
"from",
"a",
"specified",
"template",
"in",
"the",
"disk",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1526-L1530 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/crf/crfpp/Path.java | Path.calcExpectation | public void calcExpectation(double[] expected, double Z, int size)
{
double c = Math.exp(lnode.alpha + cost + rnode.beta - Z);
for (int i = 0; fvector.get(i) != -1; i++)
{
int idx = fvector.get(i) + lnode.y * size + rnode.y;
expected[idx] += c;
}
} | java | public void calcExpectation(double[] expected, double Z, int size)
{
double c = Math.exp(lnode.alpha + cost + rnode.beta - Z);
for (int i = 0; fvector.get(i) != -1; i++)
{
int idx = fvector.get(i) + lnode.y * size + rnode.y;
expected[idx] += c;
}
} | [
"public",
"void",
"calcExpectation",
"(",
"double",
"[",
"]",
"expected",
",",
"double",
"Z",
",",
"int",
"size",
")",
"{",
"double",
"c",
"=",
"Math",
".",
"exp",
"(",
"lnode",
".",
"alpha",
"+",
"cost",
"+",
"rnode",
".",
"beta",
"-",
"Z",
")",
... | 计算边的期望
@param expected 输出期望
@param Z 规范化因子
@param size 标签个数 | [
"计算边的期望"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/Path.java#L36-L44 |
zaproxy/zaproxy | src/org/zaproxy/zap/spider/URLCanonicalizer.java | URLCanonicalizer.isDefaultPort | private static boolean isDefaultPort(String scheme, int port) {
return HTTP_SCHEME.equalsIgnoreCase(scheme) && port == HTTP_DEFAULT_PORT
|| HTTPS_SCHEME.equalsIgnoreCase(scheme) && port == HTTPS_DEFAULT_PORT;
} | java | private static boolean isDefaultPort(String scheme, int port) {
return HTTP_SCHEME.equalsIgnoreCase(scheme) && port == HTTP_DEFAULT_PORT
|| HTTPS_SCHEME.equalsIgnoreCase(scheme) && port == HTTPS_DEFAULT_PORT;
} | [
"private",
"static",
"boolean",
"isDefaultPort",
"(",
"String",
"scheme",
",",
"int",
"port",
")",
"{",
"return",
"HTTP_SCHEME",
".",
"equalsIgnoreCase",
"(",
"scheme",
")",
"&&",
"port",
"==",
"HTTP_DEFAULT_PORT",
"||",
"HTTPS_SCHEME",
".",
"equalsIgnoreCase",
... | Tells whether or not the given port is the default for the given scheme.
<p>
<strong>Note:</strong> Only HTTP and HTTPS schemes are taken into account.
@param scheme the scheme
@param port the port
@return {@code true} if given the port is the default port for the given scheme, {@code false} otherwise. | [
"Tells",
"whether",
"or",
"not",
"the",
"given",
"port",
"is",
"the",
"default",
"for",
"the",
"given",
"scheme",
".",
"<p",
">",
"<strong",
">",
"Note",
":",
"<",
"/",
"strong",
">",
"Only",
"HTTP",
"and",
"HTTPS",
"schemes",
"are",
"taken",
"into",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/URLCanonicalizer.java#L200-L203 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java | SelfCalibrationLinearRotationMulti.extractCalibration | void extractCalibration( Homography2D_F64 Hinv , CameraPinhole c ) {
CommonOps_DDF3.multTransA(Hinv,W0,tmp);
CommonOps_DDF3.mult(tmp,Hinv,Wi);
convertW(Wi,c);
} | java | void extractCalibration( Homography2D_F64 Hinv , CameraPinhole c ) {
CommonOps_DDF3.multTransA(Hinv,W0,tmp);
CommonOps_DDF3.mult(tmp,Hinv,Wi);
convertW(Wi,c);
} | [
"void",
"extractCalibration",
"(",
"Homography2D_F64",
"Hinv",
",",
"CameraPinhole",
"c",
")",
"{",
"CommonOps_DDF3",
".",
"multTransA",
"(",
"Hinv",
",",
"W0",
",",
"tmp",
")",
";",
"CommonOps_DDF3",
".",
"mult",
"(",
"tmp",
",",
"Hinv",
",",
"Wi",
")",
... | Extracts calibration for the non-reference frames
w = H^-T*w*H^-1 | [
"Extracts",
"calibration",
"for",
"the",
"non",
"-",
"reference",
"frames"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java#L265-L270 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java | IOBaseComponent.setPosition | public void setPosition(float x, float y, float z) {
componentPosition.set(x, y, z);
if (sceneObject != null) {
sceneObject.getTransform().setPosition(x, y, z);
}
} | java | public void setPosition(float x, float y, float z) {
componentPosition.set(x, y, z);
if (sceneObject != null) {
sceneObject.getTransform().setPosition(x, y, z);
}
} | [
"public",
"void",
"setPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"componentPosition",
".",
"set",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"if",
"(",
"sceneObject",
"!=",
"null",
")",
"{",
"sceneObject",
".",
"getT... | Set the position of the {@link IOBaseComponent}
@param x the x value of the quaternion
@param y the y value of the quaternion
@param z the z value of the quaternion | [
"Set",
"the",
"position",
"of",
"the",
"{",
"@link",
"IOBaseComponent",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java#L97-L102 |
HiddenStage/divide | Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java | GCMRegistrar.register | public static void register(Context context, String... senderIds) {
GCMRegistrar.resetBackoff(context);
internalRegister(context, senderIds);
} | java | public static void register(Context context, String... senderIds) {
GCMRegistrar.resetBackoff(context);
internalRegister(context, senderIds);
} | [
"public",
"static",
"void",
"register",
"(",
"Context",
"context",
",",
"String",
"...",
"senderIds",
")",
"{",
"GCMRegistrar",
".",
"resetBackoff",
"(",
"context",
")",
";",
"internalRegister",
"(",
"context",
",",
"senderIds",
")",
";",
"}"
] | Initiate messaging registration for the current application.
<p>
The result will be returned as an
{@link GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK} intent with
either a {@link GCMConstants#EXTRA_REGISTRATION_ID} or
{@link GCMConstants#EXTRA_ERROR}.
@param context application context.
@param senderIds Google Project ID of the accounts authorized to send
messages to this application.
@throws IllegalStateException if device does not have all GCM
dependencies installed. | [
"Initiate",
"messaging",
"registration",
"for",
"the",
"current",
"application",
".",
"<p",
">",
"The",
"result",
"will",
"be",
"returned",
"as",
"an",
"{",
"@link",
"GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK",
"}",
"intent",
"with",
"either",
"a",
"{",
"... | train | https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java#L211-L214 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java | Objects.requireNonNullNorEmpty | public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) {
if (requireNonNull(collection).isEmpty()) {
throw new IllegalArgumentException(message);
}
return collection;
} | java | public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) {
if (requireNonNull(collection).isEmpty()) {
throw new IllegalArgumentException(message);
}
return collection;
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"requireNonNullNorEmpty",
"(",
"T",
"collection",
",",
"String",
"message",
")",
"{",
"if",
"(",
"requireNonNull",
"(",
"collection",
")",
".",
"isEmpty",
"(",
")",
")",
"{",... | Require a collection to be neither null, nor empty.
@param collection collection
@param message error message
@param <T> Collection type
@return collection | [
"Require",
"a",
"collection",
"to",
"be",
"neither",
"null",
"nor",
"empty",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java#L42-L47 |
recommenders/rival | rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java | MultipleRecommendationRunner.runLenskitRecommenders | public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | java | public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) {
for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) {
RecommendationRunner.run(rec);
}
} | [
"public",
"static",
"void",
"runLenskitRecommenders",
"(",
"final",
"Set",
"<",
"String",
">",
"paths",
",",
"final",
"Properties",
"properties",
")",
"{",
"for",
"(",
"AbstractRunner",
"<",
"Long",
",",
"Long",
">",
"rec",
":",
"instantiateLenskitRecommenders",... | Runs the Lenskit recommenders.
@param paths the input and output paths.
@param properties the properties. | [
"Runs",
"the",
"Lenskit",
"recommenders",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L145-L149 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/layout/InfomationDialog.java | InfomationDialog.showInfoDialog | public static String showInfoDialog(final Frame owner, final String message)
{
InfomationDialog mdialog;
String ok = "OK";
mdialog = new InfomationDialog(owner, "Information message", message, ok);
@SuppressWarnings("unlikely-arg-type")
final int index = mdialog.getVButtons().indexOf(ok);
final Button button = mdialog.getVButtons().get(index);
button.addActionListener(mdialog);
mdialog.setVisible(true);
return mdialog.getResult();
} | java | public static String showInfoDialog(final Frame owner, final String message)
{
InfomationDialog mdialog;
String ok = "OK";
mdialog = new InfomationDialog(owner, "Information message", message, ok);
@SuppressWarnings("unlikely-arg-type")
final int index = mdialog.getVButtons().indexOf(ok);
final Button button = mdialog.getVButtons().get(index);
button.addActionListener(mdialog);
mdialog.setVisible(true);
return mdialog.getResult();
} | [
"public",
"static",
"String",
"showInfoDialog",
"(",
"final",
"Frame",
"owner",
",",
"final",
"String",
"message",
")",
"{",
"InfomationDialog",
"mdialog",
";",
"String",
"ok",
"=",
"\"OK\"",
";",
"mdialog",
"=",
"new",
"InfomationDialog",
"(",
"owner",
",",
... | Statische Methode um ein Dialogfenster mit der angegebener Nachricht zu erzeugen.
@param owner
the owner
@param message
the message
@return das ergebnis | [
"Statische",
"Methode",
"um",
"ein",
"Dialogfenster",
"mit",
"der",
"angegebener",
"Nachricht",
"zu",
"erzeugen",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/InfomationDialog.java#L63-L74 |
zaproxy/zaproxy | src/org/zaproxy/zap/authentication/GenericAuthenticationCredentials.java | GenericAuthenticationCredentials.getSetCredentialsForUserApiAction | public static ApiDynamicActionImplementor getSetCredentialsForUserApiAction(
final AuthenticationMethodType methodType) {
return new ApiDynamicActionImplementor(ACTION_SET_CREDENTIALS, null,
new String[] { PARAM_CONFIG_PARAMS }) {
@Override
public void handleAction(JSONObject params) throws ApiException {
Context context = ApiUtils.getContextByParamId(params, UsersAPI.PARAM_CONTEXT_ID);
int userId = ApiUtils.getIntParam(params, UsersAPI.PARAM_USER_ID);
// Make sure the type of authentication method is compatible
if (!methodType.isTypeForMethod(context.getAuthenticationMethod()))
throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER,
"User's credentials should match authentication method type of the context: "
+ context.getAuthenticationMethod().getType().getName());
// NOTE: no need to check if extension is loaded as this method is called only if
// the Users extension is loaded
ExtensionUserManagement extensionUserManagement = Control.getSingleton()
.getExtensionLoader().getExtension(ExtensionUserManagement.class);
User user = extensionUserManagement.getContextUserAuthManager(context.getIndex())
.getUserById(userId);
if (user == null)
throw new ApiException(ApiException.Type.USER_NOT_FOUND, UsersAPI.PARAM_USER_ID);
// Build and set the credentials
GenericAuthenticationCredentials credentials = (GenericAuthenticationCredentials) context
.getAuthenticationMethod().createAuthenticationCredentials();
for (String paramName : credentials.paramNames)
credentials.setParam(paramName, ApiUtils.getNonEmptyStringParam(params, paramName));
user.setAuthenticationCredentials(credentials);
}
};
} | java | public static ApiDynamicActionImplementor getSetCredentialsForUserApiAction(
final AuthenticationMethodType methodType) {
return new ApiDynamicActionImplementor(ACTION_SET_CREDENTIALS, null,
new String[] { PARAM_CONFIG_PARAMS }) {
@Override
public void handleAction(JSONObject params) throws ApiException {
Context context = ApiUtils.getContextByParamId(params, UsersAPI.PARAM_CONTEXT_ID);
int userId = ApiUtils.getIntParam(params, UsersAPI.PARAM_USER_ID);
// Make sure the type of authentication method is compatible
if (!methodType.isTypeForMethod(context.getAuthenticationMethod()))
throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER,
"User's credentials should match authentication method type of the context: "
+ context.getAuthenticationMethod().getType().getName());
// NOTE: no need to check if extension is loaded as this method is called only if
// the Users extension is loaded
ExtensionUserManagement extensionUserManagement = Control.getSingleton()
.getExtensionLoader().getExtension(ExtensionUserManagement.class);
User user = extensionUserManagement.getContextUserAuthManager(context.getIndex())
.getUserById(userId);
if (user == null)
throw new ApiException(ApiException.Type.USER_NOT_FOUND, UsersAPI.PARAM_USER_ID);
// Build and set the credentials
GenericAuthenticationCredentials credentials = (GenericAuthenticationCredentials) context
.getAuthenticationMethod().createAuthenticationCredentials();
for (String paramName : credentials.paramNames)
credentials.setParam(paramName, ApiUtils.getNonEmptyStringParam(params, paramName));
user.setAuthenticationCredentials(credentials);
}
};
} | [
"public",
"static",
"ApiDynamicActionImplementor",
"getSetCredentialsForUserApiAction",
"(",
"final",
"AuthenticationMethodType",
"methodType",
")",
"{",
"return",
"new",
"ApiDynamicActionImplementor",
"(",
"ACTION_SET_CREDENTIALS",
",",
"null",
",",
"new",
"String",
"[",
"... | Gets the api action for setting a {@link GenericAuthenticationCredentials} for an User.
@param methodType the method type for which this is called
@return api action implementation | [
"Gets",
"the",
"api",
"action",
"for",
"setting",
"a",
"{",
"@link",
"GenericAuthenticationCredentials",
"}",
"for",
"an",
"User",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/authentication/GenericAuthenticationCredentials.java#L125-L156 |
jmurty/java-xmlbuilder | src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java | BaseXMLBuilder.elementBeforeImpl | protected Element elementBeforeImpl(String name) {
String prefix = getPrefixFromQualifiedName(name);
String namespaceURI = this.xmlNode.lookupNamespaceURI(prefix);
return elementBeforeImpl(name, namespaceURI);
} | java | protected Element elementBeforeImpl(String name) {
String prefix = getPrefixFromQualifiedName(name);
String namespaceURI = this.xmlNode.lookupNamespaceURI(prefix);
return elementBeforeImpl(name, namespaceURI);
} | [
"protected",
"Element",
"elementBeforeImpl",
"(",
"String",
"name",
")",
"{",
"String",
"prefix",
"=",
"getPrefixFromQualifiedName",
"(",
"name",
")",
";",
"String",
"namespaceURI",
"=",
"this",
".",
"xmlNode",
".",
"lookupNamespaceURI",
"(",
"prefix",
")",
";",... | Add a named XML element to the document as a sibling element
that precedes the position of this builder node.
When adding an element to a namespaced document, the new node will be
assigned a namespace matching it's qualified name prefix (if any) or
the document's default namespace. NOTE: If the element has a prefix that
does not match any known namespaces, the element will be created
without any namespace.
@param name
the name of the XML element.
@throws IllegalStateException
if you attempt to add a sibling element to a node where there are already
one or more siblings that are text nodes. | [
"Add",
"a",
"named",
"XML",
"element",
"to",
"the",
"document",
"as",
"a",
"sibling",
"element",
"that",
"precedes",
"the",
"position",
"of",
"this",
"builder",
"node",
"."
] | train | https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L765-L769 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.updateTagsAsync | public Observable<VirtualNetworkGatewayConnectionListEntityInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() {
@Override
public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkGatewayConnectionListEntityInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() {
@Override
public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkGatewayConnectionListEntityInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"u... | Updates a virtual network gateway connection tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"virtual",
"network",
"gateway",
"connection",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L638-L645 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_antihack_ipBlocked_GET | public OvhBlockedIp ip_antihack_ipBlocked_GET(String ip, String ipBlocked) throws IOException {
String qPath = "/ip/{ip}/antihack/{ipBlocked}";
StringBuilder sb = path(qPath, ip, ipBlocked);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBlockedIp.class);
} | java | public OvhBlockedIp ip_antihack_ipBlocked_GET(String ip, String ipBlocked) throws IOException {
String qPath = "/ip/{ip}/antihack/{ipBlocked}";
StringBuilder sb = path(qPath, ip, ipBlocked);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBlockedIp.class);
} | [
"public",
"OvhBlockedIp",
"ip_antihack_ipBlocked_GET",
"(",
"String",
"ip",
",",
"String",
"ipBlocked",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/antihack/{ipBlocked}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"ip",
... | Get this object properties
REST: GET /ip/{ip}/antihack/{ipBlocked}
@param ip [required]
@param ipBlocked [required] your IP | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L873-L878 |
vtatai/srec | core/src/main/java/com/github/srec/util/Utils.java | Utils.groovyEvaluate | public static Object groovyEvaluate(ExecutionContext context, String expression) {
Binding binding = new Binding();
for (Map.Entry<String, CommandSymbol> entry : context.getSymbols().entrySet()) {
final CommandSymbol symbol = entry.getValue();
if (symbol instanceof VarCommand) {
binding.setVariable(entry.getKey(), convertToJava(((VarCommand) symbol).getValue(context)));
}
}
GroovyShell shell = new GroovyShell(binding);
final Object o = shell.evaluate(expression);
if (o instanceof GString) {
return o.toString();
}
return o;
} | java | public static Object groovyEvaluate(ExecutionContext context, String expression) {
Binding binding = new Binding();
for (Map.Entry<String, CommandSymbol> entry : context.getSymbols().entrySet()) {
final CommandSymbol symbol = entry.getValue();
if (symbol instanceof VarCommand) {
binding.setVariable(entry.getKey(), convertToJava(((VarCommand) symbol).getValue(context)));
}
}
GroovyShell shell = new GroovyShell(binding);
final Object o = shell.evaluate(expression);
if (o instanceof GString) {
return o.toString();
}
return o;
} | [
"public",
"static",
"Object",
"groovyEvaluate",
"(",
"ExecutionContext",
"context",
",",
"String",
"expression",
")",
"{",
"Binding",
"binding",
"=",
"new",
"Binding",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"CommandSymbol",
">",
... | Evaluates an expression using Groovy. All VarCommands inside the context are used in order to evaluate the given
expression.
@param context The EC
@param expression The expression to evaluate
@return The value | [
"Evaluates",
"an",
"expression",
"using",
"Groovy",
".",
"All",
"VarCommands",
"inside",
"the",
"context",
"are",
"used",
"in",
"order",
"to",
"evaluate",
"the",
"given",
"expression",
"."
] | train | https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/util/Utils.java#L243-L257 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.setOrAppend | public static Object setOrAppend(Object array, int index, Object value) {
if(index < length(array)) {
Array.set(array, index, value);
return array;
}else {
return append(array, value);
}
} | java | public static Object setOrAppend(Object array, int index, Object value) {
if(index < length(array)) {
Array.set(array, index, value);
return array;
}else {
return append(array, value);
}
} | [
"public",
"static",
"Object",
"setOrAppend",
"(",
"Object",
"array",
",",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"length",
"(",
"array",
")",
")",
"{",
"Array",
".",
"set",
"(",
"array",
",",
"index",
",",
"value",... | 将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加
@param array 已有数组
@param index 位置,大于长度追加,否则替换
@param value 新值
@return 新数组或原有数组
@since 4.1.2 | [
"将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L435-L442 |
paypal/SeLion | client/src/main/java/com/paypal/selion/internal/platform/pageyaml/GuiMapReaderFactory.java | GuiMapReaderFactory.getInstance | public static GuiMapReader getInstance(String pageDomain, String pageClassName) throws IOException {
logger.entering(new Object[]{pageDomain, pageClassName});
Preconditions.checkArgument(StringUtils.isNotBlank(pageClassName),
"pageClassName can not be null, empty, or whitespace");
String guiDataDir = Config.getConfigProperty(ConfigProperty.GUI_DATA_DIR);
String processedPageDomain = StringUtils.defaultString(pageDomain, "");
String rawDataFile = guiDataDir + "/" + processedPageDomain + "/" + pageClassName;
if (processedPageDomain.isEmpty()) {
rawDataFile = guiDataDir + "/" + pageClassName;
}
String yamlFile = rawDataFile + ".yaml";
String ymlFile = rawDataFile + ".yml";
GuiMapReader dataProvider;
if (getFilePath(yamlFile) != null) {
dataProvider = YamlReaderFactory.createInstance(yamlFile);
} else if (getFilePath(ymlFile) != null) {
dataProvider = YamlReaderFactory.createInstance(ymlFile);
} else {
// Should be a FileNotFoundException?
FileNotFoundException e = new FileNotFoundException("Data file does not exist for " + rawDataFile
+ ". Supported file extensions: yaml, yml.");
logger.log(Level.SEVERE, e.getMessage(), e);
throw e;
}
logger.exiting(dataProvider);
return dataProvider;
} | java | public static GuiMapReader getInstance(String pageDomain, String pageClassName) throws IOException {
logger.entering(new Object[]{pageDomain, pageClassName});
Preconditions.checkArgument(StringUtils.isNotBlank(pageClassName),
"pageClassName can not be null, empty, or whitespace");
String guiDataDir = Config.getConfigProperty(ConfigProperty.GUI_DATA_DIR);
String processedPageDomain = StringUtils.defaultString(pageDomain, "");
String rawDataFile = guiDataDir + "/" + processedPageDomain + "/" + pageClassName;
if (processedPageDomain.isEmpty()) {
rawDataFile = guiDataDir + "/" + pageClassName;
}
String yamlFile = rawDataFile + ".yaml";
String ymlFile = rawDataFile + ".yml";
GuiMapReader dataProvider;
if (getFilePath(yamlFile) != null) {
dataProvider = YamlReaderFactory.createInstance(yamlFile);
} else if (getFilePath(ymlFile) != null) {
dataProvider = YamlReaderFactory.createInstance(ymlFile);
} else {
// Should be a FileNotFoundException?
FileNotFoundException e = new FileNotFoundException("Data file does not exist for " + rawDataFile
+ ". Supported file extensions: yaml, yml.");
logger.log(Level.SEVERE, e.getMessage(), e);
throw e;
}
logger.exiting(dataProvider);
return dataProvider;
} | [
"public",
"static",
"GuiMapReader",
"getInstance",
"(",
"String",
"pageDomain",
",",
"String",
"pageClassName",
")",
"throws",
"IOException",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"pageDomain",
",",
"pageClassName",
"}",
")",
";"... | Method to get the reader instance depending on the input parameters.
@param pageDomain
domain folder under which the input data files are present.
@param pageClassName
Page class name. May not be <code>null</code>, empty, or whitespace.
@return DataProvider instance
@throws IOException | [
"Method",
"to",
"get",
"the",
"reader",
"instance",
"depending",
"on",
"the",
"input",
"parameters",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/pageyaml/GuiMapReaderFactory.java#L52-L82 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.opentracing.1.3/src/com/ibm/ws/microprofile/opentracing/OpenTracingService.java | OpenTracingService.isTraced | public static boolean isTraced(String classOperationName, String methodOperationName) {
return isTraced(methodOperationName) || (isTraced(classOperationName) && !OPERATION_NAME_UNTRACED.equals(methodOperationName));
} | java | public static boolean isTraced(String classOperationName, String methodOperationName) {
return isTraced(methodOperationName) || (isTraced(classOperationName) && !OPERATION_NAME_UNTRACED.equals(methodOperationName));
} | [
"public",
"static",
"boolean",
"isTraced",
"(",
"String",
"classOperationName",
",",
"String",
"methodOperationName",
")",
"{",
"return",
"isTraced",
"(",
"methodOperationName",
")",
"||",
"(",
"isTraced",
"(",
"classOperationName",
")",
"&&",
"!",
"OPERATION_NAME_U... | Return true if {@code methodOperationName} is not null (i.e. it represents
something that has the {@code Traced} annotation) and if the
{@code Traced} annotation was not explicitly set to {@code false}, or return
true if {@code classOperationName} is not null (i.e. it represents
something that has the {@code Traced} annotation) and the
{@code Traced} annotation was not explicitly set to {@code false},
and the {@code methodOperationName} is not explicitly set to {@code false}.
@param classOperationName The class operation name
@param methodOperationName The method operation name
@return See above | [
"Return",
"true",
"if",
"{",
"@code",
"methodOperationName",
"}",
"is",
"not",
"null",
"(",
"i",
".",
"e",
".",
"it",
"represents",
"something",
"that",
"has",
"the",
"{",
"@code",
"Traced",
"}",
"annotation",
")",
"and",
"if",
"the",
"{",
"@code",
"Tr... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.opentracing.1.3/src/com/ibm/ws/microprofile/opentracing/OpenTracingService.java#L87-L89 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java | OfflineMessageManager.getMessages | public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Message> messages = new ArrayList<>(nodes.size());
OfflineMessageRequest request = new OfflineMessageRequest();
for (String node : nodes) {
OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
item.setAction("view");
request.addItem(item);
}
// Filter offline messages that were requested by this request
StanzaFilter messageFilter = new AndFilter(PACKET_FILTER, new StanzaFilter() {
@Override
public boolean accept(Stanza packet) {
OfflineMessageInfo info = packet.getExtension("offline",
namespace);
return nodes.contains(info.getNode());
}
});
int pendingNodes = nodes.size();
try (StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter)) {
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
// Collect the received offline messages
Message message;
do {
message = messageCollector.nextResult();
if (message != null) {
messages.add(message);
pendingNodes--;
} else if (message == null && pendingNodes > 0) {
LOGGER.log(Level.WARNING,
"Did not receive all expected offline messages. " + pendingNodes + " are missing.");
}
} while (message != null && pendingNodes > 0);
}
return messages;
} | java | public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Message> messages = new ArrayList<>(nodes.size());
OfflineMessageRequest request = new OfflineMessageRequest();
for (String node : nodes) {
OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
item.setAction("view");
request.addItem(item);
}
// Filter offline messages that were requested by this request
StanzaFilter messageFilter = new AndFilter(PACKET_FILTER, new StanzaFilter() {
@Override
public boolean accept(Stanza packet) {
OfflineMessageInfo info = packet.getExtension("offline",
namespace);
return nodes.contains(info.getNode());
}
});
int pendingNodes = nodes.size();
try (StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter)) {
connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
// Collect the received offline messages
Message message;
do {
message = messageCollector.nextResult();
if (message != null) {
messages.add(message);
pendingNodes--;
} else if (message == null && pendingNodes > 0) {
LOGGER.log(Level.WARNING,
"Did not receive all expected offline messages. " + pendingNodes + " are missing.");
}
} while (message != null && pendingNodes > 0);
}
return messages;
} | [
"public",
"List",
"<",
"Message",
">",
"getMessages",
"(",
"final",
"List",
"<",
"String",
">",
"nodes",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
"<",
"Message",
">",
... | Returns a List of the offline <tt>Messages</tt> whose stamp matches the specified
request. The request will include the list of stamps that uniquely identifies
the offline messages to retrieve. The returned offline messages will not be deleted
from the server. Use {@link #deleteMessages(java.util.List)} to delete the messages.
@param nodes the list of stamps that uniquely identifies offline message.
@return a List with the offline <tt>Messages</tt> that were received as part of
this request.
@throws XMPPErrorException If the user is not allowed to make this request or the server does
not support offline message retrieval.
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"a",
"List",
"of",
"the",
"offline",
"<tt",
">",
"Messages<",
"/",
"tt",
">",
"whose",
"stamp",
"matches",
"the",
"specified",
"request",
".",
"The",
"request",
"will",
"include",
"the",
"list",
"of",
"stamps",
"that",
"uniquely",
"identifies",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java#L150-L184 |
RogerParkinson/madura-objects-parent | madura-objects/src/main/java/org/springframework/context/support/JdbcMessageSource.java | JdbcMessageSource.resolveCodeInternal | protected MessageFormat resolveCodeInternal(String code, Locale locale) {
String result;
lastQuery = System.currentTimeMillis();
try {
result = (String) jdbcTemplate.queryForObject(sqlStatement,
new Object[] { code, locale.toString() }, String.class);
} catch (IncorrectResultSizeDataAccessException e) {
if (locale != null) {
// Retry without a locale if we checked with one before
try {
result = (String) jdbcTemplate.queryForObject(sqlStatement,
new Object[] { code, null }, String.class);
} catch (IncorrectResultSizeDataAccessException ex) {
return null;
}
} else {
return null;
}
}
return new MessageFormat(result, locale);
} | java | protected MessageFormat resolveCodeInternal(String code, Locale locale) {
String result;
lastQuery = System.currentTimeMillis();
try {
result = (String) jdbcTemplate.queryForObject(sqlStatement,
new Object[] { code, locale.toString() }, String.class);
} catch (IncorrectResultSizeDataAccessException e) {
if (locale != null) {
// Retry without a locale if we checked with one before
try {
result = (String) jdbcTemplate.queryForObject(sqlStatement,
new Object[] { code, null }, String.class);
} catch (IncorrectResultSizeDataAccessException ex) {
return null;
}
} else {
return null;
}
}
return new MessageFormat(result, locale);
} | [
"protected",
"MessageFormat",
"resolveCodeInternal",
"(",
"String",
"code",
",",
"Locale",
"locale",
")",
"{",
"String",
"result",
";",
"lastQuery",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"result",
"=",
"(",
"String",
")",
"jdbcT... | Check in base the message associated with the given code and locale
@param code
the code of the message to solve
@param locale
the locale to check against
@return a MessageFormat if one were found, either for the given locale or
for the default on, or null if nothing could be found | [
"Check",
"in",
"base",
"the",
"message",
"associated",
"with",
"the",
"given",
"code",
"and",
"locale"
] | train | https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-objects/src/main/java/org/springframework/context/support/JdbcMessageSource.java#L100-L123 |
apereo/cas | support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java | DelegatedClientAuthenticationAction.handleException | protected Event handleException(final J2EContext webContext, final BaseClient<Credentials, CommonProfile> client, final Exception e) {
if (e instanceof RequestSloException) {
try {
webContext.getResponse().sendRedirect("logout");
} catch (final IOException ioe) {
throw new IllegalArgumentException("Unable to call logout", ioe);
}
return stopWebflow();
}
val msg = String.format("Delegated authentication has failed with client %s", client.getName());
LOGGER.error(msg, e);
throw new IllegalArgumentException(msg);
} | java | protected Event handleException(final J2EContext webContext, final BaseClient<Credentials, CommonProfile> client, final Exception e) {
if (e instanceof RequestSloException) {
try {
webContext.getResponse().sendRedirect("logout");
} catch (final IOException ioe) {
throw new IllegalArgumentException("Unable to call logout", ioe);
}
return stopWebflow();
}
val msg = String.format("Delegated authentication has failed with client %s", client.getName());
LOGGER.error(msg, e);
throw new IllegalArgumentException(msg);
} | [
"protected",
"Event",
"handleException",
"(",
"final",
"J2EContext",
"webContext",
",",
"final",
"BaseClient",
"<",
"Credentials",
",",
"CommonProfile",
">",
"client",
",",
"final",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"RequestSloException",
... | Handle the thrown exception.
@param webContext the web context
@param client the authentication client
@param e the thrown exception
@return the event to trigger | [
"Handle",
"the",
"thrown",
"exception",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/flow/DelegatedClientAuthenticationAction.java#L208-L220 |
federkasten/appbundle-maven-plugin | src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java | CreateApplicationBundleMojo.copyResources | private List<String> copyResources(File targetDirectory, List<FileSet> fileSets) throws MojoExecutionException {
ArrayList<String> addedFiles = new ArrayList<String>();
for (FileSet fileSet : fileSets) {
// Get the absolute base directory for the FileSet
File sourceDirectory = new File(fileSet.getDirectory());
if (!sourceDirectory.isAbsolute()) {
sourceDirectory = new File(project.getBasedir(), sourceDirectory.getPath());
}
if (!sourceDirectory.exists()) {
// If the requested directory does not exist, log it and carry on
getLog().warn("Specified source directory " + sourceDirectory.getPath() + " does not exist.");
continue;
}
List<String> includedFiles = scanFileSet(sourceDirectory, fileSet);
addedFiles.addAll(includedFiles);
getLog().info("Copying " + includedFiles.size() + " additional resource" + (includedFiles.size() > 1 ? "s" : ""));
for (String destination : includedFiles) {
File source = new File(sourceDirectory, destination);
File destinationFile = new File(targetDirectory, destination);
// Make sure that the directory we are copying into exists
destinationFile.getParentFile().mkdirs();
try {
FileUtils.copyFile(source, destinationFile);
destinationFile.setExecutable(fileSet.isExecutable(),false);
} catch (IOException e) {
throw new MojoExecutionException("Error copying additional resource " + source, e);
}
}
}
return addedFiles;
} | java | private List<String> copyResources(File targetDirectory, List<FileSet> fileSets) throws MojoExecutionException {
ArrayList<String> addedFiles = new ArrayList<String>();
for (FileSet fileSet : fileSets) {
// Get the absolute base directory for the FileSet
File sourceDirectory = new File(fileSet.getDirectory());
if (!sourceDirectory.isAbsolute()) {
sourceDirectory = new File(project.getBasedir(), sourceDirectory.getPath());
}
if (!sourceDirectory.exists()) {
// If the requested directory does not exist, log it and carry on
getLog().warn("Specified source directory " + sourceDirectory.getPath() + " does not exist.");
continue;
}
List<String> includedFiles = scanFileSet(sourceDirectory, fileSet);
addedFiles.addAll(includedFiles);
getLog().info("Copying " + includedFiles.size() + " additional resource" + (includedFiles.size() > 1 ? "s" : ""));
for (String destination : includedFiles) {
File source = new File(sourceDirectory, destination);
File destinationFile = new File(targetDirectory, destination);
// Make sure that the directory we are copying into exists
destinationFile.getParentFile().mkdirs();
try {
FileUtils.copyFile(source, destinationFile);
destinationFile.setExecutable(fileSet.isExecutable(),false);
} catch (IOException e) {
throw new MojoExecutionException("Error copying additional resource " + source, e);
}
}
}
return addedFiles;
} | [
"private",
"List",
"<",
"String",
">",
"copyResources",
"(",
"File",
"targetDirectory",
",",
"List",
"<",
"FileSet",
">",
"fileSets",
")",
"throws",
"MojoExecutionException",
"{",
"ArrayList",
"<",
"String",
">",
"addedFiles",
"=",
"new",
"ArrayList",
"<",
"St... | Copies given resources to the build directory.
@param fileSets A list of FileSet objects that represent additional
resources to copy.
@throws MojoExecutionException In case of a resource copying error. | [
"Copies",
"given",
"resources",
"to",
"the",
"build",
"directory",
"."
] | train | https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L741-L779 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java | TypeUtility.endStringConversion | public static void endStringConversion(Builder methodBuilder, TypeName typeMirror) {
SQLTransform transform = SQLTransformer.lookup(typeMirror);
switch (transform.getColumnType()) {
case TEXT:
return;
case BLOB:
methodBuilder.addCode(",$T.UTF_8)", StandardCharsets.class);
break;
case INTEGER:
case REAL:
methodBuilder.addCode(")");
break;
default:
break;
}
} | java | public static void endStringConversion(Builder methodBuilder, TypeName typeMirror) {
SQLTransform transform = SQLTransformer.lookup(typeMirror);
switch (transform.getColumnType()) {
case TEXT:
return;
case BLOB:
methodBuilder.addCode(",$T.UTF_8)", StandardCharsets.class);
break;
case INTEGER:
case REAL:
methodBuilder.addCode(")");
break;
default:
break;
}
} | [
"public",
"static",
"void",
"endStringConversion",
"(",
"Builder",
"methodBuilder",
",",
"TypeName",
"typeMirror",
")",
"{",
"SQLTransform",
"transform",
"=",
"SQLTransformer",
".",
"lookup",
"(",
"typeMirror",
")",
";",
"switch",
"(",
"transform",
".",
"getColumn... | generate end string to translate in code to used in content value or parameter need to be converted in string through String.valueOf
@param methodBuilder
the method builder
@param typeMirror
the type mirror | [
"generate",
"end",
"string",
"to",
"translate",
"in",
"code",
"to",
"used",
"in",
"content",
"value",
"or",
"parameter",
"need",
"to",
"be",
"converted",
"in",
"string",
"through",
"String",
".",
"valueOf"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/TypeUtility.java#L431-L447 |
JodaOrg/joda-beans | src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java | MsgPackOutput.writeExtensionByte | void writeExtensionByte(int extensionType, int value) throws IOException {
output.write(FIX_EXT_1);
output.write(extensionType);
output.write(value);
} | java | void writeExtensionByte(int extensionType, int value) throws IOException {
output.write(FIX_EXT_1);
output.write(extensionType);
output.write(value);
} | [
"void",
"writeExtensionByte",
"(",
"int",
"extensionType",
",",
"int",
"value",
")",
"throws",
"IOException",
"{",
"output",
".",
"write",
"(",
"FIX_EXT_1",
")",
";",
"output",
".",
"write",
"(",
"extensionType",
")",
";",
"output",
".",
"write",
"(",
"val... | Writes an extension string using FIX_EXT_1.
@param extensionType the type
@param value the value to write as the data
@throws IOException if an error occurs | [
"Writes",
"an",
"extension",
"string",
"using",
"FIX_EXT_1",
"."
] | train | https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java#L279-L283 |
jboss/jboss-servlet-api_spec | src/main/java/javax/servlet/http/HttpServletResponseWrapper.java | HttpServletResponseWrapper.addHeader | @Override
public void addHeader(String name, String value) {
this._getHttpServletResponse().addHeader(name, value);
} | java | @Override
public void addHeader(String name, String value) {
this._getHttpServletResponse().addHeader(name, value);
} | [
"@",
"Override",
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"_getHttpServletResponse",
"(",
")",
".",
"addHeader",
"(",
"name",
",",
"value",
")",
";",
"}"
] | The default behavior of this method is to return addHeader(String name, String value)
on the wrapped response object. | [
"The",
"default",
"behavior",
"of",
"this",
"method",
"is",
"to",
"return",
"addHeader",
"(",
"String",
"name",
"String",
"value",
")",
"on",
"the",
"wrapped",
"response",
"object",
"."
] | train | https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpServletResponseWrapper.java#L216-L219 |
google/closure-compiler | src/com/google/javascript/jscomp/ExploitAssigns.java | ExploitAssigns.isCollapsibleValue | private static boolean isCollapsibleValue(Node value, boolean isLValue) {
switch (value.getToken()) {
case GETPROP:
// Do not collapse GETPROPs on arbitrary objects, because
// they may be implemented setter functions, and oftentimes
// setter functions fail on native objects. This is OK for "THIS"
// objects, because we assume that they are non-native.
return !isLValue || value.getFirstChild().isThis();
case NAME:
return true;
default:
return NodeUtil.isImmutableValue(value);
}
} | java | private static boolean isCollapsibleValue(Node value, boolean isLValue) {
switch (value.getToken()) {
case GETPROP:
// Do not collapse GETPROPs on arbitrary objects, because
// they may be implemented setter functions, and oftentimes
// setter functions fail on native objects. This is OK for "THIS"
// objects, because we assume that they are non-native.
return !isLValue || value.getFirstChild().isThis();
case NAME:
return true;
default:
return NodeUtil.isImmutableValue(value);
}
} | [
"private",
"static",
"boolean",
"isCollapsibleValue",
"(",
"Node",
"value",
",",
"boolean",
"isLValue",
")",
"{",
"switch",
"(",
"value",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"GETPROP",
":",
"// Do not collapse GETPROPs on arbitrary objects, because",
"// th... | Determines whether we know enough about the given value to be able
to collapse it into subsequent expressions.
For example, we can collapse booleans and variable names:
<code>
x = 3; y = x; // y = x = 3;
a = true; b = true; // b = a = true;
<code>
But we won't try to collapse complex expressions.
@param value The value node.
@param isLValue Whether it's on the left-hand side of an expr. | [
"Determines",
"whether",
"we",
"know",
"enough",
"about",
"the",
"given",
"value",
"to",
"be",
"able",
"to",
"collapse",
"it",
"into",
"subsequent",
"expressions",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ExploitAssigns.java#L80-L95 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java | SinglePerturbationNeighbourhood.canSwap | private boolean canSwap(SubsetSolution solution, Set<Integer> addCandidates, Set<Integer> deleteCandidates){
return !addCandidates.isEmpty()
&& !deleteCandidates.isEmpty()
&& isValidSubsetSize(solution.getNumSelectedIDs());
} | java | private boolean canSwap(SubsetSolution solution, Set<Integer> addCandidates, Set<Integer> deleteCandidates){
return !addCandidates.isEmpty()
&& !deleteCandidates.isEmpty()
&& isValidSubsetSize(solution.getNumSelectedIDs());
} | [
"private",
"boolean",
"canSwap",
"(",
"SubsetSolution",
"solution",
",",
"Set",
"<",
"Integer",
">",
"addCandidates",
",",
"Set",
"<",
"Integer",
">",
"deleteCandidates",
")",
"{",
"return",
"!",
"addCandidates",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"deleteC... | Check if it is possible to swap a selected and unselected item.
@param solution solution for which moves are generated
@param addCandidates set of candidate IDs to be added
@param deleteCandidates set of candidate IDs to be deleted
@return <code>true</code> if it is possible to perform a swap | [
"Check",
"if",
"it",
"is",
"possible",
"to",
"swap",
"a",
"selected",
"and",
"unselected",
"item",
"."
] | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L246-L250 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.asDateTime | public static <T extends Comparable<?>> DateTimeExpression<T> asDateTime(Expression<T> expr) {
Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
if (underlyingMixin instanceof PathImpl) {
return new DateTimePath<T>((PathImpl<T>) underlyingMixin);
} else if (underlyingMixin instanceof OperationImpl) {
return new DateTimeOperation<T>((OperationImpl<T>) underlyingMixin);
} else if (underlyingMixin instanceof TemplateExpressionImpl) {
return new DateTimeTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
} else {
return new DateTimeExpression<T>(underlyingMixin) {
private static final long serialVersionUID = 8007203530480765244L;
@Override
public <R, C> R accept(Visitor<R, C> v, C context) {
return this.mixin.accept(v, context);
}
};
}
} | java | public static <T extends Comparable<?>> DateTimeExpression<T> asDateTime(Expression<T> expr) {
Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
if (underlyingMixin instanceof PathImpl) {
return new DateTimePath<T>((PathImpl<T>) underlyingMixin);
} else if (underlyingMixin instanceof OperationImpl) {
return new DateTimeOperation<T>((OperationImpl<T>) underlyingMixin);
} else if (underlyingMixin instanceof TemplateExpressionImpl) {
return new DateTimeTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
} else {
return new DateTimeExpression<T>(underlyingMixin) {
private static final long serialVersionUID = 8007203530480765244L;
@Override
public <R, C> R accept(Visitor<R, C> v, C context) {
return this.mixin.accept(v, context);
}
};
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
">",
">",
"DateTimeExpression",
"<",
"T",
">",
"asDateTime",
"(",
"Expression",
"<",
"T",
">",
"expr",
")",
"{",
"Expression",
"<",
"T",
">",
"underlyingMixin",
"=",
"ExpressionUtils",
".",
... | Create a new DateTimeExpression
@param expr the date time Expression
@return new DateTimeExpression | [
"Create",
"a",
"new",
"DateTimeExpression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L1977-L1998 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newConfigurationException | public static ConfigurationException newConfigurationException(Throwable cause, String message, Object... args) {
return new ConfigurationException(format(message, args), cause);
} | java | public static ConfigurationException newConfigurationException(Throwable cause, String message, Object... args) {
return new ConfigurationException(format(message, args), cause);
} | [
"public",
"static",
"ConfigurationException",
"newConfigurationException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ConfigurationException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",... | Constructs and initializes a new {@link ConfigurationException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link ConfigurationException} was thrown.
@param message {@link String} describing the {@link ConfigurationException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link ConfigurationException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.context.configure.ConfigurationException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"ConfigurationException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"O... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L137-L139 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java | WWindowInterceptor.preparePaint | @Override
public void preparePaint(final Request request) {
if (windowId == null) {
super.preparePaint(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.preparePaint(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | java | @Override
public void preparePaint(final Request request) {
if (windowId == null) {
super.preparePaint(request);
} else {
// Get the window component
ComponentWithContext target = WebUtilities.getComponentById(windowId, true);
if (target == null) {
throw new SystemException("No window component for id " + windowId);
}
UIContext uic = UIContextHolder.getCurrentPrimaryUIContext();
Environment originalEnvironment = uic.getEnvironment();
uic.setEnvironment(new EnvironmentDelegate(originalEnvironment, windowId, target));
UIContextHolder.pushContext(target.getContext());
try {
super.preparePaint(request);
} finally {
uic.setEnvironment(originalEnvironment);
UIContextHolder.popContext();
}
}
} | [
"@",
"Override",
"public",
"void",
"preparePaint",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"windowId",
"==",
"null",
")",
"{",
"super",
".",
"preparePaint",
"(",
"request",
")",
";",
"}",
"else",
"{",
"// Get the window component",
"Componen... | Temporarily replaces the environment while the UI prepares to render.
@param request the request being responded to. | [
"Temporarily",
"replaces",
"the",
"environment",
"while",
"the",
"UI",
"prepares",
"to",
"render",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/WWindowInterceptor.java#L90-L113 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java | PDTWebDateHelper.getDateTimeFromRFC822 | @Nullable
public static ZonedDateTime getDateTimeFromRFC822 (@Nullable final String sDate)
{
if (StringHelper.hasNoText (sDate))
return null;
final WithZoneId aPair = extractDateTimeZone (sDate.trim ());
return parseZonedDateTimeUsingMask (RFC822_MASKS, aPair.getString (), aPair.getZoneId ());
} | java | @Nullable
public static ZonedDateTime getDateTimeFromRFC822 (@Nullable final String sDate)
{
if (StringHelper.hasNoText (sDate))
return null;
final WithZoneId aPair = extractDateTimeZone (sDate.trim ());
return parseZonedDateTimeUsingMask (RFC822_MASKS, aPair.getString (), aPair.getZoneId ());
} | [
"@",
"Nullable",
"public",
"static",
"ZonedDateTime",
"getDateTimeFromRFC822",
"(",
"@",
"Nullable",
"final",
"String",
"sDate",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sDate",
")",
")",
"return",
"null",
";",
"final",
"WithZoneId",
"aPair... | Parses a Date out of a String with a date in RFC822 format. <br>
It parsers the following formats:
<ul>
<li>"EEE, dd MMM uuuu HH:mm:ss z"</li>
<li>"EEE, dd MMM uuuu HH:mm z"</li>
<li>"EEE, dd MMM uu HH:mm:ss z"</li>
<li>"EEE, dd MMM uu HH:mm z"</li>
<li>"dd MMM uuuu HH:mm:ss z"</li>
<li>"dd MMM uuuu HH:mm z"</li>
<li>"dd MMM uu HH:mm:ss z"</li>
<li>"dd MMM uu HH:mm z"</li>
</ul>
<p>
Refer to the java.text.SimpleDateFormat javadocs for details on the format
of each element.
</p>
@param sDate
string to parse for a date. May be <code>null</code>.
@return the Date represented by the given RFC822 string. It returns
<b>null</b> if it was not possible to parse the given string into a
{@link ZonedDateTime} or if the passed {@link String} was
<code>null</code>. | [
"Parses",
"a",
"Date",
"out",
"of",
"a",
"String",
"with",
"a",
"date",
"in",
"RFC822",
"format",
".",
"<br",
">",
"It",
"parsers",
"the",
"following",
"formats",
":",
"<ul",
">",
"<li",
">",
"EEE",
"dd",
"MMM",
"uuuu",
"HH",
":",
"mm",
":",
"ss",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java#L281-L289 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java | RowInputBase.resetRow | public void resetRow(int filepos, int rowsize) throws IOException {
mark = 0;
reset();
if (buf.length < rowsize) {
buf = new byte[rowsize];
}
filePos = filepos;
size = count = rowsize;
pos = 4;
buf[0] = (byte) ((rowsize >>> 24) & 0xFF);
buf[1] = (byte) ((rowsize >>> 16) & 0xFF);
buf[2] = (byte) ((rowsize >>> 8) & 0xFF);
buf[3] = (byte) ((rowsize >>> 0) & 0xFF);
} | java | public void resetRow(int filepos, int rowsize) throws IOException {
mark = 0;
reset();
if (buf.length < rowsize) {
buf = new byte[rowsize];
}
filePos = filepos;
size = count = rowsize;
pos = 4;
buf[0] = (byte) ((rowsize >>> 24) & 0xFF);
buf[1] = (byte) ((rowsize >>> 16) & 0xFF);
buf[2] = (byte) ((rowsize >>> 8) & 0xFF);
buf[3] = (byte) ((rowsize >>> 0) & 0xFF);
} | [
"public",
"void",
"resetRow",
"(",
"int",
"filepos",
",",
"int",
"rowsize",
")",
"throws",
"IOException",
"{",
"mark",
"=",
"0",
";",
"reset",
"(",
")",
";",
"if",
"(",
"buf",
".",
"length",
"<",
"rowsize",
")",
"{",
"buf",
"=",
"new",
"byte",
"[",... | Used to reset the row, ready for a new row to be written into the
byte[] buffer by an external routine. | [
"Used",
"to",
"reset",
"the",
"row",
"ready",
"for",
"a",
"new",
"row",
"to",
"be",
"written",
"into",
"the",
"byte",
"[]",
"buffer",
"by",
"an",
"external",
"routine",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rowio/RowInputBase.java#L277-L294 |
houbb/log-integration | src/main/java/com/github/houbb/log/integration/adaptors/jdbc/StatementLogger.java | StatementLogger.newInstance | public static Statement newInstance(Statement stmt, Log statementLog, int queryStack) {
InvocationHandler handler = new StatementLogger(stmt, statementLog, queryStack);
ClassLoader cl = Statement.class.getClassLoader();
return (Statement) Proxy.newProxyInstance(cl, new Class[]{Statement.class}, handler);
} | java | public static Statement newInstance(Statement stmt, Log statementLog, int queryStack) {
InvocationHandler handler = new StatementLogger(stmt, statementLog, queryStack);
ClassLoader cl = Statement.class.getClassLoader();
return (Statement) Proxy.newProxyInstance(cl, new Class[]{Statement.class}, handler);
} | [
"public",
"static",
"Statement",
"newInstance",
"(",
"Statement",
"stmt",
",",
"Log",
"statementLog",
",",
"int",
"queryStack",
")",
"{",
"InvocationHandler",
"handler",
"=",
"new",
"StatementLogger",
"(",
"stmt",
",",
"statementLog",
",",
"queryStack",
")",
";"... | /*
Creates a logging version of a Statement
@param stmt - the statement
@return - the proxy | [
"/",
"*",
"Creates",
"a",
"logging",
"version",
"of",
"a",
"Statement"
] | train | https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/StatementLogger.java#L88-L92 |
alkacon/opencms-core | src/org/opencms/relations/CmsRelation.java | CmsRelation.getSource | public CmsResource getSource(CmsObject cms, CmsResourceFilter filter) throws CmsException {
try {
// first look up by id
return cms.readResource(getSourceId(), filter);
} catch (CmsVfsResourceNotFoundException e) {
// then look up by name, but from the root site
String storedSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot("");
return cms.readResource(getSourcePath(), filter);
} finally {
cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
} | java | public CmsResource getSource(CmsObject cms, CmsResourceFilter filter) throws CmsException {
try {
// first look up by id
return cms.readResource(getSourceId(), filter);
} catch (CmsVfsResourceNotFoundException e) {
// then look up by name, but from the root site
String storedSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot("");
return cms.readResource(getSourcePath(), filter);
} finally {
cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
} | [
"public",
"CmsResource",
"getSource",
"(",
"CmsObject",
"cms",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"// first look up by id",
"return",
"cms",
".",
"readResource",
"(",
"getSourceId",
"(",
")",
",",
"filter",
")",
"... | Returns the source resource when possible to read with the given filter.<p>
@param cms the current user context
@param filter the filter to use
@return the source resource
@throws CmsException if something goes wrong | [
"Returns",
"the",
"source",
"resource",
"when",
"possible",
"to",
"read",
"with",
"the",
"given",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsRelation.java#L148-L163 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final Color color) throws IOException
{
final float [] components = new float [] { color.getRed () / 255f,
color.getGreen () / 255f,
color.getBlue () / 255f };
final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE);
setNonStrokingColor (pdColor);
} | java | public void setNonStrokingColor (final Color color) throws IOException
{
final float [] components = new float [] { color.getRed () / 255f,
color.getGreen () / 255f,
color.getBlue () / 255f };
final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE);
setNonStrokingColor (pdColor);
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"Color",
"color",
")",
"throws",
"IOException",
"{",
"final",
"float",
"[",
"]",
"components",
"=",
"new",
"float",
"[",
"]",
"{",
"color",
".",
"getRed",
"(",
")",
"/",
"255f",
",",
"color",
".",
... | Set the non-stroking color using an AWT color. Conversion uses the default
sRGB color space.
@param color
The color to set.
@throws IOException
If an IO error occurs while writing to the stream. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"using",
"an",
"AWT",
"color",
".",
"Conversion",
"uses",
"the",
"default",
"sRGB",
"color",
"space",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L929-L936 |
tomgibara/bits | src/main/java/com/tomgibara/bits/Bits.java | Bits.asStore | public static BitStore asStore(BitSet bitSet, int size) {
if (bitSet == null) throw new IllegalArgumentException("null bitSet");
checkSize(size);
return new BitSetBitStore(bitSet, 0, size, true);
} | java | public static BitStore asStore(BitSet bitSet, int size) {
if (bitSet == null) throw new IllegalArgumentException("null bitSet");
checkSize(size);
return new BitSetBitStore(bitSet, 0, size, true);
} | [
"public",
"static",
"BitStore",
"asStore",
"(",
"BitSet",
"bitSet",
",",
"int",
"size",
")",
"{",
"if",
"(",
"bitSet",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null bitSet\"",
")",
";",
"checkSize",
"(",
"size",
")",
";",
"ret... | Exposes a <code>BitSet</code> as a {@link BitStore}. The returned bit
store is a live view over the bit set; changes made to the bit set are
reflected in the bit store and vice versa. Unlike bit sets, bit stores
have a fixed size which must be specified at construction time and which
is not required to match the length of the bit set. In all cases, the
bits of the bit set are drawn from the lowest-indexed bits.
@param bitSet
the bits of the {@link BitStore}
@param size
the size, in bits, of the {@link BitStore}
@return a {@link BitStore} view over the bit set. | [
"Exposes",
"a",
"<code",
">",
"BitSet<",
"/",
"code",
">",
"as",
"a",
"{",
"@link",
"BitStore",
"}",
".",
"The",
"returned",
"bit",
"store",
"is",
"a",
"live",
"view",
"over",
"the",
"bit",
"set",
";",
"changes",
"made",
"to",
"the",
"bit",
"set",
... | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L492-L496 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/MatrixIO.java | MatrixIO.saveDenseCSV | public static void saveDenseCSV(DMatrix A , String fileName )
throws IOException
{
PrintStream fileStream = new PrintStream(fileName);
fileStream.println(A.getNumRows() + " " + A.getNumCols() + " real");
for( int i = 0; i < A.getNumRows(); i++ ) {
for( int j = 0; j < A.getNumCols(); j++ ) {
fileStream.print(A.get(i,j)+" ");
}
fileStream.println();
}
fileStream.close();
} | java | public static void saveDenseCSV(DMatrix A , String fileName )
throws IOException
{
PrintStream fileStream = new PrintStream(fileName);
fileStream.println(A.getNumRows() + " " + A.getNumCols() + " real");
for( int i = 0; i < A.getNumRows(); i++ ) {
for( int j = 0; j < A.getNumCols(); j++ ) {
fileStream.print(A.get(i,j)+" ");
}
fileStream.println();
}
fileStream.close();
} | [
"public",
"static",
"void",
"saveDenseCSV",
"(",
"DMatrix",
"A",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"PrintStream",
"fileStream",
"=",
"new",
"PrintStream",
"(",
"fileName",
")",
";",
"fileStream",
".",
"println",
"(",
"A",
".",
"ge... | Saves a matrix to disk using in a Column Space Value (CSV) format. For a
description of the format see {@link MatrixIO#loadCSV(String,boolean)}.
@param A The matrix being saved.
@param fileName Name of the file its being saved at.
@throws java.io.IOException | [
"Saves",
"a",
"matrix",
"to",
"disk",
"using",
"in",
"a",
"Column",
"Space",
"Value",
"(",
"CSV",
")",
"format",
".",
"For",
"a",
"description",
"of",
"the",
"format",
"see",
"{",
"@link",
"MatrixIO#loadCSV",
"(",
"String",
"boolean",
")",
"}",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L104-L117 |
jqno/equalsverifier | src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/NonnullAnnotationVerifier.java | NonnullAnnotationVerifier.fieldIsNonnull | public static boolean fieldIsNonnull(Field field, AnnotationCache annotationCache) {
Class<?> type = field.getDeclaringClass();
if (annotationCache.hasFieldAnnotation(type, field.getName(), NONNULL)) {
return true;
}
if (annotationCache.hasFieldAnnotation(type, field.getName(), NULLABLE)) {
return false;
}
return annotationCache.hasClassAnnotation(type, FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL) ||
annotationCache.hasClassAnnotation(type, JSR305_DEFAULT_ANNOTATION_NONNULL) ||
annotationCache.hasClassAnnotation(type, ECLIPSE_DEFAULT_ANNOTATION_NONNULL);
} | java | public static boolean fieldIsNonnull(Field field, AnnotationCache annotationCache) {
Class<?> type = field.getDeclaringClass();
if (annotationCache.hasFieldAnnotation(type, field.getName(), NONNULL)) {
return true;
}
if (annotationCache.hasFieldAnnotation(type, field.getName(), NULLABLE)) {
return false;
}
return annotationCache.hasClassAnnotation(type, FINDBUGS1X_DEFAULT_ANNOTATION_NONNULL) ||
annotationCache.hasClassAnnotation(type, JSR305_DEFAULT_ANNOTATION_NONNULL) ||
annotationCache.hasClassAnnotation(type, ECLIPSE_DEFAULT_ANNOTATION_NONNULL);
} | [
"public",
"static",
"boolean",
"fieldIsNonnull",
"(",
"Field",
"field",
",",
"AnnotationCache",
"annotationCache",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"field",
".",
"getDeclaringClass",
"(",
")",
";",
"if",
"(",
"annotationCache",
".",
"hasFieldAnno... | Checks whether the given field is marked with an Nonnull annotation,
whether directly, or through some default annotation mechanism.
@param field The field to be checked.
@param annotationCache To provide access to the annotations on the field
and the field's class
@return True if the field is to be treated as Nonnull. | [
"Checks",
"whether",
"the",
"given",
"field",
"is",
"marked",
"with",
"an",
"Nonnull",
"annotation",
"whether",
"directly",
"or",
"through",
"some",
"default",
"annotation",
"mechanism",
"."
] | train | https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/reflection/annotations/NonnullAnnotationVerifier.java#L23-L34 |
VoltDB/voltdb | src/frontend/org/voltcore/zk/BabySitter.java | BabySitter.nonblockingFactory | public static BabySitter nonblockingFactory(ZooKeeper zk, String dir,
Callback cb, ExecutorService es)
throws InterruptedException, ExecutionException
{
BabySitter bs = new BabySitter(zk, dir, cb, es);
bs.m_es.submit(bs.m_eventHandler);
return bs;
} | java | public static BabySitter nonblockingFactory(ZooKeeper zk, String dir,
Callback cb, ExecutorService es)
throws InterruptedException, ExecutionException
{
BabySitter bs = new BabySitter(zk, dir, cb, es);
bs.m_es.submit(bs.m_eventHandler);
return bs;
} | [
"public",
"static",
"BabySitter",
"nonblockingFactory",
"(",
"ZooKeeper",
"zk",
",",
"String",
"dir",
",",
"Callback",
"cb",
",",
"ExecutorService",
"es",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"BabySitter",
"bs",
"=",
"new",
"BabyS... | Create a new BabySitter and make sure it reads the initial children list.
Use the provided ExecutorService to queue events to, rather than
creating a private ExecutorService. | [
"Create",
"a",
"new",
"BabySitter",
"and",
"make",
"sure",
"it",
"reads",
"the",
"initial",
"children",
"list",
".",
"Use",
"the",
"provided",
"ExecutorService",
"to",
"queue",
"events",
"to",
"rather",
"than",
"creating",
"a",
"private",
"ExecutorService",
".... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/BabySitter.java#L150-L157 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java | PathWrapper.lookup | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
return getWrappedPath().lookup(userPath, newAttributes);
} | java | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
return getWrappedPath().lookup(userPath, newAttributes);
} | [
"public",
"PathImpl",
"lookup",
"(",
"String",
"userPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"newAttributes",
")",
"{",
"return",
"getWrappedPath",
"(",
")",
".",
"lookup",
"(",
"userPath",
",",
"newAttributes",
")",
";",
"}"
] | Returns a new path relative to the current one.
<p>Path only handles scheme:xxx. Subclasses of Path will specialize
the xxx.
@param userPath relative or absolute path, essentially any url.
@param newAttributes attributes for the new path.
@return the new path or null if the scheme doesn't exist | [
"Returns",
"a",
"new",
"path",
"relative",
"to",
"the",
"current",
"one",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java#L81-L84 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.streamOfTypeForMethodArgument | @SuppressWarnings("WeakerAccess")
@Internal
protected final Stream streamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) ->
((DefaultBeanContext) context).streamOfType(resolutionContext, beanType, qualifier)
);
} | java | @SuppressWarnings("WeakerAccess")
@Internal
protected final Stream streamOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) ->
((DefaultBeanContext) context).streamOfType(resolutionContext, beanType, qualifier)
);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"protected",
"final",
"Stream",
"streamOfTypeForMethodArgument",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"MethodInjectionPoint",
"injectionPoint",
",",
"Ar... | Obtains all bean definitions for the method at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The method injection point
@param argument The argument
@return The resolved bean | [
"Obtains",
"all",
"bean",
"definitions",
"for",
"the",
"method",
"at",
"the",
"given",
"index",
"and",
"the",
"argument",
"at",
"the",
"given",
"index",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and"... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L927-L933 |
arquillian/arquillian-cube | kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java | KuberntesServiceUrlResourceProvider.getContainerPort | private static int getContainerPort(Service service, Annotation... qualifiers) {
for (Annotation q : qualifiers) {
if (q instanceof Port) {
Port port = (Port) q;
if (port.value() > 0) {
return port.value();
}
}
}
ServicePort servicePort = findQualifiedServicePort(service, qualifiers);
if (servicePort != null) {
return servicePort.getTargetPort().getIntVal();
}
return 0;
} | java | private static int getContainerPort(Service service, Annotation... qualifiers) {
for (Annotation q : qualifiers) {
if (q instanceof Port) {
Port port = (Port) q;
if (port.value() > 0) {
return port.value();
}
}
}
ServicePort servicePort = findQualifiedServicePort(service, qualifiers);
if (servicePort != null) {
return servicePort.getTargetPort().getIntVal();
}
return 0;
} | [
"private",
"static",
"int",
"getContainerPort",
"(",
"Service",
"service",
",",
"Annotation",
"...",
"qualifiers",
")",
"{",
"for",
"(",
"Annotation",
"q",
":",
"qualifiers",
")",
"{",
"if",
"(",
"q",
"instanceof",
"Port",
")",
"{",
"Port",
"port",
"=",
... | Find the the qualfied container port of the target service
Uses java annotations first or returns the container port.
@param service
The target service.
@param qualifiers
The set of qualifiers.
@return Returns the resolved containerPort of '0' as a fallback. | [
"Find",
"the",
"the",
"qualfied",
"container",
"port",
"of",
"the",
"target",
"service",
"Uses",
"java",
"annotations",
"first",
"or",
"returns",
"the",
"container",
"port",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/enricher/KuberntesServiceUrlResourceProvider.java#L156-L171 |
apache/incubator-gobblin | gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java | AzkabanClient.uploadProjectZip | public AzkabanClientStatus uploadProjectZip(String projectName,
File zipFile) throws AzkabanClientException {
AzkabanMultiCallables.UploadProjectCallable callable =
AzkabanMultiCallables.UploadProjectCallable.builder()
.client(this)
.projectName(projectName)
.zipFile(zipFile)
.build();
return runWithRetry(callable, AzkabanClientStatus.class);
} | java | public AzkabanClientStatus uploadProjectZip(String projectName,
File zipFile) throws AzkabanClientException {
AzkabanMultiCallables.UploadProjectCallable callable =
AzkabanMultiCallables.UploadProjectCallable.builder()
.client(this)
.projectName(projectName)
.zipFile(zipFile)
.build();
return runWithRetry(callable, AzkabanClientStatus.class);
} | [
"public",
"AzkabanClientStatus",
"uploadProjectZip",
"(",
"String",
"projectName",
",",
"File",
"zipFile",
")",
"throws",
"AzkabanClientException",
"{",
"AzkabanMultiCallables",
".",
"UploadProjectCallable",
"callable",
"=",
"AzkabanMultiCallables",
".",
"UploadProjectCallabl... | Updates a project by uploading a new zip file. Before uploading any project zip files,
the project should be created first.
@param projectName project name
@param zipFile zip file
@return A status object indicating if AJAX request is successful. | [
"Updates",
"a",
"project",
"by",
"uploading",
"a",
"new",
"zip",
"file",
".",
"Before",
"uploading",
"any",
"project",
"zip",
"files",
"the",
"project",
"should",
"be",
"created",
"first",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L318-L329 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.checkStatus | protected void checkStatus(List<ValidationWarning> warnings, Status... allowed) {
Status actual = getProperty(Status.class);
if (actual == null) {
return;
}
List<String> allowedValues = new ArrayList<String>(allowed.length);
for (Status status : allowed) {
String value = status.getValue().toLowerCase();
allowedValues.add(value);
}
String actualValue = actual.getValue().toLowerCase();
if (!allowedValues.contains(actualValue)) {
warnings.add(new ValidationWarning(13, actual.getValue(), allowedValues));
}
} | java | protected void checkStatus(List<ValidationWarning> warnings, Status... allowed) {
Status actual = getProperty(Status.class);
if (actual == null) {
return;
}
List<String> allowedValues = new ArrayList<String>(allowed.length);
for (Status status : allowed) {
String value = status.getValue().toLowerCase();
allowedValues.add(value);
}
String actualValue = actual.getValue().toLowerCase();
if (!allowedValues.contains(actualValue)) {
warnings.add(new ValidationWarning(13, actual.getValue(), allowedValues));
}
} | [
"protected",
"void",
"checkStatus",
"(",
"List",
"<",
"ValidationWarning",
">",
"warnings",
",",
"Status",
"...",
"allowed",
")",
"{",
"Status",
"actual",
"=",
"getProperty",
"(",
"Status",
".",
"class",
")",
";",
"if",
"(",
"actual",
"==",
"null",
")",
... | Utility method for validating the {@link Status} property of a component.
@param warnings the list to add the warnings to
@param allowed the valid statuses | [
"Utility",
"method",
"for",
"validating",
"the",
"{"
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L550-L566 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/SpringServlet.java | SpringServlet.failStartup | protected void failStartup(String message, Throwable th)
throws ServletException {
System.err.println("\n**************************");
System.err.println("** FEDORA STARTUP ERROR **");
System.err.println("**************************\n");
System.err.println(message);
if (th == null) {
System.err.println();
throw new ServletException(message);
} else {
th.printStackTrace();
System.err.println();
throw new ServletException(message, th);
}
} | java | protected void failStartup(String message, Throwable th)
throws ServletException {
System.err.println("\n**************************");
System.err.println("** FEDORA STARTUP ERROR **");
System.err.println("**************************\n");
System.err.println(message);
if (th == null) {
System.err.println();
throw new ServletException(message);
} else {
th.printStackTrace();
System.err.println();
throw new ServletException(message, th);
}
} | [
"protected",
"void",
"failStartup",
"(",
"String",
"message",
",",
"Throwable",
"th",
")",
"throws",
"ServletException",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"\\n**************************\"",
")",
";",
"System",
".",
"err",
".",
"println",
"(",
"... | Prints a "FEDORA STARTUP ERROR" to STDERR along with the stacktrace of
the Throwable (if given) and finally, throws a ServletException. | [
"Prints",
"a",
"FEDORA",
"STARTUP",
"ERROR",
"to",
"STDERR",
"along",
"with",
"the",
"stacktrace",
"of",
"the",
"Throwable",
"(",
"if",
"given",
")",
"and",
"finally",
"throws",
"a",
"ServletException",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/SpringServlet.java#L30-L44 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java | PrivateDataManager.removePrivateDataProvider | public static void removePrivateDataProvider(String elementName, String namespace) {
String key = XmppStringUtils.generateKey(elementName, namespace);
privateDataProviders.remove(key);
} | java | public static void removePrivateDataProvider(String elementName, String namespace) {
String key = XmppStringUtils.generateKey(elementName, namespace);
privateDataProviders.remove(key);
} | [
"public",
"static",
"void",
"removePrivateDataProvider",
"(",
"String",
"elementName",
",",
"String",
"namespace",
")",
"{",
"String",
"key",
"=",
"XmppStringUtils",
".",
"generateKey",
"(",
"elementName",
",",
"namespace",
")",
";",
"privateDataProviders",
".",
"... | Removes a private data provider with the specified element name and namespace.
@param elementName The XML element name.
@param namespace The XML namespace. | [
"Removes",
"a",
"private",
"data",
"provider",
"with",
"the",
"specified",
"element",
"name",
"and",
"namespace",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java#L129-L132 |
RestExpress/PluginExpress | cors/src/main/java/com/strategicgains/restexpress/plugin/cors/CorsHeaderPlugin.java | CorsHeaderPlugin.addPreflightOptionsRequestSupport | private void addPreflightOptionsRequestSupport(RestExpress server, CorsOptionsController corsOptionsController)
{
RouteBuilder rb;
for (String pattern : methodsByPattern.keySet())
{
rb = server.uri(pattern, corsOptionsController)
.action("options", HttpMethod.OPTIONS)
.noSerialization()
// Disable both authentication and authorization which are usually use header such as X-Authorization.
// When browser does CORS preflight with OPTIONS request, such headers are not included.
.flag(Flags.Auth.PUBLIC_ROUTE)
.flag(Flags.Auth.NO_AUTHORIZATION);
for (String flag : flags)
{
rb.flag(flag);
}
for (Entry<String, Object> entry : parameters.entrySet())
{
rb.parameter(entry.getKey(), entry.getValue());
}
routeBuilders.add(rb);
}
} | java | private void addPreflightOptionsRequestSupport(RestExpress server, CorsOptionsController corsOptionsController)
{
RouteBuilder rb;
for (String pattern : methodsByPattern.keySet())
{
rb = server.uri(pattern, corsOptionsController)
.action("options", HttpMethod.OPTIONS)
.noSerialization()
// Disable both authentication and authorization which are usually use header such as X-Authorization.
// When browser does CORS preflight with OPTIONS request, such headers are not included.
.flag(Flags.Auth.PUBLIC_ROUTE)
.flag(Flags.Auth.NO_AUTHORIZATION);
for (String flag : flags)
{
rb.flag(flag);
}
for (Entry<String, Object> entry : parameters.entrySet())
{
rb.parameter(entry.getKey(), entry.getValue());
}
routeBuilders.add(rb);
}
} | [
"private",
"void",
"addPreflightOptionsRequestSupport",
"(",
"RestExpress",
"server",
",",
"CorsOptionsController",
"corsOptionsController",
")",
"{",
"RouteBuilder",
"rb",
";",
"for",
"(",
"String",
"pattern",
":",
"methodsByPattern",
".",
"keySet",
"(",
")",
")",
... | Add an 'OPTIONS' method supported on all routes for the pre-flight CORS request.
@param server a RestExpress server instance. | [
"Add",
"an",
"OPTIONS",
"method",
"supported",
"on",
"all",
"routes",
"for",
"the",
"pre",
"-",
"flight",
"CORS",
"request",
"."
] | train | https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/cors/src/main/java/com/strategicgains/restexpress/plugin/cors/CorsHeaderPlugin.java#L230-L256 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sortValiableDesc | @Deprecated
public static Comparator<? super MonetaryAmount> sortValiableDesc(
final ExchangeRateProvider provider) {
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortValuable(provider).compare(o1, o2) * -1;
}
};
} | java | @Deprecated
public static Comparator<? super MonetaryAmount> sortValiableDesc(
final ExchangeRateProvider provider) {
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortValuable(provider).compare(o1, o2) * -1;
}
};
} | [
"@",
"Deprecated",
"public",
"static",
"Comparator",
"<",
"?",
"super",
"MonetaryAmount",
">",
"sortValiableDesc",
"(",
"final",
"ExchangeRateProvider",
"provider",
")",
"{",
"return",
"new",
"Comparator",
"<",
"MonetaryAmount",
">",
"(",
")",
"{",
"@",
"Overrid... | Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)}
@param provider the rate provider to be used.
@return the Descending order of
{@link MonetaryFunctions#sortValuable(ExchangeRateProvider)}
@deprecated Use #sortValiableDesc instead of. | [
"Descending",
"order",
"of",
"{"
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L116-L125 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java | CommerceSubscriptionEntryPersistenceImpl.fetchByUUID_G | @Override
public CommerceSubscriptionEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CommerceSubscriptionEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CommerceSubscriptionEntry",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the commerce subscription entry where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce subscription entry, or <code>null</code> if a matching commerce subscription entry could not be found | [
"Returns",
"the",
"commerce",
"subscription",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"find... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L711-L714 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java | AbstractArchiveJob.fileCreatedDate | private Date fileCreatedDate(String fileName) {
String[] splittedWithoutExtention = fileName.split(".");
String fileNameWithoutExtention = splittedWithoutExtention[0];
String[] splittedWithoutPrefix = fileNameWithoutExtention.split("-");
String fileNameDateInStr = splittedWithoutPrefix[1];
try {
return AuditUtil.stringTodate(fileNameDateInStr, "yyyy-MM-dd");
} catch (ParseException e) {
throw new Audit4jRuntimeException("Exception occured parsing the date.", e);
}
} | java | private Date fileCreatedDate(String fileName) {
String[] splittedWithoutExtention = fileName.split(".");
String fileNameWithoutExtention = splittedWithoutExtention[0];
String[] splittedWithoutPrefix = fileNameWithoutExtention.split("-");
String fileNameDateInStr = splittedWithoutPrefix[1];
try {
return AuditUtil.stringTodate(fileNameDateInStr, "yyyy-MM-dd");
} catch (ParseException e) {
throw new Audit4jRuntimeException("Exception occured parsing the date.", e);
}
} | [
"private",
"Date",
"fileCreatedDate",
"(",
"String",
"fileName",
")",
"{",
"String",
"[",
"]",
"splittedWithoutExtention",
"=",
"fileName",
".",
"split",
"(",
"\".\"",
")",
";",
"String",
"fileNameWithoutExtention",
"=",
"splittedWithoutExtention",
"[",
"0",
"]",
... | File created date.
@param fileName the file name
@return the date | [
"File",
"created",
"date",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java#L87-L97 |
telly/groundy | library/src/main/java/com/telly/groundy/util/DownloadUtils.java | DownloadUtils.getDownloadListenerForTask | public static DownloadProgressListener getDownloadListenerForTask(final GroundyTask groundyTask) {
return new DownloadProgressListener() {
@Override
public void onProgress(String url, int progress) {
groundyTask.updateProgress(progress);
}
};
} | java | public static DownloadProgressListener getDownloadListenerForTask(final GroundyTask groundyTask) {
return new DownloadProgressListener() {
@Override
public void onProgress(String url, int progress) {
groundyTask.updateProgress(progress);
}
};
} | [
"public",
"static",
"DownloadProgressListener",
"getDownloadListenerForTask",
"(",
"final",
"GroundyTask",
"groundyTask",
")",
"{",
"return",
"new",
"DownloadProgressListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onProgress",
"(",
"String",
"url",
",",
... | Returns a progress listener that will post progress to the specified groundyTask.
@param groundyTask the groundyTask to post progress to. Cannot be null.
@return a progress listener | [
"Returns",
"a",
"progress",
"listener",
"that",
"will",
"post",
"progress",
"to",
"the",
"specified",
"groundyTask",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/util/DownloadUtils.java#L102-L109 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.bindScriptBundle | @Override
public void bindScriptBundle(final IScriptBundle scriptBundle, final GVRMain gvrMain, boolean bindToMainScene)
throws IOException, GVRScriptException {
// Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set.
bindHelper((GVRScriptBundle)scriptBundle, null, BIND_MASK_GVRSCRIPT | BIND_MASK_GVRACTIVITY);
if (bindToMainScene) {
final IScriptEvents bindToSceneListener = new GVREventListeners.ScriptEvents() {
GVRScene mainScene = null;
@Override
public void onInit(GVRContext gvrContext) throws Throwable {
mainScene = gvrContext.getMainScene();
}
@Override
public void onAfterInit() {
try {
bindScriptBundleToScene((GVRScriptBundle)scriptBundle, mainScene);
} catch (IOException e) {
mGvrContext.logError(e.getMessage(), this);
} catch (GVRScriptException e) {
mGvrContext.logError(e.getMessage(), this);
} finally {
// Remove the listener itself
gvrMain.getEventReceiver().removeListener(this);
}
}
};
// Add listener to bind to main scene when event "onAfterInit" is received
gvrMain.getEventReceiver().addListener(bindToSceneListener);
}
} | java | @Override
public void bindScriptBundle(final IScriptBundle scriptBundle, final GVRMain gvrMain, boolean bindToMainScene)
throws IOException, GVRScriptException {
// Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set.
bindHelper((GVRScriptBundle)scriptBundle, null, BIND_MASK_GVRSCRIPT | BIND_MASK_GVRACTIVITY);
if (bindToMainScene) {
final IScriptEvents bindToSceneListener = new GVREventListeners.ScriptEvents() {
GVRScene mainScene = null;
@Override
public void onInit(GVRContext gvrContext) throws Throwable {
mainScene = gvrContext.getMainScene();
}
@Override
public void onAfterInit() {
try {
bindScriptBundleToScene((GVRScriptBundle)scriptBundle, mainScene);
} catch (IOException e) {
mGvrContext.logError(e.getMessage(), this);
} catch (GVRScriptException e) {
mGvrContext.logError(e.getMessage(), this);
} finally {
// Remove the listener itself
gvrMain.getEventReceiver().removeListener(this);
}
}
};
// Add listener to bind to main scene when event "onAfterInit" is received
gvrMain.getEventReceiver().addListener(bindToSceneListener);
}
} | [
"@",
"Override",
"public",
"void",
"bindScriptBundle",
"(",
"final",
"IScriptBundle",
"scriptBundle",
",",
"final",
"GVRMain",
"gvrMain",
",",
"boolean",
"bindToMainScene",
")",
"throws",
"IOException",
",",
"GVRScriptException",
"{",
"// Here, bind to all targets except ... | Binds a script bundle to a {@link GVRScene} object.
@param scriptBundle
The script bundle.
@param gvrMain
The {@link GVRMain} to bind to.
@param bindToMainScene
If {@code true}, also bind it to the main scene on the event {@link GVRMain#onAfterInit}.
@throws IOException if script bundle file cannot be read.
@throws GVRScriptException if script processing error occurs. | [
"Binds",
"a",
"script",
"bundle",
"to",
"a",
"{",
"@link",
"GVRScene",
"}",
"object",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L269-L302 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/Assert.java | Assert.assertTree | public static void assertTree(int rootType, String preorder, Tree tree)
{
assertNotNull("tree should be non-null", tree);
assertPreordered(null, preorder, tree);
assertEquals("Comparing root type", rootType, tree.getType());
} | java | public static void assertTree(int rootType, String preorder, Tree tree)
{
assertNotNull("tree should be non-null", tree);
assertPreordered(null, preorder, tree);
assertEquals("Comparing root type", rootType, tree.getType());
} | [
"public",
"static",
"void",
"assertTree",
"(",
"int",
"rootType",
",",
"String",
"preorder",
",",
"Tree",
"tree",
")",
"{",
"assertNotNull",
"(",
"\"tree should be non-null\"",
",",
"tree",
")",
";",
"assertPreordered",
"(",
"null",
",",
"preorder",
",",
"tree... | Asserts a parse tree.
@param rootType the type of the root of the tree.
@param preorder the preorder traversal of the tree.
@param tree an ANTLR tree to assert on. | [
"Asserts",
"a",
"parse",
"tree",
"."
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L242-L247 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java | PDF417HighLevelEncoder.determineConsecutiveBinaryCount | private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding)
throws WriterException {
CharsetEncoder encoder = encoding.newEncoder();
int len = msg.length();
int idx = startpos;
while (idx < len) {
char ch = msg.charAt(idx);
int numericCount = 0;
while (numericCount < 13 && isDigit(ch)) {
numericCount++;
//textCount++;
int i = idx + numericCount;
if (i >= len) {
break;
}
ch = msg.charAt(i);
}
if (numericCount >= 13) {
return idx - startpos;
}
ch = msg.charAt(idx);
if (!encoder.canEncode(ch)) {
throw new WriterException("Non-encodable character detected: " + ch + " (Unicode: " + (int) ch + ')');
}
idx++;
}
return idx - startpos;
} | java | private static int determineConsecutiveBinaryCount(String msg, int startpos, Charset encoding)
throws WriterException {
CharsetEncoder encoder = encoding.newEncoder();
int len = msg.length();
int idx = startpos;
while (idx < len) {
char ch = msg.charAt(idx);
int numericCount = 0;
while (numericCount < 13 && isDigit(ch)) {
numericCount++;
//textCount++;
int i = idx + numericCount;
if (i >= len) {
break;
}
ch = msg.charAt(i);
}
if (numericCount >= 13) {
return idx - startpos;
}
ch = msg.charAt(idx);
if (!encoder.canEncode(ch)) {
throw new WriterException("Non-encodable character detected: " + ch + " (Unicode: " + (int) ch + ')');
}
idx++;
}
return idx - startpos;
} | [
"private",
"static",
"int",
"determineConsecutiveBinaryCount",
"(",
"String",
"msg",
",",
"int",
"startpos",
",",
"Charset",
"encoding",
")",
"throws",
"WriterException",
"{",
"CharsetEncoder",
"encoder",
"=",
"encoding",
".",
"newEncoder",
"(",
")",
";",
"int",
... | Determines the number of consecutive characters that are encodable using binary compaction.
@param msg the message
@param startpos the start position within the message
@param encoding the charset used to convert the message to a byte array
@return the requested character count | [
"Determines",
"the",
"number",
"of",
"consecutive",
"characters",
"that",
"are",
"encodable",
"using",
"binary",
"compaction",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417HighLevelEncoder.java#L537-L566 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.getValueForMethodArgument | @SuppressWarnings({"unused", "unchecked"})
@Internal
protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex) {
MethodInjectionPoint injectionPoint = methodInjectionPoints.get(methodIndex);
Argument argument = injectionPoint.getArguments()[argIndex];
BeanResolutionContext.Path path = resolutionContext.getPath();
path.pushMethodArgumentResolve(this, injectionPoint, argument);
if (context instanceof ApplicationContext) {
// can't use orElseThrow here due to compiler bug
try {
String valueAnnStr = argument.getAnnotationMetadata().getValue(Value.class, String.class).orElse(null);
Class argumentType = argument.getType();
if (isInnerConfiguration(argumentType)) {
Qualifier qualifier = resolveQualifier(resolutionContext, argument, true);
return ((DefaultBeanContext) context).getBean(resolutionContext, argumentType, qualifier);
} else {
String argumentName = argument.getName();
String valString = resolvePropertyValueName(resolutionContext, injectionPoint.getAnnotationMetadata(), argument, valueAnnStr);
ApplicationContext applicationContext = (ApplicationContext) context;
ArgumentConversionContext conversionContext = ConversionContext.of(argument);
Optional value = resolveValue(applicationContext, conversionContext, valueAnnStr != null, valString);
if (argumentType == Optional.class) {
return resolveOptionalObject(value);
} else {
if (value.isPresent()) {
return value.get();
} else {
if (argument.isDeclaredAnnotationPresent(Nullable.class)) {
return null;
}
throw new DependencyInjectionException(resolutionContext, injectionPoint, conversionContext, valString);
}
}
}
} finally {
path.pop();
}
} else {
path.pop();
throw new DependencyInjectionException(resolutionContext, argument, "BeanContext must support property resolution");
}
} | java | @SuppressWarnings({"unused", "unchecked"})
@Internal
protected final Object getValueForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, int methodIndex, int argIndex) {
MethodInjectionPoint injectionPoint = methodInjectionPoints.get(methodIndex);
Argument argument = injectionPoint.getArguments()[argIndex];
BeanResolutionContext.Path path = resolutionContext.getPath();
path.pushMethodArgumentResolve(this, injectionPoint, argument);
if (context instanceof ApplicationContext) {
// can't use orElseThrow here due to compiler bug
try {
String valueAnnStr = argument.getAnnotationMetadata().getValue(Value.class, String.class).orElse(null);
Class argumentType = argument.getType();
if (isInnerConfiguration(argumentType)) {
Qualifier qualifier = resolveQualifier(resolutionContext, argument, true);
return ((DefaultBeanContext) context).getBean(resolutionContext, argumentType, qualifier);
} else {
String argumentName = argument.getName();
String valString = resolvePropertyValueName(resolutionContext, injectionPoint.getAnnotationMetadata(), argument, valueAnnStr);
ApplicationContext applicationContext = (ApplicationContext) context;
ArgumentConversionContext conversionContext = ConversionContext.of(argument);
Optional value = resolveValue(applicationContext, conversionContext, valueAnnStr != null, valString);
if (argumentType == Optional.class) {
return resolveOptionalObject(value);
} else {
if (value.isPresent()) {
return value.get();
} else {
if (argument.isDeclaredAnnotationPresent(Nullable.class)) {
return null;
}
throw new DependencyInjectionException(resolutionContext, injectionPoint, conversionContext, valString);
}
}
}
} finally {
path.pop();
}
} else {
path.pop();
throw new DependencyInjectionException(resolutionContext, argument, "BeanContext must support property resolution");
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unused\"",
",",
"\"unchecked\"",
"}",
")",
"@",
"Internal",
"protected",
"final",
"Object",
"getValueForMethodArgument",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"int",
"methodIndex",
... | Obtains a value for the given method argument.
@param resolutionContext The resolution context
@param context The bean context
@param methodIndex The method index
@param argIndex The argument index
@return The value | [
"Obtains",
"a",
"value",
"for",
"the",
"given",
"method",
"argument",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L740-L784 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_pendingChanges_GET | public ArrayList<OvhPendingChanges> serviceName_pendingChanges_GET(String serviceName) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/pendingChanges";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | java | public ArrayList<OvhPendingChanges> serviceName_pendingChanges_GET(String serviceName) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/pendingChanges";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t9);
} | [
"public",
"ArrayList",
"<",
"OvhPendingChanges",
">",
"serviceName_pendingChanges_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/pendingChanges\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"... | List the pending changes on your Load Balancer configuration, per zone
REST: GET /ipLoadbalancing/{serviceName}/pendingChanges
@param serviceName [required] The internal name of your IP load balancing | [
"List",
"the",
"pending",
"changes",
"on",
"your",
"Load",
"Balancer",
"configuration",
"per",
"zone"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1228-L1233 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java | WebhookCluster.newBuilder | public WebhookClientBuilder newBuilder(long id, String token)
{
WebhookClientBuilder builder = new WebhookClientBuilder(id, token);
builder.setExecutorService(defaultPool)
.setHttpClient(defaultHttpClient)
.setThreadFactory(threadFactory)
.setDaemon(isDaemon);
if (defaultHttpClientBuilder != null)
builder.setHttpClientBuilder(defaultHttpClientBuilder);
return builder;
} | java | public WebhookClientBuilder newBuilder(long id, String token)
{
WebhookClientBuilder builder = new WebhookClientBuilder(id, token);
builder.setExecutorService(defaultPool)
.setHttpClient(defaultHttpClient)
.setThreadFactory(threadFactory)
.setDaemon(isDaemon);
if (defaultHttpClientBuilder != null)
builder.setHttpClientBuilder(defaultHttpClientBuilder);
return builder;
} | [
"public",
"WebhookClientBuilder",
"newBuilder",
"(",
"long",
"id",
",",
"String",
"token",
")",
"{",
"WebhookClientBuilder",
"builder",
"=",
"new",
"WebhookClientBuilder",
"(",
"id",
",",
"token",
")",
";",
"builder",
".",
"setExecutorService",
"(",
"defaultPool",... | Creates a new {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilder}
with the defined default settings of this cluster.
@param id
The webhook id
@param token
The webhook token
@throws java.lang.IllegalArgumentException
If the token is {@code null}, empty or contains blanks
@return The WebhookClientBuilder with default settings
@see net.dv8tion.jda.webhook.WebhookClientBuilder#WebhookClientBuilder(long, String) new WebhookClientBuilder(long, String) | [
"Creates",
"a",
"new",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"webhook",
".",
"WebhookClientBuilder",
"WebhookClientBuilder",
"}",
"with",
"the",
"defined",
"default",
"settings",
"of",
"this",
"cluster",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L325-L335 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java | AlignedBox3f.setFromCorners | @Override
public void setFromCorners(Point3D p1, Point3D p2) {
setFromCorners(
p1.getX(), p1.getY(), p1.getZ(),
p2.getX(), p2.getY(), p2.getZ());
} | java | @Override
public void setFromCorners(Point3D p1, Point3D p2) {
setFromCorners(
p1.getX(), p1.getY(), p1.getZ(),
p2.getX(), p2.getY(), p2.getZ());
} | [
"@",
"Override",
"public",
"void",
"setFromCorners",
"(",
"Point3D",
"p1",
",",
"Point3D",
"p2",
")",
"{",
"setFromCorners",
"(",
"p1",
".",
"getX",
"(",
")",
",",
"p1",
".",
"getY",
"(",
")",
",",
"p1",
".",
"getZ",
"(",
")",
",",
"p2",
".",
"ge... | Change the frame of the box.
@param p1 is the coordinate of the first corner.
@param p2 is the coordinate of the second corner. | [
"Change",
"the",
"frame",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L284-L289 |
micronaut-projects/micronaut-core | discovery-client/src/main/java/io/micronaut/discovery/client/DiscoveryClientConfiguration.java | DiscoveryClientConfiguration.setZones | public void setZones(Map<String, List<URL>> zones) {
if (zones != null) {
this.otherZones = zones.entrySet()
.stream()
.flatMap((Function<Map.Entry<String, List<URL>>, Stream<ServiceInstance>>) entry ->
entry.getValue()
.stream()
.map(uriMapper())
.map(uri ->
ServiceInstance.builder(getServiceID(), uri)
.zone(entry.getKey())
.build()
))
.collect(Collectors.toList());
}
} | java | public void setZones(Map<String, List<URL>> zones) {
if (zones != null) {
this.otherZones = zones.entrySet()
.stream()
.flatMap((Function<Map.Entry<String, List<URL>>, Stream<ServiceInstance>>) entry ->
entry.getValue()
.stream()
.map(uriMapper())
.map(uri ->
ServiceInstance.builder(getServiceID(), uri)
.zone(entry.getKey())
.build()
))
.collect(Collectors.toList());
}
} | [
"public",
"void",
"setZones",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"URL",
">",
">",
"zones",
")",
"{",
"if",
"(",
"zones",
"!=",
"null",
")",
"{",
"this",
".",
"otherZones",
"=",
"zones",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")"... | Configures Discovery servers in other zones.
@param zones The zones | [
"Configures",
"Discovery",
"servers",
"in",
"other",
"zones",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/discovery-client/src/main/java/io/micronaut/discovery/client/DiscoveryClientConfiguration.java#L155-L170 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.removeAll | @SafeVarargs
public static <T> boolean removeAll(Collection<? super T> collection, T... elements) {
return collection.removeAll(Arrays.asList(elements));
} | java | @SafeVarargs
public static <T> boolean removeAll(Collection<? super T> collection, T... elements) {
return collection.removeAll(Arrays.asList(elements));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"boolean",
"removeAll",
"(",
"Collection",
"<",
"?",
"super",
"T",
">",
"collection",
",",
"T",
"...",
"elements",
")",
"{",
"return",
"collection",
".",
"removeAll",
"(",
"Arrays",
".",
"asList",
"(... | Removes all of the specified elements from the specified collection.
@param collection
the collection from which the {@code elements} are to be removed. May not be <code>null</code>.
@param elements
the elements be remove from the {@code collection}. May not be <code>null</code> but may contain
<code>null</code> entries if the {@code collection} allows that.
@return <code>true</code> if the collection changed as a result of the call
@since 2.4 | [
"Removes",
"all",
"of",
"the",
"specified",
"elements",
"from",
"the",
"specified",
"collection",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L284-L287 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/tree/patricia/PatriciaTreeMutable.java | PatriciaTreeMutable.mutateUp | private void mutateUp(@NotNull final Deque<ChildReferenceTransient> stack, MutableNode node) {
while (!stack.isEmpty()) {
final ChildReferenceTransient parent = stack.pop();
final MutableNode mutableParent = parent.mutate(this);
mutableParent.setChild(parent.firstByte, node);
node = mutableParent;
}
} | java | private void mutateUp(@NotNull final Deque<ChildReferenceTransient> stack, MutableNode node) {
while (!stack.isEmpty()) {
final ChildReferenceTransient parent = stack.pop();
final MutableNode mutableParent = parent.mutate(this);
mutableParent.setChild(parent.firstByte, node);
node = mutableParent;
}
} | [
"private",
"void",
"mutateUp",
"(",
"@",
"NotNull",
"final",
"Deque",
"<",
"ChildReferenceTransient",
">",
"stack",
",",
"MutableNode",
"node",
")",
"{",
"while",
"(",
"!",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"ChildReferenceTransient",
"par... | /*
stack contains all ancestors of the node, stack.peek() is its parent. | [
"/",
"*",
"stack",
"contains",
"all",
"ancestors",
"of",
"the",
"node",
"stack",
".",
"peek",
"()",
"is",
"its",
"parent",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/PatriciaTreeMutable.java#L416-L423 |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java | FamilyBuilderImpl.createFamilyEvent | public Attribute createFamilyEvent(final Family family, final String type,
final String dateString) {
if (family == null || type == null || dateString == null) {
return gedObjectBuilder.createAttribute();
}
final Attribute event = gedObjectBuilder.createAttribute(family, type);
event.insert(new Date(event, dateString));
return event;
} | java | public Attribute createFamilyEvent(final Family family, final String type,
final String dateString) {
if (family == null || type == null || dateString == null) {
return gedObjectBuilder.createAttribute();
}
final Attribute event = gedObjectBuilder.createAttribute(family, type);
event.insert(new Date(event, dateString));
return event;
} | [
"public",
"Attribute",
"createFamilyEvent",
"(",
"final",
"Family",
"family",
",",
"final",
"String",
"type",
",",
"final",
"String",
"dateString",
")",
"{",
"if",
"(",
"family",
"==",
"null",
"||",
"type",
"==",
"null",
"||",
"dateString",
"==",
"null",
"... | Create a dated event.
@param family the family the event is for
@param type the type of event
@param dateString the date of the event
@return the created event | [
"Create",
"a",
"dated",
"event",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java#L71-L79 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static void rotate(Image image, int degree, File outFile) throws IORuntimeException {
write(rotate(image, degree), outFile);
} | java | public static void rotate(Image image, int degree, File outFile) throws IORuntimeException {
write(rotate(image, degree), outFile);
} | [
"public",
"static",
"void",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
",",
"File",
"outFile",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"rotate",
"(",
"image",
",",
"degree",
")",
",",
"outFile",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流
@param image 目标图像
@param degree 旋转角度
@param outFile 输出文件
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1016-L1018 |
ykrasik/jaci | jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java | StringUtils.removeTrailingDelimiter | public static String removeTrailingDelimiter(String str, String delimiter) {
if (!str.endsWith(delimiter)) {
return str;
} else {
return str.substring(0, str.length() - delimiter.length());
}
} | java | public static String removeTrailingDelimiter(String str, String delimiter) {
if (!str.endsWith(delimiter)) {
return str;
} else {
return str.substring(0, str.length() - delimiter.length());
}
} | [
"public",
"static",
"String",
"removeTrailingDelimiter",
"(",
"String",
"str",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"!",
"str",
".",
"endsWith",
"(",
"delimiter",
")",
")",
"{",
"return",
"str",
";",
"}",
"else",
"{",
"return",
"str",
".",
... | Removes the trailing delimiter from a string.
@param str String to process.
@param delimiter Delimiter to remove.
@return The string with the trailing delimiter removed. | [
"Removes",
"the",
"trailing",
"delimiter",
"from",
"a",
"string",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L60-L66 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotGetOptional | public static <T> Optional<Optional<T>> dotGetOptional(
final Map map, final String pathString, final Class<T> clazz
) {
return dotGet(map, Optional.class, pathString).map(opt -> (Optional<T>) opt);
} | java | public static <T> Optional<Optional<T>> dotGetOptional(
final Map map, final String pathString, final Class<T> clazz
) {
return dotGet(map, Optional.class, pathString).map(opt -> (Optional<T>) opt);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"Optional",
"<",
"T",
">",
">",
"dotGetOptional",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"dotGet",
"(",
... | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param pathString nodes to walk in map
@return value | [
"Get",
"optional",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L240-L244 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java | SluggishGui.sawOpcode | @Override
public void sawOpcode(int seen) {
if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) {
String clsName = getClassConstantOperand();
String mName = getNameConstantOperand();
String methodInfo = clsName + ':' + mName;
String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ':' + methodSig) : "0";
if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) {
if (isListenerMethod) {
bugReporter.reportBug(new BugInstance(this, BugType.SG_SLUGGISH_GUI.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this.getClassContext().getJavaClass(), listenerCode.get(this.getCode())));
} else {
expensiveThisCalls.add(getMethodName() + ':' + getMethodSig());
}
throw new StopOpcodeParsingException();
}
}
} | java | @Override
public void sawOpcode(int seen) {
if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) {
String clsName = getClassConstantOperand();
String mName = getNameConstantOperand();
String methodInfo = clsName + ':' + mName;
String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ':' + methodSig) : "0";
if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) {
if (isListenerMethod) {
bugReporter.reportBug(new BugInstance(this, BugType.SG_SLUGGISH_GUI.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this.getClassContext().getJavaClass(), listenerCode.get(this.getCode())));
} else {
expensiveThisCalls.add(getMethodName() + ':' + getMethodSig());
}
throw new StopOpcodeParsingException();
}
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"if",
"(",
"(",
"seen",
"==",
"Const",
".",
"INVOKEINTERFACE",
")",
"||",
"(",
"seen",
"==",
"Const",
".",
"INVOKEVIRTUAL",
")",
"||",
"(",
"seen",
"==",
"Const",
".",
"INV... | overrides the visitor to look for the execution of expensive calls
@param seen
the currently parsed opcode | [
"overrides",
"the",
"visitor",
"to",
"look",
"for",
"the",
"execution",
"of",
"expensive",
"calls"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L170-L189 |
line/armeria | examples/grpc-service/src/main/java/example/armeria/grpc/HelloServiceImpl.java | HelloServiceImpl.lazyHello | @Override
public void lazyHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
// You can use the event loop for scheduling a task.
RequestContext.current().contextAwareEventLoop().schedule(() -> {
responseObserver.onNext(buildReply(toMessage(request.getName())));
responseObserver.onCompleted();
}, 3, TimeUnit.SECONDS);
} | java | @Override
public void lazyHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
// You can use the event loop for scheduling a task.
RequestContext.current().contextAwareEventLoop().schedule(() -> {
responseObserver.onNext(buildReply(toMessage(request.getName())));
responseObserver.onCompleted();
}, 3, TimeUnit.SECONDS);
} | [
"@",
"Override",
"public",
"void",
"lazyHello",
"(",
"HelloRequest",
"request",
",",
"StreamObserver",
"<",
"HelloReply",
">",
"responseObserver",
")",
"{",
"// You can use the event loop for scheduling a task.",
"RequestContext",
".",
"current",
"(",
")",
".",
"context... | Sends a {@link HelloReply} 3 seconds after receiving a request. | [
"Sends",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/examples/grpc-service/src/main/java/example/armeria/grpc/HelloServiceImpl.java#L31-L38 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java | HashUtils.getFileSHA256String | public static String getFileSHA256String(File file) throws IOException {
MessageDigest messageDigest = getMessageDigest(SHA256);
return getFileHashString(file, messageDigest);
} | java | public static String getFileSHA256String(File file) throws IOException {
MessageDigest messageDigest = getMessageDigest(SHA256);
return getFileHashString(file, messageDigest);
} | [
"public",
"static",
"String",
"getFileSHA256String",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"MessageDigest",
"messageDigest",
"=",
"getMessageDigest",
"(",
"SHA256",
")",
";",
"return",
"getFileHashString",
"(",
"file",
",",
"messageDigest",
")",
... | Calculate SHA-256 hash of a File
@param file - the File to hash
@return the SHA-256 hash value
@throws IOException | [
"Calculate",
"SHA",
"-",
"256",
"hash",
"of",
"a",
"File"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java#L70-L73 |
MenoData/Time4J | base/src/main/java/net/time4j/range/DateInterval.java | DateInterval.toFullDays | public TimestampInterval toFullDays() {
Boundary<PlainTimestamp> b1;
Boundary<PlainTimestamp> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
PlainDate d1 = this.getStart().getTemporal();
PlainTimestamp t1;
if (this.getStart().isOpen()) {
t1 = d1.at(PlainTime.midnightAtEndOfDay());
} else {
t1 = d1.atStartOfDay();
}
b1 = Boundary.of(IntervalEdge.CLOSED, t1);
}
if (this.getEnd().isInfinite()) {
b2 = Boundary.infiniteFuture();
} else {
PlainDate d2 = this.getEnd().getTemporal();
PlainTimestamp t2;
if (this.getEnd().isOpen()) {
t2 = d2.atStartOfDay();
} else {
t2 = d2.at(PlainTime.midnightAtEndOfDay());
}
b2 = Boundary.of(IntervalEdge.OPEN, t2);
}
return new TimestampInterval(b1, b2);
} | java | public TimestampInterval toFullDays() {
Boundary<PlainTimestamp> b1;
Boundary<PlainTimestamp> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
PlainDate d1 = this.getStart().getTemporal();
PlainTimestamp t1;
if (this.getStart().isOpen()) {
t1 = d1.at(PlainTime.midnightAtEndOfDay());
} else {
t1 = d1.atStartOfDay();
}
b1 = Boundary.of(IntervalEdge.CLOSED, t1);
}
if (this.getEnd().isInfinite()) {
b2 = Boundary.infiniteFuture();
} else {
PlainDate d2 = this.getEnd().getTemporal();
PlainTimestamp t2;
if (this.getEnd().isOpen()) {
t2 = d2.atStartOfDay();
} else {
t2 = d2.at(PlainTime.midnightAtEndOfDay());
}
b2 = Boundary.of(IntervalEdge.OPEN, t2);
}
return new TimestampInterval(b1, b2);
} | [
"public",
"TimestampInterval",
"toFullDays",
"(",
")",
"{",
"Boundary",
"<",
"PlainTimestamp",
">",
"b1",
";",
"Boundary",
"<",
"PlainTimestamp",
">",
"b2",
";",
"if",
"(",
"this",
".",
"getStart",
"(",
")",
".",
"isInfinite",
"(",
")",
")",
"{",
"b1",
... | /*[deutsch]
<p>Wandelt diese Instanz in ein Zeitstempelintervall
mit Datumswerten von Mitternacht zu Mitternacht um. </p>
<p>Das Ergebnisintervall ist halb-offen, wenn dieses Intervall
endlich ist. </p>
@return timestamp interval (from midnight to midnight)
@since 2.0 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Wandelt",
"diese",
"Instanz",
"in",
"ein",
"Zeitstempelintervall",
"mit",
"Datumswerten",
"von",
"Mitternacht",
"zu",
"Mitternacht",
"um",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/DateInterval.java#L535-L568 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.getRequestURL | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | java | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | [
"public",
"static",
"String",
"getRequestURL",
"(",
"HttpServletRequest",
"req",
",",
"boolean",
"includeQueryString",
")",
"{",
"StringBuffer",
"sb",
"=",
"req",
".",
"getRequestURL",
"(",
")",
";",
"int",
"maxpos",
"=",
"sb",
".",
"indexOf",
"(",
"\"/\"",
... | returns the full request URL
@param req - the HttpServletRequest
@param includeQueryString - if true, the QueryString will be appended if one exists | [
"returns",
"the",
"full",
"request",
"URL"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L493-L511 |
demidenko05/beigesoft-bcommon | src/main/java/org/beigesoft/holder/HolderRapiGetters.java | HolderRapiGetters.getFor | @Override
public final Method getFor(final Class<?> pClass, final String pFieldName) {
Map<String, Method> methMap = this.rapiMethodsMap.get(pClass);
if (methMap == null) {
// There is no way to get from Map partially initialized bean
// in this double-checked locking implementation
// cause putting to the Map fully initialized bean
synchronized (this.rapiMethodsMap) {
methMap = this.rapiMethodsMap.get(pClass);
if (methMap == null) {
methMap = new HashMap<String, Method>();
Method[] methods = getUtlReflection().retrieveMethods(pClass);
for (Method method : methods) {
if (method.getName().startsWith("get")) {
String fldNm = method.getName().substring(3, 4).toLowerCase()
+ method.getName().substring(4);
methMap.put(fldNm, method);
}
}
//assigning fully initialized object:
this.rapiMethodsMap.put(pClass, methMap);
}
}
}
return methMap.get(pFieldName);
} | java | @Override
public final Method getFor(final Class<?> pClass, final String pFieldName) {
Map<String, Method> methMap = this.rapiMethodsMap.get(pClass);
if (methMap == null) {
// There is no way to get from Map partially initialized bean
// in this double-checked locking implementation
// cause putting to the Map fully initialized bean
synchronized (this.rapiMethodsMap) {
methMap = this.rapiMethodsMap.get(pClass);
if (methMap == null) {
methMap = new HashMap<String, Method>();
Method[] methods = getUtlReflection().retrieveMethods(pClass);
for (Method method : methods) {
if (method.getName().startsWith("get")) {
String fldNm = method.getName().substring(3, 4).toLowerCase()
+ method.getName().substring(4);
methMap.put(fldNm, method);
}
}
//assigning fully initialized object:
this.rapiMethodsMap.put(pClass, methMap);
}
}
}
return methMap.get(pFieldName);
} | [
"@",
"Override",
"public",
"final",
"Method",
"getFor",
"(",
"final",
"Class",
"<",
"?",
">",
"pClass",
",",
"final",
"String",
"pFieldName",
")",
"{",
"Map",
"<",
"String",
",",
"Method",
">",
"methMap",
"=",
"this",
".",
"rapiMethodsMap",
".",
"get",
... | <p>Get thing for given class and thing name.</p>
@param pClass a Class
@param pFieldName Thing Name
@return a thing | [
"<p",
">",
"Get",
"thing",
"for",
"given",
"class",
"and",
"thing",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-bcommon/blob/bb446822b4fc9b5a6a8cd3cc98d0b3d83d718daf/src/main/java/org/beigesoft/holder/HolderRapiGetters.java#L46-L71 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java | AbstractVectorModel.nearest | public List<Map.Entry<K, Float>> nearest(K key)
{
return nearest(key, 10);
} | java | public List<Map.Entry<K, Float>> nearest(K key)
{
return nearest(key, 10);
} | [
"public",
"List",
"<",
"Map",
".",
"Entry",
"<",
"K",
",",
"Float",
">",
">",
"nearest",
"(",
"K",
"key",
")",
"{",
"return",
"nearest",
"(",
"key",
",",
"10",
")",
";",
"}"
] | 查询与词语最相似的词语
@param key 词语
@return 键值对列表, 键是相似词语, 值是相似度, 按相似度降序排列 | [
"查询与词语最相似的词语"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/mining/word2vec/AbstractVectorModel.java#L160-L163 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.addDays | public static <T extends java.util.Date> T addDays(final T date, final int amount) {
return roll(date, amount, CalendarUnit.DAY);
} | java | public static <T extends java.util.Date> T addDays(final T date, final int amount) {
return roll(date, amount, CalendarUnit.DAY);
} | [
"public",
"static",
"<",
"T",
"extends",
"java",
".",
"util",
".",
"Date",
">",
"T",
"addDays",
"(",
"final",
"T",
"date",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"roll",
"(",
"date",
",",
"amount",
",",
"CalendarUnit",
".",
"DAY",
")",
... | Adds a number of days to a date returning a new object.
The original {@code Date} is unchanged.
@param date the date, not null
@param amount the amount to add, may be negative
@return the new {@code Date} with the amount added
@throws IllegalArgumentException if the date is null | [
"Adds",
"a",
"number",
"of",
"days",
"to",
"a",
"date",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L993-L995 |
Chorus-bdd/Chorus | interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/FilePathScanner.java | FilePathScanner.addFeaturesRecursively | private void addFeaturesRecursively(File directory, List<File> targetList, FileFilter fileFilter) {
File[] files = directory.listFiles();
//sort the files here, since otherwise we get differences in execution order between 'nix, case sensitive
//and win, case insensitive, toys 'r us
Arrays.sort(files, new Comparator<File>() {
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
for (File f : files) {
if (f.isDirectory()) {
addFeaturesRecursively(f, targetList, fileFilter);
} else if (fileFilter.accept(f)) {
targetList.add(f);
}
}
} | java | private void addFeaturesRecursively(File directory, List<File> targetList, FileFilter fileFilter) {
File[] files = directory.listFiles();
//sort the files here, since otherwise we get differences in execution order between 'nix, case sensitive
//and win, case insensitive, toys 'r us
Arrays.sort(files, new Comparator<File>() {
public int compare(File o1, File o2) {
return o1.getName().compareTo(o2.getName());
}
});
for (File f : files) {
if (f.isDirectory()) {
addFeaturesRecursively(f, targetList, fileFilter);
} else if (fileFilter.accept(f)) {
targetList.add(f);
}
}
} | [
"private",
"void",
"addFeaturesRecursively",
"(",
"File",
"directory",
",",
"List",
"<",
"File",
">",
"targetList",
",",
"FileFilter",
"fileFilter",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"//sort the files here,... | Recursively scans subdirectories, adding all feature files to the targetList. | [
"Recursively",
"scans",
"subdirectories",
"adding",
"all",
"feature",
"files",
"to",
"the",
"targetList",
"."
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-pathscanner/src/main/java/org/chorusbdd/chorus/pathscanner/FilePathScanner.java#L69-L87 |
kikinteractive/ice | ice/src/main/java/com/kik/config/ice/internal/ConfigDescriptorFactory.java | ConfigDescriptorFactory.buildDescriptors | public List<ConfigDescriptor> buildDescriptors(Class<?> configClass, Optional<String> scopeOpt)
{
if (!StaticConfigHelper.isValidConfigInterface(configClass)) {
// condition is already logged.
throw new ConfigException("Invalid Configuration class.");
}
List<ConfigDescriptor> descriptors = Lists.newArrayList();
for (Method method : configClass.getMethods()) {
StaticConfigHelper.MethodValidationState validationState = StaticConfigHelper.isValidConfigInterfaceMethod(method);
switch (validationState) {
case OK:
descriptors.add(internalBuildDescriptor(method, scopeOpt, getMethodDefaultValue(method)));
case IS_DEFAULT:
// Skip default interface methods
break;
default:
log.debug("Configuration class {} was found to be invalid: {}",
configClass.getName(), validationState.name());
throw new ConfigException("Invalid Configuration class: {}", validationState.name());
}
}
return descriptors;
} | java | public List<ConfigDescriptor> buildDescriptors(Class<?> configClass, Optional<String> scopeOpt)
{
if (!StaticConfigHelper.isValidConfigInterface(configClass)) {
// condition is already logged.
throw new ConfigException("Invalid Configuration class.");
}
List<ConfigDescriptor> descriptors = Lists.newArrayList();
for (Method method : configClass.getMethods()) {
StaticConfigHelper.MethodValidationState validationState = StaticConfigHelper.isValidConfigInterfaceMethod(method);
switch (validationState) {
case OK:
descriptors.add(internalBuildDescriptor(method, scopeOpt, getMethodDefaultValue(method)));
case IS_DEFAULT:
// Skip default interface methods
break;
default:
log.debug("Configuration class {} was found to be invalid: {}",
configClass.getName(), validationState.name());
throw new ConfigException("Invalid Configuration class: {}", validationState.name());
}
}
return descriptors;
} | [
"public",
"List",
"<",
"ConfigDescriptor",
">",
"buildDescriptors",
"(",
"Class",
"<",
"?",
">",
"configClass",
",",
"Optional",
"<",
"String",
">",
"scopeOpt",
")",
"{",
"if",
"(",
"!",
"StaticConfigHelper",
".",
"isValidConfigInterface",
"(",
"configClass",
... | Build a {@link ConfigDescriptor} given a configuration interface reference.
@param configClass config interface to build descriptors for
@param scopeOpt optional scope name to include in config descriptors.
@return A list of {@link ConfigDescriptor} instances describing the given config interface and scope name. | [
"Build",
"a",
"{",
"@link",
"ConfigDescriptor",
"}",
"given",
"a",
"configuration",
"interface",
"reference",
"."
] | train | https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/ConfigDescriptorFactory.java#L76-L101 |
knightliao/disconf | disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java | StringUtil.longToString | public static String longToString(long longValue, boolean noCase) {
char[] digits = noCase ? DIGITS_NOCASE : DIGITS;
int digitsLength = digits.length;
if (longValue == 0) {
return String.valueOf(digits[0]);
}
if (longValue < 0) {
longValue = -longValue;
}
StringBuilder strValue = new StringBuilder();
while (longValue != 0) {
int digit = (int) (longValue % digitsLength);
longValue = longValue / digitsLength;
strValue.append(digits[digit]);
}
return strValue.toString();
} | java | public static String longToString(long longValue, boolean noCase) {
char[] digits = noCase ? DIGITS_NOCASE : DIGITS;
int digitsLength = digits.length;
if (longValue == 0) {
return String.valueOf(digits[0]);
}
if (longValue < 0) {
longValue = -longValue;
}
StringBuilder strValue = new StringBuilder();
while (longValue != 0) {
int digit = (int) (longValue % digitsLength);
longValue = longValue / digitsLength;
strValue.append(digits[digit]);
}
return strValue.toString();
} | [
"public",
"static",
"String",
"longToString",
"(",
"long",
"longValue",
",",
"boolean",
"noCase",
")",
"{",
"char",
"[",
"]",
"digits",
"=",
"noCase",
"?",
"DIGITS_NOCASE",
":",
"DIGITS",
";",
"int",
"digitsLength",
"=",
"digits",
".",
"length",
";",
"if",... | 将一个长整形转换成62进制的字符串。
@param longValue 64位数字
@param noCase 区分大小写
@return 62进制的字符串 | [
"将一个长整形转换成62进制的字符串。"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L444-L466 |
datacleaner/DataCleaner | engine/core/src/main/java/org/datacleaner/result/save/AnalysisResultSaveHandler.java | AnalysisResultSaveHandler.createSafeAnalysisResult | public AnalysisResult createSafeAnalysisResult() {
final Set<ComponentJob> unsafeKeys = getUnsafeResultElements().keySet();
if (unsafeKeys.isEmpty()) {
return _analysisResult;
}
final Map<ComponentJob, AnalyzerResult> resultMap = new LinkedHashMap<>(_analysisResult.getResultMap());
for (final ComponentJob unsafeKey : unsafeKeys) {
resultMap.remove(unsafeKey);
}
if (resultMap.isEmpty()) {
return null;
}
return new SimpleAnalysisResult(resultMap, _analysisResult.getCreationDate());
} | java | public AnalysisResult createSafeAnalysisResult() {
final Set<ComponentJob> unsafeKeys = getUnsafeResultElements().keySet();
if (unsafeKeys.isEmpty()) {
return _analysisResult;
}
final Map<ComponentJob, AnalyzerResult> resultMap = new LinkedHashMap<>(_analysisResult.getResultMap());
for (final ComponentJob unsafeKey : unsafeKeys) {
resultMap.remove(unsafeKey);
}
if (resultMap.isEmpty()) {
return null;
}
return new SimpleAnalysisResult(resultMap, _analysisResult.getCreationDate());
} | [
"public",
"AnalysisResult",
"createSafeAnalysisResult",
"(",
")",
"{",
"final",
"Set",
"<",
"ComponentJob",
">",
"unsafeKeys",
"=",
"getUnsafeResultElements",
"(",
")",
".",
"keySet",
"(",
")",
";",
"if",
"(",
"unsafeKeys",
".",
"isEmpty",
"(",
")",
")",
"{"... | Creates a safe {@link AnalysisResult} for saving
@return a new {@link AnalysisResult} or null if it is not possible to
create a result that is safer than the previous. | [
"Creates",
"a",
"safe",
"{",
"@link",
"AnalysisResult",
"}",
"for",
"saving"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/result/save/AnalysisResultSaveHandler.java#L119-L135 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java | SessionsInner.getAsync | public Observable<IntegrationAccountSessionInner> getAsync(String resourceGroupName, String integrationAccountName, String sessionName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName).map(new Func1<ServiceResponse<IntegrationAccountSessionInner>, IntegrationAccountSessionInner>() {
@Override
public IntegrationAccountSessionInner call(ServiceResponse<IntegrationAccountSessionInner> response) {
return response.body();
}
});
} | java | public Observable<IntegrationAccountSessionInner> getAsync(String resourceGroupName, String integrationAccountName, String sessionName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName).map(new Func1<ServiceResponse<IntegrationAccountSessionInner>, IntegrationAccountSessionInner>() {
@Override
public IntegrationAccountSessionInner call(ServiceResponse<IntegrationAccountSessionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IntegrationAccountSessionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"sessionName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"in... | Gets an integration account session.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param sessionName The integration account session name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountSessionInner object | [
"Gets",
"an",
"integration",
"account",
"session",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java#L375-L382 |
fabric8io/fabric8-forge | addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelVersionHelper.java | CamelVersionHelper.isGE | public static boolean isGE(String base, String other) {
ComparableVersion v1 = new ComparableVersion(base);
ComparableVersion v2 = new ComparableVersion(other);
return v2.compareTo(v1) >= 0;
} | java | public static boolean isGE(String base, String other) {
ComparableVersion v1 = new ComparableVersion(base);
ComparableVersion v2 = new ComparableVersion(other);
return v2.compareTo(v1) >= 0;
} | [
"public",
"static",
"boolean",
"isGE",
"(",
"String",
"base",
",",
"String",
"other",
")",
"{",
"ComparableVersion",
"v1",
"=",
"new",
"ComparableVersion",
"(",
"base",
")",
";",
"ComparableVersion",
"v2",
"=",
"new",
"ComparableVersion",
"(",
"other",
")",
... | Checks whether other >= base
@param base the base version
@param other the other version
@return <tt>true</tt> if GE, <tt>false</tt> otherwise | [
"Checks",
"whether",
"other",
">",
"=",
"base"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelVersionHelper.java#L44-L48 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRect_S16.java | ImplDisparityScoreSadRect_S16.computeFirstRow | private void computeFirstRow(GrayS16 left, GrayS16 right ) {
// compute horizontal scores for first row block
for( int row = 0; row < regionHeight; row++ ) {
int scores[] = horizontalScore[row];
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore);
}
// compute score for the top possible row
for( int i = 0; i < lengthHorizontal; i++ ) {
int sum = 0;
for( int row = 0; row < regionHeight; row++ ) {
sum += horizontalScore[row][i];
}
verticalScore[i] = sum;
}
// compute disparity
computeDisparity.process(radiusY, verticalScore);
} | java | private void computeFirstRow(GrayS16 left, GrayS16 right ) {
// compute horizontal scores for first row block
for( int row = 0; row < regionHeight; row++ ) {
int scores[] = horizontalScore[row];
UtilDisparityScore.computeScoreRow(left, right, row, scores,
minDisparity,maxDisparity,regionWidth,elementScore);
}
// compute score for the top possible row
for( int i = 0; i < lengthHorizontal; i++ ) {
int sum = 0;
for( int row = 0; row < regionHeight; row++ ) {
sum += horizontalScore[row][i];
}
verticalScore[i] = sum;
}
// compute disparity
computeDisparity.process(radiusY, verticalScore);
} | [
"private",
"void",
"computeFirstRow",
"(",
"GrayS16",
"left",
",",
"GrayS16",
"right",
")",
"{",
"// compute horizontal scores for first row block",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"regionHeight",
";",
"row",
"++",
")",
"{",
"int",
"scores... | Initializes disparity calculation by finding the scores for the initial block of horizontal
rows. | [
"Initializes",
"disparity",
"calculation",
"by",
"finding",
"the",
"scores",
"for",
"the",
"initial",
"block",
"of",
"horizontal",
"rows",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/ImplDisparityScoreSadRect_S16.java#L83-L104 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/vbs/VBSProcessOutputValidator.java | VBSProcessOutputValidator.validateProcessOutput | @Override
public void validateProcessOutput(FaxClientSpi faxClientSpi,ProcessOutput processOutput,FaxActionType faxActionType)
{
//call exit code validation
super.validateProcessOutput(faxClientSpi,processOutput,faxActionType);
//get output
String output=processOutput.getOutputText();
String errorPut=processOutput.getErrorText();
boolean throwError=false;
if((output!=null)&&(output.length()>0))
{
if(output.indexOf(VBSProcessOutputValidator.OPERATION_OUTPUT_DONE)==-1)
{
throwError=true;
}
}
else
{
throwError=true;
}
if(throwError)
{
String message=this.getVBSFailedLineErrorMessage(errorPut);
if((errorPut!=null)&&(errorPut.indexOf(VBSProcessOutputValidator.ACTIVE_X_NOT_INSTALLED)!=-1))
{
throw new FaxException("Error while invoking VBS script (fax server ActiveX not installed on system),"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
}
throw new FaxException("Error while invoking VBS script,"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
}
} | java | @Override
public void validateProcessOutput(FaxClientSpi faxClientSpi,ProcessOutput processOutput,FaxActionType faxActionType)
{
//call exit code validation
super.validateProcessOutput(faxClientSpi,processOutput,faxActionType);
//get output
String output=processOutput.getOutputText();
String errorPut=processOutput.getErrorText();
boolean throwError=false;
if((output!=null)&&(output.length()>0))
{
if(output.indexOf(VBSProcessOutputValidator.OPERATION_OUTPUT_DONE)==-1)
{
throwError=true;
}
}
else
{
throwError=true;
}
if(throwError)
{
String message=this.getVBSFailedLineErrorMessage(errorPut);
if((errorPut!=null)&&(errorPut.indexOf(VBSProcessOutputValidator.ACTIVE_X_NOT_INSTALLED)!=-1))
{
throw new FaxException("Error while invoking VBS script (fax server ActiveX not installed on system),"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
}
throw new FaxException("Error while invoking VBS script,"+message+" script output:\n"+output+"\nScript error:\n"+errorPut);
}
} | [
"@",
"Override",
"public",
"void",
"validateProcessOutput",
"(",
"FaxClientSpi",
"faxClientSpi",
",",
"ProcessOutput",
"processOutput",
",",
"FaxActionType",
"faxActionType",
")",
"{",
"//call exit code validation",
"super",
".",
"validateProcessOutput",
"(",
"faxClientSpi"... | This function validates the process output for errors.<br>
If not valid, an exception should be thrown.
@param faxClientSpi
The fax client SPI
@param processOutput
The process output to validate
@param faxActionType
The fax action type | [
"This",
"function",
"validates",
"the",
"process",
"output",
"for",
"errors",
".",
"<br",
">",
"If",
"not",
"valid",
"an",
"exception",
"should",
"be",
"thrown",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/vbs/VBSProcessOutputValidator.java#L87-L120 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optByteArray | @Nullable
public static byte[] optByteArray(@Nullable Bundle bundle, @Nullable String key) {
return optByteArray(bundle, key, new byte[0]);
} | java | @Nullable
public static byte[] optByteArray(@Nullable Bundle bundle, @Nullable String key) {
return optByteArray(bundle, key, new byte[0]);
} | [
"@",
"Nullable",
"public",
"static",
"byte",
"[",
"]",
"optByteArray",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optByteArray",
"(",
"bundle",
",",
"key",
",",
"new",
"byte",
"[",
"0",
"]",
")... | Returns a optional byte array value. In other words, returns the value mapped by key if it exists and is a byte array.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return a fallback value.
@param key a key for the value.
@return a byte array value if exists, null otherwise.
@see android.os.Bundle#getByteArray(String) | [
"Returns",
"a",
"optional",
"byte",
"array",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"byte",
"array",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
... | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L241-L244 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/conversion/impl/STRINGValueConverter.java | STRINGValueConverter.convertFromString | protected String convertFromString(String literal, INode node) throws ValueConverterWithValueException {
Implementation converter = createConverter();
String result = converter.convertFromJavaString(literal);
if (converter.errorMessage != null) {
throw new ValueConverterWithValueException(converter.errorMessage, node, result.toString(), converter.errorIndex,
converter.errorLength, null);
}
return result;
} | java | protected String convertFromString(String literal, INode node) throws ValueConverterWithValueException {
Implementation converter = createConverter();
String result = converter.convertFromJavaString(literal);
if (converter.errorMessage != null) {
throw new ValueConverterWithValueException(converter.errorMessage, node, result.toString(), converter.errorIndex,
converter.errorLength, null);
}
return result;
} | [
"protected",
"String",
"convertFromString",
"(",
"String",
"literal",
",",
"INode",
"node",
")",
"throws",
"ValueConverterWithValueException",
"{",
"Implementation",
"converter",
"=",
"createConverter",
"(",
")",
";",
"String",
"result",
"=",
"converter",
".",
"conv... | Converts a string literal (including leading and trailing single or double quote) to a semantic
string value. Recovers from invalid escape sequences and announces the first problem with a
{@link ValueConverterWithValueException}.
@since 2.7
@throws ValueConverterWithValueException if the given string is syntactically invalid.
@see Strings#convertFromJavaString(String, boolean) | [
"Converts",
"a",
"string",
"literal",
"(",
"including",
"leading",
"and",
"trailing",
"single",
"or",
"double",
"quote",
")",
"to",
"a",
"semantic",
"string",
"value",
".",
"Recovers",
"from",
"invalid",
"escape",
"sequences",
"and",
"announces",
"the",
"first... | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/conversion/impl/STRINGValueConverter.java#L49-L57 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/syncer/Syncer.java | Syncer.doSync | private <T, S extends ISyncableData> void doSync(T caller, String... syncNames)
{
@SuppressWarnings("unchecked")
ISyncHandler<T, S> handler = (ISyncHandler<T, S>) getHandler(caller);
if (handler == null)
return;
S data = handler.getSyncData(caller);
int indexes = getFieldIndexes(handler, syncNames);
Map<String, Object> values = getFieldValues(caller, handler, syncNames);
SyncerMessage.Packet<T, S> packet = new Packet<>(getHandlerId(caller.getClass()), data, indexes, values);
handler.send(caller, packet);
} | java | private <T, S extends ISyncableData> void doSync(T caller, String... syncNames)
{
@SuppressWarnings("unchecked")
ISyncHandler<T, S> handler = (ISyncHandler<T, S>) getHandler(caller);
if (handler == null)
return;
S data = handler.getSyncData(caller);
int indexes = getFieldIndexes(handler, syncNames);
Map<String, Object> values = getFieldValues(caller, handler, syncNames);
SyncerMessage.Packet<T, S> packet = new Packet<>(getHandlerId(caller.getClass()), data, indexes, values);
handler.send(caller, packet);
} | [
"private",
"<",
"T",
",",
"S",
"extends",
"ISyncableData",
">",
"void",
"doSync",
"(",
"T",
"caller",
",",
"String",
"...",
"syncNames",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"ISyncHandler",
"<",
"T",
",",
"S",
">",
"handler",
"="... | Synchronizes the specified fields names and sends the corresponding packet.
@param <T> the type of the caller
@param caller the caller
@param syncNames the sync names | [
"Synchronizes",
"the",
"specified",
"fields",
"names",
"and",
"sends",
"the",
"corresponding",
"packet",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/syncer/Syncer.java#L293-L307 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java | SSLConfigManager.addSSLConfigToMap | public synchronized void addSSLConfigToMap(String alias, SSLConfig sslConfig) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "addSSLConfigToMap: alias=" + alias);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, sslConfig.toString());
}
if (sslConfigMap.containsKey(alias)) {
sslConfigMap.remove(alias);
outboundSSL.removeDynamicSelectionsWithSSLConfig(alias);
}
if (validationEnabled())
sslConfig.validateSSLConfig();
sslConfigMap.put(alias, sslConfig);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "addSSLConfigToMap");
} | java | public synchronized void addSSLConfigToMap(String alias, SSLConfig sslConfig) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "addSSLConfigToMap: alias=" + alias);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, sslConfig.toString());
}
if (sslConfigMap.containsKey(alias)) {
sslConfigMap.remove(alias);
outboundSSL.removeDynamicSelectionsWithSSLConfig(alias);
}
if (validationEnabled())
sslConfig.validateSSLConfig();
sslConfigMap.put(alias, sslConfig);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "addSSLConfigToMap");
} | [
"public",
"synchronized",
"void",
"addSSLConfigToMap",
"(",
"String",
"alias",
",",
"SSLConfig",
"sslConfig",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
... | *
This method adds an SSL config from the SSLConfigManager map and list.
@param alias
@param sslConfig
@throws Exception
* | [
"*",
"This",
"method",
"adds",
"an",
"SSL",
"config",
"from",
"the",
"SSLConfigManager",
"map",
"and",
"list",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1341-L1362 |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/swapper/HdfsFailedFetchLock.java | HdfsFailedFetchLock.handleIOException | private void handleIOException(IOException e, String action, int attempt)
throws VoldemortException, InterruptedException {
if ( // any of the following happens, we need to bubble up
// FileSystem instance got closed, somehow
e.getMessage().contains("Filesystem closed") ||
// HDFS permission issues
ExceptionUtils.recursiveClassEquals(e, AccessControlException.class)) {
throw new VoldemortException("Got an IOException we cannot recover from while trying to " +
action + ". Attempt # " + attempt + "/" + maxAttempts + ". Will not try again.", e);
} else {
logFailureAndWait(action, IO_EXCEPTION, attempt, e);
}
} | java | private void handleIOException(IOException e, String action, int attempt)
throws VoldemortException, InterruptedException {
if ( // any of the following happens, we need to bubble up
// FileSystem instance got closed, somehow
e.getMessage().contains("Filesystem closed") ||
// HDFS permission issues
ExceptionUtils.recursiveClassEquals(e, AccessControlException.class)) {
throw new VoldemortException("Got an IOException we cannot recover from while trying to " +
action + ". Attempt # " + attempt + "/" + maxAttempts + ". Will not try again.", e);
} else {
logFailureAndWait(action, IO_EXCEPTION, attempt, e);
}
} | [
"private",
"void",
"handleIOException",
"(",
"IOException",
"e",
",",
"String",
"action",
",",
"int",
"attempt",
")",
"throws",
"VoldemortException",
",",
"InterruptedException",
"{",
"if",
"(",
"// any of the following happens, we need to bubble up",
"// FileSystem instanc... | This function is intended to detect the subset of IOException which are not
considered recoverable, in which case we want to bubble up the exception, instead
of retrying.
@throws VoldemortException | [
"This",
"function",
"is",
"intended",
"to",
"detect",
"the",
"subset",
"of",
"IOException",
"which",
"are",
"not",
"considered",
"recoverable",
"in",
"which",
"case",
"we",
"want",
"to",
"bubble",
"up",
"the",
"exception",
"instead",
"of",
"retrying",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/swapper/HdfsFailedFetchLock.java#L186-L198 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getWindowMaxLoadTime | public long getWindowMaxLoadTime(final String intervalName, final TimeUnit unit) {
final long max = windowMaxLoadTime.getValueAsLong(intervalName);
return max == Constants.MAX_TIME_DEFAULT ? max : unit.transformMillis(max);
} | java | public long getWindowMaxLoadTime(final String intervalName, final TimeUnit unit) {
final long max = windowMaxLoadTime.getValueAsLong(intervalName);
return max == Constants.MAX_TIME_DEFAULT ? max : unit.transformMillis(max);
} | [
"public",
"long",
"getWindowMaxLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"final",
"long",
"max",
"=",
"windowMaxLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
";",
"return",
"max",
"==",
"Constant... | Returns web page maximum load time for given interval and {@link TimeUnit}.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return web page maximum load time | [
"Returns",
"web",
"page",
"maximum",
"load",
"time",
"for",
"given",
"interval",
"and",
"{",
"@link",
"TimeUnit",
"}",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L187-L190 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.insert | @SuppressWarnings("unchecked")
public static <T> Object insert(Object array, int index, T... newElements) {
if (isEmpty(newElements)) {
return array;
}
if(isEmpty(array)) {
return newElements;
}
final int len = length(array);
if (index < 0) {
index = (index % len) + len;
}
final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length);
System.arraycopy(array, 0, result, 0, Math.min(len, index));
System.arraycopy(newElements, 0, result, index, newElements.length);
if (index < len) {
System.arraycopy(array, index, result, index + newElements.length, len - index);
}
return result;
} | java | @SuppressWarnings("unchecked")
public static <T> Object insert(Object array, int index, T... newElements) {
if (isEmpty(newElements)) {
return array;
}
if(isEmpty(array)) {
return newElements;
}
final int len = length(array);
if (index < 0) {
index = (index % len) + len;
}
final T[] result = newArray(array.getClass().getComponentType(), Math.max(len, index) + newElements.length);
System.arraycopy(array, 0, result, 0, Math.min(len, index));
System.arraycopy(newElements, 0, result, index, newElements.length);
if (index < len) {
System.arraycopy(array, index, result, index + newElements.length, len - index);
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Object",
"insert",
"(",
"Object",
"array",
",",
"int",
"index",
",",
"T",
"...",
"newElements",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"newElements",
")",
")",
"{",
"... | 将新元素插入到到已有数组中的某个位置<br>
添加新元素会生成一个新的数组,不影响原数组<br>
如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充
@param <T> 数组元素类型
@param array 已有数组
@param index 插入位置,此位置为对应此位置元素之前的空档
@param newElements 新元素
@return 新数组
@since 4.0.8 | [
"将新元素插入到到已有数组中的某个位置<br",
">",
"添加新元素会生成一个新的数组,不影响原数组<br",
">",
"如果插入位置为为负数,从原数组从后向前计数,若大于原数组长度,则空白处用null填充"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L473-L494 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.enforceRegularStorageINode | public static void enforceRegularStorageINode(INodeFile inode, String msg)
throws IOException {
if (inode.getStorageType() != StorageType.REGULAR_STORAGE) {
LOG.error(msg);
throw new IOException(msg);
}
} | java | public static void enforceRegularStorageINode(INodeFile inode, String msg)
throws IOException {
if (inode.getStorageType() != StorageType.REGULAR_STORAGE) {
LOG.error(msg);
throw new IOException(msg);
}
} | [
"public",
"static",
"void",
"enforceRegularStorageINode",
"(",
"INodeFile",
"inode",
",",
"String",
"msg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inode",
".",
"getStorageType",
"(",
")",
"!=",
"StorageType",
".",
"REGULAR_STORAGE",
")",
"{",
"LOG",
"."... | Verify if file is regular storage, otherwise throw an exception | [
"Verify",
"if",
"file",
"is",
"regular",
"storage",
"otherwise",
"throw",
"an",
"exception"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L251-L257 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/StringFieldBuilder.java | StringFieldBuilder.addSubField | private T addSubField(String fieldName, SortedMap<String, String> fieldDefinition) {
subFields.put(fieldName, fieldDefinition);
return castThis();
} | java | private T addSubField(String fieldName, SortedMap<String, String> fieldDefinition) {
subFields.put(fieldName, fieldDefinition);
return castThis();
} | [
"private",
"T",
"addSubField",
"(",
"String",
"fieldName",
",",
"SortedMap",
"<",
"String",
",",
"String",
">",
"fieldDefinition",
")",
"{",
"subFields",
".",
"put",
"(",
"fieldName",
",",
"fieldDefinition",
")",
";",
"return",
"castThis",
"(",
")",
";",
"... | Add a sub-field. A {@code SortedMap} is required for consistency of the index settings hash. | [
"Add",
"a",
"sub",
"-",
"field",
".",
"A",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/StringFieldBuilder.java#L60-L63 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.