repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java | TableLayoutBuilder.cell | public TableLayoutBuilder cell(JComponent component, String attributes) {
Cell cc = cellInternal(component, attributes);
lastCC = cc;
items.add(cc);
return this;
} | java | public TableLayoutBuilder cell(JComponent component, String attributes) {
Cell cc = cellInternal(component, attributes);
lastCC = cc;
items.add(cc);
return this;
} | [
"public",
"TableLayoutBuilder",
"cell",
"(",
"JComponent",
"component",
",",
"String",
"attributes",
")",
"{",
"Cell",
"cc",
"=",
"cellInternal",
"(",
"component",
",",
"attributes",
")",
";",
"lastCC",
"=",
"cc",
";",
"items",
".",
"add",
"(",
"cc",
")",
... | Inserts a component at the current row/column. Attributes may be zero or
more of rowSpec, columnSpec, colGrId, rowGrId, align and valign. | [
"Inserts",
"a",
"component",
"at",
"the",
"current",
"row",
"/",
"column",
".",
"Attributes",
"may",
"be",
"zero",
"or",
"more",
"of",
"rowSpec",
"columnSpec",
"colGrId",
"rowGrId",
"align",
"and",
"valign",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/TableLayoutBuilder.java#L262-L267 |
allure-framework/allure1 | allure-report-plugin-api/src/main/java/ru/yandex/qatools/allure/data/plugins/AbstractPlugin.java | AbstractPlugin.getPluginData | @Override
public List<PluginData> getPluginData() {
List<PluginData> results = new ArrayList<>();
for (Field field : getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Plugin.Data.class)) {
String fileName = getFileName(field);
results.add(new PluginData(fileName, getFieldValue(field)));
}
}
return results;
} | java | @Override
public List<PluginData> getPluginData() {
List<PluginData> results = new ArrayList<>();
for (Field field : getClass().getDeclaredFields()) {
if (field.isAnnotationPresent(Plugin.Data.class)) {
String fileName = getFileName(field);
results.add(new PluginData(fileName, getFieldValue(field)));
}
}
return results;
} | [
"@",
"Override",
"public",
"List",
"<",
"PluginData",
">",
"getPluginData",
"(",
")",
"{",
"List",
"<",
"PluginData",
">",
"results",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Field",
"field",
":",
"getClass",
"(",
")",
".",
"getDeclar... | This method creates a {@link PluginData} for each field with
{@link Plugin.Data} annotation.
@see #getFileName(Field)
@see #getFieldValue(Field) | [
"This",
"method",
"creates",
"a",
"{",
"@link",
"PluginData",
"}",
"for",
"each",
"field",
"with",
"{",
"@link",
"Plugin",
".",
"Data",
"}",
"annotation",
"."
] | train | https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-report-plugin-api/src/main/java/ru/yandex/qatools/allure/data/plugins/AbstractPlugin.java#L54-L64 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java | WDataTable.setSort | protected void setSort(final int index, final boolean ascending) {
TableModel model = getOrCreateComponentModel();
model.sortColIndex = index;
model.sortAscending = ascending;
} | java | protected void setSort(final int index, final boolean ascending) {
TableModel model = getOrCreateComponentModel();
model.sortColIndex = index;
model.sortAscending = ascending;
} | [
"protected",
"void",
"setSort",
"(",
"final",
"int",
"index",
",",
"final",
"boolean",
"ascending",
")",
"{",
"TableModel",
"model",
"=",
"getOrCreateComponentModel",
"(",
")",
";",
"model",
".",
"sortColIndex",
"=",
"index",
";",
"model",
".",
"sortAscending"... | For rendering purposes only - has no effect on model.
@param index the sort column index, or -1 for no sort.
@param ascending true for ascending order, false for descending | [
"For",
"rendering",
"purposes",
"only",
"-",
"has",
"no",
"effect",
"on",
"model",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java#L861-L865 |
urbanairship/datacube | src/main/java/com/urbanairship/datacube/dbharnesses/HBaseDbHarness.java | HBaseDbHarness.runBatchAsync | @Override
public Future<?> runBatchAsync(Batch<T> batch, AfterExecute<T> afterExecute) throws FullQueueException {
/*
* Since ThreadPoolExecutor throws RejectedExecutionException when its queue is full,
* we have to backoff and retry if execute() throws RejectedExecutionHandler.
*
* This will cause all other threads writing to this cube to block. This is the desired
* behavior since we want to stop accepting new writes past a certain point if we can't
* send them to the database.
*/
try {
// Submit this batch
synchronized (batchesInFlight) {
batchesInFlight.add(batch);
}
return flushExecutor.submit(new FlushWorkerRunnable(batch, afterExecute));
} catch (RejectedExecutionException ree) {
throw new FullQueueException();
}
} | java | @Override
public Future<?> runBatchAsync(Batch<T> batch, AfterExecute<T> afterExecute) throws FullQueueException {
/*
* Since ThreadPoolExecutor throws RejectedExecutionException when its queue is full,
* we have to backoff and retry if execute() throws RejectedExecutionHandler.
*
* This will cause all other threads writing to this cube to block. This is the desired
* behavior since we want to stop accepting new writes past a certain point if we can't
* send them to the database.
*/
try {
// Submit this batch
synchronized (batchesInFlight) {
batchesInFlight.add(batch);
}
return flushExecutor.submit(new FlushWorkerRunnable(batch, afterExecute));
} catch (RejectedExecutionException ree) {
throw new FullQueueException();
}
} | [
"@",
"Override",
"public",
"Future",
"<",
"?",
">",
"runBatchAsync",
"(",
"Batch",
"<",
"T",
">",
"batch",
",",
"AfterExecute",
"<",
"T",
">",
"afterExecute",
")",
"throws",
"FullQueueException",
"{",
"/* \n * Since ThreadPoolExecutor throws RejectedExecutionE... | Hands off the given batch to the flush executor to be sent to the database soon. Doesn't
throw IOException, since batches are just asynchronously submitted for execution, but
will throw AsyncException if some previous batch had a RuntimeException.
@return a Future that the caller can use to detect when the database IO is done. The returned
future will never have an ExecutionException. | [
"Hands",
"off",
"the",
"given",
"batch",
"to",
"the",
"flush",
"executor",
"to",
"be",
"sent",
"to",
"the",
"database",
"soon",
".",
"Doesn",
"t",
"throw",
"IOException",
"since",
"batches",
"are",
"just",
"asynchronously",
"submitted",
"for",
"execution",
"... | train | https://github.com/urbanairship/datacube/blob/89c6b68744cc384c8b49f921cdb0a0f9f414ada6/src/main/java/com/urbanairship/datacube/dbharnesses/HBaseDbHarness.java#L224-L243 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ReadaheadPool.java | ReadaheadPool.readaheadStream | public ReadaheadRequest readaheadStream(
String identifier,
FileDescriptor fd,
long curPos,
long readaheadLength,
long maxOffsetToRead,
ReadaheadRequest lastReadahead) {
Preconditions.checkArgument(curPos <= maxOffsetToRead,
"Readahead position %s higher than maxOffsetToRead %s",
curPos, maxOffsetToRead);
if (readaheadLength <= 0) {
return null;
}
long lastOffset = Long.MIN_VALUE;
if (lastReadahead != null) {
lastOffset = lastReadahead.getOffset();
}
// trigger each readahead when we have reached the halfway mark
// in the previous readahead. This gives the system time
// to satisfy the readahead before we start reading the data.
long nextOffset = lastOffset + readaheadLength / 2;
if (curPos >= nextOffset) {
// cancel any currently pending readahead, to avoid
// piling things up in the queue. Each reader should have at most
// one outstanding request in the queue.
if (lastReadahead != null) {
lastReadahead.cancel();
lastReadahead = null;
}
long length = Math.min(readaheadLength,
maxOffsetToRead - curPos);
if (length <= 0) {
// we've reached the end of the stream
return null;
}
return submitReadahead(identifier, fd, curPos, length);
} else {
return lastReadahead;
}
} | java | public ReadaheadRequest readaheadStream(
String identifier,
FileDescriptor fd,
long curPos,
long readaheadLength,
long maxOffsetToRead,
ReadaheadRequest lastReadahead) {
Preconditions.checkArgument(curPos <= maxOffsetToRead,
"Readahead position %s higher than maxOffsetToRead %s",
curPos, maxOffsetToRead);
if (readaheadLength <= 0) {
return null;
}
long lastOffset = Long.MIN_VALUE;
if (lastReadahead != null) {
lastOffset = lastReadahead.getOffset();
}
// trigger each readahead when we have reached the halfway mark
// in the previous readahead. This gives the system time
// to satisfy the readahead before we start reading the data.
long nextOffset = lastOffset + readaheadLength / 2;
if (curPos >= nextOffset) {
// cancel any currently pending readahead, to avoid
// piling things up in the queue. Each reader should have at most
// one outstanding request in the queue.
if (lastReadahead != null) {
lastReadahead.cancel();
lastReadahead = null;
}
long length = Math.min(readaheadLength,
maxOffsetToRead - curPos);
if (length <= 0) {
// we've reached the end of the stream
return null;
}
return submitReadahead(identifier, fd, curPos, length);
} else {
return lastReadahead;
}
} | [
"public",
"ReadaheadRequest",
"readaheadStream",
"(",
"String",
"identifier",
",",
"FileDescriptor",
"fd",
",",
"long",
"curPos",
",",
"long",
"readaheadLength",
",",
"long",
"maxOffsetToRead",
",",
"ReadaheadRequest",
"lastReadahead",
")",
"{",
"Preconditions",
".",
... | Issue a request to readahead on the given file descriptor.
@param identifier a textual identifier that will be used in error
messages (e.g. the file name)
@param fd the file descriptor to read ahead
@param curPos the current offset at which reads are being issued
@param readaheadLength the configured length to read ahead
@param maxOffsetToRead the maximum offset that will be readahead
(useful if, for example, only some segment of the file is
requested by the user). Pass {@link Long.MAX_VALUE} to allow
readahead to the end of the file.
@param lastReadahead the result returned by the previous invocation
of this function on this file descriptor, or null if this is
the first call
@return an object representing this outstanding request, or null
if no readahead was performed | [
"Issue",
"a",
"request",
"to",
"readahead",
"on",
"the",
"given",
"file",
"descriptor",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ReadaheadPool.java#L85-L132 |
jayantk/jklol | src/com/jayantkrish/jklol/cfg/CfgParseChart.java | CfgParseChart.getInsideEntries | public Factor getInsideEntries(int spanStart, int spanEnd) {
Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(),
parentVar.getVariableSizes(), insideChart[spanStart][spanEnd]);
return new TableFactor(parentVar, entries);
} | java | public Factor getInsideEntries(int spanStart, int spanEnd) {
Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(),
parentVar.getVariableSizes(), insideChart[spanStart][spanEnd]);
return new TableFactor(parentVar, entries);
} | [
"public",
"Factor",
"getInsideEntries",
"(",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"Tensor",
"entries",
"=",
"new",
"DenseTensor",
"(",
"parentVar",
".",
"getVariableNumsArray",
"(",
")",
",",
"parentVar",
".",
"getVariableSizes",
"(",
")",
",",... | Get the inside unnormalized probabilities over productions at a particular
span in the tree. | [
"Get",
"the",
"inside",
"unnormalized",
"probabilities",
"over",
"productions",
"at",
"a",
"particular",
"span",
"in",
"the",
"tree",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L253-L257 |
stagemonitor/stagemonitor | stagemonitor-os/src/main/java/org/stagemonitor/os/SigarNativeBindingLoader.java | SigarNativeBindingLoader.extractFromJarToTemp | public static void extractFromJarToTemp(String path, File tempDirectory) throws IOException {
File temp = createTempFile(path, tempDirectory);
if (temp == null) {
// already extracted
return;
}
writeFromJarToTempFile(path, temp);
} | java | public static void extractFromJarToTemp(String path, File tempDirectory) throws IOException {
File temp = createTempFile(path, tempDirectory);
if (temp == null) {
// already extracted
return;
}
writeFromJarToTempFile(path, temp);
} | [
"public",
"static",
"void",
"extractFromJarToTemp",
"(",
"String",
"path",
",",
"File",
"tempDirectory",
")",
"throws",
"IOException",
"{",
"File",
"temp",
"=",
"createTempFile",
"(",
"path",
",",
"tempDirectory",
")",
";",
"if",
"(",
"temp",
"==",
"null",
"... | Loads library from current JAR archive<p>
The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after
exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.
@param path The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext
@throws IOException If temporary file creation or read/write operation fails
@throws IllegalArgumentException If source file (param path) does not exist
@throws IllegalArgumentException If the path is not absolute or if the filename is shorter than three characters
(see restriction of {@link File#createTempFile(java.lang.String,
java.lang.String)}). | [
"Loads",
"library",
"from",
"current",
"JAR",
"archive<p",
">"
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-os/src/main/java/org/stagemonitor/os/SigarNativeBindingLoader.java#L81-L88 |
jetty-project/jetty-npn | npn-boot/src/main/java/sun/security/ssl/SSLEngineImpl.java | SSLEngineImpl.checkSequenceNumber | private boolean checkSequenceNumber(MAC mac, byte type)
throws IOException {
/*
* Don't bother to check the sequence number for error or
* closed connections, or NULL MAC
*/
if (connectionState >= cs_ERROR || mac == MAC.NULL) {
return false;
}
/*
* Conservatively, close the connection immediately when the
* sequence number is close to overflow
*/
if (mac.seqNumOverflow()) {
/*
* TLS protocols do not define a error alert for sequence
* number overflow. We use handshake_failure error alert
* for handshaking and bad_record_mac for other records.
*/
if (debug != null && Debug.isOn("ssl")) {
System.out.println(threadName() +
", sequence number extremely close to overflow " +
"(2^64-1 packets). Closing connection.");
}
fatal(Alerts.alert_handshake_failure, "sequence number overflow");
return true; // make the compiler happy
}
/*
* Ask for renegotiation when need to renew sequence number.
*
* Don't bother to kickstart the renegotiation when the local is
* asking for it.
*/
if ((type != Record.ct_handshake) && mac.seqNumIsHuge()) {
if (debug != null && Debug.isOn("ssl")) {
System.out.println(threadName() + ", request renegotiation " +
"to avoid sequence number overflow");
}
beginHandshake();
return true;
}
return false;
} | java | private boolean checkSequenceNumber(MAC mac, byte type)
throws IOException {
/*
* Don't bother to check the sequence number for error or
* closed connections, or NULL MAC
*/
if (connectionState >= cs_ERROR || mac == MAC.NULL) {
return false;
}
/*
* Conservatively, close the connection immediately when the
* sequence number is close to overflow
*/
if (mac.seqNumOverflow()) {
/*
* TLS protocols do not define a error alert for sequence
* number overflow. We use handshake_failure error alert
* for handshaking and bad_record_mac for other records.
*/
if (debug != null && Debug.isOn("ssl")) {
System.out.println(threadName() +
", sequence number extremely close to overflow " +
"(2^64-1 packets). Closing connection.");
}
fatal(Alerts.alert_handshake_failure, "sequence number overflow");
return true; // make the compiler happy
}
/*
* Ask for renegotiation when need to renew sequence number.
*
* Don't bother to kickstart the renegotiation when the local is
* asking for it.
*/
if ((type != Record.ct_handshake) && mac.seqNumIsHuge()) {
if (debug != null && Debug.isOn("ssl")) {
System.out.println(threadName() + ", request renegotiation " +
"to avoid sequence number overflow");
}
beginHandshake();
return true;
}
return false;
} | [
"private",
"boolean",
"checkSequenceNumber",
"(",
"MAC",
"mac",
",",
"byte",
"type",
")",
"throws",
"IOException",
"{",
"/*\n * Don't bother to check the sequence number for error or\n * closed connections, or NULL MAC\n */",
"if",
"(",
"connectionState",
">... | Check the sequence number state
RFC 4346 states that, "Sequence numbers are of type uint64 and
may not exceed 2^64-1. Sequence numbers do not wrap. If a TLS
implementation would need to wrap a sequence number, it must
renegotiate instead."
Return true if the handshake status may be changed. | [
"Check",
"the",
"sequence",
"number",
"state"
] | train | https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/SSLEngineImpl.java#L1380-L1429 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java | MsgDestEncodingUtilsImpl.getDestinationFromMsgRepresentation | public final JmsDestination getDestinationFromMsgRepresentation(byte[] msgForm) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestinationFromMsgRepresentation");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "msgForm: " + SibTr.formatBytes(msgForm));
JmsDestination newDest = null;
if (msgForm == null) {
// Error case.
throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class,
"INTERNAL_INVALID_VALUE_CWSIA0361",
new Object[] {"null", "getDestinationFromMsgRepresentation(byte[])"}, tc);
}
// The first half-byte in the message form indicates the Destination type
if ((msgForm[0] & TOPIC_TYPE) == TOPIC_TYPE) {
newDest = new JmsTopicImpl();
}
else {
newDest = new JmsQueueImpl();
}
// Decode the basic stuff (i.e. DeliveryMode, Priority & TTL) onto the new Destination
int offset = decodeBasicProperties(newDest, msgForm);
// Now decode the rest of the byte[] onto this new Destination
decodeOtherProperties(newDest, msgForm, offset);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationFromMsgRepresentation", newDest);
return newDest;
} | java | public final JmsDestination getDestinationFromMsgRepresentation(byte[] msgForm) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestinationFromMsgRepresentation");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "msgForm: " + SibTr.formatBytes(msgForm));
JmsDestination newDest = null;
if (msgForm == null) {
// Error case.
throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class,
"INTERNAL_INVALID_VALUE_CWSIA0361",
new Object[] {"null", "getDestinationFromMsgRepresentation(byte[])"}, tc);
}
// The first half-byte in the message form indicates the Destination type
if ((msgForm[0] & TOPIC_TYPE) == TOPIC_TYPE) {
newDest = new JmsTopicImpl();
}
else {
newDest = new JmsQueueImpl();
}
// Decode the basic stuff (i.e. DeliveryMode, Priority & TTL) onto the new Destination
int offset = decodeBasicProperties(newDest, msgForm);
// Now decode the rest of the byte[] onto this new Destination
decodeOtherProperties(newDest, msgForm, offset);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationFromMsgRepresentation", newDest);
return newDest;
} | [
"public",
"final",
"JmsDestination",
"getDestinationFromMsgRepresentation",
"(",
"byte",
"[",
"]",
"msgForm",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
... | /*
@see com.ibm.ws.sib.api.jms.MessageDestEncodingUtils#getDestinationFromMsgRepresentation(byte[])
Inflates the efficient byte[] representation from the message into a
JmsDestination object.
Throws a JMSException if there are problems during the deserialization process, for
example if the parameter is null. | [
"/",
"*",
"@see",
"com",
".",
"ibm",
".",
"ws",
".",
"sib",
".",
"api",
".",
"jms",
".",
"MessageDestEncodingUtils#getDestinationFromMsgRepresentation",
"(",
"byte",
"[]",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L235-L264 |
sematext/sematext-metrics | src/main/java/com/sematext/metrics/client/SematextClient.java | SematextClient.newInstance | public static SematextClient newInstance(String token) {
if (token == null) {
throw new IllegalArgumentException("Token should be defined.");
}
return newInstance(new ClientProperties(token, null, null));
} | java | public static SematextClient newInstance(String token) {
if (token == null) {
throw new IllegalArgumentException("Token should be defined.");
}
return newInstance(new ClientProperties(token, null, null));
} | [
"public",
"static",
"SematextClient",
"newInstance",
"(",
"String",
"token",
")",
"{",
"if",
"(",
"token",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Token should be defined.\"",
")",
";",
"}",
"return",
"newInstance",
"(",
"new"... | Create new instance of client.
@param token token
@return new client instance
@throws IllegalArgumentException when token or executor is {@code null} | [
"Create",
"new",
"instance",
"of",
"client",
"."
] | train | https://github.com/sematext/sematext-metrics/blob/a89ebb9eca2e4e8d8547e68bc9bc1f01aeb3975c/src/main/java/com/sematext/metrics/client/SematextClient.java#L194-L199 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.installationTemplate_templateName_partitionScheme_schemeName_DELETE | public void installationTemplate_templateName_partitionScheme_schemeName_DELETE(String templateName, String schemeName) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}";
StringBuilder sb = path(qPath, templateName, schemeName);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void installationTemplate_templateName_partitionScheme_schemeName_DELETE(String templateName, String schemeName) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}";
StringBuilder sb = path(qPath, templateName, schemeName);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"installationTemplate_templateName_partitionScheme_schemeName_DELETE",
"(",
"String",
"templateName",
",",
"String",
"schemeName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/installationTemplate/{templateName}/partitionScheme/{schemeName}\"",
... | remove this scheme of partition
REST: DELETE /me/installationTemplate/{templateName}/partitionScheme/{schemeName}
@param templateName [required] This template name
@param schemeName [required] name of this partitioning scheme | [
"remove",
"this",
"scheme",
"of",
"partition"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3615-L3619 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java | ClassUtility.callMethod | public static Object callMethod(final Method method, final Object instance, final Object... parameters) throws CoreException {
Object res = null;
try {
// store current visibility
final boolean accessible = method.isAccessible();
// let it accessible anyway
method.setAccessible(true);
// Call this method with right parameters
res = method.invoke(instance, parameters);
// Reset default visibility
method.setAccessible(accessible);
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
final String methodName = instance.getClass().getSimpleName() + "." + method.getName();
throw new CoreException("Impossible to call method " + methodName, e);
}
return res;
} | java | public static Object callMethod(final Method method, final Object instance, final Object... parameters) throws CoreException {
Object res = null;
try {
// store current visibility
final boolean accessible = method.isAccessible();
// let it accessible anyway
method.setAccessible(true);
// Call this method with right parameters
res = method.invoke(instance, parameters);
// Reset default visibility
method.setAccessible(accessible);
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
final String methodName = instance.getClass().getSimpleName() + "." + method.getName();
throw new CoreException("Impossible to call method " + methodName, e);
}
return res;
} | [
"public",
"static",
"Object",
"callMethod",
"(",
"final",
"Method",
"method",
",",
"final",
"Object",
"instance",
",",
"final",
"Object",
"...",
"parameters",
")",
"throws",
"CoreException",
"{",
"Object",
"res",
"=",
"null",
";",
"try",
"{",
"// store current... | Call the given method for the instance object even if its visibility is private or protected.
@param method the method to call
@param instance the object instance to use
@param parameters the list of method parameters to use
@return the method return
@throws CoreException if the method call has failed | [
"Call",
"the",
"given",
"method",
"for",
"the",
"instance",
"object",
"even",
"if",
"its",
"visibility",
"is",
"private",
"or",
"protected",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java#L519-L541 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/EntityHelper.java | EntityHelper.getEntity | @SuppressWarnings("unchecked")
public static <T> T getEntity(InputStream in, TypeReference<T> reference) {
// If the entity type is an iterator then return a streaming iterator to prevent Jackson instantiating
// the entire response in memory.
Type type = reference.getType();
if (type instanceof ParameterizedType &&
Iterator.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())) {
Type elementType = ((ParameterizedType) type).getActualTypeArguments()[0];
return (T) streamingIterator(in, typeReferenceFrom(elementType));
}
// Use Jackson to deserialize the input stream.
try {
return JsonHelper.readJson(in, reference);
} catch (IOException e) {
throw Throwables.propagate(e);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getEntity(InputStream in, TypeReference<T> reference) {
// If the entity type is an iterator then return a streaming iterator to prevent Jackson instantiating
// the entire response in memory.
Type type = reference.getType();
if (type instanceof ParameterizedType &&
Iterator.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())) {
Type elementType = ((ParameterizedType) type).getActualTypeArguments()[0];
return (T) streamingIterator(in, typeReferenceFrom(elementType));
}
// Use Jackson to deserialize the input stream.
try {
return JsonHelper.readJson(in, reference);
} catch (IOException e) {
throw Throwables.propagate(e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getEntity",
"(",
"InputStream",
"in",
",",
"TypeReference",
"<",
"T",
">",
"reference",
")",
"{",
"// If the entity type is an iterator then return a streaming iterator to preve... | Reads the entity input stream and deserializes the JSON content to the given type reference. If the
type reference is for an iterator then a {@link JsonStreamingArrayParser} will be returned to stream
the deserialized contents to the caller. | [
"Reads",
"the",
"entity",
"input",
"stream",
"and",
"deserializes",
"the",
"JSON",
"content",
"to",
"the",
"given",
"type",
"reference",
".",
"If",
"the",
"type",
"reference",
"is",
"for",
"an",
"iterator",
"then",
"a",
"{"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/EntityHelper.java#L41-L58 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java | AbstractEventSerializer.getNextEvent | public CloudTrailEvent getNextEvent() throws IOException {
CloudTrailEventData eventData = new CloudTrailEventData();
String key;
/* Get next CloudTrailEvent event from log file. When failed to parse a event,
* IOException will be thrown. In this case, the charEnd index the place we
* encountered parsing error. */
// return the starting location of the current token; that is, position of the first character
// from input that starts the current token
int charStart = (int) jsonParser.getTokenLocation().getCharOffset();
while(jsonParser.nextToken() != JsonToken.END_OBJECT) {
key = jsonParser.getCurrentName();
switch (key) {
case "eventVersion":
String eventVersion = jsonParser.nextTextValue();
if (Double.parseDouble(eventVersion) > SUPPORTED_EVENT_VERSION) {
logger.debug(String.format("EventVersion %s is not supported by CloudTrail.", eventVersion));
}
eventData.add(key, eventVersion);
break;
case "userIdentity":
this.parseUserIdentity(eventData);
break;
case "eventTime":
eventData.add(CloudTrailEventField.eventTime.name(), convertToDate(jsonParser.nextTextValue()));
break;
case "eventID":
eventData.add(key, convertToUUID(jsonParser.nextTextValue()));
break;
case "readOnly":
this.parseReadOnly(eventData);
break;
case "resources":
this.parseResources(eventData);
break;
case "managementEvent":
this.parseManagementEvent(eventData);
break;
default:
eventData.add(key, parseDefaultValue(key));
break;
}
}
this.setAccountId(eventData);
// event's last character position in the log file.
int charEnd = (int) jsonParser.getTokenLocation().getCharOffset();
CloudTrailEventMetadata metaData = getMetadata(charStart, charEnd);
return new CloudTrailEvent(eventData, metaData);
} | java | public CloudTrailEvent getNextEvent() throws IOException {
CloudTrailEventData eventData = new CloudTrailEventData();
String key;
/* Get next CloudTrailEvent event from log file. When failed to parse a event,
* IOException will be thrown. In this case, the charEnd index the place we
* encountered parsing error. */
// return the starting location of the current token; that is, position of the first character
// from input that starts the current token
int charStart = (int) jsonParser.getTokenLocation().getCharOffset();
while(jsonParser.nextToken() != JsonToken.END_OBJECT) {
key = jsonParser.getCurrentName();
switch (key) {
case "eventVersion":
String eventVersion = jsonParser.nextTextValue();
if (Double.parseDouble(eventVersion) > SUPPORTED_EVENT_VERSION) {
logger.debug(String.format("EventVersion %s is not supported by CloudTrail.", eventVersion));
}
eventData.add(key, eventVersion);
break;
case "userIdentity":
this.parseUserIdentity(eventData);
break;
case "eventTime":
eventData.add(CloudTrailEventField.eventTime.name(), convertToDate(jsonParser.nextTextValue()));
break;
case "eventID":
eventData.add(key, convertToUUID(jsonParser.nextTextValue()));
break;
case "readOnly":
this.parseReadOnly(eventData);
break;
case "resources":
this.parseResources(eventData);
break;
case "managementEvent":
this.parseManagementEvent(eventData);
break;
default:
eventData.add(key, parseDefaultValue(key));
break;
}
}
this.setAccountId(eventData);
// event's last character position in the log file.
int charEnd = (int) jsonParser.getTokenLocation().getCharOffset();
CloudTrailEventMetadata metaData = getMetadata(charStart, charEnd);
return new CloudTrailEvent(eventData, metaData);
} | [
"public",
"CloudTrailEvent",
"getNextEvent",
"(",
")",
"throws",
"IOException",
"{",
"CloudTrailEventData",
"eventData",
"=",
"new",
"CloudTrailEventData",
"(",
")",
";",
"String",
"key",
";",
"/* Get next CloudTrailEvent event from log file. When failed to parse a event,\n ... | Get the next event from the CloudTrail log and parse it.
@return a {@link CloudTrailEvent} that represents the
parsed event.
@throws IOException if the event could not be parsed. | [
"Get",
"the",
"next",
"event",
"from",
"the",
"CloudTrail",
"log",
"and",
"parse",
"it",
"."
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L119-L173 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/RowColumnResourcesImpl.java | RowColumnResourcesImpl.addImageToCell | public void addImageToCell(long sheetId, long rowId, long columnId, String file, String fileType, boolean overrideValidation, String altText) throws FileNotFoundException, SmartsheetException {
addImage("sheets/" + sheetId + "/rows/" + rowId + "/columns/" + columnId + "/cellimages", file, fileType, overrideValidation, altText);
} | java | public void addImageToCell(long sheetId, long rowId, long columnId, String file, String fileType, boolean overrideValidation, String altText) throws FileNotFoundException, SmartsheetException {
addImage("sheets/" + sheetId + "/rows/" + rowId + "/columns/" + columnId + "/cellimages", file, fileType, overrideValidation, altText);
} | [
"public",
"void",
"addImageToCell",
"(",
"long",
"sheetId",
",",
"long",
"rowId",
",",
"long",
"columnId",
",",
"String",
"file",
",",
"String",
"fileType",
",",
"boolean",
"overrideValidation",
",",
"String",
"altText",
")",
"throws",
"FileNotFoundException",
"... | Add an image to a cell.
It mirrors the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/{rowId}/columns/{columnId}/cellimages
Exceptions:
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ResourceNotFoundException : if the resource can not be found
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet Id
@param rowId the row id
@param columnId the column id
@param file the file path
@param fileType
@throws SmartsheetException the smartsheet exception
@throws FileNotFoundException image file not found | [
"Add",
"an",
"image",
"to",
"a",
"cell",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowColumnResourcesImpl.java#L176-L178 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.createStream | public CreateStreamResponse createStream(String playDomain, String app, String pushStream) {
CreateStreamRequest request = new CreateStreamRequest();
request.withPlayDomain(playDomain)
.withApp(app)
.withPublish(new CreateStreamRequest.PublishInfo().withPushStream(pushStream));
return createStream(request);
} | java | public CreateStreamResponse createStream(String playDomain, String app, String pushStream) {
CreateStreamRequest request = new CreateStreamRequest();
request.withPlayDomain(playDomain)
.withApp(app)
.withPublish(new CreateStreamRequest.PublishInfo().withPushStream(pushStream));
return createStream(request);
} | [
"public",
"CreateStreamResponse",
"createStream",
"(",
"String",
"playDomain",
",",
"String",
"app",
",",
"String",
"pushStream",
")",
"{",
"CreateStreamRequest",
"request",
"=",
"new",
"CreateStreamRequest",
"(",
")",
";",
"request",
".",
"withPlayDomain",
"(",
"... | Create a domain stream in the live stream service.
@param playDomain The domain which this stream belongs to
@param app The app which this stream belongs to, may not exist when create stream
@param pushStream, name of this stream
@return the response | [
"Create",
"a",
"domain",
"stream",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1379-L1385 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getMessageStatistic | public MessageStatListResult getMessageStatistic(String timeUnit, String start, int duration)
throws APIConnectionException, APIRequestException {
return _reportClient.getMessageStatistic(timeUnit, start, duration);
} | java | public MessageStatListResult getMessageStatistic(String timeUnit, String start, int duration)
throws APIConnectionException, APIRequestException {
return _reportClient.getMessageStatistic(timeUnit, start, duration);
} | [
"public",
"MessageStatListResult",
"getMessageStatistic",
"(",
"String",
"timeUnit",
",",
"String",
"start",
",",
"int",
"duration",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_reportClient",
".",
"getMessageStatistic",
"(",
"ti... | Get message statistic. Detail instructions please refer to https://docs.jiguang.cn/jmessage/server/rest_api_im_report_v2/#_6
@param timeUnit MUST be one of HOUR, DAY, MONTH
@param start start time, when timeUnit is HOUR, format: yyyy-MM-dd HH,
@param duration depends on timeUnit, the duration has limit
@return {@link MessageStatListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"message",
"statistic",
".",
"Detail",
"instructions",
"please",
"refer",
"to",
"https",
":",
"//",
"docs",
".",
"jiguang",
".",
"cn",
"/",
"jmessage",
"/",
"server",
"/",
"rest_api_im_report_v2",
"/",
"#_6"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L1010-L1013 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.loadSymbolMultimap | @Deprecated
public static ImmutableMultimap<Symbol, Symbol> loadSymbolMultimap(File multimapFile)
throws IOException {
return loadSymbolMultimap(Files.asCharSource(multimapFile, Charsets.UTF_8));
} | java | @Deprecated
public static ImmutableMultimap<Symbol, Symbol> loadSymbolMultimap(File multimapFile)
throws IOException {
return loadSymbolMultimap(Files.asCharSource(multimapFile, Charsets.UTF_8));
} | [
"@",
"Deprecated",
"public",
"static",
"ImmutableMultimap",
"<",
"Symbol",
",",
"Symbol",
">",
"loadSymbolMultimap",
"(",
"File",
"multimapFile",
")",
"throws",
"IOException",
"{",
"return",
"loadSymbolMultimap",
"(",
"Files",
".",
"asCharSource",
"(",
"multimapFile... | Deprecated in favor of the CharSource version to force the user to define their encoding. If
you call this, it will use UTF_8 encoding.
@deprecated | [
"Deprecated",
"in",
"favor",
"of",
"the",
"CharSource",
"version",
"to",
"force",
"the",
"user",
"to",
"define",
"their",
"encoding",
".",
"If",
"you",
"call",
"this",
"it",
"will",
"use",
"UTF_8",
"encoding",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L1169-L1173 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java | SVGAndroidRenderer.render | private void render(SVG.Svg obj, Box viewPort)
{
render(obj, viewPort, obj.viewBox, obj.preserveAspectRatio);
} | java | private void render(SVG.Svg obj, Box viewPort)
{
render(obj, viewPort, obj.viewBox, obj.preserveAspectRatio);
} | [
"private",
"void",
"render",
"(",
"SVG",
".",
"Svg",
"obj",
",",
"Box",
"viewPort",
")",
"{",
"render",
"(",
"obj",
",",
"viewPort",
",",
"obj",
".",
"viewBox",
",",
"obj",
".",
"preserveAspectRatio",
")",
";",
"}"
] | When referenced by a <use> element, it's width and height take precedence over the ones in the <svg> object. | [
"When",
"referenced",
"by",
"a",
"<use",
">",
"element",
"it",
"s",
"width",
"and",
"height",
"take",
"precedence",
"over",
"the",
"ones",
"in",
"the",
"<svg",
">",
"object",
"."
] | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java#L575-L578 |
Erudika/para | para-server/src/main/java/com/erudika/para/rest/RestUtils.java | RestUtils.getBatchDeleteResponse | public static Response getBatchDeleteResponse(App app, List<String> ids) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "batch", "delete")) {
LinkedList<ParaObject> objects = new LinkedList<>();
if (app != null && ids != null && !ids.isEmpty()) {
if (ids.size() <= Config.MAX_ITEMS_PER_PAGE) {
for (ParaObject pobj : Para.getDAO().readAll(app.getAppIdentifier(), ids, true).values()) {
if (pobj != null && pobj.getId() != null && pobj.getType() != null) {
// deleting apps in batch is not allowed
if (isNotAnApp(pobj.getType()) && checkIfUserCanModifyObject(app, pobj)) {
objects.add(pobj);
}
}
}
Para.getDAO().deleteAll(app.getAppIdentifier(), objects);
} else {
return getStatusResponse(Response.Status.BAD_REQUEST,
"Limit reached. Maximum number of items to delete is " + Config.MAX_ITEMS_PER_PAGE);
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Missing ids.");
}
return Response.ok().build();
}
} | java | public static Response getBatchDeleteResponse(App app, List<String> ids) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "batch", "delete")) {
LinkedList<ParaObject> objects = new LinkedList<>();
if (app != null && ids != null && !ids.isEmpty()) {
if (ids.size() <= Config.MAX_ITEMS_PER_PAGE) {
for (ParaObject pobj : Para.getDAO().readAll(app.getAppIdentifier(), ids, true).values()) {
if (pobj != null && pobj.getId() != null && pobj.getType() != null) {
// deleting apps in batch is not allowed
if (isNotAnApp(pobj.getType()) && checkIfUserCanModifyObject(app, pobj)) {
objects.add(pobj);
}
}
}
Para.getDAO().deleteAll(app.getAppIdentifier(), objects);
} else {
return getStatusResponse(Response.Status.BAD_REQUEST,
"Limit reached. Maximum number of items to delete is " + Config.MAX_ITEMS_PER_PAGE);
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Missing ids.");
}
return Response.ok().build();
}
} | [
"public",
"static",
"Response",
"getBatchDeleteResponse",
"(",
"App",
"app",
",",
"List",
"<",
"String",
">",
"ids",
")",
"{",
"try",
"(",
"final",
"Metrics",
".",
"Context",
"context",
"=",
"Metrics",
".",
"time",
"(",
"app",
"==",
"null",
"?",
"null",
... | Batch delete response as JSON.
@param app the current App object
@param ids list of ids to delete
@return a status code 200 or 400 | [
"Batch",
"delete",
"response",
"as",
"JSON",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L591-L615 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java | DynamoDBMapper.marshallIntoObject | public <T> T marshallIntoObject(Class<T> clazz, Map<String, AttributeValue> itemAttributes) {
T toReturn = null;
try {
toReturn = clazz.newInstance();
} catch ( InstantiationException e ) {
throw new DynamoDBMappingException("Failed to instantiate new instance of class", e);
} catch ( IllegalAccessException e ) {
throw new DynamoDBMappingException("Failed to instantiate new instance of class", e);
}
if ( itemAttributes == null || itemAttributes.isEmpty() )
return toReturn;
itemAttributes = untransformAttributes(clazz, itemAttributes);
for ( Method m : reflector.getRelevantGetters(clazz) ) {
String attributeName = reflector.getAttributeName(m);
if ( itemAttributes.containsKey(attributeName) ) {
setValue(toReturn, m, itemAttributes.get(attributeName));
}
}
return toReturn;
} | java | public <T> T marshallIntoObject(Class<T> clazz, Map<String, AttributeValue> itemAttributes) {
T toReturn = null;
try {
toReturn = clazz.newInstance();
} catch ( InstantiationException e ) {
throw new DynamoDBMappingException("Failed to instantiate new instance of class", e);
} catch ( IllegalAccessException e ) {
throw new DynamoDBMappingException("Failed to instantiate new instance of class", e);
}
if ( itemAttributes == null || itemAttributes.isEmpty() )
return toReturn;
itemAttributes = untransformAttributes(clazz, itemAttributes);
for ( Method m : reflector.getRelevantGetters(clazz) ) {
String attributeName = reflector.getAttributeName(m);
if ( itemAttributes.containsKey(attributeName) ) {
setValue(toReturn, m, itemAttributes.get(attributeName));
}
}
return toReturn;
} | [
"public",
"<",
"T",
">",
"T",
"marshallIntoObject",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"itemAttributes",
")",
"{",
"T",
"toReturn",
"=",
"null",
";",
"try",
"{",
"toReturn",
"=",
"clazz",
".",
... | Creates and fills in the attributes on an instance of the class given
with the attributes given.
<p>
This is accomplished by looking for getter methods annotated with an
appropriate annotation, then looking for matching attribute names in the
item attribute map.
@param clazz
The class to instantiate and hydrate
@param itemAttributes
The set of item attributes, keyed by attribute name. | [
"Creates",
"and",
"fills",
"in",
"the",
"attributes",
"on",
"an",
"instance",
"of",
"the",
"class",
"given",
"with",
"the",
"attributes",
"given",
".",
"<p",
">",
"This",
"is",
"accomplished",
"by",
"looking",
"for",
"getter",
"methods",
"annotated",
"with",... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L298-L321 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java | GeoJsonToAssembler.fromTransferObject | public MultiPoint fromTransferObject(MultiPointTo input, CrsId crsId) {
if (input == null) { return null; }
crsId = getCrsId(input, crsId);
isValid(input);
Point[] points = new Point[input.getCoordinates().length];
for (int i = 0; i < points.length; i++) {
points[i] = createPoint(input.getCoordinates()[i], crsId);
}
return new MultiPoint(points);
} | java | public MultiPoint fromTransferObject(MultiPointTo input, CrsId crsId) {
if (input == null) { return null; }
crsId = getCrsId(input, crsId);
isValid(input);
Point[] points = new Point[input.getCoordinates().length];
for (int i = 0; i < points.length; i++) {
points[i] = createPoint(input.getCoordinates()[i], crsId);
}
return new MultiPoint(points);
} | [
"public",
"MultiPoint",
"fromTransferObject",
"(",
"MultiPointTo",
"input",
",",
"CrsId",
"crsId",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"crsId",
"=",
"getCrsId",
"(",
"input",
",",
"crsId",
")",
";",
"isValid"... | Creates a multipoint object starting from a transfer object.
@param input the multipoint transfer object
@param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input.
@return the corresponding geometry
@throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object | [
"Creates",
"a",
"multipoint",
"object",
"starting",
"from",
"a",
"transfer",
"object",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L396-L407 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.rebuildInstance | public void rebuildInstance(String instanceId, String imageId, String adminPass) throws BceClientException {
this.rebuildInstance(new RebuildInstanceRequest().withInstanceId(instanceId)
.withImageId(imageId).withAdminPass(adminPass));
} | java | public void rebuildInstance(String instanceId, String imageId, String adminPass) throws BceClientException {
this.rebuildInstance(new RebuildInstanceRequest().withInstanceId(instanceId)
.withImageId(imageId).withAdminPass(adminPass));
} | [
"public",
"void",
"rebuildInstance",
"(",
"String",
"instanceId",
",",
"String",
"imageId",
",",
"String",
"adminPass",
")",
"throws",
"BceClientException",
"{",
"this",
".",
"rebuildInstance",
"(",
"new",
"RebuildInstanceRequest",
"(",
")",
".",
"withInstanceId",
... | Rebuilding the instance owned by the user.
After rebuilding the instance,
all of snapshots created from original instance system disk will be deleted,
all of customized images will be saved for using in the future.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param instanceId The id of the instance.
@param imageId The id of the image which is used to rebuild the instance.
@param adminPass The admin password to login the instance.
The admin password will be encrypted in AES-128 algorithm
with the substring of the former 16 characters of user SecretKey.
See more detail on
<a href = "https://bce.baidu.com/doc/BCC/API.html#.7A.E6.31.D8.94.C1.A1.C2.1A.8D.92.ED.7F.60.7D.AF">
BCE API doc</a>
@throws BceClientException | [
"Rebuilding",
"the",
"instance",
"owned",
"by",
"the",
"user",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L597-L600 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.getScaleFactor | private static int getScaleFactor(ImageMetadata metadata, int maxPixels) {
int scale = 1;
int scaledW = metadata.getW();
int scaledH = metadata.getH();
while (scaledW * scaledH > maxPixels) {
scale *= 2;
scaledH /= 2;
scaledW /= 2;
}
return scale;
} | java | private static int getScaleFactor(ImageMetadata metadata, int maxPixels) {
int scale = 1;
int scaledW = metadata.getW();
int scaledH = metadata.getH();
while (scaledW * scaledH > maxPixels) {
scale *= 2;
scaledH /= 2;
scaledW /= 2;
}
return scale;
} | [
"private",
"static",
"int",
"getScaleFactor",
"(",
"ImageMetadata",
"metadata",
",",
"int",
"maxPixels",
")",
"{",
"int",
"scale",
"=",
"1",
";",
"int",
"scaledW",
"=",
"metadata",
".",
"getW",
"(",
")",
";",
"int",
"scaledH",
"=",
"metadata",
".",
"getH... | Calculating scale factor with limit of pixel amount
@param metadata image metadata
@param maxPixels limit for pixels
@return scale factor | [
"Calculating",
"scale",
"factor",
"with",
"limit",
"of",
"pixel",
"amount"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L535-L545 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListUserSegmentEntryRelPersistenceImpl.java | CommercePriceListUserSegmentEntryRelPersistenceImpl.findAll | @Override
public List<CommercePriceListUserSegmentEntryRel> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommercePriceListUserSegmentEntryRel> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceListUserSegmentEntryRel",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce price list user segment entry rels.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceListUserSegmentEntryRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce price list user segment entry rels
@param end the upper bound of the range of commerce price list user segment entry rels (not inclusive)
@return the range of commerce price list user segment entry rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"price",
"list",
"user",
"segment",
"entry",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListUserSegmentEntryRelPersistenceImpl.java#L3005-L3008 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java | WebSocketServerHandshaker00.close | @Override
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
return channel.writeAndFlush(frame, promise);
} | java | @Override
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
return channel.writeAndFlush(frame, promise);
} | [
"@",
"Override",
"public",
"ChannelFuture",
"close",
"(",
"Channel",
"channel",
",",
"CloseWebSocketFrame",
"frame",
",",
"ChannelPromise",
"promise",
")",
"{",
"return",
"channel",
".",
"writeAndFlush",
"(",
"frame",
",",
"promise",
")",
";",
"}"
] | Echo back the closing frame
@param channel
Channel
@param frame
Web Socket frame that was received | [
"Echo",
"back",
"the",
"closing",
"frame"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java#L185-L188 |
casmi/casmi | src/main/java/casmi/graphics/element/Lines.java | Lines.setEndCornerColor | public void setEndCornerColor(Color color) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
} | java | public void setEndCornerColor(Color color) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
} | [
"public",
"void",
"setEndCornerColor",
"(",
"Color",
"color",
")",
"{",
"if",
"(",
"endColor",
"==",
"null",
")",
"{",
"endColor",
"=",
"new",
"RGBColor",
"(",
"0.0",
",",
"0.0",
",",
"0.0",
")",
";",
"}",
"setGradation",
"(",
"true",
")",
";",
"this... | Sets the end point's color for gradation.
@param color The color of the end point. | [
"Sets",
"the",
"end",
"point",
"s",
"color",
"for",
"gradation",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Lines.java#L286-L292 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/DateTimeFormatterCache.java | DateTimeFormatterCache.getDateTimeFormatterStrict | @Nonnull
public static DateTimeFormatter getDateTimeFormatterStrict (@Nonnull @Nonempty final String sPattern)
{
return getDateTimeFormatter (sPattern, ResolverStyle.STRICT);
} | java | @Nonnull
public static DateTimeFormatter getDateTimeFormatterStrict (@Nonnull @Nonempty final String sPattern)
{
return getDateTimeFormatter (sPattern, ResolverStyle.STRICT);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getDateTimeFormatterStrict",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sPattern",
")",
"{",
"return",
"getDateTimeFormatter",
"(",
"sPattern",
",",
"ResolverStyle",
".",
"STRICT",
")",
";",
... | Get the cached DateTimeFormatter using STRICT resolving.
@param sPattern
The pattern to retrieve. May neither be <code>null</code> nor empty.
@return The compiled DateTimeFormatter and never <code>null</code> .
@throws IllegalArgumentException
If the pattern is invalid | [
"Get",
"the",
"cached",
"DateTimeFormatter",
"using",
"STRICT",
"resolving",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/DateTimeFormatterCache.java#L76-L80 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodePort | public static String encodePort(String port, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(port, encoding, HierarchicalUriComponents.Type.PORT);
} | java | public static String encodePort(String port, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(port, encoding, HierarchicalUriComponents.Type.PORT);
} | [
"public",
"static",
"String",
"encodePort",
"(",
"String",
"port",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"port",
",",
"encoding",
",",
"HierarchicalUriCompone... | Encodes the given URI port with the given encoding.
@param port the port to be encoded
@param encoding the character encoding to encode to
@return the encoded port
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"port",
"with",
"the",
"given",
"encoding",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L263-L265 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java | MongoDS.createCredentail | private MongoCredential createCredentail(String group) {
final Setting setting = this.setting;
if(null == setting) {
return null;
}
final String user = setting.getStr("user", group, setting.getStr("user"));
final String pass = setting.getStr("pass", group, setting.getStr("pass"));
final String database = setting.getStr("database", group, setting.getStr("database"));
return createCredentail(user, database, pass);
} | java | private MongoCredential createCredentail(String group) {
final Setting setting = this.setting;
if(null == setting) {
return null;
}
final String user = setting.getStr("user", group, setting.getStr("user"));
final String pass = setting.getStr("pass", group, setting.getStr("pass"));
final String database = setting.getStr("database", group, setting.getStr("database"));
return createCredentail(user, database, pass);
} | [
"private",
"MongoCredential",
"createCredentail",
"(",
"String",
"group",
")",
"{",
"final",
"Setting",
"setting",
"=",
"this",
".",
"setting",
";",
"if",
"(",
"null",
"==",
"setting",
")",
"{",
"return",
"null",
";",
"}",
"final",
"String",
"user",
"=",
... | 创建{@link MongoCredential},用于服务端验证<br>
此方法会首先读取指定分组下的属性,用户没有定义则读取空分组下的属性
@param group 分组
@return {@link MongoCredential},如果用户未指定用户名密码返回null
@since 4.1.20 | [
"创建",
"{",
"@link",
"MongoCredential",
"}",
",用于服务端验证<br",
">",
"此方法会首先读取指定分组下的属性,用户没有定义则读取空分组下的属性"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L295-L304 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.deleteVirtualNetworkFunctionRecord | @Help(help = "Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public void deleteVirtualNetworkFunctionRecord(final String id, final String idVnfr)
throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
requestDelete(url);
} | java | @Help(help = "Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id")
public void deleteVirtualNetworkFunctionRecord(final String id, final String idVnfr)
throws SDKException {
String url = id + "/vnfrecords" + "/" + idVnfr;
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Delete the VirtualNetworkFunctionRecord of NetworkServiceRecord with specific id\"",
")",
"public",
"void",
"deleteVirtualNetworkFunctionRecord",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"idVnfr",
")",
"throws",
"SDKException",
... | Deletes a specific VirtualNetworkFunctionRecord.
@param id the ID of the NetworkServiceRecord containing the VirtualNetworkFunctionRecord
@param idVnfr the ID of the VirtualNetworkFunctionRecord to delete
@throws SDKException if the request fails | [
"Deletes",
"a",
"specific",
"VirtualNetworkFunctionRecord",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L166-L171 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java | ParameterChecker.buildMessage | private static String buildMessage(String parameterName, String methodName) {
ResourceBundle rb = ResourceBundle.getBundle("org.apache.beehive.controls.system.jdbc.parser.strings", Locale.getDefault() );
String pattern = rb.getString("jdbccontrol.invalid.param");
return MessageFormat.format(pattern, parameterName, methodName);
} | java | private static String buildMessage(String parameterName, String methodName) {
ResourceBundle rb = ResourceBundle.getBundle("org.apache.beehive.controls.system.jdbc.parser.strings", Locale.getDefault() );
String pattern = rb.getString("jdbccontrol.invalid.param");
return MessageFormat.format(pattern, parameterName, methodName);
} | [
"private",
"static",
"String",
"buildMessage",
"(",
"String",
"parameterName",
",",
"String",
"methodName",
")",
"{",
"ResourceBundle",
"rb",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"\"org.apache.beehive.controls.system.jdbc.parser.strings\"",
",",
"Locale",
".",
... | Build the error message for this module.
@param parameterName
@param methodName
@return The generated messge. | [
"Build",
"the",
"error",
"message",
"for",
"this",
"module",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java#L190-L195 |
Azure/azure-sdk-for-java | datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdateAsync | public Observable<FirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | java | public Observable<FirewallRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String firewallRuleName, CreateOrUpdateFirewallRuleParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FirewallRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"firewallRuleName",
",",
"CreateOrUpdateFirewallRuleParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateW... | Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this new firewall rule.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Store account.
@param firewallRuleName The name of the firewall rule to create or update.
@param parameters Parameters supplied to create or update the firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FirewallRuleInner object | [
"Creates",
"or",
"updates",
"the",
"specified",
"firewall",
"rule",
".",
"During",
"update",
"the",
"firewall",
"rule",
"with",
"the",
"specified",
"name",
"will",
"be",
"replaced",
"with",
"this",
"new",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/FirewallRulesInner.java#L257-L264 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/UsersApi.java | UsersApi.getUserProperties | public PropertiesEnvelope getUserProperties(String userId, String aid) throws ApiException {
ApiResponse<PropertiesEnvelope> resp = getUserPropertiesWithHttpInfo(userId, aid);
return resp.getData();
} | java | public PropertiesEnvelope getUserProperties(String userId, String aid) throws ApiException {
ApiResponse<PropertiesEnvelope> resp = getUserPropertiesWithHttpInfo(userId, aid);
return resp.getData();
} | [
"public",
"PropertiesEnvelope",
"getUserProperties",
"(",
"String",
"userId",
",",
"String",
"aid",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"PropertiesEnvelope",
">",
"resp",
"=",
"getUserPropertiesWithHttpInfo",
"(",
"userId",
",",
"aid",
")",
";",
... | Get User application properties
Get application properties of a user
@param userId User Id (required)
@param aid Application ID (optional)
@return PropertiesEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"User",
"application",
"properties",
"Get",
"application",
"properties",
"of",
"a",
"user"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L782-L785 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java | JobOperatorImpl.publishEvent | private void publishEvent(WSJobInstance jobInst, String topicToPublish, String correlationId) {
if (eventsPublisher != null) {
eventsPublisher.publishJobInstanceEvent(jobInst, topicToPublish, correlationId);
}
} | java | private void publishEvent(WSJobInstance jobInst, String topicToPublish, String correlationId) {
if (eventsPublisher != null) {
eventsPublisher.publishJobInstanceEvent(jobInst, topicToPublish, correlationId);
}
} | [
"private",
"void",
"publishEvent",
"(",
"WSJobInstance",
"jobInst",
",",
"String",
"topicToPublish",
",",
"String",
"correlationId",
")",
"{",
"if",
"(",
"eventsPublisher",
"!=",
"null",
")",
"{",
"eventsPublisher",
".",
"publishJobInstanceEvent",
"(",
"jobInst",
... | Helper method to publish event with correlationId
@param jobInstance
@param topicToPublish
@param correlationId | [
"Helper",
"method",
"to",
"publish",
"event",
"with",
"correlationId"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L382-L386 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/file/HttpFileService.java | HttpFileService.orElse | public HttpService orElse(Service<HttpRequest, HttpResponse> nextService) {
requireNonNull(nextService, "nextService");
return new OrElseHttpService(this, nextService);
} | java | public HttpService orElse(Service<HttpRequest, HttpResponse> nextService) {
requireNonNull(nextService, "nextService");
return new OrElseHttpService(this, nextService);
} | [
"public",
"HttpService",
"orElse",
"(",
"Service",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
"nextService",
")",
"{",
"requireNonNull",
"(",
"nextService",
",",
"\"nextService\"",
")",
";",
"return",
"new",
"OrElseHttpService",
"(",
"this",
",",
"nextService",... | Creates a new {@link HttpService} that tries this {@link HttpFileService} first and then the specified
{@link HttpService} when this {@link HttpFileService} does not have a requested resource.
@param nextService the {@link HttpService} to try secondly | [
"Creates",
"a",
"new",
"{",
"@link",
"HttpService",
"}",
"that",
"tries",
"this",
"{",
"@link",
"HttpFileService",
"}",
"first",
"and",
"then",
"the",
"specified",
"{",
"@link",
"HttpService",
"}",
"when",
"this",
"{",
"@link",
"HttpFileService",
"}",
"does"... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileService.java#L306-L309 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ProvideDescriptionToCheck.java | ProvideDescriptionToCheck.findThatCall | static MethodInvocationTree findThatCall(VisitorState state) {
TreePath path = state.getPath();
/*
* Each iteration walks 1 method call up the tree, but it's actually 2 steps in the tree because
* there's a MethodSelectTree between each pair of MethodInvocationTrees.
*/
while (true) {
path = path.getParentPath().getParentPath();
Tree leaf = path.getLeaf();
if (leaf.getKind() != METHOD_INVOCATION) {
return null;
}
MethodInvocationTree maybeThatCall = (MethodInvocationTree) leaf;
if (WITH_MESSAGE_OR_ABOUT.matches(maybeThatCall, state)) {
continue;
} else if (SUBJECT_BUILDER_THAT.matches(maybeThatCall, state)) {
return maybeThatCall;
} else {
return null;
}
}
} | java | static MethodInvocationTree findThatCall(VisitorState state) {
TreePath path = state.getPath();
/*
* Each iteration walks 1 method call up the tree, but it's actually 2 steps in the tree because
* there's a MethodSelectTree between each pair of MethodInvocationTrees.
*/
while (true) {
path = path.getParentPath().getParentPath();
Tree leaf = path.getLeaf();
if (leaf.getKind() != METHOD_INVOCATION) {
return null;
}
MethodInvocationTree maybeThatCall = (MethodInvocationTree) leaf;
if (WITH_MESSAGE_OR_ABOUT.matches(maybeThatCall, state)) {
continue;
} else if (SUBJECT_BUILDER_THAT.matches(maybeThatCall, state)) {
return maybeThatCall;
} else {
return null;
}
}
} | [
"static",
"MethodInvocationTree",
"findThatCall",
"(",
"VisitorState",
"state",
")",
"{",
"TreePath",
"path",
"=",
"state",
".",
"getPath",
"(",
")",
";",
"/*\n * Each iteration walks 1 method call up the tree, but it's actually 2 steps in the tree because\n * there's a Met... | Starting from a {@code VisitorState} pointing at part of a fluent assertion statement (like
{@code check()} or {@code assertWithMessage()}, walks up the tree and returns the subsequent
call to {@code that(...)}.
<p>Often, the call is made directly on the result of the given tree -- like when the input is
{@code check()}, which is part of the expression {@code check().that(...)}. But sometimes there
is an intervening call to {@code withMessage}, {@code about}, or both. | [
"Starting",
"from",
"a",
"{",
"@code",
"VisitorState",
"}",
"pointing",
"at",
"part",
"of",
"a",
"fluent",
"assertion",
"statement",
"(",
"like",
"{",
"@code",
"check",
"()",
"}",
"or",
"{",
"@code",
"assertWithMessage",
"()",
"}",
"walks",
"up",
"the",
... | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ProvideDescriptionToCheck.java#L93-L114 |
hageldave/ImagingKit | ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java | Pixel.rgb_fromNormalized | public static final int rgb_fromNormalized(final double r, final double g, final double b){
return rgb_bounded((int)Math.round(r*0xff), (int)Math.round(g*0xff), (int)Math.round(b*0xff));
} | java | public static final int rgb_fromNormalized(final double r, final double g, final double b){
return rgb_bounded((int)Math.round(r*0xff), (int)Math.round(g*0xff), (int)Math.round(b*0xff));
} | [
"public",
"static",
"final",
"int",
"rgb_fromNormalized",
"(",
"final",
"double",
"r",
",",
"final",
"double",
"g",
",",
"final",
"double",
"b",
")",
"{",
"return",
"rgb_bounded",
"(",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"r",
"*",
"0xff",
")",
... | Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a
single 32bit integer value with alpha=255 (opaque).
Component values less than 0 or greater than 1 clamped to fit the range.
@param r red
@param g green
@param b blue
@return packed ARGB value
@see #argb_fromNormalized(double, double, double, double)
@see #rgb(int, int, int)
@see #a_normalized(int)
@see #r_normalized(int)
@see #g_normalized(int)
@see #b_normalized(int)
@since 1.2 | [
"Packs",
"normalized",
"ARGB",
"color",
"components",
"(",
"values",
"in",
"[",
"0",
".",
"0",
"..",
"1",
".",
"0",
"]",
")",
"into",
"a",
"single",
"32bit",
"integer",
"value",
"with",
"alpha",
"=",
"255",
"(",
"opaque",
")",
".",
"Component",
"valu... | train | https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L693-L695 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java | CsvBeanReader.populateBean | private <T> T populateBean(final T resultBean, final String[] nameMapping) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( nameMapping[i] == null || fieldValue == null ) {
continue;
}
// invoke the setter on the bean
Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass());
invokeSetter(resultBean, setMethod, fieldValue);
}
return resultBean;
} | java | private <T> T populateBean(final T resultBean, final String[] nameMapping) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( nameMapping[i] == null || fieldValue == null ) {
continue;
}
// invoke the setter on the bean
Method setMethod = cache.getSetMethod(resultBean, nameMapping[i], fieldValue.getClass());
invokeSetter(resultBean, setMethod, fieldValue);
}
return resultBean;
} | [
"private",
"<",
"T",
">",
"T",
"populateBean",
"(",
"final",
"T",
"resultBean",
",",
"final",
"String",
"[",
"]",
"nameMapping",
")",
"{",
"// map each column to its associated field on the bean",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameMapping",... | Populates the bean by mapping the processed columns to the fields of the bean.
@param resultBean
the bean to populate
@param nameMapping
the name mappings
@return the populated bean
@throws SuperCsvReflectionException
if there was a reflection exception while populating the bean | [
"Populates",
"the",
"bean",
"by",
"mapping",
"the",
"processed",
"columns",
"to",
"the",
"fields",
"of",
"the",
"bean",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/CsvBeanReader.java#L154-L173 |
roboconf/roboconf-platform | miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/TextUtils.java | TextUtils.fixSelectionOffset | static int fixSelectionOffset( String fullText, int selectionOffset ) {
if( selectionOffset < 0 || selectionOffset >= fullText.length())
selectionOffset = 0;
// Get the full line
int lineBreakIndex = selectionOffset - 1;
for( ; lineBreakIndex >= 0; lineBreakIndex -- ) {
char c = fullText.charAt( lineBreakIndex );
if( isLineBreak( c )) {
lineBreakIndex ++;
break;
}
}
return lineBreakIndex < 0 ? 0 : lineBreakIndex;
} | java | static int fixSelectionOffset( String fullText, int selectionOffset ) {
if( selectionOffset < 0 || selectionOffset >= fullText.length())
selectionOffset = 0;
// Get the full line
int lineBreakIndex = selectionOffset - 1;
for( ; lineBreakIndex >= 0; lineBreakIndex -- ) {
char c = fullText.charAt( lineBreakIndex );
if( isLineBreak( c )) {
lineBreakIndex ++;
break;
}
}
return lineBreakIndex < 0 ? 0 : lineBreakIndex;
} | [
"static",
"int",
"fixSelectionOffset",
"(",
"String",
"fullText",
",",
"int",
"selectionOffset",
")",
"{",
"if",
"(",
"selectionOffset",
"<",
"0",
"||",
"selectionOffset",
">=",
"fullText",
".",
"length",
"(",
")",
")",
"selectionOffset",
"=",
"0",
";",
"// ... | Fixes the selection offset to get the whole line.
<p>
Invalid values result in zero.
</p>
@param fullText the full text (not null)
@param selectionOffset the selection offset
@return a valid selection offset, set to the beginning of the last line or of the text | [
"Fixes",
"the",
"selection",
"offset",
"to",
"get",
"the",
"whole",
"line",
".",
"<p",
">",
"Invalid",
"values",
"result",
"in",
"zero",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/TextUtils.java#L97-L113 |
l0s/fernet-java8 | fernet-java8/src/main/java/com/macasaet/fernet/Token.java | Token.validateAndDecrypt | @SuppressWarnings("PMD.LawOfDemeter")
public <T> T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator) {
return validator.validateAndDecrypt(keys, this);
} | java | @SuppressWarnings("PMD.LawOfDemeter")
public <T> T validateAndDecrypt(final Collection<? extends Key> keys, final Validator<T> validator) {
return validator.validateAndDecrypt(keys, this);
} | [
"@",
"SuppressWarnings",
"(",
"\"PMD.LawOfDemeter\"",
")",
"public",
"<",
"T",
">",
"T",
"validateAndDecrypt",
"(",
"final",
"Collection",
"<",
"?",
"extends",
"Key",
">",
"keys",
",",
"final",
"Validator",
"<",
"T",
">",
"validator",
")",
"{",
"return",
"... | Check the validity of this token against a collection of keys. Use this if you have implemented key rotation.
@param keys the active keys which may have been used to generate token
@param validator an object that encapsulates the validation parameters (e.g. TTL)
@return the decrypted, deserialised payload of this token
@throws TokenValidationException if none of the keys were used to generate this token | [
"Check",
"the",
"validity",
"of",
"this",
"token",
"against",
"a",
"collection",
"of",
"keys",
".",
"Use",
"this",
"if",
"you",
"have",
"implemented",
"key",
"rotation",
"."
] | train | https://github.com/l0s/fernet-java8/blob/427244bc1af605ffca0ac2469d66b297ea9f77b3/fernet-java8/src/main/java/com/macasaet/fernet/Token.java#L205-L208 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java | ScpClient.put | public void put(String[] localFiles, String remoteFile, boolean recursive)
throws SshException, ChannelOpenException {
put(localFiles, remoteFile, recursive, null);
} | java | public void put(String[] localFiles, String remoteFile, boolean recursive)
throws SshException, ChannelOpenException {
put(localFiles, remoteFile, recursive, null);
} | [
"public",
"void",
"put",
"(",
"String",
"[",
"]",
"localFiles",
",",
"String",
"remoteFile",
",",
"boolean",
"recursive",
")",
"throws",
"SshException",
",",
"ChannelOpenException",
"{",
"put",
"(",
"localFiles",
",",
"remoteFile",
",",
"recursive",
",",
"null... | <p>
Uploads an array of local files onto the remote server.
</p>
@param localFiles
an array of local files; may be files or directories
@param remoteFile
the path on the remote server, may be a file or directory.
@param recursive
Copy the contents of directorys recursivly
@throws IOException
if an IO error occurs during the operation | [
"<p",
">",
"Uploads",
"an",
"array",
"of",
"local",
"files",
"onto",
"the",
"remote",
"server",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/scp/ScpClient.java#L281-L284 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java | ProxyFilter.sessionIdle | @Override
public void sessionIdle(NextFilter nextFilter, IoSession session,
IdleStatus status) throws Exception {
ProxyIoSession proxyIoSession = (ProxyIoSession) session
.getAttribute(ProxyIoSession.PROXY_SESSION);
proxyIoSession.getEventQueue().enqueueEventIfNecessary(
new IoSessionEvent(nextFilter, session, status));
} | java | @Override
public void sessionIdle(NextFilter nextFilter, IoSession session,
IdleStatus status) throws Exception {
ProxyIoSession proxyIoSession = (ProxyIoSession) session
.getAttribute(ProxyIoSession.PROXY_SESSION);
proxyIoSession.getEventQueue().enqueueEventIfNecessary(
new IoSessionEvent(nextFilter, session, status));
} | [
"@",
"Override",
"public",
"void",
"sessionIdle",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
",",
"IdleStatus",
"status",
")",
"throws",
"Exception",
"{",
"ProxyIoSession",
"proxyIoSession",
"=",
"(",
"ProxyIoSession",
")",
"session",
".",
"getA... | Event is stored in an {@link IoSessionEventQueue} for later delivery to the next filter
in the chain when the handshake would have succeed. This will prevent the rest of
the filter chain from being affected by this filter internals.
@param nextFilter the next filter in filter chain
@param session the session object | [
"Event",
"is",
"stored",
"in",
"an",
"{",
"@link",
"IoSessionEventQueue",
"}",
"for",
"later",
"delivery",
"to",
"the",
"next",
"filter",
"in",
"the",
"chain",
"when",
"the",
"handshake",
"would",
"have",
"succeed",
".",
"This",
"will",
"prevent",
"the",
"... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L334-L341 |
stevespringett/Alpine | alpine/src/main/java/alpine/filters/ContentSecurityPolicyFilter.java | ContentSecurityPolicyFilter.getStringFromValue | private void getStringFromValue(final StringBuilder builder, final String directive, final String value) {
if (value != null) {
builder.append(directive).append(" ").append(value).append(";");
}
} | java | private void getStringFromValue(final StringBuilder builder, final String directive, final String value) {
if (value != null) {
builder.append(directive).append(" ").append(value).append(";");
}
} | [
"private",
"void",
"getStringFromValue",
"(",
"final",
"StringBuilder",
"builder",
",",
"final",
"String",
"directive",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"directive",
")",
... | Assists in the formatting of a single CSP directive.
@param builder a StringBuilder object
@param directive a CSP directive
@param value the value of the CSP directive | [
"Assists",
"in",
"the",
"formatting",
"of",
"a",
"single",
"CSP",
"directive",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/filters/ContentSecurityPolicyFilter.java#L213-L217 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java | CommonOps_DDF4.subtract | public static void subtract( DMatrix4 a , DMatrix4 b , DMatrix4 c ) {
c.a1 = a.a1 - b.a1;
c.a2 = a.a2 - b.a2;
c.a3 = a.a3 - b.a3;
c.a4 = a.a4 - b.a4;
} | java | public static void subtract( DMatrix4 a , DMatrix4 b , DMatrix4 c ) {
c.a1 = a.a1 - b.a1;
c.a2 = a.a2 - b.a2;
c.a3 = a.a3 - b.a3;
c.a4 = a.a4 - b.a4;
} | [
"public",
"static",
"void",
"subtract",
"(",
"DMatrix4",
"a",
",",
"DMatrix4",
"b",
",",
"DMatrix4",
"c",
")",
"{",
"c",
".",
"a1",
"=",
"a",
".",
"a1",
"-",
"b",
".",
"a1",
";",
"c",
".",
"a2",
"=",
"a",
".",
"a2",
"-",
"b",
".",
"a2",
";"... | <p>Performs the following operation:<br>
<br>
c = a - b <br>
c<sub>i</sub> = a<sub>i</sub> - b<sub>i</sub> <br>
</p>
<p>
Vector C can be the same instance as Vector A and/or B.
</p>
@param a A Vector. Not modified.
@param b A Vector. Not modified.
@param c A Vector where the results are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"-",
"b",
"<br",
">",
"c<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"-",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L183-L188 |
MenoData/Time4J | base/src/main/java/net/time4j/calendar/astro/SolarTime.java | SolarTime.ofLocation | public static SolarTime ofLocation(
double latitude,
double longitude,
int altitude,
Calculator calculator
) {
String name = calculator.name();
CALCULATORS.putIfAbsent(name, calculator);
check(latitude, longitude, altitude, name);
return new SolarTime(latitude, longitude, altitude, name, null);
} | java | public static SolarTime ofLocation(
double latitude,
double longitude,
int altitude,
Calculator calculator
) {
String name = calculator.name();
CALCULATORS.putIfAbsent(name, calculator);
check(latitude, longitude, altitude, name);
return new SolarTime(latitude, longitude, altitude, name, null);
} | [
"public",
"static",
"SolarTime",
"ofLocation",
"(",
"double",
"latitude",
",",
"double",
"longitude",
",",
"int",
"altitude",
",",
"Calculator",
"calculator",
")",
"{",
"String",
"name",
"=",
"calculator",
".",
"name",
"(",
")",
";",
"CALCULATORS",
".",
"put... | /*[deutsch]
<p>Liefert die Sonnenzeit zur angegebenen geographischen Position. </p>
<p>Diese Methode nimmt geographische Angaben nur in Dezimalgrad entgegen. Wenn diese Daten aber
in Grad, Bogenminuten und Bogensekunden vorliegen, sollten Anwender den {@link #ofLocation() Builder-Ansatz}
bevorzugen. </p>
@param latitude geographical latitude in decimal degrees ({@code -90.0 <= x <= +90.0})
@param longitude geographical longitude in decimal degrees ({@code -180.0 <= x < 180.0})
@param altitude geographical altitude relative to sea level in meters ({@code 0 <= x < 11,0000})
@param calculator instance of solar time calculator
@return instance of local solar time
@throws IllegalArgumentException if the coordinates are out of range
@since 3.36/4.31 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Liefert",
"die",
"Sonnenzeit",
"zur",
"angegebenen",
"geographischen",
"Position",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/SolarTime.java#L442-L454 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java | CalendarPanel.setSizeOfWeekNumberLabels | private void setSizeOfWeekNumberLabels() {
JLabel firstLabel = weekNumberLabels.get(0);
Font font = firstLabel.getFont();
FontMetrics fontMetrics = firstLabel.getFontMetrics(font);
int width = fontMetrics.stringWidth("53 ");
width += constantWeekNumberLabelInsets.left;
width += constantWeekNumberLabelInsets.right;
Dimension size = new Dimension(width, 1);
for (JLabel currentLabel : weekNumberLabels) {
currentLabel.setMinimumSize(size);
currentLabel.setPreferredSize(size);
}
topLeftLabel.setMinimumSize(size);
topLeftLabel.setPreferredSize(size);
} | java | private void setSizeOfWeekNumberLabels() {
JLabel firstLabel = weekNumberLabels.get(0);
Font font = firstLabel.getFont();
FontMetrics fontMetrics = firstLabel.getFontMetrics(font);
int width = fontMetrics.stringWidth("53 ");
width += constantWeekNumberLabelInsets.left;
width += constantWeekNumberLabelInsets.right;
Dimension size = new Dimension(width, 1);
for (JLabel currentLabel : weekNumberLabels) {
currentLabel.setMinimumSize(size);
currentLabel.setPreferredSize(size);
}
topLeftLabel.setMinimumSize(size);
topLeftLabel.setPreferredSize(size);
} | [
"private",
"void",
"setSizeOfWeekNumberLabels",
"(",
")",
"{",
"JLabel",
"firstLabel",
"=",
"weekNumberLabels",
".",
"get",
"(",
"0",
")",
";",
"Font",
"font",
"=",
"firstLabel",
".",
"getFont",
"(",
")",
";",
"FontMetrics",
"fontMetrics",
"=",
"firstLabel",
... | setSizeOfWeekNumberLabels, This sets the minimum and preferred size of the week number
labels, to be able to hold largest week number in the current week number label font.
Note: The week number labels need to be added to the panel before this method can be called. | [
"setSizeOfWeekNumberLabels",
"This",
"sets",
"the",
"minimum",
"and",
"preferred",
"size",
"of",
"the",
"week",
"number",
"labels",
"to",
"be",
"able",
"to",
"hold",
"largest",
"week",
"number",
"in",
"the",
"current",
"week",
"number",
"label",
"font",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java#L1178-L1192 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java | PacketCapturesInner.getStatusAsync | public Observable<PacketCaptureQueryStatusResultInner> getStatusAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).map(new Func1<ServiceResponse<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>() {
@Override
public PacketCaptureQueryStatusResultInner call(ServiceResponse<PacketCaptureQueryStatusResultInner> response) {
return response.body();
}
});
} | java | public Observable<PacketCaptureQueryStatusResultInner> getStatusAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) {
return getStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).map(new Func1<ServiceResponse<PacketCaptureQueryStatusResultInner>, PacketCaptureQueryStatusResultInner>() {
@Override
public PacketCaptureQueryStatusResultInner call(ServiceResponse<PacketCaptureQueryStatusResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PacketCaptureQueryStatusResultInner",
">",
"getStatusAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"packetCaptureName",
")",
"{",
"return",
"getStatusWithServiceResponseAsync",
"(",
"resourceGroup... | Query the status of a running packet capture session.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the Network Watcher resource.
@param packetCaptureName The name given to the packet capture session.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Query",
"the",
"status",
"of",
"a",
"running",
"packet",
"capture",
"session",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java#L744-L751 |
Alluxio/alluxio | integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java | SparkIntegrationChecker.printResultInfo | private void printResultInfo(Status resultStatus, PrintWriter reportWriter) {
switch (resultStatus) {
case FAIL_TO_FIND_CLASS:
reportWriter.println(FAIL_TO_FIND_CLASS_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
case FAIL_TO_FIND_FS:
reportWriter.println(FAIL_TO_FIND_FS_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
case FAIL_TO_SUPPORT_HA:
reportWriter.println(FAIL_TO_SUPPORT_HA_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
default:
reportWriter.println(TEST_PASSED_MESSAGE);
break;
}
} | java | private void printResultInfo(Status resultStatus, PrintWriter reportWriter) {
switch (resultStatus) {
case FAIL_TO_FIND_CLASS:
reportWriter.println(FAIL_TO_FIND_CLASS_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
case FAIL_TO_FIND_FS:
reportWriter.println(FAIL_TO_FIND_FS_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
case FAIL_TO_SUPPORT_HA:
reportWriter.println(FAIL_TO_SUPPORT_HA_MESSAGE);
reportWriter.println(TEST_FAILED_MESSAGE);
break;
default:
reportWriter.println(TEST_PASSED_MESSAGE);
break;
}
} | [
"private",
"void",
"printResultInfo",
"(",
"Status",
"resultStatus",
",",
"PrintWriter",
"reportWriter",
")",
"{",
"switch",
"(",
"resultStatus",
")",
"{",
"case",
"FAIL_TO_FIND_CLASS",
":",
"reportWriter",
".",
"println",
"(",
"FAIL_TO_FIND_CLASS_MESSAGE",
")",
";"... | Saves Spark with Alluixo integration checker results.
@param resultStatus Spark job result status
@param reportWriter save user-facing messages to a generated file | [
"Saves",
"Spark",
"with",
"Alluixo",
"integration",
"checker",
"results",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/checker/src/main/java/alluxio/checker/SparkIntegrationChecker.java#L169-L187 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/util/Util.java | Util.trimString | public static String trimString(String string, int maxMessageLength) {
if (string == null) {
return null;
} else if (string.length() > maxMessageLength) {
// CHECKSTYLE.OFF: MagicNumber
return string.substring(0, maxMessageLength - 3) + "...";
// CHECKSTYLE.ON: MagicNumber
} else {
return string;
}
} | java | public static String trimString(String string, int maxMessageLength) {
if (string == null) {
return null;
} else if (string.length() > maxMessageLength) {
// CHECKSTYLE.OFF: MagicNumber
return string.substring(0, maxMessageLength - 3) + "...";
// CHECKSTYLE.ON: MagicNumber
} else {
return string;
}
} | [
"public",
"static",
"String",
"trimString",
"(",
"String",
"string",
",",
"int",
"maxMessageLength",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"string",
".",
"length",
"(",
")",
">",
"maxMessa... | Trims a String, ensuring that the maximum length isn't reached.
@param string string to trim
@param maxMessageLength maximum length of the string
@return trimmed string | [
"Trims",
"a",
"String",
"ensuring",
"that",
"the",
"maximum",
"length",
"isn",
"t",
"reached",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/util/Util.java#L146-L156 |
CloudSlang/cs-actions | cs-ssh/src/main/java/io/cloudslang/content/ssh/utils/CacheUtils.java | CacheUtils.getFromCache | public static SSHService getFromCache(SessionResource<Map<String, SSHConnection>> sessionResource, String sessionId) {
Session savedSession = CacheUtils.getSshSession(sessionResource, sessionId);
if (savedSession != null && savedSession.isConnected()) {
Channel savedChannel = CacheUtils.getSshChannel(sessionResource, sessionId);
return new SSHServiceImpl(savedSession, savedChannel);
}
return null;
} | java | public static SSHService getFromCache(SessionResource<Map<String, SSHConnection>> sessionResource, String sessionId) {
Session savedSession = CacheUtils.getSshSession(sessionResource, sessionId);
if (savedSession != null && savedSession.isConnected()) {
Channel savedChannel = CacheUtils.getSshChannel(sessionResource, sessionId);
return new SSHServiceImpl(savedSession, savedChannel);
}
return null;
} | [
"public",
"static",
"SSHService",
"getFromCache",
"(",
"SessionResource",
"<",
"Map",
"<",
"String",
",",
"SSHConnection",
">",
">",
"sessionResource",
",",
"String",
"sessionId",
")",
"{",
"Session",
"savedSession",
"=",
"CacheUtils",
".",
"getSshSession",
"(",
... | Get an opened SSH session from cache (Operation Orchestration session).
@param sessionResource The session resource.
@return the SSH service | [
"Get",
"an",
"opened",
"SSH",
"session",
"from",
"cache",
"(",
"Operation",
"Orchestration",
"session",
")",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-ssh/src/main/java/io/cloudslang/content/ssh/utils/CacheUtils.java#L123-L131 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java | WidgetFactory.createWidget | public static Widget createWidget(final GVRSceneObject sceneObject,
Class<? extends Widget> widgetClass) throws InstantiationException {
NodeEntry attributes = new NodeEntry(sceneObject);
return createWidget(sceneObject, attributes, widgetClass);
} | java | public static Widget createWidget(final GVRSceneObject sceneObject,
Class<? extends Widget> widgetClass) throws InstantiationException {
NodeEntry attributes = new NodeEntry(sceneObject);
return createWidget(sceneObject, attributes, widgetClass);
} | [
"public",
"static",
"Widget",
"createWidget",
"(",
"final",
"GVRSceneObject",
"sceneObject",
",",
"Class",
"<",
"?",
"extends",
"Widget",
">",
"widgetClass",
")",
"throws",
"InstantiationException",
"{",
"NodeEntry",
"attributes",
"=",
"new",
"NodeEntry",
"(",
"sc... | Create a {@link Widget} of the specified {@code widgetClass} to wrap
{@link GVRSceneObject sceneObject}.
@param sceneObject
The {@code GVRSceneObject} to wrap
@param widgetClass
The {@linkplain Class} of the {@code Widget} to wrap
{@code sceneObject} with.
@return A new {@code Widget} instance.
@throws InstantiationException
If the {@code Widget} can't be instantiated for any reason. | [
"Create",
"a",
"{",
"@link",
"Widget",
"}",
"of",
"the",
"specified",
"{",
"@code",
"widgetClass",
"}",
"to",
"wrap",
"{",
"@link",
"GVRSceneObject",
"sceneObject",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L69-L73 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java | ResourceLoader.getBufferedReader | public static BufferedReader getBufferedReader(final File resource, final String encoding) throws IOException {
return new BufferedReader(getInputStreamReader(resource, encoding));
} | java | public static BufferedReader getBufferedReader(final File resource, final String encoding) throws IOException {
return new BufferedReader(getInputStreamReader(resource, encoding));
} | [
"public",
"static",
"BufferedReader",
"getBufferedReader",
"(",
"final",
"File",
"resource",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"return",
"new",
"BufferedReader",
"(",
"getInputStreamReader",
"(",
"resource",
",",
"encoding",
")",... | Loads a resource as {@link BufferedReader}.
@param resource
The resource to be loaded.
@param encoding
The encoding to use
@return The reader | [
"Loads",
"a",
"resource",
"as",
"{",
"@link",
"BufferedReader",
"}",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ResourceLoader.java#L80-L82 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/UtilDecompositons_DDRM.java | UtilDecompositons_DDRM.checkZerosLT | public static DMatrixRMaj checkZerosLT(DMatrixRMaj A , int numRows , int numCols) {
if( A == null ) {
return new DMatrixRMaj(numRows,numCols);
} else if( numRows != A.numRows || numCols != A.numCols ) {
A.reshape(numRows,numCols);
A.zero();
} else {
for( int i = 0; i < A.numRows; i++ ) {
int index = i*A.numCols;
int end = index + Math.min(i,A.numCols);;
while( index < end ) {
A.data[index++] = 0;
}
}
}
return A;
} | java | public static DMatrixRMaj checkZerosLT(DMatrixRMaj A , int numRows , int numCols) {
if( A == null ) {
return new DMatrixRMaj(numRows,numCols);
} else if( numRows != A.numRows || numCols != A.numCols ) {
A.reshape(numRows,numCols);
A.zero();
} else {
for( int i = 0; i < A.numRows; i++ ) {
int index = i*A.numCols;
int end = index + Math.min(i,A.numCols);;
while( index < end ) {
A.data[index++] = 0;
}
}
}
return A;
} | [
"public",
"static",
"DMatrixRMaj",
"checkZerosLT",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"numRows",
",",
"int",
"numCols",
")",
"{",
"if",
"(",
"A",
"==",
"null",
")",
"{",
"return",
"new",
"DMatrixRMaj",
"(",
"numRows",
",",
"numCols",
")",
";",
"}",
"... | Creates a zeros matrix only if A does not already exist. If it does exist it will fill
the lower triangular portion with zeros. | [
"Creates",
"a",
"zeros",
"matrix",
"only",
"if",
"A",
"does",
"not",
"already",
"exist",
".",
"If",
"it",
"does",
"exist",
"it",
"will",
"fill",
"the",
"lower",
"triangular",
"portion",
"with",
"zeros",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/UtilDecompositons_DDRM.java#L55-L71 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.lookAlong | public Matrix4f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setLookAlong(dirX, dirY, dirZ, upX, upY, upZ);
return lookAlongGeneric(dirX, dirY, dirZ, upX, upY, upZ, dest);
} | java | public Matrix4f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setLookAlong(dirX, dirY, dirZ, upX, upY, upZ);
return lookAlongGeneric(dirX, dirY, dirZ, upX, upY, upZ, dest);
} | [
"public",
"Matrix4f",
"lookAlong",
"(",
"float",
"dirX",
",",
"float",
"dirY",
",",
"float",
"dirZ",
",",
"float",
"upX",
",",
"float",
"upY",
",",
"float",
"upZ",
",",
"Matrix4f",
"dest",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",... | Apply a rotation transformation to this matrix to make <code>-z</code> point along <code>dir</code>
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookalong rotation matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the
lookalong rotation transformation will be applied first!
<p>
This is equivalent to calling
{@link #lookAt(float, float, float, float, float, float, float, float, float) lookAt()}
with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>.
<p>
In order to set the matrix to a lookalong transformation without post-multiplying it,
use {@link #setLookAlong(float, float, float, float, float, float) setLookAlong()}
@see #lookAt(float, float, float, float, float, float, float, float, float)
@see #setLookAlong(float, float, float, float, float, float)
@param dirX
the x-coordinate of the direction to look along
@param dirY
the y-coordinate of the direction to look along
@param dirZ
the z-coordinate of the direction to look along
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"rotation",
"transformation",
"to",
"this",
"matrix",
"to",
"make",
"<code",
">",
"-",
"z<",
"/",
"code",
">",
"point",
"along",
"<code",
">",
"dir<",
"/",
"code",
">",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L8136-L8140 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java | IntentsClient.listIntents | public final ListIntentsPagedResponse listIntents(ProjectAgentName parent, String languageCode) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setLanguageCode(languageCode)
.build();
return listIntents(request);
} | java | public final ListIntentsPagedResponse listIntents(ProjectAgentName parent, String languageCode) {
ListIntentsRequest request =
ListIntentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setLanguageCode(languageCode)
.build();
return listIntents(request);
} | [
"public",
"final",
"ListIntentsPagedResponse",
"listIntents",
"(",
"ProjectAgentName",
"parent",
",",
"String",
"languageCode",
")",
"{",
"ListIntentsRequest",
"request",
"=",
"ListIntentsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
... | Returns the list of all intents in the specified agent.
<p>Sample code:
<pre><code>
try (IntentsClient intentsClient = IntentsClient.create()) {
ProjectAgentName parent = ProjectAgentName.of("[PROJECT]");
String languageCode = "";
for (Intent element : intentsClient.listIntents(parent, languageCode).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. The agent to list all intents from. Format: `projects/<Project
ID>/agent`.
@param languageCode Optional. The language to list training phrases, parameters and rich
messages for. If not specified, the agent's default language is used. [Many
languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are
supported. Note: languages must be enabled in the agent before they can be used.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Returns",
"the",
"list",
"of",
"all",
"intents",
"in",
"the",
"specified",
"agent",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java#L275-L282 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializationContext.java | JsonDeserializationContext.traceError | public RuntimeException traceError( RuntimeException cause, JsonReader reader ) {
RuntimeException exception = traceError( cause );
traceReaderInfo( reader );
return exception;
} | java | public RuntimeException traceError( RuntimeException cause, JsonReader reader ) {
RuntimeException exception = traceError( cause );
traceReaderInfo( reader );
return exception;
} | [
"public",
"RuntimeException",
"traceError",
"(",
"RuntimeException",
"cause",
",",
"JsonReader",
"reader",
")",
"{",
"RuntimeException",
"exception",
"=",
"traceError",
"(",
"cause",
")",
";",
"traceReaderInfo",
"(",
"reader",
")",
";",
"return",
"exception",
";",... | Trace an error with current reader state and returns a corresponding exception.
@param cause cause of the error
@param reader current reader
@return a {@link JsonDeserializationException} if we wrap the exceptions, the cause otherwise | [
"Trace",
"an",
"error",
"with",
"current",
"reader",
"state",
"and",
"returns",
"a",
"corresponding",
"exception",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializationContext.java#L389-L393 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java | InternalTextureLoader.createTexture | public Texture createTexture(final int width, final int height, final int filter) throws IOException {
ImageData ds = new EmptyImageData(width, height);
return getTexture(ds, filter);
} | java | public Texture createTexture(final int width, final int height, final int filter) throws IOException {
ImageData ds = new EmptyImageData(width, height);
return getTexture(ds, filter);
} | [
"public",
"Texture",
"createTexture",
"(",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"int",
"filter",
")",
"throws",
"IOException",
"{",
"ImageData",
"ds",
"=",
"new",
"EmptyImageData",
"(",
"width",
",",
"height",
")",
";",
"re... | Create an empty texture
@param width The width of the new texture
@param height The height of the new texture
@return The created empty texture
@throws IOException Indicates a failure to create the texture on the graphics hardware | [
"Create",
"an",
"empty",
"texture"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/InternalTextureLoader.java#L371-L375 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java | JMapper.getDestination | public D getDestination(D destination,final S source){
try {
return mapper.vVAllAllAll(destination, source);
}catch (Exception e) {
JmapperLog.error(e);
}
return null;
} | java | public D getDestination(D destination,final S source){
try {
return mapper.vVAllAllAll(destination, source);
}catch (Exception e) {
JmapperLog.error(e);
}
return null;
} | [
"public",
"D",
"getDestination",
"(",
"D",
"destination",
",",
"final",
"S",
"source",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"vVAllAllAll",
"(",
"destination",
",",
"source",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JmapperLog",... | This Method returns the destination given in input enriched with data contained in source given in input<br>
with this setting:
<table summary = "">
<tr>
<td><code>NullPointerControl</code></td><td><code>ALL</code></td>
</tr><tr>
<td><code>MappingType</code> of Destination</td><td><code>ALL_FIELDS</code></td>
</tr><tr>
<td><code>MappingType</code> of Source</td><td><code>ALL_FIELDS</code></td>
</tr>
</table>
@param destination instance to enrich
@param source instance that contains the data
@return destination enriched
@see NullPointerControl
@see MappingType | [
"This",
"Method",
"returns",
"the",
"destination",
"given",
"in",
"input",
"enriched",
"with",
"data",
"contained",
"in",
"source",
"given",
"in",
"input<br",
">",
"with",
"this",
"setting",
":",
"<table",
"summary",
"=",
">",
"<tr",
">",
"<td",
">",
"<cod... | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java#L148-L155 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/async/AsyncRequest.java | AsyncRequest.markRecord | public void markRecord(BufferedRecord<D> record, int bytesWritten) {
synchronized (this) {
thunks.add(new Thunk<>(record, bytesWritten));
byteSize += bytesWritten;
}
} | java | public void markRecord(BufferedRecord<D> record, int bytesWritten) {
synchronized (this) {
thunks.add(new Thunk<>(record, bytesWritten));
byteSize += bytesWritten;
}
} | [
"public",
"void",
"markRecord",
"(",
"BufferedRecord",
"<",
"D",
">",
"record",
",",
"int",
"bytesWritten",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"thunks",
".",
"add",
"(",
"new",
"Thunk",
"<>",
"(",
"record",
",",
"bytesWritten",
")",
")",
... | Mark the record associated with this request
@param record buffered record
@param bytesWritten bytes of the record written into the request | [
"Mark",
"the",
"record",
"associated",
"with",
"this",
"request"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/async/AsyncRequest.java#L71-L76 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/SecurityActions.java | SecurityActions.privilegedExecution | static <T, U, R> R privilegedExecution(BiFunction<T, U, R> function, T t, U u) {
return privilegedExecution().execute(function, t, u);
} | java | static <T, U, R> R privilegedExecution(BiFunction<T, U, R> function, T t, U u) {
return privilegedExecution().execute(function, t, u);
} | [
"static",
"<",
"T",
",",
"U",
",",
"R",
">",
"R",
"privilegedExecution",
"(",
"BiFunction",
"<",
"T",
",",
"U",
",",
"R",
">",
"function",
",",
"T",
"t",
",",
"U",
"u",
")",
"{",
"return",
"privilegedExecution",
"(",
")",
".",
"execute",
"(",
"fu... | Execute the given function, in a privileged block if a security manager is checking.
@param function the function
@param t the first argument to the function
@param u the second argument to the function
@param <T> the type of the first argument to the function
@param <U> the type of the second argument to the function
@param <R> the type of the function return value
@return the return value of the function | [
"Execute",
"the",
"given",
"function",
"in",
"a",
"privileged",
"block",
"if",
"a",
"security",
"manager",
"is",
"checking",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/SecurityActions.java#L60-L62 |
jimmoores/quandl4j | core/src/main/java/com/jimmoores/quandl/MetaDataResult.java | MetaDataResult.getDouble | public Double getDouble(final String fieldName) {
try {
if (_jsonObject.isNull(fieldName)) {
return null;
} else {
return _jsonObject.getDouble(fieldName);
}
} catch (JSONException ex) {
throw new QuandlRuntimeException("Cannot find field", ex);
}
} | java | public Double getDouble(final String fieldName) {
try {
if (_jsonObject.isNull(fieldName)) {
return null;
} else {
return _jsonObject.getDouble(fieldName);
}
} catch (JSONException ex) {
throw new QuandlRuntimeException("Cannot find field", ex);
}
} | [
"public",
"Double",
"getDouble",
"(",
"final",
"String",
"fieldName",
")",
"{",
"try",
"{",
"if",
"(",
"_jsonObject",
".",
"isNull",
"(",
"fieldName",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"_jsonObject",
".",
"getDouble",
"(",... | Get a Double field. This attempts to work around the stupid NaN is null behavior by explicitly testing for null. Throws a
QuandlRuntimeException if it cannot find the field
@param fieldName the name of the field
@return the field value, or null if the field is null | [
"Get",
"a",
"Double",
"field",
".",
"This",
"attempts",
"to",
"work",
"around",
"the",
"stupid",
"NaN",
"is",
"null",
"behavior",
"by",
"explicitly",
"testing",
"for",
"null",
".",
"Throws",
"a",
"QuandlRuntimeException",
"if",
"it",
"cannot",
"find",
"the",... | train | https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/MetaDataResult.java#L150-L160 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/fs/Node.java | Node.copyDirectory | public List<Node> copyDirectory(Node dest) throws DirectoryNotFoundException, CopyException {
return copyDirectory(dest, new Filter().includeAll());
} | java | public List<Node> copyDirectory(Node dest) throws DirectoryNotFoundException, CopyException {
return copyDirectory(dest, new Filter().includeAll());
} | [
"public",
"List",
"<",
"Node",
">",
"copyDirectory",
"(",
"Node",
"dest",
")",
"throws",
"DirectoryNotFoundException",
",",
"CopyException",
"{",
"return",
"copyDirectory",
"(",
"dest",
",",
"new",
"Filter",
"(",
")",
".",
"includeAll",
"(",
")",
")",
";",
... | Convenience method for copy all files. Does not use default-excludes
@return list of files and directories created | [
"Convenience",
"method",
"for",
"copy",
"all",
"files",
".",
"Does",
"not",
"use",
"default",
"-",
"excludes"
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L768-L770 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java | StructuredDataId.makeId | public StructuredDataId makeId(final String defaultId, final int anEnterpriseNumber) {
String id;
String[] req;
String[] opt;
if (anEnterpriseNumber <= 0) {
return this;
}
if (this.name != null) {
id = this.name;
req = this.required;
opt = this.optional;
} else {
id = defaultId;
req = null;
opt = null;
}
return new StructuredDataId(id, anEnterpriseNumber, req, opt);
} | java | public StructuredDataId makeId(final String defaultId, final int anEnterpriseNumber) {
String id;
String[] req;
String[] opt;
if (anEnterpriseNumber <= 0) {
return this;
}
if (this.name != null) {
id = this.name;
req = this.required;
opt = this.optional;
} else {
id = defaultId;
req = null;
opt = null;
}
return new StructuredDataId(id, anEnterpriseNumber, req, opt);
} | [
"public",
"StructuredDataId",
"makeId",
"(",
"final",
"String",
"defaultId",
",",
"final",
"int",
"anEnterpriseNumber",
")",
"{",
"String",
"id",
";",
"String",
"[",
"]",
"req",
";",
"String",
"[",
"]",
"opt",
";",
"if",
"(",
"anEnterpriseNumber",
"<=",
"0... | Creates an id based on the current id.
@param defaultId The default id to use if this StructuredDataId doesn't have a name.
@param anEnterpriseNumber The enterprise number.
@return a StructuredDataId. | [
"Creates",
"an",
"id",
"based",
"on",
"the",
"current",
"id",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java#L184-L202 |
lordcodes/SnackbarBuilder | snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/callback/SnackbarCallback.java | SnackbarCallback.onDismissed | @Override
public final void onDismissed(Snackbar snackbar, int dismissEvent) {
super.onDismissed(snackbar, dismissEvent);
notifySnackbarCallback(snackbar, dismissEvent);
} | java | @Override
public final void onDismissed(Snackbar snackbar, int dismissEvent) {
super.onDismissed(snackbar, dismissEvent);
notifySnackbarCallback(snackbar, dismissEvent);
} | [
"@",
"Override",
"public",
"final",
"void",
"onDismissed",
"(",
"Snackbar",
"snackbar",
",",
"int",
"dismissEvent",
")",
"{",
"super",
".",
"onDismissed",
"(",
"snackbar",
",",
"dismissEvent",
")",
";",
"notifySnackbarCallback",
"(",
"snackbar",
",",
"dismissEve... | Notifies that the Snackbar has been dismissed through some event, for example swiping or the action being pressed.
@param snackbar The Snackbar which has been dismissed.
@param dismissEvent The event which caused the dismissal. | [
"Notifies",
"that",
"the",
"Snackbar",
"has",
"been",
"dismissed",
"through",
"some",
"event",
"for",
"example",
"swiping",
"or",
"the",
"action",
"being",
"pressed",
"."
] | train | https://github.com/lordcodes/SnackbarBuilder/blob/a104a753c78ed66940c19d295e141a521cf81d73/snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/callback/SnackbarCallback.java#L54-L59 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.doPhase | public final Key doPhase(Key key, boolean lastPhase)
throws InvalidKeyException, IllegalStateException
{
chooseFirstProvider();
return spi.engineDoPhase(key, lastPhase);
} | java | public final Key doPhase(Key key, boolean lastPhase)
throws InvalidKeyException, IllegalStateException
{
chooseFirstProvider();
return spi.engineDoPhase(key, lastPhase);
} | [
"public",
"final",
"Key",
"doPhase",
"(",
"Key",
"key",
",",
"boolean",
"lastPhase",
")",
"throws",
"InvalidKeyException",
",",
"IllegalStateException",
"{",
"chooseFirstProvider",
"(",
")",
";",
"return",
"spi",
".",
"engineDoPhase",
"(",
"key",
",",
"lastPhase... | Executes the next phase of this key agreement with the given
key that was received from one of the other parties involved in this key
agreement.
@param key the key for this phase. For example, in the case of
Diffie-Hellman between 2 parties, this would be the other party's
Diffie-Hellman public key.
@param lastPhase flag which indicates whether or not this is the last
phase of this key agreement.
@return the (intermediate) key resulting from this phase, or null
if this phase does not yield a key
@exception InvalidKeyException if the given key is inappropriate for
this phase.
@exception IllegalStateException if this key agreement has not been
initialized. | [
"Executes",
"the",
"next",
"phase",
"of",
"this",
"key",
"agreement",
"with",
"the",
"given",
"key",
"that",
"was",
"received",
"from",
"one",
"of",
"the",
"other",
"parties",
"involved",
"in",
"this",
"key",
"agreement",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L556-L561 |
ontop/ontop | engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitness.java | TreeWitness.isCompatible | public static boolean isCompatible(TreeWitness tw1, TreeWitness tw2) {
Set<Term> commonTerms = new HashSet<>(tw1.getDomain());
commonTerms.retainAll(tw2.getDomain());
if (!commonTerms.isEmpty()) {
if (!tw1.getRoots().containsAll(commonTerms) || !tw2.getRoots().containsAll(commonTerms))
return false;
}
return true;
} | java | public static boolean isCompatible(TreeWitness tw1, TreeWitness tw2) {
Set<Term> commonTerms = new HashSet<>(tw1.getDomain());
commonTerms.retainAll(tw2.getDomain());
if (!commonTerms.isEmpty()) {
if (!tw1.getRoots().containsAll(commonTerms) || !tw2.getRoots().containsAll(commonTerms))
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isCompatible",
"(",
"TreeWitness",
"tw1",
",",
"TreeWitness",
"tw2",
")",
"{",
"Set",
"<",
"Term",
">",
"commonTerms",
"=",
"new",
"HashSet",
"<>",
"(",
"tw1",
".",
"getDomain",
"(",
")",
")",
";",
"commonTerms",
".",
"ret... | boolean isCompatibleWith(TreeWitness tw1, TreeWitness tw2)
tree witnesses are consistent iff their domains intersect on their **common** roots
@param tw1: a tree witness
@return true if tw1 is compatible with the given tree witness | [
"boolean",
"isCompatibleWith",
"(",
"TreeWitness",
"tw1",
"TreeWitness",
"tw2",
")"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/core/src/main/java/it/unibz/inf/ontop/answering/reformulation/rewriting/impl/TreeWitness.java#L161-L169 |
looly/hutool | hutool-json/src/main/java/cn/hutool/json/JSONUtil.java | JSONUtil.putByPath | public static void putByPath(JSON json, String expression, Object value) {
json.putByPath(expression, value);
} | java | public static void putByPath(JSON json, String expression, Object value) {
json.putByPath(expression, value);
} | [
"public",
"static",
"void",
"putByPath",
"(",
"JSON",
"json",
",",
"String",
"expression",
",",
"Object",
"value",
")",
"{",
"json",
".",
"putByPath",
"(",
"expression",
",",
"value",
")",
";",
"}"
] | 设置表达式指定位置(或filed对应)的值<br>
若表达式指向一个JSONArray则设置其坐标对应位置的值,若指向JSONObject则put对应key的值<br>
注意:如果为JSONArray,则设置值得下标不能大于已有JSONArray的长度<br>
<ol>
<li>.表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值</li>
<li>[]表达式,可以获取集合等对象中对应index的值</li>
</ol>
表达式栗子:
<pre>
persion
persion.name
persons[3]
person.friends[5].name
</pre>
@param json JSON,可以为JSONObject或JSONArray
@param expression 表达式
@param value 值 | [
"设置表达式指定位置(或filed对应)的值<br",
">",
"若表达式指向一个JSONArray则设置其坐标对应位置的值,若指向JSONObject则put对应key的值<br",
">",
"注意:如果为JSONArray,则设置值得下标不能大于已有JSONArray的长度<br",
">",
"<ol",
">",
"<li",
">",
".",
"表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值<",
"/",
"li",
">",
"<li",
">",
"[]",
"表达式,可以获取集合等对象中对应index的值... | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L436-L438 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java | SOS.computeH | protected static double computeH(DBIDRef ignore, DoubleDBIDListIter it, double[] p, double mbeta) {
double sumP = 0.;
// Skip point "i", break loop in two:
it.seek(0);
for(int j = 0; it.valid(); j++, it.advance()) {
if(DBIDUtil.equal(ignore, it)) {
p[j] = 0;
continue;
}
sumP += (p[j] = FastMath.exp(it.doubleValue() * mbeta));
}
if(!(sumP > 0)) {
// All pij are zero. Bad news.
return Double.NEGATIVE_INFINITY;
}
final double s = 1. / sumP; // Scaling factor
double sum = 0.;
// While we could skip pi[i], it should be 0 anyway.
it.seek(0);
for(int j = 0; it.valid(); j++, it.advance()) {
sum += it.doubleValue() * (p[j] *= s);
}
return FastMath.log(sumP) - mbeta * sum;
} | java | protected static double computeH(DBIDRef ignore, DoubleDBIDListIter it, double[] p, double mbeta) {
double sumP = 0.;
// Skip point "i", break loop in two:
it.seek(0);
for(int j = 0; it.valid(); j++, it.advance()) {
if(DBIDUtil.equal(ignore, it)) {
p[j] = 0;
continue;
}
sumP += (p[j] = FastMath.exp(it.doubleValue() * mbeta));
}
if(!(sumP > 0)) {
// All pij are zero. Bad news.
return Double.NEGATIVE_INFINITY;
}
final double s = 1. / sumP; // Scaling factor
double sum = 0.;
// While we could skip pi[i], it should be 0 anyway.
it.seek(0);
for(int j = 0; it.valid(); j++, it.advance()) {
sum += it.doubleValue() * (p[j] *= s);
}
return FastMath.log(sumP) - mbeta * sum;
} | [
"protected",
"static",
"double",
"computeH",
"(",
"DBIDRef",
"ignore",
",",
"DoubleDBIDListIter",
"it",
",",
"double",
"[",
"]",
"p",
",",
"double",
"mbeta",
")",
"{",
"double",
"sumP",
"=",
"0.",
";",
"// Skip point \"i\", break loop in two:",
"it",
".",
"see... | Compute H (observed perplexity) for row i, and the row pij_i.
@param ignore Object to skip
@param it Distances list
@param p Output probabilities
@param mbeta {@code -1. / (2 * sigma * sigma)}
@return Observed perplexity | [
"Compute",
"H",
"(",
"observed",
"perplexity",
")",
"for",
"row",
"i",
"and",
"the",
"row",
"pij_i",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java#L272-L295 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java | ImageModerationsImpl.evaluateUrlInputAsync | public Observable<Evaluate> evaluateUrlInputAsync(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) {
return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, evaluateUrlInputOptionalParameter).map(new Func1<ServiceResponse<Evaluate>, Evaluate>() {
@Override
public Evaluate call(ServiceResponse<Evaluate> response) {
return response.body();
}
});
} | java | public Observable<Evaluate> evaluateUrlInputAsync(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) {
return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, evaluateUrlInputOptionalParameter).map(new Func1<ServiceResponse<Evaluate>, Evaluate>() {
@Override
public Evaluate call(ServiceResponse<Evaluate> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Evaluate",
">",
"evaluateUrlInputAsync",
"(",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"EvaluateUrlInputOptionalParameter",
"evaluateUrlInputOptionalParameter",
")",
"{",
"return",
"evaluateUrlInputWithServiceResponseAsync",
... | Returns probabilities of the image containing racy or adult content.
@param contentType The content type.
@param imageUrl The image url.
@param evaluateUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Evaluate object | [
"Returns",
"probabilities",
"of",
"the",
"image",
"containing",
"racy",
"or",
"adult",
"content",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1606-L1613 |
joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java | PhoenixReader.readTasks | private void readTasks(Project phoenixProject, Storepoint storepoint)
{
processLayouts(phoenixProject);
processActivityCodes(storepoint);
processActivities(storepoint);
updateDates();
} | java | private void readTasks(Project phoenixProject, Storepoint storepoint)
{
processLayouts(phoenixProject);
processActivityCodes(storepoint);
processActivities(storepoint);
updateDates();
} | [
"private",
"void",
"readTasks",
"(",
"Project",
"phoenixProject",
",",
"Storepoint",
"storepoint",
")",
"{",
"processLayouts",
"(",
"phoenixProject",
")",
";",
"processActivityCodes",
"(",
"storepoint",
")",
";",
"processActivities",
"(",
"storepoint",
")",
";",
"... | Read phases and activities from the Phoenix file to create the task hierarchy.
@param phoenixProject all project data
@param storepoint storepoint containing current project data | [
"Read",
"phases",
"and",
"activities",
"from",
"the",
"Phoenix",
"file",
"to",
"create",
"the",
"task",
"hierarchy",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L319-L325 |
FINRAOS/DataGenerator | dg-core/src/main/java/org/finra/datagenerator/writer/SqlWriter.java | SqlWriter.getSqlFormatted | public String getSqlFormatted(Map<String, String> dataMap) {
StringBuilder keys = new StringBuilder();
StringBuilder values = new StringBuilder();
StringBuilder query = new StringBuilder();
for (String var : outTemplate) {
if (keys.length() > 0) {
keys.append(',');
}
if (values.length() > 0) {
values.append(',');
}
keys.append(var);
values.append(dataMap.get(var));
}
return query.append(sqlStatement).append(" INTO ").append(schema).append(".")
.append(tableName).append(" (").append(keys).append(") ").append("VALUES")
.append(" (").append(values).append(");").toString();
} | java | public String getSqlFormatted(Map<String, String> dataMap) {
StringBuilder keys = new StringBuilder();
StringBuilder values = new StringBuilder();
StringBuilder query = new StringBuilder();
for (String var : outTemplate) {
if (keys.length() > 0) {
keys.append(',');
}
if (values.length() > 0) {
values.append(',');
}
keys.append(var);
values.append(dataMap.get(var));
}
return query.append(sqlStatement).append(" INTO ").append(schema).append(".")
.append(tableName).append(" (").append(keys).append(") ").append("VALUES")
.append(" (").append(values).append(");").toString();
} | [
"public",
"String",
"getSqlFormatted",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"dataMap",
")",
"{",
"StringBuilder",
"keys",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"StringBuilder",
"values",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"StringBuil... | INSERT/UPDATE INTO schema.table (key1, key2) VALUES ("value1","valu2"); | [
"INSERT",
"/",
"UPDATE",
"INTO",
"schema",
".",
"table",
"(",
"key1",
"key2",
")",
"VALUES",
"(",
"value1",
"valu2",
")",
";"
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/writer/SqlWriter.java#L93-L111 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.listBrands | public BrandsResponse listBrands(String accountId, AccountsApi.ListBrandsOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling listBrands");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/brands".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "exclude_distributor_brand", options.excludeDistributorBrand));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_logos", options.includeLogos));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<BrandsResponse> localVarReturnType = new GenericType<BrandsResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public BrandsResponse listBrands(String accountId, AccountsApi.ListBrandsOptions options) throws ApiException {
Object localVarPostBody = "{}";
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling listBrands");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/brands".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "exclude_distributor_brand", options.excludeDistributorBrand));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_logos", options.includeLogos));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<BrandsResponse> localVarReturnType = new GenericType<BrandsResponse>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"BrandsResponse",
"listBrands",
"(",
"String",
"accountId",
",",
"AccountsApi",
".",
"ListBrandsOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"\"{}\"",
";",
"// verify the required parameter 'accountId' is set",
"if",
... | Gets a list of brand profiles.
Retrieves the list of brand profiles associated with the account and the default brand profiles. The Account Branding feature (accountSettings properties `canSelfBrandSend` and `canSelfBrandSend`) must be set to **true** for the account to use this call.
@param accountId The external account number (int) or account ID Guid. (required)
@param options for modifying the method behavior.
@return BrandsResponse
@throws ApiException if fails to make API call | [
"Gets",
"a",
"list",
"of",
"brand",
"profiles",
".",
"Retrieves",
"the",
"list",
"of",
"brand",
"profiles",
"associated",
"with",
"the",
"account",
"and",
"the",
"default",
"brand",
"profiles",
".",
"The",
"Account",
"Branding",
"feature",
"(",
"accountSetting... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1900-L1937 |
google/error-prone | check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java | SuggestedFixes.qualifyType | public static String qualifyType(VisitorState state, SuggestedFix.Builder fix, Symbol sym) {
if (sym.getKind() == ElementKind.TYPE_PARAMETER) {
return sym.getSimpleName().toString();
}
Deque<String> names = new ArrayDeque<>();
for (Symbol curr = sym; curr != null; curr = curr.owner) {
names.addFirst(curr.getSimpleName().toString());
Symbol found =
FindIdentifiers.findIdent(curr.getSimpleName().toString(), state, KindSelector.VAL_TYP);
if (found == curr) {
break;
}
if (curr.owner != null && curr.owner.getKind() == ElementKind.PACKAGE) {
// If the owner of curr is a package, we can't do anything except import or fully-qualify
// the type name.
if (found != null) {
names.addFirst(curr.owner.getQualifiedName().toString());
} else {
fix.addImport(curr.getQualifiedName().toString());
}
break;
}
}
return Joiner.on('.').join(names);
} | java | public static String qualifyType(VisitorState state, SuggestedFix.Builder fix, Symbol sym) {
if (sym.getKind() == ElementKind.TYPE_PARAMETER) {
return sym.getSimpleName().toString();
}
Deque<String> names = new ArrayDeque<>();
for (Symbol curr = sym; curr != null; curr = curr.owner) {
names.addFirst(curr.getSimpleName().toString());
Symbol found =
FindIdentifiers.findIdent(curr.getSimpleName().toString(), state, KindSelector.VAL_TYP);
if (found == curr) {
break;
}
if (curr.owner != null && curr.owner.getKind() == ElementKind.PACKAGE) {
// If the owner of curr is a package, we can't do anything except import or fully-qualify
// the type name.
if (found != null) {
names.addFirst(curr.owner.getQualifiedName().toString());
} else {
fix.addImport(curr.getQualifiedName().toString());
}
break;
}
}
return Joiner.on('.').join(names);
} | [
"public",
"static",
"String",
"qualifyType",
"(",
"VisitorState",
"state",
",",
"SuggestedFix",
".",
"Builder",
"fix",
",",
"Symbol",
"sym",
")",
"{",
"if",
"(",
"sym",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"TYPE_PARAMETER",
")",
"{",
"return... | Returns a human-friendly name of the given {@link Symbol.TypeSymbol} for use in fixes.
<ul>
<li>If the type is already imported, its simple name is used.
<li>If an enclosing type is imported, that enclosing type is used as a qualified.
<li>Otherwise the outermost enclosing type is imported and used as a qualifier.
</ul> | [
"Returns",
"a",
"human",
"-",
"friendly",
"name",
"of",
"the",
"given",
"{",
"@link",
"Symbol",
".",
"TypeSymbol",
"}",
"for",
"use",
"in",
"fixes",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L268-L292 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/FormatUtils.java | FormatUtils.formatTrimmed | public static String formatTrimmed(Object o, int precision, int length) {
return String.format(getTrimmedFormat(getFormat(o, precision), length), o);
} | java | public static String formatTrimmed(Object o, int precision, int length) {
return String.format(getTrimmedFormat(getFormat(o, precision), length), o);
} | [
"public",
"static",
"String",
"formatTrimmed",
"(",
"Object",
"o",
",",
"int",
"precision",
",",
"int",
"length",
")",
"{",
"return",
"String",
".",
"format",
"(",
"getTrimmedFormat",
"(",
"getFormat",
"(",
"o",
",",
"precision",
")",
",",
"length",
")",
... | Returns a String representation of the given object using an appropriate
format and the specified precision in case the object is a non-integer
number, trimmed to the specified length.
@param o
Object for which a String representation is desired.
@param precision
Desired precision
@param length
Length of the trimmed string.
@return String representation of the given object using an appropriate
format | [
"Returns",
"a",
"String",
"representation",
"of",
"the",
"given",
"object",
"using",
"an",
"appropriate",
"format",
"and",
"the",
"specified",
"precision",
"in",
"case",
"the",
"object",
"is",
"a",
"non",
"-",
"integer",
"number",
"trimmed",
"to",
"the",
"sp... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/FormatUtils.java#L107-L109 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java | RequestUtil.getSelector | public static <T extends Enum> T getSelector(SlingHttpServletRequest request, T defaultValue) {
String[] selectors = request.getRequestPathInfo().getSelectors();
Class type = defaultValue.getClass();
for (String selector : selectors) {
try {
T value = (T) T.valueOf(type, selector);
return value;
} catch (IllegalArgumentException iaex) {
// ok, try next
}
}
return defaultValue;
} | java | public static <T extends Enum> T getSelector(SlingHttpServletRequest request, T defaultValue) {
String[] selectors = request.getRequestPathInfo().getSelectors();
Class type = defaultValue.getClass();
for (String selector : selectors) {
try {
T value = (T) T.valueOf(type, selector);
return value;
} catch (IllegalArgumentException iaex) {
// ok, try next
}
}
return defaultValue;
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
">",
"T",
"getSelector",
"(",
"SlingHttpServletRequest",
"request",
",",
"T",
"defaultValue",
")",
"{",
"String",
"[",
"]",
"selectors",
"=",
"request",
".",
"getRequestPathInfo",
"(",
")",
".",
"getSelectors",
... | Returns an enum value from selectors if an appropriate selector
can be found otherwise the default value given.
@param request the request object with the selector info
@param defaultValue the default enum value
@param <T> the enum type derived from the default value | [
"Returns",
"an",
"enum",
"value",
"from",
"selectors",
"if",
"an",
"appropriate",
"selector",
"can",
"be",
"found",
"otherwise",
"the",
"default",
"value",
"given",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java#L53-L65 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.findAll | public static <T> List<T> findAll(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) {
return findAll(self, Pattern.compile(regex.toString()), closure);
} | java | public static <T> List<T> findAll(CharSequence self, CharSequence regex, @ClosureParams(value=SimpleType.class, options="java.lang.String[]") Closure<T> closure) {
return findAll(self, Pattern.compile(regex.toString()), closure);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"findAll",
"(",
"CharSequence",
"self",
",",
"CharSequence",
"regex",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.lang.String[]\"",
")",
"C... | Finds all occurrences of a regular expression string within a CharSequence. Any matches are passed to the specified closure. The closure
is expected to have the full match in the first parameter. If there are any capture groups, they will be placed in subsequent parameters.
<p>
If there are no matches, the closure will not be called, and an empty List will be returned.
<p>
For example, if the regex doesn't match, it returns an empty list:
<pre>
assert [] == "foo".findAll(/(\w*) Fish/) { match, firstWord -> return firstWord }
</pre>
Any regular expression matches are passed to the closure, if there are no capture groups, there will be one parameter for the match:
<pre>
assert ["couldn't", "wouldn't"] == "I could not, would not, with a fox.".findAll(/.ould/) { match -> "${match}n't"}
</pre>
If there are capture groups, the first parameter will be the match followed by one parameter for each capture group:
<pre>
def orig = "There's a Wocket in my Pocket"
assert ["W > Wocket", "P > Pocket"] == orig.findAll(/(.)ocket/) { match, firstLetter -> "$firstLetter > $match" }
</pre>
@param self a CharSequence
@param regex the capturing regex CharSequence
@param closure will be passed the full match plus each of the capturing groups (if any)
@return a List containing all results from calling the closure with each full match (and potentially capturing groups) of the regex within the CharSequence, an empty list will be returned if there are no matches
@see #findAll(CharSequence, Pattern, groovy.lang.Closure)
@since 1.8.2 | [
"Finds",
"all",
"occurrences",
"of",
"a",
"regular",
"expression",
"string",
"within",
"a",
"CharSequence",
".",
"Any",
"matches",
"are",
"passed",
"to",
"the",
"specified",
"closure",
".",
"The",
"closure",
"is",
"expected",
"to",
"have",
"the",
"full",
"ma... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1081-L1083 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java | RequestHttpBase.setHeaderOutImpl | protected void setHeaderOutImpl(String key, String value)
{
int i = 0;
boolean hasHeader = false;
ArrayList<String> keys = _headerKeysOut;
ArrayList<String> values = _headerValuesOut;
for (i = keys.size() - 1; i >= 0; i--) {
String oldKey = keys.get(i);
if (oldKey.equalsIgnoreCase(key)) {
if (hasHeader) {
keys.remove(i);
values.remove(i);
}
else {
hasHeader = true;
values.set(i, value);
}
}
}
if (! hasHeader) {
keys.add(key);
values.add(value);
}
} | java | protected void setHeaderOutImpl(String key, String value)
{
int i = 0;
boolean hasHeader = false;
ArrayList<String> keys = _headerKeysOut;
ArrayList<String> values = _headerValuesOut;
for (i = keys.size() - 1; i >= 0; i--) {
String oldKey = keys.get(i);
if (oldKey.equalsIgnoreCase(key)) {
if (hasHeader) {
keys.remove(i);
values.remove(i);
}
else {
hasHeader = true;
values.set(i, value);
}
}
}
if (! hasHeader) {
keys.add(key);
values.add(value);
}
} | [
"protected",
"void",
"setHeaderOutImpl",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"int",
"i",
"=",
"0",
";",
"boolean",
"hasHeader",
"=",
"false",
";",
"ArrayList",
"<",
"String",
">",
"keys",
"=",
"_headerKeysOut",
";",
"ArrayList",
"<",
... | Sets a header, replacing an already-existing header.
@param key the header key to set.
@param value the header value to set. | [
"Sets",
"a",
"header",
"replacing",
"an",
"already",
"-",
"existing",
"header",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java#L1874-L1902 |
Jasig/uPortal | uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java | AuthorizationImpl.newPrincipal | @Override
public IAuthorizationPrincipal newPrincipal(IGroupMember groupMember) throws GroupsException {
String key = groupMember.getKey();
Class type = groupMember.getType();
logger.debug("AuthorizationImpl.newPrincipal(): for {} ({})", type, key);
return newPrincipal(key, type);
} | java | @Override
public IAuthorizationPrincipal newPrincipal(IGroupMember groupMember) throws GroupsException {
String key = groupMember.getKey();
Class type = groupMember.getType();
logger.debug("AuthorizationImpl.newPrincipal(): for {} ({})", type, key);
return newPrincipal(key, type);
} | [
"@",
"Override",
"public",
"IAuthorizationPrincipal",
"newPrincipal",
"(",
"IGroupMember",
"groupMember",
")",
"throws",
"GroupsException",
"{",
"String",
"key",
"=",
"groupMember",
".",
"getKey",
"(",
")",
";",
"Class",
"type",
"=",
"groupMember",
".",
"getType",... | Converts an <code>IGroupMember</code> into an <code>IAuthorizationPrincipal</code>.
@return org.apereo.portal.security.IAuthorizationPrincipal
@param groupMember org.apereo.portal.groups.IGroupMember | [
"Converts",
"an",
"<code",
">",
"IGroupMember<",
"/",
"code",
">",
"into",
"an",
"<code",
">",
"IAuthorizationPrincipal<",
"/",
"code",
">",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L942-L950 |
jenetics/jenetics | jenetics/src/main/java/io/jenetics/Phenotype.java | Phenotype.newInstance | @Deprecated
public Phenotype<G, C> newInstance(
final long generation,
final Function<? super Genotype<G>, ? extends C> function,
final Function<? super C, ? extends C> scaler
) {
return of(_genotype, generation, function, scaler);
} | java | @Deprecated
public Phenotype<G, C> newInstance(
final long generation,
final Function<? super Genotype<G>, ? extends C> function,
final Function<? super C, ? extends C> scaler
) {
return of(_genotype, generation, function, scaler);
} | [
"@",
"Deprecated",
"public",
"Phenotype",
"<",
"G",
",",
"C",
">",
"newInstance",
"(",
"final",
"long",
"generation",
",",
"final",
"Function",
"<",
"?",
"super",
"Genotype",
"<",
"G",
">",
",",
"?",
"extends",
"C",
">",
"function",
",",
"final",
"Func... | Return a new phenotype with the the genotype of this and with new
fitness function, fitness scaler and generation.
@param generation the generation of the new phenotype.
@param function the (new) fitness scaler of the created phenotype.
@param scaler the (new) fitness scaler of the created phenotype
@return a new phenotype with the given values.
@throws NullPointerException if one of the values is {@code null}.
@throws IllegalArgumentException if the given {@code generation} is
{@code < 0}.
@deprecated Will be removed in a later version | [
"Return",
"a",
"new",
"phenotype",
"with",
"the",
"the",
"genotype",
"of",
"this",
"and",
"with",
"new",
"fitness",
"function",
"fitness",
"scaler",
"and",
"generation",
"."
] | train | https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics/src/main/java/io/jenetics/Phenotype.java#L349-L356 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java | AbstractRestClient.buildConnectionManager | protected PoolingHttpClientConnectionManager buildConnectionManager(TrustStrategy trustStrategy, HostnameVerifier hostnameVerifier, String... certResources){
try {
KeyStore trustStore = certResources == null || certResources.length == 0 ? null : buildKeyStoreFromResources(certResources);
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(trustStore, trustStrategy)
.build();
SSLConnectionSocketFactory sslsf = hostnameVerifier == null ?
new SSLConnectionSocketFactory(sslContext) : new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
.register("https", sslsf)
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.build();
return new PoolingHttpClientConnectionManager(socketFactoryRegistry);
} catch (Exception e) {
throw Throwables.propagate(e);
}
} | java | protected PoolingHttpClientConnectionManager buildConnectionManager(TrustStrategy trustStrategy, HostnameVerifier hostnameVerifier, String... certResources){
try {
KeyStore trustStore = certResources == null || certResources.length == 0 ? null : buildKeyStoreFromResources(certResources);
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(trustStore, trustStrategy)
.build();
SSLConnectionSocketFactory sslsf = hostnameVerifier == null ?
new SSLConnectionSocketFactory(sslContext) : new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create()
.register("https", sslsf)
.register("http", PlainConnectionSocketFactory.getSocketFactory())
.build();
return new PoolingHttpClientConnectionManager(socketFactoryRegistry);
} catch (Exception e) {
throw Throwables.propagate(e);
}
} | [
"protected",
"PoolingHttpClientConnectionManager",
"buildConnectionManager",
"(",
"TrustStrategy",
"trustStrategy",
",",
"HostnameVerifier",
"hostnameVerifier",
",",
"String",
"...",
"certResources",
")",
"{",
"try",
"{",
"KeyStore",
"trustStore",
"=",
"certResources",
"=="... | Build a PoolingHttpClientConnectionManager that trusts certificates loaded from specified resource with specified trust strategy.
If you want the REST client to trust some specific server certificates, you can override {@link #buildConnectionManager()} method
and use this method to build a custom connection manager.
@param trustStrategy The trust strategy, can be null if the default one should be used.
To always trust self-signed server certificates, use <code>TrustSelfSignedStrategy</code>.
@param hostnameVerifier The verifier of hostnames, can be null if the default one should be used.
To skip hostname verification, use <code>NoopHostnameVerifier</code>
@param certResources Resources that contains certificates in binary or base64 DER/.crt format.
@return a PoolingHttpClientConnectionManager | [
"Build",
"a",
"PoolingHttpClientConnectionManager",
"that",
"trusts",
"certificates",
"loaded",
"from",
"specified",
"resource",
"with",
"specified",
"trust",
"strategy",
".",
"If",
"you",
"want",
"the",
"REST",
"client",
"to",
"trust",
"some",
"specific",
"server",... | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L287-L303 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/math/NumericsUtilities.java | NumericsUtilities.fEq | public static boolean fEq( float a, float b, float epsilon ) {
if (isNaN(a) && isNaN(b)) {
return true;
}
float diffAbs = abs(a - b);
return a == b ? true : diffAbs < epsilon ? true : diffAbs / Math.max(abs(a), abs(b)) < epsilon;
} | java | public static boolean fEq( float a, float b, float epsilon ) {
if (isNaN(a) && isNaN(b)) {
return true;
}
float diffAbs = abs(a - b);
return a == b ? true : diffAbs < epsilon ? true : diffAbs / Math.max(abs(a), abs(b)) < epsilon;
} | [
"public",
"static",
"boolean",
"fEq",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"epsilon",
")",
"{",
"if",
"(",
"isNaN",
"(",
"a",
")",
"&&",
"isNaN",
"(",
"b",
")",
")",
"{",
"return",
"true",
";",
"}",
"float",
"diffAbs",
"=",
"abs",
... | Returns true if two floats are considered equal based on an supplied epsilon.
<p>Note that two {@link Float#NaN} are seen as equal and return true.</p>
@param a float to compare.
@param b float to compare.
@return true if two float are considered equal. | [
"Returns",
"true",
"if",
"two",
"floats",
"are",
"considered",
"equal",
"based",
"on",
"an",
"supplied",
"epsilon",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/math/NumericsUtilities.java#L170-L176 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/service/RegistryService.java | RegistryService.pullImageWithPolicy | public void pullImageWithPolicy(String image, ImagePullManager pullManager, RegistryConfig registryConfig, boolean hasImage)
throws DockerAccessException, MojoExecutionException {
// Already pulled, so we don't need to take care
if (pullManager.hasAlreadyPulled(image)) {
return;
}
// Check if a pull is required
if (!imageRequiresPull(hasImage, pullManager.getImagePullPolicy(), image)) {
return;
}
ImageName imageName = new ImageName(image);
long time = System.currentTimeMillis();
String actualRegistry = EnvUtil.firstRegistryOf(
imageName.getRegistry(),
registryConfig.getRegistry());
docker.pullImage(imageName.getFullName(),
createAuthConfig(false, null, actualRegistry, registryConfig), actualRegistry);
log.info("Pulled %s in %s", imageName.getFullName(), EnvUtil.formatDurationTill(time));
pullManager.pulled(image);
if (actualRegistry != null && !imageName.hasRegistry()) {
// If coming from a registry which was not contained in the original name, add a tag from the
// full name with the registry to the short name with no-registry.
docker.tag(imageName.getFullName(actualRegistry), image, false);
}
} | java | public void pullImageWithPolicy(String image, ImagePullManager pullManager, RegistryConfig registryConfig, boolean hasImage)
throws DockerAccessException, MojoExecutionException {
// Already pulled, so we don't need to take care
if (pullManager.hasAlreadyPulled(image)) {
return;
}
// Check if a pull is required
if (!imageRequiresPull(hasImage, pullManager.getImagePullPolicy(), image)) {
return;
}
ImageName imageName = new ImageName(image);
long time = System.currentTimeMillis();
String actualRegistry = EnvUtil.firstRegistryOf(
imageName.getRegistry(),
registryConfig.getRegistry());
docker.pullImage(imageName.getFullName(),
createAuthConfig(false, null, actualRegistry, registryConfig), actualRegistry);
log.info("Pulled %s in %s", imageName.getFullName(), EnvUtil.formatDurationTill(time));
pullManager.pulled(image);
if (actualRegistry != null && !imageName.hasRegistry()) {
// If coming from a registry which was not contained in the original name, add a tag from the
// full name with the registry to the short name with no-registry.
docker.tag(imageName.getFullName(actualRegistry), image, false);
}
} | [
"public",
"void",
"pullImageWithPolicy",
"(",
"String",
"image",
",",
"ImagePullManager",
"pullManager",
",",
"RegistryConfig",
"registryConfig",
",",
"boolean",
"hasImage",
")",
"throws",
"DockerAccessException",
",",
"MojoExecutionException",
"{",
"// Already pulled, so w... | Check an image, and, if <code>autoPull</code> is set to true, fetch it. Otherwise if the image
is not existent, throw an error
@param registryConfig registry configuration
@throws DockerAccessException
@throws MojoExecutionException | [
"Check",
"an",
"image",
"and",
"if",
"<code",
">",
"autoPull<",
"/",
"code",
">",
"is",
"set",
"to",
"true",
"fetch",
"it",
".",
"Otherwise",
"if",
"the",
"image",
"is",
"not",
"existent",
"throw",
"an",
"error",
"@param",
"registryConfig",
"registry",
"... | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/RegistryService.java#L82-L110 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/Stack.java | Stack.withAttributes | public Stack withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public Stack withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"Stack",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The stack's attributes.
</p>
@param attributes
The stack's attributes.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"stack",
"s",
"attributes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/Stack.java#L426-L429 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java | Util.decodeGSSExportedName | public static GSSExportedName decodeGSSExportedName(byte[] name_tok) {
if (name_tok != null) {
ByteArrayInputStream bais = new ByteArrayInputStream(name_tok);
try {
// GSSToken tag 1 0x04
int t1 = bais.read();
if (t1 == ASN_TAG_NT_EXPORTED_NAME1) {
// GSSToken tag 2 0x01
int t2 = bais.read();
if (t2 == ASN_TAG_NT_EXPORTED_NAME2) {
// read the two length bytes
int l = bais.read() << 8;
l += bais.read();
// read the oid
byte[] oid_arr = new byte[l];
bais.read(oid_arr, 0, l);
String oid = decodeOID(oid_arr);
int l1 = bais.read();
int l2 = bais.read();
int l3 = bais.read();
int l4 = bais.read();
int name_len = (l1 << 24) + (l2 << 16) + (l3 << 8) + l4;
byte[] name_arr = new byte[name_len];
bais.read(name_arr, 0, name_len);
String name = new String(name_arr);
return new GSSExportedName(name, oid);
}
}
} catch (Exception ex) {
ex.printStackTrace();
// do nothing, return null
}
}
return null;
} | java | public static GSSExportedName decodeGSSExportedName(byte[] name_tok) {
if (name_tok != null) {
ByteArrayInputStream bais = new ByteArrayInputStream(name_tok);
try {
// GSSToken tag 1 0x04
int t1 = bais.read();
if (t1 == ASN_TAG_NT_EXPORTED_NAME1) {
// GSSToken tag 2 0x01
int t2 = bais.read();
if (t2 == ASN_TAG_NT_EXPORTED_NAME2) {
// read the two length bytes
int l = bais.read() << 8;
l += bais.read();
// read the oid
byte[] oid_arr = new byte[l];
bais.read(oid_arr, 0, l);
String oid = decodeOID(oid_arr);
int l1 = bais.read();
int l2 = bais.read();
int l3 = bais.read();
int l4 = bais.read();
int name_len = (l1 << 24) + (l2 << 16) + (l3 << 8) + l4;
byte[] name_arr = new byte[name_len];
bais.read(name_arr, 0, name_len);
String name = new String(name_arr);
return new GSSExportedName(name, oid);
}
}
} catch (Exception ex) {
ex.printStackTrace();
// do nothing, return null
}
}
return null;
} | [
"public",
"static",
"GSSExportedName",
"decodeGSSExportedName",
"(",
"byte",
"[",
"]",
"name_tok",
")",
"{",
"if",
"(",
"name_tok",
"!=",
"null",
")",
"{",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"name_tok",
")",
";",
"try",
"{... | This function reads a name from a byte array which was created
by the gssExportName() method.
@param name_tok The GSS name token.
@return The name from the GSS name token. | [
"This",
"function",
"reads",
"a",
"name",
"from",
"a",
"byte",
"array",
"which",
"was",
"created",
"by",
"the",
"gssExportName",
"()",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L268-L305 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4Connection.java | JDBC4Connection.prepareStatement | @Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"PreparedStatement",
"prepareStatement",
"(",
"String",
"sql",
",",
"int",
"[",
"]",
"columnIndexes",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. | [
"Creates",
"a",
"default",
"PreparedStatement",
"object",
"capable",
"of",
"returning",
"the",
"auto",
"-",
"generated",
"keys",
"designated",
"by",
"the",
"given",
"array",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L378-L383 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.createDummyLine | public static LineString createDummyLine() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0)};
LineString lineString = gf().createLineString(c);
return lineString;
} | java | public static LineString createDummyLine() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0)};
LineString lineString = gf().createLineString(c);
return lineString;
} | [
"public",
"static",
"LineString",
"createDummyLine",
"(",
")",
"{",
"Coordinate",
"[",
"]",
"c",
"=",
"new",
"Coordinate",
"[",
"]",
"{",
"new",
"Coordinate",
"(",
"0.0",
",",
"0.0",
")",
",",
"new",
"Coordinate",
"(",
"1.0",
",",
"1.0",
")",
",",
"n... | Creates a line that may help out as placeholder.
@return a dummy {@link LineString}. | [
"Creates",
"a",
"line",
"that",
"may",
"help",
"out",
"as",
"placeholder",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L136-L140 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.pageBody | public String pageBody(int segment, String className, String parameters) {
if (segment == HTML_START) {
StringBuffer result = new StringBuffer(128);
result.append("</head>\n<body unselectable=\"on\"");
if (className != null) {
result.append(" class=\"");
result.append(className);
result.append("\"");
}
if (CmsStringUtil.isNotEmpty(parameters)) {
result.append(" ");
result.append(parameters);
}
result.append(">\n");
return result.toString();
} else {
return "</body>";
}
} | java | public String pageBody(int segment, String className, String parameters) {
if (segment == HTML_START) {
StringBuffer result = new StringBuffer(128);
result.append("</head>\n<body unselectable=\"on\"");
if (className != null) {
result.append(" class=\"");
result.append(className);
result.append("\"");
}
if (CmsStringUtil.isNotEmpty(parameters)) {
result.append(" ");
result.append(parameters);
}
result.append(">\n");
return result.toString();
} else {
return "</body>";
}
} | [
"public",
"String",
"pageBody",
"(",
"int",
"segment",
",",
"String",
"className",
",",
"String",
"parameters",
")",
"{",
"if",
"(",
"segment",
"==",
"HTML_START",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"128",
")",
";",
"resul... | Builds the html of the body.<p>
@param segment the HTML segment (START / END)
@param className optional class attribute to add to the body tag
@param parameters optional parameters to add to the body tag
@return the html of the body | [
"Builds",
"the",
"html",
"of",
"the",
"body",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1948-L1967 |
gallandarakhneorg/afc | advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java | RoadPolylineDrawer.setupRoadBorders | protected void setupRoadBorders(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color = gc.rgb(getDrawingColor(element));
gc.setStroke(color);
final double width;
if (element.isWidePolyline()) {
width = 2 + gc.doc2fxSize(element.getWidth());
} else {
width = 3;
}
gc.setLineWidthInPixels(width);
} | java | protected void setupRoadBorders(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color = gc.rgb(getDrawingColor(element));
gc.setStroke(color);
final double width;
if (element.isWidePolyline()) {
width = 2 + gc.doc2fxSize(element.getWidth());
} else {
width = 3;
}
gc.setLineWidthInPixels(width);
} | [
"protected",
"void",
"setupRoadBorders",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"RoadPolyline",
"element",
")",
"{",
"final",
"Color",
"color",
"=",
"gc",
".",
"rgb",
"(",
"getDrawingColor",
"(",
"element",
")",
")",
";",
"gc",
".",
"setStroke",
"(",
"co... | Setup for drawing the road borders.
@param gc the graphics context.
@param element the element to draw. | [
"Setup",
"for",
"drawing",
"the",
"road",
"borders",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java#L86-L96 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateYXZ | public Matrix4f rotateYXZ(Vector3f angles) {
return rotateYXZ(angles.y, angles.x, angles.z);
} | java | public Matrix4f rotateYXZ(Vector3f angles) {
return rotateYXZ(angles.y, angles.x, angles.z);
} | [
"public",
"Matrix4f",
"rotateYXZ",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateYXZ",
"(",
"angles",
".",
"y",
",",
"angles",
".",
"x",
",",
"angles",
".",
"z",
")",
";",
"}"
] | Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and
followed by a rotation of <code>angles.z</code> radians about the Z 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>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axi... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5649-L5651 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java | TitlePaneIconifyButtonPainter.paintBackgroundPressed | private void paintBackgroundPressed(Graphics2D g, JComponent c, int width, int height) {
paintBackground(g, c, width, height, pressed);
} | java | private void paintBackgroundPressed(Graphics2D g, JComponent c, int width, int height) {
paintBackground(g, c, width, height, pressed);
} | [
"private",
"void",
"paintBackgroundPressed",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"paintBackground",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
",",
"pressed",
")",
";",
"}"
] | Paint the background pressed state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"background",
"pressed",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L159-L161 |
alkacon/opencms-core | src/org/opencms/util/CmsMacroResolver.java | CmsMacroResolver.resolveMacros | public static String resolveMacros(String input, CmsObject cms, CmsMessages messages) {
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.m_cms = cms;
resolver.m_messages = messages;
resolver.m_keepEmptyMacros = true;
return resolver.resolveMacros(input);
} | java | public static String resolveMacros(String input, CmsObject cms, CmsMessages messages) {
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.m_cms = cms;
resolver.m_messages = messages;
resolver.m_keepEmptyMacros = true;
return resolver.resolveMacros(input);
} | [
"public",
"static",
"String",
"resolveMacros",
"(",
"String",
"input",
",",
"CmsObject",
"cms",
",",
"CmsMessages",
"messages",
")",
"{",
"CmsMacroResolver",
"resolver",
"=",
"new",
"CmsMacroResolver",
"(",
")",
";",
"resolver",
".",
"m_cms",
"=",
"cms",
";",
... | Resolves the macros in the given input using the provided parameters.<p>
A macro in the form <code>%(key)</code> or <code>${key}</code> in the content is replaced with it's assigned value
returned by the <code>{@link I_CmsMacroResolver#getMacroValue(String)}</code> method of the given
<code>{@link I_CmsMacroResolver}</code> instance.<p>
If a macro is found that can not be mapped to a value by the given macro resolver,
it is left untouched in the input.<p>
@param input the input in which to resolve the macros
@param cms the OpenCms user context to use when resolving macros
@param messages the message resource bundle to use when resolving macros
@return the input with the macros resolved | [
"Resolves",
"the",
"macros",
"in",
"the",
"given",
"input",
"using",
"the",
"provided",
"parameters",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsMacroResolver.java#L525-L532 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java | ArchiveAnalyzer.analyzeDependency | @Override
public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
extractAndAnalyze(dependency, engine, 0);
engine.sortDependencies();
} | java | @Override
public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
extractAndAnalyze(dependency, engine, 0);
engine.sortDependencies();
} | [
"@",
"Override",
"public",
"void",
"analyzeDependency",
"(",
"Dependency",
"dependency",
",",
"Engine",
"engine",
")",
"throws",
"AnalysisException",
"{",
"extractAndAnalyze",
"(",
"dependency",
",",
"engine",
",",
"0",
")",
";",
"engine",
".",
"sortDependencies",... | Analyzes a given dependency. If the dependency is an archive, such as a
WAR or EAR, the contents are extracted, scanned, and added to the list of
dependencies within the engine.
@param dependency the dependency to analyze
@param engine the engine scanning
@throws AnalysisException thrown if there is an analysis exception | [
"Analyzes",
"a",
"given",
"dependency",
".",
"If",
"the",
"dependency",
"is",
"an",
"archive",
"such",
"as",
"a",
"WAR",
"or",
"EAR",
"the",
"contents",
"are",
"extracted",
"scanned",
"and",
"added",
"to",
"the",
"list",
"of",
"dependencies",
"within",
"th... | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/ArchiveAnalyzer.java#L231-L235 |
fedups/com.obdobion.argument | src/main/java/com/obdobion/argument/type/AbstractCLA.java | AbstractCLA.uncompileQuoter | static public void uncompileQuoter(final StringBuilder out, final String value)
{
out.append("'");
if (value != null)
out.append(value.replaceAll("'", "\\\\'").replaceAll("\"", "\\\\\""));
out.append("'");
} | java | static public void uncompileQuoter(final StringBuilder out, final String value)
{
out.append("'");
if (value != null)
out.append(value.replaceAll("'", "\\\\'").replaceAll("\"", "\\\\\""));
out.append("'");
} | [
"static",
"public",
"void",
"uncompileQuoter",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"value",
")",
"{",
"out",
".",
"append",
"(",
"\"'\"",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"out",
".",
"append",
"(",
"value",
"."... | <p>
uncompileQuoter.
</p>
@param out a {@link java.lang.StringBuilder} object.
@param value a {@link java.lang.String} object. | [
"<p",
">",
"uncompileQuoter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/fedups/com.obdobion.argument/blob/9679aebbeedaef4e592227842fa0e91410708a67/src/main/java/com/obdobion/argument/type/AbstractCLA.java#L95-L101 |
neoremind/fluent-validator | fluent-validator-spring/src/main/java/com/baidu/unbiz/fluentvalidator/support/MessageSupport.java | MessageSupport.getText | public static String getText(String code, Object[] args, Locale locale) {
Preconditions.checkState(messageSource != null,
"If i18n is enabled, please make sure MessageSource is properly set as a member in "
+ "MessageSupport");
return messageSource.getMessage(code, args, locale);
} | java | public static String getText(String code, Object[] args, Locale locale) {
Preconditions.checkState(messageSource != null,
"If i18n is enabled, please make sure MessageSource is properly set as a member in "
+ "MessageSupport");
return messageSource.getMessage(code, args, locale);
} | [
"public",
"static",
"String",
"getText",
"(",
"String",
"code",
",",
"Object",
"[",
"]",
"args",
",",
"Locale",
"locale",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"messageSource",
"!=",
"null",
",",
"\"If i18n is enabled, please make sure MessageSource is ... | 获取国际化消息
@param code 消息key
@param args 参数列表
@param locale 语言地区
@return 消息 | [
"获取国际化消息"
] | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator-spring/src/main/java/com/baidu/unbiz/fluentvalidator/support/MessageSupport.java#L115-L120 |
pravega/pravega | shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java | StreamSegmentNameUtils.getScopedStreamName | public static String getScopedStreamName(String scope, String streamName) {
return getScopedStreamNameInternal(scope, streamName).toString();
} | java | public static String getScopedStreamName(String scope, String streamName) {
return getScopedStreamNameInternal(scope, streamName).toString();
} | [
"public",
"static",
"String",
"getScopedStreamName",
"(",
"String",
"scope",
",",
"String",
"streamName",
")",
"{",
"return",
"getScopedStreamNameInternal",
"(",
"scope",
",",
"streamName",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Compose and return scoped stream name.
@param scope scope to be used in ScopedStream name.
@param streamName stream name to be used in ScopedStream name.
@return scoped stream name. | [
"Compose",
"and",
"return",
"scoped",
"stream",
"name",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java#L245-L247 |
apache/incubator-gobblin | gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixUtils.java | HelixUtils.deleteStoppedHelixJob | private static void deleteStoppedHelixJob(HelixManager helixManager, String workFlowName, String jobName)
throws InterruptedException {
WorkflowContext workflowContext = TaskDriver.getWorkflowContext(helixManager, workFlowName);
while (workflowContext.getJobState(TaskUtil.getNamespacedJobName(workFlowName, jobName)) != STOPPED) {
log.info("Waiting for job {} to stop...", jobName);
workflowContext = TaskDriver.getWorkflowContext(helixManager, workFlowName);
Thread.sleep(1000);
}
// deleting the entire workflow, as one workflow contains only one job
new TaskDriver(helixManager).deleteAndWaitForCompletion(workFlowName, 10000L);
log.info("Workflow deleted.");
} | java | private static void deleteStoppedHelixJob(HelixManager helixManager, String workFlowName, String jobName)
throws InterruptedException {
WorkflowContext workflowContext = TaskDriver.getWorkflowContext(helixManager, workFlowName);
while (workflowContext.getJobState(TaskUtil.getNamespacedJobName(workFlowName, jobName)) != STOPPED) {
log.info("Waiting for job {} to stop...", jobName);
workflowContext = TaskDriver.getWorkflowContext(helixManager, workFlowName);
Thread.sleep(1000);
}
// deleting the entire workflow, as one workflow contains only one job
new TaskDriver(helixManager).deleteAndWaitForCompletion(workFlowName, 10000L);
log.info("Workflow deleted.");
} | [
"private",
"static",
"void",
"deleteStoppedHelixJob",
"(",
"HelixManager",
"helixManager",
",",
"String",
"workFlowName",
",",
"String",
"jobName",
")",
"throws",
"InterruptedException",
"{",
"WorkflowContext",
"workflowContext",
"=",
"TaskDriver",
".",
"getWorkflowContex... | Deletes the stopped Helix Workflow.
Caller should stop the Workflow before calling this method.
@param helixManager helix manager
@param workFlowName workflow needed to be deleted
@param jobName helix job name
@throws InterruptedException | [
"Deletes",
"the",
"stopped",
"Helix",
"Workflow",
".",
"Caller",
"should",
"stop",
"the",
"Workflow",
"before",
"calling",
"this",
"method",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixUtils.java#L242-L253 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java | KvStateLocationRegistry.notifyKvStateRegistered | public void notifyKvStateRegistered(
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId,
InetSocketAddress kvStateServerAddress) {
KvStateLocation location = lookupTable.get(registrationName);
if (location == null) {
// First registration for this operator, create the location info
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
int parallelism = vertex.getMaxParallelism();
location = new KvStateLocation(jobId, jobVertexId, parallelism, registrationName);
lookupTable.put(registrationName, location);
} else {
throw new IllegalArgumentException("Unknown JobVertexID " + jobVertexId);
}
}
// Duplicated name if vertex IDs don't match
if (!location.getJobVertexId().equals(jobVertexId)) {
IllegalStateException duplicate = new IllegalStateException(
"Registration name clash. KvState with name '" + registrationName +
"' has already been registered by another operator (" +
location.getJobVertexId() + ").");
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
vertex.fail(new SuppressRestartsException(duplicate));
}
throw duplicate;
}
location.registerKvState(keyGroupRange, kvStateId, kvStateServerAddress);
} | java | public void notifyKvStateRegistered(
JobVertexID jobVertexId,
KeyGroupRange keyGroupRange,
String registrationName,
KvStateID kvStateId,
InetSocketAddress kvStateServerAddress) {
KvStateLocation location = lookupTable.get(registrationName);
if (location == null) {
// First registration for this operator, create the location info
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
int parallelism = vertex.getMaxParallelism();
location = new KvStateLocation(jobId, jobVertexId, parallelism, registrationName);
lookupTable.put(registrationName, location);
} else {
throw new IllegalArgumentException("Unknown JobVertexID " + jobVertexId);
}
}
// Duplicated name if vertex IDs don't match
if (!location.getJobVertexId().equals(jobVertexId)) {
IllegalStateException duplicate = new IllegalStateException(
"Registration name clash. KvState with name '" + registrationName +
"' has already been registered by another operator (" +
location.getJobVertexId() + ").");
ExecutionJobVertex vertex = jobVertices.get(jobVertexId);
if (vertex != null) {
vertex.fail(new SuppressRestartsException(duplicate));
}
throw duplicate;
}
location.registerKvState(keyGroupRange, kvStateId, kvStateServerAddress);
} | [
"public",
"void",
"notifyKvStateRegistered",
"(",
"JobVertexID",
"jobVertexId",
",",
"KeyGroupRange",
"keyGroupRange",
",",
"String",
"registrationName",
",",
"KvStateID",
"kvStateId",
",",
"InetSocketAddress",
"kvStateServerAddress",
")",
"{",
"KvStateLocation",
"location"... | Notifies the registry about a registered KvState instance.
@param jobVertexId JobVertexID the KvState instance belongs to
@param keyGroupRange Key group range the KvState instance belongs to
@param registrationName Name under which the KvState has been registered
@param kvStateId ID of the registered KvState instance
@param kvStateServerAddress Server address where to find the KvState instance
@throws IllegalArgumentException If JobVertexID does not belong to job
@throws IllegalArgumentException If state has been registered with same
name by another operator.
@throws IndexOutOfBoundsException If key group index is out of bounds. | [
"Notifies",
"the",
"registry",
"about",
"a",
"registered",
"KvState",
"instance",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/query/KvStateLocationRegistry.java#L89-L126 |
Wadpam/guja | guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java | GAEBlobServlet.doDelete | @Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (null != req.getParameter(KEY_PARAM)) {
deleteBlob(req, resp);
} else {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} | java | @Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (null != req.getParameter(KEY_PARAM)) {
deleteBlob(req, resp);
} else {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
} | [
"@",
"Override",
"protected",
"void",
"doDelete",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"if",
"(",
"null",
"!=",
"req",
".",
"getParameter",
"(",
"KEY_PARAM",
")",
")",
... | Url paths supported
/api/blob?key=<> (DELETE) Delete a blob based on blob key | [
"Url",
"paths",
"supported",
"/",
"api",
"/",
"blob?key",
"=",
"<",
">",
"(",
"DELETE",
")",
"Delete",
"a",
"blob",
"based",
"on",
"blob",
"key"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java#L88-L95 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.elementDecl | public void elementDecl(String name, String model) throws SAXException
{
// Do not inline external DTD
if (m_inExternalDTD)
return;
try
{
final java.io.Writer writer = m_writer;
DTDprolog();
writer.write("<!ELEMENT ");
writer.write(name);
writer.write(' ');
writer.write(model);
writer.write('>');
writer.write(m_lineSep, 0, m_lineSepLen);
}
catch (IOException e)
{
throw new SAXException(e);
}
} | java | public void elementDecl(String name, String model) throws SAXException
{
// Do not inline external DTD
if (m_inExternalDTD)
return;
try
{
final java.io.Writer writer = m_writer;
DTDprolog();
writer.write("<!ELEMENT ");
writer.write(name);
writer.write(' ');
writer.write(model);
writer.write('>');
writer.write(m_lineSep, 0, m_lineSepLen);
}
catch (IOException e)
{
throw new SAXException(e);
}
} | [
"public",
"void",
"elementDecl",
"(",
"String",
"name",
",",
"String",
"model",
")",
"throws",
"SAXException",
"{",
"// Do not inline external DTD",
"if",
"(",
"m_inExternalDTD",
")",
"return",
";",
"try",
"{",
"final",
"java",
".",
"io",
".",
"Writer",
"write... | Report an element type declaration.
<p>The content model will consist of the string "EMPTY", the
string "ANY", or a parenthesised group, optionally followed
by an occurrence indicator. The model will be normalized so
that all whitespace is removed,and will include the enclosing
parentheses.</p>
@param name The element type name.
@param model The content model as a normalized string.
@exception SAXException The application may raise an exception. | [
"Report",
"an",
"element",
"type",
"declaration",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L300-L322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.