repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/Interval.java | Interval.oneToBy | public static Interval oneToBy(int count, int step) {
"""
Returns an Interval starting from 1 to the specified count value with a step value of step.
"""
if (count < 1)
{
throw new IllegalArgumentException("Only positive ranges allowed using oneToBy");
}
return Interval.fromToBy(1, count, step);
} | java | public static Interval oneToBy(int count, int step)
{
if (count < 1)
{
throw new IllegalArgumentException("Only positive ranges allowed using oneToBy");
}
return Interval.fromToBy(1, count, step);
} | [
"public",
"static",
"Interval",
"oneToBy",
"(",
"int",
"count",
",",
"int",
"step",
")",
"{",
"if",
"(",
"count",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Only positive ranges allowed using oneToBy\"",
")",
";",
"}",
"return",
"I... | Returns an Interval starting from 1 to the specified count value with a step value of step. | [
"Returns",
"an",
"Interval",
"starting",
"from",
"1",
"to",
"the",
"specified",
"count",
"value",
"with",
"a",
"step",
"value",
"of",
"step",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L148-L155 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDate.java | LocalDate.withField | public LocalDate withField(DateTimeFieldType fieldType, int value) {
"""
Returns a copy of this date with the specified field set to a new value.
<p>
For example, if the field type is <code>monthOfYear</code> then the
month of year field will be changed in the returned instance.
If the field type is null, then <code>this</code> is returned.
<p>
These two lines are equivalent:
<pre>
LocalDate updated = dt.withDayOfMonth(6);
LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
</pre>
@param fieldType the field type to set, not null
@param value the value to set
@return a copy of this date with the field set
@throws IllegalArgumentException if the field is null or unsupported
"""
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | java | public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | [
"public",
"LocalDate",
"withField",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"value",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field must not be null\"",
")",
";",
"}",
"if",
"(",
"... | Returns a copy of this date with the specified field set to a new value.
<p>
For example, if the field type is <code>monthOfYear</code> then the
month of year field will be changed in the returned instance.
If the field type is null, then <code>this</code> is returned.
<p>
These two lines are equivalent:
<pre>
LocalDate updated = dt.withDayOfMonth(6);
LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
</pre>
@param fieldType the field type to set, not null
@param value the value to set
@return a copy of this date with the field set
@throws IllegalArgumentException if the field is null or unsupported | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"the",
"specified",
"field",
"set",
"to",
"a",
"new",
"value",
".",
"<p",
">",
"For",
"example",
"if",
"the",
"field",
"type",
"is",
"<code",
">",
"monthOfYear<",
"/",
"code",
">",
"then",
"the",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L1097-L1106 |
prestodb/presto | presto-orc/src/main/java/com/facebook/presto/orc/OrcDataSourceUtils.java | OrcDataSourceUtils.mergeAdjacentDiskRanges | public static List<DiskRange> mergeAdjacentDiskRanges(Collection<DiskRange> diskRanges, DataSize maxMergeDistance, DataSize maxReadSize) {
"""
Merge disk ranges that are closer than {@code maxMergeDistance}.
"""
// sort ranges by start offset
List<DiskRange> ranges = new ArrayList<>(diskRanges);
Collections.sort(ranges, new Comparator<DiskRange>()
{
@Override
public int compare(DiskRange o1, DiskRange o2)
{
return Long.compare(o1.getOffset(), o2.getOffset());
}
});
// merge overlapping ranges
long maxReadSizeBytes = maxReadSize.toBytes();
long maxMergeDistanceBytes = maxMergeDistance.toBytes();
ImmutableList.Builder<DiskRange> result = ImmutableList.builder();
DiskRange last = ranges.get(0);
for (int i = 1; i < ranges.size(); i++) {
DiskRange current = ranges.get(i);
DiskRange merged = last.span(current);
if (merged.getLength() <= maxReadSizeBytes && last.getEnd() + maxMergeDistanceBytes >= current.getOffset()) {
last = merged;
}
else {
result.add(last);
last = current;
}
}
result.add(last);
return result.build();
} | java | public static List<DiskRange> mergeAdjacentDiskRanges(Collection<DiskRange> diskRanges, DataSize maxMergeDistance, DataSize maxReadSize)
{
// sort ranges by start offset
List<DiskRange> ranges = new ArrayList<>(diskRanges);
Collections.sort(ranges, new Comparator<DiskRange>()
{
@Override
public int compare(DiskRange o1, DiskRange o2)
{
return Long.compare(o1.getOffset(), o2.getOffset());
}
});
// merge overlapping ranges
long maxReadSizeBytes = maxReadSize.toBytes();
long maxMergeDistanceBytes = maxMergeDistance.toBytes();
ImmutableList.Builder<DiskRange> result = ImmutableList.builder();
DiskRange last = ranges.get(0);
for (int i = 1; i < ranges.size(); i++) {
DiskRange current = ranges.get(i);
DiskRange merged = last.span(current);
if (merged.getLength() <= maxReadSizeBytes && last.getEnd() + maxMergeDistanceBytes >= current.getOffset()) {
last = merged;
}
else {
result.add(last);
last = current;
}
}
result.add(last);
return result.build();
} | [
"public",
"static",
"List",
"<",
"DiskRange",
">",
"mergeAdjacentDiskRanges",
"(",
"Collection",
"<",
"DiskRange",
">",
"diskRanges",
",",
"DataSize",
"maxMergeDistance",
",",
"DataSize",
"maxReadSize",
")",
"{",
"// sort ranges by start offset",
"List",
"<",
"DiskRan... | Merge disk ranges that are closer than {@code maxMergeDistance}. | [
"Merge",
"disk",
"ranges",
"that",
"are",
"closer",
"than",
"{"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/OrcDataSourceUtils.java#L40-L72 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.parseBigDecimal | @Nullable
public static BigDecimal parseBigDecimal (@Nullable final String sStr, @Nullable final BigDecimal aDefault) {
"""
Parse the given {@link String} as {@link BigDecimal}.
@param sStr
The String to parse. May be <code>null</code>.
@param aDefault
The default value to be returned if the passed string could not be
converted to a valid value. May be <code>null</code>.
@return <code>aDefault</code> if the string does not represent a valid
value.
"""
if (sStr != null && sStr.length () > 0)
try
{
return new BigDecimal (_getUnifiedDecimal (sStr));
}
catch (final NumberFormatException ex)
{
// Fall through
}
return aDefault;
} | java | @Nullable
public static BigDecimal parseBigDecimal (@Nullable final String sStr, @Nullable final BigDecimal aDefault)
{
if (sStr != null && sStr.length () > 0)
try
{
return new BigDecimal (_getUnifiedDecimal (sStr));
}
catch (final NumberFormatException ex)
{
// Fall through
}
return aDefault;
} | [
"@",
"Nullable",
"public",
"static",
"BigDecimal",
"parseBigDecimal",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"aDefault",
")",
"{",
"if",
"(",
"sStr",
"!=",
"null",
"&&",
"sStr",
".",
"length",
"(",
")"... | Parse the given {@link String} as {@link BigDecimal}.
@param sStr
The String to parse. May be <code>null</code>.
@param aDefault
The default value to be returned if the passed string could not be
converted to a valid value. May be <code>null</code>.
@return <code>aDefault</code> if the string does not represent a valid
value. | [
"Parse",
"the",
"given",
"{",
"@link",
"String",
"}",
"as",
"{",
"@link",
"BigDecimal",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1481-L1494 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/ArrayUtils.java | ArrayUtils.indexOf | @NullSafe
public static <T> int indexOf(T[] array, T element) {
"""
Null-safe method to find the index of the given {@code element} in the given {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array used to search for {@code element}.
@param element {@link Object} element to search for in the given {@code array}.
@return the index of the given {@code element} in the given {@code array} or return {@literal -1}
if {@code element} could not be found.
"""
for (int index = 0, length = nullSafeLength(array); index < length; index++) {
if (equalsIgnoreNull(array[index], element)) {
return index;
}
}
return -1;
} | java | @NullSafe
public static <T> int indexOf(T[] array, T element) {
for (int index = 0, length = nullSafeLength(array); index < length; index++) {
if (equalsIgnoreNull(array[index], element)) {
return index;
}
}
return -1;
} | [
"@",
"NullSafe",
"public",
"static",
"<",
"T",
">",
"int",
"indexOf",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"length",
"=",
"nullSafeLength",
"(",
"array",
")",
";",
"index",
"<",
"l... | Null-safe method to find the index of the given {@code element} in the given {@code array}.
@param <T> {@link Class} type of elements in the array.
@param array array used to search for {@code element}.
@param element {@link Object} element to search for in the given {@code array}.
@return the index of the given {@code element} in the given {@code array} or return {@literal -1}
if {@code element} could not be found. | [
"Null",
"-",
"safe",
"method",
"to",
"find",
"the",
"index",
"of",
"the",
"given",
"{",
"@code",
"element",
"}",
"in",
"the",
"given",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L510-L520 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.addRevisionToRevHistory | private void addRevisionToRevHistory(final Node revHistory, final Node revision) {
"""
Adds a revision element to the list of revisions in a revhistory element. This method ensures that the new revision is at
the top of the revhistory list.
@param revHistory The revhistory element to add the revision to.
@param revision The revision element to be added into the revisionhistory element.
"""
if (revHistory.hasChildNodes()) {
revHistory.insertBefore(revision, revHistory.getFirstChild());
} else {
revHistory.appendChild(revision);
}
} | java | private void addRevisionToRevHistory(final Node revHistory, final Node revision) {
if (revHistory.hasChildNodes()) {
revHistory.insertBefore(revision, revHistory.getFirstChild());
} else {
revHistory.appendChild(revision);
}
} | [
"private",
"void",
"addRevisionToRevHistory",
"(",
"final",
"Node",
"revHistory",
",",
"final",
"Node",
"revision",
")",
"{",
"if",
"(",
"revHistory",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"revHistory",
".",
"insertBefore",
"(",
"revision",
",",
"revHistor... | Adds a revision element to the list of revisions in a revhistory element. This method ensures that the new revision is at
the top of the revhistory list.
@param revHistory The revhistory element to add the revision to.
@param revision The revision element to be added into the revisionhistory element. | [
"Adds",
"a",
"revision",
"element",
"to",
"the",
"list",
"of",
"revisions",
"in",
"a",
"revhistory",
"element",
".",
"This",
"method",
"ensures",
"that",
"the",
"new",
"revision",
"is",
"at",
"the",
"top",
"of",
"the",
"revhistory",
"list",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L3148-L3154 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listFromJobScheduleNext | public PagedList<CloudJob> listFromJobScheduleNext(final String nextPageLink) {
"""
Lists the jobs that have been created under the specified job schedule.
@param nextPageLink The NextLink from the previous successful call to List operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<CloudJob> object if successful.
"""
ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<CloudJob>(response.body()) {
@Override
public Page<CloudJob> nextPage(String nextPageLink) {
return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | java | public PagedList<CloudJob> listFromJobScheduleNext(final String nextPageLink) {
ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<CloudJob>(response.body()) {
@Override
public Page<CloudJob> nextPage(String nextPageLink) {
return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"CloudJob",
">",
"listFromJobScheduleNext",
"(",
"final",
"String",
"nextPageLink",
")",
"{",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudJob",
">",
",",
"JobListFromJobScheduleHeaders",
">",
"response",
"=",
"listFromJobScheduleNex... | Lists the jobs that have been created under the specified job schedule.
@param nextPageLink The NextLink from the previous successful call to List operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<CloudJob> object if successful. | [
"Lists",
"the",
"jobs",
"that",
"have",
"been",
"created",
"under",
"the",
"specified",
"job",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3559-L3567 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/message/process/MessageProcessRunnerTask.java | MessageProcessRunnerTask.runProcess | public void runProcess(BaseProcess job, Map<String,Object> properties) {
"""
Run this process.
@param job The process to run.
@param properties The properties to pass to this process.
"""
if (properties == null)
properties = new HashMap<String,Object>();
Map<String,Object> propMessage = m_message.getMessageHeader().getProperties();
if (propMessage != null)
properties.putAll(propMessage);
properties.put(DBParams.MESSAGE, m_message);
job.init(this, null, properties);
job.run();
job.free();
} | java | public void runProcess(BaseProcess job, Map<String,Object> properties)
{
if (properties == null)
properties = new HashMap<String,Object>();
Map<String,Object> propMessage = m_message.getMessageHeader().getProperties();
if (propMessage != null)
properties.putAll(propMessage);
properties.put(DBParams.MESSAGE, m_message);
job.init(this, null, properties);
job.run();
job.free();
} | [
"public",
"void",
"runProcess",
"(",
"BaseProcess",
"job",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
"... | Run this process.
@param job The process to run.
@param properties The properties to pass to this process. | [
"Run",
"this",
"process",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/process/MessageProcessRunnerTask.java#L84-L97 |
jglobus/JGlobus | gridftp/src/main/java/org/globus/ftp/GridFTPClient.java | GridFTPClient.mlsr | public void mlsr(String path, MlsxEntryWriter writer)
throws ServerException, ClientException, IOException {
"""
Performs a recursive directory listing starting at the given path
(or, if path is null, at the current directory of the FTP server).
MlsxEntry instances for all of the files in the subtree will be
written through the passed MlsxEntryWriter.
@param path path to begin recursive directory listing
@param writer sink for created MlsxEntry instances
@throws ServerException
@throws ClientException
@throws IOException
"""
if (gSession.parallel > 1) {
throw new ClientException(
ClientException.BAD_MODE,
"mlsr cannot be called with parallelism");
}
Command cmd = (path == null) ?
new Command("MLSR") :
new Command("MLSR", path);
MlsxParserDataSink sink = new MlsxParserDataSink(writer);
performTransfer(cmd, sink);
} | java | public void mlsr(String path, MlsxEntryWriter writer)
throws ServerException, ClientException, IOException {
if (gSession.parallel > 1) {
throw new ClientException(
ClientException.BAD_MODE,
"mlsr cannot be called with parallelism");
}
Command cmd = (path == null) ?
new Command("MLSR") :
new Command("MLSR", path);
MlsxParserDataSink sink = new MlsxParserDataSink(writer);
performTransfer(cmd, sink);
} | [
"public",
"void",
"mlsr",
"(",
"String",
"path",
",",
"MlsxEntryWriter",
"writer",
")",
"throws",
"ServerException",
",",
"ClientException",
",",
"IOException",
"{",
"if",
"(",
"gSession",
".",
"parallel",
">",
"1",
")",
"{",
"throw",
"new",
"ClientException",... | Performs a recursive directory listing starting at the given path
(or, if path is null, at the current directory of the FTP server).
MlsxEntry instances for all of the files in the subtree will be
written through the passed MlsxEntryWriter.
@param path path to begin recursive directory listing
@param writer sink for created MlsxEntry instances
@throws ServerException
@throws ClientException
@throws IOException | [
"Performs",
"a",
"recursive",
"directory",
"listing",
"starting",
"at",
"the",
"given",
"path",
"(",
"or",
"if",
"path",
"is",
"null",
"at",
"the",
"current",
"directory",
"of",
"the",
"FTP",
"server",
")",
".",
"MlsxEntry",
"instances",
"for",
"all",
"of"... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/GridFTPClient.java#L1026-L1040 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/distort/impl/DistortSupport.java | DistortSupport.transformRotate | public static PixelTransformAffine_F32 transformRotate( float x0 , float y0 , float x1 , float y1 , float angle ) {
"""
Creates a {@link boofcv.alg.distort.PixelTransformAffine_F32} from the dst image into the src image.
@param x0 Center of rotation in input image coordinates.
@param y0 Center of rotation in input image coordinates.
@param x1 Center of rotation in output image coordinates.
@param y1 Center of rotation in output image coordinates.
@param angle Angle of rotation.
"""
// make the coordinate system's origin the image center
Se2_F32 imageToCenter = new Se2_F32(-x0,-y0,0);
Se2_F32 rotate = new Se2_F32(0,0,angle);
Se2_F32 centerToImage = new Se2_F32(x1,y1,0);
InvertibleTransformSequence sequence = new InvertibleTransformSequence();
sequence.addTransform(true,imageToCenter);
sequence.addTransform(true,rotate);
sequence.addTransform(true,centerToImage);
Se2_F32 total = new Se2_F32();
sequence.computeTransform(total);
Se2_F32 inv = total.invert(null);
Affine2D_F32 affine = ConvertTransform_F32.convert(inv,(Affine2D_F32)null);
PixelTransformAffine_F32 distort = new PixelTransformAffine_F32();
distort.set(affine);
return distort;
} | java | public static PixelTransformAffine_F32 transformRotate( float x0 , float y0 , float x1 , float y1 , float angle )
{
// make the coordinate system's origin the image center
Se2_F32 imageToCenter = new Se2_F32(-x0,-y0,0);
Se2_F32 rotate = new Se2_F32(0,0,angle);
Se2_F32 centerToImage = new Se2_F32(x1,y1,0);
InvertibleTransformSequence sequence = new InvertibleTransformSequence();
sequence.addTransform(true,imageToCenter);
sequence.addTransform(true,rotate);
sequence.addTransform(true,centerToImage);
Se2_F32 total = new Se2_F32();
sequence.computeTransform(total);
Se2_F32 inv = total.invert(null);
Affine2D_F32 affine = ConvertTransform_F32.convert(inv,(Affine2D_F32)null);
PixelTransformAffine_F32 distort = new PixelTransformAffine_F32();
distort.set(affine);
return distort;
} | [
"public",
"static",
"PixelTransformAffine_F32",
"transformRotate",
"(",
"float",
"x0",
",",
"float",
"y0",
",",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"angle",
")",
"{",
"// make the coordinate system's origin the image center",
"Se2_F32",
"imageToCenter",
"... | Creates a {@link boofcv.alg.distort.PixelTransformAffine_F32} from the dst image into the src image.
@param x0 Center of rotation in input image coordinates.
@param y0 Center of rotation in input image coordinates.
@param x1 Center of rotation in output image coordinates.
@param y1 Center of rotation in output image coordinates.
@param angle Angle of rotation. | [
"Creates",
"a",
"{",
"@link",
"boofcv",
".",
"alg",
".",
"distort",
".",
"PixelTransformAffine_F32",
"}",
"from",
"the",
"dst",
"image",
"into",
"the",
"src",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/impl/DistortSupport.java#L71-L92 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java | Pattern.repeat | public static Pattern repeat(Pattern pattern, int min, int max) {
"""
A pattern which matches <code>pattern</code> as many times as possible
but at least <code>min</code> times and at most <code>max</code> times.
@param pattern
@param min
@param max
@return
"""
if (pattern == null)
{
throw new IllegalArgumentException("Pattern can not be null");
}
return new RepeatPattern(pattern, min, max);
} | java | public static Pattern repeat(Pattern pattern, int min, int max)
{
if (pattern == null)
{
throw new IllegalArgumentException("Pattern can not be null");
}
return new RepeatPattern(pattern, min, max);
} | [
"public",
"static",
"Pattern",
"repeat",
"(",
"Pattern",
"pattern",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Pattern can not be null\"",
")",
";",
"}",
... | A pattern which matches <code>pattern</code> as many times as possible
but at least <code>min</code> times and at most <code>max</code> times.
@param pattern
@param min
@param max
@return | [
"A",
"pattern",
"which",
"matches",
"<code",
">",
"pattern<",
"/",
"code",
">",
"as",
"many",
"times",
"as",
"possible",
"but",
"at",
"least",
"<code",
">",
"min<",
"/",
"code",
">",
"times",
"and",
"at",
"most",
"<code",
">",
"max<",
"/",
"code",
">... | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/misc/Pattern.java#L209-L216 |
googlegenomics/gatk-tools-java | src/main/java/com/google/cloud/genomics/gatk/picard/runner/GA4GHPicardRunner.java | GA4GHPicardRunner.processGA4GHInput | private Input processGA4GHInput(String input) throws IOException, GeneralSecurityException, URISyntaxException {
"""
Processes GA4GH based input, creates required API connections and data pump
"""
GA4GHUrl url = new GA4GHUrl(input);
SAMFilePump pump;
if (usingGrpc) {
factoryGrpc.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.genomics.v1.Read,
com.google.genomics.v1.ReadGroupSet,
com.google.genomics.v1.Reference>(
factoryGrpc
.get(url.getRootUrl())
.getReads(url));
} else {
factoryRest.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.api.services.genomics.model.Read,
com.google.api.services.genomics.model.ReadGroupSet,
com.google.api.services.genomics.model.Reference>(
factoryRest
.get(url.getRootUrl())
.getReads(url));
}
return new Input(input, STDIN_FILE_NAME, pump);
} | java | private Input processGA4GHInput(String input) throws IOException, GeneralSecurityException, URISyntaxException {
GA4GHUrl url = new GA4GHUrl(input);
SAMFilePump pump;
if (usingGrpc) {
factoryGrpc.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.genomics.v1.Read,
com.google.genomics.v1.ReadGroupSet,
com.google.genomics.v1.Reference>(
factoryGrpc
.get(url.getRootUrl())
.getReads(url));
} else {
factoryRest.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.api.services.genomics.model.Read,
com.google.api.services.genomics.model.ReadGroupSet,
com.google.api.services.genomics.model.Reference>(
factoryRest
.get(url.getRootUrl())
.getReads(url));
}
return new Input(input, STDIN_FILE_NAME, pump);
} | [
"private",
"Input",
"processGA4GHInput",
"(",
"String",
"input",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
",",
"URISyntaxException",
"{",
"GA4GHUrl",
"url",
"=",
"new",
"GA4GHUrl",
"(",
"input",
")",
";",
"SAMFilePump",
"pump",
";",
"if",
"... | Processes GA4GH based input, creates required API connections and data pump | [
"Processes",
"GA4GH",
"based",
"input",
"creates",
"required",
"API",
"connections",
"and",
"data",
"pump"
] | train | https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/picard/runner/GA4GHPicardRunner.java#L212-L237 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java | JsonWriter.registerWriterInterfaceLast | public void registerWriterInterfaceLast(Class<?> interFace, JsonWriterI<?> writer) {
"""
associate an Writer to a interface With Low priority
@param interFace interface to map
@param writer writer Object
"""
writerInterfaces.addLast(new WriterByInterface(interFace, writer));
} | java | public void registerWriterInterfaceLast(Class<?> interFace, JsonWriterI<?> writer) {
writerInterfaces.addLast(new WriterByInterface(interFace, writer));
} | [
"public",
"void",
"registerWriterInterfaceLast",
"(",
"Class",
"<",
"?",
">",
"interFace",
",",
"JsonWriterI",
"<",
"?",
">",
"writer",
")",
"{",
"writerInterfaces",
".",
"addLast",
"(",
"new",
"WriterByInterface",
"(",
"interFace",
",",
"writer",
")",
")",
... | associate an Writer to a interface With Low priority
@param interFace interface to map
@param writer writer Object | [
"associate",
"an",
"Writer",
"to",
"a",
"interface",
"With",
"Low",
"priority"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java#L343-L345 |
stagemonitor/stagemonitor | stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/soap/SoapHandlerTransformer.java | SoapHandlerTransformer.addHandlers | @Advice.OnMethodEnter
private static void addHandlers(@Advice.Argument(value = 0, readOnly = false) List<Handler> handlerChain, @Advice.This Binding binding) {
"""
This code might be executed in the context of the bootstrap class loader. That's why we have to make sure we only
call code which is visible. For example, we can't use slf4j or directly reference stagemonitor classes
"""
final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
final List<Handler<?>> stagemonitorHandlers = Dispatcher.get("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
if (stagemonitorHandlers != null) {
logger.fine("Adding SOAPHandlers " + stagemonitorHandlers + " to handlerChain for Binding " + binding);
if (handlerChain == null) {
handlerChain = Collections.emptyList();
}
// creating a new list as we don't know if handlerChain is immutable or not
handlerChain = new ArrayList<Handler>(handlerChain);
for (Handler<?> stagemonitorHandler : stagemonitorHandlers) {
if (!handlerChain.contains(stagemonitorHandler) &&
// makes sure we only add the handler to the correct application
Dispatcher.isVisibleToCurrentContextClassLoader(stagemonitorHandler)) {
handlerChain.add(stagemonitorHandler);
}
}
logger.fine("Handler Chain: " + handlerChain);
} else {
logger.fine("No SOAPHandlers found in Dispatcher for Binding " + binding);
}
} | java | @Advice.OnMethodEnter
private static void addHandlers(@Advice.Argument(value = 0, readOnly = false) List<Handler> handlerChain, @Advice.This Binding binding) {
final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
final List<Handler<?>> stagemonitorHandlers = Dispatcher.get("org.stagemonitor.tracing.soap.SoapHandlerTransformer");
if (stagemonitorHandlers != null) {
logger.fine("Adding SOAPHandlers " + stagemonitorHandlers + " to handlerChain for Binding " + binding);
if (handlerChain == null) {
handlerChain = Collections.emptyList();
}
// creating a new list as we don't know if handlerChain is immutable or not
handlerChain = new ArrayList<Handler>(handlerChain);
for (Handler<?> stagemonitorHandler : stagemonitorHandlers) {
if (!handlerChain.contains(stagemonitorHandler) &&
// makes sure we only add the handler to the correct application
Dispatcher.isVisibleToCurrentContextClassLoader(stagemonitorHandler)) {
handlerChain.add(stagemonitorHandler);
}
}
logger.fine("Handler Chain: " + handlerChain);
} else {
logger.fine("No SOAPHandlers found in Dispatcher for Binding " + binding);
}
} | [
"@",
"Advice",
".",
"OnMethodEnter",
"private",
"static",
"void",
"addHandlers",
"(",
"@",
"Advice",
".",
"Argument",
"(",
"value",
"=",
"0",
",",
"readOnly",
"=",
"false",
")",
"List",
"<",
"Handler",
">",
"handlerChain",
",",
"@",
"Advice",
".",
"This"... | This code might be executed in the context of the bootstrap class loader. That's why we have to make sure we only
call code which is visible. For example, we can't use slf4j or directly reference stagemonitor classes | [
"This",
"code",
"might",
"be",
"executed",
"in",
"the",
"context",
"of",
"the",
"bootstrap",
"class",
"loader",
".",
"That",
"s",
"why",
"we",
"have",
"to",
"make",
"sure",
"we",
"only",
"call",
"code",
"which",
"is",
"visible",
".",
"For",
"example",
... | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/soap/SoapHandlerTransformer.java#L85-L108 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/user/UserCoreDao.java | UserCoreDao.buildColumnsAs | public String[] buildColumnsAs(String[] columns, String value) {
"""
Build "columns as" values for the table columns with the specified
columns as the specified value
@param columns
columns to include as value
@param value
"columns as" value for specified columns
@return "columns as" values
@since 2.0.0
"""
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value;
}
return buildColumnsAs(columns, values);
} | java | public String[] buildColumnsAs(String[] columns, String value) {
String[] values = new String[columns.length];
for (int i = 0; i < columns.length; i++) {
values[i] = value;
}
return buildColumnsAs(columns, values);
} | [
"public",
"String",
"[",
"]",
"buildColumnsAs",
"(",
"String",
"[",
"]",
"columns",
",",
"String",
"value",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"new",
"String",
"[",
"columns",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Build "columns as" values for the table columns with the specified
columns as the specified value
@param columns
columns to include as value
@param value
"columns as" value for specified columns
@return "columns as" values
@since 2.0.0 | [
"Build",
"columns",
"as",
"values",
"for",
"the",
"table",
"columns",
"with",
"the",
"specified",
"columns",
"as",
"the",
"specified",
"value"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserCoreDao.java#L1584-L1592 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/customfieldservice/CreateCustomFieldsAndOptions.java | CreateCustomFieldsAndOptions.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
"""
Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.
"""
// Get the CustomFieldService.
CustomFieldServiceInterface customFieldService =
adManagerServices.get(session, CustomFieldServiceInterface.class);
// Create a number custom field that can be used for an external ID in the
// API.
CustomField numberCustomField = new CustomField();
numberCustomField.setName("External ID #" + new Random().nextInt(Integer.MAX_VALUE));
numberCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
numberCustomField.setDataType(CustomFieldDataType.NUMBER);
numberCustomField.setVisibility(CustomFieldVisibility.API_ONLY);
// Create a drop-down custom field that can be used in the UI.
CustomField dropDownCustomField = new CustomField();
dropDownCustomField.setName(
"Internal approval status #" + new Random().nextInt(Integer.MAX_VALUE));
dropDownCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
dropDownCustomField.setDataType(CustomFieldDataType.DROP_DOWN);
dropDownCustomField.setVisibility(CustomFieldVisibility.FULL);
// Create the custom fields on the server.
CustomField[] customFields =
customFieldService.createCustomFields(
new CustomField[] {numberCustomField, dropDownCustomField});
for (CustomField createdCustomField : customFields) {
System.out.printf(
"A custom field with ID %d and name '%s' was created.%n",
createdCustomField.getId(), createdCustomField.getName());
}
// Set the created drop-down custom field.
dropDownCustomField = customFields[1];
// Create approved custom field option.
CustomFieldOption approvedCustomFieldOption = new CustomFieldOption();
approvedCustomFieldOption.setDisplayName("APPROVED");
approvedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create unapproved custom field option.
CustomFieldOption unapprovedCustomFieldOption = new CustomFieldOption();
unapprovedCustomFieldOption.setDisplayName("UNAPPROVED");
unapprovedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create the custom field options on the server.
CustomFieldOption[] customFieldOptions =
customFieldService.createCustomFieldOptions(
new CustomFieldOption[] {approvedCustomFieldOption, unapprovedCustomFieldOption});
for (CustomFieldOption createdCustomFieldOption : customFieldOptions) {
System.out.printf(
"A custom field option with ID %d and display name '%s' was created.%n",
createdCustomFieldOption.getId(), createdCustomFieldOption.getDisplayName());
}
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the CustomFieldService.
CustomFieldServiceInterface customFieldService =
adManagerServices.get(session, CustomFieldServiceInterface.class);
// Create a number custom field that can be used for an external ID in the
// API.
CustomField numberCustomField = new CustomField();
numberCustomField.setName("External ID #" + new Random().nextInt(Integer.MAX_VALUE));
numberCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
numberCustomField.setDataType(CustomFieldDataType.NUMBER);
numberCustomField.setVisibility(CustomFieldVisibility.API_ONLY);
// Create a drop-down custom field that can be used in the UI.
CustomField dropDownCustomField = new CustomField();
dropDownCustomField.setName(
"Internal approval status #" + new Random().nextInt(Integer.MAX_VALUE));
dropDownCustomField.setEntityType(CustomFieldEntityType.LINE_ITEM);
dropDownCustomField.setDataType(CustomFieldDataType.DROP_DOWN);
dropDownCustomField.setVisibility(CustomFieldVisibility.FULL);
// Create the custom fields on the server.
CustomField[] customFields =
customFieldService.createCustomFields(
new CustomField[] {numberCustomField, dropDownCustomField});
for (CustomField createdCustomField : customFields) {
System.out.printf(
"A custom field with ID %d and name '%s' was created.%n",
createdCustomField.getId(), createdCustomField.getName());
}
// Set the created drop-down custom field.
dropDownCustomField = customFields[1];
// Create approved custom field option.
CustomFieldOption approvedCustomFieldOption = new CustomFieldOption();
approvedCustomFieldOption.setDisplayName("APPROVED");
approvedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create unapproved custom field option.
CustomFieldOption unapprovedCustomFieldOption = new CustomFieldOption();
unapprovedCustomFieldOption.setDisplayName("UNAPPROVED");
unapprovedCustomFieldOption.setCustomFieldId(dropDownCustomField.getId());
// Create the custom field options on the server.
CustomFieldOption[] customFieldOptions =
customFieldService.createCustomFieldOptions(
new CustomFieldOption[] {approvedCustomFieldOption, unapprovedCustomFieldOption});
for (CustomFieldOption createdCustomFieldOption : customFieldOptions) {
System.out.printf(
"A custom field option with ID %d and display name '%s' was created.%n",
createdCustomFieldOption.getId(), createdCustomFieldOption.getDisplayName());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the CustomFieldService.",
"CustomFieldServiceInterface",
"customFieldService",
"=",
"adManagerServices",
"... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/customfieldservice/CreateCustomFieldsAndOptions.java#L55-L111 |
knightliao/disconf | disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java | StringUtil.startsWithChar | public static boolean startsWithChar(String str, char ch) {
"""
判断字符串<code>str</code>是否以字符<code>ch</code>开头
@param str 要比较的字符串
@param ch 开头字符
@return 如果字符串<code>str</code>是否以字符<code>ch</code> 开头,则返回<code>true</code>
"""
if (StringUtils.isEmpty(str)) {
return false;
}
return str.charAt(0) == ch;
} | java | public static boolean startsWithChar(String str, char ch) {
if (StringUtils.isEmpty(str)) {
return false;
}
return str.charAt(0) == ch;
} | [
"public",
"static",
"boolean",
"startsWithChar",
"(",
"String",
"str",
",",
"char",
"ch",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"str",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"str",
".",
"charAt",
"(",
"0",
")",
"==",... | 判断字符串<code>str</code>是否以字符<code>ch</code>开头
@param str 要比较的字符串
@param ch 开头字符
@return 如果字符串<code>str</code>是否以字符<code>ch</code> 开头,则返回<code>true</code> | [
"判断字符串<code",
">",
"str<",
"/",
"code",
">",
"是否以字符<code",
">",
"ch<",
"/",
"code",
">",
"开头"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L566-L572 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/util/ConfigUtil.java | ConfigUtil.discoverProxyLocation | public static String discoverProxyLocation() {
"""
Tries to discover user proxy location.
If a UID system property is set, and running on a Unix machine it
returns /tmp/x509up_u${UID}. If any other machine then Unix, it returns
${tempdir}/x509up_u${UID}, where tempdir is a platform-specific
temporary directory as indicated by the java.io.tmpdir system property.
If a UID system property is not set, the username will be used instead
of the UID. That is, it returns ${tempdir}/x509up_u_${username}
"""
String dir = null;
if (getOS() == UNIX_OS) {
dir = "/tmp/";
} else {
String tmpDir = System.getProperty("java.io.tmpdir");
dir = (tmpDir == null) ? globus_dir : tmpDir;
}
String uid = System.getProperty("UID");
if (uid != null) {
return getLocation(dir, PROXY_NAME + uid);
} else if (getOS() == UNIX_OS) {
try {
return getLocation(dir, PROXY_NAME + getUID());
} catch (IOException e) {
}
}
/* If all else fails use username */
String suffix = System.getProperty("user.name");
if (suffix != null) {
suffix = suffix.toLowerCase();
} else {
suffix = "nousername";
}
return getLocation(dir, PROXY_NAME + "_" + suffix);
} | java | public static String discoverProxyLocation() {
String dir = null;
if (getOS() == UNIX_OS) {
dir = "/tmp/";
} else {
String tmpDir = System.getProperty("java.io.tmpdir");
dir = (tmpDir == null) ? globus_dir : tmpDir;
}
String uid = System.getProperty("UID");
if (uid != null) {
return getLocation(dir, PROXY_NAME + uid);
} else if (getOS() == UNIX_OS) {
try {
return getLocation(dir, PROXY_NAME + getUID());
} catch (IOException e) {
}
}
/* If all else fails use username */
String suffix = System.getProperty("user.name");
if (suffix != null) {
suffix = suffix.toLowerCase();
} else {
suffix = "nousername";
}
return getLocation(dir, PROXY_NAME + "_" + suffix);
} | [
"public",
"static",
"String",
"discoverProxyLocation",
"(",
")",
"{",
"String",
"dir",
"=",
"null",
";",
"if",
"(",
"getOS",
"(",
")",
"==",
"UNIX_OS",
")",
"{",
"dir",
"=",
"\"/tmp/\"",
";",
"}",
"else",
"{",
"String",
"tmpDir",
"=",
"System",
".",
... | Tries to discover user proxy location.
If a UID system property is set, and running on a Unix machine it
returns /tmp/x509up_u${UID}. If any other machine then Unix, it returns
${tempdir}/x509up_u${UID}, where tempdir is a platform-specific
temporary directory as indicated by the java.io.tmpdir system property.
If a UID system property is not set, the username will be used instead
of the UID. That is, it returns ${tempdir}/x509up_u_${username} | [
"Tries",
"to",
"discover",
"user",
"proxy",
"location",
".",
"If",
"a",
"UID",
"system",
"property",
"is",
"set",
"and",
"running",
"on",
"a",
"Unix",
"machine",
"it",
"returns",
"/",
"tmp",
"/",
"x509up_u$",
"{",
"UID",
"}",
".",
"If",
"any",
"other",... | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/util/ConfigUtil.java#L74-L105 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java | HttpClientResponseBuilder.doReturn | public HttpClientResponseBuilder doReturn(String response, Charset charset) {
"""
Adds action which returns provided response in provided charset and status 200.
@param response response to return
@return response builder
"""
newRule.addAction(new StringResponse(response, charset));
return new HttpClientResponseBuilder(newRule);
} | java | public HttpClientResponseBuilder doReturn(String response, Charset charset) {
newRule.addAction(new StringResponse(response, charset));
return new HttpClientResponseBuilder(newRule);
} | [
"public",
"HttpClientResponseBuilder",
"doReturn",
"(",
"String",
"response",
",",
"Charset",
"charset",
")",
"{",
"newRule",
".",
"addAction",
"(",
"new",
"StringResponse",
"(",
"response",
",",
"charset",
")",
")",
";",
"return",
"new",
"HttpClientResponseBuilde... | Adds action which returns provided response in provided charset and status 200.
@param response response to return
@return response builder | [
"Adds",
"action",
"which",
"returns",
"provided",
"response",
"in",
"provided",
"charset",
"and",
"status",
"200",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L99-L102 |
apache/fluo-recipes | modules/spark/src/main/java/org/apache/fluo/recipes/spark/FluoSparkHelper.java | FluoSparkHelper.bulkImportKvToAccumulo | public void bulkImportKvToAccumulo(JavaPairRDD<Key, Value> data, String accumuloTable,
BulkImportOptions opts) {
"""
Bulk import Key/Value data into specified Accumulo table. This method does not repartition
data. One RFile will be created for each partition in the passed in RDD. Ensure the RDD is
reasonably partitioned before calling this method.
@param data Key/value data to import
@param accumuloTable Accumulo table used for import
@param opts Bulk import options
"""
Path tempDir = getTempDir(opts);
Connector conn = chooseConnector(opts);
try {
if (hdfs.exists(tempDir)) {
throw new IllegalArgumentException("HDFS temp dir already exists: " + tempDir.toString());
}
hdfs.mkdirs(tempDir);
Path dataDir = new Path(tempDir.toString() + "/data");
Path failDir = new Path(tempDir.toString() + "/fail");
hdfs.mkdirs(failDir);
// save data to HDFS
Job job = Job.getInstance(hadoopConfig);
AccumuloFileOutputFormat.setOutputPath(job, dataDir);
// must use new API here as saveAsHadoopFile throws exception
data.saveAsNewAPIHadoopFile(dataDir.toString(), Key.class, Value.class,
AccumuloFileOutputFormat.class, job.getConfiguration());
// bulk import data to Accumulo
log.info("Wrote data for bulk import to HDFS temp directory: {}", dataDir);
conn.tableOperations().importDirectory(accumuloTable, dataDir.toString(), failDir.toString(),
false);
// throw exception if failures directory contains files
if (hdfs.listFiles(failDir, true).hasNext()) {
throw new IllegalStateException("Bulk import failed! Found files that failed to import "
+ "in failures directory: " + failDir);
}
log.info("Successfully bulk imported data in {} to '{}' Accumulo table", dataDir,
accumuloTable);
// delete data directory
hdfs.delete(tempDir, true);
log.info("Deleted HDFS temp directory created for bulk import: {}", tempDir);
// @formatter:off
} catch (IOException | TableNotFoundException | AccumuloException
| AccumuloSecurityException e) {
// @formatter:on
throw new IllegalStateException(e);
}
} | java | public void bulkImportKvToAccumulo(JavaPairRDD<Key, Value> data, String accumuloTable,
BulkImportOptions opts) {
Path tempDir = getTempDir(opts);
Connector conn = chooseConnector(opts);
try {
if (hdfs.exists(tempDir)) {
throw new IllegalArgumentException("HDFS temp dir already exists: " + tempDir.toString());
}
hdfs.mkdirs(tempDir);
Path dataDir = new Path(tempDir.toString() + "/data");
Path failDir = new Path(tempDir.toString() + "/fail");
hdfs.mkdirs(failDir);
// save data to HDFS
Job job = Job.getInstance(hadoopConfig);
AccumuloFileOutputFormat.setOutputPath(job, dataDir);
// must use new API here as saveAsHadoopFile throws exception
data.saveAsNewAPIHadoopFile(dataDir.toString(), Key.class, Value.class,
AccumuloFileOutputFormat.class, job.getConfiguration());
// bulk import data to Accumulo
log.info("Wrote data for bulk import to HDFS temp directory: {}", dataDir);
conn.tableOperations().importDirectory(accumuloTable, dataDir.toString(), failDir.toString(),
false);
// throw exception if failures directory contains files
if (hdfs.listFiles(failDir, true).hasNext()) {
throw new IllegalStateException("Bulk import failed! Found files that failed to import "
+ "in failures directory: " + failDir);
}
log.info("Successfully bulk imported data in {} to '{}' Accumulo table", dataDir,
accumuloTable);
// delete data directory
hdfs.delete(tempDir, true);
log.info("Deleted HDFS temp directory created for bulk import: {}", tempDir);
// @formatter:off
} catch (IOException | TableNotFoundException | AccumuloException
| AccumuloSecurityException e) {
// @formatter:on
throw new IllegalStateException(e);
}
} | [
"public",
"void",
"bulkImportKvToAccumulo",
"(",
"JavaPairRDD",
"<",
"Key",
",",
"Value",
">",
"data",
",",
"String",
"accumuloTable",
",",
"BulkImportOptions",
"opts",
")",
"{",
"Path",
"tempDir",
"=",
"getTempDir",
"(",
"opts",
")",
";",
"Connector",
"conn",... | Bulk import Key/Value data into specified Accumulo table. This method does not repartition
data. One RFile will be created for each partition in the passed in RDD. Ensure the RDD is
reasonably partitioned before calling this method.
@param data Key/value data to import
@param accumuloTable Accumulo table used for import
@param opts Bulk import options | [
"Bulk",
"import",
"Key",
"/",
"Value",
"data",
"into",
"specified",
"Accumulo",
"table",
".",
"This",
"method",
"does",
"not",
"repartition",
"data",
".",
"One",
"RFile",
"will",
"be",
"created",
"for",
"each",
"partition",
"in",
"the",
"passed",
"in",
"RD... | train | https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/spark/src/main/java/org/apache/fluo/recipes/spark/FluoSparkHelper.java#L213-L257 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.datePartStr | public static Expression datePartStr(String expression, DatePartExt part) {
"""
Returned expression results in Date part as an integer.
The date expression is a string in a supported format, and part is one of the supported date part strings.
"""
return datePartStr(x(expression), part);
} | java | public static Expression datePartStr(String expression, DatePartExt part) {
return datePartStr(x(expression), part);
} | [
"public",
"static",
"Expression",
"datePartStr",
"(",
"String",
"expression",
",",
"DatePartExt",
"part",
")",
"{",
"return",
"datePartStr",
"(",
"x",
"(",
"expression",
")",
",",
"part",
")",
";",
"}"
] | Returned expression results in Date part as an integer.
The date expression is a string in a supported format, and part is one of the supported date part strings. | [
"Returned",
"expression",
"results",
"in",
"Date",
"part",
"as",
"an",
"integer",
".",
"The",
"date",
"expression",
"is",
"a",
"string",
"in",
"a",
"supported",
"format",
"and",
"part",
"is",
"one",
"of",
"the",
"supported",
"date",
"part",
"strings",
"."
... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L164-L166 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java | DeIdentifyUtil.deidentifyEdge | public static String deidentifyEdge(String str, int start, int end) {
"""
Deidentify edge.
@param str the str
@param start the start
@param end the end
@return the string
@since 2.0.0
"""
return deidentifyLeft(deidentifyRight(str, end), start);
} | java | public static String deidentifyEdge(String str, int start, int end) {
return deidentifyLeft(deidentifyRight(str, end), start);
} | [
"public",
"static",
"String",
"deidentifyEdge",
"(",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"deidentifyLeft",
"(",
"deidentifyRight",
"(",
"str",
",",
"end",
")",
",",
"start",
")",
";",
"}"
] | Deidentify edge.
@param str the str
@param start the start
@param end the end
@return the string
@since 2.0.0 | [
"Deidentify",
"edge",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java#L150-L152 |
hdecarne/java-default | src/main/java/de/carne/util/SystemProperties.java | SystemProperties.longValue | public static long longValue(String key, long defaultValue) {
"""
Gets a {@code long} system property value.
@param key the property key to retrieve.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined.
"""
String value = System.getProperty(key);
long longValue = defaultValue;
if (value != null) {
try {
longValue = Long.parseLong(value);
} catch (NumberFormatException e) {
LOG.warning(e, "Ignoring invalid long system propert: ''{0}'' = ''{1}''", key, value);
}
}
return longValue;
} | java | public static long longValue(String key, long defaultValue) {
String value = System.getProperty(key);
long longValue = defaultValue;
if (value != null) {
try {
longValue = Long.parseLong(value);
} catch (NumberFormatException e) {
LOG.warning(e, "Ignoring invalid long system propert: ''{0}'' = ''{1}''", key, value);
}
}
return longValue;
} | [
"public",
"static",
"long",
"longValue",
"(",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"System",
".",
"getProperty",
"(",
"key",
")",
";",
"long",
"longValue",
"=",
"defaultValue",
";",
"if",
"(",
"value",
"!=",
"nu... | Gets a {@code long} system property value.
@param key the property key to retrieve.
@param defaultValue the default value to return in case the property is not defined.
@return the property value or the submitted default value if the property is not defined. | [
"Gets",
"a",
"{",
"@code",
"long",
"}",
"system",
"property",
"value",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/SystemProperties.java#L189-L201 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcherState.java | ConsumerDispatcherState.setUser | public void setUser(String user, boolean isSIBServerSubject) {
"""
Sets the user.
@param user The user to set
@param isSIBServerSubject
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setUser", user);
this.user = user;
this.isSIBServerSubject = isSIBServerSubject;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setUser");
} | java | public void setUser(String user, boolean isSIBServerSubject)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setUser", user);
this.user = user;
this.isSIBServerSubject = isSIBServerSubject;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setUser");
} | [
"public",
"void",
"setUser",
"(",
"String",
"user",
",",
"boolean",
"isSIBServerSubject",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
","... | Sets the user.
@param user The user to set
@param isSIBServerSubject | [
"Sets",
"the",
"user",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConsumerDispatcherState.java#L427-L436 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/CallbackHandlerInterceptor.java | CallbackHandlerInterceptor.getDownloadedFile | private InputStream getDownloadedFile(String response) throws FMSException {
"""
Method to get the input stream from the download URL returned from service
@param response the download URL string
@return InputStream the downloaded file
@throws FMSException
"""
if (response != null) {
try {
URL url = new URL(response);
return url.openStream();
} catch (Exception e) {
throw new FMSException("Exception while downloading the file from URL.", e);
}
}
return null;
} | java | private InputStream getDownloadedFile(String response) throws FMSException {
if (response != null) {
try {
URL url = new URL(response);
return url.openStream();
} catch (Exception e) {
throw new FMSException("Exception while downloading the file from URL.", e);
}
}
return null;
} | [
"private",
"InputStream",
"getDownloadedFile",
"(",
"String",
"response",
")",
"throws",
"FMSException",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"response",
")",
";",
"return",
"url",
".",
"op... | Method to get the input stream from the download URL returned from service
@param response the download URL string
@return InputStream the downloaded file
@throws FMSException | [
"Method",
"to",
"get",
"the",
"input",
"stream",
"from",
"the",
"download",
"URL",
"returned",
"from",
"service"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/CallbackHandlerInterceptor.java#L309-L320 |
Azure/azure-sdk-for-java | common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java | AzureProxy.createDefaultPipeline | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, HttpPipelinePolicy credentialsPolicy) {
"""
Create the default HttpPipeline.
@param swaggerInterface The interface that the pipeline will use to generate a user-agent
string.
@param credentialsPolicy The credentials policy factory to use to apply authentication to the
pipeline.
@return the default HttpPipeline.
"""
// Order in which policies applied will be the order in which they appear in the array
//
List<HttpPipelinePolicy> policies = new ArrayList<HttpPipelinePolicy>();
policies.add(new UserAgentPolicy(getDefaultUserAgentString(swaggerInterface)));
policies.add(new RetryPolicy());
policies.add(new CookiePolicy());
if (credentialsPolicy != null) {
policies.add(credentialsPolicy);
}
return new HttpPipeline(policies.toArray(new HttpPipelinePolicy[policies.size()]));
} | java | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, HttpPipelinePolicy credentialsPolicy) {
// Order in which policies applied will be the order in which they appear in the array
//
List<HttpPipelinePolicy> policies = new ArrayList<HttpPipelinePolicy>();
policies.add(new UserAgentPolicy(getDefaultUserAgentString(swaggerInterface)));
policies.add(new RetryPolicy());
policies.add(new CookiePolicy());
if (credentialsPolicy != null) {
policies.add(credentialsPolicy);
}
return new HttpPipeline(policies.toArray(new HttpPipelinePolicy[policies.size()]));
} | [
"public",
"static",
"HttpPipeline",
"createDefaultPipeline",
"(",
"Class",
"<",
"?",
">",
"swaggerInterface",
",",
"HttpPipelinePolicy",
"credentialsPolicy",
")",
"{",
"// Order in which policies applied will be the order in which they appear in the array",
"//",
"List",
"<",
"... | Create the default HttpPipeline.
@param swaggerInterface The interface that the pipeline will use to generate a user-agent
string.
@param credentialsPolicy The credentials policy factory to use to apply authentication to the
pipeline.
@return the default HttpPipeline. | [
"Create",
"the",
"default",
"HttpPipeline",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java#L192-L203 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/BeanUtils.java | BeanUtils.getProperty | public static <T> T getProperty(Object bean, String name, Class<T> clazz) throws Exception {
"""
得到属性的值
@param bean 对象
@param name 属性名
@param clazz 设置值的类
@param <T> 和返回值对应的类型
@return 属性值
@throws Exception 取值异常
"""
Method method = ReflectUtils.getPropertyGetterMethod(bean.getClass(), name);
if (method.isAccessible()) {
return (T) method.invoke(bean);
} else {
try {
method.setAccessible(true);
return (T) method.invoke(bean);
} finally {
method.setAccessible(false);
}
}
} | java | public static <T> T getProperty(Object bean, String name, Class<T> clazz) throws Exception {
Method method = ReflectUtils.getPropertyGetterMethod(bean.getClass(), name);
if (method.isAccessible()) {
return (T) method.invoke(bean);
} else {
try {
method.setAccessible(true);
return (T) method.invoke(bean);
} finally {
method.setAccessible(false);
}
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getProperty",
"(",
"Object",
"bean",
",",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"Exception",
"{",
"Method",
"method",
"=",
"ReflectUtils",
".",
"getPropertyGetterMethod",
"(",
"bean"... | 得到属性的值
@param bean 对象
@param name 属性名
@param clazz 设置值的类
@param <T> 和返回值对应的类型
@return 属性值
@throws Exception 取值异常 | [
"得到属性的值"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/BeanUtils.java#L71-L83 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableConfig.java | PathfindableConfig.exports | public static Xml exports(Map<String, PathData> pathData) {
"""
Export the pathfindable data to node.
@param pathData The pathfindable data (must not be <code>null</code>).
@return The path data node.
@throws LionEngineException If unable to read node.
"""
Check.notNull(pathData);
final Xml node = new Xml(NODE_PATHFINDABLE);
for (final PathData data : pathData.values())
{
node.add(exportPathData(data));
}
return node;
} | java | public static Xml exports(Map<String, PathData> pathData)
{
Check.notNull(pathData);
final Xml node = new Xml(NODE_PATHFINDABLE);
for (final PathData data : pathData.values())
{
node.add(exportPathData(data));
}
return node;
} | [
"public",
"static",
"Xml",
"exports",
"(",
"Map",
"<",
"String",
",",
"PathData",
">",
"pathData",
")",
"{",
"Check",
".",
"notNull",
"(",
"pathData",
")",
";",
"final",
"Xml",
"node",
"=",
"new",
"Xml",
"(",
"NODE_PATHFINDABLE",
")",
";",
"for",
"(",
... | Export the pathfindable data to node.
@param pathData The pathfindable data (must not be <code>null</code>).
@return The path data node.
@throws LionEngineException If unable to read node. | [
"Export",
"the",
"pathfindable",
"data",
"to",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableConfig.java#L89-L100 |
deephacks/confit | provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java | HBeanReferences.getReferenceKeyValue | public static KeyValue getReferenceKeyValue(byte[] rowkey, String propertyName,
String schemaName, List<BeanId> refs, UniqueIds uids) {
"""
Get a particular type of references identified by propertyName into key value
form.
@param schemaName
"""
final byte[] pid = uids.getUsid().getId(propertyName);
final byte[] sid = uids.getUsid().getId(schemaName);
final byte[] qual = new byte[] { sid[0], sid[1], pid[0], pid[1] };
final byte[] iids = getIids2(refs, uids);
return new KeyValue(rowkey, REF_COLUMN_FAMILY, qual, iids);
} | java | public static KeyValue getReferenceKeyValue(byte[] rowkey, String propertyName,
String schemaName, List<BeanId> refs, UniqueIds uids) {
final byte[] pid = uids.getUsid().getId(propertyName);
final byte[] sid = uids.getUsid().getId(schemaName);
final byte[] qual = new byte[] { sid[0], sid[1], pid[0], pid[1] };
final byte[] iids = getIids2(refs, uids);
return new KeyValue(rowkey, REF_COLUMN_FAMILY, qual, iids);
} | [
"public",
"static",
"KeyValue",
"getReferenceKeyValue",
"(",
"byte",
"[",
"]",
"rowkey",
",",
"String",
"propertyName",
",",
"String",
"schemaName",
",",
"List",
"<",
"BeanId",
">",
"refs",
",",
"UniqueIds",
"uids",
")",
"{",
"final",
"byte",
"[",
"]",
"pi... | Get a particular type of references identified by propertyName into key value
form.
@param schemaName | [
"Get",
"a",
"particular",
"type",
"of",
"references",
"identified",
"by",
"propertyName",
"into",
"key",
"value",
"form",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanReferences.java#L82-L89 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/SkewedInfo.java | SkewedInfo.withSkewedColumnValueLocationMaps | public SkewedInfo withSkewedColumnValueLocationMaps(java.util.Map<String, String> skewedColumnValueLocationMaps) {
"""
<p>
A mapping of skewed values to the columns that contain them.
</p>
@param skewedColumnValueLocationMaps
A mapping of skewed values to the columns that contain them.
@return Returns a reference to this object so that method calls can be chained together.
"""
setSkewedColumnValueLocationMaps(skewedColumnValueLocationMaps);
return this;
} | java | public SkewedInfo withSkewedColumnValueLocationMaps(java.util.Map<String, String> skewedColumnValueLocationMaps) {
setSkewedColumnValueLocationMaps(skewedColumnValueLocationMaps);
return this;
} | [
"public",
"SkewedInfo",
"withSkewedColumnValueLocationMaps",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"skewedColumnValueLocationMaps",
")",
"{",
"setSkewedColumnValueLocationMaps",
"(",
"skewedColumnValueLocationMaps",
")",
";",
"return",
... | <p>
A mapping of skewed values to the columns that contain them.
</p>
@param skewedColumnValueLocationMaps
A mapping of skewed values to the columns that contain them.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"mapping",
"of",
"skewed",
"values",
"to",
"the",
"columns",
"that",
"contain",
"them",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/SkewedInfo.java#L225-L228 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java | AbstractMoskitoAspect.createAccumulators | private void createAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass, AccumulateWithSubClasses... annotations) {
"""
Create class level accumulators from {@link AccumulateWithSubClasses} annotations.
@param producer
{@link OnDemandStatsProducer}
@param producerClass
producer class
@param annotations
{@link AccumulateWithSubClasses} annotations to process
"""
for (final AccumulateWithSubClasses annotation : annotations)
if (annotation != null)
AccumulatorUtil.getInstance(producerClass).createAccumulator(producer, annotation);
} | java | private void createAccumulators(final OnDemandStatsProducer<S> producer, final Class producerClass, AccumulateWithSubClasses... annotations) {
for (final AccumulateWithSubClasses annotation : annotations)
if (annotation != null)
AccumulatorUtil.getInstance(producerClass).createAccumulator(producer, annotation);
} | [
"private",
"void",
"createAccumulators",
"(",
"final",
"OnDemandStatsProducer",
"<",
"S",
">",
"producer",
",",
"final",
"Class",
"producerClass",
",",
"AccumulateWithSubClasses",
"...",
"annotations",
")",
"{",
"for",
"(",
"final",
"AccumulateWithSubClasses",
"annota... | Create class level accumulators from {@link AccumulateWithSubClasses} annotations.
@param producer
{@link OnDemandStatsProducer}
@param producerClass
producer class
@param annotations
{@link AccumulateWithSubClasses} annotations to process | [
"Create",
"class",
"level",
"accumulators",
"from",
"{",
"@link",
"AccumulateWithSubClasses",
"}",
"annotations",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L281-L285 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PandaApi.java | PandaApi.getPhotos | public Photos getPhotos(String pandaName, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws Exception {
"""
Ask the Flickr Pandas for a list of recent public (and "safe") photos.
<br>
More information about the pandas can be found on the
<a href="http://code.flickr.com/blog/2009/03/03/panda-tuesday-the-history-of-the-panda-new-apis-explore-and-you/">dev blog</a>. Authentication
<br>
This method does not require authentication.
<br>
You can fetch a list of all the current pandas using the {@link #getList()} API method.
@param pandaName (Required) The name of the panda to ask for photos from.
@param extras extra information to fetch for each returned record.
@param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500.
@param page The page of results to return. If this argument is less than 1, it defaults to 1.
@param sign if true, the request will be signed.
@return photos object from the panda.
@throws Exception if required parameter is missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.panda.getPhotos.html">flickr.panda.getPhotos</a>
"""
JinxUtils.validateParams(pandaName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.panda.getPhotos");
params.put("panda_name", pandaName);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class, sign);
} | java | public Photos getPhotos(String pandaName, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws Exception {
JinxUtils.validateParams(pandaName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.panda.getPhotos");
params.put("panda_name", pandaName);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class, sign);
} | [
"public",
"Photos",
"getPhotos",
"(",
"String",
"pandaName",
",",
"EnumSet",
"<",
"JinxConstants",
".",
"PhotoExtras",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
",",
"boolean",
"sign",
")",
"throws",
"Exception",
"{",
"JinxUtils",
".",
"valid... | Ask the Flickr Pandas for a list of recent public (and "safe") photos.
<br>
More information about the pandas can be found on the
<a href="http://code.flickr.com/blog/2009/03/03/panda-tuesday-the-history-of-the-panda-new-apis-explore-and-you/">dev blog</a>. Authentication
<br>
This method does not require authentication.
<br>
You can fetch a list of all the current pandas using the {@link #getList()} API method.
@param pandaName (Required) The name of the panda to ask for photos from.
@param extras extra information to fetch for each returned record.
@param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500.
@param page The page of results to return. If this argument is less than 1, it defaults to 1.
@param sign if true, the request will be signed.
@return photos object from the panda.
@throws Exception if required parameter is missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.panda.getPhotos.html">flickr.panda.getPhotos</a> | [
"Ask",
"the",
"Flickr",
"Pandas",
"for",
"a",
"list",
"of",
"recent",
"public",
"(",
"and",
"safe",
")",
"photos",
".",
"<br",
">",
"More",
"information",
"about",
"the",
"pandas",
"can",
"be",
"found",
"on",
"the",
"<a",
"href",
"=",
"http",
":",
"/... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PandaApi.java#L82-L97 |
beihaifeiwu/dolphin | dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/ContentMergePlugin.java | ContentMergePlugin.mergeExistedElement | protected void mergeExistedElement(XmlElement src, XmlElement dest) {
"""
合并已经存在的Xml元素
@param src The source xml element for merging
@param dest The dest xml element for merging
"""
// 合并属性
List<Attribute> srcAttributes = src.getAttributes();
List<Attribute> destAttributes = dest.getAttributes();
for (Attribute srcAttr : srcAttributes) {
Attribute matched = null;
for (Attribute destAttr : destAttributes) {
if (StringUtils.equals(srcAttr.getName(), destAttr.getName()) &&
StringUtils.equals(srcAttr.getValue(), destAttr.getValue())) {
matched = destAttr;
}
}
// 不存在则添加到目标元素的属性列表中
if (matched == null) {
destAttributes.add(srcAttributes.indexOf(srcAttr), srcAttr);
}
}
// 重组子节点
// reformationTheElementChilds(src);
// reformationTheElementChilds(dest);
// 暂时不做处理 ---留待后续添加
} | java | protected void mergeExistedElement(XmlElement src, XmlElement dest) {
// 合并属性
List<Attribute> srcAttributes = src.getAttributes();
List<Attribute> destAttributes = dest.getAttributes();
for (Attribute srcAttr : srcAttributes) {
Attribute matched = null;
for (Attribute destAttr : destAttributes) {
if (StringUtils.equals(srcAttr.getName(), destAttr.getName()) &&
StringUtils.equals(srcAttr.getValue(), destAttr.getValue())) {
matched = destAttr;
}
}
// 不存在则添加到目标元素的属性列表中
if (matched == null) {
destAttributes.add(srcAttributes.indexOf(srcAttr), srcAttr);
}
}
// 重组子节点
// reformationTheElementChilds(src);
// reformationTheElementChilds(dest);
// 暂时不做处理 ---留待后续添加
} | [
"protected",
"void",
"mergeExistedElement",
"(",
"XmlElement",
"src",
",",
"XmlElement",
"dest",
")",
"{",
"// 合并属性",
"List",
"<",
"Attribute",
">",
"srcAttributes",
"=",
"src",
".",
"getAttributes",
"(",
")",
";",
"List",
"<",
"Attribute",
">",
"destAttribute... | 合并已经存在的Xml元素
@param src The source xml element for merging
@param dest The dest xml element for merging | [
"合并已经存在的Xml元素"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/ContentMergePlugin.java#L132-L156 |
wonderpush/wonderpush-android-sdk | sdk/src/main/java/com/wonderpush/sdk/WonderPushJobQueue.java | WonderPushJobQueue.postJobWithDescription | protected Job postJobWithDescription(JSONObject jobDescription, long notBeforeRealtimeElapsed) {
"""
Creates and stores a job in the queue based on the provided description
@return The stored job or null if something went wrong (the queue is full for instance)
"""
String jobId = UUID.randomUUID().toString();
InternalJob job = new InternalJob(jobId, jobDescription, notBeforeRealtimeElapsed);
return post(job);
} | java | protected Job postJobWithDescription(JSONObject jobDescription, long notBeforeRealtimeElapsed) {
String jobId = UUID.randomUUID().toString();
InternalJob job = new InternalJob(jobId, jobDescription, notBeforeRealtimeElapsed);
return post(job);
} | [
"protected",
"Job",
"postJobWithDescription",
"(",
"JSONObject",
"jobDescription",
",",
"long",
"notBeforeRealtimeElapsed",
")",
"{",
"String",
"jobId",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
";",
"InternalJob",
"job",
"=",
"new",
... | Creates and stores a job in the queue based on the provided description
@return The stored job or null if something went wrong (the queue is full for instance) | [
"Creates",
"and",
"stores",
"a",
"job",
"in",
"the",
"queue",
"based",
"on",
"the",
"provided",
"description"
] | train | https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushJobQueue.java#L80-L84 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/spi/LobEngine.java | LobEngine.setClobValue | public void setClobValue(long locator, Clob data) throws PersistException, IOException {
"""
Stores a value into a Clob, replacing anything that was there
before. Passing null deletes the Clob, which is a convenience for
auto-generated code that may call this method.
@param locator lob locator as created by createNewClob
@param data source of data for Clob, which may be null to delete
@throws IllegalArgumentException if locator is zero
"""
if (data == null) {
deleteLob(locator);
return;
}
if (locator == 0) {
throw new IllegalArgumentException("Cannot use locator zero");
}
if (data instanceof ClobImpl) {
BlobImpl impl = ((ClobImpl) data).getWrappedBlob();
if (impl.getEnclosing() == this && impl.mLocator == locator) {
// Blob is ours and locator is the same, so nothing to do.
return;
}
}
try {
setClobValue(locator, data.openReader(0, 0));
} catch (FetchException e) {
throw e.toPersistException();
}
} | java | public void setClobValue(long locator, Clob data) throws PersistException, IOException {
if (data == null) {
deleteLob(locator);
return;
}
if (locator == 0) {
throw new IllegalArgumentException("Cannot use locator zero");
}
if (data instanceof ClobImpl) {
BlobImpl impl = ((ClobImpl) data).getWrappedBlob();
if (impl.getEnclosing() == this && impl.mLocator == locator) {
// Blob is ours and locator is the same, so nothing to do.
return;
}
}
try {
setClobValue(locator, data.openReader(0, 0));
} catch (FetchException e) {
throw e.toPersistException();
}
} | [
"public",
"void",
"setClobValue",
"(",
"long",
"locator",
",",
"Clob",
"data",
")",
"throws",
"PersistException",
",",
"IOException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"deleteLob",
"(",
"locator",
")",
";",
"return",
";",
"}",
"if",
"(",
... | Stores a value into a Clob, replacing anything that was there
before. Passing null deletes the Clob, which is a convenience for
auto-generated code that may call this method.
@param locator lob locator as created by createNewClob
@param data source of data for Clob, which may be null to delete
@throws IllegalArgumentException if locator is zero | [
"Stores",
"a",
"value",
"into",
"a",
"Clob",
"replacing",
"anything",
"that",
"was",
"there",
"before",
".",
"Passing",
"null",
"deletes",
"the",
"Clob",
"which",
"is",
"a",
"convenience",
"for",
"auto",
"-",
"generated",
"code",
"that",
"may",
"call",
"th... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/spi/LobEngine.java#L333-L356 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.sub2Ind | public static long sub2Ind(int[] shape, int[] indices) {
"""
Convert the given index (such as 1,1)
to a linear index
@param shape the shape of the indexes to convert
@param indices the index to convert
@return the linear index given the shape
and indices
"""
long index = 0;
int shift = 1;
for (int i = 0; i < shape.length; i++) {
index += shift * indices[i];
shift *= shape[i];
}
return index;
} | java | public static long sub2Ind(int[] shape, int[] indices) {
long index = 0;
int shift = 1;
for (int i = 0; i < shape.length; i++) {
index += shift * indices[i];
shift *= shape[i];
}
return index;
} | [
"public",
"static",
"long",
"sub2Ind",
"(",
"int",
"[",
"]",
"shape",
",",
"int",
"[",
"]",
"indices",
")",
"{",
"long",
"index",
"=",
"0",
";",
"int",
"shift",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shape",
".",
"le... | Convert the given index (such as 1,1)
to a linear index
@param shape the shape of the indexes to convert
@param indices the index to convert
@return the linear index given the shape
and indices | [
"Convert",
"the",
"given",
"index",
"(",
"such",
"as",
"1",
"1",
")",
"to",
"a",
"linear",
"index"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2245-L2253 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java | PositionAlignmentOptions.setHorizontalAlignment | public PositionAlignmentOptions setHorizontalAlignment(PositionRelation horizontalAlignment, int offsetLeft) {
"""
Set the horizontalAlignment property with an offset. One of LEFT, CENTER, RIGHT.
@param horizontalAlignment
@param offsetLeft
@return the instance
"""
switch (horizontalAlignment)
{
case LEFT:
case CENTER:
case RIGHT:
break;
default:
throw new IllegalArgumentException("Illegal value for the horizontal alignment property");
}
this.horizontalAlignment = horizontalAlignment;
this.offsetLeft = offsetLeft;
return this;
} | java | public PositionAlignmentOptions setHorizontalAlignment(PositionRelation horizontalAlignment, int offsetLeft)
{
switch (horizontalAlignment)
{
case LEFT:
case CENTER:
case RIGHT:
break;
default:
throw new IllegalArgumentException("Illegal value for the horizontal alignment property");
}
this.horizontalAlignment = horizontalAlignment;
this.offsetLeft = offsetLeft;
return this;
} | [
"public",
"PositionAlignmentOptions",
"setHorizontalAlignment",
"(",
"PositionRelation",
"horizontalAlignment",
",",
"int",
"offsetLeft",
")",
"{",
"switch",
"(",
"horizontalAlignment",
")",
"{",
"case",
"LEFT",
":",
"case",
"CENTER",
":",
"case",
"RIGHT",
":",
"bre... | Set the horizontalAlignment property with an offset. One of LEFT, CENTER, RIGHT.
@param horizontalAlignment
@param offsetLeft
@return the instance | [
"Set",
"the",
"horizontalAlignment",
"property",
"with",
"an",
"offset",
".",
"One",
"of",
"LEFT",
"CENTER",
"RIGHT",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java#L208-L223 |
glyptodon/guacamole-client | extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/RadiusConnectionService.java | RadiusConnectionService.createRadiusConnection | private RadiusClient createRadiusConnection() throws GuacamoleException {
"""
Creates a new instance of RadiusClient, configured with parameters
from guacamole.properties.
@return
A RadiusClient instance, configured with server, shared secret,
ports, and timeout, as configured in guacamole.properties.
@throws GuacamoleException
If an error occurs while parsing guacamole.properties, or if the
configuration of RadiusClient fails.
"""
// Create the RADIUS client with the configuration parameters
try {
return new RadiusClient(InetAddress.getByName(confService.getRadiusServer()),
confService.getRadiusSharedSecret(),
confService.getRadiusAuthPort(),
confService.getRadiusAcctPort(),
confService.getRadiusTimeout());
}
catch (UnknownHostException e) {
logger.debug("Failed to resolve host.", e);
throw new GuacamoleServerException("Unable to resolve RADIUS server host.", e);
}
catch (IOException e) {
logger.debug("Failed to communicate with host.", e);
throw new GuacamoleServerException("Failed to communicate with RADIUS server.", e);
}
} | java | private RadiusClient createRadiusConnection() throws GuacamoleException {
// Create the RADIUS client with the configuration parameters
try {
return new RadiusClient(InetAddress.getByName(confService.getRadiusServer()),
confService.getRadiusSharedSecret(),
confService.getRadiusAuthPort(),
confService.getRadiusAcctPort(),
confService.getRadiusTimeout());
}
catch (UnknownHostException e) {
logger.debug("Failed to resolve host.", e);
throw new GuacamoleServerException("Unable to resolve RADIUS server host.", e);
}
catch (IOException e) {
logger.debug("Failed to communicate with host.", e);
throw new GuacamoleServerException("Failed to communicate with RADIUS server.", e);
}
} | [
"private",
"RadiusClient",
"createRadiusConnection",
"(",
")",
"throws",
"GuacamoleException",
"{",
"// Create the RADIUS client with the configuration parameters",
"try",
"{",
"return",
"new",
"RadiusClient",
"(",
"InetAddress",
".",
"getByName",
"(",
"confService",
".",
"... | Creates a new instance of RadiusClient, configured with parameters
from guacamole.properties.
@return
A RadiusClient instance, configured with server, shared secret,
ports, and timeout, as configured in guacamole.properties.
@throws GuacamoleException
If an error occurs while parsing guacamole.properties, or if the
configuration of RadiusClient fails. | [
"Creates",
"a",
"new",
"instance",
"of",
"RadiusClient",
"configured",
"with",
"parameters",
"from",
"guacamole",
".",
"properties",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/RadiusConnectionService.java#L79-L98 |
playn/playn | scene/src/playn/scene/Layer.java | Layer.absorbHits | public Layer absorbHits () {
"""
Configures a hit tester for this layer which hits this layer any time a hit does not hit a
child of this layer. This absorbs all hits that would otherwise propagate up to this layer's
parent. Note that this does not do any calculations to determine whether the hit is within the
bounds of this layer, as those may or may not be known. <em>All</em> all hits that are checked
against this layer are absorbed.
"""
return setHitTester(new Layer.HitTester() {
public Layer hitTest (Layer layer, Point p) {
Layer hit = hitTestDefault(p);
return (hit == null) ? Layer.this : hit;
}
@Override public String toString () { return "<all>"; }
});
} | java | public Layer absorbHits () {
return setHitTester(new Layer.HitTester() {
public Layer hitTest (Layer layer, Point p) {
Layer hit = hitTestDefault(p);
return (hit == null) ? Layer.this : hit;
}
@Override public String toString () { return "<all>"; }
});
} | [
"public",
"Layer",
"absorbHits",
"(",
")",
"{",
"return",
"setHitTester",
"(",
"new",
"Layer",
".",
"HitTester",
"(",
")",
"{",
"public",
"Layer",
"hitTest",
"(",
"Layer",
"layer",
",",
"Point",
"p",
")",
"{",
"Layer",
"hit",
"=",
"hitTestDefault",
"(",
... | Configures a hit tester for this layer which hits this layer any time a hit does not hit a
child of this layer. This absorbs all hits that would otherwise propagate up to this layer's
parent. Note that this does not do any calculations to determine whether the hit is within the
bounds of this layer, as those may or may not be known. <em>All</em> all hits that are checked
against this layer are absorbed. | [
"Configures",
"a",
"hit",
"tester",
"for",
"this",
"layer",
"which",
"hits",
"this",
"layer",
"any",
"time",
"a",
"hit",
"does",
"not",
"hit",
"a",
"child",
"of",
"this",
"layer",
".",
"This",
"absorbs",
"all",
"hits",
"that",
"would",
"otherwise",
"prop... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/Layer.java#L684-L692 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.removeAll | @SafeVarargs
public static float[] removeAll(final float[] a, final float... elements) {
"""
Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection)
"""
if (N.isNullOrEmpty(a)) {
return N.EMPTY_FLOAT_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final FloatList list = FloatList.of(a.clone());
list.removeAll(FloatList.of(elements));
return list.trimToSize().array();
} | java | @SafeVarargs
public static float[] removeAll(final float[] a, final float... elements) {
if (N.isNullOrEmpty(a)) {
return N.EMPTY_FLOAT_ARRAY;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final FloatList list = FloatList.of(a.clone());
list.removeAll(FloatList.of(elements));
return list.trimToSize().array();
} | [
"@",
"SafeVarargs",
"public",
"static",
"float",
"[",
"]",
"removeAll",
"(",
"final",
"float",
"[",
"]",
"a",
",",
"final",
"float",
"...",
"elements",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
"N",
".",
"EM... | Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection) | [
"Returns",
"a",
"new",
"array",
"with",
"removes",
"all",
"the",
"occurrences",
"of",
"specified",
"elements",
"from",
"<code",
">",
"a<",
"/",
"code",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23489-L23502 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.examplesMethodWithServiceResponseAsync | public Observable<ServiceResponse<List<LabelTextObject>>> examplesMethodWithServiceResponseAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) {
"""
Gets the utterances for the given model in the given app version.
@param appId The application ID.
@param versionId The version ID.
@param modelId The ID (GUID) of the model.
@param examplesMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<LabelTextObject> object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (modelId == null) {
throw new IllegalArgumentException("Parameter modelId is required and cannot be null.");
}
final Integer skip = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.skip() : null;
final Integer take = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.take() : null;
return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, skip, take);
} | java | public Observable<ServiceResponse<List<LabelTextObject>>> examplesMethodWithServiceResponseAsync(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (modelId == null) {
throw new IllegalArgumentException("Parameter modelId is required and cannot be null.");
}
final Integer skip = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.skip() : null;
final Integer take = examplesMethodOptionalParameter != null ? examplesMethodOptionalParameter.take() : null;
return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, skip, take);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"LabelTextObject",
">",
">",
">",
"examplesMethodWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"String",
"modelId",
",",
"ExamplesMethodOptionalParameter",
"examplesMet... | Gets the utterances for the given model in the given app version.
@param appId The application ID.
@param versionId The version ID.
@param modelId The ID (GUID) of the model.
@param examplesMethodOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<LabelTextObject> object | [
"Gets",
"the",
"utterances",
"for",
"the",
"given",
"model",
"in",
"the",
"given",
"app",
"version",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2672-L2689 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.notZero | public static void notZero(final Integer input, final String inputName) {
"""
Checks that the input value is non-zero
@param input the input to check
@param inputName the name of the input
@throws IllegalArgumentException if input is null or if the input is zero
"""
notNull(input, inputName);
if (input == 0) {
throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero");
}
} | java | public static void notZero(final Integer input, final String inputName) {
notNull(input, inputName);
if (input == 0) {
throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero");
}
} | [
"public",
"static",
"void",
"notZero",
"(",
"final",
"Integer",
"input",
",",
"final",
"String",
"inputName",
")",
"{",
"notNull",
"(",
"input",
",",
"inputName",
")",
";",
"if",
"(",
"input",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Checks that the input value is non-zero
@param input the input to check
@param inputName the name of the input
@throws IllegalArgumentException if input is null or if the input is zero | [
"Checks",
"that",
"the",
"input",
"value",
"is",
"non",
"-",
"zero"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L177-L183 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/adaptor/ESAAdaptor.java | ESAAdaptor.isScript | private static boolean isScript(String base, ZipFile zip) {
"""
Look for matching *.bat files in zip file. If there is then assume it is a script
@return true if matching *.bat file is found, false otherwise.
"""
Enumeration<? extends ZipEntry> files = zip.entries();
while (files.hasMoreElements()) {
ZipEntry f = files.nextElement();
if ((f.getName()).equals(base + ".bat") || (f.getName()).contains("/" + base + ".bat")) {
return true;
}
}
return false;
} | java | private static boolean isScript(String base, ZipFile zip) {
Enumeration<? extends ZipEntry> files = zip.entries();
while (files.hasMoreElements()) {
ZipEntry f = files.nextElement();
if ((f.getName()).equals(base + ".bat") || (f.getName()).contains("/" + base + ".bat")) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isScript",
"(",
"String",
"base",
",",
"ZipFile",
"zip",
")",
"{",
"Enumeration",
"<",
"?",
"extends",
"ZipEntry",
">",
"files",
"=",
"zip",
".",
"entries",
"(",
")",
";",
"while",
"(",
"files",
".",
"hasMoreElements",
"(... | Look for matching *.bat files in zip file. If there is then assume it is a script
@return true if matching *.bat file is found, false otherwise. | [
"Look",
"for",
"matching",
"*",
".",
"bat",
"files",
"in",
"zip",
"file",
".",
"If",
"there",
"is",
"then",
"assume",
"it",
"is",
"a",
"script"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/adaptor/ESAAdaptor.java#L682-L691 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java | RuleBasedPluralizer.pluralize | public String pluralize(String word, int number) {
"""
{@inheritDoc}
<p>
Converts a noun or pronoun to its plural form for the given number of instances. If
<code>number</code> is 1, <code>word</code> is returned unchanged.
</p>
<p>
The return value is not defined if this method is passed a plural form.
</p>
"""
if (number == 1) { return word; }
Matcher matcher = pattern.matcher(word);
if (matcher.matches()) {
String pre = matcher.group(1);
String trimmedWord = matcher.group(2);
String post = matcher.group(3);
String plural = pluralizeInternal(trimmedWord);
if (plural == null) { return fallbackPluralizer.pluralize(word, number); }
return pre + postProcess(trimmedWord, plural) + post;
}
return word;
} | java | public String pluralize(String word, int number) {
if (number == 1) { return word; }
Matcher matcher = pattern.matcher(word);
if (matcher.matches()) {
String pre = matcher.group(1);
String trimmedWord = matcher.group(2);
String post = matcher.group(3);
String plural = pluralizeInternal(trimmedWord);
if (plural == null) { return fallbackPluralizer.pluralize(word, number); }
return pre + postProcess(trimmedWord, plural) + post;
}
return word;
} | [
"public",
"String",
"pluralize",
"(",
"String",
"word",
",",
"int",
"number",
")",
"{",
"if",
"(",
"number",
"==",
"1",
")",
"{",
"return",
"word",
";",
"}",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"word",
")",
";",
"if",
"(",
"m... | {@inheritDoc}
<p>
Converts a noun or pronoun to its plural form for the given number of instances. If
<code>number</code> is 1, <code>word</code> is returned unchanged.
</p>
<p>
The return value is not defined if this method is passed a plural form.
</p> | [
"{"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java#L193-L205 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.minByDouble | public OptionalInt minByDouble(IntToDoubleFunction keyExtractor) {
"""
Returns the minimum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalInt} describing some element of this stream for
which the lowest value was returned by key extractor, or an empty
{@code OptionalInt} if the stream is empty
@since 0.1.2
"""
return collect(PrimitiveBox::new, (box, i) -> {
double key = keyExtractor.applyAsDouble(i);
if (!box.b || Double.compare(box.d, key) > 0) {
box.b = true;
box.d = key;
box.i = i;
}
}, PrimitiveBox.MIN_DOUBLE).asInt();
} | java | public OptionalInt minByDouble(IntToDoubleFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
double key = keyExtractor.applyAsDouble(i);
if (!box.b || Double.compare(box.d, key) > 0) {
box.b = true;
box.d = key;
box.i = i;
}
}, PrimitiveBox.MIN_DOUBLE).asInt();
} | [
"public",
"OptionalInt",
"minByDouble",
"(",
"IntToDoubleFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"i",
")",
"->",
"{",
"double",
"key",
"=",
"keyExtractor",
".",
"applyAsDouble",
"(",
"... | Returns the minimum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalInt} describing some element of this stream for
which the lowest value was returned by key extractor, or an empty
{@code OptionalInt} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"minimum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1061-L1070 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.createMediaResource | public CreateMediaResourceResponse createMediaResource(
String title,
String description,
File file,
String transcodingPresetGroupName,
int priority)
throws FileNotFoundException {
"""
Uploads the specified file to Bos under the specified bucket and key name.
@param title media title.
@param description media description.
@param file The file containing the data to be uploaded to VOD.
@param transcodingPresetGroupName set transcoding presetgroup name, if NULL, use default
@param priority set transcoding priority[0,9], lowest priority is 0. Only effect your own task
@return A PutObjectResponse object containing the information returned by Bos for the newly created object.
@throws FileNotFoundException
"""
return createMediaResource(title, description, file, transcodingPresetGroupName, priority, null);
} | java | public CreateMediaResourceResponse createMediaResource(
String title,
String description,
File file,
String transcodingPresetGroupName,
int priority)
throws FileNotFoundException {
return createMediaResource(title, description, file, transcodingPresetGroupName, priority, null);
} | [
"public",
"CreateMediaResourceResponse",
"createMediaResource",
"(",
"String",
"title",
",",
"String",
"description",
",",
"File",
"file",
",",
"String",
"transcodingPresetGroupName",
",",
"int",
"priority",
")",
"throws",
"FileNotFoundException",
"{",
"return",
"create... | Uploads the specified file to Bos under the specified bucket and key name.
@param title media title.
@param description media description.
@param file The file containing the data to be uploaded to VOD.
@param transcodingPresetGroupName set transcoding presetgroup name, if NULL, use default
@param priority set transcoding priority[0,9], lowest priority is 0. Only effect your own task
@return A PutObjectResponse object containing the information returned by Bos for the newly created object.
@throws FileNotFoundException | [
"Uploads",
"the",
"specified",
"file",
"to",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L206-L214 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updateSharedAccess | public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess) throws ApiException {
"""
Reserved: Sets the shared access information for users.
Reserved: Sets the shared access information for one or more users.
@param accountId The external account number (int) or account ID Guid. (required)
@param accountSharedAccess (optional)
@return AccountSharedAccess
"""
return updateSharedAccess(accountId, accountSharedAccess, null);
} | java | public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess) throws ApiException {
return updateSharedAccess(accountId, accountSharedAccess, null);
} | [
"public",
"AccountSharedAccess",
"updateSharedAccess",
"(",
"String",
"accountId",
",",
"AccountSharedAccess",
"accountSharedAccess",
")",
"throws",
"ApiException",
"{",
"return",
"updateSharedAccess",
"(",
"accountId",
",",
"accountSharedAccess",
",",
"null",
")",
";",
... | Reserved: Sets the shared access information for users.
Reserved: Sets the shared access information for one or more users.
@param accountId The external account number (int) or account ID Guid. (required)
@param accountSharedAccess (optional)
@return AccountSharedAccess | [
"Reserved",
":",
"Sets",
"the",
"shared",
"access",
"information",
"for",
"users",
".",
"Reserved",
":",
"Sets",
"the",
"shared",
"access",
"information",
"for",
"one",
"or",
"more",
"users",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L3043-L3045 |
Pi4J/pi4j | pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java | DacGpioProviderBase.setValue | @Override
public void setValue(Pin pin, Number value) {
"""
Set the requested analog output pin's conversion value.
@param pin to get conversion values for
@param value analog output pin conversion value
"""
super.setValue(pin, value.doubleValue());
} | java | @Override
public void setValue(Pin pin, Number value) {
super.setValue(pin, value.doubleValue());
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"Pin",
"pin",
",",
"Number",
"value",
")",
"{",
"super",
".",
"setValue",
"(",
"pin",
",",
"value",
".",
"doubleValue",
"(",
")",
")",
";",
"}"
] | Set the requested analog output pin's conversion value.
@param pin to get conversion values for
@param value analog output pin conversion value | [
"Set",
"the",
"requested",
"analog",
"output",
"pin",
"s",
"conversion",
"value",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/DacGpioProviderBase.java#L111-L114 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getKerasLayerFromConfig | public static KerasLayer getKerasLayerFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf,
Map<String, Class<? extends KerasLayer>> customLayers,
Map<String, SameDiffLambdaLayer> lambdaLayers,
Map<String, ? extends KerasLayer> previousLayers)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
"""
Build KerasLayer from a Keras layer configuration.
@param layerConfig map containing Keras layer properties
@return KerasLayer
@see Layer
"""
return getKerasLayerFromConfig(layerConfig, false, conf, customLayers, lambdaLayers, previousLayers);
} | java | public static KerasLayer getKerasLayerFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf,
Map<String, Class<? extends KerasLayer>> customLayers,
Map<String, SameDiffLambdaLayer> lambdaLayers,
Map<String, ? extends KerasLayer> previousLayers)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
return getKerasLayerFromConfig(layerConfig, false, conf, customLayers, lambdaLayers, previousLayers);
} | [
"public",
"static",
"KerasLayer",
"getKerasLayerFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"KerasLayer",
">",
">",
"customLayers... | Build KerasLayer from a Keras layer configuration.
@param layerConfig map containing Keras layer properties
@return KerasLayer
@see Layer | [
"Build",
"KerasLayer",
"from",
"a",
"Keras",
"layer",
"configuration",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L160-L167 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/style/TableCellStyleBuilder.java | TableCellStyleBuilder.borderRight | public TableCellStyleBuilder borderRight(final Length size, final Color borderColor,
final BorderAttribute.Style style) {
"""
Add a border style for the right border of this cell.
@param size the size of the line
@param borderColor the color to be used in format #rrggbb e.g. '#ff0000' for a red border
@param style the style of the border line, either BorderAttribute.BORDER_SOLID or BorderAttribute.BORDER_DOUBLE
@return this for fluent style
"""
final BorderAttribute bs = new BorderAttribute(size, borderColor, style);
this.bordersBuilder.right(bs);
return this;
} | java | public TableCellStyleBuilder borderRight(final Length size, final Color borderColor,
final BorderAttribute.Style style) {
final BorderAttribute bs = new BorderAttribute(size, borderColor, style);
this.bordersBuilder.right(bs);
return this;
} | [
"public",
"TableCellStyleBuilder",
"borderRight",
"(",
"final",
"Length",
"size",
",",
"final",
"Color",
"borderColor",
",",
"final",
"BorderAttribute",
".",
"Style",
"style",
")",
"{",
"final",
"BorderAttribute",
"bs",
"=",
"new",
"BorderAttribute",
"(",
"size",
... | Add a border style for the right border of this cell.
@param size the size of the line
@param borderColor the color to be used in format #rrggbb e.g. '#ff0000' for a red border
@param style the style of the border line, either BorderAttribute.BORDER_SOLID or BorderAttribute.BORDER_DOUBLE
@return this for fluent style | [
"Add",
"a",
"border",
"style",
"for",
"the",
"right",
"border",
"of",
"this",
"cell",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/style/TableCellStyleBuilder.java#L143-L148 |
akquinet/needle | src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java | ReflectionUtil.getFieldValue | public static Object getFieldValue(final Object object, final Class<?> clazz, final String fieldName) {
"""
Get the value of a given field on a given object via reflection.
@param object
-- target object of field access
@param clazz
-- type of argument object
@param fieldName
-- name of the field
@return -- the value of the represented field in object; primitive values
are wrapped in an appropriate object before being returned
"""
try {
final Field field = clazz.getDeclaredField(fieldName);
return getFieldValue(object, field);
} catch (final Exception e) {
throw new IllegalArgumentException("Could not get field value: " + fieldName, e);
}
} | java | public static Object getFieldValue(final Object object, final Class<?> clazz, final String fieldName) {
try {
final Field field = clazz.getDeclaredField(fieldName);
return getFieldValue(object, field);
} catch (final Exception e) {
throw new IllegalArgumentException("Could not get field value: " + fieldName, e);
}
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"final",
"Object",
"object",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"fieldName",
")",
"{",
"try",
"{",
"final",
"Field",
"field",
"=",
"clazz",
".",
"getDeclaredField",
"("... | Get the value of a given field on a given object via reflection.
@param object
-- target object of field access
@param clazz
-- type of argument object
@param fieldName
-- name of the field
@return -- the value of the represented field in object; primitive values
are wrapped in an appropriate object before being returned | [
"Get",
"the",
"value",
"of",
"a",
"given",
"field",
"on",
"a",
"given",
"object",
"via",
"reflection",
"."
] | train | https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L235-L242 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java | CachingXmlDataStore.createCachingXmlDataStore | @Nonnull
public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final URL dataUrl, @Nonnull final URL versionURL, @Nonnull final DataStore fallback) {
"""
Constructs a new instance of {@code CachingXmlDataStore} with the given arguments. The given {@code cacheFile}
can be empty or filled with previously cached data in XML format. The file must be writable otherwise an
exception will be thrown.
@param dataUrl
URL for online version of <em>UAS data</em>
@param versionURL
URL for version information of online <em>UAS data</em>
@param fallback
<em>UAS data</em> as fallback in case the data on the specified resource can not be read correctly
@return new instance of {@link CachingXmlDataStore}
@throws net.sf.qualitycheck.exception.IllegalNullArgumentException
if one of the given arguments is {@code null}
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if the given cache file can not be read
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if no URL can be resolved to the given given file
"""
return createCachingXmlDataStore(findOrCreateCacheFile(), dataUrl, versionURL, DEFAULT_CHARSET,
fallback);
} | java | @Nonnull
public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final URL dataUrl, @Nonnull final URL versionURL, @Nonnull final DataStore fallback) {
return createCachingXmlDataStore(findOrCreateCacheFile(), dataUrl, versionURL, DEFAULT_CHARSET,
fallback);
} | [
"@",
"Nonnull",
"public",
"static",
"CachingXmlDataStore",
"createCachingXmlDataStore",
"(",
"@",
"Nonnull",
"final",
"URL",
"dataUrl",
",",
"@",
"Nonnull",
"final",
"URL",
"versionURL",
",",
"@",
"Nonnull",
"final",
"DataStore",
"fallback",
")",
"{",
"return",
... | Constructs a new instance of {@code CachingXmlDataStore} with the given arguments. The given {@code cacheFile}
can be empty or filled with previously cached data in XML format. The file must be writable otherwise an
exception will be thrown.
@param dataUrl
URL for online version of <em>UAS data</em>
@param versionURL
URL for version information of online <em>UAS data</em>
@param fallback
<em>UAS data</em> as fallback in case the data on the specified resource can not be read correctly
@return new instance of {@link CachingXmlDataStore}
@throws net.sf.qualitycheck.exception.IllegalNullArgumentException
if one of the given arguments is {@code null}
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if the given cache file can not be read
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if no URL can be resolved to the given given file | [
"Constructs",
"a",
"new",
"instance",
"of",
"{",
"@code",
"CachingXmlDataStore",
"}",
"with",
"the",
"given",
"arguments",
".",
"The",
"given",
"{",
"@code",
"cacheFile",
"}",
"can",
"be",
"empty",
"or",
"filled",
"with",
"previously",
"cached",
"data",
"in"... | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java#L115-L119 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.getTextSize | public Rectangle getTextSize(String text, Font font) {
"""
Return the text box for the specified text and font.
@param text text
@param font font
@return text box
"""
template.saveState();
// get the font
DefaultFontMapper mapper = new DefaultFontMapper();
BaseFont bf = mapper.awtToPdf(font);
template.setFontAndSize(bf, font.getSize());
// calculate text width and height
float textWidth = template.getEffectiveStringWidth(text, false);
float ascent = bf.getAscentPoint(text, font.getSize());
float descent = bf.getDescentPoint(text, font.getSize());
float textHeight = ascent - descent;
template.restoreState();
return new Rectangle(0, 0, textWidth, textHeight);
} | java | public Rectangle getTextSize(String text, Font font) {
template.saveState();
// get the font
DefaultFontMapper mapper = new DefaultFontMapper();
BaseFont bf = mapper.awtToPdf(font);
template.setFontAndSize(bf, font.getSize());
// calculate text width and height
float textWidth = template.getEffectiveStringWidth(text, false);
float ascent = bf.getAscentPoint(text, font.getSize());
float descent = bf.getDescentPoint(text, font.getSize());
float textHeight = ascent - descent;
template.restoreState();
return new Rectangle(0, 0, textWidth, textHeight);
} | [
"public",
"Rectangle",
"getTextSize",
"(",
"String",
"text",
",",
"Font",
"font",
")",
"{",
"template",
".",
"saveState",
"(",
")",
";",
"// get the font",
"DefaultFontMapper",
"mapper",
"=",
"new",
"DefaultFontMapper",
"(",
")",
";",
"BaseFont",
"bf",
"=",
... | Return the text box for the specified text and font.
@param text text
@param font font
@return text box | [
"Return",
"the",
"text",
"box",
"for",
"the",
"specified",
"text",
"and",
"font",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L137-L150 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java | RandomAccessListIterate.detectIndexWith | public static <T, IV> int detectIndexWith(List<T> list, Predicate2<? super T, ? super IV> predicate, IV injectedValue) {
"""
Searches for the first occurrence where the predicate evaluates to true.
@see Iterate#detectIndexWith(Iterable, Predicate2, Object)
"""
int size = list.size();
for (int i = 0; i < size; i++)
{
if (predicate.accept(list.get(i), injectedValue))
{
return i;
}
}
return -1;
} | java | public static <T, IV> int detectIndexWith(List<T> list, Predicate2<? super T, ? super IV> predicate, IV injectedValue)
{
int size = list.size();
for (int i = 0; i < size; i++)
{
if (predicate.accept(list.get(i), injectedValue))
{
return i;
}
}
return -1;
} | [
"public",
"static",
"<",
"T",
",",
"IV",
">",
"int",
"detectIndexWith",
"(",
"List",
"<",
"T",
">",
"list",
",",
"Predicate2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"IV",
">",
"predicate",
",",
"IV",
"injectedValue",
")",
"{",
"int",
"size",
"... | Searches for the first occurrence where the predicate evaluates to true.
@see Iterate#detectIndexWith(Iterable, Predicate2, Object) | [
"Searches",
"for",
"the",
"first",
"occurrence",
"where",
"the",
"predicate",
"evaluates",
"to",
"true",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L1148-L1159 |
tweea/matrixjavalib-main-web | src/main/java/net/matrix/web/html/HTMLs.java | HTMLs.fitToLength | public static String fitToLength(final String html, final int length) {
"""
将 HTML 文本适配到指定长度。
@param html
HTML 文本
@param length
目标长度
@return 适配结果
"""
if (html == null) {
return StringUtils.repeat(SPACE, length);
}
int len = html.length();
if (len >= length) {
return html;
}
StringBuilder sb = new StringBuilder();
sb.append(html);
for (int i = 0; i < length - len; i++) {
sb.append(SPACE);
}
return sb.toString();
} | java | public static String fitToLength(final String html, final int length) {
if (html == null) {
return StringUtils.repeat(SPACE, length);
}
int len = html.length();
if (len >= length) {
return html;
}
StringBuilder sb = new StringBuilder();
sb.append(html);
for (int i = 0; i < length - len; i++) {
sb.append(SPACE);
}
return sb.toString();
} | [
"public",
"static",
"String",
"fitToLength",
"(",
"final",
"String",
"html",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"html",
"==",
"null",
")",
"{",
"return",
"StringUtils",
".",
"repeat",
"(",
"SPACE",
",",
"length",
")",
";",
"}",
"int",
... | 将 HTML 文本适配到指定长度。
@param html
HTML 文本
@param length
目标长度
@return 适配结果 | [
"将",
"HTML",
"文本适配到指定长度。"
] | train | https://github.com/tweea/matrixjavalib-main-web/blob/c3386e728e6f97ff3a3d2cd94769e82840b1266f/src/main/java/net/matrix/web/html/HTMLs.java#L33-L48 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeSetter | public static void invokeSetter(Object object, String fieldName, Object value, boolean ignoreNonExisting) {
"""
invokes the setter on the filed
@param object
@param field
@return
"""
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
if(null == field) {
if (ignoreNonExisting) {
return;
} else {
throw new NullPointerException("no field with name " + fieldName + " found on output object. ignoreNonExisting was " + ignoreNonExisting);
}
}
invokeSetter(object, field, value, ignoreNonExisting);
} | java | public static void invokeSetter(Object object, String fieldName, Object value, boolean ignoreNonExisting)
{
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
if(null == field) {
if (ignoreNonExisting) {
return;
} else {
throw new NullPointerException("no field with name " + fieldName + " found on output object. ignoreNonExisting was " + ignoreNonExisting);
}
}
invokeSetter(object, field, value, ignoreNonExisting);
} | [
"public",
"static",
"void",
"invokeSetter",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Object",
"value",
",",
"boolean",
"ignoreNonExisting",
")",
"{",
"Field",
"field",
"=",
"ReflectionUtils",
".",
"findField",
"(",
"object",
".",
"getClass",
... | invokes the setter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"setter",
"on",
"the",
"filed"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L180-L191 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java | OpenSslX509KeyManagerFactory.newEngineBased | public static OpenSslX509KeyManagerFactory newEngineBased(File certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
"""
Create a new initialized {@link OpenSslX509KeyManagerFactory} which loads its {@link PrivateKey} directly from
an {@code OpenSSL engine} via the
<a href="https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_load_private_key.html">ENGINE_load_private_key</a>
function.
"""
return newEngineBased(SslContext.toX509Certificates(certificateChain), password);
} | java | public static OpenSslX509KeyManagerFactory newEngineBased(File certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
return newEngineBased(SslContext.toX509Certificates(certificateChain), password);
} | [
"public",
"static",
"OpenSslX509KeyManagerFactory",
"newEngineBased",
"(",
"File",
"certificateChain",
",",
"String",
"password",
")",
"throws",
"CertificateException",
",",
"IOException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"UnrecoverableKeyExcept... | Create a new initialized {@link OpenSslX509KeyManagerFactory} which loads its {@link PrivateKey} directly from
an {@code OpenSSL engine} via the
<a href="https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_load_private_key.html">ENGINE_load_private_key</a>
function. | [
"Create",
"a",
"new",
"initialized",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L240-L244 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.mergeCompleted | private void mergeCompleted(SegmentProperties segmentProperties, UpdateableSegmentMetadata transactionMetadata, MergeSegmentOperation mergeOp) {
"""
Executes post-Storage merge tasks, including state and metadata updates.
"""
// We have processed a MergeSegmentOperation, pop the first operation off and decrement the counter.
StorageOperation processedOperation = this.operations.removeFirst();
assert processedOperation != null && processedOperation instanceof MergeSegmentOperation : "First outstanding operation was not a MergeSegmentOperation";
MergeSegmentOperation mop = (MergeSegmentOperation) processedOperation;
assert mop.getSourceSegmentId() == transactionMetadata.getId() : "First outstanding operation was a MergeSegmentOperation for the wrong Transaction id.";
int newCount = this.mergeTransactionCount.decrementAndGet();
assert newCount >= 0 : "Negative value for mergeTransactionCount";
// Post-merger validation. Verify we are still in agreement with the storage.
long expectedNewLength = this.metadata.getStorageLength() + mergeOp.getLength();
if (segmentProperties.getLength() != expectedNewLength) {
throw new CompletionException(new DataCorruptionException(String.format(
"Transaction Segment '%s' was merged into parent '%s' but the parent segment has an unexpected StorageLength after the merger. Previous=%d, MergeLength=%d, Expected=%d, Actual=%d",
transactionMetadata.getName(),
this.metadata.getName(),
segmentProperties.getLength(),
mergeOp.getLength(),
expectedNewLength,
segmentProperties.getLength())));
}
updateMetadata(segmentProperties);
updateMetadataForTransactionPostMerger(transactionMetadata, mop.getStreamSegmentId());
} | java | private void mergeCompleted(SegmentProperties segmentProperties, UpdateableSegmentMetadata transactionMetadata, MergeSegmentOperation mergeOp) {
// We have processed a MergeSegmentOperation, pop the first operation off and decrement the counter.
StorageOperation processedOperation = this.operations.removeFirst();
assert processedOperation != null && processedOperation instanceof MergeSegmentOperation : "First outstanding operation was not a MergeSegmentOperation";
MergeSegmentOperation mop = (MergeSegmentOperation) processedOperation;
assert mop.getSourceSegmentId() == transactionMetadata.getId() : "First outstanding operation was a MergeSegmentOperation for the wrong Transaction id.";
int newCount = this.mergeTransactionCount.decrementAndGet();
assert newCount >= 0 : "Negative value for mergeTransactionCount";
// Post-merger validation. Verify we are still in agreement with the storage.
long expectedNewLength = this.metadata.getStorageLength() + mergeOp.getLength();
if (segmentProperties.getLength() != expectedNewLength) {
throw new CompletionException(new DataCorruptionException(String.format(
"Transaction Segment '%s' was merged into parent '%s' but the parent segment has an unexpected StorageLength after the merger. Previous=%d, MergeLength=%d, Expected=%d, Actual=%d",
transactionMetadata.getName(),
this.metadata.getName(),
segmentProperties.getLength(),
mergeOp.getLength(),
expectedNewLength,
segmentProperties.getLength())));
}
updateMetadata(segmentProperties);
updateMetadataForTransactionPostMerger(transactionMetadata, mop.getStreamSegmentId());
} | [
"private",
"void",
"mergeCompleted",
"(",
"SegmentProperties",
"segmentProperties",
",",
"UpdateableSegmentMetadata",
"transactionMetadata",
",",
"MergeSegmentOperation",
"mergeOp",
")",
"{",
"// We have processed a MergeSegmentOperation, pop the first operation off and decrement the cou... | Executes post-Storage merge tasks, including state and metadata updates. | [
"Executes",
"post",
"-",
"Storage",
"merge",
"tasks",
"including",
"state",
"and",
"metadata",
"updates",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L987-L1011 |
softindex/datakernel | core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java | ByteBuf.getString | @Contract(pure = true)
public String getString(@NotNull Charset charset) {
"""
Returns a {@code String} created from this {@code ByteBuf} using given charset.
Does not recycle this {@code ByteBuf}.
@param charset charset which is used to create {@code String} from this {@code ByteBuf}.
@return {@code String} from this {@code ByteBuf} in a given charset.
"""
return new String(array, head, readRemaining(), charset);
} | java | @Contract(pure = true)
public String getString(@NotNull Charset charset) {
return new String(array, head, readRemaining(), charset);
} | [
"@",
"Contract",
"(",
"pure",
"=",
"true",
")",
"public",
"String",
"getString",
"(",
"@",
"NotNull",
"Charset",
"charset",
")",
"{",
"return",
"new",
"String",
"(",
"array",
",",
"head",
",",
"readRemaining",
"(",
")",
",",
"charset",
")",
";",
"}"
] | Returns a {@code String} created from this {@code ByteBuf} using given charset.
Does not recycle this {@code ByteBuf}.
@param charset charset which is used to create {@code String} from this {@code ByteBuf}.
@return {@code String} from this {@code ByteBuf} in a given charset. | [
"Returns",
"a",
"{",
"@code",
"String",
"}",
"created",
"from",
"this",
"{",
"@code",
"ByteBuf",
"}",
"using",
"given",
"charset",
".",
"Does",
"not",
"recycle",
"this",
"{",
"@code",
"ByteBuf",
"}",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L799-L802 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.lookaheadSequence | private boolean lookaheadSequence(boolean terminated, Token.Kind... kinds) {
"""
Attempt to match a given sequence of tokens in the given order, whilst
ignoring any whitespace in between. Note that, in any case, the index
will be unchanged!
@param terminated
Indicates whether or not this function should be concerned
with new lines. The terminated flag indicates whether or not
the current construct being parsed is known to be terminated.
If so, then we don't need to worry about newlines and can
greedily consume them (i.e. since we'll eventually run into
the terminating symbol).
@param kinds
@return whether the sequence matches
"""
int next = index;
for (Token.Kind k : kinds) {
next = terminated ? skipWhiteSpace(next) : skipLineSpace(next);
if (next >= tokens.size() || tokens.get(next++).kind != k) {
return false;
}
}
return true;
} | java | private boolean lookaheadSequence(boolean terminated, Token.Kind... kinds) {
int next = index;
for (Token.Kind k : kinds) {
next = terminated ? skipWhiteSpace(next) : skipLineSpace(next);
if (next >= tokens.size() || tokens.get(next++).kind != k) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"lookaheadSequence",
"(",
"boolean",
"terminated",
",",
"Token",
".",
"Kind",
"...",
"kinds",
")",
"{",
"int",
"next",
"=",
"index",
";",
"for",
"(",
"Token",
".",
"Kind",
"k",
":",
"kinds",
")",
"{",
"next",
"=",
"terminated",
"?... | Attempt to match a given sequence of tokens in the given order, whilst
ignoring any whitespace in between. Note that, in any case, the index
will be unchanged!
@param terminated
Indicates whether or not this function should be concerned
with new lines. The terminated flag indicates whether or not
the current construct being parsed is known to be terminated.
If so, then we don't need to worry about newlines and can
greedily consume them (i.e. since we'll eventually run into
the terminating symbol).
@param kinds
@return whether the sequence matches | [
"Attempt",
"to",
"match",
"a",
"given",
"sequence",
"of",
"tokens",
"in",
"the",
"given",
"order",
"whilst",
"ignoring",
"any",
"whitespace",
"in",
"between",
".",
"Note",
"that",
"in",
"any",
"case",
"the",
"index",
"will",
"be",
"unchanged!"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L4295-L4304 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/cellprocessor/format/ParseProcessor.java | ParseProcessor.checkPreconditions | private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) {
"""
コンスタによるインスタンスを生成する際の前提条件となる引数のチェックを行う。
@throws NullPointerException type or parser is null.
"""
if(type == null) {
throw new NullPointerException("type is null.");
}
if(parser == null) {
throw new NullPointerException("parser is null.");
}
} | java | private static <T> void checkPreconditions(final Class<T> type, final TextParser<T> parser) {
if(type == null) {
throw new NullPointerException("type is null.");
}
if(parser == null) {
throw new NullPointerException("parser is null.");
}
} | [
"private",
"static",
"<",
"T",
">",
"void",
"checkPreconditions",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"TextParser",
"<",
"T",
">",
"parser",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExcept... | コンスタによるインスタンスを生成する際の前提条件となる引数のチェックを行う。
@throws NullPointerException type or parser is null. | [
"コンスタによるインスタンスを生成する際の前提条件となる引数のチェックを行う。",
"@throws",
"NullPointerException",
"type",
"or",
"parser",
"is",
"null",
"."
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/cellprocessor/format/ParseProcessor.java#L43-L51 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.assertNotNull | public static void assertNotNull(final Object object, final String message) {
"""
Check that an object is null and throw NullPointerException in the case.
@param object an object to be checked
@param message message to be used as the exception message
@throws NullPointerException it will be thrown if the object is null
"""
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | java | public static void assertNotNull(final Object object, final String message) {
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | [
"public",
"static",
"void",
"assertNotNull",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
"==",
"null",
"?",
"\"Object is n... | Check that an object is null and throw NullPointerException in the case.
@param object an object to be checked
@param message message to be used as the exception message
@throws NullPointerException it will be thrown if the object is null | [
"Check",
"that",
"an",
"object",
"is",
"null",
"and",
"throw",
"NullPointerException",
"in",
"the",
"case",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L478-L482 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java | Configuration.setProperty | public void setProperty(String category, String key, Object value) {
"""
Sets a property in the configuration
@param category The category of the property
@param key The key to identify the property
@param value The value associated with it
"""
this.setProperty(category, key, value.toString());
} | java | public void setProperty(String category, String key, Object value) {
this.setProperty(category, key, value.toString());
} | [
"public",
"void",
"setProperty",
"(",
"String",
"category",
",",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"setProperty",
"(",
"category",
",",
"key",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Sets a property in the configuration
@param category The category of the property
@param key The key to identify the property
@param value The value associated with it | [
"Sets",
"a",
"property",
"in",
"the",
"configuration"
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L215-L217 |
mqlight/java-mqlight | mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/logback/LogbackLoggingImpl.java | LogbackLoggingImpl.createPatternLayoutEncoder | private static PatternLayoutEncoder createPatternLayoutEncoder(LoggerContext context, String patternProperty) {
"""
Creates a {@link PatternLayoutEncoder} for the pattern specified for the pattern property.
@param context Logger context to associate the pattern layout encoder with.
@param patternProperty Logger context property that contains the required pattern.
@return A {@link PatternLayoutEncoder} for the required pattern.
"""
final String pattern = context.getProperty(patternProperty);
final PatternLayoutEncoder patternLayoutEncoder = new PatternLayoutEncoder();
patternLayoutEncoder.setContext(context);
patternLayoutEncoder.setPattern(pattern);
patternLayoutEncoder.start();
return patternLayoutEncoder;
} | java | private static PatternLayoutEncoder createPatternLayoutEncoder(LoggerContext context, String patternProperty) {
final String pattern = context.getProperty(patternProperty);
final PatternLayoutEncoder patternLayoutEncoder = new PatternLayoutEncoder();
patternLayoutEncoder.setContext(context);
patternLayoutEncoder.setPattern(pattern);
patternLayoutEncoder.start();
return patternLayoutEncoder;
} | [
"private",
"static",
"PatternLayoutEncoder",
"createPatternLayoutEncoder",
"(",
"LoggerContext",
"context",
",",
"String",
"patternProperty",
")",
"{",
"final",
"String",
"pattern",
"=",
"context",
".",
"getProperty",
"(",
"patternProperty",
")",
";",
"final",
"Patter... | Creates a {@link PatternLayoutEncoder} for the pattern specified for the pattern property.
@param context Logger context to associate the pattern layout encoder with.
@param patternProperty Logger context property that contains the required pattern.
@return A {@link PatternLayoutEncoder} for the required pattern. | [
"Creates",
"a",
"{",
"@link",
"PatternLayoutEncoder",
"}",
"for",
"the",
"pattern",
"specified",
"for",
"the",
"pattern",
"property",
"."
] | train | https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/logback/LogbackLoggingImpl.java#L238-L245 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostconditionsD | public static double checkPostconditionsD(
final double value,
final ContractDoubleConditionType... conditions)
throws PostconditionViolationException {
"""
A {@code double} specialized version of {@link #checkPostconditions(Object,
ContractConditionType[])}
@param value The value
@param conditions The conditions the value must obey
@return value
@throws PostconditionViolationException If any of the conditions are false
"""
final Violations violations = innerCheckAllDouble(value, conditions);
if (violations != null) {
throw failed(null, Double.valueOf(value), violations);
}
return value;
} | java | public static double checkPostconditionsD(
final double value,
final ContractDoubleConditionType... conditions)
throws PostconditionViolationException
{
final Violations violations = innerCheckAllDouble(value, conditions);
if (violations != null) {
throw failed(null, Double.valueOf(value), violations);
}
return value;
} | [
"public",
"static",
"double",
"checkPostconditionsD",
"(",
"final",
"double",
"value",
",",
"final",
"ContractDoubleConditionType",
"...",
"conditions",
")",
"throws",
"PostconditionViolationException",
"{",
"final",
"Violations",
"violations",
"=",
"innerCheckAllDouble",
... | A {@code double} specialized version of {@link #checkPostconditions(Object,
ContractConditionType[])}
@param value The value
@param conditions The conditions the value must obey
@return value
@throws PostconditionViolationException If any of the conditions are false | [
"A",
"{",
"@code",
"double",
"}",
"specialized",
"version",
"of",
"{",
"@link",
"#checkPostconditions",
"(",
"Object",
"ContractConditionType",
"[]",
")",
"}"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L146-L156 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java | NullNotificationService.batchUpdate | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) {
"""
This applies a set of invalidations and new entries to this CacheUnit,
including the local internal cache and external caches registered
with this CacheUnit.
@param invalidateIdEvents A Vector of invalidate by id events.
@param invalidateTemplateEvents A Vector of invalidate by template events.
@param pushEntryEvents A Vector of cache entries.
""" //CCC
// nothing to do for NullNotification
} | java | public void batchUpdate(HashMap invalidateIdEvents, HashMap invalidateTemplateEvents, ArrayList pushEntryEvents, ArrayList aliasEntryEvents, CacheUnit cacheUnit) { //CCC
// nothing to do for NullNotification
} | [
"public",
"void",
"batchUpdate",
"(",
"HashMap",
"invalidateIdEvents",
",",
"HashMap",
"invalidateTemplateEvents",
",",
"ArrayList",
"pushEntryEvents",
",",
"ArrayList",
"aliasEntryEvents",
",",
"CacheUnit",
"cacheUnit",
")",
"{",
"//CCC",
"// nothing to do for NullNotifica... | This applies a set of invalidations and new entries to this CacheUnit,
including the local internal cache and external caches registered
with this CacheUnit.
@param invalidateIdEvents A Vector of invalidate by id events.
@param invalidateTemplateEvents A Vector of invalidate by template events.
@param pushEntryEvents A Vector of cache entries. | [
"This",
"applies",
"a",
"set",
"of",
"invalidations",
"and",
"new",
"entries",
"to",
"this",
"CacheUnit",
"including",
"the",
"local",
"internal",
"cache",
"and",
"external",
"caches",
"registered",
"with",
"this",
"CacheUnit",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/NullNotificationService.java#L35-L37 |
threerings/nenya | core/src/main/java/com/threerings/media/MediaPanel.java | MediaPanel.paintBits | protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) {
"""
Renders the sprites and animations that intersect the supplied dirty region in the specified
layer. Derived classes can override this method if they need to do custom sprite or
animation rendering (if they need to do special sprite z-order handling, for example). The
clipping region will already be set appropriately.
"""
_metamgr.paintMedia(gfx, layer, dirty);
} | java | protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty)
{
_metamgr.paintMedia(gfx, layer, dirty);
} | [
"protected",
"void",
"paintBits",
"(",
"Graphics2D",
"gfx",
",",
"int",
"layer",
",",
"Rectangle",
"dirty",
")",
"{",
"_metamgr",
".",
"paintMedia",
"(",
"gfx",
",",
"layer",
",",
"dirty",
")",
";",
"}"
] | Renders the sprites and animations that intersect the supplied dirty region in the specified
layer. Derived classes can override this method if they need to do custom sprite or
animation rendering (if they need to do special sprite z-order handling, for example). The
clipping region will already be set appropriately. | [
"Renders",
"the",
"sprites",
"and",
"animations",
"that",
"intersect",
"the",
"supplied",
"dirty",
"region",
"in",
"the",
"specified",
"layer",
".",
"Derived",
"classes",
"can",
"override",
"this",
"method",
"if",
"they",
"need",
"to",
"do",
"custom",
"sprite"... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MediaPanel.java#L548-L551 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/UpdateExpressionGenerator.java | UpdateExpressionGenerator.getBaseToken | private String getBaseToken(List<String> sortedNonKeyNonNullAttributeNames,
List<String> sortedNullValuedNonKeyAttributeNames) {
"""
Uses attribute names from sortedNonKeyNonNullAttributeNames and sortedNullValuedNonKeyAttributeNames to generate an {@link Adler32} checkSum
Adler32 generates checksum that is unique enough to be used as a token within an update item and faster to compute than CRC32.
"""
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
try {
for (String nonKeyNonNullAttributeName : sortedNonKeyNonNullAttributeNames) {
dataOutputStream.writeUTF(nonKeyNonNullAttributeName);
}
for (String nullValuedNonKeyAttributeName : sortedNullValuedNonKeyAttributeNames) {
dataOutputStream.writeUTF(nullValuedNonKeyAttributeName);
}
} catch (IOException e) {
throw new DynamoDBMappingException("Failed to process update operation inside transactionWrite request due to an IOException ", e);
}
Adler32 adler32 = new Adler32();
adler32.update(byteArrayOutputStream.toByteArray());
return Long.toHexString(adler32.getValue());
} | java | private String getBaseToken(List<String> sortedNonKeyNonNullAttributeNames,
List<String> sortedNullValuedNonKeyAttributeNames) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
try {
for (String nonKeyNonNullAttributeName : sortedNonKeyNonNullAttributeNames) {
dataOutputStream.writeUTF(nonKeyNonNullAttributeName);
}
for (String nullValuedNonKeyAttributeName : sortedNullValuedNonKeyAttributeNames) {
dataOutputStream.writeUTF(nullValuedNonKeyAttributeName);
}
} catch (IOException e) {
throw new DynamoDBMappingException("Failed to process update operation inside transactionWrite request due to an IOException ", e);
}
Adler32 adler32 = new Adler32();
adler32.update(byteArrayOutputStream.toByteArray());
return Long.toHexString(adler32.getValue());
} | [
"private",
"String",
"getBaseToken",
"(",
"List",
"<",
"String",
">",
"sortedNonKeyNonNullAttributeNames",
",",
"List",
"<",
"String",
">",
"sortedNullValuedNonKeyAttributeNames",
")",
"{",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream... | Uses attribute names from sortedNonKeyNonNullAttributeNames and sortedNullValuedNonKeyAttributeNames to generate an {@link Adler32} checkSum
Adler32 generates checksum that is unique enough to be used as a token within an update item and faster to compute than CRC32. | [
"Uses",
"attribute",
"names",
"from",
"sortedNonKeyNonNullAttributeNames",
"and",
"sortedNullValuedNonKeyAttributeNames",
"to",
"generate",
"an",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/UpdateExpressionGenerator.java#L179-L196 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.removeByG_T_E | @Override
public void removeByG_T_E(long groupId, String type, boolean enabled) {
"""
Removes all the commerce notification templates where groupId = ? and type = ? and enabled = ? from the database.
@param groupId the group ID
@param type the type
@param enabled the enabled
"""
for (CommerceNotificationTemplate commerceNotificationTemplate : findByG_T_E(
groupId, type, enabled, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
null)) {
remove(commerceNotificationTemplate);
}
} | java | @Override
public void removeByG_T_E(long groupId, String type, boolean enabled) {
for (CommerceNotificationTemplate commerceNotificationTemplate : findByG_T_E(
groupId, type, enabled, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
null)) {
remove(commerceNotificationTemplate);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_T_E",
"(",
"long",
"groupId",
",",
"String",
"type",
",",
"boolean",
"enabled",
")",
"{",
"for",
"(",
"CommerceNotificationTemplate",
"commerceNotificationTemplate",
":",
"findByG_T_E",
"(",
"groupId",
",",
"type",
","... | Removes all the commerce notification templates where groupId = ? and type = ? and enabled = ? from the database.
@param groupId the group ID
@param type the type
@param enabled the enabled | [
"Removes",
"all",
"the",
"commerce",
"notification",
"templates",
"where",
"groupId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"and",
"enabled",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L4279-L4286 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/Tools.java | Tools.Scale | public static double Scale(DoubleRange from, DoubleRange to, int x) {
"""
Converts the value x (which is measured in the scale 'from') to another value measured in the scale 'to'.
@param from Scale from.
@param to Scale to.
@param x Value.
@return Result.
"""
if (from.length() == 0) return 0;
return ((to.length()) * (x - from.getMin()) / from.length() + to.getMin());
} | java | public static double Scale(DoubleRange from, DoubleRange to, int x) {
if (from.length() == 0) return 0;
return ((to.length()) * (x - from.getMin()) / from.length() + to.getMin());
} | [
"public",
"static",
"double",
"Scale",
"(",
"DoubleRange",
"from",
",",
"DoubleRange",
"to",
",",
"int",
"x",
")",
"{",
"if",
"(",
"from",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"0",
";",
"return",
"(",
"(",
"to",
".",
"length",
"(",
... | Converts the value x (which is measured in the scale 'from') to another value measured in the scale 'to'.
@param from Scale from.
@param to Scale to.
@param x Value.
@return Result. | [
"Converts",
"the",
"value",
"x",
"(",
"which",
"is",
"measured",
"in",
"the",
"scale",
"from",
")",
"to",
"another",
"value",
"measured",
"in",
"the",
"scale",
"to",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Tools.java#L422-L425 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/config/TriggerDefinition.java | TriggerDefinition.fromSchema | public static List<TriggerDefinition> fromSchema(Row serializedTriggers) {
"""
Deserialize triggers from storage-level representation.
@param serializedTriggers storage-level partition containing the trigger definitions
@return the list of processed TriggerDefinitions
"""
List<TriggerDefinition> triggers = new ArrayList<>();
String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF);
for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers))
{
String name = row.getString(TRIGGER_NAME);
String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS);
triggers.add(new TriggerDefinition(name, classOption));
}
return triggers;
} | java | public static List<TriggerDefinition> fromSchema(Row serializedTriggers)
{
List<TriggerDefinition> triggers = new ArrayList<>();
String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF);
for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers))
{
String name = row.getString(TRIGGER_NAME);
String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS);
triggers.add(new TriggerDefinition(name, classOption));
}
return triggers;
} | [
"public",
"static",
"List",
"<",
"TriggerDefinition",
">",
"fromSchema",
"(",
"Row",
"serializedTriggers",
")",
"{",
"List",
"<",
"TriggerDefinition",
">",
"triggers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"query",
"=",
"String",
".",
"form... | Deserialize triggers from storage-level representation.
@param serializedTriggers storage-level partition containing the trigger definitions
@return the list of processed TriggerDefinitions | [
"Deserialize",
"triggers",
"from",
"storage",
"-",
"level",
"representation",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/TriggerDefinition.java#L61-L72 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java | SchemaTypeAdapter.readArray | private Schema readArray(JsonReader reader, Set<String> knownRecords) throws IOException {
"""
Constructs {@link Schema.Type#ARRAY ARRAY} type schema from the json input.
@param reader The {@link JsonReader} for streaming json input tokens.
@param knownRecords Set of record name already encountered during the reading.
@return A {@link Schema} of type {@link Schema.Type#ARRAY ARRAY}.
@throws java.io.IOException When fails to construct a valid schema from the input.
"""
return Schema.arrayOf(readInnerSchema(reader, "items", knownRecords));
} | java | private Schema readArray(JsonReader reader, Set<String> knownRecords) throws IOException {
return Schema.arrayOf(readInnerSchema(reader, "items", knownRecords));
} | [
"private",
"Schema",
"readArray",
"(",
"JsonReader",
"reader",
",",
"Set",
"<",
"String",
">",
"knownRecords",
")",
"throws",
"IOException",
"{",
"return",
"Schema",
".",
"arrayOf",
"(",
"readInnerSchema",
"(",
"reader",
",",
"\"items\"",
",",
"knownRecords",
... | Constructs {@link Schema.Type#ARRAY ARRAY} type schema from the json input.
@param reader The {@link JsonReader} for streaming json input tokens.
@param knownRecords Set of record name already encountered during the reading.
@return A {@link Schema} of type {@link Schema.Type#ARRAY ARRAY}.
@throws java.io.IOException When fails to construct a valid schema from the input. | [
"Constructs",
"{",
"@link",
"Schema",
".",
"Type#ARRAY",
"ARRAY",
"}",
"type",
"schema",
"from",
"the",
"json",
"input",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java#L165-L167 |
i-net-software/jlessc | src/com/inet/lib/less/Operation.java | Operation.putConvertion | private static void putConvertion( HashMap<String, Double> group, String unit, double factor ) {
"""
Helper for creating static unit conversions.
@param group the unit group like length, duration or angles. Units of one group can convert in another.
@param unit the unit name
@param factor the convert factor
"""
UNIT_CONVERSIONS.put(unit, group );
group.put( unit, factor );
} | java | private static void putConvertion( HashMap<String, Double> group, String unit, double factor ) {
UNIT_CONVERSIONS.put(unit, group );
group.put( unit, factor );
} | [
"private",
"static",
"void",
"putConvertion",
"(",
"HashMap",
"<",
"String",
",",
"Double",
">",
"group",
",",
"String",
"unit",
",",
"double",
"factor",
")",
"{",
"UNIT_CONVERSIONS",
".",
"put",
"(",
"unit",
",",
"group",
")",
";",
"group",
".",
"put",
... | Helper for creating static unit conversions.
@param group the unit group like length, duration or angles. Units of one group can convert in another.
@param unit the unit name
@param factor the convert factor | [
"Helper",
"for",
"creating",
"static",
"unit",
"conversions",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L74-L77 |
xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java | ConfigurationSupport.setAdditionalFields | public static void setAdditionalFields(String spec, GelfMessageAssembler gelfMessageAssembler) {
"""
Set the additional (static) fields.
@param spec field=value,field1=value1, ...
@param gelfMessageAssembler the Gelf message assembler to apply the configuration
"""
if (null != spec) {
String[] properties = spec.split(MULTI_VALUE_DELIMITTER);
for (String field : properties) {
final int index = field.indexOf(EQ);
if (-1 == index) {
continue;
}
gelfMessageAssembler.addField(new StaticMessageField(field.substring(0, index), field.substring(index + 1)));
}
}
} | java | public static void setAdditionalFields(String spec, GelfMessageAssembler gelfMessageAssembler) {
if (null != spec) {
String[] properties = spec.split(MULTI_VALUE_DELIMITTER);
for (String field : properties) {
final int index = field.indexOf(EQ);
if (-1 == index) {
continue;
}
gelfMessageAssembler.addField(new StaticMessageField(field.substring(0, index), field.substring(index + 1)));
}
}
} | [
"public",
"static",
"void",
"setAdditionalFields",
"(",
"String",
"spec",
",",
"GelfMessageAssembler",
"gelfMessageAssembler",
")",
"{",
"if",
"(",
"null",
"!=",
"spec",
")",
"{",
"String",
"[",
"]",
"properties",
"=",
"spec",
".",
"split",
"(",
"MULTI_VALUE_D... | Set the additional (static) fields.
@param spec field=value,field1=value1, ...
@param gelfMessageAssembler the Gelf message assembler to apply the configuration | [
"Set",
"the",
"additional",
"(",
"static",
")",
"fields",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java#L25-L37 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.createTranslator | public static DPTXlator createTranslator(int mainNumber, String dptID)
throws KNXException {
"""
Creates a DPT translator for the given datapoint type ID.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the
supplied datapoint type ID.
<p>
If the <code>dptID</code> argument is built up the recommended way, that is "<i>main
number</i>.<i>sub number</i>", the <code>mainNumber</code> argument might be
left 0 to use the datapoint type ID only.<br>
Note, that we don't enforce any particular or standardized format on the dptID
structure, so using a different formatted dptID solely without main number argument
results in undefined behavior.
@param mainNumber data type main number, number >= 0; use 0 to infer translator
type from <code>dptID</code> argument only
@param dptID datapoint type ID for selecting a particular kind of value translation
@return the new {@link DPTXlator} object
@throws KNXException on main type not found or creation failed (refer to
{@link MainType#createTranslator(String)})
"""
try {
final int main = getMainNumber(mainNumber, dptID);
final MainType type = (MainType) map.get(new Integer(main));
if (type != null)
return type.createTranslator(dptID);
}
catch (final NumberFormatException e) {}
throw new KNXException("main number not found for " + dptID);
} | java | public static DPTXlator createTranslator(int mainNumber, String dptID)
throws KNXException
{
try {
final int main = getMainNumber(mainNumber, dptID);
final MainType type = (MainType) map.get(new Integer(main));
if (type != null)
return type.createTranslator(dptID);
}
catch (final NumberFormatException e) {}
throw new KNXException("main number not found for " + dptID);
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"int",
"mainNumber",
",",
"String",
"dptID",
")",
"throws",
"KNXException",
"{",
"try",
"{",
"final",
"int",
"main",
"=",
"getMainNumber",
"(",
"mainNumber",
",",
"dptID",
")",
";",
"final",
"MainType",... | Creates a DPT translator for the given datapoint type ID.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the
supplied datapoint type ID.
<p>
If the <code>dptID</code> argument is built up the recommended way, that is "<i>main
number</i>.<i>sub number</i>", the <code>mainNumber</code> argument might be
left 0 to use the datapoint type ID only.<br>
Note, that we don't enforce any particular or standardized format on the dptID
structure, so using a different formatted dptID solely without main number argument
results in undefined behavior.
@param mainNumber data type main number, number >= 0; use 0 to infer translator
type from <code>dptID</code> argument only
@param dptID datapoint type ID for selecting a particular kind of value translation
@return the new {@link DPTXlator} object
@throws KNXException on main type not found or creation failed (refer to
{@link MainType#createTranslator(String)}) | [
"Creates",
"a",
"DPT",
"translator",
"for",
"the",
"given",
"datapoint",
"type",
"ID",
".",
"<p",
">",
"The",
"translation",
"behavior",
"of",
"a",
"DPT",
"translator",
"instance",
"is",
"uniquely",
"defined",
"by",
"the",
"supplied",
"datapoint",
"type",
"I... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L460-L471 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java | Preconditions.checkNotNull | public static <T> T checkNotNull(T reference, String message) {
"""
Checks that the given object reference is not {@code null} and throws a customized
{@link NullPointerException} if it is. Intended for doing parameter validation in methods and
constructors, e.g.:
<blockquote><pre>
public void foo(Bar bar, Baz baz) {
this.bar = Preconditions.checkNotNull(bar, "bar must not be null.");
Preconditions.checkNotBull(baz, "baz must not be null.");
}
</pre></blockquote>
@param reference the object reference to check for being {@code null}
@param message the detail message to be used in the event that an exception is thrown
@param <T> the type of the reference
@return {@code reference} if not {@code null}
@throws NullPointerException if {@code reference} is {@code null}
"""
if (reference == null) {
throw new NullPointerException(message);
}
return reference;
} | java | public static <T> T checkNotNull(T reference, String message) {
if (reference == null) {
throw new NullPointerException(message);
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"String",
"message",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
")",
";",
"}",
"return",
"reference... | Checks that the given object reference is not {@code null} and throws a customized
{@link NullPointerException} if it is. Intended for doing parameter validation in methods and
constructors, e.g.:
<blockquote><pre>
public void foo(Bar bar, Baz baz) {
this.bar = Preconditions.checkNotNull(bar, "bar must not be null.");
Preconditions.checkNotBull(baz, "baz must not be null.");
}
</pre></blockquote>
@param reference the object reference to check for being {@code null}
@param message the detail message to be used in the event that an exception is thrown
@param <T> the type of the reference
@return {@code reference} if not {@code null}
@throws NullPointerException if {@code reference} is {@code null} | [
"Checks",
"that",
"the",
"given",
"object",
"reference",
"is",
"not",
"{",
"@code",
"null",
"}",
"and",
"throws",
"a",
"customized",
"{",
"@link",
"NullPointerException",
"}",
"if",
"it",
"is",
".",
"Intended",
"for",
"doing",
"parameter",
"validation",
"in"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L110-L115 |
networknt/light-rest-4j | openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java | ResponseValidator.validateResponseContent | public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode) {
"""
validate a given response content object with media content type "application/json"
uri, httpMethod, statusCode, DEFAULT_MEDIA_TYPE is to locate the schema to validate
@param responseContent response content needs to be validated
@param uri original uri of the request
@param httpMethod eg. "put" or "get"
@param statusCode eg. 200, 400
@return Status
"""
return validateResponseContent(responseContent, uri, httpMethod, statusCode, JSON_MEDIA_TYPE);
} | java | public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode) {
return validateResponseContent(responseContent, uri, httpMethod, statusCode, JSON_MEDIA_TYPE);
} | [
"public",
"Status",
"validateResponseContent",
"(",
"Object",
"responseContent",
",",
"String",
"uri",
",",
"String",
"httpMethod",
",",
"String",
"statusCode",
")",
"{",
"return",
"validateResponseContent",
"(",
"responseContent",
",",
"uri",
",",
"httpMethod",
","... | validate a given response content object with media content type "application/json"
uri, httpMethod, statusCode, DEFAULT_MEDIA_TYPE is to locate the schema to validate
@param responseContent response content needs to be validated
@param uri original uri of the request
@param httpMethod eg. "put" or "get"
@param statusCode eg. 200, 400
@return Status | [
"validate",
"a",
"given",
"response",
"content",
"object",
"with",
"media",
"content",
"type",
"application",
"/",
"json",
"uri",
"httpMethod",
"statusCode",
"DEFAULT_MEDIA_TYPE",
"is",
"to",
"locate",
"the",
"schema",
"to",
"validate"
] | train | https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L80-L82 |
stagemonitor/stagemonitor | stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/metrics/MetricsSpanEventListener.java | MetricsSpanEventListener.trackExternalRequestRate | private void trackExternalRequestRate(Span span, String operationName, SpanContextInformation spanContext, boolean trackMetricsByOperationName) {
"""
/*
tracks the external requests grouped by the parent request name
this helps to analyze which requests issue a lot of external requests like jdbc calls
"""
int totalCount = 0;
for (SpanContextInformation.ExternalRequestStats externalRequestStats : spanContext.getExternalRequestStats()) {
long durationNanos = externalRequestStats.getExecutionTimeNanos();
final String requestType = externalRequestStats.getRequestType();
span.setTag("external_requests." + requestType + ".duration_ms", durationNanos / MILLISECOND_IN_NANOS);
span.setTag("external_requests." + requestType + ".count", externalRequestStats.getExecutionCount());
totalCount += externalRequestStats.getExecutionCount();
}
if (trackMetricsByOperationName) {
metricRegistry.meter(externalRequestRateTemplate
.build(operationName))
.mark(totalCount);
}
} | java | private void trackExternalRequestRate(Span span, String operationName, SpanContextInformation spanContext, boolean trackMetricsByOperationName) {
int totalCount = 0;
for (SpanContextInformation.ExternalRequestStats externalRequestStats : spanContext.getExternalRequestStats()) {
long durationNanos = externalRequestStats.getExecutionTimeNanos();
final String requestType = externalRequestStats.getRequestType();
span.setTag("external_requests." + requestType + ".duration_ms", durationNanos / MILLISECOND_IN_NANOS);
span.setTag("external_requests." + requestType + ".count", externalRequestStats.getExecutionCount());
totalCount += externalRequestStats.getExecutionCount();
}
if (trackMetricsByOperationName) {
metricRegistry.meter(externalRequestRateTemplate
.build(operationName))
.mark(totalCount);
}
} | [
"private",
"void",
"trackExternalRequestRate",
"(",
"Span",
"span",
",",
"String",
"operationName",
",",
"SpanContextInformation",
"spanContext",
",",
"boolean",
"trackMetricsByOperationName",
")",
"{",
"int",
"totalCount",
"=",
"0",
";",
"for",
"(",
"SpanContextInfor... | /*
tracks the external requests grouped by the parent request name
this helps to analyze which requests issue a lot of external requests like jdbc calls | [
"/",
"*",
"tracks",
"the",
"external",
"requests",
"grouped",
"by",
"the",
"parent",
"request",
"name",
"this",
"helps",
"to",
"analyze",
"which",
"requests",
"issue",
"a",
"lot",
"of",
"external",
"requests",
"like",
"jdbc",
"calls"
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-tracing/src/main/java/org/stagemonitor/tracing/metrics/MetricsSpanEventListener.java#L116-L130 |
js-lib-com/commons | src/main/java/js/lang/Config.java | Config.hasAttribute | public boolean hasAttribute(String name, String value) {
"""
Test if configuration object has an attribute with requested name and value.
@param name name of the attribute to search for,
@param value attribute value.
@return true if configuration object has an attribute with requested name and value.
@throws IllegalArgumentException if <code>name</code> argument is null or empty.
@throws IllegalArgumentException if <code>value</code> argument is null or empty.
"""
Params.notNullOrEmpty(name, "Attribute name");
Params.notNullOrEmpty(value, "Attribute value");
return value.equals(attributes.get(name));
} | java | public boolean hasAttribute(String name, String value)
{
Params.notNullOrEmpty(name, "Attribute name");
Params.notNullOrEmpty(value, "Attribute value");
return value.equals(attributes.get(name));
} | [
"public",
"boolean",
"hasAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Params",
".",
"notNullOrEmpty",
"(",
"name",
",",
"\"Attribute name\"",
")",
";",
"Params",
".",
"notNullOrEmpty",
"(",
"value",
",",
"\"Attribute value\"",
")",
";"... | Test if configuration object has an attribute with requested name and value.
@param name name of the attribute to search for,
@param value attribute value.
@return true if configuration object has an attribute with requested name and value.
@throws IllegalArgumentException if <code>name</code> argument is null or empty.
@throws IllegalArgumentException if <code>value</code> argument is null or empty. | [
"Test",
"if",
"configuration",
"object",
"has",
"an",
"attribute",
"with",
"requested",
"name",
"and",
"value",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L252-L257 |
jwtk/jjwt | impl/src/main/java/io/jsonwebtoken/impl/crypto/RsaProvider.java | RsaProvider.generateKeyPair | @SuppressWarnings("unused") //used by io.jsonwebtoken.security.Keys
public static KeyPair generateKeyPair(SignatureAlgorithm alg) {
"""
Generates a new RSA secure-randomly key pair suitable for the specified SignatureAlgorithm using JJWT's
default {@link SignatureProvider#DEFAULT_SECURE_RANDOM SecureRandom instance}. This is a convenience method
that immediately delegates to {@link #generateKeyPair(int)} based on the relevant key size for the specified
algorithm.
@param alg the signature algorithm to inspect to determine a size in bits.
@return a new RSA secure-random key pair of the specified size.
@see #generateKeyPair()
@see #generateKeyPair(int, SecureRandom)
@see #generateKeyPair(String, int, SecureRandom)
@since 0.10.0
"""
Assert.isTrue(alg.isRsa(), "Only RSA algorithms are supported by this method.");
int keySizeInBits = 4096;
switch (alg) {
case RS256:
case PS256:
keySizeInBits = 2048;
break;
case RS384:
case PS384:
keySizeInBits = 3072;
break;
}
return generateKeyPair(keySizeInBits, DEFAULT_SECURE_RANDOM);
} | java | @SuppressWarnings("unused") //used by io.jsonwebtoken.security.Keys
public static KeyPair generateKeyPair(SignatureAlgorithm alg) {
Assert.isTrue(alg.isRsa(), "Only RSA algorithms are supported by this method.");
int keySizeInBits = 4096;
switch (alg) {
case RS256:
case PS256:
keySizeInBits = 2048;
break;
case RS384:
case PS384:
keySizeInBits = 3072;
break;
}
return generateKeyPair(keySizeInBits, DEFAULT_SECURE_RANDOM);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"//used by io.jsonwebtoken.security.Keys",
"public",
"static",
"KeyPair",
"generateKeyPair",
"(",
"SignatureAlgorithm",
"alg",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"alg",
".",
"isRsa",
"(",
")",
",",
"\"Only RSA al... | Generates a new RSA secure-randomly key pair suitable for the specified SignatureAlgorithm using JJWT's
default {@link SignatureProvider#DEFAULT_SECURE_RANDOM SecureRandom instance}. This is a convenience method
that immediately delegates to {@link #generateKeyPair(int)} based on the relevant key size for the specified
algorithm.
@param alg the signature algorithm to inspect to determine a size in bits.
@return a new RSA secure-random key pair of the specified size.
@see #generateKeyPair()
@see #generateKeyPair(int, SecureRandom)
@see #generateKeyPair(String, int, SecureRandom)
@since 0.10.0 | [
"Generates",
"a",
"new",
"RSA",
"secure",
"-",
"randomly",
"key",
"pair",
"suitable",
"for",
"the",
"specified",
"SignatureAlgorithm",
"using",
"JJWT",
"s",
"default",
"{",
"@link",
"SignatureProvider#DEFAULT_SECURE_RANDOM",
"SecureRandom",
"instance",
"}",
".",
"Th... | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/impl/src/main/java/io/jsonwebtoken/impl/crypto/RsaProvider.java#L135-L150 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java | JSchema.setAccessors | private void setAccessors(int bias, JMFSchema schema) {
"""
permits retrieval of accessors relative to box schemas as well as the public schema.
"""
int nextBoxBias = bias + fields.length + variants.length;
for (int i = 0; i < fields.length; i++) {
JSField field = fields[i];
if (field instanceof JSVariant) {
JSchema boxed = (JSchema) ((JSVariant)field).getBoxed();
boxed.setAccessors(nextBoxBias, schema);
// Copy accessors from the top type of the box to the visible variant
JSVariant boxVar = (JSVariant) boxed.getJMFType();
field.setAccessor(boxVar.getAccessor(boxed), boxed);
field.setAccessor(boxVar.getAccessor(schema), schema);
((JSVariant) field).setBoxAccessor(i + bias, schema);
nextBoxBias += boxed.getAccessorCount();
}
else
field.setAccessor(i + bias, schema);
}
for (int i = 0; i < variants.length; i++)
variants[i].setAccessor(i + bias + fields.length, schema);
} | java | private void setAccessors(int bias, JMFSchema schema) {
int nextBoxBias = bias + fields.length + variants.length;
for (int i = 0; i < fields.length; i++) {
JSField field = fields[i];
if (field instanceof JSVariant) {
JSchema boxed = (JSchema) ((JSVariant)field).getBoxed();
boxed.setAccessors(nextBoxBias, schema);
// Copy accessors from the top type of the box to the visible variant
JSVariant boxVar = (JSVariant) boxed.getJMFType();
field.setAccessor(boxVar.getAccessor(boxed), boxed);
field.setAccessor(boxVar.getAccessor(schema), schema);
((JSVariant) field).setBoxAccessor(i + bias, schema);
nextBoxBias += boxed.getAccessorCount();
}
else
field.setAccessor(i + bias, schema);
}
for (int i = 0; i < variants.length; i++)
variants[i].setAccessor(i + bias + fields.length, schema);
} | [
"private",
"void",
"setAccessors",
"(",
"int",
"bias",
",",
"JMFSchema",
"schema",
")",
"{",
"int",
"nextBoxBias",
"=",
"bias",
"+",
"fields",
".",
"length",
"+",
"variants",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"field... | permits retrieval of accessors relative to box schemas as well as the public schema. | [
"permits",
"retrieval",
"of",
"accessors",
"relative",
"to",
"box",
"schemas",
"as",
"well",
"as",
"the",
"public",
"schema",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java#L672-L691 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.lastIndexOf | public int lastIndexOf(final StrMatcher matcher, int startIndex) {
"""
Searches the string builder using the matcher to find the last
match searching from the given index.
<p>
Matchers can be used to perform advanced searching behaviour.
For example you could write a matcher to find the character 'a'
followed by a number.
@param matcher the matcher to use, null returns -1
@param startIndex the index to start at, invalid index rounded to edge
@return the last index matched, or -1 if not found
"""
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (matcher == null || startIndex < 0) {
return -1;
}
final char[] buf = buffer;
final int endIndex = startIndex + 1;
for (int i = startIndex; i >= 0; i--) {
if (matcher.isMatch(buf, i, 0, endIndex) > 0) {
return i;
}
}
return -1;
} | java | public int lastIndexOf(final StrMatcher matcher, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (matcher == null || startIndex < 0) {
return -1;
}
final char[] buf = buffer;
final int endIndex = startIndex + 1;
for (int i = startIndex; i >= 0; i--) {
if (matcher.isMatch(buf, i, 0, endIndex) > 0) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lastIndexOf",
"(",
"final",
"StrMatcher",
"matcher",
",",
"int",
"startIndex",
")",
"{",
"startIndex",
"=",
"(",
"startIndex",
">=",
"size",
"?",
"size",
"-",
"1",
":",
"startIndex",
")",
";",
"if",
"(",
"matcher",
"==",
"null",
"||",
... | Searches the string builder using the matcher to find the last
match searching from the given index.
<p>
Matchers can be used to perform advanced searching behaviour.
For example you could write a matcher to find the character 'a'
followed by a number.
@param matcher the matcher to use, null returns -1
@param startIndex the index to start at, invalid index rounded to edge
@return the last index matched, or -1 if not found | [
"Searches",
"the",
"string",
"builder",
"using",
"the",
"matcher",
"to",
"find",
"the",
"last",
"match",
"searching",
"from",
"the",
"given",
"index",
".",
"<p",
">",
"Matchers",
"can",
"be",
"used",
"to",
"perform",
"advanced",
"searching",
"behaviour",
"."... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2629-L2642 |
osglworks/java-tool-ext | src/main/java/org/osgl/util/Token.java | Token.generateToken | @Deprecated
public static String generateToken(String secret, Life tl, String oid, String... payload) {
"""
This method is deprecated, please use {@link #generateToken(byte[], Life, String, String...)} instead
Generate a token string with secret key, ID and optionally payloads
@param secret the secret to encrypt to token string
@param tl the expiration of the token
@param oid the ID of the token (could be customer ID etc)
@param payload the payload optionally indicate more information
@return an encrypted token string that is expiring in {@link Life#SHORT} time period
"""
return generateToken(secret, tl.seconds, oid, payload);
} | java | @Deprecated
public static String generateToken(String secret, Life tl, String oid, String... payload) {
return generateToken(secret, tl.seconds, oid, payload);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"generateToken",
"(",
"String",
"secret",
",",
"Life",
"tl",
",",
"String",
"oid",
",",
"String",
"...",
"payload",
")",
"{",
"return",
"generateToken",
"(",
"secret",
",",
"tl",
".",
"seconds",
",",
"oid",
... | This method is deprecated, please use {@link #generateToken(byte[], Life, String, String...)} instead
Generate a token string with secret key, ID and optionally payloads
@param secret the secret to encrypt to token string
@param tl the expiration of the token
@param oid the ID of the token (could be customer ID etc)
@param payload the payload optionally indicate more information
@return an encrypted token string that is expiring in {@link Life#SHORT} time period | [
"This",
"method",
"is",
"deprecated",
"please",
"use",
"{",
"@link",
"#generateToken",
"(",
"byte",
"[]",
"Life",
"String",
"String",
"...",
")",
"}",
"instead"
] | train | https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L296-L299 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java | SegmentKeyCache.includeUpdateBatch | List<Long> includeUpdateBatch(TableKeyBatch batch, long batchOffset, int generation) {
"""
Updates the tail cache for with the contents of the given {@link TableKeyBatch}.
Each {@link TableKeyBatch.Item} is updated only if no previous entry exists with its {@link TableKeyBatch.Item#getHash()}
or if its {@link TableKeyBatch.Item#getOffset()} is greater than the existing entry's offset.
This method should be used for processing new updates to the Index (as opposed from bulk-loading already indexed keys).
@param batch An {@link TableKeyBatch} containing items to accept into the Cache.
@param batchOffset Offset in the Segment where the first item in the {@link TableKeyBatch} has been written to.
@param generation The current Cache Generation (from the Cache Manager).
@return A List of offsets for each item in the {@link TableKeyBatch} (in the same order) of where the latest value
for that item's Key exists now.
"""
val result = new ArrayList<Long>(batch.getItems().size());
synchronized (this) {
for (TableKeyBatch.Item item : batch.getItems()) {
long itemOffset = batchOffset + item.getOffset();
CacheBucketOffset existingOffset = get(item.getHash(), generation);
if (existingOffset == null || itemOffset > existingOffset.getSegmentOffset()) {
// We have no previous entry, or we do and the current offset is higher, so it prevails.
this.tailOffsets.put(item.getHash(), new CacheBucketOffset(itemOffset, batch.isRemoval()));
result.add(itemOffset);
} else {
// Current offset is lower.
result.add(existingOffset.getSegmentOffset());
}
if (existingOffset != null) {
// Only record a backpointer if we have a previous location to point to.
this.backpointers.put(itemOffset, existingOffset.getSegmentOffset());
}
}
}
return result;
} | java | List<Long> includeUpdateBatch(TableKeyBatch batch, long batchOffset, int generation) {
val result = new ArrayList<Long>(batch.getItems().size());
synchronized (this) {
for (TableKeyBatch.Item item : batch.getItems()) {
long itemOffset = batchOffset + item.getOffset();
CacheBucketOffset existingOffset = get(item.getHash(), generation);
if (existingOffset == null || itemOffset > existingOffset.getSegmentOffset()) {
// We have no previous entry, or we do and the current offset is higher, so it prevails.
this.tailOffsets.put(item.getHash(), new CacheBucketOffset(itemOffset, batch.isRemoval()));
result.add(itemOffset);
} else {
// Current offset is lower.
result.add(existingOffset.getSegmentOffset());
}
if (existingOffset != null) {
// Only record a backpointer if we have a previous location to point to.
this.backpointers.put(itemOffset, existingOffset.getSegmentOffset());
}
}
}
return result;
} | [
"List",
"<",
"Long",
">",
"includeUpdateBatch",
"(",
"TableKeyBatch",
"batch",
",",
"long",
"batchOffset",
",",
"int",
"generation",
")",
"{",
"val",
"result",
"=",
"new",
"ArrayList",
"<",
"Long",
">",
"(",
"batch",
".",
"getItems",
"(",
")",
".",
"size... | Updates the tail cache for with the contents of the given {@link TableKeyBatch}.
Each {@link TableKeyBatch.Item} is updated only if no previous entry exists with its {@link TableKeyBatch.Item#getHash()}
or if its {@link TableKeyBatch.Item#getOffset()} is greater than the existing entry's offset.
This method should be used for processing new updates to the Index (as opposed from bulk-loading already indexed keys).
@param batch An {@link TableKeyBatch} containing items to accept into the Cache.
@param batchOffset Offset in the Segment where the first item in the {@link TableKeyBatch} has been written to.
@param generation The current Cache Generation (from the Cache Manager).
@return A List of offsets for each item in the {@link TableKeyBatch} (in the same order) of where the latest value
for that item's Key exists now. | [
"Updates",
"the",
"tail",
"cache",
"for",
"with",
"the",
"contents",
"of",
"the",
"given",
"{",
"@link",
"TableKeyBatch",
"}",
".",
"Each",
"{",
"@link",
"TableKeyBatch",
".",
"Item",
"}",
"is",
"updated",
"only",
"if",
"no",
"previous",
"entry",
"exists",... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java#L148-L171 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PropertiesRule.java | PropertiesRule.apply | @Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
"""
Applies this schema rule to take the required code generation steps.
<p>
For each property present within the properties node, this rule will
invoke the 'property' rule provided by the given schema mapper.
@param nodeName
the name of the node for which properties are being added
@param node
the properties node, containing property names and their
definition
@param jclass
the Java type which will have the given properties added
@return the given jclass
"""
if (node == null) {
node = JsonNodeFactory.instance.objectNode();
}
for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
String property = properties.next();
ruleFactory.getPropertyRule().apply(property, node.get(property), node, jclass, schema);
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders() && !jclass._extends().name().equals("Object")) {
addOverrideBuilders(jclass, jclass.owner()._getClass(jclass._extends().fullName()));
}
ruleFactory.getAnnotator().propertyOrder(jclass, node);
return jclass;
} | java | @Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
if (node == null) {
node = JsonNodeFactory.instance.objectNode();
}
for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
String property = properties.next();
ruleFactory.getPropertyRule().apply(property, node.get(property), node, jclass, schema);
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders() && !jclass._extends().name().equals("Object")) {
addOverrideBuilders(jclass, jclass.owner()._getClass(jclass._extends().fullName()));
}
ruleFactory.getAnnotator().propertyOrder(jclass, node);
return jclass;
} | [
"@",
"Override",
"public",
"JDefinedClass",
"apply",
"(",
"String",
"nodeName",
",",
"JsonNode",
"node",
",",
"JsonNode",
"parent",
",",
"JDefinedClass",
"jclass",
",",
"Schema",
"schema",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"node",
"=",
... | Applies this schema rule to take the required code generation steps.
<p>
For each property present within the properties node, this rule will
invoke the 'property' rule provided by the given schema mapper.
@param nodeName
the name of the node for which properties are being added
@param node
the properties node, containing property names and their
definition
@param jclass
the Java type which will have the given properties added
@return the given jclass | [
"Applies",
"this",
"schema",
"rule",
"to",
"take",
"the",
"required",
"code",
"generation",
"steps",
".",
"<p",
">",
"For",
"each",
"property",
"present",
"within",
"the",
"properties",
"node",
"this",
"rule",
"will",
"invoke",
"the",
"property",
"rule",
"pr... | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PropertiesRule.java#L61-L80 |
carewebframework/carewebframework-vista | org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayRenderer.java | DocumentDisplayRenderer.renderItem | @Override
public void renderItem(final Listitem item, final Document doc) {
"""
Render the list item for the specified document.
@param item List item to render.
@param doc The document associated with the list item.
"""
final Listcell cell = new Listcell();
item.appendChild(cell);
final Div sep = new Div();
sep.setSclass("vista-documents-sep");
cell.appendChild(sep);
final Div div = new Div();
div.setSclass(Constants.SCLASS_TEXT_REPORT_TITLE);
cell.appendChild(div);
final Hbox boxHeader = new Hbox();
final Label header = new Label(doc.getTitle());
header.setZclass(Constants.SCLASS_TEXT_REPORT_TITLE);
boxHeader.appendChild(header);
div.appendChild(boxHeader);
Label body = new Label(doc.getBody());
body.setMultiline(true);
body.setPre(true);
cell.appendChild(body);
} | java | @Override
public void renderItem(final Listitem item, final Document doc) {
final Listcell cell = new Listcell();
item.appendChild(cell);
final Div sep = new Div();
sep.setSclass("vista-documents-sep");
cell.appendChild(sep);
final Div div = new Div();
div.setSclass(Constants.SCLASS_TEXT_REPORT_TITLE);
cell.appendChild(div);
final Hbox boxHeader = new Hbox();
final Label header = new Label(doc.getTitle());
header.setZclass(Constants.SCLASS_TEXT_REPORT_TITLE);
boxHeader.appendChild(header);
div.appendChild(boxHeader);
Label body = new Label(doc.getBody());
body.setMultiline(true);
body.setPre(true);
cell.appendChild(body);
} | [
"@",
"Override",
"public",
"void",
"renderItem",
"(",
"final",
"Listitem",
"item",
",",
"final",
"Document",
"doc",
")",
"{",
"final",
"Listcell",
"cell",
"=",
"new",
"Listcell",
"(",
")",
";",
"item",
".",
"appendChild",
"(",
"cell",
")",
";",
"final",
... | Render the list item for the specified document.
@param item List item to render.
@param doc The document associated with the list item. | [
"Render",
"the",
"list",
"item",
"for",
"the",
"specified",
"document",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayRenderer.java#L52-L71 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java | MainScene.addChildObjectToCamera | public void addChildObjectToCamera(final GVRSceneObject child, int camera) {
"""
Adds a scene object to one or both of the left and right cameras.
@param child The {@link GVRSceneObject} to add.
@param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be
or'd together to add {@code child} to both cameras.
"""
switch (camera) {
case LEFT_CAMERA:
mLeftCameraRootObject.addChildObject(child);
break;
case RIGHT_CAMERA:
mRightCameraRootObject.addChildObject(child);
break;
default:
mMainCameraRootObject.addChildObject(child);
break;
}
} | java | public void addChildObjectToCamera(final GVRSceneObject child, int camera) {
switch (camera) {
case LEFT_CAMERA:
mLeftCameraRootObject.addChildObject(child);
break;
case RIGHT_CAMERA:
mRightCameraRootObject.addChildObject(child);
break;
default:
mMainCameraRootObject.addChildObject(child);
break;
}
} | [
"public",
"void",
"addChildObjectToCamera",
"(",
"final",
"GVRSceneObject",
"child",
",",
"int",
"camera",
")",
"{",
"switch",
"(",
"camera",
")",
"{",
"case",
"LEFT_CAMERA",
":",
"mLeftCameraRootObject",
".",
"addChildObject",
"(",
"child",
")",
";",
"break",
... | Adds a scene object to one or both of the left and right cameras.
@param child The {@link GVRSceneObject} to add.
@param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be
or'd together to add {@code child} to both cameras. | [
"Adds",
"a",
"scene",
"object",
"to",
"one",
"or",
"both",
"of",
"the",
"left",
"and",
"right",
"cameras",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java#L311-L323 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java | CPOptionPersistenceImpl.removeByG_K | @Override
public CPOption removeByG_K(long groupId, String key)
throws NoSuchCPOptionException {
"""
Removes the cp option where groupId = ? and key = ? from the database.
@param groupId the group ID
@param key the key
@return the cp option that was removed
"""
CPOption cpOption = findByG_K(groupId, key);
return remove(cpOption);
} | java | @Override
public CPOption removeByG_K(long groupId, String key)
throws NoSuchCPOptionException {
CPOption cpOption = findByG_K(groupId, key);
return remove(cpOption);
} | [
"@",
"Override",
"public",
"CPOption",
"removeByG_K",
"(",
"long",
"groupId",
",",
"String",
"key",
")",
"throws",
"NoSuchCPOptionException",
"{",
"CPOption",
"cpOption",
"=",
"findByG_K",
"(",
"groupId",
",",
"key",
")",
";",
"return",
"remove",
"(",
"cpOptio... | Removes the cp option where groupId = ? and key = ? from the database.
@param groupId the group ID
@param key the key
@return the cp option that was removed | [
"Removes",
"the",
"cp",
"option",
"where",
"groupId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2138-L2144 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/EmailUtils.java | EmailUtils.sendJobFailureAlertEmail | public static void sendJobFailureAlertEmail(String jobName, String message, int failures, State jobState)
throws EmailException {
"""
Send a job failure alert email.
@param jobName job name
@param message email message
@param failures number of consecutive job failures
@param jobState a {@link State} object carrying job configuration properties
@throws EmailException if there is anything wrong sending the email
"""
sendEmail(jobState, String.format("Gobblin alert: job %s has failed %d %s consecutively in the past", jobName,
failures, failures > 1 ? "times" : "time"), message);
} | java | public static void sendJobFailureAlertEmail(String jobName, String message, int failures, State jobState)
throws EmailException {
sendEmail(jobState, String.format("Gobblin alert: job %s has failed %d %s consecutively in the past", jobName,
failures, failures > 1 ? "times" : "time"), message);
} | [
"public",
"static",
"void",
"sendJobFailureAlertEmail",
"(",
"String",
"jobName",
",",
"String",
"message",
",",
"int",
"failures",
",",
"State",
"jobState",
")",
"throws",
"EmailException",
"{",
"sendEmail",
"(",
"jobState",
",",
"String",
".",
"format",
"(",
... | Send a job failure alert email.
@param jobName job name
@param message email message
@param failures number of consecutive job failures
@param jobState a {@link State} object carrying job configuration properties
@throws EmailException if there is anything wrong sending the email | [
"Send",
"a",
"job",
"failure",
"alert",
"email",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/EmailUtils.java#L120-L124 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyTextNode | protected final void copyTextNode(final int nodeID, SerializationHandler handler)
throws SAXException {
"""
Copy the String value of a Text node to a SerializationHandler
"""
if (nodeID != DTM.NULL) {
int dataIndex = m_dataOrQName.elementAt(nodeID);
if (dataIndex >= 0) {
m_chars.sendSAXcharacters(handler,
dataIndex >>> TEXT_LENGTH_BITS,
dataIndex & TEXT_LENGTH_MAX);
} else {
m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex+1));
}
}
} | java | protected final void copyTextNode(final int nodeID, SerializationHandler handler)
throws SAXException
{
if (nodeID != DTM.NULL) {
int dataIndex = m_dataOrQName.elementAt(nodeID);
if (dataIndex >= 0) {
m_chars.sendSAXcharacters(handler,
dataIndex >>> TEXT_LENGTH_BITS,
dataIndex & TEXT_LENGTH_MAX);
} else {
m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex+1));
}
}
} | [
"protected",
"final",
"void",
"copyTextNode",
"(",
"final",
"int",
"nodeID",
",",
"SerializationHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"nodeID",
"!=",
"DTM",
".",
"NULL",
")",
"{",
"int",
"dataIndex",
"=",
"m_dataOrQName",
".",
"... | Copy the String value of a Text node to a SerializationHandler | [
"Copy",
"the",
"String",
"value",
"of",
"a",
"Text",
"node",
"to",
"a",
"SerializationHandler"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3168-L3182 |
samskivert/samskivert | src/main/java/com/samskivert/util/ClassUtil.java | ClassUtil.getFields | public static void getFields (Class<?> clazz, List<Field> addTo) {
"""
Add all the fields of the specifed class (and its ancestors) to the list. Note, if we are
running in a sandbox, this will only enumerate public members.
"""
// first get the fields of the superclass
Class<?> pclazz = clazz.getSuperclass();
if (pclazz != null && !pclazz.equals(Object.class)) {
getFields(pclazz, addTo);
}
// then reflect on this class's declared fields
Field[] fields;
try {
fields = clazz.getDeclaredFields();
} catch (SecurityException se) {
System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se);
fields = new Field[0];
}
// override the default accessibility check for the fields
try {
AccessibleObject.setAccessible(fields, true);
} catch (SecurityException se) {
// ah well, only publics for us
}
for (Field field : fields) {
int mods = field.getModifiers();
if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) {
continue; // skip static and transient fields
}
addTo.add(field);
}
} | java | public static void getFields (Class<?> clazz, List<Field> addTo)
{
// first get the fields of the superclass
Class<?> pclazz = clazz.getSuperclass();
if (pclazz != null && !pclazz.equals(Object.class)) {
getFields(pclazz, addTo);
}
// then reflect on this class's declared fields
Field[] fields;
try {
fields = clazz.getDeclaredFields();
} catch (SecurityException se) {
System.err.println("Unable to get declared fields of " + clazz.getName() + ": " + se);
fields = new Field[0];
}
// override the default accessibility check for the fields
try {
AccessibleObject.setAccessible(fields, true);
} catch (SecurityException se) {
// ah well, only publics for us
}
for (Field field : fields) {
int mods = field.getModifiers();
if (Modifier.isStatic(mods) || Modifier.isTransient(mods)) {
continue; // skip static and transient fields
}
addTo.add(field);
}
} | [
"public",
"static",
"void",
"getFields",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"List",
"<",
"Field",
">",
"addTo",
")",
"{",
"// first get the fields of the superclass",
"Class",
"<",
"?",
">",
"pclazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
"... | Add all the fields of the specifed class (and its ancestors) to the list. Note, if we are
running in a sandbox, this will only enumerate public members. | [
"Add",
"all",
"the",
"fields",
"of",
"the",
"specifed",
"class",
"(",
"and",
"its",
"ancestors",
")",
"to",
"the",
"list",
".",
"Note",
"if",
"we",
"are",
"running",
"in",
"a",
"sandbox",
"this",
"will",
"only",
"enumerate",
"public",
"members",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ClassUtil.java#L48-L79 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java | BaseSessionProxy.doRemoteAction | public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException {
"""
Do a remote action.
@param strCommand Command to perform remotely.
@return boolean success.
"""
BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION);
transport.addParam(NAME, strCommand); // Don't use COMMAND
transport.addParam(PROPERTIES, properties);
Object strReturn = transport.sendMessageAndGetReply();
if (strReturn instanceof String)
{ // Could be returning a session
BaseSessionProxy session = this.checkForSession((String)strReturn);
if (session != null)
return session;
}
Object objReturn = transport.convertReturnObject(strReturn);
return this.checkDBException(objReturn);
} | java | public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
{
BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION);
transport.addParam(NAME, strCommand); // Don't use COMMAND
transport.addParam(PROPERTIES, properties);
Object strReturn = transport.sendMessageAndGetReply();
if (strReturn instanceof String)
{ // Could be returning a session
BaseSessionProxy session = this.checkForSession((String)strReturn);
if (session != null)
return session;
}
Object objReturn = transport.convertReturnObject(strReturn);
return this.checkDBException(objReturn);
} | [
"public",
"Object",
"doRemoteAction",
"(",
"String",
"strCommand",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
... | Do a remote action.
@param strCommand Command to perform remotely.
@return boolean success. | [
"Do",
"a",
"remote",
"action",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java#L82-L96 |
TheHortonMachine/hortonmachine | gui/src/main/java/org/hortonmachine/gui/utils/GuiUtilities.java | GuiUtilities.colorButton | public static void colorButton( JButton button, Color color, Integer size ) {
"""
Create an image to make a color picker button.
@param button the button.
@param color the color to set.
@param size the optional size of the image.
"""
if (size == null)
size = 15;
BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
Graphics2D gr = (Graphics2D) bi.getGraphics();
gr.setColor(color);
gr.fillRect(0, 0, size, size);
gr.dispose();
button.setIcon(new ImageIcon(bi));
} | java | public static void colorButton( JButton button, Color color, Integer size ) {
if (size == null)
size = 15;
BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB);
Graphics2D gr = (Graphics2D) bi.getGraphics();
gr.setColor(color);
gr.fillRect(0, 0, size, size);
gr.dispose();
button.setIcon(new ImageIcon(bi));
} | [
"public",
"static",
"void",
"colorButton",
"(",
"JButton",
"button",
",",
"Color",
"color",
",",
"Integer",
"size",
")",
"{",
"if",
"(",
"size",
"==",
"null",
")",
"size",
"=",
"15",
";",
"BufferedImage",
"bi",
"=",
"new",
"BufferedImage",
"(",
"size",
... | Create an image to make a color picker button.
@param button the button.
@param color the color to set.
@param size the optional size of the image. | [
"Create",
"an",
"image",
"to",
"make",
"a",
"color",
"picker",
"button",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/utils/GuiUtilities.java#L484-L494 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java | MathBindings.nextAfter | public static DoubleBinding nextAfter(final ObservableDoubleValue start, final ObservableDoubleValue direction) {
"""
Binding for {@link java.lang.Math#nextAfter(double, double)}
@param start starting floating-point value
@param direction value indicating which of
{@code start}'s neighbors or {@code start} should
be returned
@return The floating-point number adjacent to {@code start} in the
direction of {@code direction}.
"""
return createDoubleBinding(() -> Math.nextAfter(start.get(), direction.get()), start, direction);
} | java | public static DoubleBinding nextAfter(final ObservableDoubleValue start, final ObservableDoubleValue direction) {
return createDoubleBinding(() -> Math.nextAfter(start.get(), direction.get()), start, direction);
} | [
"public",
"static",
"DoubleBinding",
"nextAfter",
"(",
"final",
"ObservableDoubleValue",
"start",
",",
"final",
"ObservableDoubleValue",
"direction",
")",
"{",
"return",
"createDoubleBinding",
"(",
"(",
")",
"->",
"Math",
".",
"nextAfter",
"(",
"start",
".",
"get"... | Binding for {@link java.lang.Math#nextAfter(double, double)}
@param start starting floating-point value
@param direction value indicating which of
{@code start}'s neighbors or {@code start} should
be returned
@return The floating-point number adjacent to {@code start} in the
direction of {@code direction}. | [
"Binding",
"for",
"{",
"@link",
"java",
".",
"lang",
".",
"Math#nextAfter",
"(",
"double",
"double",
")",
"}"
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L1084-L1086 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setFeatureStyle | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle) {
"""
Set the feature style into the polygon options
@param polygonOptions polygon options
@param featureStyle feature style
@return true if style was set into the polygon options
"""
return StyleUtils.setFeatureStyle(polygonOptions, featureStyle, density);
} | java | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyle featureStyle) {
return StyleUtils.setFeatureStyle(polygonOptions, featureStyle, density);
} | [
"public",
"boolean",
"setFeatureStyle",
"(",
"PolygonOptions",
"polygonOptions",
",",
"FeatureStyle",
"featureStyle",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"polygonOptions",
",",
"featureStyle",
",",
"density",
")",
";",
"}"
] | Set the feature style into the polygon options
@param polygonOptions polygon options
@param featureStyle feature style
@return true if style was set into the polygon options | [
"Set",
"the",
"feature",
"style",
"into",
"the",
"polygon",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L313-L315 |
camunda/camunda-bpm-jbehave | camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java | Guards.checkIsSetLocal | public static void checkIsSetLocal(final DelegateExecution execution, final String variableName) {
"""
Checks, if a local variable with specified name is set.
@param execution
process execution.
@param variableName
name of the variable to check.
"""
Preconditions.checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);
final Object variableLocal = execution.getVariableLocal(variableName);
Preconditions.checkState(variableLocal != null,
String.format("Condition of task '%s' is violated: Local variable '%s' is not set.", new Object[] { execution.getCurrentActivityId(), variableName }));
} | java | public static void checkIsSetLocal(final DelegateExecution execution, final String variableName) {
Preconditions.checkArgument(variableName != null, VARIABLE_NAME_MUST_BE_NOT_NULL);
final Object variableLocal = execution.getVariableLocal(variableName);
Preconditions.checkState(variableLocal != null,
String.format("Condition of task '%s' is violated: Local variable '%s' is not set.", new Object[] { execution.getCurrentActivityId(), variableName }));
} | [
"public",
"static",
"void",
"checkIsSetLocal",
"(",
"final",
"DelegateExecution",
"execution",
",",
"final",
"String",
"variableName",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"variableName",
"!=",
"null",
",",
"VARIABLE_NAME_MUST_BE_NOT_NULL",
")",
";",
... | Checks, if a local variable with specified name is set.
@param execution
process execution.
@param variableName
name of the variable to check. | [
"Checks",
"if",
"a",
"local",
"variable",
"with",
"specified",
"name",
"is",
"set",
"."
] | train | https://github.com/camunda/camunda-bpm-jbehave/blob/ffad22471418e2c7f161f8976ca8a042114138ab/camunda-bpm-jbehave/src/main/java/org/camunda/bpm/data/Guards.java#L62-L68 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE | public OvhTask organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE(String organizationName, String exchangeService, String mailingListAddress) throws IOException {
"""
Delete mailing list
REST: DELETE /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param mailingListAddress [required] The mailing list address
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE(String organizationName, String exchangeService, String mailingListAddress) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"mailingListAddress",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/... | Delete mailing list
REST: DELETE /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param mailingListAddress [required] The mailing list address | [
"Delete",
"mailing",
"list"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1354-L1359 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.isTrue | public static void isTrue(final boolean expression, final String message, final long value) {
"""
<p>Validate that the argument condition is {@code true}; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating a
primitive number or using your own custom validation expression.</p>
<pre>Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);</pre>
<p>For performance reasons, the long value is passed as a separate parameter and
appended to the exception message only in the case of an error.</p>
@param expression the boolean expression to check
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param value the value to append to the message when invalid
@throws IllegalArgumentException if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, double)
@see #isTrue(boolean, String, Object...)
"""
if (!expression) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, Long.valueOf(value)));
}
} | java | public static void isTrue(final boolean expression, final String message, final long value) {
if (!expression) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, Long.valueOf(value)));
}
} | [
"public",
"static",
"void",
"isTrue",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"StringUtils",
"... | <p>Validate that the argument condition is {@code true}; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating a
primitive number or using your own custom validation expression.</p>
<pre>Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);</pre>
<p>For performance reasons, the long value is passed as a separate parameter and
appended to the exception message only in the case of an error.</p>
@param expression the boolean expression to check
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param value the value to append to the message when invalid
@throws IllegalArgumentException if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, double)
@see #isTrue(boolean, String, Object...) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L109-L113 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withLong | public Postcard withLong(@Nullable String key, long value) {
"""
Inserts a long value into the mapping of this Bundle, replacing
any existing value for the given key.
@param key a String, or null
@param value a long
@return current
"""
mBundle.putLong(key, value);
return this;
} | java | public Postcard withLong(@Nullable String key, long value) {
mBundle.putLong(key, value);
return this;
} | [
"public",
"Postcard",
"withLong",
"(",
"@",
"Nullable",
"String",
"key",
",",
"long",
"value",
")",
"{",
"mBundle",
".",
"putLong",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a long value into the mapping of this Bundle, replacing
any existing value for the given key.
@param key a String, or null
@param value a long
@return current | [
"Inserts",
"a",
"long",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L296-L299 |
google/auto | value/src/main/java/com/google/auto/value/processor/ErrorReporter.java | ErrorReporter.reportWarning | void reportWarning(String msg, Element e) {
"""
Issue a compilation warning.
@param msg the text of the warning
@param e the element to which it pertains
"""
messager.printMessage(Diagnostic.Kind.WARNING, msg, e);
} | java | void reportWarning(String msg, Element e) {
messager.printMessage(Diagnostic.Kind.WARNING, msg, e);
} | [
"void",
"reportWarning",
"(",
"String",
"msg",
",",
"Element",
"e",
")",
"{",
"messager",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"WARNING",
",",
"msg",
",",
"e",
")",
";",
"}"
] | Issue a compilation warning.
@param msg the text of the warning
@param e the element to which it pertains | [
"Issue",
"a",
"compilation",
"warning",
"."
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/ErrorReporter.java#L52-L54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.