repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java | KeyVaultClientCustomImpl.listKeysAsync | public ServiceFuture<List<KeyItem>> listKeysAsync(final String vaultBaseUrl,
final ListOperationCallback<KeyItem> serviceCallback) {
return getKeysAsync(vaultBaseUrl, serviceCallback);
} | java | public ServiceFuture<List<KeyItem>> listKeysAsync(final String vaultBaseUrl,
final ListOperationCallback<KeyItem> serviceCallback) {
return getKeysAsync(vaultBaseUrl, serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"KeyItem",
">",
">",
"listKeysAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"ListOperationCallback",
"<",
"KeyItem",
">",
"serviceCallback",
")",
"{",
"return",
"getKeysAsync",
"(",
"vaultBaseUrl",
",",
... | List keys in the specified vault.
@param vaultBaseUrl
The vault name, e.g. https://myvault.vault.azure.net
@param serviceCallback
the async ServiceCallback to handle successful and failed
responses.
@return the {@link ServiceFuture} object | [
"List",
"keys",
"in",
"the",
"specified",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L849-L852 |
samskivert/samskivert | src/main/java/com/samskivert/util/RandomUtil.java | RandomUtil.getWeightedIndex | public static int getWeightedIndex (int[] weights, Random r)
{
int sum = IntListUtil.sum(weights);
if (sum < 1) {
return -1;
}
int pick = getInt(sum, r);
for (int ii = 0, nn = weights.length; ii < nn; ii++) {
pick -= weights[ii];
if (pick < 0) {
return ii;
}
}
log.warning("getWeightedIndex failed", new Throwable()); // Impossible!
return 0;
} | java | public static int getWeightedIndex (int[] weights, Random r)
{
int sum = IntListUtil.sum(weights);
if (sum < 1) {
return -1;
}
int pick = getInt(sum, r);
for (int ii = 0, nn = weights.length; ii < nn; ii++) {
pick -= weights[ii];
if (pick < 0) {
return ii;
}
}
log.warning("getWeightedIndex failed", new Throwable()); // Impossible!
return 0;
} | [
"public",
"static",
"int",
"getWeightedIndex",
"(",
"int",
"[",
"]",
"weights",
",",
"Random",
"r",
")",
"{",
"int",
"sum",
"=",
"IntListUtil",
".",
"sum",
"(",
"weights",
")",
";",
"if",
"(",
"sum",
"<",
"1",
")",
"{",
"return",
"-",
"1",
";",
"... | Pick a random index from the array, weighted by the value of the corresponding array
element.
@param weights an array of non-negative integers.
@param r the random number generator to use
@return an index into the array, or -1 if the sum of the weights is less than 1. For
example, passing in {1, 0, 3, 4} will return:
<pre>{@code
0 - 1/8th of the time
1 - never
2 - 3/8th of the time
3 - half of the time
}</pre> | [
"Pick",
"a",
"random",
"index",
"from",
"the",
"array",
"weighted",
"by",
"the",
"value",
"of",
"the",
"corresponding",
"array",
"element",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/RandomUtil.java#L196-L211 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java | InjectionRecommender2.recommendFrom | protected void recommendFrom(String label, Set<BindingElement> source, Set<Binding> current) {
this.bindingFactory.setName(getName());
boolean hasRecommend = false;
for (final BindingElement sourceElement : source) {
final Binding wrapElement = this.bindingFactory.toBinding(sourceElement);
if (!current.contains(wrapElement)) {
if (!hasRecommend) {
LOG.info(MessageFormat.format("Begin recommendations for {0}", //$NON-NLS-1$
label));
hasRecommend = true;
}
LOG.warn(MessageFormat.format("\t{1}", //$NON-NLS-1$
label, sourceElement.getKeyString()));
}
}
if (hasRecommend) {
LOG.info(MessageFormat.format("End recommendations for {0}", //$NON-NLS-1$
label));
} else {
LOG.info(MessageFormat.format("No recommendation for {0}", //$NON-NLS-1$
label));
}
} | java | protected void recommendFrom(String label, Set<BindingElement> source, Set<Binding> current) {
this.bindingFactory.setName(getName());
boolean hasRecommend = false;
for (final BindingElement sourceElement : source) {
final Binding wrapElement = this.bindingFactory.toBinding(sourceElement);
if (!current.contains(wrapElement)) {
if (!hasRecommend) {
LOG.info(MessageFormat.format("Begin recommendations for {0}", //$NON-NLS-1$
label));
hasRecommend = true;
}
LOG.warn(MessageFormat.format("\t{1}", //$NON-NLS-1$
label, sourceElement.getKeyString()));
}
}
if (hasRecommend) {
LOG.info(MessageFormat.format("End recommendations for {0}", //$NON-NLS-1$
label));
} else {
LOG.info(MessageFormat.format("No recommendation for {0}", //$NON-NLS-1$
label));
}
} | [
"protected",
"void",
"recommendFrom",
"(",
"String",
"label",
",",
"Set",
"<",
"BindingElement",
">",
"source",
",",
"Set",
"<",
"Binding",
">",
"current",
")",
"{",
"this",
".",
"bindingFactory",
".",
"setName",
"(",
"getName",
"(",
")",
")",
";",
"bool... | Provide the recommendations.
@param label the source of the recommendation.
@param source the source of recommendation.
@param current the current bindings. | [
"Provide",
"the",
"recommendations",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java#L220-L242 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java | DFSAdmin.upgradeProgress | public int upgradeProgress(String[] argv, int idx) throws IOException {
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
if (idx != argv.length - 1) {
printUsage("-upgradeProgress");
return -1;
}
UpgradeAction action;
if ("status".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.GET_STATUS;
} else if ("details".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.DETAILED_STATUS;
} else if ("force".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.FORCE_PROCEED;
} else {
printUsage("-upgradeProgress");
return -1;
}
UpgradeStatusReport status = dfs.distributedUpgradeProgress(action);
String statusText = (status == null ?
"There are no upgrades in progress." :
status.getStatusText(action == UpgradeAction.DETAILED_STATUS));
System.out.println(statusText);
return 0;
} | java | public int upgradeProgress(String[] argv, int idx) throws IOException {
DistributedFileSystem dfs = getDFS();
if (dfs == null) {
System.out.println("FileSystem is " + getFS().getUri());
return -1;
}
if (idx != argv.length - 1) {
printUsage("-upgradeProgress");
return -1;
}
UpgradeAction action;
if ("status".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.GET_STATUS;
} else if ("details".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.DETAILED_STATUS;
} else if ("force".equalsIgnoreCase(argv[idx])) {
action = UpgradeAction.FORCE_PROCEED;
} else {
printUsage("-upgradeProgress");
return -1;
}
UpgradeStatusReport status = dfs.distributedUpgradeProgress(action);
String statusText = (status == null ?
"There are no upgrades in progress." :
status.getStatusText(action == UpgradeAction.DETAILED_STATUS));
System.out.println(statusText);
return 0;
} | [
"public",
"int",
"upgradeProgress",
"(",
"String",
"[",
"]",
"argv",
",",
"int",
"idx",
")",
"throws",
"IOException",
"{",
"DistributedFileSystem",
"dfs",
"=",
"getDFS",
"(",
")",
";",
"if",
"(",
"dfs",
"==",
"null",
")",
"{",
"System",
".",
"out",
"."... | Command to request current distributed upgrade status,
a detailed status, or to force the upgrade to proceed.
Usage: java DFSAdmin -upgradeProgress [status | details | force]
@exception IOException | [
"Command",
"to",
"request",
"current",
"distributed",
"upgrade",
"status",
"a",
"detailed",
"status",
"or",
"to",
"force",
"the",
"upgrade",
"to",
"proceed",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L709-L738 |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java | JenkinsLogs.addMasterJulLogRecords | private void addMasterJulLogRecords(Container result) {
// this file captures the most recent of those that are still kept around in memory.
// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,
// but added nonetheless just in case.
//
// should be ignorable.
result.add(new LogRecordContent("nodes/master/logs/all_memory_buffer.log") {
@Override
public Iterable<LogRecord> getLogRecords() {
return SupportPlugin.getInstance().getAllLogRecords();
}
});
final File[] julLogFiles = SupportPlugin.getRootDirectory().listFiles(new LogFilenameFilter());
if (julLogFiles == null) {
LOGGER.log(Level.WARNING, "Cannot add master java.util.logging logs to the bundle. Cannot access log files");
return;
}
// log records written to the disk
for (File file : julLogFiles){
result.add(new FileContent("nodes/master/logs/{0}", new String[]{file.getName()}, file));
}
} | java | private void addMasterJulLogRecords(Container result) {
// this file captures the most recent of those that are still kept around in memory.
// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,
// but added nonetheless just in case.
//
// should be ignorable.
result.add(new LogRecordContent("nodes/master/logs/all_memory_buffer.log") {
@Override
public Iterable<LogRecord> getLogRecords() {
return SupportPlugin.getInstance().getAllLogRecords();
}
});
final File[] julLogFiles = SupportPlugin.getRootDirectory().listFiles(new LogFilenameFilter());
if (julLogFiles == null) {
LOGGER.log(Level.WARNING, "Cannot add master java.util.logging logs to the bundle. Cannot access log files");
return;
}
// log records written to the disk
for (File file : julLogFiles){
result.add(new FileContent("nodes/master/logs/{0}", new String[]{file.getName()}, file));
}
} | [
"private",
"void",
"addMasterJulLogRecords",
"(",
"Container",
"result",
")",
"{",
"// this file captures the most recent of those that are still kept around in memory.",
"// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,",
"// but added nonetheless just i... | Adds j.u.l logging output that the support-core plugin captures.
<p>
Compared to {@link #addMasterJulRingBuffer(Container)}, this one uses disk files,
so it remembers larger number of entries. | [
"Adds",
"j",
".",
"u",
".",
"l",
"logging",
"output",
"that",
"the",
"support",
"-",
"core",
"plugin",
"captures",
"."
] | train | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java#L172-L195 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/http/HttpUtil.java | HttpUtil.encodeParameters | public static String encodeParameters(RequestConfig config, Heroku.RequestKey... keys) {
StringBuilder encodedParameters = new StringBuilder();
String separator = "";
for (Heroku.RequestKey key : keys) {
if (config.get(key) != null) {
encodedParameters.append(separator);
encodedParameters.append(urlencode(key.queryParameter, ENCODE_FAIL));
encodedParameters.append("=");
encodedParameters.append(urlencode(config.get(key), ENCODE_FAIL));
separator = "&";
}
}
return new String(encodedParameters);
} | java | public static String encodeParameters(RequestConfig config, Heroku.RequestKey... keys) {
StringBuilder encodedParameters = new StringBuilder();
String separator = "";
for (Heroku.RequestKey key : keys) {
if (config.get(key) != null) {
encodedParameters.append(separator);
encodedParameters.append(urlencode(key.queryParameter, ENCODE_FAIL));
encodedParameters.append("=");
encodedParameters.append(urlencode(config.get(key), ENCODE_FAIL));
separator = "&";
}
}
return new String(encodedParameters);
} | [
"public",
"static",
"String",
"encodeParameters",
"(",
"RequestConfig",
"config",
",",
"Heroku",
".",
"RequestKey",
"...",
"keys",
")",
"{",
"StringBuilder",
"encodedParameters",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"separator",
"=",
"\"\"",
";"... | URL encode request paramaters from a {@link RequestConfig}.
@param config Name/value pairs for a HTTP request.
@param keys List of keys in the config to encode.
@return A string representation of encoded name/value parameters. | [
"URL",
"encode",
"request",
"paramaters",
"from",
"a",
"{"
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/http/HttpUtil.java#L38-L53 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_upgrade.java | ns_upgrade.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_upgrade_responses result = (ns_upgrade_responses) service.get_payload_formatter().string_to_resource(ns_upgrade_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_upgrade_response_array);
}
ns_upgrade[] result_ns_upgrade = new ns_upgrade[result.ns_upgrade_response_array.length];
for(int i = 0; i < result.ns_upgrade_response_array.length; i++)
{
result_ns_upgrade[i] = result.ns_upgrade_response_array[i].ns_upgrade[0];
}
return result_ns_upgrade;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ns_upgrade_responses result = (ns_upgrade_responses) service.get_payload_formatter().string_to_resource(ns_upgrade_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_upgrade_response_array);
}
ns_upgrade[] result_ns_upgrade = new ns_upgrade[result.ns_upgrade_response_array.length];
for(int i = 0; i < result.ns_upgrade_response_array.length; i++)
{
result_ns_upgrade[i] = result.ns_upgrade_response_array[i].ns_upgrade[0];
}
return result_ns_upgrade;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ns_upgrade_responses",
"result",
"=",
"(",
"ns_upgrade_responses",
")",
"service",
".",
"get_payload_formatte... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_upgrade.java#L191-L208 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.orthoSymmetric | public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, Matrix4x3f dest) {
return orthoSymmetric(width, height, zNear, zFar, false, dest);
} | java | public Matrix4x3f orthoSymmetric(float width, float height, float zNear, float zFar, Matrix4x3f dest) {
return orthoSymmetric(width, height, zNear, zFar, false, dest);
} | [
"public",
"Matrix4x3f",
"orthoSymmetric",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"Matrix4x3f",
"dest",
")",
"{",
"return",
"orthoSymmetric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
"... | Apply a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>.
<p>
This method is equivalent to calling {@link #ortho(float, float, float, float, float, float, Matrix4x3f) ortho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to a symmetric orthographic projection without post-multiplying it,
use {@link #setOrthoSymmetric(float, float, float, float) setOrthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #setOrthoSymmetric(float, float, float, float)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param dest
will hold the result
@return dest | [
"Apply",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"1",
"]",
"<",
"/",
"code",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5287-L5289 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java | ColorYuv.yuvToRgb | public static <T extends ImageGray<T>>
void yuvToRgb(Planar<T> yuv , Planar<T> rgb) {
rgb.reshape(rgb.width,rgb.height,3);
if( rgb.getBandType() == GrayF32.class ) {
if(BoofConcurrency.USE_CONCURRENT ) {
ImplColorYuv_MT.yuvToRgb_F32((Planar<GrayF32>)yuv,(Planar<GrayF32>)rgb);
} else {
ImplColorYuv.yuvToRgb_F32((Planar<GrayF32>)yuv,(Planar<GrayF32>)rgb);
}
} else if( rgb.getBandType() == GrayU8.class ) {
if(BoofConcurrency.USE_CONCURRENT ) {
ImplColorYuv_MT.ycbcrToRgb_U8((Planar<GrayU8>)yuv,(Planar<GrayU8>)rgb);
} else {
ImplColorYuv.ycbcrToRgb_U8((Planar<GrayU8>)yuv,(Planar<GrayU8>)rgb);
}
} else {
throw new IllegalArgumentException("Unsupported band type "+rgb.getBandType().getSimpleName());
}
} | java | public static <T extends ImageGray<T>>
void yuvToRgb(Planar<T> yuv , Planar<T> rgb) {
rgb.reshape(rgb.width,rgb.height,3);
if( rgb.getBandType() == GrayF32.class ) {
if(BoofConcurrency.USE_CONCURRENT ) {
ImplColorYuv_MT.yuvToRgb_F32((Planar<GrayF32>)yuv,(Planar<GrayF32>)rgb);
} else {
ImplColorYuv.yuvToRgb_F32((Planar<GrayF32>)yuv,(Planar<GrayF32>)rgb);
}
} else if( rgb.getBandType() == GrayU8.class ) {
if(BoofConcurrency.USE_CONCURRENT ) {
ImplColorYuv_MT.ycbcrToRgb_U8((Planar<GrayU8>)yuv,(Planar<GrayU8>)rgb);
} else {
ImplColorYuv.ycbcrToRgb_U8((Planar<GrayU8>)yuv,(Planar<GrayU8>)rgb);
}
} else {
throw new IllegalArgumentException("Unsupported band type "+rgb.getBandType().getSimpleName());
}
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
">",
"void",
"yuvToRgb",
"(",
"Planar",
"<",
"T",
">",
"yuv",
",",
"Planar",
"<",
"T",
">",
"rgb",
")",
"{",
"rgb",
".",
"reshape",
"(",
"rgb",
".",
"width",
",",
"rgb",
".",
... | Convert a 3-channel {@link Planar} image from YUV into RGB. If integer then YCbCr and not YUV.
@param rgb (Input) RGB encoded image
@param yuv (Output) YUV encoded image | [
"Convert",
"a",
"3",
"-",
"channel",
"{",
"@link",
"Planar",
"}",
"image",
"from",
"YUV",
"into",
"RGB",
".",
"If",
"integer",
"then",
"YCbCr",
"and",
"not",
"YUV",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java#L147-L166 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/EntityListenersProcessor.java | EntityListenersProcessor.addCallBackMethod | @SuppressWarnings("unchecked")
private void addCallBackMethod(EntityMetadata metadata, Class<?> jpaAnnotation, CallbackMethod callbackMethod)
{
Map<Class<?>, List<? extends CallbackMethod>> callBackMethodsMap = metadata.getCallbackMethodsMap();
List<CallbackMethod> list = (List<CallbackMethod>) callBackMethodsMap.get(jpaAnnotation);
if (null == list)
{
list = new ArrayList<CallbackMethod>();
callBackMethodsMap.put(jpaAnnotation, list);
}
list.add(callbackMethod);
} | java | @SuppressWarnings("unchecked")
private void addCallBackMethod(EntityMetadata metadata, Class<?> jpaAnnotation, CallbackMethod callbackMethod)
{
Map<Class<?>, List<? extends CallbackMethod>> callBackMethodsMap = metadata.getCallbackMethodsMap();
List<CallbackMethod> list = (List<CallbackMethod>) callBackMethodsMap.get(jpaAnnotation);
if (null == list)
{
list = new ArrayList<CallbackMethod>();
callBackMethodsMap.put(jpaAnnotation, list);
}
list.add(callbackMethod);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"addCallBackMethod",
"(",
"EntityMetadata",
"metadata",
",",
"Class",
"<",
"?",
">",
"jpaAnnotation",
",",
"CallbackMethod",
"callbackMethod",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
">",
... | Adds the call back method.
@param metadata
the metadata
@param jpaAnnotation
the jpa annotation
@param callbackMethod
the callback method | [
"Adds",
"the",
"call",
"back",
"method",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/EntityListenersProcessor.java#L148-L159 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsAccountsApp.java | CmsAccountsApp.createGroupTable | protected I_CmsFilterableTable createGroupTable(
String path,
CmsAccountsApp cmsAccountsApp,
I_CmsOuTreeType type,
boolean toggle) {
return new CmsGroupTable(path, cmsAccountsApp, type, toggle);
} | java | protected I_CmsFilterableTable createGroupTable(
String path,
CmsAccountsApp cmsAccountsApp,
I_CmsOuTreeType type,
boolean toggle) {
return new CmsGroupTable(path, cmsAccountsApp, type, toggle);
} | [
"protected",
"I_CmsFilterableTable",
"createGroupTable",
"(",
"String",
"path",
",",
"CmsAccountsApp",
"cmsAccountsApp",
",",
"I_CmsOuTreeType",
"type",
",",
"boolean",
"toggle",
")",
"{",
"return",
"new",
"CmsGroupTable",
"(",
"path",
",",
"cmsAccountsApp",
",",
"t... | Creates a table for displaying groups.<p>
@param path the path
@param cmsAccountsApp the app instance
@param type the tree type
@param toggle the value of the 'sub-OU' toggle
@return the table | [
"Creates",
"a",
"table",
"for",
"displaying",
"groups",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAccountsApp.java#L765-L772 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/svm/PlattSMO.java | PlattSMO.setEpsilon | public void setEpsilon(double epsilon)
{
if(Double.isNaN(epsilon) || Double.isInfinite(epsilon) || epsilon <= 0)
throw new IllegalArgumentException("epsilon must be in (0, infty), not " + epsilon);
this.epsilon = epsilon;
} | java | public void setEpsilon(double epsilon)
{
if(Double.isNaN(epsilon) || Double.isInfinite(epsilon) || epsilon <= 0)
throw new IllegalArgumentException("epsilon must be in (0, infty), not " + epsilon);
this.epsilon = epsilon;
} | [
"public",
"void",
"setEpsilon",
"(",
"double",
"epsilon",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"epsilon",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"epsilon",
")",
"||",
"epsilon",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Sets the epsilon for the epsilon insensitive loss when performing
regression. This variable has no impact during classification problems.
For regression problems, any predicated value that is within the epsilon
of the target will be treated as "correct". Increasing epsilon usually
decreases the number of support vectors, but may reduce the accuracy of
the model
@param epsilon the positive value for the acceptable error when doing
regression | [
"Sets",
"the",
"epsilon",
"for",
"the",
"epsilon",
"insensitive",
"loss",
"when",
"performing",
"regression",
".",
"This",
"variable",
"has",
"no",
"impact",
"during",
"classification",
"problems",
".",
"For",
"regression",
"problems",
"any",
"predicated",
"value"... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/PlattSMO.java#L1213-L1218 |
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/RestorePointsInner.java | RestorePointsInner.beginCreate | public RestorePointInner beginCreate(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().single().body();
} | java | public RestorePointInner beginCreate(String resourceGroupName, String serverName, String databaseName, String restorePointLabel) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, restorePointLabel).toBlocking().single().body();
} | [
"public",
"RestorePointInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"restorePointLabel",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"ser... | Creates a restore point for a data warehouse.
@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 databaseName The name of the database.
@param restorePointLabel The restore point label to apply
@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 RestorePointInner object if successful. | [
"Creates",
"a",
"restore",
"point",
"for",
"a",
"data",
"warehouse",
"."
] | 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/RestorePointsInner.java#L276-L278 |
phax/ph-commons | ph-wsclient/src/main/java/com/helger/wsclient/WSClientConfig.java | WSClientConfig.setSSLSocketFactoryTrustAll | @Nonnull
public final WSClientConfig setSSLSocketFactoryTrustAll (final boolean bDebugMode) throws KeyManagementException
{
try
{
final SSLContext aSSLContext = SSLContext.getInstance ("TLSv1.2");
aSSLContext.init (null,
new TrustManager [] { new TrustManagerTrustAll (bDebugMode) },
RandomHelper.getSecureRandom ());
final SSLSocketFactory aSF = aSSLContext.getSocketFactory ();
return setSSLSocketFactory (aSF);
}
catch (final NoSuchAlgorithmException ex)
{
throw new IllegalStateException ("TLS 1.2 is not supported", ex);
}
} | java | @Nonnull
public final WSClientConfig setSSLSocketFactoryTrustAll (final boolean bDebugMode) throws KeyManagementException
{
try
{
final SSLContext aSSLContext = SSLContext.getInstance ("TLSv1.2");
aSSLContext.init (null,
new TrustManager [] { new TrustManagerTrustAll (bDebugMode) },
RandomHelper.getSecureRandom ());
final SSLSocketFactory aSF = aSSLContext.getSocketFactory ();
return setSSLSocketFactory (aSF);
}
catch (final NoSuchAlgorithmException ex)
{
throw new IllegalStateException ("TLS 1.2 is not supported", ex);
}
} | [
"@",
"Nonnull",
"public",
"final",
"WSClientConfig",
"setSSLSocketFactoryTrustAll",
"(",
"final",
"boolean",
"bDebugMode",
")",
"throws",
"KeyManagementException",
"{",
"try",
"{",
"final",
"SSLContext",
"aSSLContext",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"TL... | Set the {@link SSLSocketFactory} to be used by this client to one that
trusts all servers.
@param bDebugMode
<code>true</code> for extended debug logging, <code>false</code> for
production.
@throws KeyManagementException
if initializing the SSL context failed
@return this for chaining
@since 9.1.5 | [
"Set",
"the",
"{",
"@link",
"SSLSocketFactory",
"}",
"to",
"be",
"used",
"by",
"this",
"client",
"to",
"one",
"that",
"trusts",
"all",
"servers",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-wsclient/src/main/java/com/helger/wsclient/WSClientConfig.java#L146-L162 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java | SARLJvmModelInferrer.initializeLocalTypes | protected void initializeLocalTypes(GenerationContext context, JvmFeature feature, XExpression expression) {
if (expression != null) {
int localTypeIndex = context.getLocalTypeIndex();
final TreeIterator<EObject> iterator = EcoreUtil2.getAllNonDerivedContents(expression, true);
final String nameStub = "__" + feature.getDeclaringType().getSimpleName() + "_"; //$NON-NLS-1$ //$NON-NLS-2$
while (iterator.hasNext()) {
final EObject next = iterator.next();
if (next.eClass() == XtendPackage.Literals.ANONYMOUS_CLASS) {
inferLocalClass((AnonymousClass) next, nameStub + localTypeIndex, feature);
iterator.prune();
++localTypeIndex;
}
}
context.setLocalTypeIndex(localTypeIndex);
}
} | java | protected void initializeLocalTypes(GenerationContext context, JvmFeature feature, XExpression expression) {
if (expression != null) {
int localTypeIndex = context.getLocalTypeIndex();
final TreeIterator<EObject> iterator = EcoreUtil2.getAllNonDerivedContents(expression, true);
final String nameStub = "__" + feature.getDeclaringType().getSimpleName() + "_"; //$NON-NLS-1$ //$NON-NLS-2$
while (iterator.hasNext()) {
final EObject next = iterator.next();
if (next.eClass() == XtendPackage.Literals.ANONYMOUS_CLASS) {
inferLocalClass((AnonymousClass) next, nameStub + localTypeIndex, feature);
iterator.prune();
++localTypeIndex;
}
}
context.setLocalTypeIndex(localTypeIndex);
}
} | [
"protected",
"void",
"initializeLocalTypes",
"(",
"GenerationContext",
"context",
",",
"JvmFeature",
"feature",
",",
"XExpression",
"expression",
")",
"{",
"if",
"(",
"expression",
"!=",
"null",
")",
"{",
"int",
"localTypeIndex",
"=",
"context",
".",
"getLocalType... | Initialize the local class to the given expression.
@param context the generation context.
@param feature the feature which contains the expression.
@param expression the expression which contains the local class. | [
"Initialize",
"the",
"local",
"class",
"to",
"the",
"given",
"expression",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L456-L471 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java | BaseDataSource.getConnection | public Connection getConnection(String user, String password) throws SQLException {
try {
Connection con = DriverManager.getConnection(getUrl(), user, password);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Created a {0} for {1} at {2}",
new Object[] {getDescription(), user, getUrl()});
}
return con;
} catch (SQLException e) {
LOGGER.log(Level.FINE, "Failed to create a {0} for {1} at {2}: {3}",
new Object[] {getDescription(), user, getUrl(), e});
throw e;
}
} | java | public Connection getConnection(String user, String password) throws SQLException {
try {
Connection con = DriverManager.getConnection(getUrl(), user, password);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Created a {0} for {1} at {2}",
new Object[] {getDescription(), user, getUrl()});
}
return con;
} catch (SQLException e) {
LOGGER.log(Level.FINE, "Failed to create a {0} for {1} at {2}: {3}",
new Object[] {getDescription(), user, getUrl(), e});
throw e;
}
} | [
"public",
"Connection",
"getConnection",
"(",
"String",
"user",
",",
"String",
"password",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"Connection",
"con",
"=",
"DriverManager",
".",
"getConnection",
"(",
"getUrl",
"(",
")",
",",
"user",
",",
"password",
... | Gets a connection to the PostgreSQL database. The database is identified by the DataSource
properties serverName, databaseName, and portNumber. The user to connect as is identified by
the arguments user and password, which override the DataSource properties by the same name.
@param user user
@param password password
@return A valid database connection.
@throws SQLException Occurs when the database connection cannot be established. | [
"Gets",
"a",
"connection",
"to",
"the",
"PostgreSQL",
"database",
".",
"The",
"database",
"is",
"identified",
"by",
"the",
"DataSource",
"properties",
"serverName",
"databaseName",
"and",
"portNumber",
".",
"The",
"user",
"to",
"connect",
"as",
"is",
"identified... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java#L95-L108 |
sundrio/sundrio | annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java | ToPojo.readPrimitiveArrayValue | private static String readPrimitiveArrayValue(String ref, TypeDef source, Property property) {
StringBuilder sb = new StringBuilder();
Method getter = getterOf(source, property);
sb.append(indent(ref))
.append("Arrays.stream(")
.append("("+property.getTypeRef().toString()+")(" + ref + " instanceof Map ? ((Map)" + ref + ").getOrDefault(\"" + getterOf(source, property).getName() + "\" , " + getDefaultValue(property)+") : "+ getDefaultValue(property)+")")
.append(".toArray(size -> new "+getter.getReturnType().toString()+"[size])");
return sb.toString();
} | java | private static String readPrimitiveArrayValue(String ref, TypeDef source, Property property) {
StringBuilder sb = new StringBuilder();
Method getter = getterOf(source, property);
sb.append(indent(ref))
.append("Arrays.stream(")
.append("("+property.getTypeRef().toString()+")(" + ref + " instanceof Map ? ((Map)" + ref + ").getOrDefault(\"" + getterOf(source, property).getName() + "\" , " + getDefaultValue(property)+") : "+ getDefaultValue(property)+")")
.append(".toArray(size -> new "+getter.getReturnType().toString()+"[size])");
return sb.toString();
} | [
"private",
"static",
"String",
"readPrimitiveArrayValue",
"(",
"String",
"ref",
",",
"TypeDef",
"source",
",",
"Property",
"property",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Method",
"getter",
"=",
"getterOf",
"(",
"sourc... | Returns the string representation of the code that reads a primitive array property.
@param ref The reference.
@param source The type of the reference.
@param property The property to read.
@return The code. | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"code",
"that",
"reads",
"a",
"primitive",
"array",
"property",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L819-L827 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java | GosuClassTransformer.maybeWrapProgramEvaluateForManangedProgram | private IRStatement maybeWrapProgramEvaluateForManangedProgram( DynamicFunctionSymbol dfs, IRStatement methodBody )
{
if( dfs.getDisplayName().equals( "evaluate" ) )
{
IType[] argTypes = dfs.getArgTypes();
if( argTypes.length == 1 && argTypes[0] == JavaTypes.IEXTERNAL_SYMBOL_MAP() )
{
IType declaringType = dfs.getDeclaringTypeInfo().getOwnersType();
if( declaringType instanceof IGosuProgram &&
TypeSystem.get( IManagedProgramInstance.class ).isAssignableFrom( declaringType ) )
{
IRSymbol exceptionId = new IRSymbol( "$failure", getDescriptor( Throwable.class ), true );
_cc().putSymbol( exceptionId );
IRStatement exceptionIdInit = buildAssignment( exceptionId, pushNull() );
methodBody =
new IRStatementList( true,
exceptionIdInit,
buildIf( buildMethodCall( IManagedProgramInstance.class, "beforeExecution", boolean.class, new Class[0], pushThis(), Collections.<IRExpression>emptyList() ),
new IRTryCatchFinallyStatement( methodBody,
Collections.singletonList( new IRCatchClause( exceptionId, new IRNoOpStatement() ) ),
buildMethodCall( buildMethodCall( IManagedProgramInstance.class, "afterExecution", void.class, new Class[]{Throwable.class}, pushThis(), Collections.<IRExpression>singletonList( identifier( exceptionId ) ) ) ) ) ),
new IRReturnStatement( null, nullLiteral() ) );
}
}
}
return methodBody;
} | java | private IRStatement maybeWrapProgramEvaluateForManangedProgram( DynamicFunctionSymbol dfs, IRStatement methodBody )
{
if( dfs.getDisplayName().equals( "evaluate" ) )
{
IType[] argTypes = dfs.getArgTypes();
if( argTypes.length == 1 && argTypes[0] == JavaTypes.IEXTERNAL_SYMBOL_MAP() )
{
IType declaringType = dfs.getDeclaringTypeInfo().getOwnersType();
if( declaringType instanceof IGosuProgram &&
TypeSystem.get( IManagedProgramInstance.class ).isAssignableFrom( declaringType ) )
{
IRSymbol exceptionId = new IRSymbol( "$failure", getDescriptor( Throwable.class ), true );
_cc().putSymbol( exceptionId );
IRStatement exceptionIdInit = buildAssignment( exceptionId, pushNull() );
methodBody =
new IRStatementList( true,
exceptionIdInit,
buildIf( buildMethodCall( IManagedProgramInstance.class, "beforeExecution", boolean.class, new Class[0], pushThis(), Collections.<IRExpression>emptyList() ),
new IRTryCatchFinallyStatement( methodBody,
Collections.singletonList( new IRCatchClause( exceptionId, new IRNoOpStatement() ) ),
buildMethodCall( buildMethodCall( IManagedProgramInstance.class, "afterExecution", void.class, new Class[]{Throwable.class}, pushThis(), Collections.<IRExpression>singletonList( identifier( exceptionId ) ) ) ) ) ),
new IRReturnStatement( null, nullLiteral() ) );
}
}
}
return methodBody;
} | [
"private",
"IRStatement",
"maybeWrapProgramEvaluateForManangedProgram",
"(",
"DynamicFunctionSymbol",
"dfs",
",",
"IRStatement",
"methodBody",
")",
"{",
"if",
"(",
"dfs",
".",
"getDisplayName",
"(",
")",
".",
"equals",
"(",
"\"evaluate\"",
")",
")",
"{",
"IType",
... | If this is:
<ul>
<li> a Gosu program and
<li> it has a superclass that implements IManagedProgramInstance and
<li> this method is <code>evaluate( IExternalSymbolMap )</code>
</ul>
Generate the evaluate() method like so:
<pre>
function evaluate( map: IExternalSymbolMap ) : Object {
var $failure : Throwable
if( this.beforeExecution() ) {
try {
[method-body] // returns result
}
catch( $catchFailure: Throwable ) {
$failure = $catchFailure
}
finally {
this.afterExecution( $failure )
}
}
return null // only get here if exception not rethrown in afterExecution()
}
</pre> | [
"If",
"this",
"is",
":",
"<ul",
">",
"<li",
">",
"a",
"Gosu",
"program",
"and",
"<li",
">",
"it",
"has",
"a",
"superclass",
"that",
"implements",
"IManagedProgramInstance",
"and",
"<li",
">",
"this",
"method",
"is",
"<code",
">",
"evaluate",
"(",
"IExter... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/GosuClassTransformer.java#L1616-L1643 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listOperationsAsync | public Observable<List<OperationInner>> listOperationsAsync(String resourceGroupName, String name) {
return listOperationsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<OperationInner>>, List<OperationInner>>() {
@Override
public List<OperationInner> call(ServiceResponse<List<OperationInner>> response) {
return response.body();
}
});
} | java | public Observable<List<OperationInner>> listOperationsAsync(String resourceGroupName, String name) {
return listOperationsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<OperationInner>>, List<OperationInner>>() {
@Override
public List<OperationInner> call(ServiceResponse<List<OperationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"OperationInner",
">",
">",
"listOperationsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listOperationsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"ma... | List all currently running operations on the App Service Environment.
List all currently running operations on the App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<OperationInner> object | [
"List",
"all",
"currently",
"running",
"operations",
"on",
"the",
"App",
"Service",
"Environment",
".",
"List",
"all",
"currently",
"running",
"operations",
"on",
"the",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3654-L3661 |
rundeck/rundeck | core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java | ResourceXMLGenerator.genAttributes | private void genAttributes(final Element ent, final ResourceXMLParser.Entity entity) {
if (null == entity.getProperties() ) {
return;
}
for (final String key:entity.getProperties().stringPropertyNames()){
if (!ResourceXMLConstants.allPropSet.contains(key)) {
//test attribute name is a valid XML attribute name
if (isValidName(key)) {
ent.addAttribute(key, entity.getProperties().getProperty(key));
} else {
//add sub element
final Element atelm = ent.addElement(ATTRIBUTE_TAG);
atelm.addAttribute(ATTRIBUTE_NAME_ATTR, key);
atelm.addAttribute(ATTRIBUTE_VALUE_ATTR, entity.getProperties().getProperty(key));
}
}
}
} | java | private void genAttributes(final Element ent, final ResourceXMLParser.Entity entity) {
if (null == entity.getProperties() ) {
return;
}
for (final String key:entity.getProperties().stringPropertyNames()){
if (!ResourceXMLConstants.allPropSet.contains(key)) {
//test attribute name is a valid XML attribute name
if (isValidName(key)) {
ent.addAttribute(key, entity.getProperties().getProperty(key));
} else {
//add sub element
final Element atelm = ent.addElement(ATTRIBUTE_TAG);
atelm.addAttribute(ATTRIBUTE_NAME_ATTR, key);
atelm.addAttribute(ATTRIBUTE_VALUE_ATTR, entity.getProperties().getProperty(key));
}
}
}
} | [
"private",
"void",
"genAttributes",
"(",
"final",
"Element",
"ent",
",",
"final",
"ResourceXMLParser",
".",
"Entity",
"entity",
")",
"{",
"if",
"(",
"null",
"==",
"entity",
".",
"getProperties",
"(",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"final"... | Generate resources section and resource references
@param ent element
@param entity entity | [
"Generate",
"resources",
"section",
"and",
"resource",
"references"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/shared/resources/ResourceXMLGenerator.java#L200-L218 |
lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.query | public String query(String paramName, String defaultValue) {
return this.request.query(paramName, defaultValue);
} | java | public String query(String paramName, String defaultValue) {
return this.request.query(paramName, defaultValue);
} | [
"public",
"String",
"query",
"(",
"String",
"paramName",
",",
"String",
"defaultValue",
")",
"{",
"return",
"this",
".",
"request",
".",
"query",
"(",
"paramName",
",",
"defaultValue",
")",
";",
"}"
] | Get a request parameter, if NULL is returned to defaultValue
@param paramName parameter name
@param defaultValue default String value
@return Return request parameter values | [
"Get",
"a",
"request",
"parameter",
"if",
"NULL",
"is",
"returned",
"to",
"defaultValue"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L173-L175 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.completeThrowable | final boolean completeThrowable(Throwable x, Object r) {
return U.compareAndSwapObject(this, RESULT, null, encodeThrowable(x, r));
} | java | final boolean completeThrowable(Throwable x, Object r) {
return U.compareAndSwapObject(this, RESULT, null, encodeThrowable(x, r));
} | [
"final",
"boolean",
"completeThrowable",
"(",
"Throwable",
"x",
",",
"Object",
"r",
")",
"{",
"return",
"U",
".",
"compareAndSwapObject",
"(",
"this",
",",
"RESULT",
",",
"null",
",",
"encodeThrowable",
"(",
"x",
",",
"r",
")",
")",
";",
"}"
] | Completes with the given (non-null) exceptional result as a wrapped CompletionException unless
it is one already, unless already completed. May complete with the given Object r (which must
have been the result of a source future) if it is equivalent, i.e. if this is a simple
propagation of an existing CompletionException. | [
"Completes",
"with",
"the",
"given",
"(",
"non",
"-",
"null",
")",
"exceptional",
"result",
"as",
"a",
"wrapped",
"CompletionException",
"unless",
"it",
"is",
"one",
"already",
"unless",
"already",
"completed",
".",
"May",
"complete",
"with",
"the",
"given",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L626-L628 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(Reader reader, Writer writer, int bufferSize) throws IORuntimeException {
return copy(reader, writer, bufferSize, null);
} | java | public static long copy(Reader reader, Writer writer, int bufferSize) throws IORuntimeException {
return copy(reader, writer, bufferSize, null);
} | [
"public",
"static",
"long",
"copy",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
",",
"int",
"bufferSize",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"reader",
",",
"writer",
",",
"bufferSize",
",",
"null",
")",
";",
"}"
] | 将Reader中的内容复制到Writer中
@param reader Reader
@param writer Writer
@param bufferSize 缓存大小
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"将Reader中的内容复制到Writer中"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L86-L88 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jEntityQueries.java | BaseNeo4jEntityQueries.completeFindAssociationQuery | private String completeFindAssociationQuery(String relationshipType, AssociationKeyMetadata associationKeyMetadata) {
StringBuilder queryBuilder = findAssociationPartialQuery( relationshipType, associationKeyMetadata );
queryBuilder.append( "RETURN id(target), r, " );
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( ", target ORDER BY id(target) " );
return queryBuilder.toString();
} | java | private String completeFindAssociationQuery(String relationshipType, AssociationKeyMetadata associationKeyMetadata) {
StringBuilder queryBuilder = findAssociationPartialQuery( relationshipType, associationKeyMetadata );
queryBuilder.append( "RETURN id(target), r, " );
queryBuilder.append( ENTITY_ALIAS );
queryBuilder.append( ", target ORDER BY id(target) " );
return queryBuilder.toString();
} | [
"private",
"String",
"completeFindAssociationQuery",
"(",
"String",
"relationshipType",
",",
"AssociationKeyMetadata",
"associationKeyMetadata",
")",
"{",
"StringBuilder",
"queryBuilder",
"=",
"findAssociationPartialQuery",
"(",
"relationshipType",
",",
"associationKeyMetadata",
... | /*
Example:
MATCH (owner:ENTITY:Car {`carId.maker`: {0}, `carId.model`: {1}}) <-[r:tires]- (target)
RETURN r, owner, target
or for embedded associations:
MATCH (owner:ENTITY:StoryGame {id: {0}}) -[:evilBranch]-> (:EMBEDDED) -[r:additionalEndings]-> (target:EMBEDDED)
RETURN id(target), r, owner, target ORDER BY id(target) | [
"/",
"*",
"Example",
":"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jEntityQueries.java#L338-L344 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/stereo/CyclicCarbohydrateRecognition.java | CyclicCarbohydrateRecognition.horizontalOffset | private Point2d horizontalOffset(Point2d[] points, Turn[] turns, Projection projection) {
// Haworth must currently be drawn vertically, I have seen them drawn
// slanted but it's difficult to determine which way the projection
// is relative
if (projection != Projection.Chair)
return new Point2d(0, 0);
// the atoms either side of a central atom are our reference
int offset = chairCenterOffset(turns);
int prev = (offset + 5) % 6;
int next = (offset + 7) % 6;
// and the axis formed by these atoms is our horizontal reference which
// we normalise
double deltaX = points[prev].x - points[next].x;
double deltaY = points[prev].y - points[next].y;
double mag = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
deltaX /= mag;
deltaY /= mag;
// we now ensure the reference always points left to right (presumes no
// vertical chairs)
if (deltaX < 0) {
deltaX = -deltaX;
deltaY = -deltaY;
}
// horizontal = <1,0> so the offset if the difference from this
return new Point2d(1 - deltaX, deltaY);
} | java | private Point2d horizontalOffset(Point2d[] points, Turn[] turns, Projection projection) {
// Haworth must currently be drawn vertically, I have seen them drawn
// slanted but it's difficult to determine which way the projection
// is relative
if (projection != Projection.Chair)
return new Point2d(0, 0);
// the atoms either side of a central atom are our reference
int offset = chairCenterOffset(turns);
int prev = (offset + 5) % 6;
int next = (offset + 7) % 6;
// and the axis formed by these atoms is our horizontal reference which
// we normalise
double deltaX = points[prev].x - points[next].x;
double deltaY = points[prev].y - points[next].y;
double mag = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
deltaX /= mag;
deltaY /= mag;
// we now ensure the reference always points left to right (presumes no
// vertical chairs)
if (deltaX < 0) {
deltaX = -deltaX;
deltaY = -deltaY;
}
// horizontal = <1,0> so the offset if the difference from this
return new Point2d(1 - deltaX, deltaY);
} | [
"private",
"Point2d",
"horizontalOffset",
"(",
"Point2d",
"[",
"]",
"points",
",",
"Turn",
"[",
"]",
"turns",
",",
"Projection",
"projection",
")",
"{",
"// Haworth must currently be drawn vertically, I have seen them drawn",
"// slanted but it's difficult to determine which wa... | Determine the horizontal offset of the projection. This allows
projections that are drawn at angle to be correctly interpreted.
Currently only projections of chair conformations are considered.
@param points points of the cycle
@param turns the turns in the cycle (left/right)
@param projection the type of projection
@return the horizontal offset | [
"Determine",
"the",
"horizontal",
"offset",
"of",
"the",
"projection",
".",
"This",
"allows",
"projections",
"that",
"are",
"drawn",
"at",
"angle",
"to",
"be",
"correctly",
"interpreted",
".",
"Currently",
"only",
"projections",
"of",
"chair",
"conformations",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/CyclicCarbohydrateRecognition.java#L390-L420 |
mapbox/mapbox-navigation-android | libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java | DynamicCamera.createCameraPosition | private CameraPosition createCameraPosition(Location location, RouteProgress routeProgress) {
LegStep upComingStep = routeProgress.currentLegProgress().upComingStep();
if (upComingStep != null) {
Point stepManeuverPoint = upComingStep.maneuver().location();
List<LatLng> latLngs = new ArrayList<>();
LatLng currentLatLng = new LatLng(location);
LatLng maneuverLatLng = new LatLng(stepManeuverPoint.latitude(), stepManeuverPoint.longitude());
latLngs.add(currentLatLng);
latLngs.add(maneuverLatLng);
if (latLngs.size() < 1 || currentLatLng.equals(maneuverLatLng)) {
return mapboxMap.getCameraPosition();
}
LatLngBounds cameraBounds = new LatLngBounds.Builder()
.includes(latLngs)
.build();
int[] padding = {0, 0, 0, 0};
return mapboxMap.getCameraForLatLngBounds(cameraBounds, padding);
}
return mapboxMap.getCameraPosition();
} | java | private CameraPosition createCameraPosition(Location location, RouteProgress routeProgress) {
LegStep upComingStep = routeProgress.currentLegProgress().upComingStep();
if (upComingStep != null) {
Point stepManeuverPoint = upComingStep.maneuver().location();
List<LatLng> latLngs = new ArrayList<>();
LatLng currentLatLng = new LatLng(location);
LatLng maneuverLatLng = new LatLng(stepManeuverPoint.latitude(), stepManeuverPoint.longitude());
latLngs.add(currentLatLng);
latLngs.add(maneuverLatLng);
if (latLngs.size() < 1 || currentLatLng.equals(maneuverLatLng)) {
return mapboxMap.getCameraPosition();
}
LatLngBounds cameraBounds = new LatLngBounds.Builder()
.includes(latLngs)
.build();
int[] padding = {0, 0, 0, 0};
return mapboxMap.getCameraForLatLngBounds(cameraBounds, padding);
}
return mapboxMap.getCameraPosition();
} | [
"private",
"CameraPosition",
"createCameraPosition",
"(",
"Location",
"location",
",",
"RouteProgress",
"routeProgress",
")",
"{",
"LegStep",
"upComingStep",
"=",
"routeProgress",
".",
"currentLegProgress",
"(",
")",
".",
"upComingStep",
"(",
")",
";",
"if",
"(",
... | Creates a camera position with the current location and upcoming maneuver location.
<p>
Using {@link MapboxMap#getCameraForLatLngBounds(LatLngBounds, int[])} with a {@link LatLngBounds}
that includes the current location and upcoming maneuver location.
@param location for current location
@param routeProgress for upcoming maneuver location
@return camera position that encompasses both locations | [
"Creates",
"a",
"camera",
"position",
"with",
"the",
"current",
"location",
"and",
"upcoming",
"maneuver",
"location",
".",
"<p",
">",
"Using",
"{",
"@link",
"MapboxMap#getCameraForLatLngBounds",
"(",
"LatLngBounds",
"int",
"[]",
")",
"}",
"with",
"a",
"{",
"@... | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/camera/DynamicCamera.java#L128-L151 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.listJobsWithServiceResponseAsync | public Observable<ServiceResponse<Page<JobResponseInner>>> listJobsWithServiceResponseAsync(final String resourceGroupName, final String resourceName) {
return listJobsSinglePageAsync(resourceGroupName, resourceName)
.concatMap(new Func1<ServiceResponse<Page<JobResponseInner>>, Observable<ServiceResponse<Page<JobResponseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobResponseInner>>> call(ServiceResponse<Page<JobResponseInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listJobsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<JobResponseInner>>> listJobsWithServiceResponseAsync(final String resourceGroupName, final String resourceName) {
return listJobsSinglePageAsync(resourceGroupName, resourceName)
.concatMap(new Func1<ServiceResponse<Page<JobResponseInner>>, Observable<ServiceResponse<Page<JobResponseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobResponseInner>>> call(ServiceResponse<Page<JobResponseInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listJobsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobResponseInner",
">",
">",
">",
"listJobsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"resourceName",
")",
"{",
"return",
"listJobsSinglePageAsync",
... | Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobResponseInner> object | [
"Get",
"a",
"list",
"of",
"all",
"the",
"jobs",
"in",
"an",
"IoT",
"hub",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/",
"iot",
"-",
"hub",
"/",
"iot",
"-",
"hub",
"-",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2139-L2151 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public void setTypeface(Paint paint, String typefaceName) {
Typeface typeface = mCache.get(typefaceName);
paint.setTypeface(typeface);
} | java | public void setTypeface(Paint paint, String typefaceName) {
Typeface typeface = mCache.get(typefaceName);
paint.setTypeface(typeface);
} | [
"public",
"void",
"setTypeface",
"(",
"Paint",
"paint",
",",
"String",
"typefaceName",
")",
"{",
"Typeface",
"typeface",
"=",
"mCache",
".",
"get",
"(",
"typefaceName",
")",
";",
"paint",
".",
"setTypeface",
"(",
"typeface",
")",
";",
"}"
] | Set the typeface to the target paint.
@param paint the set typeface.
@param typefaceName typeface name. | [
"Set",
"the",
"typeface",
"to",
"the",
"target",
"paint",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L195-L198 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspStatusBean.java | CmsJspStatusBean.includeTemplatePart | public void includeTemplatePart(String target, String element, Map<String, Object> parameterMap)
throws JspException {
// store current site root and URI
String currentSiteRoot = getRequestContext().getSiteRoot();
String currentUri = getRequestContext().getUri();
try {
// set site root and URI to display template part correct
getRequestContext().setSiteRoot(getSiteRoot());
getRequestContext().setUri(getTemplateUri());
// include the template part
include(target, element, parameterMap);
} finally {
// reset site root and requested URI to status JSP
getRequestContext().setSiteRoot(currentSiteRoot);
getRequestContext().setUri(currentUri);
}
} | java | public void includeTemplatePart(String target, String element, Map<String, Object> parameterMap)
throws JspException {
// store current site root and URI
String currentSiteRoot = getRequestContext().getSiteRoot();
String currentUri = getRequestContext().getUri();
try {
// set site root and URI to display template part correct
getRequestContext().setSiteRoot(getSiteRoot());
getRequestContext().setUri(getTemplateUri());
// include the template part
include(target, element, parameterMap);
} finally {
// reset site root and requested URI to status JSP
getRequestContext().setSiteRoot(currentSiteRoot);
getRequestContext().setUri(currentUri);
}
} | [
"public",
"void",
"includeTemplatePart",
"(",
"String",
"target",
",",
"String",
"element",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameterMap",
")",
"throws",
"JspException",
"{",
"// store current site root and URI",
"String",
"currentSiteRoot",
"=",
"ge... | Include a template part to display on the error page.<p>
@param target the target uri of the file in the OpenCms VFS (can be relative or absolute)
@param element the element (template selector) to display from the target
@param parameterMap a map of the request parameters
@throws JspException in case there were problems including the target | [
"Include",
"a",
"template",
"part",
"to",
"display",
"on",
"the",
"error",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStatusBean.java#L385-L403 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.patchAsync | public Observable<DatabaseAccountInner> patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountInner> patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountInner",
">",
"patchAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountPatchParameters",
"updateParameters",
")",
"{",
"return",
"patchWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Patches the properties of an existing Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param updateParameters The tags parameter to patch for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Patches",
"the",
"properties",
"of",
"an",
"existing",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L301-L308 |
samskivert/samskivert | src/main/java/com/samskivert/util/StringUtil.java | StringUtil.parseBooleanArray | public static boolean[] parseBooleanArray (String source)
{
StringTokenizer tok = new StringTokenizer(source, ",");
boolean[] vals = new boolean[tok.countTokens()];
for (int i = 0; tok.hasMoreTokens(); i++) {
// accept a lone 't' for true for compatibility with toString(boolean[])
String token = tok.nextToken().trim();
vals[i] = Boolean.parseBoolean(token) || token.equalsIgnoreCase("t");
}
return vals;
} | java | public static boolean[] parseBooleanArray (String source)
{
StringTokenizer tok = new StringTokenizer(source, ",");
boolean[] vals = new boolean[tok.countTokens()];
for (int i = 0; tok.hasMoreTokens(); i++) {
// accept a lone 't' for true for compatibility with toString(boolean[])
String token = tok.nextToken().trim();
vals[i] = Boolean.parseBoolean(token) || token.equalsIgnoreCase("t");
}
return vals;
} | [
"public",
"static",
"boolean",
"[",
"]",
"parseBooleanArray",
"(",
"String",
"source",
")",
"{",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"source",
",",
"\",\"",
")",
";",
"boolean",
"[",
"]",
"vals",
"=",
"new",
"boolean",
"[",
"tok",... | Parses an array of booleans from its string representation. The array should be represented
as a bare list of numbers separated by commas, for example:
<pre>false, false, true, false</pre> | [
"Parses",
"an",
"array",
"of",
"booleans",
"from",
"its",
"string",
"representation",
".",
"The",
"array",
"should",
"be",
"represented",
"as",
"a",
"bare",
"list",
"of",
"numbers",
"separated",
"by",
"commas",
"for",
"example",
":"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L888-L898 |
nilsreiter/uima-util | src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java | AnnotationUtil.trimFront | @Deprecated
public static <T extends Annotation> T trimFront(T annotation, char... ws) {
return trimBegin(annotation, ws);
} | java | @Deprecated
public static <T extends Annotation> T trimFront(T annotation, char... ws) {
return trimBegin(annotation, ws);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"trimFront",
"(",
"T",
"annotation",
",",
"char",
"...",
"ws",
")",
"{",
"return",
"trimBegin",
"(",
"annotation",
",",
"ws",
")",
";",
"}"
] | Moves the begin-index as long as a character contain in the array is at
the beginning.
@param annotation
the annotation to be trimmed
@param ws
an array of chars to be trimmed
@param <T>
the annotation type
@return the trimmed annotation
@since 0.4.1
@deprecated Use {@link #trimBegin(Annotation, char...)} instead. | [
"Moves",
"the",
"begin",
"-",
"index",
"as",
"long",
"as",
"a",
"character",
"contain",
"in",
"the",
"array",
"is",
"at",
"the",
"beginning",
"."
] | train | https://github.com/nilsreiter/uima-util/blob/6f3bc3b8785702fe4ab9b670b87eaa215006f593/src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java#L129-L132 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | @SuppressWarnings("static-method")
protected XExpression _generate(XTypeLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(literal.getType());
return literal;
} | java | @SuppressWarnings("static-method")
protected XExpression _generate(XTypeLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(literal.getType());
return literal;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"XExpression",
"_generate",
"(",
"XTypeLiteral",
"literal",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"appendReturnIfExpectedReturnedExpression",
"(",
"it",
",... | Generate the given object.
@param literal the type literal.
@param it the target for the generated content.
@param context the context.
@return the literal. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L960-L965 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/java4less/RFaxFaxClientSpi.java | RFaxFaxClientSpi.submitFaxJobViaFaxModem | protected void submitFaxJobViaFaxModem(FaxJob faxJob) throws Exception
{
//get type
String type=faxJob.getProperty(FaxJobExtendedPropertyConstants.DATA_TYPE_FAX_JOB_PROPERTY_KEY.toString(),"TEXT");
//get common values
int width=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.WIDTH_FAX_JOB_PROPERTY_KEY.toString(),null));
int height=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.HEIGHT_FAX_JOB_PROPERTY_KEY.toString(),null));
int imageType=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.IMAGE_TYPE_FAX_JOB_PROPERTY_KEY.toString(),String.valueOf(BufferedImage.TYPE_INT_RGB)));
//create image
BufferedImage image=new BufferedImage(width,height,imageType);
//create fax producer
Object faxProducer=null;
if(type.equalsIgnoreCase("PDF"))
{
//get type
Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.PDFFaxProducer");
//create fax producer
faxProducer=ReflectionHelper.createInstance(classDefinition);
ReflectionHelper.invokeMethod(classDefinition,faxProducer,"setPDFFile",new Class[]{String.class},new Object[]{faxJob.getFilePath()});
Field field=ReflectionHelper.getField(classDefinition,"pageImage");
field.set(faxProducer,image);
}
else if(type.equalsIgnoreCase("TEXT"))
{
//get type
Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.TextFaxProducer");
//create fax producer
faxProducer=ReflectionHelper.createInstance(classDefinition);
String text=IOHelper.readTextFile(faxJob.getFile());
Field field=ReflectionHelper.getField(classDefinition,"text");
field.set(faxProducer,text);
field=ReflectionHelper.getField(classDefinition,"pageImage");
field.set(faxProducer,image);
ReflectionHelper.invokeMethod(classDefinition,faxProducer,"prepare",null,null);
}
else
{
throw new FaxException("Unsupported type provided: "+type);
}
//init fax modem
Class<?> faxModemClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxModem");
Object faxModem=ReflectionHelper.createInstance(faxModemClassDefinition);
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"setPortName",new Class[]{String.class},new Object[]{this.portName});
Field field=ReflectionHelper.getField(faxModemClassDefinition,"faxClass");
field.set(faxModem,Integer.valueOf(this.faxClass));
//send fax
Class<?> faxProducerClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxProducer");
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"open",new Class[]{faxProducerClassDefinition},new Object[]{faxProducer});
boolean faxSent=((Boolean)ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"sendFax",new Class[]{String.class},new Object[]{faxJob.getTargetAddress()})).booleanValue();
//release fax modem
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"close",null,null);
if(!faxSent)
{
field=ReflectionHelper.getField(faxModemClassDefinition,"lastError");
String lastError=(String)field.get(faxModem);
throw new FaxException("Error while sending fax. Error: "+lastError);
}
} | java | protected void submitFaxJobViaFaxModem(FaxJob faxJob) throws Exception
{
//get type
String type=faxJob.getProperty(FaxJobExtendedPropertyConstants.DATA_TYPE_FAX_JOB_PROPERTY_KEY.toString(),"TEXT");
//get common values
int width=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.WIDTH_FAX_JOB_PROPERTY_KEY.toString(),null));
int height=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.HEIGHT_FAX_JOB_PROPERTY_KEY.toString(),null));
int imageType=Integer.parseInt(faxJob.getProperty(FaxJobExtendedPropertyConstants.IMAGE_TYPE_FAX_JOB_PROPERTY_KEY.toString(),String.valueOf(BufferedImage.TYPE_INT_RGB)));
//create image
BufferedImage image=new BufferedImage(width,height,imageType);
//create fax producer
Object faxProducer=null;
if(type.equalsIgnoreCase("PDF"))
{
//get type
Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.PDFFaxProducer");
//create fax producer
faxProducer=ReflectionHelper.createInstance(classDefinition);
ReflectionHelper.invokeMethod(classDefinition,faxProducer,"setPDFFile",new Class[]{String.class},new Object[]{faxJob.getFilePath()});
Field field=ReflectionHelper.getField(classDefinition,"pageImage");
field.set(faxProducer,image);
}
else if(type.equalsIgnoreCase("TEXT"))
{
//get type
Class<?> classDefinition=ReflectionHelper.getType("com.java4less.rfax.TextFaxProducer");
//create fax producer
faxProducer=ReflectionHelper.createInstance(classDefinition);
String text=IOHelper.readTextFile(faxJob.getFile());
Field field=ReflectionHelper.getField(classDefinition,"text");
field.set(faxProducer,text);
field=ReflectionHelper.getField(classDefinition,"pageImage");
field.set(faxProducer,image);
ReflectionHelper.invokeMethod(classDefinition,faxProducer,"prepare",null,null);
}
else
{
throw new FaxException("Unsupported type provided: "+type);
}
//init fax modem
Class<?> faxModemClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxModem");
Object faxModem=ReflectionHelper.createInstance(faxModemClassDefinition);
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"setPortName",new Class[]{String.class},new Object[]{this.portName});
Field field=ReflectionHelper.getField(faxModemClassDefinition,"faxClass");
field.set(faxModem,Integer.valueOf(this.faxClass));
//send fax
Class<?> faxProducerClassDefinition=ReflectionHelper.getType("com.java4less.rfax.FaxProducer");
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"open",new Class[]{faxProducerClassDefinition},new Object[]{faxProducer});
boolean faxSent=((Boolean)ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"sendFax",new Class[]{String.class},new Object[]{faxJob.getTargetAddress()})).booleanValue();
//release fax modem
ReflectionHelper.invokeMethod(faxModemClassDefinition,faxModem,"close",null,null);
if(!faxSent)
{
field=ReflectionHelper.getField(faxModemClassDefinition,"lastError");
String lastError=(String)field.get(faxModem);
throw new FaxException("Error while sending fax. Error: "+lastError);
}
} | [
"protected",
"void",
"submitFaxJobViaFaxModem",
"(",
"FaxJob",
"faxJob",
")",
"throws",
"Exception",
"{",
"//get type",
"String",
"type",
"=",
"faxJob",
".",
"getProperty",
"(",
"FaxJobExtendedPropertyConstants",
".",
"DATA_TYPE_FAX_JOB_PROPERTY_KEY",
".",
"toString",
"... | This function will submit a new fax job.<br>
The fax job ID may be populated by this method in the provided
fax job object.
@param faxJob
The fax job object containing the needed information
@throws Exception
Any exception | [
"This",
"function",
"will",
"submit",
"a",
"new",
"fax",
"job",
".",
"<br",
">",
"The",
"fax",
"job",
"ID",
"may",
"be",
"populated",
"by",
"this",
"method",
"in",
"the",
"provided",
"fax",
"job",
"object",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/java4less/RFaxFaxClientSpi.java#L231-L299 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/live/CallerId.java | CallerId.valueOf | public static CallerId valueOf(String s)
{
final String[] parsedCallerId;
parsedCallerId = AstUtil.parseCallerId(s);
return new CallerId(parsedCallerId[0], parsedCallerId[1]);
} | java | public static CallerId valueOf(String s)
{
final String[] parsedCallerId;
parsedCallerId = AstUtil.parseCallerId(s);
return new CallerId(parsedCallerId[0], parsedCallerId[1]);
} | [
"public",
"static",
"CallerId",
"valueOf",
"(",
"String",
"s",
")",
"{",
"final",
"String",
"[",
"]",
"parsedCallerId",
";",
"parsedCallerId",
"=",
"AstUtil",
".",
"parseCallerId",
"(",
"s",
")",
";",
"return",
"new",
"CallerId",
"(",
"parsedCallerId",
"[",
... | Parses a caller id string in the form
<code>"Some Name" <1234></code> to a CallerId object.
@param s the caller id string to parse.
@return the corresponding CallerId object which is never <code>null</code>.
@see AstUtil#parseCallerId(String) | [
"Parses",
"a",
"caller",
"id",
"string",
"in",
"the",
"form",
"<code",
">",
"Some",
"Name",
"<",
";",
"1234>",
";",
"<",
"/",
"code",
">",
"to",
"a",
"CallerId",
"object",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/live/CallerId.java#L81-L87 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/ContentMatcher.java | ContentMatcher.getInstance | public static ContentMatcher getInstance(String xmlFileName) {
ContentMatcher cm = new ContentMatcher();
// Load the pattern definitions from an XML file
try {
cm.loadXMLPatternDefinitions(cm.getClass().getResourceAsStream(xmlFileName));
} catch (JDOMException | IOException ex) {
throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using: " + xmlFileName, ex);
}
return cm;
} | java | public static ContentMatcher getInstance(String xmlFileName) {
ContentMatcher cm = new ContentMatcher();
// Load the pattern definitions from an XML file
try {
cm.loadXMLPatternDefinitions(cm.getClass().getResourceAsStream(xmlFileName));
} catch (JDOMException | IOException ex) {
throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using: " + xmlFileName, ex);
}
return cm;
} | [
"public",
"static",
"ContentMatcher",
"getInstance",
"(",
"String",
"xmlFileName",
")",
"{",
"ContentMatcher",
"cm",
"=",
"new",
"ContentMatcher",
"(",
")",
";",
"// Load the pattern definitions from an XML file\r",
"try",
"{",
"cm",
".",
"loadXMLPatternDefinitions",
"(... | Direct method for a complete ContentMatcher instance creation.
Use the ClassLoader for the resource detection and loading, be careful regarding the
relative file name use (this class is in another package).
@param xmlFileName the name of the XML file that need to be used for initialization
@return a ContentMatcher instance | [
"Direct",
"method",
"for",
"a",
"complete",
"ContentMatcher",
"instance",
"creation",
".",
"Use",
"the",
"ClassLoader",
"for",
"the",
"resource",
"detection",
"and",
"loading",
"be",
"careful",
"regarding",
"the",
"relative",
"file",
"name",
"use",
"(",
"this",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ContentMatcher.java#L56-L68 |
e-amzallag/dajlab-core | src/main/java/org/dajlab/gui/ModelManager.java | ModelManager.saveModel | public static void saveModel(final File file, final DajlabModel dajlabModel) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Gson fxGson = FxGson.fullBuilder().setPrettyPrinting().create();
JsonElement el = fxGson.toJsonTree(dajlabModel);
try {
JsonWriter w = new JsonWriter(new FileWriter(file));
w.setIndent("\t");
fxGson.toJson(el, w);
w.close();
} catch (Exception e) {
logger.error("Unable to export model to file [{}]", file.getName());
ExceptionFactory.throwDaJLabRuntimeException(DaJLabConstants.ERR_SAVE_MODEL);
}
}
});
} | java | public static void saveModel(final File file, final DajlabModel dajlabModel) {
Platform.runLater(new Runnable() {
@Override
public void run() {
Gson fxGson = FxGson.fullBuilder().setPrettyPrinting().create();
JsonElement el = fxGson.toJsonTree(dajlabModel);
try {
JsonWriter w = new JsonWriter(new FileWriter(file));
w.setIndent("\t");
fxGson.toJson(el, w);
w.close();
} catch (Exception e) {
logger.error("Unable to export model to file [{}]", file.getName());
ExceptionFactory.throwDaJLabRuntimeException(DaJLabConstants.ERR_SAVE_MODEL);
}
}
});
} | [
"public",
"static",
"void",
"saveModel",
"(",
"final",
"File",
"file",
",",
"final",
"DajlabModel",
"dajlabModel",
")",
"{",
"Platform",
".",
"runLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"Gso... | Save to the file the model.
@param file
file
@param dajlabModel
model | [
"Save",
"to",
"the",
"file",
"the",
"model",
"."
] | train | https://github.com/e-amzallag/dajlab-core/blob/2fe25e5f861d426ff68f65728427f80b96a72905/src/main/java/org/dajlab/gui/ModelManager.java#L62-L81 |
datasift/datasift-java | src/main/java/com/datasift/client/push/connectors/CouchDB.java | CouchDB.verifySSL | public CouchDB verifySSL(String yesOrNo) {
if (yesOrNo == null || !"yes".equals(yesOrNo) || !"no".equals(yesOrNo)) {
throw new IllegalArgumentException("The strings yes or no are the only valid options for the veirfy ssl " +
"option");
}
return setParam("verify_ssl", yesOrNo);
} | java | public CouchDB verifySSL(String yesOrNo) {
if (yesOrNo == null || !"yes".equals(yesOrNo) || !"no".equals(yesOrNo)) {
throw new IllegalArgumentException("The strings yes or no are the only valid options for the veirfy ssl " +
"option");
}
return setParam("verify_ssl", yesOrNo);
} | [
"public",
"CouchDB",
"verifySSL",
"(",
"String",
"yesOrNo",
")",
"{",
"if",
"(",
"yesOrNo",
"==",
"null",
"||",
"!",
"\"yes\"",
".",
"equals",
"(",
"yesOrNo",
")",
"||",
"!",
"\"no\"",
".",
"equals",
"(",
"yesOrNo",
")",
")",
"{",
"throw",
"new",
"Il... | /*
If you are using SSL to connect, this specifies whether the certificate should be verified. Useful when a
client has a self-signed certificate for development. Possible values are:
yes
no
@return this | [
"/",
"*",
"If",
"you",
"are",
"using",
"SSL",
"to",
"connect",
"this",
"specifies",
"whether",
"the",
"certificate",
"should",
"be",
"verified",
".",
"Useful",
"when",
"a",
"client",
"has",
"a",
"self",
"-",
"signed",
"certificate",
"for",
"development",
"... | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/push/connectors/CouchDB.java#L101-L107 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/AmountFormats.java | AmountFormats.wordBased | public static String wordBased(Duration duration, Locale locale) {
Objects.requireNonNull(duration, "duration must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_HOUR),
UnitFormat.of(bundle, WORDBASED_MINUTE),
UnitFormat.of(bundle, WORDBASED_SECOND),
UnitFormat.of(bundle, WORDBASED_MILLISECOND)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
long hours = duration.toHours();
long mins = duration.toMinutes() % MINUTES_PER_HOUR;
long secs = duration.getSeconds() % SECONDS_PER_MINUTE;
int millis = duration.getNano() / NANOS_PER_MILLIS;
int[] values = {(int) hours, (int) mins, (int) secs, millis};
return wb.format(values);
} | java | public static String wordBased(Duration duration, Locale locale) {
Objects.requireNonNull(duration, "duration must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_HOUR),
UnitFormat.of(bundle, WORDBASED_MINUTE),
UnitFormat.of(bundle, WORDBASED_SECOND),
UnitFormat.of(bundle, WORDBASED_MILLISECOND)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
long hours = duration.toHours();
long mins = duration.toMinutes() % MINUTES_PER_HOUR;
long secs = duration.getSeconds() % SECONDS_PER_MINUTE;
int millis = duration.getNano() / NANOS_PER_MILLIS;
int[] values = {(int) hours, (int) mins, (int) secs, millis};
return wb.format(values);
} | [
"public",
"static",
"String",
"wordBased",
"(",
"Duration",
"duration",
",",
"Locale",
"locale",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"duration",
",",
"\"duration must not be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"locale",
",",
"\... | Formats a duration to a string in a localized word-based format.
<p>
This returns a word-based format for the duration.
The words are configured in a resource bundle text file -
{@code org.threeten.extra.wordbased.properties} - with overrides per language.
@param duration the duration to format
@param locale the locale to use
@return the localized word-based format for the duration | [
"Formats",
"a",
"duration",
"to",
"a",
"string",
"in",
"a",
"localized",
"word",
"-",
"based",
"format",
".",
"<p",
">",
"This",
"returns",
"a",
"word",
"-",
"based",
"format",
"for",
"the",
"duration",
".",
"The",
"words",
"are",
"configured",
"in",
"... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/AmountFormats.java#L207-L224 |
belaban/JGroups | src/org/jgroups/auth/FixedMembershipToken.java | FixedMembershipToken.authenticate | public boolean authenticate(AuthToken token, Message msg) {
if ((token != null) && (token instanceof FixedMembershipToken) && (this.memberList != null)) {
PhysicalAddress src = (PhysicalAddress) auth.down(new Event(Event.GET_PHYSICAL_ADDRESS, msg.getSrc()));
if (src == null) {
log.error(Util.getMessage("DidnTFindPhysicalAddressFor") + msg.getSrc());
return false;
}
return isInMembersList((IpAddress)src);
}
if (log.isWarnEnabled())
log.warn("Invalid AuthToken instance - wrong type or null");
return false;
} | java | public boolean authenticate(AuthToken token, Message msg) {
if ((token != null) && (token instanceof FixedMembershipToken) && (this.memberList != null)) {
PhysicalAddress src = (PhysicalAddress) auth.down(new Event(Event.GET_PHYSICAL_ADDRESS, msg.getSrc()));
if (src == null) {
log.error(Util.getMessage("DidnTFindPhysicalAddressFor") + msg.getSrc());
return false;
}
return isInMembersList((IpAddress)src);
}
if (log.isWarnEnabled())
log.warn("Invalid AuthToken instance - wrong type or null");
return false;
} | [
"public",
"boolean",
"authenticate",
"(",
"AuthToken",
"token",
",",
"Message",
"msg",
")",
"{",
"if",
"(",
"(",
"token",
"!=",
"null",
")",
"&&",
"(",
"token",
"instanceof",
"FixedMembershipToken",
")",
"&&",
"(",
"this",
".",
"memberList",
"!=",
"null",
... | /*public void start() throws Exception {
super.start();
IpAddress self=(IpAddress)auth.getPhysicalAddress();
if(!isInMembersList(self))
throw new IllegalStateException("own physical address " + self + " is not in members (" + memberList + ")");
} | [
"/",
"*",
"public",
"void",
"start",
"()",
"throws",
"Exception",
"{",
"super",
".",
"start",
"()",
";",
"IpAddress",
"self",
"=",
"(",
"IpAddress",
")",
"auth",
".",
"getPhysicalAddress",
"()",
";",
"if",
"(",
"!isInMembersList",
"(",
"self",
"))",
"thr... | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/auth/FixedMembershipToken.java#L67-L80 |
alkacon/opencms-core | src/org/opencms/notification/CmsContentNotification.java | CmsContentNotification.appendEditLink | private void appendEditLink(StringBuffer buf, CmsExtendedNotificationCause notificationCause) {
buf.append("<td>");
if (existsEditor(notificationCause.getResource())) {
try {
String resourcePath = notificationCause.getResource().getRootPath();
String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath);
resourcePath = resourcePath.substring(siteRoot.length());
Map<String, String[]> params = new HashMap<String, String[]>();
CmsUUID projectId = getCmsObject().readProject(
OpenCms.getSystemInfo().getNotificationProject()).getUuid();
params.put(CmsWorkplace.PARAM_WP_PROJECT, new String[] {String.valueOf(projectId)});
params.put(
CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE,
new String[] {CmsResource.getParentFolder(resourcePath)});
params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot});
params.put(CmsDialog.PARAM_RESOURCE, new String[] {resourcePath});
buf.append("[<a href=\"");
buf.append(CmsRequestUtil.appendParameters(m_uriWorkplace + "editors/editor.jsp", params, false));
buf.append("\">");
buf.append(m_messages.key(Messages.GUI_EDIT_0));
buf.append("</a>]");
} catch (CmsException e) {
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
}
}
buf.append("</td>");
} | java | private void appendEditLink(StringBuffer buf, CmsExtendedNotificationCause notificationCause) {
buf.append("<td>");
if (existsEditor(notificationCause.getResource())) {
try {
String resourcePath = notificationCause.getResource().getRootPath();
String siteRoot = OpenCms.getSiteManager().getSiteRoot(resourcePath);
resourcePath = resourcePath.substring(siteRoot.length());
Map<String, String[]> params = new HashMap<String, String[]>();
CmsUUID projectId = getCmsObject().readProject(
OpenCms.getSystemInfo().getNotificationProject()).getUuid();
params.put(CmsWorkplace.PARAM_WP_PROJECT, new String[] {String.valueOf(projectId)});
params.put(
CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE,
new String[] {CmsResource.getParentFolder(resourcePath)});
params.put(CmsWorkplace.PARAM_WP_SITE, new String[] {siteRoot});
params.put(CmsDialog.PARAM_RESOURCE, new String[] {resourcePath});
buf.append("[<a href=\"");
buf.append(CmsRequestUtil.appendParameters(m_uriWorkplace + "editors/editor.jsp", params, false));
buf.append("\">");
buf.append(m_messages.key(Messages.GUI_EDIT_0));
buf.append("</a>]");
} catch (CmsException e) {
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
}
}
buf.append("</td>");
} | [
"private",
"void",
"appendEditLink",
"(",
"StringBuffer",
"buf",
",",
"CmsExtendedNotificationCause",
"notificationCause",
")",
"{",
"buf",
".",
"append",
"(",
"\"<td>\"",
")",
";",
"if",
"(",
"existsEditor",
"(",
"notificationCause",
".",
"getResource",
"(",
")",... | Appends a link to edit the resource to a StringBuffer.<p>
@param buf the StringBuffer to append the html code to.
@param notificationCause the information for specific resource. | [
"Appends",
"a",
"link",
"to",
"edit",
"the",
"resource",
"to",
"a",
"StringBuffer",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/notification/CmsContentNotification.java#L264-L293 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.toArc | private static Arc2D.Double toArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle, final boolean pClosed) {
return new Arc2D.Double(pRectangle, 90 - pStartAngle, -pArcAngle, pClosed ? Arc2D.PIE : Arc2D.OPEN);
} | java | private static Arc2D.Double toArc(final Rectangle2D pRectangle, int pStartAngle, int pArcAngle, final boolean pClosed) {
return new Arc2D.Double(pRectangle, 90 - pStartAngle, -pArcAngle, pClosed ? Arc2D.PIE : Arc2D.OPEN);
} | [
"private",
"static",
"Arc2D",
".",
"Double",
"toArc",
"(",
"final",
"Rectangle2D",
"pRectangle",
",",
"int",
"pStartAngle",
",",
"int",
"pArcAngle",
",",
"final",
"boolean",
"pClosed",
")",
"{",
"return",
"new",
"Arc2D",
".",
"Double",
"(",
"pRectangle",
","... | Converts a rectangle to an arc.
@param pRectangle the framing rectangle
@param pStartAngle start angle in degrees (starting from 12'o clock, this differs from Java)
@param pArcAngle rotation angle in degrees (starting from {@code pStartAngle}, this differs from Java arcs)
@param pClosed specifies if the arc should be closed
@return the arc | [
"Converts",
"a",
"rectangle",
"to",
"an",
"arc",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L716-L718 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/model/data/series/Sample.java | Sample.ofTimeDoubleText | public static Sample ofTimeDoubleText(long time, double numericValue, String textValue) {
return new Sample(time, null, null, textValue)
.setNumericValueFromDouble(numericValue);
} | java | public static Sample ofTimeDoubleText(long time, double numericValue, String textValue) {
return new Sample(time, null, null, textValue)
.setNumericValueFromDouble(numericValue);
} | [
"public",
"static",
"Sample",
"ofTimeDoubleText",
"(",
"long",
"time",
",",
"double",
"numericValue",
",",
"String",
"textValue",
")",
"{",
"return",
"new",
"Sample",
"(",
"time",
",",
"null",
",",
"null",
",",
"textValue",
")",
".",
"setNumericValueFromDouble... | Creates a new {@link Sample} with time, double and text value specified
@param time time in milliseconds from 1970-01-01 00:00:00
@param numericValue the numeric value of the sample
@param textValue the text value of the sample
@return the Sample with specified fields | [
"Creates",
"a",
"new",
"{",
"@link",
"Sample",
"}",
"with",
"time",
"double",
"and",
"text",
"value",
"specified"
] | train | https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/model/data/series/Sample.java#L92-L95 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java | SdkUtils.createArrayOutputStream | public static OutputStream createArrayOutputStream(final OutputStream[] outputStreams) {
return new OutputStream() {
@Override
public void close() throws IOException {
for (OutputStream o : outputStreams) {
o.close();
}
super.close();
}
@Override
public void flush() throws IOException {
for (OutputStream o : outputStreams) {
o.flush();
}
super.flush();
}
@Override
public void write(int oneByte) throws IOException {
for (OutputStream o : outputStreams) {
o.write(oneByte);
}
}
@Override
public void write(byte[] buffer) throws IOException {
for (OutputStream o : outputStreams) {
o.write(buffer);
}
}
@Override
public void write(byte[] buffer, int offset, int count) throws IOException {
for (OutputStream o : outputStreams) {
o.write(buffer, offset, count);
}
}
};
} | java | public static OutputStream createArrayOutputStream(final OutputStream[] outputStreams) {
return new OutputStream() {
@Override
public void close() throws IOException {
for (OutputStream o : outputStreams) {
o.close();
}
super.close();
}
@Override
public void flush() throws IOException {
for (OutputStream o : outputStreams) {
o.flush();
}
super.flush();
}
@Override
public void write(int oneByte) throws IOException {
for (OutputStream o : outputStreams) {
o.write(oneByte);
}
}
@Override
public void write(byte[] buffer) throws IOException {
for (OutputStream o : outputStreams) {
o.write(buffer);
}
}
@Override
public void write(byte[] buffer, int offset, int count) throws IOException {
for (OutputStream o : outputStreams) {
o.write(buffer, offset, count);
}
}
};
} | [
"public",
"static",
"OutputStream",
"createArrayOutputStream",
"(",
"final",
"OutputStream",
"[",
"]",
"outputStreams",
")",
"{",
"return",
"new",
"OutputStream",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
... | Helper method that wraps given arrays inside of a single outputstream.
@param outputStreams an array of multiple outputstreams.
@return a single outputstream that will write to provided outputstreams. | [
"Helper",
"method",
"that",
"wraps",
"given",
"arrays",
"inside",
"of",
"a",
"single",
"outputstream",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L144-L187 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ComplianceItemEntry.java | ComplianceItemEntry.withDetails | public ComplianceItemEntry withDetails(java.util.Map<String, String> details) {
setDetails(details);
return this;
} | java | public ComplianceItemEntry withDetails(java.util.Map<String, String> details) {
setDetails(details);
return this;
} | [
"public",
"ComplianceItemEntry",
"withDetails",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"details",
")",
"{",
"setDetails",
"(",
"details",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A "Key": "Value" tag combination for the compliance item.
</p>
@param details
A "Key": "Value" tag combination for the compliance item.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"Key",
":",
"Value",
"tag",
"combination",
"for",
"the",
"compliance",
"item",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ComplianceItemEntry.java#L321-L324 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.doubleUnaryOperator | public static DoubleUnaryOperator doubleUnaryOperator(CheckedDoubleUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsDouble(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static DoubleUnaryOperator doubleUnaryOperator(CheckedDoubleUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsDouble(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"DoubleUnaryOperator",
"doubleUnaryOperator",
"(",
"CheckedDoubleUnaryOperator",
"operator",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"t",
"->",
"{",
"try",
"{",
"return",
"operator",
".",
"applyAsDouble",
"(",
"t"... | Wrap a {@link CheckedDoubleUnaryOperator} in a {@link DoubleUnaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
LongStream.of(1.0, 2.0, 3.0).map(Unchecked.doubleUnaryOperator(
d -> {
if (d < 0.0)
throw new Exception("Only positive numbers allowed");
return d;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedDoubleUnaryOperator",
"}",
"in",
"a",
"{",
"@link",
"DoubleUnaryOperator",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"LongStream",
".",... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L2052-L2063 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/KdTreeMemory.java | KdTreeMemory.requestNode | public KdTree.Node requestNode(P point , int index ) {
KdTree.Node n = requestNode();
n.point = point;
n.index = index;
n.split = -1;
return n;
} | java | public KdTree.Node requestNode(P point , int index ) {
KdTree.Node n = requestNode();
n.point = point;
n.index = index;
n.split = -1;
return n;
} | [
"public",
"KdTree",
".",
"Node",
"requestNode",
"(",
"P",
"point",
",",
"int",
"index",
")",
"{",
"KdTree",
".",
"Node",
"n",
"=",
"requestNode",
"(",
")",
";",
"n",
".",
"point",
"=",
"point",
";",
"n",
".",
"index",
"=",
"index",
";",
"n",
".",... | Request a leaf node be returned. All data parameters will be automatically assigned appropriate
values for a leaf. | [
"Request",
"a",
"leaf",
"node",
"be",
"returned",
".",
"All",
"data",
"parameters",
"will",
"be",
"automatically",
"assigned",
"appropriate",
"values",
"for",
"a",
"leaf",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/KdTreeMemory.java#L52-L58 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/context/FlashWrapper.java | FlashWrapper.putNow | @Override
public void putNow(String key, Object value) {
getWrapped().putNow(key, value);
} | java | @Override
public void putNow(String key, Object value) {
getWrapped().putNow(key, value);
} | [
"@",
"Override",
"public",
"void",
"putNow",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"getWrapped",
"(",
")",
".",
"putNow",
"(",
"key",
",",
"value",
")",
";",
"}"
] | <p class="changed_added_2_2">The default behavior of this method
is to call {@link Flash#putNow(String, Object)} on the wrapped
{@link Flash} object.</p>
@since 2.2 | [
"<p",
"class",
"=",
"changed_added_2_2",
">",
"The",
"default",
"behavior",
"of",
"this",
"method",
"is",
"to",
"call",
"{",
"@link",
"Flash#putNow",
"(",
"String",
"Object",
")",
"}",
"on",
"the",
"wrapped",
"{",
"@link",
"Flash",
"}",
"object",
".",
"<... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/FlashWrapper.java#L136-L139 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java | VectorPackingPropagator.removeItem | protected void removeItem(int item, int bin) throws ContradictionException {
updateLoads(item, bin);
if (decoKPSimple != null) {
decoKPSimple.postRemoveItem(item, bin);
}
} | java | protected void removeItem(int item, int bin) throws ContradictionException {
updateLoads(item, bin);
if (decoKPSimple != null) {
decoKPSimple.postRemoveItem(item, bin);
}
} | [
"protected",
"void",
"removeItem",
"(",
"int",
"item",
",",
"int",
"bin",
")",
"throws",
"ContradictionException",
"{",
"updateLoads",
"(",
"item",
",",
"bin",
")",
";",
"if",
"(",
"decoKPSimple",
"!=",
"null",
")",
"{",
"decoKPSimple",
".",
"postRemoveItem"... | apply rule 2 (binLoad <= binPotentialLoad) when an item has been removed from the bin candidate list
@throws ContradictionException if a contradiction (rule 2) is raised | [
"apply",
"rule",
"2",
"(",
"binLoad",
"<",
"=",
"binPotentialLoad",
")",
"when",
"an",
"item",
"has",
"been",
"removed",
"from",
"the",
"bin",
"candidate",
"list"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java#L304-L309 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java | MemoryMapArchiveBase.getNestedNode | private Node getNestedNode(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getValue();
// Check to see if the requested path starts with the nested archive path
if (startsWith(path, archivePath)) {
Archive<?> nestedArchive = archiveAsset.getArchive();
// Get the asset path from within the nested archive
ArchivePath nestedAssetPath = getNestedPath(path, archivePath);
// Recurse the call to the nested archive
return nestedArchive.get(nestedAssetPath);
}
}
return null;
} | java | private Node getNestedNode(ArchivePath path) {
// Iterate through nested archives
for (Entry<ArchivePath, ArchiveAsset> nestedArchiveEntry : nestedArchives.entrySet()) {
ArchivePath archivePath = nestedArchiveEntry.getKey();
ArchiveAsset archiveAsset = nestedArchiveEntry.getValue();
// Check to see if the requested path starts with the nested archive path
if (startsWith(path, archivePath)) {
Archive<?> nestedArchive = archiveAsset.getArchive();
// Get the asset path from within the nested archive
ArchivePath nestedAssetPath = getNestedPath(path, archivePath);
// Recurse the call to the nested archive
return nestedArchive.get(nestedAssetPath);
}
}
return null;
} | [
"private",
"Node",
"getNestedNode",
"(",
"ArchivePath",
"path",
")",
"{",
"// Iterate through nested archives",
"for",
"(",
"Entry",
"<",
"ArchivePath",
",",
"ArchiveAsset",
">",
"nestedArchiveEntry",
":",
"nestedArchives",
".",
"entrySet",
"(",
")",
")",
"{",
"Ar... | Attempt to get the asset from a nested archive.
@param path
@return | [
"Attempt",
"to",
"get",
"the",
"asset",
"from",
"a",
"nested",
"archive",
"."
] | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L422-L440 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java | PostConditionException.validateEqualTo | public static void validateEqualTo( Number value, Number condition, String identifier )
throws PostConditionException
{
if( value.doubleValue() == condition.doubleValue() )
{
return;
}
throw new PostConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | java | public static void validateEqualTo( Number value, Number condition, String identifier )
throws PostConditionException
{
if( value.doubleValue() == condition.doubleValue() )
{
return;
}
throw new PostConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateEqualTo",
"(",
"Number",
"value",
",",
"Number",
"condition",
",",
"String",
"identifier",
")",
"throws",
"PostConditionException",
"{",
"if",
"(",
"value",
".",
"doubleValue",
"(",
")",
"==",
"condition",
".",
"doubleValue",... | Validates that the value under test is a particular value.
This method ensures that <code>value == condition</code>.
@param identifier The name of the object.
@param condition The condition value.
@param value The value to be tested.
@throws PostConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"under",
"test",
"is",
"a",
"particular",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L254-L262 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedSecretAsync | public ServiceFuture<SecretBundle> recoverDeletedSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(recoverDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback);
} | java | public ServiceFuture<SecretBundle> recoverDeletedSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(recoverDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"SecretBundle",
">",
"recoverDeletedSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"final",
"ServiceCallback",
"<",
"SecretBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromR... | Recovers the deleted secret to the latest version.
Recovers the deleted secret in the specified vault. This operation can only be performed on a soft-delete enabled vault. This operation requires the secrets/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the deleted secret.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Recovers",
"the",
"deleted",
"secret",
"to",
"the",
"latest",
"version",
".",
"Recovers",
"the",
"deleted",
"secret",
"in",
"the",
"specified",
"vault",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"on",
"a",
"soft",
"-",
"delete",
"enabled",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4832-L4834 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/MoreExecutors.java | MoreExecutors.platformThreadFactory | @Beta
@GwtIncompatible // concurrency
public static ThreadFactory platformThreadFactory() {
if (!isAppEngine()) {
return Executors.defaultThreadFactory();
}
try {
return (ThreadFactory)
Class.forName("com.google_voltpatches.appengine.api.ThreadManager")
.getMethod("currentRequestThreadFactory")
.invoke(null);
} catch (IllegalAccessException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
} | java | @Beta
@GwtIncompatible // concurrency
public static ThreadFactory platformThreadFactory() {
if (!isAppEngine()) {
return Executors.defaultThreadFactory();
}
try {
return (ThreadFactory)
Class.forName("com.google_voltpatches.appengine.api.ThreadManager")
.getMethod("currentRequestThreadFactory")
.invoke(null);
} catch (IllegalAccessException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Couldn't invoke ThreadManager.currentRequestThreadFactory", e);
} catch (InvocationTargetException e) {
throw Throwables.propagate(e.getCause());
}
} | [
"@",
"Beta",
"@",
"GwtIncompatible",
"// concurrency",
"public",
"static",
"ThreadFactory",
"platformThreadFactory",
"(",
")",
"{",
"if",
"(",
"!",
"isAppEngine",
"(",
")",
")",
"{",
"return",
"Executors",
".",
"defaultThreadFactory",
"(",
")",
";",
"}",
"try"... | Returns a default thread factory used to create new threads.
<p>On AppEngine, returns {@code ThreadManager.currentRequestThreadFactory()}. Otherwise,
returns {@link Executors#defaultThreadFactory()}.
@since 14.0 | [
"Returns",
"a",
"default",
"thread",
"factory",
"used",
"to",
"create",
"new",
"threads",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/MoreExecutors.java#L751-L771 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java | SetDirtyOnChangeHandler.init | public void init(BaseField field, BaseField fldTarget, boolean bIfNewRecord, boolean bIfCurrentRecord)
{
m_fldTarget = fldTarget;
m_bIfNewRecord = bIfNewRecord;
m_bIfCurrentRecord = bIfCurrentRecord;
super.init(field);
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
} | java | public void init(BaseField field, BaseField fldTarget, boolean bIfNewRecord, boolean bIfCurrentRecord)
{
m_fldTarget = fldTarget;
m_bIfNewRecord = bIfNewRecord;
m_bIfCurrentRecord = bIfCurrentRecord;
super.init(field);
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"BaseField",
"fldTarget",
",",
"boolean",
"bIfNewRecord",
",",
"boolean",
"bIfCurrentRecord",
")",
"{",
"m_fldTarget",
"=",
"fldTarget",
";",
"m_bIfNewRecord",
"=",
"bIfNewRecord",
";",
"m_bIfCurrentRecord",
... | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param fldTarget The field to set to modified if this field changes.
@param bIfNewRecord Only set to dirty if the target field's record is new.
@param bIfCurrentRecord Only set to dirty if the target field's record is current. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/SetDirtyOnChangeHandler.java#L64-L75 |
sdl/odata | odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java | EntityDataModelUtil.getAndCheckComplexType | public static ComplexType getAndCheckComplexType(EntityDataModel entityDataModel, Class<?> javaType) {
return checkIsComplexType(getAndCheckType(entityDataModel, javaType));
} | java | public static ComplexType getAndCheckComplexType(EntityDataModel entityDataModel, Class<?> javaType) {
return checkIsComplexType(getAndCheckType(entityDataModel, javaType));
} | [
"public",
"static",
"ComplexType",
"getAndCheckComplexType",
"(",
"EntityDataModel",
"entityDataModel",
",",
"Class",
"<",
"?",
">",
"javaType",
")",
"{",
"return",
"checkIsComplexType",
"(",
"getAndCheckType",
"(",
"entityDataModel",
",",
"javaType",
")",
")",
";",... | Gets the OData type for a Java type and checks if the OData type is a complex type; throws an exception if the
OData type is not a complex type.
@param entityDataModel The entity data model.
@param javaType The Java type.
@return The OData complex type for the Java type.
@throws ODataSystemException If there is no OData type for the specified Java type or if the OData type is not
a complex type. | [
"Gets",
"the",
"OData",
"type",
"for",
"a",
"Java",
"type",
"and",
"checks",
"if",
"the",
"OData",
"type",
"is",
"a",
"complex",
"type",
";",
"throws",
"an",
"exception",
"if",
"the",
"OData",
"type",
"is",
"not",
"a",
"complex",
"type",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L275-L277 |
micronaut-projects/micronaut-core | tracing/src/main/java/io/micronaut/tracing/interceptor/TraceInterceptor.java | TraceInterceptor.logError | public static void logError(Span span, Throwable e) {
HashMap<String, Object> fields = new HashMap<>();
fields.put(Fields.ERROR_OBJECT, e);
String message = e.getMessage();
if (message != null) {
fields.put(Fields.MESSAGE, message);
}
span.log(fields);
} | java | public static void logError(Span span, Throwable e) {
HashMap<String, Object> fields = new HashMap<>();
fields.put(Fields.ERROR_OBJECT, e);
String message = e.getMessage();
if (message != null) {
fields.put(Fields.MESSAGE, message);
}
span.log(fields);
} | [
"public",
"static",
"void",
"logError",
"(",
"Span",
"span",
",",
"Throwable",
"e",
")",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"fields",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"fields",
".",
"put",
"(",
"Fields",
".",
"ERROR_OBJECT",
... | Logs an error to the span.
@param span The span
@param e The error | [
"Logs",
"an",
"error",
"to",
"the",
"span",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/tracing/src/main/java/io/micronaut/tracing/interceptor/TraceInterceptor.java#L221-L229 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/streaming/StreamPlan.java | StreamPlan.transferFiles | public StreamPlan transferFiles(InetAddress to, Collection<StreamSession.SSTableStreamingSections> sstableDetails)
{
coordinator.transferFiles(to, sstableDetails);
return this;
} | java | public StreamPlan transferFiles(InetAddress to, Collection<StreamSession.SSTableStreamingSections> sstableDetails)
{
coordinator.transferFiles(to, sstableDetails);
return this;
} | [
"public",
"StreamPlan",
"transferFiles",
"(",
"InetAddress",
"to",
",",
"Collection",
"<",
"StreamSession",
".",
"SSTableStreamingSections",
">",
"sstableDetails",
")",
"{",
"coordinator",
".",
"transferFiles",
"(",
"to",
",",
"sstableDetails",
")",
";",
"return",
... | Add transfer task to send given SSTable files.
@param to endpoint address of receiver
@param sstableDetails sstables with file positions and estimated key count.
this collection will be modified to remove those files that are successfully handed off
@return this object for chaining | [
"Add",
"transfer",
"task",
"to",
"send",
"given",
"SSTable",
"files",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/StreamPlan.java#L142-L147 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/SubsystemChannel.java | SubsystemChannel.sendMessage | protected void sendMessage(byte[] msg) throws SshException {
try {
Packet pkt = createPacket();
pkt.write(msg);
sendMessage(pkt);
} catch (IOException ex) {
throw new SshException(SshException.UNEXPECTED_TERMINATION, ex);
}
} | java | protected void sendMessage(byte[] msg) throws SshException {
try {
Packet pkt = createPacket();
pkt.write(msg);
sendMessage(pkt);
} catch (IOException ex) {
throw new SshException(SshException.UNEXPECTED_TERMINATION, ex);
}
} | [
"protected",
"void",
"sendMessage",
"(",
"byte",
"[",
"]",
"msg",
")",
"throws",
"SshException",
"{",
"try",
"{",
"Packet",
"pkt",
"=",
"createPacket",
"(",
")",
";",
"pkt",
".",
"write",
"(",
"msg",
")",
";",
"sendMessage",
"(",
"pkt",
")",
";",
"}"... | Send a byte array as a message.
@param msg
@throws SshException
@deprecated This has changed internally to use a
{@link com.sshtools.ssh.Packet} and it is recommended that
all implementations change to use
{@link com.sshtools.ssh.Packet}'s as they provide a more
efficent way of sending data. | [
"Send",
"a",
"byte",
"array",
"as",
"a",
"message",
"."
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/SubsystemChannel.java#L141-L149 |
michel-kraemer/bson4jackson | src/main/java/de/undercouch/bson4jackson/BsonParser.java | BsonParser.handleNewDocument | protected JsonToken handleNewDocument(boolean array) throws IOException {
if (_in == null) {
//this means Feature.HONOR_DOCUMENT_LENGTH is enabled, and we
//haven't yet started reading. Read the first int to find out the
//length of the document.
byte[] buf = new byte[Integer.SIZE / Byte.SIZE];
int len = 0;
while (len < buf.length) {
int l = _rawInputStream.read(buf, len, buf.length - len);
if (l == -1) {
throw new IOException("Not enough bytes for length of document");
}
len += l;
}
//wrap the input stream by a bounded stream, subtract buf.length from the
//length because the size itself is included in the length
int documentLength = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).getInt();
InputStream in = new BoundedInputStream(_rawInputStream, documentLength - buf.length);
//buffer if the raw input stream is not already buffered
if (!(_rawInputStream instanceof BufferedInputStream)) {
in = new StaticBufferedInputStream(in);
}
_counter = new CountingInputStream(in);
_in = new LittleEndianInputStream(_counter);
} else {
//read document header (skip size, we're not interested)
_in.readInt();
}
_currentContext = new Context(_currentContext, array);
return array ? JsonToken.START_ARRAY : JsonToken.START_OBJECT;
} | java | protected JsonToken handleNewDocument(boolean array) throws IOException {
if (_in == null) {
//this means Feature.HONOR_DOCUMENT_LENGTH is enabled, and we
//haven't yet started reading. Read the first int to find out the
//length of the document.
byte[] buf = new byte[Integer.SIZE / Byte.SIZE];
int len = 0;
while (len < buf.length) {
int l = _rawInputStream.read(buf, len, buf.length - len);
if (l == -1) {
throw new IOException("Not enough bytes for length of document");
}
len += l;
}
//wrap the input stream by a bounded stream, subtract buf.length from the
//length because the size itself is included in the length
int documentLength = ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN).getInt();
InputStream in = new BoundedInputStream(_rawInputStream, documentLength - buf.length);
//buffer if the raw input stream is not already buffered
if (!(_rawInputStream instanceof BufferedInputStream)) {
in = new StaticBufferedInputStream(in);
}
_counter = new CountingInputStream(in);
_in = new LittleEndianInputStream(_counter);
} else {
//read document header (skip size, we're not interested)
_in.readInt();
}
_currentContext = new Context(_currentContext, array);
return array ? JsonToken.START_ARRAY : JsonToken.START_OBJECT;
} | [
"protected",
"JsonToken",
"handleNewDocument",
"(",
"boolean",
"array",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_in",
"==",
"null",
")",
"{",
"//this means Feature.HONOR_DOCUMENT_LENGTH is enabled, and we",
"//haven't yet started reading. Read the first int to find out the... | Can be called when a new embedded document is found. Reads the
document's header and creates a new context on the stack.
@param array true if the document is an embedded array
@return the json token read
@throws IOException if an I/O error occurs | [
"Can",
"be",
"called",
"when",
"a",
"new",
"embedded",
"document",
"is",
"found",
".",
"Reads",
"the",
"document",
"s",
"header",
"and",
"creates",
"a",
"new",
"context",
"on",
"the",
"stack",
"."
] | train | https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonParser.java#L405-L438 |
googlearchive/firebase-simple-login-java | src/main/java/com/firebase/simplelogin/SimpleLogin.java | SimpleLogin.loginAnonymously | public void loginAnonymously(final SimpleLoginAuthenticatedHandler completionHandler) {
HashMap<String, String> data = new HashMap<String, String>();
makeRequest(Constants.FIREBASE_AUTH_ANONYMOUS_PATH, data, new RequestHandler() {
public void handle(FirebaseSimpleLoginError error, JSONObject data) {
if (error != null) {
completionHandler.authenticated(error, null);
}
else {
try {
String token = data.has("token") ? data.getString("token") : null;
if (token == null) {
JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails);
completionHandler.authenticated(theError, null);
}
else {
JSONObject userData = data.has("user") ? data.getJSONObject("user") : null;
if (userData == null) {
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
completionHandler.authenticated(theError, null);
}
else {
attemptAuthWithToken(token, Provider.ANONYMOUS, userData, completionHandler);
}
}
}
catch (JSONException e) {
e.printStackTrace();
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
completionHandler.authenticated(theError, null);
}
}
}
});
} | java | public void loginAnonymously(final SimpleLoginAuthenticatedHandler completionHandler) {
HashMap<String, String> data = new HashMap<String, String>();
makeRequest(Constants.FIREBASE_AUTH_ANONYMOUS_PATH, data, new RequestHandler() {
public void handle(FirebaseSimpleLoginError error, JSONObject data) {
if (error != null) {
completionHandler.authenticated(error, null);
}
else {
try {
String token = data.has("token") ? data.getString("token") : null;
if (token == null) {
JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null;
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails);
completionHandler.authenticated(theError, null);
}
else {
JSONObject userData = data.has("user") ? data.getJSONObject("user") : null;
if (userData == null) {
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
completionHandler.authenticated(theError, null);
}
else {
attemptAuthWithToken(token, Provider.ANONYMOUS, userData, completionHandler);
}
}
}
catch (JSONException e) {
e.printStackTrace();
FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null);
completionHandler.authenticated(theError, null);
}
}
}
});
} | [
"public",
"void",
"loginAnonymously",
"(",
"final",
"SimpleLoginAuthenticatedHandler",
"completionHandler",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"makeRequest",
... | Login anonymously.
@param completionHandler Handler for asynchronous events. | [
"Login",
"anonymously",
"."
] | train | https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L225-L261 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java | FTPFileSystem.getFileStatus | private FileStatus getFileStatus(FTPClient client, Path file)
throws IOException {
FileStatus fileStat = null;
Path workDir = new Path(client.printWorkingDirectory());
Path absolute = makeAbsolute(workDir, file);
Path parentPath = absolute.getParent();
if (parentPath == null) { // root dir
long length = -1; // Length of root dir on server not known
boolean isDir = true;
int blockReplication = 1;
long blockSize = DEFAULT_BLOCK_SIZE; // Block Size not known.
long modTime = -1; // Modification time of root dir not known.
Path root = new Path("/");
return new FileStatus(length, isDir, blockReplication, blockSize,
modTime, root.makeQualified(this));
}
String pathName = parentPath.toUri().getPath();
FTPFile[] ftpFiles = client.listFiles(pathName);
if (ftpFiles != null) {
for (FTPFile ftpFile : ftpFiles) {
if (ftpFile.getName().equals(file.getName())) { // file found in dir
fileStat = getFileStatus(ftpFile, parentPath);
break;
}
}
if (fileStat == null) {
throw new FileNotFoundException("File " + file + " does not exist.");
}
} else {
throw new FileNotFoundException("File " + file + " does not exist.");
}
return fileStat;
} | java | private FileStatus getFileStatus(FTPClient client, Path file)
throws IOException {
FileStatus fileStat = null;
Path workDir = new Path(client.printWorkingDirectory());
Path absolute = makeAbsolute(workDir, file);
Path parentPath = absolute.getParent();
if (parentPath == null) { // root dir
long length = -1; // Length of root dir on server not known
boolean isDir = true;
int blockReplication = 1;
long blockSize = DEFAULT_BLOCK_SIZE; // Block Size not known.
long modTime = -1; // Modification time of root dir not known.
Path root = new Path("/");
return new FileStatus(length, isDir, blockReplication, blockSize,
modTime, root.makeQualified(this));
}
String pathName = parentPath.toUri().getPath();
FTPFile[] ftpFiles = client.listFiles(pathName);
if (ftpFiles != null) {
for (FTPFile ftpFile : ftpFiles) {
if (ftpFile.getName().equals(file.getName())) { // file found in dir
fileStat = getFileStatus(ftpFile, parentPath);
break;
}
}
if (fileStat == null) {
throw new FileNotFoundException("File " + file + " does not exist.");
}
} else {
throw new FileNotFoundException("File " + file + " does not exist.");
}
return fileStat;
} | [
"private",
"FileStatus",
"getFileStatus",
"(",
"FTPClient",
"client",
",",
"Path",
"file",
")",
"throws",
"IOException",
"{",
"FileStatus",
"fileStat",
"=",
"null",
";",
"Path",
"workDir",
"=",
"new",
"Path",
"(",
"client",
".",
"printWorkingDirectory",
"(",
"... | Convenience method, so that we don't open a new connection when using this
method from within another method. Otherwise every API invocation incurs
the overhead of opening/closing a TCP connection. | [
"Convenience",
"method",
"so",
"that",
"we",
"don",
"t",
"open",
"a",
"new",
"connection",
"when",
"using",
"this",
"method",
"from",
"within",
"another",
"method",
".",
"Otherwise",
"every",
"API",
"invocation",
"incurs",
"the",
"overhead",
"of",
"opening",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java#L393-L425 |
twilio/authy-java | src/main/java/com/authy/AuthyUtil.java | AuthyUtil.validateSignatureForGet | public static boolean validateSignatureForGet(Map<String, String> params, Map<String, String> headers, String url, String apiKey) throws OneTouchException, UnsupportedEncodingException {
return validateSignature(params, headers, "GET", url, apiKey);
} | java | public static boolean validateSignatureForGet(Map<String, String> params, Map<String, String> headers, String url, String apiKey) throws OneTouchException, UnsupportedEncodingException {
return validateSignature(params, headers, "GET", url, apiKey);
} | [
"public",
"static",
"boolean",
"validateSignatureForGet",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"url",
",",
"String",
"apiKey",
")",
"throws",
"OneTouchException",
",... | Validates the request information to
@param params The query parameters in case of a GET request
@param headers The headers of the request
@param url The url of the request.
@param apiKey the security token from the authy library
@return true if the signature ios valid, false otherwise
@throws com.authy.OneTouchException
@throws UnsupportedEncodingException if the string parameters have problems with UTF-8 encoding. | [
"Validates",
"the",
"request",
"information",
"to"
] | train | https://github.com/twilio/authy-java/blob/55e3a5ff57a93b3eb36f5b59e8824e60af2b8b91/src/main/java/com/authy/AuthyUtil.java#L202-L204 |
amzn/ion-java | src/com/amazon/ion/Timestamp.java | Timestamp.forSecond | public static Timestamp forSecond(int year, int month, int day,
int hour, int minute, BigDecimal second,
Integer offset)
{
// Tease apart the whole and fractional seconds.
// Storing them separately is silly.
int s = second.intValue();
BigDecimal frac = second.subtract(BigDecimal.valueOf(s));
return new Timestamp(Precision.SECOND, year, month, day, hour, minute, s, frac, offset, APPLY_OFFSET_YES);
} | java | public static Timestamp forSecond(int year, int month, int day,
int hour, int minute, BigDecimal second,
Integer offset)
{
// Tease apart the whole and fractional seconds.
// Storing them separately is silly.
int s = second.intValue();
BigDecimal frac = second.subtract(BigDecimal.valueOf(s));
return new Timestamp(Precision.SECOND, year, month, day, hour, minute, s, frac, offset, APPLY_OFFSET_YES);
} | [
"public",
"static",
"Timestamp",
"forSecond",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
",",
"int",
"hour",
",",
"int",
"minute",
",",
"BigDecimal",
"second",
",",
"Integer",
"offset",
")",
"{",
"// Tease apart the whole and fractional seconds.... | Returns a Timestamp, precise to the second, with a given local offset.
<p>
This is equivalent to the corresponding Ion value
{@code YYYY-MM-DDThh:mm:ss.sss+-oo:oo}, where {@code oo:oo} represents
the hour and minutes of the local offset from UTC.
@param second must be at least zero and less than 60.
Must not be null.
@param offset
the local offset from UTC, measured in minutes;
may be {@code null} to represent an unknown local offset | [
"Returns",
"a",
"Timestamp",
"precise",
"to",
"the",
"second",
"with",
"a",
"given",
"local",
"offset",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
"the",
"corresponding",
"Ion",
"value",
"{",
"@code",
"YYYY",
"-",
"MM",
"-",
"DDThh",
":",
"mm",
... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L1313-L1322 |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java | JmsSyncProducer.getReplyDestination | private Destination getReplyDestination(Session session, Message message) throws JMSException {
if (message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL) != null) {
if (message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL) instanceof Destination) {
return (Destination) message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL);
} else {
return resolveDestinationName(message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL).toString(), session);
}
} else if (endpointConfiguration.getReplyDestination() != null) {
return endpointConfiguration.getReplyDestination();
} else if (StringUtils.hasText(endpointConfiguration.getReplyDestinationName())) {
return resolveDestinationName(endpointConfiguration.getReplyDestinationName(), session);
}
if (endpointConfiguration.isPubSubDomain() && session instanceof TopicSession) {
return session.createTemporaryTopic();
} else {
return session.createTemporaryQueue();
}
} | java | private Destination getReplyDestination(Session session, Message message) throws JMSException {
if (message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL) != null) {
if (message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL) instanceof Destination) {
return (Destination) message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL);
} else {
return resolveDestinationName(message.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL).toString(), session);
}
} else if (endpointConfiguration.getReplyDestination() != null) {
return endpointConfiguration.getReplyDestination();
} else if (StringUtils.hasText(endpointConfiguration.getReplyDestinationName())) {
return resolveDestinationName(endpointConfiguration.getReplyDestinationName(), session);
}
if (endpointConfiguration.isPubSubDomain() && session instanceof TopicSession) {
return session.createTemporaryTopic();
} else {
return session.createTemporaryQueue();
}
} | [
"private",
"Destination",
"getReplyDestination",
"(",
"Session",
"session",
",",
"Message",
"message",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"message",
".",
"getHeader",
"(",
"org",
".",
"springframework",
".",
"messaging",
".",
"MessageHeaders",
".",
"... | Retrieve the reply destination either by injected instance, destination name or
by creating a new temporary destination.
@param session current JMS session
@param message holding possible reply destination in header.
@return the reply destination.
@throws JMSException | [
"Retrieve",
"the",
"reply",
"destination",
"either",
"by",
"injected",
"instance",
"destination",
"name",
"or",
"by",
"creating",
"a",
"new",
"temporary",
"destination",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java#L277-L295 |
3redronin/mu-server | src/main/java/io/muserver/CookieBuilder.java | CookieBuilder.withValue | public CookieBuilder withValue(String value) {
Mutils.notNull("value", value);
boolean matches = value.matches("^[0-9A-Za-z!#$%&'()*+\\-./:<=>?@\\[\\]^_`{|}~]*$");
if (!matches) {
throw new IllegalArgumentException("A cookie value can only be ASCII characters excluding control characters, whitespace, quotes, commas, semicolons and backslashes. Consider using CookieBuilder.withUrlEncodedValue instead.");
}
this.value = value;
return this;
} | java | public CookieBuilder withValue(String value) {
Mutils.notNull("value", value);
boolean matches = value.matches("^[0-9A-Za-z!#$%&'()*+\\-./:<=>?@\\[\\]^_`{|}~]*$");
if (!matches) {
throw new IllegalArgumentException("A cookie value can only be ASCII characters excluding control characters, whitespace, quotes, commas, semicolons and backslashes. Consider using CookieBuilder.withUrlEncodedValue instead.");
}
this.value = value;
return this;
} | [
"public",
"CookieBuilder",
"withValue",
"(",
"String",
"value",
")",
"{",
"Mutils",
".",
"notNull",
"(",
"\"value\"",
",",
"value",
")",
";",
"boolean",
"matches",
"=",
"value",
".",
"matches",
"(",
"\"^[0-9A-Za-z!#$%&'()*+\\\\-./:<=>?@\\\\[\\\\]^_`{|}~]*$\"",
")",
... | <p>Sets the value of the cookie.</p>
<p>Note that only a subset of ASCII characters are allowed (any other characters must be encoded).
Consider using {@link #withUrlEncodedValue(String)} instead if you want to use arbitrary values.</p>
@param value The value to use for the cookie, which can be any US-ASCII characters excluding CTLs, whitespace,
double quotes, comma, semicolon, and backslash.
@return This builder
@throws IllegalArgumentException If the value contains illegal characters | [
"<p",
">",
"Sets",
"the",
"value",
"of",
"the",
"cookie",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Note",
"that",
"only",
"a",
"subset",
"of",
"ASCII",
"characters",
"are",
"allowed",
"(",
"any",
"other",
"characters",
"must",
"be",
"encoded",
")",
".",
... | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/CookieBuilder.java#L42-L52 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java | StrSpliter.splitIgnoreCase | public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, true);
} | java | public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty){
return split(str, separator, limit, isTrim, ignoreEmpty, true);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitIgnoreCase",
"(",
"String",
"str",
",",
"String",
"separator",
",",
"int",
"limit",
",",
"boolean",
"isTrim",
",",
"boolean",
"ignoreEmpty",
")",
"{",
"return",
"split",
"(",
"str",
",",
"separator",
",... | 切分字符串,忽略大小写
@param str 被切分的字符串
@param separator 分隔符字符串
@param limit 限制分片数
@param isTrim 是否去除切分字符串后每个元素两边的空格
@param ignoreEmpty 是否忽略空串
@return 切分后的集合
@since 3.2.1 | [
"切分字符串,忽略大小写"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L259-L261 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java | FileUtils.copyFile | public static void copyFile(File src, File dest, StreamMonitor monitor) throws IOException, FileNotFoundException {
FileInputStream fis = null;
FileOutputStream fos = null;
int length = (int) src.length();
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
StreamUtils.copyStream(monitor, src.toURI().toURL(), length, fis, fos, true);
} catch (FileNotFoundException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (NullArgumentException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (MalformedURLException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (IOException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
}
} | java | public static void copyFile(File src, File dest, StreamMonitor monitor) throws IOException, FileNotFoundException {
FileInputStream fis = null;
FileOutputStream fos = null;
int length = (int) src.length();
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
StreamUtils.copyStream(monitor, src.toURI().toURL(), length, fis, fos, true);
} catch (FileNotFoundException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (NullArgumentException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (MalformedURLException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
} catch (IOException e) {
reportError(monitor, e, src.toURI().toURL());
throw e;
}
} | [
"public",
"static",
"void",
"copyFile",
"(",
"File",
"src",
",",
"File",
"dest",
",",
"StreamMonitor",
"monitor",
")",
"throws",
"IOException",
",",
"FileNotFoundException",
"{",
"FileInputStream",
"fis",
"=",
"null",
";",
"FileOutputStream",
"fos",
"=",
"null",... | Copies a file.
@param src
The source file.
@param dest
The destination file.
@param monitor
The monitor to use for reporting.
@throws IOException
if any underlying I/O problem occurs.
@throws FileNotFoundException
if the source file does not exist. | [
"Copies",
"a",
"file",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/FileUtils.java#L58-L79 |
lonnyj/liquibase-spatial | src/main/java/liquibase/ext/spatial/sqlgenerator/DropSpatialIndexGeneratorGeoDB.java | DropSpatialIndexGeneratorGeoDB.generateSqlIfExists | public Sql[] generateSqlIfExists(final DropSpatialIndexStatement statement,
final Database database) {
final String catalogName = statement.getTableCatalogName();
final String schemaName = statement.getTableSchemaName();
final String tableName = statement.getTableName();
final SpatialIndexExistsPrecondition precondition = new SpatialIndexExistsPrecondition();
precondition.setCatalogName(catalogName);
precondition.setSchemaName(schemaName);
precondition.setTableName(tableName);
final DatabaseObject example = precondition.getExample(database, tableName);
try {
// If a spatial index exists on the table, drop it.
if (SnapshotGeneratorFactory.getInstance().has(example, database)) {
return generateSql(statement, database, null);
}
} catch (final Exception e) {
throw new UnexpectedLiquibaseException(e);
}
return new Sql[0];
} | java | public Sql[] generateSqlIfExists(final DropSpatialIndexStatement statement,
final Database database) {
final String catalogName = statement.getTableCatalogName();
final String schemaName = statement.getTableSchemaName();
final String tableName = statement.getTableName();
final SpatialIndexExistsPrecondition precondition = new SpatialIndexExistsPrecondition();
precondition.setCatalogName(catalogName);
precondition.setSchemaName(schemaName);
precondition.setTableName(tableName);
final DatabaseObject example = precondition.getExample(database, tableName);
try {
// If a spatial index exists on the table, drop it.
if (SnapshotGeneratorFactory.getInstance().has(example, database)) {
return generateSql(statement, database, null);
}
} catch (final Exception e) {
throw new UnexpectedLiquibaseException(e);
}
return new Sql[0];
} | [
"public",
"Sql",
"[",
"]",
"generateSqlIfExists",
"(",
"final",
"DropSpatialIndexStatement",
"statement",
",",
"final",
"Database",
"database",
")",
"{",
"final",
"String",
"catalogName",
"=",
"statement",
".",
"getTableCatalogName",
"(",
")",
";",
"final",
"Strin... | Generates the SQL statement to drop the spatial index if it exists.
@param statement
the drop spatial index statement.
@param database
the database.
@return the drop spatial index statement, if the index exists. | [
"Generates",
"the",
"SQL",
"statement",
"to",
"drop",
"the",
"spatial",
"index",
"if",
"it",
"exists",
"."
] | train | https://github.com/lonnyj/liquibase-spatial/blob/36ae41b0d3d08bb00a22c856e51ffeed08891c0e/src/main/java/liquibase/ext/spatial/sqlgenerator/DropSpatialIndexGeneratorGeoDB.java#L81-L100 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/CSSHTMLBundleLinkRenderer.java | CSSHTMLBundleLinkRenderer.isForcedToRenderIeCssBundleInDebug | private boolean isForcedToRenderIeCssBundleInDebug(BundleRendererContext ctx, boolean debugOn) {
return debugOn && getResourceType().equals(JawrConstant.CSS_TYPE)
&& bundler.getConfig().isForceCssBundleInDebugForIEOn() && RendererRequestUtils.isIE(ctx.getRequest());
} | java | private boolean isForcedToRenderIeCssBundleInDebug(BundleRendererContext ctx, boolean debugOn) {
return debugOn && getResourceType().equals(JawrConstant.CSS_TYPE)
&& bundler.getConfig().isForceCssBundleInDebugForIEOn() && RendererRequestUtils.isIE(ctx.getRequest());
} | [
"private",
"boolean",
"isForcedToRenderIeCssBundleInDebug",
"(",
"BundleRendererContext",
"ctx",
",",
"boolean",
"debugOn",
")",
"{",
"return",
"debugOn",
"&&",
"getResourceType",
"(",
")",
".",
"equals",
"(",
"JawrConstant",
".",
"CSS_TYPE",
")",
"&&",
"bundler",
... | Returns true if the renderer must render a CSS bundle link even in debug
mode
@param ctx
the context
@param debugOn
the debug flag
@return true if the renderer must render a CSS bundle link even in debug
mode | [
"Returns",
"true",
"if",
"the",
"renderer",
"must",
"render",
"a",
"CSS",
"bundle",
"link",
"even",
"in",
"debug",
"mode"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/CSSHTMLBundleLinkRenderer.java#L172-L176 |
thulab/iotdb-jdbc | src/main/java/cn/edu/tsinghua/iotdb/jdbc/TsfileStatement.java | TsfileStatement.executeSQL | private boolean executeSQL(String sql) throws TException, SQLException {
isCancelled = false;
String sqlToLowerCase = sql.toLowerCase().trim();
if (sqlToLowerCase.startsWith(SHOW_TIMESERIES_COMMAND_LOWERCASE)) {
String[] cmdSplited = sql.split("\\s+");
if (cmdSplited.length != 3) {
throw new SQLException("Error format of \'SHOW TIMESERIES <PATH>\'");
} else {
String path = cmdSplited[2];
DatabaseMetaData databaseMetaData = connection.getMetaData();
resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogTimeseries, path, null, null);
return true;
}
} else if (sqlToLowerCase.equals(SHOW_STORAGE_GROUP_COMMAND_LOWERCASE)) {
DatabaseMetaData databaseMetaData = connection.getMetaData();
resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogStorageGroup, null, null, null);
return true;
} else {
TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionHandle, sql);
TSExecuteStatementResp execResp = client.executeStatement(execReq);
operationHandle = execResp.getOperationHandle();
Utils.verifySuccess(execResp.getStatus());
if (execResp.getOperationHandle().hasResultSet) {
resultSet = new TsfileQueryResultSet(this, execResp.getColumns(), client, sessionHandle,
operationHandle, sql, execResp.getOperationType(), getColumnsType(execResp.getColumns()));
return true;
}
return false;
}
} | java | private boolean executeSQL(String sql) throws TException, SQLException {
isCancelled = false;
String sqlToLowerCase = sql.toLowerCase().trim();
if (sqlToLowerCase.startsWith(SHOW_TIMESERIES_COMMAND_LOWERCASE)) {
String[] cmdSplited = sql.split("\\s+");
if (cmdSplited.length != 3) {
throw new SQLException("Error format of \'SHOW TIMESERIES <PATH>\'");
} else {
String path = cmdSplited[2];
DatabaseMetaData databaseMetaData = connection.getMetaData();
resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogTimeseries, path, null, null);
return true;
}
} else if (sqlToLowerCase.equals(SHOW_STORAGE_GROUP_COMMAND_LOWERCASE)) {
DatabaseMetaData databaseMetaData = connection.getMetaData();
resultSet = databaseMetaData.getColumns(TsFileDBConstant.CatalogStorageGroup, null, null, null);
return true;
} else {
TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionHandle, sql);
TSExecuteStatementResp execResp = client.executeStatement(execReq);
operationHandle = execResp.getOperationHandle();
Utils.verifySuccess(execResp.getStatus());
if (execResp.getOperationHandle().hasResultSet) {
resultSet = new TsfileQueryResultSet(this, execResp.getColumns(), client, sessionHandle,
operationHandle, sql, execResp.getOperationType(), getColumnsType(execResp.getColumns()));
return true;
}
return false;
}
} | [
"private",
"boolean",
"executeSQL",
"(",
"String",
"sql",
")",
"throws",
"TException",
",",
"SQLException",
"{",
"isCancelled",
"=",
"false",
";",
"String",
"sqlToLowerCase",
"=",
"sql",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
... | There are four kinds of sql here:
(1) show timeseries path
(2) show storage group
(3) query sql
(4) update sql
(1) and (2) return new TsfileMetadataResultSet
(3) return new TsfileQueryResultSet
(4) simply get executed
@param sql
@return
@throws TException
@throws SQLException | [
"There",
"are",
"four",
"kinds",
"of",
"sql",
"here",
":",
"(",
"1",
")",
"show",
"timeseries",
"path",
"(",
"2",
")",
"show",
"storage",
"group",
"(",
"3",
")",
"query",
"sql",
"(",
"4",
")",
"update",
"sql"
] | train | https://github.com/thulab/iotdb-jdbc/blob/badd5b304fd628da9d69e621477769eeefe0870d/src/main/java/cn/edu/tsinghua/iotdb/jdbc/TsfileStatement.java#L186-L215 |
windup/windup | exec/api/src/main/java/org/jboss/windup/exec/configuration/options/OutputPathOption.java | OutputPathOption.validateInputAndOutputPath | public static ValidationResult validateInputAndOutputPath(Path inputPath, Path outputPath){
return validateInputsAndOutputPaths(Collections.singletonList(inputPath), outputPath);
} | java | public static ValidationResult validateInputAndOutputPath(Path inputPath, Path outputPath){
return validateInputsAndOutputPaths(Collections.singletonList(inputPath), outputPath);
} | [
"public",
"static",
"ValidationResult",
"validateInputAndOutputPath",
"(",
"Path",
"inputPath",
",",
"Path",
"outputPath",
")",
"{",
"return",
"validateInputsAndOutputPaths",
"(",
"Collections",
".",
"singletonList",
"(",
"inputPath",
")",
",",
"outputPath",
")",
";",... | <p>
This validates that the input and output options are compatible.
</p>
<p>
Examples of incompatibilities would include:
</p>
<ul>
<li>Input and Output path are the same</li>
<li>Input is a subdirectory of the output</li>
<li>Output is a subdirectory of the input</li>
</ul> | [
"<p",
">",
"This",
"validates",
"that",
"the",
"input",
"and",
"output",
"options",
"are",
"compatible",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Examples",
"of",
"incompatibilities",
"would",
"include",
":",
"<",
"/",
"p",
">",
"<ul",
">",
"<li",
">",
"... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/exec/api/src/main/java/org/jboss/windup/exec/configuration/options/OutputPathOption.java#L76-L78 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.refreshSession | public RefreshSessionResponse refreshSession(RefreshSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(REFRESH, null);
return invokeHttpClient(internalRequest, RefreshSessionResponse.class);
} | java | public RefreshSessionResponse refreshSession(RefreshSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(REFRESH, null);
return invokeHttpClient(internalRequest, RefreshSessionResponse.class);
} | [
"public",
"RefreshSessionResponse",
"refreshSession",
"(",
"RefreshSessionRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSessionId",
"(",
")",
"... | Refresh your live session by live session id.
@param request The request object containing all parameters for refreshing live session.
@return the response | [
"Refresh",
"your",
"live",
"session",
"by",
"live",
"session",
"id",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1005-L1012 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java | ContentCryptoMaterial.doCreate | private static ContentCryptoMaterial doCreate(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
ContentCryptoScheme contentCryptoScheme,
S3CryptoScheme targetS3CryptoScheme,
CryptoConfiguration config,
AWSKMS kms,
AmazonWebServiceRequest req) {
// Secure the envelope symmetric key either by encryption, key wrapping
// or KMS.
SecuredCEK cekSecured = secureCEK(cek, kekMaterials,
targetS3CryptoScheme.getKeyWrapScheme(),
config, kms, req);
return wrap(cek, iv, contentCryptoScheme, config.getCryptoProvider(),
config.getAlwaysUseCryptoProvider(), cekSecured);
} | java | private static ContentCryptoMaterial doCreate(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
ContentCryptoScheme contentCryptoScheme,
S3CryptoScheme targetS3CryptoScheme,
CryptoConfiguration config,
AWSKMS kms,
AmazonWebServiceRequest req) {
// Secure the envelope symmetric key either by encryption, key wrapping
// or KMS.
SecuredCEK cekSecured = secureCEK(cek, kekMaterials,
targetS3CryptoScheme.getKeyWrapScheme(),
config, kms, req);
return wrap(cek, iv, contentCryptoScheme, config.getCryptoProvider(),
config.getAlwaysUseCryptoProvider(), cekSecured);
} | [
"private",
"static",
"ContentCryptoMaterial",
"doCreate",
"(",
"SecretKey",
"cek",
",",
"byte",
"[",
"]",
"iv",
",",
"EncryptionMaterials",
"kekMaterials",
",",
"ContentCryptoScheme",
"contentCryptoScheme",
",",
"S3CryptoScheme",
"targetS3CryptoScheme",
",",
"CryptoConfig... | Returns a new instance of <code>ContentCryptoMaterial</code> for the
given input parameters by using the specified content crypto scheme, and
S3 crypto scheme.
Note network calls are involved if the CEK is to be protected by KMS.
@param cek
content encrypting key
@param iv
initialization vector
@param kekMaterials
kek encryption material used to secure the CEK; can be KMS
enabled.
@param contentCryptoScheme
content crypto scheme to be used, which can differ from the
one of <code>targetS3CryptoScheme</code>
@param targetS3CryptoScheme
the target s3 crypto scheme to be used for providing the key
wrapping scheme and mechanism for secure randomness
@param config
crypto configuration
@param kms
reference to the KMS client
@param req
the originating AWS service request | [
"Returns",
"a",
"new",
"instance",
"of",
"<code",
">",
"ContentCryptoMaterial<",
"/",
"code",
">",
"for",
"the",
"given",
"input",
"parameters",
"by",
"using",
"the",
"specified",
"content",
"crypto",
"scheme",
"and",
"S3",
"crypto",
"scheme",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java#L804-L818 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listPreparationAndReleaseTaskStatus | public PagedList<JobPreparationAndReleaseTaskExecutionInformation> listPreparationAndReleaseTaskStatus(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) {
ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions).toBlocking().single();
return new PagedList<JobPreparationAndReleaseTaskExecutionInformation>(response.body()) {
@Override
public Page<JobPreparationAndReleaseTaskExecutionInformation> nextPage(String nextPageLink) {
JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null;
if (jobListPreparationAndReleaseTaskStatusOptions != null) {
jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions();
jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate());
}
return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body();
}
};
} | java | public PagedList<JobPreparationAndReleaseTaskExecutionInformation> listPreparationAndReleaseTaskStatus(final String jobId, final JobListPreparationAndReleaseTaskStatusOptions jobListPreparationAndReleaseTaskStatusOptions) {
ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response = listPreparationAndReleaseTaskStatusSinglePageAsync(jobId, jobListPreparationAndReleaseTaskStatusOptions).toBlocking().single();
return new PagedList<JobPreparationAndReleaseTaskExecutionInformation>(response.body()) {
@Override
public Page<JobPreparationAndReleaseTaskExecutionInformation> nextPage(String nextPageLink) {
JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions = null;
if (jobListPreparationAndReleaseTaskStatusOptions != null) {
jobListPreparationAndReleaseTaskStatusNextOptions = new JobListPreparationAndReleaseTaskStatusNextOptions();
jobListPreparationAndReleaseTaskStatusNextOptions.withClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.clientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withReturnClientRequestId(jobListPreparationAndReleaseTaskStatusOptions.returnClientRequestId());
jobListPreparationAndReleaseTaskStatusNextOptions.withOcpDate(jobListPreparationAndReleaseTaskStatusOptions.ocpDate());
}
return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions).toBlocking().single().body();
}
};
} | [
"public",
"PagedList",
"<",
"JobPreparationAndReleaseTaskExecutionInformation",
">",
"listPreparationAndReleaseTaskStatus",
"(",
"final",
"String",
"jobId",
",",
"final",
"JobListPreparationAndReleaseTaskStatusOptions",
"jobListPreparationAndReleaseTaskStatusOptions",
")",
"{",
"Serv... | Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run.
This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified.
@param jobId The ID of the job.
@param jobListPreparationAndReleaseTaskStatusOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object if successful. | [
"Lists",
"the",
"execution",
"status",
"of",
"the",
"Job",
"Preparation",
"and",
"Job",
"Release",
"task",
"for",
"the",
"specified",
"job",
"across",
"the",
"compute",
"nodes",
"where",
"the",
"job",
"has",
"run",
".",
"This",
"API",
"returns",
"the",
"Jo... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2941-L2956 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/DCGEvaluation.java | DCGEvaluation.computeDCG | public static <I extends ScoreIter> double computeDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive;
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied;
}
positive = 0;
tied = 0;
}
return sum * MathUtil.LOG2; // Change base to log 2.
} | java | public static <I extends ScoreIter> double computeDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive;
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied;
}
positive = 0;
tied = 0;
}
return sum * MathUtil.LOG2; // Change base to log 2.
} | [
"public",
"static",
"<",
"I",
"extends",
"ScoreIter",
">",
"double",
"computeDCG",
"(",
"Predicate",
"<",
"?",
"super",
"I",
">",
"predicate",
",",
"I",
"iter",
")",
"{",
"double",
"sum",
"=",
"0.",
";",
"int",
"i",
"=",
"0",
",",
"positive",
"=",
... | Compute the DCG given a set of positive IDs and a sorted list of entries,
which may include ties.
@param <I> Iterator type
@param predicate Predicate to test for positive objects
@param iter Iterator over results, with ties.
@return area under curve | [
"Compute",
"the",
"DCG",
"given",
"a",
"set",
"of",
"positive",
"IDs",
"and",
"a",
"sorted",
"list",
"of",
"entries",
"which",
"may",
"include",
"ties",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/DCGEvaluation.java#L96-L119 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addJQueryFile | private void addJQueryFile(Content head, DocPath filePath) {
HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT(
pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath());
head.addContent(jqyeryScriptFile);
} | java | private void addJQueryFile(Content head, DocPath filePath) {
HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT(
pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath());
head.addContent(jqyeryScriptFile);
} | [
"private",
"void",
"addJQueryFile",
"(",
"Content",
"head",
",",
"DocPath",
"filePath",
")",
"{",
"HtmlTree",
"jqyeryScriptFile",
"=",
"HtmlTree",
".",
"SCRIPT",
"(",
"pathToRoot",
".",
"resolve",
"(",
"DocPaths",
".",
"JQUERY_FILES",
".",
"resolve",
"(",
"fil... | Add a link to the JQuery javascript file.
@param head the content tree to which the files will be added
@param filePath the DocPath of the file that needs to be added | [
"Add",
"a",
"link",
"to",
"the",
"JQuery",
"javascript",
"file",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1816-L1820 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByZipCode | public Iterable<DContact> queryByZipCode(Object parent, java.lang.String zipCode) {
return queryByField(parent, DContactMapper.Field.ZIPCODE.getFieldName(), zipCode);
} | java | public Iterable<DContact> queryByZipCode(Object parent, java.lang.String zipCode) {
return queryByField(parent, DContactMapper.Field.ZIPCODE.getFieldName(), zipCode);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByZipCode",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"zipCode",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"ZIPCODE",
".",
"getFieldN... | query-by method for field zipCode
@param zipCode the specified attribute
@return an Iterable of DContacts for the specified zipCode | [
"query",
"-",
"by",
"method",
"for",
"field",
"zipCode"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L331-L333 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java | AbstractWComponent.setFlag | protected void setFlag(final int mask, final boolean flag) {
// Only store the flag value if it is not the default.
if (flag != isFlagSet(mask)) {
ComponentModel model = getOrCreateComponentModel();
model.setFlags(switchFlag(model.getFlags(), mask, flag));
}
} | java | protected void setFlag(final int mask, final boolean flag) {
// Only store the flag value if it is not the default.
if (flag != isFlagSet(mask)) {
ComponentModel model = getOrCreateComponentModel();
model.setFlags(switchFlag(model.getFlags(), mask, flag));
}
} | [
"protected",
"void",
"setFlag",
"(",
"final",
"int",
"mask",
",",
"final",
"boolean",
"flag",
")",
"{",
"// Only store the flag value if it is not the default.",
"if",
"(",
"flag",
"!=",
"isFlagSet",
"(",
"mask",
")",
")",
"{",
"ComponentModel",
"model",
"=",
"g... | Sets or clears one or more component flags in the component model for the given context..
@param mask the bit mask for the flags to set/clear.
@param flag true to set the flag(s), false to clear. | [
"Sets",
"or",
"clears",
"one",
"or",
"more",
"component",
"flags",
"in",
"the",
"component",
"model",
"for",
"the",
"given",
"context",
".."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java#L977-L983 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.toShort | public static final Function<String,Short> toShort(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToShort(roundingMode, decimalPoint);
} | java | public static final Function<String,Short> toShort(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToShort(roundingMode, decimalPoint);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Short",
">",
"toShort",
"(",
"final",
"RoundingMode",
"roundingMode",
",",
"final",
"DecimalPoint",
"decimalPoint",
")",
"{",
"return",
"new",
"ToShort",
"(",
"roundingMode",
",",
"decimalPoint",
")",... | <p>
Converts a String into a Short, using the specified decimal point
configuration ({@link DecimalPoint}). Rounding mode is used for removing the
decimal part of the number. The target String should contain no
thousand separators. The integer part of the input string must be between
{@link Short#MIN_VALUE} and {@link Short#MAX_VALUE}
</p>
@param roundingMode the rounding mode to be used when setting the scale
@param decimalPoint the decimal point being used by the String
@return the resulting Short object | [
"<p",
">",
"Converts",
"a",
"String",
"into",
"a",
"Short",
"using",
"the",
"specified",
"decimal",
"point",
"configuration",
"(",
"{",
"@link",
"DecimalPoint",
"}",
")",
".",
"Rounding",
"mode",
"is",
"used",
"for",
"removing",
"the",
"decimal",
"part",
"... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1087-L1089 |
voldemort/voldemort | src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java | ClientConfigUtil.writeMultipleClientConfigAvro | public static String writeMultipleClientConfigAvro(Map<String, Properties> mapStoreToProps) {
// TODO: Use a dedicated json lib. We shouldn't be manually manipulating json...
String avroConfig = "";
Boolean firstStore = true;
for(String storeName: mapStoreToProps.keySet()) {
if(firstStore) {
firstStore = false;
} else {
avroConfig = avroConfig + ",\n";
}
Properties props = mapStoreToProps.get(storeName);
avroConfig = avroConfig + "\t\"" + storeName + "\": "
+ writeSingleClientConfigAvro(props);
}
return "{\n" + avroConfig + "\n}";
} | java | public static String writeMultipleClientConfigAvro(Map<String, Properties> mapStoreToProps) {
// TODO: Use a dedicated json lib. We shouldn't be manually manipulating json...
String avroConfig = "";
Boolean firstStore = true;
for(String storeName: mapStoreToProps.keySet()) {
if(firstStore) {
firstStore = false;
} else {
avroConfig = avroConfig + ",\n";
}
Properties props = mapStoreToProps.get(storeName);
avroConfig = avroConfig + "\t\"" + storeName + "\": "
+ writeSingleClientConfigAvro(props);
}
return "{\n" + avroConfig + "\n}";
} | [
"public",
"static",
"String",
"writeMultipleClientConfigAvro",
"(",
"Map",
"<",
"String",
",",
"Properties",
">",
"mapStoreToProps",
")",
"{",
"// TODO: Use a dedicated json lib. We shouldn't be manually manipulating json...",
"String",
"avroConfig",
"=",
"\"\"",
";",
"Boolea... | Assembles an avro format string that contains multiple fat client configs
from map of store to properties
@param mapStoreToProps A map of store names to their properties
@return Avro string that contains multiple store configs | [
"Assembles",
"an",
"avro",
"format",
"string",
"that",
"contains",
"multiple",
"fat",
"client",
"configs",
"from",
"map",
"of",
"store",
"to",
"properties"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/config/ClientConfigUtil.java#L120-L136 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java | GeometryExtrude.getCounterClockWise | private static LineString getCounterClockWise(final LineString lineString) {
final Coordinate c0 = lineString.getCoordinateN(0);
final Coordinate c1 = lineString.getCoordinateN(1);
final Coordinate c2 = lineString.getCoordinateN(2);
lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3));
if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.COUNTERCLOCKWISE) {
return lineString;
} else {
return (LineString) lineString.reverse();
}
} | java | private static LineString getCounterClockWise(final LineString lineString) {
final Coordinate c0 = lineString.getCoordinateN(0);
final Coordinate c1 = lineString.getCoordinateN(1);
final Coordinate c2 = lineString.getCoordinateN(2);
lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3));
if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.COUNTERCLOCKWISE) {
return lineString;
} else {
return (LineString) lineString.reverse();
}
} | [
"private",
"static",
"LineString",
"getCounterClockWise",
"(",
"final",
"LineString",
"lineString",
")",
"{",
"final",
"Coordinate",
"c0",
"=",
"lineString",
".",
"getCoordinateN",
"(",
"0",
")",
";",
"final",
"Coordinate",
"c1",
"=",
"lineString",
".",
"getCoor... | Reverse the LineString to be oriented counter-clockwise.
@param lineString
@return | [
"Reverse",
"the",
"LineString",
"to",
"be",
"oriented",
"counter",
"-",
"clockwise",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L204-L214 |
Bedework/bw-util | bw-util-jmx/src/main/java/org/bedework/util/jmx/ManagementContext.java | ManagementContext.createCustomComponentMBeanName | public ObjectName createCustomComponentMBeanName(final String type, final String name) {
ObjectName result = null;
String tmp = jmxDomainName + ":" +
"type=" + sanitizeString(type) +
",name=" + sanitizeString(name);
try {
result = new ObjectName(tmp);
} catch (MalformedObjectNameException e) {
error("Couldn't create ObjectName from: " + type + " , " + name);
}
return result;
} | java | public ObjectName createCustomComponentMBeanName(final String type, final String name) {
ObjectName result = null;
String tmp = jmxDomainName + ":" +
"type=" + sanitizeString(type) +
",name=" + sanitizeString(name);
try {
result = new ObjectName(tmp);
} catch (MalformedObjectNameException e) {
error("Couldn't create ObjectName from: " + type + " , " + name);
}
return result;
} | [
"public",
"ObjectName",
"createCustomComponentMBeanName",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"name",
")",
"{",
"ObjectName",
"result",
"=",
"null",
";",
"String",
"tmp",
"=",
"jmxDomainName",
"+",
"\":\"",
"+",
"\"type=\"",
"+",
"sanitizeStr... | Formulate and return the MBean ObjectName of a custom control MBean
@param type
@param name
@return the JMX ObjectName of the MBean, or <code>null</code> if
<code>customName</code> is invalid. | [
"Formulate",
"and",
"return",
"the",
"MBean",
"ObjectName",
"of",
"a",
"custom",
"control",
"MBean"
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jmx/src/main/java/org/bedework/util/jmx/ManagementContext.java#L203-L214 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/util/BitUtilBig.java | BitUtilBig.reversePart | final long reversePart(long v, int maxBits) {
long rest = v & (~((1L << maxBits) - 1));
return rest | reverse(v, maxBits);
} | java | final long reversePart(long v, int maxBits) {
long rest = v & (~((1L << maxBits) - 1));
return rest | reverse(v, maxBits);
} | [
"final",
"long",
"reversePart",
"(",
"long",
"v",
",",
"int",
"maxBits",
")",
"{",
"long",
"rest",
"=",
"v",
"&",
"(",
"~",
"(",
"(",
"1L",
"<<",
"maxBits",
")",
"-",
"1",
")",
")",
";",
"return",
"rest",
"|",
"reverse",
"(",
"v",
",",
"maxBits... | Touches only the specified bits - it does not zero out the higher bits (like reverse does). | [
"Touches",
"only",
"the",
"specified",
"bits",
"-",
"it",
"does",
"not",
"zero",
"out",
"the",
"higher",
"bits",
"(",
"like",
"reverse",
"does",
")",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/BitUtilBig.java#L121-L124 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BooleanField.java | BooleanField.moveSQLToField | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
boolean bResult = false;
if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED)))
bResult = resultset.getBoolean(iColumn);
else
bResult = resultset.getByte(iColumn) == 0 ? false: true;
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setState(bResult, false, DBConstants.READ_MOVE);
} | java | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
boolean bResult = false;
if (DBConstants.TRUE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED)))
bResult = resultset.getBoolean(iColumn);
else
bResult = resultset.getByte(iColumn) == 0 ? false: true;
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setState(bResult, false, DBConstants.READ_MOVE);
} | [
"public",
"void",
"moveSQLToField",
"(",
"ResultSet",
"resultset",
",",
"int",
"iColumn",
")",
"throws",
"SQLException",
"{",
"boolean",
"bResult",
"=",
"false",
";",
"if",
"(",
"DBConstants",
".",
"TRUE",
".",
"equals",
"(",
"this",
".",
"getRecord",
"(",
... | Move the physical binary data to this SQL parameter row.
@param resultset The resultset to get the SQL data from.
@param iColumn the column in the resultset that has my data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BooleanField.java#L204-L215 |
cdk/cdk | descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java | Tanimoto.calculate | public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
Set<String> common = new TreeSet<String>(features1.keySet());
common.retainAll(features2.keySet());
double xy = 0., x = 0., y = 0.;
for (String s : common) {
int c1 = features1.get(s), c2 = features2.get(s);
xy += c1 * c2;
}
for (Integer c : features1.values()) {
x += c * c;
}
for (Integer c : features2.values()) {
y += c * c;
}
return (float) (xy / (x + y - xy));
} | java | public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) {
Set<String> common = new TreeSet<String>(features1.keySet());
common.retainAll(features2.keySet());
double xy = 0., x = 0., y = 0.;
for (String s : common) {
int c1 = features1.get(s), c2 = features2.get(s);
xy += c1 * c2;
}
for (Integer c : features1.values()) {
x += c * c;
}
for (Integer c : features2.values()) {
y += c * c;
}
return (float) (xy / (x + y - xy));
} | [
"public",
"static",
"float",
"calculate",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"features1",
",",
"Map",
"<",
"String",
",",
"Integer",
">",
"features2",
")",
"{",
"Set",
"<",
"String",
">",
"common",
"=",
"new",
"TreeSet",
"<",
"String",
">"... | Evaluate continuous Tanimoto coefficient for two feature, count fingerprint representations.
<p>
Note that feature/count type fingerprints may be of different length.
Uses Tanimoto method from 10.1021/ci800326z
@param features1 The first feature map
@param features2 The second feature map
@return The Tanimoto coefficient | [
"Evaluate",
"continuous",
"Tanimoto",
"coefficient",
"for",
"two",
"feature",
"count",
"fingerprint",
"representations",
".",
"<p",
">",
"Note",
"that",
"feature",
"/",
"count",
"type",
"fingerprints",
"may",
"be",
"of",
"different",
"length",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L152-L167 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java | SeaGlassSplitPaneDivider.createLeftOneTouchButton | protected JButton createLeftOneTouchButton() {
SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH);
int oneTouchSize = lookupOneTouchSize();
b.setName("SplitPaneDivider.leftOneTouchButton");
b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize));
b.setCursor(Cursor.getPredefinedCursor(
splitPane.getOrientation() ==
JSplitPane.HORIZONTAL_SPLIT ?
Cursor.W_RESIZE_CURSOR:Cursor.N_RESIZE_CURSOR));
b.setFocusPainted(false);
b.setBorderPainted(false);
b.setRequestFocusEnabled(false);
b.setDirection(mapDirection(true));
return b;
} | java | protected JButton createLeftOneTouchButton() {
SeaGlassArrowButton b = new SeaGlassArrowButton(SwingConstants.NORTH);
int oneTouchSize = lookupOneTouchSize();
b.setName("SplitPaneDivider.leftOneTouchButton");
b.setMinimumSize(new Dimension(oneTouchSize, oneTouchSize));
b.setCursor(Cursor.getPredefinedCursor(
splitPane.getOrientation() ==
JSplitPane.HORIZONTAL_SPLIT ?
Cursor.W_RESIZE_CURSOR:Cursor.N_RESIZE_CURSOR));
b.setFocusPainted(false);
b.setBorderPainted(false);
b.setRequestFocusEnabled(false);
b.setDirection(mapDirection(true));
return b;
} | [
"protected",
"JButton",
"createLeftOneTouchButton",
"(",
")",
"{",
"SeaGlassArrowButton",
"b",
"=",
"new",
"SeaGlassArrowButton",
"(",
"SwingConstants",
".",
"NORTH",
")",
";",
"int",
"oneTouchSize",
"=",
"lookupOneTouchSize",
"(",
")",
";",
"b",
".",
"setName",
... | Creates and return an instance of JButton that can be used to collapse
the left/top component in the split pane.
@return a one-touch button. | [
"Creates",
"and",
"return",
"an",
"instance",
"of",
"JButton",
"that",
"can",
"be",
"used",
"to",
"collapse",
"the",
"left",
"/",
"top",
"component",
"in",
"the",
"split",
"pane",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassSplitPaneDivider.java#L180-L196 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java | CmsResourceWrapperXmlPage.prepareContent | protected String prepareContent(String content, CmsObject cms, CmsResource xmlPage, String path) {
// cut off eventually existing html skeleton
content = CmsStringUtil.extractHtmlBody(content);
// add tags for stylesheet
String stylesheet = getUriStyleSheet(cms, xmlPage);
// content-type
String encoding = CmsLocaleManager.getResourceEncoding(cms, xmlPage);
String contentType = CmsResourceManager.MIMETYPE_HTML + "; charset=" + encoding;
content = CmsEncoder.adjustHtmlEncoding(content, encoding);
// rewrite uri
Object obj = cms.getRequestContext().getAttribute(CmsObjectWrapper.ATTRIBUTE_NAME);
if (obj != null) {
CmsObjectWrapper wrapper = (CmsObjectWrapper)obj;
stylesheet = wrapper.rewriteLink(stylesheet);
}
String base = OpenCms.getSystemInfo().getOpenCmsContext();
StringBuffer result = new StringBuffer(content.length() + 1024);
result.append("<html><head>");
// meta: content-type
result.append("<meta http-equiv=\"content-type\" content=\"");
result.append(contentType);
result.append("\">");
// title as full path
result.append("<title>");
result.append(cms.getRequestContext().removeSiteRoot(path));
result.append("</title>");
// stylesheet
if (!"".equals(stylesheet)) {
result.append("<link href=\"");
result.append(base);
result.append(stylesheet);
result.append("\" rel=\"stylesheet\" type=\"text/css\">");
}
result.append("</head><body>");
result.append(content);
result.append("</body></html>");
content = result.toString();
return content.trim();
} | java | protected String prepareContent(String content, CmsObject cms, CmsResource xmlPage, String path) {
// cut off eventually existing html skeleton
content = CmsStringUtil.extractHtmlBody(content);
// add tags for stylesheet
String stylesheet = getUriStyleSheet(cms, xmlPage);
// content-type
String encoding = CmsLocaleManager.getResourceEncoding(cms, xmlPage);
String contentType = CmsResourceManager.MIMETYPE_HTML + "; charset=" + encoding;
content = CmsEncoder.adjustHtmlEncoding(content, encoding);
// rewrite uri
Object obj = cms.getRequestContext().getAttribute(CmsObjectWrapper.ATTRIBUTE_NAME);
if (obj != null) {
CmsObjectWrapper wrapper = (CmsObjectWrapper)obj;
stylesheet = wrapper.rewriteLink(stylesheet);
}
String base = OpenCms.getSystemInfo().getOpenCmsContext();
StringBuffer result = new StringBuffer(content.length() + 1024);
result.append("<html><head>");
// meta: content-type
result.append("<meta http-equiv=\"content-type\" content=\"");
result.append(contentType);
result.append("\">");
// title as full path
result.append("<title>");
result.append(cms.getRequestContext().removeSiteRoot(path));
result.append("</title>");
// stylesheet
if (!"".equals(stylesheet)) {
result.append("<link href=\"");
result.append(base);
result.append(stylesheet);
result.append("\" rel=\"stylesheet\" type=\"text/css\">");
}
result.append("</head><body>");
result.append(content);
result.append("</body></html>");
content = result.toString();
return content.trim();
} | [
"protected",
"String",
"prepareContent",
"(",
"String",
"content",
",",
"CmsObject",
"cms",
",",
"CmsResource",
"xmlPage",
",",
"String",
"path",
")",
"{",
"// cut off eventually existing html skeleton",
"content",
"=",
"CmsStringUtil",
".",
"extractHtmlBody",
"(",
"c... | Prepare the content of a xml page before returning.<p>
Mainly adds the basic html structure and the css style sheet.<p>
@param content the origin content of the xml page element
@param cms the initialized CmsObject
@param xmlPage the xml page resource
@param path the full path to set as the title in the html head
@return the prepared content with the added html structure | [
"Prepare",
"the",
"content",
"of",
"a",
"xml",
"page",
"before",
"returning",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperXmlPage.java#L891-L941 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.debugv | public void debugv(String format, Object... params) {
doLog(Level.DEBUG, FQCN, format, params, null);
} | java | public void debugv(String format, Object... params) {
doLog(Level.DEBUG, FQCN, format, params, null);
} | [
"public",
"void",
"debugv",
"(",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLog",
"(",
"Level",
".",
"DEBUG",
",",
"FQCN",
",",
"format",
",",
"params",
",",
"null",
")",
";",
"}"
] | Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param params the parameters | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"DEBUG",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L598-L600 |
allure-framework/allure-java | allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java | AllureLifecycle.prepareAttachment | @SuppressWarnings({"PMD.NullAssignment", "PMD.UseObjectForClearerAPI"})
public String prepareAttachment(final String name, final String type, final String fileExtension) {
final String extension = Optional.ofNullable(fileExtension)
.filter(ext -> !ext.isEmpty())
.map(ext -> ext.charAt(0) == '.' ? ext : "." + ext)
.orElse("");
final String source = UUID.randomUUID().toString() + ATTACHMENT_FILE_SUFFIX + extension;
final Optional<String> current = threadContext.getCurrent();
if (!current.isPresent()) {
LOGGER.error("Could not add attachment: no test is running");
//backward compatibility: return source even if no attachment is going to be written.
return source;
}
final Attachment attachment = new Attachment()
.setName(isEmpty(name) ? null : name)
.setType(isEmpty(type) ? null : type)
.setSource(source);
final String uuid = current.get();
storage.get(uuid, WithAttachments.class).ifPresent(withAttachments -> {
synchronized (storage) {
withAttachments.getAttachments().add(attachment);
}
});
return attachment.getSource();
} | java | @SuppressWarnings({"PMD.NullAssignment", "PMD.UseObjectForClearerAPI"})
public String prepareAttachment(final String name, final String type, final String fileExtension) {
final String extension = Optional.ofNullable(fileExtension)
.filter(ext -> !ext.isEmpty())
.map(ext -> ext.charAt(0) == '.' ? ext : "." + ext)
.orElse("");
final String source = UUID.randomUUID().toString() + ATTACHMENT_FILE_SUFFIX + extension;
final Optional<String> current = threadContext.getCurrent();
if (!current.isPresent()) {
LOGGER.error("Could not add attachment: no test is running");
//backward compatibility: return source even if no attachment is going to be written.
return source;
}
final Attachment attachment = new Attachment()
.setName(isEmpty(name) ? null : name)
.setType(isEmpty(type) ? null : type)
.setSource(source);
final String uuid = current.get();
storage.get(uuid, WithAttachments.class).ifPresent(withAttachments -> {
synchronized (storage) {
withAttachments.getAttachments().add(attachment);
}
});
return attachment.getSource();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"PMD.NullAssignment\"",
",",
"\"PMD.UseObjectForClearerAPI\"",
"}",
")",
"public",
"String",
"prepareAttachment",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"type",
",",
"final",
"String",
"fileExtension",
")",
"{",
... | Adds attachment to current running test or step, and returns source. In order
to store attachment content use {@link #writeAttachment(String, InputStream)} method.
@param name the name of attachment
@param type the content type of attachment
@param fileExtension the attachment file extension
@return the source of added attachment | [
"Adds",
"attachment",
"to",
"current",
"running",
"test",
"or",
"step",
"and",
"returns",
"source",
".",
"In",
"order",
"to",
"store",
"attachment",
"content",
"use",
"{",
"@link",
"#writeAttachment",
"(",
"String",
"InputStream",
")",
"}",
"method",
"."
] | train | https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L599-L625 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.updateFriendsNote | public ResponseWrapper updateFriendsNote(String username, FriendNote[] array)
throws APIConnectionException, APIRequestException {
return _userClient.updateFriendsNote(username, array);
} | java | public ResponseWrapper updateFriendsNote(String username, FriendNote[] array)
throws APIConnectionException, APIRequestException {
return _userClient.updateFriendsNote(username, array);
} | [
"public",
"ResponseWrapper",
"updateFriendsNote",
"(",
"String",
"username",
",",
"FriendNote",
"[",
"]",
"array",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"updateFriendsNote",
"(",
"username",
",",
"array... | Update friends' note information. The size is limit to 500.
@param username Necessary
@param array FriendNote array
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Update",
"friends",
"note",
"information",
".",
"The",
"size",
"is",
"limit",
"to",
"500",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L316-L319 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/Rotation.java | Rotation.aroundAxis | public Rotation aroundAxis(float x, float y, float z)
{
axisX = x;
axisY = y;
axisZ = z;
return this;
} | java | public Rotation aroundAxis(float x, float y, float z)
{
axisX = x;
axisY = y;
axisZ = z;
return this;
} | [
"public",
"Rotation",
"aroundAxis",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"axisX",
"=",
"x",
";",
"axisY",
"=",
"y",
";",
"axisZ",
"=",
"z",
";",
"return",
"this",
";",
"}"
] | Sets the axis for this {@link Rotation}.
@param x the x
@param y the y
@param z the z
@return the rotation | [
"Sets",
"the",
"axis",
"for",
"this",
"{",
"@link",
"Rotation",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Rotation.java#L136-L142 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/service/support/AbstractCacheableService.java | AbstractCacheableService.withCaching | protected VALUE withCaching(KEY key, Supplier<VALUE> cacheLoader) {
return getCache()
.map(CachingTemplate::with)
.<VALUE>map(template -> template.withCaching(key, () -> {
setCacheMiss();
return cacheLoader.get();
}))
.orElseGet(cacheLoader);
} | java | protected VALUE withCaching(KEY key, Supplier<VALUE> cacheLoader) {
return getCache()
.map(CachingTemplate::with)
.<VALUE>map(template -> template.withCaching(key, () -> {
setCacheMiss();
return cacheLoader.get();
}))
.orElseGet(cacheLoader);
} | [
"protected",
"VALUE",
"withCaching",
"(",
"KEY",
"key",
",",
"Supplier",
"<",
"VALUE",
">",
"cacheLoader",
")",
"{",
"return",
"getCache",
"(",
")",
".",
"map",
"(",
"CachingTemplate",
"::",
"with",
")",
".",
"<",
"VALUE",
">",
"map",
"(",
"template",
... | Enables an application service method to optionally apply and use caching to carry out its function.
@param key {@link KEY key} used to look up an existing {@link VALUE value} in the {@link Cache}.
@param cacheLoader {@link Supplier} used to compute/execute the application serivce method function
if the {@link Cache} does not contain an already computed {@link VALUE value} or caching is not enabled.
@return the cached or computed {@link VALUE value}.
@see org.cp.elements.data.caching.support.CachingTemplate#withCaching(Comparable, Supplier)
@see org.cp.elements.data.caching.Cache
@see java.util.function.Supplier
@see #isCachingEnabled()
@see #getCache() | [
"Enables",
"an",
"application",
"service",
"method",
"to",
"optionally",
"apply",
"and",
"use",
"caching",
"to",
"carry",
"out",
"its",
"function",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/service/support/AbstractCacheableService.java#L122-L133 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java | InheritDocTaglet.getTagletOutput | public Content getTagletOutput(Element e, DocTree tag, TagletWriter tagletWriter) {
DocTree inheritTag = tag.getKind() == INHERIT_DOC ? null : tag;
return retrieveInheritedDocumentation(tagletWriter, e,
inheritTag, tagletWriter.isFirstSentence);
} | java | public Content getTagletOutput(Element e, DocTree tag, TagletWriter tagletWriter) {
DocTree inheritTag = tag.getKind() == INHERIT_DOC ? null : tag;
return retrieveInheritedDocumentation(tagletWriter, e,
inheritTag, tagletWriter.isFirstSentence);
} | [
"public",
"Content",
"getTagletOutput",
"(",
"Element",
"e",
",",
"DocTree",
"tag",
",",
"TagletWriter",
"tagletWriter",
")",
"{",
"DocTree",
"inheritTag",
"=",
"tag",
".",
"getKind",
"(",
")",
"==",
"INHERIT_DOC",
"?",
"null",
":",
"tag",
";",
"return",
"... | Given the <code>Tag</code> representation of this custom
tag, return its string representation, which is output
to the generated page.
@param e the element holding the tag
@param tag the <code>Tag</code> representation of this custom tag.
@param tagletWriter the taglet writer for output.
@return the Content representation of this <code>Tag</code>. | [
"Given",
"the",
"<code",
">",
"Tag<",
"/",
"code",
">",
"representation",
"of",
"this",
"custom",
"tag",
"return",
"its",
"string",
"representation",
"which",
"is",
"output",
"to",
"the",
"generated",
"page",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java#L185-L189 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java | MultiNormalizerHybrid.revertLabels | @Override
public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays) {
for (int i = 0; i < labels.length; i++) {
revertLabels(labels, maskArrays, i);
}
} | java | @Override
public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays) {
for (int i = 0; i < labels.length; i++) {
revertLabels(labels, maskArrays, i);
}
} | [
"@",
"Override",
"public",
"void",
"revertLabels",
"(",
"@",
"NonNull",
"INDArray",
"[",
"]",
"labels",
",",
"INDArray",
"[",
"]",
"maskArrays",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"labels",
".",
"length",
";",
"i",
"++",
")"... | Undo (revert) the normalization applied by this DataNormalization instance to the entire outputs array
@param labels The normalized array of outputs
@param maskArrays Optional mask arrays belonging to the outputs | [
"Undo",
"(",
"revert",
")",
"the",
"normalization",
"applied",
"by",
"this",
"DataNormalization",
"instance",
"to",
"the",
"entire",
"outputs",
"array"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L405-L410 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | PropertiesUtil.getIntegerProperty | public int getIntegerProperty(final String name, final int defaultValue) {
final String prop = getStringProperty(name);
if (prop != null) {
try {
return Integer.parseInt(prop);
} catch (final Exception ignored) {
return defaultValue;
}
}
return defaultValue;
} | java | public int getIntegerProperty(final String name, final int defaultValue) {
final String prop = getStringProperty(name);
if (prop != null) {
try {
return Integer.parseInt(prop);
} catch (final Exception ignored) {
return defaultValue;
}
}
return defaultValue;
} | [
"public",
"int",
"getIntegerProperty",
"(",
"final",
"String",
"name",
",",
"final",
"int",
"defaultValue",
")",
"{",
"final",
"String",
"prop",
"=",
"getStringProperty",
"(",
"name",
")",
";",
"if",
"(",
"prop",
"!=",
"null",
")",
"{",
"try",
"{",
"retu... | Gets the named property as an integer.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the parsed integer value of the property or {@code defaultValue} if it was undefined or could not be
parsed. | [
"Gets",
"the",
"named",
"property",
"as",
"an",
"integer",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L206-L216 |
Impetus/Kundera | src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java | RedisClient.unIndex | private void unIndex(final Object connection, final AttributeWrapper wrapper, final String member)
{
Set<String> keys = wrapper.getIndexes().keySet();
for (String key : keys)
{
if (resource != null && resource.isActive())
{
((Transaction) connection).zrem(key, member);
}
else
{
((Pipeline) connection).zrem(key, member);
}
}
} | java | private void unIndex(final Object connection, final AttributeWrapper wrapper, final String member)
{
Set<String> keys = wrapper.getIndexes().keySet();
for (String key : keys)
{
if (resource != null && resource.isActive())
{
((Transaction) connection).zrem(key, member);
}
else
{
((Pipeline) connection).zrem(key, member);
}
}
} | [
"private",
"void",
"unIndex",
"(",
"final",
"Object",
"connection",
",",
"final",
"AttributeWrapper",
"wrapper",
",",
"final",
"String",
"member",
")",
"{",
"Set",
"<",
"String",
">",
"keys",
"=",
"wrapper",
".",
"getIndexes",
"(",
")",
".",
"keySet",
"(",... | Deletes inverted indexes from redis.
@param connection
redis instance.
@param wrapper
attribute wrapper
@param member
sorted set member name. | [
"Deletes",
"inverted",
"indexes",
"from",
"redis",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-redis/src/main/java/com/impetus/client/redis/RedisClient.java#L1262-L1278 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F32_1D.java | GeneralPurposeFFT_F32_1D.complexInverse | public void complexInverse(float[] a, int offa, boolean scale) {
if (n == 1)
return;
switch (plan) {
case SPLIT_RADIX:
cftfsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, +1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, 1);
break;
}
if (scale) {
scale(n, a, offa, true);
}
} | java | public void complexInverse(float[] a, int offa, boolean scale) {
if (n == 1)
return;
switch (plan) {
case SPLIT_RADIX:
cftfsub(2 * n, a, offa, ip, nw, w);
break;
case MIXED_RADIX:
cfftf(a, offa, +1);
break;
case BLUESTEIN:
bluestein_complex(a, offa, 1);
break;
}
if (scale) {
scale(n, a, offa, true);
}
} | [
"public",
"void",
"complexInverse",
"(",
"float",
"[",
"]",
"a",
",",
"int",
"offa",
",",
"boolean",
"scale",
")",
"{",
"if",
"(",
"n",
"==",
"1",
")",
"return",
";",
"switch",
"(",
"plan",
")",
"{",
"case",
"SPLIT_RADIX",
":",
"cftfsub",
"(",
"2",... | Computes 1D inverse DFT of complex data leaving the result in
<code>a</code>. Complex number is stored as two float values in
sequence: the real and imaginary part, i.e. the size of the input array
must be greater or equal 2*n. The physical layout of the input data has
to be as follows:<br>
<pre>
a[offa+2*k] = Re[k],
a[offa+2*k+1] = Im[k], 0<=k<n
</pre>
@param a
data to transform
@param offa
index of the first element in array <code>a</code>
@param scale
if true then scaling is performed | [
"Computes",
"1D",
"inverse",
"DFT",
"of",
"complex",
"data",
"leaving",
"the",
"result",
"in",
"<code",
">",
"a<",
"/",
"code",
">",
".",
"Complex",
"number",
"is",
"stored",
"as",
"two",
"float",
"values",
"in",
"sequence",
":",
"the",
"real",
"and",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/GeneralPurposeFFT_F32_1D.java#L239-L256 |
walkmod/walkmod-core | src/main/java/org/walkmod/WalkModFacade.java | WalkModFacade.removePluginConfig | public void removePluginConfig(PluginConfig pluginConfig, boolean recursive) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.removePluginConfig(pluginConfig, recursive);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | java | public void removePluginConfig(PluginConfig pluginConfig, boolean recursive) throws Exception {
long startTime = System.currentTimeMillis();
Exception exception = null;
if (!cfg.exists()) {
init();
}
userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
try {
ConfigurationManager manager = new ConfigurationManager(cfg, false);
ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
cfgProvider.removePluginConfig(pluginConfig, recursive);
} catch (Exception e) {
exception = e;
} finally {
System.setProperty("user.dir", userDir);
updateMsg(startTime, exception);
}
} | [
"public",
"void",
"removePluginConfig",
"(",
"PluginConfig",
"pluginConfig",
",",
"boolean",
"recursive",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"Exception",
"exception",
"=",
"null",
";",
"i... | Removes a plugin from the configuration file.
@param pluginConfig
Plugin configuration to remove.
@param recursive
If it necessary to remove the plugin from all the submodules.
@throws Exception
if the walkmod configuration file can't be read. | [
"Removes",
"a",
"plugin",
"from",
"the",
"configuration",
"file",
"."
] | train | https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L841-L860 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.flatMapToInt | @NotNull
public IntStream flatMapToInt(@NotNull final Function<? super T, ? extends IntStream> mapper) {
return new IntStream(params, new ObjFlatMapToInt<T>(iterator, mapper));
} | java | @NotNull
public IntStream flatMapToInt(@NotNull final Function<? super T, ? extends IntStream> mapper) {
return new IntStream(params, new ObjFlatMapToInt<T>(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"IntStream",
"flatMapToInt",
"(",
"@",
"NotNull",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"IntStream",
">",
"mapper",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"ObjFlatMapToInt",
... | Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
<p>This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code IntStream}
@see #flatMap(com.annimon.stream.function.Function) | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"replacing",
"each",
"element",
"of",
"this",
"stream",
"with",
"the",
"contents",
"of",
"a",
"mapped",
"stream",
"produced",
"by",
"applying",
"the",
"provided",
"mapping",
"function",
"to"... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L880-L883 |
azkaban/azkaban | azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java | JobRunner.handleNonReadyStatus | private boolean handleNonReadyStatus() {
synchronized (this.syncObject) {
Status nodeStatus = this.node.getStatus();
boolean quickFinish = false;
final long time = System.currentTimeMillis();
if (Status.isStatusFinished(nodeStatus)) {
quickFinish = true;
} else if (nodeStatus == Status.DISABLED) {
nodeStatus = changeStatus(Status.SKIPPED, time);
quickFinish = true;
} else if (this.isKilled()) {
nodeStatus = changeStatus(Status.KILLED, time);
quickFinish = true;
}
if (quickFinish) {
this.node.setStartTime(time);
fireEvent(
Event.create(this, EventType.JOB_STARTED,
new EventData(nodeStatus, this.node.getNestedId())));
this.node.setEndTime(time);
fireEvent(
Event
.create(this, EventType.JOB_FINISHED,
new EventData(nodeStatus, this.node.getNestedId())));
return true;
}
return false;
}
} | java | private boolean handleNonReadyStatus() {
synchronized (this.syncObject) {
Status nodeStatus = this.node.getStatus();
boolean quickFinish = false;
final long time = System.currentTimeMillis();
if (Status.isStatusFinished(nodeStatus)) {
quickFinish = true;
} else if (nodeStatus == Status.DISABLED) {
nodeStatus = changeStatus(Status.SKIPPED, time);
quickFinish = true;
} else if (this.isKilled()) {
nodeStatus = changeStatus(Status.KILLED, time);
quickFinish = true;
}
if (quickFinish) {
this.node.setStartTime(time);
fireEvent(
Event.create(this, EventType.JOB_STARTED,
new EventData(nodeStatus, this.node.getNestedId())));
this.node.setEndTime(time);
fireEvent(
Event
.create(this, EventType.JOB_FINISHED,
new EventData(nodeStatus, this.node.getNestedId())));
return true;
}
return false;
}
} | [
"private",
"boolean",
"handleNonReadyStatus",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"syncObject",
")",
"{",
"Status",
"nodeStatus",
"=",
"this",
".",
"node",
".",
"getStatus",
"(",
")",
";",
"boolean",
"quickFinish",
"=",
"false",
";",
"final",
... | Used to handle non-ready and special status's (i.e. KILLED). Returns true if they handled
anything. | [
"Used",
"to",
"handle",
"non",
"-",
"ready",
"and",
"special",
"status",
"s",
"(",
"i",
".",
"e",
".",
"KILLED",
")",
".",
"Returns",
"true",
"if",
"they",
"handled",
"anything",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-exec-server/src/main/java/azkaban/execapp/JobRunner.java#L407-L438 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.