repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.beginCreateOrUpdateSecuritySettingsAsync | public Observable<Void> beginCreateOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
"""
Updates the security settings on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param deviceAdminPassword Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginCreateOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginCreateOrUpdateSecuritySettingsAsync(String deviceName, String resourceGroupName, AsymmetricEncryptedSecret deviceAdminPassword) {
return beginCreateOrUpdateSecuritySettingsWithServiceResponseAsync(deviceName, resourceGroupName, deviceAdminPassword).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginCreateOrUpdateSecuritySettingsAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"AsymmetricEncryptedSecret",
"deviceAdminPassword",
")",
"{",
"return",
"beginCreateOrUpdateSecuritySettingsWithServiceRespo... | Updates the security settings on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param deviceAdminPassword Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Updates",
"the",
"security",
"settings",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1942-L1949 |
alibaba/java-dns-cache-manipulator | library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java | DnsCacheManipulator.listDnsCache | public static List<DnsCacheEntry> listDnsCache() {
"""
Get all dns cache entries.
@return dns cache entries
@throws DnsCacheManipulatorException Operation fail
@see #getWholeDnsCache()
@since 1.2.0
"""
try {
return InetAddressCacheUtil.listInetAddressCache().getCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e);
}
} | java | public static List<DnsCacheEntry> listDnsCache() {
try {
return InetAddressCacheUtil.listInetAddressCache().getCache();
} catch (Exception e) {
throw new DnsCacheManipulatorException("Fail to listDnsCache, cause: " + e.toString(), e);
}
} | [
"public",
"static",
"List",
"<",
"DnsCacheEntry",
">",
"listDnsCache",
"(",
")",
"{",
"try",
"{",
"return",
"InetAddressCacheUtil",
".",
"listInetAddressCache",
"(",
")",
".",
"getCache",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw... | Get all dns cache entries.
@return dns cache entries
@throws DnsCacheManipulatorException Operation fail
@see #getWholeDnsCache()
@since 1.2.0 | [
"Get",
"all",
"dns",
"cache",
"entries",
"."
] | train | https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L162-L168 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuEventElapsedTime | public static int cuEventElapsedTime(float pMilliseconds[], CUevent hStart, CUevent hEnd) {
"""
Computes the elapsed time between two events.
<pre>
CUresult cuEventElapsedTime (
float* pMilliseconds,
CUevent hStart,
CUevent hEnd )
</pre>
<div>
<p>Computes the elapsed time between two
events. Computes the elapsed time between two events (in milliseconds
with a resolution
of around 0.5 microseconds).
</p>
<p>If either event was last recorded in a
non-NULL stream, the resulting time may be greater than expected (even
if both used
the same stream handle). This happens
because the cuEventRecord() operation takes place asynchronously and
there is no guarantee that the measured latency is actually just
between the two
events. Any number of other different
stream operations could execute in between the two measured events,
thus altering the
timing in a significant way.
</p>
<p>If cuEventRecord() has not been called
on either event then CUDA_ERROR_INVALID_HANDLE is returned. If
cuEventRecord() has been called on both events but one or both of them
has not yet been completed (that is, cuEventQuery() would return
CUDA_ERROR_NOT_READY on at least one of the events), CUDA_ERROR_NOT_READY
is returned. If either event was created with the CU_EVENT_DISABLE_TIMING
flag, then this function will return CUDA_ERROR_INVALID_HANDLE.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pMilliseconds Time between hStart and hEnd in ms
@param hStart Starting event
@param hEnd Ending event
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE,
CUDA_ERROR_NOT_READY
@see JCudaDriver#cuEventCreate
@see JCudaDriver#cuEventRecord
@see JCudaDriver#cuEventQuery
@see JCudaDriver#cuEventSynchronize
@see JCudaDriver#cuEventDestroy
"""
return checkResult(cuEventElapsedTimeNative(pMilliseconds, hStart, hEnd));
} | java | public static int cuEventElapsedTime(float pMilliseconds[], CUevent hStart, CUevent hEnd)
{
return checkResult(cuEventElapsedTimeNative(pMilliseconds, hStart, hEnd));
} | [
"public",
"static",
"int",
"cuEventElapsedTime",
"(",
"float",
"pMilliseconds",
"[",
"]",
",",
"CUevent",
"hStart",
",",
"CUevent",
"hEnd",
")",
"{",
"return",
"checkResult",
"(",
"cuEventElapsedTimeNative",
"(",
"pMilliseconds",
",",
"hStart",
",",
"hEnd",
")",... | Computes the elapsed time between two events.
<pre>
CUresult cuEventElapsedTime (
float* pMilliseconds,
CUevent hStart,
CUevent hEnd )
</pre>
<div>
<p>Computes the elapsed time between two
events. Computes the elapsed time between two events (in milliseconds
with a resolution
of around 0.5 microseconds).
</p>
<p>If either event was last recorded in a
non-NULL stream, the resulting time may be greater than expected (even
if both used
the same stream handle). This happens
because the cuEventRecord() operation takes place asynchronously and
there is no guarantee that the measured latency is actually just
between the two
events. Any number of other different
stream operations could execute in between the two measured events,
thus altering the
timing in a significant way.
</p>
<p>If cuEventRecord() has not been called
on either event then CUDA_ERROR_INVALID_HANDLE is returned. If
cuEventRecord() has been called on both events but one or both of them
has not yet been completed (that is, cuEventQuery() would return
CUDA_ERROR_NOT_READY on at least one of the events), CUDA_ERROR_NOT_READY
is returned. If either event was created with the CU_EVENT_DISABLE_TIMING
flag, then this function will return CUDA_ERROR_INVALID_HANDLE.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pMilliseconds Time between hStart and hEnd in ms
@param hStart Starting event
@param hEnd Ending event
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_HANDLE,
CUDA_ERROR_NOT_READY
@see JCudaDriver#cuEventCreate
@see JCudaDriver#cuEventRecord
@see JCudaDriver#cuEventQuery
@see JCudaDriver#cuEventSynchronize
@see JCudaDriver#cuEventDestroy | [
"Computes",
"the",
"elapsed",
"time",
"between",
"two",
"events",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13657-L13660 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHMessages.java | XPATHMessages.createXPATHMessage | public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception {
"""
Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted message string.
"""
// BEGIN android-changed
// don't localize exception messages
return createXPATHMsg(XPATHBundle, msgKey, args);
// END android-changed
} | java | public static final String createXPATHMessage(String msgKey, Object args[]) //throws Exception
{
// BEGIN android-changed
// don't localize exception messages
return createXPATHMsg(XPATHBundle, msgKey, args);
// END android-changed
} | [
"public",
"static",
"final",
"String",
"createXPATHMessage",
"(",
"String",
"msgKey",
",",
"Object",
"args",
"[",
"]",
")",
"//throws Exception ",
"{",
"// BEGIN android-changed",
"// don't localize exception messages",
"return",
"createXPATHMsg",
"(",
"XPATHBundle",
... | Creates a message from the specified key and replacement
arguments, localized to the given locale.
@param msgKey The key for the message text.
@param args The arguments to be used as replacement text
in the message created.
@return The formatted message string. | [
"Creates",
"a",
"message",
"from",
"the",
"specified",
"key",
"and",
"replacement",
"arguments",
"localized",
"to",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/res/XPATHMessages.java#L50-L56 |
icode/ameba | src/main/java/ameba/core/ws/rs/ParamConverters.java | ParamConverters.parseDate | public static Date parseDate(String value, ParsePosition pos) {
"""
<p>parseDate.</p>
@param value a {@link java.lang.String} object.
@param pos a {@link java.text.ParsePosition} object.
@return a {@link java.util.Date} object.
"""
Long timestamp = parseTimestamp(value);
if (timestamp != null) {
return new Date(timestamp);
}
if (value.contains(" ")) {
value = value.replace(" ", "+");
}
if (!(value.contains("-") || value.contains("+")) && !value.endsWith("Z")) {
value += SYS_TZ;
}
try {
return ISO8601Utils.parse(value, pos);
} catch (ParseException e) {
throw new ExtractorException(e);
}
} | java | public static Date parseDate(String value, ParsePosition pos) {
Long timestamp = parseTimestamp(value);
if (timestamp != null) {
return new Date(timestamp);
}
if (value.contains(" ")) {
value = value.replace(" ", "+");
}
if (!(value.contains("-") || value.contains("+")) && !value.endsWith("Z")) {
value += SYS_TZ;
}
try {
return ISO8601Utils.parse(value, pos);
} catch (ParseException e) {
throw new ExtractorException(e);
}
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"String",
"value",
",",
"ParsePosition",
"pos",
")",
"{",
"Long",
"timestamp",
"=",
"parseTimestamp",
"(",
"value",
")",
";",
"if",
"(",
"timestamp",
"!=",
"null",
")",
"{",
"return",
"new",
"Date",
"(",
"tim... | <p>parseDate.</p>
@param value a {@link java.lang.String} object.
@param pos a {@link java.text.ParsePosition} object.
@return a {@link java.util.Date} object. | [
"<p",
">",
"parseDate",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/ws/rs/ParamConverters.java#L76-L92 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/ValidationUtils.java | ValidationUtils.buildValueMismatchErrorMessage | public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) {
"""
Constructs proper error message with expected value and actual value.
@param baseMessage the base error message.
@param controlValue the expected value.
@param actualValue the actual value.
@return
"""
return baseMessage + ", expected '" + controlValue + "' but was '" + actualValue + "'";
} | java | public static String buildValueMismatchErrorMessage(String baseMessage, Object controlValue, Object actualValue) {
return baseMessage + ", expected '" + controlValue + "' but was '" + actualValue + "'";
} | [
"public",
"static",
"String",
"buildValueMismatchErrorMessage",
"(",
"String",
"baseMessage",
",",
"Object",
"controlValue",
",",
"Object",
"actualValue",
")",
"{",
"return",
"baseMessage",
"+",
"\", expected '\"",
"+",
"controlValue",
"+",
"\"' but was '\"",
"+",
"ac... | Constructs proper error message with expected value and actual value.
@param baseMessage the base error message.
@param controlValue the expected value.
@param actualValue the actual value.
@return | [
"Constructs",
"proper",
"error",
"message",
"with",
"expected",
"value",
"and",
"actual",
"value",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/ValidationUtils.java#L155-L157 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.row | private static int row(int[] r, int f) {
"""
Returns the index of given frequency.
@param r the frequency list.
@param f the given frequency.
@return the index of given frequency or -1 if it doesn't exist in the list.
"""
int i = 0;
while (i < r.length && r[i] < f) {
++i;
}
return ((i < r.length && r[i] == f) ? i : -1);
} | java | private static int row(int[] r, int f) {
int i = 0;
while (i < r.length && r[i] < f) {
++i;
}
return ((i < r.length && r[i] == f) ? i : -1);
} | [
"private",
"static",
"int",
"row",
"(",
"int",
"[",
"]",
"r",
",",
"int",
"f",
")",
"{",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"r",
".",
"length",
"&&",
"r",
"[",
"i",
"]",
"<",
"f",
")",
"{",
"++",
"i",
";",
"}",
"return",
... | Returns the index of given frequency.
@param r the frequency list.
@param f the given frequency.
@return the index of given frequency or -1 if it doesn't exist in the list. | [
"Returns",
"the",
"index",
"of",
"given",
"frequency",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L3258-L3266 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java | AbstractUserTaskBuilder.camundaFormField | public CamundaUserTaskFormFieldBuilder camundaFormField() {
"""
Creates a new camunda form field extension element.
@return the builder object
"""
CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
return new CamundaUserTaskFormFieldBuilder(modelInstance, element, camundaFormField);
} | java | public CamundaUserTaskFormFieldBuilder camundaFormField() {
CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
return new CamundaUserTaskFormFieldBuilder(modelInstance, element, camundaFormField);
} | [
"public",
"CamundaUserTaskFormFieldBuilder",
"camundaFormField",
"(",
")",
"{",
"CamundaFormData",
"camundaFormData",
"=",
"getCreateSingleExtensionElement",
"(",
"CamundaFormData",
".",
"class",
")",
";",
"CamundaFormField",
"camundaFormField",
"=",
"createChild",
"(",
"ca... | Creates a new camunda form field extension element.
@return the builder object | [
"Creates",
"a",
"new",
"camunda",
"form",
"field",
"extension",
"element",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractUserTaskBuilder.java#L176-L180 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java | SshConnectionImpl.executeCommandChannel | @Override
public ChannelExec executeCommandChannel(String command) throws SshException, IOException {
"""
This version takes a command to run, and then returns a wrapper instance
that exposes all the standard state of the channel (stdin, stdout,
stderr, exit status, etc).
@param command the command to execute.
@return a Channel with access to all streams and the exit code.
@throws IOException if it is so.
@throws SshException if there are any ssh problems.
@see #executeCommandReader(String)
"""
return executeCommandChannel(command, true);
} | java | @Override
public ChannelExec executeCommandChannel(String command) throws SshException, IOException {
return executeCommandChannel(command, true);
} | [
"@",
"Override",
"public",
"ChannelExec",
"executeCommandChannel",
"(",
"String",
"command",
")",
"throws",
"SshException",
",",
"IOException",
"{",
"return",
"executeCommandChannel",
"(",
"command",
",",
"true",
")",
";",
"}"
] | This version takes a command to run, and then returns a wrapper instance
that exposes all the standard state of the channel (stdin, stdout,
stderr, exit status, etc).
@param command the command to execute.
@return a Channel with access to all streams and the exit code.
@throws IOException if it is so.
@throws SshException if there are any ssh problems.
@see #executeCommandReader(String) | [
"This",
"version",
"takes",
"a",
"command",
"to",
"run",
"and",
"then",
"returns",
"a",
"wrapper",
"instance",
"that",
"exposes",
"all",
"the",
"standard",
"state",
"of",
"the",
"channel",
"(",
"stdin",
"stdout",
"stderr",
"exit",
"status",
"etc",
")",
"."... | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L356-L359 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussRepliesApi.java | GroupsDiscussRepliesApi.getInfo | public ReplyInfo getInfo(String topicId, String replyId) throws JinxException {
"""
Get information on a group topic reply.
<br>
@param topicId (Required) The ID of the topic the post is in.
@param replyId (Required) The ID of the reply to fetch.
@return reply information.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.replies.getInfo.html">flickr.groups.discuss.replies.getInfo</a>
"""
JinxUtils.validateParams(topicId, replyId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.replies.getInfo");
params.put("topic_id", topicId);
params.put("reply_id", replyId);
return jinx.flickrGet(params, ReplyInfo.class);
} | java | public ReplyInfo getInfo(String topicId, String replyId) throws JinxException {
JinxUtils.validateParams(topicId, replyId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.groups.discuss.replies.getInfo");
params.put("topic_id", topicId);
params.put("reply_id", replyId);
return jinx.flickrGet(params, ReplyInfo.class);
} | [
"public",
"ReplyInfo",
"getInfo",
"(",
"String",
"topicId",
",",
"String",
"replyId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"topicId",
",",
"replyId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
... | Get information on a group topic reply.
<br>
@param topicId (Required) The ID of the topic the post is in.
@param replyId (Required) The ID of the reply to fetch.
@return reply information.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.replies.getInfo.html">flickr.groups.discuss.replies.getInfo</a> | [
"Get",
"information",
"on",
"a",
"group",
"topic",
"reply",
".",
"<br",
">"
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussRepliesApi.java#L115-L122 |
ehcache/ehcache3 | core/src/main/java/org/ehcache/core/exceptions/ExceptionFactory.java | ExceptionFactory.newCacheLoadingException | public static CacheLoadingException newCacheLoadingException(Exception e, Exception suppressed) {
"""
Creates a new {@code CacheLoadingException} with the provided exception as cause and a suppressed one.
@param e the cause
@param suppressed the suppressed exception to add to the new exception
@return a cache loading exception
"""
CacheLoadingException ne = new CacheLoadingException(e);
ne.addSuppressed(e);
return ne;
} | java | public static CacheLoadingException newCacheLoadingException(Exception e, Exception suppressed) {
CacheLoadingException ne = new CacheLoadingException(e);
ne.addSuppressed(e);
return ne;
} | [
"public",
"static",
"CacheLoadingException",
"newCacheLoadingException",
"(",
"Exception",
"e",
",",
"Exception",
"suppressed",
")",
"{",
"CacheLoadingException",
"ne",
"=",
"new",
"CacheLoadingException",
"(",
"e",
")",
";",
"ne",
".",
"addSuppressed",
"(",
"e",
... | Creates a new {@code CacheLoadingException} with the provided exception as cause and a suppressed one.
@param e the cause
@param suppressed the suppressed exception to add to the new exception
@return a cache loading exception | [
"Creates",
"a",
"new",
"{",
"@code",
"CacheLoadingException",
"}",
"with",
"the",
"provided",
"exception",
"as",
"cause",
"and",
"a",
"suppressed",
"one",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/exceptions/ExceptionFactory.java#L71-L75 |
wildfly/wildfly-core | jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java | ObjectNameAddressUtil.createObjectName | static ObjectName createObjectName(final String domain, final PathAddress pathAddress) {
"""
Creates an ObjectName representation of a {@link PathAddress}.
@param domain the JMX domain to use for the ObjectName. Cannot be {@code null}
@param pathAddress the address. Cannot be {@code null}
@return the ObjectName. Will not return {@code null}
"""
return createObjectName(domain, pathAddress, null);
} | java | static ObjectName createObjectName(final String domain, final PathAddress pathAddress) {
return createObjectName(domain, pathAddress, null);
} | [
"static",
"ObjectName",
"createObjectName",
"(",
"final",
"String",
"domain",
",",
"final",
"PathAddress",
"pathAddress",
")",
"{",
"return",
"createObjectName",
"(",
"domain",
",",
"pathAddress",
",",
"null",
")",
";",
"}"
] | Creates an ObjectName representation of a {@link PathAddress}.
@param domain the JMX domain to use for the ObjectName. Cannot be {@code null}
@param pathAddress the address. Cannot be {@code null}
@return the ObjectName. Will not return {@code null} | [
"Creates",
"an",
"ObjectName",
"representation",
"of",
"a",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java#L135-L137 |
Red5/red5-io | src/main/java/org/red5/io/matroska/VINT.java | VINT.fromValue | public static VINT fromValue(long value) {
"""
method to construct {@link VINT} based on its value
@param value
- value of {@link VINT}
@return {@link VINT} corresponding to this value
"""
BitSet bs = BitSet.valueOf(new long[] { value });
byte length = (byte) (1 + bs.length() / BIT_IN_BYTE);
if (bs.length() == length * BIT_IN_BYTE) {
length++;
}
bs.set(length * BIT_IN_BYTE - length);
long binary = bs.toLongArray()[0];
return new VINT(binary, length, value);
} | java | public static VINT fromValue(long value) {
BitSet bs = BitSet.valueOf(new long[] { value });
byte length = (byte) (1 + bs.length() / BIT_IN_BYTE);
if (bs.length() == length * BIT_IN_BYTE) {
length++;
}
bs.set(length * BIT_IN_BYTE - length);
long binary = bs.toLongArray()[0];
return new VINT(binary, length, value);
} | [
"public",
"static",
"VINT",
"fromValue",
"(",
"long",
"value",
")",
"{",
"BitSet",
"bs",
"=",
"BitSet",
".",
"valueOf",
"(",
"new",
"long",
"[",
"]",
"{",
"value",
"}",
")",
";",
"byte",
"length",
"=",
"(",
"byte",
")",
"(",
"1",
"+",
"bs",
".",
... | method to construct {@link VINT} based on its value
@param value
- value of {@link VINT}
@return {@link VINT} corresponding to this value | [
"method",
"to",
"construct",
"{",
"@link",
"VINT",
"}",
"based",
"on",
"its",
"value"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/VINT.java#L144-L153 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/PhoneIntents.java | PhoneIntents.newSmsIntent | public static Intent newSmsIntent(Context context, String body) {
"""
Creates an intent that will allow to send an SMS without specifying the phone number
@param body The text to send
@return the intent
"""
return newSmsIntent(context, body, (String[]) null);
} | java | public static Intent newSmsIntent(Context context, String body) {
return newSmsIntent(context, body, (String[]) null);
} | [
"public",
"static",
"Intent",
"newSmsIntent",
"(",
"Context",
"context",
",",
"String",
"body",
")",
"{",
"return",
"newSmsIntent",
"(",
"context",
",",
"body",
",",
"(",
"String",
"[",
"]",
")",
"null",
")",
";",
"}"
] | Creates an intent that will allow to send an SMS without specifying the phone number
@param body The text to send
@return the intent | [
"Creates",
"an",
"intent",
"that",
"will",
"allow",
"to",
"send",
"an",
"SMS",
"without",
"specifying",
"the",
"phone",
"number"
] | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L71-L73 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.rotateAffine | public Matrix4d rotateAffine(Quaternionfc quat, Matrix4d dest) {
"""
Apply the rotation - and possibly scaling - transformation of the given {@link Quaternionfc} to this {@link #isAffine() affine} matrix and store
the result in <code>dest</code>.
<p>
This method assumes <code>this</code> to be {@link #isAffine() affine}.
<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>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying,
use {@link #rotation(Quaternionfc)}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@see #rotation(Quaternionfc)
@param quat
the {@link Quaternionfc}
@param dest
will hold the result
@return dest
"""
double w2 = quat.w() * quat.w();
double x2 = quat.x() * quat.x();
double y2 = quat.y() * quat.y();
double z2 = quat.z() * quat.z();
double zw = quat.z() * quat.w();
double xy = quat.x() * quat.y();
double xz = quat.x() * quat.z();
double yw = quat.y() * quat.w();
double yz = quat.y() * quat.z();
double xw = quat.x() * quat.w();
double rm00 = w2 + x2 - z2 - y2;
double rm01 = xy + zw + zw + xy;
double rm02 = xz - yw + xz - yw;
double rm10 = -zw + xy - zw + xy;
double rm11 = y2 - z2 + w2 - x2;
double rm12 = yz + yz + xw + xw;
double rm20 = yw + xz + xz + yw;
double rm21 = yz + yz - xw - xw;
double rm22 = z2 - y2 - x2 + w2;
double nm00 = m00 * rm00 + m10 * rm01 + m20 * rm02;
double nm01 = m01 * rm00 + m11 * rm01 + m21 * rm02;
double nm02 = m02 * rm00 + m12 * rm01 + m22 * rm02;
double nm10 = m00 * rm10 + m10 * rm11 + m20 * rm12;
double nm11 = m01 * rm10 + m11 * rm11 + m21 * rm12;
double nm12 = m02 * rm10 + m12 * rm11 + m22 * rm12;
dest.m20 = m00 * rm20 + m10 * rm21 + m20 * rm22;
dest.m21 = m01 * rm20 + m11 * rm21 + m21 * rm22;
dest.m22 = m02 * rm20 + m12 * rm21 + m22 * rm22;
dest.m23 = 0.0;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m03 = 0.0;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m13 = 0.0;
dest.m30 = m30;
dest.m31 = m31;
dest.m32 = m32;
dest.m33 = m33;
dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | java | public Matrix4d rotateAffine(Quaternionfc quat, Matrix4d dest) {
double w2 = quat.w() * quat.w();
double x2 = quat.x() * quat.x();
double y2 = quat.y() * quat.y();
double z2 = quat.z() * quat.z();
double zw = quat.z() * quat.w();
double xy = quat.x() * quat.y();
double xz = quat.x() * quat.z();
double yw = quat.y() * quat.w();
double yz = quat.y() * quat.z();
double xw = quat.x() * quat.w();
double rm00 = w2 + x2 - z2 - y2;
double rm01 = xy + zw + zw + xy;
double rm02 = xz - yw + xz - yw;
double rm10 = -zw + xy - zw + xy;
double rm11 = y2 - z2 + w2 - x2;
double rm12 = yz + yz + xw + xw;
double rm20 = yw + xz + xz + yw;
double rm21 = yz + yz - xw - xw;
double rm22 = z2 - y2 - x2 + w2;
double nm00 = m00 * rm00 + m10 * rm01 + m20 * rm02;
double nm01 = m01 * rm00 + m11 * rm01 + m21 * rm02;
double nm02 = m02 * rm00 + m12 * rm01 + m22 * rm02;
double nm10 = m00 * rm10 + m10 * rm11 + m20 * rm12;
double nm11 = m01 * rm10 + m11 * rm11 + m21 * rm12;
double nm12 = m02 * rm10 + m12 * rm11 + m22 * rm12;
dest.m20 = m00 * rm20 + m10 * rm21 + m20 * rm22;
dest.m21 = m01 * rm20 + m11 * rm21 + m21 * rm22;
dest.m22 = m02 * rm20 + m12 * rm21 + m22 * rm22;
dest.m23 = 0.0;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = nm02;
dest.m03 = 0.0;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = nm12;
dest.m13 = 0.0;
dest.m30 = m30;
dest.m31 = m31;
dest.m32 = m32;
dest.m33 = m33;
dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | [
"public",
"Matrix4d",
"rotateAffine",
"(",
"Quaternionfc",
"quat",
",",
"Matrix4d",
"dest",
")",
"{",
"double",
"w2",
"=",
"quat",
".",
"w",
"(",
")",
"*",
"quat",
".",
"w",
"(",
")",
";",
"double",
"x2",
"=",
"quat",
".",
"x",
"(",
")",
"*",
"qu... | Apply the rotation - and possibly scaling - transformation of the given {@link Quaternionfc} to this {@link #isAffine() affine} matrix and store
the result in <code>dest</code>.
<p>
This method assumes <code>this</code> to be {@link #isAffine() affine}.
<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>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying,
use {@link #rotation(Quaternionfc)}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@see #rotation(Quaternionfc)
@param quat
the {@link Quaternionfc}
@param dest
will hold the result
@return dest | [
"Apply",
"the",
"rotation",
"-",
"and",
"possibly",
"scaling",
"-",
"transformation",
"of",
"the",
"given",
"{",
"@link",
"Quaternionfc",
"}",
"to",
"this",
"{",
"@link",
"#isAffine",
"()",
"affine",
"}",
"matrix",
"and",
"store",
"the",
"result",
"in",
"<... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L8133-L8177 |
pac4j/pac4j | pac4j-http/src/main/java/org/pac4j/http/credentials/DigestCredentials.java | DigestCredentials.calculateServerDigest | public String calculateServerDigest(boolean passwordAlreadyEncoded, String password) {
"""
This calculates the server digest value based on user stored password. If the server stores password in clear format
then passwordAlreadyEncoded should be false. If the server stores the password in ha1, digest then the
passwordAlreadyEncoded should be true.
@param passwordAlreadyEncoded false if the server stored password is in clear, true otherwise
@param password user password stored server-side
@return digest value. This value must match the client "response" value in the Authorization http header
for a successful digest authentication
"""
return generateDigest(passwordAlreadyEncoded, username,
realm, password, httpMethod, uri, qop, nonce, nc, cnonce);
} | java | public String calculateServerDigest(boolean passwordAlreadyEncoded, String password) {
return generateDigest(passwordAlreadyEncoded, username,
realm, password, httpMethod, uri, qop, nonce, nc, cnonce);
} | [
"public",
"String",
"calculateServerDigest",
"(",
"boolean",
"passwordAlreadyEncoded",
",",
"String",
"password",
")",
"{",
"return",
"generateDigest",
"(",
"passwordAlreadyEncoded",
",",
"username",
",",
"realm",
",",
"password",
",",
"httpMethod",
",",
"uri",
",",... | This calculates the server digest value based on user stored password. If the server stores password in clear format
then passwordAlreadyEncoded should be false. If the server stores the password in ha1, digest then the
passwordAlreadyEncoded should be true.
@param passwordAlreadyEncoded false if the server stored password is in clear, true otherwise
@param password user password stored server-side
@return digest value. This value must match the client "response" value in the Authorization http header
for a successful digest authentication | [
"This",
"calculates",
"the",
"server",
"digest",
"value",
"based",
"on",
"user",
"stored",
"password",
".",
"If",
"the",
"server",
"stores",
"password",
"in",
"clear",
"format",
"then",
"passwordAlreadyEncoded",
"should",
"be",
"false",
".",
"If",
"the",
"serv... | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-http/src/main/java/org/pac4j/http/credentials/DigestCredentials.java#L68-L71 |
agmip/ace-lookup | src/main/java/org/agmip/ace/util/AcePathfinderUtil.java | AcePathfinderUtil.insertValue | public static void insertValue(HashMap m, String var, String val) {
"""
Inserts the variable in the appropriate place in a {@link HashMap},
according to the AcePathfinder.
@param m the HashMap to add the variable to.
@param var Variable to lookup
@param val the value to insert into the HashMap
"""
insertValue(m, var, val, null);
} | java | public static void insertValue(HashMap m, String var, String val) {
insertValue(m, var, val, null);
} | [
"public",
"static",
"void",
"insertValue",
"(",
"HashMap",
"m",
",",
"String",
"var",
",",
"String",
"val",
")",
"{",
"insertValue",
"(",
"m",
",",
"var",
",",
"val",
",",
"null",
")",
";",
"}"
] | Inserts the variable in the appropriate place in a {@link HashMap},
according to the AcePathfinder.
@param m the HashMap to add the variable to.
@param var Variable to lookup
@param val the value to insert into the HashMap | [
"Inserts",
"the",
"variable",
"in",
"the",
"appropriate",
"place",
"in",
"a",
"{",
"@link",
"HashMap",
"}",
"according",
"to",
"the",
"AcePathfinder",
"."
] | train | https://github.com/agmip/ace-lookup/blob/d8224a231cb8c01729e63010916a2a85517ce4c1/src/main/java/org/agmip/ace/util/AcePathfinderUtil.java#L90-L92 |
Azure/azure-sdk-for-java | keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java | VaultsInner.purgeDeletedAsync | public Observable<Void> purgeDeletedAsync(String vaultName, String location) {
"""
Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
@param vaultName The name of the soft-deleted vault.
@param location The location of the soft-deleted vault.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return purgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> purgeDeletedAsync(String vaultName, String location) {
return purgeDeletedWithServiceResponseAsync(vaultName, location).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"purgeDeletedAsync",
"(",
"String",
"vaultName",
",",
"String",
"location",
")",
"{",
"return",
"purgeDeletedWithServiceResponseAsync",
"(",
"vaultName",
",",
"location",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"Servi... | Permanently deletes the specified vault. aka Purges the deleted Azure key vault.
@param vaultName The name of the soft-deleted vault.
@param location The location of the soft-deleted vault.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Permanently",
"deletes",
"the",
"specified",
"vault",
".",
"aka",
"Purges",
"the",
"deleted",
"Azure",
"key",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L1278-L1285 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java | LocalNetworkGatewaysInner.createOrUpdateAsync | public Observable<LocalNetworkGatewayInner> createOrUpdateAsync(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
"""
Creates or updates a local network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param parameters Parameters supplied to the create or update local network gateway operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() {
@Override
public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<LocalNetworkGatewayInner> createOrUpdateAsync(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).map(new Func1<ServiceResponse<LocalNetworkGatewayInner>, LocalNetworkGatewayInner>() {
@Override
public LocalNetworkGatewayInner call(ServiceResponse<LocalNetworkGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LocalNetworkGatewayInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"localNetworkGatewayName",
",",
"LocalNetworkGatewayInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates a local network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param parameters Parameters supplied to the create or update local network gateway operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"local",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L145-L152 |
google/closure-compiler | src/com/google/javascript/jscomp/JSModuleGraph.java | JSModuleGraph.getDeepestCommonDependency | JSModule getDeepestCommonDependency(JSModule m1, JSModule m2) {
"""
Finds the deepest common dependency of two modules, not including the two
modules themselves.
@param m1 A module in this graph
@param m2 A module in this graph
@return The deepest common dep of {@code m1} and {@code m2}, or null if
they have no common dependencies
"""
int m1Depth = m1.getDepth();
int m2Depth = m2.getDepth();
// According our definition of depth, the result must have a strictly
// smaller depth than either m1 or m2.
for (int depth = Math.min(m1Depth, m2Depth) - 1; depth >= 0; depth--) {
List<JSModule> modulesAtDepth = modulesByDepth.get(depth);
// Look at the modules at this depth in reverse order, so that we use the
// original ordering of the modules to break ties (later meaning deeper).
for (int i = modulesAtDepth.size() - 1; i >= 0; i--) {
JSModule m = modulesAtDepth.get(i);
if (dependsOn(m1, m) && dependsOn(m2, m)) {
return m;
}
}
}
return null;
} | java | JSModule getDeepestCommonDependency(JSModule m1, JSModule m2) {
int m1Depth = m1.getDepth();
int m2Depth = m2.getDepth();
// According our definition of depth, the result must have a strictly
// smaller depth than either m1 or m2.
for (int depth = Math.min(m1Depth, m2Depth) - 1; depth >= 0; depth--) {
List<JSModule> modulesAtDepth = modulesByDepth.get(depth);
// Look at the modules at this depth in reverse order, so that we use the
// original ordering of the modules to break ties (later meaning deeper).
for (int i = modulesAtDepth.size() - 1; i >= 0; i--) {
JSModule m = modulesAtDepth.get(i);
if (dependsOn(m1, m) && dependsOn(m2, m)) {
return m;
}
}
}
return null;
} | [
"JSModule",
"getDeepestCommonDependency",
"(",
"JSModule",
"m1",
",",
"JSModule",
"m2",
")",
"{",
"int",
"m1Depth",
"=",
"m1",
".",
"getDepth",
"(",
")",
";",
"int",
"m2Depth",
"=",
"m2",
".",
"getDepth",
"(",
")",
";",
"// According our definition of depth, t... | Finds the deepest common dependency of two modules, not including the two
modules themselves.
@param m1 A module in this graph
@param m2 A module in this graph
@return The deepest common dep of {@code m1} and {@code m2}, or null if
they have no common dependencies | [
"Finds",
"the",
"deepest",
"common",
"dependency",
"of",
"two",
"modules",
"not",
"including",
"the",
"two",
"modules",
"themselves",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JSModuleGraph.java#L406-L423 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/handlers/DefaultFilenameTabCompleter.java | DefaultFilenameTabCompleter.completeCandidates | @Override
void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
"""
The only supported syntax at command execution is fully quoted, e.g.:
"/My Files\..." or not quoted at all. Completion supports only these 2
syntaxes.
"""
boolean quoted = buffer.startsWith("\"");
if (candidates.size() == 1) {
// Escaping must occur in all cases.
// if quoted, only " will be escaped.
EscapeSelector escSelector = quoted
? QUOTES_ONLY_ESCAPE_SELECTOR : ESCAPE_SELECTOR;
candidates.set(0, Util.escapeString(candidates.get(0), escSelector));
}
} | java | @Override
void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
boolean quoted = buffer.startsWith("\"");
if (candidates.size() == 1) {
// Escaping must occur in all cases.
// if quoted, only " will be escaped.
EscapeSelector escSelector = quoted
? QUOTES_ONLY_ESCAPE_SELECTOR : ESCAPE_SELECTOR;
candidates.set(0, Util.escapeString(candidates.get(0), escSelector));
}
} | [
"@",
"Override",
"void",
"completeCandidates",
"(",
"CommandContext",
"ctx",
",",
"String",
"buffer",
",",
"int",
"cursor",
",",
"List",
"<",
"String",
">",
"candidates",
")",
"{",
"boolean",
"quoted",
"=",
"buffer",
".",
"startsWith",
"(",
"\"\\\"\"",
")",
... | The only supported syntax at command execution is fully quoted, e.g.:
"/My Files\..." or not quoted at all. Completion supports only these 2
syntaxes. | [
"The",
"only",
"supported",
"syntax",
"at",
"command",
"execution",
"is",
"fully",
"quoted",
"e",
".",
"g",
".",
":",
"/",
"My",
"Files",
"\\",
"...",
"or",
"not",
"quoted",
"at",
"all",
".",
"Completion",
"supports",
"only",
"these",
"2",
"syntaxes",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/DefaultFilenameTabCompleter.java#L59-L69 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.returnField | public static Object returnField(Object object, String fieldName) throws MjdbcException {
"""
Returns class field value
Is used to return Constants
@param object Class field of which would be returned
@param fieldName field name
@return field value
@throws org.midao.jdbc.core.exception.MjdbcException if field is not present or access is prohibited
"""
AssertUtils.assertNotNull(object);
Object result = null;
Field field = null;
try {
field = object.getClass().getField(fieldName);
result = field.get(object);
} catch (NoSuchFieldException ex) {
throw new MjdbcException(ex);
} catch (IllegalAccessException ex) {
throw new MjdbcException(ex);
}
return result;
} | java | public static Object returnField(Object object, String fieldName) throws MjdbcException {
AssertUtils.assertNotNull(object);
Object result = null;
Field field = null;
try {
field = object.getClass().getField(fieldName);
result = field.get(object);
} catch (NoSuchFieldException ex) {
throw new MjdbcException(ex);
} catch (IllegalAccessException ex) {
throw new MjdbcException(ex);
}
return result;
} | [
"public",
"static",
"Object",
"returnField",
"(",
"Object",
"object",
",",
"String",
"fieldName",
")",
"throws",
"MjdbcException",
"{",
"AssertUtils",
".",
"assertNotNull",
"(",
"object",
")",
";",
"Object",
"result",
"=",
"null",
";",
"Field",
"field",
"=",
... | Returns class field value
Is used to return Constants
@param object Class field of which would be returned
@param fieldName field name
@return field value
@throws org.midao.jdbc.core.exception.MjdbcException if field is not present or access is prohibited | [
"Returns",
"class",
"field",
"value",
"Is",
"used",
"to",
"return",
"Constants"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L451-L467 |
lightbend/config | config/src/main/java/com/typesafe/config/ConfigRenderOptions.java | ConfigRenderOptions.setJson | public ConfigRenderOptions setJson(boolean value) {
"""
Returns options with JSON toggled. JSON means that HOCON extensions
(omitting commas, quotes for example) won't be used. However, whether to
use comments is controlled by the separate {@link #setComments(boolean)}
and {@link #setOriginComments(boolean)} options. So if you enable
comments you will get invalid JSON despite setting this to true.
@param value
true to include non-JSON extensions in the render
@return options with requested setting for JSON
"""
if (value == json)
return this;
else
return new ConfigRenderOptions(originComments, comments, formatted, value);
} | java | public ConfigRenderOptions setJson(boolean value) {
if (value == json)
return this;
else
return new ConfigRenderOptions(originComments, comments, formatted, value);
} | [
"public",
"ConfigRenderOptions",
"setJson",
"(",
"boolean",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"json",
")",
"return",
"this",
";",
"else",
"return",
"new",
"ConfigRenderOptions",
"(",
"originComments",
",",
"comments",
",",
"formatted",
",",
"value",... | Returns options with JSON toggled. JSON means that HOCON extensions
(omitting commas, quotes for example) won't be used. However, whether to
use comments is controlled by the separate {@link #setComments(boolean)}
and {@link #setOriginComments(boolean)} options. So if you enable
comments you will get invalid JSON despite setting this to true.
@param value
true to include non-JSON extensions in the render
@return options with requested setting for JSON | [
"Returns",
"options",
"with",
"JSON",
"toggled",
".",
"JSON",
"means",
"that",
"HOCON",
"extensions",
"(",
"omitting",
"commas",
"quotes",
"for",
"example",
")",
"won",
"t",
"be",
"used",
".",
"However",
"whether",
"to",
"use",
"comments",
"is",
"controlled"... | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigRenderOptions.java#L149-L154 |
square/spoon | spoon-runner/src/main/java/com/squareup/spoon/misc/StackTrace.java | StackTrace.from | public static StackTrace from(Throwable exception) {
"""
Convert a {@link Throwable} to its equivalent {@link StackTrace}.
"""
checkNotNull(exception);
StackTrace cause = null;
Throwable realCause = exception.getCause();
if (realCause != null && realCause != exception) {
cause = from(realCause);
}
Deque<Element> elements = new ArrayDeque<>();
for (StackTraceElement element : exception.getStackTrace()) {
elements.add(Element.from(element));
}
String className = exception.getClass().getCanonicalName();
String message = exception.getMessage();
return new StackTrace(className, message, elements, cause);
} | java | public static StackTrace from(Throwable exception) {
checkNotNull(exception);
StackTrace cause = null;
Throwable realCause = exception.getCause();
if (realCause != null && realCause != exception) {
cause = from(realCause);
}
Deque<Element> elements = new ArrayDeque<>();
for (StackTraceElement element : exception.getStackTrace()) {
elements.add(Element.from(element));
}
String className = exception.getClass().getCanonicalName();
String message = exception.getMessage();
return new StackTrace(className, message, elements, cause);
} | [
"public",
"static",
"StackTrace",
"from",
"(",
"Throwable",
"exception",
")",
"{",
"checkNotNull",
"(",
"exception",
")",
";",
"StackTrace",
"cause",
"=",
"null",
";",
"Throwable",
"realCause",
"=",
"exception",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"... | Convert a {@link Throwable} to its equivalent {@link StackTrace}. | [
"Convert",
"a",
"{"
] | train | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/misc/StackTrace.java#L21-L38 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java | FlowControllerFactory.getPageFlowForRequest | public static PageFlowController getPageFlowForRequest( HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext ) {
"""
Get the page flow instance that should be associated with the given request. If it doesn't exist, create it.
If one is created, the page flow stack (for nesting) will be cleared or pushed, and the new instance will be
stored as the current page flow.
@deprecated Use {@link #getPageFlowForRequest(RequestContext)} instead.
@param request the current HttpServletRequest.
@param response the current HttpServletResponse.
@param servletContext the current ServletContext.
@return the {@link PageFlowController} for the request, or <code>null</code> if none was found.
"""
return getPageFlowForRelativeURI( request, response, InternalUtils.getDecodedServletPath( request ), servletContext );
} | java | public static PageFlowController getPageFlowForRequest( HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext )
{
return getPageFlowForRelativeURI( request, response, InternalUtils.getDecodedServletPath( request ), servletContext );
} | [
"public",
"static",
"PageFlowController",
"getPageFlowForRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"ServletContext",
"servletContext",
")",
"{",
"return",
"getPageFlowForRelativeURI",
"(",
"request",
",",
"response",
",",
... | Get the page flow instance that should be associated with the given request. If it doesn't exist, create it.
If one is created, the page flow stack (for nesting) will be cleared or pushed, and the new instance will be
stored as the current page flow.
@deprecated Use {@link #getPageFlowForRequest(RequestContext)} instead.
@param request the current HttpServletRequest.
@param response the current HttpServletResponse.
@param servletContext the current ServletContext.
@return the {@link PageFlowController} for the request, or <code>null</code> if none was found. | [
"Get",
"the",
"page",
"flow",
"instance",
"that",
"should",
"be",
"associated",
"with",
"the",
"given",
"request",
".",
"If",
"it",
"doesn",
"t",
"exist",
"create",
"it",
".",
"If",
"one",
"is",
"created",
"the",
"page",
"flow",
"stack",
"(",
"for",
"n... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java#L567-L572 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java | RegistriesInner.beginUpdatePolicies | public RegistryPoliciesInner beginUpdatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) {
"""
Updates the policies for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryPoliciesUpdateParameters The parameters for updating policies of a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryPoliciesInner object if successful.
"""
return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().single().body();
} | java | public RegistryPoliciesInner beginUpdatePolicies(String resourceGroupName, String registryName, RegistryPoliciesInner registryPoliciesUpdateParameters) {
return beginUpdatePoliciesWithServiceResponseAsync(resourceGroupName, registryName, registryPoliciesUpdateParameters).toBlocking().single().body();
} | [
"public",
"RegistryPoliciesInner",
"beginUpdatePolicies",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RegistryPoliciesInner",
"registryPoliciesUpdateParameters",
")",
"{",
"return",
"beginUpdatePoliciesWithServiceResponseAsync",
"(",
"resourceGroupName"... | Updates the policies for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryPoliciesUpdateParameters The parameters for updating policies of a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryPoliciesInner object if successful. | [
"Updates",
"the",
"policies",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1655-L1657 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java | TransformerIdentityImpl.getOutputProperty | public String getOutputProperty(String name) throws IllegalArgumentException {
"""
Get an output property that is in effect for the
transformation. The property specified may be a property
that was set with setOutputProperty, or it may be a
property specified in the stylesheet.
@param name A non-null String that specifies an output
property name, which may be namespace qualified.
@return The string value of the output property, or null
if no property was found.
@throws IllegalArgumentException If the property is not supported.
@see javax.xml.transform.OutputKeys
"""
String value = null;
OutputProperties props = m_outputFormat;
value = props.getProperty(name);
if (null == value)
{
if (!OutputProperties.isLegalPropertyKey(name))
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: "
// + name);
}
return value;
} | java | public String getOutputProperty(String name) throws IllegalArgumentException
{
String value = null;
OutputProperties props = m_outputFormat;
value = props.getProperty(name);
if (null == value)
{
if (!OutputProperties.isLegalPropertyKey(name))
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{name})); //"output property not recognized: "
// + name);
}
return value;
} | [
"public",
"String",
"getOutputProperty",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"value",
"=",
"null",
";",
"OutputProperties",
"props",
"=",
"m_outputFormat",
";",
"value",
"=",
"props",
".",
"getProperty",
"(",
"name",
... | Get an output property that is in effect for the
transformation. The property specified may be a property
that was set with setOutputProperty, or it may be a
property specified in the stylesheet.
@param name A non-null String that specifies an output
property name, which may be namespace qualified.
@return The string value of the output property, or null
if no property was found.
@throws IllegalArgumentException If the property is not supported.
@see javax.xml.transform.OutputKeys | [
"Get",
"an",
"output",
"property",
"that",
"is",
"in",
"effect",
"for",
"the",
"transformation",
".",
"The",
"property",
"specified",
"may",
"be",
"a",
"property",
"that",
"was",
"set",
"with",
"setOutputProperty",
"or",
"it",
"may",
"be",
"a",
"property",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L762-L778 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java | GenericGenerators.tableSwitch | public static InsnList tableSwitch(InsnList indexInsnList, InsnList defaultInsnList, int caseStartIdx, InsnList... caseInsnLists) {
"""
Generates instructions for a switch table. This does not automatically generate jumps at the end of each default/case statement. It's
your responsibility to either add the relevant jumps, throws, or returns at each default/case statement, otherwise the code will
just fall through (which is likely not what you want).
@param indexInsnList instructions to calculate the index -- must leave an int on the stack
@param defaultInsnList instructions to execute on default statement -- must leave the stack unchanged
@param caseStartIdx the number which the case statements start at
@param caseInsnLists instructions to execute on each case statement -- must leave the stack unchanged
@return instructions for a table switch
@throws NullPointerException if any argument is {@code null} or contains {@code null}
@throws IllegalArgumentException if any numeric argument is {@code < 0}, or if {@code caseInsnLists} is empty
"""
Validate.notNull(defaultInsnList);
Validate.notNull(indexInsnList);
Validate.isTrue(caseStartIdx >= 0);
Validate.notNull(caseInsnLists);
Validate.noNullElements(caseInsnLists);
Validate.isTrue(caseInsnLists.length > 0);
InsnList ret = new InsnList();
LabelNode defaultLabelNode = new LabelNode();
LabelNode[] caseLabelNodes = new LabelNode[caseInsnLists.length];
for (int i = 0; i < caseInsnLists.length; i++) {
caseLabelNodes[i] = new LabelNode();
}
ret.add(indexInsnList);
ret.add(new TableSwitchInsnNode(caseStartIdx, caseStartIdx + caseInsnLists.length - 1, defaultLabelNode, caseLabelNodes));
for (int i = 0; i < caseInsnLists.length; i++) {
LabelNode caseLabelNode = caseLabelNodes[i];
InsnList caseInsnList = caseInsnLists[i];
if (caseInsnList != null) {
ret.add(caseLabelNode);
ret.add(caseInsnList);
}
}
if (defaultInsnList != null) {
ret.add(defaultLabelNode);
ret.add(defaultInsnList);
}
return ret;
} | java | public static InsnList tableSwitch(InsnList indexInsnList, InsnList defaultInsnList, int caseStartIdx, InsnList... caseInsnLists) {
Validate.notNull(defaultInsnList);
Validate.notNull(indexInsnList);
Validate.isTrue(caseStartIdx >= 0);
Validate.notNull(caseInsnLists);
Validate.noNullElements(caseInsnLists);
Validate.isTrue(caseInsnLists.length > 0);
InsnList ret = new InsnList();
LabelNode defaultLabelNode = new LabelNode();
LabelNode[] caseLabelNodes = new LabelNode[caseInsnLists.length];
for (int i = 0; i < caseInsnLists.length; i++) {
caseLabelNodes[i] = new LabelNode();
}
ret.add(indexInsnList);
ret.add(new TableSwitchInsnNode(caseStartIdx, caseStartIdx + caseInsnLists.length - 1, defaultLabelNode, caseLabelNodes));
for (int i = 0; i < caseInsnLists.length; i++) {
LabelNode caseLabelNode = caseLabelNodes[i];
InsnList caseInsnList = caseInsnLists[i];
if (caseInsnList != null) {
ret.add(caseLabelNode);
ret.add(caseInsnList);
}
}
if (defaultInsnList != null) {
ret.add(defaultLabelNode);
ret.add(defaultInsnList);
}
return ret;
} | [
"public",
"static",
"InsnList",
"tableSwitch",
"(",
"InsnList",
"indexInsnList",
",",
"InsnList",
"defaultInsnList",
",",
"int",
"caseStartIdx",
",",
"InsnList",
"...",
"caseInsnLists",
")",
"{",
"Validate",
".",
"notNull",
"(",
"defaultInsnList",
")",
";",
"Valid... | Generates instructions for a switch table. This does not automatically generate jumps at the end of each default/case statement. It's
your responsibility to either add the relevant jumps, throws, or returns at each default/case statement, otherwise the code will
just fall through (which is likely not what you want).
@param indexInsnList instructions to calculate the index -- must leave an int on the stack
@param defaultInsnList instructions to execute on default statement -- must leave the stack unchanged
@param caseStartIdx the number which the case statements start at
@param caseInsnLists instructions to execute on each case statement -- must leave the stack unchanged
@return instructions for a table switch
@throws NullPointerException if any argument is {@code null} or contains {@code null}
@throws IllegalArgumentException if any numeric argument is {@code < 0}, or if {@code caseInsnLists} is empty | [
"Generates",
"instructions",
"for",
"a",
"switch",
"table",
".",
"This",
"does",
"not",
"automatically",
"generate",
"jumps",
"at",
"the",
"end",
"of",
"each",
"default",
"/",
"case",
"statement",
".",
"It",
"s",
"your",
"responsibility",
"to",
"either",
"ad... | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L936-L970 |
michel-kraemer/gradle-download-task | src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java | DownloadAction.getCachedETag | private String getCachedETag(HttpHost host, String file) {
"""
Get the cached ETag for the given host and file
@param host the host
@param file the file
@return the cached ETag or null if there is no ETag in the cache
"""
Map<String, Object> cachedETags = readCachedETags();
@SuppressWarnings("unchecked")
Map<String, Object> hostMap =
(Map<String, Object>)cachedETags.get(host.toURI());
if (hostMap == null) {
return null;
}
@SuppressWarnings("unchecked")
Map<String, String> etagMap = (Map<String, String>)hostMap.get(file);
if (etagMap == null) {
return null;
}
return etagMap.get("ETag");
} | java | private String getCachedETag(HttpHost host, String file) {
Map<String, Object> cachedETags = readCachedETags();
@SuppressWarnings("unchecked")
Map<String, Object> hostMap =
(Map<String, Object>)cachedETags.get(host.toURI());
if (hostMap == null) {
return null;
}
@SuppressWarnings("unchecked")
Map<String, String> etagMap = (Map<String, String>)hostMap.get(file);
if (etagMap == null) {
return null;
}
return etagMap.get("ETag");
} | [
"private",
"String",
"getCachedETag",
"(",
"HttpHost",
"host",
",",
"String",
"file",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"cachedETags",
"=",
"readCachedETags",
"(",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
... | Get the cached ETag for the given host and file
@param host the host
@param file the file
@return the cached ETag or null if there is no ETag in the cache | [
"Get",
"the",
"cached",
"ETag",
"for",
"the",
"given",
"host",
"and",
"file"
] | train | https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L416-L433 |
BlueBrain/bluima | modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/utils/StructuredDirectory.java | StructuredDirectory.getFilePath | public static String getFilePath(int docId, String extention) {
"""
@param docId
usually PubMed id
@param extention
e.g. "gz", or "pdf" (WITHOUT dot!)
@return a path, e.g.:
<ul>
<li>2345678, "gz" -> "2/345/678.gz"</li>
<li>78, "pdf" -> "0/0/78.pdf"</li>
</ul>
"""
int[] split = getSplit(docId);
return split[0] + "/" + split[1] + "/" + split[2] + "." + extention;
} | java | public static String getFilePath(int docId, String extention) {
int[] split = getSplit(docId);
return split[0] + "/" + split[1] + "/" + split[2] + "." + extention;
} | [
"public",
"static",
"String",
"getFilePath",
"(",
"int",
"docId",
",",
"String",
"extention",
")",
"{",
"int",
"[",
"]",
"split",
"=",
"getSplit",
"(",
"docId",
")",
";",
"return",
"split",
"[",
"0",
"]",
"+",
"\"/\"",
"+",
"split",
"[",
"1",
"]",
... | @param docId
usually PubMed id
@param extention
e.g. "gz", or "pdf" (WITHOUT dot!)
@return a path, e.g.:
<ul>
<li>2345678, "gz" -> "2/345/678.gz"</li>
<li>78, "pdf" -> "0/0/78.pdf"</li>
</ul> | [
"@param",
"docId",
"usually",
"PubMed",
"id",
"@param",
"extention",
"e",
".",
"g",
".",
"gz",
"or",
"pdf",
"(",
"WITHOUT",
"dot!",
")",
"@return",
"a",
"path",
"e",
".",
"g",
".",
":",
"<ul",
">",
"<li",
">",
"2345678",
"gz",
"-",
">",
"2",
"/",... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/utils/StructuredDirectory.java#L108-L111 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/GridRansacLineDetector.java | GridRansacLineDetector.process | public void process( D derivX , D derivY , GrayU8 binaryEdges ) {
"""
Detects line segments through the image inside of grids.
@param derivX Image derivative along x-axis. Not modified.
@param derivY Image derivative along x-axis. Not modified.
@param binaryEdges True values indicate that a pixel is an edge pixel. Not modified.
"""
InputSanityCheck.checkSameShape(derivX,derivY,binaryEdges);
int w = derivX.width-regionSize+1;
int h = derivY.height-regionSize+1;
foundLines.reshape(derivX.width / regionSize, derivX.height / regionSize);
foundLines.reset();
// avoid partial regions/other image edge conditions by being at least the region's radius away
for( int y = 0; y < h; y += regionSize) {
int gridY = y/regionSize;
// index of the top left pixel in the region being considered
// possible over optimization
int index = binaryEdges.startIndex + y*binaryEdges.stride;
for( int x = 0; x < w; x+= regionSize , index += regionSize) {
int gridX = x/regionSize;
// detects edgels inside the region
detectEdgels(index,x,y,derivX,derivY,binaryEdges);
// find lines inside the region using RANSAC
findLinesInRegion(foundLines.get(gridX,gridY));
}
}
} | java | public void process( D derivX , D derivY , GrayU8 binaryEdges )
{
InputSanityCheck.checkSameShape(derivX,derivY,binaryEdges);
int w = derivX.width-regionSize+1;
int h = derivY.height-regionSize+1;
foundLines.reshape(derivX.width / regionSize, derivX.height / regionSize);
foundLines.reset();
// avoid partial regions/other image edge conditions by being at least the region's radius away
for( int y = 0; y < h; y += regionSize) {
int gridY = y/regionSize;
// index of the top left pixel in the region being considered
// possible over optimization
int index = binaryEdges.startIndex + y*binaryEdges.stride;
for( int x = 0; x < w; x+= regionSize , index += regionSize) {
int gridX = x/regionSize;
// detects edgels inside the region
detectEdgels(index,x,y,derivX,derivY,binaryEdges);
// find lines inside the region using RANSAC
findLinesInRegion(foundLines.get(gridX,gridY));
}
}
} | [
"public",
"void",
"process",
"(",
"D",
"derivX",
",",
"D",
"derivY",
",",
"GrayU8",
"binaryEdges",
")",
"{",
"InputSanityCheck",
".",
"checkSameShape",
"(",
"derivX",
",",
"derivY",
",",
"binaryEdges",
")",
";",
"int",
"w",
"=",
"derivX",
".",
"width",
"... | Detects line segments through the image inside of grids.
@param derivX Image derivative along x-axis. Not modified.
@param derivY Image derivative along x-axis. Not modified.
@param binaryEdges True values indicate that a pixel is an edge pixel. Not modified. | [
"Detects",
"line",
"segments",
"through",
"the",
"image",
"inside",
"of",
"grids",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/GridRansacLineDetector.java#L104-L129 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileUtil.java | FileUtil.fullyDelete | @Deprecated
public static void fullyDelete(FileSystem fs, Path dir)
throws IOException {
"""
Recursively delete a directory.
@param fs {@link FileSystem} on which the path is present
@param dir directory to recursively delete
@throws IOException
@deprecated Use {@link FileSystem#delete(Path, boolean)}
"""
fs.delete(dir, true);
} | java | @Deprecated
public static void fullyDelete(FileSystem fs, Path dir)
throws IOException {
fs.delete(dir, true);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"fullyDelete",
"(",
"FileSystem",
"fs",
",",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"fs",
".",
"delete",
"(",
"dir",
",",
"true",
")",
";",
"}"
] | Recursively delete a directory.
@param fs {@link FileSystem} on which the path is present
@param dir directory to recursively delete
@throws IOException
@deprecated Use {@link FileSystem#delete(Path, boolean)} | [
"Recursively",
"delete",
"a",
"directory",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileUtil.java#L120-L124 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/sms/SmsClient.java | SmsClient.searchRejectedMessages | public SearchRejectedMessagesResponse searchRejectedMessages(Date date, String to) throws IOException, NexmoClientException {
"""
Search for rejected SMS transactions by date and recipient MSISDN.
@param date the date of the rejected SMS message to be looked up
@param to the MSISDN number of the SMS recipient
@return rejection data matching the provided criteria
"""
return this.searchRejectedMessages(new SearchRejectedMessagesRequest(date, to));
} | java | public SearchRejectedMessagesResponse searchRejectedMessages(Date date, String to) throws IOException, NexmoClientException {
return this.searchRejectedMessages(new SearchRejectedMessagesRequest(date, to));
} | [
"public",
"SearchRejectedMessagesResponse",
"searchRejectedMessages",
"(",
"Date",
"date",
",",
"String",
"to",
")",
"throws",
"IOException",
",",
"NexmoClientException",
"{",
"return",
"this",
".",
"searchRejectedMessages",
"(",
"new",
"SearchRejectedMessagesRequest",
"(... | Search for rejected SMS transactions by date and recipient MSISDN.
@param date the date of the rejected SMS message to be looked up
@param to the MSISDN number of the SMS recipient
@return rejection data matching the provided criteria | [
"Search",
"for",
"rejected",
"SMS",
"transactions",
"by",
"date",
"and",
"recipient",
"MSISDN",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/sms/SmsClient.java#L137-L139 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java | GeoJsonToAssembler.createPolygon | private Polygon createPolygon(double[][][] coordinates, CrsId crsId) {
"""
Creates a polygon starting from its geojson coordinate array
@param coordinates the geojson coordinate array
@param crsId the srid of the crs to use
@return a geolatte polygon instance
"""
LinearRing[] rings = new LinearRing[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
rings[i] = new LinearRing(createPointSequence(coordinates[i], crsId));
}
return new Polygon(rings);
} | java | private Polygon createPolygon(double[][][] coordinates, CrsId crsId) {
LinearRing[] rings = new LinearRing[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
rings[i] = new LinearRing(createPointSequence(coordinates[i], crsId));
}
return new Polygon(rings);
} | [
"private",
"Polygon",
"createPolygon",
"(",
"double",
"[",
"]",
"[",
"]",
"[",
"]",
"coordinates",
",",
"CrsId",
"crsId",
")",
"{",
"LinearRing",
"[",
"]",
"rings",
"=",
"new",
"LinearRing",
"[",
"coordinates",
".",
"length",
"]",
";",
"for",
"(",
"int... | Creates a polygon starting from its geojson coordinate array
@param coordinates the geojson coordinate array
@param crsId the srid of the crs to use
@return a geolatte polygon instance | [
"Creates",
"a",
"polygon",
"starting",
"from",
"its",
"geojson",
"coordinate",
"array"
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L446-L452 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/GridBy.java | GridBy.getXPathForColumnInRowByValueInOtherColumn | public static String getXPathForColumnInRowByValueInOtherColumn(String value, String columnName, String... extraColumnNames) {
"""
Creates an XPath expression that will find a cell in a row, selecting the row based on the
text in a specific column (identified by its header text).
@param value text to find in column with the supplied header.
@param columnName header text of the column to find value in.
@param extraColumnNames name of other header texts that must be present in table's header row
@return XPath expression selecting a td in the row
"""
String selectIndex = getXPathForColumnIndex(columnName);
String rowXPath = getXPathForRowByValueInOtherColumn(selectIndex, value);
String headerXPath = getXPathForHeaderRowByHeaders(columnName, extraColumnNames);
return String.format("(.//table[./%1$s and ./%2$s])[last()]/%2$s/td",
headerXPath, rowXPath);
} | java | public static String getXPathForColumnInRowByValueInOtherColumn(String value, String columnName, String... extraColumnNames) {
String selectIndex = getXPathForColumnIndex(columnName);
String rowXPath = getXPathForRowByValueInOtherColumn(selectIndex, value);
String headerXPath = getXPathForHeaderRowByHeaders(columnName, extraColumnNames);
return String.format("(.//table[./%1$s and ./%2$s])[last()]/%2$s/td",
headerXPath, rowXPath);
} | [
"public",
"static",
"String",
"getXPathForColumnInRowByValueInOtherColumn",
"(",
"String",
"value",
",",
"String",
"columnName",
",",
"String",
"...",
"extraColumnNames",
")",
"{",
"String",
"selectIndex",
"=",
"getXPathForColumnIndex",
"(",
"columnName",
")",
";",
"S... | Creates an XPath expression that will find a cell in a row, selecting the row based on the
text in a specific column (identified by its header text).
@param value text to find in column with the supplied header.
@param columnName header text of the column to find value in.
@param extraColumnNames name of other header texts that must be present in table's header row
@return XPath expression selecting a td in the row | [
"Creates",
"an",
"XPath",
"expression",
"that",
"will",
"find",
"a",
"cell",
"in",
"a",
"row",
"selecting",
"the",
"row",
"based",
"on",
"the",
"text",
"in",
"a",
"specific",
"column",
"(",
"identified",
"by",
"its",
"header",
"text",
")",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/GridBy.java#L50-L56 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java | X509CertSelector.equalNames | static boolean equalNames(Collection<?> object1, Collection<?> object2) {
"""
Compare for equality two objects of the form passed to
setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames).
Throw an {@code IllegalArgumentException} or a
{@code ClassCastException} if one of the objects is malformed.
@param object1 a Collection containing the first object to compare
@param object2 a Collection containing the second object to compare
@return true if the objects are equal, false otherwise
"""
if ((object1 == null) || (object2 == null)) {
return object1 == object2;
}
return object1.equals(object2);
} | java | static boolean equalNames(Collection<?> object1, Collection<?> object2) {
if ((object1 == null) || (object2 == null)) {
return object1 == object2;
}
return object1.equals(object2);
} | [
"static",
"boolean",
"equalNames",
"(",
"Collection",
"<",
"?",
">",
"object1",
",",
"Collection",
"<",
"?",
">",
"object2",
")",
"{",
"if",
"(",
"(",
"object1",
"==",
"null",
")",
"||",
"(",
"object2",
"==",
"null",
")",
")",
"{",
"return",
"object1... | Compare for equality two objects of the form passed to
setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames).
Throw an {@code IllegalArgumentException} or a
{@code ClassCastException} if one of the objects is malformed.
@param object1 a Collection containing the first object to compare
@param object2 a Collection containing the second object to compare
@return true if the objects are equal, false otherwise | [
"Compare",
"for",
"equality",
"two",
"objects",
"of",
"the",
"form",
"passed",
"to",
"setSubjectAlternativeNames",
"(",
"or",
"X509CRLSelector",
".",
"setIssuerNames",
")",
".",
"Throw",
"an",
"{",
"@code",
"IllegalArgumentException",
"}",
"or",
"a",
"{",
"@code... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L876-L881 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java | AVA.toRFC1779String | public String toRFC1779String(Map<String, String> oidMap) {
"""
Returns a printable form of this attribute, using RFC 1779
syntax for individual attribute/value assertions. It
emits standardised keywords, as well as keywords contained in the
OID/keyword map.
"""
return toKeywordValueString(toKeyword(RFC1779, oidMap));
} | java | public String toRFC1779String(Map<String, String> oidMap) {
return toKeywordValueString(toKeyword(RFC1779, oidMap));
} | [
"public",
"String",
"toRFC1779String",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oidMap",
")",
"{",
"return",
"toKeywordValueString",
"(",
"toKeyword",
"(",
"RFC1779",
",",
"oidMap",
")",
")",
";",
"}"
] | Returns a printable form of this attribute, using RFC 1779
syntax for individual attribute/value assertions. It
emits standardised keywords, as well as keywords contained in the
OID/keyword map. | [
"Returns",
"a",
"printable",
"form",
"of",
"this",
"attribute",
"using",
"RFC",
"1779",
"syntax",
"for",
"individual",
"attribute",
"/",
"value",
"assertions",
".",
"It",
"emits",
"standardised",
"keywords",
"as",
"well",
"as",
"keywords",
"contained",
"in",
"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L711-L713 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/serializers/FieldSerializer.java | FieldSerializer.createCopy | protected T createCopy (Kryo kryo, T original) {
"""
Used by {@link #copy(Kryo, Object)} to create a new object. This can be overridden to customize object creation, eg to call
a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}.
"""
return (T)kryo.newInstance(original.getClass());
} | java | protected T createCopy (Kryo kryo, T original) {
return (T)kryo.newInstance(original.getClass());
} | [
"protected",
"T",
"createCopy",
"(",
"Kryo",
"kryo",
",",
"T",
"original",
")",
"{",
"return",
"(",
"T",
")",
"kryo",
".",
"newInstance",
"(",
"original",
".",
"getClass",
"(",
")",
")",
";",
"}"
] | Used by {@link #copy(Kryo, Object)} to create a new object. This can be overridden to customize object creation, eg to call
a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. | [
"Used",
"by",
"{"
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/serializers/FieldSerializer.java#L206-L208 |
NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.requestMtu | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
void requestMtu(@IntRange(from = 0, to = 517) final int mtu)
throws DeviceDisconnectedException, UploadAbortedException {
"""
Requests given MTU. This method is only supported on Android Lollipop or newer versions.
Only DFU from SDK 14.1 or newer supports MTU > 23.
@param mtu new MTU to be requested.
"""
if (mAborted)
throw new UploadAbortedException();
mRequestCompleted = false;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Requesting new MTU...");
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "gatt.requestMtu(" + mtu + ")");
if (!mGatt.requestMtu(mtu))
return;
// We have to wait until the MTU exchange finishes
try {
synchronized (mLock) {
while ((!mRequestCompleted && mConnected && mError == 0) || mPaused)
mLock.wait();
}
} catch (final InterruptedException e) {
loge("Sleeping interrupted", e);
}
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read Service Changed CCCD: device disconnected");
} | java | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
void requestMtu(@IntRange(from = 0, to = 517) final int mtu)
throws DeviceDisconnectedException, UploadAbortedException {
if (mAborted)
throw new UploadAbortedException();
mRequestCompleted = false;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Requesting new MTU...");
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_DEBUG, "gatt.requestMtu(" + mtu + ")");
if (!mGatt.requestMtu(mtu))
return;
// We have to wait until the MTU exchange finishes
try {
synchronized (mLock) {
while ((!mRequestCompleted && mConnected && mError == 0) || mPaused)
mLock.wait();
}
} catch (final InterruptedException e) {
loge("Sleeping interrupted", e);
}
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read Service Changed CCCD: device disconnected");
} | [
"@",
"RequiresApi",
"(",
"api",
"=",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"void",
"requestMtu",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"517",
")",
"final",
"int",
"mtu",
")",
"throws",
"DeviceDisconnectedException",
... | Requests given MTU. This method is only supported on Android Lollipop or newer versions.
Only DFU from SDK 14.1 or newer supports MTU > 23.
@param mtu new MTU to be requested. | [
"Requests",
"given",
"MTU",
".",
"This",
"method",
"is",
"only",
"supported",
"on",
"Android",
"Lollipop",
"or",
"newer",
"versions",
".",
"Only",
"DFU",
"from",
"SDK",
"14",
".",
"1",
"or",
"newer",
"supports",
"MTU",
">",
"23",
"."
] | train | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L679-L702 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java | JobAgentsInner.updateAsync | public Observable<JobAgentInner> updateAsync(String resourceGroupName, String serverName, String jobAgentName) {
"""
Updates a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent to be updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1<ServiceResponse<JobAgentInner>, JobAgentInner>() {
@Override
public JobAgentInner call(ServiceResponse<JobAgentInner> response) {
return response.body();
}
});
} | java | public Observable<JobAgentInner> updateAsync(String resourceGroupName, String serverName, String jobAgentName) {
return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1<ServiceResponse<JobAgentInner>, JobAgentInner>() {
@Override
public JobAgentInner call(ServiceResponse<JobAgentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobAgentInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"j... | Updates a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent to be updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"job",
"agent",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java#L715-L722 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java | XmlResponsesSaxParser.parseListBucketObjectsResponse | public ListBucketHandler parseListBucketObjectsResponse(InputStream inputStream, final boolean shouldSDKDecodeResponse)
throws IOException {
"""
Parses a ListBucket response XML document from an input stream.
@param inputStream
XML data input stream.
@return the XML handler object populated with data parsed from the XML
stream.
@throws SdkClientException
"""
ListBucketHandler handler = new ListBucketHandler(shouldSDKDecodeResponse);
parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream));
return handler;
} | java | public ListBucketHandler parseListBucketObjectsResponse(InputStream inputStream, final boolean shouldSDKDecodeResponse)
throws IOException {
ListBucketHandler handler = new ListBucketHandler(shouldSDKDecodeResponse);
parseXmlInputStream(handler, sanitizeXmlDocument(handler, inputStream));
return handler;
} | [
"public",
"ListBucketHandler",
"parseListBucketObjectsResponse",
"(",
"InputStream",
"inputStream",
",",
"final",
"boolean",
"shouldSDKDecodeResponse",
")",
"throws",
"IOException",
"{",
"ListBucketHandler",
"handler",
"=",
"new",
"ListBucketHandler",
"(",
"shouldSDKDecodeRes... | Parses a ListBucket response XML document from an input stream.
@param inputStream
XML data input stream.
@return the XML handler object populated with data parsed from the XML
stream.
@throws SdkClientException | [
"Parses",
"a",
"ListBucket",
"response",
"XML",
"document",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/XmlResponsesSaxParser.java#L319-L325 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/http/CookieManager.java | CookieManager.addCookie | public void addCookie(String name, String value, HttpServletResponse response) {
"""
Add a new cookie, using the configured domain, path and max age, to the response.
@param name the name of the cookie
@param value the value of the cookie
"""
Cookie cookie = new Cookie(name, value);
cookie.setHttpOnly(httpOnly);
cookie.setSecure(secure);
if (StringUtils.isNotEmpty(domain)) {
cookie.setDomain(domain);
}
if (StringUtils.isNotEmpty(path)) {
cookie.setPath(path);
}
if (maxAge != null) {
cookie.setMaxAge(maxAge);
}
response.addCookie(cookie);
logger.debug(LOG_KEY_ADDED_COOKIE, name);
} | java | public void addCookie(String name, String value, HttpServletResponse response) {
Cookie cookie = new Cookie(name, value);
cookie.setHttpOnly(httpOnly);
cookie.setSecure(secure);
if (StringUtils.isNotEmpty(domain)) {
cookie.setDomain(domain);
}
if (StringUtils.isNotEmpty(path)) {
cookie.setPath(path);
}
if (maxAge != null) {
cookie.setMaxAge(maxAge);
}
response.addCookie(cookie);
logger.debug(LOG_KEY_ADDED_COOKIE, name);
} | [
"public",
"void",
"addCookie",
"(",
"String",
"name",
",",
"String",
"value",
",",
"HttpServletResponse",
"response",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookie",
".",
"setHttpOnly",
"(",
"httpOnly",
")... | Add a new cookie, using the configured domain, path and max age, to the response.
@param name the name of the cookie
@param value the value of the cookie | [
"Add",
"a",
"new",
"cookie",
"using",
"the",
"configured",
"domain",
"path",
"and",
"max",
"age",
"to",
"the",
"response",
"."
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/http/CookieManager.java#L71-L88 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java | SkbShellFactory.newCommand | public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp) {
"""
Returns a new shell command without formal arguments, use the factory to create one.
@param command the actual command
@param category the command's category, can be null
@param description the command's description
@param addedHelp additional help, can be null
@return new shell command
@throws IllegalArgumentException if command or description was null
"""
return new AbstractShellCommand(command, null, category, description, addedHelp);
} | java | public static SkbShellCommand newCommand(String command, SkbShellCommandCategory category, String description, String addedHelp){
return new AbstractShellCommand(command, null, category, description, addedHelp);
} | [
"public",
"static",
"SkbShellCommand",
"newCommand",
"(",
"String",
"command",
",",
"SkbShellCommandCategory",
"category",
",",
"String",
"description",
",",
"String",
"addedHelp",
")",
"{",
"return",
"new",
"AbstractShellCommand",
"(",
"command",
",",
"null",
",",
... | Returns a new shell command without formal arguments, use the factory to create one.
@param command the actual command
@param category the command's category, can be null
@param description the command's description
@param addedHelp additional help, can be null
@return new shell command
@throws IllegalArgumentException if command or description was null | [
"Returns",
"a",
"new",
"shell",
"command",
"without",
"formal",
"arguments",
"use",
"the",
"factory",
"to",
"create",
"one",
"."
] | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L140-L142 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java | Duration.ofNanos | public static Duration ofNanos(long nanos) {
"""
Obtains a {@code Duration} representing a number of nanoseconds.
<p>
The seconds and nanoseconds are extracted from the specified nanoseconds.
@param nanos the number of nanoseconds, positive or negative
@return a {@code Duration}, not null
"""
long secs = nanos / NANOS_PER_SECOND;
int nos = (int) (nanos % NANOS_PER_SECOND);
if (nos < 0) {
nos += NANOS_PER_SECOND;
secs--;
}
return create(secs, nos);
} | java | public static Duration ofNanos(long nanos) {
long secs = nanos / NANOS_PER_SECOND;
int nos = (int) (nanos % NANOS_PER_SECOND);
if (nos < 0) {
nos += NANOS_PER_SECOND;
secs--;
}
return create(secs, nos);
} | [
"public",
"static",
"Duration",
"ofNanos",
"(",
"long",
"nanos",
")",
"{",
"long",
"secs",
"=",
"nanos",
"/",
"NANOS_PER_SECOND",
";",
"int",
"nos",
"=",
"(",
"int",
")",
"(",
"nanos",
"%",
"NANOS_PER_SECOND",
")",
";",
"if",
"(",
"nos",
"<",
"0",
")... | Obtains a {@code Duration} representing a number of nanoseconds.
<p>
The seconds and nanoseconds are extracted from the specified nanoseconds.
@param nanos the number of nanoseconds, positive or negative
@return a {@code Duration}, not null | [
"Obtains",
"a",
"{",
"@code",
"Duration",
"}",
"representing",
"a",
"number",
"of",
"nanoseconds",
".",
"<p",
">",
"The",
"seconds",
"and",
"nanoseconds",
"are",
"extracted",
"from",
"the",
"specified",
"nanoseconds",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L272-L280 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/core/Config.java | Config.get | public static Object get(ServletRequest request, String name) {
"""
Looks up a configuration variable in the "request" scope.
<p> The lookup of configuration variables is performed as if each scope
had its own name space, that is, the same configuration variable name
in one scope does not replace one stored in a different scope.
@param request Request object in which the configuration variable is to
be looked up
@param name Configuration variable name
@return The <tt>java.lang.Object</tt> associated with the configuration
variable, or null if it is not defined.
"""
return request.getAttribute(name + REQUEST_SCOPE_SUFFIX);
} | java | public static Object get(ServletRequest request, String name) {
return request.getAttribute(name + REQUEST_SCOPE_SUFFIX);
} | [
"public",
"static",
"Object",
"get",
"(",
"ServletRequest",
"request",
",",
"String",
"name",
")",
"{",
"return",
"request",
".",
"getAttribute",
"(",
"name",
"+",
"REQUEST_SCOPE_SUFFIX",
")",
";",
"}"
] | Looks up a configuration variable in the "request" scope.
<p> The lookup of configuration variables is performed as if each scope
had its own name space, that is, the same configuration variable name
in one scope does not replace one stored in a different scope.
@param request Request object in which the configuration variable is to
be looked up
@param name Configuration variable name
@return The <tt>java.lang.Object</tt> associated with the configuration
variable, or null if it is not defined. | [
"Looks",
"up",
"a",
"configuration",
"variable",
"in",
"the",
"request",
"scope",
".",
"<p",
">",
"The",
"lookup",
"of",
"configuration",
"variables",
"is",
"performed",
"as",
"if",
"each",
"scope",
"had",
"its",
"own",
"name",
"space",
"that",
"is",
"the"... | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/core/Config.java#L125-L127 |
samskivert/pythagoras | src/main/java/pythagoras/d/Arc.java | Arc.setArc | public void setArc (XY point, IDimension size, double start, double extent, int type) {
"""
Sets the location, size, angular extents, and closure type of this arc to the specified
values.
"""
setArc(point.x(), point.y(), size.width(), size.height(), start, extent, type);
} | java | public void setArc (XY point, IDimension size, double start, double extent, int type) {
setArc(point.x(), point.y(), size.width(), size.height(), start, extent, type);
} | [
"public",
"void",
"setArc",
"(",
"XY",
"point",
",",
"IDimension",
"size",
",",
"double",
"start",
",",
"double",
"extent",
",",
"int",
"type",
")",
"{",
"setArc",
"(",
"point",
".",
"x",
"(",
")",
",",
"point",
".",
"y",
"(",
")",
",",
"size",
"... | Sets the location, size, angular extents, and closure type of this arc to the specified
values. | [
"Sets",
"the",
"location",
"size",
"angular",
"extents",
"and",
"closure",
"type",
"of",
"this",
"arc",
"to",
"the",
"specified",
"values",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Arc.java#L143-L145 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.getAllDomainsPlayCount | public GetAllDomainsPlayCountResponse getAllDomainsPlayCount(GetAllDomainsStatisticsRequest request) {
"""
get all domains' total play count statistics in the live stream service.
@param request The request object containing all options for getting all domains' play count statistics
@return the response
"""
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getTimeInterval(), "timeInterval should NOT be null");
checkStringNotEmpty(request.getStartTime(), "startTime should NOT be null");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
STATISTICS, LIVE_DOMAIN, "playcount");
internalRequest.addParameter("timeInterval", request.getTimeInterval());
internalRequest.addParameter("startTime", request.getStartTime());
if (request.getEndTime() != null) {
internalRequest.addParameter("endTime", request.getEndTime());
}
return invokeHttpClient(internalRequest, GetAllDomainsPlayCountResponse.class);
} | java | public GetAllDomainsPlayCountResponse getAllDomainsPlayCount(GetAllDomainsStatisticsRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getTimeInterval(), "timeInterval should NOT be null");
checkStringNotEmpty(request.getStartTime(), "startTime should NOT be null");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request,
STATISTICS, LIVE_DOMAIN, "playcount");
internalRequest.addParameter("timeInterval", request.getTimeInterval());
internalRequest.addParameter("startTime", request.getStartTime());
if (request.getEndTime() != null) {
internalRequest.addParameter("endTime", request.getEndTime());
}
return invokeHttpClient(internalRequest, GetAllDomainsPlayCountResponse.class);
} | [
"public",
"GetAllDomainsPlayCountResponse",
"getAllDomainsPlayCount",
"(",
"GetAllDomainsStatisticsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getTime... | get all domains' total play count statistics in the live stream service.
@param request The request object containing all options for getting all domains' play count statistics
@return the response | [
"get",
"all",
"domains",
"total",
"play",
"count",
"statistics",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1853-L1867 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/UniverseApi.java | UniverseApi.getUniverseStarsStarId | public StarResponse getUniverseStarsStarId(Integer starId, String datasource, String ifNoneMatch)
throws ApiException {
"""
Get star information Get information on a star --- This route expires
daily at 11:05
@param starId
star_id integer (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return StarResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body
"""
ApiResponse<StarResponse> resp = getUniverseStarsStarIdWithHttpInfo(starId, datasource, ifNoneMatch);
return resp.getData();
} | java | public StarResponse getUniverseStarsStarId(Integer starId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<StarResponse> resp = getUniverseStarsStarIdWithHttpInfo(starId, datasource, ifNoneMatch);
return resp.getData();
} | [
"public",
"StarResponse",
"getUniverseStarsStarId",
"(",
"Integer",
"starId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"StarResponse",
">",
"resp",
"=",
"getUniverseStarsStarIdWithHttpInfo",
"(",
... | Get star information Get information on a star --- This route expires
daily at 11:05
@param starId
star_id integer (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return StarResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"star",
"information",
"Get",
"information",
"on",
"a",
"star",
"---",
"This",
"route",
"expires",
"daily",
"at",
"11",
":",
"05"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UniverseApi.java#L2935-L2939 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java | AbstractNpmAnalyzer.createDependency | protected Dependency createDependency(Dependency dependency, String name, String version, String scope) {
"""
Construct a dependency object.
@param dependency the parent dependency
@param name the name of the dependency to create
@param version the version of the dependency to create
@param scope the scope of the dependency being created
@return the generated dependency
"""
final Dependency nodeModule = new Dependency(new File(dependency.getActualFile() + "?" + name), true);
nodeModule.setEcosystem(NPM_DEPENDENCY_ECOSYSTEM);
//this is virtual - the sha1 is purely for the hyperlink in the final html report
nodeModule.setSha1sum(Checksum.getSHA1Checksum(String.format("%s:%s", name, version)));
nodeModule.setSha256sum(Checksum.getSHA256Checksum(String.format("%s:%s", name, version)));
nodeModule.setMd5sum(Checksum.getMD5Checksum(String.format("%s:%s", name, version)));
nodeModule.addEvidence(EvidenceType.PRODUCT, "package.json", "name", name, Confidence.HIGHEST);
nodeModule.addEvidence(EvidenceType.VENDOR, "package.json", "name", name, Confidence.HIGH);
if (!StringUtils.isBlank(version)) {
nodeModule.addEvidence(EvidenceType.VERSION, "package.json", "version", version, Confidence.HIGHEST);
nodeModule.setVersion(version);
}
if (dependency.getName() != null) {
nodeModule.addProjectReference(dependency.getName() + ": " + scope);
} else {
nodeModule.addProjectReference(dependency.getDisplayFileName() + ": " + scope);
}
nodeModule.setName(name);
//TODO - we can likely create a valid CPE as a low confidence guess using cpe:2.3:a:[name]_project:[name]:[version]
//(and add a targetSw of npm/node)
Identifier id;
try {
final PackageURL purl = PackageURLBuilder.aPackageURL().withType(StandardTypes.NPM)
.withName(name).withVersion(version).build();
id = new PurlIdentifier(purl, Confidence.HIGHEST);
} catch (MalformedPackageURLException ex) {
LOGGER.debug("Unable to generate Purl - using a generic identifier instead " + ex.getMessage());
id = new GenericIdentifier(String.format("npm:%s@%s", dependency.getName(), version), Confidence.HIGHEST);
}
nodeModule.addSoftwareIdentifier(id);
return nodeModule;
} | java | protected Dependency createDependency(Dependency dependency, String name, String version, String scope) {
final Dependency nodeModule = new Dependency(new File(dependency.getActualFile() + "?" + name), true);
nodeModule.setEcosystem(NPM_DEPENDENCY_ECOSYSTEM);
//this is virtual - the sha1 is purely for the hyperlink in the final html report
nodeModule.setSha1sum(Checksum.getSHA1Checksum(String.format("%s:%s", name, version)));
nodeModule.setSha256sum(Checksum.getSHA256Checksum(String.format("%s:%s", name, version)));
nodeModule.setMd5sum(Checksum.getMD5Checksum(String.format("%s:%s", name, version)));
nodeModule.addEvidence(EvidenceType.PRODUCT, "package.json", "name", name, Confidence.HIGHEST);
nodeModule.addEvidence(EvidenceType.VENDOR, "package.json", "name", name, Confidence.HIGH);
if (!StringUtils.isBlank(version)) {
nodeModule.addEvidence(EvidenceType.VERSION, "package.json", "version", version, Confidence.HIGHEST);
nodeModule.setVersion(version);
}
if (dependency.getName() != null) {
nodeModule.addProjectReference(dependency.getName() + ": " + scope);
} else {
nodeModule.addProjectReference(dependency.getDisplayFileName() + ": " + scope);
}
nodeModule.setName(name);
//TODO - we can likely create a valid CPE as a low confidence guess using cpe:2.3:a:[name]_project:[name]:[version]
//(and add a targetSw of npm/node)
Identifier id;
try {
final PackageURL purl = PackageURLBuilder.aPackageURL().withType(StandardTypes.NPM)
.withName(name).withVersion(version).build();
id = new PurlIdentifier(purl, Confidence.HIGHEST);
} catch (MalformedPackageURLException ex) {
LOGGER.debug("Unable to generate Purl - using a generic identifier instead " + ex.getMessage());
id = new GenericIdentifier(String.format("npm:%s@%s", dependency.getName(), version), Confidence.HIGHEST);
}
nodeModule.addSoftwareIdentifier(id);
return nodeModule;
} | [
"protected",
"Dependency",
"createDependency",
"(",
"Dependency",
"dependency",
",",
"String",
"name",
",",
"String",
"version",
",",
"String",
"scope",
")",
"{",
"final",
"Dependency",
"nodeModule",
"=",
"new",
"Dependency",
"(",
"new",
"File",
"(",
"dependency... | Construct a dependency object.
@param dependency the parent dependency
@param name the name of the dependency to create
@param version the version of the dependency to create
@param scope the scope of the dependency being created
@return the generated dependency | [
"Construct",
"a",
"dependency",
"object",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java#L127-L160 |
facebookarchive/hadoop-20 | src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/Gridmix.java | Gridmix.startThreads | private void startThreads(Configuration conf, String traceIn, Path ioPath,
Path scratchDir, CountDownLatch startFlag) throws IOException {
"""
Create each component in the pipeline and start it.
@param conf Configuration data, no keys specific to this context
@param traceIn Either a Path to the trace data or "-" for
stdin
@param ioPath Path from which input data is read
@param scratchDir Path into which job output is written
@param startFlag Semaphore for starting job trace pipeline
"""
monitor = createJobMonitor();
submitter = createJobSubmitter(monitor,
conf.getInt(GRIDMIX_SUB_THR,
Runtime.getRuntime().availableProcessors() + 1),
conf.getInt(GRIDMIX_QUE_DEP, 5),
new FilePool(conf, ioPath));
factory = createJobFactory(submitter, traceIn, scratchDir, conf, startFlag);
monitor.start();
submitter.start();
factory.start();
} | java | private void startThreads(Configuration conf, String traceIn, Path ioPath,
Path scratchDir, CountDownLatch startFlag) throws IOException {
monitor = createJobMonitor();
submitter = createJobSubmitter(monitor,
conf.getInt(GRIDMIX_SUB_THR,
Runtime.getRuntime().availableProcessors() + 1),
conf.getInt(GRIDMIX_QUE_DEP, 5),
new FilePool(conf, ioPath));
factory = createJobFactory(submitter, traceIn, scratchDir, conf, startFlag);
monitor.start();
submitter.start();
factory.start();
} | [
"private",
"void",
"startThreads",
"(",
"Configuration",
"conf",
",",
"String",
"traceIn",
",",
"Path",
"ioPath",
",",
"Path",
"scratchDir",
",",
"CountDownLatch",
"startFlag",
")",
"throws",
"IOException",
"{",
"monitor",
"=",
"createJobMonitor",
"(",
")",
";",... | Create each component in the pipeline and start it.
@param conf Configuration data, no keys specific to this context
@param traceIn Either a Path to the trace data or "-" for
stdin
@param ioPath Path from which input data is read
@param scratchDir Path into which job output is written
@param startFlag Semaphore for starting job trace pipeline | [
"Create",
"each",
"component",
"in",
"the",
"pipeline",
"and",
"start",
"it",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/gridmix/src/java/org/apache/hadoop/mapred/gridmix/Gridmix.java#L130-L142 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.toObjectOrNull | @Deprecated
public static Scriptable toObjectOrNull(Context cx, Object obj) {
"""
<strong>Warning</strong>: This doesn't allow to resolve primitive
prototype properly when many top scopes are involved
@deprecated Use {@link #toObjectOrNull(Context, Object, Scriptable)} instead
"""
if (obj instanceof Scriptable) {
return (Scriptable)obj;
} else if (obj != null && obj != Undefined.instance) {
return toObject(cx, getTopCallScope(cx), obj);
}
return null;
} | java | @Deprecated
public static Scriptable toObjectOrNull(Context cx, Object obj)
{
if (obj instanceof Scriptable) {
return (Scriptable)obj;
} else if (obj != null && obj != Undefined.instance) {
return toObject(cx, getTopCallScope(cx), obj);
}
return null;
} | [
"@",
"Deprecated",
"public",
"static",
"Scriptable",
"toObjectOrNull",
"(",
"Context",
"cx",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Scriptable",
")",
"{",
"return",
"(",
"Scriptable",
")",
"obj",
";",
"}",
"else",
"if",
"(",
"ob... | <strong>Warning</strong>: This doesn't allow to resolve primitive
prototype properly when many top scopes are involved
@deprecated Use {@link #toObjectOrNull(Context, Object, Scriptable)} instead | [
"<strong",
">",
"Warning<",
"/",
"strong",
">",
":",
"This",
"doesn",
"t",
"allow",
"to",
"resolve",
"primitive",
"prototype",
"properly",
"when",
"many",
"top",
"scopes",
"are",
"involved"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1068-L1077 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java | MetamodelImpl.assignMappedSuperClass | public void assignMappedSuperClass(Map<Class<?>, ManagedType<?>> mappedSuperClass) {
"""
Adds mapped super class to mapped super class collection.
@param mappedSuperClass
the mappedSuperClassTypes to set
"""
if (this.mappedSuperClassTypes == null)
{
this.mappedSuperClassTypes = mappedSuperClass;
}
else
{
this.mappedSuperClassTypes.putAll(mappedSuperClassTypes);
}
} | java | public void assignMappedSuperClass(Map<Class<?>, ManagedType<?>> mappedSuperClass)
{
if (this.mappedSuperClassTypes == null)
{
this.mappedSuperClassTypes = mappedSuperClass;
}
else
{
this.mappedSuperClassTypes.putAll(mappedSuperClassTypes);
}
} | [
"public",
"void",
"assignMappedSuperClass",
"(",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"ManagedType",
"<",
"?",
">",
">",
"mappedSuperClass",
")",
"{",
"if",
"(",
"this",
".",
"mappedSuperClassTypes",
"==",
"null",
")",
"{",
"this",
".",
"mappedSuperCla... | Adds mapped super class to mapped super class collection.
@param mappedSuperClass
the mappedSuperClassTypes to set | [
"Adds",
"mapped",
"super",
"class",
"to",
"mapped",
"super",
"class",
"collection",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L333-L343 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java | WorkflowsInner.updateAsync | public Observable<WorkflowInner> updateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) {
"""
Updates a workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param workflow The workflow.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() {
@Override
public WorkflowInner call(ServiceResponse<WorkflowInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowInner> updateAsync(String resourceGroupName, String workflowName, WorkflowInner workflow) {
return updateWithServiceResponseAsync(resourceGroupName, workflowName, workflow).map(new Func1<ServiceResponse<WorkflowInner>, WorkflowInner>() {
@Override
public WorkflowInner call(ServiceResponse<WorkflowInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"WorkflowInner",
"workflow",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
",... | Updates a workflow.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param workflow The workflow.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowInner object | [
"Updates",
"a",
"workflow",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L816-L823 |
Omertron/api-omdb | src/main/java/com/omertron/omdbapi/tools/OmdbUrlBuilder.java | OmdbUrlBuilder.generateUrl | public static URL generateUrl(final String url) throws OMDBException {
"""
Generate a URL object from a String URL
@param url
@return
@throws OMDBException
"""
try {
return new URL(url);
} catch (MalformedURLException ex) {
throw new OMDBException(ApiExceptionType.INVALID_URL, "Failed to create URL", url, ex);
}
} | java | public static URL generateUrl(final String url) throws OMDBException {
try {
return new URL(url);
} catch (MalformedURLException ex) {
throw new OMDBException(ApiExceptionType.INVALID_URL, "Failed to create URL", url, ex);
}
} | [
"public",
"static",
"URL",
"generateUrl",
"(",
"final",
"String",
"url",
")",
"throws",
"OMDBException",
"{",
"try",
"{",
"return",
"new",
"URL",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"ex",
")",
"{",
"throw",
"new",
"OMDBExcepti... | Generate a URL object from a String URL
@param url
@return
@throws OMDBException | [
"Generate",
"a",
"URL",
"object",
"from",
"a",
"String",
"URL"
] | train | https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/tools/OmdbUrlBuilder.java#L134-L140 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/context/AbstractContext.java | AbstractContext.setVariables | public void setVariables(final Map<String,Object> variables) {
"""
<p>
Sets several variables at a time into the context.
</p>
@param variables the variables to be set.
"""
if (variables == null) {
return;
}
this.variables.putAll(variables);
} | java | public void setVariables(final Map<String,Object> variables) {
if (variables == null) {
return;
}
this.variables.putAll(variables);
} | [
"public",
"void",
"setVariables",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
")",
"{",
"if",
"(",
"variables",
"==",
"null",
")",
"{",
"return",
";",
"}",
"this",
".",
"variables",
".",
"putAll",
"(",
"variables",
")",
";",
... | <p>
Sets several variables at a time into the context.
</p>
@param variables the variables to be set. | [
"<p",
">",
"Sets",
"several",
"variables",
"at",
"a",
"time",
"into",
"the",
"context",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/context/AbstractContext.java#L122-L127 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java | NotificationManager.removeClientNotification | public void removeClientNotification(RESTRequest request, ObjectName objectName, int clientID) {
"""
Removes a corresponding client notification for the given ObjectName
"""
//Get the client area
ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null);
//Remove the corresponding listener (will also remove from MBeanServer)
clientArea.removeClientNotificationListener(request, objectName);
} | java | public void removeClientNotification(RESTRequest request, ObjectName objectName, int clientID) {
//Get the client area
ClientNotificationArea clientArea = getInboxIfAvailable(clientID, null);
//Remove the corresponding listener (will also remove from MBeanServer)
clientArea.removeClientNotificationListener(request, objectName);
} | [
"public",
"void",
"removeClientNotification",
"(",
"RESTRequest",
"request",
",",
"ObjectName",
"objectName",
",",
"int",
"clientID",
")",
"{",
"//Get the client area ",
"ClientNotificationArea",
"clientArea",
"=",
"getInboxIfAvailable",
"(",
"clientID",
",",
"null",
")... | Removes a corresponding client notification for the given ObjectName | [
"Removes",
"a",
"corresponding",
"client",
"notification",
"for",
"the",
"given",
"ObjectName"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/NotificationManager.java#L158-L164 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.getIntegerValue | public static Integer getIntegerValue(QuerySolution resultRow, String variableName) {
"""
Given a query result from a SPARQL query, obtain the number value at the
given variable
@param resultRow the result from a SPARQL query
@param variableName the name of the variable to obtain
@return the Integer value, or null otherwise
"""
if (resultRow != null) {
Resource res = resultRow.getResource(variableName);
if (res != null && res.isLiteral()) {
Literal val = res.asLiteral();
if (val != null) {
return Integer.valueOf(val.getInt());
}
}
}
return null;
} | java | public static Integer getIntegerValue(QuerySolution resultRow, String variableName) {
if (resultRow != null) {
Resource res = resultRow.getResource(variableName);
if (res != null && res.isLiteral()) {
Literal val = res.asLiteral();
if (val != null) {
return Integer.valueOf(val.getInt());
}
}
}
return null;
} | [
"public",
"static",
"Integer",
"getIntegerValue",
"(",
"QuerySolution",
"resultRow",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"resultRow",
"!=",
"null",
")",
"{",
"Resource",
"res",
"=",
"resultRow",
".",
"getResource",
"(",
"variableName",
")",
";"... | Given a query result from a SPARQL query, obtain the number value at the
given variable
@param resultRow the result from a SPARQL query
@param variableName the name of the variable to obtain
@return the Integer value, or null otherwise | [
"Given",
"a",
"query",
"result",
"from",
"a",
"SPARQL",
"query",
"obtain",
"the",
"number",
"value",
"at",
"the",
"given",
"variable"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L181-L194 |
joniles/mpxj | src/main/java/net/sf/mpxj/utility/DataExportUtility.java | DataExportUtility.escapeText | private String escapeText(StringBuilder sb, String text) {
"""
Quick and dirty XML text escape.
@param sb working string buffer
@param text input text
@return escaped text
"""
int length = text.length();
char c;
sb.setLength(0);
for (int loop = 0; loop < length; loop++)
{
c = text.charAt(loop);
switch (c)
{
case '<':
{
sb.append("<");
break;
}
case '>':
{
sb.append(">");
break;
}
case '&':
{
sb.append("&");
break;
}
default:
{
if (validXMLCharacter(c))
{
if (c > 127)
{
sb.append("&#" + (int) c + ";");
}
else
{
sb.append(c);
}
}
break;
}
}
}
return (sb.toString());
} | java | private String escapeText(StringBuilder sb, String text)
{
int length = text.length();
char c;
sb.setLength(0);
for (int loop = 0; loop < length; loop++)
{
c = text.charAt(loop);
switch (c)
{
case '<':
{
sb.append("<");
break;
}
case '>':
{
sb.append(">");
break;
}
case '&':
{
sb.append("&");
break;
}
default:
{
if (validXMLCharacter(c))
{
if (c > 127)
{
sb.append("&#" + (int) c + ";");
}
else
{
sb.append(c);
}
}
break;
}
}
}
return (sb.toString());
} | [
"private",
"String",
"escapeText",
"(",
"StringBuilder",
"sb",
",",
"String",
"text",
")",
"{",
"int",
"length",
"=",
"text",
".",
"length",
"(",
")",
";",
"char",
"c",
";",
"sb",
".",
"setLength",
"(",
"0",
")",
";",
"for",
"(",
"int",
"loop",
"="... | Quick and dirty XML text escape.
@param sb working string buffer
@param text input text
@return escaped text | [
"Quick",
"and",
"dirty",
"XML",
"text",
"escape",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/DataExportUtility.java#L328-L379 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.needIncrement | private static boolean needIncrement(MutableBigInteger mdivisor, int roundingMode,
int qsign, MutableBigInteger mq, MutableBigInteger mr) {
"""
Tests if quotient has to be incremented according the roundingMode
"""
assert !mr.isZero();
int cmpFracHalf = mr.compareHalf(mdivisor);
return commonNeedIncrement(roundingMode, qsign, cmpFracHalf, mq.isOdd());
} | java | private static boolean needIncrement(MutableBigInteger mdivisor, int roundingMode,
int qsign, MutableBigInteger mq, MutableBigInteger mr) {
assert !mr.isZero();
int cmpFracHalf = mr.compareHalf(mdivisor);
return commonNeedIncrement(roundingMode, qsign, cmpFracHalf, mq.isOdd());
} | [
"private",
"static",
"boolean",
"needIncrement",
"(",
"MutableBigInteger",
"mdivisor",
",",
"int",
"roundingMode",
",",
"int",
"qsign",
",",
"MutableBigInteger",
"mq",
",",
"MutableBigInteger",
"mr",
")",
"{",
"assert",
"!",
"mr",
".",
"isZero",
"(",
")",
";",... | Tests if quotient has to be incremented according the roundingMode | [
"Tests",
"if",
"quotient",
"has",
"to",
"be",
"incremented",
"according",
"the",
"roundingMode"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4353-L4358 |
assertthat/selenium-shutterbug | src/main/java/com/assertthat/selenium_shutterbug/utils/image/ImageProcessor.java | ImageProcessor.imagesAreEqualsWithDiff | public static boolean imagesAreEqualsWithDiff(BufferedImage image1, BufferedImage image2, String pathFileName, double deviation) {
"""
Extends the functionality of imagesAreEqualsWithDiff, but creates a third BufferedImage and applies pixel manipulation to it.
@param image1 The first image to compare
@param image2 The second image to compare
@param pathFileName The output path filename for the third image, if null then is ignored
@param deviation The upper limit of the pixel deviation for the test
@return If the test passes
"""
BufferedImage output = new BufferedImage(image1.getWidth(), image1.getHeight(), BufferedImage.TYPE_INT_RGB);
int width1 = image1.getWidth(null);
int width2 = image2.getWidth(null);
int height1 = image1.getHeight(null);
int height2 = image2.getHeight(null);
if ((width1 != width2) || (height1 != height2)) {
throw new UnableToCompareImagesException("Images dimensions mismatch: image1 - " + width1 + "x" + height1 + "; image2 - " + width2 + "x" + height2);
}
long diff = 0;
long recordedDiff = 0; // Records the difference so it can be compared, saves having to do three if statements
for (int y = 0; y < height1; y++) {
for (int x = 0; x < width1; x++) {
recordedDiff = diff;
// Grab RGB values of both images, then bit shift and bitwise AND to break them down into R, G and B
int rgb1 = image1.getRGB(x, y);
int rgb2 = image2.getRGB(x, y);
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = (rgb1) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = (rgb2) & 0xff;
diff += Math.abs(r1 - r2);
diff += Math.abs(g1 - g2);
diff += Math.abs(b1 - b2);
// If difference > recorded difference, change pixel to red. If zero, set to image 1's original pixel
if(diff > recordedDiff)
output.setRGB(x,y,new Color(255,0,0).getRGB() & rgb1); // Dark red = original position, Light red is moved to
else
output.setRGB(x,y,rgb1);
}
}
int colourSpaceBytes = 3; // RGB is 24 bit, or 3 bytes
double totalPixels = width1 * height1 * colourSpaceBytes;
pixelError = diff / totalPixels / 255.0;
// Write the image as png, with the filename based on the path provided
if(pixelError > 0)
FileUtil.writeImage(output,"png",new File(pathFileName+".png"));
return pixelError == 0 || pixelError <= deviation;
} | java | public static boolean imagesAreEqualsWithDiff(BufferedImage image1, BufferedImage image2, String pathFileName, double deviation) {
BufferedImage output = new BufferedImage(image1.getWidth(), image1.getHeight(), BufferedImage.TYPE_INT_RGB);
int width1 = image1.getWidth(null);
int width2 = image2.getWidth(null);
int height1 = image1.getHeight(null);
int height2 = image2.getHeight(null);
if ((width1 != width2) || (height1 != height2)) {
throw new UnableToCompareImagesException("Images dimensions mismatch: image1 - " + width1 + "x" + height1 + "; image2 - " + width2 + "x" + height2);
}
long diff = 0;
long recordedDiff = 0; // Records the difference so it can be compared, saves having to do three if statements
for (int y = 0; y < height1; y++) {
for (int x = 0; x < width1; x++) {
recordedDiff = diff;
// Grab RGB values of both images, then bit shift and bitwise AND to break them down into R, G and B
int rgb1 = image1.getRGB(x, y);
int rgb2 = image2.getRGB(x, y);
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = (rgb1) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = (rgb2) & 0xff;
diff += Math.abs(r1 - r2);
diff += Math.abs(g1 - g2);
diff += Math.abs(b1 - b2);
// If difference > recorded difference, change pixel to red. If zero, set to image 1's original pixel
if(diff > recordedDiff)
output.setRGB(x,y,new Color(255,0,0).getRGB() & rgb1); // Dark red = original position, Light red is moved to
else
output.setRGB(x,y,rgb1);
}
}
int colourSpaceBytes = 3; // RGB is 24 bit, or 3 bytes
double totalPixels = width1 * height1 * colourSpaceBytes;
pixelError = diff / totalPixels / 255.0;
// Write the image as png, with the filename based on the path provided
if(pixelError > 0)
FileUtil.writeImage(output,"png",new File(pathFileName+".png"));
return pixelError == 0 || pixelError <= deviation;
} | [
"public",
"static",
"boolean",
"imagesAreEqualsWithDiff",
"(",
"BufferedImage",
"image1",
",",
"BufferedImage",
"image2",
",",
"String",
"pathFileName",
",",
"double",
"deviation",
")",
"{",
"BufferedImage",
"output",
"=",
"new",
"BufferedImage",
"(",
"image1",
".",... | Extends the functionality of imagesAreEqualsWithDiff, but creates a third BufferedImage and applies pixel manipulation to it.
@param image1 The first image to compare
@param image2 The second image to compare
@param pathFileName The output path filename for the third image, if null then is ignored
@param deviation The upper limit of the pixel deviation for the test
@return If the test passes | [
"Extends",
"the",
"functionality",
"of",
"imagesAreEqualsWithDiff",
"but",
"creates",
"a",
"third",
"BufferedImage",
"and",
"applies",
"pixel",
"manipulation",
"to",
"it",
"."
] | train | https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/utils/image/ImageProcessor.java#L147-L191 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getRepeated | @Nonnull
public static String getRepeated (final char cElement, @Nonnegative final int nRepeats) {
"""
Get the passed string element repeated for a certain number of times. Each
string element is simply appended at the end of the string.
@param cElement
The character to get repeated.
@param nRepeats
The number of repetitions to retrieve. May not be < 0.
@return A non-<code>null</code> string containing the string element for the
given number of times.
"""
ValueEnforcer.isGE0 (nRepeats, "Repeats");
if (nRepeats == 0)
return "";
if (nRepeats == 1)
return Character.toString (cElement);
final char [] aElement = new char [nRepeats];
Arrays.fill (aElement, cElement);
return new String (aElement);
} | java | @Nonnull
public static String getRepeated (final char cElement, @Nonnegative final int nRepeats)
{
ValueEnforcer.isGE0 (nRepeats, "Repeats");
if (nRepeats == 0)
return "";
if (nRepeats == 1)
return Character.toString (cElement);
final char [] aElement = new char [nRepeats];
Arrays.fill (aElement, cElement);
return new String (aElement);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getRepeated",
"(",
"final",
"char",
"cElement",
",",
"@",
"Nonnegative",
"final",
"int",
"nRepeats",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nRepeats",
",",
"\"Repeats\"",
")",
";",
"if",
"(",
"nRepeats",... | Get the passed string element repeated for a certain number of times. Each
string element is simply appended at the end of the string.
@param cElement
The character to get repeated.
@param nRepeats
The number of repetitions to retrieve. May not be < 0.
@return A non-<code>null</code> string containing the string element for the
given number of times. | [
"Get",
"the",
"passed",
"string",
"element",
"repeated",
"for",
"a",
"certain",
"number",
"of",
"times",
".",
"Each",
"string",
"element",
"is",
"simply",
"appended",
"at",
"the",
"end",
"of",
"the",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2353-L2366 |
GerdHolz/TOVAL | src/de/invation/code/toval/time/TimeUtils.java | TimeUtils.diffFromDate | private static Date diffFromDate(Date date, long diff, boolean clearTimeOfDay) {
"""
Caution: Difference calculation is based on adding/subtracting milliseconds and omits time zones.<br>
In some cases the method might return possibly unexpected results due to time zones.<br>
When for example to the last day of CEST without time of day information (in 2016: 30.10.2016 00:00:00 000) milliseconds for one day are added,
the resulting date is NOT 30.10.2016 23:00:00 000 (as expected due to one hour subtraction because of summer time) but 31.10.2016 00:00:00 000.
"""
Date result = convertToUtilDate(convertToLocalDateTime(date).plusNanos(diff*1000000));
if(!clearTimeOfDay)
return result;
return clearTimeOfDay(result);
} | java | private static Date diffFromDate(Date date, long diff, boolean clearTimeOfDay){
Date result = convertToUtilDate(convertToLocalDateTime(date).plusNanos(diff*1000000));
if(!clearTimeOfDay)
return result;
return clearTimeOfDay(result);
} | [
"private",
"static",
"Date",
"diffFromDate",
"(",
"Date",
"date",
",",
"long",
"diff",
",",
"boolean",
"clearTimeOfDay",
")",
"{",
"Date",
"result",
"=",
"convertToUtilDate",
"(",
"convertToLocalDateTime",
"(",
"date",
")",
".",
"plusNanos",
"(",
"diff",
"*",
... | Caution: Difference calculation is based on adding/subtracting milliseconds and omits time zones.<br>
In some cases the method might return possibly unexpected results due to time zones.<br>
When for example to the last day of CEST without time of day information (in 2016: 30.10.2016 00:00:00 000) milliseconds for one day are added,
the resulting date is NOT 30.10.2016 23:00:00 000 (as expected due to one hour subtraction because of summer time) but 31.10.2016 00:00:00 000. | [
"Caution",
":",
"Difference",
"calculation",
"is",
"based",
"on",
"adding",
"/",
"subtracting",
"milliseconds",
"and",
"omits",
"time",
"zones",
".",
"<br",
">",
"In",
"some",
"cases",
"the",
"method",
"might",
"return",
"possibly",
"unexpected",
"results",
"d... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/time/TimeUtils.java#L128-L133 |
kiegroup/drools | kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionServiceCompiler.java | DecisionServiceCompiler.inputQualifiedNamePrefix | private static String inputQualifiedNamePrefix(DMNNode input, DMNModelImpl model) {
"""
DMN v1.2 specification, chapter "10.4 Execution Semantics of Decision Services"
The qualified name of an element named E that is defined in the same decision model as S is simply E.
Otherwise, the qualified name is I.E, where I is the name of the import element that refers to the model where E is defined.
"""
if (input.getModelNamespace().equals(model.getNamespace())) {
return null;
} else {
Optional<String> importAlias = model.getImportAliasFor(input.getModelNamespace(), input.getModelName());
if (!importAlias.isPresent()) {
MsgUtil.reportMessage(LOG,
DMNMessage.Severity.ERROR,
((DMNBaseNode)input).getSource(),
model,
null,
null,
Msg.IMPORT_NOT_FOUND_FOR_NODE_MISSING_ALIAS,
new QName(input.getModelNamespace(), input.getModelName()),
((DMNBaseNode)input).getSource());
return null;
}
return importAlias.get();
}
} | java | private static String inputQualifiedNamePrefix(DMNNode input, DMNModelImpl model) {
if (input.getModelNamespace().equals(model.getNamespace())) {
return null;
} else {
Optional<String> importAlias = model.getImportAliasFor(input.getModelNamespace(), input.getModelName());
if (!importAlias.isPresent()) {
MsgUtil.reportMessage(LOG,
DMNMessage.Severity.ERROR,
((DMNBaseNode)input).getSource(),
model,
null,
null,
Msg.IMPORT_NOT_FOUND_FOR_NODE_MISSING_ALIAS,
new QName(input.getModelNamespace(), input.getModelName()),
((DMNBaseNode)input).getSource());
return null;
}
return importAlias.get();
}
} | [
"private",
"static",
"String",
"inputQualifiedNamePrefix",
"(",
"DMNNode",
"input",
",",
"DMNModelImpl",
"model",
")",
"{",
"if",
"(",
"input",
".",
"getModelNamespace",
"(",
")",
".",
"equals",
"(",
"model",
".",
"getNamespace",
"(",
")",
")",
")",
"{",
"... | DMN v1.2 specification, chapter "10.4 Execution Semantics of Decision Services"
The qualified name of an element named E that is defined in the same decision model as S is simply E.
Otherwise, the qualified name is I.E, where I is the name of the import element that refers to the model where E is defined. | [
"DMN",
"v1",
".",
"2",
"specification",
"chapter",
"10",
".",
"4",
"Execution",
"Semantics",
"of",
"Decision",
"Services",
"The",
"qualified",
"name",
"of",
"an",
"element",
"named",
"E",
"that",
"is",
"defined",
"in",
"the",
"same",
"decision",
"model",
"... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DecisionServiceCompiler.java#L88-L107 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/BeanUtils.java | BeanUtils.copy | public static <E> E copy(Object source, Class<E> targetClass) {
"""
将source中与targetClass同名的字段从source中复制到targetClass的实例中,source中的{@link Alias Alias}注解将会生效,需要注
意的是source中的Alias注解不要对应dest中的多个字段,否则会发生不可预测错误
@param source 被复制的源对象
@param targetClass 要复制的目标对象的class对象
@param <E> 目标对象的实际类型
@return targetClass的实例,当targetClass或者source的class为接口、抽象类或者不是public时返回null
"""
if (source == null || targetClass == null) {
return null;
}
E target;
String targetClassName = targetClass.getName();
log.debug("生成{}的实例", targetClassName);
try {
// 没有权限访问该类或者该类(为接口、抽象类)不能实例化时将抛出异常
target = targetClass.newInstance();
} catch (Exception e) {
log.error("target生成失败,请检查代码;失败原因:", e);
return null;
}
return copy(target, source);
} | java | public static <E> E copy(Object source, Class<E> targetClass) {
if (source == null || targetClass == null) {
return null;
}
E target;
String targetClassName = targetClass.getName();
log.debug("生成{}的实例", targetClassName);
try {
// 没有权限访问该类或者该类(为接口、抽象类)不能实例化时将抛出异常
target = targetClass.newInstance();
} catch (Exception e) {
log.error("target生成失败,请检查代码;失败原因:", e);
return null;
}
return copy(target, source);
} | [
"public",
"static",
"<",
"E",
">",
"E",
"copy",
"(",
"Object",
"source",
",",
"Class",
"<",
"E",
">",
"targetClass",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"targetClass",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"E",
"target"... | 将source中与targetClass同名的字段从source中复制到targetClass的实例中,source中的{@link Alias Alias}注解将会生效,需要注
意的是source中的Alias注解不要对应dest中的多个字段,否则会发生不可预测错误
@param source 被复制的源对象
@param targetClass 要复制的目标对象的class对象
@param <E> 目标对象的实际类型
@return targetClass的实例,当targetClass或者source的class为接口、抽象类或者不是public时返回null | [
"将source中与targetClass同名的字段从source中复制到targetClass的实例中,source中的",
"{",
"@link",
"Alias",
"Alias",
"}",
"注解将会生效,需要注",
"意的是source中的Alias注解不要对应dest中的多个字段,否则会发生不可预测错误"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/BeanUtils.java#L140-L156 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/TaskUtils.java | TaskUtils.decorateTaskWithErrorHandler | public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task,
ErrorHandler errorHandler, boolean isRepeatingTask) {
"""
Decorate the task for error handling. If the provided
@param task the task
@param errorHandler the error handler
@param isRepeatingTask the is repeating task
@return the delegating error handling runnable
{@link ErrorHandler} is not {@code null}, it will be used. Otherwise,
repeating tasks will have errors suppressed by default whereas one-shot
tasks will have errors propagated by default since those errors may be
expected through the returned {@link Future}. In both cases, the errors
will be logged.
"""
if (task instanceof DelegatingErrorHandlingRunnable) {
return (DelegatingErrorHandlingRunnable) task;
}
ErrorHandler eh = errorHandler != null ? errorHandler : getDefaultErrorHandler(isRepeatingTask);
return new DelegatingErrorHandlingRunnable(task, eh);
} | java | public static DelegatingErrorHandlingRunnable decorateTaskWithErrorHandler(Runnable task,
ErrorHandler errorHandler, boolean isRepeatingTask) {
if (task instanceof DelegatingErrorHandlingRunnable) {
return (DelegatingErrorHandlingRunnable) task;
}
ErrorHandler eh = errorHandler != null ? errorHandler : getDefaultErrorHandler(isRepeatingTask);
return new DelegatingErrorHandlingRunnable(task, eh);
} | [
"public",
"static",
"DelegatingErrorHandlingRunnable",
"decorateTaskWithErrorHandler",
"(",
"Runnable",
"task",
",",
"ErrorHandler",
"errorHandler",
",",
"boolean",
"isRepeatingTask",
")",
"{",
"if",
"(",
"task",
"instanceof",
"DelegatingErrorHandlingRunnable",
")",
"{",
... | Decorate the task for error handling. If the provided
@param task the task
@param errorHandler the error handler
@param isRepeatingTask the is repeating task
@return the delegating error handling runnable
{@link ErrorHandler} is not {@code null}, it will be used. Otherwise,
repeating tasks will have errors suppressed by default whereas one-shot
tasks will have errors propagated by default since those errors may be
expected through the returned {@link Future}. In both cases, the errors
will be logged. | [
"Decorate",
"the",
"task",
"for",
"error",
"handling",
".",
"If",
"the",
"provided"
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/TaskUtils.java#L53-L60 |
Samsung/GearVRf | GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java | GVRSphericalEmitter.generateParticleVelocities | private float[] generateParticleVelocities() {
"""
Generate random velocities for every particle. The direction is obtained by assuming
the position of a particle as a vector. This normalised vector is scaled by
the speed range.
@return
"""
float [] particleVelocities = new float[mEmitRate * 3];
Vector3f temp = new Vector3f(0,0,0);
for ( int i = 0; i < mEmitRate * 3 ; i +=3 )
{
temp.x = mParticlePositions[i];
temp.y = mParticlePositions[i+1];
temp.z = mParticlePositions[i+2];
float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x)
+ minVelocity.x;
float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y)
+ minVelocity.y;
float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z)
+ minVelocity.z;
temp = temp.normalize();
temp.mul(velx, vely, velz, temp);
particleVelocities[i] = temp.x;
particleVelocities[i+1] = temp.y;
particleVelocities[i+2] = temp.z;
}
return particleVelocities;
} | java | private float[] generateParticleVelocities()
{
float [] particleVelocities = new float[mEmitRate * 3];
Vector3f temp = new Vector3f(0,0,0);
for ( int i = 0; i < mEmitRate * 3 ; i +=3 )
{
temp.x = mParticlePositions[i];
temp.y = mParticlePositions[i+1];
temp.z = mParticlePositions[i+2];
float velx = mRandom.nextFloat() * (maxVelocity.x- minVelocity.x)
+ minVelocity.x;
float vely = mRandom.nextFloat() * (maxVelocity.y - minVelocity.y)
+ minVelocity.y;
float velz = mRandom.nextFloat() * (maxVelocity.z - minVelocity.z)
+ minVelocity.z;
temp = temp.normalize();
temp.mul(velx, vely, velz, temp);
particleVelocities[i] = temp.x;
particleVelocities[i+1] = temp.y;
particleVelocities[i+2] = temp.z;
}
return particleVelocities;
} | [
"private",
"float",
"[",
"]",
"generateParticleVelocities",
"(",
")",
"{",
"float",
"[",
"]",
"particleVelocities",
"=",
"new",
"float",
"[",
"mEmitRate",
"*",
"3",
"]",
";",
"Vector3f",
"temp",
"=",
"new",
"Vector3f",
"(",
"0",
",",
"0",
",",
"0",
")"... | Generate random velocities for every particle. The direction is obtained by assuming
the position of a particle as a vector. This normalised vector is scaled by
the speed range.
@return | [
"Generate",
"random",
"velocities",
"for",
"every",
"particle",
".",
"The",
"direction",
"is",
"obtained",
"by",
"assuming",
"the",
"position",
"of",
"a",
"particle",
"as",
"a",
"vector",
".",
"This",
"normalised",
"vector",
"is",
"scaled",
"by",
"the",
"spe... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVRSphericalEmitter.java#L113-L142 |
geomajas/geomajas-project-client-gwt2 | plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java | TileBasedLayerClient.createDefaultOsmLayer | @Deprecated
public OsmLayer createDefaultOsmLayer(String id, TileConfiguration conf) {
"""
Create a new OSM layer with the given ID and tile configuration. The layer will be configured
with the default OSM tile services so you don't have to specify these URLs yourself.
@param id The unique ID of the layer.
@param conf The tile configuration.
@return A new OSM layer.
@deprecated use {@link #createDefaultOsmLayer(String, int)}
"""
OsmLayer layer = new OsmLayer(id, conf);
layer.addUrls(Arrays.asList(DEFAULT_OSM_URLS));
return layer;
} | java | @Deprecated
public OsmLayer createDefaultOsmLayer(String id, TileConfiguration conf) {
OsmLayer layer = new OsmLayer(id, conf);
layer.addUrls(Arrays.asList(DEFAULT_OSM_URLS));
return layer;
} | [
"@",
"Deprecated",
"public",
"OsmLayer",
"createDefaultOsmLayer",
"(",
"String",
"id",
",",
"TileConfiguration",
"conf",
")",
"{",
"OsmLayer",
"layer",
"=",
"new",
"OsmLayer",
"(",
"id",
",",
"conf",
")",
";",
"layer",
".",
"addUrls",
"(",
"Arrays",
".",
"... | Create a new OSM layer with the given ID and tile configuration. The layer will be configured
with the default OSM tile services so you don't have to specify these URLs yourself.
@param id The unique ID of the layer.
@param conf The tile configuration.
@return A new OSM layer.
@deprecated use {@link #createDefaultOsmLayer(String, int)} | [
"Create",
"a",
"new",
"OSM",
"layer",
"with",
"the",
"given",
"ID",
"and",
"tile",
"configuration",
".",
"The",
"layer",
"will",
"be",
"configured",
"with",
"the",
"default",
"OSM",
"tile",
"services",
"so",
"you",
"don",
"t",
"have",
"to",
"specify",
"t... | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java#L132-L137 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java | ExecutionGraph.getOutputVertex | public ExecutionVertex getOutputVertex(final int stage, final int index) {
"""
Returns the output vertex with the specified index for the given stage.
@param stage
the index of the stage
@param index
the index of the output vertex to return
@return the output vertex with the specified index or <code>null</code> if no output vertex with such an index
exists in that stage
"""
try {
final ExecutionStage s = this.stages.get(stage);
if (s == null) {
return null;
}
return s.getOutputExecutionVertex(index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
} | java | public ExecutionVertex getOutputVertex(final int stage, final int index) {
try {
final ExecutionStage s = this.stages.get(stage);
if (s == null) {
return null;
}
return s.getOutputExecutionVertex(index);
} catch (ArrayIndexOutOfBoundsException e) {
return null;
}
} | [
"public",
"ExecutionVertex",
"getOutputVertex",
"(",
"final",
"int",
"stage",
",",
"final",
"int",
"index",
")",
"{",
"try",
"{",
"final",
"ExecutionStage",
"s",
"=",
"this",
".",
"stages",
".",
"get",
"(",
"stage",
")",
";",
"if",
"(",
"s",
"==",
"nul... | Returns the output vertex with the specified index for the given stage.
@param stage
the index of the stage
@param index
the index of the output vertex to return
@return the output vertex with the specified index or <code>null</code> if no output vertex with such an index
exists in that stage | [
"Returns",
"the",
"output",
"vertex",
"with",
"the",
"specified",
"index",
"for",
"the",
"given",
"stage",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L701-L714 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java | MaterialListValueBox.addItem | public void addItem(T value, String text, boolean reload) {
"""
Adds an item to the list box, specifying an initial value for the item.
@param value the item's value, to be submitted if it is part of a
{@link FormPanel}; cannot be <code>null</code>
@param text the text of the item to be added
@param reload perform a 'material select' reload to update the DOM.
"""
values.add(value);
listBox.addItem(text, keyFactory.generateKey(value));
if (reload) {
reload();
}
} | java | public void addItem(T value, String text, boolean reload) {
values.add(value);
listBox.addItem(text, keyFactory.generateKey(value));
if (reload) {
reload();
}
} | [
"public",
"void",
"addItem",
"(",
"T",
"value",
",",
"String",
"text",
",",
"boolean",
"reload",
")",
"{",
"values",
".",
"add",
"(",
"value",
")",
";",
"listBox",
".",
"addItem",
"(",
"text",
",",
"keyFactory",
".",
"generateKey",
"(",
"value",
")",
... | Adds an item to the list box, specifying an initial value for the item.
@param value the item's value, to be submitted if it is part of a
{@link FormPanel}; cannot be <code>null</code>
@param text the text of the item to be added
@param reload perform a 'material select' reload to update the DOM. | [
"Adds",
"an",
"item",
"to",
"the",
"list",
"box",
"specifying",
"an",
"initial",
"value",
"for",
"the",
"item",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L258-L265 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_billingAccount_line_POST | public OvhOrder telephony_billingAccount_line_POST(String billingAccount, String brand, Boolean[] displayUniversalDirectories, Long[] extraSimultaneousLines, String mondialRelayId, String[] offers, Long[] ownerContactIds, Long quantity, Boolean retractation, Long shippingContactId, OvhLineTypeEnum[] types, String[] zones) throws IOException {
"""
Create order
REST: POST /order/telephony/{billingAccount}/line
@param extraSimultaneousLines [required] Additional simultaneous numbers. Set several simultaneous lines for each line per phone
@param quantity [required] Quantity of request repetition in this configuration
@param retractation [required] Retractation rights if set
@param zones [required] Geographic zones. Let empty for nogeographic type. Set several zones for each line per phone
@param ownerContactIds [required] Owner contact information id from /me entry point for each line
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping address information entry.
@param brand [required] Phone brands wanted with the offer. Set null for NO phone
@param displayUniversalDirectories [required] Publish owner contact informations on universal directories or not
@param offers [required] The line offers. Set several offers for each line per phone (Deprecated, use offer method instead)
@param shippingContactId [required] Shipping contact information id from /me entry point
@param types [required] Number type. Set several types for each line per phone
@param billingAccount [required] The name of your billingAccount
"""
String qPath = "/order/telephony/{billingAccount}/line";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "brand", brand);
addBody(o, "displayUniversalDirectories", displayUniversalDirectories);
addBody(o, "extraSimultaneousLines", extraSimultaneousLines);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "offers", offers);
addBody(o, "ownerContactIds", ownerContactIds);
addBody(o, "quantity", quantity);
addBody(o, "retractation", retractation);
addBody(o, "shippingContactId", shippingContactId);
addBody(o, "types", types);
addBody(o, "zones", zones);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_billingAccount_line_POST(String billingAccount, String brand, Boolean[] displayUniversalDirectories, Long[] extraSimultaneousLines, String mondialRelayId, String[] offers, Long[] ownerContactIds, Long quantity, Boolean retractation, Long shippingContactId, OvhLineTypeEnum[] types, String[] zones) throws IOException {
String qPath = "/order/telephony/{billingAccount}/line";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "brand", brand);
addBody(o, "displayUniversalDirectories", displayUniversalDirectories);
addBody(o, "extraSimultaneousLines", extraSimultaneousLines);
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "offers", offers);
addBody(o, "ownerContactIds", ownerContactIds);
addBody(o, "quantity", quantity);
addBody(o, "retractation", retractation);
addBody(o, "shippingContactId", shippingContactId);
addBody(o, "types", types);
addBody(o, "zones", zones);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_billingAccount_line_POST",
"(",
"String",
"billingAccount",
",",
"String",
"brand",
",",
"Boolean",
"[",
"]",
"displayUniversalDirectories",
",",
"Long",
"[",
"]",
"extraSimultaneousLines",
",",
"String",
"mondialRelayId",
",",
"String",... | Create order
REST: POST /order/telephony/{billingAccount}/line
@param extraSimultaneousLines [required] Additional simultaneous numbers. Set several simultaneous lines for each line per phone
@param quantity [required] Quantity of request repetition in this configuration
@param retractation [required] Retractation rights if set
@param zones [required] Geographic zones. Let empty for nogeographic type. Set several zones for each line per phone
@param ownerContactIds [required] Owner contact information id from /me entry point for each line
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping address information entry.
@param brand [required] Phone brands wanted with the offer. Set null for NO phone
@param displayUniversalDirectories [required] Publish owner contact informations on universal directories or not
@param offers [required] The line offers. Set several offers for each line per phone (Deprecated, use offer method instead)
@param shippingContactId [required] Shipping contact information id from /me entry point
@param types [required] Number type. Set several types for each line per phone
@param billingAccount [required] The name of your billingAccount | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6370-L6387 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java | VBSFaxClientSpi.invokeScript | protected FaxJobStatus invokeScript(FaxJob faxJob,String name,Object[] input,FaxActionType faxActionType) {
"""
Invokes the VB script and returns its output.
@param faxJob
The fax job object containing the needed information
@param name
The script name
@param input
The script input
@param faxActionType
The fax action type
@return The fax job status (only for get fax job status action, for others null will be returned)
"""
//generate script
String script=this.generateScript(name,input);
//invoke script
ProcessOutput processOutput=this.invokeScript(script);
//validate output
this.processOutputValidator.validateProcessOutput(this,processOutput,faxActionType);
//handle output
FaxJobStatus output=null;
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
this.processOutputHandler.updateFaxJob(this,faxJob,processOutput,faxActionType);
break;
case GET_FAX_JOB_STATUS:
output=this.processOutputHandler.getFaxJobStatus(this,processOutput);
break;
default:
//do nothing
break;
}
return output;
} | java | protected FaxJobStatus invokeScript(FaxJob faxJob,String name,Object[] input,FaxActionType faxActionType)
{
//generate script
String script=this.generateScript(name,input);
//invoke script
ProcessOutput processOutput=this.invokeScript(script);
//validate output
this.processOutputValidator.validateProcessOutput(this,processOutput,faxActionType);
//handle output
FaxJobStatus output=null;
switch(faxActionType)
{
case SUBMIT_FAX_JOB:
this.processOutputHandler.updateFaxJob(this,faxJob,processOutput,faxActionType);
break;
case GET_FAX_JOB_STATUS:
output=this.processOutputHandler.getFaxJobStatus(this,processOutput);
break;
default:
//do nothing
break;
}
return output;
} | [
"protected",
"FaxJobStatus",
"invokeScript",
"(",
"FaxJob",
"faxJob",
",",
"String",
"name",
",",
"Object",
"[",
"]",
"input",
",",
"FaxActionType",
"faxActionType",
")",
"{",
"//generate script",
"String",
"script",
"=",
"this",
".",
"generateScript",
"(",
"nam... | Invokes the VB script and returns its output.
@param faxJob
The fax job object containing the needed information
@param name
The script name
@param input
The script input
@param faxActionType
The fax action type
@return The fax job status (only for get fax job status action, for others null will be returned) | [
"Invokes",
"the",
"VB",
"script",
"and",
"returns",
"its",
"output",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/vbs/VBSFaxClientSpi.java#L620-L647 |
js-lib-com/dom | src/main/java/js/dom/w3c/DocumentImpl.java | DocumentImpl.evaluateXPathNodeNS | Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) {
"""
Name space aware variant for {@link #evaluateXPathNode(Node, String, Object...)}.
@param contextNode evaluation context node,
@param namespaceContext name space context maps prefixes to name space URIs,
@param expression XPath expression, formatting tags supported,
@param args optional formatting arguments.
@return evaluation result as element, possible null.
"""
if (args.length > 0) {
expression = Strings.format(expression, args);
}
Node node = null;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
if (namespaceContext != null) {
xpath.setNamespaceContext(namespaceContext);
}
Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE);
if (result == null) {
return null;
}
node = (Node) result;
if (node.getNodeType() != Node.ELEMENT_NODE) {
log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode);
return null;
}
} catch (XPathExpressionException e) {
throw new DomException(e);
}
return getElement(node);
} | java | Element evaluateXPathNodeNS(Node contextNode, NamespaceContext namespaceContext, String expression, Object... args) {
if (args.length > 0) {
expression = Strings.format(expression, args);
}
Node node = null;
try {
XPath xpath = XPathFactory.newInstance().newXPath();
if (namespaceContext != null) {
xpath.setNamespaceContext(namespaceContext);
}
Object result = xpath.evaluate(expression, contextNode, XPathConstants.NODE);
if (result == null) {
return null;
}
node = (Node) result;
if (node.getNodeType() != Node.ELEMENT_NODE) {
log.debug("XPath expression |%s| on |%s| yields a node that is not element. Force to null.", xpath, contextNode);
return null;
}
} catch (XPathExpressionException e) {
throw new DomException(e);
}
return getElement(node);
} | [
"Element",
"evaluateXPathNodeNS",
"(",
"Node",
"contextNode",
",",
"NamespaceContext",
"namespaceContext",
",",
"String",
"expression",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
">",
"0",
")",
"{",
"expression",
"=",
"Strings",
... | Name space aware variant for {@link #evaluateXPathNode(Node, String, Object...)}.
@param contextNode evaluation context node,
@param namespaceContext name space context maps prefixes to name space URIs,
@param expression XPath expression, formatting tags supported,
@param args optional formatting arguments.
@return evaluation result as element, possible null. | [
"Name",
"space",
"aware",
"variant",
"for",
"{",
"@link",
"#evaluateXPathNode",
"(",
"Node",
"String",
"Object",
"...",
")",
"}",
"."
] | train | https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L300-L324 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.indexOfAny | public static int indexOfAny(final CharSequence cs, final String searchChars) {
"""
<p>Search a CharSequence to find the first index of any
character in the given set of characters.</p>
<p>A {@code null} String will return {@code -1}.
A {@code null} search string will return {@code -1}.</p>
<pre>
StringUtils.indexOfAny(null, *) = -1
StringUtils.indexOfAny("", *) = -1
StringUtils.indexOfAny(*, null) = -1
StringUtils.indexOfAny(*, "") = -1
StringUtils.indexOfAny("zzabyycdxx", "za") = 0
StringUtils.indexOfAny("zzabyycdxx", "by") = 3
StringUtils.indexOfAny("aba","z") = -1
</pre>
@param cs the CharSequence to check, may be null
@param searchChars the chars to search for, may be null
@return the index of any of the chars, -1 if no match or null input
@since 2.0
@since 3.0 Changed signature from indexOfAny(String, String) to indexOfAny(CharSequence, String)
"""
if (isEmpty(cs) || isEmpty(searchChars)) {
return INDEX_NOT_FOUND;
}
return indexOfAny(cs, searchChars.toCharArray());
} | java | public static int indexOfAny(final CharSequence cs, final String searchChars) {
if (isEmpty(cs) || isEmpty(searchChars)) {
return INDEX_NOT_FOUND;
}
return indexOfAny(cs, searchChars.toCharArray());
} | [
"public",
"static",
"int",
"indexOfAny",
"(",
"final",
"CharSequence",
"cs",
",",
"final",
"String",
"searchChars",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"cs",
")",
"||",
"isEmpty",
"(",
"searchChars",
")",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
... | <p>Search a CharSequence to find the first index of any
character in the given set of characters.</p>
<p>A {@code null} String will return {@code -1}.
A {@code null} search string will return {@code -1}.</p>
<pre>
StringUtils.indexOfAny(null, *) = -1
StringUtils.indexOfAny("", *) = -1
StringUtils.indexOfAny(*, null) = -1
StringUtils.indexOfAny(*, "") = -1
StringUtils.indexOfAny("zzabyycdxx", "za") = 0
StringUtils.indexOfAny("zzabyycdxx", "by") = 3
StringUtils.indexOfAny("aba","z") = -1
</pre>
@param cs the CharSequence to check, may be null
@param searchChars the chars to search for, may be null
@return the index of any of the chars, -1 if no match or null input
@since 2.0
@since 3.0 Changed signature from indexOfAny(String, String) to indexOfAny(CharSequence, String) | [
"<p",
">",
"Search",
"a",
"CharSequence",
"to",
"find",
"the",
"first",
"index",
"of",
"any",
"character",
"in",
"the",
"given",
"set",
"of",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L2122-L2127 |
Trilarion/java-vorbis-support | src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java | VorbisAudioFileReader.getAudioFileFormat | @Override
public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException {
"""
Return the AudioFileFormat from the given InputStream.
@return
@throws javax.sound.sampled.UnsupportedAudioFileException
@throws java.io.IOException
"""
LOG.log(Level.FINE, "getAudioFileFormat(InputStream inputStream)");
try {
if (!inputStream.markSupported()) {
inputStream = new BufferedInputStream(inputStream);
}
inputStream.mark(MARK_LIMIT);
return getAudioFileFormat(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED);
} finally {
inputStream.reset();
}
} | java | @Override
public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException {
LOG.log(Level.FINE, "getAudioFileFormat(InputStream inputStream)");
try {
if (!inputStream.markSupported()) {
inputStream = new BufferedInputStream(inputStream);
}
inputStream.mark(MARK_LIMIT);
return getAudioFileFormat(inputStream, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED);
} finally {
inputStream.reset();
}
} | [
"@",
"Override",
"public",
"AudioFileFormat",
"getAudioFileFormat",
"(",
"InputStream",
"inputStream",
")",
"throws",
"UnsupportedAudioFileException",
",",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"getAudioFileFormat(InputStream inputStream... | Return the AudioFileFormat from the given InputStream.
@return
@throws javax.sound.sampled.UnsupportedAudioFileException
@throws java.io.IOException | [
"Return",
"the",
"AudioFileFormat",
"from",
"the",
"given",
"InputStream",
"."
] | train | https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java#L138-L150 |
alibaba/Tangram-Android | tangram/src/main/java/com/tmall/wireless/tangram/core/adapter/GroupBasicAdapter.java | GroupBasicAdapter.insertGroup | public void insertGroup(int inserted, @Nullable List<L> groups) {
"""
insert groups after position inserted
@param inserted index that will inserted after
@param groups new groups
"""
if (inserted < 0 || inserted >= mCards.size() || groups == null || groups.size() == 0)
return;
List<L> cards = getGroups();
boolean changed = cards.addAll(inserted, groups);
if (changed)
setData(cards);
} | java | public void insertGroup(int inserted, @Nullable List<L> groups) {
if (inserted < 0 || inserted >= mCards.size() || groups == null || groups.size() == 0)
return;
List<L> cards = getGroups();
boolean changed = cards.addAll(inserted, groups);
if (changed)
setData(cards);
} | [
"public",
"void",
"insertGroup",
"(",
"int",
"inserted",
",",
"@",
"Nullable",
"List",
"<",
"L",
">",
"groups",
")",
"{",
"if",
"(",
"inserted",
"<",
"0",
"||",
"inserted",
">=",
"mCards",
".",
"size",
"(",
")",
"||",
"groups",
"==",
"null",
"||",
... | insert groups after position inserted
@param inserted index that will inserted after
@param groups new groups | [
"insert",
"groups",
"after",
"position",
"inserted"
] | train | https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram/core/adapter/GroupBasicAdapter.java#L543-L553 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java | CfgAlignmentModel.getRootFactor | public Factor getRootFactor(ExpressionTree tree, VariableNumMap expressionVar) {
"""
This method is a hack that enables the use of the "substitutions"
field of ExpressionTree at the root of the CFG parse. In the future,
these substitutions should be handled using unary rules in the
CFG parser.
"""
List<Assignment> roots = Lists.newArrayList();
if (tree.getSubstitutions().size() == 0) {
roots.add(expressionVar.outcomeArrayToAssignment(tree.getExpressionNode()));
} else {
for (ExpressionTree substitution : tree.getSubstitutions()) {
roots.add(expressionVar.outcomeArrayToAssignment(substitution.getExpressionNode()));
}
}
return TableFactor.pointDistribution(expressionVar, roots.toArray(new Assignment[0]));
} | java | public Factor getRootFactor(ExpressionTree tree, VariableNumMap expressionVar) {
List<Assignment> roots = Lists.newArrayList();
if (tree.getSubstitutions().size() == 0) {
roots.add(expressionVar.outcomeArrayToAssignment(tree.getExpressionNode()));
} else {
for (ExpressionTree substitution : tree.getSubstitutions()) {
roots.add(expressionVar.outcomeArrayToAssignment(substitution.getExpressionNode()));
}
}
return TableFactor.pointDistribution(expressionVar, roots.toArray(new Assignment[0]));
} | [
"public",
"Factor",
"getRootFactor",
"(",
"ExpressionTree",
"tree",
",",
"VariableNumMap",
"expressionVar",
")",
"{",
"List",
"<",
"Assignment",
">",
"roots",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"if",
"(",
"tree",
".",
"getSubstitutions",
"(",
... | This method is a hack that enables the use of the "substitutions"
field of ExpressionTree at the root of the CFG parse. In the future,
these substitutions should be handled using unary rules in the
CFG parser. | [
"This",
"method",
"is",
"a",
"hack",
"that",
"enables",
"the",
"use",
"of",
"the",
"substitutions",
"field",
"of",
"ExpressionTree",
"at",
"the",
"root",
"of",
"the",
"CFG",
"parse",
".",
"In",
"the",
"future",
"these",
"substitutions",
"should",
"be",
"ha... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java#L327-L338 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/TraceNLSHelper.java | TraceNLSHelper.getString | public String getString(String key, String defaultString) {
"""
Look for a translated message using the input key. If it is not found, then
the provided default string is returned.
@param key
@param defaultString
@return String
"""
if (tnls != null)
return tnls.getString(key, defaultString);
return defaultString;
} | java | public String getString(String key, String defaultString) {
if (tnls != null)
return tnls.getString(key, defaultString);
return defaultString;
} | [
"public",
"String",
"getString",
"(",
"String",
"key",
",",
"String",
"defaultString",
")",
"{",
"if",
"(",
"tnls",
"!=",
"null",
")",
"return",
"tnls",
".",
"getString",
"(",
"key",
",",
"defaultString",
")",
";",
"return",
"defaultString",
";",
"}"
] | Look for a translated message using the input key. If it is not found, then
the provided default string is returned.
@param key
@param defaultString
@return String | [
"Look",
"for",
"a",
"translated",
"message",
"using",
"the",
"input",
"key",
".",
"If",
"it",
"is",
"not",
"found",
"then",
"the",
"provided",
"default",
"string",
"is",
"returned",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/TraceNLSHelper.java#L52-L57 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/Jinx.java | Jinx.getAuthorizationUrl | public String getAuthorizationUrl(Token requestToken, JinxConstants.OAuthPermissions permissions) throws JinxException {
"""
OAuth workflow, step two: Get an authorization URL.
<br>
Once you have a request token pass it to this method to get the authorization URL.
The user should be directed to the returned URL, where they can authorize your
application. Once they have authorized your application, they will receive a
verification code, which should be passed to the
{@link #getAccessToken(org.scribe.model.Token, String)} method.
@param requestToken the request token.
@param permissions the permissions your application is requesting.
@return authorization URL that the user should be directed to.
@throws JinxException if any parameter is null.
"""
JinxUtils.validateParams(requestToken, permissions);
String url = this.oAuthService.getAuthorizationUrl(requestToken);
return url + "&perms=" + permissions.toString();
} | java | public String getAuthorizationUrl(Token requestToken, JinxConstants.OAuthPermissions permissions) throws JinxException {
JinxUtils.validateParams(requestToken, permissions);
String url = this.oAuthService.getAuthorizationUrl(requestToken);
return url + "&perms=" + permissions.toString();
} | [
"public",
"String",
"getAuthorizationUrl",
"(",
"Token",
"requestToken",
",",
"JinxConstants",
".",
"OAuthPermissions",
"permissions",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"requestToken",
",",
"permissions",
")",
";",
"String",... | OAuth workflow, step two: Get an authorization URL.
<br>
Once you have a request token pass it to this method to get the authorization URL.
The user should be directed to the returned URL, where they can authorize your
application. Once they have authorized your application, they will receive a
verification code, which should be passed to the
{@link #getAccessToken(org.scribe.model.Token, String)} method.
@param requestToken the request token.
@param permissions the permissions your application is requesting.
@return authorization URL that the user should be directed to.
@throws JinxException if any parameter is null. | [
"OAuth",
"workflow",
"step",
"two",
":",
"Get",
"an",
"authorization",
"URL",
".",
"<br",
">",
"Once",
"you",
"have",
"a",
"request",
"token",
"pass",
"it",
"to",
"this",
"method",
"to",
"get",
"the",
"authorization",
"URL",
".",
"The",
"user",
"should",... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/Jinx.java#L267-L271 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.typeTextInWebElement | public void typeTextInWebElement(WebElement webElement, String text) {
"""
Types text in the specified WebElement.
@param webElement the WebElement to type text in
@param text the text to enter in the {@link WebElement} field
"""
if(config.commandLogging){
Log.d(config.commandLoggingTag, "typeTextInWebElement("+webElement+", \""+text+"\")");
}
clickOnWebElement(webElement);
dialogUtils.hideSoftKeyboard(null, true, true);
instrumentation.sendStringSync(text);
} | java | public void typeTextInWebElement(WebElement webElement, String text){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "typeTextInWebElement("+webElement+", \""+text+"\")");
}
clickOnWebElement(webElement);
dialogUtils.hideSoftKeyboard(null, true, true);
instrumentation.sendStringSync(text);
} | [
"public",
"void",
"typeTextInWebElement",
"(",
"WebElement",
"webElement",
",",
"String",
"text",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"typeTextInWebElement(\"",
"+",
"... | Types text in the specified WebElement.
@param webElement the WebElement to type text in
@param text the text to enter in the {@link WebElement} field | [
"Types",
"text",
"in",
"the",
"specified",
"WebElement",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2777-L2785 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java | SignatureFileVerifier.getTimestamp | private Timestamp getTimestamp(SignerInfo info)
throws IOException, NoSuchAlgorithmException, SignatureException,
CertificateException {
"""
/*
Examines a signature timestamp token to generate a timestamp object.
Examines the signer's unsigned attributes for a
<tt>signatureTimestampToken</tt> attribute. If present,
then it is parsed to extract the date and time at which the
timestamp was generated.
@param info A signer information element of a PKCS 7 block.
@return A timestamp token or null if none is present.
@throws IOException if an error is encountered while parsing the
PKCS7 data.
@throws NoSuchAlgorithmException if an error is encountered while
verifying the PKCS7 object.
@throws SignatureException if an error is encountered while
verifying the PKCS7 object.
@throws CertificateException if an error is encountered while generating
the TSA's certpath.
"""
Timestamp timestamp = null;
// Extract the signer's unsigned attributes
PKCS9Attributes unsignedAttrs = info.getUnauthenticatedAttributes();
if (unsignedAttrs != null) {
PKCS9Attribute timestampTokenAttr =
unsignedAttrs.getAttribute("signatureTimestampToken");
if (timestampTokenAttr != null) {
PKCS7 timestampToken =
new PKCS7((byte[])timestampTokenAttr.getValue());
// Extract the content (an encoded timestamp token info)
byte[] encodedTimestampTokenInfo =
timestampToken.getContentInfo().getData();
// Extract the signer (the Timestamping Authority)
// while verifying the content
SignerInfo[] tsa =
timestampToken.verify(encodedTimestampTokenInfo);
// Expect only one signer
ArrayList<X509Certificate> chain =
tsa[0].getCertificateChain(timestampToken);
CertPath tsaChain = certificateFactory.generateCertPath(chain);
// Create a timestamp token info object
TimestampToken timestampTokenInfo =
new TimestampToken(encodedTimestampTokenInfo);
// Check that the signature timestamp applies to this signature
verifyTimestamp(timestampTokenInfo, info.getEncryptedDigest());
// Create a timestamp object
timestamp =
new Timestamp(timestampTokenInfo.getDate(), tsaChain);
}
}
return timestamp;
} | java | private Timestamp getTimestamp(SignerInfo info)
throws IOException, NoSuchAlgorithmException, SignatureException,
CertificateException {
Timestamp timestamp = null;
// Extract the signer's unsigned attributes
PKCS9Attributes unsignedAttrs = info.getUnauthenticatedAttributes();
if (unsignedAttrs != null) {
PKCS9Attribute timestampTokenAttr =
unsignedAttrs.getAttribute("signatureTimestampToken");
if (timestampTokenAttr != null) {
PKCS7 timestampToken =
new PKCS7((byte[])timestampTokenAttr.getValue());
// Extract the content (an encoded timestamp token info)
byte[] encodedTimestampTokenInfo =
timestampToken.getContentInfo().getData();
// Extract the signer (the Timestamping Authority)
// while verifying the content
SignerInfo[] tsa =
timestampToken.verify(encodedTimestampTokenInfo);
// Expect only one signer
ArrayList<X509Certificate> chain =
tsa[0].getCertificateChain(timestampToken);
CertPath tsaChain = certificateFactory.generateCertPath(chain);
// Create a timestamp token info object
TimestampToken timestampTokenInfo =
new TimestampToken(encodedTimestampTokenInfo);
// Check that the signature timestamp applies to this signature
verifyTimestamp(timestampTokenInfo, info.getEncryptedDigest());
// Create a timestamp object
timestamp =
new Timestamp(timestampTokenInfo.getDate(), tsaChain);
}
}
return timestamp;
} | [
"private",
"Timestamp",
"getTimestamp",
"(",
"SignerInfo",
"info",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"SignatureException",
",",
"CertificateException",
"{",
"Timestamp",
"timestamp",
"=",
"null",
";",
"// Extract the signer's unsigned attri... | /*
Examines a signature timestamp token to generate a timestamp object.
Examines the signer's unsigned attributes for a
<tt>signatureTimestampToken</tt> attribute. If present,
then it is parsed to extract the date and time at which the
timestamp was generated.
@param info A signer information element of a PKCS 7 block.
@return A timestamp token or null if none is present.
@throws IOException if an error is encountered while parsing the
PKCS7 data.
@throws NoSuchAlgorithmException if an error is encountered while
verifying the PKCS7 object.
@throws SignatureException if an error is encountered while
verifying the PKCS7 object.
@throws CertificateException if an error is encountered while generating
the TSA's certpath. | [
"/",
"*",
"Examines",
"a",
"signature",
"timestamp",
"token",
"to",
"generate",
"a",
"timestamp",
"object",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java#L523-L559 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.handleDeleteFile | protected FileApiResponse handleDeleteFile(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
"""
Makes the api call to delete a file attached to an entity.
@param type
@param entityId
@param fileId
@return
"""
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesDeleteFile(BullhornEntityInfo.getTypesRestEntityName(type),
entityId, fileId);
String url = restUrlFactory.assembleDeleteFileUrl();
StandardFileApiResponse fileApiResponse = this.performCustomRequest(url, null, StandardFileApiResponse.class, uriVariables,
HttpMethod.DELETE, null);
return fileApiResponse;
} | java | protected FileApiResponse handleDeleteFile(Class<? extends FileEntity> type, Integer entityId, Integer fileId) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesDeleteFile(BullhornEntityInfo.getTypesRestEntityName(type),
entityId, fileId);
String url = restUrlFactory.assembleDeleteFileUrl();
StandardFileApiResponse fileApiResponse = this.performCustomRequest(url, null, StandardFileApiResponse.class, uriVariables,
HttpMethod.DELETE, null);
return fileApiResponse;
} | [
"protected",
"FileApiResponse",
"handleDeleteFile",
"(",
"Class",
"<",
"?",
"extends",
"FileEntity",
">",
"type",
",",
"Integer",
"entityId",
",",
"Integer",
"fileId",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"uriVariables",
"=",
"restUriVariablesFact... | Makes the api call to delete a file attached to an entity.
@param type
@param entityId
@param fileId
@return | [
"Makes",
"the",
"api",
"call",
"to",
"delete",
"a",
"file",
"attached",
"to",
"an",
"entity",
"."
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1746-L1754 |
irmen/Pyrolite | java/src/main/java/net/razorvine/pyro/PyroProxy.java | PyroProxy.call_oneway | public void call_oneway(String method, Object... arguments) throws PickleException, PyroException, IOException {
"""
Call a method on the remote Pyro object this proxy is for, using Oneway call semantics (return immediately).
@param method the name of the method you want to call
@param arguments zero or more arguments for the remote method
"""
internal_call(method, null, Message.FLAGS_ONEWAY, true, arguments);
} | java | public void call_oneway(String method, Object... arguments) throws PickleException, PyroException, IOException {
internal_call(method, null, Message.FLAGS_ONEWAY, true, arguments);
} | [
"public",
"void",
"call_oneway",
"(",
"String",
"method",
",",
"Object",
"...",
"arguments",
")",
"throws",
"PickleException",
",",
"PyroException",
",",
"IOException",
"{",
"internal_call",
"(",
"method",
",",
"null",
",",
"Message",
".",
"FLAGS_ONEWAY",
",",
... | Call a method on the remote Pyro object this proxy is for, using Oneway call semantics (return immediately).
@param method the name of the method you want to call
@param arguments zero or more arguments for the remote method | [
"Call",
"a",
"method",
"on",
"the",
"remote",
"Pyro",
"object",
"this",
"proxy",
"is",
"for",
"using",
"Oneway",
"call",
"semantics",
"(",
"return",
"immediately",
")",
"."
] | train | https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pyro/PyroProxy.java#L186-L188 |
ganglia/jmxetric | src/main/java/info/ganglia/jmxetric/MBeanSampler.java | MBeanSampler.addMBeanAttribute | public void addMBeanAttribute(String mbean, MBeanAttribute attr)
throws Exception {
"""
Adds an {@link info.ganglia.jmxetric.MBeanAttribute} to be sampled.
@param mbean
name of the mbean
@param attr
attribute to be sample
@throws Exception
"""
MBeanHolder mbeanHolder = mbeanMap.get(mbean);
if (mbeanHolder == null) {
mbeanHolder = new MBeanHolder(this, process, mbean);
mbeanMap.put(mbean, mbeanHolder);
}
mbeanHolder.addAttribute(attr);
log.info("Added attribute " + attr + " to " + mbean);
} | java | public void addMBeanAttribute(String mbean, MBeanAttribute attr)
throws Exception {
MBeanHolder mbeanHolder = mbeanMap.get(mbean);
if (mbeanHolder == null) {
mbeanHolder = new MBeanHolder(this, process, mbean);
mbeanMap.put(mbean, mbeanHolder);
}
mbeanHolder.addAttribute(attr);
log.info("Added attribute " + attr + " to " + mbean);
} | [
"public",
"void",
"addMBeanAttribute",
"(",
"String",
"mbean",
",",
"MBeanAttribute",
"attr",
")",
"throws",
"Exception",
"{",
"MBeanHolder",
"mbeanHolder",
"=",
"mbeanMap",
".",
"get",
"(",
"mbean",
")",
";",
"if",
"(",
"mbeanHolder",
"==",
"null",
")",
"{"... | Adds an {@link info.ganglia.jmxetric.MBeanAttribute} to be sampled.
@param mbean
name of the mbean
@param attr
attribute to be sample
@throws Exception | [
"Adds",
"an",
"{",
"@link",
"info",
".",
"ganglia",
".",
"jmxetric",
".",
"MBeanAttribute",
"}",
"to",
"be",
"sampled",
"."
] | train | https://github.com/ganglia/jmxetric/blob/0b21edb9bd75e0b2df8370ad1c77a1ea47f502ca/src/main/java/info/ganglia/jmxetric/MBeanSampler.java#L108-L117 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java | ZKPaths.getPathAndNode | public static PathAndNode getPathAndNode(String path) {
"""
Given a full path, return the node name and its path. i.e. "/one/two/three" will return {"/one/two", "three"}
@param path the path
@return the node
"""
PathUtils.validatePath(path);
int i = path.lastIndexOf(PATH_SEPARATOR);
if ( i < 0 )
{
return new PathAndNode(path, "");
}
if ( (i + 1) >= path.length() )
{
return new PathAndNode(PATH_SEPARATOR, "");
}
String node = path.substring(i + 1);
String parentPath = (i > 0) ? path.substring(0, i) : PATH_SEPARATOR;
return new PathAndNode(parentPath, node);
} | java | public static PathAndNode getPathAndNode(String path)
{
PathUtils.validatePath(path);
int i = path.lastIndexOf(PATH_SEPARATOR);
if ( i < 0 )
{
return new PathAndNode(path, "");
}
if ( (i + 1) >= path.length() )
{
return new PathAndNode(PATH_SEPARATOR, "");
}
String node = path.substring(i + 1);
String parentPath = (i > 0) ? path.substring(0, i) : PATH_SEPARATOR;
return new PathAndNode(parentPath, node);
} | [
"public",
"static",
"PathAndNode",
"getPathAndNode",
"(",
"String",
"path",
")",
"{",
"PathUtils",
".",
"validatePath",
"(",
"path",
")",
";",
"int",
"i",
"=",
"path",
".",
"lastIndexOf",
"(",
"PATH_SEPARATOR",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
... | Given a full path, return the node name and its path. i.e. "/one/two/three" will return {"/one/two", "three"}
@param path the path
@return the node | [
"Given",
"a",
"full",
"path",
"return",
"the",
"node",
"name",
"and",
"its",
"path",
".",
"i",
".",
"e",
".",
"/",
"one",
"/",
"two",
"/",
"three",
"will",
"return",
"{",
"/",
"one",
"/",
"two",
"three",
"}"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L163-L178 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java | FileUtils.string2File | public static boolean string2File(File file, String data) throws IOException {
"""
字符流写文件 较快
@param file 文件
@param data 数据
@return 操作是否成功
@throws IOException 发送IO异常
"""
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
FileWriter writer = null;
try {
writer = new FileWriter(file, false);
writer.write(data);
} finally {
if (writer != null) {
writer.close();
}
}
return true;
} | java | public static boolean string2File(File file, String data) throws IOException {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
FileWriter writer = null;
try {
writer = new FileWriter(file, false);
writer.write(data);
} finally {
if (writer != null) {
writer.close();
}
}
return true;
} | [
"public",
"static",
"boolean",
"string2File",
"(",
"File",
"file",
",",
"String",
"data",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"getParentFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"{",
"file",
".",
"getParentFile",
"(",
"... | 字符流写文件 较快
@param file 文件
@param data 数据
@return 操作是否成功
@throws IOException 发送IO异常 | [
"字符流写文件",
"较快"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java#L205-L219 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/config/Configuration.java | Configuration.setDefaultStyle | public final void setDefaultStyle(final Map<String, Style> defaultStyle) {
"""
Set the default styles. the case of the keys are not important. The retrieval will be case
insensitive.
@param defaultStyle the mapping from geometry type name (point, polygon, etc...) to the style
to use for that type.
"""
this.defaultStyle = new HashMap<>(defaultStyle.size());
for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) {
String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase());
if (normalizedName == null) {
normalizedName = entry.getKey().toLowerCase();
}
this.defaultStyle.put(normalizedName, entry.getValue());
}
} | java | public final void setDefaultStyle(final Map<String, Style> defaultStyle) {
this.defaultStyle = new HashMap<>(defaultStyle.size());
for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) {
String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase());
if (normalizedName == null) {
normalizedName = entry.getKey().toLowerCase();
}
this.defaultStyle.put(normalizedName, entry.getValue());
}
} | [
"public",
"final",
"void",
"setDefaultStyle",
"(",
"final",
"Map",
"<",
"String",
",",
"Style",
">",
"defaultStyle",
")",
"{",
"this",
".",
"defaultStyle",
"=",
"new",
"HashMap",
"<>",
"(",
"defaultStyle",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"... | Set the default styles. the case of the keys are not important. The retrieval will be case
insensitive.
@param defaultStyle the mapping from geometry type name (point, polygon, etc...) to the style
to use for that type. | [
"Set",
"the",
"default",
"styles",
".",
"the",
"case",
"of",
"the",
"keys",
"are",
"not",
"important",
".",
"The",
"retrieval",
"will",
"be",
"case",
"insensitive",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/config/Configuration.java#L446-L457 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/widget/element/Element.java | Element.getNodeListUsingJavaXPath | private NodeList getNodeListUsingJavaXPath(String xpath) throws Exception {
"""
Get the list of nodes which satisfy the xpath expression passed in
@param xpath
the input xpath expression
@return the nodeset of matching elements
@throws Exception
"""
XPathFactory xpathFac = XPathFactory.newInstance();
XPath theXpath = xpathFac.newXPath();
String html = getGUIDriver().getHtmlSource();
html = html.replaceAll(">\\s+<", "><");
InputStream input = new ByteArrayInputStream(html.getBytes(Charset.forName("UTF-8")));
XMLReader reader = new Parser();
reader.setFeature(Parser.namespacesFeature, false);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
DOMResult result = new DOMResult();
transformer.transform(new SAXSource(reader, new InputSource(input)), result);
Node htmlNode = result.getNode(); // This code gets a Node from the
// result.
NodeList nodes = (NodeList) theXpath.evaluate(xpath, htmlNode, XPathConstants.NODESET);
return nodes;
} | java | private NodeList getNodeListUsingJavaXPath(String xpath) throws Exception {
XPathFactory xpathFac = XPathFactory.newInstance();
XPath theXpath = xpathFac.newXPath();
String html = getGUIDriver().getHtmlSource();
html = html.replaceAll(">\\s+<", "><");
InputStream input = new ByteArrayInputStream(html.getBytes(Charset.forName("UTF-8")));
XMLReader reader = new Parser();
reader.setFeature(Parser.namespacesFeature, false);
Transformer transformer = TransformerFactory.newInstance().newTransformer();
DOMResult result = new DOMResult();
transformer.transform(new SAXSource(reader, new InputSource(input)), result);
Node htmlNode = result.getNode(); // This code gets a Node from the
// result.
NodeList nodes = (NodeList) theXpath.evaluate(xpath, htmlNode, XPathConstants.NODESET);
return nodes;
} | [
"private",
"NodeList",
"getNodeListUsingJavaXPath",
"(",
"String",
"xpath",
")",
"throws",
"Exception",
"{",
"XPathFactory",
"xpathFac",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"XPath",
"theXpath",
"=",
"xpathFac",
".",
"newXPath",
"(",
")",
";",... | Get the list of nodes which satisfy the xpath expression passed in
@param xpath
the input xpath expression
@return the nodeset of matching elements
@throws Exception | [
"Get",
"the",
"list",
"of",
"nodes",
"which",
"satisfy",
"the",
"xpath",
"expression",
"passed",
"in"
] | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L892-L912 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java | MessageUtils.buildMessage | static String buildMessage(BeanResolutionContext resolutionContext, Argument argument, String message, boolean circular) {
"""
Builds an appropriate error message for a constructor argument.
@param resolutionContext The resolution context
@param argument The argument
@param message The message
@param circular Is the path circular
@return The message
"""
StringBuilder builder = new StringBuilder("Failed to inject value for parameter [");
String ls = System.getProperty("line.separator");
BeanResolutionContext.Path path = resolutionContext.getPath();
builder
.append(argument.getName()).append("] of class: ")
.append(path.peek().getDeclaringType().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(circular, builder, ls, path);
return builder.toString();
} | java | static String buildMessage(BeanResolutionContext resolutionContext, Argument argument, String message, boolean circular) {
StringBuilder builder = new StringBuilder("Failed to inject value for parameter [");
String ls = System.getProperty("line.separator");
BeanResolutionContext.Path path = resolutionContext.getPath();
builder
.append(argument.getName()).append("] of class: ")
.append(path.peek().getDeclaringType().getName())
.append(ls)
.append(ls);
if (message != null) {
builder.append("Message: ").append(message).append(ls);
}
appendPath(circular, builder, ls, path);
return builder.toString();
} | [
"static",
"String",
"buildMessage",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"Argument",
"argument",
",",
"String",
"message",
",",
"boolean",
"circular",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
"\"Failed to inject value fo... | Builds an appropriate error message for a constructor argument.
@param resolutionContext The resolution context
@param argument The argument
@param message The message
@param circular Is the path circular
@return The message | [
"Builds",
"an",
"appropriate",
"error",
"message",
"for",
"a",
"constructor",
"argument",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L129-L143 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.toLightweightTypeReference | public static LightweightTypeReference toLightweightTypeReference(
JvmType type, CommonTypeComputationServices services) {
"""
Convert a type reference to a lightweight type reference.
@param type - type to convert.
@param services - services used for the conversion
@return the lightweight type reference.
"""
return toLightweightTypeReference(type, services, false);
} | java | public static LightweightTypeReference toLightweightTypeReference(
JvmType type, CommonTypeComputationServices services) {
return toLightweightTypeReference(type, services, false);
} | [
"public",
"static",
"LightweightTypeReference",
"toLightweightTypeReference",
"(",
"JvmType",
"type",
",",
"CommonTypeComputationServices",
"services",
")",
"{",
"return",
"toLightweightTypeReference",
"(",
"type",
",",
"services",
",",
"false",
")",
";",
"}"
] | Convert a type reference to a lightweight type reference.
@param type - type to convert.
@param services - services used for the conversion
@return the lightweight type reference. | [
"Convert",
"a",
"type",
"reference",
"to",
"a",
"lightweight",
"type",
"reference",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L627-L630 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/Graphics.java | Graphics.applyMask | public static ImageBuffer applyMask(ImageBuffer imageBuffer, ColorRgba maskColor) {
"""
Apply color mask to the image.
@param imageBuffer The image reference (must not be <code>null</code>).
@param maskColor The color mask (must not be <code>null</code>).
@return The masked image buffer.
@throws LionEngineException If invalid arguments.
"""
return factoryGraphic.applyMask(imageBuffer, maskColor);
} | java | public static ImageBuffer applyMask(ImageBuffer imageBuffer, ColorRgba maskColor)
{
return factoryGraphic.applyMask(imageBuffer, maskColor);
} | [
"public",
"static",
"ImageBuffer",
"applyMask",
"(",
"ImageBuffer",
"imageBuffer",
",",
"ColorRgba",
"maskColor",
")",
"{",
"return",
"factoryGraphic",
".",
"applyMask",
"(",
"imageBuffer",
",",
"maskColor",
")",
";",
"}"
] | Apply color mask to the image.
@param imageBuffer The image reference (must not be <code>null</code>).
@param maskColor The color mask (must not be <code>null</code>).
@return The masked image buffer.
@throws LionEngineException If invalid arguments. | [
"Apply",
"color",
"mask",
"to",
"the",
"image",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/Graphics.java#L163-L166 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java | BundlesHandlerFactory.getBundleFromName | private JoinableResourceBundle getBundleFromName(String name, List<JoinableResourceBundle> bundles) {
"""
Returns a bundle from its name
@param name
the bundle name
@param bundles
the list of bundle
@return a bundle from its name
"""
JoinableResourceBundle bundle = null;
for (JoinableResourceBundle aBundle : bundles) {
if (aBundle.getName().equals(name)) {
bundle = aBundle;
break;
}
}
return bundle;
} | java | private JoinableResourceBundle getBundleFromName(String name, List<JoinableResourceBundle> bundles) {
JoinableResourceBundle bundle = null;
for (JoinableResourceBundle aBundle : bundles) {
if (aBundle.getName().equals(name)) {
bundle = aBundle;
break;
}
}
return bundle;
} | [
"private",
"JoinableResourceBundle",
"getBundleFromName",
"(",
"String",
"name",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
")",
"{",
"JoinableResourceBundle",
"bundle",
"=",
"null",
";",
"for",
"(",
"JoinableResourceBundle",
"aBundle",
":",
"bundles"... | Returns a bundle from its name
@param name
the bundle name
@param bundles
the list of bundle
@return a bundle from its name | [
"Returns",
"a",
"bundle",
"from",
"its",
"name"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L453-L464 |
adyliu/jafka | src/main/java/io/jafka/producer/ZKBrokerPartitionInfo.java | ZKBrokerPartitionInfo.getZKTopicPartitionInfo | private Map<String, SortedSet<Partition>> getZKTopicPartitionInfo(Map<Integer, Broker> allBrokers) {
"""
Generate a sequence of (brokerId, numPartitions) for all topics registered in zookeeper
@param allBrokers all register brokers
@return a mapping from topic to sequence of (brokerId, numPartitions)
"""
final Map<String, SortedSet<Partition>> brokerPartitionsPerTopic = new HashMap<String, SortedSet<Partition>>();
ZkUtils.makeSurePersistentPathExists(zkClient, ZkUtils.BrokerTopicsPath);
List<String> topics = ZkUtils.getChildrenParentMayNotExist(zkClient, ZkUtils.BrokerTopicsPath);
for (String topic : topics) {
// find the number of broker partitions registered for this topic
String brokerTopicPath = ZkUtils.BrokerTopicsPath + "/" + topic;
List<String> brokerList = ZkUtils.getChildrenParentMayNotExist(zkClient, brokerTopicPath);
//
final SortedSet<Partition> sortedBrokerPartitions = new TreeSet<Partition>();
final Set<Integer> existBids = new HashSet<Integer>();
for (String bid : brokerList) {
final int ibid = Integer.parseInt(bid);
final String numPath = brokerTopicPath + "/" + bid;
final Integer numPartition = Integer.valueOf(ZkUtils.readData(zkClient, numPath));
for (int i = 0; i < numPartition.intValue(); i++) {
sortedBrokerPartitions.add(new Partition(ibid, i));
}
existBids.add(ibid);
}
// add all brokers after topic created
for(Integer bid:allBrokers.keySet()){
if(!existBids.contains(bid)){
sortedBrokerPartitions.add(new Partition(bid,0));// this broker run after topic created
}
}
logger.debug("Broker ids and # of partitions on each for topic: " + topic + " = " + sortedBrokerPartitions);
brokerPartitionsPerTopic.put(topic, sortedBrokerPartitions);
}
return brokerPartitionsPerTopic;
} | java | private Map<String, SortedSet<Partition>> getZKTopicPartitionInfo(Map<Integer, Broker> allBrokers) {
final Map<String, SortedSet<Partition>> brokerPartitionsPerTopic = new HashMap<String, SortedSet<Partition>>();
ZkUtils.makeSurePersistentPathExists(zkClient, ZkUtils.BrokerTopicsPath);
List<String> topics = ZkUtils.getChildrenParentMayNotExist(zkClient, ZkUtils.BrokerTopicsPath);
for (String topic : topics) {
// find the number of broker partitions registered for this topic
String brokerTopicPath = ZkUtils.BrokerTopicsPath + "/" + topic;
List<String> brokerList = ZkUtils.getChildrenParentMayNotExist(zkClient, brokerTopicPath);
//
final SortedSet<Partition> sortedBrokerPartitions = new TreeSet<Partition>();
final Set<Integer> existBids = new HashSet<Integer>();
for (String bid : brokerList) {
final int ibid = Integer.parseInt(bid);
final String numPath = brokerTopicPath + "/" + bid;
final Integer numPartition = Integer.valueOf(ZkUtils.readData(zkClient, numPath));
for (int i = 0; i < numPartition.intValue(); i++) {
sortedBrokerPartitions.add(new Partition(ibid, i));
}
existBids.add(ibid);
}
// add all brokers after topic created
for(Integer bid:allBrokers.keySet()){
if(!existBids.contains(bid)){
sortedBrokerPartitions.add(new Partition(bid,0));// this broker run after topic created
}
}
logger.debug("Broker ids and # of partitions on each for topic: " + topic + " = " + sortedBrokerPartitions);
brokerPartitionsPerTopic.put(topic, sortedBrokerPartitions);
}
return brokerPartitionsPerTopic;
} | [
"private",
"Map",
"<",
"String",
",",
"SortedSet",
"<",
"Partition",
">",
">",
"getZKTopicPartitionInfo",
"(",
"Map",
"<",
"Integer",
",",
"Broker",
">",
"allBrokers",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"SortedSet",
"<",
"Partition",
">",
">",
... | Generate a sequence of (brokerId, numPartitions) for all topics registered in zookeeper
@param allBrokers all register brokers
@return a mapping from topic to sequence of (brokerId, numPartitions) | [
"Generate",
"a",
"sequence",
"of",
"(",
"brokerId",
"numPartitions",
")",
"for",
"all",
"topics",
"registered",
"in",
"zookeeper"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/producer/ZKBrokerPartitionInfo.java#L133-L163 |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java | JScreen.getGBConstraints | public GridBagConstraints getGBConstraints() {
"""
Get the GridBagConstraints.
@return The gridbag constraints object.
"""
if (m_gbconstraints == null)
{
m_gbconstraints = new GridBagConstraints();
m_gbconstraints.insets = new Insets(2, 2, 2, 2);
m_gbconstraints.ipadx = 2;
m_gbconstraints.ipady = 2;
}
return m_gbconstraints;
} | java | public GridBagConstraints getGBConstraints()
{
if (m_gbconstraints == null)
{
m_gbconstraints = new GridBagConstraints();
m_gbconstraints.insets = new Insets(2, 2, 2, 2);
m_gbconstraints.ipadx = 2;
m_gbconstraints.ipady = 2;
}
return m_gbconstraints;
} | [
"public",
"GridBagConstraints",
"getGBConstraints",
"(",
")",
"{",
"if",
"(",
"m_gbconstraints",
"==",
"null",
")",
"{",
"m_gbconstraints",
"=",
"new",
"GridBagConstraints",
"(",
")",
";",
"m_gbconstraints",
".",
"insets",
"=",
"new",
"Insets",
"(",
"2",
",",
... | Get the GridBagConstraints.
@return The gridbag constraints object. | [
"Get",
"the",
"GridBagConstraints",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L182-L192 |
lucasr/probe | library/src/main/java/org/lucasr/probe/Interceptor.java | Interceptor.invokeDraw | protected final void invokeDraw(View view, Canvas canvas) {
"""
Performs a {@link View#draw(Canvas)} call on the given {@link View}.
"""
final ViewProxy proxy = (ViewProxy) view;
proxy.invokeDraw(canvas);
} | java | protected final void invokeDraw(View view, Canvas canvas) {
final ViewProxy proxy = (ViewProxy) view;
proxy.invokeDraw(canvas);
} | [
"protected",
"final",
"void",
"invokeDraw",
"(",
"View",
"view",
",",
"Canvas",
"canvas",
")",
"{",
"final",
"ViewProxy",
"proxy",
"=",
"(",
"ViewProxy",
")",
"view",
";",
"proxy",
".",
"invokeDraw",
"(",
"canvas",
")",
";",
"}"
] | Performs a {@link View#draw(Canvas)} call on the given {@link View}. | [
"Performs",
"a",
"{"
] | train | https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L91-L94 |
apache/groovy | src/main/groovy/groovy/transform/stc/ClosureSignatureHint.java | ClosureSignatureHint.pickGenericType | public static ClassNode pickGenericType(MethodNode node, int parameterIndex, int gtIndex) {
"""
A helper method which will extract the n-th generic type from the n-th parameter of a method node.
@param node the method node from which the generic type should be picked
@param parameterIndex the index of the parameter in the method parameter list
@param gtIndex the index of the generic type to extract
@return the generic type, or {@link org.codehaus.groovy.ast.ClassHelper#OBJECT_TYPE} if it doesn't exist.
"""
final Parameter[] parameters = node.getParameters();
final ClassNode type = parameters[parameterIndex].getOriginType();
return pickGenericType(type, gtIndex);
} | java | public static ClassNode pickGenericType(MethodNode node, int parameterIndex, int gtIndex) {
final Parameter[] parameters = node.getParameters();
final ClassNode type = parameters[parameterIndex].getOriginType();
return pickGenericType(type, gtIndex);
} | [
"public",
"static",
"ClassNode",
"pickGenericType",
"(",
"MethodNode",
"node",
",",
"int",
"parameterIndex",
",",
"int",
"gtIndex",
")",
"{",
"final",
"Parameter",
"[",
"]",
"parameters",
"=",
"node",
".",
"getParameters",
"(",
")",
";",
"final",
"ClassNode",
... | A helper method which will extract the n-th generic type from the n-th parameter of a method node.
@param node the method node from which the generic type should be picked
@param parameterIndex the index of the parameter in the method parameter list
@param gtIndex the index of the generic type to extract
@return the generic type, or {@link org.codehaus.groovy.ast.ClassHelper#OBJECT_TYPE} if it doesn't exist. | [
"A",
"helper",
"method",
"which",
"will",
"extract",
"the",
"n",
"-",
"th",
"generic",
"type",
"from",
"the",
"n",
"-",
"th",
"parameter",
"of",
"a",
"method",
"node",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/transform/stc/ClosureSignatureHint.java#L76-L80 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java | BitmapUtils.storeOnCacheDir | public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
"""
Store the bitmap on the cache directory path.
@param context the context.
@param bitmap to store.
@param path file path.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file.
"""
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
} | java | public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
} | [
"public",
"static",
"File",
"storeOnCacheDir",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"path",
",",
"String",
"filename",
",",
"Bitmap",
".",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"{",
"File",
"dir",
"=",
"new",
... | Store the bitmap on the cache directory path.
@param context the context.
@param bitmap to store.
@param path file path.
@param filename file name.
@param format bitmap format.
@param quality the quality of the compressed bitmap.
@return the compressed bitmap file. | [
"Store",
"the",
"bitmap",
"on",
"the",
"cache",
"directory",
"path",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L250-L258 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java | CouchDbClient.executeToInputStream | public InputStream executeToInputStream(HttpConnection connection) throws CouchDbException {
"""
<p>Execute the HttpConnection request and return the InputStream if there were no errors.</p>
<p>The stream <b>must</b> be closed after use.</p>
@param connection the request HttpConnection
@return InputStream from the HttpConnection response
@throws CouchDbException for HTTP error codes or if there was an IOException
"""
try {
return execute(connection).responseAsInputStream();
} catch (IOException ioe) {
throw new CouchDbException("Error retrieving server response", ioe);
}
} | java | public InputStream executeToInputStream(HttpConnection connection) throws CouchDbException {
try {
return execute(connection).responseAsInputStream();
} catch (IOException ioe) {
throw new CouchDbException("Error retrieving server response", ioe);
}
} | [
"public",
"InputStream",
"executeToInputStream",
"(",
"HttpConnection",
"connection",
")",
"throws",
"CouchDbException",
"{",
"try",
"{",
"return",
"execute",
"(",
"connection",
")",
".",
"responseAsInputStream",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"i... | <p>Execute the HttpConnection request and return the InputStream if there were no errors.</p>
<p>The stream <b>must</b> be closed after use.</p>
@param connection the request HttpConnection
@return InputStream from the HttpConnection response
@throws CouchDbException for HTTP error codes or if there was an IOException | [
"<p",
">",
"Execute",
"the",
"HttpConnection",
"request",
"and",
"return",
"the",
"InputStream",
"if",
"there",
"were",
"no",
"errors",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"stream",
"<b",
">",
"must<",
"/",
"b",
">",
"be",
"closed",
"after",
"... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java#L644-L650 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java | LatLongUtils.fromString | public static LatLong fromString(String latLongString) {
"""
Creates a new LatLong from a comma-separated string of coordinates in the order latitude, longitude. All
coordinate values must be in degrees.
@param latLongString the string that describes the LatLong.
@return a new LatLong with the given coordinates.
@throws IllegalArgumentException if the string cannot be parsed or describes an invalid LatLong.
"""
double[] coordinates = parseCoordinateString(latLongString, 2);
return new LatLong(coordinates[0], coordinates[1]);
} | java | public static LatLong fromString(String latLongString) {
double[] coordinates = parseCoordinateString(latLongString, 2);
return new LatLong(coordinates[0], coordinates[1]);
} | [
"public",
"static",
"LatLong",
"fromString",
"(",
"String",
"latLongString",
")",
"{",
"double",
"[",
"]",
"coordinates",
"=",
"parseCoordinateString",
"(",
"latLongString",
",",
"2",
")",
";",
"return",
"new",
"LatLong",
"(",
"coordinates",
"[",
"0",
"]",
"... | Creates a new LatLong from a comma-separated string of coordinates in the order latitude, longitude. All
coordinate values must be in degrees.
@param latLongString the string that describes the LatLong.
@return a new LatLong with the given coordinates.
@throws IllegalArgumentException if the string cannot be parsed or describes an invalid LatLong. | [
"Creates",
"a",
"new",
"LatLong",
"from",
"a",
"comma",
"-",
"separated",
"string",
"of",
"coordinates",
"in",
"the",
"order",
"latitude",
"longitude",
".",
"All",
"coordinate",
"values",
"must",
"be",
"in",
"degrees",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L180-L183 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/auth/SignerFactory.java | SignerFactory.lookupAndCreateSigner | private static Signer lookupAndCreateSigner(String serviceName, String regionName) {
"""
Internal implementation for looking up and creating a signer by service
name and region.
"""
String signerType = lookUpSignerTypeByServiceAndRegion(serviceName, regionName);
return createSigner(signerType, serviceName);
} | java | private static Signer lookupAndCreateSigner(String serviceName, String regionName) {
String signerType = lookUpSignerTypeByServiceAndRegion(serviceName, regionName);
return createSigner(signerType, serviceName);
} | [
"private",
"static",
"Signer",
"lookupAndCreateSigner",
"(",
"String",
"serviceName",
",",
"String",
"regionName",
")",
"{",
"String",
"signerType",
"=",
"lookUpSignerTypeByServiceAndRegion",
"(",
"serviceName",
",",
"regionName",
")",
";",
"return",
"createSigner",
"... | Internal implementation for looking up and creating a signer by service
name and region. | [
"Internal",
"implementation",
"for",
"looking",
"up",
"and",
"creating",
"a",
"signer",
"by",
"service",
"name",
"and",
"region",
"."
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/auth/SignerFactory.java#L112-L115 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/graphics/SimpleTheme.java | SimpleTheme.addOverride | public synchronized Definition addOverride(Class<?> clazz, TextColor foreground, TextColor background, SGR... styles) {
"""
Adds an override for a particular class, or overwrites a previously defined override.
@param clazz Class to override the theme for
@param foreground Color to use as the foreground color for this override style
@param background Color to use as the background color for this override style
@param styles SGR styles to apply for this override
@return The newly created {@link Definition} that corresponds to this override.
"""
Definition definition = new Definition(new Style(foreground, background, styles));
overrideDefinitions.put(clazz, definition);
return definition;
} | java | public synchronized Definition addOverride(Class<?> clazz, TextColor foreground, TextColor background, SGR... styles) {
Definition definition = new Definition(new Style(foreground, background, styles));
overrideDefinitions.put(clazz, definition);
return definition;
} | [
"public",
"synchronized",
"Definition",
"addOverride",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"TextColor",
"foreground",
",",
"TextColor",
"background",
",",
"SGR",
"...",
"styles",
")",
"{",
"Definition",
"definition",
"=",
"new",
"Definition",
"(",
"new"... | Adds an override for a particular class, or overwrites a previously defined override.
@param clazz Class to override the theme for
@param foreground Color to use as the foreground color for this override style
@param background Color to use as the background color for this override style
@param styles SGR styles to apply for this override
@return The newly created {@link Definition} that corresponds to this override. | [
"Adds",
"an",
"override",
"for",
"a",
"particular",
"class",
"or",
"overwrites",
"a",
"previously",
"defined",
"override",
"."
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/graphics/SimpleTheme.java#L138-L142 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.