repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/Search.java | Search.setStopCriterionCheckPeriod | public void setStopCriterionCheckPeriod(long period, TimeUnit timeUnit){
// acquire status lock
synchronized(statusLock){
// assert idle
assertIdle("Cannot modify stop criterion check period.");
// pass new settings to checker
stopCriterionChecker.setPeriod(period, timeUnit);
// log
LOGGER.debug("{}: set stop criterion check period to {} ms", this, timeUnit.toMillis(period));
}
} | java | public void setStopCriterionCheckPeriod(long period, TimeUnit timeUnit){
// acquire status lock
synchronized(statusLock){
// assert idle
assertIdle("Cannot modify stop criterion check period.");
// pass new settings to checker
stopCriterionChecker.setPeriod(period, timeUnit);
// log
LOGGER.debug("{}: set stop criterion check period to {} ms", this, timeUnit.toMillis(period));
}
} | [
"public",
"void",
"setStopCriterionCheckPeriod",
"(",
"long",
"period",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"// acquire status lock",
"synchronized",
"(",
"statusLock",
")",
"{",
"// assert idle",
"assertIdle",
"(",
"\"Cannot modify stop criterion check period.\"",
")",
... | Instructs the search to check its stop criteria at regular intervals separated by the given period.
For the default period, see {@link StopCriterionChecker}, which is used internally for this purpose.
The period should be at least 1 millisecond, else the stop criterion checker may thrown an exception
when the search is started. Note that this method may only be called when the search is idle.
<p>
Regardless of the specified period, the stop criteria are also checked after each search step.
@param period time between subsequent stop criterion checks (> 0)
@param timeUnit corresponding time unit
@throws SearchException if the search is not idle
@throws IllegalArgumentException if the given period is not strictly positive | [
"Instructs",
"the",
"search",
"to",
"check",
"its",
"stop",
"criteria",
"at",
"regular",
"intervals",
"separated",
"by",
"the",
"given",
"period",
".",
"For",
"the",
"default",
"period",
"see",
"{",
"@link",
"StopCriterionChecker",
"}",
"which",
"is",
"used",
... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L596-L606 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.isWholeArray | public static boolean isWholeArray(int rank, int... dimension){
return rank == 0 || dimension == null || dimension.length == 0 ||
(dimension.length == 1 && dimension[0] == Integer.MAX_VALUE) || dimension.length == rank;
} | java | public static boolean isWholeArray(int rank, int... dimension){
return rank == 0 || dimension == null || dimension.length == 0 ||
(dimension.length == 1 && dimension[0] == Integer.MAX_VALUE) || dimension.length == rank;
} | [
"public",
"static",
"boolean",
"isWholeArray",
"(",
"int",
"rank",
",",
"int",
"...",
"dimension",
")",
"{",
"return",
"rank",
"==",
"0",
"||",
"dimension",
"==",
"null",
"||",
"dimension",
".",
"length",
"==",
"0",
"||",
"(",
"dimension",
".",
"length",... | Returns true if the dimension is null
or the dimension length is 1 and the first entry
is {@link Integer#MAX_VALUE}
@param rank the rank of the input array
@param dimension the dimensions specified
@return true if the dimension length is equal to the rank,
the dimension is null or the dimension length is 1 and the first entry is
{@link Integer#MAX_VALUE} | [
"Returns",
"true",
"if",
"the",
"dimension",
"is",
"null",
"or",
"the",
"dimension",
"length",
"is",
"1",
"and",
"the",
"first",
"entry",
"is",
"{",
"@link",
"Integer#MAX_VALUE",
"}",
"@param",
"rank",
"the",
"rank",
"of",
"the",
"input",
"array",
"@param"... | 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#L348-L351 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/servlet/ServletOperationSet.java | ServletOperationSet.getOperation | public ServletOperation getOperation(SlingHttpServletRequest request, Method method) {
ServletOperation operation = null;
E extension = RequestUtil.getExtension(request, defaultExtension);
Map<E, O> extensionDefaults = operationDefaults.get(method);
if (extensionDefaults != null) {
O defaultOperation = extensionDefaults.get(extension);
if (defaultOperation != null) {
Map<E, Map<O, ServletOperation>> extensions = operationMap.get(method);
if (extensions != null) {
Map<O, ServletOperation> operations = extensions.get(extension);
if (operations != null) {
operation = operations.get(RequestUtil.getSelector(request, defaultOperation));
}
}
}
}
return operation;
} | java | public ServletOperation getOperation(SlingHttpServletRequest request, Method method) {
ServletOperation operation = null;
E extension = RequestUtil.getExtension(request, defaultExtension);
Map<E, O> extensionDefaults = operationDefaults.get(method);
if (extensionDefaults != null) {
O defaultOperation = extensionDefaults.get(extension);
if (defaultOperation != null) {
Map<E, Map<O, ServletOperation>> extensions = operationMap.get(method);
if (extensions != null) {
Map<O, ServletOperation> operations = extensions.get(extension);
if (operations != null) {
operation = operations.get(RequestUtil.getSelector(request, defaultOperation));
}
}
}
}
return operation;
} | [
"public",
"ServletOperation",
"getOperation",
"(",
"SlingHttpServletRequest",
"request",
",",
"Method",
"method",
")",
"{",
"ServletOperation",
"operation",
"=",
"null",
";",
"E",
"extension",
"=",
"RequestUtil",
".",
"getExtension",
"(",
"request",
",",
"defaultExt... | Retrieves the servlet operation requested for the used HTTP method.
Looks in the selectors for a operation and gives their implementation in the extensions context.
@param request the servlet request
@param method the requested HTTP method
@return the operation or 'null', if the requested combination of selector
and extension has no implementation for the given HTTP method | [
"Retrieves",
"the",
"servlet",
"operation",
"requested",
"for",
"the",
"used",
"HTTP",
"method",
".",
"Looks",
"in",
"the",
"selectors",
"for",
"a",
"operation",
"and",
"gives",
"their",
"implementation",
"in",
"the",
"extensions",
"context",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/servlet/ServletOperationSet.java#L51-L68 |
landawn/AbacusUtil | src/com/landawn/abacus/util/SQLExecutor.java | SQLExecutor.createTableIfNotExists | public boolean createTableIfNotExists(final String tableName, final String schema) {
Connection conn = getConnection();
try {
return JdbcUtil.createTableIfNotExists(conn, tableName, schema);
} finally {
closeQuietly(conn);
}
} | java | public boolean createTableIfNotExists(final String tableName, final String schema) {
Connection conn = getConnection();
try {
return JdbcUtil.createTableIfNotExists(conn, tableName, schema);
} finally {
closeQuietly(conn);
}
} | [
"public",
"boolean",
"createTableIfNotExists",
"(",
"final",
"String",
"tableName",
",",
"final",
"String",
"schema",
")",
"{",
"Connection",
"conn",
"=",
"getConnection",
"(",
")",
";",
"try",
"{",
"return",
"JdbcUtil",
".",
"createTableIfNotExists",
"(",
"conn... | Returns {@code true} if succeed to create table, otherwise {@code false} is returned.
@param tableName
@param schema
@return | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"succeed",
"to",
"create",
"table",
"otherwise",
"{",
"@code",
"false",
"}",
"is",
"returned",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L3264-L3272 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java | DetectDescribeAssociate.pruneTracks | private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) {
if( unassociated.size > maxInactiveTracks ) {
// make the first N elements the ones which will be dropped
int numDrop = unassociated.size-maxInactiveTracks;
for (int i = 0; i < numDrop; i++) {
int selected = rand.nextInt(unassociated.size-i)+i;
int a = unassociated.get(i);
unassociated.data[i] = unassociated.data[selected];
unassociated.data[selected] = a;
}
List<PointTrack> dropList = new ArrayList<>();
for (int i = 0; i < numDrop; i++) {
dropList.add( info.tracks.get(unassociated.get(i)) );
}
for (int i = 0; i < dropList.size(); i++) {
dropTrack(dropList.get(i));
}
}
} | java | private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) {
if( unassociated.size > maxInactiveTracks ) {
// make the first N elements the ones which will be dropped
int numDrop = unassociated.size-maxInactiveTracks;
for (int i = 0; i < numDrop; i++) {
int selected = rand.nextInt(unassociated.size-i)+i;
int a = unassociated.get(i);
unassociated.data[i] = unassociated.data[selected];
unassociated.data[selected] = a;
}
List<PointTrack> dropList = new ArrayList<>();
for (int i = 0; i < numDrop; i++) {
dropList.add( info.tracks.get(unassociated.get(i)) );
}
for (int i = 0; i < dropList.size(); i++) {
dropTrack(dropList.get(i));
}
}
} | [
"private",
"void",
"pruneTracks",
"(",
"SetTrackInfo",
"<",
"Desc",
">",
"info",
",",
"GrowQueue_I32",
"unassociated",
")",
"{",
"if",
"(",
"unassociated",
".",
"size",
">",
"maxInactiveTracks",
")",
"{",
"// make the first N elements the ones which will be dropped",
... | If there are too many unassociated tracks, randomly select some of those tracks and drop them | [
"If",
"there",
"are",
"too",
"many",
"unassociated",
"tracks",
"randomly",
"select",
"some",
"of",
"those",
"tracks",
"and",
"drop",
"them"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java#L174-L192 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspNavBuilder.java | CmsJspNavBuilder.getNavigationForResource | public CmsJspNavElement getNavigationForResource(String sitePath, CmsResourceFilter reourceFilter) {
return getNavigationForResource(sitePath, reourceFilter, false);
} | java | public CmsJspNavElement getNavigationForResource(String sitePath, CmsResourceFilter reourceFilter) {
return getNavigationForResource(sitePath, reourceFilter, false);
} | [
"public",
"CmsJspNavElement",
"getNavigationForResource",
"(",
"String",
"sitePath",
",",
"CmsResourceFilter",
"reourceFilter",
")",
"{",
"return",
"getNavigationForResource",
"(",
"sitePath",
",",
"reourceFilter",
",",
"false",
")",
";",
"}"
] | Returns a navigation element for the named resource.<p>
@param sitePath the resource name to get the navigation information for,
must be a full path name, e.g. "/docs/index.html"
@param reourceFilter the resource filter
@return a navigation element for the given resource | [
"Returns",
"a",
"navigation",
"element",
"for",
"the",
"named",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L607-L610 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java | LocalDate.atTime | public LocalDateTime atTime(int hour, int minute, int second) {
return atTime(LocalTime.of(hour, minute, second));
} | java | public LocalDateTime atTime(int hour, int minute, int second) {
return atTime(LocalTime.of(hour, minute, second));
} | [
"public",
"LocalDateTime",
"atTime",
"(",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
")",
"{",
"return",
"atTime",
"(",
"LocalTime",
".",
"of",
"(",
"hour",
",",
"minute",
",",
"second",
")",
")",
";",
"}"
] | Combines this date with a time to create a {@code LocalDateTime}.
<p>
This returns a {@code LocalDateTime} formed from this date at the
specified hour, minute and second.
The nanosecond field will be set to zero.
The individual time fields must be within their valid range.
All possible combinations of date and time are valid.
@param hour the hour-of-day to use, from 0 to 23
@param minute the minute-of-hour to use, from 0 to 59
@param second the second-of-minute to represent, from 0 to 59
@return the local date-time formed from this date and the specified time, not null
@throws DateTimeException if the value of any field is out of range | [
"Combines",
"this",
"date",
"with",
"a",
"time",
"to",
"create",
"a",
"{",
"@code",
"LocalDateTime",
"}",
".",
"<p",
">",
"This",
"returns",
"a",
"{",
"@code",
"LocalDateTime",
"}",
"formed",
"from",
"this",
"date",
"at",
"the",
"specified",
"hour",
"min... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java#L1736-L1738 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java | Cipher.update | public final int update(ByteBuffer input, ByteBuffer output)
throws ShortBufferException {
checkCipherState();
if ((input == null) || (output == null)) {
throw new IllegalArgumentException("Buffers must not be null");
}
if (input == output) {
throw new IllegalArgumentException("Input and output buffers must "
+ "not be the same object, consider using buffer.duplicate()");
}
if (output.isReadOnly()) {
throw new ReadOnlyBufferException();
}
updateProviderIfNeeded();
return spi.engineUpdate(input, output);
} | java | public final int update(ByteBuffer input, ByteBuffer output)
throws ShortBufferException {
checkCipherState();
if ((input == null) || (output == null)) {
throw new IllegalArgumentException("Buffers must not be null");
}
if (input == output) {
throw new IllegalArgumentException("Input and output buffers must "
+ "not be the same object, consider using buffer.duplicate()");
}
if (output.isReadOnly()) {
throw new ReadOnlyBufferException();
}
updateProviderIfNeeded();
return spi.engineUpdate(input, output);
} | [
"public",
"final",
"int",
"update",
"(",
"ByteBuffer",
"input",
",",
"ByteBuffer",
"output",
")",
"throws",
"ShortBufferException",
"{",
"checkCipherState",
"(",
")",
";",
"if",
"(",
"(",
"input",
"==",
"null",
")",
"||",
"(",
"output",
"==",
"null",
")",
... | Continues a multiple-part encryption or decryption operation
(depending on how this cipher was initialized), processing another data
part.
<p>All <code>input.remaining()</code> bytes starting at
<code>input.position()</code> are processed. The result is stored
in the output buffer.
Upon return, the input buffer's position will be equal
to its limit; its limit will not have changed. The output buffer's
position will have advanced by n, where n is the value returned
by this method; the output buffer's limit will not have changed.
<p>If <code>output.remaining()</code> bytes are insufficient to
hold the result, a <code>ShortBufferException</code> is thrown.
In this case, repeat this call with a larger output buffer. Use
{@link #getOutputSize(int) getOutputSize} to determine how big
the output buffer should be.
<p>Note: this method should be copy-safe, which means the
<code>input</code> and <code>output</code> buffers can reference
the same block of memory and no unprocessed input data is overwritten
when the result is copied into the output buffer.
@param input the input ByteBuffer
@param output the output ByteByffer
@return the number of bytes stored in <code>output</code>
@exception IllegalStateException if this cipher is in a wrong state
(e.g., has not been initialized)
@exception IllegalArgumentException if input and output are the
same object
@exception ReadOnlyBufferException if the output buffer is read-only
@exception ShortBufferException if there is insufficient space in the
output buffer
@since 1.5 | [
"Continues",
"a",
"multiple",
"-",
"part",
"encryption",
"or",
"decryption",
"operation",
"(",
"depending",
"on",
"how",
"this",
"cipher",
"was",
"initialized",
")",
"processing",
"another",
"data",
"part",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java#L1885-L1902 |
jbundle/jbundle | base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java | TrxMessageHeader.init | public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties)
{
m_mapMessageHeader = properties;
m_mapMessageTransport = null;
m_mapMessageInfo = null;
super.init(strQueueName, MessageConstants.INTERNET_QUEUE, source, properties);
} | java | public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties)
{
m_mapMessageHeader = properties;
m_mapMessageTransport = null;
m_mapMessageInfo = null;
super.init(strQueueName, MessageConstants.INTERNET_QUEUE, source, properties);
} | [
"public",
"void",
"init",
"(",
"String",
"strQueueName",
",",
"String",
"strQueueType",
",",
"Object",
"source",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"m_mapMessageHeader",
"=",
"properties",
";",
"m_mapMessageTransport",
"=",
... | Constructor.
@param strQueueName Name of the queue.
@param strQueueType Type of queue - remote or local.
@param source usually the object sending or listening for the message, to reduce echos. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L233-L239 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java | GrassRasterReader.readUncompressedFPRowByNumber | private void readUncompressedFPRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile, int typeBytes )
throws IOException, DataFormatException {
int datanumber = fileWindow.getCols() * typeBytes;
thefile.seek((rn * datanumber));
thefile.read(rowdata.array());
} | java | private void readUncompressedFPRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile, int typeBytes )
throws IOException, DataFormatException {
int datanumber = fileWindow.getCols() * typeBytes;
thefile.seek((rn * datanumber));
thefile.read(rowdata.array());
} | [
"private",
"void",
"readUncompressedFPRowByNumber",
"(",
"ByteBuffer",
"rowdata",
",",
"int",
"rn",
",",
"RandomAccessFile",
"thefile",
",",
"int",
"typeBytes",
")",
"throws",
"IOException",
",",
"DataFormatException",
"{",
"int",
"datanumber",
"=",
"fileWindow",
".... | read a row of data from an uncompressed floating point map
@param rn
@param outFile
@param typeBytes
@return the ByteBuffer containing the data
@throws IOException
@throws DataFormatException | [
"read",
"a",
"row",
"of",
"data",
"from",
"an",
"uncompressed",
"floating",
"point",
"map"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java#L1104-L1110 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.binarySearch | public static <T> int binarySearch(final T[] a, final T key, final Comparator<? super T> cmp) {
return Array.binarySearch(a, key, cmp);
} | java | public static <T> int binarySearch(final T[] a, final T key, final Comparator<? super T> cmp) {
return Array.binarySearch(a, key, cmp);
} | [
"public",
"static",
"<",
"T",
">",
"int",
"binarySearch",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"T",
"key",
",",
"final",
"Comparator",
"<",
"?",
"super",
"T",
">",
"cmp",
")",
"{",
"return",
"Array",
".",
"binarySearch",
"(",
"a",
",",
... | {@link Arrays#binarySearch(Object[], Object, Comparator)}
@param a
@param key
@param cmp
@return | [
"{",
"@link",
"Arrays#binarySearch",
"(",
"Object",
"[]",
"Object",
"Comparator",
")",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12281-L12283 |
mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java | OfflinePlugin.startDownload | public void startDownload(OfflineDownloadOptions options) {
Intent intent = new Intent(context, OfflineDownloadService.class);
intent.setAction(OfflineConstants.ACTION_START_DOWNLOAD);
intent.putExtra(KEY_BUNDLE, options);
context.startService(intent);
} | java | public void startDownload(OfflineDownloadOptions options) {
Intent intent = new Intent(context, OfflineDownloadService.class);
intent.setAction(OfflineConstants.ACTION_START_DOWNLOAD);
intent.putExtra(KEY_BUNDLE, options);
context.startService(intent);
} | [
"public",
"void",
"startDownload",
"(",
"OfflineDownloadOptions",
"options",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"OfflineDownloadService",
".",
"class",
")",
";",
"intent",
".",
"setAction",
"(",
"OfflineConstants",
".",
"ACT... | Start downloading an offline download by providing an options object.
<p>
You can listen to the actual creation of the download with {@link OfflineDownloadChangeListener}.
</p>
@param options the offline download builder
@since 0.1.0 | [
"Start",
"downloading",
"an",
"offline",
"download",
"by",
"providing",
"an",
"options",
"object",
".",
"<p",
">",
"You",
"can",
"listen",
"to",
"the",
"actual",
"creation",
"of",
"the",
"download",
"with",
"{",
"@link",
"OfflineDownloadChangeListener",
"}",
"... | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L81-L86 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.getDirectorySchema | public static Schema getDirectorySchema(Path directory, FileSystem fs, boolean latest) throws IOException {
Schema schema = null;
try (Closer closer = Closer.create()) {
List<FileStatus> files = getDirectorySchemaHelper(directory, fs);
if (files == null || files.size() == 0) {
LOG.warn("There is no previous avro file in the directory: " + directory);
} else {
FileStatus file = latest ? files.get(0) : files.get(files.size() - 1);
LOG.debug("Path to get the avro schema: " + file);
FsInput fi = new FsInput(file.getPath(), fs.getConf());
GenericDatumReader<GenericRecord> genReader = new GenericDatumReader<>();
schema = closer.register(new DataFileReader<>(fi, genReader)).getSchema();
}
} catch (IOException ioe) {
throw new IOException("Cannot get the schema for directory " + directory, ioe);
}
return schema;
} | java | public static Schema getDirectorySchema(Path directory, FileSystem fs, boolean latest) throws IOException {
Schema schema = null;
try (Closer closer = Closer.create()) {
List<FileStatus> files = getDirectorySchemaHelper(directory, fs);
if (files == null || files.size() == 0) {
LOG.warn("There is no previous avro file in the directory: " + directory);
} else {
FileStatus file = latest ? files.get(0) : files.get(files.size() - 1);
LOG.debug("Path to get the avro schema: " + file);
FsInput fi = new FsInput(file.getPath(), fs.getConf());
GenericDatumReader<GenericRecord> genReader = new GenericDatumReader<>();
schema = closer.register(new DataFileReader<>(fi, genReader)).getSchema();
}
} catch (IOException ioe) {
throw new IOException("Cannot get the schema for directory " + directory, ioe);
}
return schema;
} | [
"public",
"static",
"Schema",
"getDirectorySchema",
"(",
"Path",
"directory",
",",
"FileSystem",
"fs",
",",
"boolean",
"latest",
")",
"throws",
"IOException",
"{",
"Schema",
"schema",
"=",
"null",
";",
"try",
"(",
"Closer",
"closer",
"=",
"Closer",
".",
"cre... | Get the latest avro schema for a directory
@param directory the input dir that contains avro files
@param fs the {@link FileSystem} for the given directory.
@param latest true to return latest schema, false to return oldest schema
@return the latest/oldest schema in the directory
@throws IOException | [
"Get",
"the",
"latest",
"avro",
"schema",
"for",
"a",
"directory"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L492-L509 |
looly/hutool | hutool-http/src/main/java/cn/hutool/http/HttpConnection.java | HttpConnection.create | public static HttpConnection create(String urlStr, Proxy proxy) {
return create(URLUtil.toUrlForHttp(urlStr), proxy);
} | java | public static HttpConnection create(String urlStr, Proxy proxy) {
return create(URLUtil.toUrlForHttp(urlStr), proxy);
} | [
"public",
"static",
"HttpConnection",
"create",
"(",
"String",
"urlStr",
",",
"Proxy",
"proxy",
")",
"{",
"return",
"create",
"(",
"URLUtil",
".",
"toUrlForHttp",
"(",
"urlStr",
")",
",",
"proxy",
")",
";",
"}"
] | 创建HttpConnection
@param urlStr URL
@param proxy 代理,无代理传{@code null}
@return HttpConnection | [
"创建HttpConnection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpConnection.java#L52-L54 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java | Resources.getResourceAsStream | @Pure
public static InputStream getResourceAsStream(ClassLoader classLoader, String path) {
return currentResourceInstance.getResourceAsStream(classLoader, path);
} | java | @Pure
public static InputStream getResourceAsStream(ClassLoader classLoader, String path) {
return currentResourceInstance.getResourceAsStream(classLoader, path);
} | [
"@",
"Pure",
"public",
"static",
"InputStream",
"getResourceAsStream",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"path",
")",
"{",
"return",
"currentResourceInstance",
".",
"getResourceAsStream",
"(",
"classLoader",
",",
"path",
")",
";",
"}"
] | Replies the input stream of a resource.
<p>You may use Unix-like syntax to write the resource path, ie.
you may use slashes to separate filenames, and may not start the
path with a slash.
<p>If the {@code classLoader} parameter is <code>null</code>,
the class loader replied by {@link ClassLoaderFinder} is used.
If this last is <code>null</code>, the class loader of
the Resources class is used.
@param classLoader is the research scope. If <code>null</code>,
the class loader replied by {@link ClassLoaderFinder} is used.
@param path is the absolute path of the resource.
@return the url of the resource or <code>null</code> if the resource was
not found in class paths. | [
"Replies",
"the",
"input",
"stream",
"of",
"a",
"resource",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L318-L321 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/TextGame.java | TextGame.drawRect | public void drawRect(Graphic g, ColorRgba color, int x, int y, int width, int height)
{
g.setColor(color);
g.drawRect(x - this.x, this.y - y - height + this.height, width, height, false);
} | java | public void drawRect(Graphic g, ColorRgba color, int x, int y, int width, int height)
{
g.setColor(color);
g.drawRect(x - this.x, this.y - y - height + this.height, width, height, false);
} | [
"public",
"void",
"drawRect",
"(",
"Graphic",
"g",
",",
"ColorRgba",
"color",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"g",
".",
"setColor",
"(",
"color",
")",
";",
"g",
".",
"drawRect",
"(",
"x",
"-"... | Renders text on graphic output, to the specified location using the specified localizable referential.
@param g The graphic output.
@param color The rectangle color.
@param x The horizontal location.
@param y The vertical location.
@param width The rectangle width.
@param height The rectangle height. | [
"Renders",
"text",
"on",
"graphic",
"output",
"to",
"the",
"specified",
"location",
"using",
"the",
"specified",
"localizable",
"referential",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/TextGame.java#L100-L104 |
appium/java-client | src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java | EventFiringObjectFactory.getEventFiringObject | public static <T> T getEventFiringObject(T t, WebDriver driver) {
return getEventFiringObject(t, driver, Collections.emptyList());
} | java | public static <T> T getEventFiringObject(T t, WebDriver driver) {
return getEventFiringObject(t, driver, Collections.emptyList());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getEventFiringObject",
"(",
"T",
"t",
",",
"WebDriver",
"driver",
")",
"{",
"return",
"getEventFiringObject",
"(",
"t",
",",
"driver",
",",
"Collections",
".",
"emptyList",
"(",
")",
")",
";",
"}"
] | This method makes an event firing object.
@param t an original {@link Object} that is
supposed to be listenable
@param driver an instance of {@link org.openqa.selenium.WebDriver}
@param <T> T
@return an {@link Object} that fires events | [
"This",
"method",
"makes",
"an",
"event",
"firing",
"object",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java#L54-L56 |
alkacon/opencms-core | src/org/opencms/ade/upload/CmsUploadBean.java | CmsUploadBean.generateResponse | private String generateResponse(Boolean success, String message, String stacktrace) {
JSONObject result = new JSONObject();
try {
result.put(I_CmsUploadConstants.KEY_SUCCESS, success);
result.put(I_CmsUploadConstants.KEY_MESSAGE, message);
result.put(I_CmsUploadConstants.KEY_STACKTRACE, stacktrace);
result.put(I_CmsUploadConstants.KEY_REQUEST_SIZE, getRequest().getContentLength());
result.put(I_CmsUploadConstants.KEY_UPLOADED_FILES, new JSONArray(m_resourcesCreated.keySet()));
result.put(I_CmsUploadConstants.KEY_UPLOADED_FILE_NAMES, new JSONArray(m_resourcesCreated.values()));
if (m_uploadHook != null) {
result.put(I_CmsUploadConstants.KEY_UPLOAD_HOOK, m_uploadHook);
}
} catch (JSONException e) {
LOG.error(m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_JSON_0), e);
}
return result.toString();
} | java | private String generateResponse(Boolean success, String message, String stacktrace) {
JSONObject result = new JSONObject();
try {
result.put(I_CmsUploadConstants.KEY_SUCCESS, success);
result.put(I_CmsUploadConstants.KEY_MESSAGE, message);
result.put(I_CmsUploadConstants.KEY_STACKTRACE, stacktrace);
result.put(I_CmsUploadConstants.KEY_REQUEST_SIZE, getRequest().getContentLength());
result.put(I_CmsUploadConstants.KEY_UPLOADED_FILES, new JSONArray(m_resourcesCreated.keySet()));
result.put(I_CmsUploadConstants.KEY_UPLOADED_FILE_NAMES, new JSONArray(m_resourcesCreated.values()));
if (m_uploadHook != null) {
result.put(I_CmsUploadConstants.KEY_UPLOAD_HOOK, m_uploadHook);
}
} catch (JSONException e) {
LOG.error(m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_JSON_0), e);
}
return result.toString();
} | [
"private",
"String",
"generateResponse",
"(",
"Boolean",
"success",
",",
"String",
"message",
",",
"String",
"stacktrace",
")",
"{",
"JSONObject",
"result",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"result",
".",
"put",
"(",
"I_CmsUploadConstants",... | Generates a JSON object and returns its String representation for the response.<p>
@param success <code>true</code> if the upload was successful
@param message the message to display
@param stacktrace the stack trace in case of an error
@return the the response String | [
"Generates",
"a",
"JSON",
"object",
"and",
"returns",
"its",
"String",
"representation",
"for",
"the",
"response",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/upload/CmsUploadBean.java#L429-L446 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/serialize/SerializationHelper.java | SerializationHelper.getDeserializedObject | @Nonnull
public static <T> T getDeserializedObject (@Nonnull final byte [] aData)
{
ValueEnforcer.notNull (aData, "Data");
// Read new object from byte array
try (final ObjectInputStream aOIS = new ObjectInputStream (new NonBlockingByteArrayInputStream (aData)))
{
return GenericReflection.uncheckedCast (aOIS.readObject ());
}
catch (final Exception ex)
{
throw new IllegalStateException ("Failed to read serializable object", ex);
}
} | java | @Nonnull
public static <T> T getDeserializedObject (@Nonnull final byte [] aData)
{
ValueEnforcer.notNull (aData, "Data");
// Read new object from byte array
try (final ObjectInputStream aOIS = new ObjectInputStream (new NonBlockingByteArrayInputStream (aData)))
{
return GenericReflection.uncheckedCast (aOIS.readObject ());
}
catch (final Exception ex)
{
throw new IllegalStateException ("Failed to read serializable object", ex);
}
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"getDeserializedObject",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aData",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aData",
",",
"\"Data\"",
")",
";",
"// Read new object from byte array",
... | Convert the passed byte array to an object using deserialization.
@param aData
The source serialized byte array. Must contain a single object only.
May not be <code>null</code>.
@return The deserialized object. Never <code>null</code>.
@throws IllegalStateException
If deserialization failed
@param <T>
The type of the deserialized object | [
"Convert",
"the",
"passed",
"byte",
"array",
"to",
"an",
"object",
"using",
"deserialization",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/serialize/SerializationHelper.java#L96-L110 |
HadoopGenomics/Hadoop-BAM | src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java | VCFInputFormat.getSplits | @Override public List<InputSplit> getSplits(JobContext job)
throws IOException
{
if (this.conf == null)
this.conf = job.getConfiguration();
final List<InputSplit> origSplits = super.getSplits(job);
// We have to partition the splits by input format and hand the BCF ones
// over to getBCFSplits().
final List<FileSplit>
bcfOrigSplits = new ArrayList<FileSplit>(origSplits.size());
final List<InputSplit>
newSplits = new ArrayList<InputSplit>(origSplits.size());
for (final InputSplit iSplit : origSplits) {
final FileSplit split = (FileSplit)iSplit;
if (VCFFormat.BCF.equals(getFormat(split.getPath())))
bcfOrigSplits.add(split);
else
newSplits.add(split);
}
fixBCFSplits(bcfOrigSplits, newSplits);
return filterByInterval(newSplits, conf);
} | java | @Override public List<InputSplit> getSplits(JobContext job)
throws IOException
{
if (this.conf == null)
this.conf = job.getConfiguration();
final List<InputSplit> origSplits = super.getSplits(job);
// We have to partition the splits by input format and hand the BCF ones
// over to getBCFSplits().
final List<FileSplit>
bcfOrigSplits = new ArrayList<FileSplit>(origSplits.size());
final List<InputSplit>
newSplits = new ArrayList<InputSplit>(origSplits.size());
for (final InputSplit iSplit : origSplits) {
final FileSplit split = (FileSplit)iSplit;
if (VCFFormat.BCF.equals(getFormat(split.getPath())))
bcfOrigSplits.add(split);
else
newSplits.add(split);
}
fixBCFSplits(bcfOrigSplits, newSplits);
return filterByInterval(newSplits, conf);
} | [
"@",
"Override",
"public",
"List",
"<",
"InputSplit",
">",
"getSplits",
"(",
"JobContext",
"job",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"conf",
"==",
"null",
")",
"this",
".",
"conf",
"=",
"job",
".",
"getConfiguration",
"(",
")",
... | Defers to {@link BCFSplitGuesser} as appropriate for each individual
path. VCF paths do not require special handling, so their splits are left
unchanged. | [
"Defers",
"to",
"{"
] | train | https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java#L272-L298 |
relayrides/pushy | micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java | MicrometerApnsClientMetricsListener.handleNotificationSent | @Override
public void handleNotificationSent(final ApnsClient apnsClient, final long notificationId) {
this.notificationStartTimes.put(notificationId, System.nanoTime());
this.sentNotifications.increment();
} | java | @Override
public void handleNotificationSent(final ApnsClient apnsClient, final long notificationId) {
this.notificationStartTimes.put(notificationId, System.nanoTime());
this.sentNotifications.increment();
} | [
"@",
"Override",
"public",
"void",
"handleNotificationSent",
"(",
"final",
"ApnsClient",
"apnsClient",
",",
"final",
"long",
"notificationId",
")",
"{",
"this",
".",
"notificationStartTimes",
".",
"put",
"(",
"notificationId",
",",
"System",
".",
"nanoTime",
"(",
... | Records a successful attempt to send a notification and updates metrics accordingly.
@param apnsClient the client that sent the notification; note that this is ignored by
{@code MicrometerApnsClientMetricsListener} instances, which should always be used for exactly one client
@param notificationId an opaque, unique identifier for the notification that was sent | [
"Records",
"a",
"successful",
"attempt",
"to",
"send",
"a",
"notification",
"and",
"updates",
"metrics",
"accordingly",
"."
] | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java#L196-L200 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/MapTilePathModel.java | MapTilePathModel.getFreeTileAround | private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id)
{
for (int ctx = tx - radius; ctx <= tx + radius; ctx++)
{
for (int cty = ty - radius; cty <= ty + radius; cty++)
{
if (isAreaAvailable(mover, ctx, cty, tw, th, id))
{
return new CoordTile(ctx, cty);
}
}
}
return null;
} | java | private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id)
{
for (int ctx = tx - radius; ctx <= tx + radius; ctx++)
{
for (int cty = ty - radius; cty <= ty + radius; cty++)
{
if (isAreaAvailable(mover, ctx, cty, tw, th, id))
{
return new CoordTile(ctx, cty);
}
}
}
return null;
} | [
"private",
"CoordTile",
"getFreeTileAround",
"(",
"Pathfindable",
"mover",
",",
"int",
"tx",
",",
"int",
"ty",
",",
"int",
"tw",
",",
"int",
"th",
",",
"int",
"radius",
",",
"Integer",
"id",
")",
"{",
"for",
"(",
"int",
"ctx",
"=",
"tx",
"-",
"radius... | Search a free area from this location.
@param mover The object moving on map.
@param tx The horizontal tile index.
@param ty The vertical tile index.
@param tw The width in tile.
@param th The height in tile.
@param radius The search radius.
@param id The mover id.
@return The free tile found (<code>null</code> if none). | [
"Search",
"a",
"free",
"area",
"from",
"this",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/MapTilePathModel.java#L212-L225 |
3pillarlabs/spring-data-simpledb | spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java | ReflectionUtils.getPropertyField | public static Field getPropertyField(Class<?> clazz, String propertyPath) {
Field propertyField = null;
try {
String[] properties = propertyPath.split("\\.");
Field carField = getDeclaredFieldInHierarchy(clazz, properties[0]);
if (properties.length == 1) {
propertyField = carField;
} else {
String cdr = StringUtils.arrayToDelimitedString(
Arrays.copyOfRange(properties, 1, properties.length), ".");
propertyField = getPropertyField(carField.getType(), cdr);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error accessing propertyPath: " + propertyPath +
" on class: " + clazz.getName(), e);
}
return propertyField;
} | java | public static Field getPropertyField(Class<?> clazz, String propertyPath) {
Field propertyField = null;
try {
String[] properties = propertyPath.split("\\.");
Field carField = getDeclaredFieldInHierarchy(clazz, properties[0]);
if (properties.length == 1) {
propertyField = carField;
} else {
String cdr = StringUtils.arrayToDelimitedString(
Arrays.copyOfRange(properties, 1, properties.length), ".");
propertyField = getPropertyField(carField.getType(), cdr);
}
} catch (Exception e) {
throw new IllegalArgumentException("Error accessing propertyPath: " + propertyPath +
" on class: " + clazz.getName(), e);
}
return propertyField;
} | [
"public",
"static",
"Field",
"getPropertyField",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"propertyPath",
")",
"{",
"Field",
"propertyField",
"=",
"null",
";",
"try",
"{",
"String",
"[",
"]",
"properties",
"=",
"propertyPath",
".",
"split",
"("... | Retrieve the {@link Field} corresponding to the propertyPath in the given
class.
@param clazz
@param propertyPath
@return | [
"Retrieve",
"the",
"{",
"@link",
"Field",
"}",
"corresponding",
"to",
"the",
"propertyPath",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java#L271-L289 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.getContent | public static String getContent(VelocityEngine ve, String templateFileName, VelocityContext context) {
final StringWriter writer = new StringWriter(); // StringWriter不需要关闭
toWriter(ve, templateFileName, context, writer);
return writer.toString();
} | java | public static String getContent(VelocityEngine ve, String templateFileName, VelocityContext context) {
final StringWriter writer = new StringWriter(); // StringWriter不需要关闭
toWriter(ve, templateFileName, context, writer);
return writer.toString();
} | [
"public",
"static",
"String",
"getContent",
"(",
"VelocityEngine",
"ve",
",",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
")",
"{",
"final",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"// StringWriter不需要关闭\r",
"toWriter... | 获得指定模板填充后的内容
@param ve 模板引擎
@param templateFileName 模板名称
@param context 上下文(变量值的容器)
@return 模板和内容匹配后的内容 | [
"获得指定模板填充后的内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L114-L118 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java | Utils.isSubclassOf | public boolean isSubclassOf(TypeElement t1, TypeElement t2) {
return typeUtils.isSubtype(t1.asType(), t2.asType());
} | java | public boolean isSubclassOf(TypeElement t1, TypeElement t2) {
return typeUtils.isSubtype(t1.asType(), t2.asType());
} | [
"public",
"boolean",
"isSubclassOf",
"(",
"TypeElement",
"t1",
",",
"TypeElement",
"t2",
")",
"{",
"return",
"typeUtils",
".",
"isSubtype",
"(",
"t1",
".",
"asType",
"(",
")",
",",
"t2",
".",
"asType",
"(",
")",
")",
";",
"}"
] | Test whether a class is a subclass of another class.
@param t1 the candidate superclass.
@param t2 the target
@return true if t1 is a superclass of t2. | [
"Test",
"whether",
"a",
"class",
"is",
"a",
"subclass",
"of",
"another",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L216-L218 |
fabric8io/fabric8-forge | addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java | MavenHelpers.ensureMavenDependencyAdded | public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
getLOG().debug("Project already includes: " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion());
return false;
}
}
DependencyBuilder component = DependencyBuilder.create().
setGroupId(groupId).
setArtifactId(artifactId);
if (scope != null) {
component.setScopeType(scope);
}
String version = MavenHelpers.getVersion(groupId, artifactId);
if (Strings.isNotBlank(version)) {
component = component.setVersion(version);
getLOG().debug("Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope);
} else {
getLOG().debug("No version could be found for: " + groupId + ":" + artifactId);
}
dependencyInstaller.install(project, component);
return true;
} | java | public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
getLOG().debug("Project already includes: " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion());
return false;
}
}
DependencyBuilder component = DependencyBuilder.create().
setGroupId(groupId).
setArtifactId(artifactId);
if (scope != null) {
component.setScopeType(scope);
}
String version = MavenHelpers.getVersion(groupId, artifactId);
if (Strings.isNotBlank(version)) {
component = component.setVersion(version);
getLOG().debug("Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope);
} else {
getLOG().debug("No version could be found for: " + groupId + ":" + artifactId);
}
dependencyInstaller.install(project, component);
return true;
} | [
"public",
"static",
"boolean",
"ensureMavenDependencyAdded",
"(",
"Project",
"project",
",",
"DependencyInstaller",
"dependencyInstaller",
",",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"scope",
")",
"{",
"List",
"<",
"Dependency",
">",
"depen... | Returns true if the dependency was added or false if its already there | [
"Returns",
"true",
"if",
"the",
"dependency",
"was",
"added",
"or",
"false",
"if",
"its",
"already",
"there"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L121-L147 |
Bernardo-MG/repository-pattern-java | src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java | JpaRepository.buildQuery | private final Query buildQuery(final NamedParameterQueryData query) {
final Query builtQuery; // Query created from the query data
// Builds the base query
builtQuery = getEntityManager().createQuery(query.getQuery());
// Applies the parameters
for (final Entry<String, Object> entry : query.getParameters()
.entrySet()) {
builtQuery.setParameter(entry.getKey(), entry.getValue());
}
return builtQuery;
} | java | private final Query buildQuery(final NamedParameterQueryData query) {
final Query builtQuery; // Query created from the query data
// Builds the base query
builtQuery = getEntityManager().createQuery(query.getQuery());
// Applies the parameters
for (final Entry<String, Object> entry : query.getParameters()
.entrySet()) {
builtQuery.setParameter(entry.getKey(), entry.getValue());
}
return builtQuery;
} | [
"private",
"final",
"Query",
"buildQuery",
"(",
"final",
"NamedParameterQueryData",
"query",
")",
"{",
"final",
"Query",
"builtQuery",
";",
"// Query created from the query data",
"// Builds the base query",
"builtQuery",
"=",
"getEntityManager",
"(",
")",
".",
"createQue... | Creates a {@code Query} from the data contained on the received
{@code QueryData}.
<p>
The string query contained on the {@code QueryData} will be transformed
into the {@code Query}, to which the parameters contained on that same
received object will be applied.
@param query
the base query
@return a {@code Query} created from the received {@code QueryData} | [
"Creates",
"a",
"{",
"@code",
"Query",
"}",
"from",
"the",
"data",
"contained",
"on",
"the",
"received",
"{",
"@code",
"QueryData",
"}",
".",
"<p",
">",
"The",
"string",
"query",
"contained",
"on",
"the",
"{",
"@code",
"QueryData",
"}",
"will",
"be",
"... | train | https://github.com/Bernardo-MG/repository-pattern-java/blob/e94d5bbf9aeeb45acc8485f3686a6e791b082ea8/src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java#L328-L341 |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.handleAddProperty | protected void handleAddProperty(EntityBuilder builder, String propName, Field currentField, Object obj) {
builder.addProperty(propName, ReflectionUtils.getFieldValue(currentField, obj));
} | java | protected void handleAddProperty(EntityBuilder builder, String propName, Field currentField, Object obj) {
builder.addProperty(propName, ReflectionUtils.getFieldValue(currentField, obj));
} | [
"protected",
"void",
"handleAddProperty",
"(",
"EntityBuilder",
"builder",
",",
"String",
"propName",
",",
"Field",
"currentField",
",",
"Object",
"obj",
")",
"{",
"builder",
".",
"addProperty",
"(",
"propName",
",",
"ReflectionUtils",
".",
"getFieldValue",
"(",
... | Handles adding a property to an entity builder. Called by {@link ReflectingConverter#toEntity(Object, Field, Object, List)}
for each property found.
@param builder
@param propName
@param currentField
@param obj | [
"Handles",
"adding",
"a",
"property",
"to",
"an",
"entity",
"builder",
".",
"Called",
"by",
"{",
"@link",
"ReflectingConverter#toEntity",
"(",
"Object",
"Field",
"Object",
"List",
")",
"}",
"for",
"each",
"property",
"found",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L458-L460 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java | ProtectionIntentsInner.validateAsync | public Observable<PreValidateEnableBackupResponseInner> validateAsync(String azureRegion, PreValidateEnableBackupRequest parameters) {
return validateWithServiceResponseAsync(azureRegion, parameters).map(new Func1<ServiceResponse<PreValidateEnableBackupResponseInner>, PreValidateEnableBackupResponseInner>() {
@Override
public PreValidateEnableBackupResponseInner call(ServiceResponse<PreValidateEnableBackupResponseInner> response) {
return response.body();
}
});
} | java | public Observable<PreValidateEnableBackupResponseInner> validateAsync(String azureRegion, PreValidateEnableBackupRequest parameters) {
return validateWithServiceResponseAsync(azureRegion, parameters).map(new Func1<ServiceResponse<PreValidateEnableBackupResponseInner>, PreValidateEnableBackupResponseInner>() {
@Override
public PreValidateEnableBackupResponseInner call(ServiceResponse<PreValidateEnableBackupResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PreValidateEnableBackupResponseInner",
">",
"validateAsync",
"(",
"String",
"azureRegion",
",",
"PreValidateEnableBackupRequest",
"parameters",
")",
"{",
"return",
"validateWithServiceResponseAsync",
"(",
"azureRegion",
",",
"parameters",
")",
... | It will validate followings
1. Vault capacity
2. VM is already protected
3. Any VM related configuration passed in properties.
@param azureRegion Azure region to hit Api
@param parameters Enable backup validation request on Virtual Machine
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PreValidateEnableBackupResponseInner object | [
"It",
"will",
"validate",
"followings",
"1",
".",
"Vault",
"capacity",
"2",
".",
"VM",
"is",
"already",
"protected",
"3",
".",
"Any",
"VM",
"related",
"configuration",
"passed",
"in",
"properties",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java#L112-L119 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java | HandlerMethodMetaArgsFactory.createGetMethod | public MethodMetaArgs createGetMethod(HandlerMetaDef handlerMetaDef, Object keyValue) {
String p_methodName = handlerMetaDef.getFindMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the findMethod parameter: <getMethod name=XXXXX /> ", module);
}
if (keyValue == null) {
Debug.logError("[JdonFramework] not found model's key value:" + handlerMetaDef.getModelMapping().getKeyName()
+ "=? in request parameters", module);
}
return createCRUDMethodMetaArgs(p_methodName, keyValue);
} | java | public MethodMetaArgs createGetMethod(HandlerMetaDef handlerMetaDef, Object keyValue) {
String p_methodName = handlerMetaDef.getFindMethod();
if (p_methodName == null) {
Debug.logError("[JdonFramework] not configure the findMethod parameter: <getMethod name=XXXXX /> ", module);
}
if (keyValue == null) {
Debug.logError("[JdonFramework] not found model's key value:" + handlerMetaDef.getModelMapping().getKeyName()
+ "=? in request parameters", module);
}
return createCRUDMethodMetaArgs(p_methodName, keyValue);
} | [
"public",
"MethodMetaArgs",
"createGetMethod",
"(",
"HandlerMetaDef",
"handlerMetaDef",
",",
"Object",
"keyValue",
")",
"{",
"String",
"p_methodName",
"=",
"handlerMetaDef",
".",
"getFindMethod",
"(",
")",
";",
"if",
"(",
"p_methodName",
"==",
"null",
")",
"{",
... | create find method the service's find method parameter type must be
String type
@param handlerMetaDef
@param keyValue
@return MethodMetaArgs instance | [
"create",
"find",
"method",
"the",
"service",
"s",
"find",
"method",
"parameter",
"type",
"must",
"be",
"String",
"type"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java#L61-L72 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java | AnnotationUtil.getAnnotationValue | public static <T> T getAnnotationValue(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType, String propertyName) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method method = ReflectUtil.getMethodOfObj(annotation, propertyName);
if (null == method) {
return null;
}
return ReflectUtil.invoke(annotation, method);
} | java | public static <T> T getAnnotationValue(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType, String propertyName) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method method = ReflectUtil.getMethodOfObj(annotation, propertyName);
if (null == method) {
return null;
}
return ReflectUtil.invoke(annotation, method);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getAnnotationValue",
"(",
"AnnotatedElement",
"annotationEle",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"String",
"propertyName",
")",
"throws",
"UtilException",
"{",
"final",
"Annotation... | 获取指定注解属性的值<br>
如果无指定的属性方法返回null
@param <T> 注解值类型
@param annotationEle {@link AccessibleObject},可以是Class、Method、Field、Constructor、ReflectPermission
@param annotationType 注解类型
@param propertyName 属性名,例如注解中定义了name()方法,则 此处传入name
@return 注解对象
@throws UtilException 调用注解中的方法时执行异常 | [
"获取指定注解属性的值<br",
">",
"如果无指定的属性方法返回null"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationUtil.java#L90-L101 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java | AccountsInner.listByResourceGroupAsync | public Observable<Page<DataLakeAnalyticsAccountBasicInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Page<DataLakeAnalyticsAccountBasicInner>>() {
@Override
public Page<DataLakeAnalyticsAccountBasicInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DataLakeAnalyticsAccountBasicInner>> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Page<DataLakeAnalyticsAccountBasicInner>>() {
@Override
public Page<DataLakeAnalyticsAccountBasicInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DataLakeAnalyticsAccountBasicInner",
">",
">",
"listByResourceGroupAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"filter",
",",
"final",
"Integer",
"top",
",",
"final",
"Integer",
"skip",
",",... | Gets the first page of Data Lake Analytics accounts, if any, within a specific resource group. This includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group.
@param filter OData filter. Optional.
@param top The number of items to return. Optional.
@param skip The number of items to skip over before returning elements. Optional.
@param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional.
@param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional.
@param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeAnalyticsAccountBasicInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Analytics",
"accounts",
"if",
"any",
"within",
"a",
"specific",
"resource",
"group",
".",
"This",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L543-L551 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getDayDifference | public static long getDayDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffDays = TimeUnit.MILLISECONDS.toDays(diffTime);
return diffDays;
} | java | public static long getDayDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffDays = TimeUnit.MILLISECONDS.toDays(diffTime);
return diffDays;
} | [
"public",
"static",
"long",
"getDayDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
"d... | Gets the day difference.
@param startDate the start date
@param endDate the end date
@return the day difference | [
"Gets",
"the",
"day",
"difference",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L427-L433 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toNormalizedString | public String toNormalizedString(boolean keepMixed, IPv6StringOptions params) {
if(keepMixed && fromString != null && getAddressfromString().isMixedIPv6() && !params.makeMixed()) {
params = new IPv6StringOptions(
params.base,
params.expandSegments,
params.wildcardOption,
params.wildcards,
params.segmentStrPrefix,
true,
params.ipv4Opts,
params.compressOptions,
params.separator,
params.zoneSeparator,
params.addrLabel,
params.addrSuffix,
params.reverse,
params.splitDigits,
params.uppercase);
}
return toNormalizedString(params);
} | java | public String toNormalizedString(boolean keepMixed, IPv6StringOptions params) {
if(keepMixed && fromString != null && getAddressfromString().isMixedIPv6() && !params.makeMixed()) {
params = new IPv6StringOptions(
params.base,
params.expandSegments,
params.wildcardOption,
params.wildcards,
params.segmentStrPrefix,
true,
params.ipv4Opts,
params.compressOptions,
params.separator,
params.zoneSeparator,
params.addrLabel,
params.addrSuffix,
params.reverse,
params.splitDigits,
params.uppercase);
}
return toNormalizedString(params);
} | [
"public",
"String",
"toNormalizedString",
"(",
"boolean",
"keepMixed",
",",
"IPv6StringOptions",
"params",
")",
"{",
"if",
"(",
"keepMixed",
"&&",
"fromString",
"!=",
"null",
"&&",
"getAddressfromString",
"(",
")",
".",
"isMixedIPv6",
"(",
")",
"&&",
"!",
"par... | Constructs a string representing this address according to the given parameters
@param keepMixed if this address was constructed from a string with mixed representation (a:b:c:d:e:f:1.2.3.4), whether to keep it that way (ignored if makeMixed is true in the params argument)
@param params the parameters for the address string | [
"Constructs",
"a",
"string",
"representing",
"this",
"address",
"according",
"to",
"the",
"given",
"parameters"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1968-L1988 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java | AbstractFormatter2._format | protected void _format(EObject obj, IFormattableDocument document) {
for (EObject child : obj.eContents())
document.format(child);
} | java | protected void _format(EObject obj, IFormattableDocument document) {
for (EObject child : obj.eContents())
document.format(child);
} | [
"protected",
"void",
"_format",
"(",
"EObject",
"obj",
",",
"IFormattableDocument",
"document",
")",
"{",
"for",
"(",
"EObject",
"child",
":",
"obj",
".",
"eContents",
"(",
")",
")",
"document",
".",
"format",
"(",
"child",
")",
";",
"}"
] | Fall-back for types that are not handled by a subclasse's dispatch method. | [
"Fall",
"-",
"back",
"for",
"types",
"that",
"are",
"not",
"handled",
"by",
"a",
"subclasse",
"s",
"dispatch",
"method",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/formatting2/AbstractFormatter2.java#L189-L192 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductSearchResultUrl.java | ProductSearchResultUrl.getRandomAccessCursorUrl | public static MozuUrl getRandomAccessCursorUrl(String filter, Integer pageSize, String query, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/productsearch/randomAccessCursor/?query={query}&filter={filter}&pageSize={pageSize}&responseFields={responseFields}");
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("query", query);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getRandomAccessCursorUrl(String filter, Integer pageSize, String query, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/productsearch/randomAccessCursor/?query={query}&filter={filter}&pageSize={pageSize}&responseFields={responseFields}");
formatter.formatUrl("filter", filter);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("query", query);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getRandomAccessCursorUrl",
"(",
"String",
"filter",
",",
"Integer",
"pageSize",
",",
"String",
"query",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/st... | Get Resource Url for GetRandomAccessCursor
@param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters.
@param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.
@param query Properties for the product location inventory provided for queries to locate products by their location.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetRandomAccessCursor"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductSearchResultUrl.java#L24-L32 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/process/ProcessAdapter.java | ProcessAdapter.waitFor | public boolean waitFor(long timeout, TimeUnit unit) {
try {
return getProcess().waitFor(timeout, unit);
}
catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
return isNotRunning();
}
} | java | public boolean waitFor(long timeout, TimeUnit unit) {
try {
return getProcess().waitFor(timeout, unit);
}
catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
return isNotRunning();
}
} | [
"public",
"boolean",
"waitFor",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"try",
"{",
"return",
"getProcess",
"(",
")",
".",
"waitFor",
"(",
"timeout",
",",
"unit",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ignore",
")",
"{",... | Waits until the specified timeout for this {@link Process} to stop.
This method handles the {@link InterruptedException} thrown by {@link Process#waitFor(long, TimeUnit)}
by resetting the interrupt bit on the current (calling) {@link Thread}.
@param timeout long value to indicate the number of units in the timeout.
@param unit {@link TimeUnit} of the timeout (e.g. seconds).
@return a boolean value indicating whether the {@link Process} stopped within the given timeout.
@see java.lang.Process#waitFor(long, TimeUnit)
@see #isNotRunning() | [
"Waits",
"until",
"the",
"specified",
"timeout",
"for",
"this",
"{",
"@link",
"Process",
"}",
"to",
"stop",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/process/ProcessAdapter.java#L677-L685 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java | SpecializedOps_DDRM.addIdentity | public static void addIdentity(DMatrix1Row A , DMatrix1Row B , double alpha )
{
if( A.numCols != A.numRows )
throw new IllegalArgumentException("A must be square");
if( B.numCols != A.numCols || B.numRows != A.numRows )
throw new IllegalArgumentException("B must be the same shape as A");
int n = A.numCols;
int index = 0;
for( int i = 0; i < n; i++ ) {
for( int j = 0; j < n; j++ , index++) {
if( i == j ) {
B.set( index , A.get(index) + alpha);
} else {
B.set( index , A.get(index) );
}
}
}
} | java | public static void addIdentity(DMatrix1Row A , DMatrix1Row B , double alpha )
{
if( A.numCols != A.numRows )
throw new IllegalArgumentException("A must be square");
if( B.numCols != A.numCols || B.numRows != A.numRows )
throw new IllegalArgumentException("B must be the same shape as A");
int n = A.numCols;
int index = 0;
for( int i = 0; i < n; i++ ) {
for( int j = 0; j < n; j++ , index++) {
if( i == j ) {
B.set( index , A.get(index) + alpha);
} else {
B.set( index , A.get(index) );
}
}
}
} | [
"public",
"static",
"void",
"addIdentity",
"(",
"DMatrix1Row",
"A",
",",
"DMatrix1Row",
"B",
",",
"double",
"alpha",
")",
"{",
"if",
"(",
"A",
".",
"numCols",
"!=",
"A",
".",
"numRows",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A must be squar... | <p>
Performs the following operation:<br>
<br>
B = A + αI
<p>
@param A A square matrix. Not modified.
@param B A square matrix that the results are saved to. Modified.
@param alpha Scaling factor for the identity matrix. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"B",
"=",
"A",
"+",
"&alpha",
";",
"I",
"<p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L284-L303 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java | ReflectUtil.getTypePackageNames | private static void getTypePackageNames(Type type, Map<String, Class<?>> packageNames) {
if (type instanceof Class<?>) {
getClassPackageNames((Class<?>) type, packageNames);
} else if (type instanceof GenericArrayType) {
getTypePackageNames(((GenericArrayType) type).getGenericComponentType(), packageNames);
} else if (type instanceof ParameterizedType) {
getParameterizedTypePackageNames((ParameterizedType) type, packageNames);
} else if (type instanceof TypeVariable) {
getTypeVariablePackageNames((TypeVariable) type, packageNames);
} else if (type instanceof WildcardType) {
getWildcardTypePackageNames((WildcardType) type, packageNames);
}
} | java | private static void getTypePackageNames(Type type, Map<String, Class<?>> packageNames) {
if (type instanceof Class<?>) {
getClassPackageNames((Class<?>) type, packageNames);
} else if (type instanceof GenericArrayType) {
getTypePackageNames(((GenericArrayType) type).getGenericComponentType(), packageNames);
} else if (type instanceof ParameterizedType) {
getParameterizedTypePackageNames((ParameterizedType) type, packageNames);
} else if (type instanceof TypeVariable) {
getTypeVariablePackageNames((TypeVariable) type, packageNames);
} else if (type instanceof WildcardType) {
getWildcardTypePackageNames((WildcardType) type, packageNames);
}
} | [
"private",
"static",
"void",
"getTypePackageNames",
"(",
"Type",
"type",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"packageNames",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"getClassPackageNames",
"("... | Visits all the components of a type, collecting a map taking the name of
each package in which package-private types are defined to one of the
classes contained in {@code type} that belongs to that package. If any
private types are encountered, an {@link IllegalArgumentException} is
thrown.
This is required to deal with situations like Generic<Private> where
Generic is publically defined in package A and Private is private to
package B; we need to place code that uses this type in package B, even
though the top-level class is from A. | [
"Visits",
"all",
"the",
"components",
"of",
"a",
"type",
"collecting",
"a",
"map",
"taking",
"the",
"name",
"of",
"each",
"package",
"in",
"which",
"package",
"-",
"private",
"types",
"are",
"defined",
"to",
"one",
"of",
"the",
"classes",
"contained",
"in"... | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java#L216-L228 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainerCreator.java | QueryAtomContainerCreator.createAnyAtomContainer | public static QueryAtomContainer createAnyAtomContainer(IAtomContainer container, boolean aromaticity) {
if (aromaticity)
return QueryAtomContainer.create(container,
Expr.Type.IS_AROMATIC,
Expr.Type.ALIPHATIC_ORDER);
else
return QueryAtomContainer.create(container,
Expr.Type.ORDER);
} | java | public static QueryAtomContainer createAnyAtomContainer(IAtomContainer container, boolean aromaticity) {
if (aromaticity)
return QueryAtomContainer.create(container,
Expr.Type.IS_AROMATIC,
Expr.Type.ALIPHATIC_ORDER);
else
return QueryAtomContainer.create(container,
Expr.Type.ORDER);
} | [
"public",
"static",
"QueryAtomContainer",
"createAnyAtomContainer",
"(",
"IAtomContainer",
"container",
",",
"boolean",
"aromaticity",
")",
"{",
"if",
"(",
"aromaticity",
")",
"return",
"QueryAtomContainer",
".",
"create",
"(",
"container",
",",
"Expr",
".",
"Type",... | Creates a QueryAtomContainer with the following settings:
<pre>
// aromaticity = true
QueryAtomContainer.create(container,
Expr.Type.IS_AROMATIC,
Expr.Type.ALIPHATIC_ORDER);
// aromaticity = false
QueryAtomContainer.create(container,
Expr.Type.ORDER);
</pre>
@param container The AtomContainer that stands as model
@param aromaticity option flag
@return The new QueryAtomContainer created from container. | [
"Creates",
"a",
"QueryAtomContainer",
"with",
"the",
"following",
"settings",
":"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/QueryAtomContainerCreator.java#L151-L159 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java | SignatureConverter.convertMethodSignature | public static String convertMethodSignature(String className, String methodName, String methodSig) {
return convertMethodSignature(className, methodName, methodSig, "");
} | java | public static String convertMethodSignature(String className, String methodName, String methodSig) {
return convertMethodSignature(className, methodName, methodSig, "");
} | [
"public",
"static",
"String",
"convertMethodSignature",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"String",
"methodSig",
")",
"{",
"return",
"convertMethodSignature",
"(",
"className",
",",
"methodName",
",",
"methodSig",
",",
"\"\"",
")",
";",... | Convenience method for generating a method signature in human readable
form.
@param className
name of the class containing the method
@param methodName
the name of the method
@param methodSig
the signature of the method | [
"Convenience",
"method",
"for",
"generating",
"a",
"method",
"signature",
"in",
"human",
"readable",
"form",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L185-L187 |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java | IncrementalSSSP.isInSSSP | public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception {
return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() {
@Override
public boolean filter(Edge<Long, Double> edge) throws Exception {
return edge.equals(edgeToBeRemoved);
}
}).count() > 0;
} | java | public static boolean isInSSSP(final Edge<Long, Double> edgeToBeRemoved, DataSet<Edge<Long, Double>> edgesInSSSP) throws Exception {
return edgesInSSSP.filter(new FilterFunction<Edge<Long, Double>>() {
@Override
public boolean filter(Edge<Long, Double> edge) throws Exception {
return edge.equals(edgeToBeRemoved);
}
}).count() > 0;
} | [
"public",
"static",
"boolean",
"isInSSSP",
"(",
"final",
"Edge",
"<",
"Long",
",",
"Double",
">",
"edgeToBeRemoved",
",",
"DataSet",
"<",
"Edge",
"<",
"Long",
",",
"Double",
">",
">",
"edgesInSSSP",
")",
"throws",
"Exception",
"{",
"return",
"edgesInSSSP",
... | Function that verifies whether the edge to be removed is part of the SSSP or not.
If it is, the src vertex will be invalidated.
@param edgeToBeRemoved
@param edgesInSSSP
@return true or false | [
"Function",
"that",
"verifies",
"whether",
"the",
"edge",
"to",
"be",
"removed",
"is",
"part",
"of",
"the",
"SSSP",
"or",
"not",
".",
"If",
"it",
"is",
"the",
"src",
"vertex",
"will",
"be",
"invalidated",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/examples/IncrementalSSSP.java#L140-L148 |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.readResourceCategories | public List<CmsCategory> readResourceCategories(CmsObject cms, String resourceName) throws CmsException {
return internalReadResourceCategories(cms, cms.readResource(resourceName), false);
} | java | public List<CmsCategory> readResourceCategories(CmsObject cms, String resourceName) throws CmsException {
return internalReadResourceCategories(cms, cms.readResource(resourceName), false);
} | [
"public",
"List",
"<",
"CmsCategory",
">",
"readResourceCategories",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
")",
"throws",
"CmsException",
"{",
"return",
"internalReadResourceCategories",
"(",
"cms",
",",
"cms",
".",
"readResource",
"(",
"resourceNa... | Reads the categories for a resource identified by the given resource name.<p>
@param cms the current cms context
@param resourceName the path of the resource to get the categories for
@return the categories list
@throws CmsException if something goes wrong | [
"Reads",
"the",
"categories",
"for",
"a",
"resource",
"identified",
"by",
"the",
"given",
"resource",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L664-L667 |
wisdom-framework/wisdom-jcr | wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java | JcromBundleContext.addCrudService | public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException {
jcrom.map(clazz);
JcrCrudService<? extends Object> jcromCrudService;
jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz);
crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService));
} | java | public void addCrudService(Class clazz, BundleContext bundleContext, JcrRepository repository) throws RepositoryException {
jcrom.map(clazz);
JcrCrudService<? extends Object> jcromCrudService;
jcromCrudService = new JcrCrudService<>(repository, jcrom, clazz);
crudServiceRegistrations.put(jcromCrudService, registerCrud(bundleContext, jcromCrudService));
} | [
"public",
"void",
"addCrudService",
"(",
"Class",
"clazz",
",",
"BundleContext",
"bundleContext",
",",
"JcrRepository",
"repository",
")",
"throws",
"RepositoryException",
"{",
"jcrom",
".",
"map",
"(",
"clazz",
")",
";",
"JcrCrudService",
"<",
"?",
"extends",
"... | Create a crud service for given class and context, and registers it
@param clazz
@param context
@param repository
@throws RepositoryException | [
"Create",
"a",
"crud",
"service",
"for",
"given",
"class",
"and",
"context",
"and",
"registers",
"it"
] | train | https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-jcr-core/src/main/java/org/wisdom/jcrom/runtime/JcromBundleContext.java#L60-L65 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java | LayoutRefiner.visitAdj | private int visitAdj(boolean[] visited, int[] result, int p, int v) {
int n = 0;
Arrays.fill(visited, false);
visited[v] = true;
for (int w : adjList[v]) {
if (w != p && !visited[w]) {
n = visit(visited, result, v, w, n);
}
}
visited[v] = false;
return n;
} | java | private int visitAdj(boolean[] visited, int[] result, int p, int v) {
int n = 0;
Arrays.fill(visited, false);
visited[v] = true;
for (int w : adjList[v]) {
if (w != p && !visited[w]) {
n = visit(visited, result, v, w, n);
}
}
visited[v] = false;
return n;
} | [
"private",
"int",
"visitAdj",
"(",
"boolean",
"[",
"]",
"visited",
",",
"int",
"[",
"]",
"result",
",",
"int",
"p",
",",
"int",
"v",
")",
"{",
"int",
"n",
"=",
"0",
";",
"Arrays",
".",
"fill",
"(",
"visited",
",",
"false",
")",
";",
"visited",
... | Recursively visit 'v' and all vertices adjacent to it (excluding 'p')
adding all except 'v' to the result array.
@param visited visit flags array, should be cleared before search
@param result visited vertices
@param p previous vertex
@param v start vertex
@return number of visited vertices | [
"Recursively",
"visit",
"v",
"and",
"all",
"vertices",
"adjacent",
"to",
"it",
"(",
"excluding",
"p",
")",
"adding",
"all",
"except",
"v",
"to",
"the",
"result",
"array",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L998-L1009 |
bThink-BGU/BPjs | src/main/java/il/ac/bgu/cs/bp/bpjs/internal/ScriptableUtils.java | ScriptableUtils.jsEquals | public static boolean jsEquals(Object o1, Object o2) {
// quick breakers
if (o1 == o2) return true;
if (o1 == null ^ o2 == null) return false;
// Can we do a by-part comparison?
if (o1 instanceof ScriptableObject && o2 instanceof ScriptableObject) {
return jsScriptableObjectEqual((ScriptableObject) o1, (ScriptableObject) o2);
}
// Concatenated strings in Rhino have a different type. We need to manually
// resolve to String semantics, which is what the following lines do.
if (o1 instanceof ConsString) {
o1 = o1.toString();
}
if (o2 instanceof ConsString) {
o2 = o2.toString();
}
// default comparison (hopefully they have meaningful equals())
return o1.equals(o2);
} | java | public static boolean jsEquals(Object o1, Object o2) {
// quick breakers
if (o1 == o2) return true;
if (o1 == null ^ o2 == null) return false;
// Can we do a by-part comparison?
if (o1 instanceof ScriptableObject && o2 instanceof ScriptableObject) {
return jsScriptableObjectEqual((ScriptableObject) o1, (ScriptableObject) o2);
}
// Concatenated strings in Rhino have a different type. We need to manually
// resolve to String semantics, which is what the following lines do.
if (o1 instanceof ConsString) {
o1 = o1.toString();
}
if (o2 instanceof ConsString) {
o2 = o2.toString();
}
// default comparison (hopefully they have meaningful equals())
return o1.equals(o2);
} | [
"public",
"static",
"boolean",
"jsEquals",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"// quick breakers",
"if",
"(",
"o1",
"==",
"o2",
")",
"return",
"true",
";",
"if",
"(",
"o1",
"==",
"null",
"^",
"o2",
"==",
"null",
")",
"return",
"false... | Deep-compare of {@code o1} and {@code o2}. Recurses down these objects,
when needed.
<em>DOES NOT DEAL WITH CIRCULAR REFERENCES!</em>
@param o1
@param o2
@return {@code true} iff both objects are recursively equal | [
"Deep",
"-",
"compare",
"of",
"{",
"@code",
"o1",
"}",
"and",
"{",
"@code",
"o2",
"}",
".",
"Recurses",
"down",
"these",
"objects",
"when",
"needed",
"."
] | train | https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/internal/ScriptableUtils.java#L71-L93 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.getName | public static String getName(String s, String separator) {
if (s.length() == 1) { // handle common case
return getName(s.charAt(0));
}
int cp;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i);
if (i != 0) sb.append(separator);
sb.append(UCharacter.getName(cp));
}
return sb.toString();
} | java | public static String getName(String s, String separator) {
if (s.length() == 1) { // handle common case
return getName(s.charAt(0));
}
int cp;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i);
if (i != 0) sb.append(separator);
sb.append(UCharacter.getName(cp));
}
return sb.toString();
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"s",
",",
"String",
"separator",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"// handle common case",
"return",
"getName",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")"... | <strong>[icu]</strong> Returns the names for each of the characters in a string
@param s string to format
@param separator string to go between names
@return string of names | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"names",
"for",
"each",
"of",
"the",
"characters",
"in",
"a",
"string"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L3901-L3913 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java | LabeledScoredTreeFactory.newTreeNode | @Override
public Tree newTreeNode(Label parentLabel, List<Tree> children) {
return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children);
} | java | @Override
public Tree newTreeNode(Label parentLabel, List<Tree> children) {
return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children);
} | [
"@",
"Override",
"public",
"Tree",
"newTreeNode",
"(",
"Label",
"parentLabel",
",",
"List",
"<",
"Tree",
">",
"children",
")",
"{",
"return",
"new",
"LabeledScoredTreeNode",
"(",
"lf",
".",
"newLabel",
"(",
"parentLabel",
")",
",",
"children",
")",
";",
"}... | Create a new non-leaf tree node with the given label
@param parentLabel The label for the node
@param children A <code>List</code> of the children of this node,
each of which should itself be a <code>LabeledScoredTree</code>
@return A new internal tree node | [
"Create",
"a",
"new",
"non",
"-",
"leaf",
"tree",
"node",
"with",
"the",
"given",
"label"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java#L67-L70 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java | ProductSortDefinitionUrl.updateProductSortDefinitionUrl | public static MozuUrl updateProductSortDefinitionUrl(Integer productSortDefinitionId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}");
formatter.formatUrl("productSortDefinitionId", productSortDefinitionId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateProductSortDefinitionUrl(Integer productSortDefinitionId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/productsortdefinitions/{productSortDefinitionId}?responseFields={responseFields}");
formatter.formatUrl("productSortDefinitionId", productSortDefinitionId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateProductSortDefinitionUrl",
"(",
"Integer",
"productSortDefinitionId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/productsortdefinitions/{productSortD... | Get Resource Url for UpdateProductSortDefinition
@param productSortDefinitionId Unique identifier of the product sort definition.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateProductSortDefinition"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/ProductSortDefinitionUrl.java#L70-L76 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/saverestore/IndexSnapshotWritePlan.java | IndexSnapshotWritePlan.createIndexExpressionForTable | public static AbstractExpression createIndexExpressionForTable(Table table, Map<Integer, Integer> ranges)
{
HashRangeExpression predicate = new HashRangeExpression();
predicate.setRanges(ranges);
predicate.setHashColumnIndex(table.getPartitioncolumn().getIndex());
return predicate;
} | java | public static AbstractExpression createIndexExpressionForTable(Table table, Map<Integer, Integer> ranges)
{
HashRangeExpression predicate = new HashRangeExpression();
predicate.setRanges(ranges);
predicate.setHashColumnIndex(table.getPartitioncolumn().getIndex());
return predicate;
} | [
"public",
"static",
"AbstractExpression",
"createIndexExpressionForTable",
"(",
"Table",
"table",
",",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"ranges",
")",
"{",
"HashRangeExpression",
"predicate",
"=",
"new",
"HashRangeExpression",
"(",
")",
";",
"predicate",
... | Create the expression used to build elastic index for a given table.
@param table The table to build the elastic index on
@param ranges The hash ranges that the index should include | [
"Create",
"the",
"expression",
"used",
"to",
"build",
"elastic",
"index",
"for",
"a",
"given",
"table",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/IndexSnapshotWritePlan.java#L116-L123 |
google/gson | gson/src/main/java/com/google/gson/JsonObject.java | JsonObject.addProperty | public void addProperty(String property, Character value) {
add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value));
} | java | public void addProperty(String property, Character value) {
add(property, value == null ? JsonNull.INSTANCE : new JsonPrimitive(value));
} | [
"public",
"void",
"addProperty",
"(",
"String",
"property",
",",
"Character",
"value",
")",
"{",
"add",
"(",
"property",
",",
"value",
"==",
"null",
"?",
"JsonNull",
".",
"INSTANCE",
":",
"new",
"JsonPrimitive",
"(",
"value",
")",
")",
";",
"}"
] | Convenience method to add a char member. The specified value is converted to a
JsonPrimitive of Character.
@param property name of the member.
@param value the number value associated with the member. | [
"Convenience",
"method",
"to",
"add",
"a",
"char",
"member",
".",
"The",
"specified",
"value",
"is",
"converted",
"to",
"a",
"JsonPrimitive",
"of",
"Character",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/JsonObject.java#L112-L114 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/jasper/DataSourceProcessor.java | DataSourceProcessor.setAttribute | public void setAttribute(final String name, final Attribute attribute) {
if (name.equals("datasource")) {
this.allAttributes.putAll(((DataSourceAttribute) attribute).getAttributes());
} else if (this.copyAttributes.contains(name)) {
this.allAttributes.put(name, attribute);
}
} | java | public void setAttribute(final String name, final Attribute attribute) {
if (name.equals("datasource")) {
this.allAttributes.putAll(((DataSourceAttribute) attribute).getAttributes());
} else if (this.copyAttributes.contains(name)) {
this.allAttributes.put(name, attribute);
}
} | [
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"Attribute",
"attribute",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"\"datasource\"",
")",
")",
"{",
"this",
".",
"allAttributes",
".",
"putAll",
"(",
"(",
"(",
"DataS... | All the sub-level attributes.
@param name the attribute name.
@param attribute the attribute. | [
"All",
"the",
"sub",
"-",
"level",
"attributes",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/jasper/DataSourceProcessor.java#L188-L194 |
hawkular/hawkular-apm | server/elasticsearch/src/main/java/org/hawkular/apm/server/elasticsearch/SpanServiceElasticsearch.java | SpanServiceElasticsearch.processConnectedFragment | protected void processConnectedFragment(String tenantId, Trace fragment) {
List<Producer> producers = NodeUtil.findNodes(fragment.getNodes(), Producer.class);
for (Producer producer : producers) {
if (!producer.getCorrelationIds().isEmpty()) {
List<Trace> fragments = getTraceFragments(tenantId, producer.getCorrelationIds().stream()
.map(correlationIdentifier -> correlationIdentifier.getValue())
.collect(Collectors.toList()));
for (Trace descendant : fragments) {
// Attach the fragment root nodes to the producer
producer.getNodes().addAll(descendant.getNodes());
processConnectedFragment(tenantId, descendant);
}
}
}
} | java | protected void processConnectedFragment(String tenantId, Trace fragment) {
List<Producer> producers = NodeUtil.findNodes(fragment.getNodes(), Producer.class);
for (Producer producer : producers) {
if (!producer.getCorrelationIds().isEmpty()) {
List<Trace> fragments = getTraceFragments(tenantId, producer.getCorrelationIds().stream()
.map(correlationIdentifier -> correlationIdentifier.getValue())
.collect(Collectors.toList()));
for (Trace descendant : fragments) {
// Attach the fragment root nodes to the producer
producer.getNodes().addAll(descendant.getNodes());
processConnectedFragment(tenantId, descendant);
}
}
}
} | [
"protected",
"void",
"processConnectedFragment",
"(",
"String",
"tenantId",
",",
"Trace",
"fragment",
")",
"{",
"List",
"<",
"Producer",
">",
"producers",
"=",
"NodeUtil",
".",
"findNodes",
"(",
"fragment",
".",
"getNodes",
"(",
")",
",",
"Producer",
".",
"c... | This method aggregates enhances the root trace, representing the
complete end to end instance view, with the details available from
a linked trace fragment that should be attached to the supplied
Producer node. If the producer node is null then don't merge
(as fragment is root) and just recursively process the fragment
to identify additional linked fragments.
@param tenantId The tenant id
@param fragment The fragment to be processed | [
"This",
"method",
"aggregates",
"enhances",
"the",
"root",
"trace",
"representing",
"the",
"complete",
"end",
"to",
"end",
"instance",
"view",
"with",
"the",
"details",
"available",
"from",
"a",
"linked",
"trace",
"fragment",
"that",
"should",
"be",
"attached",
... | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/elasticsearch/src/main/java/org/hawkular/apm/server/elasticsearch/SpanServiceElasticsearch.java#L262-L279 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java | BigFloatStream.range | public static Stream<BigFloat> range(BigFloat startInclusive, BigFloat endExclusive, BigFloat step) {
if (step.isZero()) {
throw new IllegalArgumentException("invalid step: 0");
}
if (endExclusive.subtract(startInclusive).signum() != step.signum()) {
return Stream.empty();
}
return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endExclusive, false, step), false);
} | java | public static Stream<BigFloat> range(BigFloat startInclusive, BigFloat endExclusive, BigFloat step) {
if (step.isZero()) {
throw new IllegalArgumentException("invalid step: 0");
}
if (endExclusive.subtract(startInclusive).signum() != step.signum()) {
return Stream.empty();
}
return StreamSupport.stream(new BigFloatSpliterator(startInclusive, endExclusive, false, step), false);
} | [
"public",
"static",
"Stream",
"<",
"BigFloat",
">",
"range",
"(",
"BigFloat",
"startInclusive",
",",
"BigFloat",
"endExclusive",
",",
"BigFloat",
"step",
")",
"{",
"if",
"(",
"step",
".",
"isZero",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | Returns a sequential ordered {@code Stream<BigFloat>} from {@code startInclusive}
(inclusive) to {@code endExclusive} (exclusive) by an incremental {@code step}.
<p>An equivalent sequence of increasing values can be produced
sequentially using a {@code for} loop as follows:
<pre>for (BigFloat i = startInclusive; i.isLessThan(endExclusive); i = i.add(step)) {
...
}</pre>
@param startInclusive the (inclusive) initial value
@param endExclusive the exclusive upper bound
@param step the step between elements
@return a sequential {@code Stream<BigFloat>} | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"Stream<BigFloat",
">",
"}",
"from",
"{",
"@code",
"startInclusive",
"}",
"(",
"inclusive",
")",
"to",
"{",
"@code",
"endExclusive",
"}",
"(",
"exclusive",
")",
"by",
"an",
"incremental",
"{",
"@code",
... | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/stream/BigFloatStream.java#L33-L41 |
Azure/azure-sdk-for-java | signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java | SignalRsInner.beginUpdate | public SignalRResourceInner beginUpdate(String resourceGroupName, String resourceName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public SignalRResourceInner beginUpdate(String resourceGroupName, String resourceName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"SignalRResourceInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",... | Operation to update an exiting SignalR service.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param resourceName The name of the SignalR resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SignalRResourceInner object if successful. | [
"Operation",
"to",
"update",
"an",
"exiting",
"SignalR",
"service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1581-L1583 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.sendTypingStarted | public ApiSuccessResponse sendTypingStarted(String id, AcceptData3 acceptData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendTypingStartedWithHttpInfo(id, acceptData);
return resp.getData();
} | java | public ApiSuccessResponse sendTypingStarted(String id, AcceptData3 acceptData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendTypingStartedWithHttpInfo(id, acceptData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"sendTypingStarted",
"(",
"String",
"id",
",",
"AcceptData3",
"acceptData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"sendTypingStartedWithHttpInfo",
"(",
"id",
",",
"acceptData",
"... | Send notification that the agent is typing
Send notification that the agent is typing to the other participants in the specified chat.
@param id The ID of the chat interaction. (required)
@param acceptData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Send",
"notification",
"that",
"the",
"agent",
"is",
"typing",
"Send",
"notification",
"that",
"the",
"agent",
"is",
"typing",
"to",
"the",
"other",
"participants",
"in",
"the",
"specified",
"chat",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1826-L1829 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.arrayEndsWith | public static boolean arrayEndsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
int arrindex = array.length;
while (--index >= 0) {
if (array[--arrindex] != str[index]) {
result = false;
break;
}
}
}
return result;
} | java | public static boolean arrayEndsWith(final byte[] array, final byte[] str) {
boolean result = false;
if (array.length >= str.length) {
result = true;
int index = str.length;
int arrindex = array.length;
while (--index >= 0) {
if (array[--arrindex] != str[index]) {
result = false;
break;
}
}
}
return result;
} | [
"public",
"static",
"boolean",
"arrayEndsWith",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"byte",
"[",
"]",
"str",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"array",
".",
"length",
">=",
"str",
".",
"length",
")",
"{",... | Check that a byte array ends with some byte values.
@param array array to be checked, must not be null
@param str a byte string which will be checked as the end sequence of the
array, must not be null
@return true if the string is the end sequence of the array, false
otherwise
@throws NullPointerException if any argument is null
@since 1.1 | [
"Check",
"that",
"a",
"byte",
"array",
"ends",
"with",
"some",
"byte",
"values",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L941-L955 |
OpenLiberty/open-liberty | dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTransactionImpl.java | EmbeddableTransactionImpl.enlistAsyncResource | @Override
public void enlistAsyncResource(String xaResFactoryFilter, Serializable xaResInfo, Xid xid) throws SystemException // @LIDB1922-5C
{
if (tc.isEntryEnabled())
Tr.entry(tc, "enlistAsyncResource (SPI): args: ", new Object[] { xaResFactoryFilter, xaResInfo, xid });
try {
final WSATAsyncResource res = new WSATAsyncResource(xaResFactoryFilter, xaResInfo, xid);
final WSATParticipantWrapper wrapper = new WSATParticipantWrapper(res);
getResources().addAsyncResource(wrapper);
} finally {
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistAsyncResource (SPI)");
}
} | java | @Override
public void enlistAsyncResource(String xaResFactoryFilter, Serializable xaResInfo, Xid xid) throws SystemException // @LIDB1922-5C
{
if (tc.isEntryEnabled())
Tr.entry(tc, "enlistAsyncResource (SPI): args: ", new Object[] { xaResFactoryFilter, xaResInfo, xid });
try {
final WSATAsyncResource res = new WSATAsyncResource(xaResFactoryFilter, xaResInfo, xid);
final WSATParticipantWrapper wrapper = new WSATParticipantWrapper(res);
getResources().addAsyncResource(wrapper);
} finally {
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistAsyncResource (SPI)");
}
} | [
"@",
"Override",
"public",
"void",
"enlistAsyncResource",
"(",
"String",
"xaResFactoryFilter",
",",
"Serializable",
"xaResInfo",
",",
"Xid",
"xid",
")",
"throws",
"SystemException",
"// @LIDB1922-5C",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"... | Enlist an asynchronous resource with the target TransactionImpl object.
A WSATParticipantWrapper is typically a representation of a downstream WSAT
subordinate server.
@param asyncResource the remote WSATParticipantWrapper | [
"Enlist",
"an",
"asynchronous",
"resource",
"with",
"the",
"target",
"TransactionImpl",
"object",
".",
"A",
"WSATParticipantWrapper",
"is",
"typically",
"a",
"representation",
"of",
"a",
"downstream",
"WSAT",
"subordinate",
"server",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/jta/embeddable/impl/EmbeddableTransactionImpl.java#L573-L586 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/client/MetaDataService.java | MetaDataService.deleteGroupEntities | public boolean deleteGroupEntities(String entityGroupName, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
QueryPart<Entity> query = new Query<Entity>("entity-groups")
.path(entityGroupName, true)
.path("entities/delete");
return httpClientManager.updateMetaData(query, post(entitiesNames));
} | java | public boolean deleteGroupEntities(String entityGroupName, Entity... entities) {
checkEntityGroupIsEmpty(entityGroupName);
List<String> entitiesNames = new ArrayList<>();
for (Entity entity : entities) {
entitiesNames.add(entity.getName());
}
QueryPart<Entity> query = new Query<Entity>("entity-groups")
.path(entityGroupName, true)
.path("entities/delete");
return httpClientManager.updateMetaData(query, post(entitiesNames));
} | [
"public",
"boolean",
"deleteGroupEntities",
"(",
"String",
"entityGroupName",
",",
"Entity",
"...",
"entities",
")",
"{",
"checkEntityGroupIsEmpty",
"(",
"entityGroupName",
")",
";",
"List",
"<",
"String",
">",
"entitiesNames",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Delete entities from entity group.
@param entityGroupName Entity group name.
@param entities Entities to replace. @return {@code true} if entities added.
@return is success
@throws AtsdClientException raised if there is any client problem
@throws AtsdServerException raised if there is any server problem | [
"Delete",
"entities",
"from",
"entity",
"group",
"."
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/client/MetaDataService.java#L555-L565 |
aoindustries/aoweb-framework | src/main/java/com/aoindustries/website/framework/WebPage.java | WebPage.getNavImageURL | public String getNavImageURL(WebSiteRequest req, HttpServletResponse resp, Object params) throws IOException, SQLException {
return resp.encodeURL(req.getContextPath()+req.getURL(this, params));
} | java | public String getNavImageURL(WebSiteRequest req, HttpServletResponse resp, Object params) throws IOException, SQLException {
return resp.encodeURL(req.getContextPath()+req.getURL(this, params));
} | [
"public",
"String",
"getNavImageURL",
"(",
"WebSiteRequest",
"req",
",",
"HttpServletResponse",
"resp",
",",
"Object",
"params",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"return",
"resp",
".",
"encodeURL",
"(",
"req",
".",
"getContextPath",
"(",
"... | Gets the URL associated with a nav image.
@see #getNavImageAlt
@see #getNavImageSuffix | [
"Gets",
"the",
"URL",
"associated",
"with",
"a",
"nav",
"image",
"."
] | train | https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/WebPage.java#L674-L676 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java | EnumHelper.getFromIDCaseInsensitiveOrDefault | @Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrDefault (@Nonnull final Class <ENUMTYPE> aClass,
@Nullable final String sID,
@Nullable final ENUMTYPE eDefault)
{
ValueEnforcer.notNull (aClass, "Class");
if (sID == null)
return eDefault;
return findFirst (aClass, x -> x.getID ().equalsIgnoreCase (sID), eDefault);
} | java | @Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrDefault (@Nonnull final Class <ENUMTYPE> aClass,
@Nullable final String sID,
@Nullable final ENUMTYPE eDefault)
{
ValueEnforcer.notNull (aClass, "Class");
if (sID == null)
return eDefault;
return findFirst (aClass, x -> x.getID ().equalsIgnoreCase (sID), eDefault);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"ENUMTYPE",
"extends",
"Enum",
"<",
"ENUMTYPE",
">",
"&",
"IHasID",
"<",
"String",
">",
">",
"ENUMTYPE",
"getFromIDCaseInsensitiveOrDefault",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"ENUMTYPE",
">",
"aClass",
",",
... | Get the enum value with the passed string ID case insensitive
@param <ENUMTYPE>
The enum type
@param aClass
The enum class
@param sID
The ID to search
@param eDefault
The default value to be returned, if the ID was not found.
@return The default parameter if no enum item with the given ID is present. | [
"Get",
"the",
"enum",
"value",
"with",
"the",
"passed",
"string",
"ID",
"case",
"insensitive"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L192-L202 |
lazy-koala/java-toolkit | fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java | ThreadTask.addTaskRunOnce | public void addTaskRunOnce(int startDelayTime, Runnable runnable) {
scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS);
} | java | public void addTaskRunOnce(int startDelayTime, Runnable runnable) {
scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS);
} | [
"public",
"void",
"addTaskRunOnce",
"(",
"int",
"startDelayTime",
",",
"Runnable",
"runnable",
")",
"{",
"scheduledExecutorService",
".",
"schedule",
"(",
"runnable",
",",
"startDelayTime",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}"
] | 运行一次的指定任务
<p>Function: addTaskRunOnce</p>
<p>Description: </p>
@param startDelayTime 延迟时间(s)
@param runnable
@author acexy@thankjava.com
@date 2016年10月8日 下午3:00:51
@version 1.0 | [
"运行一次的指定任务",
"<p",
">",
"Function",
":",
"addTaskRunOnce<",
"/",
"p",
">",
"<p",
">",
"Description",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/thread/ThreadTask.java#L141-L143 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java | GobblinMetricsRegistry.putIfAbsent | public GobblinMetrics putIfAbsent(String id, GobblinMetrics gobblinMetrics) {
return this.metricsCache.asMap().putIfAbsent(id, gobblinMetrics);
} | java | public GobblinMetrics putIfAbsent(String id, GobblinMetrics gobblinMetrics) {
return this.metricsCache.asMap().putIfAbsent(id, gobblinMetrics);
} | [
"public",
"GobblinMetrics",
"putIfAbsent",
"(",
"String",
"id",
",",
"GobblinMetrics",
"gobblinMetrics",
")",
"{",
"return",
"this",
".",
"metricsCache",
".",
"asMap",
"(",
")",
".",
"putIfAbsent",
"(",
"id",
",",
"gobblinMetrics",
")",
";",
"}"
] | Associate a {@link GobblinMetrics} instance with a given ID if the ID is
not already associated with a {@link GobblinMetrics} instance.
@param id the given {@link GobblinMetrics} ID
@param gobblinMetrics the {@link GobblinMetrics} instance to be associated with the given ID
@return the previous {@link GobblinMetrics} instance associated with the ID or {@code null}
if there's no previous {@link GobblinMetrics} instance associated with the ID | [
"Associate",
"a",
"{",
"@link",
"GobblinMetrics",
"}",
"instance",
"with",
"a",
"given",
"ID",
"if",
"the",
"ID",
"is",
"not",
"already",
"associated",
"with",
"a",
"{",
"@link",
"GobblinMetrics",
"}",
"instance",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetricsRegistry.java#L64-L66 |
i-net-software/jlessc | src/com/inet/lib/less/LessParser.java | LessParser.buildExpression | @Nonnull
private Expression buildExpression( String str ) {
switch( str.charAt( 0 ) ) {
case '@':
return new VariableExpression( reader, str );
case '-':
if( str.startsWith( "-@" ) ) {
return new FunctionExpression( reader, "-", new Operation( reader, buildExpression( str.substring( 1 ) ), (char)0 ) );
}
//$FALL-THROUGH$
default:
return new ValueExpression( reader, str );
}
} | java | @Nonnull
private Expression buildExpression( String str ) {
switch( str.charAt( 0 ) ) {
case '@':
return new VariableExpression( reader, str );
case '-':
if( str.startsWith( "-@" ) ) {
return new FunctionExpression( reader, "-", new Operation( reader, buildExpression( str.substring( 1 ) ), (char)0 ) );
}
//$FALL-THROUGH$
default:
return new ValueExpression( reader, str );
}
} | [
"@",
"Nonnull",
"private",
"Expression",
"buildExpression",
"(",
"String",
"str",
")",
"{",
"switch",
"(",
"str",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"case",
"'",
"'",
":",
"return",
"new",
"VariableExpression",
"(",
"reader",
",",
"str",
")",
";",... | Create an expression from the given atomic string.
@param str the expression like a number, color, variable, string, etc
@return the expression | [
"Create",
"an",
"expression",
"from",
"the",
"given",
"atomic",
"string",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1154-L1167 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/images/BitmapUtils.java | BitmapUtils.toBitmap | public static Bitmap toBitmap(Uri uri, Integer maxWidth, Integer maxHeight) {
try {
Context context = AbstractApplication.get();
// First decode with inJustDecodeBounds=true to check dimensions
Options options = new Options();
options.inJustDecodeBounds = true;
InputStream openInputStream = context.getContentResolver().openInputStream(uri);
BitmapFactory.decodeStream(openInputStream, null, options);
openInputStream.close();
// Calculate inSampleSize
if ((maxWidth != null) && (maxHeight != null)) {
float scale = Math.min(maxWidth.floatValue() / options.outWidth, maxHeight.floatValue()
/ options.outHeight);
options.inSampleSize = Math.round(1 / scale);
}
// Decode bitmap with inSampleSize set
openInputStream = context.getContentResolver().openInputStream(uri);
options.inJustDecodeBounds = false;
Bitmap result = BitmapFactory.decodeStream(openInputStream, null, options);
openInputStream.close();
return result;
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null;
}
} | java | public static Bitmap toBitmap(Uri uri, Integer maxWidth, Integer maxHeight) {
try {
Context context = AbstractApplication.get();
// First decode with inJustDecodeBounds=true to check dimensions
Options options = new Options();
options.inJustDecodeBounds = true;
InputStream openInputStream = context.getContentResolver().openInputStream(uri);
BitmapFactory.decodeStream(openInputStream, null, options);
openInputStream.close();
// Calculate inSampleSize
if ((maxWidth != null) && (maxHeight != null)) {
float scale = Math.min(maxWidth.floatValue() / options.outWidth, maxHeight.floatValue()
/ options.outHeight);
options.inSampleSize = Math.round(1 / scale);
}
// Decode bitmap with inSampleSize set
openInputStream = context.getContentResolver().openInputStream(uri);
options.inJustDecodeBounds = false;
Bitmap result = BitmapFactory.decodeStream(openInputStream, null, options);
openInputStream.close();
return result;
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null;
}
} | [
"public",
"static",
"Bitmap",
"toBitmap",
"(",
"Uri",
"uri",
",",
"Integer",
"maxWidth",
",",
"Integer",
"maxHeight",
")",
"{",
"try",
"{",
"Context",
"context",
"=",
"AbstractApplication",
".",
"get",
"(",
")",
";",
"// First decode with inJustDecodeBounds=true t... | Gets a {@link Bitmap} from a {@link Uri}. Resizes the image to a determined width and height.
@param uri The {@link Uri} from which the image is obtained.
@param maxWidth The maximum width of the image used to scale it. If null, the image won't be scaled
@param maxHeight The maximum height of the image used to scale it. If null, the image won't be scaled
@return {@link Bitmap} The resized image. | [
"Gets",
"a",
"{",
"@link",
"Bitmap",
"}",
"from",
"a",
"{",
"@link",
"Uri",
"}",
".",
"Resizes",
"the",
"image",
"to",
"a",
"determined",
"width",
"and",
"height",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/images/BitmapUtils.java#L54-L82 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.findElement | public WebElement findElement(final By by, final Predicate<WebElement> condition) {
return wef.by(by).condition(condition).find();
} | java | public WebElement findElement(final By by, final Predicate<WebElement> condition) {
return wef.by(by).condition(condition).find();
} | [
"public",
"WebElement",
"findElement",
"(",
"final",
"By",
"by",
",",
"final",
"Predicate",
"<",
"WebElement",
">",
"condition",
")",
"{",
"return",
"wef",
".",
"by",
"(",
"by",
")",
".",
"condition",
"(",
"condition",
")",
".",
"find",
"(",
")",
";",
... | Finds the first element. Uses the internal {@link WebElementFinder}, which tries to apply
the specified {@code condition} until it times out.
@param by
the {@link By} used to locate the element
@param condition
a condition the found element must meet
@return the element | [
"Finds",
"the",
"first",
"element",
".",
"Uses",
"the",
"internal",
"{",
"@link",
"WebElementFinder",
"}",
"which",
"tries",
"to",
"apply",
"the",
"specified",
"{",
"@code",
"condition",
"}",
"until",
"it",
"times",
"out",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L186-L188 |
googleads/googleads-java-lib | extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsSessionUtil.java | AdWordsSessionUtil.getClientCustomerId | public static long getClientCustomerId(AdWordsSession session) {
String accountIdStr = session.getClientCustomerId();
// clientCustomerId might be absent from AdWordsSession, e.g., for
// ReportDefinitionService.getReportFields() and CustomerService.getCustomers().
// In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined.
if (accountIdStr == null) {
return VIRTUAL_CID;
}
try {
return Long.parseLong(accountIdStr.replace("-", ""));
} catch (NumberFormatException e) {
throw new RateLimiterException("Encountered invalid CID: " + accountIdStr, e);
}
} | java | public static long getClientCustomerId(AdWordsSession session) {
String accountIdStr = session.getClientCustomerId();
// clientCustomerId might be absent from AdWordsSession, e.g., for
// ReportDefinitionService.getReportFields() and CustomerService.getCustomers().
// In this case, use ONE virtual account to handle rate limit of ALL unknown accounts combined.
if (accountIdStr == null) {
return VIRTUAL_CID;
}
try {
return Long.parseLong(accountIdStr.replace("-", ""));
} catch (NumberFormatException e) {
throw new RateLimiterException("Encountered invalid CID: " + accountIdStr, e);
}
} | [
"public",
"static",
"long",
"getClientCustomerId",
"(",
"AdWordsSession",
"session",
")",
"{",
"String",
"accountIdStr",
"=",
"session",
".",
"getClientCustomerId",
"(",
")",
";",
"// clientCustomerId might be absent from AdWordsSession, e.g., for",
"// ReportDefinitionService.... | Get client customer ID from the adwords session, and convert it to Long type.
@param session the AdWords session
@return the client customer ID in the AdWords session, or VIRTUAL_CID if absent | [
"Get",
"client",
"customer",
"ID",
"from",
"the",
"adwords",
"session",
"and",
"convert",
"it",
"to",
"Long",
"type",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/AdWordsSessionUtil.java#L31-L46 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java | TorrentHandle.moveStorage | public void moveStorage(String savePath, MoveFlags flags) {
th.move_storage(savePath, flags.swig());
} | java | public void moveStorage(String savePath, MoveFlags flags) {
th.move_storage(savePath, flags.swig());
} | [
"public",
"void",
"moveStorage",
"(",
"String",
"savePath",
",",
"MoveFlags",
"flags",
")",
"{",
"th",
".",
"move_storage",
"(",
"savePath",
",",
"flags",
".",
"swig",
"(",
")",
")",
";",
"}"
] | Moves the file(s) that this torrent are currently seeding from or
downloading to. If the given {@code savePath} is not located on the same
drive as the original save path, the files will be copied to the new
drive and removed from their original location. This will block all
other disk IO, and other torrents download and upload rates may drop
while copying the file.
<p>
Since disk IO is performed in a separate thread, this operation is
also asynchronous. Once the operation completes, the
{@link com.frostwire.jlibtorrent.alerts.StorageMovedAlert} is generated,
with the new path as the message. If the move fails for some reason,
{@link com.frostwire.jlibtorrent.alerts.StorageMovedFailedAlert}
generated instead, containing the error message.
<p>
The {@code flags} argument determines the behavior of the copying/moving
of the files in the torrent.
<p>
Files that have been renamed to have absolute paths are not moved by
this function. Keep in mind that files that don't belong to the
torrent but are stored in the torrent's directory may be moved as
well. This goes for files that have been renamed to absolute paths
that still end up inside the save path.
@param savePath the new save path
@param flags the move behavior flags | [
"Moves",
"the",
"file",
"(",
"s",
")",
"that",
"this",
"torrent",
"are",
"currently",
"seeding",
"from",
"or",
"downloading",
"to",
".",
"If",
"the",
"given",
"{",
"@code",
"savePath",
"}",
"is",
"not",
"located",
"on",
"the",
"same",
"drive",
"as",
"t... | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java#L1323-L1325 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java | DefaultJsonQueryLogEntryCreator.writeQuerySizeEntry | protected void writeQuerySizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("\"querySize\":");
sb.append(queryInfoList.size());
sb.append(", ");
} | java | protected void writeQuerySizeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("\"querySize\":");
sb.append(queryInfoList.size());
sb.append(", ");
} | [
"protected",
"void",
"writeQuerySizeEntry",
"(",
"StringBuilder",
"sb",
",",
"ExecutionInfo",
"execInfo",
",",
"List",
"<",
"QueryInfo",
">",
"queryInfoList",
")",
"{",
"sb",
".",
"append",
"(",
"\"\\\"querySize\\\":\"",
")",
";",
"sb",
".",
"append",
"(",
"qu... | Write query size as json.
<p>default: "querySize":1,
@param sb StringBuilder to write
@param execInfo execution info
@param queryInfoList query info list | [
"Write",
"query",
"size",
"as",
"json",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L167-L171 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java | ContainerGroupsInner.updateAsync | public Observable<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName, Resource resource) {
return updateWithServiceResponseAsync(resourceGroupName, containerGroupName, resource).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | java | public Observable<ContainerGroupInner> updateAsync(String resourceGroupName, String containerGroupName, Resource resource) {
return updateWithServiceResponseAsync(resourceGroupName, containerGroupName, resource).map(new Func1<ServiceResponse<ContainerGroupInner>, ContainerGroupInner>() {
@Override
public ContainerGroupInner call(ServiceResponse<ContainerGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ContainerGroupInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
",",
"Resource",
"resource",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGro... | Update container groups.
Updates container group tags with specified values.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@param resource The container group resource with just the tags to be updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ContainerGroupInner object | [
"Update",
"container",
"groups",
".",
"Updates",
"container",
"group",
"tags",
"with",
"specified",
"values",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2018_02_01_preview/implementation/ContainerGroupsInner.java#L650-L657 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/logging/LoggerUtil.java | LoggerUtil.createSLF4JIntervalStatsLoggerForAllConfiguredIntervals | public static final void createSLF4JIntervalStatsLoggerForAllConfiguredIntervals(IStatsProducer producer, String loggerNamePrefix){
List<String> configuredIntervals = MoskitoConfigurationHolder.getConfiguration().getConfiguredIntervalNames();
for (String intervalName : configuredIntervals){
new IntervalStatsLogger(producer,
IntervalRegistry.getInstance().getInterval(intervalName),
new SLF4JLogOutput(LoggerFactory.getLogger(loggerNamePrefix+intervalName)));
}
} | java | public static final void createSLF4JIntervalStatsLoggerForAllConfiguredIntervals(IStatsProducer producer, String loggerNamePrefix){
List<String> configuredIntervals = MoskitoConfigurationHolder.getConfiguration().getConfiguredIntervalNames();
for (String intervalName : configuredIntervals){
new IntervalStatsLogger(producer,
IntervalRegistry.getInstance().getInterval(intervalName),
new SLF4JLogOutput(LoggerFactory.getLogger(loggerNamePrefix+intervalName)));
}
} | [
"public",
"static",
"final",
"void",
"createSLF4JIntervalStatsLoggerForAllConfiguredIntervals",
"(",
"IStatsProducer",
"producer",
",",
"String",
"loggerNamePrefix",
")",
"{",
"List",
"<",
"String",
">",
"configuredIntervals",
"=",
"MoskitoConfigurationHolder",
".",
"getCon... | Creates interval stats loggers for all configured intervals. Every logger is attached to a logger with name
loggerNamePrefix<intervalName>. If loggerNamePrefix is for example 'foo' then all loggers are attached to
foo1m, foo5m, foo15m etc, for all configured intervals.
@param producer producer to attach loggers to.
@param loggerNamePrefix loggerNamePrefix prefix. | [
"Creates",
"interval",
"stats",
"loggers",
"for",
"all",
"configured",
"intervals",
".",
"Every",
"logger",
"is",
"attached",
"to",
"a",
"logger",
"with",
"name",
"loggerNamePrefix<",
";",
"intervalName>",
";",
".",
"If",
"loggerNamePrefix",
"is",
"for",
"ex... | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/logging/LoggerUtil.java#L41-L48 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/HTMLUtilities.java | HTMLUtilities.inlineHtmlPage | public static String inlineHtmlPage(final String html, final String basePath) {
String retValue = html;
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(html);
} catch (Exception ex) {
LOG.error("Failed to convert the HTML into a DOM Document", ex);
}
if (doc != null) {
inlineImgNodes(doc, basePath);
inlineCssNodes(doc, basePath);
inlineSvgNodes(doc, basePath);
retValue = XMLUtilities.convertDocumentToString(doc);
}
return retValue;
} | java | public static String inlineHtmlPage(final String html, final String basePath) {
String retValue = html;
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(html);
} catch (Exception ex) {
LOG.error("Failed to convert the HTML into a DOM Document", ex);
}
if (doc != null) {
inlineImgNodes(doc, basePath);
inlineCssNodes(doc, basePath);
inlineSvgNodes(doc, basePath);
retValue = XMLUtilities.convertDocumentToString(doc);
}
return retValue;
} | [
"public",
"static",
"String",
"inlineHtmlPage",
"(",
"final",
"String",
"html",
",",
"final",
"String",
"basePath",
")",
"{",
"String",
"retValue",
"=",
"html",
";",
"Document",
"doc",
"=",
"null",
";",
"try",
"{",
"doc",
"=",
"XMLUtilities",
".",
"convert... | Takes a XHTML file (usually generated by Publican), and inlines all the
CSS, image and SVG data. The resulting string is a stand alone HTML file
with no references to external resources.
@param html The original XHTML code
@param basePath The path on which all the resources referenced by the
XHTML file can be found
@return A single, stand alone version of the XHTML | [
"Takes",
"a",
"XHTML",
"file",
"(",
"usually",
"generated",
"by",
"Publican",
")",
"and",
"inlines",
"all",
"the",
"CSS",
"image",
"and",
"SVG",
"data",
".",
"The",
"resulting",
"string",
"is",
"a",
"stand",
"alone",
"HTML",
"file",
"with",
"no",
"refere... | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/HTMLUtilities.java#L60-L78 |
sporniket/p3 | src/main/java/com/sporniket/libre/p3/P3.java | P3.executeProgram | @SuppressWarnings("unused")
private void executeProgram(String name, String[] source) throws Exception
{
String _singleStringSource = executeProgram__makeSingleStringSource(source);
executeProgram(name, _singleStringSource);
} | java | @SuppressWarnings("unused")
private void executeProgram(String name, String[] source) throws Exception
{
String _singleStringSource = executeProgram__makeSingleStringSource(source);
executeProgram(name, _singleStringSource);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"executeProgram",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"source",
")",
"throws",
"Exception",
"{",
"String",
"_singleStringSource",
"=",
"executeProgram__makeSingleStringSource",
"(",
"sou... | The processor for extracting directives.
@param name
property name, unused.
@param source
the directives.
@throws Exception
when there is a problem. | [
"The",
"processor",
"for",
"extracting",
"directives",
"."
] | train | https://github.com/sporniket/p3/blob/fc20b3066dc4a9cd759090adae0a6b02508df135/src/main/java/com/sporniket/libre/p3/P3.java#L558-L563 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.similarDeleteByUrl | public JSONObject similarDeleteByUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_DELETE);
postOperation(request);
return requestServer(request);
} | java | public JSONObject similarDeleteByUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_DELETE);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"similarDeleteByUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",... | 相似图检索—删除接口
**删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject | [
"相似图检索—删除接口",
"**",
"删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L649-L660 |
jbundle/jbundle | app/program/screen/src/main/java/org/jbundle/app/program/access/AccessGridScreen.java | AccessGridScreen.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((strCommand.equalsIgnoreCase(MenuConstants.FORM))
|| (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)))
{
String strHandle = null;
if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))
{
try {
Record record = this.getMainRecord();
if ((record.getEditMode() == DBConstants.EDIT_CURRENT)
|| (record.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
strHandle = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
} catch (DBException ex) {
strHandle = null; // Ignore error - just go to form
}
}
strCommand = Utility.addURLParam(null, DBParams.SCREEN, AccessScreen.class.getName()); // Screen class
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD));
strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package"));
if (strHandle != null)
strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle);
}
return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((strCommand.equalsIgnoreCase(MenuConstants.FORM))
|| (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)))
{
String strHandle = null;
if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))
{
try {
Record record = this.getMainRecord();
if ((record.getEditMode() == DBConstants.EDIT_CURRENT)
|| (record.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
strHandle = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
} catch (DBException ex) {
strHandle = null; // Ignore error - just go to form
}
}
strCommand = Utility.addURLParam(null, DBParams.SCREEN, AccessScreen.class.getName()); // Screen class
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD));
strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package"));
if (strHandle != null)
strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle);
}
return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"(",
"strCommand",
".",
"equalsIgnoreCase",
"(",
"MenuConstants",
".",
"FORM",
")",
")",
"||",
"(",
"strComma... | Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"<br",
"/",
">",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"<br",
"/",
">",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/access/AccessGridScreen.java#L111-L135 |
seedstack/business | migrate/src/main/java/org/seedstack/business/view/VirtualList.java | VirtualList.assertSubRange | private void assertSubRange(long from, long to) {
if (!checkSubRange(from) || !checkSubRange(to)) {
throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have "
+ "not been loaded in the virtual list.");
}
} | java | private void assertSubRange(long from, long to) {
if (!checkSubRange(from) || !checkSubRange(to)) {
throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have "
+ "not been loaded in the virtual list.");
}
} | [
"private",
"void",
"assertSubRange",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"if",
"(",
"!",
"checkSubRange",
"(",
"from",
")",
"||",
"!",
"checkSubRange",
"(",
"to",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Required da... | Asserts that the requested sub list is available in the virtual list. Otherwise it throws
an IndexOutOfBoundsException.
@param from the from index (inclusive)
@param to the to index (inclusive) | [
"Asserts",
"that",
"the",
"requested",
"sub",
"list",
"is",
"available",
"in",
"the",
"virtual",
"list",
".",
"Otherwise",
"it",
"throws",
"an",
"IndexOutOfBoundsException",
"."
] | train | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/view/VirtualList.java#L116-L121 |
OpenTSDB/opentsdb | src/query/filter/TagVLiteralOrFilter.java | TagVLiteralOrFilter.resolveTagkName | @Override
public Deferred<byte[]> resolveTagkName(final TSDB tsdb) {
final Config config = tsdb.getConfig();
// resolve tag values if the filter is NOT case insensitive and there are
// fewer literals than the expansion limit
if (!case_insensitive &&
literals.size() <= config.getInt("tsd.query.filter.expansion_limit")) {
return resolveTags(tsdb, literals);
} else {
return super.resolveTagkName(tsdb);
}
} | java | @Override
public Deferred<byte[]> resolveTagkName(final TSDB tsdb) {
final Config config = tsdb.getConfig();
// resolve tag values if the filter is NOT case insensitive and there are
// fewer literals than the expansion limit
if (!case_insensitive &&
literals.size() <= config.getInt("tsd.query.filter.expansion_limit")) {
return resolveTags(tsdb, literals);
} else {
return super.resolveTagkName(tsdb);
}
} | [
"@",
"Override",
"public",
"Deferred",
"<",
"byte",
"[",
"]",
">",
"resolveTagkName",
"(",
"final",
"TSDB",
"tsdb",
")",
"{",
"final",
"Config",
"config",
"=",
"tsdb",
".",
"getConfig",
"(",
")",
";",
"// resolve tag values if the filter is NOT case insensitive an... | Overridden here so that we can resolve the literal values if we don't have
too many of them AND we're not searching with case insensitivity. | [
"Overridden",
"here",
"so",
"that",
"we",
"can",
"resolve",
"the",
"literal",
"values",
"if",
"we",
"don",
"t",
"have",
"too",
"many",
"of",
"them",
"AND",
"we",
"re",
"not",
"searching",
"with",
"case",
"insensitivity",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/filter/TagVLiteralOrFilter.java#L100-L112 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeConstructor | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Class<?>[] parameterTypes,
Object[] arguments) throws Exception {
if (parameterTypes != null && arguments != null) {
if (parameterTypes.length != arguments.length) {
throw new IllegalArgumentException("parameterTypes and arguments must have the same length");
}
}
Constructor<T> constructor = null;
try {
constructor = classThatContainsTheConstructorToTest.getDeclaredConstructor(parameterTypes);
} catch (Exception e) {
throw new ConstructorNotFoundException("Could not lookup the constructor", e);
}
return createInstance(constructor, arguments);
} | java | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Class<?>[] parameterTypes,
Object[] arguments) throws Exception {
if (parameterTypes != null && arguments != null) {
if (parameterTypes.length != arguments.length) {
throw new IllegalArgumentException("parameterTypes and arguments must have the same length");
}
}
Constructor<T> constructor = null;
try {
constructor = classThatContainsTheConstructorToTest.getDeclaredConstructor(parameterTypes);
} catch (Exception e) {
throw new ConstructorNotFoundException("Could not lookup the constructor", e);
}
return createInstance(constructor, arguments);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeConstructor",
"(",
"Class",
"<",
"T",
">",
"classThatContainsTheConstructorToTest",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"[",
"]",
"arguments",
")",
"throws",
"Exception",
"{",... | Invoke a constructor. Useful for testing classes with a private
constructor when PowerMock cannot determine which constructor to invoke.
This only happens if you have two constructors with the same number of
arguments where one is using primitive data types and the other is using
the wrapped counter part. For example:
<pre>
public class MyClass {
private MyClass(Integer i) {
...
}
private MyClass(int i) {
...
}
</pre>
This ought to be a really rare case. So for most situation, use
@param <T> the generic type
@param classThatContainsTheConstructorToTest the class that contains the constructor to test
@param parameterTypes the parameter types
@param arguments the arguments
@return The object created after the constructor has been invoked.
@throws Exception If an exception occur when invoking the constructor.
{@link #invokeConstructor(Class, Object...)} instead. | [
"Invoke",
"a",
"constructor",
".",
"Useful",
"for",
"testing",
"classes",
"with",
"a",
"private",
"constructor",
"when",
"PowerMock",
"cannot",
"determine",
"which",
"constructor",
"to",
"invoke",
".",
"This",
"only",
"happens",
"if",
"you",
"have",
"two",
"co... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1247-L1263 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java | Line.set | public void set(float sx, float sy, float ex, float ey) {
super.pointsDirty = true;
start.set(sx, sy);
end.set(ex, ey);
float dx = (ex - sx);
float dy = (ey - sy);
vec.set(dx,dy);
lenSquared = (dx * dx) + (dy * dy);
} | java | public void set(float sx, float sy, float ex, float ey) {
super.pointsDirty = true;
start.set(sx, sy);
end.set(ex, ey);
float dx = (ex - sx);
float dy = (ey - sy);
vec.set(dx,dy);
lenSquared = (dx * dx) + (dy * dy);
} | [
"public",
"void",
"set",
"(",
"float",
"sx",
",",
"float",
"sy",
",",
"float",
"ex",
",",
"float",
"ey",
")",
"{",
"super",
".",
"pointsDirty",
"=",
"true",
";",
"start",
".",
"set",
"(",
"sx",
",",
"sy",
")",
";",
"end",
".",
"set",
"(",
"ex",... | Configure the line without garbage
@param sx
The x coordinate of the start
@param sy
The y coordinate of the start
@param ex
The x coordiante of the end
@param ey
The y coordinate of the end | [
"Configure",
"the",
"line",
"without",
"garbage"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java#L215-L224 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.createAlias | public Criteria createAlias(String associationPath, String alias) {
return criteria.createAlias(associationPath, alias);
} | java | public Criteria createAlias(String associationPath, String alias) {
return criteria.createAlias(associationPath, alias);
} | [
"public",
"Criteria",
"createAlias",
"(",
"String",
"associationPath",
",",
"String",
"alias",
")",
"{",
"return",
"criteria",
".",
"createAlias",
"(",
"associationPath",
",",
"alias",
")",
";",
"}"
] | Join an association, assigning an alias to the joined association.
Functionally equivalent to createAlias(String, String, int) using
CriteriaSpecificationINNER_JOIN for the joinType.
@param associationPath A dot-seperated property path
@param alias The alias to assign to the joined association (for later reference).
@return this (for method chaining)
#see {@link #createAlias(String, String, int)}
@throws HibernateException Indicates a problem creating the sub criteria | [
"Join",
"an",
"association",
"assigning",
"an",
"alias",
"to",
"the",
"joined",
"association",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L574-L576 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setFlakeIdGeneratorConfigs | public Config setFlakeIdGeneratorConfigs(Map<String, FlakeIdGeneratorConfig> map) {
flakeIdGeneratorConfigMap.clear();
flakeIdGeneratorConfigMap.putAll(map);
for (Entry<String, FlakeIdGeneratorConfig> entry : map.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setFlakeIdGeneratorConfigs(Map<String, FlakeIdGeneratorConfig> map) {
flakeIdGeneratorConfigMap.clear();
flakeIdGeneratorConfigMap.putAll(map);
for (Entry<String, FlakeIdGeneratorConfig> entry : map.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setFlakeIdGeneratorConfigs",
"(",
"Map",
"<",
"String",
",",
"FlakeIdGeneratorConfig",
">",
"map",
")",
"{",
"flakeIdGeneratorConfigMap",
".",
"clear",
"(",
")",
";",
"flakeIdGeneratorConfigMap",
".",
"putAll",
"(",
"map",
")",
";",
"for",
"... | Sets the map of {@link FlakeIdGenerator} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param map the FlakeIdGenerator configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"FlakeIdGenerator",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3083-L3090 |
zanata/openprops | orig/Properties.java | Properties.storeToXML | public synchronized void storeToXML(OutputStream os, String comment)
throws IOException
{
if (os == null)
throw new NullPointerException();
storeToXML(os, comment, "UTF-8");
} | java | public synchronized void storeToXML(OutputStream os, String comment)
throws IOException
{
if (os == null)
throw new NullPointerException();
storeToXML(os, comment, "UTF-8");
} | [
"public",
"synchronized",
"void",
"storeToXML",
"(",
"OutputStream",
"os",
",",
"String",
"comment",
")",
"throws",
"IOException",
"{",
"if",
"(",
"os",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"storeToXML",
"(",
"os",
",",
... | Emits an XML document representing all of the properties contained
in this table.
<p> An invocation of this method of the form <tt>props.storeToXML(os,
comment)</tt> behaves in exactly the same way as the invocation
<tt>props.storeToXML(os, comment, "UTF-8");</tt>.
@param os the output stream on which to emit the XML document.
@param comment a description of the property list, or <code>null</code>
if no comment is desired.
@throws IOException if writing to the specified output stream
results in an <tt>IOException</tt>.
@throws NullPointerException if <code>os</code> is null.
@throws ClassCastException if this <code>Properties</code> object
contains any keys or values that are not
<code>Strings</code>.
@see #loadFromXML(InputStream)
@since 1.5 | [
"Emits",
"an",
"XML",
"document",
"representing",
"all",
"of",
"the",
"properties",
"contained",
"in",
"this",
"table",
"."
] | train | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/orig/Properties.java#L893-L899 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSelectToggleRenderer.java | WSelectToggleRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSelectToggle toggle = (WSelectToggle) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:selecttoggle");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
State state = toggle.getState();
if (State.ALL.equals(state)) {
xml.appendAttribute("selected", "all");
} else if (State.NONE.equals(state)) {
xml.appendAttribute("selected", "none");
} else {
xml.appendAttribute("selected", "some");
}
xml.appendOptionalAttribute("disabled", toggle.isDisabled(), "true");
xml.appendAttribute("target", toggle.getTarget().getId());
xml.appendAttribute("renderAs", toggle.isRenderAsText() ? "text" : "control");
xml.appendOptionalAttribute("roundTrip", !toggle.isClientSide(), "true");
xml.appendEnd();
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSelectToggle toggle = (WSelectToggle) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:selecttoggle");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
State state = toggle.getState();
if (State.ALL.equals(state)) {
xml.appendAttribute("selected", "all");
} else if (State.NONE.equals(state)) {
xml.appendAttribute("selected", "none");
} else {
xml.appendAttribute("selected", "some");
}
xml.appendOptionalAttribute("disabled", toggle.isDisabled(), "true");
xml.appendAttribute("target", toggle.getTarget().getId());
xml.appendAttribute("renderAs", toggle.isRenderAsText() ? "text" : "control");
xml.appendOptionalAttribute("roundTrip", !toggle.isClientSide(), "true");
xml.appendEnd();
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WSelectToggle",
"toggle",
"=",
"(",
"WSelectToggle",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"re... | Paints the given WSelectToggle.
@param component the WSelectToggle to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WSelectToggle",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSelectToggleRenderer.java#L23-L48 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/TransportFormatAdapter.java | TransportFormatAdapter.writeJson | public static void writeJson(Serializable serializable, OutputStream output)
throws IOException {
TransportFormat.JSON.writeSerializableTo(serializable, output);
} | java | public static void writeJson(Serializable serializable, OutputStream output)
throws IOException {
TransportFormat.JSON.writeSerializableTo(serializable, output);
} | [
"public",
"static",
"void",
"writeJson",
"(",
"Serializable",
"serializable",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"TransportFormat",
".",
"JSON",
".",
"writeSerializableTo",
"(",
"serializable",
",",
"output",
")",
";",
"}"
] | Export JSON.
@param serializable Serializable
@param output OutputStream
@throws IOException e | [
"Export",
"JSON",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/TransportFormatAdapter.java#L51-L54 |
hawkular/hawkular-apm | server/rest/src/main/java/org/hawkular/apm/server/rest/RESTServiceUtil.java | RESTServiceUtil.decodeProperties | public static void decodeProperties(Set<PropertyCriteria> properties, String encoded) {
if (encoded != null && !encoded.trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(encoded, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String[] parts = token.split("[|]");
if (parts.length >= 2) {
String name = parts[0].trim();
String value = parts[1].trim();
Operator op = Operator.HAS;
if (parts.length > 2) {
op = Operator.valueOf(parts[2].trim());
}
log.tracef("Extracted property name [%s] value [%s] operator [%s]", name, value, op);
properties.add(new PropertyCriteria(name, value, op));
}
}
}
} | java | public static void decodeProperties(Set<PropertyCriteria> properties, String encoded) {
if (encoded != null && !encoded.trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(encoded, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String[] parts = token.split("[|]");
if (parts.length >= 2) {
String name = parts[0].trim();
String value = parts[1].trim();
Operator op = Operator.HAS;
if (parts.length > 2) {
op = Operator.valueOf(parts[2].trim());
}
log.tracef("Extracted property name [%s] value [%s] operator [%s]", name, value, op);
properties.add(new PropertyCriteria(name, value, op));
}
}
}
} | [
"public",
"static",
"void",
"decodeProperties",
"(",
"Set",
"<",
"PropertyCriteria",
">",
"properties",
",",
"String",
"encoded",
")",
"{",
"if",
"(",
"encoded",
"!=",
"null",
"&&",
"!",
"encoded",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
... | This method processes a comma separated list of properties, defined as a name|value pair.
@param properties The properties map
@param encoded The string containing the encoded properties | [
"This",
"method",
"processes",
"a",
"comma",
"separated",
"list",
"of",
"properties",
"defined",
"as",
"a",
"name|value",
"pair",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/rest/src/main/java/org/hawkular/apm/server/rest/RESTServiceUtil.java#L44-L65 |
JodaOrg/joda-time | src/main/java/org/joda/time/convert/ReadablePartialConverter.java | ReadablePartialConverter.getChronology | public Chronology getChronology(Object object, Chronology chrono) {
if (chrono == null) {
chrono = ((ReadablePartial) object).getChronology();
chrono = DateTimeUtils.getChronology(chrono);
}
return chrono;
} | java | public Chronology getChronology(Object object, Chronology chrono) {
if (chrono == null) {
chrono = ((ReadablePartial) object).getChronology();
chrono = DateTimeUtils.getChronology(chrono);
}
return chrono;
} | [
"public",
"Chronology",
"getChronology",
"(",
"Object",
"object",
",",
"Chronology",
"chrono",
")",
"{",
"if",
"(",
"chrono",
"==",
"null",
")",
"{",
"chrono",
"=",
"(",
"(",
"ReadablePartial",
")",
"object",
")",
".",
"getChronology",
"(",
")",
";",
"ch... | Gets the chronology, which is taken from the ReadableInstant.
<p>
If the passed in chronology is non-null, it is used.
Otherwise the chronology from the instant is used.
@param object the ReadablePartial to convert, must not be null
@param chrono the chronology to use, null means use that from object
@return the chronology, never null | [
"Gets",
"the",
"chronology",
"which",
"is",
"taken",
"from",
"the",
"ReadableInstant",
".",
"<p",
">",
"If",
"the",
"passed",
"in",
"chronology",
"is",
"non",
"-",
"null",
"it",
"is",
"used",
".",
"Otherwise",
"the",
"chronology",
"from",
"the",
"instant",... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/ReadablePartialConverter.java#L66-L72 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java | MultiMap.addValues | public void addValues(Object name, List values)
{
Object lo = super.get(name);
Object ln = LazyList.addCollection(lo,values);
if (lo!=ln)
super.put(name,ln);
} | java | public void addValues(Object name, List values)
{
Object lo = super.get(name);
Object ln = LazyList.addCollection(lo,values);
if (lo!=ln)
super.put(name,ln);
} | [
"public",
"void",
"addValues",
"(",
"Object",
"name",
",",
"List",
"values",
")",
"{",
"Object",
"lo",
"=",
"super",
".",
"get",
"(",
"name",
")",
";",
"Object",
"ln",
"=",
"LazyList",
".",
"addCollection",
"(",
"lo",
",",
"values",
")",
";",
"if",
... | Add values to multi valued entry.
If the entry is single valued, it is converted to the first
value of a multi valued entry.
@param name The entry key.
@param values The List of multiple values. | [
"Add",
"values",
"to",
"multi",
"valued",
"entry",
".",
"If",
"the",
"entry",
"is",
"single",
"valued",
"it",
"is",
"converted",
"to",
"the",
"first",
"value",
"of",
"a",
"multi",
"valued",
"entry",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java#L198-L204 |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java | CmsUserInfoDialog.showUserInfo | public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
} | java | public static void showUserInfo(CmsSessionInfo session) {
final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {
public void run() {
window.close();
}
});
window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
window.setContent(dialog);
A_CmsUI.get().addWindow(window);
} | [
"public",
"static",
"void",
"showUserInfo",
"(",
"CmsSessionInfo",
"session",
")",
"{",
"final",
"Window",
"window",
"=",
"CmsBasicDialog",
".",
"prepareWindow",
"(",
"DialogWidth",
".",
"wide",
")",
";",
"CmsUserInfoDialog",
"dialog",
"=",
"new",
"CmsUserInfoDial... | Shows a dialog with user information for given session.
@param session to show information for | [
"Shows",
"a",
"dialog",
"with",
"user",
"information",
"for",
"given",
"session",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsUserInfoDialog.java#L163-L177 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.serviceName_glueRecord_host_GET | public OvhGlueRecord serviceName_glueRecord_host_GET(String serviceName, String host) throws IOException {
String qPath = "/domain/{serviceName}/glueRecord/{host}";
StringBuilder sb = path(qPath, serviceName, host);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGlueRecord.class);
} | java | public OvhGlueRecord serviceName_glueRecord_host_GET(String serviceName, String host) throws IOException {
String qPath = "/domain/{serviceName}/glueRecord/{host}";
StringBuilder sb = path(qPath, serviceName, host);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhGlueRecord.class);
} | [
"public",
"OvhGlueRecord",
"serviceName_glueRecord_host_GET",
"(",
"String",
"serviceName",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/{serviceName}/glueRecord/{host}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qP... | Get this object properties
REST: GET /domain/{serviceName}/glueRecord/{host}
@param serviceName [required] The internal name of your domain
@param host [required] Host of the glue record | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1198-L1203 |
cdapio/tigon | tigon-queue/src/main/java/co/cask/tigon/data/security/HBaseTokenUtils.java | HBaseTokenUtils.obtainToken | public static Credentials obtainToken(Configuration hConf, Credentials credentials) {
if (!User.isHBaseSecurityEnabled(hConf)) {
return credentials;
}
try {
Class c = Class.forName("org.apache.hadoop.hbase.security.token.TokenUtil");
Method method = c.getMethod("obtainToken", Configuration.class);
Token<? extends TokenIdentifier> token = castToken(method.invoke(null, hConf));
credentials.addToken(token.getService(), token);
return credentials;
} catch (Exception e) {
LOG.error("Failed to get secure token for HBase.", e);
throw Throwables.propagate(e);
}
} | java | public static Credentials obtainToken(Configuration hConf, Credentials credentials) {
if (!User.isHBaseSecurityEnabled(hConf)) {
return credentials;
}
try {
Class c = Class.forName("org.apache.hadoop.hbase.security.token.TokenUtil");
Method method = c.getMethod("obtainToken", Configuration.class);
Token<? extends TokenIdentifier> token = castToken(method.invoke(null, hConf));
credentials.addToken(token.getService(), token);
return credentials;
} catch (Exception e) {
LOG.error("Failed to get secure token for HBase.", e);
throw Throwables.propagate(e);
}
} | [
"public",
"static",
"Credentials",
"obtainToken",
"(",
"Configuration",
"hConf",
",",
"Credentials",
"credentials",
")",
"{",
"if",
"(",
"!",
"User",
".",
"isHBaseSecurityEnabled",
"(",
"hConf",
")",
")",
"{",
"return",
"credentials",
";",
"}",
"try",
"{",
"... | Gets a HBase delegation token and stores it in the given Credentials.
@return the same Credentials instance as the one given in parameter. | [
"Gets",
"a",
"HBase",
"delegation",
"token",
"and",
"stores",
"it",
"in",
"the",
"given",
"Credentials",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-queue/src/main/java/co/cask/tigon/data/security/HBaseTokenUtils.java#L42-L60 |
alipay/sofa-hessian | src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.runTasks | @GuardedBy("evictionLock")
void runTasks(Task[] tasks, int maxTaskIndex) {
for (int i = 0; i <= maxTaskIndex; i++) {
runTasksInChain(tasks[i]);
}
} | java | @GuardedBy("evictionLock")
void runTasks(Task[] tasks, int maxTaskIndex) {
for (int i = 0; i <= maxTaskIndex; i++) {
runTasksInChain(tasks[i]);
}
} | [
"@",
"GuardedBy",
"(",
"\"evictionLock\"",
")",
"void",
"runTasks",
"(",
"Task",
"[",
"]",
"tasks",
",",
"int",
"maxTaskIndex",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"maxTaskIndex",
";",
"i",
"++",
")",
"{",
"runTasksInChain",
"... | Runs the pending page replacement policy operations.
@param tasks the ordered array of the pending operations
@param maxTaskIndex the maximum index of the array | [
"Runs",
"the",
"pending",
"page",
"replacement",
"policy",
"operations",
"."
] | train | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/alipay/hessian/clhm/ConcurrentLinkedHashMap.java#L527-L532 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java | InnerMetricContext.getHistograms | @Override
public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
return getSimplyNamedMetrics(Histogram.class, Optional.of(filter));
} | java | @Override
public SortedMap<String, Histogram> getHistograms(MetricFilter filter) {
return getSimplyNamedMetrics(Histogram.class, Optional.of(filter));
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Histogram",
">",
"getHistograms",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getSimplyNamedMetrics",
"(",
"Histogram",
".",
"class",
",",
"Optional",
".",
"of",
"(",
"filter",
")",
")",
";... | See {@link com.codahale.metrics.MetricRegistry#getHistograms(com.codahale.metrics.MetricFilter)}.
<p>
This method will return fully-qualified metric names if the {@link MetricContext} is configured
to report fully-qualified metric names.
</p> | [
"See",
"{",
"@link",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricRegistry#getHistograms",
"(",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricFilter",
")",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L216-L219 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java | StrSpliter.splitToArray | public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty){
return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty));
} | java | public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty){
return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty));
} | [
"public",
"static",
"String",
"[",
"]",
"splitToArray",
"(",
"String",
"str",
",",
"Pattern",
"separatorPattern",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"return",
"toArray",
"(",
"split",
"(",
"str",
",",
"s... | 通过正则切分字符串为字符串数组
@param str 被切分的字符串
@param separatorPattern 分隔符正则{@link Pattern}
@param limit 限制分片数
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.0.8 | [
"通过正则切分字符串为字符串数组"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L453-L455 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/MetadataUtils.java | MetadataUtils.indexSearchEnabled | public static boolean indexSearchEnabled(final String persistenceUnit, final KunderaMetadata kunderaMetadata)
{
PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata,
persistenceUnit);
String clientFactoryName = puMetadata != null ? puMetadata
.getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
return !(Constants.REDIS_CLIENT_FACTORY.equalsIgnoreCase(clientFactoryName));
} | java | public static boolean indexSearchEnabled(final String persistenceUnit, final KunderaMetadata kunderaMetadata)
{
PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata,
persistenceUnit);
String clientFactoryName = puMetadata != null ? puMetadata
.getProperty(PersistenceProperties.KUNDERA_CLIENT_FACTORY) : null;
return !(Constants.REDIS_CLIENT_FACTORY.equalsIgnoreCase(clientFactoryName));
} | [
"public",
"static",
"boolean",
"indexSearchEnabled",
"(",
"final",
"String",
"persistenceUnit",
",",
"final",
"KunderaMetadata",
"kunderaMetadata",
")",
"{",
"PersistenceUnitMetadata",
"puMetadata",
"=",
"KunderaMetadataManager",
".",
"getPersistenceUnitMetadata",
"(",
"kun... | Index based search has to be optional, ideally need to register a
callback in case index persistence/search etc is optional.
@param persistenceUnit
persistence unit
@return true, if index based search is enabled. | [
"Index",
"based",
"search",
"has",
"to",
"be",
"optional",
"ideally",
"need",
"to",
"register",
"a",
"callback",
"in",
"case",
"index",
"persistence",
"/",
"search",
"etc",
"is",
"optional",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/MetadataUtils.java#L603-L611 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java | PageInBrowserStats.getDomMinLoadTime | public long getDomMinLoadTime(final String intervalName, final TimeUnit unit) {
final long min = domMinLoadTime.getValueAsLong(intervalName);
return min == Constants.MIN_TIME_DEFAULT ? min : unit.transformMillis(min);
} | java | public long getDomMinLoadTime(final String intervalName, final TimeUnit unit) {
final long min = domMinLoadTime.getValueAsLong(intervalName);
return min == Constants.MIN_TIME_DEFAULT ? min : unit.transformMillis(min);
} | [
"public",
"long",
"getDomMinLoadTime",
"(",
"final",
"String",
"intervalName",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"final",
"long",
"min",
"=",
"domMinLoadTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
";",
"return",
"min",
"==",
"Constants",
... | Returns DOM minimum load time for given interval and time unit.
@param intervalName name of the interval
@param unit {@link TimeUnit}
@return DOM minimum load time | [
"Returns",
"DOM",
"minimum",
"load",
"time",
"for",
"given",
"interval",
"and",
"time",
"unit",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L129-L132 |
Abnaxos/markdown-doclet | doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java | MarkdownDoclet.defaultProcess | protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
try {
StringBuilder buf = new StringBuilder();
buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
buf.append('\n');
for ( Tag tag : doc.tags() ) {
processTag(tag, buf);
buf.append('\n');
}
doc.setRawCommentText(buf.toString());
}
catch ( final ParserRuntimeException e ) {
if ( doc instanceof RootDoc ) {
printError(new SourcePosition() {
@Override
public File file() {
return options.getOverviewFile();
}
@Override
public int line() {
return 0;
}
@Override
public int column() {
return 0;
}
}, e.getMessage());
}
else {
printError(doc.position(), e.getMessage());
}
}
} | java | protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
try {
StringBuilder buf = new StringBuilder();
buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
buf.append('\n');
for ( Tag tag : doc.tags() ) {
processTag(tag, buf);
buf.append('\n');
}
doc.setRawCommentText(buf.toString());
}
catch ( final ParserRuntimeException e ) {
if ( doc instanceof RootDoc ) {
printError(new SourcePosition() {
@Override
public File file() {
return options.getOverviewFile();
}
@Override
public int line() {
return 0;
}
@Override
public int column() {
return 0;
}
}, e.getMessage());
}
else {
printError(doc.position(), e.getMessage());
}
}
} | [
"protected",
"void",
"defaultProcess",
"(",
"Doc",
"doc",
",",
"boolean",
"fixLeadingSpaces",
")",
"{",
"try",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buf",
".",
"append",
"(",
"getOptions",
"(",
")",
".",
"toHtml",
"(",
... | Default processing of any documentation node.
@param doc The documentation.
@param fixLeadingSpaces `true` if leading spaces should be fixed.
@see Options#toHtml(String, boolean) | [
"Default",
"processing",
"of",
"any",
"documentation",
"node",
"."
] | train | https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L367-L399 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java | QuartzScheduler.pauseJobIfPresent | public synchronized boolean pauseJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.pauseJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
} | java | public synchronized boolean pauseJobIfPresent(final String jobName, final String groupName)
throws SchedulerException {
if (ifJobExist(jobName, groupName)) {
this.scheduler.pauseJob(new JobKey(jobName, groupName));
return true;
} else {
return false;
}
} | [
"public",
"synchronized",
"boolean",
"pauseJobIfPresent",
"(",
"final",
"String",
"jobName",
",",
"final",
"String",
"groupName",
")",
"throws",
"SchedulerException",
"{",
"if",
"(",
"ifJobExist",
"(",
"jobName",
",",
"groupName",
")",
")",
"{",
"this",
".",
"... | Pause a job if it's present.
@param jobName
@param groupName
@return true if job has been paused, no if job doesn't exist.
@throws SchedulerException | [
"Pause",
"a",
"job",
"if",
"it",
"s",
"present",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/scheduler/QuartzScheduler.java#L95-L103 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyEncoder.java | KeyEncoder.encodeDesc | public static int encodeDesc(Character value, byte[] dst, int dstOffset) {
if (value == null) {
dst[dstOffset] = NULL_BYTE_LOW;
return 1;
} else {
dst[dstOffset] = NOT_NULL_BYTE_LOW;
DataEncoder.encode((char) ~value.charValue(), dst, dstOffset + 1);
return 3;
}
} | java | public static int encodeDesc(Character value, byte[] dst, int dstOffset) {
if (value == null) {
dst[dstOffset] = NULL_BYTE_LOW;
return 1;
} else {
dst[dstOffset] = NOT_NULL_BYTE_LOW;
DataEncoder.encode((char) ~value.charValue(), dst, dstOffset + 1);
return 3;
}
} | [
"public",
"static",
"int",
"encodeDesc",
"(",
"Character",
"value",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstOffset",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"dst",
"[",
"dstOffset",
"]",
"=",
"NULL_BYTE_LOW",
";",
"return",
"1",
"... | Encodes the given Character object into exactly 1 or 3 bytes for
descending order. If the Character object is never expected to be null,
consider encoding as a char primitive.
@param value optional Character value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array
@return amount of bytes written | [
"Encodes",
"the",
"given",
"Character",
"object",
"into",
"exactly",
"1",
"or",
"3",
"bytes",
"for",
"descending",
"order",
".",
"If",
"the",
"Character",
"object",
"is",
"never",
"expected",
"to",
"be",
"null",
"consider",
"encoding",
"as",
"a",
"char",
"... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L191-L200 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/AlertsInner.java | AlertsInner.getAsync | public Observable<AlertInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<AlertInner>, AlertInner>() {
@Override
public AlertInner call(ServiceResponse<AlertInner> response) {
return response.body();
}
});
} | java | public Observable<AlertInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<AlertInner>, AlertInner>() {
@Override
public AlertInner call(ServiceResponse<AlertInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AlertInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
")",
".... | Gets an alert by name.
@param deviceName The device name.
@param name The alert name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AlertInner object | [
"Gets",
"an",
"alert",
"by",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/AlertsInner.java#L235-L242 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java | EigenvalueSmall_F64.value2x2_fast | public void value2x2_fast( double a11 , double a12, double a21 , double a22 )
{
double left = (a11+a22)/2.0;
double inside = 4.0*a12*a21 + (a11-a22)*(a11-a22);
if( inside < 0 ) {
value0.real = value1.real = left;
value0.imaginary = Math.sqrt(-inside)/2.0;
value1.imaginary = -value0.imaginary;
} else {
double right = Math.sqrt(inside)/2.0;
value0.real = (left+right);
value1.real = (left-right);
value0.imaginary = value1.imaginary = 0.0;
}
} | java | public void value2x2_fast( double a11 , double a12, double a21 , double a22 )
{
double left = (a11+a22)/2.0;
double inside = 4.0*a12*a21 + (a11-a22)*(a11-a22);
if( inside < 0 ) {
value0.real = value1.real = left;
value0.imaginary = Math.sqrt(-inside)/2.0;
value1.imaginary = -value0.imaginary;
} else {
double right = Math.sqrt(inside)/2.0;
value0.real = (left+right);
value1.real = (left-right);
value0.imaginary = value1.imaginary = 0.0;
}
} | [
"public",
"void",
"value2x2_fast",
"(",
"double",
"a11",
",",
"double",
"a12",
",",
"double",
"a21",
",",
"double",
"a22",
")",
"{",
"double",
"left",
"=",
"(",
"a11",
"+",
"a22",
")",
"/",
"2.0",
";",
"double",
"inside",
"=",
"4.0",
"*",
"a12",
"*... | Computes the eigenvalues of a 2 by 2 matrix using a faster but more prone to errors method. This
is the typical method. | [
"Computes",
"the",
"eigenvalues",
"of",
"a",
"2",
"by",
"2",
"matrix",
"using",
"a",
"faster",
"but",
"more",
"prone",
"to",
"errors",
"method",
".",
"This",
"is",
"the",
"typical",
"method",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/eig/EigenvalueSmall_F64.java#L95-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.