repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
ZieIony/Carbon | carbon/src/main/java/carbon/internal/Menu.java | Menu.addInternal | private android.view.MenuItem addInternal(int group, int id, int categoryOrder, CharSequence title) {
final int ordering = getOrdering(categoryOrder);
final MenuItem item = createNewMenuItem(group, id, categoryOrder, ordering, title,
mDefaultShowAsAction);
/*
if (mCurrentMenuInfo != null) {
// Pass along the current menu info
item.setMenuInfo(mCurrentMenuInfo);
}
*/
mItems.add(findInsertIndex(mItems, ordering), item);
onItemsChanged(true);
return item;
} | java | private android.view.MenuItem addInternal(int group, int id, int categoryOrder, CharSequence title) {
final int ordering = getOrdering(categoryOrder);
final MenuItem item = createNewMenuItem(group, id, categoryOrder, ordering, title,
mDefaultShowAsAction);
/*
if (mCurrentMenuInfo != null) {
// Pass along the current menu info
item.setMenuInfo(mCurrentMenuInfo);
}
*/
mItems.add(findInsertIndex(mItems, ordering), item);
onItemsChanged(true);
return item;
} | [
"private",
"android",
".",
"view",
".",
"MenuItem",
"addInternal",
"(",
"int",
"group",
",",
"int",
"id",
",",
"int",
"categoryOrder",
",",
"CharSequence",
"title",
")",
"{",
"final",
"int",
"ordering",
"=",
"getOrdering",
"(",
"categoryOrder",
")",
";",
"... | Adds an item to the menu. The other add methods funnel to this. | [
"Adds",
"an",
"item",
"to",
"the",
"menu",
".",
"The",
"other",
"add",
"methods",
"funnel",
"to",
"this",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/internal/Menu.java#L240-L255 |
derari/cthul | xml/src/main/java/org/cthul/resolve/ResolvingException.java | ResolvingException.throwIf | public <T1 extends Throwable>
RuntimeException throwIf(Class<T1> t1)
throws T1 {
return throwIf(t1, NULL_EX, NULL_EX, NULL_EX);
} | java | public <T1 extends Throwable>
RuntimeException throwIf(Class<T1> t1)
throws T1 {
return throwIf(t1, NULL_EX, NULL_EX, NULL_EX);
} | [
"public",
"<",
"T1",
"extends",
"Throwable",
">",
"RuntimeException",
"throwIf",
"(",
"Class",
"<",
"T1",
">",
"t1",
")",
"throws",
"T1",
"{",
"return",
"throwIf",
"(",
"t1",
",",
"NULL_EX",
",",
"NULL_EX",
",",
"NULL_EX",
")",
";",
"}"
] | Throws the {@linkplain #getResolvingCause() cause} if it is the
specified type, otherwise returns a
{@linkplain #asRuntimeException() runtime exception}.
@param <T1>
@param t1
@return runtime exception
@throws T1 | [
"Throws",
"the",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/ResolvingException.java#L227-L231 |
scireum/s3ninja | src/main/java/ninja/Bucket.java | Bucket.outputObjects | public void outputObjects(XMLStructuredOutput output, int limit, @Nullable String marker, @Nullable String prefix) {
ListFileTreeVisitor visitor = new ListFileTreeVisitor(output, limit, marker, prefix);
output.beginOutput("ListBucketResult", Attribute.set("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"));
output.property("Name", getName());
output.property("MaxKeys", limit);
output.property("Marker", marker);
output.property("Prefix", prefix);
try {
Files.walkFileTree(file.toPath(), visitor);
} catch (IOException e) {
Exceptions.handle(e);
}
output.property("IsTruncated", limit > 0 && visitor.getCount() > limit);
output.endOutput();
} | java | public void outputObjects(XMLStructuredOutput output, int limit, @Nullable String marker, @Nullable String prefix) {
ListFileTreeVisitor visitor = new ListFileTreeVisitor(output, limit, marker, prefix);
output.beginOutput("ListBucketResult", Attribute.set("xmlns", "http://s3.amazonaws.com/doc/2006-03-01/"));
output.property("Name", getName());
output.property("MaxKeys", limit);
output.property("Marker", marker);
output.property("Prefix", prefix);
try {
Files.walkFileTree(file.toPath(), visitor);
} catch (IOException e) {
Exceptions.handle(e);
}
output.property("IsTruncated", limit > 0 && visitor.getCount() > limit);
output.endOutput();
} | [
"public",
"void",
"outputObjects",
"(",
"XMLStructuredOutput",
"output",
",",
"int",
"limit",
",",
"@",
"Nullable",
"String",
"marker",
",",
"@",
"Nullable",
"String",
"prefix",
")",
"{",
"ListFileTreeVisitor",
"visitor",
"=",
"new",
"ListFileTreeVisitor",
"(",
... | Returns a list of at most the provided number of stored objects
@param output the xml structured output the list of objects should be written to
@param limit controls the maximum number of objects returned
@param marker the key to start with when listing objects in a bucket
@param prefix limits the response to keys that begin with the specified prefix | [
"Returns",
"a",
"list",
"of",
"at",
"most",
"the",
"provided",
"number",
"of",
"stored",
"objects"
] | train | https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/Bucket.java#L92-L107 |
netty/netty | transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java | NioChannelOption.setOption | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | java | static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) {
java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel;
if (!channel.supportedOptions().contains(option.option)) {
return false;
}
if (channel instanceof ServerSocketChannel && option.option == java.net.StandardSocketOptions.IP_TOS) {
// Skip IP_TOS as a workaround for a JDK bug:
// See http://mail.openjdk.java.net/pipermail/nio-dev/2018-August/005365.html
return false;
}
try {
channel.setOption(option.option, value);
return true;
} catch (IOException e) {
throw new ChannelException(e);
}
} | [
"static",
"<",
"T",
">",
"boolean",
"setOption",
"(",
"Channel",
"jdkChannel",
",",
"NioChannelOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"java",
".",
"nio",
".",
"channels",
".",
"NetworkChannel",
"channel",
"=",
"(",
"java",
".",
... | Internal helper methods to remove code duplication between Nio*Channel implementations. | [
"Internal",
"helper",
"methods",
"to",
"remove",
"code",
"duplication",
"between",
"Nio",
"*",
"Channel",
"implementations",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/socket/nio/NioChannelOption.java#L56-L72 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/ReportingApi.java | ReportingApi.peek | public List<StatisticValue> peek(String subscriptionId) throws WorkspaceApiException {
try {
InlineResponse2002 resp = api.peek(subscriptionId);
Util.throwIfNotOk(resp.getStatus());
InlineResponse2002Data data = resp.getData();
if(data == null) {
throw new WorkspaceApiException("Response data is empty");
}
return data.getStatistics();
}
catch(ApiException ex) {
throw new WorkspaceApiException("Cannot peek", ex);
}
} | java | public List<StatisticValue> peek(String subscriptionId) throws WorkspaceApiException {
try {
InlineResponse2002 resp = api.peek(subscriptionId);
Util.throwIfNotOk(resp.getStatus());
InlineResponse2002Data data = resp.getData();
if(data == null) {
throw new WorkspaceApiException("Response data is empty");
}
return data.getStatistics();
}
catch(ApiException ex) {
throw new WorkspaceApiException("Cannot peek", ex);
}
} | [
"public",
"List",
"<",
"StatisticValue",
">",
"peek",
"(",
"String",
"subscriptionId",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"InlineResponse2002",
"resp",
"=",
"api",
".",
"peek",
"(",
"subscriptionId",
")",
";",
"Util",
".",
"throwIfNotOk",
... | Get the statistics for the specified subscription ID.
@param subscriptionId The unique ID of the subscription. | [
"Get",
"the",
"statistics",
"for",
"the",
"specified",
"subscription",
"ID",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/ReportingApi.java#L33-L48 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.refundTransaction | public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) {
String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId;
if (amount != null) {
url = url + "?amount_in_cents=" + (amount.intValue() * 100);
}
doDELETE(url);
} | java | public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) {
String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId;
if (amount != null) {
url = url + "?amount_in_cents=" + (amount.intValue() * 100);
}
doDELETE(url);
} | [
"public",
"void",
"refundTransaction",
"(",
"final",
"String",
"transactionId",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"amount",
")",
"{",
"String",
"url",
"=",
"Transactions",
".",
"TRANSACTIONS_RESOURCE",
"+",
"\"/\"",
"+",
"transactionId",
";",
"if",
"(... | Refund a transaction
@param transactionId recurly transaction id
@param amount amount to refund, null for full refund | [
"Refund",
"a",
"transaction"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L956-L962 |
nathanmarz/dfs-datastores | dfs-datastores-cascading/src/main/java/com/backtype/cascading/tap/PailTap.java | PailTap.sourceConfInit | @Override
public void sourceConfInit(FlowProcess<JobConf> process, JobConf conf) {
try {
Path root = getQualifiedPath(conf);
if (_options.attrs != null && _options.attrs.length > 0) {
Pail pail = new Pail(_pailRoot, conf);
for (List<String> attr : _options.attrs) {
String rel = Utils.join(attr, "/");
pail.getSubPail(rel); //ensure the path exists
Path toAdd = new Path(root, rel);
LOG.info("Adding input path " + toAdd.toString());
FileInputFormat.addInputPath(conf, toAdd);
}
} else {
FileInputFormat.addInputPath(conf, root);
}
getScheme().sourceConfInit(process, this, conf);
makeLocal(conf, getQualifiedPath(conf), "forcing job to local mode, via source: ");
TupleSerialization.setSerializations(conf);
} catch (IOException e) {
throw new TapException(e);
}
} | java | @Override
public void sourceConfInit(FlowProcess<JobConf> process, JobConf conf) {
try {
Path root = getQualifiedPath(conf);
if (_options.attrs != null && _options.attrs.length > 0) {
Pail pail = new Pail(_pailRoot, conf);
for (List<String> attr : _options.attrs) {
String rel = Utils.join(attr, "/");
pail.getSubPail(rel); //ensure the path exists
Path toAdd = new Path(root, rel);
LOG.info("Adding input path " + toAdd.toString());
FileInputFormat.addInputPath(conf, toAdd);
}
} else {
FileInputFormat.addInputPath(conf, root);
}
getScheme().sourceConfInit(process, this, conf);
makeLocal(conf, getQualifiedPath(conf), "forcing job to local mode, via source: ");
TupleSerialization.setSerializations(conf);
} catch (IOException e) {
throw new TapException(e);
}
} | [
"@",
"Override",
"public",
"void",
"sourceConfInit",
"(",
"FlowProcess",
"<",
"JobConf",
">",
"process",
",",
"JobConf",
"conf",
")",
"{",
"try",
"{",
"Path",
"root",
"=",
"getQualifiedPath",
"(",
"conf",
")",
";",
"if",
"(",
"_options",
".",
"attrs",
"!... | no good way to override this, just had to copy/paste and modify | [
"no",
"good",
"way",
"to",
"override",
"this",
"just",
"had",
"to",
"copy",
"/",
"paste",
"and",
"modify"
] | train | https://github.com/nathanmarz/dfs-datastores/blob/ad2ce6d1ef748bab8444e81fa1617ab5e8b1a43e/dfs-datastores-cascading/src/main/java/com/backtype/cascading/tap/PailTap.java#L227-L250 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/concurrent/ExecutorServiceHelper.java | ExecutorServiceHelper.shutdownAndWaitUntilAllTasksAreFinished | @Nonnull
public static EInterrupt shutdownAndWaitUntilAllTasksAreFinished (@Nonnull final ExecutorService aES,
@Nonnegative final long nTimeout,
@Nonnull final TimeUnit eUnit)
{
ValueEnforcer.notNull (aES, "ExecutorService");
if (aES.isShutdown ())
return EInterrupt.NOT_INTERRUPTED;
// accept no further requests
aES.shutdown ();
// Wait...
return waitUntilAllTasksAreFinished (aES, nTimeout, eUnit);
} | java | @Nonnull
public static EInterrupt shutdownAndWaitUntilAllTasksAreFinished (@Nonnull final ExecutorService aES,
@Nonnegative final long nTimeout,
@Nonnull final TimeUnit eUnit)
{
ValueEnforcer.notNull (aES, "ExecutorService");
if (aES.isShutdown ())
return EInterrupt.NOT_INTERRUPTED;
// accept no further requests
aES.shutdown ();
// Wait...
return waitUntilAllTasksAreFinished (aES, nTimeout, eUnit);
} | [
"@",
"Nonnull",
"public",
"static",
"EInterrupt",
"shutdownAndWaitUntilAllTasksAreFinished",
"(",
"@",
"Nonnull",
"final",
"ExecutorService",
"aES",
",",
"@",
"Nonnegative",
"final",
"long",
"nTimeout",
",",
"@",
"Nonnull",
"final",
"TimeUnit",
"eUnit",
")",
"{",
... | Call shutdown on the {@link ExecutorService} and wait indefinitely until it
terminated.
@param aES
The {@link ExecutorService} to operate on. May not be
<code>null</code>.
@param nTimeout
the maximum time to wait. Must be > 0.
@param eUnit
the time unit of the timeout argument. Must not be <code>null</code>
.
@return {@link EInterrupt#INTERRUPTED} if the executor service was
interrupted while awaiting termination. Never <code>null</code>. | [
"Call",
"shutdown",
"on",
"the",
"{",
"@link",
"ExecutorService",
"}",
"and",
"wait",
"indefinitely",
"until",
"it",
"terminated",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/concurrent/ExecutorServiceHelper.java#L129-L144 |
RKumsher/utils | src/main/java/com/github/rkumsher/number/RandomNumberUtils.java | RandomNumberUtils.randomInt | public static int randomInt(int startInclusive, int endExclusive) {
checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start");
if (startInclusive == endExclusive) {
return startInclusive;
}
return RANDOM.ints(1, startInclusive, endExclusive).sum();
} | java | public static int randomInt(int startInclusive, int endExclusive) {
checkArgument(startInclusive <= endExclusive, "End must be greater than or equal to start");
if (startInclusive == endExclusive) {
return startInclusive;
}
return RANDOM.ints(1, startInclusive, endExclusive).sum();
} | [
"public",
"static",
"int",
"randomInt",
"(",
"int",
"startInclusive",
",",
"int",
"endExclusive",
")",
"{",
"checkArgument",
"(",
"startInclusive",
"<=",
"endExclusive",
",",
"\"End must be greater than or equal to start\"",
")",
";",
"if",
"(",
"startInclusive",
"=="... | Returns a random int within the specified range.
@param startInclusive the earliest int that can be returned
@param endExclusive the upper bound (not included)
@return the random int
@throws IllegalArgumentException if endExclusive is less than startInclusive | [
"Returns",
"a",
"random",
"int",
"within",
"the",
"specified",
"range",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L52-L58 |
bazaarvoice/emodb | mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java | HadoopDataStoreManager.createDataStoreWithHostDiscovery | private CloseableDataStore createDataStoreWithHostDiscovery(final URI location, String apiKey, MetricRegistry metricRegistry) {
// Get the service factory for this cluster.
String cluster = LocationUtil.getClusterForLocation(location);
MultiThreadedServiceFactory<AuthDataStore> dataStoreFactory = createDataStoreServiceFactory(cluster, metricRegistry);
// If the host discovery uses ZooKeeper -- that is, it doesn't used fixed hosts -- create a Curator for it.
final Optional<CuratorFramework> curator = LocationUtil.getCuratorForLocation(location);
HostDiscovery hostDiscovery = LocationUtil.getHostDiscoveryForLocation(location, curator, dataStoreFactory.getServiceName(), metricRegistry);
final AuthDataStore authDataStore = ServicePoolBuilder.create(AuthDataStore.class)
.withHostDiscovery(hostDiscovery)
.withServiceFactory(dataStoreFactory)
.withCachingPolicy(ServiceCachingPolicyBuilder.getMultiThreadedClientPolicy())
.withMetricRegistry(metricRegistry)
.buildProxy(new ExponentialBackoffRetry(5, 50, 1000, TimeUnit.MILLISECONDS));
// Set the CloseableDataStore's close() method to close the service pool proxy and, if it was required, the curator.
Runnable onClose = new Runnable() {
@Override
public void run() {
_log.info("Closing service pool and ZooKeeper connection for {}", location);
ServicePoolProxies.close(authDataStore);
if (curator.isPresent()) {
try {
Closeables.close(curator.get(), true);
} catch (IOException e) {
// Won't happen, already caught
}
}
}
};
DataStore dataStore = DataStoreAuthenticator.proxied(authDataStore).usingCredentials(apiKey);
return asCloseableDataStore(dataStore, Optional.of(onClose));
} | java | private CloseableDataStore createDataStoreWithHostDiscovery(final URI location, String apiKey, MetricRegistry metricRegistry) {
// Get the service factory for this cluster.
String cluster = LocationUtil.getClusterForLocation(location);
MultiThreadedServiceFactory<AuthDataStore> dataStoreFactory = createDataStoreServiceFactory(cluster, metricRegistry);
// If the host discovery uses ZooKeeper -- that is, it doesn't used fixed hosts -- create a Curator for it.
final Optional<CuratorFramework> curator = LocationUtil.getCuratorForLocation(location);
HostDiscovery hostDiscovery = LocationUtil.getHostDiscoveryForLocation(location, curator, dataStoreFactory.getServiceName(), metricRegistry);
final AuthDataStore authDataStore = ServicePoolBuilder.create(AuthDataStore.class)
.withHostDiscovery(hostDiscovery)
.withServiceFactory(dataStoreFactory)
.withCachingPolicy(ServiceCachingPolicyBuilder.getMultiThreadedClientPolicy())
.withMetricRegistry(metricRegistry)
.buildProxy(new ExponentialBackoffRetry(5, 50, 1000, TimeUnit.MILLISECONDS));
// Set the CloseableDataStore's close() method to close the service pool proxy and, if it was required, the curator.
Runnable onClose = new Runnable() {
@Override
public void run() {
_log.info("Closing service pool and ZooKeeper connection for {}", location);
ServicePoolProxies.close(authDataStore);
if (curator.isPresent()) {
try {
Closeables.close(curator.get(), true);
} catch (IOException e) {
// Won't happen, already caught
}
}
}
};
DataStore dataStore = DataStoreAuthenticator.proxied(authDataStore).usingCredentials(apiKey);
return asCloseableDataStore(dataStore, Optional.of(onClose));
} | [
"private",
"CloseableDataStore",
"createDataStoreWithHostDiscovery",
"(",
"final",
"URI",
"location",
",",
"String",
"apiKey",
",",
"MetricRegistry",
"metricRegistry",
")",
"{",
"// Get the service factory for this cluster.",
"String",
"cluster",
"=",
"LocationUtil",
".",
"... | Creates a DataStore using host discovery (ZooKeeper and Ostrich). | [
"Creates",
"a",
"DataStore",
"using",
"host",
"discovery",
"(",
"ZooKeeper",
"and",
"Ostrich",
")",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java#L101-L135 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/io/ModbusASCIITransport.java | ModbusASCIITransport.calculateLRC | private static byte calculateLRC(byte[] data, int off, int length, int tailskip) {
int lrc = 0;
for (int i = off; i < length - tailskip; i++) {
lrc += ((int) data[i]) & 0xFF;
}
return (byte) ((-lrc) & 0xff);
} | java | private static byte calculateLRC(byte[] data, int off, int length, int tailskip) {
int lrc = 0;
for (int i = off; i < length - tailskip; i++) {
lrc += ((int) data[i]) & 0xFF;
}
return (byte) ((-lrc) & 0xff);
} | [
"private",
"static",
"byte",
"calculateLRC",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"off",
",",
"int",
"length",
",",
"int",
"tailskip",
")",
"{",
"int",
"lrc",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"off",
";",
"i",
"<",
"length",
"-",
... | Calculates a LRC checksum
@param data Data to use
@param off Offset into byte array
@param length Number of bytes to use
@param tailskip Bytes to skip at tail
@return Checksum | [
"Calculates",
"a",
"LRC",
"checksum"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusASCIITransport.java#L211-L217 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/SingleInputSemanticProperties.java | SingleInputSemanticProperties.addForwardedField | public void addForwardedField(int sourceField, FieldSet destinationFields) {
FieldSet fs;
if((fs = this.forwardedFields.get(sourceField)) != null) {
fs.addAll(destinationFields);
} else {
fs = new FieldSet(destinationFields);
this.forwardedFields.put(sourceField, fs);
}
} | java | public void addForwardedField(int sourceField, FieldSet destinationFields) {
FieldSet fs;
if((fs = this.forwardedFields.get(sourceField)) != null) {
fs.addAll(destinationFields);
} else {
fs = new FieldSet(destinationFields);
this.forwardedFields.put(sourceField, fs);
}
} | [
"public",
"void",
"addForwardedField",
"(",
"int",
"sourceField",
",",
"FieldSet",
"destinationFields",
")",
"{",
"FieldSet",
"fs",
";",
"if",
"(",
"(",
"fs",
"=",
"this",
".",
"forwardedFields",
".",
"get",
"(",
"sourceField",
")",
")",
"!=",
"null",
")",... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) to multiple fields in the destination
record(s).
@param sourceField the position in the source record(s)
@param destinationFields the position in the destination record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"to",
"multiple",
"fields",
"in",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/SingleInputSemanticProperties.java#L69-L77 |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/typeahead/client/ui/Typeahead.java | Typeahead.onSelected | private void onSelected(final Event event, final Suggestion<T> suggestion) {
TypeaheadSelectedEvent.fire(this, suggestion, event);
} | java | private void onSelected(final Event event, final Suggestion<T> suggestion) {
TypeaheadSelectedEvent.fire(this, suggestion, event);
} | [
"private",
"void",
"onSelected",
"(",
"final",
"Event",
"event",
",",
"final",
"Suggestion",
"<",
"T",
">",
"suggestion",
")",
"{",
"TypeaheadSelectedEvent",
".",
"fire",
"(",
"this",
",",
"suggestion",
",",
"event",
")",
";",
"}"
] | Triggered when a suggestion from the dropdown menu is selected.
@param event the event
@param suggestion the suggestion object | [
"Triggered",
"when",
"a",
"suggestion",
"from",
"the",
"dropdown",
"menu",
"is",
"selected",
"."
] | train | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/typeahead/client/ui/Typeahead.java#L200-L202 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java | ProcessListenerEx.asUnsigned | public short asUnsigned(ProcessEvent e, String scale) throws KNXFormatException
{
final DPTXlator8BitUnsigned t = new DPTXlator8BitUnsigned(scale);
t.setData(e.getASDU());
return t.getValueUnsigned();
} | java | public short asUnsigned(ProcessEvent e, String scale) throws KNXFormatException
{
final DPTXlator8BitUnsigned t = new DPTXlator8BitUnsigned(scale);
t.setData(e.getASDU());
return t.getValueUnsigned();
} | [
"public",
"short",
"asUnsigned",
"(",
"ProcessEvent",
"e",
",",
"String",
"scale",
")",
"throws",
"KNXFormatException",
"{",
"final",
"DPTXlator8BitUnsigned",
"t",
"=",
"new",
"DPTXlator8BitUnsigned",
"(",
"scale",
")",
";",
"t",
".",
"setData",
"(",
"e",
".",... | Returns the ASDU of the received process event as unsigned 8 Bit datapoint value.
<p>
This method has to be invoked manually by the user (either in
{@link #groupReadResponse(ProcessEvent)} or
{@link ProcessListener#groupWrite(ProcessEvent)}), depending on the received
datapoint type.
@param e the process event with the ASDU to translate
@param scale see {@link ProcessCommunicator#readUnsigned(
tuwien.auto.calimero.GroupAddress, String)}
@return the received value of type 8 Bit unsigned
@throws KNXFormatException on not supported or not available 8 Bit unsigned DPT | [
"Returns",
"the",
"ASDU",
"of",
"the",
"received",
"process",
"event",
"as",
"unsigned",
"8",
"Bit",
"datapoint",
"value",
".",
"<p",
">",
"This",
"method",
"has",
"to",
"be",
"invoked",
"manually",
"by",
"the",
"user",
"(",
"either",
"in",
"{",
"@link",... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java#L149-L154 |
Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java | LifecycleHooks.installTransformer | public static ClassFileTransformer installTransformer(Instrumentation instrumentation) {
final TypeDescription runReflectiveCall = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.RunReflectiveCall").resolve();
final TypeDescription finished = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.Finished").resolve();
final TypeDescription createTest = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.CreateTest").resolve();
final TypeDescription runChild = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.RunChild").resolve();
final TypeDescription run = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.Run").resolve();
final TypeDescription runNotifier = TypePool.Default.ofSystemLoader().describe("org.junit.runner.notification.RunNotifier").resolve();
final SignatureToken runToken = new SignatureToken("run", TypeDescription.VOID, Arrays.asList(runNotifier));
return new AgentBuilder.Default()
.type(hasSuperType(named("org.junit.internal.runners.model.ReflectiveCallable")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("runReflectiveCall")).intercept(MethodDelegation.to(runReflectiveCall))
.implement(Hooked.class);
}
})
.type(hasSuperType(named("org.junit.runners.model.RunnerScheduler")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("finished")).intercept(MethodDelegation.to(finished))
.implement(Hooked.class);
}
})
.type(hasSuperType(named("org.junit.runners.ParentRunner")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("createTest")).intercept(MethodDelegation.to(createTest))
.method(named("runChild")).intercept(MethodDelegation.to(runChild))
.method(hasSignature(runToken)).intercept(MethodDelegation.to(run))
.implement(Hooked.class);
}
})
.installOn(instrumentation);
} | java | public static ClassFileTransformer installTransformer(Instrumentation instrumentation) {
final TypeDescription runReflectiveCall = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.RunReflectiveCall").resolve();
final TypeDescription finished = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.Finished").resolve();
final TypeDescription createTest = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.CreateTest").resolve();
final TypeDescription runChild = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.RunChild").resolve();
final TypeDescription run = TypePool.Default.ofSystemLoader().describe("com.nordstrom.automation.junit.Run").resolve();
final TypeDescription runNotifier = TypePool.Default.ofSystemLoader().describe("org.junit.runner.notification.RunNotifier").resolve();
final SignatureToken runToken = new SignatureToken("run", TypeDescription.VOID, Arrays.asList(runNotifier));
return new AgentBuilder.Default()
.type(hasSuperType(named("org.junit.internal.runners.model.ReflectiveCallable")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("runReflectiveCall")).intercept(MethodDelegation.to(runReflectiveCall))
.implement(Hooked.class);
}
})
.type(hasSuperType(named("org.junit.runners.model.RunnerScheduler")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("finished")).intercept(MethodDelegation.to(finished))
.implement(Hooked.class);
}
})
.type(hasSuperType(named("org.junit.runners.ParentRunner")))
.transform(new Transformer() {
@Override
public Builder<?> transform(Builder<?> builder, TypeDescription type,
ClassLoader classloader, JavaModule module) {
return builder.method(named("createTest")).intercept(MethodDelegation.to(createTest))
.method(named("runChild")).intercept(MethodDelegation.to(runChild))
.method(hasSignature(runToken)).intercept(MethodDelegation.to(run))
.implement(Hooked.class);
}
})
.installOn(instrumentation);
} | [
"public",
"static",
"ClassFileTransformer",
"installTransformer",
"(",
"Instrumentation",
"instrumentation",
")",
"{",
"final",
"TypeDescription",
"runReflectiveCall",
"=",
"TypePool",
".",
"Default",
".",
"ofSystemLoader",
"(",
")",
".",
"describe",
"(",
"\"com.nordstr... | Install the {@code Byte Buddy} byte code transformations that provide test fine-grained test lifecycle hooks.
@param instrumentation {@link Instrumentation} object used to transform JUnit core classes
@return The installed class file transformer | [
"Install",
"the",
"{",
"@code",
"Byte",
"Buddy",
"}",
"byte",
"code",
"transformations",
"that",
"provide",
"test",
"fine",
"-",
"grained",
"test",
"lifecycle",
"hooks",
"."
] | train | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L71-L112 |
nutzam/nutzboot | nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java | TioWebsocketMsgHandler.onText | @Override
public Object onText(WsRequest wsRequest, String text, ChannelContext channelContext) throws Exception {
log.debug("onText");
TioWebsocketMethodMapper onText = methods.getOnText();
if (onText != null) {
onText.getMethod().invoke(onText.getInstance(), channelContext, text);
} else {
TioWebsocketMethodMapper onBeforeText = methods.getOnBeforeText();
if (onBeforeText != null) {
TioWebsocketRequest invoke = (TioWebsocketRequest) onBeforeText.getMethod().invoke(onBeforeText.getInstance(), channelContext, text);
onMapEvent(invoke, channelContext);
}
}
return null;
} | java | @Override
public Object onText(WsRequest wsRequest, String text, ChannelContext channelContext) throws Exception {
log.debug("onText");
TioWebsocketMethodMapper onText = methods.getOnText();
if (onText != null) {
onText.getMethod().invoke(onText.getInstance(), channelContext, text);
} else {
TioWebsocketMethodMapper onBeforeText = methods.getOnBeforeText();
if (onBeforeText != null) {
TioWebsocketRequest invoke = (TioWebsocketRequest) onBeforeText.getMethod().invoke(onBeforeText.getInstance(), channelContext, text);
onMapEvent(invoke, channelContext);
}
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"onText",
"(",
"WsRequest",
"wsRequest",
",",
"String",
"text",
",",
"ChannelContext",
"channelContext",
")",
"throws",
"Exception",
"{",
"log",
".",
"debug",
"(",
"\"onText\"",
")",
";",
"TioWebsocketMethodMapper",
"onText",
... | receive text
@param wsRequest wsRequest
@param text String
@param channelContext channelContext
@return AnyObject
@throws Exception e | [
"receive",
"text"
] | train | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-tio-websocket/src/main/java/org/nutz/boot/starter/tio/websocketbean/TioWebsocketMsgHandler.java#L116-L130 |
alkacon/opencms-core | src/org/opencms/site/CmsSiteManagerImpl.java | CmsSiteManagerImpl.removeSite | public void removeSite(CmsObject cms, CmsSite site) throws CmsException {
// check permissions
if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
// simple unit tests will have runlevel 1 and no CmsObject
OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER);
}
// un-freeze
m_frozen = false;
// create a new map containing all existing sites without the one to remove
Map<CmsSiteMatcher, CmsSite> siteMatcherSites = new HashMap<CmsSiteMatcher, CmsSite>();
List<CmsSiteMatcher> matchersForSite = site.getAllMatchers();
for (Map.Entry<CmsSiteMatcher, CmsSite> entry : m_siteMatcherSites.entrySet()) {
if (!(matchersForSite.contains(entry.getKey()))) {
// entry not the site itself nor an alias of the site nor the secure URL of the site, so add it
siteMatcherSites.put(entry.getKey(), entry.getValue());
}
}
setSiteMatcherSites(siteMatcherSites);
// remove the site from the map holding the site roots as keys and the sites as values
Map<String, CmsSite> siteRootSites = new HashMap<String, CmsSite>(m_siteRootSites);
siteRootSites.remove(site.getSiteRoot());
m_siteRootSites = Collections.unmodifiableMap(siteRootSites);
// re-initialize, will freeze the state when finished
initialize(cms);
OpenCms.writeConfiguration(CmsSitesConfiguration.class);
} | java | public void removeSite(CmsObject cms, CmsSite site) throws CmsException {
// check permissions
if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
// simple unit tests will have runlevel 1 and no CmsObject
OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER);
}
// un-freeze
m_frozen = false;
// create a new map containing all existing sites without the one to remove
Map<CmsSiteMatcher, CmsSite> siteMatcherSites = new HashMap<CmsSiteMatcher, CmsSite>();
List<CmsSiteMatcher> matchersForSite = site.getAllMatchers();
for (Map.Entry<CmsSiteMatcher, CmsSite> entry : m_siteMatcherSites.entrySet()) {
if (!(matchersForSite.contains(entry.getKey()))) {
// entry not the site itself nor an alias of the site nor the secure URL of the site, so add it
siteMatcherSites.put(entry.getKey(), entry.getValue());
}
}
setSiteMatcherSites(siteMatcherSites);
// remove the site from the map holding the site roots as keys and the sites as values
Map<String, CmsSite> siteRootSites = new HashMap<String, CmsSite>(m_siteRootSites);
siteRootSites.remove(site.getSiteRoot());
m_siteRootSites = Collections.unmodifiableMap(siteRootSites);
// re-initialize, will freeze the state when finished
initialize(cms);
OpenCms.writeConfiguration(CmsSitesConfiguration.class);
} | [
"public",
"void",
"removeSite",
"(",
"CmsObject",
"cms",
",",
"CmsSite",
"site",
")",
"throws",
"CmsException",
"{",
"// check permissions",
"if",
"(",
"OpenCms",
".",
"getRunLevel",
"(",
")",
">",
"OpenCms",
".",
"RUNLEVEL_1_CORE_OBJECT",
")",
"{",
"// simple u... | Removes a site from the list of configured sites.<p>
@param cms the cms object
@param site the site to remove
@throws CmsException if something goes wrong | [
"Removes",
"a",
"site",
"from",
"the",
"list",
"of",
"configured",
"sites",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1404-L1434 |
johnkil/Android-RobotoTextView | robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java | RobotoTypefaces.setUpTypeface | public static void setUpTypeface(@NonNull TextView textView, @RobotoTypeface int typeface) {
setUpTypeface(textView, obtainTypeface(textView.getContext(), typeface));
} | java | public static void setUpTypeface(@NonNull TextView textView, @RobotoTypeface int typeface) {
setUpTypeface(textView, obtainTypeface(textView.getContext(), typeface));
} | [
"public",
"static",
"void",
"setUpTypeface",
"(",
"@",
"NonNull",
"TextView",
"textView",
",",
"@",
"RobotoTypeface",
"int",
"typeface",
")",
"{",
"setUpTypeface",
"(",
"textView",
",",
"obtainTypeface",
"(",
"textView",
".",
"getContext",
"(",
")",
",",
"type... | Set up typeface for TextView.
@param textView The text view
@param typeface The value of "robotoTypeface" attribute | [
"Set",
"up",
"typeface",
"for",
"TextView",
"."
] | train | https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java#L525-L527 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/background/FactoryBackgroundModel.java | FactoryBackgroundModel.stationaryGaussian | public static <T extends ImageBase<T>>
BackgroundStationaryGaussian<T> stationaryGaussian(@Nonnull ConfigBackgroundGaussian config , ImageType<T> imageType ) {
config.checkValidity();
BackgroundStationaryGaussian<T> ret;
switch( imageType.getFamily() ) {
case GRAY:
ret = new BackgroundStationaryGaussian_SB(config.learnRate,config.threshold,imageType.getImageClass());
break;
case PLANAR:
ret = new BackgroundStationaryGaussian_PL(config.learnRate,config.threshold,imageType);
break;
case INTERLEAVED:
ret = new BackgroundStationaryGaussian_IL(config.learnRate,config.threshold,imageType);
break;
default:
throw new IllegalArgumentException("Unknown image type");
}
ret.setInitialVariance(config.initialVariance);
ret.setMinimumDifference(config.minimumDifference);
ret.setUnknownValue(config.unknownValue);
return ret;
} | java | public static <T extends ImageBase<T>>
BackgroundStationaryGaussian<T> stationaryGaussian(@Nonnull ConfigBackgroundGaussian config , ImageType<T> imageType ) {
config.checkValidity();
BackgroundStationaryGaussian<T> ret;
switch( imageType.getFamily() ) {
case GRAY:
ret = new BackgroundStationaryGaussian_SB(config.learnRate,config.threshold,imageType.getImageClass());
break;
case PLANAR:
ret = new BackgroundStationaryGaussian_PL(config.learnRate,config.threshold,imageType);
break;
case INTERLEAVED:
ret = new BackgroundStationaryGaussian_IL(config.learnRate,config.threshold,imageType);
break;
default:
throw new IllegalArgumentException("Unknown image type");
}
ret.setInitialVariance(config.initialVariance);
ret.setMinimumDifference(config.minimumDifference);
ret.setUnknownValue(config.unknownValue);
return ret;
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageBase",
"<",
"T",
">",
">",
"BackgroundStationaryGaussian",
"<",
"T",
">",
"stationaryGaussian",
"(",
"@",
"Nonnull",
"ConfigBackgroundGaussian",
"config",
",",
"ImageType",
"<",
"T",
">",
"imageType",
")",
"{",
"c... | Creates an instance of {@link BackgroundStationaryGaussian}.
@param config Configures the background model
@param imageType Type of input image
@return new instance of the background model | [
"Creates",
"an",
"instance",
"of",
"{",
"@link",
"BackgroundStationaryGaussian",
"}",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/background/FactoryBackgroundModel.java#L112-L141 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java | IntFloatDenseVector.lookupIndex | public int lookupIndex(float value, float delta) {
for (int i=0; i<elements.length; i++) {
if (Primitives.equals(elements[i], value, delta)) {
return i;
}
}
return -1;
} | java | public int lookupIndex(float value, float delta) {
for (int i=0; i<elements.length; i++) {
if (Primitives.equals(elements[i], value, delta)) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lookupIndex",
"(",
"float",
"value",
",",
"float",
"delta",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Primitives",
".",
"equals",
"(",
"elements",
... | Gets the index of the first element in this vector with the specified
value, or -1 if it is not present.
@param value The value to search for.
@param delta The delta with which to evaluate equality.
@return The index or -1 if not present. | [
"Gets",
"the",
"index",
"of",
"the",
"first",
"element",
"in",
"this",
"vector",
"with",
"the",
"specified",
"value",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"present",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java#L184-L191 |
alipay/sofa-hessian | src/main/java/com/caucho/hessian/io/HessianOutput.java | HessianOutput.writeByteBufferPart | public void writeByteBufferPart(byte[] buffer, int offset, int length)
throws IOException
{
while (length > 0) {
int sublen = length;
if (0x8000 < sublen)
sublen = 0x8000;
os.write('b');
os.write(sublen >> 8);
os.write(sublen);
os.write(buffer, offset, sublen);
length -= sublen;
offset += sublen;
}
} | java | public void writeByteBufferPart(byte[] buffer, int offset, int length)
throws IOException
{
while (length > 0) {
int sublen = length;
if (0x8000 < sublen)
sublen = 0x8000;
os.write('b');
os.write(sublen >> 8);
os.write(sublen);
os.write(buffer, offset, sublen);
length -= sublen;
offset += sublen;
}
} | [
"public",
"void",
"writeByteBufferPart",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"while",
"(",
"length",
">",
"0",
")",
"{",
"int",
"sublen",
"=",
"length",
";",
"if",
"(",
"0x8000... | Writes a byte buffer to the stream.
<code><pre>
b b16 b18 bytes
</pre></code> | [
"Writes",
"a",
"byte",
"buffer",
"to",
"the",
"stream",
"."
] | train | https://github.com/alipay/sofa-hessian/blob/89e4f5af28602101dab7b498995018871616357b/src/main/java/com/caucho/hessian/io/HessianOutput.java#L730-L748 |
alkacon/opencms-core | src/org/opencms/util/CmsStringUtil.java | CmsStringUtil.changeFileNameSuffixTo | public static String changeFileNameSuffixTo(String filename, String suffix) {
int dotPos = filename.lastIndexOf('.');
if (dotPos != -1) {
return filename.substring(0, dotPos + 1) + suffix;
} else {
// the string has no suffix
return filename;
}
} | java | public static String changeFileNameSuffixTo(String filename, String suffix) {
int dotPos = filename.lastIndexOf('.');
if (dotPos != -1) {
return filename.substring(0, dotPos + 1) + suffix;
} else {
// the string has no suffix
return filename;
}
} | [
"public",
"static",
"String",
"changeFileNameSuffixTo",
"(",
"String",
"filename",
",",
"String",
"suffix",
")",
"{",
"int",
"dotPos",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"dotPos",
"!=",
"-",
"1",
")",
"{",
"return",
... | Changes the given filenames suffix from the current suffix to the provided suffix.
<b>Directly exposed for JSP EL</b>, not through {@link org.opencms.jsp.util.CmsJspElFunctions}.<p>
@param filename the filename to be changed
@param suffix the new suffix of the file
@return the filename with the replaced suffix | [
"Changes",
"the",
"given",
"filenames",
"suffix",
"from",
"the",
"current",
"suffix",
"to",
"the",
"provided",
"suffix",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L249-L258 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ServiceLoaderHelper.java | ServiceLoaderHelper.getFirstSPIImplementation | @Nullable
public static <T> T getFirstSPIImplementation (@Nonnull final Class <T> aSPIClass, @Nullable final Logger aLogger)
{
return getFirstSPIImplementation (aSPIClass, ClassLoaderHelper.getDefaultClassLoader (), aLogger);
} | java | @Nullable
public static <T> T getFirstSPIImplementation (@Nonnull final Class <T> aSPIClass, @Nullable final Logger aLogger)
{
return getFirstSPIImplementation (aSPIClass, ClassLoaderHelper.getDefaultClassLoader (), aLogger);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
">",
"T",
"getFirstSPIImplementation",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"T",
">",
"aSPIClass",
",",
"@",
"Nullable",
"final",
"Logger",
"aLogger",
")",
"{",
"return",
"getFirstSPIImplementation",
"(",
... | Uses the {@link ServiceLoader} to load all SPI implementations of the
passed class and return only the first instance.
@param <T>
The implementation type to be loaded
@param aSPIClass
The SPI interface class. May not be <code>null</code>.
@param aLogger
An optional logger to use. May be <code>null</code>.
@return A collection of all currently available plugins. Never
<code>null</code>. | [
"Uses",
"the",
"{",
"@link",
"ServiceLoader",
"}",
"to",
"load",
"all",
"SPI",
"implementations",
"of",
"the",
"passed",
"class",
"and",
"return",
"only",
"the",
"first",
"instance",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ServiceLoaderHelper.java#L225-L229 |
matthewhorridge/mdock | src/main/java/org/coode/mdock/SplitterNode.java | SplitterNode.addChild | protected void addChild(Node child, int index, double split) {
children.add(index, child);
nodeSplits.put(child, split);
child.setParent(this);
} | java | protected void addChild(Node child, int index, double split) {
children.add(index, child);
nodeSplits.put(child, split);
child.setParent(this);
} | [
"protected",
"void",
"addChild",
"(",
"Node",
"child",
",",
"int",
"index",
",",
"double",
"split",
")",
"{",
"children",
".",
"add",
"(",
"index",
",",
"child",
")",
";",
"nodeSplits",
".",
"put",
"(",
"child",
",",
"split",
")",
";",
"child",
".",
... | Adds a child of this node.
@param child The child node to be added
@param index The position of the child node.
@param split The amount/weighting of parent node that the child node should
receive | [
"Adds",
"a",
"child",
"of",
"this",
"node",
"."
] | train | https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L217-L221 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java | RxJavaPlugins.createSingleScheduler | @NonNull
@GwtIncompatible
public static Scheduler createSingleScheduler(@NonNull ThreadFactory threadFactory) {
return new SingleScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
} | java | @NonNull
@GwtIncompatible
public static Scheduler createSingleScheduler(@NonNull ThreadFactory threadFactory) {
return new SingleScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null"));
} | [
"@",
"NonNull",
"@",
"GwtIncompatible",
"public",
"static",
"Scheduler",
"createSingleScheduler",
"(",
"@",
"NonNull",
"ThreadFactory",
"threadFactory",
")",
"{",
"return",
"new",
"SingleScheduler",
"(",
"ObjectHelper",
".",
"requireNonNull",
"(",
"threadFactory",
","... | Create an instance of the default {@link Scheduler} used for {@link Schedulers#single()}
except using {@code threadFactory} for thread creation.
<p>History: 2.0.5 - experimental
@param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any
system properties for configuring new thread creation. Cannot be null.
@return the created Scheduler instance
@since 2.1 | [
"Create",
"an",
"instance",
"of",
"the",
"default",
"{"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java#L1254-L1258 |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java | AuthenticationApi.tenantInfoWithHttpInfo | public ApiResponse<ModelApiResponse> tenantInfoWithHttpInfo(ApiRequestAuthSchemeLookupData lookupData) throws ApiException {
com.squareup.okhttp.Call call = tenantInfoValidateBeforeCall(lookupData, null, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | java | public ApiResponse<ModelApiResponse> tenantInfoWithHttpInfo(ApiRequestAuthSchemeLookupData lookupData) throws ApiException {
com.squareup.okhttp.Call call = tenantInfoValidateBeforeCall(lookupData, null, null);
Type localVarReturnType = new TypeToken<ModelApiResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | [
"public",
"ApiResponse",
"<",
"ModelApiResponse",
">",
"tenantInfoWithHttpInfo",
"(",
"ApiRequestAuthSchemeLookupData",
"lookupData",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"tenantInfoValidateBeforeCall",
"("... | Get authentication scheme.
Get the authentication scheme by user name or tenant name. The return value is 'saml' if the contact center has [Security Assertion Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) (SAML) enabled; otherwise, the return value is 'basic'.
@param lookupData Data for scheme lookup. (required)
@return ApiResponse<ModelApiResponse>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"authentication",
"scheme",
".",
"Get",
"the",
"authentication",
"scheme",
"by",
"user",
"name",
"or",
"tenant",
"name",
".",
"The",
"return",
"value",
"is",
"'",
";",
"saml'",
";",
"if",
"the",
"contact",
"center",
"has",
"[",
"Security",
"As... | train | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1600-L1604 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java | TypeConversion.longToBytes | public static void longToBytes(long value, byte[] bytes, int offset) {
for (int i = offset + 7; i >= offset; --i) {
bytes[i] = (byte) value;
value = value >> 8;
}
} | java | public static void longToBytes(long value, byte[] bytes, int offset) {
for (int i = offset + 7; i >= offset; --i) {
bytes[i] = (byte) value;
value = value >> 8;
}
} | [
"public",
"static",
"void",
"longToBytes",
"(",
"long",
"value",
",",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"offset",
"+",
"7",
";",
"i",
">=",
"offset",
";",
"--",
"i",
")",
"{",
"bytes",
"[",
... | A utility method to convert the long into bytes in an array.
@param value
The long.
@param bytes
The byte array to which the long should be copied.
@param offset
The index where the long should start. | [
"A",
"utility",
"method",
"to",
"convert",
"the",
"long",
"into",
"bytes",
"in",
"an",
"array",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L143-L148 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GammaDistribution.java | GammaDistribution.logcdf | public static double logcdf(double val, double k, double theta) {
if(val < 0) {
return Double.NEGATIVE_INFINITY;
}
double vt = val * theta;
return (val == Double.POSITIVE_INFINITY) ? 0. : logregularizedGammaP(k, vt);
} | java | public static double logcdf(double val, double k, double theta) {
if(val < 0) {
return Double.NEGATIVE_INFINITY;
}
double vt = val * theta;
return (val == Double.POSITIVE_INFINITY) ? 0. : logregularizedGammaP(k, vt);
} | [
"public",
"static",
"double",
"logcdf",
"(",
"double",
"val",
",",
"double",
"k",
",",
"double",
"theta",
")",
"{",
"if",
"(",
"val",
"<",
"0",
")",
"{",
"return",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"}",
"double",
"vt",
"=",
"val",
"*",
"theta"... | The log CDF, static version.
@param val Value
@param k Shape k
@param theta Theta = 1.0/Beta aka. "scaling" parameter
@return cdf value | [
"The",
"log",
"CDF",
"static",
"version",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/GammaDistribution.java#L201-L207 |
Abnaxos/markdown-doclet | doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java | MarkdownDoclet.processTag | @SuppressWarnings("unchecked")
protected void processTag(Tag tag, StringBuilder target) {
TagRenderer<Tag> renderer = (TagRenderer<Tag>)tagRenderers.get(tag.kind());
if ( renderer == null ) {
renderer = TagRenderer.VERBATIM;
}
renderer.render(tag, target, this);
} | java | @SuppressWarnings("unchecked")
protected void processTag(Tag tag, StringBuilder target) {
TagRenderer<Tag> renderer = (TagRenderer<Tag>)tagRenderers.get(tag.kind());
if ( renderer == null ) {
renderer = TagRenderer.VERBATIM;
}
renderer.render(tag, target, this);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"processTag",
"(",
"Tag",
"tag",
",",
"StringBuilder",
"target",
")",
"{",
"TagRenderer",
"<",
"Tag",
">",
"renderer",
"=",
"(",
"TagRenderer",
"<",
"Tag",
">",
")",
"tagRenderers",
"."... | Process a tag.
@param tag The tag.
@param target The target string builder. | [
"Process",
"a",
"tag",
"."
] | train | https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/MarkdownDoclet.java#L407-L414 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/cos/COSBlockOutputStream.java | COSBlockOutputStream.putObject | private void putObject() throws IOException {
LOG.debug("Executing regular upload for {}", writeOperationHelper);
final COSDataBlocks.DataBlock block = getActiveBlock();
int size = block.dataSize();
final COSDataBlocks.BlockUploadData uploadData = block.startUpload();
final PutObjectRequest putObjectRequest = uploadData.hasFile()
? writeOperationHelper.newPutRequest(uploadData.getFile())
: writeOperationHelper.newPutRequest(uploadData.getUploadStream(), size);
final ObjectMetadata om = new ObjectMetadata();
om.setUserMetadata(mMetadata);
if (contentType != null && !contentType.isEmpty()) {
om.setContentType(contentType);
} else {
om.setContentType("application/octet-stream");
}
putObjectRequest.setMetadata(om);
ListenableFuture<PutObjectResult> putObjectResult =
executorService.submit(new Callable<PutObjectResult>() {
@Override
public PutObjectResult call() throws Exception {
PutObjectResult result;
try {
// the putObject call automatically closes the input
// stream afterwards.
result = writeOperationHelper.putObject(putObjectRequest);
} finally {
closeAll(LOG, uploadData, block);
}
return result;
}
});
clearActiveBlock();
// wait for completion
try {
putObjectResult.get();
} catch (InterruptedException ie) {
LOG.warn("Interrupted object upload", ie);
Thread.currentThread().interrupt();
} catch (ExecutionException ee) {
throw extractException("regular upload", key, ee);
}
} | java | private void putObject() throws IOException {
LOG.debug("Executing regular upload for {}", writeOperationHelper);
final COSDataBlocks.DataBlock block = getActiveBlock();
int size = block.dataSize();
final COSDataBlocks.BlockUploadData uploadData = block.startUpload();
final PutObjectRequest putObjectRequest = uploadData.hasFile()
? writeOperationHelper.newPutRequest(uploadData.getFile())
: writeOperationHelper.newPutRequest(uploadData.getUploadStream(), size);
final ObjectMetadata om = new ObjectMetadata();
om.setUserMetadata(mMetadata);
if (contentType != null && !contentType.isEmpty()) {
om.setContentType(contentType);
} else {
om.setContentType("application/octet-stream");
}
putObjectRequest.setMetadata(om);
ListenableFuture<PutObjectResult> putObjectResult =
executorService.submit(new Callable<PutObjectResult>() {
@Override
public PutObjectResult call() throws Exception {
PutObjectResult result;
try {
// the putObject call automatically closes the input
// stream afterwards.
result = writeOperationHelper.putObject(putObjectRequest);
} finally {
closeAll(LOG, uploadData, block);
}
return result;
}
});
clearActiveBlock();
// wait for completion
try {
putObjectResult.get();
} catch (InterruptedException ie) {
LOG.warn("Interrupted object upload", ie);
Thread.currentThread().interrupt();
} catch (ExecutionException ee) {
throw extractException("regular upload", key, ee);
}
} | [
"private",
"void",
"putObject",
"(",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"debug",
"(",
"\"Executing regular upload for {}\"",
",",
"writeOperationHelper",
")",
";",
"final",
"COSDataBlocks",
".",
"DataBlock",
"block",
"=",
"getActiveBlock",
"(",
")",
";... | Upload the current block as a single PUT request; if the buffer is empty a
0-byte PUT will be invoked, as it is needed to create an entry at the far
end.
@throws IOException any problem | [
"Upload",
"the",
"current",
"block",
"as",
"a",
"single",
"PUT",
"request",
";",
"if",
"the",
"buffer",
"is",
"empty",
"a",
"0",
"-",
"byte",
"PUT",
"will",
"be",
"invoked",
"as",
"it",
"is",
"needed",
"to",
"create",
"an",
"entry",
"at",
"the",
"far... | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSBlockOutputStream.java#L371-L414 |
beanshell/beanshell | src/main/java/bsh/BlockNameSpace.java | BlockNameSpace.setBlockVariable | public void setBlockVariable( String name, Object value )
throws UtilEvalError
{
super.setVariable( name, value, false/*strict?*/, false );
} | java | public void setBlockVariable( String name, Object value )
throws UtilEvalError
{
super.setVariable( name, value, false/*strict?*/, false );
} | [
"public",
"void",
"setBlockVariable",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"UtilEvalError",
"{",
"super",
".",
"setVariable",
"(",
"name",
",",
"value",
",",
"false",
"/*strict?*/",
",",
"false",
")",
";",
"}"
] | Set an untyped variable in the block namespace.
The BlockNameSpace would normally delegate this set to the parent.
Typed variables are naturally set locally.
This is used in try/catch block argument. | [
"Set",
"an",
"untyped",
"variable",
"in",
"the",
"block",
"namespace",
".",
"The",
"BlockNameSpace",
"would",
"normally",
"delegate",
"this",
"set",
"to",
"the",
"parent",
".",
"Typed",
"variables",
"are",
"naturally",
"set",
"locally",
".",
"This",
"is",
"u... | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BlockNameSpace.java#L87-L91 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java | JQMHeader.setRightButton | public JQMButton setRightButton(String text, JQMPage page, DataIcon icon) {
return setRightButton(text, "#" + page.getId(), icon);
} | java | public JQMButton setRightButton(String text, JQMPage page, DataIcon icon) {
return setRightButton(text, "#" + page.getId(), icon);
} | [
"public",
"JQMButton",
"setRightButton",
"(",
"String",
"text",
",",
"JQMPage",
"page",
",",
"DataIcon",
"icon",
")",
"{",
"return",
"setRightButton",
"(",
"text",
",",
"\"#\"",
"+",
"page",
".",
"getId",
"(",
")",
",",
"icon",
")",
";",
"}"
] | Creates a new {@link JQMButton} with the given text and linking to the
given {@link JQMPage} and with the given icon and then sets that button
in the right slot. Any existing right button will be replaced.
@param text
the text for the button
@param page
the optional page for the button to link to, if null then
this button does not navigate by default
@param icon
the icon to use or null if no icon is required
@return the created button | [
"Creates",
"a",
"new",
"{",
"@link",
"JQMButton",
"}",
"with",
"the",
"given",
"text",
"and",
"linking",
"to",
"the",
"given",
"{",
"@link",
"JQMPage",
"}",
"and",
"with",
"the",
"given",
"icon",
"and",
"then",
"sets",
"that",
"button",
"in",
"the",
"r... | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L329-L331 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/ChaiUtility.java | ChaiUtility.createGroup | public static ChaiGroup createGroup( final String parentDN, final String name, final ChaiProvider provider )
throws ChaiOperationException, ChaiUnavailableException
{
//Get a good CN for it
final String objectCN = findUniqueName( name, parentDN, provider );
//Concantonate the entryDN
final StringBuilder entryDN = new StringBuilder();
entryDN.append( "cn=" );
entryDN.append( objectCN );
entryDN.append( ',' );
entryDN.append( parentDN );
//First create the base group.
provider.createEntry( entryDN.toString(), ChaiConstant.OBJECTCLASS_BASE_LDAP_GROUP, Collections.emptyMap() );
//Now build an ldapentry object to add attributes to it
final ChaiEntry theObject = provider.getEntryFactory().newChaiEntry( entryDN.toString() );
//Add the description
theObject.writeStringAttribute( ChaiConstant.ATTR_LDAP_DESCRIPTION, name );
//Return the newly created group.
return provider.getEntryFactory().newChaiGroup( entryDN.toString() );
} | java | public static ChaiGroup createGroup( final String parentDN, final String name, final ChaiProvider provider )
throws ChaiOperationException, ChaiUnavailableException
{
//Get a good CN for it
final String objectCN = findUniqueName( name, parentDN, provider );
//Concantonate the entryDN
final StringBuilder entryDN = new StringBuilder();
entryDN.append( "cn=" );
entryDN.append( objectCN );
entryDN.append( ',' );
entryDN.append( parentDN );
//First create the base group.
provider.createEntry( entryDN.toString(), ChaiConstant.OBJECTCLASS_BASE_LDAP_GROUP, Collections.emptyMap() );
//Now build an ldapentry object to add attributes to it
final ChaiEntry theObject = provider.getEntryFactory().newChaiEntry( entryDN.toString() );
//Add the description
theObject.writeStringAttribute( ChaiConstant.ATTR_LDAP_DESCRIPTION, name );
//Return the newly created group.
return provider.getEntryFactory().newChaiGroup( entryDN.toString() );
} | [
"public",
"static",
"ChaiGroup",
"createGroup",
"(",
"final",
"String",
"parentDN",
",",
"final",
"String",
"name",
",",
"final",
"ChaiProvider",
"provider",
")",
"throws",
"ChaiOperationException",
",",
"ChaiUnavailableException",
"{",
"//Get a good CN for it",
"final"... | Creates a new group entry in the ldap directory. A new "groupOfNames" object is created.
The "cn" and "description" ldap attributes are set to the supplied name.
@param parentDN the entryDN of the new group.
@param name name of the group
@param provider a ldap provider be used to create the group.
@return an instance of the ChaiGroup entry
@throws ChaiOperationException If there is an error during the operation
@throws ChaiUnavailableException If the directory server(s) are unavailable | [
"Creates",
"a",
"new",
"group",
"entry",
"in",
"the",
"ldap",
"directory",
".",
"A",
"new",
"groupOfNames",
"object",
"is",
"created",
".",
"The",
"cn",
"and",
"description",
"ldap",
"attributes",
"are",
"set",
"to",
"the",
"supplied",
"name",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/ChaiUtility.java#L68-L92 |
jboss/jboss-el-api_spec | src/main/java/javax/el/ELContext.java | ELContext.enterLambdaScope | public void enterLambdaScope(Map<String,Object> args) {
if (lambdaArgs == null) {
lambdaArgs = new Stack<Map<String,Object>>();
}
lambdaArgs.push(args);
} | java | public void enterLambdaScope(Map<String,Object> args) {
if (lambdaArgs == null) {
lambdaArgs = new Stack<Map<String,Object>>();
}
lambdaArgs.push(args);
} | [
"public",
"void",
"enterLambdaScope",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
")",
"{",
"if",
"(",
"lambdaArgs",
"==",
"null",
")",
"{",
"lambdaArgs",
"=",
"new",
"Stack",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"(",
")",
... | Installs a Lambda argument map, in preparation for the evaluation
of a Lambda expression. The arguments in the map will be in scope
during the evaluation of the Lambda expression.
@param args The Lambda arguments map
@since EL 3.0 | [
"Installs",
"a",
"Lambda",
"argument",
"map",
"in",
"preparation",
"for",
"the",
"evaluation",
"of",
"a",
"Lambda",
"expression",
".",
"The",
"arguments",
"in",
"the",
"map",
"will",
"be",
"in",
"scope",
"during",
"the",
"evaluation",
"of",
"the",
"Lambda",
... | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELContext.java#L422-L427 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addIdInCollectionCondition | protected void addIdInCollectionCondition(final String propertyName, final Collection<?> values) {
addIdInCollectionCondition(getRootPath().get(propertyName), values);
} | java | protected void addIdInCollectionCondition(final String propertyName, final Collection<?> values) {
addIdInCollectionCondition(getRootPath().get(propertyName), values);
} | [
"protected",
"void",
"addIdInCollectionCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"addIdInCollectionCondition",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
",",
"valu... | Add a Field Search Condition that will check if the id field exists in an array of values. eg. {@code field IN (values)}
@param propertyName The name of the field id as defined in the Entity mapping class.
@param values The List of Ids to be compared to. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"id",
"field",
"exists",
"in",
"an",
"array",
"of",
"values",
".",
"eg",
".",
"{",
"@code",
"field",
"IN",
"(",
"values",
")",
"}"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L292-L294 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java | ReflectionUtils.doWithLocalMethods | public static void doWithLocalMethods(Class<?> clazz, MethodCallback mc) {
Method[] methods = getDeclaredMethods(clazz);
for (Method method : methods) {
try {
mc.doWith(method);
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Not allowed to access method '" + method.getName() + "': " + ex);
}
}
} | java | public static void doWithLocalMethods(Class<?> clazz, MethodCallback mc) {
Method[] methods = getDeclaredMethods(clazz);
for (Method method : methods) {
try {
mc.doWith(method);
}
catch (IllegalAccessException ex) {
throw new IllegalStateException("Not allowed to access method '" + method.getName() + "': " + ex);
}
}
} | [
"public",
"static",
"void",
"doWithLocalMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"MethodCallback",
"mc",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"getDeclaredMethods",
"(",
"clazz",
")",
";",
"for",
"(",
"Method",
"method",
":",
"methods",... | Perform the given callback operation on all matching methods of the given
class, as locally declared or equivalent thereof (such as default methods
on Java 8 based interfaces that the given class implements).
@param clazz the class to introspect
@param mc the callback to invoke for each method
@since 4.2
@see #doWithMethods | [
"Perform",
"the",
"given",
"callback",
"operation",
"on",
"all",
"matching",
"methods",
"of",
"the",
"given",
"class",
"as",
"locally",
"declared",
"or",
"equivalent",
"thereof",
"(",
"such",
"as",
"default",
"methods",
"on",
"Java",
"8",
"based",
"interfaces"... | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java#L489-L499 |
alkacon/opencms-core | src/org/opencms/util/CmsRequestUtil.java | CmsRequestUtil.getNotEmptyParameter | public static String getNotEmptyParameter(HttpServletRequest request, String paramName) {
String result = request.getParameter(paramName);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) {
result = null;
}
return result;
} | java | public static String getNotEmptyParameter(HttpServletRequest request, String paramName) {
String result = request.getParameter(paramName);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(result)) {
result = null;
}
return result;
} | [
"public",
"static",
"String",
"getNotEmptyParameter",
"(",
"HttpServletRequest",
"request",
",",
"String",
"paramName",
")",
"{",
"String",
"result",
"=",
"request",
".",
"getParameter",
"(",
"paramName",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isEmptyOrWhites... | Reads value from the request parameters,
will return <code>null</code> if the value is not available or only white space.<p>
@param request the request to read the parameter from
@param paramName the parameter name to read
@return the request parameter value for the given parameter | [
"Reads",
"value",
"from",
"the",
"request",
"parameters",
"will",
"return",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"the",
"value",
"is",
"not",
"available",
"or",
"only",
"white",
"space",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L626-L633 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel.java | sslpolicylabel.get | public static sslpolicylabel get(nitro_service service, String labelname) throws Exception{
sslpolicylabel obj = new sslpolicylabel();
obj.set_labelname(labelname);
sslpolicylabel response = (sslpolicylabel) obj.get_resource(service);
return response;
} | java | public static sslpolicylabel get(nitro_service service, String labelname) throws Exception{
sslpolicylabel obj = new sslpolicylabel();
obj.set_labelname(labelname);
sslpolicylabel response = (sslpolicylabel) obj.get_resource(service);
return response;
} | [
"public",
"static",
"sslpolicylabel",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"sslpolicylabel",
"obj",
"=",
"new",
"sslpolicylabel",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
... | Use this API to fetch sslpolicylabel resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslpolicylabel",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel.java#L314-L319 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setSecretAsync | public Observable<SecretBundle> setSecretAsync(String vaultBaseUrl, String secretName, String value) {
return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() {
@Override
public SecretBundle call(ServiceResponse<SecretBundle> response) {
return response.body();
}
});
} | java | public Observable<SecretBundle> setSecretAsync(String vaultBaseUrl, String secretName, String value) {
return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() {
@Override
public SecretBundle call(ServiceResponse<SecretBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SecretBundle",
">",
"setSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"String",
"value",
")",
"{",
"return",
"setSecretWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"secretName",
",",
"value",
")"... | Sets a secret in a specified key vault.
The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@param value The value of the secret.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SecretBundle object | [
"Sets",
"a",
"secret",
"in",
"a",
"specified",
"key",
"vault",
".",
"The",
"SET",
"operation",
"adds",
"a",
"secret",
"to",
"the",
"Azure",
"Key",
"Vault",
".",
"If",
"the",
"named",
"secret",
"already",
"exists",
"Azure",
"Key",
"Vault",
"creates",
"a",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3351-L3358 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.updateWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updateWithServiceResponseAsync(UUID appId, String versionId, UpdateVersionsOptionalParameter updateOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String version = updateOptionalParameter != null ? updateOptionalParameter.version() : null;
return updateWithServiceResponseAsync(appId, versionId, version);
} | java | public Observable<ServiceResponse<OperationStatus>> updateWithServiceResponseAsync(UUID appId, String versionId, UpdateVersionsOptionalParameter updateOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String version = updateOptionalParameter != null ? updateOptionalParameter.version() : null;
return updateWithServiceResponseAsync(appId, versionId, version);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updateWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UpdateVersionsOptionalParameter",
"updateOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"... | Updates the name or description of the application version.
@param appId The application ID.
@param versionId The version ID.
@param updateOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"the",
"name",
"or",
"description",
"of",
"the",
"application",
"version",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L580-L593 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.toPackageFolder | protected static File toPackageFolder(String packageName) {
File file = null;
for (final String element : packageName.split("[.]")) { //$NON-NLS-1$
if (file == null) {
file = new File(element);
} else {
file = new File(file, element);
}
}
return file;
} | java | protected static File toPackageFolder(String packageName) {
File file = null;
for (final String element : packageName.split("[.]")) { //$NON-NLS-1$
if (file == null) {
file = new File(element);
} else {
file = new File(file, element);
}
}
return file;
} | [
"protected",
"static",
"File",
"toPackageFolder",
"(",
"String",
"packageName",
")",
"{",
"File",
"file",
"=",
"null",
";",
"for",
"(",
"final",
"String",
"element",
":",
"packageName",
".",
"split",
"(",
"\"[.]\"",
")",
")",
"{",
"//$NON-NLS-1$",
"if",
"(... | Convert a a package name for therelative file.
@param packageName the name.
@return the file. | [
"Convert",
"a",
"a",
"package",
"name",
"for",
"therelative",
"file",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L519-L529 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java | FSDataset.registerMBean | void registerMBean(final String storageId) {
// We wrap to bypass standard mbean naming convetion.
// This wraping can be removed in java 6 as it is more flexible in
// package naming for mbeans and their impl.
StandardMBean bean;
String storageName;
if (storageId == null || storageId.equals("")) {// Temp fix for the uninitialized storage
storageName = "UndefinedStorageId" + rand.nextInt();
} else {
storageName = storageId;
}
try {
bean = new StandardMBean(this,FSDatasetMBean.class);
mbeanName = MBeanUtil.registerMBean("DataNode", "FSDatasetState-" + storageName, bean);
versionBeanName = VersionInfo.registerJMX("DataNode");
} catch (NotCompliantMBeanException e) {
e.printStackTrace();
}
DataNode.LOG.info("Registered FSDatasetStatusMBean");
} | java | void registerMBean(final String storageId) {
// We wrap to bypass standard mbean naming convetion.
// This wraping can be removed in java 6 as it is more flexible in
// package naming for mbeans and their impl.
StandardMBean bean;
String storageName;
if (storageId == null || storageId.equals("")) {// Temp fix for the uninitialized storage
storageName = "UndefinedStorageId" + rand.nextInt();
} else {
storageName = storageId;
}
try {
bean = new StandardMBean(this,FSDatasetMBean.class);
mbeanName = MBeanUtil.registerMBean("DataNode", "FSDatasetState-" + storageName, bean);
versionBeanName = VersionInfo.registerJMX("DataNode");
} catch (NotCompliantMBeanException e) {
e.printStackTrace();
}
DataNode.LOG.info("Registered FSDatasetStatusMBean");
} | [
"void",
"registerMBean",
"(",
"final",
"String",
"storageId",
")",
"{",
"// We wrap to bypass standard mbean naming convetion.",
"// This wraping can be removed in java 6 as it is more flexible in",
"// package naming for mbeans and their impl.",
"StandardMBean",
"bean",
";",
"String",
... | Register the FSDataset MBean using the name
"hadoop:service=DataNode,name=FSDatasetState-<storageid>" | [
"Register",
"the",
"FSDataset",
"MBean",
"using",
"the",
"name",
"hadoop",
":",
"service",
"=",
"DataNode",
"name",
"=",
"FSDatasetState",
"-",
"<storageid",
">"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2943-L2963 |
rey5137/material | material/src/main/java/com/rey/material/app/ThemeManager.java | ThemeManager.getStyle | public int getStyle(int styleId, int theme){
int[] styles = getStyleList(styleId);
return styles == null ? 0 : styles[theme];
} | java | public int getStyle(int styleId, int theme){
int[] styles = getStyleList(styleId);
return styles == null ? 0 : styles[theme];
} | [
"public",
"int",
"getStyle",
"(",
"int",
"styleId",
",",
"int",
"theme",
")",
"{",
"int",
"[",
"]",
"styles",
"=",
"getStyleList",
"(",
"styleId",
")",
";",
"return",
"styles",
"==",
"null",
"?",
"0",
":",
"styles",
"[",
"theme",
"]",
";",
"}"
] | Get a specific style of a styleId.
@param styleId The styleId.
@param theme The theme.
@return The specific style. | [
"Get",
"a",
"specific",
"style",
"of",
"a",
"styleId",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/ThemeManager.java#L184-L187 |
aws/aws-sdk-java | aws-java-sdk-resourcegroupstaggingapi/src/main/java/com/amazonaws/services/resourcegroupstaggingapi/model/UntagResourcesResult.java | UntagResourcesResult.withFailedResourcesMap | public UntagResourcesResult withFailedResourcesMap(java.util.Map<String, FailureInfo> failedResourcesMap) {
setFailedResourcesMap(failedResourcesMap);
return this;
} | java | public UntagResourcesResult withFailedResourcesMap(java.util.Map<String, FailureInfo> failedResourcesMap) {
setFailedResourcesMap(failedResourcesMap);
return this;
} | [
"public",
"UntagResourcesResult",
"withFailedResourcesMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"FailureInfo",
">",
"failedResourcesMap",
")",
"{",
"setFailedResourcesMap",
"(",
"failedResourcesMap",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Details of resources that could not be untagged. An error code, status code, and error message are returned for
each failed item.
</p>
@param failedResourcesMap
Details of resources that could not be untagged. An error code, status code, and error message are
returned for each failed item.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Details",
"of",
"resources",
"that",
"could",
"not",
"be",
"untagged",
".",
"An",
"error",
"code",
"status",
"code",
"and",
"error",
"message",
"are",
"returned",
"for",
"each",
"failed",
"item",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroupstaggingapi/src/main/java/com/amazonaws/services/resourcegroupstaggingapi/model/UntagResourcesResult.java#L75-L78 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/ringsearch/AllRingsFinder.java | AllRingsFinder.findAllRingsInIsolatedRingSystem | public IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer, int maxRingSize) throws CDKException {
final EdgeToBondMap edges = EdgeToBondMap.withSpaceFor(atomContainer);
final int[][] graph = GraphUtil.toAdjList(atomContainer, edges);
AllCycles ac = new AllCycles(graph, maxRingSize, threshold.value);
if (!ac.completed()) throw new CDKException("Threshold exceeded for AllRingsFinder");
IRingSet ringSet = atomContainer.getBuilder().newInstance(IRingSet.class);
for (int[] path : ac.paths()) {
ringSet.addAtomContainer(toRing(atomContainer, edges, path));
}
return ringSet;
} | java | public IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer, int maxRingSize) throws CDKException {
final EdgeToBondMap edges = EdgeToBondMap.withSpaceFor(atomContainer);
final int[][] graph = GraphUtil.toAdjList(atomContainer, edges);
AllCycles ac = new AllCycles(graph, maxRingSize, threshold.value);
if (!ac.completed()) throw new CDKException("Threshold exceeded for AllRingsFinder");
IRingSet ringSet = atomContainer.getBuilder().newInstance(IRingSet.class);
for (int[] path : ac.paths()) {
ringSet.addAtomContainer(toRing(atomContainer, edges, path));
}
return ringSet;
} | [
"public",
"IRingSet",
"findAllRingsInIsolatedRingSystem",
"(",
"IAtomContainer",
"atomContainer",
",",
"int",
"maxRingSize",
")",
"throws",
"CDKException",
"{",
"final",
"EdgeToBondMap",
"edges",
"=",
"EdgeToBondMap",
".",
"withSpaceFor",
"(",
"atomContainer",
")",
";",... | Compute all rings up to an including the {@literal maxRingSize}. No
pre-processing is done on the container.
@param atomContainer the molecule to be searched for rings
@param maxRingSize Maximum ring size to consider. Provides a possible
breakout from recursion for complex compounds.
@return a RingSet containing the rings in molecule
@throws CDKException An exception thrown if the threshold was exceeded | [
"Compute",
"all",
"rings",
"up",
"to",
"an",
"including",
"the",
"{",
"@literal",
"maxRingSize",
"}",
".",
"No",
"pre",
"-",
"processing",
"is",
"done",
"on",
"the",
"container",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/ringsearch/AllRingsFinder.java#L183-L199 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsResourceIcon.java | CmsResourceIcon.getSmallTypeIconHTML | private static String getSmallTypeIconHTML(String type, boolean isPageOverlay) {
CmsExplorerTypeSettings typeSettings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type);
if ((typeSettings == null) && LOG.isWarnEnabled()) {
LOG.warn("Could not read explorer type settings for " + type);
}
String result = null;
String overlayClass = isPageOverlay ? "o-page-icon-overlay" : "o-icon-overlay";
if (typeSettings != null) {
if (typeSettings.getSmallIconStyle() != null) {
result = "<span class=\"v-icon "
+ overlayClass
+ " "
+ typeSettings.getSmallIconStyle()
+ "\"> </span>";
} else if (typeSettings.getIcon() != null) {
result = "<img src=\""
+ CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + typeSettings.getIcon())
+ "\" class=\""
+ overlayClass
+ "\" />";
} else {
result = "<span class=\"v-icon "
+ overlayClass
+ " "
+ CmsExplorerTypeSettings.ICON_STYLE_DEFAULT_SMALL
+ "\"> </span>";
}
}
return result;
} | java | private static String getSmallTypeIconHTML(String type, boolean isPageOverlay) {
CmsExplorerTypeSettings typeSettings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(type);
if ((typeSettings == null) && LOG.isWarnEnabled()) {
LOG.warn("Could not read explorer type settings for " + type);
}
String result = null;
String overlayClass = isPageOverlay ? "o-page-icon-overlay" : "o-icon-overlay";
if (typeSettings != null) {
if (typeSettings.getSmallIconStyle() != null) {
result = "<span class=\"v-icon "
+ overlayClass
+ " "
+ typeSettings.getSmallIconStyle()
+ "\"> </span>";
} else if (typeSettings.getIcon() != null) {
result = "<img src=\""
+ CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + typeSettings.getIcon())
+ "\" class=\""
+ overlayClass
+ "\" />";
} else {
result = "<span class=\"v-icon "
+ overlayClass
+ " "
+ CmsExplorerTypeSettings.ICON_STYLE_DEFAULT_SMALL
+ "\"> </span>";
}
}
return result;
} | [
"private",
"static",
"String",
"getSmallTypeIconHTML",
"(",
"String",
"type",
",",
"boolean",
"isPageOverlay",
")",
"{",
"CmsExplorerTypeSettings",
"typeSettings",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getExplorerTypeSetting",
"(",
"type",
")",
... | Returns the URI of the small resource type icon for the given type.<p>
@param type the resource type name
@param isPageOverlay <code>true</code> in case this is a page overlay and not a folder overlay
@return the icon URI | [
"Returns",
"the",
"URI",
"of",
"the",
"small",
"resource",
"type",
"icon",
"for",
"the",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsResourceIcon.java#L443-L473 |
xiaolongzuo/niubi-job | niubi-job-framework/niubi-job-scheduler/src/main/java/com/zuoxiaolong/niubi/job/scheduler/JobEnvironmentCache.java | JobEnvironmentCache.findScheduleJobDescriptor | public ScheduleJobDescriptor findScheduleJobDescriptor(String jarFilePath, String group, String name) {
List<JobDescriptor> jobDescriptorList = jobDescriptorListMap.get(jarFilePath);
if (jobDescriptorList == null) {
throw new NiubiException(new IllegalStateException("job descriptor list can't be null."));
}
for (JobDescriptor jobDescriptorInner : jobDescriptorList) {
if (jobDescriptorInner.group().equals(group) && jobDescriptorInner.name().equals(name)) {
return new DefaultScheduleJobDescriptor(jobDescriptorInner);
}
}
throw new NiubiException(new RuntimeException("can't find SchedulerJobDescriptor for [" + group + "." + name + "]"));
} | java | public ScheduleJobDescriptor findScheduleJobDescriptor(String jarFilePath, String group, String name) {
List<JobDescriptor> jobDescriptorList = jobDescriptorListMap.get(jarFilePath);
if (jobDescriptorList == null) {
throw new NiubiException(new IllegalStateException("job descriptor list can't be null."));
}
for (JobDescriptor jobDescriptorInner : jobDescriptorList) {
if (jobDescriptorInner.group().equals(group) && jobDescriptorInner.name().equals(name)) {
return new DefaultScheduleJobDescriptor(jobDescriptorInner);
}
}
throw new NiubiException(new RuntimeException("can't find SchedulerJobDescriptor for [" + group + "." + name + "]"));
} | [
"public",
"ScheduleJobDescriptor",
"findScheduleJobDescriptor",
"(",
"String",
"jarFilePath",
",",
"String",
"group",
",",
"String",
"name",
")",
"{",
"List",
"<",
"JobDescriptor",
">",
"jobDescriptorList",
"=",
"jobDescriptorListMap",
".",
"get",
"(",
"jarFilePath",
... | 查找可调度的任务描述符
@param jarFilePath jar包路径
@param group 组名
@param name 名称
@return 若找到则返回一个ScheduleJobDescriptor实例,否则抛出异常 | [
"查找可调度的任务描述符"
] | train | https://github.com/xiaolongzuo/niubi-job/blob/ed21d5b80f8b16c8b3a0b2fbc688442b878edbe4/niubi-job-framework/niubi-job-scheduler/src/main/java/com/zuoxiaolong/niubi/job/scheduler/JobEnvironmentCache.java#L85-L96 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java | ElementBase.notifyChildren | public void notifyChildren(String eventName, Object eventData, boolean recurse) {
notifyChildren(this, eventName, eventData, recurse);
} | java | public void notifyChildren(String eventName, Object eventData, boolean recurse) {
notifyChildren(this, eventName, eventData, recurse);
} | [
"public",
"void",
"notifyChildren",
"(",
"String",
"eventName",
",",
"Object",
"eventData",
",",
"boolean",
"recurse",
")",
"{",
"notifyChildren",
"(",
"this",
",",
"eventName",
",",
"eventData",
",",
"recurse",
")",
";",
"}"
] | Allows a parent element to notify its children of an event of interest.
@param eventName Name of the event.
@param eventData Data associated with the event.
@param recurse If true, recurse over all child levels. | [
"Allows",
"a",
"parent",
"element",
"to",
"notify",
"its",
"children",
"of",
"an",
"event",
"of",
"interest",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L1012-L1014 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.handleComputeMonthStart | protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
// If the month is out of range, adjust it into range, and
// modify the extended year value accordingly.
if (month < 0 || month > 11) {
int[] rem = new int[1];
eyear += floorDivide(month, 12, rem);
month = rem[0];
}
int gyear = eyear + epochYear - 1; // Gregorian year
int newYear = newYear(gyear);
int newMoon = newMoonNear(newYear + month * 29, true);
int julianDay = newMoon + EPOCH_JULIAN_DAY;
// Save fields for later restoration
int saveMonth = internalGet(MONTH);
int saveIsLeapMonth = internalGet(IS_LEAP_MONTH);
// Ignore IS_LEAP_MONTH field if useMonth is false
int isLeapMonth = useMonth ? saveIsLeapMonth : 0;
computeGregorianFields(julianDay);
// This will modify the MONTH and IS_LEAP_MONTH fields (only)
computeChineseFields(newMoon, getGregorianYear(),
getGregorianMonth(), false);
if (month != internalGet(MONTH) ||
isLeapMonth != internalGet(IS_LEAP_MONTH)) {
newMoon = newMoonNear(newMoon + SYNODIC_GAP, true);
julianDay = newMoon + EPOCH_JULIAN_DAY;
}
internalSet(MONTH, saveMonth);
internalSet(IS_LEAP_MONTH, saveIsLeapMonth);
return julianDay - 1;
} | java | protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
// If the month is out of range, adjust it into range, and
// modify the extended year value accordingly.
if (month < 0 || month > 11) {
int[] rem = new int[1];
eyear += floorDivide(month, 12, rem);
month = rem[0];
}
int gyear = eyear + epochYear - 1; // Gregorian year
int newYear = newYear(gyear);
int newMoon = newMoonNear(newYear + month * 29, true);
int julianDay = newMoon + EPOCH_JULIAN_DAY;
// Save fields for later restoration
int saveMonth = internalGet(MONTH);
int saveIsLeapMonth = internalGet(IS_LEAP_MONTH);
// Ignore IS_LEAP_MONTH field if useMonth is false
int isLeapMonth = useMonth ? saveIsLeapMonth : 0;
computeGregorianFields(julianDay);
// This will modify the MONTH and IS_LEAP_MONTH fields (only)
computeChineseFields(newMoon, getGregorianYear(),
getGregorianMonth(), false);
if (month != internalGet(MONTH) ||
isLeapMonth != internalGet(IS_LEAP_MONTH)) {
newMoon = newMoonNear(newMoon + SYNODIC_GAP, true);
julianDay = newMoon + EPOCH_JULIAN_DAY;
}
internalSet(MONTH, saveMonth);
internalSet(IS_LEAP_MONTH, saveIsLeapMonth);
return julianDay - 1;
} | [
"protected",
"int",
"handleComputeMonthStart",
"(",
"int",
"eyear",
",",
"int",
"month",
",",
"boolean",
"useMonth",
")",
"{",
"// If the month is out of range, adjust it into range, and",
"// modify the extended year value accordingly.",
"if",
"(",
"month",
"<",
"0",
"||",... | Return the Julian day number of day before the first day of the
given month in the given extended year.
<p>Note: This method reads the IS_LEAP_MONTH field to determine
whether the given month is a leap month.
@param eyear the extended year
@param month the zero-based month. The month is also determined
by reading the IS_LEAP_MONTH field.
@return the Julian day number of the day before the first
day of the given month and year | [
"Return",
"the",
"Julian",
"day",
"number",
"of",
"day",
"before",
"the",
"first",
"day",
"of",
"the",
"given",
"month",
"in",
"the",
"given",
"extended",
"year",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L954-L993 |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.trimRight | public UTF8String trimRight(UTF8String trimString) {
if (trimString == null) return null;
int charIdx = 0;
// number of characters from the source string
int numChars = 0;
// array of character length for the source string
int[] stringCharLen = new int[numBytes];
// array of the first byte position for each character in the source string
int[] stringCharPos = new int[numBytes];
// build the position and length array
while (charIdx < numBytes) {
stringCharPos[numChars] = charIdx;
stringCharLen[numChars] = numBytesForFirstByte(getByte(charIdx));
charIdx += stringCharLen[numChars];
numChars ++;
}
// index trimEnd points to the first no matching byte position from the right side of
// the source string.
int trimEnd = numBytes - 1;
while (numChars > 0) {
UTF8String searchChar = copyUTF8String(
stringCharPos[numChars - 1],
stringCharPos[numChars - 1] + stringCharLen[numChars - 1] - 1);
if (trimString.find(searchChar, 0) >= 0) {
trimEnd -= stringCharLen[numChars - 1];
} else {
break;
}
numChars --;
}
if (trimEnd < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(0, trimEnd);
}
} | java | public UTF8String trimRight(UTF8String trimString) {
if (trimString == null) return null;
int charIdx = 0;
// number of characters from the source string
int numChars = 0;
// array of character length for the source string
int[] stringCharLen = new int[numBytes];
// array of the first byte position for each character in the source string
int[] stringCharPos = new int[numBytes];
// build the position and length array
while (charIdx < numBytes) {
stringCharPos[numChars] = charIdx;
stringCharLen[numChars] = numBytesForFirstByte(getByte(charIdx));
charIdx += stringCharLen[numChars];
numChars ++;
}
// index trimEnd points to the first no matching byte position from the right side of
// the source string.
int trimEnd = numBytes - 1;
while (numChars > 0) {
UTF8String searchChar = copyUTF8String(
stringCharPos[numChars - 1],
stringCharPos[numChars - 1] + stringCharLen[numChars - 1] - 1);
if (trimString.find(searchChar, 0) >= 0) {
trimEnd -= stringCharLen[numChars - 1];
} else {
break;
}
numChars --;
}
if (trimEnd < 0) {
// empty string
return EMPTY_UTF8;
} else {
return copyUTF8String(0, trimEnd);
}
} | [
"public",
"UTF8String",
"trimRight",
"(",
"UTF8String",
"trimString",
")",
"{",
"if",
"(",
"trimString",
"==",
"null",
")",
"return",
"null",
";",
"int",
"charIdx",
"=",
"0",
";",
"// number of characters from the source string",
"int",
"numChars",
"=",
"0",
";"... | Based on the given trim string, trim this string starting from right end
This method searches each character in the source string starting from the right end,
removes the character if it is in the trim string, stops at the first character which is not
in the trim string, returns the new string.
@param trimString the trim character string | [
"Based",
"on",
"the",
"given",
"trim",
"string",
"trim",
"this",
"string",
"starting",
"from",
"right",
"end",
"This",
"method",
"searches",
"each",
"character",
"in",
"the",
"source",
"string",
"starting",
"from",
"the",
"right",
"end",
"removes",
"the",
"c... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L629-L667 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java | Decimal.fromBigDecimal | public static Decimal fromBigDecimal(BigDecimal bd, int precision, int scale) {
bd = bd.setScale(scale, RoundingMode.HALF_UP);
if (bd.precision() > precision) {
return null;
}
long longVal = -1;
if (precision <= MAX_COMPACT_PRECISION) {
longVal = bd.movePointRight(scale).longValueExact();
}
return new Decimal(precision, scale, longVal, bd);
} | java | public static Decimal fromBigDecimal(BigDecimal bd, int precision, int scale) {
bd = bd.setScale(scale, RoundingMode.HALF_UP);
if (bd.precision() > precision) {
return null;
}
long longVal = -1;
if (precision <= MAX_COMPACT_PRECISION) {
longVal = bd.movePointRight(scale).longValueExact();
}
return new Decimal(precision, scale, longVal, bd);
} | [
"public",
"static",
"Decimal",
"fromBigDecimal",
"(",
"BigDecimal",
"bd",
",",
"int",
"precision",
",",
"int",
"scale",
")",
"{",
"bd",
"=",
"bd",
".",
"setScale",
"(",
"scale",
",",
"RoundingMode",
".",
"HALF_UP",
")",
";",
"if",
"(",
"bd",
".",
"prec... | then `precision` is checked. if precision overflow, it will return `null` | [
"then",
"precision",
"is",
"checked",
".",
"if",
"precision",
"overflow",
"it",
"will",
"return",
"null"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/Decimal.java#L158-L169 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/spatialite/ImportExportUtils.java | ImportExportUtils.executeShapefileImportQueries | public static void executeShapefileImportQueries( final ASpatialDb db, String tableName, String shpPath, String encoding,
int srid, ESpatialiteGeometryType geometryType ) throws Exception {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMddHHmmss");
if (encoding == null || encoding.trim().length() == 0) {
encoding = "UTF-8";
}
String geomType = geometryType.getDescription();
if (geomType.contains("_")) {
geomType = geomType.split("_")[0];
}
if (shpPath.endsWith(".shp")) {
shpPath = shpPath.substring(0, shpPath.length() - 4);
}
String tmptable = "virtualTmp" + dateFormatter.format(new Date()) + tableName;
final String sql1 = "CREATE VIRTUAL TABLE " + tmptable + " using virtualshape('" + shpPath + "','" + encoding + "',"
+ srid + ");";
final String sql2 = "select RegisterVirtualGeometry('" + tmptable + "');";
final String sql3 = "create table " + tableName + " as select * from " + tmptable + ";";
String sql4 = "select recovergeometrycolumn('" + tableName + "','Geometry'," + srid + ",'" + geomType + "');";
final String sql5 = "select CreateSpatialIndex('" + tableName + "','Geometry');";
final String sql6 = "drop table '" + tmptable + "';";
final String sql7 = "select updateLayerStatistics('" + tableName + "');";
db.executeInsertUpdateDeleteSql(sql1);
db.executeInsertUpdateDeleteSql(sql2);
db.executeInsertUpdateDeleteSql(sql3);
int executeInsertUpdateDeleteSql = db.executeInsertUpdateDeleteSql(sql4);
if (executeInsertUpdateDeleteSql == 0) {
// try also the multi toggle, since the virtualtable might have choosen a different one
// than geotools
if (geomType.contains(MULTI)) {
geomType = geomType.replaceFirst(MULTI, "");
} else {
geomType = MULTI + geomType;
}
sql4 = "select recovergeometrycolumn('" + tableName + "','Geometry'," + srid + ",'" + geomType + "');";
db.executeInsertUpdateDeleteSql(sql4);
}
db.executeInsertUpdateDeleteSql(sql5);
db.executeInsertUpdateDeleteSql(sql6);
db.executeInsertUpdateDeleteSql(sql7);
} | java | public static void executeShapefileImportQueries( final ASpatialDb db, String tableName, String shpPath, String encoding,
int srid, ESpatialiteGeometryType geometryType ) throws Exception {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMddHHmmss");
if (encoding == null || encoding.trim().length() == 0) {
encoding = "UTF-8";
}
String geomType = geometryType.getDescription();
if (geomType.contains("_")) {
geomType = geomType.split("_")[0];
}
if (shpPath.endsWith(".shp")) {
shpPath = shpPath.substring(0, shpPath.length() - 4);
}
String tmptable = "virtualTmp" + dateFormatter.format(new Date()) + tableName;
final String sql1 = "CREATE VIRTUAL TABLE " + tmptable + " using virtualshape('" + shpPath + "','" + encoding + "',"
+ srid + ");";
final String sql2 = "select RegisterVirtualGeometry('" + tmptable + "');";
final String sql3 = "create table " + tableName + " as select * from " + tmptable + ";";
String sql4 = "select recovergeometrycolumn('" + tableName + "','Geometry'," + srid + ",'" + geomType + "');";
final String sql5 = "select CreateSpatialIndex('" + tableName + "','Geometry');";
final String sql6 = "drop table '" + tmptable + "';";
final String sql7 = "select updateLayerStatistics('" + tableName + "');";
db.executeInsertUpdateDeleteSql(sql1);
db.executeInsertUpdateDeleteSql(sql2);
db.executeInsertUpdateDeleteSql(sql3);
int executeInsertUpdateDeleteSql = db.executeInsertUpdateDeleteSql(sql4);
if (executeInsertUpdateDeleteSql == 0) {
// try also the multi toggle, since the virtualtable might have choosen a different one
// than geotools
if (geomType.contains(MULTI)) {
geomType = geomType.replaceFirst(MULTI, "");
} else {
geomType = MULTI + geomType;
}
sql4 = "select recovergeometrycolumn('" + tableName + "','Geometry'," + srid + ",'" + geomType + "');";
db.executeInsertUpdateDeleteSql(sql4);
}
db.executeInsertUpdateDeleteSql(sql5);
db.executeInsertUpdateDeleteSql(sql6);
db.executeInsertUpdateDeleteSql(sql7);
} | [
"public",
"static",
"void",
"executeShapefileImportQueries",
"(",
"final",
"ASpatialDb",
"db",
",",
"String",
"tableName",
",",
"String",
"shpPath",
",",
"String",
"encoding",
",",
"int",
"srid",
",",
"ESpatialiteGeometryType",
"geometryType",
")",
"throws",
"Except... | Import a shapefile into the database using a temporary virtual table.
@param db the database.
@param tableName the name for the new table.
@param shpPath the shp to import.
@param encoding the encoding. If <code>null</code>, UTF-8 is used.
@param srid the epsg code for the file.
@param geometryType the geometry type of the file.
@throws Exception | [
"Import",
"a",
"shapefile",
"into",
"the",
"database",
"using",
"a",
"temporary",
"virtual",
"table",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/ImportExportUtils.java#L45-L90 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForPrimitive | @SuppressWarnings("static-method")
protected void getLinkForPrimitive(Content link, LinkInfo linkInfo, Type type) {
link.addContent(type.typeName());
} | java | @SuppressWarnings("static-method")
protected void getLinkForPrimitive(Content link, LinkInfo linkInfo, Type type) {
link.addContent(type.typeName());
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"void",
"getLinkForPrimitive",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"type",
".",
"typeName",
"(",
")",
")",
";... | Build the link for the primitive.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"primitive",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L64-L67 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withCloseable | public static <T, U extends AutoCloseable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws Exception {
Throwable thrown = null;
try {
return action.call(self);
} catch (Throwable e) {
thrown = e;
throw e;
} finally {
if (thrown != null) {
Throwable suppressed = tryClose(self, true);
if (suppressed != null) {
thrown.addSuppressed(suppressed);
}
} else {
self.close();
}
}
} | java | public static <T, U extends AutoCloseable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws Exception {
Throwable thrown = null;
try {
return action.call(self);
} catch (Throwable e) {
thrown = e;
throw e;
} finally {
if (thrown != null) {
Throwable suppressed = tryClose(self, true);
if (suppressed != null) {
thrown.addSuppressed(suppressed);
}
} else {
self.close();
}
}
} | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"AutoCloseable",
">",
"T",
"withCloseable",
"(",
"U",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"action",
")",
"throws",
"Exception"... | Allows this AutoCloseable to be used within the closure, ensuring that it
is closed once the closure has been executed and before this method returns.
<p>
As with the try-with-resources statement, if multiple exceptions are thrown
the exception from the closure will be returned and the exception from closing
will be added as a suppressed exception.
@param self the AutoCloseable
@param action the closure taking the AutoCloseable as parameter
@return the value returned by the closure
@throws Exception if an Exception occurs.
@since 2.5.0 | [
"Allows",
"this",
"AutoCloseable",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"closed",
"once",
"the",
"closure",
"has",
"been",
"executed",
"and",
"before",
"this",
"method",
"returns",
".",
"<p",
">",
"As",
"with",
"t... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1638-L1655 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.hexDump | public static String hexDump(ByteBuf buffer) {
return hexDump(buffer, buffer.readerIndex(), buffer.readableBytes());
} | java | public static String hexDump(ByteBuf buffer) {
return hexDump(buffer, buffer.readerIndex(), buffer.readableBytes());
} | [
"public",
"static",
"String",
"hexDump",
"(",
"ByteBuf",
"buffer",
")",
"{",
"return",
"hexDump",
"(",
"buffer",
",",
"buffer",
".",
"readerIndex",
"(",
")",
",",
"buffer",
".",
"readableBytes",
"(",
")",
")",
";",
"}"
] | Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
of the specified buffer's readable bytes. | [
"Returns",
"a",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Hex_dump",
">",
"hex",
"dump<",
"/",
"a",
">",
"of",
"the",
"specified",
"buffer",
"s",
"readable",
"bytes",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L113-L115 |
teatrove/teatrove | teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java | DateContext.changeDate | public Date changeDate(Date date, int delta) {
return adjustDate(date, Calendar.DATE, delta);
} | java | public Date changeDate(Date date, int delta) {
return adjustDate(date, Calendar.DATE, delta);
} | [
"public",
"Date",
"changeDate",
"(",
"Date",
"date",
",",
"int",
"delta",
")",
"{",
"return",
"adjustDate",
"(",
"date",
",",
"Calendar",
".",
"DATE",
",",
"delta",
")",
";",
"}"
] | Roll a date forward or back a given number of days. Only the days are
modified in the associated date. If the delta is positive, then the date
is rolled forward the given number of days. If the delta is negative,
then the date is rolled backward the given number of days.
@param date The initial date from which to start.
@param delta The positive or negative integer value of days to move
@return The new {@link Date} instance reflecting the specified change | [
"Roll",
"a",
"date",
"forward",
"or",
"back",
"a",
"given",
"number",
"of",
"days",
".",
"Only",
"the",
"days",
"are",
"modified",
"in",
"the",
"associated",
"date",
".",
"If",
"the",
"delta",
"is",
"positive",
"then",
"the",
"date",
"is",
"rolled",
"f... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java#L411-L413 |
jroyalty/jglm | src/main/java/com/hackoeur/jglm/support/FastMathCalc.java | FastMathCalc.splitMult | private static void splitMult(double a[], double b[], double ans[]) {
ans[0] = a[0] * b[0];
ans[1] = a[0] * b[1] + a[1] * b[0] + a[1] * b[1];
/* Resplit */
resplit(ans);
} | java | private static void splitMult(double a[], double b[], double ans[]) {
ans[0] = a[0] * b[0];
ans[1] = a[0] * b[1] + a[1] * b[0] + a[1] * b[1];
/* Resplit */
resplit(ans);
} | [
"private",
"static",
"void",
"splitMult",
"(",
"double",
"a",
"[",
"]",
",",
"double",
"b",
"[",
"]",
",",
"double",
"ans",
"[",
"]",
")",
"{",
"ans",
"[",
"0",
"]",
"=",
"a",
"[",
"0",
"]",
"*",
"b",
"[",
"0",
"]",
";",
"ans",
"[",
"1",
... | Multiply two numbers in split form.
@param a first term of multiplication
@param b second term of multiplication
@param ans placeholder where to put the result | [
"Multiply",
"two",
"numbers",
"in",
"split",
"form",
"."
] | train | https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L363-L369 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getImploded | @Nonnull
public static <ELEMENTTYPE> String getImploded (@Nullable final ELEMENTTYPE [] aElements,
@Nonnegative final int nOfs,
@Nonnegative final int nLen)
{
return getImplodedMapped (aElements, nOfs, nLen, String::valueOf);
} | java | @Nonnull
public static <ELEMENTTYPE> String getImploded (@Nullable final ELEMENTTYPE [] aElements,
@Nonnegative final int nOfs,
@Nonnegative final int nLen)
{
return getImplodedMapped (aElements, nOfs, nLen, String::valueOf);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"String",
"getImploded",
"(",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aElements",
",",
"@",
"Nonnegative",
"final",
"int",
"nOfs",
",",
"@",
"Nonnegative",
"final",
"int",
"nLen",
")",
... | Get a concatenated String from all elements of the passed array, without a
separator.
@param aElements
The container to convert. May be <code>null</code> or empty.
@param nOfs
The offset to start from.
@param nLen
The number of elements to implode.
@return The concatenated string.
@param <ELEMENTTYPE>
The type of elements to be imploded. | [
"Get",
"a",
"concatenated",
"String",
"from",
"all",
"elements",
"of",
"the",
"passed",
"array",
"without",
"a",
"separator",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1188-L1194 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listIntents | public List<IntentClassifier> listIntents(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
return listIntentsWithServiceResponseAsync(appId, versionId, listIntentsOptionalParameter).toBlocking().single().body();
} | java | public List<IntentClassifier> listIntents(UUID appId, String versionId, ListIntentsOptionalParameter listIntentsOptionalParameter) {
return listIntentsWithServiceResponseAsync(appId, versionId, listIntentsOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"IntentClassifier",
">",
"listIntents",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListIntentsOptionalParameter",
"listIntentsOptionalParameter",
")",
"{",
"return",
"listIntentsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",... | Gets information about the intent models.
@param appId The application ID.
@param versionId The version ID.
@param listIntentsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<IntentClassifier> object if successful. | [
"Gets",
"information",
"about",
"the",
"intent",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L754-L756 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java | XMLResource.postResource | @POST
@Consumes({
MediaType.TEXT_XML, MediaType.APPLICATION_XML
})
public Response postResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
final JaxRx impl = Systems.getInstance(system);
final String info = impl.add(input, new ResourcePath(resource, headers));
return Response.created(null).entity(info).build();
} | java | @POST
@Consumes({
MediaType.TEXT_XML, MediaType.APPLICATION_XML
})
public Response postResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream input) {
final JaxRx impl = Systems.getInstance(system);
final String info = impl.add(input, new ResourcePath(resource, headers));
return Response.created(null).entity(info).build();
} | [
"@",
"POST",
"@",
"Consumes",
"(",
"{",
"MediaType",
".",
"TEXT_XML",
",",
"MediaType",
".",
"APPLICATION_XML",
"}",
")",
"public",
"Response",
"postResource",
"(",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"SYSTEM",
")",
"final",
"String",
"system",
","... | This method will be called when an HTTP client sends a POST request to an
existing resource to add a resource. Content-Type must be 'text/xml'.
@param system
The implementation system.
@param resource
The resource name.
@param headers
HTTP header attributes.
@param input
The input stream.
@return The {@link Response} which can be empty when no response is
expected. Otherwise it holds the response XML file. | [
"This",
"method",
"will",
"be",
"called",
"when",
"an",
"HTTP",
"client",
"sends",
"a",
"POST",
"request",
"to",
"an",
"existing",
"resource",
"to",
"add",
"a",
"resource",
".",
"Content",
"-",
"Type",
"must",
"be",
"text",
"/",
"xml",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java#L123-L134 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java | PoolOperations.enableAutoScale | public void enableAutoScale(String poolId, String autoScaleFormula, Period autoScaleEvaluationInterval)
throws BatchErrorException, IOException {
enableAutoScale(poolId, autoScaleFormula, autoScaleEvaluationInterval, null);
} | java | public void enableAutoScale(String poolId, String autoScaleFormula, Period autoScaleEvaluationInterval)
throws BatchErrorException, IOException {
enableAutoScale(poolId, autoScaleFormula, autoScaleEvaluationInterval, null);
} | [
"public",
"void",
"enableAutoScale",
"(",
"String",
"poolId",
",",
"String",
"autoScaleFormula",
",",
"Period",
"autoScaleEvaluationInterval",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"enableAutoScale",
"(",
"poolId",
",",
"autoScaleFormula",
",",
... | Enables automatic scaling on the specified pool.
@param poolId
The ID of the pool.
@param autoScaleFormula
The formula for the desired number of compute nodes in the pool.
@param autoScaleEvaluationInterval
The time interval at which to automatically adjust the pool size.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Enables",
"automatic",
"scaling",
"on",
"the",
"specified",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L711-L714 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.of | public static ClassReloadingStrategy of(Instrumentation instrumentation) {
if (DISPATCHER.isRetransformClassesSupported(instrumentation)) {
return new ClassReloadingStrategy(instrumentation, Strategy.RETRANSFORMATION);
} else if (instrumentation.isRedefineClassesSupported()) {
return new ClassReloadingStrategy(instrumentation, Strategy.REDEFINITION);
} else {
throw new IllegalArgumentException("Instrumentation does not support reloading of classes: " + instrumentation);
}
} | java | public static ClassReloadingStrategy of(Instrumentation instrumentation) {
if (DISPATCHER.isRetransformClassesSupported(instrumentation)) {
return new ClassReloadingStrategy(instrumentation, Strategy.RETRANSFORMATION);
} else if (instrumentation.isRedefineClassesSupported()) {
return new ClassReloadingStrategy(instrumentation, Strategy.REDEFINITION);
} else {
throw new IllegalArgumentException("Instrumentation does not support reloading of classes: " + instrumentation);
}
} | [
"public",
"static",
"ClassReloadingStrategy",
"of",
"(",
"Instrumentation",
"instrumentation",
")",
"{",
"if",
"(",
"DISPATCHER",
".",
"isRetransformClassesSupported",
"(",
"instrumentation",
")",
")",
"{",
"return",
"new",
"ClassReloadingStrategy",
"(",
"instrumentatio... | Creates a class reloading strategy for the given instrumentation. The given instrumentation must either
support {@link java.lang.instrument.Instrumentation#isRedefineClassesSupported()} or
{@link java.lang.instrument.Instrumentation#isRetransformClassesSupported()}. If both modes are supported,
classes will be transformed using a class retransformation.
@param instrumentation The instrumentation to be used by this reloading strategy.
@return A suitable class reloading strategy. | [
"Creates",
"a",
"class",
"reloading",
"strategy",
"for",
"the",
"given",
"instrumentation",
".",
"The",
"given",
"instrumentation",
"must",
"either",
"support",
"{",
"@link",
"java",
".",
"lang",
".",
"instrument",
".",
"Instrumentation#isRedefineClassesSupported",
... | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L136-L144 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java | NamePreservingRunnable.setName | private void setName(Thread thread, String name) {
try {
thread.setName(name);
} catch (SecurityException se) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Failed to set the thread name.", se);
}
}
} | java | private void setName(Thread thread, String name) {
try {
thread.setName(name);
} catch (SecurityException se) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Failed to set the thread name.", se);
}
}
} | [
"private",
"void",
"setName",
"(",
"Thread",
"thread",
",",
"String",
"name",
")",
"{",
"try",
"{",
"thread",
".",
"setName",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"se",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isWarnEnabled",
"(",... | Wraps {@link Thread#setName(String)} to catch a possible {@link Exception}s such as
{@link SecurityException} in sandbox environments, such as applets | [
"Wraps",
"{"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java#L71-L79 |
Sayi/poi-tl | src/main/java/com/deepoove/poi/XWPFTemplate.java | XWPFTemplate.compile | public static XWPFTemplate compile(InputStream inputStream, Configure config) {
try {
XWPFTemplate instance = new XWPFTemplate();
instance.config = config;
instance.doc = new NiceXWPFDocument(inputStream);
instance.visitor = new TemplateVisitor(instance.config);
instance.eleTemplates = instance.visitor.visitDocument(instance.doc);
return instance;
} catch (IOException e) {
logger.error("Compile template failed", e);
throw new ResolverException("Compile template failed");
}
} | java | public static XWPFTemplate compile(InputStream inputStream, Configure config) {
try {
XWPFTemplate instance = new XWPFTemplate();
instance.config = config;
instance.doc = new NiceXWPFDocument(inputStream);
instance.visitor = new TemplateVisitor(instance.config);
instance.eleTemplates = instance.visitor.visitDocument(instance.doc);
return instance;
} catch (IOException e) {
logger.error("Compile template failed", e);
throw new ResolverException("Compile template failed");
}
} | [
"public",
"static",
"XWPFTemplate",
"compile",
"(",
"InputStream",
"inputStream",
",",
"Configure",
"config",
")",
"{",
"try",
"{",
"XWPFTemplate",
"instance",
"=",
"new",
"XWPFTemplate",
"(",
")",
";",
"instance",
".",
"config",
"=",
"config",
";",
"instance"... | template file as InputStream
@param inputStream
@param config
@return
@version 1.2.0 | [
"template",
"file",
"as",
"InputStream"
] | train | https://github.com/Sayi/poi-tl/blob/cf502a6aed473c534df4b0cac5e038fcb95d3f06/src/main/java/com/deepoove/poi/XWPFTemplate.java#L108-L120 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java | OpenPgpContentElement.getExtension | @SuppressWarnings("unchecked")
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
if (namespace == null) {
return null;
}
String key = XmppStringUtils.generateKey(elementName, namespace);
ExtensionElement packetExtension;
synchronized (payload) {
packetExtension = payload.getFirst(key);
}
if (packetExtension == null) {
return null;
}
return (PE) packetExtension;
} | java | @SuppressWarnings("unchecked")
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
if (namespace == null) {
return null;
}
String key = XmppStringUtils.generateKey(elementName, namespace);
ExtensionElement packetExtension;
synchronized (payload) {
packetExtension = payload.getFirst(key);
}
if (packetExtension == null) {
return null;
}
return (PE) packetExtension;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"PE",
"extends",
"ExtensionElement",
">",
"PE",
"getExtension",
"(",
"String",
"elementName",
",",
"String",
"namespace",
")",
"{",
"if",
"(",
"namespace",
"==",
"null",
")",
"{",
"return",
"... | Returns the first extension that matches the specified element name and
namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
only the namespace is matched. Extensions are
are arbitrary XML elements in standard XMPP stanzas.
@param elementName the XML element name of the extension. (May be null)
@param namespace the XML element namespace of the extension.
@param <PE> type of the ExtensionElement.
@return the extension, or <tt>null</tt> if it doesn't exist. | [
"Returns",
"the",
"first",
"extension",
"that",
"matches",
"the",
"specified",
"element",
"name",
"and",
"namespace",
"or",
"<tt",
">",
"null<",
"/",
"tt",
">",
"if",
"it",
"doesn",
"t",
"exist",
".",
"If",
"the",
"provided",
"elementName",
"is",
"null",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java#L137-L151 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.moveTo | public void moveTo(double x, double y, double z) {
if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x);
this.coordsProperty[this.numCoordsProperty.get()-2].set(y);
this.coordsProperty[this.numCoordsProperty.get()-1].set(z);
}
else {
ensureSlots(false, 3);
this.types[this.numTypesProperty.get()] = PathElementType.MOVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(x);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(y);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(z);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
}
this.graphicalBounds = null;
this.logicalBounds = null;
} | java | public void moveTo(double x, double y, double z) {
if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) {
this.coordsProperty[this.numCoordsProperty.get()-3].set(x);
this.coordsProperty[this.numCoordsProperty.get()-2].set(y);
this.coordsProperty[this.numCoordsProperty.get()-1].set(z);
}
else {
ensureSlots(false, 3);
this.types[this.numTypesProperty.get()] = PathElementType.MOVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(x);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(y);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()].set(z);
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
}
this.graphicalBounds = null;
this.logicalBounds = null;
} | [
"public",
"void",
"moveTo",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"if",
"(",
"this",
".",
"numTypesProperty",
".",
"get",
"(",
")",
">",
"0",
"&&",
"this",
".",
"types",
"[",
"this",
".",
"numTypesProperty",
".",
"ge... | Adds a point to the path by moving to the specified
coordinates specified in double precision.
@param x the specified X coordinate
@param y the specified Y coordinate
@param z the specified Z coordinate | [
"Adds",
"a",
"point",
"to",
"the",
"path",
"by",
"moving",
"to",
"the",
"specified",
"coordinates",
"specified",
"in",
"double",
"precision",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2011-L2033 |
aol/cyclops | cyclops/src/main/java/cyclops/control/Future.java | Future.firstSuccess | @SafeVarargs
public static <T> Future<T> firstSuccess(Future<T>... fts) {
Future<T> future = Future.future();
Stream.of(fts)
.forEach(f->f.peek(r->future.complete(r)));
Future<T> all = allOf(fts).recover(e->{ future.completeExceptionally(e); return null;});
return future;
} | java | @SafeVarargs
public static <T> Future<T> firstSuccess(Future<T>... fts) {
Future<T> future = Future.future();
Stream.of(fts)
.forEach(f->f.peek(r->future.complete(r)));
Future<T> all = allOf(fts).recover(e->{ future.completeExceptionally(e); return null;});
return future;
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"firstSuccess",
"(",
"Future",
"<",
"T",
">",
"...",
"fts",
")",
"{",
"Future",
"<",
"T",
">",
"future",
"=",
"Future",
".",
"future",
"(",
")",
";",
"Stream",
".",
"... | Select the first Future to return with a successful result
<pre>
{@code
Future<Integer> ft = Future.future();
Future<Integer> result = Future.firstSuccess(Future.of(()->1),ft);
ft.complete(10);
result.getValue() //1
}
</pre>
@param fts Futures to race
@return First Future to return with a result | [
"Select",
"the",
"first",
"Future",
"to",
"return",
"with",
"a",
"successful",
"result"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L211-L219 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.boundsContains | @Pure
protected final boolean boundsContains(double x, double y, double delta) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
double dlt = delta;
if (dlt < 0) {
dlt = -dlt;
}
final Point2d p = new Point2d(x, y);
if (dlt == 0) {
return bounds.contains(p);
}
p.subX(dlt);
p.subY(dlt);
final Point2d p2 = new Point2d(p.getX() + dlt, p.getY() + dlt);
return bounds.contains(p) && bounds.contains(p2);
} | java | @Pure
protected final boolean boundsContains(double x, double y, double delta) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
double dlt = delta;
if (dlt < 0) {
dlt = -dlt;
}
final Point2d p = new Point2d(x, y);
if (dlt == 0) {
return bounds.contains(p);
}
p.subX(dlt);
p.subY(dlt);
final Point2d p2 = new Point2d(p.getX() + dlt, p.getY() + dlt);
return bounds.contains(p) && bounds.contains(p2);
} | [
"@",
"Pure",
"protected",
"final",
"boolean",
"boundsContains",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"delta",
")",
"{",
"final",
"Rectangle2d",
"bounds",
"=",
"getBoundingBox",
"(",
")",
";",
"assert",
"bounds",
"!=",
"null",
";",
"double... | Replies if the specified point (<var>x</var>,<var>y</var>)
was inside the bounds of this MapElement.
@param x is a geo-referenced coordinate
@param y is a geo-referenced coordinate
@param delta is the geo-referenced distance that corresponds to a approximation
distance in the screen coordinate system
@return <code>true</code> if the point is inside the bounds of this object,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"point",
"(",
"<var",
">",
"x<",
"/",
"var",
">",
"<var",
">",
"y<",
"/",
"var",
">",
")",
"was",
"inside",
"the",
"bounds",
"of",
"this",
"MapElement",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L418-L434 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncSocketChannelHelper.java | AsyncSocketChannelHelper.createTimeout | private void createTimeout(IAbstractAsyncFuture future, long delay, boolean isRead) {
if (AsyncProperties.disableTimeouts) {
return;
}
// create the timeout time, while not holding the lock
long timeoutTime =
(System.currentTimeMillis() + delay + Timer.timeoutRoundup)
& Timer.timeoutResolution;
synchronized (future.getCompletedSemaphore()) {
// make sure it didn't complete while we were getting here
if (!future.isCompleted()) {
timer.createTimeoutRequest(timeoutTime, this.callback, future);
}
}
} | java | private void createTimeout(IAbstractAsyncFuture future, long delay, boolean isRead) {
if (AsyncProperties.disableTimeouts) {
return;
}
// create the timeout time, while not holding the lock
long timeoutTime =
(System.currentTimeMillis() + delay + Timer.timeoutRoundup)
& Timer.timeoutResolution;
synchronized (future.getCompletedSemaphore()) {
// make sure it didn't complete while we were getting here
if (!future.isCompleted()) {
timer.createTimeoutRequest(timeoutTime, this.callback, future);
}
}
} | [
"private",
"void",
"createTimeout",
"(",
"IAbstractAsyncFuture",
"future",
",",
"long",
"delay",
",",
"boolean",
"isRead",
")",
"{",
"if",
"(",
"AsyncProperties",
".",
"disableTimeouts",
")",
"{",
"return",
";",
"}",
"// create the timeout time, while not holding the ... | Create the delayed timeout work item for this request.
@param future
@param delay
@param isRead | [
"Create",
"the",
"delayed",
"timeout",
"work",
"item",
"for",
"this",
"request",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncSocketChannelHelper.java#L574-L589 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_cholsol.java | DZcs_cholsol.cs_cholsol | public static boolean cs_cholsol(int order, DZcs A, DZcsa b) {
DZcsa x;
DZcss S;
DZcsn N;
int n;
boolean ok;
if (!CS_CSC (A) || b == null) return (false); /* check inputs */
n = A.n ;
S = cs_schol (order, A) ; /* ordering and symbolic analysis */
N = cs_chol (A, S) ; /* numeric Cholesky factorization */
x = new DZcsa (n) ; /* get workspace */
ok = (S != null && N != null && x != null) ;
if (ok)
{
cs_ipvec (S.pinv, b, x, n); /* x = P*b */
cs_lsolve (N.L, x) ; /* x = L\x */
cs_ltsolve (N.L, x) ; /* x = L'\x */
cs_pvec (S.pinv, x, b, n) ; /* b = P'*x */
}
return (ok);
} | java | public static boolean cs_cholsol(int order, DZcs A, DZcsa b) {
DZcsa x;
DZcss S;
DZcsn N;
int n;
boolean ok;
if (!CS_CSC (A) || b == null) return (false); /* check inputs */
n = A.n ;
S = cs_schol (order, A) ; /* ordering and symbolic analysis */
N = cs_chol (A, S) ; /* numeric Cholesky factorization */
x = new DZcsa (n) ; /* get workspace */
ok = (S != null && N != null && x != null) ;
if (ok)
{
cs_ipvec (S.pinv, b, x, n); /* x = P*b */
cs_lsolve (N.L, x) ; /* x = L\x */
cs_ltsolve (N.L, x) ; /* x = L'\x */
cs_pvec (S.pinv, x, b, n) ; /* b = P'*x */
}
return (ok);
} | [
"public",
"static",
"boolean",
"cs_cholsol",
"(",
"int",
"order",
",",
"DZcs",
"A",
",",
"DZcsa",
"b",
")",
"{",
"DZcsa",
"x",
";",
"DZcss",
"S",
";",
"DZcsn",
"N",
";",
"int",
"n",
";",
"boolean",
"ok",
";",
"if",
"(",
"!",
"CS_CSC",
"(",
"A",
... | Solves Ax=b where A is symmetric positive definite; b is overwritten with
solution.
@param order
ordering method to use (0 or 1)
@param A
column-compressed matrix, symmetric positive definite, only
upper triangular part is used
@param b
right hand side, b is overwritten with solution
@return true if successful, false on error | [
"Solves",
"Ax",
"=",
"b",
"where",
"A",
"is",
"symmetric",
"positive",
"definite",
";",
"b",
"is",
"overwritten",
"with",
"solution",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_cholsol.java#L62-L82 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.getTables | @Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
checkClosed();
this.sysCatalog.setString(1, "TABLES");
JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery();
VoltTable vtable = res.getVoltTable().clone(0);
List<String> typeStrings = null;
if (types != null) {
typeStrings = Arrays.asList(types);
}
// If no pattern is specified, default to matching any/all.
if (tableNamePattern == null || tableNamePattern.length() == 0)
{
tableNamePattern = "%";
}
Pattern table_pattern = computeJavaPattern(tableNamePattern);
// Filter tables based on type and pattern
while (res.next()) {
if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) {
Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME"));
if (table_matcher.matches())
{
vtable.addRow(res.getRowData());
}
}
}
return new JDBC4ResultSet(this.sysCatalog, vtable);
} | java | @Override
public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException
{
checkClosed();
this.sysCatalog.setString(1, "TABLES");
JDBC4ResultSet res = (JDBC4ResultSet) this.sysCatalog.executeQuery();
VoltTable vtable = res.getVoltTable().clone(0);
List<String> typeStrings = null;
if (types != null) {
typeStrings = Arrays.asList(types);
}
// If no pattern is specified, default to matching any/all.
if (tableNamePattern == null || tableNamePattern.length() == 0)
{
tableNamePattern = "%";
}
Pattern table_pattern = computeJavaPattern(tableNamePattern);
// Filter tables based on type and pattern
while (res.next()) {
if (typeStrings == null || typeStrings.contains(res.getString("TABLE_TYPE"))) {
Matcher table_matcher = table_pattern.matcher(res.getString("TABLE_NAME"));
if (table_matcher.matches())
{
vtable.addRow(res.getRowData());
}
}
}
return new JDBC4ResultSet(this.sysCatalog, vtable);
} | [
"@",
"Override",
"public",
"ResultSet",
"getTables",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"tableNamePattern",
",",
"String",
"[",
"]",
"types",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"this",
".",
... | Retrieves a description of the tables available in the given catalog. | [
"Retrieves",
"a",
"description",
"of",
"the",
"tables",
"available",
"in",
"the",
"given",
"catalog",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L832-L865 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/SnsAPI.java | SnsAPI.connectOauth2Authorize | public static String connectOauth2Authorize(String appid,String redirect_uri,boolean snsapi_userinfo,String state){
return connectOauth2Authorize(appid, redirect_uri, snsapi_userinfo, state, null);
} | java | public static String connectOauth2Authorize(String appid,String redirect_uri,boolean snsapi_userinfo,String state){
return connectOauth2Authorize(appid, redirect_uri, snsapi_userinfo, state, null);
} | [
"public",
"static",
"String",
"connectOauth2Authorize",
"(",
"String",
"appid",
",",
"String",
"redirect_uri",
",",
"boolean",
"snsapi_userinfo",
",",
"String",
"state",
")",
"{",
"return",
"connectOauth2Authorize",
"(",
"appid",
",",
"redirect_uri",
",",
"snsapi_us... | 生成网页授权 URL
@param appid appid
@param redirect_uri 自动URLEncoder
@param snsapi_userinfo snsapi_userinfo
@param state 可以为空
@return url | [
"生成网页授权",
"URL"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/SnsAPI.java#L168-L170 |
davidmoten/rxjava-extras | src/main/java/com/github/davidmoten/rx/Serialized.java | Serialized.read | public static <T extends Serializable> Observable<T> read(final File file) {
return read(file, DEFAULT_BUFFER_SIZE);
} | java | public static <T extends Serializable> Observable<T> read(final File file) {
return read(file, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"<",
"T",
"extends",
"Serializable",
">",
"Observable",
"<",
"T",
">",
"read",
"(",
"final",
"File",
"file",
")",
"{",
"return",
"read",
"(",
"file",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | Returns the deserialized objects from the given {@link File} as an
{@link Observable} stream. A buffer size of 8192 bytes is used by
default.
@param file
the input file containing serialized java objects
@param <T>
the generic type of the deserialized objects returned in the
stream
@return the stream of deserialized objects from the {@link InputStream}
as an {@link Observable}. | [
"Returns",
"the",
"deserialized",
"objects",
"from",
"the",
"given",
"{",
"@link",
"File",
"}",
"as",
"an",
"{",
"@link",
"Observable",
"}",
"stream",
".",
"A",
"buffer",
"size",
"of",
"8192",
"bytes",
"is",
"used",
"by",
"default",
"."
] | train | https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/Serialized.java#L136-L138 |
nguillaumin/slick2d-maven | slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java | GradientEditor.addPoint | public void addPoint(float pos, Color col) {
ControlPoint point = new ControlPoint(col, pos);
for (int i=0;i<list.size()-1;i++) {
ControlPoint now = (ControlPoint) list.get(i);
ControlPoint next = (ControlPoint) list.get(i+1);
if ((now.pos <= 0.5f) && (next.pos >=0.5f)) {
list.add(i+1,point);
break;
}
}
repaint(0);
} | java | public void addPoint(float pos, Color col) {
ControlPoint point = new ControlPoint(col, pos);
for (int i=0;i<list.size()-1;i++) {
ControlPoint now = (ControlPoint) list.get(i);
ControlPoint next = (ControlPoint) list.get(i+1);
if ((now.pos <= 0.5f) && (next.pos >=0.5f)) {
list.add(i+1,point);
break;
}
}
repaint(0);
} | [
"public",
"void",
"addPoint",
"(",
"float",
"pos",
",",
"Color",
"col",
")",
"{",
"ControlPoint",
"point",
"=",
"new",
"ControlPoint",
"(",
"col",
",",
"pos",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")... | Add a control point to the gradient
@param pos The position in the gradient (0 -> 1)
@param col The color at the new control point | [
"Add",
"a",
"control",
"point",
"to",
"the",
"gradient"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java#L364-L375 |
dlew/joda-time-android | library/src/main/java/net/danlew/android/joda/DateUtils.java | DateUtils.getRelativeTimeSpanString | public static CharSequence getRelativeTimeSpanString(Context context, ReadablePartial time) {
return getRelativeTimeSpanString(context, time.toDateTime(DateTime.now()));
} | java | public static CharSequence getRelativeTimeSpanString(Context context, ReadablePartial time) {
return getRelativeTimeSpanString(context, time.toDateTime(DateTime.now()));
} | [
"public",
"static",
"CharSequence",
"getRelativeTimeSpanString",
"(",
"Context",
"context",
",",
"ReadablePartial",
"time",
")",
"{",
"return",
"getRelativeTimeSpanString",
"(",
"context",
",",
"time",
".",
"toDateTime",
"(",
"DateTime",
".",
"now",
"(",
")",
")",... | Returns a string describing 'time' as a time relative to the current time.
Missing fields from 'time' are filled in with values from the current time.
@see #getRelativeTimeSpanString(Context, ReadableInstant, int) | [
"Returns",
"a",
"string",
"describing",
"time",
"as",
"a",
"time",
"relative",
"to",
"the",
"current",
"time",
"."
] | train | https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L213-L215 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java | Utilities.compareVersionToRange | public static int compareVersionToRange(Version version, Version minVersion, Version maxVersion) {
assert minVersion == null || maxVersion == null || minVersion.compareTo(maxVersion) < 0;
if (version == null) {
return Integer.MIN_VALUE;
}
if (minVersion != null && compareVersionsNoQualifier(version, minVersion) < 0) {
return -1;
}
if (maxVersion != null && compareVersionsNoQualifier(version, maxVersion) >= 0) {
return 1;
}
return 0;
} | java | public static int compareVersionToRange(Version version, Version minVersion, Version maxVersion) {
assert minVersion == null || maxVersion == null || minVersion.compareTo(maxVersion) < 0;
if (version == null) {
return Integer.MIN_VALUE;
}
if (minVersion != null && compareVersionsNoQualifier(version, minVersion) < 0) {
return -1;
}
if (maxVersion != null && compareVersionsNoQualifier(version, maxVersion) >= 0) {
return 1;
}
return 0;
} | [
"public",
"static",
"int",
"compareVersionToRange",
"(",
"Version",
"version",
",",
"Version",
"minVersion",
",",
"Version",
"maxVersion",
")",
"{",
"assert",
"minVersion",
"==",
"null",
"||",
"maxVersion",
"==",
"null",
"||",
"minVersion",
".",
"compareTo",
"("... | Null-safe compare a version number to a range of version numbers.
<p>The minVersion must be strictly lower to the maxVersion. Otherwise
the behavior is not predictible.
@param version the version to compare to the range; must not be <code>null</code>.
@param minVersion the minimal version in the range (inclusive); could be <code>null</code>.
@param maxVersion the maximal version in the range (exclusive); could be <code>null</code>.
@return a negative number if the version in lower than the minVersion.
A positive number if the version is greater than or equal to the maxVersion.
<code>0</code> if the version is between minVersion and maxVersion. | [
"Null",
"-",
"safe",
"compare",
"a",
"version",
"number",
"to",
"a",
"range",
"of",
"version",
"numbers",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Utilities.java#L85-L97 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/BiInt2ObjectMap.java | BiInt2ObjectMap.get | @SuppressWarnings("unchecked")
public V get(final int keyPartA, final int keyPartB)
{
final long key = compoundKey(keyPartA, keyPartB);
final int mask = values.length - 1;
int index = Hashing.hash(key, mask);
Object value;
while (null != (value = values[index]))
{
if (key == keys[index])
{
break;
}
index = ++index & mask;
}
return (V)value;
} | java | @SuppressWarnings("unchecked")
public V get(final int keyPartA, final int keyPartB)
{
final long key = compoundKey(keyPartA, keyPartB);
final int mask = values.length - 1;
int index = Hashing.hash(key, mask);
Object value;
while (null != (value = values[index]))
{
if (key == keys[index])
{
break;
}
index = ++index & mask;
}
return (V)value;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"get",
"(",
"final",
"int",
"keyPartA",
",",
"final",
"int",
"keyPartB",
")",
"{",
"final",
"long",
"key",
"=",
"compoundKey",
"(",
"keyPartA",
",",
"keyPartB",
")",
";",
"final",
"int",
... | Retrieve a value from the map.
@param keyPartA for the key
@param keyPartB for the key
@return value matching the key if found or null if not found. | [
"Retrieve",
"a",
"value",
"from",
"the",
"map",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/BiInt2ObjectMap.java#L206-L225 |
Axway/Grapes | utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java | GrapesClient.postModule | public void postModule(final Module module, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.moduleResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, module);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST module";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | java | public void postModule(final Module module, final String user, final String password) throws GrapesCommunicationException, AuthenticationException {
final Client client = getClient(user, password);
final WebResource resource = client.resource(serverURL).path(RequestUtils.moduleResourcePath());
final ClientResponse response = resource.type(MediaType.APPLICATION_JSON).post(ClientResponse.class, module);
client.destroy();
if(ClientResponse.Status.CREATED.getStatusCode() != response.getStatus()){
final String message = "Failed to POST module";
if(LOG.isErrorEnabled()) {
LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
}
throw new GrapesCommunicationException(message, response.getStatus());
}
} | [
"public",
"void",
"postModule",
"(",
"final",
"Module",
"module",
",",
"final",
"String",
"user",
",",
"final",
"String",
"password",
")",
"throws",
"GrapesCommunicationException",
",",
"AuthenticationException",
"{",
"final",
"Client",
"client",
"=",
"getClient",
... | Post a module to the server
@param module
@param user
@param password
@throws GrapesCommunicationException
@throws javax.naming.AuthenticationException | [
"Post",
"a",
"module",
"to",
"the",
"server"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L178-L191 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java | CommonOps_DSCC.changeSign | public static void changeSign(DMatrixSparseCSC A , DMatrixSparseCSC B ) {
if( A != B ) {
B.copyStructure(A);
}
for (int i = 0; i < A.nz_length; i++) {
B.nz_values[i] = -A.nz_values[i];
}
} | java | public static void changeSign(DMatrixSparseCSC A , DMatrixSparseCSC B ) {
if( A != B ) {
B.copyStructure(A);
}
for (int i = 0; i < A.nz_length; i++) {
B.nz_values[i] = -A.nz_values[i];
}
} | [
"public",
"static",
"void",
"changeSign",
"(",
"DMatrixSparseCSC",
"A",
",",
"DMatrixSparseCSC",
"B",
")",
"{",
"if",
"(",
"A",
"!=",
"B",
")",
"{",
"B",
".",
"copyStructure",
"(",
"A",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"... | B = -A. Changes the sign of elements in A and stores it in B. A and B can be the same instance.
@param A (Input) Matrix. Not modified.
@param B (Output) Matrix. Modified. | [
"B",
"=",
"-",
"A",
".",
"Changes",
"the",
"sign",
"of",
"elements",
"in",
"A",
"and",
"stores",
"it",
"in",
"B",
".",
"A",
"and",
"B",
"can",
"be",
"the",
"same",
"instance",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L442-L450 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java | SpecializedOps_DDRM.copyTriangle | public static DMatrixRMaj copyTriangle(DMatrixRMaj src , DMatrixRMaj dst , boolean upper ) {
if( dst == null ) {
dst = new DMatrixRMaj(src.numRows,src.numCols);
} else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) {
throw new IllegalArgumentException("src and dst must have the same dimensions.");
}
if( upper ) {
int N = Math.min(src.numRows,src.numCols);
for( int i = 0; i < N; i++ ) {
int index = i*src.numCols+i;
System.arraycopy(src.data,index,dst.data,index,src.numCols-i);
}
} else {
for( int i = 0; i < src.numRows; i++ ) {
int length = Math.min(i+1,src.numCols);
int index = i*src.numCols;
System.arraycopy(src.data,index,dst.data,index,length);
}
}
return dst;
} | java | public static DMatrixRMaj copyTriangle(DMatrixRMaj src , DMatrixRMaj dst , boolean upper ) {
if( dst == null ) {
dst = new DMatrixRMaj(src.numRows,src.numCols);
} else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) {
throw new IllegalArgumentException("src and dst must have the same dimensions.");
}
if( upper ) {
int N = Math.min(src.numRows,src.numCols);
for( int i = 0; i < N; i++ ) {
int index = i*src.numCols+i;
System.arraycopy(src.data,index,dst.data,index,src.numCols-i);
}
} else {
for( int i = 0; i < src.numRows; i++ ) {
int length = Math.min(i+1,src.numCols);
int index = i*src.numCols;
System.arraycopy(src.data,index,dst.data,index,length);
}
}
return dst;
} | [
"public",
"static",
"DMatrixRMaj",
"copyTriangle",
"(",
"DMatrixRMaj",
"src",
",",
"DMatrixRMaj",
"dst",
",",
"boolean",
"upper",
")",
"{",
"if",
"(",
"dst",
"==",
"null",
")",
"{",
"dst",
"=",
"new",
"DMatrixRMaj",
"(",
"src",
".",
"numRows",
",",
"src"... | Copies just the upper or lower triangular portion of a matrix.
@param src Matrix being copied. Not modified.
@param dst Where just a triangle from src is copied. If null a new one will be created. Modified.
@param upper If the upper or lower triangle should be copied.
@return The copied matrix. | [
"Copies",
"just",
"the",
"upper",
"or",
"lower",
"triangular",
"portion",
"of",
"a",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L123-L145 |
wildfly/wildfly-core | process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java | ProcessUtils.killProcess | static boolean killProcess(final String processName, int id) {
int pid;
try {
pid = processUtils.resolveProcessId(processName, id);
if(pid > 0) {
try {
Runtime.getRuntime().exec(processUtils.getKillCommand(pid));
return true;
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid);
}
}
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName);
}
return false;
} | java | static boolean killProcess(final String processName, int id) {
int pid;
try {
pid = processUtils.resolveProcessId(processName, id);
if(pid > 0) {
try {
Runtime.getRuntime().exec(processUtils.getKillCommand(pid));
return true;
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to kill process '%s' with pid '%s'", processName, pid);
}
}
} catch (Throwable t) {
ProcessLogger.ROOT_LOGGER.debugf(t, "failed to resolve pid of process '%s'", processName);
}
return false;
} | [
"static",
"boolean",
"killProcess",
"(",
"final",
"String",
"processName",
",",
"int",
"id",
")",
"{",
"int",
"pid",
";",
"try",
"{",
"pid",
"=",
"processUtils",
".",
"resolveProcessId",
"(",
"processName",
",",
"id",
")",
";",
"if",
"(",
"pid",
">",
"... | Try to kill a given process.
@param processName the process name
@param id the process integer id, or {@code -1} if this is not relevant
@return {@code true} if the command succeeded, {@code false} otherwise | [
"Try",
"to",
"kill",
"a",
"given",
"process",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java#L38-L54 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java | MonitoringAspect.resolveAnnotation | private Monitor resolveAnnotation(final ProceedingJoinPoint pjp) {
final Signature signature = pjp.getSignature();
final Class<?> type = signature.getDeclaringType();
final Method method = (signature instanceof MethodSignature) ? MethodSignature.class.cast(signature).getMethod() :
null;
final Monitor methodMonitorAnn = method != null ? findAnnotation(method, Monitor.class) : null;
if (methodMonitorAnn != null)
return methodMonitorAnn;
return findTypeAnnotation(type, Monitor.class);
} | java | private Monitor resolveAnnotation(final ProceedingJoinPoint pjp) {
final Signature signature = pjp.getSignature();
final Class<?> type = signature.getDeclaringType();
final Method method = (signature instanceof MethodSignature) ? MethodSignature.class.cast(signature).getMethod() :
null;
final Monitor methodMonitorAnn = method != null ? findAnnotation(method, Monitor.class) : null;
if (methodMonitorAnn != null)
return methodMonitorAnn;
return findTypeAnnotation(type, Monitor.class);
} | [
"private",
"Monitor",
"resolveAnnotation",
"(",
"final",
"ProceedingJoinPoint",
"pjp",
")",
"{",
"final",
"Signature",
"signature",
"=",
"pjp",
".",
"getSignature",
"(",
")",
";",
"final",
"Class",
"<",
"?",
">",
"type",
"=",
"signature",
".",
"getDeclaringTyp... | Trying to resolve {@link Monitor} annotation first in method annotations scope, then in class scope. Note - method will also check
if {@link Monitor} is Placed to some other annotation as meta!
Search order :
- 1 method;
- 2 type.
@param pjp
{@link ProceedingJoinPoint}
@return {@link Monitor} or {@code null} | [
"Trying",
"to",
"resolve",
"{",
"@link",
"Monitor",
"}",
"annotation",
"first",
"in",
"method",
"annotations",
"scope",
"then",
"in",
"class",
"scope",
".",
"Note",
"-",
"method",
"will",
"also",
"check",
"if",
"{",
"@link",
"Monitor",
"}",
"is",
"Placed",... | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L98-L107 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.JensenShannonDivergence | public static double JensenShannonDivergence(double[] x, double[] y) {
double[] m = new double[x.length];
for (int i = 0; i < m.length; i++) {
m[i] = (x[i] + y[i]) / 2;
}
return (KullbackLeiblerDivergence(x, m) + KullbackLeiblerDivergence(y, m)) / 2;
} | java | public static double JensenShannonDivergence(double[] x, double[] y) {
double[] m = new double[x.length];
for (int i = 0; i < m.length; i++) {
m[i] = (x[i] + y[i]) / 2;
}
return (KullbackLeiblerDivergence(x, m) + KullbackLeiblerDivergence(y, m)) / 2;
} | [
"public",
"static",
"double",
"JensenShannonDivergence",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"double",
"[",
"]",
"m",
"=",
"new",
"double",
"[",
"x",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where
M = (P+Q)/2. The Jensen-Shannon divergence is a popular
method of measuring the similarity between two probability distributions.
It is also known as information radius or total divergence to the average.
It is based on the Kullback-Leibler divergence, with the difference that
it is always a finite value. The square root of the Jensen-Shannon divergence
is a metric. | [
"Jensen",
"-",
"Shannon",
"divergence",
"JS",
"(",
"P||Q",
")",
"=",
"(",
"KL",
"(",
"P||M",
")",
"+",
"KL",
"(",
"Q||M",
"))",
"/",
"2",
"where",
"M",
"=",
"(",
"P",
"+",
"Q",
")",
"/",
"2",
".",
"The",
"Jensen",
"-",
"Shannon",
"divergence",
... | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2395-L2402 |
xerial/snappy-java | src/main/java/org/xerial/snappy/SnappyInputStream.java | SnappyInputStream.readNext | private int readNext(byte[] dest, int offset, int len)
throws IOException
{
int readBytes = 0;
while (readBytes < len) {
int ret = in.read(dest, readBytes + offset, len - readBytes);
if (ret == -1) {
finishedReading = true;
return readBytes;
}
readBytes += ret;
}
return readBytes;
} | java | private int readNext(byte[] dest, int offset, int len)
throws IOException
{
int readBytes = 0;
while (readBytes < len) {
int ret = in.read(dest, readBytes + offset, len - readBytes);
if (ret == -1) {
finishedReading = true;
return readBytes;
}
readBytes += ret;
}
return readBytes;
} | [
"private",
"int",
"readNext",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"readBytes",
"=",
"0",
";",
"while",
"(",
"readBytes",
"<",
"len",
")",
"{",
"int",
"ret",
"=",
"in",
".... | Read next len bytes
@param dest
@param offset
@param len
@return read bytes | [
"Read",
"next",
"len",
"bytes"
] | train | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/SnappyInputStream.java#L373-L386 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellTextField.java | JCellTextField.init | public void init(int iMaxLength, boolean bAlignRight)
{
this.setColumns(iMaxLength);
this.setBorder(null);
if (bAlignRight)
this.setHorizontalAlignment(JTextField.RIGHT);
} | java | public void init(int iMaxLength, boolean bAlignRight)
{
this.setColumns(iMaxLength);
this.setBorder(null);
if (bAlignRight)
this.setHorizontalAlignment(JTextField.RIGHT);
} | [
"public",
"void",
"init",
"(",
"int",
"iMaxLength",
",",
"boolean",
"bAlignRight",
")",
"{",
"this",
".",
"setColumns",
"(",
"iMaxLength",
")",
";",
"this",
".",
"setBorder",
"(",
"null",
")",
";",
"if",
"(",
"bAlignRight",
")",
"this",
".",
"setHorizont... | Creates new JCellButton.
@param iMaxLength The number of columns of text in this field.
@param bAlignRight If true, align the text to the right. | [
"Creates",
"new",
"JCellButton",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellTextField.java#L71-L77 |
alkacon/opencms-core | src/org/opencms/xml/templatemapper/CmsTemplateMapper.java | CmsTemplateMapper.getConfiguration | private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {
if (!m_enabled) {
return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
}
if (m_configPath == null) {
m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
}
return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
cms,
m_configPath,
new Transformer() {
@Override
public Object transform(Object input) {
try {
CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
SAXReader saxBuilder = new SAXReader();
try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
Document document = saxBuilder.read(stream);
CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
return config;
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
}
}
}));
} | java | private CmsTemplateMapperConfiguration getConfiguration(final CmsObject cms) {
if (!m_enabled) {
return CmsTemplateMapperConfiguration.EMPTY_CONFIG;
}
if (m_configPath == null) {
m_configPath = OpenCms.getSystemInfo().getConfigFilePath(cms, "template-mapping.xml");
}
return (CmsTemplateMapperConfiguration)(CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().loadVfsObject(
cms,
m_configPath,
new Transformer() {
@Override
public Object transform(Object input) {
try {
CmsFile file = cms.readFile(m_configPath, CmsResourceFilter.IGNORE_EXPIRATION);
SAXReader saxBuilder = new SAXReader();
try (ByteArrayInputStream stream = new ByteArrayInputStream(file.getContents())) {
Document document = saxBuilder.read(stream);
CmsTemplateMapperConfiguration config = new CmsTemplateMapperConfiguration(cms, document);
return config;
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
return new CmsTemplateMapperConfiguration(); // empty configuration, does not do anything
}
}
}));
} | [
"private",
"CmsTemplateMapperConfiguration",
"getConfiguration",
"(",
"final",
"CmsObject",
"cms",
")",
"{",
"if",
"(",
"!",
"m_enabled",
")",
"{",
"return",
"CmsTemplateMapperConfiguration",
".",
"EMPTY_CONFIG",
";",
"}",
"if",
"(",
"m_configPath",
"==",
"null",
... | Loads the configuration file, using CmsVfsMemoryObjectCache for caching.
@param cms the CMS context
@return the template mapper configuration | [
"Loads",
"the",
"configuration",
"file",
"using",
"CmsVfsMemoryObjectCache",
"for",
"caching",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/templatemapper/CmsTemplateMapper.java#L348-L381 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java | InjectionBinding.getInjectableObject | Object getInjectableObject(Object targetObject, // F743-33811.2
InjectionTargetContext targetContext) // F49213.1
throws InjectionException
{
if (getInjectionScope() != InjectionScope.COMP)
{
// In some environments, non-comp bindings might not be fully merged,
// which means injection must do a full lookup. Allow the runtime
// environment to decide.
return InjectionEngineAccessor.getInternalInstance().getInjectableObject(this, targetObject, targetContext);
}
// If the injected object will be contextually related to the target,
// then use the signature that passes the target. d664351.1
return getInjectionObject(targetObject, targetContext);
} | java | Object getInjectableObject(Object targetObject, // F743-33811.2
InjectionTargetContext targetContext) // F49213.1
throws InjectionException
{
if (getInjectionScope() != InjectionScope.COMP)
{
// In some environments, non-comp bindings might not be fully merged,
// which means injection must do a full lookup. Allow the runtime
// environment to decide.
return InjectionEngineAccessor.getInternalInstance().getInjectableObject(this, targetObject, targetContext);
}
// If the injected object will be contextually related to the target,
// then use the signature that passes the target. d664351.1
return getInjectionObject(targetObject, targetContext);
} | [
"Object",
"getInjectableObject",
"(",
"Object",
"targetObject",
",",
"// F743-33811.2",
"InjectionTargetContext",
"targetContext",
")",
"// F49213.1",
"throws",
"InjectionException",
"{",
"if",
"(",
"getInjectionScope",
"(",
")",
"!=",
"InjectionScope",
".",
"COMP",
")"... | Returns an object to be injected for this injection binding. This method
must be used instead of {@link #getInjectionObject} for externally merged
java:global/:app/:module bindings.
@param targetObject the object being injected into
@param targetContext provides access to context data associated with
the target of the injection (e.g. EJBContext). May be null
if not provided by the container, and will be null for a
naming lookup.
@return the value to inject | [
"Returns",
"an",
"object",
"to",
"be",
"injected",
"for",
"this",
"injection",
"binding",
".",
"This",
"method",
"must",
"be",
"used",
"instead",
"of",
"{",
"@link",
"#getInjectionObject",
"}",
"for",
"externally",
"merged",
"java",
":",
"global",
"/",
":",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/wsspi/injectionengine/InjectionBinding.java#L1354-L1369 |
kaazing/gateway | transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameEncodingSupport.java | WsFrameEncodingSupport.doEncodeOpcode | private static byte doEncodeOpcode(byte b, WsMessage message) {
Kind kind = message.getKind();
switch (kind) {
case CONTINUATION:
b |= Opcode.CONTINUATION.getCode();
break;
case TEXT: {
b |= Opcode.TEXT.getCode();
break;
}
case BINARY: {
b |= Opcode.BINARY.getCode();
break;
}
case PING: {
b |= Opcode.PING.getCode();
break;
}
case PONG: {
b |= Opcode.PONG.getCode();
break;
}
case CLOSE: {
b |= Opcode.CLOSE.getCode();
break;
}
default:
throw new IllegalStateException("Unrecognized frame type: " + message.getKind());
}
return b;
} | java | private static byte doEncodeOpcode(byte b, WsMessage message) {
Kind kind = message.getKind();
switch (kind) {
case CONTINUATION:
b |= Opcode.CONTINUATION.getCode();
break;
case TEXT: {
b |= Opcode.TEXT.getCode();
break;
}
case BINARY: {
b |= Opcode.BINARY.getCode();
break;
}
case PING: {
b |= Opcode.PING.getCode();
break;
}
case PONG: {
b |= Opcode.PONG.getCode();
break;
}
case CLOSE: {
b |= Opcode.CLOSE.getCode();
break;
}
default:
throw new IllegalStateException("Unrecognized frame type: " + message.getKind());
}
return b;
} | [
"private",
"static",
"byte",
"doEncodeOpcode",
"(",
"byte",
"b",
",",
"WsMessage",
"message",
")",
"{",
"Kind",
"kind",
"=",
"message",
".",
"getKind",
"(",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"CONTINUATION",
":",
"b",
"|=",
"Opcode",
".... | Encode a WebSocket opcode onto a byte that might have some high bits set.
@param b
@param message
@return | [
"Encode",
"a",
"WebSocket",
"opcode",
"onto",
"a",
"byte",
"that",
"might",
"have",
"some",
"high",
"bits",
"set",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameEncodingSupport.java#L231-L262 |
UrielCh/ovh-java-sdk | ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java | ApiOvhCaasregistry.serviceName_namespaces_namespaceId_permissions_permissionId_GET | public OvhPermissions serviceName_namespaces_namespaceId_permissions_permissionId_GET(String serviceName, String namespaceId, String permissionId) throws IOException {
String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/permissions/{permissionId}";
StringBuilder sb = path(qPath, serviceName, namespaceId, permissionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPermissions.class);
} | java | public OvhPermissions serviceName_namespaces_namespaceId_permissions_permissionId_GET(String serviceName, String namespaceId, String permissionId) throws IOException {
String qPath = "/caas/registry/{serviceName}/namespaces/{namespaceId}/permissions/{permissionId}";
StringBuilder sb = path(qPath, serviceName, namespaceId, permissionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPermissions.class);
} | [
"public",
"OvhPermissions",
"serviceName_namespaces_namespaceId_permissions_permissionId_GET",
"(",
"String",
"serviceName",
",",
"String",
"namespaceId",
",",
"String",
"permissionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/caas/registry/{serviceName}/n... | Inspect permission
REST: GET /caas/registry/{serviceName}/namespaces/{namespaceId}/permissions/{permissionId}
@param namespaceId [required] Namespace id
@param permissionId [required] Permission id
@param serviceName [required] Service name
API beta | [
"Inspect",
"permission"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L453-L458 |
VoltDB/voltdb | src/frontend/org/voltcore/utils/ssl/SSLBufferDecrypter.java | SSLBufferDecrypter.tlsunwrap | public ByteBuf tlsunwrap(ByteBuffer srcBuffer, ByteBuf dstBuf, PooledByteBufAllocator allocator) {
int writerIndex = dstBuf.writerIndex();
ByteBuffer byteBuffer = dstBuf.nioBuffer(writerIndex, dstBuf.writableBytes());
while (true) {
SSLEngineResult result;
try {
result = m_sslEngine.unwrap(srcBuffer, byteBuffer);
} catch (SSLException | ReadOnlyBufferException | IllegalArgumentException | IllegalStateException e) {
dstBuf.release();
throw new TLSException("ssl engine unwrap fault", e);
} catch (Throwable t) {
dstBuf.release();
throw t;
}
switch (result.getStatus()) {
case OK:
if (result.bytesProduced() <= 0 || srcBuffer.hasRemaining()) {
continue;
}
dstBuf.writerIndex(writerIndex + result.bytesProduced());
return dstBuf;
case BUFFER_OVERFLOW:
dstBuf.release();
if (m_sslEngine.getSession().getApplicationBufferSize() > dstBuf.writableBytes()) {
int size = m_sslEngine.getSession().getApplicationBufferSize();
dstBuf = allocator.buffer(size);
writerIndex = dstBuf.writerIndex();
byteBuffer = dstBuf.nioBuffer(writerIndex, dstBuf.writableBytes());
continue;
}
throw new TLSException("SSL engine unexpectedly overflowed when decrypting");
case BUFFER_UNDERFLOW:
dstBuf.release();
throw new TLSException("SSL engine unexpectedly underflowed when decrypting");
case CLOSED:
dstBuf.release();
throw new TLSException("SSL engine is closed on ssl unwrap of buffer.");
}
}
} | java | public ByteBuf tlsunwrap(ByteBuffer srcBuffer, ByteBuf dstBuf, PooledByteBufAllocator allocator) {
int writerIndex = dstBuf.writerIndex();
ByteBuffer byteBuffer = dstBuf.nioBuffer(writerIndex, dstBuf.writableBytes());
while (true) {
SSLEngineResult result;
try {
result = m_sslEngine.unwrap(srcBuffer, byteBuffer);
} catch (SSLException | ReadOnlyBufferException | IllegalArgumentException | IllegalStateException e) {
dstBuf.release();
throw new TLSException("ssl engine unwrap fault", e);
} catch (Throwable t) {
dstBuf.release();
throw t;
}
switch (result.getStatus()) {
case OK:
if (result.bytesProduced() <= 0 || srcBuffer.hasRemaining()) {
continue;
}
dstBuf.writerIndex(writerIndex + result.bytesProduced());
return dstBuf;
case BUFFER_OVERFLOW:
dstBuf.release();
if (m_sslEngine.getSession().getApplicationBufferSize() > dstBuf.writableBytes()) {
int size = m_sslEngine.getSession().getApplicationBufferSize();
dstBuf = allocator.buffer(size);
writerIndex = dstBuf.writerIndex();
byteBuffer = dstBuf.nioBuffer(writerIndex, dstBuf.writableBytes());
continue;
}
throw new TLSException("SSL engine unexpectedly overflowed when decrypting");
case BUFFER_UNDERFLOW:
dstBuf.release();
throw new TLSException("SSL engine unexpectedly underflowed when decrypting");
case CLOSED:
dstBuf.release();
throw new TLSException("SSL engine is closed on ssl unwrap of buffer.");
}
}
} | [
"public",
"ByteBuf",
"tlsunwrap",
"(",
"ByteBuffer",
"srcBuffer",
",",
"ByteBuf",
"dstBuf",
",",
"PooledByteBufAllocator",
"allocator",
")",
"{",
"int",
"writerIndex",
"=",
"dstBuf",
".",
"writerIndex",
"(",
")",
";",
"ByteBuffer",
"byteBuffer",
"=",
"dstBuf",
"... | Encrypt data in {@code srcBuffer} into {@code dstBuf} if it is large enough. If an error occurs {@code dstBuf}
will be released. If {@code dstBuf} is not large enough a new buffer will be allocated from {@code allocator} and
{@code dstBuf} will be released.
@param srcBuffer holding encrypted data
@param dstBuf to attempt to write plain text data into
@param allocator to be used to allocate new buffers if {@code dstBuf} is too small
@return {@link ByteBuf} containing plain text data | [
"Encrypt",
"data",
"in",
"{",
"@code",
"srcBuffer",
"}",
"into",
"{",
"@code",
"dstBuf",
"}",
"if",
"it",
"is",
"large",
"enough",
".",
"If",
"an",
"error",
"occurs",
"{",
"@code",
"dstBuf",
"}",
"will",
"be",
"released",
".",
"If",
"{",
"@code",
"ds... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/utils/ssl/SSLBufferDecrypter.java#L123-L164 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/AnnotationMatcherUtils.java | AnnotationMatcherUtils.getArgument | @Nullable
public static ExpressionTree getArgument(AnnotationTree annotationTree, String name) {
for (ExpressionTree argumentTree : annotationTree.getArguments()) {
if (argumentTree.getKind() != Tree.Kind.ASSIGNMENT) {
continue;
}
AssignmentTree assignmentTree = (AssignmentTree) argumentTree;
if (!assignmentTree.getVariable().toString().equals(name)) {
continue;
}
ExpressionTree expressionTree = assignmentTree.getExpression();
return expressionTree;
}
return null;
} | java | @Nullable
public static ExpressionTree getArgument(AnnotationTree annotationTree, String name) {
for (ExpressionTree argumentTree : annotationTree.getArguments()) {
if (argumentTree.getKind() != Tree.Kind.ASSIGNMENT) {
continue;
}
AssignmentTree assignmentTree = (AssignmentTree) argumentTree;
if (!assignmentTree.getVariable().toString().equals(name)) {
continue;
}
ExpressionTree expressionTree = assignmentTree.getExpression();
return expressionTree;
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"ExpressionTree",
"getArgument",
"(",
"AnnotationTree",
"annotationTree",
",",
"String",
"name",
")",
"{",
"for",
"(",
"ExpressionTree",
"argumentTree",
":",
"annotationTree",
".",
"getArguments",
"(",
")",
")",
"{",
"if",
"(... | Gets the value for an argument, or null if the argument does not exist.
@param annotationTree the AST node for the annotation
@param name the name of the argument whose value to get
@return the value of the argument, or null if the argument does not exist | [
"Gets",
"the",
"value",
"for",
"an",
"argument",
"or",
"null",
"if",
"the",
"argument",
"does",
"not",
"exist",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/AnnotationMatcherUtils.java#L39-L53 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java | LockedInodePath.lockChild | public LockedInodePath lockChild(Inode child, LockPattern lockPattern)
throws InvalidPathException {
return lockChild(child, lockPattern, addComponent(mPathComponents, child.getName()));
} | java | public LockedInodePath lockChild(Inode child, LockPattern lockPattern)
throws InvalidPathException {
return lockChild(child, lockPattern, addComponent(mPathComponents, child.getName()));
} | [
"public",
"LockedInodePath",
"lockChild",
"(",
"Inode",
"child",
",",
"LockPattern",
"lockPattern",
")",
"throws",
"InvalidPathException",
"{",
"return",
"lockChild",
"(",
"child",
",",
"lockPattern",
",",
"addComponent",
"(",
"mPathComponents",
",",
"child",
".",
... | Returns a new locked inode path composed of the current path plus the child inode. The path is
traversed according to the lock pattern. The original locked inode path is unaffected.
childComponentsHint can be used to save the work of computing path components when the path
components for the new path are already known.
On failure, all locks taken by this method will be released.
@param child the child inode
@param lockPattern the lock pattern
@return the new locked path | [
"Returns",
"a",
"new",
"locked",
"inode",
"path",
"composed",
"of",
"the",
"current",
"path",
"plus",
"the",
"child",
"inode",
".",
"The",
"path",
"is",
"traversed",
"according",
"to",
"the",
"lock",
"pattern",
".",
"The",
"original",
"locked",
"inode",
"p... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java#L381-L384 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/path/ActionPathResolver.java | ActionPathResolver.handleActionPath | public boolean handleActionPath(String requestPath, ActionFoundPathHandler handler) throws Exception {
assertArgumentNotNull("requestPath", requestPath);
assertArgumentNotNull("handler", handler);
final MappingPathResource pathResource = customizeActionMapping(requestPath);
return mappingActionPath(pathResource, handler);
} | java | public boolean handleActionPath(String requestPath, ActionFoundPathHandler handler) throws Exception {
assertArgumentNotNull("requestPath", requestPath);
assertArgumentNotNull("handler", handler);
final MappingPathResource pathResource = customizeActionMapping(requestPath);
return mappingActionPath(pathResource, handler);
} | [
"public",
"boolean",
"handleActionPath",
"(",
"String",
"requestPath",
",",
"ActionFoundPathHandler",
"handler",
")",
"throws",
"Exception",
"{",
"assertArgumentNotNull",
"(",
"\"requestPath\"",
",",
"requestPath",
")",
";",
"assertArgumentNotNull",
"(",
"\"handler\"",
... | Handle the action path from the specified request path.
@param requestPath The request path to be analyzed. (NotNull)
@param handler The handler of the action path when the action is found. (NotNull)
@return Is it actually handled? (false if not found)
@throws Exception When the handler throws or internal process throws. | [
"Handle",
"the",
"action",
"path",
"from",
"the",
"specified",
"request",
"path",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/path/ActionPathResolver.java#L109-L114 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java | DefaultBeanClassBuilder.buildClass | public byte[] buildClass( ClassDefinition classDef, ClassLoader classLoader ) throws IOException,
SecurityException,
IllegalArgumentException,
ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
InstantiationException,
NoSuchFieldException {
ClassWriter cw = this.buildClassHeader( classLoader, classDef );
buildMetaData( cw, classDef );
buildFields( cw, classDef );
if ( classDef.isTraitable() ) {
buildDynamicPropertyMap( cw, classDef );
buildTraitMap( cw, classDef );
buildFieldTMS( cw, classDef );
}
buildConstructors( cw, classDef );
buildGettersAndSetters( cw, classDef );
buildEqualityMethods( cw, classDef );
buildToString( cw, classDef );
if ( classDef.isTraitable() ) {
// must guarantee serialization order when enhancing fields are present
buildSerializationMethods(cw, classDef);
}
if ( classDef.isReactive() ) {
implementReactivity( cw, classDef );
}
cw.visitEnd();
return cw.toByteArray();
} | java | public byte[] buildClass( ClassDefinition classDef, ClassLoader classLoader ) throws IOException,
SecurityException,
IllegalArgumentException,
ClassNotFoundException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
InstantiationException,
NoSuchFieldException {
ClassWriter cw = this.buildClassHeader( classLoader, classDef );
buildMetaData( cw, classDef );
buildFields( cw, classDef );
if ( classDef.isTraitable() ) {
buildDynamicPropertyMap( cw, classDef );
buildTraitMap( cw, classDef );
buildFieldTMS( cw, classDef );
}
buildConstructors( cw, classDef );
buildGettersAndSetters( cw, classDef );
buildEqualityMethods( cw, classDef );
buildToString( cw, classDef );
if ( classDef.isTraitable() ) {
// must guarantee serialization order when enhancing fields are present
buildSerializationMethods(cw, classDef);
}
if ( classDef.isReactive() ) {
implementReactivity( cw, classDef );
}
cw.visitEnd();
return cw.toByteArray();
} | [
"public",
"byte",
"[",
"]",
"buildClass",
"(",
"ClassDefinition",
"classDef",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"IOException",
",",
"SecurityException",
",",
"IllegalArgumentException",
",",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"I... | Dynamically builds, defines and loads a class based on the given class definition
@param classDef the class definition object structure
@return the Class instance for the given class definition
@throws IOException
@throws InvocationTargetException
@throws IllegalAccessException
@throws NoSuchMethodException
@throws ClassNotFoundException
@throws IllegalArgumentException
@throws SecurityException
@throws NoSuchFieldException
@throws InstantiationException | [
"Dynamically",
"builds",
"defines",
"and",
"loads",
"a",
"class",
"based",
"on",
"the",
"given",
"class",
"definition"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L80-L118 |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asConstFunction | public static MatrixFunction asConstFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return arg;
}
};
} | java | public static MatrixFunction asConstFunction(final double arg) {
return new MatrixFunction() {
@Override
public double evaluate(int i, int j, double value) {
return arg;
}
};
} | [
"public",
"static",
"MatrixFunction",
"asConstFunction",
"(",
"final",
"double",
"arg",
")",
"{",
"return",
"new",
"MatrixFunction",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"evaluate",
"(",
"int",
"i",
",",
"int",
"j",
",",
"double",
"value",
"... | Creates a const function that evaluates it's argument to given {@code value}.
@param arg a const value
@return a closure object that does {@code _} | [
"Creates",
"a",
"const",
"function",
"that",
"evaluates",
"it",
"s",
"argument",
"to",
"given",
"{",
"@code",
"value",
"}",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L423-L430 |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.getOrCreateStrand | private static DNAStrand getOrCreateStrand(HashMap<Integer, DNAStrand> strands, int color) {
DNAStrand strand = strands.get(color);
if (strand == null) {
strand = new DNAStrand();
strand.color = color;
strand.count = 0;
strands.put(strand.color, strand);
}
return strand;
} | java | private static DNAStrand getOrCreateStrand(HashMap<Integer, DNAStrand> strands, int color) {
DNAStrand strand = strands.get(color);
if (strand == null) {
strand = new DNAStrand();
strand.color = color;
strand.count = 0;
strands.put(strand.color, strand);
}
return strand;
} | [
"private",
"static",
"DNAStrand",
"getOrCreateStrand",
"(",
"HashMap",
"<",
"Integer",
",",
"DNAStrand",
">",
"strands",
",",
"int",
"color",
")",
"{",
"DNAStrand",
"strand",
"=",
"strands",
".",
"get",
"(",
"color",
")",
";",
"if",
"(",
"strand",
"==",
... | Try to get a strand of the given color. Create it if it doesn't exist. | [
"Try",
"to",
"get",
"a",
"strand",
"of",
"the",
"given",
"color",
".",
"Create",
"it",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | train | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L663-L672 |
apache/incubator-shardingsphere | sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/rule/OrchestrationMasterSlaveRule.java | OrchestrationMasterSlaveRule.updateDisabledDataSourceNames | public void updateDisabledDataSourceNames(final String dataSourceName, final boolean isDisabled) {
if (isDisabled) {
disabledDataSourceNames.add(dataSourceName);
} else {
disabledDataSourceNames.remove(dataSourceName);
}
} | java | public void updateDisabledDataSourceNames(final String dataSourceName, final boolean isDisabled) {
if (isDisabled) {
disabledDataSourceNames.add(dataSourceName);
} else {
disabledDataSourceNames.remove(dataSourceName);
}
} | [
"public",
"void",
"updateDisabledDataSourceNames",
"(",
"final",
"String",
"dataSourceName",
",",
"final",
"boolean",
"isDisabled",
")",
"{",
"if",
"(",
"isDisabled",
")",
"{",
"disabledDataSourceNames",
".",
"add",
"(",
"dataSourceName",
")",
";",
"}",
"else",
... | Update disabled data source names.
@param dataSourceName data source name
@param isDisabled is disabled | [
"Update",
"disabled",
"data",
"source",
"names",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/rule/OrchestrationMasterSlaveRule.java#L61-L67 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.getPropertyValueEnum | public static int getPropertyValueEnum(int property, CharSequence valueAlias) {
int propEnum = UPropertyAliases.INSTANCE.getPropertyValueEnum(property, valueAlias);
if (propEnum == UProperty.UNDEFINED) {
throw new IllegalIcuArgumentException("Invalid name: " + valueAlias);
}
return propEnum;
} | java | public static int getPropertyValueEnum(int property, CharSequence valueAlias) {
int propEnum = UPropertyAliases.INSTANCE.getPropertyValueEnum(property, valueAlias);
if (propEnum == UProperty.UNDEFINED) {
throw new IllegalIcuArgumentException("Invalid name: " + valueAlias);
}
return propEnum;
} | [
"public",
"static",
"int",
"getPropertyValueEnum",
"(",
"int",
"property",
",",
"CharSequence",
"valueAlias",
")",
"{",
"int",
"propEnum",
"=",
"UPropertyAliases",
".",
"INSTANCE",
".",
"getPropertyValueEnum",
"(",
"property",
",",
"valueAlias",
")",
";",
"if",
... | <strong>[icu]</strong> Return the property value integer for a given value name, as
specified in the Unicode database file PropertyValueAliases.txt.
Short, long, and any other variants are recognized.
Note: Some of the names in PropertyValueAliases.txt will only be
recognized with UProperty.GENERAL_CATEGORY_MASK, not
UProperty.GENERAL_CATEGORY. These include: "C" / "Other", "L" /
"Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P"
/ "Punctuation", "S" / "Symbol", and "Z" / "Separator".
@param property UProperty selector constant.
UProperty.INT_START <= property < UProperty.INT_LIMIT or
UProperty.BINARY_START <= property < UProperty.BINARY_LIMIT or
UProperty.MASK_START < = property < UProperty.MASK_LIMIT.
Only these properties can be enumerated.
@param valueAlias the value name to be matched. The name is
compared using "loose matching" as described in
PropertyValueAliases.txt.
@return a value integer. Note: UProperty.GENERAL_CATEGORY
values are mask values produced by left-shifting 1 by
UCharacter.getType(). This allows grouped categories such as
[:L:] to be represented.
@see UProperty
@throws IllegalArgumentException if property is not a valid UProperty
selector or valueAlias is not a value of this property | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Return",
"the",
"property",
"value",
"integer",
"for",
"a",
"given",
"value",
"name",
"as",
"specified",
"in",
"the",
"Unicode",
"database",
"file",
"PropertyValueAliases",
".",
"txt",
".",
"Short"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4215-L4221 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/admin/LocationTypeUrl.java | LocationTypeUrl.getLocationTypeUrl | public static MozuUrl getLocationTypeUrl(String locationTypeCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/admin/locationtypes/{locationTypeCode}?responseFields={responseFields}");
formatter.formatUrl("locationTypeCode", locationTypeCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getLocationTypeUrl(String locationTypeCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/admin/locationtypes/{locationTypeCode}?responseFields={responseFields}");
formatter.formatUrl("locationTypeCode", locationTypeCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getLocationTypeUrl",
"(",
"String",
"locationTypeCode",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/admin/locationtypes/{locationTypeCode}?responseFields={responseFields}... | Get Resource Url for GetLocationType
@param locationTypeCode The user-defined code that identifies the location type.
@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",
"GetLocationType"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/admin/LocationTypeUrl.java#L32-L38 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java | RegistryService.initRegistryEntry | public void initRegistryEntry(String groupName, String entryName) throws RepositoryException,
RepositoryConfigurationException
{
String relPath = EXO_REGISTRY + "/" + groupName + "/" + entryName;
for (RepositoryEntry repConfiguration : repConfigurations())
{
String repName = repConfiguration.getName();
SessionProvider sysProvider = SessionProvider.createSystemProvider();
Node root = session(sysProvider, repositoryService.getRepository(repName)).getRootNode();
if (!root.hasNode(relPath))
{
root.addNode(relPath, EXO_REGISTRYENTRY_NT);
root.save();
}
else
{
LOG.info("The RegistryEntry " + relPath + "is already initialized on repository " + repName);
}
sysProvider.close();
}
} | java | public void initRegistryEntry(String groupName, String entryName) throws RepositoryException,
RepositoryConfigurationException
{
String relPath = EXO_REGISTRY + "/" + groupName + "/" + entryName;
for (RepositoryEntry repConfiguration : repConfigurations())
{
String repName = repConfiguration.getName();
SessionProvider sysProvider = SessionProvider.createSystemProvider();
Node root = session(sysProvider, repositoryService.getRepository(repName)).getRootNode();
if (!root.hasNode(relPath))
{
root.addNode(relPath, EXO_REGISTRYENTRY_NT);
root.save();
}
else
{
LOG.info("The RegistryEntry " + relPath + "is already initialized on repository " + repName);
}
sysProvider.close();
}
} | [
"public",
"void",
"initRegistryEntry",
"(",
"String",
"groupName",
",",
"String",
"entryName",
")",
"throws",
"RepositoryException",
",",
"RepositoryConfigurationException",
"{",
"String",
"relPath",
"=",
"EXO_REGISTRY",
"+",
"\"/\"",
"+",
"groupName",
"+",
"\"/\"",
... | Initializes the registry entry
@param groupName the group entry name
@param entryName the entry name
@throws RepositoryConfigurationException if a configuration issue occurs
@throws RepositoryException if any error occurs | [
"Initializes",
"the",
"registry",
"entry"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java#L588-L609 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.