repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
williamwebb/alogger | ALogger/alogger-base/src/main/java/com/jug6ernaut/android/logging/LogEntry.java | LogEntry.fromLogRecord | public static LogEntry fromLogRecord(LogRecord record){
Level level;
long when = 0;
String message = "";
when = record.getMillis();
message = (record.getMessage()==null?"":record.getMessage());
level = record.getLevel();
return new LogEntry(level, when, message);
} | java | public static LogEntry fromLogRecord(LogRecord record){
Level level;
long when = 0;
String message = "";
when = record.getMillis();
message = (record.getMessage()==null?"":record.getMessage());
level = record.getLevel();
return new LogEntry(level, when, message);
} | [
"public",
"static",
"LogEntry",
"fromLogRecord",
"(",
"LogRecord",
"record",
")",
"{",
"Level",
"level",
";",
"long",
"when",
"=",
"0",
";",
"String",
"message",
"=",
"\"\"",
";",
"when",
"=",
"record",
".",
"getMillis",
"(",
")",
";",
"message",
"=",
... | /*
public Spanned toColorString(){
StringBuilder sb = new StringBuilder();
sb.append(toString());
LogLevel l = LogLevel.INFO;
switch(level){
case INFO:{
sb.insert(0, "<font color=\"white\">");
sb.append("</font>");
}break;
case Level.WARNING:{
sb.insert(0, "<font color=\"yellow\">");
sb.append("</font>");
}break;
case Level.SEVERE:{
sb.insert(0, "<font color=\"red\">");
sb.append("</font>");
}break;
case Level.ALL:{
sb.insert(0, "<font color=\"white\">");
sb.append("</font>");
}break;
}
return Html.fromHtml(sb.toString());
} | [
"/",
"*",
"public",
"Spanned",
"toColorString",
"()",
"{"
] | train | https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/ALogger/alogger-base/src/main/java/com/jug6ernaut/android/logging/LogEntry.java#L95-L105 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.agreements_GET | public ArrayList<Long> agreements_GET(OvhAgreementStateEnum agreed, Long contractId) throws IOException {
String qPath = "/me/agreements";
StringBuilder sb = path(qPath);
query(sb, "agreed", agreed);
query(sb, "contractId", contractId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> agreements_GET(OvhAgreementStateEnum agreed, Long contractId) throws IOException {
String qPath = "/me/agreements";
StringBuilder sb = path(qPath);
query(sb, "agreed", agreed);
query(sb, "contractId", contractId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"agreements_GET",
"(",
"OvhAgreementStateEnum",
"agreed",
",",
"Long",
"contractId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/agreements\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | List of contracts signed between you and OVH
REST: GET /me/agreements
@param contractId [required] Filter the value of contractId property (like)
@param agreed [required] Filter the value of agreed property (like) | [
"List",
"of",
"contracts",
"signed",
"between",
"you",
"and",
"OVH"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1468-L1475 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java | DefaultShardManagerBuilder.setCallbackPool | public DefaultShardManagerBuilder setCallbackPool(ExecutorService executor, boolean automaticShutdown)
{
return setCallbackPoolProvider(executor == null ? null : new ThreadPoolProviderImpl<>(executor, automaticShutdown));
} | java | public DefaultShardManagerBuilder setCallbackPool(ExecutorService executor, boolean automaticShutdown)
{
return setCallbackPoolProvider(executor == null ? null : new ThreadPoolProviderImpl<>(executor, automaticShutdown));
} | [
"public",
"DefaultShardManagerBuilder",
"setCallbackPool",
"(",
"ExecutorService",
"executor",
",",
"boolean",
"automaticShutdown",
")",
"{",
"return",
"setCallbackPoolProvider",
"(",
"executor",
"==",
"null",
"?",
"null",
":",
"new",
"ThreadPoolProviderImpl",
"<>",
"("... | Sets the {@link ExecutorService ExecutorService} that should be used in
the JDA callback handler which mostly consists of {@link net.dv8tion.jda.core.requests.RestAction RestAction} callbacks.
By default JDA will use {@link ForkJoinPool#commonPool()}
<br><b>Only change this pool if you know what you're doing.</b>
@param executor
The thread-pool to use for callback handling
@param automaticShutdown
Whether {@link net.dv8tion.jda.core.JDA#shutdown()} should automatically shutdown this pool
@return The DefaultShardManagerBuilder instance. Useful for chaining. | [
"Sets",
"the",
"{",
"@link",
"ExecutorService",
"ExecutorService",
"}",
"that",
"should",
"be",
"used",
"in",
"the",
"JDA",
"callback",
"handler",
"which",
"mostly",
"consists",
"of",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"requ... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java#L837-L840 |
alkacon/opencms-core | src/org/opencms/db/CmsExportPointDriver.java | CmsExportPointDriver.deleteResource | public void deleteResource(String resourceName, String exportpoint) {
File file = getExportPointFile(resourceName, exportpoint);
if (file.exists() && file.canWrite()) {
// delete the file (or folder)
file.delete();
// also delete empty parent directories
File parent = file.getParentFile();
if (parent.canWrite()) {
parent.delete();
}
}
} | java | public void deleteResource(String resourceName, String exportpoint) {
File file = getExportPointFile(resourceName, exportpoint);
if (file.exists() && file.canWrite()) {
// delete the file (or folder)
file.delete();
// also delete empty parent directories
File parent = file.getParentFile();
if (parent.canWrite()) {
parent.delete();
}
}
} | [
"public",
"void",
"deleteResource",
"(",
"String",
"resourceName",
",",
"String",
"exportpoint",
")",
"{",
"File",
"file",
"=",
"getExportPointFile",
"(",
"resourceName",
",",
"exportpoint",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
"&&",
"file",... | Deletes a file or a folder in the real file sytem.<p>
If the given resource name points to a folder, then this folder is only deleted if it is empty.
This is required since the same export point RFS target folder may be used by multiple export points.
For example, this is usually the case with the <code>/WEB-INF/classes/</code> and
<code>/WEB-INF/lib/</code> folders which are export point for multiple modules.
If all resources in the RFS target folder where deleted, uninstalling one module would delete the
export <code>classes</code> and <code>lib</code> resources of all other modules.<p>
@param resourceName the root path of the resource to be deleted
@param exportpoint the name of the export point | [
"Deletes",
"a",
"file",
"or",
"a",
"folder",
"in",
"the",
"real",
"file",
"sytem",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsExportPointDriver.java#L108-L120 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java | CachingTemplate.withCachePut | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCachePut(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(key, "Key is required");
Assert.notNull(cacheableOperation, "Supplier is required");
return (T) Optional.ofNullable(cacheableOperation.get())
.map(value -> write(getLock(), key, value))
.orElse(null);
} | java | @SuppressWarnings("unchecked")
public <T extends VALUE> T withCachePut(KEY key, Supplier<VALUE> cacheableOperation) {
Assert.notNull(key, "Key is required");
Assert.notNull(cacheableOperation, "Supplier is required");
return (T) Optional.ofNullable(cacheableOperation.get())
.map(value -> write(getLock(), key, value))
.orElse(null);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
"extends",
"VALUE",
">",
"T",
"withCachePut",
"(",
"KEY",
"key",
",",
"Supplier",
"<",
"VALUE",
">",
"cacheableOperation",
")",
"{",
"Assert",
".",
"notNull",
"(",
"key",
",",
"\"Key i... | This caching data access operation invokes the supplied {@link Supplier cacheable operation} and then caches
the {@link VALUE result} before returning the computed {@link VALUE}.
The {@link VALUE result} of the {@link Supplier cacheable operation} is only cached if the {@link VALUE result}
is not {@literal null}.
@param <T> {@link Class type} of the return {@link VALUE value}.
@param key {@link KEY key} mapping the {@link VALUE value} returned by the {@link Supplier cacheable operation}
as an entry stored in the {@link Cache}.
@param cacheableOperation {@link Supplier} used to compute or load a {@link VALUE value}
mapped to the given {@link KEY key} and put as an entry in the {@link Cache}.
@return the {@link VALUE result} of the {@link Supplier cacheable operation}.
@throws IllegalArgumentException if either the {@link KEY key} or the {@link Supplier} are {@literal null}.
@see java.util.function.Supplier
@see #getCache()
@see #getLock() | [
"This",
"caching",
"data",
"access",
"operation",
"invokes",
"the",
"supplied",
"{",
"@link",
"Supplier",
"cacheable",
"operation",
"}",
"and",
"then",
"caches",
"the",
"{",
"@link",
"VALUE",
"result",
"}",
"before",
"returning",
"the",
"computed",
"{",
"@link... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/caching/support/CachingTemplate.java#L348-L357 |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java | BaseTransform.extractAttribute | protected String extractAttribute(String name, String line) {
int i = line.indexOf(name + "=\"");
i = i == -1 ? i : i + name.length() + 2;
int j = i == -1 ? -1 : line.indexOf("\"", i);
return j == -1 ? null : line.substring(i, j);
} | java | protected String extractAttribute(String name, String line) {
int i = line.indexOf(name + "=\"");
i = i == -1 ? i : i + name.length() + 2;
int j = i == -1 ? -1 : line.indexOf("\"", i);
return j == -1 ? null : line.substring(i, j);
} | [
"protected",
"String",
"extractAttribute",
"(",
"String",
"name",
",",
"String",
"line",
")",
"{",
"int",
"i",
"=",
"line",
".",
"indexOf",
"(",
"name",
"+",
"\"=\\\"\"",
")",
";",
"i",
"=",
"i",
"==",
"-",
"1",
"?",
"i",
":",
"i",
"+",
"name",
"... | Extracts the value of the named attribute.
@param name The attribute name.
@param line The source line.
@return The attribute value, or null if not found. | [
"Extracts",
"the",
"value",
"of",
"the",
"named",
"attribute",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/chm/BaseTransform.java#L84-L89 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsappflowcollector.java | nsappflowcollector.get | public static nsappflowcollector get(nitro_service service, String name) throws Exception{
nsappflowcollector obj = new nsappflowcollector();
obj.set_name(name);
nsappflowcollector response = (nsappflowcollector) obj.get_resource(service);
return response;
} | java | public static nsappflowcollector get(nitro_service service, String name) throws Exception{
nsappflowcollector obj = new nsappflowcollector();
obj.set_name(name);
nsappflowcollector response = (nsappflowcollector) obj.get_resource(service);
return response;
} | [
"public",
"static",
"nsappflowcollector",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"nsappflowcollector",
"obj",
"=",
"new",
"nsappflowcollector",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";... | Use this API to fetch nsappflowcollector resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"nsappflowcollector",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsappflowcollector.java#L235-L240 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java | CollectionNamingConfusion.checkConfusedName | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists")
private boolean checkConfusedName(String methodOrVariableName, String signature) {
try {
String name = methodOrVariableName.toLowerCase(Locale.ENGLISH);
if ((name.endsWith("map") || (name.endsWith("set") && !name.endsWith("toset")) || name.endsWith("list") || name.endsWith("queue"))
&& signature.startsWith("Ljava/util/")) {
String clsName = SignatureUtils.stripSignature(signature);
JavaClass cls = Repository.lookupClass(clsName);
if ((cls.implementationOf(mapInterface) && !name.endsWith("map")) || (cls.implementationOf(setInterface) && !name.endsWith("set"))
|| ((cls.implementationOf(listInterface) || cls.implementationOf(queueInterface)) && !name.endsWith("list")
&& !name.endsWith("queue"))) {
return true;
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
return false;
} | java | @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EXS_EXCEPTION_SOFTENING_RETURN_FALSE", justification = "No other simple way to determine whether class exists")
private boolean checkConfusedName(String methodOrVariableName, String signature) {
try {
String name = methodOrVariableName.toLowerCase(Locale.ENGLISH);
if ((name.endsWith("map") || (name.endsWith("set") && !name.endsWith("toset")) || name.endsWith("list") || name.endsWith("queue"))
&& signature.startsWith("Ljava/util/")) {
String clsName = SignatureUtils.stripSignature(signature);
JavaClass cls = Repository.lookupClass(clsName);
if ((cls.implementationOf(mapInterface) && !name.endsWith("map")) || (cls.implementationOf(setInterface) && !name.endsWith("set"))
|| ((cls.implementationOf(listInterface) || cls.implementationOf(queueInterface)) && !name.endsWith("list")
&& !name.endsWith("queue"))) {
return true;
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
return false;
} | [
"@",
"edu",
".",
"umd",
".",
"cs",
".",
"findbugs",
".",
"annotations",
".",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"EXS_EXCEPTION_SOFTENING_RETURN_FALSE\"",
",",
"justification",
"=",
"\"No other simple way to determine whether class exists\"",
")",
"private",
"boole... | looks for a name that mentions a collection type but the wrong type for the variable
@param methodOrVariableName
the method or variable name
@param signature
the variable signature
@return whether the name doesn't match the type | [
"looks",
"for",
"a",
"name",
"that",
"mentions",
"a",
"collection",
"type",
"but",
"the",
"wrong",
"type",
"for",
"the",
"variable"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L135-L154 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java | JsonModelCoder.get | public T get(InputStream stream) throws IOException, JsonFormatException {
JsonPullParser parser = JsonPullParser.newParser(stream);
return get(parser, null);
} | java | public T get(InputStream stream) throws IOException, JsonFormatException {
JsonPullParser parser = JsonPullParser.newParser(stream);
return get(parser, null);
} | [
"public",
"T",
"get",
"(",
"InputStream",
"stream",
")",
"throws",
"IOException",
",",
"JsonFormatException",
"{",
"JsonPullParser",
"parser",
"=",
"JsonPullParser",
".",
"newParser",
"(",
"stream",
")",
";",
"return",
"get",
"(",
"parser",
",",
"null",
")",
... | Attempts to parse the given data as an object.
@param stream JSON-formatted data
@return An object instance
@throws IOException
@throws JsonFormatException The given data is malformed, or its type is unexpected | [
"Attempts",
"to",
"parse",
"the",
"given",
"data",
"as",
"an",
"object",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L186-L189 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataWriter.java | AnnotationMetadataWriter.instantiateNewMetadata | @Internal
public static void instantiateNewMetadata(Type owningType, ClassWriter declaringClassWriter, GeneratorAdapter generatorAdapter, DefaultAnnotationMetadata annotationMetadata, Map<String, GeneratorAdapter> loadTypeMethods) {
instantiateInternal(owningType, declaringClassWriter, generatorAdapter, annotationMetadata, true, loadTypeMethods);
} | java | @Internal
public static void instantiateNewMetadata(Type owningType, ClassWriter declaringClassWriter, GeneratorAdapter generatorAdapter, DefaultAnnotationMetadata annotationMetadata, Map<String, GeneratorAdapter> loadTypeMethods) {
instantiateInternal(owningType, declaringClassWriter, generatorAdapter, annotationMetadata, true, loadTypeMethods);
} | [
"@",
"Internal",
"public",
"static",
"void",
"instantiateNewMetadata",
"(",
"Type",
"owningType",
",",
"ClassWriter",
"declaringClassWriter",
",",
"GeneratorAdapter",
"generatorAdapter",
",",
"DefaultAnnotationMetadata",
"annotationMetadata",
",",
"Map",
"<",
"String",
",... | Writes out the byte code necessary to instantiate the given {@link DefaultAnnotationMetadata}.
@param owningType The owning type
@param declaringClassWriter The declaring class writer
@param generatorAdapter The generator adapter
@param annotationMetadata The annotation metadata
@param loadTypeMethods The generated load type methods | [
"Writes",
"out",
"the",
"byte",
"code",
"necessary",
"to",
"instantiate",
"the",
"given",
"{",
"@link",
"DefaultAnnotationMetadata",
"}",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/AnnotationMetadataWriter.java#L215-L218 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/email/Mail.java | Mail.templateMessage | public Mail templateMessage(String template, Map<String, Object> content) throws MangooTemplateEngineException {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
Objects.requireNonNull(content, Required.CONTENT.toString());
if (template.charAt(0) == '/' || template.startsWith("\\")) {
template = template.substring(1, template.length());
}
this.email.htmlMessage(
Application.getInstance(TemplateEngine.class).renderTemplate(new TemplateContext(content).withTemplatePath(template)),
Default.ENCODING.toString());
return this;
} | java | public Mail templateMessage(String template, Map<String, Object> content) throws MangooTemplateEngineException {
Objects.requireNonNull(template, Required.TEMPLATE.toString());
Objects.requireNonNull(content, Required.CONTENT.toString());
if (template.charAt(0) == '/' || template.startsWith("\\")) {
template = template.substring(1, template.length());
}
this.email.htmlMessage(
Application.getInstance(TemplateEngine.class).renderTemplate(new TemplateContext(content).withTemplatePath(template)),
Default.ENCODING.toString());
return this;
} | [
"public",
"Mail",
"templateMessage",
"(",
"String",
"template",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"content",
")",
"throws",
"MangooTemplateEngineException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"template",
",",
"Required",
".",
"TEMPLATE",
".... | Sets a template to be rendered for the email. Using a template
will make it a HTML Email by default.
@param template The template to use
@param content The content for the template
@return A mail object instance
@throws MangooTemplateEngineException if rendering of template fails | [
"Sets",
"a",
"template",
"to",
"be",
"rendered",
"for",
"the",
"email",
".",
"Using",
"a",
"template",
"will",
"make",
"it",
"a",
"HTML",
"Email",
"by",
"default",
"."
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/email/Mail.java#L54-L67 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/configuration/PyPreferenceAccess.java | PyPreferenceAccess.loadPreferences | public static void loadPreferences(PyGeneratorConfiguration generatorConfig, IPreferenceStore store) {
final String key = ExtraLanguagePreferenceAccess.getPrefixedKey(PyGeneratorPlugin.PREFERENCE_ID,
PyPreferenceAccess.JYTHON_COMPLIANCE_PROPERTY);
if (store.contains(key)) {
generatorConfig.setImplicitJvmTypes(store.getBoolean(key));
}
} | java | public static void loadPreferences(PyGeneratorConfiguration generatorConfig, IPreferenceStore store) {
final String key = ExtraLanguagePreferenceAccess.getPrefixedKey(PyGeneratorPlugin.PREFERENCE_ID,
PyPreferenceAccess.JYTHON_COMPLIANCE_PROPERTY);
if (store.contains(key)) {
generatorConfig.setImplicitJvmTypes(store.getBoolean(key));
}
} | [
"public",
"static",
"void",
"loadPreferences",
"(",
"PyGeneratorConfiguration",
"generatorConfig",
",",
"IPreferenceStore",
"store",
")",
"{",
"final",
"String",
"key",
"=",
"ExtraLanguagePreferenceAccess",
".",
"getPrefixedKey",
"(",
"PyGeneratorPlugin",
".",
"PREFERENCE... | Load the generator configuration from the preferences.
@param generatorConfig the configuration to set up.
@param store the preference store access. | [
"Load",
"the",
"generator",
"configuration",
"from",
"the",
"preferences",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/configuration/PyPreferenceAccess.java#L53-L59 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.getAllGroups | public static List<String> getAllGroups(Pattern pattern, CharSequence content) {
return getAllGroups(pattern, content, true);
} | java | public static List<String> getAllGroups(Pattern pattern, CharSequence content) {
return getAllGroups(pattern, content, true);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getAllGroups",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"return",
"getAllGroups",
"(",
"pattern",
",",
"content",
",",
"true",
")",
";",
"}"
] | 获得匹配的字符串匹配到的所有分组
@param pattern 编译后的正则模式
@param content 被匹配的内容
@return 匹配后得到的字符串数组,按照分组顺序依次列出,未匹配到返回空列表,任何一个参数为null返回null
@since 3.1.0 | [
"获得匹配的字符串匹配到的所有分组"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L131-L133 |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java | SingleSessionIoHandlerDelegate.exceptionCaught | public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
SingleSessionIoHandler handler = (SingleSessionIoHandler) session
.getAttribute(HANDLER);
handler.exceptionCaught(cause);
} | java | public void exceptionCaught(IoSession session, Throwable cause)
throws Exception {
SingleSessionIoHandler handler = (SingleSessionIoHandler) session
.getAttribute(HANDLER);
handler.exceptionCaught(cause);
} | [
"public",
"void",
"exceptionCaught",
"(",
"IoSession",
"session",
",",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"SingleSessionIoHandler",
"handler",
"=",
"(",
"SingleSessionIoHandler",
")",
"session",
".",
"getAttribute",
"(",
"HANDLER",
")",
";",
"h... | Delegates the method call to the
{@link SingleSessionIoHandler#exceptionCaught(Throwable)} method of the
handler assigned to this session. | [
"Delegates",
"the",
"method",
"call",
"to",
"the",
"{"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java#L124-L129 |
Impetus/Kundera | src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java | DocumentIndexer.addEntityClassToDocument | protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, Document document,
final MetamodelImpl metaModel) {
try {
Field luceneField;
Object id;
id = PropertyAccessorHelper.getId(entity, metadata);
// Indexing composite keys
if (metaModel != null && metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
id = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, id);
}
luceneField =
new Field(IndexingConstants.ENTITY_ID_FIELD, id.toString(), Field.Store.YES, Field.Index.ANALYZED);
// luceneField.set
// adding class
// namespace
// /*Field.Store.YES, Field.Index.ANALYZED_NO_NORMS*/);
document.add(luceneField);
// index namespace for unique deletion
luceneField =
new Field(IndexingConstants.KUNDERA_ID_FIELD, getKunderaId(metadata, id), Field.Store.YES,
Field.Index.ANALYZED); // adding
// class
// namespace
// Field.Store.YES/*, Field.Index.ANALYZED_NO_NORMS*/);
document.add(luceneField);
// index entity class
luceneField =
new Field(IndexingConstants.ENTITY_CLASS_FIELD, metadata.getEntityClazz().getCanonicalName()
.toLowerCase(), Field.Store.YES, Field.Index.ANALYZED);
document.add(luceneField);
//
luceneField = new Field("timestamp", System.currentTimeMillis() + "", Field.Store.YES, Field.Index.NO);
document.add(luceneField);
// index index name
luceneField =
new Field(IndexingConstants.ENTITY_INDEXNAME_FIELD, metadata.getIndexName(), Field.Store.NO,
Field.Index.ANALYZED_NO_NORMS);
document.add(luceneField);
luceneField =
new Field(getCannonicalPropertyName(metadata.getEntityClazz().getSimpleName(),
((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), id.toString(),
Field.Store.YES, Field.Index.ANALYZED_NO_NORMS);
document.add(luceneField);
} catch (PropertyAccessException e) {
throw new IllegalArgumentException("Id could not be read from object " + entity);
}
} | java | protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, Document document,
final MetamodelImpl metaModel) {
try {
Field luceneField;
Object id;
id = PropertyAccessorHelper.getId(entity, metadata);
// Indexing composite keys
if (metaModel != null && metaModel.isEmbeddable(metadata.getIdAttribute().getBindableJavaType())) {
id = KunderaCoreUtils.prepareCompositeKey(metadata.getIdAttribute(), metaModel, id);
}
luceneField =
new Field(IndexingConstants.ENTITY_ID_FIELD, id.toString(), Field.Store.YES, Field.Index.ANALYZED);
// luceneField.set
// adding class
// namespace
// /*Field.Store.YES, Field.Index.ANALYZED_NO_NORMS*/);
document.add(luceneField);
// index namespace for unique deletion
luceneField =
new Field(IndexingConstants.KUNDERA_ID_FIELD, getKunderaId(metadata, id), Field.Store.YES,
Field.Index.ANALYZED); // adding
// class
// namespace
// Field.Store.YES/*, Field.Index.ANALYZED_NO_NORMS*/);
document.add(luceneField);
// index entity class
luceneField =
new Field(IndexingConstants.ENTITY_CLASS_FIELD, metadata.getEntityClazz().getCanonicalName()
.toLowerCase(), Field.Store.YES, Field.Index.ANALYZED);
document.add(luceneField);
//
luceneField = new Field("timestamp", System.currentTimeMillis() + "", Field.Store.YES, Field.Index.NO);
document.add(luceneField);
// index index name
luceneField =
new Field(IndexingConstants.ENTITY_INDEXNAME_FIELD, metadata.getIndexName(), Field.Store.NO,
Field.Index.ANALYZED_NO_NORMS);
document.add(luceneField);
luceneField =
new Field(getCannonicalPropertyName(metadata.getEntityClazz().getSimpleName(),
((AbstractAttribute) metadata.getIdAttribute()).getJPAColumnName()), id.toString(),
Field.Store.YES, Field.Index.ANALYZED_NO_NORMS);
document.add(luceneField);
} catch (PropertyAccessException e) {
throw new IllegalArgumentException("Id could not be read from object " + entity);
}
} | [
"protected",
"void",
"addEntityClassToDocument",
"(",
"EntityMetadata",
"metadata",
",",
"Object",
"entity",
",",
"Document",
"document",
",",
"final",
"MetamodelImpl",
"metaModel",
")",
"{",
"try",
"{",
"Field",
"luceneField",
";",
"Object",
"id",
";",
"id",
"=... | Prepare index document.
@param metadata
the metadata
@param entity
the object
@param document
the document | [
"Prepare",
"index",
"document",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/DocumentIndexer.java#L358-L411 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java | ManagementClient.createRule | public RuleDescription createRule(String topicName, String subscriptionName, RuleDescription ruleDescription) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.createRuleAsync(topicName, subscriptionName, ruleDescription));
} | java | public RuleDescription createRule(String topicName, String subscriptionName, RuleDescription ruleDescription) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.createRuleAsync(topicName, subscriptionName, ruleDescription));
} | [
"public",
"RuleDescription",
"createRule",
"(",
"String",
"topicName",
",",
"String",
"subscriptionName",
",",
"RuleDescription",
"ruleDescription",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"t... | Creates a new rule for a given topic - subscription.
See {@link RuleDescription} for default values of subscription properties.
@param topicName - Name of the topic.
@param subscriptionName - Name of the subscription.
@param ruleDescription - A {@link RuleDescription} object describing the attributes with which the new rule will be created.
@return {@link RuleDescription} of the newly created rule.
@throws MessagingEntityAlreadyExistsException - An entity with the same name exists under the same service namespace.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws QuotaExceededException - Either the specified size in the description is not supported or the maximum allowed quota has been reached.
@throws InterruptedException if the current thread was interrupted | [
"Creates",
"a",
"new",
"rule",
"for",
"a",
"given",
"topic",
"-",
"subscription",
".",
"See",
"{"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L470-L472 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java | KunderaQuery.addTypedParameter | private void addTypedParameter(Type type, String parameter, FilterClause clause) {
if (typedParameter == null) {
typedParameter = new TypedParameter(type);
}
if (typedParameter.getType().equals(type)) {
typedParameter.addParameters(parameter, clause);
} else {
logger.warn("Invalid type provided, it can either be name or indexes!");
}
} | java | private void addTypedParameter(Type type, String parameter, FilterClause clause) {
if (typedParameter == null) {
typedParameter = new TypedParameter(type);
}
if (typedParameter.getType().equals(type)) {
typedParameter.addParameters(parameter, clause);
} else {
logger.warn("Invalid type provided, it can either be name or indexes!");
}
} | [
"private",
"void",
"addTypedParameter",
"(",
"Type",
"type",
",",
"String",
"parameter",
",",
"FilterClause",
"clause",
")",
"{",
"if",
"(",
"typedParameter",
"==",
"null",
")",
"{",
"typedParameter",
"=",
"new",
"TypedParameter",
"(",
"type",
")",
";",
"}",... | Adds typed parameter to {@link TypedParameter}.
@param type
type of parameter(e.g. NAMED/INDEXED)
@param parameter
parameter name.
@param clause
filter clause. | [
"Adds",
"typed",
"parameter",
"to",
"{",
"@link",
"TypedParameter",
"}",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java#L737-L747 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java | FieldList.doRecordChange | public int doRecordChange(Field field, int iChangeType, boolean bDisplayOption)
{
if (field != null)
if (iChangeType == Constants.SCREEN_MOVE)
this.firePropertyChange(field.getFieldName(), null, field.getData());
return Constants.NORMAL_RETURN;
} | java | public int doRecordChange(Field field, int iChangeType, boolean bDisplayOption)
{
if (field != null)
if (iChangeType == Constants.SCREEN_MOVE)
this.firePropertyChange(field.getFieldName(), null, field.getData());
return Constants.NORMAL_RETURN;
} | [
"public",
"int",
"doRecordChange",
"(",
"Field",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
")",
"if",
"(",
"iChangeType",
"==",
"Constants",
".",
"SCREEN_MOVE",
")",
"this",
".",
"fire... | Called each time a field changed.
This method replaces behaviors in the thick model. Just override this method and look for the
target field and do the listener associated with a change of value.
Note: The thin version (this one) keeps a flag for changes, the thick version surveys the fields.
@param field The field that changed.
@param iChangeType The type of change (See record for the list).
@param iDisplayOtion The display option.
@return The error code. | [
"Called",
"each",
"time",
"a",
"field",
"changed",
".",
"This",
"method",
"replaces",
"behaviors",
"in",
"the",
"thick",
"model",
".",
"Just",
"override",
"this",
"method",
"and",
"look",
"for",
"the",
"target",
"field",
"and",
"do",
"the",
"listener",
"as... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java#L382-L388 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FacesBackingBean.java | FacesBackingBean.persistInSession | public void persistInSession( HttpServletRequest request, HttpServletResponse response )
{
StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName =
ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
sh.setAttribute( rc, attrName, this );
} | java | public void persistInSession( HttpServletRequest request, HttpServletResponse response )
{
StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName =
ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
sh.setAttribute( rc, attrName, this );
} | [
"public",
"void",
"persistInSession",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"StorageHandler",
"sh",
"=",
"Handlers",
".",
"get",
"(",
"getServletContext",
"(",
")",
")",
".",
"getStorageHandler",
"(",
")",
";",
"... | Store this object in the user session, in the appropriate place. Used by the framework; normally should not be
called directly. | [
"Store",
"this",
"object",
"in",
"the",
"user",
"session",
"in",
"the",
"appropriate",
"place",
".",
"Used",
"by",
"the",
"framework",
";",
"normally",
"should",
"not",
"be",
"called",
"directly",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FacesBackingBean.java#L70-L79 |
alkacon/opencms-core | src/org/opencms/mail/CmsMailSettings.java | CmsMailSettings.addMailHost | public void addMailHost(
String hostname,
String port,
String order,
String protocol,
String security,
String username,
String password) {
Integer thePort;
try {
thePort = Integer.valueOf(port);
} catch (Throwable t) {
thePort = Integer.valueOf(25);
}
m_orderDefault += 10;
Integer theOrder;
try {
theOrder = Integer.valueOf(order);
if (theOrder.intValue() > m_orderDefault) {
m_orderDefault = theOrder.intValue();
}
} catch (Throwable t) {
// valueOf: use jdk int cache if possible and not new operator:
theOrder = Integer.valueOf(m_orderDefault);
}
CmsMailHost host = new CmsMailHost(hostname, thePort, theOrder, protocol, security, username, password);
m_mailHosts.add(host);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_ADD_HOST_1, host));
}
Collections.sort(m_mailHosts);
} | java | public void addMailHost(
String hostname,
String port,
String order,
String protocol,
String security,
String username,
String password) {
Integer thePort;
try {
thePort = Integer.valueOf(port);
} catch (Throwable t) {
thePort = Integer.valueOf(25);
}
m_orderDefault += 10;
Integer theOrder;
try {
theOrder = Integer.valueOf(order);
if (theOrder.intValue() > m_orderDefault) {
m_orderDefault = theOrder.intValue();
}
} catch (Throwable t) {
// valueOf: use jdk int cache if possible and not new operator:
theOrder = Integer.valueOf(m_orderDefault);
}
CmsMailHost host = new CmsMailHost(hostname, thePort, theOrder, protocol, security, username, password);
m_mailHosts.add(host);
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_ADD_HOST_1, host));
}
Collections.sort(m_mailHosts);
} | [
"public",
"void",
"addMailHost",
"(",
"String",
"hostname",
",",
"String",
"port",
",",
"String",
"order",
",",
"String",
"protocol",
",",
"String",
"security",
",",
"String",
"username",
",",
"String",
"password",
")",
"{",
"Integer",
"thePort",
";",
"try",... | Adds a new mail host to the internal list of mail hosts.<p>
@param hostname the name of the mail host
@param port the port of the mail host
@param order the order in which the host is tried
@param protocol the protocol to use (default "smtp")
@param security the security mode
@param username the user name to use for authentication
@param password the password to use for authentication | [
"Adds",
"a",
"new",
"mail",
"host",
"to",
"the",
"internal",
"list",
"of",
"mail",
"hosts",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/mail/CmsMailSettings.java#L100-L132 |
alkacon/opencms-core | src/org/opencms/security/CmsOrgUnitManager.java | CmsOrgUnitManager.readOrganizationalUnit | public CmsOrganizationalUnit readOrganizationalUnit(CmsObject cms, String ouFqn) throws CmsException {
return m_securityManager.readOrganizationalUnit(cms.getRequestContext(), ouFqn);
} | java | public CmsOrganizationalUnit readOrganizationalUnit(CmsObject cms, String ouFqn) throws CmsException {
return m_securityManager.readOrganizationalUnit(cms.getRequestContext(), ouFqn);
} | [
"public",
"CmsOrganizationalUnit",
"readOrganizationalUnit",
"(",
"CmsObject",
"cms",
",",
"String",
"ouFqn",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"readOrganizationalUnit",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
",",
"ouFqn"... | Reads an organizational Unit based on its fully qualified name.<p>
@param cms the opencms context
@param ouFqn the fully qualified name of the organizational Unit to be read
@return the organizational Unit with the provided fully qualified name
@throws CmsException if something goes wrong | [
"Reads",
"an",
"organizational",
"Unit",
"based",
"on",
"its",
"fully",
"qualified",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L310-L313 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ActivitysInner.java | ActivitysInner.listByModuleWithServiceResponseAsync | public Observable<ServiceResponse<Page<ActivityInner>>> listByModuleWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String moduleName) {
return listByModuleSinglePageAsync(resourceGroupName, automationAccountName, moduleName)
.concatMap(new Func1<ServiceResponse<Page<ActivityInner>>, Observable<ServiceResponse<Page<ActivityInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ActivityInner>>> call(ServiceResponse<Page<ActivityInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByModuleNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<ActivityInner>>> listByModuleWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String moduleName) {
return listByModuleSinglePageAsync(resourceGroupName, automationAccountName, moduleName)
.concatMap(new Func1<ServiceResponse<Page<ActivityInner>>, Observable<ServiceResponse<Page<ActivityInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ActivityInner>>> call(ServiceResponse<Page<ActivityInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByModuleNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ActivityInner",
">",
">",
">",
"listByModuleWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
",",
"final",
"String",
"moduleName",
... | Retrieve a list of activities in the module identified by module name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param moduleName The name of module.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ActivityInner> object | [
"Retrieve",
"a",
"list",
"of",
"activities",
"in",
"the",
"module",
"identified",
"by",
"module",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ActivitysInner.java#L243-L255 |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java | InstanceListenerService.evaluateMethod | private void evaluateMethod(Object listener, Class<? extends Annotation> annotation, Method method, Map<Object, Set<Method>> methods) {
if (method.isAnnotationPresent(annotation)) {
if (method.getParameterTypes().length != 1) {
throw new XOException("Life cycle method '" + method.toGenericString() + "' annotated with '" + annotation.getName()
+ "' must declare exactly one parameter but declares " + method.getParameterTypes().length + ".");
}
Set<Method> listenerMethods = methods.get(listener);
if (listenerMethods == null) {
listenerMethods = new HashSet<>();
methods.put(listener, listenerMethods);
}
listenerMethods.add(method);
}
} | java | private void evaluateMethod(Object listener, Class<? extends Annotation> annotation, Method method, Map<Object, Set<Method>> methods) {
if (method.isAnnotationPresent(annotation)) {
if (method.getParameterTypes().length != 1) {
throw new XOException("Life cycle method '" + method.toGenericString() + "' annotated with '" + annotation.getName()
+ "' must declare exactly one parameter but declares " + method.getParameterTypes().length + ".");
}
Set<Method> listenerMethods = methods.get(listener);
if (listenerMethods == null) {
listenerMethods = new HashSet<>();
methods.put(listener, listenerMethods);
}
listenerMethods.add(method);
}
} | [
"private",
"void",
"evaluateMethod",
"(",
"Object",
"listener",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"Method",
"method",
",",
"Map",
"<",
"Object",
",",
"Set",
"<",
"Method",
">",
">",
"methods",
")",
"{",
"if",
"(",
... | Evaluates a method if an annotation is present and if true adds to the map of
life cycle methods.
@param listener
The listener instance.
@param annotation
The annotation to check for.
@param method
The method to evaluate.
@param methods
The map of methods. | [
"Evaluates",
"a",
"method",
"if",
"an",
"annotation",
"is",
"present",
"and",
"if",
"true",
"adds",
"to",
"the",
"map",
"of",
"life",
"cycle",
"methods",
"."
] | train | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java#L145-L158 |
shrinkwrap/shrinkwrap | impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java | ServiceExtensionLoader.loadExtensionWrapper | private <T extends Assignable> ExtensionWrapper loadExtensionWrapper(final InputStream extensionStream,
Class<T> extensionClass) {
Properties properties = new Properties();
try {
properties.load(extensionStream);
} catch (IOException e) {
throw new RuntimeException("Could not open stream for extensionURL " + extensionStream, e);
}
String implementingClassName = (String) properties.get("implementingClassName");
if (implementingClassName == null) {
throw new RuntimeException("Property implementingClassName is not present in " + extensionStream);
}
final Map<String, String> map = new HashMap<String, String>(properties.size());
final Enumeration<Object> keys = properties.keys();
while (keys.hasMoreElements()) {
final String key = (String) keys.nextElement();
final String value = (String) properties.get(key);
map.put(key, value);
}
return new ExtensionWrapper(implementingClassName, map, extensionClass);
} | java | private <T extends Assignable> ExtensionWrapper loadExtensionWrapper(final InputStream extensionStream,
Class<T> extensionClass) {
Properties properties = new Properties();
try {
properties.load(extensionStream);
} catch (IOException e) {
throw new RuntimeException("Could not open stream for extensionURL " + extensionStream, e);
}
String implementingClassName = (String) properties.get("implementingClassName");
if (implementingClassName == null) {
throw new RuntimeException("Property implementingClassName is not present in " + extensionStream);
}
final Map<String, String> map = new HashMap<String, String>(properties.size());
final Enumeration<Object> keys = properties.keys();
while (keys.hasMoreElements()) {
final String key = (String) keys.nextElement();
final String value = (String) properties.get(key);
map.put(key, value);
}
return new ExtensionWrapper(implementingClassName, map, extensionClass);
} | [
"private",
"<",
"T",
"extends",
"Assignable",
">",
"ExtensionWrapper",
"loadExtensionWrapper",
"(",
"final",
"InputStream",
"extensionStream",
",",
"Class",
"<",
"T",
">",
"extensionClass",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
... | Wraps the provider-configuration file <code>extensionStream</code>, the SPI <code>extensionClass</code> and its
implementation class name into a {@link ExtensionWrapper} instance.
@param <T>
@param extensionStream
- a bytes stream representation of the provider-configuration file
@param extensionClass
- SPI type
@return a {@link ExtensionWrapper} instance | [
"Wraps",
"the",
"provider",
"-",
"configuration",
"file",
"<code",
">",
"extensionStream<",
"/",
"code",
">",
"the",
"SPI",
"<code",
">",
"extensionClass<",
"/",
"code",
">",
"and",
"its",
"implementation",
"class",
"name",
"into",
"a",
"{",
"@link",
"Extens... | train | https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java#L294-L314 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/TimeUnit.java | TimeUnit.timedWait | public void timedWait(Object obj, long timeout)
throws InterruptedException {
if (timeout > 0) {
long ms = toMillis(timeout);
int ns = excessNanos(timeout, ms);
obj.wait(ms, ns);
}
} | java | public void timedWait(Object obj, long timeout)
throws InterruptedException {
if (timeout > 0) {
long ms = toMillis(timeout);
int ns = excessNanos(timeout, ms);
obj.wait(ms, ns);
}
} | [
"public",
"void",
"timedWait",
"(",
"Object",
"obj",
",",
"long",
"timeout",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"timeout",
">",
"0",
")",
"{",
"long",
"ms",
"=",
"toMillis",
"(",
"timeout",
")",
";",
"int",
"ns",
"=",
"excessNanos",
... | Perform a timed <tt>Object.wait</tt> using this time unit.
This is a convenience method that converts timeout arguments
into the form required by the <tt>Object.wait</tt> method.
<p>For example, you could implement a blocking <tt>poll</tt>
method (see {@link BlockingQueue#poll BlockingQueue.poll})
using:
<pre> public synchronized Object poll(long timeout, TimeUnit unit) throws InterruptedException {
while (empty) {
unit.timedWait(this, timeout);
...
}
}</pre>
@param obj the object to wait on
@param timeout the maximum time to wait.
@throws InterruptedException if interrupted while waiting.
@see java.lang.Object#wait(long, int) | [
"Perform",
"a",
"timed",
"<tt",
">",
"Object",
".",
"wait<",
"/",
"tt",
">",
"using",
"this",
"time",
"unit",
".",
"This",
"is",
"a",
"convenience",
"method",
"that",
"converts",
"timeout",
"arguments",
"into",
"the",
"form",
"required",
"by",
"the",
"<t... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/TimeUnit.java#L282-L289 |
oehf/ipf-oht-atna | nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/utils/AliasSensitiveX509KeyManager.java | AliasSensitiveX509KeyManager.chooseClientAliasForKey | private String chooseClientAliasForKey(String preferredAlias, String keyType, Principal[] issuers, Socket socket)
{
String[] aliases = getClientAliases(keyType, issuers);
if (aliases != null && aliases.length > 0) {
for (int i=0; i<aliases.length;i++) {
if (preferredAlias.equals(aliases[i])) {
return aliases[i];
}
}
}
return null;
} | java | private String chooseClientAliasForKey(String preferredAlias, String keyType, Principal[] issuers, Socket socket)
{
String[] aliases = getClientAliases(keyType, issuers);
if (aliases != null && aliases.length > 0) {
for (int i=0; i<aliases.length;i++) {
if (preferredAlias.equals(aliases[i])) {
return aliases[i];
}
}
}
return null;
} | [
"private",
"String",
"chooseClientAliasForKey",
"(",
"String",
"preferredAlias",
",",
"String",
"keyType",
",",
"Principal",
"[",
"]",
"issuers",
",",
"Socket",
"socket",
")",
"{",
"String",
"[",
"]",
"aliases",
"=",
"getClientAliases",
"(",
"keyType",
",",
"i... | Attempts to find a keystore
@param keyType
@param issuers
@param socket
@return | [
"Attempts",
"to",
"find",
"a",
"keystore"
] | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/utils/AliasSensitiveX509KeyManager.java#L142-L154 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/paytrail/PaytrailServiceFactory.java | PaytrailServiceFactory.createPaytrailService | public static PaytrailService createPaytrailService() {
IOHandler ioHandler = new HttpClientIOHandler();
Marshaller marshaller = new JacksonMarshaller();
String merchantId = SystemUtils.getSettingValue("paytrail.merchantId");
String merchantSecret = SystemUtils.getSettingValue("paytrail.merchantSecret");
return new PaytrailService(ioHandler, marshaller, merchantId, merchantSecret);
} | java | public static PaytrailService createPaytrailService() {
IOHandler ioHandler = new HttpClientIOHandler();
Marshaller marshaller = new JacksonMarshaller();
String merchantId = SystemUtils.getSettingValue("paytrail.merchantId");
String merchantSecret = SystemUtils.getSettingValue("paytrail.merchantSecret");
return new PaytrailService(ioHandler, marshaller, merchantId, merchantSecret);
} | [
"public",
"static",
"PaytrailService",
"createPaytrailService",
"(",
")",
"{",
"IOHandler",
"ioHandler",
"=",
"new",
"HttpClientIOHandler",
"(",
")",
";",
"Marshaller",
"marshaller",
"=",
"new",
"JacksonMarshaller",
"(",
")",
";",
"String",
"merchantId",
"=",
"Sys... | Creates a paytrail service instance
@return created paytrail service instance | [
"Creates",
"a",
"paytrail",
"service",
"instance"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/paytrail/PaytrailServiceFactory.java#L18-L24 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/DocumentInputStreamFactory.java | DocumentInputStreamFactory.getInstance | public InputStream getInstance(DirectoryEntry directory, String name) throws IOException
{
DocumentEntry entry = (DocumentEntry) directory.getEntry(name);
InputStream stream;
if (m_encrypted)
{
stream = new EncryptedDocumentInputStream(entry, m_encryptionCode);
}
else
{
stream = new DocumentInputStream(entry);
}
return stream;
} | java | public InputStream getInstance(DirectoryEntry directory, String name) throws IOException
{
DocumentEntry entry = (DocumentEntry) directory.getEntry(name);
InputStream stream;
if (m_encrypted)
{
stream = new EncryptedDocumentInputStream(entry, m_encryptionCode);
}
else
{
stream = new DocumentInputStream(entry);
}
return stream;
} | [
"public",
"InputStream",
"getInstance",
"(",
"DirectoryEntry",
"directory",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"DocumentEntry",
"entry",
"=",
"(",
"DocumentEntry",
")",
"directory",
".",
"getEntry",
"(",
"name",
")",
";",
"InputStream",
"s... | Method used to instantiate the appropriate input stream reader,
a standard one, or one which can deal with "encrypted" data.
@param directory directory entry
@param name file name
@return new input stream
@throws IOException | [
"Method",
"used",
"to",
"instantiate",
"the",
"appropriate",
"input",
"stream",
"reader",
"a",
"standard",
"one",
"or",
"one",
"which",
"can",
"deal",
"with",
"encrypted",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/DocumentInputStreamFactory.java#L59-L73 |
pac4j/pac4j | pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java | AbstractSAML2ResponseValidator.decryptEncryptedId | protected final NameID decryptEncryptedId(final EncryptedID encryptedId, final Decrypter decrypter) throws SAMLException {
if (encryptedId == null) {
return null;
}
if (decrypter == null) {
logger.warn("Encrypted attributes returned, but no keystore was provided.");
return null;
}
try {
final NameID decryptedId = (NameID) decrypter.decrypt(encryptedId);
return decryptedId;
} catch (final DecryptionException e) {
throw new SAMLNameIdDecryptionException("Decryption of an EncryptedID failed.", e);
}
} | java | protected final NameID decryptEncryptedId(final EncryptedID encryptedId, final Decrypter decrypter) throws SAMLException {
if (encryptedId == null) {
return null;
}
if (decrypter == null) {
logger.warn("Encrypted attributes returned, but no keystore was provided.");
return null;
}
try {
final NameID decryptedId = (NameID) decrypter.decrypt(encryptedId);
return decryptedId;
} catch (final DecryptionException e) {
throw new SAMLNameIdDecryptionException("Decryption of an EncryptedID failed.", e);
}
} | [
"protected",
"final",
"NameID",
"decryptEncryptedId",
"(",
"final",
"EncryptedID",
"encryptedId",
",",
"final",
"Decrypter",
"decrypter",
")",
"throws",
"SAMLException",
"{",
"if",
"(",
"encryptedId",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"... | Decrypts an EncryptedID, using a decrypter.
@param encryptedId The EncryptedID to be decrypted.
@param decrypter The decrypter to use.
@return Decrypted ID or {@code null} if any input is {@code null}.
@throws SAMLException If the input ID cannot be decrypted. | [
"Decrypts",
"an",
"EncryptedID",
"using",
"a",
"decrypter",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/profile/impl/AbstractSAML2ResponseValidator.java#L195-L210 |
httl/httl | httl/src/main/java/httl/spi/codecs/json/JSONArray.java | JSONArray.writeJSON | public void writeJSON(JSONValue jc, JSONWriter jb, boolean writeClass)
throws IOException {
jb.arrayBegin();
for (Object item : mArray) {
if (item == null)
jb.valueNull();
else
jc.writeValue(item, jb, writeClass);
}
jb.arrayEnd();
} | java | public void writeJSON(JSONValue jc, JSONWriter jb, boolean writeClass)
throws IOException {
jb.arrayBegin();
for (Object item : mArray) {
if (item == null)
jb.valueNull();
else
jc.writeValue(item, jb, writeClass);
}
jb.arrayEnd();
} | [
"public",
"void",
"writeJSON",
"(",
"JSONValue",
"jc",
",",
"JSONWriter",
"jb",
",",
"boolean",
"writeClass",
")",
"throws",
"IOException",
"{",
"jb",
".",
"arrayBegin",
"(",
")",
";",
"for",
"(",
"Object",
"item",
":",
"mArray",
")",
"{",
"if",
"(",
"... | write json.
@param jc json converter
@param jb json builder. | [
"write",
"json",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/codecs/json/JSONArray.java#L179-L189 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.updateTags | public ApplicationGatewayInner updateTags(String resourceGroupName, String applicationGatewayName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body();
} | java | public ApplicationGatewayInner updateTags(String resourceGroupName, String applicationGatewayName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().last().body();
} | [
"public",
"ApplicationGatewayInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"applicationGatewayName",
")",
".",
"toBlocking",
"(",
")... | Updates the specified application gateway tags.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@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 ApplicationGatewayInner object if successful. | [
"Updates",
"the",
"specified",
"application",
"gateway",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L573-L575 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java | SystemViewImporter.parseValues | private List<ValueData> parseValues() throws RepositoryException
{
List<ValueData> values = new ArrayList<ValueData>(propertyInfo.getValuesSize());
List<String> stringValues = new ArrayList<String>();
for (int k = 0; k < propertyInfo.getValuesSize(); k++)
{
if (propertyInfo.getType() == PropertyType.BINARY)
{
try
{
InputStream vStream = propertyInfo.getValues().get(k).getInputStream();
TransientValueData binaryValue = new TransientValueData(k, vStream, null, valueFactory.getSpoolConfig());
// Call to spool file into tmp
binaryValue.getAsStream().close();
vStream.close();
propertyInfo.getValues().get(k).remove();
values.add(binaryValue);
}
catch (IOException e)
{
throw new RepositoryException(e);
}
}
else
{
String val = new String(propertyInfo.getValues().get(k).toString());
stringValues.add(val);
values.add(((BaseValue)valueFactory.createValue(val, propertyInfo.getType())).getInternalData());
}
}
if (propertyInfo.getType() == ExtendedPropertyType.PERMISSION)
{
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
currentNodeInfo.setExoPrivileges(stringValues);
}
else if (Constants.EXO_OWNER.equals(propertyInfo.getName()))
{
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
currentNodeInfo.setExoOwner(stringValues.get(0));
}
return values;
} | java | private List<ValueData> parseValues() throws RepositoryException
{
List<ValueData> values = new ArrayList<ValueData>(propertyInfo.getValuesSize());
List<String> stringValues = new ArrayList<String>();
for (int k = 0; k < propertyInfo.getValuesSize(); k++)
{
if (propertyInfo.getType() == PropertyType.BINARY)
{
try
{
InputStream vStream = propertyInfo.getValues().get(k).getInputStream();
TransientValueData binaryValue = new TransientValueData(k, vStream, null, valueFactory.getSpoolConfig());
// Call to spool file into tmp
binaryValue.getAsStream().close();
vStream.close();
propertyInfo.getValues().get(k).remove();
values.add(binaryValue);
}
catch (IOException e)
{
throw new RepositoryException(e);
}
}
else
{
String val = new String(propertyInfo.getValues().get(k).toString());
stringValues.add(val);
values.add(((BaseValue)valueFactory.createValue(val, propertyInfo.getType())).getInternalData());
}
}
if (propertyInfo.getType() == ExtendedPropertyType.PERMISSION)
{
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
currentNodeInfo.setExoPrivileges(stringValues);
}
else if (Constants.EXO_OWNER.equals(propertyInfo.getName()))
{
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
currentNodeInfo.setExoOwner(stringValues.get(0));
}
return values;
} | [
"private",
"List",
"<",
"ValueData",
">",
"parseValues",
"(",
")",
"throws",
"RepositoryException",
"{",
"List",
"<",
"ValueData",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"ValueData",
">",
"(",
"propertyInfo",
".",
"getValuesSize",
"(",
")",
")",
";",
... | Returns the list of ValueData for current property
@return
@throws RepositoryException | [
"Returns",
"the",
"list",
"of",
"ValueData",
"for",
"current",
"property"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java#L655-L702 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java | ImplicitObjectUtil.loadImplicitObjects | public static void loadImplicitObjects(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext,
PageFlowController currentPageFlow) {
// @todo: add an interceptor chain here for putting implicit objects into the request
loadPageFlow(request, currentPageFlow);
// @todo: need to move bundleMap creation to a BundleMapFactory
BundleMap bundleMap = new BundleMap(request, servletContext);
loadBundleMap(request, bundleMap);
} | java | public static void loadImplicitObjects(HttpServletRequest request,
HttpServletResponse response,
ServletContext servletContext,
PageFlowController currentPageFlow) {
// @todo: add an interceptor chain here for putting implicit objects into the request
loadPageFlow(request, currentPageFlow);
// @todo: need to move bundleMap creation to a BundleMapFactory
BundleMap bundleMap = new BundleMap(request, servletContext);
loadBundleMap(request, bundleMap);
} | [
"public",
"static",
"void",
"loadImplicitObjects",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"ServletContext",
"servletContext",
",",
"PageFlowController",
"currentPageFlow",
")",
"{",
"// @todo: add an interceptor chain here for putting i... | Load the NetUI framework's implicit objects into the request.
@param request the request
@param response the response
@param servletContext the servlet context
@param currentPageFlow the current page flow | [
"Load",
"the",
"NetUI",
"framework",
"s",
"implicit",
"objects",
"into",
"the",
"request",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L69-L79 |
alkacon/opencms-core | src/org/opencms/webdav/CmsWebdavServlet.java | CmsWebdavServlet.doOptions | @Override
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) {
resp.addHeader("DAV", "1,2");
StringBuffer methodsAllowed = determineMethodsAllowed(getRelativePath(req));
resp.addHeader(HEADER_ALLOW, methodsAllowed.toString());
resp.addHeader("MS-Author-Via", "DAV");
} | java | @Override
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) {
resp.addHeader("DAV", "1,2");
StringBuffer methodsAllowed = determineMethodsAllowed(getRelativePath(req));
resp.addHeader(HEADER_ALLOW, methodsAllowed.toString());
resp.addHeader("MS-Author-Via", "DAV");
} | [
"@",
"Override",
"protected",
"void",
"doOptions",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"{",
"resp",
".",
"addHeader",
"(",
"\"DAV\"",
",",
"\"1,2\"",
")",
";",
"StringBuffer",
"methodsAllowed",
"=",
"determineMethodsAllowed",
... | Process a OPTIONS WebDAV request for the specified resource.<p>
@param req the servlet request we are processing
@param resp the servlet response we are creating | [
"Process",
"a",
"OPTIONS",
"WebDAV",
"request",
"for",
"the",
"specified",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L1767-L1776 |
Falydoor/limesurvey-rc | src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java | LimesurveyRC.getSurveyLanguageProperties | public LsSurveyLanguage getSurveyLanguageProperties(int surveyId) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
List<String> localeSettings = new ArrayList<>();
localeSettings.add("surveyls_welcometext");
localeSettings.add("surveyls_endtext");
params.setSurveyLocaleSettings(localeSettings);
LsSurveyLanguage surveyLanguage = gson.fromJson(callRC(new LsApiBody("get_language_properties", params)), LsSurveyLanguage.class);
surveyLanguage.setId(surveyId);
return surveyLanguage;
} | java | public LsSurveyLanguage getSurveyLanguageProperties(int surveyId) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
List<String> localeSettings = new ArrayList<>();
localeSettings.add("surveyls_welcometext");
localeSettings.add("surveyls_endtext");
params.setSurveyLocaleSettings(localeSettings);
LsSurveyLanguage surveyLanguage = gson.fromJson(callRC(new LsApiBody("get_language_properties", params)), LsSurveyLanguage.class);
surveyLanguage.setId(surveyId);
return surveyLanguage;
} | [
"public",
"LsSurveyLanguage",
"getSurveyLanguageProperties",
"(",
"int",
"surveyId",
")",
"throws",
"LimesurveyRCException",
"{",
"LsApiBody",
".",
"LsApiParams",
"params",
"=",
"getParamsWithKey",
"(",
"surveyId",
")",
";",
"List",
"<",
"String",
">",
"localeSettings... | Gets language properties from a survey.
@param surveyId the survey id of the survey you want the properties
@return the language properties
@throws LimesurveyRCException the limesurvey rc exception | [
"Gets",
"language",
"properties",
"from",
"a",
"survey",
"."
] | train | https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L340-L350 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypeReferenceBuilder.java | JvmTypeReferenceBuilder.typeRef | public JvmTypeReference typeRef(Class<?> clazz, JvmTypeReference... typeArgs) {
JvmType type = references.findDeclaredType(clazz, context);
if (type == null) {
return createUnknownTypeReference(clazz.getName());
}
return typeRef(type, typeArgs);
} | java | public JvmTypeReference typeRef(Class<?> clazz, JvmTypeReference... typeArgs) {
JvmType type = references.findDeclaredType(clazz, context);
if (type == null) {
return createUnknownTypeReference(clazz.getName());
}
return typeRef(type, typeArgs);
} | [
"public",
"JvmTypeReference",
"typeRef",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"JvmTypeReference",
"...",
"typeArgs",
")",
"{",
"JvmType",
"type",
"=",
"references",
".",
"findDeclaredType",
"(",
"clazz",
",",
"context",
")",
";",
"if",
"(",
"type",
"... | Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments.
@param clazz
the class the type reference shall point to.
@param typeArgs
type arguments
@return the newly created {@link JvmTypeReference} | [
"Creates",
"a",
"new",
"{",
"@link",
"JvmTypeReference",
"}",
"pointing",
"to",
"the",
"given",
"class",
"and",
"containing",
"the",
"given",
"type",
"arguments",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypeReferenceBuilder.java#L64-L70 |
orbisgis/h2gis | h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/Voronoi.java | Voronoi.getOrAppendVertex | private int getOrAppendVertex(Coordinate newCoord, Quadtree ptQuad) {
Envelope queryEnv = new Envelope(newCoord);
queryEnv.expandBy(epsilon);
QuadTreeVisitor visitor = new QuadTreeVisitor(epsilon, newCoord);
try {
ptQuad.query(queryEnv, visitor);
} catch (RuntimeException ex) {
//ignore
}
if (visitor.getNearest() != null) {
return visitor.getNearest().index;
}
// Not found then
// Append to the list and QuadTree
EnvelopeWithIndex ret = new EnvelopeWithIndex(triVertex.size(), newCoord);
ptQuad.insert(queryEnv, ret);
triVertex.add(ret);
return ret.index;
} | java | private int getOrAppendVertex(Coordinate newCoord, Quadtree ptQuad) {
Envelope queryEnv = new Envelope(newCoord);
queryEnv.expandBy(epsilon);
QuadTreeVisitor visitor = new QuadTreeVisitor(epsilon, newCoord);
try {
ptQuad.query(queryEnv, visitor);
} catch (RuntimeException ex) {
//ignore
}
if (visitor.getNearest() != null) {
return visitor.getNearest().index;
}
// Not found then
// Append to the list and QuadTree
EnvelopeWithIndex ret = new EnvelopeWithIndex(triVertex.size(), newCoord);
ptQuad.insert(queryEnv, ret);
triVertex.add(ret);
return ret.index;
} | [
"private",
"int",
"getOrAppendVertex",
"(",
"Coordinate",
"newCoord",
",",
"Quadtree",
"ptQuad",
")",
"{",
"Envelope",
"queryEnv",
"=",
"new",
"Envelope",
"(",
"newCoord",
")",
";",
"queryEnv",
".",
"expandBy",
"(",
"epsilon",
")",
";",
"QuadTreeVisitor",
"vis... | Compute unique index for the coordinate
Index count from 0 to n
If the new vertex is closer than distMerge with an another vertex then it will return its index.
@return The index of the vertex | [
"Compute",
"unique",
"index",
"for",
"the",
"coordinate",
"Index",
"count",
"from",
"0",
"to",
"n",
"If",
"the",
"new",
"vertex",
"is",
"closer",
"than",
"distMerge",
"with",
"an",
"another",
"vertex",
"then",
"it",
"will",
"return",
"its",
"index",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/jts_utils/Voronoi.java#L89-L107 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/base/Preconditions.java | Preconditions.checkNotNull | @CanIgnoreReturnValue
public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
return reference;
} | java | @CanIgnoreReturnValue
public static <T> T checkNotNull(T reference, @Nullable Object errorMessage) {
if (reference == null) {
throw new NullPointerException(String.valueOf(errorMessage));
}
return reference;
} | [
"@",
"CanIgnoreReturnValue",
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",... | Ensures that an object reference passed as a parameter to the calling method is not null.
@param reference an object reference
@param errorMessage the exception message to use if the check fails; will be converted to a
string using {@link String#valueOf(Object)}
@return the non-null reference that was validated
@throws NullPointerException if {@code reference} is null | [
"Ensures",
"that",
"an",
"object",
"reference",
"passed",
"as",
"a",
"parameter",
"to",
"the",
"calling",
"method",
"is",
"not",
"null",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/base/Preconditions.java#L784-L790 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/service/RowDataResolver.java | RowDataResolver.scheduleRepairs | public static List<AsyncOneResponse> scheduleRepairs(ColumnFamily resolved, String keyspaceName, DecoratedKey key, List<ColumnFamily> versions, List<InetAddress> endpoints)
{
List<AsyncOneResponse> results = new ArrayList<AsyncOneResponse>(versions.size());
for (int i = 0; i < versions.size(); i++)
{
ColumnFamily diffCf = ColumnFamily.diff(versions.get(i), resolved);
if (diffCf == null) // no repair needs to happen
continue;
// create and send the mutation message based on the diff
Mutation mutation = new Mutation(keyspaceName, key.getKey(), diffCf);
// use a separate verb here because we don't want these to be get the white glove hint-
// on-timeout behavior that a "real" mutation gets
results.add(MessagingService.instance().sendRR(mutation.createMessage(MessagingService.Verb.READ_REPAIR),
endpoints.get(i)));
}
return results;
} | java | public static List<AsyncOneResponse> scheduleRepairs(ColumnFamily resolved, String keyspaceName, DecoratedKey key, List<ColumnFamily> versions, List<InetAddress> endpoints)
{
List<AsyncOneResponse> results = new ArrayList<AsyncOneResponse>(versions.size());
for (int i = 0; i < versions.size(); i++)
{
ColumnFamily diffCf = ColumnFamily.diff(versions.get(i), resolved);
if (diffCf == null) // no repair needs to happen
continue;
// create and send the mutation message based on the diff
Mutation mutation = new Mutation(keyspaceName, key.getKey(), diffCf);
// use a separate verb here because we don't want these to be get the white glove hint-
// on-timeout behavior that a "real" mutation gets
results.add(MessagingService.instance().sendRR(mutation.createMessage(MessagingService.Verb.READ_REPAIR),
endpoints.get(i)));
}
return results;
} | [
"public",
"static",
"List",
"<",
"AsyncOneResponse",
">",
"scheduleRepairs",
"(",
"ColumnFamily",
"resolved",
",",
"String",
"keyspaceName",
",",
"DecoratedKey",
"key",
",",
"List",
"<",
"ColumnFamily",
">",
"versions",
",",
"List",
"<",
"InetAddress",
">",
"end... | For each row version, compare with resolved (the superset of all row versions);
if it is missing anything, send a mutation to the endpoint it come from. | [
"For",
"each",
"row",
"version",
"compare",
"with",
"resolved",
"(",
"the",
"superset",
"of",
"all",
"row",
"versions",
")",
";",
"if",
"it",
"is",
"missing",
"anything",
"send",
"a",
"mutation",
"to",
"the",
"endpoint",
"it",
"come",
"from",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/service/RowDataResolver.java#L109-L128 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/EnableOnValidHandler.java | EnableOnValidHandler.init | public void init(Record record, BaseField field, String fieldName, boolean bEnableOnValid, boolean bEnableOnNew, ScreenComponent sField)
{
this.fieldName = fieldName;
m_fldTarget = field;
m_sField = sField;
m_bEnableOnValid = bEnableOnValid;
m_bEnableOnNew = bEnableOnNew;
super.init(record);
} | java | public void init(Record record, BaseField field, String fieldName, boolean bEnableOnValid, boolean bEnableOnNew, ScreenComponent sField)
{
this.fieldName = fieldName;
m_fldTarget = field;
m_sField = sField;
m_bEnableOnValid = bEnableOnValid;
m_bEnableOnNew = bEnableOnNew;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"BaseField",
"field",
",",
"String",
"fieldName",
",",
"boolean",
"bEnableOnValid",
",",
"boolean",
"bEnableOnNew",
",",
"ScreenComponent",
"sField",
")",
"{",
"this",
".",
"fieldName",
"=",
"fieldName",
... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param field Target field.
@param iFieldSeq Target field.
@param bEnbleOnValid Enable/disable the fields on valid.
@param bEnableOnNew Enable/disable the fields on new.
@param flagField If this flag is true, do the opposite enable/disable. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/EnableOnValidHandler.java#L101-L109 |
opencb/java-common-libs | commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java | FileUtils.newInputStream | public static InputStream newInputStream(Path path, OpenOption... options) throws IOException {
FileUtils.checkFile(path);
InputStream inputStream = Files.newInputStream(path, options);
if (path.toFile().getName().endsWith(".gz")) {
inputStream = new GZIPInputStream(inputStream);
}
return inputStream;
} | java | public static InputStream newInputStream(Path path, OpenOption... options) throws IOException {
FileUtils.checkFile(path);
InputStream inputStream = Files.newInputStream(path, options);
if (path.toFile().getName().endsWith(".gz")) {
inputStream = new GZIPInputStream(inputStream);
}
return inputStream;
} | [
"public",
"static",
"InputStream",
"newInputStream",
"(",
"Path",
"path",
",",
"OpenOption",
"...",
"options",
")",
"throws",
"IOException",
"{",
"FileUtils",
".",
"checkFile",
"(",
"path",
")",
";",
"InputStream",
"inputStream",
"=",
"Files",
".",
"newInputStre... | This method is able to determine whether a file is GZipped and return an {@link InputStream} in any case.
@param path the path to the file to open
@param options options specifying how the file is opened
@return a new input stream
@throws IOException if an I/O error occurs | [
"This",
"method",
"is",
"able",
"to",
"determine",
"whether",
"a",
"file",
"is",
"GZipped",
"and",
"return",
"an",
"{",
"@link",
"InputStream",
"}",
"in",
"any",
"case",
"."
] | train | https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-lib/src/main/java/org/opencb/commons/utils/FileUtils.java#L114-L121 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/storage/AbstractDataAccess.java | AbstractDataAccess.writeHeader | protected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException {
file.seek(0);
file.writeUTF("GH");
file.writeLong(length);
file.writeInt(segmentSize);
for (int i = 0; i < header.length; i++) {
file.writeInt(header[i]);
}
} | java | protected void writeHeader(RandomAccessFile file, long length, int segmentSize) throws IOException {
file.seek(0);
file.writeUTF("GH");
file.writeLong(length);
file.writeInt(segmentSize);
for (int i = 0; i < header.length; i++) {
file.writeInt(header[i]);
}
} | [
"protected",
"void",
"writeHeader",
"(",
"RandomAccessFile",
"file",
",",
"long",
"length",
",",
"int",
"segmentSize",
")",
"throws",
"IOException",
"{",
"file",
".",
"seek",
"(",
"0",
")",
";",
"file",
".",
"writeUTF",
"(",
"\"GH\"",
")",
";",
"file",
"... | Writes some internal data into the beginning of the specified file. | [
"Writes",
"some",
"internal",
"data",
"into",
"the",
"beginning",
"of",
"the",
"specified",
"file",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/AbstractDataAccess.java#L91-L99 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/AppUtil.java | AppUtil.startGalleryApp | public static void startGalleryApp(@NonNull final Context context, @NonNull final File file) {
Condition.INSTANCE.ensureNotNull(file, "The file may not be null");
Condition.INSTANCE
.ensureFileIsNoDirectory(file, "The file must exist and must not be a directory");
startGalleryApp(context, Uri.parse("file://" + file.getAbsolutePath()));
} | java | public static void startGalleryApp(@NonNull final Context context, @NonNull final File file) {
Condition.INSTANCE.ensureNotNull(file, "The file may not be null");
Condition.INSTANCE
.ensureFileIsNoDirectory(file, "The file must exist and must not be a directory");
startGalleryApp(context, Uri.parse("file://" + file.getAbsolutePath()));
} | [
"public",
"static",
"void",
"startGalleryApp",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"File",
"file",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"file",
",",
"\"The file may not be null\"",
")",
... | Starts the gallery app in order to show a specific image. If an error occurs while starting
the gallery app, an {@link ActivityNotFoundException} will be thrown.
@param context
The context, the gallery app should be started from, as an instance of the class
{@link Context}. The context may not be null
@param file
The file, which stores the image, which should be shown, as an instance of the class
{@link File}. The file may not be null. The file must exist and must not be a
directory. | [
"Starts",
"the",
"gallery",
"app",
"in",
"order",
"to",
"show",
"a",
"specific",
"image",
".",
"If",
"an",
"error",
"occurs",
"while",
"starting",
"the",
"gallery",
"app",
"an",
"{",
"@link",
"ActivityNotFoundException",
"}",
"will",
"be",
"thrown",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/AppUtil.java#L136-L141 |
airlift/slice | src/main/java/io/airlift/slice/SliceUtf8.java | SliceUtf8.rightTrim | public static Slice rightTrim(Slice utf8, int[] whiteSpaceCodePoints)
{
int position = lastNonMatchPosition(utf8, 0, whiteSpaceCodePoints);
return utf8.slice(0, position);
} | java | public static Slice rightTrim(Slice utf8, int[] whiteSpaceCodePoints)
{
int position = lastNonMatchPosition(utf8, 0, whiteSpaceCodePoints);
return utf8.slice(0, position);
} | [
"public",
"static",
"Slice",
"rightTrim",
"(",
"Slice",
"utf8",
",",
"int",
"[",
"]",
"whiteSpaceCodePoints",
")",
"{",
"int",
"position",
"=",
"lastNonMatchPosition",
"(",
"utf8",
",",
"0",
",",
"whiteSpaceCodePoints",
")",
";",
"return",
"utf8",
".",
"slic... | Removes all white {@code whiteSpaceCodePoints} from the right side of the string.
<p>
Note: Invalid UTF-8 sequences are not trimmed. | [
"Removes",
"all",
"white",
"{"
] | train | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/SliceUtf8.java#L461-L465 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java | GridBuffer.addElement | public void addElement(int iTargetPosition, Object bookmark, GridList gridList)
{
int iArrayIndex = this.bufferToArrayIndex(iTargetPosition);
if (!this.inBufferArray(iTargetPosition))
iArrayIndex = this.newBufferStartsAt(iTargetPosition, gridList); // Add code to adjust the buffer to a new location
m_aCurrentRecord[iArrayIndex] = bookmark;
if (!this.inBufferList(iTargetPosition))
m_iCurrentRecordEnd = iTargetPosition + 1; // Logical size is this large
} | java | public void addElement(int iTargetPosition, Object bookmark, GridList gridList)
{
int iArrayIndex = this.bufferToArrayIndex(iTargetPosition);
if (!this.inBufferArray(iTargetPosition))
iArrayIndex = this.newBufferStartsAt(iTargetPosition, gridList); // Add code to adjust the buffer to a new location
m_aCurrentRecord[iArrayIndex] = bookmark;
if (!this.inBufferList(iTargetPosition))
m_iCurrentRecordEnd = iTargetPosition + 1; // Logical size is this large
} | [
"public",
"void",
"addElement",
"(",
"int",
"iTargetPosition",
",",
"Object",
"bookmark",
",",
"GridList",
"gridList",
")",
"{",
"int",
"iArrayIndex",
"=",
"this",
".",
"bufferToArrayIndex",
"(",
"iTargetPosition",
")",
";",
"if",
"(",
"!",
"this",
".",
"inB... | Add this record's unique info to current buffer.
@param iTargetPosition The position to add the bookmark at.
@param bookmark The bookmark to add.
@param gridList The gridlist to update with this bookmark. | [
"Add",
"this",
"record",
"s",
"unique",
"info",
"to",
"current",
"buffer",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L63-L71 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java | ConnectionContextFactory.createConsumer | protected void createConsumer(ConsumerConnectionContext context, String messageSelector) throws JMSException {
if (context == null) {
throw new IllegalStateException("The context is null");
}
Session session = context.getSession();
if (session == null) {
throw new IllegalStateException("The context had a null session");
}
Destination dest = context.getDestination();
if (dest == null) {
throw new IllegalStateException("The context had a null destination");
}
MessageConsumer consumer = session.createConsumer(dest, messageSelector);
context.setMessageConsumer(consumer);
} | java | protected void createConsumer(ConsumerConnectionContext context, String messageSelector) throws JMSException {
if (context == null) {
throw new IllegalStateException("The context is null");
}
Session session = context.getSession();
if (session == null) {
throw new IllegalStateException("The context had a null session");
}
Destination dest = context.getDestination();
if (dest == null) {
throw new IllegalStateException("The context had a null destination");
}
MessageConsumer consumer = session.createConsumer(dest, messageSelector);
context.setMessageConsumer(consumer);
} | [
"protected",
"void",
"createConsumer",
"(",
"ConsumerConnectionContext",
"context",
",",
"String",
"messageSelector",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The context is null... | Creates a message consumer using the context's session and destination.
@param context the context where the new consumer is stored
@param messageSelector the message selector expression that the consumer will use to filter messages
@throws JMSException any error
@throws IllegalStateException if the context is null or the context's session is null
or the context's destination is null | [
"Creates",
"a",
"message",
"consumer",
"using",
"the",
"context",
"s",
"session",
"and",
"destination",
"."
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L381-L395 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/JdbcExtractor.java | JdbcExtractor.updatePrimaryKeyConfig | private void updatePrimaryKeyConfig(String srcColumnName, String tgtColumnName) {
if (this.workUnitState.contains(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY)) {
String primarykey = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY);
this.workUnitState.setProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY,
primarykey.replaceAll(srcColumnName, tgtColumnName));
}
} | java | private void updatePrimaryKeyConfig(String srcColumnName, String tgtColumnName) {
if (this.workUnitState.contains(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY)) {
String primarykey = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY);
this.workUnitState.setProp(ConfigurationKeys.EXTRACT_PRIMARY_KEY_FIELDS_KEY,
primarykey.replaceAll(srcColumnName, tgtColumnName));
}
} | [
"private",
"void",
"updatePrimaryKeyConfig",
"(",
"String",
"srcColumnName",
",",
"String",
"tgtColumnName",
")",
"{",
"if",
"(",
"this",
".",
"workUnitState",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"EXTRACT_PRIMARY_KEY_FIELDS_KEY",
")",
")",
"{",
"String",... | Update primary key column property if there is an alias defined in query
@param srcColumnName source column name
@param tgtColumnName target column name | [
"Update",
"primary",
"key",
"column",
"property",
"if",
"there",
"is",
"an",
"alias",
"defined",
"in",
"query"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/JdbcExtractor.java#L523-L529 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java | StorageUtil.resolvedTree | public static <S> StorageTree resolvedTree(S context, ExtTree<S, ResourceMeta> authStorage) {
return ResolvedExtTree.with(context, authStorage);
} | java | public static <S> StorageTree resolvedTree(S context, ExtTree<S, ResourceMeta> authStorage) {
return ResolvedExtTree.with(context, authStorage);
} | [
"public",
"static",
"<",
"S",
">",
"StorageTree",
"resolvedTree",
"(",
"S",
"context",
",",
"ExtTree",
"<",
"S",
",",
"ResourceMeta",
">",
"authStorage",
")",
"{",
"return",
"ResolvedExtTree",
".",
"with",
"(",
"context",
",",
"authStorage",
")",
";",
"}"
... | Create a StorageTree using authorization context and authorizing tree
@param context auth context
@param authStorage authorizing storage tree
@param <S> context type
@return StorageTree for the authorization context | [
"Create",
"a",
"StorageTree",
"using",
"authorization",
"context",
"and",
"authorizing",
"tree"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageUtil.java#L184-L186 |
jenkinsci/jenkins | core/src/main/java/jenkins/mvn/SettingsProvider.java | SettingsProvider.getSettingsFilePath | public static FilePath getSettingsFilePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath settingsPath = null;
if (settings != null) {
settingsPath = settings.supplySettings(build, listener);
}
return settingsPath;
} | java | public static FilePath getSettingsFilePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath settingsPath = null;
if (settings != null) {
settingsPath = settings.supplySettings(build, listener);
}
return settingsPath;
} | [
"public",
"static",
"FilePath",
"getSettingsFilePath",
"(",
"SettingsProvider",
"settings",
",",
"AbstractBuild",
"<",
"?",
",",
"?",
">",
"build",
",",
"TaskListener",
"listener",
")",
"{",
"FilePath",
"settingsPath",
"=",
"null",
";",
"if",
"(",
"settings",
... | Convenience method handling all <code>null</code> checks. Provides the path on the (possible) remote settings file.
@param settings
the provider to be used
@param build
the active build
@param listener
the listener of the current build
@return the path to the settings.xml | [
"Convenience",
"method",
"handling",
"all",
"<code",
">",
"null<",
"/",
"code",
">",
"checks",
".",
"Provides",
"the",
"path",
"on",
"the",
"(",
"possible",
")",
"remote",
"settings",
"file",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/mvn/SettingsProvider.java#L50-L56 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/ConfigImpl.java | ConfigImpl.setTempDirectory | protected void setTempDirectory(Resource tempDirectory, boolean flush) throws ExpressionException {
if (!isDirectory(tempDirectory) || !tempDirectory.isWriteable()) {
SystemOut.printDate(getErrWriter(),
"temp directory [" + tempDirectory + "] is not writable or can not be created, using directory [" + SystemUtil.getTempDirectory() + "] instead");
tempDirectory = SystemUtil.getTempDirectory();
if (!tempDirectory.isWriteable()) {
SystemOut.printDate(getErrWriter(), "temp directory [" + tempDirectory + "] is not writable");
}
}
if (flush) ResourceUtil.removeChildrenEL(tempDirectory);// start with a empty temp directory
this.tempDirectory = tempDirectory;
} | java | protected void setTempDirectory(Resource tempDirectory, boolean flush) throws ExpressionException {
if (!isDirectory(tempDirectory) || !tempDirectory.isWriteable()) {
SystemOut.printDate(getErrWriter(),
"temp directory [" + tempDirectory + "] is not writable or can not be created, using directory [" + SystemUtil.getTempDirectory() + "] instead");
tempDirectory = SystemUtil.getTempDirectory();
if (!tempDirectory.isWriteable()) {
SystemOut.printDate(getErrWriter(), "temp directory [" + tempDirectory + "] is not writable");
}
}
if (flush) ResourceUtil.removeChildrenEL(tempDirectory);// start with a empty temp directory
this.tempDirectory = tempDirectory;
} | [
"protected",
"void",
"setTempDirectory",
"(",
"Resource",
"tempDirectory",
",",
"boolean",
"flush",
")",
"throws",
"ExpressionException",
"{",
"if",
"(",
"!",
"isDirectory",
"(",
"tempDirectory",
")",
"||",
"!",
"tempDirectory",
".",
"isWriteable",
"(",
")",
")"... | sets the temp directory
@param tempDirectory temp directory
@throws ExpressionException | [
"sets",
"the",
"temp",
"directory"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1634-L1645 |
michel-kraemer/bson4jackson | src/main/java/de/undercouch/bson4jackson/BsonParser.java | BsonParser.handleBinary | protected JsonToken handleBinary() throws IOException {
int size = _in.readInt();
byte subtype = _in.readByte();
Context ctx = getContext();
switch (subtype) {
case BsonConstants.SUBTYPE_BINARY_OLD:
int size2 = _in.readInt();
byte[] buf2 = new byte[size2];
_in.readFully(buf2);
ctx.value = buf2;
break;
case BsonConstants.SUBTYPE_UUID:
long l1 = _in.readLong();
long l2 = _in.readLong();
ctx.value = new UUID(l1, l2);
break;
default:
byte[] buf = new byte[size];
_in.readFully(buf);
ctx.value = buf;
break;
}
return JsonToken.VALUE_EMBEDDED_OBJECT;
} | java | protected JsonToken handleBinary() throws IOException {
int size = _in.readInt();
byte subtype = _in.readByte();
Context ctx = getContext();
switch (subtype) {
case BsonConstants.SUBTYPE_BINARY_OLD:
int size2 = _in.readInt();
byte[] buf2 = new byte[size2];
_in.readFully(buf2);
ctx.value = buf2;
break;
case BsonConstants.SUBTYPE_UUID:
long l1 = _in.readLong();
long l2 = _in.readLong();
ctx.value = new UUID(l1, l2);
break;
default:
byte[] buf = new byte[size];
_in.readFully(buf);
ctx.value = buf;
break;
}
return JsonToken.VALUE_EMBEDDED_OBJECT;
} | [
"protected",
"JsonToken",
"handleBinary",
"(",
")",
"throws",
"IOException",
"{",
"int",
"size",
"=",
"_in",
".",
"readInt",
"(",
")",
";",
"byte",
"subtype",
"=",
"_in",
".",
"readByte",
"(",
")",
";",
"Context",
"ctx",
"=",
"getContext",
"(",
")",
";... | Reads binary data from the input stream
@return the json token read
@throws IOException if an I/O error occurs | [
"Reads",
"binary",
"data",
"from",
"the",
"input",
"stream"
] | train | https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonParser.java#L445-L471 |
duracloud/duracloud | synctool/src/main/java/org/duracloud/sync/config/SyncToolConfigParser.java | SyncToolConfigParser.retrievePrevConfig | public SyncToolConfig retrievePrevConfig(File backupDir) {
File prevConfigBackupFile =
new File(backupDir, PREV_BACKUP_FILE_NAME);
if (prevConfigBackupFile.exists()) {
String[] prevConfigArgs = retrieveConfig(prevConfigBackupFile);
try {
return processStandardOptions(prevConfigArgs, false);
} catch (ParseException e) {
return null;
}
} else {
return null;
}
} | java | public SyncToolConfig retrievePrevConfig(File backupDir) {
File prevConfigBackupFile =
new File(backupDir, PREV_BACKUP_FILE_NAME);
if (prevConfigBackupFile.exists()) {
String[] prevConfigArgs = retrieveConfig(prevConfigBackupFile);
try {
return processStandardOptions(prevConfigArgs, false);
} catch (ParseException e) {
return null;
}
} else {
return null;
}
} | [
"public",
"SyncToolConfig",
"retrievePrevConfig",
"(",
"File",
"backupDir",
")",
"{",
"File",
"prevConfigBackupFile",
"=",
"new",
"File",
"(",
"backupDir",
",",
"PREV_BACKUP_FILE_NAME",
")",
";",
"if",
"(",
"prevConfigBackupFile",
".",
"exists",
"(",
")",
")",
"... | Retrieves the configuration of the previous run of the Sync Tool.
If there was no previous run, the backup file cannot be found, or
the backup file cannot be read, returns null, otherwise returns the
parsed configuration
@param backupDir the current backup directory
@return config for previous sync tool run, or null | [
"Retrieves",
"the",
"configuration",
"of",
"the",
"previous",
"run",
"of",
"the",
"Sync",
"Tool",
".",
"If",
"there",
"was",
"no",
"previous",
"run",
"the",
"backup",
"file",
"cannot",
"be",
"found",
"or",
"the",
"backup",
"file",
"cannot",
"be",
"read",
... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/synctool/src/main/java/org/duracloud/sync/config/SyncToolConfigParser.java#L547-L560 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchIndex.java | CmsSearchIndex.getResource | protected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc, CmsResourceFilter filter) {
try {
CmsObject clone = OpenCms.initCmsObject(cms);
clone.getRequestContext().setSiteRoot("");
return clone.readResource(doc.getPath(), filter);
} catch (CmsException e) {
// Do nothing
}
return null;
} | java | protected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc, CmsResourceFilter filter) {
try {
CmsObject clone = OpenCms.initCmsObject(cms);
clone.getRequestContext().setSiteRoot("");
return clone.readResource(doc.getPath(), filter);
} catch (CmsException e) {
// Do nothing
}
return null;
} | [
"protected",
"CmsResource",
"getResource",
"(",
"CmsObject",
"cms",
",",
"I_CmsSearchDocument",
"doc",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"try",
"{",
"CmsObject",
"clone",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"cms",
")",
";",
"clone",
".",
"ge... | Checks if the OpenCms resource referenced by the result document can be read
by the user of the given OpenCms context.
Returns the referenced <code>CmsResource</code> or <code>null</code> if
the user is not permitted to read the resource.<p>
@param cms the OpenCms user context to use for permission testing
@param doc the search result document to check
@param filter the resource filter to apply
@return the referenced <code>CmsResource</code> or <code>null</code> if the user is not permitted | [
"Checks",
"if",
"the",
"OpenCms",
"resource",
"referenced",
"by",
"the",
"result",
"document",
"can",
"be",
"read",
"by",
"the",
"user",
"of",
"the",
"given",
"OpenCms",
"context",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1724-L1735 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java | FontUtils.drawCenter | public static void drawCenter(Font font, String s, int x, int y, int width) {
drawString(font, s, Alignment.CENTER, x, y, width, Color.white);
} | java | public static void drawCenter(Font font, String s, int x, int y, int width) {
drawString(font, s, Alignment.CENTER, x, y, width, Color.white);
} | [
"public",
"static",
"void",
"drawCenter",
"(",
"Font",
"font",
",",
"String",
"s",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
")",
"{",
"drawString",
"(",
"font",
",",
"s",
",",
"Alignment",
".",
"CENTER",
",",
"x",
",",
"y",
",",
"wi... | Draw text center justified
@param font The font to draw with
@param s The string to draw
@param x The x location to draw at
@param y The y location to draw at
@param width The width to fill with the text | [
"Draw",
"text",
"center",
"justified"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L51-L53 |
plume-lib/options | src/main/java/org/plumelib/options/Options.java | Options.getEnumValue | private <T extends Enum<T>> T getEnumValue(Class<T> enumType, String name) {
T[] constants = enumType.getEnumConstants();
if (constants == null) {
throw new IllegalArgumentException(enumType.getName() + " is not an enum type");
}
for (T constant : constants) {
if (constant.name().equalsIgnoreCase(name.replace('-', '_'))) {
return constant;
}
}
// same error that's thrown by Enum.valueOf()
throw new IllegalArgumentException(
"No enum constant " + enumType.getCanonicalName() + "." + name);
} | java | private <T extends Enum<T>> T getEnumValue(Class<T> enumType, String name) {
T[] constants = enumType.getEnumConstants();
if (constants == null) {
throw new IllegalArgumentException(enumType.getName() + " is not an enum type");
}
for (T constant : constants) {
if (constant.name().equalsIgnoreCase(name.replace('-', '_'))) {
return constant;
}
}
// same error that's thrown by Enum.valueOf()
throw new IllegalArgumentException(
"No enum constant " + enumType.getCanonicalName() + "." + name);
} | [
"private",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnumValue",
"(",
"Class",
"<",
"T",
">",
"enumType",
",",
"String",
"name",
")",
"{",
"T",
"[",
"]",
"constants",
"=",
"enumType",
".",
"getEnumConstants",
"(",
")",
";",
"if",
"(... | Behaves like {@link java.lang.Enum#valueOf}, except that {@code name} is case-insensitive and
hyphen-insensitive (hyphens can be used in place of underscores). This allows for greater
flexibility when specifying enum types as command-line arguments.
@param <T> the enum type whose constant is to be returned
@param enumType the Class object of the enum type from which to return a constant
@param name the name of the constant to return
@return the enum constant of the specified enum type with the specified name | [
"Behaves",
"like",
"{",
"@link",
"java",
".",
"lang",
".",
"Enum#valueOf",
"}",
"except",
"that",
"{",
"@code",
"name",
"}",
"is",
"case",
"-",
"insensitive",
"and",
"hyphen",
"-",
"insensitive",
"(",
"hyphens",
"can",
"be",
"used",
"in",
"place",
"of",
... | train | https://github.com/plume-lib/options/blob/1bdd0ac7a1794bdf9dd373e279f69d43395154f0/src/main/java/org/plumelib/options/Options.java#L1460-L1473 |
minio/minio-java | api/src/main/java/io/minio/Signer.java | Signer.signV4 | public static Request signV4(Request request, String region, String accessKey, String secretKey)
throws NoSuchAlgorithmException, InvalidKeyException {
String contentSha256 = request.header("x-amz-content-sha256");
DateTime date = DateFormat.AMZ_DATE_FORMAT.parseDateTime(request.header("x-amz-date"));
Signer signer = new Signer(request, contentSha256, date, region, accessKey, secretKey, null);
signer.setScope();
signer.setCanonicalRequest();
signer.setStringToSign();
signer.setSigningKey();
signer.setSignature();
signer.setAuthorization();
return request.newBuilder().header("Authorization", signer.authorization).build();
} | java | public static Request signV4(Request request, String region, String accessKey, String secretKey)
throws NoSuchAlgorithmException, InvalidKeyException {
String contentSha256 = request.header("x-amz-content-sha256");
DateTime date = DateFormat.AMZ_DATE_FORMAT.parseDateTime(request.header("x-amz-date"));
Signer signer = new Signer(request, contentSha256, date, region, accessKey, secretKey, null);
signer.setScope();
signer.setCanonicalRequest();
signer.setStringToSign();
signer.setSigningKey();
signer.setSignature();
signer.setAuthorization();
return request.newBuilder().header("Authorization", signer.authorization).build();
} | [
"public",
"static",
"Request",
"signV4",
"(",
"Request",
"request",
",",
"String",
"region",
",",
"String",
"accessKey",
",",
"String",
"secretKey",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"String",
"contentSha256",
"=",
"request"... | Returns signed request object for given request, region, access key and secret key. | [
"Returns",
"signed",
"request",
"object",
"for",
"given",
"request",
"region",
"access",
"key",
"and",
"secret",
"key",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/Signer.java#L276-L290 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java | CollectionLiteralsTypeComputer.handleCollectionTypeNotAvailable | protected void handleCollectionTypeNotAvailable(XCollectionLiteral literal, ITypeComputationState state, Class<?> clazz) {
for(XExpression element: literal.getElements()) {
state.withNonVoidExpectation().computeTypes(element);
}
state.acceptActualType(state.getReferenceOwner().newUnknownTypeReference(clazz.getName()));
} | java | protected void handleCollectionTypeNotAvailable(XCollectionLiteral literal, ITypeComputationState state, Class<?> clazz) {
for(XExpression element: literal.getElements()) {
state.withNonVoidExpectation().computeTypes(element);
}
state.acceptActualType(state.getReferenceOwner().newUnknownTypeReference(clazz.getName()));
} | [
"protected",
"void",
"handleCollectionTypeNotAvailable",
"(",
"XCollectionLiteral",
"literal",
",",
"ITypeComputationState",
"state",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"for",
"(",
"XExpression",
"element",
":",
"literal",
".",
"getElements",
"(",
")"... | Process all children and assign an unknown type to the literal. | [
"Process",
"all",
"children",
"and",
"assign",
"an",
"unknown",
"type",
"to",
"the",
"literal",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L208-L213 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/data/UserMessage.java | UserMessage.create | public static UserMessage create (Name speaker, String message)
{
return new UserMessage(speaker, null, message, ChatCodes.DEFAULT_MODE);
} | java | public static UserMessage create (Name speaker, String message)
{
return new UserMessage(speaker, null, message, ChatCodes.DEFAULT_MODE);
} | [
"public",
"static",
"UserMessage",
"create",
"(",
"Name",
"speaker",
",",
"String",
"message",
")",
"{",
"return",
"new",
"UserMessage",
"(",
"speaker",
",",
"null",
",",
"message",
",",
"ChatCodes",
".",
"DEFAULT_MODE",
")",
";",
"}"
] | Constructs a user message for a player originated tell (which has no bundle and is in the
default mode). | [
"Constructs",
"a",
"user",
"message",
"for",
"a",
"player",
"originated",
"tell",
"(",
"which",
"has",
"no",
"bundle",
"and",
"is",
"in",
"the",
"default",
"mode",
")",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/data/UserMessage.java#L41-L44 |
phax/ph-web | ph-http/src/main/java/com/helger/http/CacheControlBuilder.java | CacheControlBuilder.setSharedMaxAge | @Nonnull
public CacheControlBuilder setSharedMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
{
return setSharedMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
} | java | @Nonnull
public CacheControlBuilder setSharedMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
{
return setSharedMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
} | [
"@",
"Nonnull",
"public",
"CacheControlBuilder",
"setSharedMaxAge",
"(",
"@",
"Nonnull",
"final",
"TimeUnit",
"eTimeUnit",
",",
"final",
"long",
"nDuration",
")",
"{",
"return",
"setSharedMaxAgeSeconds",
"(",
"eTimeUnit",
".",
"toSeconds",
"(",
"nDuration",
")",
"... | Set the maximum age for shared caches relative to the request time. Similar
to max-age, except that it only applies to shared (e.g., proxy) caches.
@param eTimeUnit
{@link TimeUnit} to use
@param nDuration
The duration in the passed unit
@return this | [
"Set",
"the",
"maximum",
"age",
"for",
"shared",
"caches",
"relative",
"to",
"the",
"request",
"time",
".",
"Similar",
"to",
"max",
"-",
"age",
"except",
"that",
"it",
"only",
"applies",
"to",
"shared",
"(",
"e",
".",
"g",
".",
"proxy",
")",
"caches",
... | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/CacheControlBuilder.java#L178-L182 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java | XsdAsmAttributes.generateAttribute | static void generateAttribute(XsdAttribute attribute, String apiName){
String camelAttributeName = getAttributeName(attribute);
XsdList list = getAttributeList(attribute);
String javaType = list != null ? JAVA_LIST_DESC : getFullJavaType(attribute);
boolean hasEnum = attributeHasEnum(attribute);
if (hasEnum){
getAttributeRestrictions(attribute)
.stream()
.filter(restriction -> restriction.getEnumeration() != null)
.forEach(restriction -> createEnum(attribute, restriction.getEnumeration(), apiName));
}
if (attributeHasRestrictions(attribute)){
ClassWriter attributeWriter = generateClass(camelAttributeName, JAVA_OBJECT, null, null, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, apiName);
MethodVisitor mVisitor = attributeWriter.visitMethod(ACC_PRIVATE, CONSTRUCTOR, "()V", null, null);
mVisitor.visitCode();
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKESPECIAL, JAVA_OBJECT, CONSTRUCTOR, "()V", false);
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(1, 1);
mVisitor.visitEnd();
if (hasEnum){
String enumTypeDesc = getFullClassTypeNameDesc(getEnumName(attribute), apiName);
mVisitor = attributeWriter.visitMethod(ACC_PUBLIC + ACC_STATIC, "validateRestrictions", "(" + enumTypeDesc + ")V", null, null);
} else {
String signature = list != null ? "(L" + JAVA_LIST + "<" + getFullJavaType(list.getItemType()) + ">;)V" : null;
mVisitor = attributeWriter.visitMethod(ACC_PUBLIC + ACC_STATIC, "validateRestrictions", "(" + javaType + ")V", signature, null);
}
mVisitor.visitCode();
if (hasEnum){
String enumName = getEnumName(attribute);
String enumType = getFullClassTypeName(enumName, apiName);
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKEVIRTUAL, enumType, "getValue", "()" + getEnumContainingType(attribute), false);
mVisitor.visitVarInsn(ASTORE, 1);
}
loadRestrictionsToAttribute(attribute, mVisitor, javaType, hasEnum);
writeClassToFile(camelAttributeName, attributeWriter, apiName);
}
} | java | static void generateAttribute(XsdAttribute attribute, String apiName){
String camelAttributeName = getAttributeName(attribute);
XsdList list = getAttributeList(attribute);
String javaType = list != null ? JAVA_LIST_DESC : getFullJavaType(attribute);
boolean hasEnum = attributeHasEnum(attribute);
if (hasEnum){
getAttributeRestrictions(attribute)
.stream()
.filter(restriction -> restriction.getEnumeration() != null)
.forEach(restriction -> createEnum(attribute, restriction.getEnumeration(), apiName));
}
if (attributeHasRestrictions(attribute)){
ClassWriter attributeWriter = generateClass(camelAttributeName, JAVA_OBJECT, null, null, ACC_PUBLIC + ACC_FINAL + ACC_SUPER, apiName);
MethodVisitor mVisitor = attributeWriter.visitMethod(ACC_PRIVATE, CONSTRUCTOR, "()V", null, null);
mVisitor.visitCode();
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKESPECIAL, JAVA_OBJECT, CONSTRUCTOR, "()V", false);
mVisitor.visitInsn(RETURN);
mVisitor.visitMaxs(1, 1);
mVisitor.visitEnd();
if (hasEnum){
String enumTypeDesc = getFullClassTypeNameDesc(getEnumName(attribute), apiName);
mVisitor = attributeWriter.visitMethod(ACC_PUBLIC + ACC_STATIC, "validateRestrictions", "(" + enumTypeDesc + ")V", null, null);
} else {
String signature = list != null ? "(L" + JAVA_LIST + "<" + getFullJavaType(list.getItemType()) + ">;)V" : null;
mVisitor = attributeWriter.visitMethod(ACC_PUBLIC + ACC_STATIC, "validateRestrictions", "(" + javaType + ")V", signature, null);
}
mVisitor.visitCode();
if (hasEnum){
String enumName = getEnumName(attribute);
String enumType = getFullClassTypeName(enumName, apiName);
mVisitor.visitVarInsn(ALOAD, 0);
mVisitor.visitMethodInsn(INVOKEVIRTUAL, enumType, "getValue", "()" + getEnumContainingType(attribute), false);
mVisitor.visitVarInsn(ASTORE, 1);
}
loadRestrictionsToAttribute(attribute, mVisitor, javaType, hasEnum);
writeClassToFile(camelAttributeName, attributeWriter, apiName);
}
} | [
"static",
"void",
"generateAttribute",
"(",
"XsdAttribute",
"attribute",
",",
"String",
"apiName",
")",
"{",
"String",
"camelAttributeName",
"=",
"getAttributeName",
"(",
"attribute",
")",
";",
"XsdList",
"list",
"=",
"getAttributeList",
"(",
"attribute",
")",
";"... | Creates a class which represents a {@link XsdAttribute} object.
@param attribute The {@link XsdAttribute} type that contains the required information.
@param apiName The name of the generated fluent interface. | [
"Creates",
"a",
"class",
"which",
"represents",
"a",
"{"
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmAttributes.java#L125-L175 |
toddfast/typeconverter | src/main/java/com/toddfast/util/convert/TypeConverter.java | TypeConverter.asFloat | public static float asFloat(Object value, float nullValue) {
value=convert(Float.class,value);
if (value!=null) {
return ((Float)value).floatValue();
}
else {
return nullValue;
}
} | java | public static float asFloat(Object value, float nullValue) {
value=convert(Float.class,value);
if (value!=null) {
return ((Float)value).floatValue();
}
else {
return nullValue;
}
} | [
"public",
"static",
"float",
"asFloat",
"(",
"Object",
"value",
",",
"float",
"nullValue",
")",
"{",
"value",
"=",
"convert",
"(",
"Float",
".",
"class",
",",
"value",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"(",
"(",
"Float",... | Return the value converted to a float
or the specified alternate value if the original value is null. Note,
this method still throws {@link IllegalArgumentException} if the value
is not null and could not be converted.
@param value
The value to be converted
@param nullValue
The value to be returned if {@link value} is null. Note, this
value will not be returned if the conversion fails otherwise.
@throws IllegalArgumentException
If the value cannot be converted | [
"Return",
"the",
"value",
"converted",
"to",
"a",
"float",
"or",
"the",
"specified",
"alternate",
"value",
"if",
"the",
"original",
"value",
"is",
"null",
".",
"Note",
"this",
"method",
"still",
"throws",
"{",
"@link",
"IllegalArgumentException",
"}",
"if",
... | train | https://github.com/toddfast/typeconverter/blob/44efa352254faa49edaba5c5935389705aa12b90/src/main/java/com/toddfast/util/convert/TypeConverter.java#L597-L605 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.setParameterValues | protected void setParameterValues(final PreparedStatement ps, final int index, final Object param) throws SQLException {
if (param instanceof byte[]) {
ps.setBytes(index, (byte[]) param);
} else {
ps.setObject(index, param);
}
}
} | java | protected void setParameterValues(final PreparedStatement ps, final int index, final Object param) throws SQLException {
if (param instanceof byte[]) {
ps.setBytes(index, (byte[]) param);
} else {
ps.setObject(index, param);
}
}
} | [
"protected",
"void",
"setParameterValues",
"(",
"final",
"PreparedStatement",
"ps",
",",
"final",
"int",
"index",
",",
"final",
"Object",
"param",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"param",
"instanceof",
"byte",
"[",
"]",
")",
"{",
"ps",
".",
... | Sets the value of a parameter in {@code index} to the value provided in {@code param}.
@param ps The {@link PreparedStatement} to insert the association between index and the param.
@param index The index to set the value to.
@param param The value to be set at the provided index.
@throws SQLException If something goes wrong accessing the database. | [
"Sets",
"the",
"value",
"of",
"a",
"parameter",
"in",
"{",
"@code",
"index",
"}",
"to",
"the",
"value",
"provided",
"in",
"{",
"@code",
"param",
"}",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1953-L1960 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/xmlrpc/XmlRpcDataMarshaller.java | XmlRpcDataMarshaller.checkErrors | private static void checkErrors(Object object) throws GreenPepperServerException
{
if (object instanceof Exception)
{
throw new GreenPepperServerException(GreenPepperServerErrorKey.CALL_FAILED, ((Exception)object).getMessage());
}
if (object instanceof String)
{
String msg = (String)object;
if (!StringUtils.isEmpty(msg) && msg.contains(GreenPepperServerErrorKey.ERROR))
{
String errorId = msg.replace(GreenPepperServerErrorKey.ERROR, "");
throw new GreenPepperServerException(errorId, errorId);
}
}
} | java | private static void checkErrors(Object object) throws GreenPepperServerException
{
if (object instanceof Exception)
{
throw new GreenPepperServerException(GreenPepperServerErrorKey.CALL_FAILED, ((Exception)object).getMessage());
}
if (object instanceof String)
{
String msg = (String)object;
if (!StringUtils.isEmpty(msg) && msg.contains(GreenPepperServerErrorKey.ERROR))
{
String errorId = msg.replace(GreenPepperServerErrorKey.ERROR, "");
throw new GreenPepperServerException(errorId, errorId);
}
}
} | [
"private",
"static",
"void",
"checkErrors",
"(",
"Object",
"object",
")",
"throws",
"GreenPepperServerException",
"{",
"if",
"(",
"object",
"instanceof",
"Exception",
")",
"{",
"throw",
"new",
"GreenPepperServerException",
"(",
"GreenPepperServerErrorKey",
".",
"CALL_... | Checks if the message is an GreenPepper server tagged Exception.
If so an GreenPepperServerException will be thrown with the error id found.
</p>
@param object the error id found. | [
"Checks",
"if",
"the",
"message",
"is",
"an",
"GreenPepper",
"server",
"tagged",
"Exception",
".",
"If",
"so",
"an",
"GreenPepperServerException",
"will",
"be",
"thrown",
"with",
"the",
"error",
"id",
"found",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/xmlrpc/XmlRpcDataMarshaller.java#L829-L846 |
davidmarquis/fluent-interface-proxy | src/main/java/com/fluentinterface/beans/ObjectWrapper.java | ObjectWrapper.setIndexedValue | public void setIndexedValue(Property property, int index, Object value) {
setIndexedValue(object, property, index, value, this);
} | java | public void setIndexedValue(Property property, int index, Object value) {
setIndexedValue(object, property, index, value, this);
} | [
"public",
"void",
"setIndexedValue",
"(",
"Property",
"property",
",",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"setIndexedValue",
"(",
"object",
",",
"property",
",",
"index",
",",
"value",
",",
"this",
")",
";",
"}"
] | Sets the value of the specified indexed property in the wrapped object.
@param property the indexed property whose value is to be updated, cannot be {@code null}
@param index the index position of the property value to be set
@param value the indexed value to set, can be {@code null}
@throws ReflectionException if a reflection error occurs
@throws IllegalArgumentException if the property parameter is {@code null}
@throws IllegalArgumentException if the indexed object in the wrapped object is not a {@link List} or {@code array} type
@throws IndexOutOfBoundsException if the indexed object in the wrapped object is out of bounds with the given index and autogrowing is disabled
@throws NullPointerException if the indexed object in the wrapped object is {@code null}
@throws NullPointerException if the indexed object in the wrapped object is out of bounds with the given index, but autogrowing (if enabled) is unable to fill the blank positions with {@code null} | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"indexed",
"property",
"in",
"the",
"wrapped",
"object",
"."
] | train | https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L360-L362 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java | RuntimeModelIo.loadInstances | public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) {
InstancesLoadResult result = new InstancesLoadResult();
INST: {
if( ! instancesFile.exists()) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP );
error.setDetails( expected( instancesFile.getAbsolutePath()));
result.loadErrors.add( error );
break INST;
}
FromInstanceDefinition fromDef = new FromInstanceDefinition( rootDirectory );
Collection<Instance> instances = fromDef.buildInstances( graph, instancesFile );
result.getParsedFiles().addAll( fromDef.getProcessedImports());
if( ! fromDef.getErrors().isEmpty()) {
result.loadErrors.addAll( fromDef.getErrors());
break INST;
}
Collection<ModelError> errors = RuntimeModelValidator.validate( instances );
result.loadErrors.addAll( errors );
result.objectToSource.putAll( fromDef.getObjectToSource());
result.getRootInstances().addAll( instances );
}
for( Instance rootInstance : result.rootInstances )
rootInstance.data.put( Instance.APPLICATION_NAME, applicationName );
return result;
} | java | public static InstancesLoadResult loadInstances( File instancesFile, File rootDirectory, Graphs graph, String applicationName ) {
InstancesLoadResult result = new InstancesLoadResult();
INST: {
if( ! instancesFile.exists()) {
RoboconfError error = new RoboconfError( ErrorCode.PROJ_MISSING_INSTANCE_EP );
error.setDetails( expected( instancesFile.getAbsolutePath()));
result.loadErrors.add( error );
break INST;
}
FromInstanceDefinition fromDef = new FromInstanceDefinition( rootDirectory );
Collection<Instance> instances = fromDef.buildInstances( graph, instancesFile );
result.getParsedFiles().addAll( fromDef.getProcessedImports());
if( ! fromDef.getErrors().isEmpty()) {
result.loadErrors.addAll( fromDef.getErrors());
break INST;
}
Collection<ModelError> errors = RuntimeModelValidator.validate( instances );
result.loadErrors.addAll( errors );
result.objectToSource.putAll( fromDef.getObjectToSource());
result.getRootInstances().addAll( instances );
}
for( Instance rootInstance : result.rootInstances )
rootInstance.data.put( Instance.APPLICATION_NAME, applicationName );
return result;
} | [
"public",
"static",
"InstancesLoadResult",
"loadInstances",
"(",
"File",
"instancesFile",
",",
"File",
"rootDirectory",
",",
"Graphs",
"graph",
",",
"String",
"applicationName",
")",
"{",
"InstancesLoadResult",
"result",
"=",
"new",
"InstancesLoadResult",
"(",
")",
... | Loads instances from a file.
@param instancesFile the file definition of the instances (can have imports)
@param rootDirectory the root directory that contains instance definitions, used to resolve imports
@param graph the graph to use to resolve instances
@param applicationName the application name
@return a non-null result | [
"Loads",
"instances",
"from",
"a",
"file",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/RuntimeModelIo.java#L446-L475 |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java | ByteBufferUtils.arrayCopy | public static void arrayCopy(ByteBuffer src, int srcPos, ByteBuffer dst, int dstPos, int length)
{
if (src.hasArray() && dst.hasArray())
{
System.arraycopy(src.array(),
src.arrayOffset() + srcPos,
dst.array(),
dst.arrayOffset() + dstPos,
length);
}
else
{
if (src.limit() - srcPos < length || dst.limit() - dstPos < length)
throw new IndexOutOfBoundsException();
for (int i = 0; i < length; i++)
// TODO: ByteBuffer.put is polymorphic, and might be slow here
dst.put(dstPos++, src.get(srcPos++));
}
} | java | public static void arrayCopy(ByteBuffer src, int srcPos, ByteBuffer dst, int dstPos, int length)
{
if (src.hasArray() && dst.hasArray())
{
System.arraycopy(src.array(),
src.arrayOffset() + srcPos,
dst.array(),
dst.arrayOffset() + dstPos,
length);
}
else
{
if (src.limit() - srcPos < length || dst.limit() - dstPos < length)
throw new IndexOutOfBoundsException();
for (int i = 0; i < length; i++)
// TODO: ByteBuffer.put is polymorphic, and might be slow here
dst.put(dstPos++, src.get(srcPos++));
}
} | [
"public",
"static",
"void",
"arrayCopy",
"(",
"ByteBuffer",
"src",
",",
"int",
"srcPos",
",",
"ByteBuffer",
"dst",
",",
"int",
"dstPos",
",",
"int",
"length",
")",
"{",
"if",
"(",
"src",
".",
"hasArray",
"(",
")",
"&&",
"dst",
".",
"hasArray",
"(",
"... | Transfer bytes from one ByteBuffer to another.
This function acts as System.arrayCopy() but for ByteBuffers.
@param src the source ByteBuffer
@param srcPos starting position in the source ByteBuffer
@param dst the destination ByteBuffer
@param dstPos starting position in the destination ByteBuffer
@param length the number of bytes to copy | [
"Transfer",
"bytes",
"from",
"one",
"ByteBuffer",
"to",
"another",
".",
"This",
"function",
"acts",
"as",
"System",
".",
"arrayCopy",
"()",
"but",
"for",
"ByteBuffers",
"."
] | train | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java#L195-L214 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.smoothQuadTo | public SVGPath smoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO).append(x).append(y);
} | java | public SVGPath smoothQuadTo(double x, double y) {
return append(PATH_SMOOTH_QUAD_TO).append(x).append(y);
} | [
"public",
"SVGPath",
"smoothQuadTo",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_SMOOTH_QUAD_TO",
")",
".",
"append",
"(",
"x",
")",
".",
"append",
"(",
"y",
")",
";",
"}"
] | Smooth quadratic Bezier line to the given coordinates.
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Smooth",
"quadratic",
"Bezier",
"line",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L503-L505 |
axibase/atsd-api-java | src/main/java/com/axibase/tsd/model/data/series/Sample.java | Sample.ofIsoText | public static Sample ofIsoText(String isoDate, String textValue) {
return new Sample(null, isoDate, null, textValue);
} | java | public static Sample ofIsoText(String isoDate, String textValue) {
return new Sample(null, isoDate, null, textValue);
} | [
"public",
"static",
"Sample",
"ofIsoText",
"(",
"String",
"isoDate",
",",
"String",
"textValue",
")",
"{",
"return",
"new",
"Sample",
"(",
"null",
",",
"isoDate",
",",
"null",
",",
"textValue",
")",
";",
"}"
] | Creates a new {@link Sample} with date in ISO 8061 format and text value specified
@param isoDate date in ISO 8061 format according
to <a href="https://www.ietf.org/rfc/rfc3339.txt">RFC3339</a>
@param textValue the text value of the sample
@return the Sample with specified fields | [
"Creates",
"a",
"new",
"{",
"@link",
"Sample",
"}",
"with",
"date",
"in",
"ISO",
"8061",
"format",
"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#L130-L132 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsExportpointsList.java | CmsExportpointsList.deleteExportpoint | private void deleteExportpoint(CmsModule module, String exportpoint) {
List oldExportpoints = module.getExportPoints();
List newExportpoints = new ArrayList();
Iterator i = oldExportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exp = (CmsExportPoint)i.next();
if (!exp.getUri().equals(exportpoint)) {
newExportpoints.add(exp);
}
}
module.setExportPoints(newExportpoints);
// update the module information
try {
OpenCms.getModuleManager().updateModule(getCms(), module);
} catch (CmsConfigurationException ce) {
// should never happen
throw new CmsRuntimeException(
Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()),
ce);
} catch (CmsRoleViolationException re) {
throw new CmsRuntimeException(
Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()),
re);
}
} | java | private void deleteExportpoint(CmsModule module, String exportpoint) {
List oldExportpoints = module.getExportPoints();
List newExportpoints = new ArrayList();
Iterator i = oldExportpoints.iterator();
while (i.hasNext()) {
CmsExportPoint exp = (CmsExportPoint)i.next();
if (!exp.getUri().equals(exportpoint)) {
newExportpoints.add(exp);
}
}
module.setExportPoints(newExportpoints);
// update the module information
try {
OpenCms.getModuleManager().updateModule(getCms(), module);
} catch (CmsConfigurationException ce) {
// should never happen
throw new CmsRuntimeException(
Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()),
ce);
} catch (CmsRoleViolationException re) {
throw new CmsRuntimeException(
Messages.get().container(Messages.ERR_ACTION_EXPORTPOINTS_DELETE_2, exportpoint, module.getName()),
re);
}
} | [
"private",
"void",
"deleteExportpoint",
"(",
"CmsModule",
"module",
",",
"String",
"exportpoint",
")",
"{",
"List",
"oldExportpoints",
"=",
"module",
".",
"getExportPoints",
"(",
")",
";",
"List",
"newExportpoints",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Ite... | Deletes a module exportpoint from a module.<p>
@param module the module to delete the dependency from
@param exportpoint the name of the exportpoint to delete | [
"Deletes",
"a",
"module",
"exportpoint",
"from",
"a",
"module",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsExportpointsList.java#L379-L405 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.skipLast | @CheckReturnValue
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Flowable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize) {
ObjectHelper.requireNonNull(unit, "unit is null");
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
// the internal buffer holds pairs of (timestamp, value) so double the default buffer size
int s = bufferSize << 1;
return RxJavaPlugins.onAssembly(new FlowableSkipLastTimed<T>(this, time, unit, scheduler, s, delayError));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.UNBOUNDED_IN)
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Flowable<T> skipLast(long time, TimeUnit unit, Scheduler scheduler, boolean delayError, int bufferSize) {
ObjectHelper.requireNonNull(unit, "unit is null");
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
// the internal buffer holds pairs of (timestamp, value) so double the default buffer size
int s = bufferSize << 1;
return RxJavaPlugins.onAssembly(new FlowableSkipLastTimed<T>(this, time, unit, scheduler, s, delayError));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"UNBOUNDED_IN",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"CUSTOM",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
"skipLast",
"(",
"long",
"time",
",",
"Tim... | Returns a Flowable that drops items emitted by the source Publisher during a specified time window
(defined on a specified scheduler) before the source completes.
<p>
<img width="640" height="340" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/skipLast.ts.png" alt="">
<p>
Note: this action will cache the latest items arriving in the specified time window.
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator doesn't support backpressure as it uses time to skip an arbitrary number of elements and
thus has to consume the source {@code Publisher} in an unbounded manner (i.e., no backpressure applied to it).</dd>
<dt><b>Scheduler:</b></dt>
<dd>You specify which {@link Scheduler} this operator will use.</dd>
</dl>
@param time
the length of the time window
@param unit
the time unit of {@code time}
@param scheduler
the scheduler used as the time source
@param delayError
if true, an exception signaled by the current Flowable is delayed until the regular elements are consumed
by the downstream; if false, an exception is immediately signaled and all regular elements dropped
@param bufferSize
the hint about how many elements to expect to be skipped
@return a Flowable that drops those items emitted by the source Publisher in a time window before the
source completes defined by {@code time} and {@code scheduler}
@see <a href="http://reactivex.io/documentation/operators/skiplast.html">ReactiveX operators documentation: SkipLast</a> | [
"Returns",
"a",
"Flowable",
"that",
"drops",
"items",
"emitted",
"by",
"the",
"source",
"Publisher",
"during",
"a",
"specified",
"time",
"window",
"(",
"defined",
"on",
"a",
"specified",
"scheduler",
")",
"before",
"the",
"source",
"completes",
".",
"<p",
">... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L14015-L14025 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java | FastAdapter.getItemById | @SuppressWarnings("unchecked")
public Pair<Item, Integer> getItemById(final long identifier) {
if (identifier == -1) {
return null;
}
Triple result = recursive(new AdapterPredicate() {
@Override
public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
return item.getIdentifier() == identifier;
}
}, true);
if (result.second == null) {
return null;
} else {
return new Pair(result.second, result.third);
}
} | java | @SuppressWarnings("unchecked")
public Pair<Item, Integer> getItemById(final long identifier) {
if (identifier == -1) {
return null;
}
Triple result = recursive(new AdapterPredicate() {
@Override
public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
return item.getIdentifier() == identifier;
}
}, true);
if (result.second == null) {
return null;
} else {
return new Pair(result.second, result.third);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Pair",
"<",
"Item",
",",
"Integer",
">",
"getItemById",
"(",
"final",
"long",
"identifier",
")",
"{",
"if",
"(",
"identifier",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"Triple",
... | gets the IItem given an identifier, from all registered adapters
@param identifier the identifier of the searched item
@return the found Pair<IItem, Integer> (the found item, and it's global position if it is currently displayed) or null | [
"gets",
"the",
"IItem",
"given",
"an",
"identifier",
"from",
"all",
"registered",
"adapters"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java#L867-L883 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java | PerceptronClassifier.train | public BinaryClassificationFMeasure train(String corpus, int maxIteration, boolean averagePerceptron)
{
FeatureMap featureMap = new LockableFeatureMap(new TagSet(TaskType.CLASSIFICATION));
featureMap.mutable = true; // 训练时特征映射可拓充
Instance[] instanceList = readInstance(corpus, featureMap);
model = averagePerceptron ? trainAveragedPerceptron(instanceList, featureMap, maxIteration)
: trainNaivePerceptron(instanceList, featureMap, maxIteration);
featureMap.mutable = false; // 训练结束后特征不可写
return evaluate(instanceList);
} | java | public BinaryClassificationFMeasure train(String corpus, int maxIteration, boolean averagePerceptron)
{
FeatureMap featureMap = new LockableFeatureMap(new TagSet(TaskType.CLASSIFICATION));
featureMap.mutable = true; // 训练时特征映射可拓充
Instance[] instanceList = readInstance(corpus, featureMap);
model = averagePerceptron ? trainAveragedPerceptron(instanceList, featureMap, maxIteration)
: trainNaivePerceptron(instanceList, featureMap, maxIteration);
featureMap.mutable = false; // 训练结束后特征不可写
return evaluate(instanceList);
} | [
"public",
"BinaryClassificationFMeasure",
"train",
"(",
"String",
"corpus",
",",
"int",
"maxIteration",
",",
"boolean",
"averagePerceptron",
")",
"{",
"FeatureMap",
"featureMap",
"=",
"new",
"LockableFeatureMap",
"(",
"new",
"TagSet",
"(",
"TaskType",
".",
"CLASSIFI... | 训练
@param corpus 语料库
@param maxIteration 最大迭代次数
@param averagePerceptron 是否使用平均感知机算法
@return 模型在训练集上的准确率 | [
"训练"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L122-L131 |
yidongnan/grpc-spring-boot-starter | grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/security/interceptors/ExceptionTranslatingServerInterceptor.java | ExceptionTranslatingServerInterceptor.closeCallAccessDenied | protected void closeCallAccessDenied(final ServerCall<?, ?> call, final AccessDeniedException aex) {
call.close(Status.PERMISSION_DENIED.withCause(aex).withDescription(ACCESS_DENIED_DESCRIPTION), new Metadata());
} | java | protected void closeCallAccessDenied(final ServerCall<?, ?> call, final AccessDeniedException aex) {
call.close(Status.PERMISSION_DENIED.withCause(aex).withDescription(ACCESS_DENIED_DESCRIPTION), new Metadata());
} | [
"protected",
"void",
"closeCallAccessDenied",
"(",
"final",
"ServerCall",
"<",
"?",
",",
"?",
">",
"call",
",",
"final",
"AccessDeniedException",
"aex",
")",
"{",
"call",
".",
"close",
"(",
"Status",
".",
"PERMISSION_DENIED",
".",
"withCause",
"(",
"aex",
")... | Close the call with {@link Status#PERMISSION_DENIED}.
@param call The call to close.
@param aex The exception that was the cause. | [
"Close",
"the",
"call",
"with",
"{",
"@link",
"Status#PERMISSION_DENIED",
"}",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/security/interceptors/ExceptionTranslatingServerInterceptor.java#L87-L89 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/PathAddress.java | PathAddress.subAddress | public PathAddress subAddress(int start) {
final List<PathElement> list = pathAddressList;
return new PathAddress(list.subList(start, list.size()));
} | java | public PathAddress subAddress(int start) {
final List<PathElement> list = pathAddressList;
return new PathAddress(list.subList(start, list.size()));
} | [
"public",
"PathAddress",
"subAddress",
"(",
"int",
"start",
")",
"{",
"final",
"List",
"<",
"PathElement",
">",
"list",
"=",
"pathAddressList",
";",
"return",
"new",
"PathAddress",
"(",
"list",
".",
"subList",
"(",
"start",
",",
"list",
".",
"size",
"(",
... | Get a portion of this address using segments starting at {@code start} (inclusive).
@param start the start index
@return the partial address | [
"Get",
"a",
"portion",
"of",
"this",
"address",
"using",
"segments",
"starting",
"at",
"{",
"@code",
"start",
"}",
"(",
"inclusive",
")",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/PathAddress.java#L253-L256 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelClient.java | PaymentChannelClient.setIncreasePaymentFutureIfNeeded | private void setIncreasePaymentFutureIfNeeded(PaymentChannelCloseException.CloseReason reason, String message) {
if (increasePaymentFuture != null && !increasePaymentFuture.isDone()) {
increasePaymentFuture.setException(new PaymentChannelCloseException(message, reason));
}
} | java | private void setIncreasePaymentFutureIfNeeded(PaymentChannelCloseException.CloseReason reason, String message) {
if (increasePaymentFuture != null && !increasePaymentFuture.isDone()) {
increasePaymentFuture.setException(new PaymentChannelCloseException(message, reason));
}
} | [
"private",
"void",
"setIncreasePaymentFutureIfNeeded",
"(",
"PaymentChannelCloseException",
".",
"CloseReason",
"reason",
",",
"String",
"message",
")",
"{",
"if",
"(",
"increasePaymentFuture",
"!=",
"null",
"&&",
"!",
"increasePaymentFuture",
".",
"isDone",
"(",
")",... | /*
If this is an ongoing payment channel increase we need to call setException() on its future.
@param reason is the reason for aborting
@param message is the detailed message | [
"/",
"*",
"If",
"this",
"is",
"an",
"ongoing",
"payment",
"channel",
"increase",
"we",
"need",
"to",
"call",
"setException",
"()",
"on",
"its",
"future",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelClient.java#L503-L507 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/Printer.java | Printer.printList | static void printList(final PrintWriter pw, final List<?> l) {
for (int i = 0; i < l.size(); ++i) {
Object o = l.get(i);
if (o instanceof List) {
printList(pw, (List<?>) o);
} else {
pw.print(o.toString());
}
}
} | java | static void printList(final PrintWriter pw, final List<?> l) {
for (int i = 0; i < l.size(); ++i) {
Object o = l.get(i);
if (o instanceof List) {
printList(pw, (List<?>) o);
} else {
pw.print(o.toString());
}
}
} | [
"static",
"void",
"printList",
"(",
"final",
"PrintWriter",
"pw",
",",
"final",
"List",
"<",
"?",
">",
"l",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"l",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"Object",
"o",
"=",
... | Prints the given string tree.
@param pw
the writer to be used to print the tree.
@param l
a string tree, i.e., a string list that can contain other
string lists, and so on recursively. | [
"Prints",
"the",
"given",
"string",
"tree",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/Printer.java#L579-L588 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/ChannelAction.java | ChannelAction.addPermissionOverride | @CheckReturnValue
public ChannelAction addPermissionOverride(IPermissionHolder target, long allow, long deny)
{
Checks.notNull(target, "Override Role");
Checks.notNegative(allow, "Granted permissions value");
Checks.notNegative(deny, "Denied permissions value");
Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set");
Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set");
Checks.check(target.getGuild().equals(guild), "Specified Role is not in the same Guild!");
if (target instanceof Role)
{
Role r = (Role) target;
long id = r.getIdLong();
overrides.add(new PermOverrideData(PermOverrideData.ROLE_TYPE, id, allow, deny));
}
else
{
Member m = (Member) target;
long id = m.getUser().getIdLong();
overrides.add(new PermOverrideData(PermOverrideData.MEMBER_TYPE, id, allow, deny));
}
return this;
} | java | @CheckReturnValue
public ChannelAction addPermissionOverride(IPermissionHolder target, long allow, long deny)
{
Checks.notNull(target, "Override Role");
Checks.notNegative(allow, "Granted permissions value");
Checks.notNegative(deny, "Denied permissions value");
Checks.check(allow <= Permission.ALL_PERMISSIONS, "Specified allow value may not be greater than a full permission set");
Checks.check(deny <= Permission.ALL_PERMISSIONS, "Specified deny value may not be greater than a full permission set");
Checks.check(target.getGuild().equals(guild), "Specified Role is not in the same Guild!");
if (target instanceof Role)
{
Role r = (Role) target;
long id = r.getIdLong();
overrides.add(new PermOverrideData(PermOverrideData.ROLE_TYPE, id, allow, deny));
}
else
{
Member m = (Member) target;
long id = m.getUser().getIdLong();
overrides.add(new PermOverrideData(PermOverrideData.MEMBER_TYPE, id, allow, deny));
}
return this;
} | [
"@",
"CheckReturnValue",
"public",
"ChannelAction",
"addPermissionOverride",
"(",
"IPermissionHolder",
"target",
",",
"long",
"allow",
",",
"long",
"deny",
")",
"{",
"Checks",
".",
"notNull",
"(",
"target",
",",
"\"Override Role\"",
")",
";",
"Checks",
".",
"not... | Adds a new Role or Member {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverride}
for the new Channel.
<p>Example:
<pre>{@code
Role role = guild.getPublicRole();
long allow = Permission.MESSAGE_READ.getRawValue();
long deny = Permission.MESSAGE_WRITE.getRawValue() | Permission.MESSAGE_ADD_REACTION.getRawValue();
channelAction.addPermissionOverride(role, allow, deny);
}</pre>
@param target
The not-null {@link net.dv8tion.jda.core.entities.Role Role} or {@link net.dv8tion.jda.core.entities.Member Member} for the override
@param allow
The granted {@link net.dv8tion.jda.core.Permission Permissions} for the override
Use {@link net.dv8tion.jda.core.Permission#getRawValue()} to retrieve these Permissions.
@param deny
The denied {@link net.dv8tion.jda.core.Permission Permissions} for the override
Use {@link net.dv8tion.jda.core.Permission#getRawValue()} to retrieve these Permissions.
@throws java.lang.IllegalArgumentException
<ul>
<li>If the specified target is null
or not within the same guild.</li>
<li>If one of the provided Permission values is invalid</li>
</ul>
@return The current ChannelAction, for chaining convenience
@see net.dv8tion.jda.core.Permission#getRawValue()
@see net.dv8tion.jda.core.Permission#getRaw(java.util.Collection)
@see net.dv8tion.jda.core.Permission#getRaw(net.dv8tion.jda.core.Permission...) | [
"Adds",
"a",
"new",
"Role",
"or",
"Member",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"PermissionOverride",
"PermissionOverride",
"}",
"for",
"the",
"new",
"Channel",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/ChannelAction.java#L300-L323 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java | SceneStructureCommon.connectPointToView | public void connectPointToView( int pointIndex , int viewIndex ) {
SceneStructureMetric.Point p = points[pointIndex];
for (int i = 0; i < p.views.size; i++) {
if( p.views.data[i] == viewIndex )
throw new IllegalArgumentException("Tried to add the same view twice. viewIndex="+viewIndex);
}
p.views.add(viewIndex);
} | java | public void connectPointToView( int pointIndex , int viewIndex ) {
SceneStructureMetric.Point p = points[pointIndex];
for (int i = 0; i < p.views.size; i++) {
if( p.views.data[i] == viewIndex )
throw new IllegalArgumentException("Tried to add the same view twice. viewIndex="+viewIndex);
}
p.views.add(viewIndex);
} | [
"public",
"void",
"connectPointToView",
"(",
"int",
"pointIndex",
",",
"int",
"viewIndex",
")",
"{",
"SceneStructureMetric",
".",
"Point",
"p",
"=",
"points",
"[",
"pointIndex",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"p",
".",
"view... | Specifies that the point was observed in this view.
@param pointIndex index of point
@param viewIndex index of view | [
"Specifies",
"that",
"the",
"point",
"was",
"observed",
"in",
"this",
"view",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureCommon.java#L73-L81 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/AbstractPrintQuery.java | AbstractPrintQuery.addPhrase | public AbstractPrintQuery addPhrase(final String _key,
final String _phraseStmt)
throws EFapsException
{
ValueList list = null;
final ValueParser parser = new ValueParser(new StringReader(_phraseStmt));
try {
list = parser.ExpressionString();
} catch (final ParseException e) {
throw new EFapsException(PrintQuery.class.toString(), e);
}
final Phrase phrase = new Phrase(_key, _phraseStmt, list);
this.key2Phrase.put(_key, phrase);
for (final String selectStmt : list.getExpressions()) {
final OneSelect oneselect = new OneSelect(this, selectStmt);
this.allSelects.add(oneselect);
phrase.addSelect(oneselect);
oneselect.analyzeSelectStmt();
}
return this;
} | java | public AbstractPrintQuery addPhrase(final String _key,
final String _phraseStmt)
throws EFapsException
{
ValueList list = null;
final ValueParser parser = new ValueParser(new StringReader(_phraseStmt));
try {
list = parser.ExpressionString();
} catch (final ParseException e) {
throw new EFapsException(PrintQuery.class.toString(), e);
}
final Phrase phrase = new Phrase(_key, _phraseStmt, list);
this.key2Phrase.put(_key, phrase);
for (final String selectStmt : list.getExpressions()) {
final OneSelect oneselect = new OneSelect(this, selectStmt);
this.allSelects.add(oneselect);
phrase.addSelect(oneselect);
oneselect.analyzeSelectStmt();
}
return this;
} | [
"public",
"AbstractPrintQuery",
"addPhrase",
"(",
"final",
"String",
"_key",
",",
"final",
"String",
"_phraseStmt",
")",
"throws",
"EFapsException",
"{",
"ValueList",
"list",
"=",
"null",
";",
"final",
"ValueParser",
"parser",
"=",
"new",
"ValueParser",
"(",
"ne... | Add a Phrase to this PrintQuery. A Phrase is something like:
<code>"$<attribute[LastName]> - $<attribute[FirstName]>"</code>
This would return " John - Doe". One Phrase can contain various selects
as defined for {@link #addSelect(String...)} and string to connect them.
@param _key key the phrase can be accessed
@param _phraseStmt phrase to add
@throws EFapsException on error
@return this PrintQuery | [
"Add",
"a",
"Phrase",
"to",
"this",
"PrintQuery",
".",
"A",
"Phrase",
"is",
"something",
"like",
":",
"<code",
">",
"$<",
";",
"attribute",
"[",
"LastName",
"]",
">",
";",
"-",
"$<",
";",
"attribute",
"[",
"FirstName",
"]",
">",
";",
"<",
"/"... | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L400-L422 |
CloudSlang/cs-actions | cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/PooledDataSourceProvider.java | PooledDataSourceProvider.getPropStringValue | protected String getPropStringValue(String aPropName, String aDefaultValue) {
return dbPoolingProperties.getProperty(aPropName,
aDefaultValue);
} | java | protected String getPropStringValue(String aPropName, String aDefaultValue) {
return dbPoolingProperties.getProperty(aPropName,
aDefaultValue);
} | [
"protected",
"String",
"getPropStringValue",
"(",
"String",
"aPropName",
",",
"String",
"aDefaultValue",
")",
"{",
"return",
"dbPoolingProperties",
".",
"getProperty",
"(",
"aPropName",
",",
"aDefaultValue",
")",
";",
"}"
] | get string value based on the property name from property file
the property file is databasePooling.properties
@param aPropName a property name
@param aDefaultValue a default value for that property, if the property is not there.
@return string value of that property | [
"get",
"string",
"value",
"based",
"on",
"the",
"property",
"name",
"from",
"property",
"file",
"the",
"property",
"file",
"is",
"databasePooling",
".",
"properties"
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/PooledDataSourceProvider.java#L171-L174 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/compiler/MemorySourceJavaFileObject.java | MemorySourceJavaFileObject.createUriFromName | private static URI createUriFromName(String name) {
if (name == null) {
throw new NullPointerException("name");
}
try {
return new URI(name);
} catch (final URISyntaxException e) {
throw new IllegalArgumentException("Invalid name: " + name, e);
}
} | java | private static URI createUriFromName(String name) {
if (name == null) {
throw new NullPointerException("name");
}
try {
return new URI(name);
} catch (final URISyntaxException e) {
throw new IllegalArgumentException("Invalid name: " + name, e);
}
} | [
"private",
"static",
"URI",
"createUriFromName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name\"",
")",
";",
"}",
"try",
"{",
"return",
"new",
"URI",
"(",
"name",
")",
"... | Creates a URI from a source file name.
@param name the source file name.
@return the URI.
@throws NullPointerException if <code>name</code>
is null.
@throws IllegalArgumentException if <code>name</code>
is invalid. | [
"Creates",
"a",
"URI",
"from",
"a",
"source",
"file",
"name",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/compiler/MemorySourceJavaFileObject.java#L44-L53 |
uber/NullAway | nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPath.java | AccessPath.getAccessPathForNodeWithMapGet | @Nullable
public static AccessPath getAccessPathForNodeWithMapGet(Node node, @Nullable Types types) {
if (node instanceof LocalVariableNode) {
return fromLocal((LocalVariableNode) node);
} else if (node instanceof FieldAccessNode) {
return fromFieldAccess((FieldAccessNode) node);
} else if (node instanceof MethodInvocationNode) {
return fromMethodCall((MethodInvocationNode) node, types);
} else {
return null;
}
} | java | @Nullable
public static AccessPath getAccessPathForNodeWithMapGet(Node node, @Nullable Types types) {
if (node instanceof LocalVariableNode) {
return fromLocal((LocalVariableNode) node);
} else if (node instanceof FieldAccessNode) {
return fromFieldAccess((FieldAccessNode) node);
} else if (node instanceof MethodInvocationNode) {
return fromMethodCall((MethodInvocationNode) node, types);
} else {
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"AccessPath",
"getAccessPathForNodeWithMapGet",
"(",
"Node",
"node",
",",
"@",
"Nullable",
"Types",
"types",
")",
"{",
"if",
"(",
"node",
"instanceof",
"LocalVariableNode",
")",
"{",
"return",
"fromLocal",
"(",
"(",
"LocalVar... | Gets corresponding AccessPath for node, if it exists. Handles calls to <code>Map.get()
</code>
@param node AST node
@param types javac {@link Types}
@return corresponding AccessPath if it exists; <code>null</code> otherwise | [
"Gets",
"corresponding",
"AccessPath",
"for",
"node",
"if",
"it",
"exists",
".",
"Handles",
"calls",
"to",
"<code",
">",
"Map",
".",
"get",
"()",
"<",
"/",
"code",
">"
] | train | https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPath.java#L196-L207 |
liferay/com-liferay-commerce | commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java | CommercePaymentMethodGroupRelPersistenceImpl.findByGroupId | @Override
public List<CommercePaymentMethodGroupRel> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommercePaymentMethodGroupRel> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePaymentMethodGroupRel",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
... | Returns a range of all the commerce payment method group rels where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePaymentMethodGroupRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of commerce payment method group rels
@param end the upper bound of the range of commerce payment method group rels (not inclusive)
@return the range of matching commerce payment method group rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"payment",
"method",
"group",
"rels",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-payment-service/src/main/java/com/liferay/commerce/payment/service/persistence/impl/CommercePaymentMethodGroupRelPersistenceImpl.java#L144-L148 |
google/closure-templates | java/src/com/google/template/soy/soyparse/SoyParseUtils.java | SoyParseUtils.unescapeCommandAttributeValue | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loop.
int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
if (index == -1) {
return s;
}
StringBuilder buf = new StringBuilder(s.length());
buf.append(s);
boolean nextIsQ = buf.charAt(s.length() - 1) == quoteStyle.getQuoteChar();
for (int i = s.length() - 2; i >= index; i--) {
char c = buf.charAt(i);
if (c == '\\' && nextIsQ) {
buf.deleteCharAt(i);
}
nextIsQ = c == quoteStyle.getQuoteChar();
}
return buf.toString();
} | java | static String unescapeCommandAttributeValue(String s, QuoteStyle quoteStyle) {
// NOTE: we don't just use String.replace since it internally allocates/compiles a regular
// expression. Instead we have a handrolled loop.
int index = s.indexOf(quoteStyle == QuoteStyle.DOUBLE ? "\\\"" : "\\\'");
if (index == -1) {
return s;
}
StringBuilder buf = new StringBuilder(s.length());
buf.append(s);
boolean nextIsQ = buf.charAt(s.length() - 1) == quoteStyle.getQuoteChar();
for (int i = s.length() - 2; i >= index; i--) {
char c = buf.charAt(i);
if (c == '\\' && nextIsQ) {
buf.deleteCharAt(i);
}
nextIsQ = c == quoteStyle.getQuoteChar();
}
return buf.toString();
} | [
"static",
"String",
"unescapeCommandAttributeValue",
"(",
"String",
"s",
",",
"QuoteStyle",
"quoteStyle",
")",
"{",
"// NOTE: we don't just use String.replace since it internally allocates/compiles a regular",
"// expression. Instead we have a handrolled loop.",
"int",
"index",
"=",
... | Unescapes backslash quote sequences in an attribute value to just the quote. | [
"Unescapes",
"backslash",
"quote",
"sequences",
"in",
"an",
"attribute",
"value",
"to",
"just",
"the",
"quote",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/SoyParseUtils.java#L170-L188 |
h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostRegTree.java | XGBoostRegTree.getLeafValue | @Override
public final float getLeafValue(FVec feat, int root_id) {
int pid = root_id;
int pos = pid * NODE_SIZE + 4;
int cleft_ = UnsafeUtils.get4(_nodes, pos);
while (cleft_ != -1) {
final int sindex_ = UnsafeUtils.get4(_nodes, pos + 8);
final float fvalue = feat.fvalue((int) (sindex_ & ((1L << 31) - 1L)));
if (Float.isNaN(fvalue)) {
pid = (sindex_ >>> 31) != 0 ? cleft_ : UnsafeUtils.get4(_nodes, pos + 4);
} else {
final float value_ = UnsafeUtils.get4f(_nodes, pos + 12);
pid = (fvalue < value_) ? cleft_ : UnsafeUtils.get4(_nodes, pos + 4);
}
pos = pid * NODE_SIZE + 4;
cleft_ = UnsafeUtils.get4(_nodes, pos);
}
return UnsafeUtils.get4f(_nodes, pos + 12);
} | java | @Override
public final float getLeafValue(FVec feat, int root_id) {
int pid = root_id;
int pos = pid * NODE_SIZE + 4;
int cleft_ = UnsafeUtils.get4(_nodes, pos);
while (cleft_ != -1) {
final int sindex_ = UnsafeUtils.get4(_nodes, pos + 8);
final float fvalue = feat.fvalue((int) (sindex_ & ((1L << 31) - 1L)));
if (Float.isNaN(fvalue)) {
pid = (sindex_ >>> 31) != 0 ? cleft_ : UnsafeUtils.get4(_nodes, pos + 4);
} else {
final float value_ = UnsafeUtils.get4f(_nodes, pos + 12);
pid = (fvalue < value_) ? cleft_ : UnsafeUtils.get4(_nodes, pos + 4);
}
pos = pid * NODE_SIZE + 4;
cleft_ = UnsafeUtils.get4(_nodes, pos);
}
return UnsafeUtils.get4f(_nodes, pos + 12);
} | [
"@",
"Override",
"public",
"final",
"float",
"getLeafValue",
"(",
"FVec",
"feat",
",",
"int",
"root_id",
")",
"{",
"int",
"pid",
"=",
"root_id",
";",
"int",
"pos",
"=",
"pid",
"*",
"NODE_SIZE",
"+",
"4",
";",
"int",
"cleft_",
"=",
"UnsafeUtils",
".",
... | Retrieves nodes from root to leaf and returns leaf value.
@param feat feature vector
@param root_id starting root index
@return leaf value | [
"Retrieves",
"nodes",
"from",
"root",
"to",
"leaf",
"and",
"returns",
"leaf",
"value",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostRegTree.java#L53-L74 |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java | HttpUrl.queryParameterNames | public Set<String> queryParameterNames() {
if (queryNamesAndValues == null) return Collections.emptySet();
Set<String> result = new LinkedHashSet<>();
for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) {
result.add(queryNamesAndValues.get(i));
}
return Collections.unmodifiableSet(result);
} | java | public Set<String> queryParameterNames() {
if (queryNamesAndValues == null) return Collections.emptySet();
Set<String> result = new LinkedHashSet<>();
for (int i = 0, size = queryNamesAndValues.size(); i < size; i += 2) {
result.add(queryNamesAndValues.get(i));
}
return Collections.unmodifiableSet(result);
} | [
"public",
"Set",
"<",
"String",
">",
"queryParameterNames",
"(",
")",
"{",
"if",
"(",
"queryNamesAndValues",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<>",... | Returns the distinct query parameter names in this URL, like {@code ["a", "b"]} for {@code
http://host/?a=apple&b=banana}. If this URL has no query this returns the empty set.
<p><table summary="">
<tr><th>URL</th><th>{@code queryParameterNames()}</th></tr>
<tr><td>{@code http://host/}</td><td>{@code []}</td></tr>
<tr><td>{@code http://host/?}</td><td>{@code [""]}</td></tr>
<tr><td>{@code http://host/?a=apple&k=key+lime}</td><td>{@code ["a", "k"]}</td></tr>
<tr><td>{@code http://host/?a=apple&a=apricot}</td><td>{@code ["a"]}</td></tr>
<tr><td>{@code http://host/?a=apple&b}</td><td>{@code ["a", "b"]}</td></tr>
</table> | [
"Returns",
"the",
"distinct",
"query",
"parameter",
"names",
"in",
"this",
"URL",
"like",
"{",
"@code",
"[",
"a",
"b",
"]",
"}",
"for",
"{",
"@code",
"http",
":",
"//",
"host",
"/",
"?a",
"=",
"apple&b",
"=",
"banana",
"}",
".",
"If",
"this",
"URL"... | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/http/HttpUrl.java#L730-L737 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java | JsonRpcClient.invokeAndReadResponse | private Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input, String id) throws Throwable {
invoke(methodName, argument, output, id);
return readResponse(returnType, input, id);
} | java | private Object invokeAndReadResponse(String methodName, Object argument, Type returnType, OutputStream output, InputStream input, String id) throws Throwable {
invoke(methodName, argument, output, id);
return readResponse(returnType, input, id);
} | [
"private",
"Object",
"invokeAndReadResponse",
"(",
"String",
"methodName",
",",
"Object",
"argument",
",",
"Type",
"returnType",
",",
"OutputStream",
"output",
",",
"InputStream",
"input",
",",
"String",
"id",
")",
"throws",
"Throwable",
"{",
"invoke",
"(",
"met... | Invokes the given method on the remote service
passing the given arguments and reads a response.
@param methodName the method to invoke
@param argument the argument to pass to the method
@param returnType the expected return type
@param output the {@link OutputStream} to write to
@param input the {@link InputStream} to read from
@param id id to send with the JSON-RPC request
@return the returned Object
@throws Throwable if there is an error
while reading the response
@see #writeRequest(String, Object, OutputStream, String) | [
"Invokes",
"the",
"given",
"method",
"on",
"the",
"remote",
"service",
"passing",
"the",
"given",
"arguments",
"and",
"reads",
"a",
"response",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L157-L160 |
probedock/probedock-java | src/main/java/io/probedock/client/core/filters/FilterUtils.java | FilterUtils.isRunnable | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
// Get the ROX annotations
ProbeTest mAnnotation = method.getAnnotation(ProbeTest.class);
ProbeTestClass cAnnotation = method.getDeclaringClass().getAnnotation(ProbeTestClass.class);
String fingerprint = FingerprintGenerator.fingerprint(cl, method);
if (mAnnotation != null || cAnnotation != null) {
return isRunnable(new FilterTargetData(fingerprint, method, mAnnotation, cAnnotation), filters);
} else {
return isRunnable(new FilterTargetData(fingerprint, method), filters);
}
} | java | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
// Get the ROX annotations
ProbeTest mAnnotation = method.getAnnotation(ProbeTest.class);
ProbeTestClass cAnnotation = method.getDeclaringClass().getAnnotation(ProbeTestClass.class);
String fingerprint = FingerprintGenerator.fingerprint(cl, method);
if (mAnnotation != null || cAnnotation != null) {
return isRunnable(new FilterTargetData(fingerprint, method, mAnnotation, cAnnotation), filters);
} else {
return isRunnable(new FilterTargetData(fingerprint, method), filters);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"isRunnable",
"(",
"Class",
"cl",
",",
"Method",
"method",
",",
"List",
"<",
"FilterDefinition",
">",
"filters",
")",
"{",
"// Get the ROX annotations",
"ProbeTest",
"mAnnotation",
... | Define if a test is runnable or not based on a method and class
@param cl Class
@param method The method
@param filters The filters to apply
@return True if the test can be run | [
"Define",
"if",
"a",
"test",
"is",
"runnable",
"or",
"not",
"based",
"on",
"a",
"method",
"and",
"class"
] | train | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/filters/FilterUtils.java#L44-L57 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java | CollectionDescriptorConstraints.checkInheritedForeignkey | private void checkInheritedForeignkey(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
if (!collDef.isInherited() && !collDef.isNested())
{
return;
}
if (!collDef.hasProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE))
{
return;
}
String localFk = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
String inheritedFk = collDef.getOriginal().getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
if (!CommaListIterator.sameLists(localFk, inheritedFk))
{
throw new ConstraintException("The foreignkey property has been changed for the m:n collection "+collDef.getName()+" in class "+collDef.getOwner().getName());
}
} | java | private void checkInheritedForeignkey(CollectionDescriptorDef collDef, String checkLevel) throws ConstraintException
{
if (CHECKLEVEL_NONE.equals(checkLevel))
{
return;
}
if (!collDef.isInherited() && !collDef.isNested())
{
return;
}
if (!collDef.hasProperty(PropertyHelper.OJB_PROPERTY_INDIRECTION_TABLE))
{
return;
}
String localFk = collDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
String inheritedFk = collDef.getOriginal().getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY);
if (!CommaListIterator.sameLists(localFk, inheritedFk))
{
throw new ConstraintException("The foreignkey property has been changed for the m:n collection "+collDef.getName()+" in class "+collDef.getOwner().getName());
}
} | [
"private",
"void",
"checkInheritedForeignkey",
"(",
"CollectionDescriptorDef",
"collDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"CHECKLEVEL_NONE",
".",
"equals",
"(",
"checkLevel",
")",
")",
"{",
"return",
";",
"}",
"if... | Checks that the foreignkey is not modified in an inherited/nested m:n collection descriptor.
@param collDef The collection descriptor
@param checkLevel The current check level (this constraint is checked in basic and strict) | [
"Checks",
"that",
"the",
"foreignkey",
"is",
"not",
"modified",
"in",
"an",
"inherited",
"/",
"nested",
"m",
":",
"n",
"collection",
"descriptor",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/CollectionDescriptorConstraints.java#L126-L148 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java | SparkUtils.listPaths | public static JavaRDD<String> listPaths(JavaSparkContext sc, String path, boolean recursive, String[] allowedExtensions) throws IOException {
return listPaths(sc, path, recursive, (allowedExtensions == null ? null : new HashSet<>(Arrays.asList(allowedExtensions))));
} | java | public static JavaRDD<String> listPaths(JavaSparkContext sc, String path, boolean recursive, String[] allowedExtensions) throws IOException {
return listPaths(sc, path, recursive, (allowedExtensions == null ? null : new HashSet<>(Arrays.asList(allowedExtensions))));
} | [
"public",
"static",
"JavaRDD",
"<",
"String",
">",
"listPaths",
"(",
"JavaSparkContext",
"sc",
",",
"String",
"path",
",",
"boolean",
"recursive",
",",
"String",
"[",
"]",
"allowedExtensions",
")",
"throws",
"IOException",
"{",
"return",
"listPaths",
"(",
"sc"... | List of the files in the given directory (path), as a {@code JavaRDD<String>}
@param sc Spark context
@param path Path to list files in
@param recursive Whether to walk the directory tree recursively (i.e., include subdirectories)
@param allowedExtensions If null: all files will be accepted. If non-null: only files with the specified extension will be allowed.
Exclude the extension separator - i.e., use "txt" not ".txt" here.
@return Paths in the directory
@throws IOException If error occurs getting directory contents | [
"List",
"of",
"the",
"files",
"in",
"the",
"given",
"directory",
"(",
"path",
")",
"as",
"a",
"{",
"@code",
"JavaRDD<String",
">",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/SparkUtils.java#L556-L558 |
GoogleCloudPlatform/appengine-plugins-core | src/main/java/com/google/cloud/tools/appengine/AppEngineDescriptor.java | AppEngineDescriptor.getNode | @Nullable
private static Node getNode(Document doc, String parentNodeName, String targetNodeName) {
NodeList parentElements = doc.getElementsByTagNameNS(APP_ENGINE_NAMESPACE, parentNodeName);
if (parentElements.getLength() > 0) {
Node parent = parentElements.item(0);
if (parent.hasChildNodes()) {
for (int i = 0; i < parent.getChildNodes().getLength(); i++) {
Node child = parent.getChildNodes().item(i);
if (child.getNodeName().equals(targetNodeName)) {
return child;
}
}
}
}
return null;
} | java | @Nullable
private static Node getNode(Document doc, String parentNodeName, String targetNodeName) {
NodeList parentElements = doc.getElementsByTagNameNS(APP_ENGINE_NAMESPACE, parentNodeName);
if (parentElements.getLength() > 0) {
Node parent = parentElements.item(0);
if (parent.hasChildNodes()) {
for (int i = 0; i < parent.getChildNodes().getLength(); i++) {
Node child = parent.getChildNodes().item(i);
if (child.getNodeName().equals(targetNodeName)) {
return child;
}
}
}
}
return null;
} | [
"@",
"Nullable",
"private",
"static",
"Node",
"getNode",
"(",
"Document",
"doc",
",",
"String",
"parentNodeName",
",",
"String",
"targetNodeName",
")",
"{",
"NodeList",
"parentElements",
"=",
"doc",
".",
"getElementsByTagNameNS",
"(",
"APP_ENGINE_NAMESPACE",
",",
... | Returns the first node found matching the given name contained within the parent node. | [
"Returns",
"the",
"first",
"node",
"found",
"matching",
"the",
"given",
"name",
"contained",
"within",
"the",
"parent",
"node",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/appengine/AppEngineDescriptor.java#L187-L202 |
cloudiator/flexiant-client | src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java | FlexiantComputeClient.changeServerStatus | protected void changeServerStatus(String serverUUID, ServerStatus status)
throws FlexiantException {
try {
Job job = this.getService().changeServerStatus(serverUUID, status, true, null, null);
this.waitForJob(job);
} catch (ExtilityException e) {
throw new FlexiantException("Could not start server", e);
}
} | java | protected void changeServerStatus(String serverUUID, ServerStatus status)
throws FlexiantException {
try {
Job job = this.getService().changeServerStatus(serverUUID, status, true, null, null);
this.waitForJob(job);
} catch (ExtilityException e) {
throw new FlexiantException("Could not start server", e);
}
} | [
"protected",
"void",
"changeServerStatus",
"(",
"String",
"serverUUID",
",",
"ServerStatus",
"status",
")",
"throws",
"FlexiantException",
"{",
"try",
"{",
"Job",
"job",
"=",
"this",
".",
"getService",
"(",
")",
".",
"changeServerStatus",
"(",
"serverUUID",
",",... | Changes the server status to the given status.
@param serverUUID the id of the server.
@param status the status the server should change to.
@throws FlexiantException | [
"Changes",
"the",
"server",
"status",
"to",
"the",
"given",
"status",
"."
] | train | https://github.com/cloudiator/flexiant-client/blob/30024501a6ae034ea3646f71ec0761c8bc5daa69/src/main/java/de/uniulm/omi/cloudiator/flexiant/client/compute/FlexiantComputeClient.java#L378-L386 |
telly/MrVector | library/src/main/java/com/telly/mrvector/Utils.java | Utils.updateTintFilter | static PorterDuffColorFilter updateTintFilter(Drawable drawable, PorterDuffColorFilter tintFilter, ColorStateList tint,
PorterDuff.Mode tintMode) {
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(drawable.getState(), Color.TRANSPARENT);
if (tintFilter == null || !LOLLIPOP_PLUS) { // TODO worth caching them?
return new PorterDuffColorFilter(color, tintMode);
}
tryInvoke(tintFilter, "setColor", INT_ARG, color);
tryInvoke(tintFilter, "setMode", MODE_ARG, tintMode);
return tintFilter;
} | java | static PorterDuffColorFilter updateTintFilter(Drawable drawable, PorterDuffColorFilter tintFilter, ColorStateList tint,
PorterDuff.Mode tintMode) {
if (tint == null || tintMode == null) {
return null;
}
final int color = tint.getColorForState(drawable.getState(), Color.TRANSPARENT);
if (tintFilter == null || !LOLLIPOP_PLUS) { // TODO worth caching them?
return new PorterDuffColorFilter(color, tintMode);
}
tryInvoke(tintFilter, "setColor", INT_ARG, color);
tryInvoke(tintFilter, "setMode", MODE_ARG, tintMode);
return tintFilter;
} | [
"static",
"PorterDuffColorFilter",
"updateTintFilter",
"(",
"Drawable",
"drawable",
",",
"PorterDuffColorFilter",
"tintFilter",
",",
"ColorStateList",
"tint",
",",
"PorterDuff",
".",
"Mode",
"tintMode",
")",
"{",
"if",
"(",
"tint",
"==",
"null",
"||",
"tintMode",
... | Ensures the tint filter is consistent with the current tint color and
mode. | [
"Ensures",
"the",
"tint",
"filter",
"is",
"consistent",
"with",
"the",
"current",
"tint",
"color",
"and",
"mode",
"."
] | train | https://github.com/telly/MrVector/blob/846cd05ab6e57dcdc1cae28e796ac84b1d6365d5/library/src/main/java/com/telly/mrvector/Utils.java#L111-L126 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipCall.java | SipCall.sendReinvite | public SipTransaction sendReinvite(String newContact, String displayName, String body,
String contentType, String contentSubType) {
return sendReinvite(newContact, displayName, body, contentType, contentSubType, null, null);
} | java | public SipTransaction sendReinvite(String newContact, String displayName, String body,
String contentType, String contentSubType) {
return sendReinvite(newContact, displayName, body, contentType, contentSubType, null, null);
} | [
"public",
"SipTransaction",
"sendReinvite",
"(",
"String",
"newContact",
",",
"String",
"displayName",
",",
"String",
"body",
",",
"String",
"contentType",
",",
"String",
"contentSubType",
")",
"{",
"return",
"sendReinvite",
"(",
"newContact",
",",
"displayName",
... | This method sends a basic RE-INVITE on the current dialog.
<p>
This method returns when the request message has been sent out. The calling program must
subsequently call the waitReinviteResponse() method (one or more times) to get the response(s)
and perhaps the sendReinviteOkAck() method to send an ACK. On the receive side, pertinent
methods include waitForReinvite(), respondToReinvite(), and waitForAck().
@param newContact An URI string (ex: sip:bob@192.0.2.4:5093) for updating the remote target URI
kept by the far end (target refresh), or null to not change that information.
@param displayName Display name to set in the contact header sent to the far end if newContact
is not null.
@param body A String to be used as the body of the message, for changing the media session. Use
null for no body bytes.
@param contentType The body content type (ie, 'application' part of 'application/sdp'),
required if there is to be any content (even if body bytes length 0). Use null for no
message content.
@param contentSubType The body content sub-type (ie, 'sdp' part of 'application/sdp'), required
if there is to be any content (even if body bytes length 0). Use null for no message
content.
@return A SipTransaction object if the message was successfully sent, null otherwise. You don't
need to do anything with this returned object other than to pass it to methods that you
call subsequently for this operation, namely waitReinviteResponse() and
sendReinviteOkAck(). | [
"This",
"method",
"sends",
"a",
"basic",
"RE",
"-",
"INVITE",
"on",
"the",
"current",
"dialog",
".",
"<p",
">",
"This",
"method",
"returns",
"when",
"the",
"request",
"message",
"has",
"been",
"sent",
"out",
".",
"The",
"calling",
"program",
"must",
"sub... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipCall.java#L1762-L1765 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractService.java | AbstractService.notifyFailed | protected final void notifyFailed(Throwable cause) {
checkNotNull(cause);
monitor.enter();
try {
State previous = state();
switch (previous) {
case NEW:
case TERMINATED:
throw new IllegalStateException("Failed while in state:" + previous, cause);
case RUNNING:
case STARTING:
case STOPPING:
snapshot = new StateSnapshot(FAILED, false, cause);
failed(previous, cause);
break;
case FAILED:
// Do nothing
break;
default:
throw new AssertionError("Unexpected state: " + previous);
}
} finally {
monitor.leave();
executeListeners();
}
} | java | protected final void notifyFailed(Throwable cause) {
checkNotNull(cause);
monitor.enter();
try {
State previous = state();
switch (previous) {
case NEW:
case TERMINATED:
throw new IllegalStateException("Failed while in state:" + previous, cause);
case RUNNING:
case STARTING:
case STOPPING:
snapshot = new StateSnapshot(FAILED, false, cause);
failed(previous, cause);
break;
case FAILED:
// Do nothing
break;
default:
throw new AssertionError("Unexpected state: " + previous);
}
} finally {
monitor.leave();
executeListeners();
}
} | [
"protected",
"final",
"void",
"notifyFailed",
"(",
"Throwable",
"cause",
")",
"{",
"checkNotNull",
"(",
"cause",
")",
";",
"monitor",
".",
"enter",
"(",
")",
";",
"try",
"{",
"State",
"previous",
"=",
"state",
"(",
")",
";",
"switch",
"(",
"previous",
... | Invoke this method to transition the service to the {@link State#FAILED}. The service will
<b>not be stopped</b> if it is running. Invoke this method when a service has failed critically
or otherwise cannot be started nor stopped. | [
"Invoke",
"this",
"method",
"to",
"transition",
"the",
"service",
"to",
"the",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractService.java#L403-L429 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/Actions.java | Actions.moveToElement | public Actions moveToElement(WebElement target) {
if (isBuildingActions()) {
action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target));
}
return moveInTicks(target, 0, 0);
} | java | public Actions moveToElement(WebElement target) {
if (isBuildingActions()) {
action.addAction(new MoveMouseAction(jsonMouse, (Locatable) target));
}
return moveInTicks(target, 0, 0);
} | [
"public",
"Actions",
"moveToElement",
"(",
"WebElement",
"target",
")",
"{",
"if",
"(",
"isBuildingActions",
"(",
")",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"MoveMouseAction",
"(",
"jsonMouse",
",",
"(",
"Locatable",
")",
"target",
")",
")",
";... | Moves the mouse to the middle of the element. The element is scrolled into view and its
location is calculated using getBoundingClientRect.
@param target element to move to.
@return A self reference. | [
"Moves",
"the",
"mouse",
"to",
"the",
"middle",
"of",
"the",
"element",
".",
"The",
"element",
"is",
"scrolled",
"into",
"view",
"and",
"its",
"location",
"is",
"calculated",
"using",
"getBoundingClientRect",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/Actions.java#L358-L364 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java | ClassReloadingStrategy.fromInstalledAgent | public static ClassReloadingStrategy fromInstalledAgent() {
try {
return ClassReloadingStrategy.of((Instrumentation) ClassLoader.getSystemClassLoader()
.loadClass(INSTALLER_TYPE)
.getMethod(INSTRUMENTATION_GETTER)
.invoke(STATIC_MEMBER));
} catch (RuntimeException exception) {
throw exception;
} catch (Exception exception) {
throw new IllegalStateException("The Byte Buddy agent is not installed or not accessible", exception);
}
} | java | public static ClassReloadingStrategy fromInstalledAgent() {
try {
return ClassReloadingStrategy.of((Instrumentation) ClassLoader.getSystemClassLoader()
.loadClass(INSTALLER_TYPE)
.getMethod(INSTRUMENTATION_GETTER)
.invoke(STATIC_MEMBER));
} catch (RuntimeException exception) {
throw exception;
} catch (Exception exception) {
throw new IllegalStateException("The Byte Buddy agent is not installed or not accessible", exception);
}
} | [
"public",
"static",
"ClassReloadingStrategy",
"fromInstalledAgent",
"(",
")",
"{",
"try",
"{",
"return",
"ClassReloadingStrategy",
".",
"of",
"(",
"(",
"Instrumentation",
")",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
".",
"loadClass",
"(",
"INSTALLER_TY... | <p>
Obtains a {@link net.bytebuddy.dynamic.loading.ClassReloadingStrategy} from an installed Byte Buddy agent. This
agent must be installed either by adding the {@code byte-buddy-agent.jar} when starting up the JVM by
</p>
<p>
<code>
java -javaagent:byte-buddy-agent.jar -jar app.jar
</code>
</p>
or after the start up using the Attach API. A convenience installer for the OpenJDK is provided by the
{@code ByteBuddyAgent} within the {@code byte-buddy-agent} module. The strategy is determined by the agent's support
for redefinition where are retransformation is preferred over a redefinition.
@return A class reloading strategy which uses the Byte Buddy agent's {@link java.lang.instrument.Instrumentation}. | [
"<p",
">",
"Obtains",
"a",
"{",
"@link",
"net",
".",
"bytebuddy",
".",
"dynamic",
".",
"loading",
".",
"ClassReloadingStrategy",
"}",
"from",
"an",
"installed",
"Byte",
"Buddy",
"agent",
".",
"This",
"agent",
"must",
"be",
"installed",
"either",
"by",
"add... | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassReloadingStrategy.java#L162-L173 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java | DocServiceBuilder.exampleHttpHeaders | public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, HttpHeaders... exampleHttpHeaders) {
requireNonNull(serviceType, "serviceType");
return exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
} | java | public DocServiceBuilder exampleHttpHeaders(Class<?> serviceType, HttpHeaders... exampleHttpHeaders) {
requireNonNull(serviceType, "serviceType");
return exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
} | [
"public",
"DocServiceBuilder",
"exampleHttpHeaders",
"(",
"Class",
"<",
"?",
">",
"serviceType",
",",
"HttpHeaders",
"...",
"exampleHttpHeaders",
")",
"{",
"requireNonNull",
"(",
"serviceType",
",",
"\"serviceType\"",
")",
";",
"return",
"exampleHttpHeaders",
"(",
"... | Adds the example {@link HttpHeaders} for the service with the specified type. This method is
a shortcut to:
<pre>{@code
exampleHttpHeaders(serviceType.getName(), exampleHttpHeaders);
}</pre> | [
"Adds",
"the",
"example",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L84-L87 |
podio/podio-java | src/main/java/com/podio/rating/RatingAPI.java | RatingAPI.getRating | public int getRating(Reference reference, RatingType type, int userId) {
return getResourceFactory()
.getApiResource(
"/rating/" + reference.toURLFragment() + type + "/"
+ userId).get(SingleRatingValue.class)
.getValue();
} | java | public int getRating(Reference reference, RatingType type, int userId) {
return getResourceFactory()
.getApiResource(
"/rating/" + reference.toURLFragment() + type + "/"
+ userId).get(SingleRatingValue.class)
.getValue();
} | [
"public",
"int",
"getRating",
"(",
"Reference",
"reference",
",",
"RatingType",
"type",
",",
"int",
"userId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/rating/\"",
"+",
"reference",
".",
"toURLFragment",
"(",
")",
"+",... | Returns the rating value for the given rating type, object and user.
@param reference
The reference to the object to get ratings for
@param type
The type of rating to return
@param userId
The id of the user for which to return the rating for
@return The value of the rating | [
"Returns",
"the",
"rating",
"value",
"for",
"the",
"given",
"rating",
"type",
"object",
"and",
"user",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/rating/RatingAPI.java#L231-L237 |
p6spy/p6spy | src/main/java/com/p6spy/engine/spy/appender/CustomLineFormat.java | CustomLineFormat.formatMessage | @Override
public String formatMessage(final int connectionId, final String now, final long elapsed, final String category, final String prepared, final String sql, final String url) {
String customLogMessageFormat = P6SpyOptions.getActiveInstance().getCustomLogMessageFormat();
if (customLogMessageFormat == null) {
// Someone forgot to configure customLogMessageFormat: fall back to built-in
return FALLBACK_FORMATTING_STRATEGY.formatMessage(connectionId, now, elapsed, category, prepared, sql, url);
}
return customLogMessageFormat
.replaceAll(Pattern.quote(CONNECTION_ID), Integer.toString(connectionId))
.replaceAll(Pattern.quote(CURRENT_TIME), now)
.replaceAll(Pattern.quote(EXECUTION_TIME), Long.toString(elapsed))
.replaceAll(Pattern.quote(CATEGORY), category)
.replaceAll(Pattern.quote(EFFECTIVE_SQL), Matcher.quoteReplacement(prepared))
.replaceAll(Pattern.quote(EFFECTIVE_SQL_SINGLELINE), Matcher.quoteReplacement(P6Util.singleLine(prepared)))
.replaceAll(Pattern.quote(SQL), Matcher.quoteReplacement(sql))
.replaceAll(Pattern.quote(SQL_SINGLE_LINE), Matcher.quoteReplacement(P6Util.singleLine(sql)))
.replaceAll(Pattern.quote(URL), url);
} | java | @Override
public String formatMessage(final int connectionId, final String now, final long elapsed, final String category, final String prepared, final String sql, final String url) {
String customLogMessageFormat = P6SpyOptions.getActiveInstance().getCustomLogMessageFormat();
if (customLogMessageFormat == null) {
// Someone forgot to configure customLogMessageFormat: fall back to built-in
return FALLBACK_FORMATTING_STRATEGY.formatMessage(connectionId, now, elapsed, category, prepared, sql, url);
}
return customLogMessageFormat
.replaceAll(Pattern.quote(CONNECTION_ID), Integer.toString(connectionId))
.replaceAll(Pattern.quote(CURRENT_TIME), now)
.replaceAll(Pattern.quote(EXECUTION_TIME), Long.toString(elapsed))
.replaceAll(Pattern.quote(CATEGORY), category)
.replaceAll(Pattern.quote(EFFECTIVE_SQL), Matcher.quoteReplacement(prepared))
.replaceAll(Pattern.quote(EFFECTIVE_SQL_SINGLELINE), Matcher.quoteReplacement(P6Util.singleLine(prepared)))
.replaceAll(Pattern.quote(SQL), Matcher.quoteReplacement(sql))
.replaceAll(Pattern.quote(SQL_SINGLE_LINE), Matcher.quoteReplacement(P6Util.singleLine(sql)))
.replaceAll(Pattern.quote(URL), url);
} | [
"@",
"Override",
"public",
"String",
"formatMessage",
"(",
"final",
"int",
"connectionId",
",",
"final",
"String",
"now",
",",
"final",
"long",
"elapsed",
",",
"final",
"String",
"category",
",",
"final",
"String",
"prepared",
",",
"final",
"String",
"sql",
... | Formats a log message for the logging module
@param connectionId the id of the connection
@param now the current ime expressing in milliseconds
@param elapsed the time in milliseconds that the operation took to complete
@param category the category of the operation
@param prepared the SQL statement with all bind variables replaced with actual values
@param sql the sql statement executed
@param url the database url where the sql statement executed
@return the formatted log message | [
"Formats",
"a",
"log",
"message",
"for",
"the",
"logging",
"module"
] | train | https://github.com/p6spy/p6spy/blob/c3c0fecd6e26156eecf90a90901c3c1c8a7dbdf2/src/main/java/com/p6spy/engine/spy/appender/CustomLineFormat.java#L56-L76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.