repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java | ScriptRunner.run | public TaskResponse run(Element m, TaskRequest req) {
"""
Invokes the script defined by the specified element with the specified
<code>TaskRequest</code>.
@param m An <code>Element</code> that defines a Task.
@param req A <code>TaskRequest</code> prepared externally.
@return The <code>TaskResponse</code> that results from invoking the
specified script.
"""
// Assertions.
if (m == null) {
String msg = "Argument 'm [Element]' cannot be null.";
throw new IllegalArgumentException(msg);
}
return run(compileTask(m), req);
} | java | public TaskResponse run(Element m, TaskRequest req) {
// Assertions.
if (m == null) {
String msg = "Argument 'm [Element]' cannot be null.";
throw new IllegalArgumentException(msg);
}
return run(compileTask(m), req);
} | [
"public",
"TaskResponse",
"run",
"(",
"Element",
"m",
",",
"TaskRequest",
"req",
")",
"{",
"// Assertions.",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"Argument 'm [Element]' cannot be null.\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")",
";",
"}",
"return",
"run",
"(",
"compileTask",
"(",
"m",
")",
",",
"req",
")",
";",
"}"
] | Invokes the script defined by the specified element with the specified
<code>TaskRequest</code>.
@param m An <code>Element</code> that defines a Task.
@param req A <code>TaskRequest</code> prepared externally.
@return The <code>TaskResponse</code> that results from invoking the
specified script. | [
"Invokes",
"the",
"script",
"defined",
"by",
"the",
"specified",
"element",
"with",
"the",
"specified",
"<code",
">",
"TaskRequest<",
"/",
"code",
">",
"."
] | train | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java#L171-L181 |
pravega/pravega | controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java | SegmentMonitorLeader.takeLeadership | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
"""
This function is called when the current instance is made the leader. The leadership is relinquished when this
function exits.
@param client The curator client.
@throws Exception On any error. This would result in leadership being relinquished.
"""
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release();
//Start cluster monitor.
pravegaServiceCluster = new ClusterZKImpl(client, ClusterType.HOST);
//Add listener to track host changes on the monitored pravega cluster.
pravegaServiceCluster.addListener((type, host) -> {
switch (type) {
case HOST_ADDED:
case HOST_REMOVED:
//We don't keep track of the hosts and we always query for the entire set from the cluster
//when changes occur. This is to avoid any inconsistencies if we miss any notifications.
log.info("Received event: {} for host: {}. Wake up leader for rebalancing", type, host);
hostsChange.release();
break;
case ERROR:
//This event should be due to ZK connection errors and would have been received by the monitor too,
//hence not handling it explicitly here.
log.info("Received error event when monitoring the pravega host cluster, ignoring...");
break;
}
});
//Keep looping here as long as possible to stay as the leader and exclusively monitor the pravega cluster.
while (true) {
try {
if (suspended.get()) {
log.info("Monitor is suspended, waiting for notification to resume");
suspendMonitor.acquire();
log.info("Resuming monitor");
}
hostsChange.acquire();
log.info("Received rebalance event");
// Wait here until rebalance can be performed.
waitForRebalance();
// Clear all events that has been received until this point since this will be included in the current
// rebalance operation.
hostsChange.drainPermits();
triggerRebalance();
} catch (InterruptedException e) {
log.warn("Leadership interrupted, releasing monitor thread");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
} catch (Exception e) {
//We will not release leadership if in suspended mode.
if (!suspended.get()) {
log.warn("Failed to perform rebalancing, relinquishing leadership");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
}
}
}
} | java | @Override
@Synchronized
public void takeLeadership(CuratorFramework client) throws Exception {
log.info("Obtained leadership to monitor the Host to Segment Container Mapping");
//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.
hostsChange.release();
//Start cluster monitor.
pravegaServiceCluster = new ClusterZKImpl(client, ClusterType.HOST);
//Add listener to track host changes on the monitored pravega cluster.
pravegaServiceCluster.addListener((type, host) -> {
switch (type) {
case HOST_ADDED:
case HOST_REMOVED:
//We don't keep track of the hosts and we always query for the entire set from the cluster
//when changes occur. This is to avoid any inconsistencies if we miss any notifications.
log.info("Received event: {} for host: {}. Wake up leader for rebalancing", type, host);
hostsChange.release();
break;
case ERROR:
//This event should be due to ZK connection errors and would have been received by the monitor too,
//hence not handling it explicitly here.
log.info("Received error event when monitoring the pravega host cluster, ignoring...");
break;
}
});
//Keep looping here as long as possible to stay as the leader and exclusively monitor the pravega cluster.
while (true) {
try {
if (suspended.get()) {
log.info("Monitor is suspended, waiting for notification to resume");
suspendMonitor.acquire();
log.info("Resuming monitor");
}
hostsChange.acquire();
log.info("Received rebalance event");
// Wait here until rebalance can be performed.
waitForRebalance();
// Clear all events that has been received until this point since this will be included in the current
// rebalance operation.
hostsChange.drainPermits();
triggerRebalance();
} catch (InterruptedException e) {
log.warn("Leadership interrupted, releasing monitor thread");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
} catch (Exception e) {
//We will not release leadership if in suspended mode.
if (!suspended.get()) {
log.warn("Failed to perform rebalancing, relinquishing leadership");
//Stop watching the pravega cluster.
pravegaServiceCluster.close();
throw e;
}
}
}
} | [
"@",
"Override",
"@",
"Synchronized",
"public",
"void",
"takeLeadership",
"(",
"CuratorFramework",
"client",
")",
"throws",
"Exception",
"{",
"log",
".",
"info",
"(",
"\"Obtained leadership to monitor the Host to Segment Container Mapping\"",
")",
";",
"//Attempt a rebalance whenever leadership is obtained to ensure no host events are missed.",
"hostsChange",
".",
"release",
"(",
")",
";",
"//Start cluster monitor.",
"pravegaServiceCluster",
"=",
"new",
"ClusterZKImpl",
"(",
"client",
",",
"ClusterType",
".",
"HOST",
")",
";",
"//Add listener to track host changes on the monitored pravega cluster.",
"pravegaServiceCluster",
".",
"addListener",
"(",
"(",
"type",
",",
"host",
")",
"->",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"HOST_ADDED",
":",
"case",
"HOST_REMOVED",
":",
"//We don't keep track of the hosts and we always query for the entire set from the cluster",
"//when changes occur. This is to avoid any inconsistencies if we miss any notifications.",
"log",
".",
"info",
"(",
"\"Received event: {} for host: {}. Wake up leader for rebalancing\"",
",",
"type",
",",
"host",
")",
";",
"hostsChange",
".",
"release",
"(",
")",
";",
"break",
";",
"case",
"ERROR",
":",
"//This event should be due to ZK connection errors and would have been received by the monitor too,",
"//hence not handling it explicitly here.",
"log",
".",
"info",
"(",
"\"Received error event when monitoring the pravega host cluster, ignoring...\"",
")",
";",
"break",
";",
"}",
"}",
")",
";",
"//Keep looping here as long as possible to stay as the leader and exclusively monitor the pravega cluster.",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"if",
"(",
"suspended",
".",
"get",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Monitor is suspended, waiting for notification to resume\"",
")",
";",
"suspendMonitor",
".",
"acquire",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"Resuming monitor\"",
")",
";",
"}",
"hostsChange",
".",
"acquire",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"Received rebalance event\"",
")",
";",
"// Wait here until rebalance can be performed.",
"waitForRebalance",
"(",
")",
";",
"// Clear all events that has been received until this point since this will be included in the current",
"// rebalance operation.",
"hostsChange",
".",
"drainPermits",
"(",
")",
";",
"triggerRebalance",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Leadership interrupted, releasing monitor thread\"",
")",
";",
"//Stop watching the pravega cluster.",
"pravegaServiceCluster",
".",
"close",
"(",
")",
";",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"//We will not release leadership if in suspended mode.",
"if",
"(",
"!",
"suspended",
".",
"get",
"(",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"Failed to perform rebalancing, relinquishing leadership\"",
")",
";",
"//Stop watching the pravega cluster.",
"pravegaServiceCluster",
".",
"close",
"(",
")",
";",
"throw",
"e",
";",
"}",
"}",
"}",
"}"
] | This function is called when the current instance is made the leader. The leadership is relinquished when this
function exits.
@param client The curator client.
@throws Exception On any error. This would result in leadership being relinquished. | [
"This",
"function",
"is",
"called",
"when",
"the",
"current",
"instance",
"is",
"made",
"the",
"leader",
".",
"The",
"leadership",
"is",
"relinquished",
"when",
"this",
"function",
"exits",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/fault/SegmentMonitorLeader.java#L108-L173 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <R> Func0<Observable<R>> toAsync(final Func0<? extends R> func, final Scheduler scheduler) {
"""
Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211792.aspx">MSDN: Observable.ToAsync</a>
"""
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | java | public static <R> Func0<Observable<R>> toAsync(final Func0<? extends R> func, final Scheduler scheduler) {
return new Func0<Observable<R>>() {
@Override
public Observable<R> call() {
return startCallable(func, scheduler);
}
};
} | [
"public",
"static",
"<",
"R",
">",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"toAsync",
"(",
"final",
"Func0",
"<",
"?",
"extends",
"R",
">",
"func",
",",
"final",
"Scheduler",
"scheduler",
")",
"{",
"return",
"new",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"R",
">",
"call",
"(",
")",
"{",
"return",
"startCallable",
"(",
"func",
",",
"scheduler",
")",
";",
"}",
"}",
";",
"}"
] | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh211792.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"toAsync",
".",
"s",
".",
"png",
"alt",
"=",
">"
] | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L779-L786 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxTrash.java | BoxTrash.restoreFolder | public BoxFolder.Info restoreFolder(String folderID) {
"""
Restores a trashed folder back to its original location.
@param folderID the ID of the trashed folder.
@return info about the restored folder.
"""
URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "POST");
JsonObject requestJSON = new JsonObject()
.add("", "");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString());
return restoredFolder.new Info(responseJSON);
} | java | public BoxFolder.Info restoreFolder(String folderID) {
URL url = RESTORE_FOLDER_URL_TEMPLATE.build(this.api.getBaseURL(), folderID);
BoxAPIRequest request = new BoxAPIRequest(this.api, url, "POST");
JsonObject requestJSON = new JsonObject()
.add("", "");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxFolder restoredFolder = new BoxFolder(this.api, responseJSON.get("id").asString());
return restoredFolder.new Info(responseJSON);
} | [
"public",
"BoxFolder",
".",
"Info",
"restoreFolder",
"(",
"String",
"folderID",
")",
"{",
"URL",
"url",
"=",
"RESTORE_FOLDER_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"api",
".",
"getBaseURL",
"(",
")",
",",
"folderID",
")",
";",
"BoxAPIRequest",
"request",
"=",
"new",
"BoxAPIRequest",
"(",
"this",
".",
"api",
",",
"url",
",",
"\"POST\"",
")",
";",
"JsonObject",
"requestJSON",
"=",
"new",
"JsonObject",
"(",
")",
".",
"add",
"(",
"\"\"",
",",
"\"\"",
")",
";",
"request",
".",
"setBody",
"(",
"requestJSON",
".",
"toString",
"(",
")",
")",
";",
"BoxJSONResponse",
"response",
"=",
"(",
"BoxJSONResponse",
")",
"request",
".",
"send",
"(",
")",
";",
"JsonObject",
"responseJSON",
"=",
"JsonObject",
".",
"readFrom",
"(",
"response",
".",
"getJSON",
"(",
")",
")",
";",
"BoxFolder",
"restoredFolder",
"=",
"new",
"BoxFolder",
"(",
"this",
".",
"api",
",",
"responseJSON",
".",
"get",
"(",
"\"id\"",
")",
".",
"asString",
"(",
")",
")",
";",
"return",
"restoredFolder",
".",
"new",
"Info",
"(",
"responseJSON",
")",
";",
"}"
] | Restores a trashed folder back to its original location.
@param folderID the ID of the trashed folder.
@return info about the restored folder. | [
"Restores",
"a",
"trashed",
"folder",
"back",
"to",
"its",
"original",
"location",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxTrash.java#L97-L108 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.validIndex | public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
"""
<p>Validates that the index is within the bounds of the argument
collection; otherwise throwing an exception.</p>
<pre>Validate.validIndex(myCollection, 2);</pre>
<p>If the index is invalid, then the message of the exception
is "The validated collection index is invalid: "
followed by the index.</p>
@param <T> the collection type
@param collection the collection to check, validated not null by this method
@param index the index to check
@return the validated collection (never {@code null} for method chaining)
@throws NullPointerException if the collection is {@code null}
@throws IndexOutOfBoundsException if the index is invalid
@see #validIndex(Collection, int, String, Object...)
@since 3.0
"""
return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, Integer.valueOf(index));
} | java | public static <T extends Collection<?>> T validIndex(final T collection, final int index) {
return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, Integer.valueOf(index));
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"validIndex",
"(",
"final",
"T",
"collection",
",",
"final",
"int",
"index",
")",
"{",
"return",
"validIndex",
"(",
"collection",
",",
"index",
",",
"DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE",
",",
"Integer",
".",
"valueOf",
"(",
"index",
")",
")",
";",
"}"
] | <p>Validates that the index is within the bounds of the argument
collection; otherwise throwing an exception.</p>
<pre>Validate.validIndex(myCollection, 2);</pre>
<p>If the index is invalid, then the message of the exception
is "The validated collection index is invalid: "
followed by the index.</p>
@param <T> the collection type
@param collection the collection to check, validated not null by this method
@param index the index to check
@return the validated collection (never {@code null} for method chaining)
@throws NullPointerException if the collection is {@code null}
@throws IndexOutOfBoundsException if the index is invalid
@see #validIndex(Collection, int, String, Object...)
@since 3.0 | [
"<p",
">",
"Validates",
"that",
"the",
"index",
"is",
"within",
"the",
"bounds",
"of",
"the",
"argument",
"collection",
";",
"otherwise",
"throwing",
"an",
"exception",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L724-L726 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java | NetworkEnvironmentConfiguration.calculateNewNetworkBufferMemory | private static long calculateNewNetworkBufferMemory(Configuration config, long networkBufSize, long maxJvmHeapMemory) {
"""
Calculates the amount of memory used for network buffers based on the total memory to use and
the according configuration parameters.
<p>The following configuration parameters are involved:
<ul>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_FRACTION},</li>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MIN},</li>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MAX}</li>
</ul>.
@param config configuration object
@param networkBufSize memory of network buffers based on JVM memory size and network fraction
@param maxJvmHeapMemory maximum memory used for checking the results of network memory
@return memory to use for network buffers (in bytes)
"""
float networkBufFraction = config.getFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION);
long networkBufMin = MemorySize.parse(config.getString(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN)).getBytes();
long networkBufMax = MemorySize.parse(config.getString(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX)).getBytes();
int pageSize = getPageSize(config);
checkNewNetworkConfig(pageSize, networkBufFraction, networkBufMin, networkBufMax);
long networkBufBytes = Math.min(networkBufMax, Math.max(networkBufMin, networkBufSize));
ConfigurationParserUtils.checkConfigParameter(networkBufBytes < maxJvmHeapMemory,
"(" + networkBufFraction + ", " + networkBufMin + ", " + networkBufMax + ")",
"(" + TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION.key() + ", " +
TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.key() + ", " +
TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key() + ")",
"Network buffer memory size too large: " + networkBufBytes + " >= " +
maxJvmHeapMemory + " (maximum JVM memory size)");
return networkBufBytes;
} | java | private static long calculateNewNetworkBufferMemory(Configuration config, long networkBufSize, long maxJvmHeapMemory) {
float networkBufFraction = config.getFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION);
long networkBufMin = MemorySize.parse(config.getString(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN)).getBytes();
long networkBufMax = MemorySize.parse(config.getString(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX)).getBytes();
int pageSize = getPageSize(config);
checkNewNetworkConfig(pageSize, networkBufFraction, networkBufMin, networkBufMax);
long networkBufBytes = Math.min(networkBufMax, Math.max(networkBufMin, networkBufSize));
ConfigurationParserUtils.checkConfigParameter(networkBufBytes < maxJvmHeapMemory,
"(" + networkBufFraction + ", " + networkBufMin + ", " + networkBufMax + ")",
"(" + TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION.key() + ", " +
TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MIN.key() + ", " +
TaskManagerOptions.NETWORK_BUFFERS_MEMORY_MAX.key() + ")",
"Network buffer memory size too large: " + networkBufBytes + " >= " +
maxJvmHeapMemory + " (maximum JVM memory size)");
return networkBufBytes;
} | [
"private",
"static",
"long",
"calculateNewNetworkBufferMemory",
"(",
"Configuration",
"config",
",",
"long",
"networkBufSize",
",",
"long",
"maxJvmHeapMemory",
")",
"{",
"float",
"networkBufFraction",
"=",
"config",
".",
"getFloat",
"(",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_FRACTION",
")",
";",
"long",
"networkBufMin",
"=",
"MemorySize",
".",
"parse",
"(",
"config",
".",
"getString",
"(",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_MIN",
")",
")",
".",
"getBytes",
"(",
")",
";",
"long",
"networkBufMax",
"=",
"MemorySize",
".",
"parse",
"(",
"config",
".",
"getString",
"(",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_MAX",
")",
")",
".",
"getBytes",
"(",
")",
";",
"int",
"pageSize",
"=",
"getPageSize",
"(",
"config",
")",
";",
"checkNewNetworkConfig",
"(",
"pageSize",
",",
"networkBufFraction",
",",
"networkBufMin",
",",
"networkBufMax",
")",
";",
"long",
"networkBufBytes",
"=",
"Math",
".",
"min",
"(",
"networkBufMax",
",",
"Math",
".",
"max",
"(",
"networkBufMin",
",",
"networkBufSize",
")",
")",
";",
"ConfigurationParserUtils",
".",
"checkConfigParameter",
"(",
"networkBufBytes",
"<",
"maxJvmHeapMemory",
",",
"\"(\"",
"+",
"networkBufFraction",
"+",
"\", \"",
"+",
"networkBufMin",
"+",
"\", \"",
"+",
"networkBufMax",
"+",
"\")\"",
",",
"\"(\"",
"+",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_FRACTION",
".",
"key",
"(",
")",
"+",
"\", \"",
"+",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_MIN",
".",
"key",
"(",
")",
"+",
"\", \"",
"+",
"TaskManagerOptions",
".",
"NETWORK_BUFFERS_MEMORY_MAX",
".",
"key",
"(",
")",
"+",
"\")\"",
",",
"\"Network buffer memory size too large: \"",
"+",
"networkBufBytes",
"+",
"\" >= \"",
"+",
"maxJvmHeapMemory",
"+",
"\" (maximum JVM memory size)\"",
")",
";",
"return",
"networkBufBytes",
";",
"}"
] | Calculates the amount of memory used for network buffers based on the total memory to use and
the according configuration parameters.
<p>The following configuration parameters are involved:
<ul>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_FRACTION},</li>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MIN},</li>
<li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MAX}</li>
</ul>.
@param config configuration object
@param networkBufSize memory of network buffers based on JVM memory size and network fraction
@param maxJvmHeapMemory maximum memory used for checking the results of network memory
@return memory to use for network buffers (in bytes) | [
"Calculates",
"the",
"amount",
"of",
"memory",
"used",
"for",
"network",
"buffers",
"based",
"on",
"the",
"total",
"memory",
"to",
"use",
"and",
"the",
"according",
"configuration",
"parameters",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L278-L298 |
zxing/zxing | core/src/main/java/com/google/zxing/oned/ITFReader.java | ITFReader.validateQuietZone | private void validateQuietZone(BitArray row, int startPattern) throws NotFoundException {
"""
The start & end patterns must be pre/post fixed by a quiet zone. This
zone must be at least 10 times the width of a narrow line. Scan back until
we either get to the start of the barcode or match the necessary number of
quiet zone pixels.
Note: Its assumed the row is reversed when using this method to find
quiet zone after the end pattern.
ref: http://www.barcode-1.net/i25code.html
@param row bit array representing the scanned barcode.
@param startPattern index into row of the start or end pattern.
@throws NotFoundException if the quiet zone cannot be found
"""
int quietCount = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
// if there are not so many pixel at all let's try as many as possible
quietCount = quietCount < startPattern ? quietCount : startPattern;
for (int i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
if (row.get(i)) {
break;
}
quietCount--;
}
if (quietCount != 0) {
// Unable to find the necessary number of quiet zone pixels.
throw NotFoundException.getNotFoundInstance();
}
} | java | private void validateQuietZone(BitArray row, int startPattern) throws NotFoundException {
int quietCount = this.narrowLineWidth * 10; // expect to find this many pixels of quiet zone
// if there are not so many pixel at all let's try as many as possible
quietCount = quietCount < startPattern ? quietCount : startPattern;
for (int i = startPattern - 1; quietCount > 0 && i >= 0; i--) {
if (row.get(i)) {
break;
}
quietCount--;
}
if (quietCount != 0) {
// Unable to find the necessary number of quiet zone pixels.
throw NotFoundException.getNotFoundInstance();
}
} | [
"private",
"void",
"validateQuietZone",
"(",
"BitArray",
"row",
",",
"int",
"startPattern",
")",
"throws",
"NotFoundException",
"{",
"int",
"quietCount",
"=",
"this",
".",
"narrowLineWidth",
"*",
"10",
";",
"// expect to find this many pixels of quiet zone",
"// if there are not so many pixel at all let's try as many as possible",
"quietCount",
"=",
"quietCount",
"<",
"startPattern",
"?",
"quietCount",
":",
"startPattern",
";",
"for",
"(",
"int",
"i",
"=",
"startPattern",
"-",
"1",
";",
"quietCount",
">",
"0",
"&&",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"row",
".",
"get",
"(",
"i",
")",
")",
"{",
"break",
";",
"}",
"quietCount",
"--",
";",
"}",
"if",
"(",
"quietCount",
"!=",
"0",
")",
"{",
"// Unable to find the necessary number of quiet zone pixels.",
"throw",
"NotFoundException",
".",
"getNotFoundInstance",
"(",
")",
";",
"}",
"}"
] | The start & end patterns must be pre/post fixed by a quiet zone. This
zone must be at least 10 times the width of a narrow line. Scan back until
we either get to the start of the barcode or match the necessary number of
quiet zone pixels.
Note: Its assumed the row is reversed when using this method to find
quiet zone after the end pattern.
ref: http://www.barcode-1.net/i25code.html
@param row bit array representing the scanned barcode.
@param startPattern index into row of the start or end pattern.
@throws NotFoundException if the quiet zone cannot be found | [
"The",
"start",
"&",
"end",
"patterns",
"must",
"be",
"pre",
"/",
"post",
"fixed",
"by",
"a",
"quiet",
"zone",
".",
"This",
"zone",
"must",
"be",
"at",
"least",
"10",
"times",
"the",
"width",
"of",
"a",
"narrow",
"line",
".",
"Scan",
"back",
"until",
"we",
"either",
"get",
"to",
"the",
"start",
"of",
"the",
"barcode",
"or",
"match",
"the",
"necessary",
"number",
"of",
"quiet",
"zone",
"pixels",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/ITFReader.java#L228-L245 |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java | L2Cache.get | public Entity get(Repository<Entity> repository, Object id) {
"""
Retrieves an entity from the cache or the underlying repository.
@param repository the underlying repository
@param id the ID of the entity to retrieve
@return the retrieved Entity, or null if the entity is not present.
@throws com.google.common.util.concurrent.UncheckedExecutionException if the repository throws
an error when loading the entity
"""
LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository);
EntityType entityType = repository.getEntityType();
return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null);
} | java | public Entity get(Repository<Entity> repository, Object id) {
LoadingCache<Object, Optional<Map<String, Object>>> cache = getEntityCache(repository);
EntityType entityType = repository.getEntityType();
return cache.getUnchecked(id).map(e -> entityHydration.hydrate(e, entityType)).orElse(null);
} | [
"public",
"Entity",
"get",
"(",
"Repository",
"<",
"Entity",
">",
"repository",
",",
"Object",
"id",
")",
"{",
"LoadingCache",
"<",
"Object",
",",
"Optional",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
">",
"cache",
"=",
"getEntityCache",
"(",
"repository",
")",
";",
"EntityType",
"entityType",
"=",
"repository",
".",
"getEntityType",
"(",
")",
";",
"return",
"cache",
".",
"getUnchecked",
"(",
"id",
")",
".",
"map",
"(",
"e",
"->",
"entityHydration",
".",
"hydrate",
"(",
"e",
",",
"entityType",
")",
")",
".",
"orElse",
"(",
"null",
")",
";",
"}"
] | Retrieves an entity from the cache or the underlying repository.
@param repository the underlying repository
@param id the ID of the entity to retrieve
@return the retrieved Entity, or null if the entity is not present.
@throws com.google.common.util.concurrent.UncheckedExecutionException if the repository throws
an error when loading the entity | [
"Retrieves",
"an",
"entity",
"from",
"the",
"cache",
"or",
"the",
"underlying",
"repository",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l2/L2Cache.java#L87-L91 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.importKeyAsync | public ServiceFuture<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags, final ServiceCallback<KeyBundle> serviceCallback) {
"""
Imports an externally created key, stores it, and returns key parameters and attributes to the client.
The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName Name for the imported key.
@param key The Json web key
@param hsm Whether to import as a hardware key (HSM) or software key.
@param keyAttributes The key management attributes.
@param tags Application specific metadata in the form of key-value pairs.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags), serviceCallback);
} | java | public ServiceFuture<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key, Boolean hsm, KeyAttributes keyAttributes, Map<String, String> tags, final ServiceCallback<KeyBundle> serviceCallback) {
return ServiceFuture.fromResponse(importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key, hsm, keyAttributes, tags), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"KeyBundle",
">",
"importKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"JsonWebKey",
"key",
",",
"Boolean",
"hsm",
",",
"KeyAttributes",
"keyAttributes",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
",",
"final",
"ServiceCallback",
"<",
"KeyBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"importKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"key",
",",
"hsm",
",",
"keyAttributes",
",",
"tags",
")",
",",
"serviceCallback",
")",
";",
"}"
] | Imports an externally created key, stores it, and returns key parameters and attributes to the client.
The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName Name for the imported key.
@param key The Json web key
@param hsm Whether to import as a hardware key (HSM) or software key.
@param keyAttributes The key management attributes.
@param tags Application specific metadata in the form of key-value pairs.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Imports",
"an",
"externally",
"created",
"key",
"stores",
"it",
"and",
"returns",
"key",
"parameters",
"and",
"attributes",
"to",
"the",
"client",
".",
"The",
"import",
"key",
"operation",
"may",
"be",
"used",
"to",
"import",
"any",
"key",
"type",
"into",
"an",
"Azure",
"Key",
"Vault",
".",
"If",
"the",
"named",
"key",
"already",
"exists",
"Azure",
"Key",
"Vault",
"creates",
"a",
"new",
"version",
"of",
"the",
"key",
".",
"This",
"operation",
"requires",
"the",
"keys",
"/",
"import",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L994-L996 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java | DubiousListCollection.getFieldFromStack | @Nullable
private static XField getFieldFromStack(final OpcodeStack stk, final String signature) {
"""
return the field object that the current method was called on, by finding the
reference down in the stack based on the number of parameters
@param stk the opcode stack where fields are stored
@param signature the signature of the called method
@return the field annotation for the field whose method was executed
"""
int parmCount = SignatureUtils.getNumParameters(signature);
if (stk.getStackDepth() > parmCount) {
OpcodeStack.Item itm = stk.getStackItem(parmCount);
return itm.getXField();
}
return null;
} | java | @Nullable
private static XField getFieldFromStack(final OpcodeStack stk, final String signature) {
int parmCount = SignatureUtils.getNumParameters(signature);
if (stk.getStackDepth() > parmCount) {
OpcodeStack.Item itm = stk.getStackItem(parmCount);
return itm.getXField();
}
return null;
} | [
"@",
"Nullable",
"private",
"static",
"XField",
"getFieldFromStack",
"(",
"final",
"OpcodeStack",
"stk",
",",
"final",
"String",
"signature",
")",
"{",
"int",
"parmCount",
"=",
"SignatureUtils",
".",
"getNumParameters",
"(",
"signature",
")",
";",
"if",
"(",
"stk",
".",
"getStackDepth",
"(",
")",
">",
"parmCount",
")",
"{",
"OpcodeStack",
".",
"Item",
"itm",
"=",
"stk",
".",
"getStackItem",
"(",
"parmCount",
")",
";",
"return",
"itm",
".",
"getXField",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | return the field object that the current method was called on, by finding the
reference down in the stack based on the number of parameters
@param stk the opcode stack where fields are stored
@param signature the signature of the called method
@return the field annotation for the field whose method was executed | [
"return",
"the",
"field",
"object",
"that",
"the",
"current",
"method",
"was",
"called",
"on",
"by",
"finding",
"the",
"reference",
"down",
"in",
"the",
"stack",
"based",
"on",
"the",
"number",
"of",
"parameters"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java#L229-L237 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readNormalDay | private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay) {
"""
This method extracts data for a normal working day from an MSPDI file.
@param calendar Calendar data
@param weekDay Day data
"""
int dayNumber = weekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking()));
ProjectCalendarHours hours = calendar.addCalendarHours(day);
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
} | java | private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay)
{
int dayNumber = weekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking()));
ProjectCalendarHours hours = calendar.addCalendarHours(day);
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
} | [
"private",
"void",
"readNormalDay",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"weekDay",
")",
"{",
"int",
"dayNumber",
"=",
"weekDay",
".",
"getDayType",
"(",
")",
".",
"intValue",
"(",
")",
";",
"Day",
"day",
"=",
"Day",
".",
"getInstance",
"(",
"dayNumber",
")",
";",
"calendar",
".",
"setWorkingDay",
"(",
"day",
",",
"BooleanHelper",
".",
"getBoolean",
"(",
"weekDay",
".",
"isDayWorking",
"(",
")",
")",
")",
";",
"ProjectCalendarHours",
"hours",
"=",
"calendar",
".",
"addCalendarHours",
"(",
"day",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
"times",
"=",
"weekDay",
".",
"getWorkingTimes",
"(",
")",
";",
"if",
"(",
"times",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
".",
"WorkingTime",
"period",
":",
"times",
".",
"getWorkingTime",
"(",
")",
")",
"{",
"Date",
"startTime",
"=",
"period",
".",
"getFromTime",
"(",
")",
";",
"Date",
"endTime",
"=",
"period",
".",
"getToTime",
"(",
")",
";",
"if",
"(",
"startTime",
"!=",
"null",
"&&",
"endTime",
"!=",
"null",
")",
"{",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">=",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"hours",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"}",
"}",
"}",
"}"
] | This method extracts data for a normal working day from an MSPDI file.
@param calendar Calendar data
@param weekDay Day data | [
"This",
"method",
"extracts",
"data",
"for",
"a",
"normal",
"working",
"day",
"from",
"an",
"MSPDI",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L516-L542 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReceiptTemplateBuilder.java | ReceiptTemplateBuilder.addQuickReply | public ReceiptTemplateBuilder addQuickReply(String title, String payload) {
"""
Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a>
"""
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public ReceiptTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"ReceiptTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReceiptTemplateBuilder.java#L245-L248 |
Appendium/objectlabkit | datecalc-jdk8/src/main/java/net/objectlab/kit/datecalc/jdk8/Jdk8WorkingWeek.java | Jdk8WorkingWeek.withWorkingDayFromDateTimeConstant | public Jdk8WorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, final DayOfWeek givenDayOfWeek) {
"""
Return a new JodaWorkingWeek if the status for the given day has changed.
@param working
true if working day
@param givenDayOfWeek
e.g. DateTimeConstants.MONDAY, DateTimeConstants.TUESDAY, etc
"""
final int dayOfWeek = jdk8ToCalendarDayConstant(givenDayOfWeek);
return new Jdk8WorkingWeek(super.withWorkingDayFromCalendar(working, dayOfWeek));
} | java | public Jdk8WorkingWeek withWorkingDayFromDateTimeConstant(final boolean working, final DayOfWeek givenDayOfWeek) {
final int dayOfWeek = jdk8ToCalendarDayConstant(givenDayOfWeek);
return new Jdk8WorkingWeek(super.withWorkingDayFromCalendar(working, dayOfWeek));
} | [
"public",
"Jdk8WorkingWeek",
"withWorkingDayFromDateTimeConstant",
"(",
"final",
"boolean",
"working",
",",
"final",
"DayOfWeek",
"givenDayOfWeek",
")",
"{",
"final",
"int",
"dayOfWeek",
"=",
"jdk8ToCalendarDayConstant",
"(",
"givenDayOfWeek",
")",
";",
"return",
"new",
"Jdk8WorkingWeek",
"(",
"super",
".",
"withWorkingDayFromCalendar",
"(",
"working",
",",
"dayOfWeek",
")",
")",
";",
"}"
] | Return a new JodaWorkingWeek if the status for the given day has changed.
@param working
true if working day
@param givenDayOfWeek
e.g. DateTimeConstants.MONDAY, DateTimeConstants.TUESDAY, etc | [
"Return",
"a",
"new",
"JodaWorkingWeek",
"if",
"the",
"status",
"for",
"the",
"given",
"day",
"has",
"changed",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-jdk8/src/main/java/net/objectlab/kit/datecalc/jdk8/Jdk8WorkingWeek.java#L84-L87 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.java | CMakeAnalyzer.analyzeSetVersionCommand | private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) {
"""
Extracts the version information from the contents. If more then one
version is found additional dependencies are added to the dependency
list.
@param dependency the dependency being analyzed
@param engine the dependency-check engine
@param contents the version information
"""
Dependency currentDep = dependency;
final Matcher m = SET_VERSION.matcher(contents);
int count = 0;
while (m.find()) {
count++;
LOGGER.debug("Found project command match with {} groups: {}",
m.groupCount(), m.group(0));
String product = m.group(1);
final String version = m.group(2);
LOGGER.debug("Group 1: {}", product);
LOGGER.debug("Group 2: {}", version);
final String aliasPrefix = "ALIASOF_";
if (product.startsWith(aliasPrefix)) {
product = product.replaceFirst(aliasPrefix, "");
}
if (count > 1) {
//TODO - refactor so we do not assign to the parameter (checkstyle)
currentDep = new Dependency(dependency.getActualFile());
currentDep.setEcosystem(DEPENDENCY_ECOSYSTEM);
final String filePath = String.format("%s:%s", dependency.getFilePath(), product);
currentDep.setFilePath(filePath);
currentDep.setSha1sum(Checksum.getSHA1Checksum(filePath));
currentDep.setSha256sum(Checksum.getSHA256Checksum(filePath));
currentDep.setMd5sum(Checksum.getMD5Checksum(filePath));
engine.addDependency(currentDep);
}
final String source = currentDep.getFileName();
currentDep.addEvidence(EvidenceType.PRODUCT, source, "Product", product, Confidence.MEDIUM);
currentDep.addEvidence(EvidenceType.VENDOR, source, "Vendor", product, Confidence.MEDIUM);
currentDep.addEvidence(EvidenceType.VERSION, source, "Version", version, Confidence.MEDIUM);
currentDep.setName(product);
currentDep.setVersion(version);
}
LOGGER.debug("Found {} matches.", count);
} | java | private void analyzeSetVersionCommand(Dependency dependency, Engine engine, String contents) {
Dependency currentDep = dependency;
final Matcher m = SET_VERSION.matcher(contents);
int count = 0;
while (m.find()) {
count++;
LOGGER.debug("Found project command match with {} groups: {}",
m.groupCount(), m.group(0));
String product = m.group(1);
final String version = m.group(2);
LOGGER.debug("Group 1: {}", product);
LOGGER.debug("Group 2: {}", version);
final String aliasPrefix = "ALIASOF_";
if (product.startsWith(aliasPrefix)) {
product = product.replaceFirst(aliasPrefix, "");
}
if (count > 1) {
//TODO - refactor so we do not assign to the parameter (checkstyle)
currentDep = new Dependency(dependency.getActualFile());
currentDep.setEcosystem(DEPENDENCY_ECOSYSTEM);
final String filePath = String.format("%s:%s", dependency.getFilePath(), product);
currentDep.setFilePath(filePath);
currentDep.setSha1sum(Checksum.getSHA1Checksum(filePath));
currentDep.setSha256sum(Checksum.getSHA256Checksum(filePath));
currentDep.setMd5sum(Checksum.getMD5Checksum(filePath));
engine.addDependency(currentDep);
}
final String source = currentDep.getFileName();
currentDep.addEvidence(EvidenceType.PRODUCT, source, "Product", product, Confidence.MEDIUM);
currentDep.addEvidence(EvidenceType.VENDOR, source, "Vendor", product, Confidence.MEDIUM);
currentDep.addEvidence(EvidenceType.VERSION, source, "Version", version, Confidence.MEDIUM);
currentDep.setName(product);
currentDep.setVersion(version);
}
LOGGER.debug("Found {} matches.", count);
} | [
"private",
"void",
"analyzeSetVersionCommand",
"(",
"Dependency",
"dependency",
",",
"Engine",
"engine",
",",
"String",
"contents",
")",
"{",
"Dependency",
"currentDep",
"=",
"dependency",
";",
"final",
"Matcher",
"m",
"=",
"SET_VERSION",
".",
"matcher",
"(",
"contents",
")",
";",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"count",
"++",
";",
"LOGGER",
".",
"debug",
"(",
"\"Found project command match with {} groups: {}\"",
",",
"m",
".",
"groupCount",
"(",
")",
",",
"m",
".",
"group",
"(",
"0",
")",
")",
";",
"String",
"product",
"=",
"m",
".",
"group",
"(",
"1",
")",
";",
"final",
"String",
"version",
"=",
"m",
".",
"group",
"(",
"2",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Group 1: {}\"",
",",
"product",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Group 2: {}\"",
",",
"version",
")",
";",
"final",
"String",
"aliasPrefix",
"=",
"\"ALIASOF_\"",
";",
"if",
"(",
"product",
".",
"startsWith",
"(",
"aliasPrefix",
")",
")",
"{",
"product",
"=",
"product",
".",
"replaceFirst",
"(",
"aliasPrefix",
",",
"\"\"",
")",
";",
"}",
"if",
"(",
"count",
">",
"1",
")",
"{",
"//TODO - refactor so we do not assign to the parameter (checkstyle)",
"currentDep",
"=",
"new",
"Dependency",
"(",
"dependency",
".",
"getActualFile",
"(",
")",
")",
";",
"currentDep",
".",
"setEcosystem",
"(",
"DEPENDENCY_ECOSYSTEM",
")",
";",
"final",
"String",
"filePath",
"=",
"String",
".",
"format",
"(",
"\"%s:%s\"",
",",
"dependency",
".",
"getFilePath",
"(",
")",
",",
"product",
")",
";",
"currentDep",
".",
"setFilePath",
"(",
"filePath",
")",
";",
"currentDep",
".",
"setSha1sum",
"(",
"Checksum",
".",
"getSHA1Checksum",
"(",
"filePath",
")",
")",
";",
"currentDep",
".",
"setSha256sum",
"(",
"Checksum",
".",
"getSHA256Checksum",
"(",
"filePath",
")",
")",
";",
"currentDep",
".",
"setMd5sum",
"(",
"Checksum",
".",
"getMD5Checksum",
"(",
"filePath",
")",
")",
";",
"engine",
".",
"addDependency",
"(",
"currentDep",
")",
";",
"}",
"final",
"String",
"source",
"=",
"currentDep",
".",
"getFileName",
"(",
")",
";",
"currentDep",
".",
"addEvidence",
"(",
"EvidenceType",
".",
"PRODUCT",
",",
"source",
",",
"\"Product\"",
",",
"product",
",",
"Confidence",
".",
"MEDIUM",
")",
";",
"currentDep",
".",
"addEvidence",
"(",
"EvidenceType",
".",
"VENDOR",
",",
"source",
",",
"\"Vendor\"",
",",
"product",
",",
"Confidence",
".",
"MEDIUM",
")",
";",
"currentDep",
".",
"addEvidence",
"(",
"EvidenceType",
".",
"VERSION",
",",
"source",
",",
"\"Version\"",
",",
"version",
",",
"Confidence",
".",
"MEDIUM",
")",
";",
"currentDep",
".",
"setName",
"(",
"product",
")",
";",
"currentDep",
".",
"setVersion",
"(",
"version",
")",
";",
"}",
"LOGGER",
".",
"debug",
"(",
"\"Found {} matches.\"",
",",
"count",
")",
";",
"}"
] | Extracts the version information from the contents. If more then one
version is found additional dependencies are added to the dependency
list.
@param dependency the dependency being analyzed
@param engine the dependency-check engine
@param contents the version information | [
"Extracts",
"the",
"version",
"information",
"from",
"the",
"contents",
".",
"If",
"more",
"then",
"one",
"version",
"is",
"found",
"additional",
"dependencies",
"are",
"added",
"to",
"the",
"dependency",
"list",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/CMakeAnalyzer.java#L186-L223 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.nameIncrDecr | @Deprecated
public static Object nameIncrDecr(Scriptable scopeChain, String id,
int incrDecrMask) {
"""
The method is only present for compatibility.
@deprecated Use {@link #nameIncrDecr(Scriptable, String, Context, int)} instead
"""
return nameIncrDecr(scopeChain, id, Context.getContext(), incrDecrMask);
} | java | @Deprecated
public static Object nameIncrDecr(Scriptable scopeChain, String id,
int incrDecrMask)
{
return nameIncrDecr(scopeChain, id, Context.getContext(), incrDecrMask);
} | [
"@",
"Deprecated",
"public",
"static",
"Object",
"nameIncrDecr",
"(",
"Scriptable",
"scopeChain",
",",
"String",
"id",
",",
"int",
"incrDecrMask",
")",
"{",
"return",
"nameIncrDecr",
"(",
"scopeChain",
",",
"id",
",",
"Context",
".",
"getContext",
"(",
")",
",",
"incrDecrMask",
")",
";",
"}"
] | The method is only present for compatibility.
@deprecated Use {@link #nameIncrDecr(Scriptable, String, Context, int)} instead | [
"The",
"method",
"is",
"only",
"present",
"for",
"compatibility",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L2963-L2968 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.orthoSymmetricLH | public Matrix4x3f orthoSymmetricLH(float width, float height, float zNear, float zFar) {
"""
Apply a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix.
<p>
This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float) orthoLH()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to a symmetric orthographic projection without post-multiplying it,
use {@link #setOrthoSymmetricLH(float, float, float, float) setOrthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoSymmetricLH(float, float, float, float)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this
"""
return orthoSymmetricLH(width, height, zNear, zFar, false, this);
} | java | public Matrix4x3f orthoSymmetricLH(float width, float height, float zNear, float zFar) {
return orthoSymmetricLH(width, height, zNear, zFar, false, this);
} | [
"public",
"Matrix4x3f",
"orthoSymmetricLH",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
")",
"{",
"return",
"orthoSymmetricLH",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
",",
"this",
")",
";",
"}"
] | Apply a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix.
<p>
This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float) orthoLH()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to a symmetric orthographic projection without post-multiplying it,
use {@link #setOrthoSymmetricLH(float, float, float, float) setOrthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoSymmetricLH(float, float, float, float)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Apply",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/",
"code",
">",
"to",
"this",
"matrix",
".",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
"{",
"@link",
"#orthoLH",
"(",
"float",
"float",
"float",
"float",
"float",
"float",
")",
"orthoLH",
"()",
"}",
"with",
"<code",
">",
"left",
"=",
"-",
"width",
"/",
"2<",
"/",
"code",
">",
"<code",
">",
"right",
"=",
"+",
"width",
"/",
"2<",
"/",
"code",
">",
"<code",
">",
"bottom",
"=",
"-",
"height",
"/",
"2<",
"/",
"code",
">",
"and",
"<code",
">",
"top",
"=",
"+",
"height",
"/",
"2<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"O<",
"/",
"code",
">",
"the",
"orthographic",
"projection",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"O<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"O",
"*",
"v<",
"/",
"code",
">",
"the",
"orthographic",
"projection",
"transformation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"In",
"order",
"to",
"set",
"the",
"matrix",
"to",
"a",
"symmetric",
"orthographic",
"projection",
"without",
"post",
"-",
"multiplying",
"it",
"use",
"{",
"@link",
"#setOrthoSymmetricLH",
"(",
"float",
"float",
"float",
"float",
")",
"setOrthoSymmetricLH",
"()",
"}",
".",
"<p",
">",
"Reference",
":",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"songho",
".",
"ca",
"/",
"opengl",
"/",
"gl_projectionmatrix",
".",
"html#ortho",
">",
"http",
":",
"//",
"www",
".",
"songho",
".",
"ca<",
"/",
"a",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5520-L5522 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getMetadataWithChildren | public DbxEntry./*@Nullable*/WithChildren getMetadataWithChildren(String path, boolean includeMediaInfo)
throws DbxException {
"""
Get the metadata for a given path; if the path refers to a folder,
get all the children's metadata as well.
<pre>
DbxClientV1 dbxClient = ...
DbxEntry entry = dbxClient.getMetadata("/Photos");
if (entry == null) {
System.out.println("No file or folder at that path.");
} else {
System.out.print(entry.toStringMultiline());
}
</pre>
@param path
The path (starting with "/") to the file or folder (see {@link DbxPathV1}).
@param includeMediaInfo
If {@code true}, then if the return value is a {@link DbxEntry.File}, it might have
its {@code photoInfo} and {@code mediaInfo} fields filled in.
@return If there is no file or folder at the given path, return {@code null}.
Otherwise, return the metadata for that path and the metadata for all its immediate
children (if it's a folder).
"""
return getMetadataWithChildrenBase(path, includeMediaInfo, DbxEntry.WithChildren.ReaderMaybeDeleted);
} | java | public DbxEntry./*@Nullable*/WithChildren getMetadataWithChildren(String path, boolean includeMediaInfo)
throws DbxException
{
return getMetadataWithChildrenBase(path, includeMediaInfo, DbxEntry.WithChildren.ReaderMaybeDeleted);
} | [
"public",
"DbxEntry",
".",
"/*@Nullable*/",
"WithChildren",
"getMetadataWithChildren",
"(",
"String",
"path",
",",
"boolean",
"includeMediaInfo",
")",
"throws",
"DbxException",
"{",
"return",
"getMetadataWithChildrenBase",
"(",
"path",
",",
"includeMediaInfo",
",",
"DbxEntry",
".",
"WithChildren",
".",
"ReaderMaybeDeleted",
")",
";",
"}"
] | Get the metadata for a given path; if the path refers to a folder,
get all the children's metadata as well.
<pre>
DbxClientV1 dbxClient = ...
DbxEntry entry = dbxClient.getMetadata("/Photos");
if (entry == null) {
System.out.println("No file or folder at that path.");
} else {
System.out.print(entry.toStringMultiline());
}
</pre>
@param path
The path (starting with "/") to the file or folder (see {@link DbxPathV1}).
@param includeMediaInfo
If {@code true}, then if the return value is a {@link DbxEntry.File}, it might have
its {@code photoInfo} and {@code mediaInfo} fields filled in.
@return If there is no file or folder at the given path, return {@code null}.
Otherwise, return the metadata for that path and the metadata for all its immediate
children (if it's a folder). | [
"Get",
"the",
"metadata",
"for",
"a",
"given",
"path",
";",
"if",
"the",
"path",
"refers",
"to",
"a",
"folder",
"get",
"all",
"the",
"children",
"s",
"metadata",
"as",
"well",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L174-L178 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.put | public void put(E el, P pseudo, D data) {
"""
Sets the data for the specified element and pseudo-element.
@param el the element to which the data belongs
@param pseudo a pseudo-element or null of none is required
@param data data to be set
"""
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
}
map.put(pseudo, data);
}
} | java | public void put(E el, P pseudo, D data)
{
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
}
map.put(pseudo, data);
}
} | [
"public",
"void",
"put",
"(",
"E",
"el",
",",
"P",
"pseudo",
",",
"D",
"data",
")",
"{",
"if",
"(",
"pseudo",
"==",
"null",
")",
"mainMap",
".",
"put",
"(",
"el",
",",
"data",
")",
";",
"else",
"{",
"HashMap",
"<",
"P",
",",
"D",
">",
"map",
"=",
"pseudoMaps",
".",
"get",
"(",
"el",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"map",
"=",
"new",
"HashMap",
"<",
"P",
",",
"D",
">",
"(",
")",
";",
"pseudoMaps",
".",
"put",
"(",
"el",
",",
"map",
")",
";",
"}",
"map",
".",
"put",
"(",
"pseudo",
",",
"data",
")",
";",
"}",
"}"
] | Sets the data for the specified element and pseudo-element.
@param el the element to which the data belongs
@param pseudo a pseudo-element or null of none is required
@param data data to be set | [
"Sets",
"the",
"data",
"for",
"the",
"specified",
"element",
"and",
"pseudo",
"-",
"element",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L134-L148 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java | Emitter._emitMarkedLines | private void _emitMarkedLines (final MarkdownHCStack aOut, final Line aLines) {
"""
Writes a set of markdown lines into the StringBuilder.
@param aOut
The StringBuilder to write to.
@param aLines
The lines to write.
"""
final StringBuilder aIn = new StringBuilder ();
Line aLine = aLines;
while (aLine != null)
{
if (!aLine.m_bIsEmpty)
{
aIn.append (aLine.m_sValue.substring (aLine.m_nLeading, aLine.m_sValue.length () - aLine.m_nTrailing));
if (aLine.m_nTrailing >= 2 && !m_bConvertNewline2Br)
aIn.append ("<br />");
}
if (aLine.m_aNext != null)
{
aIn.append ('\n');
if (m_bConvertNewline2Br)
aIn.append ("<br />");
}
aLine = aLine.m_aNext;
}
_recursiveEmitLine (aOut, aIn.toString (), 0, EMarkToken.NONE);
} | java | private void _emitMarkedLines (final MarkdownHCStack aOut, final Line aLines)
{
final StringBuilder aIn = new StringBuilder ();
Line aLine = aLines;
while (aLine != null)
{
if (!aLine.m_bIsEmpty)
{
aIn.append (aLine.m_sValue.substring (aLine.m_nLeading, aLine.m_sValue.length () - aLine.m_nTrailing));
if (aLine.m_nTrailing >= 2 && !m_bConvertNewline2Br)
aIn.append ("<br />");
}
if (aLine.m_aNext != null)
{
aIn.append ('\n');
if (m_bConvertNewline2Br)
aIn.append ("<br />");
}
aLine = aLine.m_aNext;
}
_recursiveEmitLine (aOut, aIn.toString (), 0, EMarkToken.NONE);
} | [
"private",
"void",
"_emitMarkedLines",
"(",
"final",
"MarkdownHCStack",
"aOut",
",",
"final",
"Line",
"aLines",
")",
"{",
"final",
"StringBuilder",
"aIn",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Line",
"aLine",
"=",
"aLines",
";",
"while",
"(",
"aLine",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"aLine",
".",
"m_bIsEmpty",
")",
"{",
"aIn",
".",
"append",
"(",
"aLine",
".",
"m_sValue",
".",
"substring",
"(",
"aLine",
".",
"m_nLeading",
",",
"aLine",
".",
"m_sValue",
".",
"length",
"(",
")",
"-",
"aLine",
".",
"m_nTrailing",
")",
")",
";",
"if",
"(",
"aLine",
".",
"m_nTrailing",
">=",
"2",
"&&",
"!",
"m_bConvertNewline2Br",
")",
"aIn",
".",
"append",
"(",
"\"<br />\"",
")",
";",
"}",
"if",
"(",
"aLine",
".",
"m_aNext",
"!=",
"null",
")",
"{",
"aIn",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"m_bConvertNewline2Br",
")",
"aIn",
".",
"append",
"(",
"\"<br />\"",
")",
";",
"}",
"aLine",
"=",
"aLine",
".",
"m_aNext",
";",
"}",
"_recursiveEmitLine",
"(",
"aOut",
",",
"aIn",
".",
"toString",
"(",
")",
",",
"0",
",",
"EMarkToken",
".",
"NONE",
")",
";",
"}"
] | Writes a set of markdown lines into the StringBuilder.
@param aOut
The StringBuilder to write to.
@param aLines
The lines to write. | [
"Writes",
"a",
"set",
"of",
"markdown",
"lines",
"into",
"the",
"StringBuilder",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java#L955-L977 |
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.mapFirst | public LongStreamEx mapFirst(LongUnaryOperator mapper) {
"""
Returns a stream where the first element is the replaced with the result
of applying the given function while the other elements are left intact.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param mapper a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to apply to the first element
@return the new stream
@since 0.4.1
"""
return delegate(new PairSpliterator.PSOfLong((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | java | public LongStreamEx mapFirst(LongUnaryOperator mapper) {
return delegate(new PairSpliterator.PSOfLong((a, b) -> b, mapper, spliterator(),
PairSpliterator.MODE_MAP_FIRST));
} | [
"public",
"LongStreamEx",
"mapFirst",
"(",
"LongUnaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfLong",
"(",
"(",
"a",
",",
"b",
")",
"->",
"b",
",",
"mapper",
",",
"spliterator",
"(",
")",
",",
"PairSpliterator",
".",
"MODE_MAP_FIRST",
")",
")",
";",
"}"
] | Returns a stream where the first element is the replaced with the result
of applying the given function while the other elements are left intact.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
@param mapper a
<a href="package-summary.html#NonInterference">non-interfering
</a>, <a href="package-summary.html#Statelessness">stateless</a>
function to apply to the first element
@return the new stream
@since 0.4.1 | [
"Returns",
"a",
"stream",
"where",
"the",
"first",
"element",
"is",
"the",
"replaced",
"with",
"the",
"result",
"of",
"applying",
"the",
"given",
"function",
"while",
"the",
"other",
"elements",
"are",
"left",
"intact",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L234-L237 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/hook/AmLogServerEndPoint.java | AmLogServerEndPoint.onClose | @OnClose
public void onClose(Session session, CloseReason closeReason) {
"""
Websocket connection close.
@param session session
@param closeReason closeReason
"""
logger.info("WebSocket closed. : SessionId={}, Reason={}", session.getId(),
closeReason.toString());
AmLogServerAdapter.getInstance().onClose(session);
} | java | @OnClose
public void onClose(Session session, CloseReason closeReason)
{
logger.info("WebSocket closed. : SessionId={}, Reason={}", session.getId(),
closeReason.toString());
AmLogServerAdapter.getInstance().onClose(session);
} | [
"@",
"OnClose",
"public",
"void",
"onClose",
"(",
"Session",
"session",
",",
"CloseReason",
"closeReason",
")",
"{",
"logger",
".",
"info",
"(",
"\"WebSocket closed. : SessionId={}, Reason={}\"",
",",
"session",
".",
"getId",
"(",
")",
",",
"closeReason",
".",
"toString",
"(",
")",
")",
";",
"AmLogServerAdapter",
".",
"getInstance",
"(",
")",
".",
"onClose",
"(",
"session",
")",
";",
"}"
] | Websocket connection close.
@param session session
@param closeReason closeReason | [
"Websocket",
"connection",
"close",
"."
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/hook/AmLogServerEndPoint.java#L59-L65 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F4.andThen | public F4<P1, P2, P3, P4, R> andThen(
final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs
) {
"""
Returns a composed function that applied, in sequence, this function and
all functions specified one by one. If applying anyone of the functions
throws an exception, it is relayed to the caller of the composed function.
If an exception is thrown out, the following functions will not be applied.
<p>When apply the composed function, the result of the last function
is returned</p>
@param fs
a sequence of function to be applied after this function
@return a composed function
"""
if (0 == fs.length) {
return this;
}
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) {
r = f.apply(p1, p2, p3, p4);
}
return r;
}
};
} | java | public F4<P1, P2, P3, P4, R> andThen(
final Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R>... fs
) {
if (0 == fs.length) {
return this;
}
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
for (Func4<? super P1, ? super P2, ? super P3, ? super P4, ? extends R> f : fs) {
r = f.apply(p1, p2, p3, p4);
}
return r;
}
};
} | [
"public",
"F4",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"R",
">",
"andThen",
"(",
"final",
"Func4",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"super",
"P3",
",",
"?",
"super",
"P4",
",",
"?",
"extends",
"R",
">",
"...",
"fs",
")",
"{",
"if",
"(",
"0",
"==",
"fs",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"final",
"Func4",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"R",
">",
"me",
"=",
"this",
";",
"return",
"new",
"F4",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"R",
"apply",
"(",
"P1",
"p1",
",",
"P2",
"p2",
",",
"P3",
"p3",
",",
"P4",
"p4",
")",
"{",
"R",
"r",
"=",
"me",
".",
"apply",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
")",
";",
"for",
"(",
"Func4",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"super",
"P3",
",",
"?",
"super",
"P4",
",",
"?",
"extends",
"R",
">",
"f",
":",
"fs",
")",
"{",
"r",
"=",
"f",
".",
"apply",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
")",
";",
"}",
"return",
"r",
";",
"}",
"}",
";",
"}"
] | Returns a composed function that applied, in sequence, this function and
all functions specified one by one. If applying anyone of the functions
throws an exception, it is relayed to the caller of the composed function.
If an exception is thrown out, the following functions will not be applied.
<p>When apply the composed function, the result of the last function
is returned</p>
@param fs
a sequence of function to be applied after this function
@return a composed function | [
"Returns",
"a",
"composed",
"function",
"that",
"applied",
"in",
"sequence",
"this",
"function",
"and",
"all",
"functions",
"specified",
"one",
"by",
"one",
".",
"If",
"applying",
"anyone",
"of",
"the",
"functions",
"throws",
"an",
"exception",
"it",
"is",
"relayed",
"to",
"the",
"caller",
"of",
"the",
"composed",
"function",
".",
"If",
"an",
"exception",
"is",
"thrown",
"out",
"the",
"following",
"functions",
"will",
"not",
"be",
"applied",
".",
"<p",
">",
"When",
"apply",
"the",
"composed",
"function",
"the",
"result",
"of",
"the",
"last",
"function",
"is",
"returned<",
"/",
"p",
">"
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1574-L1592 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/Predicates.java | Predicates.greaterEqual | public static Predicate greaterEqual(String attribute, Comparable value) {
"""
Creates a <b>greater than or equal to</b> predicate that will pass items if the value stored under the given
item {@code attribute} is greater than or equal to the given {@code value}.
<p>
See also <i>Special Attributes</i>, <i>Attribute Paths</i>, <i>Handling of {@code null}</i> and
<i>Implicit Type Conversion</i> sections of {@link Predicates}.
@param attribute the left-hand side attribute to fetch the value for comparison from.
@param value the right-hand side value to compare the attribute value against.
@return the created <b>greater than or equal to</b> predicate.
@throws IllegalArgumentException if the {@code attribute} does not exist.
"""
return new GreaterLessPredicate(attribute, value, true, false);
} | java | public static Predicate greaterEqual(String attribute, Comparable value) {
return new GreaterLessPredicate(attribute, value, true, false);
} | [
"public",
"static",
"Predicate",
"greaterEqual",
"(",
"String",
"attribute",
",",
"Comparable",
"value",
")",
"{",
"return",
"new",
"GreaterLessPredicate",
"(",
"attribute",
",",
"value",
",",
"true",
",",
"false",
")",
";",
"}"
] | Creates a <b>greater than or equal to</b> predicate that will pass items if the value stored under the given
item {@code attribute} is greater than or equal to the given {@code value}.
<p>
See also <i>Special Attributes</i>, <i>Attribute Paths</i>, <i>Handling of {@code null}</i> and
<i>Implicit Type Conversion</i> sections of {@link Predicates}.
@param attribute the left-hand side attribute to fetch the value for comparison from.
@param value the right-hand side value to compare the attribute value against.
@return the created <b>greater than or equal to</b> predicate.
@throws IllegalArgumentException if the {@code attribute} does not exist. | [
"Creates",
"a",
"<b",
">",
"greater",
"than",
"or",
"equal",
"to<",
"/",
"b",
">",
"predicate",
"that",
"will",
"pass",
"items",
"if",
"the",
"value",
"stored",
"under",
"the",
"given",
"item",
"{",
"@code",
"attribute",
"}",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"given",
"{",
"@code",
"value",
"}",
".",
"<p",
">",
"See",
"also",
"<i",
">",
"Special",
"Attributes<",
"/",
"i",
">",
"<i",
">",
"Attribute",
"Paths<",
"/",
"i",
">",
"<i",
">",
"Handling",
"of",
"{",
"@code",
"null",
"}",
"<",
"/",
"i",
">",
"and",
"<i",
">",
"Implicit",
"Type",
"Conversion<",
"/",
"i",
">",
"sections",
"of",
"{",
"@link",
"Predicates",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/Predicates.java#L360-L362 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/Latkes.java | Latkes.setLatkeProperty | public static void setLatkeProperty(final String key, final String value) {
"""
Sets latke.props with the specified key and value.
@param key the specified key
@param value the specified value
"""
if (null == key) {
LOGGER.log(Level.WARN, "latke.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "latke.props can not set null value");
return;
}
latkeProps.setProperty(key, value);
} | java | public static void setLatkeProperty(final String key, final String value) {
if (null == key) {
LOGGER.log(Level.WARN, "latke.props can not set null key");
return;
}
if (null == value) {
LOGGER.log(Level.WARN, "latke.props can not set null value");
return;
}
latkeProps.setProperty(key, value);
} | [
"public",
"static",
"void",
"setLatkeProperty",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARN",
",",
"\"latke.props can not set null key\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARN",
",",
"\"latke.props can not set null value\"",
")",
";",
"return",
";",
"}",
"latkeProps",
".",
"setProperty",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Sets latke.props with the specified key and value.
@param key the specified key
@param value the specified value | [
"Sets",
"latke",
".",
"props",
"with",
"the",
"specified",
"key",
"and",
"value",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/Latkes.java#L178-L191 |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java | SystemPropertyContext.resolveBaseDir | Path resolveBaseDir(final String name, final String dirName) {
"""
Resolves the base directory. If the system property is set that value will be used. Otherwise the path is
resolved from the home directory.
@param name the system property name
@param dirName the directory name relative to the base directory
@return the resolved base directory
"""
final String currentDir = SecurityActions.getPropertyPrivileged(name);
if (currentDir == null) {
return jbossHomeDir.resolve(dirName);
}
return Paths.get(currentDir);
} | java | Path resolveBaseDir(final String name, final String dirName) {
final String currentDir = SecurityActions.getPropertyPrivileged(name);
if (currentDir == null) {
return jbossHomeDir.resolve(dirName);
}
return Paths.get(currentDir);
} | [
"Path",
"resolveBaseDir",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"dirName",
")",
"{",
"final",
"String",
"currentDir",
"=",
"SecurityActions",
".",
"getPropertyPrivileged",
"(",
"name",
")",
";",
"if",
"(",
"currentDir",
"==",
"null",
")",
"{",
"return",
"jbossHomeDir",
".",
"resolve",
"(",
"dirName",
")",
";",
"}",
"return",
"Paths",
".",
"get",
"(",
"currentDir",
")",
";",
"}"
] | Resolves the base directory. If the system property is set that value will be used. Otherwise the path is
resolved from the home directory.
@param name the system property name
@param dirName the directory name relative to the base directory
@return the resolved base directory | [
"Resolves",
"the",
"base",
"directory",
".",
"If",
"the",
"system",
"property",
"is",
"set",
"that",
"value",
"will",
"be",
"used",
".",
"Otherwise",
"the",
"path",
"is",
"resolved",
"from",
"the",
"home",
"directory",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/SystemPropertyContext.java#L151-L157 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.get | public SftpFileAttributes get(String remote, OutputStream local,
long position) throws SftpStatusException, SshException,
TransferCancelledException {
"""
Download the remote file into an OutputStream.
@param remote
@param local
@param position
the position from which to start reading the remote file
@return the downloaded file's attributes
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException
"""
return get(remote, local, null, position);
} | java | public SftpFileAttributes get(String remote, OutputStream local,
long position) throws SftpStatusException, SshException,
TransferCancelledException {
return get(remote, local, null, position);
} | [
"public",
"SftpFileAttributes",
"get",
"(",
"String",
"remote",
",",
"OutputStream",
"local",
",",
"long",
"position",
")",
"throws",
"SftpStatusException",
",",
"SshException",
",",
"TransferCancelledException",
"{",
"return",
"get",
"(",
"remote",
",",
"local",
",",
"null",
",",
"position",
")",
";",
"}"
] | Download the remote file into an OutputStream.
@param remote
@param local
@param position
the position from which to start reading the remote file
@return the downloaded file's attributes
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"Download",
"the",
"remote",
"file",
"into",
"an",
"OutputStream",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L1556-L1560 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionsInner.java | CollectionsInner.listMetrics | public List<MetricInner> listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
"""
Retrieves the metrics determined by the given filter for the given database account and collection.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<MetricInner> object if successful.
"""
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body();
} | java | public List<MetricInner> listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"MetricInner",
">",
"listMetrics",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"databaseRid",
",",
"String",
"collectionRid",
",",
"String",
"filter",
")",
"{",
"return",
"listMetricsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"databaseRid",
",",
"collectionRid",
",",
"filter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Retrieves the metrics determined by the given filter for the given database account and collection.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<MetricInner> object if successful. | [
"Retrieves",
"the",
"metrics",
"determined",
"by",
"the",
"given",
"filter",
"for",
"the",
"given",
"database",
"account",
"and",
"collection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionsInner.java#L82-L84 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java | MultimapJoiner.appendTo | public StringBuilder appendTo(StringBuilder builder, Map<?, ? extends Collection<?>> map) {
"""
Appends the string representation of each entry of {@code map}, using the previously configured separator and
key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Map)}, except that it
does not throw {@link IOException}.
"""
return appendTo(builder, map.entrySet());
} | java | public StringBuilder appendTo(StringBuilder builder, Map<?, ? extends Collection<?>> map) {
return appendTo(builder, map.entrySet());
} | [
"public",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"builder",
",",
"Map",
"<",
"?",
",",
"?",
"extends",
"Collection",
"<",
"?",
">",
">",
"map",
")",
"{",
"return",
"appendTo",
"(",
"builder",
",",
"map",
".",
"entrySet",
"(",
")",
")",
";",
"}"
] | Appends the string representation of each entry of {@code map}, using the previously configured separator and
key-value separator, to {@code builder}. Identical to {@link #appendTo(Appendable, Map)}, except that it
does not throw {@link IOException}. | [
"Appends",
"the",
"string",
"representation",
"of",
"each",
"entry",
"of",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java#L71-L73 |
moparisthebest/beehive | beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/EJBJarDescriptorHandler.java | EJBJarDescriptorHandler.insertEJBRefsInEJBJar | private void insertEJBRefsInEJBJar(Document document, EJBInfo ejbInfo, String ejbLinkValue, List ejbList) {
"""
Insert EJB references in all of the descriptors of the EJB's in the supplied list
@param document DOM tree of an ejb-jar.xml file.
@param ejbInfo Contains information about the EJB control.
@param ejbLinkValue The ejb-link value for the EJBs.
@param ejbList The list of EJB's
"""
for (Object ejb : ejbList) {
if (ejbInfo.isLocal())
insertEJBLocalRefInEJBJar((Element)ejb, ejbInfo, ejbLinkValue, document);
else
insertEJBRefInEJBJar((Element)ejb, ejbInfo, ejbLinkValue, document);
}
} | java | private void insertEJBRefsInEJBJar(Document document, EJBInfo ejbInfo, String ejbLinkValue, List ejbList) {
for (Object ejb : ejbList) {
if (ejbInfo.isLocal())
insertEJBLocalRefInEJBJar((Element)ejb, ejbInfo, ejbLinkValue, document);
else
insertEJBRefInEJBJar((Element)ejb, ejbInfo, ejbLinkValue, document);
}
} | [
"private",
"void",
"insertEJBRefsInEJBJar",
"(",
"Document",
"document",
",",
"EJBInfo",
"ejbInfo",
",",
"String",
"ejbLinkValue",
",",
"List",
"ejbList",
")",
"{",
"for",
"(",
"Object",
"ejb",
":",
"ejbList",
")",
"{",
"if",
"(",
"ejbInfo",
".",
"isLocal",
"(",
")",
")",
"insertEJBLocalRefInEJBJar",
"(",
"(",
"Element",
")",
"ejb",
",",
"ejbInfo",
",",
"ejbLinkValue",
",",
"document",
")",
";",
"else",
"insertEJBRefInEJBJar",
"(",
"(",
"Element",
")",
"ejb",
",",
"ejbInfo",
",",
"ejbLinkValue",
",",
"document",
")",
";",
"}",
"}"
] | Insert EJB references in all of the descriptors of the EJB's in the supplied list
@param document DOM tree of an ejb-jar.xml file.
@param ejbInfo Contains information about the EJB control.
@param ejbLinkValue The ejb-link value for the EJBs.
@param ejbList The list of EJB's | [
"Insert",
"EJB",
"references",
"in",
"all",
"of",
"the",
"descriptors",
"of",
"the",
"EJB",
"s",
"in",
"the",
"supplied",
"list"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/internal/EJBJarDescriptorHandler.java#L93-L100 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/HexString.java | HexString.binToHex | public static void binToHex(byte[] bin, int start, int length, StringBuffer hex) {
"""
Converts a binary value held in a byte array into a hex string, in the
given StringBuffer, using exactly two characters per byte of input.
@param bin The byte array containing the binary value.
@param start The offset into the byte array for conversion to start..
@param length The number of bytes to convert.
@param hex The StringBuffer to contain the hex string.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "binToHex", new Object[]{bin, Integer.valueOf(start), Integer.valueOf(length), hex});
/* Constant for binary to Hex conversion */
final char BIN2HEX[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
int binByte;
for (int i=start; i<start+length; i++)
{
binByte = bin[i];
/* SibTreat the byte as unsigned */
if (binByte < 0) binByte += 256;
/* Convert and append each digit */
hex.append(BIN2HEX[binByte/16]);
hex.append(BIN2HEX[binByte%16]);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "binToHex", hex);
} | java | public static void binToHex(byte[] bin, int start, int length, StringBuffer hex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "binToHex", new Object[]{bin, Integer.valueOf(start), Integer.valueOf(length), hex});
/* Constant for binary to Hex conversion */
final char BIN2HEX[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
int binByte;
for (int i=start; i<start+length; i++)
{
binByte = bin[i];
/* SibTreat the byte as unsigned */
if (binByte < 0) binByte += 256;
/* Convert and append each digit */
hex.append(BIN2HEX[binByte/16]);
hex.append(BIN2HEX[binByte%16]);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "binToHex", hex);
} | [
"public",
"static",
"void",
"binToHex",
"(",
"byte",
"[",
"]",
"bin",
",",
"int",
"start",
",",
"int",
"length",
",",
"StringBuffer",
"hex",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"binToHex\"",
",",
"new",
"Object",
"[",
"]",
"{",
"bin",
",",
"Integer",
".",
"valueOf",
"(",
"start",
")",
",",
"Integer",
".",
"valueOf",
"(",
"length",
")",
",",
"hex",
"}",
")",
";",
"/* Constant for binary to Hex conversion */",
"final",
"char",
"BIN2HEX",
"[",
"]",
"=",
"{",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
"}",
";",
"int",
"binByte",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"start",
"+",
"length",
";",
"i",
"++",
")",
"{",
"binByte",
"=",
"bin",
"[",
"i",
"]",
";",
"/* SibTreat the byte as unsigned */",
"if",
"(",
"binByte",
"<",
"0",
")",
"binByte",
"+=",
"256",
";",
"/* Convert and append each digit */",
"hex",
".",
"append",
"(",
"BIN2HEX",
"[",
"binByte",
"/",
"16",
"]",
")",
";",
"hex",
".",
"append",
"(",
"BIN2HEX",
"[",
"binByte",
"%",
"16",
"]",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"binToHex\"",
",",
"hex",
")",
";",
"}"
] | Converts a binary value held in a byte array into a hex string, in the
given StringBuffer, using exactly two characters per byte of input.
@param bin The byte array containing the binary value.
@param start The offset into the byte array for conversion to start..
@param length The number of bytes to convert.
@param hex The StringBuffer to contain the hex string. | [
"Converts",
"a",
"binary",
"value",
"held",
"in",
"a",
"byte",
"array",
"into",
"a",
"hex",
"string",
"in",
"the",
"given",
"StringBuffer",
"using",
"exactly",
"two",
"characters",
"per",
"byte",
"of",
"input",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/HexString.java#L38-L61 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java | OjbMemberTagsHandler.memberTagValue | public String memberTagValue(Properties attributes) throws XDocletException {
"""
Returns the value of the tag/parameter combination for the current member tag
@param attributes The attributes of the template tag
@return Description of the Returned Value
@exception XDocletException Description of Exception
@doc.tag type="content"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" description="The parameter name. If not specified, then the raw
content of the tag is returned."
@doc.param name="paramNum" description="The zero-based parameter number. It's used if the user
used the space-separated format for specifying parameters."
@doc.param name="values" description="The valid values for the parameter, comma separated. An
error message is printed if the parameter value is not one of the values."
@doc.param name="default" description="The default value is returned if parameter not specified
by user for the tag."
"""
if (getCurrentField() != null) {
// setting field to true will override the for_class value.
attributes.setProperty("field", "true");
return getExpandedDelimitedTagValue(attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
return getExpandedDelimitedTagValue(attributes, FOR_METHOD);
}
else {
return null;
}
} | java | public String memberTagValue(Properties attributes) throws XDocletException
{
if (getCurrentField() != null) {
// setting field to true will override the for_class value.
attributes.setProperty("field", "true");
return getExpandedDelimitedTagValue(attributes, FOR_FIELD);
}
else if (getCurrentMethod() != null) {
return getExpandedDelimitedTagValue(attributes, FOR_METHOD);
}
else {
return null;
}
} | [
"public",
"String",
"memberTagValue",
"(",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"if",
"(",
"getCurrentField",
"(",
")",
"!=",
"null",
")",
"{",
"// setting field to true will override the for_class value.\r",
"attributes",
".",
"setProperty",
"(",
"\"field\"",
",",
"\"true\"",
")",
";",
"return",
"getExpandedDelimitedTagValue",
"(",
"attributes",
",",
"FOR_FIELD",
")",
";",
"}",
"else",
"if",
"(",
"getCurrentMethod",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getExpandedDelimitedTagValue",
"(",
"attributes",
",",
"FOR_METHOD",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Returns the value of the tag/parameter combination for the current member tag
@param attributes The attributes of the template tag
@return Description of the Returned Value
@exception XDocletException Description of Exception
@doc.tag type="content"
@doc.param name="tagName" optional="false" description="The tag name."
@doc.param name="paramName" description="The parameter name. If not specified, then the raw
content of the tag is returned."
@doc.param name="paramNum" description="The zero-based parameter number. It's used if the user
used the space-separated format for specifying parameters."
@doc.param name="values" description="The valid values for the parameter, comma separated. An
error message is printed if the parameter value is not one of the values."
@doc.param name="default" description="The default value is returned if parameter not specified
by user for the tag." | [
"Returns",
"the",
"value",
"of",
"the",
"tag",
"/",
"parameter",
"combination",
"for",
"the",
"current",
"member",
"tag"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L423-L436 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java | Strings.joinStrings | public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
"""
Generic string joining function.
@param strings Strings to be joined
@param fixCase does it need to fix word case
@param withChar char to join strings with.
@return joined-string
"""
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
} | java | public static String joinStrings(List<String> strings, boolean fixCase, char withChar) {
if (strings == null || strings.size() == 0) {
return "";
}
StringBuilder result = null;
for (String s : strings) {
if (fixCase) {
s = fixCase(s);
}
if (result == null) {
result = new StringBuilder(s);
} else {
result.append(withChar);
result.append(s);
}
}
return result.toString();
} | [
"public",
"static",
"String",
"joinStrings",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"boolean",
"fixCase",
",",
"char",
"withChar",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
"||",
"strings",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"result",
"=",
"null",
";",
"for",
"(",
"String",
"s",
":",
"strings",
")",
"{",
"if",
"(",
"fixCase",
")",
"{",
"s",
"=",
"fixCase",
"(",
"s",
")",
";",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"StringBuilder",
"(",
"s",
")",
";",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"withChar",
")",
";",
"result",
".",
"append",
"(",
"s",
")",
";",
"}",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Generic string joining function.
@param strings Strings to be joined
@param fixCase does it need to fix word case
@param withChar char to join strings with.
@return joined-string | [
"Generic",
"string",
"joining",
"function",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/cli/util/Strings.java#L40-L57 |
phax/ph-web | ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java | EmailAddressValidator._hasMXRecord | private static boolean _hasMXRecord (@Nonnull final String sHostName) {
"""
Check if the passed host name has an MX record.
@param sHostName
The host name to check.
@return <code>true</code> if an MX record was found, <code>false</code> if
not (or if an exception occurred)
"""
try
{
final Record [] aRecords = new Lookup (sHostName, Type.MX).run ();
return aRecords != null && aRecords.length > 0;
}
catch (final Exception ex)
{
// Do not log this message, as this method is potentially called very
// often!
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to check for MX record on host '" +
sHostName +
"': " +
ex.getClass ().getName () +
" - " +
ex.getMessage ());
return false;
}
} | java | private static boolean _hasMXRecord (@Nonnull final String sHostName)
{
try
{
final Record [] aRecords = new Lookup (sHostName, Type.MX).run ();
return aRecords != null && aRecords.length > 0;
}
catch (final Exception ex)
{
// Do not log this message, as this method is potentially called very
// often!
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to check for MX record on host '" +
sHostName +
"': " +
ex.getClass ().getName () +
" - " +
ex.getMessage ());
return false;
}
} | [
"private",
"static",
"boolean",
"_hasMXRecord",
"(",
"@",
"Nonnull",
"final",
"String",
"sHostName",
")",
"{",
"try",
"{",
"final",
"Record",
"[",
"]",
"aRecords",
"=",
"new",
"Lookup",
"(",
"sHostName",
",",
"Type",
".",
"MX",
")",
".",
"run",
"(",
")",
";",
"return",
"aRecords",
"!=",
"null",
"&&",
"aRecords",
".",
"length",
">",
"0",
";",
"}",
"catch",
"(",
"final",
"Exception",
"ex",
")",
"{",
"// Do not log this message, as this method is potentially called very",
"// often!",
"if",
"(",
"LOGGER",
".",
"isWarnEnabled",
"(",
")",
")",
"LOGGER",
".",
"warn",
"(",
"\"Failed to check for MX record on host '\"",
"+",
"sHostName",
"+",
"\"': \"",
"+",
"ex",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" - \"",
"+",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"}"
] | Check if the passed host name has an MX record.
@param sHostName
The host name to check.
@return <code>true</code> if an MX record was found, <code>false</code> if
not (or if an exception occurred) | [
"Check",
"if",
"the",
"passed",
"host",
"name",
"has",
"an",
"MX",
"record",
"."
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-smtp/src/main/java/com/helger/smtp/util/EmailAddressValidator.java#L81-L101 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/AnnotationsUtil.java | AnnotationsUtil.getAnnotation | public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedType, Class<T> annotationClass) {
"""
Small utility to easily get an annotation and will throw an exception if not provided.
@param annotatedType The source type to tcheck the annotation on
@param annotationClass The annotation to look for
@param <T> The annotation subtype
@return The annotation that was requested
@throws ODataSystemException If unable to find the annotation or nullpointer in case null source was specified
"""
return getAnnotation(annotatedType, annotationClass, null);
} | java | public static <T extends Annotation> T getAnnotation(AnnotatedElement annotatedType, Class<T> annotationClass) {
return getAnnotation(annotatedType, annotationClass, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"AnnotatedElement",
"annotatedType",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"return",
"getAnnotation",
"(",
"annotatedType",
",",
"annotationClass",
",",
"null",
")",
";",
"}"
] | Small utility to easily get an annotation and will throw an exception if not provided.
@param annotatedType The source type to tcheck the annotation on
@param annotationClass The annotation to look for
@param <T> The annotation subtype
@return The annotation that was requested
@throws ODataSystemException If unable to find the annotation or nullpointer in case null source was specified | [
"Small",
"utility",
"to",
"easily",
"get",
"an",
"annotation",
"and",
"will",
"throw",
"an",
"exception",
"if",
"not",
"provided",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/AnnotationsUtil.java#L57-L59 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.createOrUpdateAsync | public Observable<StorageAccountCredentialInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
"""
Creates or updates the storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@param storageAccountCredential The storage account credential.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() {
@Override
public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountCredentialInner> createOrUpdateAsync(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() {
@Override
public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountCredentialInner",
">",
"createOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"StorageAccountCredentialInner",
"storageAccountCredential",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
",",
"storageAccountCredential",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"StorageAccountCredentialInner",
">",
",",
"StorageAccountCredentialInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"StorageAccountCredentialInner",
"call",
"(",
"ServiceResponse",
"<",
"StorageAccountCredentialInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates or updates the storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@param storageAccountCredential The storage account credential.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"the",
"storage",
"account",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L351-L358 |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpClient.java | SftpClient.createDir | protected FtpMessage createDir(CommandType ftpCommand) {
"""
Execute mkDir command and create new directory.
@param ftpCommand
@return
"""
try {
sftp.mkdir(ftpCommand.getArguments());
return FtpMessage.result(FTPReply.PATHNAME_CREATED, "Pathname created", true);
} catch (SftpException e) {
throw new CitrusRuntimeException("Failed to execute ftp command", e);
}
} | java | protected FtpMessage createDir(CommandType ftpCommand) {
try {
sftp.mkdir(ftpCommand.getArguments());
return FtpMessage.result(FTPReply.PATHNAME_CREATED, "Pathname created", true);
} catch (SftpException e) {
throw new CitrusRuntimeException("Failed to execute ftp command", e);
}
} | [
"protected",
"FtpMessage",
"createDir",
"(",
"CommandType",
"ftpCommand",
")",
"{",
"try",
"{",
"sftp",
".",
"mkdir",
"(",
"ftpCommand",
".",
"getArguments",
"(",
")",
")",
";",
"return",
"FtpMessage",
".",
"result",
"(",
"FTPReply",
".",
"PATHNAME_CREATED",
",",
"\"Pathname created\"",
",",
"true",
")",
";",
"}",
"catch",
"(",
"SftpException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Failed to execute ftp command\"",
",",
"e",
")",
";",
"}",
"}"
] | Execute mkDir command and create new directory.
@param ftpCommand
@return | [
"Execute",
"mkDir",
"command",
"and",
"create",
"new",
"directory",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpClient.java#L97-L104 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java | NearestNeighborsClient.knnNew | public NearestNeighborsResults knnNew(int k, INDArray arr) throws Exception {
"""
Run a k nearest neighbors search
on a NEW data point
@param k the number of results
to retrieve
@param arr the array to run the search on.
Note that this must be a row vector
@return
@throws Exception
"""
Base64NDArrayBody base64NDArrayBody =
Base64NDArrayBody.builder().k(k).ndarray(Nd4jBase64.base64String(arr)).build();
HttpRequestWithBody req = Unirest.post(url + "/knnnew");
req.header("accept", "application/json")
.header("Content-Type", "application/json").body(base64NDArrayBody);
addAuthHeader(req);
NearestNeighborsResults ret = req.asObject(NearestNeighborsResults.class).getBody();
return ret;
} | java | public NearestNeighborsResults knnNew(int k, INDArray arr) throws Exception {
Base64NDArrayBody base64NDArrayBody =
Base64NDArrayBody.builder().k(k).ndarray(Nd4jBase64.base64String(arr)).build();
HttpRequestWithBody req = Unirest.post(url + "/knnnew");
req.header("accept", "application/json")
.header("Content-Type", "application/json").body(base64NDArrayBody);
addAuthHeader(req);
NearestNeighborsResults ret = req.asObject(NearestNeighborsResults.class).getBody();
return ret;
} | [
"public",
"NearestNeighborsResults",
"knnNew",
"(",
"int",
"k",
",",
"INDArray",
"arr",
")",
"throws",
"Exception",
"{",
"Base64NDArrayBody",
"base64NDArrayBody",
"=",
"Base64NDArrayBody",
".",
"builder",
"(",
")",
".",
"k",
"(",
"k",
")",
".",
"ndarray",
"(",
"Nd4jBase64",
".",
"base64String",
"(",
"arr",
")",
")",
".",
"build",
"(",
")",
";",
"HttpRequestWithBody",
"req",
"=",
"Unirest",
".",
"post",
"(",
"url",
"+",
"\"/knnnew\"",
")",
";",
"req",
".",
"header",
"(",
"\"accept\"",
",",
"\"application/json\"",
")",
".",
"header",
"(",
"\"Content-Type\"",
",",
"\"application/json\"",
")",
".",
"body",
"(",
"base64NDArrayBody",
")",
";",
"addAuthHeader",
"(",
"req",
")",
";",
"NearestNeighborsResults",
"ret",
"=",
"req",
".",
"asObject",
"(",
"NearestNeighborsResults",
".",
"class",
")",
".",
"getBody",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | Run a k nearest neighbors search
on a NEW data point
@param k the number of results
to retrieve
@param arr the array to run the search on.
Note that this must be a row vector
@return
@throws Exception | [
"Run",
"a",
"k",
"nearest",
"neighbors",
"search",
"on",
"a",
"NEW",
"data",
"point"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java#L111-L123 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/RandomCompat.java | RandomCompat.doubles | @NotNull
public DoubleStream doubles(long streamSize,
final double randomNumberOrigin, final double randomNumberBound) {
"""
Returns a stream producing the given {@code streamSize} number
of pseudorandom {@code double} values, each conforming
to the given origin (inclusive) and bound (exclusive).
@param streamSize the number of values to generate
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) if each random value
@return a stream of pseudorandom {@code double} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code streamSize} is
less than zero, or {@code randomNumberOrigin} is
greater than or equal to {@code randomNumberBound}
"""
if (streamSize < 0L) throw new IllegalArgumentException();
if (streamSize == 0L) {
return DoubleStream.empty();
}
return doubles(randomNumberOrigin, randomNumberBound).limit(streamSize);
} | java | @NotNull
public DoubleStream doubles(long streamSize,
final double randomNumberOrigin, final double randomNumberBound) {
if (streamSize < 0L) throw new IllegalArgumentException();
if (streamSize == 0L) {
return DoubleStream.empty();
}
return doubles(randomNumberOrigin, randomNumberBound).limit(streamSize);
} | [
"@",
"NotNull",
"public",
"DoubleStream",
"doubles",
"(",
"long",
"streamSize",
",",
"final",
"double",
"randomNumberOrigin",
",",
"final",
"double",
"randomNumberBound",
")",
"{",
"if",
"(",
"streamSize",
"<",
"0L",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"streamSize",
"==",
"0L",
")",
"{",
"return",
"DoubleStream",
".",
"empty",
"(",
")",
";",
"}",
"return",
"doubles",
"(",
"randomNumberOrigin",
",",
"randomNumberBound",
")",
".",
"limit",
"(",
"streamSize",
")",
";",
"}"
] | Returns a stream producing the given {@code streamSize} number
of pseudorandom {@code double} values, each conforming
to the given origin (inclusive) and bound (exclusive).
@param streamSize the number of values to generate
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) if each random value
@return a stream of pseudorandom {@code double} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code streamSize} is
less than zero, or {@code randomNumberOrigin} is
greater than or equal to {@code randomNumberBound} | [
"Returns",
"a",
"stream",
"producing",
"the",
"given",
"{",
"@code",
"streamSize",
"}",
"number",
"of",
"pseudorandom",
"{",
"@code",
"double",
"}",
"values",
"each",
"conforming",
"to",
"the",
"given",
"origin",
"(",
"inclusive",
")",
"and",
"bound",
"(",
"exclusive",
")",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L237-L245 |
alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java | ResponseBuilder.withStandardCard | public ResponseBuilder withStandardCard(String cardTitle, String cardText, Image image) {
"""
Sets a standard {@link Card} on the response with the specified title, content and image
@param cardTitle title for card
@param cardText text in the card
@param image image
@return response builder
"""
this.card = StandardCard.builder()
.withText(cardText)
.withImage(image)
.withTitle(cardTitle)
.build();
return this;
} | java | public ResponseBuilder withStandardCard(String cardTitle, String cardText, Image image) {
this.card = StandardCard.builder()
.withText(cardText)
.withImage(image)
.withTitle(cardTitle)
.build();
return this;
} | [
"public",
"ResponseBuilder",
"withStandardCard",
"(",
"String",
"cardTitle",
",",
"String",
"cardText",
",",
"Image",
"image",
")",
"{",
"this",
".",
"card",
"=",
"StandardCard",
".",
"builder",
"(",
")",
".",
"withText",
"(",
"cardText",
")",
".",
"withImage",
"(",
"image",
")",
".",
"withTitle",
"(",
"cardTitle",
")",
".",
"build",
"(",
")",
";",
"return",
"this",
";",
"}"
] | Sets a standard {@link Card} on the response with the specified title, content and image
@param cardTitle title for card
@param cardText text in the card
@param image image
@return response builder | [
"Sets",
"a",
"standard",
"{",
"@link",
"Card",
"}",
"on",
"the",
"response",
"with",
"the",
"specified",
"title",
"content",
"and",
"image"
] | train | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L134-L141 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsMessages.java | CmsMessages.getDateTime | public String getDateTime(Date date, CmsDateTimeUtil.Format format) {
"""
Returns a formated date and time String from a Date value,
the formatting based on the provided option and the locale
based on this instance.<p>
@param date the Date object to format as String
@param format the format to use, see {@link CmsDateTimeUtil.Format} for possible values
@return the formatted date and time
"""
return CmsDateTimeUtil.getDateTime(date, format);
} | java | public String getDateTime(Date date, CmsDateTimeUtil.Format format) {
return CmsDateTimeUtil.getDateTime(date, format);
} | [
"public",
"String",
"getDateTime",
"(",
"Date",
"date",
",",
"CmsDateTimeUtil",
".",
"Format",
"format",
")",
"{",
"return",
"CmsDateTimeUtil",
".",
"getDateTime",
"(",
"date",
",",
"format",
")",
";",
"}"
] | Returns a formated date and time String from a Date value,
the formatting based on the provided option and the locale
based on this instance.<p>
@param date the Date object to format as String
@param format the format to use, see {@link CmsDateTimeUtil.Format} for possible values
@return the formatted date and time | [
"Returns",
"a",
"formated",
"date",
"and",
"time",
"String",
"from",
"a",
"Date",
"value",
"the",
"formatting",
"based",
"on",
"the",
"provided",
"option",
"and",
"the",
"locale",
"based",
"on",
"this",
"instance",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsMessages.java#L275-L278 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_PUT | public void organizationName_service_exchangeService_mailingList_mailingListAddress_PUT(String organizationName, String exchangeService, String mailingListAddress, OvhMailingList body) throws IOException {
"""
Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param mailingListAddress [required] The mailing list address
"""
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void organizationName_service_exchangeService_mailingList_mailingListAddress_PUT(String organizationName, String exchangeService, String mailingListAddress, OvhMailingList body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}";
StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"organizationName_service_exchangeService_mailingList_mailingListAddress_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"mailingListAddress",
",",
"OvhMailingList",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"organizationName",
",",
"exchangeService",
",",
"mailingListAddress",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param mailingListAddress [required] The mailing list address | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1340-L1344 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/webui/UIFileInfo.java | UIFileInfo.addBlock | public void addBlock(String tierAlias, long blockId, long blockSize, long blockLastAccessTimeMs) {
"""
Adds a block to the file information.
@param tierAlias the tier alias
@param blockId the block id
@param blockSize the block size
@param blockLastAccessTimeMs the last access time (in milliseconds)
"""
UIFileBlockInfo block =
new UIFileBlockInfo(blockId, blockSize, blockLastAccessTimeMs, tierAlias,
mAlluxioConfiguration);
List<UIFileBlockInfo> blocksOnTier = mBlocksOnTier.get(tierAlias);
if (blocksOnTier == null) {
blocksOnTier = new ArrayList<>();
mBlocksOnTier.put(tierAlias, blocksOnTier);
}
blocksOnTier.add(block);
Long sizeOnTier = mSizeOnTier.get(tierAlias);
mSizeOnTier.put(tierAlias, (sizeOnTier == null ? 0L : sizeOnTier) + blockSize);
} | java | public void addBlock(String tierAlias, long blockId, long blockSize, long blockLastAccessTimeMs) {
UIFileBlockInfo block =
new UIFileBlockInfo(blockId, blockSize, blockLastAccessTimeMs, tierAlias,
mAlluxioConfiguration);
List<UIFileBlockInfo> blocksOnTier = mBlocksOnTier.get(tierAlias);
if (blocksOnTier == null) {
blocksOnTier = new ArrayList<>();
mBlocksOnTier.put(tierAlias, blocksOnTier);
}
blocksOnTier.add(block);
Long sizeOnTier = mSizeOnTier.get(tierAlias);
mSizeOnTier.put(tierAlias, (sizeOnTier == null ? 0L : sizeOnTier) + blockSize);
} | [
"public",
"void",
"addBlock",
"(",
"String",
"tierAlias",
",",
"long",
"blockId",
",",
"long",
"blockSize",
",",
"long",
"blockLastAccessTimeMs",
")",
"{",
"UIFileBlockInfo",
"block",
"=",
"new",
"UIFileBlockInfo",
"(",
"blockId",
",",
"blockSize",
",",
"blockLastAccessTimeMs",
",",
"tierAlias",
",",
"mAlluxioConfiguration",
")",
";",
"List",
"<",
"UIFileBlockInfo",
">",
"blocksOnTier",
"=",
"mBlocksOnTier",
".",
"get",
"(",
"tierAlias",
")",
";",
"if",
"(",
"blocksOnTier",
"==",
"null",
")",
"{",
"blocksOnTier",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"mBlocksOnTier",
".",
"put",
"(",
"tierAlias",
",",
"blocksOnTier",
")",
";",
"}",
"blocksOnTier",
".",
"add",
"(",
"block",
")",
";",
"Long",
"sizeOnTier",
"=",
"mSizeOnTier",
".",
"get",
"(",
"tierAlias",
")",
";",
"mSizeOnTier",
".",
"put",
"(",
"tierAlias",
",",
"(",
"sizeOnTier",
"==",
"null",
"?",
"0L",
":",
"sizeOnTier",
")",
"+",
"blockSize",
")",
";",
"}"
] | Adds a block to the file information.
@param tierAlias the tier alias
@param blockId the block id
@param blockSize the block size
@param blockLastAccessTimeMs the last access time (in milliseconds) | [
"Adds",
"a",
"block",
"to",
"the",
"file",
"information",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/webui/UIFileInfo.java#L189-L202 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java | JenkinsServer.getJobs | public Map<String, Job> getJobs(FolderJob folder) throws IOException {
"""
Get a list of all the defined jobs on the server (in the given folder)
@param folder {@link FolderJob}
@return list of defined jobs (summary level, for details @see Job#details
@throws IOException in case of an error.
"""
return getJobs(folder, null);
} | java | public Map<String, Job> getJobs(FolderJob folder) throws IOException {
return getJobs(folder, null);
} | [
"public",
"Map",
"<",
"String",
",",
"Job",
">",
"getJobs",
"(",
"FolderJob",
"folder",
")",
"throws",
"IOException",
"{",
"return",
"getJobs",
"(",
"folder",
",",
"null",
")",
";",
"}"
] | Get a list of all the defined jobs on the server (in the given folder)
@param folder {@link FolderJob}
@return list of defined jobs (summary level, for details @see Job#details
@throws IOException in case of an error. | [
"Get",
"a",
"list",
"of",
"all",
"the",
"defined",
"jobs",
"on",
"the",
"server",
"(",
"in",
"the",
"given",
"folder",
")"
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L140-L142 |
Netflix/governator | governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java | Grapher.toFile | public void toFile(File file) throws Exception {
"""
Writes the "Dot" graph to a given file.
@param file file to write to
"""
PrintWriter out = new PrintWriter(file, "UTF-8");
try {
out.write(graph());
}
finally {
Closeables.close(out, true);
}
} | java | public void toFile(File file) throws Exception {
PrintWriter out = new PrintWriter(file, "UTF-8");
try {
out.write(graph());
}
finally {
Closeables.close(out, true);
}
} | [
"public",
"void",
"toFile",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"file",
",",
"\"UTF-8\"",
")",
";",
"try",
"{",
"out",
".",
"write",
"(",
"graph",
"(",
")",
")",
";",
"}",
"finally",
"{",
"Closeables",
".",
"close",
"(",
"out",
",",
"true",
")",
";",
"}",
"}"
] | Writes the "Dot" graph to a given file.
@param file file to write to | [
"Writes",
"the",
"Dot",
"graph",
"to",
"a",
"given",
"file",
"."
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/Grapher.java#L131-L139 |
Harium/keel | src/main/java/com/harium/keel/catalano/core/DoublePoint.java | DoublePoint.Divide | public DoublePoint Divide(DoublePoint point1, DoublePoint point2) {
"""
Divides values of two points.
@param point1 DoublePoint.
@param point2 DoublePoint.
@return A new DoublePoint with the division operation.
"""
DoublePoint result = new DoublePoint(point1);
result.Divide(point2);
return result;
} | java | public DoublePoint Divide(DoublePoint point1, DoublePoint point2) {
DoublePoint result = new DoublePoint(point1);
result.Divide(point2);
return result;
} | [
"public",
"DoublePoint",
"Divide",
"(",
"DoublePoint",
"point1",
",",
"DoublePoint",
"point2",
")",
"{",
"DoublePoint",
"result",
"=",
"new",
"DoublePoint",
"(",
"point1",
")",
";",
"result",
".",
"Divide",
"(",
"point2",
")",
";",
"return",
"result",
";",
"}"
] | Divides values of two points.
@param point1 DoublePoint.
@param point2 DoublePoint.
@return A new DoublePoint with the division operation. | [
"Divides",
"values",
"of",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/DoublePoint.java#L238-L242 |
airlift/slice | src/main/java/io/airlift/slice/SliceUtf8.java | SliceUtf8.getCodePointBefore | public static int getCodePointBefore(Slice utf8, int position) {
"""
Gets the UTF-8 encoded code point before the {@code position}.
<p>
Note: This method does not explicitly check for valid UTF-8, and may
return incorrect results or throw an exception for invalid UTF-8.
"""
byte unsignedByte = utf8.getByte(position - 1);
if (!isContinuationByte(unsignedByte)) {
return unsignedByte & 0xFF;
}
if (!isContinuationByte(utf8.getByte(position - 2))) {
return getCodePointAt(utf8, position - 2);
}
if (!isContinuationByte(utf8.getByte(position - 3))) {
return getCodePointAt(utf8, position - 3);
}
if (!isContinuationByte(utf8.getByte(position - 4))) {
return getCodePointAt(utf8, position - 4);
}
// Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal
throw new InvalidUtf8Exception("UTF-8 is not well formed");
} | java | public static int getCodePointBefore(Slice utf8, int position)
{
byte unsignedByte = utf8.getByte(position - 1);
if (!isContinuationByte(unsignedByte)) {
return unsignedByte & 0xFF;
}
if (!isContinuationByte(utf8.getByte(position - 2))) {
return getCodePointAt(utf8, position - 2);
}
if (!isContinuationByte(utf8.getByte(position - 3))) {
return getCodePointAt(utf8, position - 3);
}
if (!isContinuationByte(utf8.getByte(position - 4))) {
return getCodePointAt(utf8, position - 4);
}
// Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal
throw new InvalidUtf8Exception("UTF-8 is not well formed");
} | [
"public",
"static",
"int",
"getCodePointBefore",
"(",
"Slice",
"utf8",
",",
"int",
"position",
")",
"{",
"byte",
"unsignedByte",
"=",
"utf8",
".",
"getByte",
"(",
"position",
"-",
"1",
")",
";",
"if",
"(",
"!",
"isContinuationByte",
"(",
"unsignedByte",
")",
")",
"{",
"return",
"unsignedByte",
"&",
"0xFF",
";",
"}",
"if",
"(",
"!",
"isContinuationByte",
"(",
"utf8",
".",
"getByte",
"(",
"position",
"-",
"2",
")",
")",
")",
"{",
"return",
"getCodePointAt",
"(",
"utf8",
",",
"position",
"-",
"2",
")",
";",
"}",
"if",
"(",
"!",
"isContinuationByte",
"(",
"utf8",
".",
"getByte",
"(",
"position",
"-",
"3",
")",
")",
")",
"{",
"return",
"getCodePointAt",
"(",
"utf8",
",",
"position",
"-",
"3",
")",
";",
"}",
"if",
"(",
"!",
"isContinuationByte",
"(",
"utf8",
".",
"getByte",
"(",
"position",
"-",
"4",
")",
")",
")",
"{",
"return",
"getCodePointAt",
"(",
"utf8",
",",
"position",
"-",
"4",
")",
";",
"}",
"// Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal",
"throw",
"new",
"InvalidUtf8Exception",
"(",
"\"UTF-8 is not well formed\"",
")",
";",
"}"
] | Gets the UTF-8 encoded code point before the {@code position}.
<p>
Note: This method does not explicitly check for valid UTF-8, and may
return incorrect results or throw an exception for invalid UTF-8. | [
"Gets",
"the",
"UTF",
"-",
"8",
"encoded",
"code",
"point",
"before",
"the",
"{"
] | train | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/SliceUtf8.java#L1020-L1038 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayNameWithDialect | public static String getDisplayNameWithDialect(String localeID, ULocale displayLocale) {
"""
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale.
If a dialect name is present in the locale data, then it is returned.
This is a cover for the ICU4C API.
@param localeID the locale whose name is to be displayed.
@param displayLocale the locale in which to display the locale name.
@return the localized locale name.
"""
return getDisplayNameWithDialectInternal(new ULocale(localeID), displayLocale);
} | java | public static String getDisplayNameWithDialect(String localeID, ULocale displayLocale) {
return getDisplayNameWithDialectInternal(new ULocale(localeID), displayLocale);
} | [
"public",
"static",
"String",
"getDisplayNameWithDialect",
"(",
"String",
"localeID",
",",
"ULocale",
"displayLocale",
")",
"{",
"return",
"getDisplayNameWithDialectInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"displayLocale",
")",
";",
"}"
] | <strong>[icu]</strong> Returns the locale ID localized for display in the provided locale.
If a dialect name is present in the locale data, then it is returned.
This is a cover for the ICU4C API.
@param localeID the locale whose name is to be displayed.
@param displayLocale the locale in which to display the locale name.
@return the localized locale name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"locale",
"ID",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"If",
"a",
"dialect",
"name",
"is",
"present",
"in",
"the",
"locale",
"data",
"then",
"it",
"is",
"returned",
".",
"This",
"is",
"a",
"cover",
"for",
"the",
"ICU4C",
"API",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1838-L1840 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java | GrassRasterWriter.createEmptyHeader | private boolean createEmptyHeader( String filePath, int rows ) {
"""
creates the space for the header of the rasterfile, filling the spaces with zeroes. After the
compression the values will be rewritten
@param filePath
@param rows
@return
"""
try {
RandomAccessFile theCreatedFile = new RandomAccessFile(filePath, "rw");
rowaddresses = new long[rows + 1];
// the size of a long
theCreatedFile.write(4);
// write the addresses of the row begins. Since we don't know how
// much
// they will be compressed, they will be filled after the
// compression
for( int i = 0; i < rows + 1; i++ ) {
theCreatedFile.writeInt(0);
}
pointerInFilePosition = theCreatedFile.getFilePointer();
rowaddresses[0] = pointerInFilePosition;
theCreatedFile.close();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
} | java | private boolean createEmptyHeader( String filePath, int rows ) {
try {
RandomAccessFile theCreatedFile = new RandomAccessFile(filePath, "rw");
rowaddresses = new long[rows + 1];
// the size of a long
theCreatedFile.write(4);
// write the addresses of the row begins. Since we don't know how
// much
// they will be compressed, they will be filled after the
// compression
for( int i = 0; i < rows + 1; i++ ) {
theCreatedFile.writeInt(0);
}
pointerInFilePosition = theCreatedFile.getFilePointer();
rowaddresses[0] = pointerInFilePosition;
theCreatedFile.close();
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
} | [
"private",
"boolean",
"createEmptyHeader",
"(",
"String",
"filePath",
",",
"int",
"rows",
")",
"{",
"try",
"{",
"RandomAccessFile",
"theCreatedFile",
"=",
"new",
"RandomAccessFile",
"(",
"filePath",
",",
"\"rw\"",
")",
";",
"rowaddresses",
"=",
"new",
"long",
"[",
"rows",
"+",
"1",
"]",
";",
"// the size of a long",
"theCreatedFile",
".",
"write",
"(",
"4",
")",
";",
"// write the addresses of the row begins. Since we don't know how",
"// much",
"// they will be compressed, they will be filled after the",
"// compression",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
"+",
"1",
";",
"i",
"++",
")",
"{",
"theCreatedFile",
".",
"writeInt",
"(",
"0",
")",
";",
"}",
"pointerInFilePosition",
"=",
"theCreatedFile",
".",
"getFilePointer",
"(",
")",
";",
"rowaddresses",
"[",
"0",
"]",
"=",
"pointerInFilePosition",
";",
"theCreatedFile",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | creates the space for the header of the rasterfile, filling the spaces with zeroes. After the
compression the values will be rewritten
@param filePath
@param rows
@return | [
"creates",
"the",
"space",
"for",
"the",
"header",
"of",
"the",
"rasterfile",
"filling",
"the",
"spaces",
"with",
"zeroes",
".",
"After",
"the",
"compression",
"the",
"values",
"will",
"be",
"rewritten"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterWriter.java#L188-L213 |
Impetus/Kundera | src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsUtils.java | PelopsUtils.generatePoolName | public static String generatePoolName(String node, int port, String keyspace) {
"""
Generate pool name.
@param persistenceUnit
the persistence unit
@param puProperties
@return the string
"""
return node + ":" + port + ":" + keyspace;
} | java | public static String generatePoolName(String node, int port, String keyspace)
{
return node + ":" + port + ":" + keyspace;
} | [
"public",
"static",
"String",
"generatePoolName",
"(",
"String",
"node",
",",
"int",
"port",
",",
"String",
"keyspace",
")",
"{",
"return",
"node",
"+",
"\":\"",
"+",
"port",
"+",
"\":\"",
"+",
"keyspace",
";",
"}"
] | Generate pool name.
@param persistenceUnit
the persistence unit
@param puProperties
@return the string | [
"Generate",
"pool",
"name",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsUtils.java#L42-L45 |
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java | CryptoHelper.createSignatureFor | @Deprecated
byte[] createSignatureFor(String algorithm, byte[] secretBytes, byte[] contentBytes) throws NoSuchAlgorithmException, InvalidKeyException {
"""
Create signature.
@param algorithm algorithm name.
@param secretBytes algorithm secret.
@param contentBytes the content to be signed.
@return the signature bytes.
@throws NoSuchAlgorithmException if the algorithm is not supported.
@throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm.
@deprecated rather use corresponding method which takes header and payload as separate inputs
"""
final Mac mac = Mac.getInstance(algorithm);
mac.init(new SecretKeySpec(secretBytes, algorithm));
return mac.doFinal(contentBytes);
} | java | @Deprecated
byte[] createSignatureFor(String algorithm, byte[] secretBytes, byte[] contentBytes) throws NoSuchAlgorithmException, InvalidKeyException {
final Mac mac = Mac.getInstance(algorithm);
mac.init(new SecretKeySpec(secretBytes, algorithm));
return mac.doFinal(contentBytes);
} | [
"@",
"Deprecated",
"byte",
"[",
"]",
"createSignatureFor",
"(",
"String",
"algorithm",
",",
"byte",
"[",
"]",
"secretBytes",
",",
"byte",
"[",
"]",
"contentBytes",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"final",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"mac",
".",
"init",
"(",
"new",
"SecretKeySpec",
"(",
"secretBytes",
",",
"algorithm",
")",
")",
";",
"return",
"mac",
".",
"doFinal",
"(",
"contentBytes",
")",
";",
"}"
] | Create signature.
@param algorithm algorithm name.
@param secretBytes algorithm secret.
@param contentBytes the content to be signed.
@return the signature bytes.
@throws NoSuchAlgorithmException if the algorithm is not supported.
@throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm.
@deprecated rather use corresponding method which takes header and payload as separate inputs | [
"Create",
"signature",
"."
] | train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L158-L163 |
Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.registerObject | public static void registerObject(String id, Object obj) {
"""
Register an object with the default registry. Equivalent to
{@code DefaultMonitorRegistry.getInstance().register(Monitors.newObjectMonitor(id, obj))}.
"""
DefaultMonitorRegistry.getInstance().register(newObjectMonitor(id, obj));
} | java | public static void registerObject(String id, Object obj) {
DefaultMonitorRegistry.getInstance().register(newObjectMonitor(id, obj));
} | [
"public",
"static",
"void",
"registerObject",
"(",
"String",
"id",
",",
"Object",
"obj",
")",
"{",
"DefaultMonitorRegistry",
".",
"getInstance",
"(",
")",
".",
"register",
"(",
"newObjectMonitor",
"(",
"id",
",",
"obj",
")",
")",
";",
"}"
] | Register an object with the default registry. Equivalent to
{@code DefaultMonitorRegistry.getInstance().register(Monitors.newObjectMonitor(id, obj))}. | [
"Register",
"an",
"object",
"with",
"the",
"default",
"registry",
".",
"Equivalent",
"to",
"{"
] | train | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L215-L217 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java | ServiceBuilder.withStreamSegmentStore | public ServiceBuilder withStreamSegmentStore(Function<ComponentSetup, StreamSegmentStore> streamSegmentStoreCreator) {
"""
Attaches the given StreamSegmentStore creator to this ServiceBuilder. The given Function will not be invoked
right away; it will be called when needed.
@param streamSegmentStoreCreator The Function to attach.
@return This ServiceBuilder.
"""
Preconditions.checkNotNull(streamSegmentStoreCreator, "streamSegmentStoreCreator");
this.streamSegmentStoreCreator = streamSegmentStoreCreator;
return this;
} | java | public ServiceBuilder withStreamSegmentStore(Function<ComponentSetup, StreamSegmentStore> streamSegmentStoreCreator) {
Preconditions.checkNotNull(streamSegmentStoreCreator, "streamSegmentStoreCreator");
this.streamSegmentStoreCreator = streamSegmentStoreCreator;
return this;
} | [
"public",
"ServiceBuilder",
"withStreamSegmentStore",
"(",
"Function",
"<",
"ComponentSetup",
",",
"StreamSegmentStore",
">",
"streamSegmentStoreCreator",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"streamSegmentStoreCreator",
",",
"\"streamSegmentStoreCreator\"",
")",
";",
"this",
".",
"streamSegmentStoreCreator",
"=",
"streamSegmentStoreCreator",
";",
"return",
"this",
";",
"}"
] | Attaches the given StreamSegmentStore creator to this ServiceBuilder. The given Function will not be invoked
right away; it will be called when needed.
@param streamSegmentStoreCreator The Function to attach.
@return This ServiceBuilder. | [
"Attaches",
"the",
"given",
"StreamSegmentStore",
"creator",
"to",
"this",
"ServiceBuilder",
".",
"The",
"given",
"Function",
"will",
"not",
"be",
"invoked",
"right",
"away",
";",
"it",
"will",
"be",
"called",
"when",
"needed",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L222-L226 |
to2mbn/JMCCC | jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java | Versions.resolveVersion | public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
"""
Resolves the version.
@param minecraftDir the minecraft directory
@param version the version name
@return the version object, or null if the version does not exist
@throws IOException if an I/O error has occurred during resolving version
@throws NullPointerException if
<code>minecraftDir==null || version==null</code>
"""
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current());
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
}
} else {
return null;
}
} | java | public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current());
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
}
} else {
return null;
}
} | [
"public",
"static",
"Version",
"resolveVersion",
"(",
"MinecraftDirectory",
"minecraftDir",
",",
"String",
"version",
")",
"throws",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"minecraftDir",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"version",
")",
";",
"if",
"(",
"doesVersionExist",
"(",
"minecraftDir",
",",
"version",
")",
")",
"{",
"try",
"{",
"return",
"getVersionParser",
"(",
")",
".",
"parseVersion",
"(",
"resolveVersionHierarchy",
"(",
"version",
",",
"minecraftDir",
")",
",",
"PlatformDescription",
".",
"current",
"(",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Couldn't parse version json: \"",
"+",
"version",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Resolves the version.
@param minecraftDir the minecraft directory
@param version the version name
@return the version object, or null if the version does not exist
@throws IOException if an I/O error has occurred during resolving version
@throws NullPointerException if
<code>minecraftDir==null || version==null</code> | [
"Resolves",
"the",
"version",
"."
] | train | https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/version/parsing/Versions.java#L36-L49 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java | JoinPoint.listenInlineOnAllDone | public static void listenInlineOnAllDone(Runnable listener, ISynchronizationPoint<?>... synchPoints) {
"""
Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint,
and add the given listener to be called when the JoinPoint is unblocked.
The JoinPoint is not unblocked until all synchronization points are unblocked.
If any has error or is cancel, the error or cancellation reason is not given to the JoinPoint,
in contrary of the method listenInline.
"""
JoinPoint<NoException> jp = new JoinPoint<>();
jp.addToJoin(synchPoints.length);
Runnable jpr = new Runnable() {
@Override
public void run() {
jp.joined();
}
};
for (int i = 0; i < synchPoints.length; ++i)
synchPoints[i].listenInline(jpr);
jp.start();
jp.listenInline(listener);
} | java | public static void listenInlineOnAllDone(Runnable listener, ISynchronizationPoint<?>... synchPoints) {
JoinPoint<NoException> jp = new JoinPoint<>();
jp.addToJoin(synchPoints.length);
Runnable jpr = new Runnable() {
@Override
public void run() {
jp.joined();
}
};
for (int i = 0; i < synchPoints.length; ++i)
synchPoints[i].listenInline(jpr);
jp.start();
jp.listenInline(listener);
} | [
"public",
"static",
"void",
"listenInlineOnAllDone",
"(",
"Runnable",
"listener",
",",
"ISynchronizationPoint",
"<",
"?",
">",
"...",
"synchPoints",
")",
"{",
"JoinPoint",
"<",
"NoException",
">",
"jp",
"=",
"new",
"JoinPoint",
"<>",
"(",
")",
";",
"jp",
".",
"addToJoin",
"(",
"synchPoints",
".",
"length",
")",
";",
"Runnable",
"jpr",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"jp",
".",
"joined",
"(",
")",
";",
"}",
"}",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"synchPoints",
".",
"length",
";",
"++",
"i",
")",
"synchPoints",
"[",
"i",
"]",
".",
"listenInline",
"(",
"jpr",
")",
";",
"jp",
".",
"start",
"(",
")",
";",
"jp",
".",
"listenInline",
"(",
"listener",
")",
";",
"}"
] | Shortcut method to create a JoinPoint waiting for the given synchronization points, start the JoinPoint,
and add the given listener to be called when the JoinPoint is unblocked.
The JoinPoint is not unblocked until all synchronization points are unblocked.
If any has error or is cancel, the error or cancellation reason is not given to the JoinPoint,
in contrary of the method listenInline. | [
"Shortcut",
"method",
"to",
"create",
"a",
"JoinPoint",
"waiting",
"for",
"the",
"given",
"synchronization",
"points",
"start",
"the",
"JoinPoint",
"and",
"add",
"the",
"given",
"listener",
"to",
"be",
"called",
"when",
"the",
"JoinPoint",
"is",
"unblocked",
".",
"The",
"JoinPoint",
"is",
"not",
"unblocked",
"until",
"all",
"synchronization",
"points",
"are",
"unblocked",
".",
"If",
"any",
"has",
"error",
"or",
"is",
"cancel",
"the",
"error",
"or",
"cancellation",
"reason",
"is",
"not",
"given",
"to",
"the",
"JoinPoint",
"in",
"contrary",
"of",
"the",
"method",
"listenInline",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/synch/JoinPoint.java#L291-L304 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Query.java | Query.addInsidePolygon | public Query addInsidePolygon(float latitude, float longitude) {
"""
Add a point to the polygon of geo-search (requires a minimum of three points to define a valid polygon)
At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form "_geoloc":{"lat":48.853409, "lng":2.348800} or
"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}] if you have several geo-locations in your record).
"""
if (insidePolygon == null) {
insidePolygon = "insidePolygon=" + latitude + "," + longitude;
} else if (insidePolygon.length() > 14) {
insidePolygon += "," + latitude + "," + longitude;
}
return this;
} | java | public Query addInsidePolygon(float latitude, float longitude) {
if (insidePolygon == null) {
insidePolygon = "insidePolygon=" + latitude + "," + longitude;
} else if (insidePolygon.length() > 14) {
insidePolygon += "," + latitude + "," + longitude;
}
return this;
} | [
"public",
"Query",
"addInsidePolygon",
"(",
"float",
"latitude",
",",
"float",
"longitude",
")",
"{",
"if",
"(",
"insidePolygon",
"==",
"null",
")",
"{",
"insidePolygon",
"=",
"\"insidePolygon=\"",
"+",
"latitude",
"+",
"\",\"",
"+",
"longitude",
";",
"}",
"else",
"if",
"(",
"insidePolygon",
".",
"length",
"(",
")",
">",
"14",
")",
"{",
"insidePolygon",
"+=",
"\",\"",
"+",
"latitude",
"+",
"\",\"",
"+",
"longitude",
";",
"}",
"return",
"this",
";",
"}"
] | Add a point to the polygon of geo-search (requires a minimum of three points to define a valid polygon)
At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form "_geoloc":{"lat":48.853409, "lng":2.348800} or
"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}] if you have several geo-locations in your record). | [
"Add",
"a",
"point",
"to",
"the",
"polygon",
"of",
"geo",
"-",
"search",
"(",
"requires",
"a",
"minimum",
"of",
"three",
"points",
"to",
"define",
"a",
"valid",
"polygon",
")",
"At",
"indexing",
"you",
"should",
"specify",
"geoloc",
"of",
"an",
"object",
"with",
"the",
"_geoloc",
"attribute",
"(",
"in",
"the",
"form",
"_geoloc",
":",
"{",
"lat",
":",
"48",
".",
"853409",
"lng",
":",
"2",
".",
"348800",
"}",
"or",
"_geoloc",
":",
"[",
"{",
"lat",
":",
"48",
".",
"853409",
"lng",
":",
"2",
".",
"348800",
"}",
"{",
"lat",
":",
"48",
".",
"547456",
"lng",
":",
"2",
".",
"972075",
"}",
"]",
"if",
"you",
"have",
"several",
"geo",
"-",
"locations",
"in",
"your",
"record",
")",
"."
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Query.java#L542-L549 |
alkacon/opencms-core | src/org/opencms/webdav/CmsWebdavServlet.java | CmsWebdavServlet.addElement | public static Element addElement(Element parent, String name) {
"""
Adds an xml element to the given parent and sets the appropriate namespace and
prefix.<p>
@param parent the parent node to add the element
@param name the name of the new element
@return the created element with the given name which was added to the given parent
"""
return parent.addElement(new QName(name, Namespace.get("D", DEFAULT_NAMESPACE)));
} | java | public static Element addElement(Element parent, String name) {
return parent.addElement(new QName(name, Namespace.get("D", DEFAULT_NAMESPACE)));
} | [
"public",
"static",
"Element",
"addElement",
"(",
"Element",
"parent",
",",
"String",
"name",
")",
"{",
"return",
"parent",
".",
"addElement",
"(",
"new",
"QName",
"(",
"name",
",",
"Namespace",
".",
"get",
"(",
"\"D\"",
",",
"DEFAULT_NAMESPACE",
")",
")",
")",
";",
"}"
] | Adds an xml element to the given parent and sets the appropriate namespace and
prefix.<p>
@param parent the parent node to add the element
@param name the name of the new element
@return the created element with the given name which was added to the given parent | [
"Adds",
"an",
"xml",
"element",
"to",
"the",
"given",
"parent",
"and",
"sets",
"the",
"appropriate",
"namespace",
"and",
"prefix",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L406-L409 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/Manager.java | Manager.registerEncryptionKey | @InterfaceAudience.Public
public boolean registerEncryptionKey(Object keyOrPassword, String databaseName) {
"""
This method has been superseded by {@link #openDatabase(String, DatabaseOptions)}.
Registers an encryption key for a database. This must be called _before_ opening an encrypted
database, or before creating a database that's to be encrypted.
If the key is incorrect (or no key is given for an encrypted database), the subsequent call
to open the database will fail with an error with code 401.
To use this API, the database storage engine must support encryption, and the
ManagerOptions.EnableStorageEncryption property must be set to true. Otherwise opening
the database will fail with an error.
@param keyOrPassword The encryption key in the form of an String (a password) or an
byte[] object exactly 32 bytes in length (a raw AES key.)
If a string is given, it will be internally converted to a raw key
using 64,000 rounds of PBKDF2 hashing.
A null value is legal, and clears a previously-registered key.
@param databaseName The name of the database.
@return True if the key can be used, False if it's not in a legal form
(e.g. key as a byte[] is not 32 bytes in length.)
"""
if (databaseName == null)
return false;
if (keyOrPassword != null) {
encryptionKeys.put(databaseName, keyOrPassword);
} else
encryptionKeys.remove(databaseName);
return true;
} | java | @InterfaceAudience.Public
public boolean registerEncryptionKey(Object keyOrPassword, String databaseName) {
if (databaseName == null)
return false;
if (keyOrPassword != null) {
encryptionKeys.put(databaseName, keyOrPassword);
} else
encryptionKeys.remove(databaseName);
return true;
} | [
"@",
"InterfaceAudience",
".",
"Public",
"public",
"boolean",
"registerEncryptionKey",
"(",
"Object",
"keyOrPassword",
",",
"String",
"databaseName",
")",
"{",
"if",
"(",
"databaseName",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"keyOrPassword",
"!=",
"null",
")",
"{",
"encryptionKeys",
".",
"put",
"(",
"databaseName",
",",
"keyOrPassword",
")",
";",
"}",
"else",
"encryptionKeys",
".",
"remove",
"(",
"databaseName",
")",
";",
"return",
"true",
";",
"}"
] | This method has been superseded by {@link #openDatabase(String, DatabaseOptions)}.
Registers an encryption key for a database. This must be called _before_ opening an encrypted
database, or before creating a database that's to be encrypted.
If the key is incorrect (or no key is given for an encrypted database), the subsequent call
to open the database will fail with an error with code 401.
To use this API, the database storage engine must support encryption, and the
ManagerOptions.EnableStorageEncryption property must be set to true. Otherwise opening
the database will fail with an error.
@param keyOrPassword The encryption key in the form of an String (a password) or an
byte[] object exactly 32 bytes in length (a raw AES key.)
If a string is given, it will be internally converted to a raw key
using 64,000 rounds of PBKDF2 hashing.
A null value is legal, and clears a previously-registered key.
@param databaseName The name of the database.
@return True if the key can be used, False if it's not in a legal form
(e.g. key as a byte[] is not 32 bytes in length.) | [
"This",
"method",
"has",
"been",
"superseded",
"by",
"{",
"@link",
"#openDatabase",
"(",
"String",
"DatabaseOptions",
")",
"}",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/Manager.java#L366-L375 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java | CommerceDiscountPersistenceImpl.countByG_C | @Override
public int countByG_C(long groupId, String couponCode) {
"""
Returns the number of commerce discounts where groupId = ? and couponCode = ?.
@param groupId the group ID
@param couponCode the coupon code
@return the number of matching commerce discounts
"""
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C;
Object[] finderArgs = new Object[] { groupId, couponCode };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEDISCOUNT_WHERE);
query.append(_FINDER_COLUMN_G_C_GROUPID_2);
boolean bindCouponCode = false;
if (couponCode == null) {
query.append(_FINDER_COLUMN_G_C_COUPONCODE_1);
}
else if (couponCode.equals("")) {
query.append(_FINDER_COLUMN_G_C_COUPONCODE_3);
}
else {
bindCouponCode = true;
query.append(_FINDER_COLUMN_G_C_COUPONCODE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindCouponCode) {
qPos.add(couponCode);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByG_C(long groupId, String couponCode) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_C;
Object[] finderArgs = new Object[] { groupId, couponCode };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_COMMERCEDISCOUNT_WHERE);
query.append(_FINDER_COLUMN_G_C_GROUPID_2);
boolean bindCouponCode = false;
if (couponCode == null) {
query.append(_FINDER_COLUMN_G_C_COUPONCODE_1);
}
else if (couponCode.equals("")) {
query.append(_FINDER_COLUMN_G_C_COUPONCODE_3);
}
else {
bindCouponCode = true;
query.append(_FINDER_COLUMN_G_C_COUPONCODE_2);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindCouponCode) {
qPos.add(couponCode);
}
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByG_C",
"(",
"long",
"groupId",
",",
"String",
"couponCode",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_G_C",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"groupId",
",",
"couponCode",
"}",
";",
"Long",
"count",
"=",
"(",
"Long",
")",
"finderCache",
".",
"getResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"this",
")",
";",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"StringBundler",
"query",
"=",
"new",
"StringBundler",
"(",
"3",
")",
";",
"query",
".",
"append",
"(",
"_SQL_COUNT_COMMERCEDISCOUNT_WHERE",
")",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_C_GROUPID_2",
")",
";",
"boolean",
"bindCouponCode",
"=",
"false",
";",
"if",
"(",
"couponCode",
"==",
"null",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_C_COUPONCODE_1",
")",
";",
"}",
"else",
"if",
"(",
"couponCode",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_C_COUPONCODE_3",
")",
";",
"}",
"else",
"{",
"bindCouponCode",
"=",
"true",
";",
"query",
".",
"append",
"(",
"_FINDER_COLUMN_G_C_COUPONCODE_2",
")",
";",
"}",
"String",
"sql",
"=",
"query",
".",
"toString",
"(",
")",
";",
"Session",
"session",
"=",
"null",
";",
"try",
"{",
"session",
"=",
"openSession",
"(",
")",
";",
"Query",
"q",
"=",
"session",
".",
"createQuery",
"(",
"sql",
")",
";",
"QueryPos",
"qPos",
"=",
"QueryPos",
".",
"getInstance",
"(",
"q",
")",
";",
"qPos",
".",
"add",
"(",
"groupId",
")",
";",
"if",
"(",
"bindCouponCode",
")",
"{",
"qPos",
".",
"add",
"(",
"couponCode",
")",
";",
"}",
"count",
"=",
"(",
"Long",
")",
"q",
".",
"uniqueResult",
"(",
")",
";",
"finderCache",
".",
"putResult",
"(",
"finderPath",
",",
"finderArgs",
",",
"count",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"finderCache",
".",
"removeResult",
"(",
"finderPath",
",",
"finderArgs",
")",
";",
"throw",
"processException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"closeSession",
"(",
"session",
")",
";",
"}",
"}",
"return",
"count",
".",
"intValue",
"(",
")",
";",
"}"
] | Returns the number of commerce discounts where groupId = ? and couponCode = ?.
@param groupId the group ID
@param couponCode the coupon code
@return the number of matching commerce discounts | [
"Returns",
"the",
"number",
"of",
"commerce",
"discounts",
"where",
"groupId",
"=",
"?",
";",
"and",
"couponCode",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L3235-L3296 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java | NodeImpl.versionHistory | public VersionHistoryImpl versionHistory(boolean pool) throws UnsupportedRepositoryOperationException,
RepositoryException {
"""
For internal use. Doesn't check the InvalidItemStateException and may return unpooled
VersionHistory object.
@param pool
boolean, true if result should be pooled in Session
@return VersionHistoryImpl
@throws UnsupportedRepositoryOperationException
if versions is nopt supported
@throws RepositoryException
if error occurs
"""
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException("Node is not mix:versionable " + getPath());
}
PropertyData vhProp =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
ItemType.PROPERTY);
if (vhProp == null)
{
throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());
}
return (VersionHistoryImpl)dataManager.getItemByIdentifier(ValueDataUtil.getString(vhProp.getValues().get(0)),
pool, false);
} | java | public VersionHistoryImpl versionHistory(boolean pool) throws UnsupportedRepositoryOperationException,
RepositoryException
{
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException("Node is not mix:versionable " + getPath());
}
PropertyData vhProp =
(PropertyData)dataManager.getItemData(nodeData(), new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
ItemType.PROPERTY);
if (vhProp == null)
{
throw new UnsupportedRepositoryOperationException("Node does not have jcr:versionHistory " + getPath());
}
return (VersionHistoryImpl)dataManager.getItemByIdentifier(ValueDataUtil.getString(vhProp.getValues().get(0)),
pool, false);
} | [
"public",
"VersionHistoryImpl",
"versionHistory",
"(",
"boolean",
"pool",
")",
"throws",
"UnsupportedRepositoryOperationException",
",",
"RepositoryException",
"{",
"if",
"(",
"!",
"this",
".",
"isNodeType",
"(",
"Constants",
".",
"MIX_VERSIONABLE",
")",
")",
"{",
"throw",
"new",
"UnsupportedRepositoryOperationException",
"(",
"\"Node is not mix:versionable \"",
"+",
"getPath",
"(",
")",
")",
";",
"}",
"PropertyData",
"vhProp",
"=",
"(",
"PropertyData",
")",
"dataManager",
".",
"getItemData",
"(",
"nodeData",
"(",
")",
",",
"new",
"QPathEntry",
"(",
"Constants",
".",
"JCR_VERSIONHISTORY",
",",
"1",
")",
",",
"ItemType",
".",
"PROPERTY",
")",
";",
"if",
"(",
"vhProp",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedRepositoryOperationException",
"(",
"\"Node does not have jcr:versionHistory \"",
"+",
"getPath",
"(",
")",
")",
";",
"}",
"return",
"(",
"VersionHistoryImpl",
")",
"dataManager",
".",
"getItemByIdentifier",
"(",
"ValueDataUtil",
".",
"getString",
"(",
"vhProp",
".",
"getValues",
"(",
")",
".",
"get",
"(",
"0",
")",
")",
",",
"pool",
",",
"false",
")",
";",
"}"
] | For internal use. Doesn't check the InvalidItemStateException and may return unpooled
VersionHistory object.
@param pool
boolean, true if result should be pooled in Session
@return VersionHistoryImpl
@throws UnsupportedRepositoryOperationException
if versions is nopt supported
@throws RepositoryException
if error occurs | [
"For",
"internal",
"use",
".",
"Doesn",
"t",
"check",
"the",
"InvalidItemStateException",
"and",
"may",
"return",
"unpooled",
"VersionHistory",
"object",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java#L2600-L2618 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.crossRatios | public static double crossRatios( Point3D_F64 a0 , Point3D_F64 a1 , Point3D_F64 a2 , Point3D_F64 a3) {
"""
Computes the cross-ratio between 4 points. This is an invariant under projective geometry.
@param a0 Point
@param a1 Point
@param a2 Point
@param a3 Point
@return cross ratio
"""
double d01 = a0.distance(a1);
double d23 = a2.distance(a3);
double d02 = a0.distance(a2);
double d13 = a1.distance(a3);
return (d01*d23)/(d02*d13);
} | java | public static double crossRatios( Point3D_F64 a0 , Point3D_F64 a1 , Point3D_F64 a2 , Point3D_F64 a3) {
double d01 = a0.distance(a1);
double d23 = a2.distance(a3);
double d02 = a0.distance(a2);
double d13 = a1.distance(a3);
return (d01*d23)/(d02*d13);
} | [
"public",
"static",
"double",
"crossRatios",
"(",
"Point3D_F64",
"a0",
",",
"Point3D_F64",
"a1",
",",
"Point3D_F64",
"a2",
",",
"Point3D_F64",
"a3",
")",
"{",
"double",
"d01",
"=",
"a0",
".",
"distance",
"(",
"a1",
")",
";",
"double",
"d23",
"=",
"a2",
".",
"distance",
"(",
"a3",
")",
";",
"double",
"d02",
"=",
"a0",
".",
"distance",
"(",
"a2",
")",
";",
"double",
"d13",
"=",
"a1",
".",
"distance",
"(",
"a3",
")",
";",
"return",
"(",
"d01",
"*",
"d23",
")",
"/",
"(",
"d02",
"*",
"d13",
")",
";",
"}"
] | Computes the cross-ratio between 4 points. This is an invariant under projective geometry.
@param a0 Point
@param a1 Point
@param a2 Point
@param a3 Point
@return cross ratio | [
"Computes",
"the",
"cross",
"-",
"ratio",
"between",
"4",
"points",
".",
"This",
"is",
"an",
"invariant",
"under",
"projective",
"geometry",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L720-L727 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/html/HtmlUtils.java | HtmlUtils.generateAttribute | public static String generateAttribute(String attributeName, String value) {
"""
Generate the HTML code for an attribute.
@param attributeName the name of the attribute.
@param value the value of the attribute.
@return the HTML attribute.
"""
return SgmlUtils.generateAttribute(attributeName, value);
} | java | public static String generateAttribute(String attributeName, String value)
{
return SgmlUtils.generateAttribute(attributeName, value);
} | [
"public",
"static",
"String",
"generateAttribute",
"(",
"String",
"attributeName",
",",
"String",
"value",
")",
"{",
"return",
"SgmlUtils",
".",
"generateAttribute",
"(",
"attributeName",
",",
"value",
")",
";",
"}"
] | Generate the HTML code for an attribute.
@param attributeName the name of the attribute.
@param value the value of the attribute.
@return the HTML attribute. | [
"Generate",
"the",
"HTML",
"code",
"for",
"an",
"attribute",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/html/HtmlUtils.java#L216-L219 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.asSuper | public Type asSuper(Type t, Symbol sym) {
"""
Return the (most specific) base type of t that starts with the
given symbol. If none exists, return null.
Caveat Emptor: Since javac represents the class of all arrays with a singleton
symbol Symtab.arrayClass, which by being a singleton cannot hold any discriminant,
this method could yield surprising answers when invoked on arrays. For example when
invoked with t being byte [] and sym being t.sym itself, asSuper would answer null.
@param t a type
@param sym a symbol
"""
/* Some examples:
*
* (Enum<E>, Comparable) => Comparable<E>
* (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>
* (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree
* (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>
* Iterable<capture#160 of ? extends c.s.s.d.DocTree>
*/
if (sym.type == syms.objectType) { //optimization
return syms.objectType;
}
return asSuper.visit(t, sym);
} | java | public Type asSuper(Type t, Symbol sym) {
/* Some examples:
*
* (Enum<E>, Comparable) => Comparable<E>
* (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>
* (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree
* (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>
* Iterable<capture#160 of ? extends c.s.s.d.DocTree>
*/
if (sym.type == syms.objectType) { //optimization
return syms.objectType;
}
return asSuper.visit(t, sym);
} | [
"public",
"Type",
"asSuper",
"(",
"Type",
"t",
",",
"Symbol",
"sym",
")",
"{",
"/* Some examples:\n *\n * (Enum<E>, Comparable) => Comparable<E>\n * (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>\n * (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree\n * (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>\n * Iterable<capture#160 of ? extends c.s.s.d.DocTree>\n */",
"if",
"(",
"sym",
".",
"type",
"==",
"syms",
".",
"objectType",
")",
"{",
"//optimization",
"return",
"syms",
".",
"objectType",
";",
"}",
"return",
"asSuper",
".",
"visit",
"(",
"t",
",",
"sym",
")",
";",
"}"
] | Return the (most specific) base type of t that starts with the
given symbol. If none exists, return null.
Caveat Emptor: Since javac represents the class of all arrays with a singleton
symbol Symtab.arrayClass, which by being a singleton cannot hold any discriminant,
this method could yield surprising answers when invoked on arrays. For example when
invoked with t being byte [] and sym being t.sym itself, asSuper would answer null.
@param t a type
@param sym a symbol | [
"Return",
"the",
"(",
"most",
"specific",
")",
"base",
"type",
"of",
"t",
"that",
"starts",
"with",
"the",
"given",
"symbol",
".",
"If",
"none",
"exists",
"return",
"null",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1853-L1866 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCDriver.java | JDBCDriver.getPropertyInfo | public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
"""
Gets information about the possible properties for this driver. <p>
The getPropertyInfo method is intended to allow a generic GUI tool
to discover what properties it should prompt a human for in order to
get enough information to connect to a database. Note that depending
on the values the human has supplied so far, additional values may
become necessary, so it may be necessary to iterate though several
calls to getPropertyInfo.<p>
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB uses the values submitted in info to set the value for
each DriverPropertyInfo object returned. It does not use the default
value that it would use for the property if the value is null. <p>
</div> <!-- end release-specific documentation -->
@param url the URL of the database to which to connect
@param info a proposed list of tag/value pairs that will be sent on
connect open
@return an array of DriverPropertyInfo objects describing possible
properties. This array may be an empty array if no properties
are required.
"""
if (!acceptsURL(url)) {
return new DriverPropertyInfo[0];
}
String[] choices = new String[] {
"true", "false"
};
DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6];
DriverPropertyInfo p;
if (info == null) {
info = new Properties();
}
p = new DriverPropertyInfo("user", null);
p.value = info.getProperty("user");
p.required = true;
pinfo[0] = p;
p = new DriverPropertyInfo("password", null);
p.value = info.getProperty("password");
p.required = true;
pinfo[1] = p;
p = new DriverPropertyInfo("get_column_name", null);
p.value = info.getProperty("get_column_name", "true");
p.required = false;
p.choices = choices;
pinfo[2] = p;
p = new DriverPropertyInfo("ifexists", null);
p.value = info.getProperty("ifexists", "false");
p.required = false;
p.choices = choices;
pinfo[3] = p;
p = new DriverPropertyInfo("default_schema", null);
p.value = info.getProperty("default_schema", "false");
p.required = false;
p.choices = choices;
pinfo[4] = p;
p = new DriverPropertyInfo("shutdown", null);
p.value = info.getProperty("shutdown", "false");
p.required = false;
p.choices = choices;
pinfo[5] = p;
return pinfo;
} | java | public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
if (!acceptsURL(url)) {
return new DriverPropertyInfo[0];
}
String[] choices = new String[] {
"true", "false"
};
DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6];
DriverPropertyInfo p;
if (info == null) {
info = new Properties();
}
p = new DriverPropertyInfo("user", null);
p.value = info.getProperty("user");
p.required = true;
pinfo[0] = p;
p = new DriverPropertyInfo("password", null);
p.value = info.getProperty("password");
p.required = true;
pinfo[1] = p;
p = new DriverPropertyInfo("get_column_name", null);
p.value = info.getProperty("get_column_name", "true");
p.required = false;
p.choices = choices;
pinfo[2] = p;
p = new DriverPropertyInfo("ifexists", null);
p.value = info.getProperty("ifexists", "false");
p.required = false;
p.choices = choices;
pinfo[3] = p;
p = new DriverPropertyInfo("default_schema", null);
p.value = info.getProperty("default_schema", "false");
p.required = false;
p.choices = choices;
pinfo[4] = p;
p = new DriverPropertyInfo("shutdown", null);
p.value = info.getProperty("shutdown", "false");
p.required = false;
p.choices = choices;
pinfo[5] = p;
return pinfo;
} | [
"public",
"DriverPropertyInfo",
"[",
"]",
"getPropertyInfo",
"(",
"String",
"url",
",",
"Properties",
"info",
")",
"{",
"if",
"(",
"!",
"acceptsURL",
"(",
"url",
")",
")",
"{",
"return",
"new",
"DriverPropertyInfo",
"[",
"0",
"]",
";",
"}",
"String",
"[",
"]",
"choices",
"=",
"new",
"String",
"[",
"]",
"{",
"\"true\"",
",",
"\"false\"",
"}",
";",
"DriverPropertyInfo",
"[",
"]",
"pinfo",
"=",
"new",
"DriverPropertyInfo",
"[",
"6",
"]",
";",
"DriverPropertyInfo",
"p",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"info",
"=",
"new",
"Properties",
"(",
")",
";",
"}",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"user\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"user\"",
")",
";",
"p",
".",
"required",
"=",
"true",
";",
"pinfo",
"[",
"0",
"]",
"=",
"p",
";",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"password\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"password\"",
")",
";",
"p",
".",
"required",
"=",
"true",
";",
"pinfo",
"[",
"1",
"]",
"=",
"p",
";",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"get_column_name\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"get_column_name\"",
",",
"\"true\"",
")",
";",
"p",
".",
"required",
"=",
"false",
";",
"p",
".",
"choices",
"=",
"choices",
";",
"pinfo",
"[",
"2",
"]",
"=",
"p",
";",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"ifexists\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"ifexists\"",
",",
"\"false\"",
")",
";",
"p",
".",
"required",
"=",
"false",
";",
"p",
".",
"choices",
"=",
"choices",
";",
"pinfo",
"[",
"3",
"]",
"=",
"p",
";",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"default_schema\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"default_schema\"",
",",
"\"false\"",
")",
";",
"p",
".",
"required",
"=",
"false",
";",
"p",
".",
"choices",
"=",
"choices",
";",
"pinfo",
"[",
"4",
"]",
"=",
"p",
";",
"p",
"=",
"new",
"DriverPropertyInfo",
"(",
"\"shutdown\"",
",",
"null",
")",
";",
"p",
".",
"value",
"=",
"info",
".",
"getProperty",
"(",
"\"shutdown\"",
",",
"\"false\"",
")",
";",
"p",
".",
"required",
"=",
"false",
";",
"p",
".",
"choices",
"=",
"choices",
";",
"pinfo",
"[",
"5",
"]",
"=",
"p",
";",
"return",
"pinfo",
";",
"}"
] | Gets information about the possible properties for this driver. <p>
The getPropertyInfo method is intended to allow a generic GUI tool
to discover what properties it should prompt a human for in order to
get enough information to connect to a database. Note that depending
on the values the human has supplied so far, additional values may
become necessary, so it may be necessary to iterate though several
calls to getPropertyInfo.<p>
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB uses the values submitted in info to set the value for
each DriverPropertyInfo object returned. It does not use the default
value that it would use for the property if the value is null. <p>
</div> <!-- end release-specific documentation -->
@param url the URL of the database to which to connect
@param info a proposed list of tag/value pairs that will be sent on
connect open
@return an array of DriverPropertyInfo objects describing possible
properties. This array may be an empty array if no properties
are required. | [
"Gets",
"information",
"about",
"the",
"possible",
"properties",
"for",
"this",
"driver",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCDriver.java#L389-L434 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java | ConstructState.addOverwriteProperties | public void addOverwriteProperties(Map<String, String> properties) {
"""
Add a set of properties that will overwrite properties in the {@link WorkUnitState}.
@param properties Properties to override.
"""
Map<String, String> previousOverwriteProps = getOverwritePropertiesMap();
previousOverwriteProps.putAll(properties);
setProp(OVERWRITE_PROPS_KEY, serializeMap(previousOverwriteProps));
} | java | public void addOverwriteProperties(Map<String, String> properties) {
Map<String, String> previousOverwriteProps = getOverwritePropertiesMap();
previousOverwriteProps.putAll(properties);
setProp(OVERWRITE_PROPS_KEY, serializeMap(previousOverwriteProps));
} | [
"public",
"void",
"addOverwriteProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"previousOverwriteProps",
"=",
"getOverwritePropertiesMap",
"(",
")",
";",
"previousOverwriteProps",
".",
"putAll",
"(",
"properties",
")",
";",
"setProp",
"(",
"OVERWRITE_PROPS_KEY",
",",
"serializeMap",
"(",
"previousOverwriteProps",
")",
")",
";",
"}"
] | Add a set of properties that will overwrite properties in the {@link WorkUnitState}.
@param properties Properties to override. | [
"Add",
"a",
"set",
"of",
"properties",
"that",
"will",
"overwrite",
"properties",
"in",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L61-L65 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java | EventSubscriptionDeclaration.createSubscriptionForExecution | public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) {
"""
Creates and inserts a subscription entity depending on the message type of this declaration.
"""
EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType);
String eventName = resolveExpressionOfEventName(execution);
eventSubscriptionEntity.setEventName(eventName);
if (activityId != null) {
ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
eventSubscriptionEntity.setActivity(activity);
}
eventSubscriptionEntity.insert();
LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity);
return eventSubscriptionEntity;
} | java | public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) {
EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType);
String eventName = resolveExpressionOfEventName(execution);
eventSubscriptionEntity.setEventName(eventName);
if (activityId != null) {
ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
eventSubscriptionEntity.setActivity(activity);
}
eventSubscriptionEntity.insert();
LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity);
return eventSubscriptionEntity;
} | [
"public",
"EventSubscriptionEntity",
"createSubscriptionForExecution",
"(",
"ExecutionEntity",
"execution",
")",
"{",
"EventSubscriptionEntity",
"eventSubscriptionEntity",
"=",
"new",
"EventSubscriptionEntity",
"(",
"execution",
",",
"eventType",
")",
";",
"String",
"eventName",
"=",
"resolveExpressionOfEventName",
"(",
"execution",
")",
";",
"eventSubscriptionEntity",
".",
"setEventName",
"(",
"eventName",
")",
";",
"if",
"(",
"activityId",
"!=",
"null",
")",
"{",
"ActivityImpl",
"activity",
"=",
"execution",
".",
"getProcessDefinition",
"(",
")",
".",
"findActivity",
"(",
"activityId",
")",
";",
"eventSubscriptionEntity",
".",
"setActivity",
"(",
"activity",
")",
";",
"}",
"eventSubscriptionEntity",
".",
"insert",
"(",
")",
";",
"LegacyBehavior",
".",
"removeLegacySubscriptionOnParent",
"(",
"execution",
",",
"eventSubscriptionEntity",
")",
";",
"return",
"eventSubscriptionEntity",
";",
"}"
] | Creates and inserts a subscription entity depending on the message type of this declaration. | [
"Creates",
"and",
"inserts",
"a",
"subscription",
"entity",
"depending",
"on",
"the",
"message",
"type",
"of",
"this",
"declaration",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java#L152-L166 |
aicer/hibiscus-http-client | src/main/java/org/aicer/hibiscus/http/client/HttpClient.java | HttpClient.addNameValuePair | public final HttpClient addNameValuePair(final String param, final Integer value) {
"""
Used by Entity-Enclosing HTTP Requests to send Name-Value pairs in the body of the request
@param param Name of Parameter
@param value Value of Parameter
@return
"""
return addNameValuePair(param, value.toString());
} | java | public final HttpClient addNameValuePair(final String param, final Integer value) {
return addNameValuePair(param, value.toString());
} | [
"public",
"final",
"HttpClient",
"addNameValuePair",
"(",
"final",
"String",
"param",
",",
"final",
"Integer",
"value",
")",
"{",
"return",
"addNameValuePair",
"(",
"param",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Used by Entity-Enclosing HTTP Requests to send Name-Value pairs in the body of the request
@param param Name of Parameter
@param value Value of Parameter
@return | [
"Used",
"by",
"Entity",
"-",
"Enclosing",
"HTTP",
"Requests",
"to",
"send",
"Name",
"-",
"Value",
"pairs",
"in",
"the",
"body",
"of",
"the",
"request"
] | train | https://github.com/aicer/hibiscus-http-client/blob/a037e3cf8d4bb862d38a55a090778736a48d67cc/src/main/java/org/aicer/hibiscus/http/client/HttpClient.java#L269-L271 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java | Bean.setPin | public void setPin(int pin, boolean active) {
"""
Set the Bean's security code.
@param pin the 6 digit pin as a number, e.g. <code>123456</code>
@param active true to enable authenticated mode, false to disable the current pin
"""
Buffer buffer = new Buffer();
buffer.writeIntLe(pin);
buffer.writeByte(active ? 1 : 0);
sendMessage(BeanMessageID.BT_SET_PIN, buffer);
} | java | public void setPin(int pin, boolean active) {
Buffer buffer = new Buffer();
buffer.writeIntLe(pin);
buffer.writeByte(active ? 1 : 0);
sendMessage(BeanMessageID.BT_SET_PIN, buffer);
} | [
"public",
"void",
"setPin",
"(",
"int",
"pin",
",",
"boolean",
"active",
")",
"{",
"Buffer",
"buffer",
"=",
"new",
"Buffer",
"(",
")",
";",
"buffer",
".",
"writeIntLe",
"(",
"pin",
")",
";",
"buffer",
".",
"writeByte",
"(",
"active",
"?",
"1",
":",
"0",
")",
";",
"sendMessage",
"(",
"BeanMessageID",
".",
"BT_SET_PIN",
",",
"buffer",
")",
";",
"}"
] | Set the Bean's security code.
@param pin the 6 digit pin as a number, e.g. <code>123456</code>
@param active true to enable authenticated mode, false to disable the current pin | [
"Set",
"the",
"Bean",
"s",
"security",
"code",
"."
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L986-L991 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/DevicesManagementApi.java | DevicesManagementApi.queryProperties | public MetadataQueryEnvelope queryProperties(String dtid, Integer count, Integer offset, String filter, Boolean includeTimestamp) throws ApiException {
"""
Query device properties across devices.
Query device properties across devices.
@param dtid Device Type ID. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@param filter Query filter. Comma-separated key=value pairs (optional)
@param includeTimestamp Include timestamp. (optional)
@return MetadataQueryEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<MetadataQueryEnvelope> resp = queryPropertiesWithHttpInfo(dtid, count, offset, filter, includeTimestamp);
return resp.getData();
} | java | public MetadataQueryEnvelope queryProperties(String dtid, Integer count, Integer offset, String filter, Boolean includeTimestamp) throws ApiException {
ApiResponse<MetadataQueryEnvelope> resp = queryPropertiesWithHttpInfo(dtid, count, offset, filter, includeTimestamp);
return resp.getData();
} | [
"public",
"MetadataQueryEnvelope",
"queryProperties",
"(",
"String",
"dtid",
",",
"Integer",
"count",
",",
"Integer",
"offset",
",",
"String",
"filter",
",",
"Boolean",
"includeTimestamp",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"MetadataQueryEnvelope",
">",
"resp",
"=",
"queryPropertiesWithHttpInfo",
"(",
"dtid",
",",
"count",
",",
"offset",
",",
"filter",
",",
"includeTimestamp",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Query device properties across devices.
Query device properties across devices.
@param dtid Device Type ID. (required)
@param count Max results count. (optional)
@param offset Result starting offset. (optional)
@param filter Query filter. Comma-separated key=value pairs (optional)
@param includeTimestamp Include timestamp. (optional)
@return MetadataQueryEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Query",
"device",
"properties",
"across",
"devices",
".",
"Query",
"device",
"properties",
"across",
"devices",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L1421-L1424 |
json-path/JsonPath | json-path/src/main/java/com/jayway/jsonpath/JsonPath.java | JsonPath.read | @SuppressWarnings( {
"""
Creates a new JsonPath and applies it to the provided Json string
@param json a json string
@param jsonPath the json path
@param filters filters to be applied to the filter place holders [?] in the path
@param <T> expected return type
@return list of objects matched by the given path
""""unchecked"})
public static <T> T read(String json, String jsonPath, Predicate... filters) {
return new ParseContextImpl().parse(json).read(jsonPath, filters);
} | java | @SuppressWarnings({"unchecked"})
public static <T> T read(String json, String jsonPath, Predicate... filters) {
return new ParseContextImpl().parse(json).read(jsonPath, filters);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
">",
"T",
"read",
"(",
"String",
"json",
",",
"String",
"jsonPath",
",",
"Predicate",
"...",
"filters",
")",
"{",
"return",
"new",
"ParseContextImpl",
"(",
")",
".",
"parse",
"(",
"json",
")",
".",
"read",
"(",
"jsonPath",
",",
"filters",
")",
";",
"}"
] | Creates a new JsonPath and applies it to the provided Json string
@param json a json string
@param jsonPath the json path
@param filters filters to be applied to the filter place holders [?] in the path
@param <T> expected return type
@return list of objects matched by the given path | [
"Creates",
"a",
"new",
"JsonPath",
"and",
"applies",
"it",
"to",
"the",
"provided",
"Json",
"string"
] | train | https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L496-L499 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/MutableClock.java | MutableClock.of | public static MutableClock of(Instant instant, ZoneId zone) {
"""
Obtains a new {@code MutableClock} set to the specified instant,
converting to date and time using the specified time-zone.
@param instant the initial value for the clock, not null
@param zone the time-zone to use, not null
@return a new {@code MutableClock}, not null
"""
Objects.requireNonNull(instant, "instant");
Objects.requireNonNull(zone, "zone");
return new MutableClock(new InstantHolder(instant), zone);
} | java | public static MutableClock of(Instant instant, ZoneId zone) {
Objects.requireNonNull(instant, "instant");
Objects.requireNonNull(zone, "zone");
return new MutableClock(new InstantHolder(instant), zone);
} | [
"public",
"static",
"MutableClock",
"of",
"(",
"Instant",
"instant",
",",
"ZoneId",
"zone",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"instant",
",",
"\"instant\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"zone",
",",
"\"zone\"",
")",
";",
"return",
"new",
"MutableClock",
"(",
"new",
"InstantHolder",
"(",
"instant",
")",
",",
"zone",
")",
";",
"}"
] | Obtains a new {@code MutableClock} set to the specified instant,
converting to date and time using the specified time-zone.
@param instant the initial value for the clock, not null
@param zone the time-zone to use, not null
@return a new {@code MutableClock}, not null | [
"Obtains",
"a",
"new",
"{",
"@code",
"MutableClock",
"}",
"set",
"to",
"the",
"specified",
"instant",
"converting",
"to",
"date",
"and",
"time",
"using",
"the",
"specified",
"time",
"-",
"zone",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/MutableClock.java#L149-L153 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/store/VFSStoreResource.java | VFSStoreResource.read | @Override
public InputStream read()
throws EFapsException {
"""
Returns for the file the input stream.
@return input stream of the file with the content
@throws EFapsException on error
"""
StoreResourceInputStream in = null;
try {
final FileObject file = this.manager.resolveFile(this.storeFileName + VFSStoreResource.EXTENSION_NORMAL);
if (!file.isReadable()) {
VFSStoreResource.LOG.error("file for " + this.storeFileName + " not readable");
throw new EFapsException(VFSStoreResource.class, "#####file not readable");
}
in = new VFSStoreResourceInputStream(this, file);
} catch (final FileSystemException e) {
VFSStoreResource.LOG.error("read of " + this.storeFileName + " failed", e);
throw new EFapsException(VFSStoreResource.class, "read.Throwable", e);
} catch (final IOException e) {
VFSStoreResource.LOG.error("read of " + this.storeFileName + " failed", e);
throw new EFapsException(VFSStoreResource.class, "read.Throwable", e);
}
return in;
} | java | @Override
public InputStream read()
throws EFapsException
{
StoreResourceInputStream in = null;
try {
final FileObject file = this.manager.resolveFile(this.storeFileName + VFSStoreResource.EXTENSION_NORMAL);
if (!file.isReadable()) {
VFSStoreResource.LOG.error("file for " + this.storeFileName + " not readable");
throw new EFapsException(VFSStoreResource.class, "#####file not readable");
}
in = new VFSStoreResourceInputStream(this, file);
} catch (final FileSystemException e) {
VFSStoreResource.LOG.error("read of " + this.storeFileName + " failed", e);
throw new EFapsException(VFSStoreResource.class, "read.Throwable", e);
} catch (final IOException e) {
VFSStoreResource.LOG.error("read of " + this.storeFileName + " failed", e);
throw new EFapsException(VFSStoreResource.class, "read.Throwable", e);
}
return in;
} | [
"@",
"Override",
"public",
"InputStream",
"read",
"(",
")",
"throws",
"EFapsException",
"{",
"StoreResourceInputStream",
"in",
"=",
"null",
";",
"try",
"{",
"final",
"FileObject",
"file",
"=",
"this",
".",
"manager",
".",
"resolveFile",
"(",
"this",
".",
"storeFileName",
"+",
"VFSStoreResource",
".",
"EXTENSION_NORMAL",
")",
";",
"if",
"(",
"!",
"file",
".",
"isReadable",
"(",
")",
")",
"{",
"VFSStoreResource",
".",
"LOG",
".",
"error",
"(",
"\"file for \"",
"+",
"this",
".",
"storeFileName",
"+",
"\" not readable\"",
")",
";",
"throw",
"new",
"EFapsException",
"(",
"VFSStoreResource",
".",
"class",
",",
"\"#####file not readable\"",
")",
";",
"}",
"in",
"=",
"new",
"VFSStoreResourceInputStream",
"(",
"this",
",",
"file",
")",
";",
"}",
"catch",
"(",
"final",
"FileSystemException",
"e",
")",
"{",
"VFSStoreResource",
".",
"LOG",
".",
"error",
"(",
"\"read of \"",
"+",
"this",
".",
"storeFileName",
"+",
"\" failed\"",
",",
"e",
")",
";",
"throw",
"new",
"EFapsException",
"(",
"VFSStoreResource",
".",
"class",
",",
"\"read.Throwable\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"VFSStoreResource",
".",
"LOG",
".",
"error",
"(",
"\"read of \"",
"+",
"this",
".",
"storeFileName",
"+",
"\" failed\"",
",",
"e",
")",
";",
"throw",
"new",
"EFapsException",
"(",
"VFSStoreResource",
".",
"class",
",",
"\"read.Throwable\"",
",",
"e",
")",
";",
"}",
"return",
"in",
";",
"}"
] | Returns for the file the input stream.
@return input stream of the file with the content
@throws EFapsException on error | [
"Returns",
"for",
"the",
"file",
"the",
"input",
"stream",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/VFSStoreResource.java#L348-L368 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readFile | public CmsFile readFile(CmsDbContext dbc, CmsResource resource) throws CmsException {
"""
Reads a file resource (including it's binary content) from the VFS,
using the specified resource filter.<p>
In case you do not need the file content,
use <code>{@link #readResource(CmsDbContext, String, CmsResourceFilter)}</code> instead.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param dbc the current database context
@param resource the base file resource (without content)
@return the file read from the VFS
@throws CmsException if operation was not successful
"""
if (resource.isFolder()) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.ERR_ACCESS_FOLDER_AS_FILE_1,
dbc.removeSiteRoot(resource.getRootPath())));
}
CmsUUID projectId = dbc.currentProject().getUuid();
CmsFile file = null;
if (resource instanceof I_CmsHistoryResource) {
file = new CmsHistoryFile((I_CmsHistoryResource)resource);
file.setContents(
getHistoryDriver(dbc).readContent(
dbc,
resource.getResourceId(),
((I_CmsHistoryResource)resource).getPublishTag()));
} else {
file = new CmsFile(resource);
file.setContents(getVfsDriver(dbc).readContent(dbc, projectId, resource.getResourceId()));
}
return file;
} | java | public CmsFile readFile(CmsDbContext dbc, CmsResource resource) throws CmsException {
if (resource.isFolder()) {
throw new CmsVfsResourceNotFoundException(
Messages.get().container(
Messages.ERR_ACCESS_FOLDER_AS_FILE_1,
dbc.removeSiteRoot(resource.getRootPath())));
}
CmsUUID projectId = dbc.currentProject().getUuid();
CmsFile file = null;
if (resource instanceof I_CmsHistoryResource) {
file = new CmsHistoryFile((I_CmsHistoryResource)resource);
file.setContents(
getHistoryDriver(dbc).readContent(
dbc,
resource.getResourceId(),
((I_CmsHistoryResource)resource).getPublishTag()));
} else {
file = new CmsFile(resource);
file.setContents(getVfsDriver(dbc).readContent(dbc, projectId, resource.getResourceId()));
}
return file;
} | [
"public",
"CmsFile",
"readFile",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"resource",
".",
"isFolder",
"(",
")",
")",
"{",
"throw",
"new",
"CmsVfsResourceNotFoundException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_ACCESS_FOLDER_AS_FILE_1",
",",
"dbc",
".",
"removeSiteRoot",
"(",
"resource",
".",
"getRootPath",
"(",
")",
")",
")",
")",
";",
"}",
"CmsUUID",
"projectId",
"=",
"dbc",
".",
"currentProject",
"(",
")",
".",
"getUuid",
"(",
")",
";",
"CmsFile",
"file",
"=",
"null",
";",
"if",
"(",
"resource",
"instanceof",
"I_CmsHistoryResource",
")",
"{",
"file",
"=",
"new",
"CmsHistoryFile",
"(",
"(",
"I_CmsHistoryResource",
")",
"resource",
")",
";",
"file",
".",
"setContents",
"(",
"getHistoryDriver",
"(",
"dbc",
")",
".",
"readContent",
"(",
"dbc",
",",
"resource",
".",
"getResourceId",
"(",
")",
",",
"(",
"(",
"I_CmsHistoryResource",
")",
"resource",
")",
".",
"getPublishTag",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"file",
"=",
"new",
"CmsFile",
"(",
"resource",
")",
";",
"file",
".",
"setContents",
"(",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readContent",
"(",
"dbc",
",",
"projectId",
",",
"resource",
".",
"getResourceId",
"(",
")",
")",
")",
";",
"}",
"return",
"file",
";",
"}"
] | Reads a file resource (including it's binary content) from the VFS,
using the specified resource filter.<p>
In case you do not need the file content,
use <code>{@link #readResource(CmsDbContext, String, CmsResourceFilter)}</code> instead.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
@param dbc the current database context
@param resource the base file resource (without content)
@return the file read from the VFS
@throws CmsException if operation was not successful | [
"Reads",
"a",
"file",
"resource",
"(",
"including",
"it",
"s",
"binary",
"content",
")",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6824-L6847 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchUtil.java | CmsSearchUtil.getDateCreatedTimeRangeFilterQuery | public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
"""
Returns a time interval as Solr compatible query string.
@param searchField the field to search for.
@param startTime the lower limit of the interval.
@param endTime the upper limit of the interval.
@return Solr compatible query string.
"""
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
} | java | public static String getDateCreatedTimeRangeFilterQuery(String searchField, long startTime, long endTime) {
String sStartTime = null;
String sEndTime = null;
// Convert startTime to ISO 8601 format
if ((startTime > Long.MIN_VALUE) && (startTime < Long.MAX_VALUE)) {
sStartTime = CmsSearchUtil.getDateAsIso8601(new Date(startTime));
}
// Convert endTime to ISO 8601 format
if ((endTime > Long.MIN_VALUE) && (endTime < Long.MAX_VALUE)) {
sEndTime = CmsSearchUtil.getDateAsIso8601(new Date(endTime));
}
// Build Solr range string
final String rangeString = CmsSearchUtil.getSolrRangeString(sStartTime, sEndTime);
// Build Solr filter string
return String.format("%s:%s", searchField, rangeString);
} | [
"public",
"static",
"String",
"getDateCreatedTimeRangeFilterQuery",
"(",
"String",
"searchField",
",",
"long",
"startTime",
",",
"long",
"endTime",
")",
"{",
"String",
"sStartTime",
"=",
"null",
";",
"String",
"sEndTime",
"=",
"null",
";",
"// Convert startTime to ISO 8601 format",
"if",
"(",
"(",
"startTime",
">",
"Long",
".",
"MIN_VALUE",
")",
"&&",
"(",
"startTime",
"<",
"Long",
".",
"MAX_VALUE",
")",
")",
"{",
"sStartTime",
"=",
"CmsSearchUtil",
".",
"getDateAsIso8601",
"(",
"new",
"Date",
"(",
"startTime",
")",
")",
";",
"}",
"// Convert endTime to ISO 8601 format",
"if",
"(",
"(",
"endTime",
">",
"Long",
".",
"MIN_VALUE",
")",
"&&",
"(",
"endTime",
"<",
"Long",
".",
"MAX_VALUE",
")",
")",
"{",
"sEndTime",
"=",
"CmsSearchUtil",
".",
"getDateAsIso8601",
"(",
"new",
"Date",
"(",
"endTime",
")",
")",
";",
"}",
"// Build Solr range string",
"final",
"String",
"rangeString",
"=",
"CmsSearchUtil",
".",
"getSolrRangeString",
"(",
"sStartTime",
",",
"sEndTime",
")",
";",
"// Build Solr filter string",
"return",
"String",
".",
"format",
"(",
"\"%s:%s\"",
",",
"searchField",
",",
"rangeString",
")",
";",
"}"
] | Returns a time interval as Solr compatible query string.
@param searchField the field to search for.
@param startTime the lower limit of the interval.
@param endTime the upper limit of the interval.
@return Solr compatible query string. | [
"Returns",
"a",
"time",
"interval",
"as",
"Solr",
"compatible",
"query",
"string",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchUtil.java#L209-L229 |
davetcc/tcMenu | tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/uimodel/UIMenuItem.java | UIMenuItem.safeIntFromProperty | protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder,
int min, int max) {
"""
Gets the integer value from a text field property and validates it again the conditions provided. It must be
a number and within the ranges provided.
@param strProp the property to convert
@param field the field to report errors against
@param errorsBuilder the list of errors recorded so far
@param min the minimum value allowed
@param max the maximum value allowed
@return the integer value if all conditions are met
"""
String s = strProp.get();
if (StringHelper.isStringEmptyOrNull(s)) {
return 0;
}
int val = 0;
try {
val = Integer.valueOf(s);
if(val < min || val > max) {
errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field));
}
} catch (NumberFormatException e) {
errorsBuilder.add(new FieldError("Value must be a number", field));
}
return val;
} | java | protected int safeIntFromProperty(StringProperty strProp, String field, List<FieldError> errorsBuilder,
int min, int max) {
String s = strProp.get();
if (StringHelper.isStringEmptyOrNull(s)) {
return 0;
}
int val = 0;
try {
val = Integer.valueOf(s);
if(val < min || val > max) {
errorsBuilder.add(new FieldError("Value must be between " + min + " and " + max, field));
}
} catch (NumberFormatException e) {
errorsBuilder.add(new FieldError("Value must be a number", field));
}
return val;
} | [
"protected",
"int",
"safeIntFromProperty",
"(",
"StringProperty",
"strProp",
",",
"String",
"field",
",",
"List",
"<",
"FieldError",
">",
"errorsBuilder",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"String",
"s",
"=",
"strProp",
".",
"get",
"(",
")",
";",
"if",
"(",
"StringHelper",
".",
"isStringEmptyOrNull",
"(",
"s",
")",
")",
"{",
"return",
"0",
";",
"}",
"int",
"val",
"=",
"0",
";",
"try",
"{",
"val",
"=",
"Integer",
".",
"valueOf",
"(",
"s",
")",
";",
"if",
"(",
"val",
"<",
"min",
"||",
"val",
">",
"max",
")",
"{",
"errorsBuilder",
".",
"add",
"(",
"new",
"FieldError",
"(",
"\"Value must be between \"",
"+",
"min",
"+",
"\" and \"",
"+",
"max",
",",
"field",
")",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"errorsBuilder",
".",
"add",
"(",
"new",
"FieldError",
"(",
"\"Value must be a number\"",
",",
"field",
")",
")",
";",
"}",
"return",
"val",
";",
"}"
] | Gets the integer value from a text field property and validates it again the conditions provided. It must be
a number and within the ranges provided.
@param strProp the property to convert
@param field the field to report errors against
@param errorsBuilder the list of errors recorded so far
@param min the minimum value allowed
@param max the maximum value allowed
@return the integer value if all conditions are met | [
"Gets",
"the",
"integer",
"value",
"from",
"a",
"text",
"field",
"property",
"and",
"validates",
"it",
"again",
"the",
"conditions",
"provided",
".",
"It",
"must",
"be",
"a",
"number",
"and",
"within",
"the",
"ranges",
"provided",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/uimodel/UIMenuItem.java#L224-L241 |
pravega/pravega | segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/admin/commands/BookKeeperCommand.java | BookKeeperCommand.createContext | protected Context createContext() throws DurableDataLogException {
"""
Creates a new Context to be used by the BookKeeper command.
@return A new Context.
@throws DurableDataLogException If the BookKeeperLogFactory could not be initialized.
"""
val serviceConfig = getServiceConfig();
val bkConfig = getCommandArgs().getState().getConfigBuilder()
.include(BookKeeperConfig.builder().with(BookKeeperConfig.ZK_ADDRESS, serviceConfig.getZkURL()))
.build().getConfig(BookKeeperConfig::builder);
val zkClient = createZKClient();
val factory = new BookKeeperLogFactory(bkConfig, zkClient, getCommandArgs().getState().getExecutor());
try {
factory.initialize();
} catch (DurableDataLogException ex) {
zkClient.close();
throw ex;
}
val bkAdmin = new BookKeeperAdmin(factory.getBookKeeperClient());
return new Context(serviceConfig, bkConfig, zkClient, factory, bkAdmin);
} | java | protected Context createContext() throws DurableDataLogException {
val serviceConfig = getServiceConfig();
val bkConfig = getCommandArgs().getState().getConfigBuilder()
.include(BookKeeperConfig.builder().with(BookKeeperConfig.ZK_ADDRESS, serviceConfig.getZkURL()))
.build().getConfig(BookKeeperConfig::builder);
val zkClient = createZKClient();
val factory = new BookKeeperLogFactory(bkConfig, zkClient, getCommandArgs().getState().getExecutor());
try {
factory.initialize();
} catch (DurableDataLogException ex) {
zkClient.close();
throw ex;
}
val bkAdmin = new BookKeeperAdmin(factory.getBookKeeperClient());
return new Context(serviceConfig, bkConfig, zkClient, factory, bkAdmin);
} | [
"protected",
"Context",
"createContext",
"(",
")",
"throws",
"DurableDataLogException",
"{",
"val",
"serviceConfig",
"=",
"getServiceConfig",
"(",
")",
";",
"val",
"bkConfig",
"=",
"getCommandArgs",
"(",
")",
".",
"getState",
"(",
")",
".",
"getConfigBuilder",
"(",
")",
".",
"include",
"(",
"BookKeeperConfig",
".",
"builder",
"(",
")",
".",
"with",
"(",
"BookKeeperConfig",
".",
"ZK_ADDRESS",
",",
"serviceConfig",
".",
"getZkURL",
"(",
")",
")",
")",
".",
"build",
"(",
")",
".",
"getConfig",
"(",
"BookKeeperConfig",
"::",
"builder",
")",
";",
"val",
"zkClient",
"=",
"createZKClient",
"(",
")",
";",
"val",
"factory",
"=",
"new",
"BookKeeperLogFactory",
"(",
"bkConfig",
",",
"zkClient",
",",
"getCommandArgs",
"(",
")",
".",
"getState",
"(",
")",
".",
"getExecutor",
"(",
")",
")",
";",
"try",
"{",
"factory",
".",
"initialize",
"(",
")",
";",
"}",
"catch",
"(",
"DurableDataLogException",
"ex",
")",
"{",
"zkClient",
".",
"close",
"(",
")",
";",
"throw",
"ex",
";",
"}",
"val",
"bkAdmin",
"=",
"new",
"BookKeeperAdmin",
"(",
"factory",
".",
"getBookKeeperClient",
"(",
")",
")",
";",
"return",
"new",
"Context",
"(",
"serviceConfig",
",",
"bkConfig",
",",
"zkClient",
",",
"factory",
",",
"bkAdmin",
")",
";",
"}"
] | Creates a new Context to be used by the BookKeeper command.
@return A new Context.
@throws DurableDataLogException If the BookKeeperLogFactory could not be initialized. | [
"Creates",
"a",
"new",
"Context",
"to",
"be",
"used",
"by",
"the",
"BookKeeper",
"command",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/host/src/main/java/io/pravega/segmentstore/server/host/admin/commands/BookKeeperCommand.java#L57-L73 |
k3po/k3po | lang/src/main/java/org/kaazing/k3po/lang/el/FunctionMapper.java | FunctionMapper.resolveFunction | public Method resolveFunction(String prefix, String localName) {
"""
Resolves a Function via prefix and local name.
@param prefix of the function
@param localName of the function
@return an instance of a Method
"""
FunctionMapperSpi functionMapperSpi = findFunctionMapperSpi(prefix);
return functionMapperSpi.resolveFunction(localName);
} | java | public Method resolveFunction(String prefix, String localName) {
FunctionMapperSpi functionMapperSpi = findFunctionMapperSpi(prefix);
return functionMapperSpi.resolveFunction(localName);
} | [
"public",
"Method",
"resolveFunction",
"(",
"String",
"prefix",
",",
"String",
"localName",
")",
"{",
"FunctionMapperSpi",
"functionMapperSpi",
"=",
"findFunctionMapperSpi",
"(",
"prefix",
")",
";",
"return",
"functionMapperSpi",
".",
"resolveFunction",
"(",
"localName",
")",
";",
"}"
] | Resolves a Function via prefix and local name.
@param prefix of the function
@param localName of the function
@return an instance of a Method | [
"Resolves",
"a",
"Function",
"via",
"prefix",
"and",
"local",
"name",
"."
] | train | https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/lang/src/main/java/org/kaazing/k3po/lang/el/FunctionMapper.java#L66-L69 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.getAncestor | public static Element getAncestor(Element element, Tag tag) {
"""
Returns the given element or it's closest ancestor with the given tag name.<p>
Returns <code>null</code> if no appropriate element was found.<p>
@param element the element
@param tag the tag name
@return the matching element
"""
if ((element == null) || (tag == null)) {
return null;
}
if (element.getTagName().equalsIgnoreCase(tag.name())) {
return element;
}
if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
return null;
}
return getAncestor(element.getParentElement(), tag);
} | java | public static Element getAncestor(Element element, Tag tag) {
if ((element == null) || (tag == null)) {
return null;
}
if (element.getTagName().equalsIgnoreCase(tag.name())) {
return element;
}
if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
return null;
}
return getAncestor(element.getParentElement(), tag);
} | [
"public",
"static",
"Element",
"getAncestor",
"(",
"Element",
"element",
",",
"Tag",
"tag",
")",
"{",
"if",
"(",
"(",
"element",
"==",
"null",
")",
"||",
"(",
"tag",
"==",
"null",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"element",
".",
"getTagName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"tag",
".",
"name",
"(",
")",
")",
")",
"{",
"return",
"element",
";",
"}",
"if",
"(",
"element",
".",
"getTagName",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"Tag",
".",
"body",
".",
"name",
"(",
")",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getAncestor",
"(",
"element",
".",
"getParentElement",
"(",
")",
",",
"tag",
")",
";",
"}"
] | Returns the given element or it's closest ancestor with the given tag name.<p>
Returns <code>null</code> if no appropriate element was found.<p>
@param element the element
@param tag the tag name
@return the matching element | [
"Returns",
"the",
"given",
"element",
"or",
"it",
"s",
"closest",
"ancestor",
"with",
"the",
"given",
"tag",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1161-L1173 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/internal/AttachmentController.java | AttachmentController.createMessageProcessor | public MessageProcessor createMessageProcessor(@NonNull MessageToSend message, @Nullable List<Attachment> attachments, @NonNull String conversationId, @NonNull String profileId) {
"""
Create instance of message processor to handle sending process of a message with attachments.
@param message Message to send.
@param attachments Attachments to upload with a message.
@param conversationId Unique conversation id.
@param profileId User profile id.
@return Message processor
"""
return new MessageProcessor(conversationId, profileId, message, attachments, maxPartSize, log);
} | java | public MessageProcessor createMessageProcessor(@NonNull MessageToSend message, @Nullable List<Attachment> attachments, @NonNull String conversationId, @NonNull String profileId) {
return new MessageProcessor(conversationId, profileId, message, attachments, maxPartSize, log);
} | [
"public",
"MessageProcessor",
"createMessageProcessor",
"(",
"@",
"NonNull",
"MessageToSend",
"message",
",",
"@",
"Nullable",
"List",
"<",
"Attachment",
">",
"attachments",
",",
"@",
"NonNull",
"String",
"conversationId",
",",
"@",
"NonNull",
"String",
"profileId",
")",
"{",
"return",
"new",
"MessageProcessor",
"(",
"conversationId",
",",
"profileId",
",",
"message",
",",
"attachments",
",",
"maxPartSize",
",",
"log",
")",
";",
"}"
] | Create instance of message processor to handle sending process of a message with attachments.
@param message Message to send.
@param attachments Attachments to upload with a message.
@param conversationId Unique conversation id.
@param profileId User profile id.
@return Message processor | [
"Create",
"instance",
"of",
"message",
"processor",
"to",
"handle",
"sending",
"process",
"of",
"a",
"message",
"with",
"attachments",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/internal/AttachmentController.java#L84-L86 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.saveDetailPages | private void saveDetailPages(
List<CmsDetailPageInfo> detailPages,
CmsResource resource,
CmsUUID newId,
CmsClientSitemapEntry updateEntry)
throws CmsException {
"""
Saves the detail page information of a sitemap to the sitemap's configuration file.<p>
@param detailPages saves the detailpage configuration
@param resource the configuration file resource
@param newId the structure id to use for new detail page entries
@param updateEntry the new detail page entry
@throws CmsException if something goes wrong
"""
CmsObject cms = getCmsObject();
if (updateEntry != null) {
for (CmsDetailPageInfo info : detailPages) {
if (info.getId() == null) {
updateEntry.setDetailpageTypeName(info.getType());
break;
}
}
}
CmsDetailPageConfigurationWriter writer = new CmsDetailPageConfigurationWriter(cms, resource);
writer.updateAndSave(detailPages, newId);
} | java | private void saveDetailPages(
List<CmsDetailPageInfo> detailPages,
CmsResource resource,
CmsUUID newId,
CmsClientSitemapEntry updateEntry)
throws CmsException {
CmsObject cms = getCmsObject();
if (updateEntry != null) {
for (CmsDetailPageInfo info : detailPages) {
if (info.getId() == null) {
updateEntry.setDetailpageTypeName(info.getType());
break;
}
}
}
CmsDetailPageConfigurationWriter writer = new CmsDetailPageConfigurationWriter(cms, resource);
writer.updateAndSave(detailPages, newId);
} | [
"private",
"void",
"saveDetailPages",
"(",
"List",
"<",
"CmsDetailPageInfo",
">",
"detailPages",
",",
"CmsResource",
"resource",
",",
"CmsUUID",
"newId",
",",
"CmsClientSitemapEntry",
"updateEntry",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"if",
"(",
"updateEntry",
"!=",
"null",
")",
"{",
"for",
"(",
"CmsDetailPageInfo",
"info",
":",
"detailPages",
")",
"{",
"if",
"(",
"info",
".",
"getId",
"(",
")",
"==",
"null",
")",
"{",
"updateEntry",
".",
"setDetailpageTypeName",
"(",
"info",
".",
"getType",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"CmsDetailPageConfigurationWriter",
"writer",
"=",
"new",
"CmsDetailPageConfigurationWriter",
"(",
"cms",
",",
"resource",
")",
";",
"writer",
".",
"updateAndSave",
"(",
"detailPages",
",",
"newId",
")",
";",
"}"
] | Saves the detail page information of a sitemap to the sitemap's configuration file.<p>
@param detailPages saves the detailpage configuration
@param resource the configuration file resource
@param newId the structure id to use for new detail page entries
@param updateEntry the new detail page entry
@throws CmsException if something goes wrong | [
"Saves",
"the",
"detail",
"page",
"information",
"of",
"a",
"sitemap",
"to",
"the",
"sitemap",
"s",
"configuration",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L3010-L3028 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateZYX | public Matrix3f rotateZYX(Vector3f angles) {
"""
Apply rotation of <code>angles.z</code> radians about the Z axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.x</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)</code>
@param angles
the Euler angles
@return this
"""
return rotateZYX(angles.z, angles.y, angles.x);
} | java | public Matrix3f rotateZYX(Vector3f angles) {
return rotateZYX(angles.z, angles.y, angles.x);
} | [
"public",
"Matrix3f",
"rotateZYX",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateZYX",
"(",
"angles",
".",
"z",
",",
"angles",
".",
"y",
",",
"angles",
".",
"x",
")",
";",
"}"
] | Apply rotation of <code>angles.z</code> radians about the Z axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.x</code> radians about the X axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateZ(angles.z).rotateY(angles.y).rotateX(angles.x)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"z<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"and",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
".",
"<p",
">",
"When",
"used",
"with",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"the",
"produced",
"rotation",
"will",
"rotate",
"a",
"vector",
"counter",
"-",
"clockwise",
"around",
"the",
"rotation",
"axis",
"when",
"viewing",
"along",
"the",
"negative",
"axis",
"direction",
"towards",
"the",
"origin",
".",
"When",
"used",
"with",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"the",
"rotation",
"is",
"clockwise",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"R<",
"/",
"code",
">",
"the",
"rotation",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"R<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"R",
"*",
"v<",
"/",
"code",
">",
"the",
"rotation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"rotateZ",
"(",
"angles",
".",
"z",
")",
".",
"rotateY",
"(",
"angles",
".",
"y",
")",
".",
"rotateX",
"(",
"angles",
".",
"x",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2107-L2109 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java | LockedMessageEnumerationImpl.deleteMessages | private void deleteMessages(JsMessage[] messagesToDelete, SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException {
"""
This private method actually performs the delete by asking the conversation helper
to flow the request across the wire. However, this method does not obtain any locks
required to perform this operation and as such should be called by a method that does
do this.
@param messagesToDelete
@param transaction
@throws SICommsException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteMessages");
int priority = JFapChannelConstants.PRIORITY_MEDIUM; // d178368
if (transaction != null) {
Transaction commsTransaction = (Transaction)transaction;
priority = commsTransaction.getLowestMessagePriority(); // d178368 // f181927
// Inform the transaction that our consumer session has deleted
// a recoverable message under this transaction. This means that if
// a rollback is performed (and strict rollback ordering is enabled)
// we can ensure that this message will be redelivered in order.
commsTransaction.associateConsumer(consumerSession);
}
// begin F219476.2
SIMessageHandle[] messageHandles = new SIMessageHandle[messagesToDelete.length];
for (int x = 0; x < messagesToDelete.length; x++) // f192215
{
if (messagesToDelete[x] != null)
{
messageHandles[x] = messagesToDelete[x].getMessageHandle();
}
}
convHelper.deleteMessages(messageHandles, transaction, priority); // d178368
// end F219476.2
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteMessages");
} | java | private void deleteMessages(JsMessage[] messagesToDelete, SITransaction transaction)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc,"deleteMessages");
int priority = JFapChannelConstants.PRIORITY_MEDIUM; // d178368
if (transaction != null) {
Transaction commsTransaction = (Transaction)transaction;
priority = commsTransaction.getLowestMessagePriority(); // d178368 // f181927
// Inform the transaction that our consumer session has deleted
// a recoverable message under this transaction. This means that if
// a rollback is performed (and strict rollback ordering is enabled)
// we can ensure that this message will be redelivered in order.
commsTransaction.associateConsumer(consumerSession);
}
// begin F219476.2
SIMessageHandle[] messageHandles = new SIMessageHandle[messagesToDelete.length];
for (int x = 0; x < messagesToDelete.length; x++) // f192215
{
if (messagesToDelete[x] != null)
{
messageHandles[x] = messagesToDelete[x].getMessageHandle();
}
}
convHelper.deleteMessages(messageHandles, transaction, priority); // d178368
// end F219476.2
// }
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc,"deleteMessages");
} | [
"private",
"void",
"deleteMessages",
"(",
"JsMessage",
"[",
"]",
"messagesToDelete",
",",
"SITransaction",
"transaction",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"deleteMessages\"",
")",
";",
"int",
"priority",
"=",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
";",
"// d178368",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"Transaction",
"commsTransaction",
"=",
"(",
"Transaction",
")",
"transaction",
";",
"priority",
"=",
"commsTransaction",
".",
"getLowestMessagePriority",
"(",
")",
";",
"// d178368 // f181927",
"// Inform the transaction that our consumer session has deleted",
"// a recoverable message under this transaction. This means that if",
"// a rollback is performed (and strict rollback ordering is enabled)",
"// we can ensure that this message will be redelivered in order.",
"commsTransaction",
".",
"associateConsumer",
"(",
"consumerSession",
")",
";",
"}",
"// begin F219476.2",
"SIMessageHandle",
"[",
"]",
"messageHandles",
"=",
"new",
"SIMessageHandle",
"[",
"messagesToDelete",
".",
"length",
"]",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"messagesToDelete",
".",
"length",
";",
"x",
"++",
")",
"// f192215",
"{",
"if",
"(",
"messagesToDelete",
"[",
"x",
"]",
"!=",
"null",
")",
"{",
"messageHandles",
"[",
"x",
"]",
"=",
"messagesToDelete",
"[",
"x",
"]",
".",
"getMessageHandle",
"(",
")",
";",
"}",
"}",
"convHelper",
".",
"deleteMessages",
"(",
"messageHandles",
",",
"transaction",
",",
"priority",
")",
";",
"// d178368",
"// end F219476.2",
"// }",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"deleteMessages\"",
")",
";",
"}"
] | This private method actually performs the delete by asking the conversation helper
to flow the request across the wire. However, this method does not obtain any locks
required to perform this operation and as such should be called by a method that does
do this.
@param messagesToDelete
@param transaction
@throws SICommsException | [
"This",
"private",
"method",
"actually",
"performs",
"the",
"delete",
"by",
"asking",
"the",
"conversation",
"helper",
"to",
"flow",
"the",
"request",
"across",
"the",
"wire",
".",
"However",
"this",
"method",
"does",
"not",
"obtain",
"any",
"locks",
"required",
"to",
"perform",
"this",
"operation",
"and",
"as",
"such",
"should",
"be",
"called",
"by",
"a",
"method",
"that",
"does",
"do",
"this",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/LockedMessageEnumerationImpl.java#L371-L407 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java | ImmutableList.subList | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
"""
Returns an immutable list of the elements between the specified {@code
fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code
fromIndex} and {@code toIndex} are equal, the empty immutable list is
returned.)
"""
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromIndex));
default:
return subListUnchecked(fromIndex, toIndex);
}
} | java | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromIndex));
default:
return subListUnchecked(fromIndex, toIndex);
}
} | [
"@",
"Override",
"public",
"ImmutableList",
"<",
"E",
">",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"checkPositionIndexes",
"(",
"fromIndex",
",",
"toIndex",
",",
"size",
"(",
")",
")",
";",
"int",
"length",
"=",
"toIndex",
"-",
"fromIndex",
";",
"if",
"(",
"length",
"==",
"size",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"switch",
"(",
"length",
")",
"{",
"case",
"0",
":",
"return",
"of",
"(",
")",
";",
"case",
"1",
":",
"return",
"of",
"(",
"get",
"(",
"fromIndex",
")",
")",
";",
"default",
":",
"return",
"subListUnchecked",
"(",
"fromIndex",
",",
"toIndex",
")",
";",
"}",
"}"
] | Returns an immutable list of the elements between the specified {@code
fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code
fromIndex} and {@code toIndex} are equal, the empty immutable list is
returned.) | [
"Returns",
"an",
"immutable",
"list",
"of",
"the",
"elements",
"between",
"the",
"specified",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java#L360-L375 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM1Utils.java | HELM1Utils.convertConnection | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
"""
method to convert the polymers ids of the connection
@param notation connection description in HELM
@param source polymer id of source
@param target polymer id of target
@param convertIds Map of old polymer ids with the new polymer ids
@return connection description in HELM with the changed polymer ids
according to the map
@throws HELM1ConverterException
"""
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | java | private static String convertConnection(String notation, String source, String target, Map<String, String> convertIds) throws HELM1ConverterException {
try {
String test = notation.replace(source, "one");
test = test.replace(target, "two");
test = test.replace("one", convertIds.get(source));
test = test.replace("two", convertIds.get(target));
return test;
} catch (NullPointerException ex) {
ex.printStackTrace();
LOG.error("Connection can't be downgraded to HELM1-Format");
throw new HELM1ConverterException("Connection can't be downgraded to HELM1-Format");
}
} | [
"private",
"static",
"String",
"convertConnection",
"(",
"String",
"notation",
",",
"String",
"source",
",",
"String",
"target",
",",
"Map",
"<",
"String",
",",
"String",
">",
"convertIds",
")",
"throws",
"HELM1ConverterException",
"{",
"try",
"{",
"String",
"test",
"=",
"notation",
".",
"replace",
"(",
"source",
",",
"\"one\"",
")",
";",
"test",
"=",
"test",
".",
"replace",
"(",
"target",
",",
"\"two\"",
")",
";",
"test",
"=",
"test",
".",
"replace",
"(",
"\"one\"",
",",
"convertIds",
".",
"get",
"(",
"source",
")",
")",
";",
"test",
"=",
"test",
".",
"replace",
"(",
"\"two\"",
",",
"convertIds",
".",
"get",
"(",
"target",
")",
")",
";",
"return",
"test",
";",
"}",
"catch",
"(",
"NullPointerException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"LOG",
".",
"error",
"(",
"\"Connection can't be downgraded to HELM1-Format\"",
")",
";",
"throw",
"new",
"HELM1ConverterException",
"(",
"\"Connection can't be downgraded to HELM1-Format\"",
")",
";",
"}",
"}"
] | method to convert the polymers ids of the connection
@param notation connection description in HELM
@param source polymer id of source
@param target polymer id of target
@param convertIds Map of old polymer ids with the new polymer ids
@return connection description in HELM with the changed polymer ids
according to the map
@throws HELM1ConverterException | [
"method",
"to",
"convert",
"the",
"polymers",
"ids",
"of",
"the",
"connection"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM1Utils.java#L333-L345 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/RowColumnOps.java | RowColumnOps.addRow | public static void addRow(Matrix A, int i, int start, int to, double c) {
"""
Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:]+ c
@param A the matrix to perform he update on
@param i the row to update
@param start the first index of the row to update from (inclusive)
@param to the last index of the row to update (exclusive)
@param c the constant to add to each element
"""
for(int j = start; j < to; j++)
A.increment(i, j, c);
} | java | public static void addRow(Matrix A, int i, int start, int to, double c)
{
for(int j = start; j < to; j++)
A.increment(i, j, c);
} | [
"public",
"static",
"void",
"addRow",
"(",
"Matrix",
"A",
",",
"int",
"i",
",",
"int",
"start",
",",
"int",
"to",
",",
"double",
"c",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"start",
";",
"j",
"<",
"to",
";",
"j",
"++",
")",
"A",
".",
"increment",
"(",
"i",
",",
"j",
",",
")",
";",
"}"
] | Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:]+ c
@param A the matrix to perform he update on
@param i the row to update
@param start the first index of the row to update from (inclusive)
@param to the last index of the row to update (exclusive)
@param c the constant to add to each element | [
"Updates",
"the",
"values",
"of",
"row",
"<tt",
">",
"i<",
"/",
"tt",
">",
"in",
"the",
"given",
"matrix",
"to",
"be",
"A",
"[",
"i",
":",
"]",
"=",
"A",
"[",
"i",
":",
"]",
"+",
"c"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L32-L36 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/Util.java | Util.writeFully | public static void writeFully(ByteBuffer buffer, WritableByteChannel channel) throws IOException {
"""
Writes the entire remaining contents of the buffer to the channel. May complete in one operation, but the
documentation is vague, so this keeps going until we are sure.
@param buffer the data to be written
@param channel the channel to which we want to write data
@throws IOException if there is a problem writing to the channel
"""
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} | java | public static void writeFully(ByteBuffer buffer, WritableByteChannel channel) throws IOException {
while (buffer.hasRemaining()) {
channel.write(buffer);
}
} | [
"public",
"static",
"void",
"writeFully",
"(",
"ByteBuffer",
"buffer",
",",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"channel",
".",
"write",
"(",
"buffer",
")",
";",
"}",
"}"
] | Writes the entire remaining contents of the buffer to the channel. May complete in one operation, but the
documentation is vague, so this keeps going until we are sure.
@param buffer the data to be written
@param channel the channel to which we want to write data
@throws IOException if there is a problem writing to the channel | [
"Writes",
"the",
"entire",
"remaining",
"contents",
"of",
"the",
"buffer",
"to",
"the",
"channel",
".",
"May",
"complete",
"in",
"one",
"operation",
"but",
"the",
"documentation",
"is",
"vague",
"so",
"this",
"keeps",
"going",
"until",
"we",
"are",
"sure",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L348-L352 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_block_POST | public void billingAccount_line_serviceName_block_POST(String billingAccount, String serviceName, OvhLineBlockingMode mode) throws IOException {
"""
Block the line. By default it will block incoming and outgoing calls (except for emergency numbers)
REST: POST /telephony/{billingAccount}/line/{serviceName}/block
@param mode [required] The block mode : outgoing, incoming, both (default: both)
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
"""
String qPath = "/telephony/{billingAccount}/line/{serviceName}/block";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "mode", mode);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_line_serviceName_block_POST(String billingAccount, String serviceName, OvhLineBlockingMode mode) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/block";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "mode", mode);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_line_serviceName_block_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhLineBlockingMode",
"mode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line/{serviceName}/block\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"billingAccount",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"mode\"",
",",
"mode",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Block the line. By default it will block incoming and outgoing calls (except for emergency numbers)
REST: POST /telephony/{billingAccount}/line/{serviceName}/block
@param mode [required] The block mode : outgoing, incoming, both (default: both)
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Block",
"the",
"line",
".",
"By",
"default",
"it",
"will",
"block",
"incoming",
"and",
"outgoing",
"calls",
"(",
"except",
"for",
"emergency",
"numbers",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1900-L1906 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | TypeUtils.getTypeArguments | public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
"""
<p>Gets the type arguments of a class/interface based on a subtype. For
instance, this method will determine that both of the parameters for the
interface {@link Map} are {@link Object} for the subtype
{@link java.util.Properties Properties} even though the subtype does not
directly implement the {@code Map} interface.</p>
<p>This method returns {@code null} if {@code type} is not assignable to
{@code toClass}. It returns an empty map if none of the classes or
interfaces in its inheritance hierarchy specify any type arguments.</p>
<p>A side effect of this method is that it also retrieves the type
arguments for the classes and interfaces that are part of the hierarchy
between {@code type} and {@code toClass}. So with the above
example, this method will also determine that the type arguments for
{@link java.util.Hashtable Hashtable} are also both {@code Object}.
In cases where the interface specified by {@code toClass} is
(indirectly) implemented more than once (e.g. where {@code toClass}
specifies the interface {@link java.lang.Iterable Iterable} and
{@code type} specifies a parameterized type that implements both
{@link java.util.Set Set} and {@link java.util.Collection Collection}),
this method will look at the inheritance hierarchy of only one of the
implementations/subclasses; the first interface encountered that isn't a
subinterface to one of the others in the {@code type} to
{@code toClass} hierarchy.</p>
@param type the type from which to determine the type parameters of
{@code toClass}
@param toClass the class whose type parameters are to be determined based
on the subtype {@code type}
@return a {@code Map} of the type assignments for the type variables in
each type in the inheritance hierarchy from {@code type} to
{@code toClass} inclusive.
"""
return getTypeArguments(type, toClass, null);
} | java | public static Map<TypeVariable<?>, Type> getTypeArguments(final Type type, final Class<?> toClass) {
return getTypeArguments(type, toClass, null);
} | [
"public",
"static",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"getTypeArguments",
"(",
"final",
"Type",
"type",
",",
"final",
"Class",
"<",
"?",
">",
"toClass",
")",
"{",
"return",
"getTypeArguments",
"(",
"type",
",",
"toClass",
",",
"null",
")",
";",
"}"
] | <p>Gets the type arguments of a class/interface based on a subtype. For
instance, this method will determine that both of the parameters for the
interface {@link Map} are {@link Object} for the subtype
{@link java.util.Properties Properties} even though the subtype does not
directly implement the {@code Map} interface.</p>
<p>This method returns {@code null} if {@code type} is not assignable to
{@code toClass}. It returns an empty map if none of the classes or
interfaces in its inheritance hierarchy specify any type arguments.</p>
<p>A side effect of this method is that it also retrieves the type
arguments for the classes and interfaces that are part of the hierarchy
between {@code type} and {@code toClass}. So with the above
example, this method will also determine that the type arguments for
{@link java.util.Hashtable Hashtable} are also both {@code Object}.
In cases where the interface specified by {@code toClass} is
(indirectly) implemented more than once (e.g. where {@code toClass}
specifies the interface {@link java.lang.Iterable Iterable} and
{@code type} specifies a parameterized type that implements both
{@link java.util.Set Set} and {@link java.util.Collection Collection}),
this method will look at the inheritance hierarchy of only one of the
implementations/subclasses; the first interface encountered that isn't a
subinterface to one of the others in the {@code type} to
{@code toClass} hierarchy.</p>
@param type the type from which to determine the type parameters of
{@code toClass}
@param toClass the class whose type parameters are to be determined based
on the subtype {@code type}
@return a {@code Map} of the type assignments for the type variables in
each type in the inheritance hierarchy from {@code type} to
{@code toClass} inclusive. | [
"<p",
">",
"Gets",
"the",
"type",
"arguments",
"of",
"a",
"class",
"/",
"interface",
"based",
"on",
"a",
"subtype",
".",
"For",
"instance",
"this",
"method",
"will",
"determine",
"that",
"both",
"of",
"the",
"parameters",
"for",
"the",
"interface",
"{",
"@link",
"Map",
"}",
"are",
"{",
"@link",
"Object",
"}",
"for",
"the",
"subtype",
"{",
"@link",
"java",
".",
"util",
".",
"Properties",
"Properties",
"}",
"even",
"though",
"the",
"subtype",
"does",
"not",
"directly",
"implement",
"the",
"{",
"@code",
"Map",
"}",
"interface",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"returns",
"{",
"@code",
"null",
"}",
"if",
"{",
"@code",
"type",
"}",
"is",
"not",
"assignable",
"to",
"{",
"@code",
"toClass",
"}",
".",
"It",
"returns",
"an",
"empty",
"map",
"if",
"none",
"of",
"the",
"classes",
"or",
"interfaces",
"in",
"its",
"inheritance",
"hierarchy",
"specify",
"any",
"type",
"arguments",
".",
"<",
"/",
"p",
">",
"<p",
">",
"A",
"side",
"effect",
"of",
"this",
"method",
"is",
"that",
"it",
"also",
"retrieves",
"the",
"type",
"arguments",
"for",
"the",
"classes",
"and",
"interfaces",
"that",
"are",
"part",
"of",
"the",
"hierarchy",
"between",
"{",
"@code",
"type",
"}",
"and",
"{",
"@code",
"toClass",
"}",
".",
"So",
"with",
"the",
"above",
"example",
"this",
"method",
"will",
"also",
"determine",
"that",
"the",
"type",
"arguments",
"for",
"{",
"@link",
"java",
".",
"util",
".",
"Hashtable",
"Hashtable",
"}",
"are",
"also",
"both",
"{",
"@code",
"Object",
"}",
".",
"In",
"cases",
"where",
"the",
"interface",
"specified",
"by",
"{",
"@code",
"toClass",
"}",
"is",
"(",
"indirectly",
")",
"implemented",
"more",
"than",
"once",
"(",
"e",
".",
"g",
".",
"where",
"{",
"@code",
"toClass",
"}",
"specifies",
"the",
"interface",
"{",
"@link",
"java",
".",
"lang",
".",
"Iterable",
"Iterable",
"}",
"and",
"{",
"@code",
"type",
"}",
"specifies",
"a",
"parameterized",
"type",
"that",
"implements",
"both",
"{",
"@link",
"java",
".",
"util",
".",
"Set",
"Set",
"}",
"and",
"{",
"@link",
"java",
".",
"util",
".",
"Collection",
"Collection",
"}",
")",
"this",
"method",
"will",
"look",
"at",
"the",
"inheritance",
"hierarchy",
"of",
"only",
"one",
"of",
"the",
"implementations",
"/",
"subclasses",
";",
"the",
"first",
"interface",
"encountered",
"that",
"isn",
"t",
"a",
"subinterface",
"to",
"one",
"of",
"the",
"others",
"in",
"the",
"{",
"@code",
"type",
"}",
"to",
"{",
"@code",
"toClass",
"}",
"hierarchy",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L789-L791 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java | NotificationsApi.unsubscribeWithHttpInfo | public ApiResponse<Void> unsubscribeWithHttpInfo() throws ApiException {
"""
CometD unsubscribe
unscubscribe from channels, see https://docs.cometd.org/current/reference/#_bayeux_meta_unsubscribe
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
com.squareup.okhttp.Call call = unsubscribeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> unsubscribeWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = unsubscribeValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"unsubscribeWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"unsubscribeValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
"return",
"apiClient",
".",
"execute",
"(",
"call",
")",
";",
"}"
] | CometD unsubscribe
unscubscribe from channels, see https://docs.cometd.org/current/reference/#_bayeux_meta_unsubscribe
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"unsubscribe",
"unscubscribe",
"from",
"channels",
"see",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_unsubscribe"
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/NotificationsApi.java#L782-L785 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.deleteFromConference | public void deleteFromConference(
String connId,
String dnToDrop,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
"""
Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call.
@param connId The connection ID of the conference.
@param dnToDrop The DN of the party to drop from the conference.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
"""
try {
VoicecallsiddeletefromconferenceData deleteData =
new VoicecallsiddeletefromconferenceData();
deleteData.setDnToDrop(dnToDrop);
deleteData.setReasons(Util.toKVList(reasons));
deleteData.setExtensions(Util.toKVList(extensions));
DeleteFromConferenceData data = new DeleteFromConferenceData();
data.data(deleteData);
ApiSuccessResponse response = this.voiceApi.deleteFromConference(connId, data);
throwIfNotOk("deleteFromConference", response);
} catch (ApiException e) {
throw new WorkspaceApiException("deleteFromConference failed", e);
}
} | java | public void deleteFromConference(
String connId,
String dnToDrop,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsiddeletefromconferenceData deleteData =
new VoicecallsiddeletefromconferenceData();
deleteData.setDnToDrop(dnToDrop);
deleteData.setReasons(Util.toKVList(reasons));
deleteData.setExtensions(Util.toKVList(extensions));
DeleteFromConferenceData data = new DeleteFromConferenceData();
data.data(deleteData);
ApiSuccessResponse response = this.voiceApi.deleteFromConference(connId, data);
throwIfNotOk("deleteFromConference", response);
} catch (ApiException e) {
throw new WorkspaceApiException("deleteFromConference failed", e);
}
} | [
"public",
"void",
"deleteFromConference",
"(",
"String",
"connId",
",",
"String",
"dnToDrop",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsiddeletefromconferenceData",
"deleteData",
"=",
"new",
"VoicecallsiddeletefromconferenceData",
"(",
")",
";",
"deleteData",
".",
"setDnToDrop",
"(",
"dnToDrop",
")",
";",
"deleteData",
".",
"setReasons",
"(",
"Util",
".",
"toKVList",
"(",
"reasons",
")",
")",
";",
"deleteData",
".",
"setExtensions",
"(",
"Util",
".",
"toKVList",
"(",
"extensions",
")",
")",
";",
"DeleteFromConferenceData",
"data",
"=",
"new",
"DeleteFromConferenceData",
"(",
")",
";",
"data",
".",
"data",
"(",
"deleteData",
")",
";",
"ApiSuccessResponse",
"response",
"=",
"this",
".",
"voiceApi",
".",
"deleteFromConference",
"(",
"connId",
",",
"data",
")",
";",
"throwIfNotOk",
"(",
"\"deleteFromConference\"",
",",
"response",
")",
";",
"}",
"catch",
"(",
"ApiException",
"e",
")",
"{",
"throw",
"new",
"WorkspaceApiException",
"(",
"\"deleteFromConference failed\"",
",",
"e",
")",
";",
"}",
"}"
] | Delete the specified DN from the conference call. This operation can only be performed by the owner of the conference call.
@param connId The connection ID of the conference.
@param dnToDrop The DN of the party to drop from the conference.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Delete",
"the",
"specified",
"DN",
"from",
"the",
"conference",
"call",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"by",
"the",
"owner",
"of",
"the",
"conference",
"call",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L917-L937 |
Claudenw/junit-contracts | junit/src/main/java/org/xenei/junit/contract/ContractSuite.java | ContractSuite.addAnnotatedClasses | private List<Runner> addAnnotatedClasses(final Class<?> baseClass, final RunnerBuilder builder,
final ContractTestMap contractTestMap, final Object baseObj) throws InitializationError {
"""
Add annotated classes to the test
@param baseClass
the base test class
@param builder
The builder to use
@param contractTestMap
The ContractTest map.
@param baseObj
this is the instance object that we will use to get the
producer instance.
@return the list of runners
@throws InitializationError
"""
final List<Runner> runners = new ArrayList<Runner>();
final ContractImpl impl = getContractImpl( baseClass );
if (impl != null) {
TestInfo testInfo = contractTestMap.getInfoByTestClass( impl.value() );
if (testInfo == null) {
testInfo = new SuiteInfo( baseClass, impl );
contractTestMap.add( testInfo );
}
if (!testInfo.hasErrors()) {
addSpecifiedClasses( runners, baseClass, builder, contractTestMap, baseObj, testInfo );
}
// this is not an else since addSpecifiedClasses may add errors to
// testInfo.
if (testInfo.hasErrors()) {
runners.add( new TestInfoErrorRunner( baseClass, testInfo ) );
}
}
return runners;
} | java | private List<Runner> addAnnotatedClasses(final Class<?> baseClass, final RunnerBuilder builder,
final ContractTestMap contractTestMap, final Object baseObj) throws InitializationError {
final List<Runner> runners = new ArrayList<Runner>();
final ContractImpl impl = getContractImpl( baseClass );
if (impl != null) {
TestInfo testInfo = contractTestMap.getInfoByTestClass( impl.value() );
if (testInfo == null) {
testInfo = new SuiteInfo( baseClass, impl );
contractTestMap.add( testInfo );
}
if (!testInfo.hasErrors()) {
addSpecifiedClasses( runners, baseClass, builder, contractTestMap, baseObj, testInfo );
}
// this is not an else since addSpecifiedClasses may add errors to
// testInfo.
if (testInfo.hasErrors()) {
runners.add( new TestInfoErrorRunner( baseClass, testInfo ) );
}
}
return runners;
} | [
"private",
"List",
"<",
"Runner",
">",
"addAnnotatedClasses",
"(",
"final",
"Class",
"<",
"?",
">",
"baseClass",
",",
"final",
"RunnerBuilder",
"builder",
",",
"final",
"ContractTestMap",
"contractTestMap",
",",
"final",
"Object",
"baseObj",
")",
"throws",
"InitializationError",
"{",
"final",
"List",
"<",
"Runner",
">",
"runners",
"=",
"new",
"ArrayList",
"<",
"Runner",
">",
"(",
")",
";",
"final",
"ContractImpl",
"impl",
"=",
"getContractImpl",
"(",
"baseClass",
")",
";",
"if",
"(",
"impl",
"!=",
"null",
")",
"{",
"TestInfo",
"testInfo",
"=",
"contractTestMap",
".",
"getInfoByTestClass",
"(",
"impl",
".",
"value",
"(",
")",
")",
";",
"if",
"(",
"testInfo",
"==",
"null",
")",
"{",
"testInfo",
"=",
"new",
"SuiteInfo",
"(",
"baseClass",
",",
"impl",
")",
";",
"contractTestMap",
".",
"add",
"(",
"testInfo",
")",
";",
"}",
"if",
"(",
"!",
"testInfo",
".",
"hasErrors",
"(",
")",
")",
"{",
"addSpecifiedClasses",
"(",
"runners",
",",
"baseClass",
",",
"builder",
",",
"contractTestMap",
",",
"baseObj",
",",
"testInfo",
")",
";",
"}",
"// this is not an else since addSpecifiedClasses may add errors to",
"// testInfo.",
"if",
"(",
"testInfo",
".",
"hasErrors",
"(",
")",
")",
"{",
"runners",
".",
"add",
"(",
"new",
"TestInfoErrorRunner",
"(",
"baseClass",
",",
"testInfo",
")",
")",
";",
"}",
"}",
"return",
"runners",
";",
"}"
] | Add annotated classes to the test
@param baseClass
the base test class
@param builder
The builder to use
@param contractTestMap
The ContractTest map.
@param baseObj
this is the instance object that we will use to get the
producer instance.
@return the list of runners
@throws InitializationError | [
"Add",
"annotated",
"classes",
"to",
"the",
"test"
] | train | https://github.com/Claudenw/junit-contracts/blob/47e7294dbff374cdd875b3aafe28db48a37fe4d4/junit/src/main/java/org/xenei/junit/contract/ContractSuite.java#L268-L289 |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java | ResourceClaim.takeQueueTicket | static String takeQueueTicket(ZooKeeper zookeeper, String lockNode) throws InterruptedException, KeeperException {
"""
Take a ticket for the queue. If the ticket was already claimed by another process,
this method retries until it succeeds.
@param zookeeper ZooKeeper connection to use.
@param lockNode Path to the znode representing the locking queue.
@return The claimed ticket.
"""
// The ticket number includes a random component to decrease the chances of collision. Collision is handled
// neatly, but it saves a few actions if there is no need to retry ticket acquisition.
String ticket = String.format("nr-%014d-%04d", System.currentTimeMillis(), random.nextInt(10000));
if (grabTicket(zookeeper, lockNode, ticket)) {
return ticket;
} else {
return takeQueueTicket(zookeeper, lockNode);
}
} | java | static String takeQueueTicket(ZooKeeper zookeeper, String lockNode) throws InterruptedException, KeeperException {
// The ticket number includes a random component to decrease the chances of collision. Collision is handled
// neatly, but it saves a few actions if there is no need to retry ticket acquisition.
String ticket = String.format("nr-%014d-%04d", System.currentTimeMillis(), random.nextInt(10000));
if (grabTicket(zookeeper, lockNode, ticket)) {
return ticket;
} else {
return takeQueueTicket(zookeeper, lockNode);
}
} | [
"static",
"String",
"takeQueueTicket",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"lockNode",
")",
"throws",
"InterruptedException",
",",
"KeeperException",
"{",
"// The ticket number includes a random component to decrease the chances of collision. Collision is handled",
"// neatly, but it saves a few actions if there is no need to retry ticket acquisition.",
"String",
"ticket",
"=",
"String",
".",
"format",
"(",
"\"nr-%014d-%04d\"",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"random",
".",
"nextInt",
"(",
"10000",
")",
")",
";",
"if",
"(",
"grabTicket",
"(",
"zookeeper",
",",
"lockNode",
",",
"ticket",
")",
")",
"{",
"return",
"ticket",
";",
"}",
"else",
"{",
"return",
"takeQueueTicket",
"(",
"zookeeper",
",",
"lockNode",
")",
";",
"}",
"}"
] | Take a ticket for the queue. If the ticket was already claimed by another process,
this method retries until it succeeds.
@param zookeeper ZooKeeper connection to use.
@param lockNode Path to the znode representing the locking queue.
@return The claimed ticket. | [
"Take",
"a",
"ticket",
"for",
"the",
"queue",
".",
"If",
"the",
"ticket",
"was",
"already",
"claimed",
"by",
"another",
"process",
"this",
"method",
"retries",
"until",
"it",
"succeeds",
"."
] | train | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ResourceClaim.java#L185-L194 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java | SdkHttpUtils.encodeParameters | public static String encodeParameters(SignableRequest<?> request) {
"""
Creates an encoded query string from all the parameters in the specified
request.
@param request
The request containing the parameters to encode.
@return Null if no parameters were present, otherwise the encoded query
string for the parameters present in the specified request.
"""
final Map<String, List<String>> requestParams = request.getParameters();
if (requestParams.isEmpty()) return null;
final List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
for (Entry<String, List<String>> entry : requestParams.entrySet()) {
String parameterName = entry.getKey();
for (String value : entry.getValue()) {
nameValuePairs
.add(new BasicNameValuePair(parameterName, value));
}
}
return URLEncodedUtils.format(nameValuePairs, DEFAULT_ENCODING);
} | java | public static String encodeParameters(SignableRequest<?> request) {
final Map<String, List<String>> requestParams = request.getParameters();
if (requestParams.isEmpty()) return null;
final List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
for (Entry<String, List<String>> entry : requestParams.entrySet()) {
String parameterName = entry.getKey();
for (String value : entry.getValue()) {
nameValuePairs
.add(new BasicNameValuePair(parameterName, value));
}
}
return URLEncodedUtils.format(nameValuePairs, DEFAULT_ENCODING);
} | [
"public",
"static",
"String",
"encodeParameters",
"(",
"SignableRequest",
"<",
"?",
">",
"request",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"requestParams",
"=",
"request",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"requestParams",
".",
"isEmpty",
"(",
")",
")",
"return",
"null",
";",
"final",
"List",
"<",
"NameValuePair",
">",
"nameValuePairs",
"=",
"new",
"ArrayList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"entry",
":",
"requestParams",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"parameterName",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"for",
"(",
"String",
"value",
":",
"entry",
".",
"getValue",
"(",
")",
")",
"{",
"nameValuePairs",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"parameterName",
",",
"value",
")",
")",
";",
"}",
"}",
"return",
"URLEncodedUtils",
".",
"format",
"(",
"nameValuePairs",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | Creates an encoded query string from all the parameters in the specified
request.
@param request
The request containing the parameters to encode.
@return Null if no parameters were present, otherwise the encoded query
string for the parameters present in the specified request. | [
"Creates",
"an",
"encoded",
"query",
"string",
"from",
"all",
"the",
"parameters",
"in",
"the",
"specified",
"request",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java#L159-L176 |
derari/cthul | log-cal10n/src/main/java/org/cthul/log/CLocLogConfiguration.java | CLocLogConfiguration.getClassLogger | public <E extends Enum<?>> CLocLogger<E> getClassLogger(int i) {
"""
Chooses a logger based on the class name of the caller of this method.
{@code i == 0} identifies the caller of this method, for {@code i > 0},
the stack is walked upwards.
@param i
@return a logger
"""
if (i < 0) {
throw new IllegalArgumentException("Expected value >= 0, got " + i);
}
return getLogger(slfLogger(i+1));
} | java | public <E extends Enum<?>> CLocLogger<E> getClassLogger(int i) {
if (i < 0) {
throw new IllegalArgumentException("Expected value >= 0, got " + i);
}
return getLogger(slfLogger(i+1));
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"?",
">",
">",
"CLocLogger",
"<",
"E",
">",
"getClassLogger",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected value >= 0, got \"",
"+",
"i",
")",
";",
"}",
"return",
"getLogger",
"(",
"slfLogger",
"(",
"i",
"+",
"1",
")",
")",
";",
"}"
] | Chooses a logger based on the class name of the caller of this method.
{@code i == 0} identifies the caller of this method, for {@code i > 0},
the stack is walked upwards.
@param i
@return a logger | [
"Chooses",
"a",
"logger",
"based",
"on",
"the",
"class",
"name",
"of",
"the",
"caller",
"of",
"this",
"method",
".",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/log-cal10n/src/main/java/org/cthul/log/CLocLogConfiguration.java#L73-L78 |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/result/renderer/RendererFactory.java | RendererFactory.isRendererMatch | private RendererSelection isRendererMatch(RendererBeanDescriptor<?> rendererDescriptor, Renderable renderable,
RendererSelection bestMatch) {
"""
Checks if a particular renderer (descriptor) is a good match for a
particular renderer.
@param rendererDescriptor
the renderer (descriptor) to check.
@param renderable
the renderable that needs rendering.
@param bestMatchingDescriptor
the currently "best matching" renderer (descriptor), or null
if no other renderers matches yet.
@return a {@link RendererSelection} object if the renderer is a match, or
null if not.
"""
final Class<? extends Renderable> renderableType = rendererDescriptor.getRenderableType();
if (ReflectionUtils.is(renderable.getClass(), renderableType)) {
if (bestMatch == null) {
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
} else {
int hierarchyDistance = ReflectionUtils.getHierarchyDistance(renderable.getClass(), renderableType);
if (hierarchyDistance == 0) {
// no hierarchy distance
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
}
if (hierarchyDistance <= bestMatch.getHierarchyDistance()) {
// lower hierarchy distance than best match
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
}
}
}
return null;
} | java | private RendererSelection isRendererMatch(RendererBeanDescriptor<?> rendererDescriptor, Renderable renderable,
RendererSelection bestMatch) {
final Class<? extends Renderable> renderableType = rendererDescriptor.getRenderableType();
if (ReflectionUtils.is(renderable.getClass(), renderableType)) {
if (bestMatch == null) {
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
} else {
int hierarchyDistance = ReflectionUtils.getHierarchyDistance(renderable.getClass(), renderableType);
if (hierarchyDistance == 0) {
// no hierarchy distance
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
}
if (hierarchyDistance <= bestMatch.getHierarchyDistance()) {
// lower hierarchy distance than best match
return isRendererCapable(rendererDescriptor, renderable, bestMatch);
}
}
}
return null;
} | [
"private",
"RendererSelection",
"isRendererMatch",
"(",
"RendererBeanDescriptor",
"<",
"?",
">",
"rendererDescriptor",
",",
"Renderable",
"renderable",
",",
"RendererSelection",
"bestMatch",
")",
"{",
"final",
"Class",
"<",
"?",
"extends",
"Renderable",
">",
"renderableType",
"=",
"rendererDescriptor",
".",
"getRenderableType",
"(",
")",
";",
"if",
"(",
"ReflectionUtils",
".",
"is",
"(",
"renderable",
".",
"getClass",
"(",
")",
",",
"renderableType",
")",
")",
"{",
"if",
"(",
"bestMatch",
"==",
"null",
")",
"{",
"return",
"isRendererCapable",
"(",
"rendererDescriptor",
",",
"renderable",
",",
"bestMatch",
")",
";",
"}",
"else",
"{",
"int",
"hierarchyDistance",
"=",
"ReflectionUtils",
".",
"getHierarchyDistance",
"(",
"renderable",
".",
"getClass",
"(",
")",
",",
"renderableType",
")",
";",
"if",
"(",
"hierarchyDistance",
"==",
"0",
")",
"{",
"// no hierarchy distance",
"return",
"isRendererCapable",
"(",
"rendererDescriptor",
",",
"renderable",
",",
"bestMatch",
")",
";",
"}",
"if",
"(",
"hierarchyDistance",
"<=",
"bestMatch",
".",
"getHierarchyDistance",
"(",
")",
")",
"{",
"// lower hierarchy distance than best match",
"return",
"isRendererCapable",
"(",
"rendererDescriptor",
",",
"renderable",
",",
"bestMatch",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Checks if a particular renderer (descriptor) is a good match for a
particular renderer.
@param rendererDescriptor
the renderer (descriptor) to check.
@param renderable
the renderable that needs rendering.
@param bestMatchingDescriptor
the currently "best matching" renderer (descriptor), or null
if no other renderers matches yet.
@return a {@link RendererSelection} object if the renderer is a match, or
null if not. | [
"Checks",
"if",
"a",
"particular",
"renderer",
"(",
"descriptor",
")",
"is",
"a",
"good",
"match",
"for",
"a",
"particular",
"renderer",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/result/renderer/RendererFactory.java#L164-L185 |
dbracewell/mango | src/main/java/com/davidbracewell/string/StringUtils.java | StringUtils.randomString | public static String randomString(int length, int min, int max, @NonNull CharMatcher validChar) {
"""
Generates a random string of a given length
@param length The length of the string
@param min The min character in the string
@param max The max character in the string
@param validChar CharPredicate that must match for a character to be returned in the string
@return A string of random characters
"""
if (length <= 0) {
return EMPTY;
}
Random random = new Random();
int maxRandom = max - min;
char[] array = new char[length];
for (int i = 0; i < array.length; i++) {
char c;
do {
c = (char) (random.nextInt(maxRandom) + min);
} while (Character.isLowSurrogate(c) ||
Character.isHighSurrogate(c) ||
!validChar.matches(c));
array[i] = c;
}
return new String(array);
} | java | public static String randomString(int length, int min, int max, @NonNull CharMatcher validChar) {
if (length <= 0) {
return EMPTY;
}
Random random = new Random();
int maxRandom = max - min;
char[] array = new char[length];
for (int i = 0; i < array.length; i++) {
char c;
do {
c = (char) (random.nextInt(maxRandom) + min);
} while (Character.isLowSurrogate(c) ||
Character.isHighSurrogate(c) ||
!validChar.matches(c));
array[i] = c;
}
return new String(array);
} | [
"public",
"static",
"String",
"randomString",
"(",
"int",
"length",
",",
"int",
"min",
",",
"int",
"max",
",",
"@",
"NonNull",
"CharMatcher",
"validChar",
")",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"return",
"EMPTY",
";",
"}",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"int",
"maxRandom",
"=",
"max",
"-",
"min",
";",
"char",
"[",
"]",
"array",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"char",
"c",
";",
"do",
"{",
"c",
"=",
"(",
"char",
")",
"(",
"random",
".",
"nextInt",
"(",
"maxRandom",
")",
"+",
"min",
")",
";",
"}",
"while",
"(",
"Character",
".",
"isLowSurrogate",
"(",
"c",
")",
"||",
"Character",
".",
"isHighSurrogate",
"(",
"c",
")",
"||",
"!",
"validChar",
".",
"matches",
"(",
"c",
")",
")",
";",
"array",
"[",
"i",
"]",
"=",
"c",
";",
"}",
"return",
"new",
"String",
"(",
"array",
")",
";",
"}"
] | Generates a random string of a given length
@param length The length of the string
@param min The min character in the string
@param max The max character in the string
@param validChar CharPredicate that must match for a character to be returned in the string
@return A string of random characters | [
"Generates",
"a",
"random",
"string",
"of",
"a",
"given",
"length"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/string/StringUtils.java#L401-L418 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/config/WampSession.java | WampSession.registerDestructionCallback | public void registerDestructionCallback(String name, Runnable callback) {
"""
Register a callback to execute on destruction of the specified attribute. The
callback is executed when the session is closed.
@param name the name of the attribute to register the callback for
@param callback the destruction callback to be executed
"""
synchronized (getSessionMutex()) {
if (isSessionCompleted()) {
throw new IllegalStateException(
"Session id=" + getWebSocketSessionId() + " already completed");
}
setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name, callback);
}
} | java | public void registerDestructionCallback(String name, Runnable callback) {
synchronized (getSessionMutex()) {
if (isSessionCompleted()) {
throw new IllegalStateException(
"Session id=" + getWebSocketSessionId() + " already completed");
}
setAttribute(DESTRUCTION_CALLBACK_NAME_PREFIX + name, callback);
}
} | [
"public",
"void",
"registerDestructionCallback",
"(",
"String",
"name",
",",
"Runnable",
"callback",
")",
"{",
"synchronized",
"(",
"getSessionMutex",
"(",
")",
")",
"{",
"if",
"(",
"isSessionCompleted",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Session id=\"",
"+",
"getWebSocketSessionId",
"(",
")",
"+",
"\" already completed\"",
")",
";",
"}",
"setAttribute",
"(",
"DESTRUCTION_CALLBACK_NAME_PREFIX",
"+",
"name",
",",
"callback",
")",
";",
"}",
"}"
] | Register a callback to execute on destruction of the specified attribute. The
callback is executed when the session is closed.
@param name the name of the attribute to register the callback for
@param callback the destruction callback to be executed | [
"Register",
"a",
"callback",
"to",
"execute",
"on",
"destruction",
"of",
"the",
"specified",
"attribute",
".",
"The",
"callback",
"is",
"executed",
"when",
"the",
"session",
"is",
"closed",
"."
] | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/config/WampSession.java#L108-L116 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java | CloudTasksClient.setIamPolicy | public final Policy setIamPolicy(QueueName resource, Policy policy) {
"""
Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any
existing policy.
<p>Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level
permissions are required to use the Cloud Console.
<p>Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission
on the specified resource parent:
<p>* `cloudtasks.queues.setIamPolicy`
<p>Sample code:
<pre><code>
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
Policy response = cloudTasksClient.setIamPolicy(resource, policy);
}
</code></pre>
@param resource REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.
@param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(resource == null ? null : resource.toString())
.setPolicy(policy)
.build();
return setIamPolicy(request);
} | java | public final Policy setIamPolicy(QueueName resource, Policy policy) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(resource == null ? null : resource.toString())
.setPolicy(policy)
.build();
return setIamPolicy(request);
} | [
"public",
"final",
"Policy",
"setIamPolicy",
"(",
"QueueName",
"resource",
",",
"Policy",
"policy",
")",
"{",
"SetIamPolicyRequest",
"request",
"=",
"SetIamPolicyRequest",
".",
"newBuilder",
"(",
")",
".",
"setResource",
"(",
"resource",
"==",
"null",
"?",
"null",
":",
"resource",
".",
"toString",
"(",
")",
")",
".",
"setPolicy",
"(",
"policy",
")",
".",
"build",
"(",
")",
";",
"return",
"setIamPolicy",
"(",
"request",
")",
";",
"}"
] | Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any
existing policy.
<p>Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level
permissions are required to use the Cloud Console.
<p>Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission
on the specified resource parent:
<p>* `cloudtasks.queues.setIamPolicy`
<p>Sample code:
<pre><code>
try (CloudTasksClient cloudTasksClient = CloudTasksClient.create()) {
QueueName resource = QueueName.of("[PROJECT]", "[LOCATION]", "[QUEUE]");
Policy policy = Policy.newBuilder().build();
Policy response = cloudTasksClient.setIamPolicy(resource, policy);
}
</code></pre>
@param resource REQUIRED: The resource for which the policy is being specified. `resource` is
usually specified as a path. For example, a Project resource is specified as
`projects/{project}`.
@param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
Platform services (such as Projects) might reject them.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Sets",
"the",
"access",
"control",
"policy",
"for",
"a",
"[",
"Queue",
"]",
"[",
"google",
".",
"cloud",
".",
"tasks",
".",
"v2",
".",
"Queue",
"]",
".",
"Replaces",
"any",
"existing",
"policy",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-tasks/src/main/java/com/google/cloud/tasks/v2/CloudTasksClient.java#L1273-L1281 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java | ProxyTask.getNextStringParam | public String getNextStringParam(InputStream in, String strName, Map<String, Object> properties) {
"""
Get the next (String) param.
Typically this is overidden in the concrete implementation.
@param strName The param name (in most implementations this is optional).
@param properties The temporary remote session properties
@return The next param as a string.
"""
String string = null;
if (properties != null)
if (properties.get(strName) != null)
string = properties.get(strName).toString();
if (NULL.equals(string))
string = null;
return string;
} | java | public String getNextStringParam(InputStream in, String strName, Map<String, Object> properties)
{
String string = null;
if (properties != null)
if (properties.get(strName) != null)
string = properties.get(strName).toString();
if (NULL.equals(string))
string = null;
return string;
} | [
"public",
"String",
"getNextStringParam",
"(",
"InputStream",
"in",
",",
"String",
"strName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"string",
"=",
"null",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"if",
"(",
"properties",
".",
"get",
"(",
"strName",
")",
"!=",
"null",
")",
"string",
"=",
"properties",
".",
"get",
"(",
"strName",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"NULL",
".",
"equals",
"(",
"string",
")",
")",
"string",
"=",
"null",
";",
"return",
"string",
";",
"}"
] | Get the next (String) param.
Typically this is overidden in the concrete implementation.
@param strName The param name (in most implementations this is optional).
@param properties The temporary remote session properties
@return The next param as a string. | [
"Get",
"the",
"next",
"(",
"String",
")",
"param",
".",
"Typically",
"this",
"is",
"overidden",
"in",
"the",
"concrete",
"implementation",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java#L245-L254 |
vipshop/vjtools | vjstar/src/main/java/com/vip/vjstar/gc/CleanUpScheduler.java | CleanUpScheduler.getCurrentDateByPlan | public static Date getCurrentDateByPlan(String plan, String pattern) {
"""
return current date time by specified hour:minute
@param plan format: hh:mm
"""
try {
FastDateFormat format = FastDateFormat.getInstance(pattern);
Date end = format.parse(plan);
Calendar today = Calendar.getInstance();
end = DateUtils.setYears(end, (today.get(Calendar.YEAR)));
end = DateUtils.setMonths(end, today.get(Calendar.MONTH));
end = DateUtils.setDays(end, today.get(Calendar.DAY_OF_MONTH));
return end;
} catch (Exception e) {
throw ExceptionUtil.unchecked(e);
}
} | java | public static Date getCurrentDateByPlan(String plan, String pattern) {
try {
FastDateFormat format = FastDateFormat.getInstance(pattern);
Date end = format.parse(plan);
Calendar today = Calendar.getInstance();
end = DateUtils.setYears(end, (today.get(Calendar.YEAR)));
end = DateUtils.setMonths(end, today.get(Calendar.MONTH));
end = DateUtils.setDays(end, today.get(Calendar.DAY_OF_MONTH));
return end;
} catch (Exception e) {
throw ExceptionUtil.unchecked(e);
}
} | [
"public",
"static",
"Date",
"getCurrentDateByPlan",
"(",
"String",
"plan",
",",
"String",
"pattern",
")",
"{",
"try",
"{",
"FastDateFormat",
"format",
"=",
"FastDateFormat",
".",
"getInstance",
"(",
"pattern",
")",
";",
"Date",
"end",
"=",
"format",
".",
"parse",
"(",
"plan",
")",
";",
"Calendar",
"today",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"end",
"=",
"DateUtils",
".",
"setYears",
"(",
"end",
",",
"(",
"today",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
")",
")",
";",
"end",
"=",
"DateUtils",
".",
"setMonths",
"(",
"end",
",",
"today",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
")",
";",
"end",
"=",
"DateUtils",
".",
"setDays",
"(",
"end",
",",
"today",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
")",
";",
"return",
"end",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"ExceptionUtil",
".",
"unchecked",
"(",
"e",
")",
";",
"}",
"}"
] | return current date time by specified hour:minute
@param plan format: hh:mm | [
"return",
"current",
"date",
"time",
"by",
"specified",
"hour",
":",
"minute"
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjstar/src/main/java/com/vip/vjstar/gc/CleanUpScheduler.java#L99-L111 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertVisiblyEquals | public static void assertVisiblyEquals(String message, Object expected, Object actual) {
"""
Assert that an actual value is visibly equal to an expected value, following conversion to a String via toString().
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param expected the expected value
@param actual the actual value
"""
String expectedInQuotes = inQuotesIfNotNull(expected);
String actualInQuotes = inQuotesIfNotNull(actual);
if (areBothNull(expected, actual)) {
pass(message);
} else if (isObjectEquals(String.valueOf(expected), String.valueOf(actual))) {
pass(message);
} else {
fail(message, actualInQuotes + " after toString() does not equal expected " + expectedInQuotes);
}
} | java | public static void assertVisiblyEquals(String message, Object expected, Object actual) {
String expectedInQuotes = inQuotesIfNotNull(expected);
String actualInQuotes = inQuotesIfNotNull(actual);
if (areBothNull(expected, actual)) {
pass(message);
} else if (isObjectEquals(String.valueOf(expected), String.valueOf(actual))) {
pass(message);
} else {
fail(message, actualInQuotes + " after toString() does not equal expected " + expectedInQuotes);
}
} | [
"public",
"static",
"void",
"assertVisiblyEquals",
"(",
"String",
"message",
",",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"String",
"expectedInQuotes",
"=",
"inQuotesIfNotNull",
"(",
"expected",
")",
";",
"String",
"actualInQuotes",
"=",
"inQuotesIfNotNull",
"(",
"actual",
")",
";",
"if",
"(",
"areBothNull",
"(",
"expected",
",",
"actual",
")",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"if",
"(",
"isObjectEquals",
"(",
"String",
".",
"valueOf",
"(",
"expected",
")",
",",
"String",
".",
"valueOf",
"(",
"actual",
")",
")",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"message",
",",
"actualInQuotes",
"+",
"\" after toString() does not equal expected \"",
"+",
"expectedInQuotes",
")",
";",
"}",
"}"
] | Assert that an actual value is visibly equal to an expected value, following conversion to a String via toString().
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param expected the expected value
@param actual the actual value | [
"Assert",
"that",
"an",
"actual",
"value",
"is",
"visibly",
"equal",
"to",
"an",
"expected",
"value",
"following",
"conversion",
"to",
"a",
"String",
"via",
"toString",
"()",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L187-L199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.