repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
jenkinsci/jenkins | core/src/main/java/hudson/model/Descriptor.java | Descriptor.newInstance | public T newInstance(@Nullable StaplerRequest req, @Nonnull JSONObject formData) throws FormException {
try {
Method m = getClass().getMethod("newInstance", StaplerRequest.class);
if(!Modifier.isAbstract(m.getDeclaringClass().getModifiers())) {
// this class overrides newInstance(StaplerRequest).
// maintain the backward compatible behavior
return verifyNewInstance(newInstance(req));
} else {
if (req==null) {
// yes, req is supposed to be always non-null, but see the note above
return verifyNewInstance(clazz.newInstance());
}
// new behavior as of 1.206
BindInterceptor oldInterceptor = req.getBindInterceptor();
try {
NewInstanceBindInterceptor interceptor;
if (oldInterceptor instanceof NewInstanceBindInterceptor) {
interceptor = (NewInstanceBindInterceptor) oldInterceptor;
} else {
interceptor = new NewInstanceBindInterceptor(oldInterceptor);
req.setBindInterceptor(interceptor);
}
interceptor.processed.put(formData, true);
return verifyNewInstance(req.bindJSON(clazz, formData));
} finally {
req.setBindInterceptor(oldInterceptor);
}
}
} catch (NoSuchMethodException e) {
throw new AssertionError(e); // impossible
} catch (InstantiationException | IllegalAccessException | RuntimeException e) {
throw new Error("Failed to instantiate "+clazz+" from "+RedactSecretJsonInErrorMessageSanitizer.INSTANCE.sanitize(formData),e);
}
} | java | public T newInstance(@Nullable StaplerRequest req, @Nonnull JSONObject formData) throws FormException {
try {
Method m = getClass().getMethod("newInstance", StaplerRequest.class);
if(!Modifier.isAbstract(m.getDeclaringClass().getModifiers())) {
// this class overrides newInstance(StaplerRequest).
// maintain the backward compatible behavior
return verifyNewInstance(newInstance(req));
} else {
if (req==null) {
// yes, req is supposed to be always non-null, but see the note above
return verifyNewInstance(clazz.newInstance());
}
// new behavior as of 1.206
BindInterceptor oldInterceptor = req.getBindInterceptor();
try {
NewInstanceBindInterceptor interceptor;
if (oldInterceptor instanceof NewInstanceBindInterceptor) {
interceptor = (NewInstanceBindInterceptor) oldInterceptor;
} else {
interceptor = new NewInstanceBindInterceptor(oldInterceptor);
req.setBindInterceptor(interceptor);
}
interceptor.processed.put(formData, true);
return verifyNewInstance(req.bindJSON(clazz, formData));
} finally {
req.setBindInterceptor(oldInterceptor);
}
}
} catch (NoSuchMethodException e) {
throw new AssertionError(e); // impossible
} catch (InstantiationException | IllegalAccessException | RuntimeException e) {
throw new Error("Failed to instantiate "+clazz+" from "+RedactSecretJsonInErrorMessageSanitizer.INSTANCE.sanitize(formData),e);
}
} | [
"public",
"T",
"newInstance",
"(",
"@",
"Nullable",
"StaplerRequest",
"req",
",",
"@",
"Nonnull",
"JSONObject",
"formData",
")",
"throws",
"FormException",
"{",
"try",
"{",
"Method",
"m",
"=",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"newInstance\"",
"... | Creates a configured instance from the submitted form.
<p>
Hudson only invokes this method when the user wants an instance of {@code T}.
So there's no need to check that in the implementation.
<p>
Starting 1.206, the default implementation of this method does the following:
<pre>
req.bindJSON(clazz,formData);
</pre>
<p>
... which performs the databinding on the constructor of {@link #clazz}.
<p>
For some types of {@link Describable}, such as {@link ListViewColumn}, this method
can be invoked with null request object for historical reason. Such design is considered
broken, but due to the compatibility reasons we cannot fix it. Because of this, the
default implementation gracefully handles null request, but the contract of the method
still is "request is always non-null." Extension points that need to define the "default instance"
semantics should define a descriptor subtype and add the no-arg newInstance method.
@param req
Always non-null (see note above.) This object includes represents the entire submission.
@param formData
The JSON object that captures the configuration data for this {@link Descriptor}.
See http://wiki.jenkins-ci.org/display/JENKINS/Structured+Form+Submission
Always non-null.
@throws FormException
Signals a problem in the submitted form.
@since 1.145 | [
"Creates",
"a",
"configured",
"instance",
"from",
"the",
"submitted",
"form",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L571-L606 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java | EmbeddedGobblin.loadCoreGobblinJarsToDistributedJars | private void loadCoreGobblinJarsToDistributedJars() {
// Gobblin-api
distributeJarByClassWithPriority(State.class, 0);
// Gobblin-core
distributeJarByClassWithPriority(ConstructState.class, 0);
// Gobblin-core-base
distributeJarByClassWithPriority(InstrumentedExtractorBase.class, 0);
// Gobblin-metrics-base
distributeJarByClassWithPriority(MetricContext.class, 0);
// Gobblin-metrics
distributeJarByClassWithPriority(GobblinMetrics.class, 0);
// Gobblin-metastore
distributeJarByClassWithPriority(FsStateStore.class, 0);
// Gobblin-runtime
distributeJarByClassWithPriority(Task.class, 0);
// Gobblin-utility
distributeJarByClassWithPriority(PathUtils.class, 0);
// joda-time
distributeJarByClassWithPriority(ReadableInstant.class, 0);
// guava
distributeJarByClassWithPriority(Escaper.class, -10); // Escaper was added in guava 15, so we use it to identify correct jar
// dropwizard.metrics-core
distributeJarByClassWithPriority(MetricFilter.class, 0);
// pegasus
distributeJarByClassWithPriority(DataTemplate.class, 0);
// commons-lang3
distributeJarByClassWithPriority(ClassUtils.class, 0);
// avro
distributeJarByClassWithPriority(SchemaBuilder.class, 0);
// guava-retry
distributeJarByClassWithPriority(RetryListener.class, 0);
// config
distributeJarByClassWithPriority(ConfigFactory.class, 0);
// reflections
distributeJarByClassWithPriority(Reflections.class, 0);
// javassist
distributeJarByClassWithPriority(ClassFile.class, 0);
} | java | private void loadCoreGobblinJarsToDistributedJars() {
// Gobblin-api
distributeJarByClassWithPriority(State.class, 0);
// Gobblin-core
distributeJarByClassWithPriority(ConstructState.class, 0);
// Gobblin-core-base
distributeJarByClassWithPriority(InstrumentedExtractorBase.class, 0);
// Gobblin-metrics-base
distributeJarByClassWithPriority(MetricContext.class, 0);
// Gobblin-metrics
distributeJarByClassWithPriority(GobblinMetrics.class, 0);
// Gobblin-metastore
distributeJarByClassWithPriority(FsStateStore.class, 0);
// Gobblin-runtime
distributeJarByClassWithPriority(Task.class, 0);
// Gobblin-utility
distributeJarByClassWithPriority(PathUtils.class, 0);
// joda-time
distributeJarByClassWithPriority(ReadableInstant.class, 0);
// guava
distributeJarByClassWithPriority(Escaper.class, -10); // Escaper was added in guava 15, so we use it to identify correct jar
// dropwizard.metrics-core
distributeJarByClassWithPriority(MetricFilter.class, 0);
// pegasus
distributeJarByClassWithPriority(DataTemplate.class, 0);
// commons-lang3
distributeJarByClassWithPriority(ClassUtils.class, 0);
// avro
distributeJarByClassWithPriority(SchemaBuilder.class, 0);
// guava-retry
distributeJarByClassWithPriority(RetryListener.class, 0);
// config
distributeJarByClassWithPriority(ConfigFactory.class, 0);
// reflections
distributeJarByClassWithPriority(Reflections.class, 0);
// javassist
distributeJarByClassWithPriority(ClassFile.class, 0);
} | [
"private",
"void",
"loadCoreGobblinJarsToDistributedJars",
"(",
")",
"{",
"// Gobblin-api",
"distributeJarByClassWithPriority",
"(",
"State",
".",
"class",
",",
"0",
")",
";",
"// Gobblin-core",
"distributeJarByClassWithPriority",
"(",
"ConstructState",
".",
"class",
",",... | This returns the set of jars required by a basic Gobblin ingestion job. In general, these need to be distributed
to workers in a distributed environment. | [
"This",
"returns",
"the",
"set",
"of",
"jars",
"required",
"by",
"a",
"basic",
"Gobblin",
"ingestion",
"job",
".",
"In",
"general",
"these",
"need",
"to",
"be",
"distributed",
"to",
"workers",
"in",
"a",
"distributed",
"environment",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java#L545-L582 |
Netflix/conductor | mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java | Query.executeAndFetchFirst | public <V> V executeAndFetchFirst(Class<V> returnType) {
Object o = executeScalar();
if (null == o) {
return null;
}
return convert(o, returnType);
} | java | public <V> V executeAndFetchFirst(Class<V> returnType) {
Object o = executeScalar();
if (null == o) {
return null;
}
return convert(o, returnType);
} | [
"public",
"<",
"V",
">",
"V",
"executeAndFetchFirst",
"(",
"Class",
"<",
"V",
">",
"returnType",
")",
"{",
"Object",
"o",
"=",
"executeScalar",
"(",
")",
";",
"if",
"(",
"null",
"==",
"o",
")",
"{",
"return",
"null",
";",
"}",
"return",
"convert",
... | Execute the statement and return only the first record from the result set.
@param returnType The Class to return.
@param <V> The type parameter.
@return An instance of {@literal <V>} from the result set. | [
"Execute",
"the",
"statement",
"and",
"return",
"only",
"the",
"first",
"record",
"from",
"the",
"result",
"set",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java#L381-L387 |
fuinorg/units4j | src/main/java/org/fuin/units4j/Units4JUtils.java | Units4JUtils.classInfo | public static ClassInfo classInfo(final ClassLoader cl, final String className) {
final Index index = index(cl, className);
return index.getClassByName(DotName.createSimple(className));
} | java | public static ClassInfo classInfo(final ClassLoader cl, final String className) {
final Index index = index(cl, className);
return index.getClassByName(DotName.createSimple(className));
} | [
"public",
"static",
"ClassInfo",
"classInfo",
"(",
"final",
"ClassLoader",
"cl",
",",
"final",
"String",
"className",
")",
"{",
"final",
"Index",
"index",
"=",
"index",
"(",
"cl",
",",
"className",
")",
";",
"return",
"index",
".",
"getClassByName",
"(",
"... | Loads a class by it's name and creates a Jandex class information for it.
@param cl
Class loader to use.
@param className
Full qualified name of the class.
@return Jandex class information. | [
"Loads",
"a",
"class",
"by",
"it",
"s",
"name",
"and",
"creates",
"a",
"Jandex",
"class",
"information",
"for",
"it",
"."
] | train | https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/Units4JUtils.java#L449-L452 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java | IDNA.convertToUnicode | @Deprecated
public static StringBuffer convertToUnicode(UCharacterIterator src, int options)
throws StringPrepParseException{
return IDNA2003.convertToUnicode(src, options);
} | java | @Deprecated
public static StringBuffer convertToUnicode(UCharacterIterator src, int options)
throws StringPrepParseException{
return IDNA2003.convertToUnicode(src, options);
} | [
"@",
"Deprecated",
"public",
"static",
"StringBuffer",
"convertToUnicode",
"(",
"UCharacterIterator",
"src",
",",
"int",
"options",
")",
"throws",
"StringPrepParseException",
"{",
"return",
"IDNA2003",
".",
"convertToUnicode",
"(",
"src",
",",
"options",
")",
";",
... | IDNA2003: Function that implements the ToUnicode operation as defined in the IDNA RFC.
This operation is done on <b>single labels</b> before sending it to something that expects
Unicode names. A label is an individual part of a domain name. Labels are usually
separated by dots; for e.g." "www.example.com" is composed of 3 labels
"www","example", and "com".
@param src The input string as UCharacterIterator to be processed
@param options A bit set of options:
- IDNA.DEFAULT Use default options, i.e., do not process unassigned code points
and do not use STD3 ASCII rules
If unassigned code points are found the operation fails with
ParseException.
- IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
If this option is set, the unassigned code points are in the input
are treated as normal Unicode code points.
- IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
If this option is set and the input does not satisfy STD3 rules,
the operation will fail with ParseException
@return StringBuffer the converted String
@deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}.
@hide original deprecated declaration | [
"IDNA2003",
":",
"Function",
"that",
"implements",
"the",
"ToUnicode",
"operation",
"as",
"defined",
"in",
"the",
"IDNA",
"RFC",
".",
"This",
"operation",
"is",
"done",
"on",
"<b",
">",
"single",
"labels<",
"/",
"b",
">",
"before",
"sending",
"it",
"to",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java#L747-L751 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/CloseableThreadContext.java | CloseableThreadContext.putAll | public static CloseableThreadContext.Instance putAll(final Map<String, String> values) {
return new CloseableThreadContext.Instance().putAll(values);
} | java | public static CloseableThreadContext.Instance putAll(final Map<String, String> values) {
return new CloseableThreadContext.Instance().putAll(values);
} | [
"public",
"static",
"CloseableThreadContext",
".",
"Instance",
"putAll",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"return",
"new",
"CloseableThreadContext",
".",
"Instance",
"(",
")",
".",
"putAll",
"(",
"values",
")",
";",... | Populates the Thread Context Map with the supplied key/value pairs. Any existing keys in the
{@link ThreadContext} will be replaced with the supplied values, and restored back to their original value when
the instance is closed.
@param values The map of key/value pairs to be added
@return a new instance that will back out the changes when closed.
@since 2.8 | [
"Populates",
"the",
"Thread",
"Context",
"Map",
"with",
"the",
"supplied",
"key",
"/",
"value",
"pairs",
".",
"Any",
"existing",
"keys",
"in",
"the",
"{",
"@link",
"ThreadContext",
"}",
"will",
"be",
"replaced",
"with",
"the",
"supplied",
"values",
"and",
... | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/CloseableThreadContext.java#L99-L101 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java | InsertAllRequest.newBuilder | public static Builder newBuilder(TableId table, RowToInsert... rows) {
return newBuilder(table, ImmutableList.copyOf(rows));
} | java | public static Builder newBuilder(TableId table, RowToInsert... rows) {
return newBuilder(table, ImmutableList.copyOf(rows));
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"TableId",
"table",
",",
"RowToInsert",
"...",
"rows",
")",
"{",
"return",
"newBuilder",
"(",
"table",
",",
"ImmutableList",
".",
"copyOf",
"(",
"rows",
")",
")",
";",
"}"
] | Returns a builder for an {@code InsertAllRequest} object given the destination table and the
rows to insert. | [
"Returns",
"a",
"builder",
"for",
"an",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/InsertAllRequest.java#L351-L353 |
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/xml/ReadDocumentPhrase.java | ReadDocumentPhrase.loadDocument | protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver);
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize();
return rslt;
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
}
} | java | protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver);
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize();
return rslt;
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
}
} | [
"protected",
"Element",
"loadDocument",
"(",
"String",
"ctx_str",
",",
"String",
"loc_str",
",",
"EntityResolver",
"resolver",
")",
"{",
"try",
"{",
"final",
"URL",
"ctx",
"=",
"new",
"URL",
"(",
"ctx_str",
")",
";",
"final",
"URL",
"doc",
"=",
"new",
"U... | Loads a DOM4J document from the specified contact and location and returns the root Element | [
"Loads",
"a",
"DOM4J",
"document",
"from",
"the",
"specified",
"contact",
"and",
"location",
"and",
"returns",
"the",
"root",
"Element"
] | train | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/xml/ReadDocumentPhrase.java#L98-L120 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.callSetter | public static void callSetter(Object obj, String prop, Object value) throws PageException {
try {
getSetter(obj, prop, value).invoke(obj);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | public static void callSetter(Object obj, String prop, Object value) throws PageException {
try {
getSetter(obj, prop, value).invoke(obj);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"public",
"static",
"void",
"callSetter",
"(",
"Object",
"obj",
",",
"String",
"prop",
",",
"Object",
"value",
")",
"throws",
"PageException",
"{",
"try",
"{",
"getSetter",
"(",
"obj",
",",
"prop",
",",
"value",
")",
".",
"invoke",
"(",
"obj",
")",
";"... | to invoke a setter Method of a Object
@param obj Object to invoke method from
@param prop Name of the Method without get
@param value Value to set to the Method
@throws PageException | [
"to",
"invoke",
"a",
"setter",
"Method",
"of",
"a",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1074-L1086 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <R> Func0<Observable<R>> toAsyncThrowing(Callable<? extends R> func) {
return toAsyncThrowing(func, Schedulers.computation());
} | java | public static <R> Func0<Observable<R>> toAsyncThrowing(Callable<? extends R> func) {
return toAsyncThrowing(func, Schedulers.computation());
} | [
"public",
"static",
"<",
"R",
">",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"Callable",
"<",
"?",
"extends",
"R",
">",
"func",
")",
"{",
"return",
"toAsyncThrowing",
"(",
"func",
",",
"Schedulers",
".",
"computation",
"(",
... | Convert a synchronous callable call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt="">
@param <R> the result value type
@param func the callable to convert
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229182.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"callable",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L176-L178 |
knowm/XChange | xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java | CexIOAdapters.adaptTrade | public static Trade adaptTrade(CexIOTrade trade, CurrencyPair currencyPair) {
BigDecimal amount = trade.getAmount();
BigDecimal price = trade.getPrice();
Date date = DateUtils.fromMillisUtc(trade.getDate() * 1000L);
OrderType type = trade.getType().equals(ORDER_TYPE_BUY) ? OrderType.BID : OrderType.ASK;
return new Trade(type, amount, currencyPair, price, date, String.valueOf(trade.getTid()));
} | java | public static Trade adaptTrade(CexIOTrade trade, CurrencyPair currencyPair) {
BigDecimal amount = trade.getAmount();
BigDecimal price = trade.getPrice();
Date date = DateUtils.fromMillisUtc(trade.getDate() * 1000L);
OrderType type = trade.getType().equals(ORDER_TYPE_BUY) ? OrderType.BID : OrderType.ASK;
return new Trade(type, amount, currencyPair, price, date, String.valueOf(trade.getTid()));
} | [
"public",
"static",
"Trade",
"adaptTrade",
"(",
"CexIOTrade",
"trade",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"BigDecimal",
"amount",
"=",
"trade",
".",
"getAmount",
"(",
")",
";",
"BigDecimal",
"price",
"=",
"trade",
".",
"getPrice",
"(",
")",
";",
... | Adapts a CexIOTrade to a Trade Object
@param trade CexIO trade object
@param currencyPair trade currencies
@return The XChange Trade | [
"Adapts",
"a",
"CexIOTrade",
"to",
"a",
"Trade",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java#L46-L53 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/persister/impl/BiDirectionalAssociationHelper.java | BiDirectionalAssociationHelper.isCollectionMatching | private static boolean isCollectionMatching(Joinable mainSideJoinable, OgmCollectionPersister inverseSidePersister) {
boolean isSameTable = mainSideJoinable.getTableName().equals( inverseSidePersister.getTableName() );
if ( !isSameTable ) {
return false;
}
return Arrays.equals( mainSideJoinable.getKeyColumnNames(), inverseSidePersister.getElementColumnNames() );
} | java | private static boolean isCollectionMatching(Joinable mainSideJoinable, OgmCollectionPersister inverseSidePersister) {
boolean isSameTable = mainSideJoinable.getTableName().equals( inverseSidePersister.getTableName() );
if ( !isSameTable ) {
return false;
}
return Arrays.equals( mainSideJoinable.getKeyColumnNames(), inverseSidePersister.getElementColumnNames() );
} | [
"private",
"static",
"boolean",
"isCollectionMatching",
"(",
"Joinable",
"mainSideJoinable",
",",
"OgmCollectionPersister",
"inverseSidePersister",
")",
"{",
"boolean",
"isSameTable",
"=",
"mainSideJoinable",
".",
"getTableName",
"(",
")",
".",
"equals",
"(",
"inverseSi... | Checks whether table name and key column names of the given joinable and inverse collection persister match. | [
"Checks",
"whether",
"table",
"name",
"and",
"key",
"column",
"names",
"of",
"the",
"given",
"joinable",
"and",
"inverse",
"collection",
"persister",
"match",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/persister/impl/BiDirectionalAssociationHelper.java#L160-L168 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java | XmlReader.readInteger | public int readInteger(int defaultValue, String attribute)
{
return Integer.parseInt(getValue(String.valueOf(defaultValue), attribute));
} | java | public int readInteger(int defaultValue, String attribute)
{
return Integer.parseInt(getValue(String.valueOf(defaultValue), attribute));
} | [
"public",
"int",
"readInteger",
"(",
"int",
"defaultValue",
",",
"String",
"attribute",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"getValue",
"(",
"String",
".",
"valueOf",
"(",
"defaultValue",
")",
",",
"attribute",
")",
")",
";",
"}"
] | Read an integer.
@param defaultValue The value returned if attribute not found.
@param attribute The integer name (must not be <code>null</code>).
@return The integer value.
@throws LionEngineException If invalid argument. | [
"Read",
"an",
"integer",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L210-L213 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/ConnectionHandle.java | ConnectionHandle.getProxyTarget | public Object getProxyTarget(){
try {
return Proxy.getInvocationHandler(this.connection).invoke(null, this.getClass().getMethod("getProxyTarget"), null);
} catch (Throwable t) {
throw new RuntimeException("BoneCP: Internal error - transaction replay log is not turned on?", t);
}
} | java | public Object getProxyTarget(){
try {
return Proxy.getInvocationHandler(this.connection).invoke(null, this.getClass().getMethod("getProxyTarget"), null);
} catch (Throwable t) {
throw new RuntimeException("BoneCP: Internal error - transaction replay log is not turned on?", t);
}
} | [
"public",
"Object",
"getProxyTarget",
"(",
")",
"{",
"try",
"{",
"return",
"Proxy",
".",
"getInvocationHandler",
"(",
"this",
".",
"connection",
")",
".",
"invoke",
"(",
"null",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"getProxyTarg... | This method will be intercepted by the proxy if it is enabled to return the internal target.
@return the target. | [
"This",
"method",
"will",
"be",
"intercepted",
"by",
"the",
"proxy",
"if",
"it",
"is",
"enabled",
"to",
"return",
"the",
"internal",
"target",
"."
] | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/ConnectionHandle.java#L1611-L1617 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.interpolationsDisagree | private boolean interpolationsDisagree(TrackPositionUpdate lastUpdate, TrackPositionUpdate currentUpdate) {
long now = System.nanoTime();
return Math.abs(interpolateTimeSinceUpdate(lastUpdate, now) - interpolateTimeSinceUpdate(currentUpdate, now)) >
slack.get();
} | java | private boolean interpolationsDisagree(TrackPositionUpdate lastUpdate, TrackPositionUpdate currentUpdate) {
long now = System.nanoTime();
return Math.abs(interpolateTimeSinceUpdate(lastUpdate, now) - interpolateTimeSinceUpdate(currentUpdate, now)) >
slack.get();
} | [
"private",
"boolean",
"interpolationsDisagree",
"(",
"TrackPositionUpdate",
"lastUpdate",
",",
"TrackPositionUpdate",
"currentUpdate",
")",
"{",
"long",
"now",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"return",
"Math",
".",
"abs",
"(",
"interpolateTimeSinceUpd... | Check whether we have diverged from what we would predict from the last update that was sent to a particular
track position listener.
@param lastUpdate the last update that was sent to the listener
@param currentUpdate the latest update available for the same player
@return {@code true }if the listener will have diverged by more than our permitted amount of slack, and so
should be updated | [
"Check",
"whether",
"we",
"have",
"diverged",
"from",
"what",
"we",
"would",
"predict",
"from",
"the",
"last",
"update",
"that",
"was",
"sent",
"to",
"a",
"particular",
"track",
"position",
"listener",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L363-L367 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java | BoxApiMetadata.getAddMetadataRequest | @Deprecated
public BoxRequestsMetadata.AddFileMetadata getAddMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) {
return getAddFileMetadataRequest(id, values, scope, template);
} | java | @Deprecated
public BoxRequestsMetadata.AddFileMetadata getAddMetadataRequest(String id, LinkedHashMap<String, Object> values, String scope, String template) {
return getAddFileMetadataRequest(id, values, scope, template);
} | [
"@",
"Deprecated",
"public",
"BoxRequestsMetadata",
".",
"AddFileMetadata",
"getAddMetadataRequest",
"(",
"String",
"id",
",",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"values",
",",
"String",
"scope",
",",
"String",
"template",
")",
"{",
"return",
"g... | Gets a request that adds metadata to a file
@param id id of the file to add metadata to
@param values mapping of the template keys to their values
@param scope currently only global and enterprise scopes are supported
@param template metadata template to use
@return request to add metadata to a file | [
"Gets",
"a",
"request",
"that",
"adds",
"metadata",
"to",
"a",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L99-L102 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java | L3ToSBGNPDConverter.createComplexContent | private void createComplexContent(Complex cx, Glyph cg)
{
if (flattenComplexContent)
{
for (PhysicalEntity mem : getFlattenedMembers(cx))
{
createComplexMember(mem, cg);
}
}
else {
for (PhysicalEntity mem : cx.getComponent())
{
if (mem instanceof Complex)
{
addComplexAsMember((Complex) mem, cg);
}
else
{
createComplexMember(mem, cg);
}
}
}
} | java | private void createComplexContent(Complex cx, Glyph cg)
{
if (flattenComplexContent)
{
for (PhysicalEntity mem : getFlattenedMembers(cx))
{
createComplexMember(mem, cg);
}
}
else {
for (PhysicalEntity mem : cx.getComponent())
{
if (mem instanceof Complex)
{
addComplexAsMember((Complex) mem, cg);
}
else
{
createComplexMember(mem, cg);
}
}
}
} | [
"private",
"void",
"createComplexContent",
"(",
"Complex",
"cx",
",",
"Glyph",
"cg",
")",
"{",
"if",
"(",
"flattenComplexContent",
")",
"{",
"for",
"(",
"PhysicalEntity",
"mem",
":",
"getFlattenedMembers",
"(",
"cx",
")",
")",
"{",
"createComplexMember",
"(",
... | /*
Fills in the content of a complex.
@param cx Complex to be filled
@param cg its glyph | [
"/",
"*",
"Fills",
"in",
"the",
"content",
"of",
"a",
"complex",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L537-L559 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Completable.java | Completable.doOnEvent | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable doOnEvent(final Consumer<? super Throwable> onEvent) {
ObjectHelper.requireNonNull(onEvent, "onEvent is null");
return RxJavaPlugins.onAssembly(new CompletableDoOnEvent(this, onEvent));
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Completable doOnEvent(final Consumer<? super Throwable> onEvent) {
ObjectHelper.requireNonNull(onEvent, "onEvent is null");
return RxJavaPlugins.onAssembly(new CompletableDoOnEvent(this, onEvent));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Completable",
"doOnEvent",
"(",
"final",
"Consumer",
"<",
"?",
"super",
"Throwable",
">",
"onEvent",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
... | Returns a Completable which calls the given onEvent callback with the (throwable) for an onError
or (null) for an onComplete signal from this Completable before delivering said signal to the downstream.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.doOnEvent.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code doOnEvent} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param onEvent the event callback
@return the new Completable instance
@throws NullPointerException if onEvent is null | [
"Returns",
"a",
"Completable",
"which",
"calls",
"the",
"given",
"onEvent",
"callback",
"with",
"the",
"(",
"throwable",
")",
"for",
"an",
"onError",
"or",
"(",
"null",
")",
"for",
"an",
"onComplete",
"signal",
"from",
"this",
"Completable",
"before",
"deliv... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1467-L1472 |
oehf/ipf-oht-atna | auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java | XDSRepositoryAuditor.auditRetrieveDocumentSetEvent | public void auditRetrieveDocumentSetEvent(
RFC3881EventOutcomeCodes eventOutcome,
String consumerUserId, String consumerUserName, String consumerIpAddress,
String repositoryEndpointUri,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
exportEvent.addDestinationActiveParticipant(consumerUserId, null, consumerUserName, consumerIpAddress, true);
if (! EventUtils.isEmptyOrNull(consumerUserName)) {
exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, userRoles);
}
//exportEvent.addPatientParticipantObject(patientId);
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(exportEvent);
} | java | public void auditRetrieveDocumentSetEvent(
RFC3881EventOutcomeCodes eventOutcome,
String consumerUserId, String consumerUserName, String consumerIpAddress,
String repositoryEndpointUri,
String[] documentUniqueIds, String[] repositoryUniqueIds, String[] homeCommunityIds,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
ExportEvent exportEvent = new ExportEvent(true, eventOutcome, new IHETransactionEventTypeCodes.RetrieveDocumentSet(), purposesOfUse);
exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId());
exportEvent.addSourceActiveParticipant(repositoryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false);
exportEvent.addDestinationActiveParticipant(consumerUserId, null, consumerUserName, consumerIpAddress, true);
if (! EventUtils.isEmptyOrNull(consumerUserName)) {
exportEvent.addHumanRequestorActiveParticipant(consumerUserName, null, consumerUserName, userRoles);
}
//exportEvent.addPatientParticipantObject(patientId);
if (!EventUtils.isEmptyOrNull(documentUniqueIds)) {
for (int i=0; i<documentUniqueIds.length; i++) {
exportEvent.addDocumentParticipantObject(documentUniqueIds[i], repositoryUniqueIds[i], homeCommunityIds[i]);
}
}
audit(exportEvent);
} | [
"public",
"void",
"auditRetrieveDocumentSetEvent",
"(",
"RFC3881EventOutcomeCodes",
"eventOutcome",
",",
"String",
"consumerUserId",
",",
"String",
"consumerUserName",
",",
"String",
"consumerIpAddress",
",",
"String",
"repositoryEndpointUri",
",",
"String",
"[",
"]",
"do... | Audits an ITI-43 Retrieve Document Set-b event for XDS.b Document Repository actors.
Sends audit messages for situations when more than one repository and more than one community are specified in the transaction.
@param eventOutcome The event outcome indicator
@param consumerUserId The Active Participant UserID for the document consumer (if using WS-Addressing)
@param consumerUserName The Active Participant UserName for the document consumer (if using WS-Security / XUA)
@param consumerIpAddress The IP address of the document consumer that initiated the transaction
@param repositoryEndpointUri The Web service endpoint URI for this document repository
@param documentUniqueIds The list of Document Entry UniqueId(s) for the document(s) retrieved
@param repositoryUniqueIds The list of XDS.b Repository Unique Ids involved in this transaction (aligned with Document Unique Ids array)
@param homeCommunityIds The list of XCA Home Community Ids involved in this transaction (aligned with Document Unique Ids array)
@param purposesOfUse purpose of use codes (may be taken from XUA token)
@param userRoles roles of the human user (may be taken from XUA token) | [
"Audits",
"an",
"ITI",
"-",
"43",
"Retrieve",
"Document",
"Set",
"-",
"b",
"event",
"for",
"XDS",
".",
"b",
"Document",
"Repository",
"actors",
".",
"Sends",
"audit",
"messages",
"for",
"situations",
"when",
"more",
"than",
"one",
"repository",
"and",
"mor... | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRepositoryAuditor.java#L326-L352 |
LevelFourAB/commons | commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java | BytesBuilder.createViaLazyDataOutput | @NonNull
static Bytes createViaLazyDataOutput(@NonNull IOConsumer<ExtendedDataOutput> creator, int expectedSize)
{
return new DataOutputBytes(creator, expectedSize);
} | java | @NonNull
static Bytes createViaLazyDataOutput(@NonNull IOConsumer<ExtendedDataOutput> creator, int expectedSize)
{
return new DataOutputBytes(creator, expectedSize);
} | [
"@",
"NonNull",
"static",
"Bytes",
"createViaLazyDataOutput",
"(",
"@",
"NonNull",
"IOConsumer",
"<",
"ExtendedDataOutput",
">",
"creator",
",",
"int",
"expectedSize",
")",
"{",
"return",
"new",
"DataOutputBytes",
"(",
"creator",
",",
"expectedSize",
")",
";",
"... | Create an instance of {@link Bytes} that is created lazily and is of
the expected size.
@param creator
the creator of byte data
@param expectedSize
the expected size of the created byte data, used to allocate memory
for the data
@return
instance of bytes | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"Bytes",
"}",
"that",
"is",
"created",
"lazily",
"and",
"is",
"of",
"the",
"expected",
"size",
"."
] | train | https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-io/src/main/java/se/l4/commons/io/BytesBuilder.java#L90-L94 |
BlueBrain/bluima | modules/bluima_jsre/src/main/java/org/itc/irst/tcc/sre/kernel/expl/AbstractMapping.java | AbstractMapping.map | public VectorSet map(ExampleSet data, FeatureIndex[] index)
throws IllegalArgumentException {
// logger.debug("AbstractMapping.map");
boolean b = (data instanceof SentenceSetCopy);
if (!b) {
throw new IllegalArgumentException();
}
VectorSet result = new VectorSet();
//
for (int i = 0; i < data.size(); i++) {
Object x = data.x(i);
Object y = data.y(i);
Object id = data.id(i);
//
Vector[] subspaces = map(x, id, index);
// merge subspaces
Vector space = mergeSubspaces(subspaces);
// normalize feature space
// space.normalize();
// add space
result.add(space, y, id);
}
return result;
} | java | public VectorSet map(ExampleSet data, FeatureIndex[] index)
throws IllegalArgumentException {
// logger.debug("AbstractMapping.map");
boolean b = (data instanceof SentenceSetCopy);
if (!b) {
throw new IllegalArgumentException();
}
VectorSet result = new VectorSet();
//
for (int i = 0; i < data.size(); i++) {
Object x = data.x(i);
Object y = data.y(i);
Object id = data.id(i);
//
Vector[] subspaces = map(x, id, index);
// merge subspaces
Vector space = mergeSubspaces(subspaces);
// normalize feature space
// space.normalize();
// add space
result.add(space, y, id);
}
return result;
} | [
"public",
"VectorSet",
"map",
"(",
"ExampleSet",
"data",
",",
"FeatureIndex",
"[",
"]",
"index",
")",
"throws",
"IllegalArgumentException",
"{",
"// logger.debug(\"AbstractMapping.map\");",
"boolean",
"b",
"=",
"(",
"data",
"instanceof",
"SentenceSetCopy",
")",
";",
... | /*
protected int maxDimension(SparseVector[] subspaces) { int max = 0; for
(int i=0;i<subspaces.length;i++) { if (subspaces[i].size() > max) max =
subspaces[i].size(); } // end for i
return max; } // end maxDimension | [
"/",
"*",
"protected",
"int",
"maxDimension",
"(",
"SparseVector",
"[]",
"subspaces",
")",
"{",
"int",
"max",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i<subspaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"subspaces",
"[",... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_jsre/src/main/java/org/itc/irst/tcc/sre/kernel/expl/AbstractMapping.java#L76-L106 |
wildfly-swarm-archive/ARCHIVE-wildfly-swarm | batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java | BatchFraction.threadPool | public BatchFraction threadPool(final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
return threadPool(DEFAULT_THREAD_POOL_NAME, maxThreads, keepAliveTime, keepAliveUnits);
} | java | public BatchFraction threadPool(final int maxThreads, final int keepAliveTime, final TimeUnit keepAliveUnits) {
return threadPool(DEFAULT_THREAD_POOL_NAME, maxThreads, keepAliveTime, keepAliveUnits);
} | [
"public",
"BatchFraction",
"threadPool",
"(",
"final",
"int",
"maxThreads",
",",
"final",
"int",
"keepAliveTime",
",",
"final",
"TimeUnit",
"keepAliveUnits",
")",
"{",
"return",
"threadPool",
"(",
"DEFAULT_THREAD_POOL_NAME",
",",
"maxThreads",
",",
"keepAliveTime",
... | Creates a new thread-pool using the {@linkplain #DEFAULT_THREAD_POOL_NAME default name} that can be used for batch jobs.
@param keepAliveTime the time to keep threads alive
@param keepAliveUnits the time unit for the keep alive time
@return this fraction | [
"Creates",
"a",
"new",
"thread",
"-",
"pool",
"using",
"the",
"{",
"@linkplain",
"#DEFAULT_THREAD_POOL_NAME",
"default",
"name",
"}",
"that",
"can",
"be",
"used",
"for",
"batch",
"jobs",
"."
] | train | https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L167-L169 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.stringTemplate | public static StringTemplate stringTemplate(Template template, Object... args) {
return stringTemplate(template, ImmutableList.copyOf(args));
} | java | public static StringTemplate stringTemplate(Template template, Object... args) {
return stringTemplate(template, ImmutableList.copyOf(args));
} | [
"public",
"static",
"StringTemplate",
"stringTemplate",
"(",
"Template",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"stringTemplate",
"(",
"template",
",",
"ImmutableList",
".",
"copyOf",
"(",
"args",
")",
")",
";",
"}"
] | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L924-L926 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/QuickReplyFactory.java | QuickReplyFactory.createQuickReplyLocation | public static QuickReply createQuickReplyLocation(String title,
String payload, String imageUrl) {
return new QuickReply(title, payload, imageUrl);
} | java | public static QuickReply createQuickReplyLocation(String title,
String payload, String imageUrl) {
return new QuickReply(title, payload, imageUrl);
} | [
"public",
"static",
"QuickReply",
"createQuickReplyLocation",
"(",
"String",
"title",
",",
"String",
"payload",
",",
"String",
"imageUrl",
")",
"{",
"return",
"new",
"QuickReply",
"(",
"title",
",",
"payload",
",",
"imageUrl",
")",
";",
"}"
] | Creates a {@link QuickReply} with a location.
@param title
the {@link QuickReply#title}.
@param payload
the {@link QuickReply#payload}.
@param imageUrl
the {@link QuickReply#imageUrl}.
@return a {@link QuickReply} object. | [
"Creates",
"a",
"{",
"@link",
"QuickReply",
"}",
"with",
"a",
"location",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/QuickReplyFactory.java#L77-L80 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.addCrossFriends | public ResponseWrapper addCrossFriends(String username, CrossFriendPayload payload)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossFriends(username, payload);
} | java | public ResponseWrapper addCrossFriends(String username, CrossFriendPayload payload)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossFriends(username, payload);
} | [
"public",
"ResponseWrapper",
"addCrossFriends",
"(",
"String",
"username",
",",
"CrossFriendPayload",
"payload",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_crossAppClient",
".",
"addCrossFriends",
"(",
"username",
",",
"payload",... | Add users from cross app.
@param username Necessary
@param payload CrossFriendPayload
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"users",
"from",
"cross",
"app",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L671-L674 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java | TokenStream.consumeInteger | public int consumeInteger() throws ParsingException, IllegalStateException {
if (completed) throwNoMoreContent();
// Get the value from the current token ...
String value = currentToken().value();
try {
int result = Integer.parseInt(value);
moveToNextToken();
return result;
} catch (NumberFormatException e) {
Position position = currentToken().position();
String msg = CommonI18n.expectingValidIntegerAtLineAndColumn.text(value, position.getLine(), position.getColumn());
throw new ParsingException(position, msg);
}
} | java | public int consumeInteger() throws ParsingException, IllegalStateException {
if (completed) throwNoMoreContent();
// Get the value from the current token ...
String value = currentToken().value();
try {
int result = Integer.parseInt(value);
moveToNextToken();
return result;
} catch (NumberFormatException e) {
Position position = currentToken().position();
String msg = CommonI18n.expectingValidIntegerAtLineAndColumn.text(value, position.getLine(), position.getColumn());
throw new ParsingException(position, msg);
}
} | [
"public",
"int",
"consumeInteger",
"(",
")",
"throws",
"ParsingException",
",",
"IllegalStateException",
"{",
"if",
"(",
"completed",
")",
"throwNoMoreContent",
"(",
")",
";",
"// Get the value from the current token ...",
"String",
"value",
"=",
"currentToken",
"(",
... | Convert the value of this token to an integer, return it, and move to the next token.
@return the current token's value, converted to an integer
@throws ParsingException if there is no such token to consume, or if the token cannot be converted to an integer
@throws IllegalStateException if this method was called before the stream was {@link #start() started} | [
"Convert",
"the",
"value",
"of",
"this",
"token",
"to",
"an",
"integer",
"return",
"it",
"and",
"move",
"to",
"the",
"next",
"token",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java#L480-L493 |
broadinstitute/barclay | src/main/java/org/broadinstitute/barclay/utils/Utils.java | Utils.prettyPrintWarningMessage | private static void prettyPrintWarningMessage(final List<String> results, final String message) {
for (final String line: message.split("\\r?\\n")) {
final StringBuilder builder = new StringBuilder(line);
while (builder.length() > TEXT_WARNING_WIDTH) {
int space = getLastSpace(builder, TEXT_WARNING_WIDTH);
if (space <= 0) space = TEXT_WARNING_WIDTH;
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder.substring(0, space)));
builder.delete(0, space + 1);
}
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder));
}
} | java | private static void prettyPrintWarningMessage(final List<String> results, final String message) {
for (final String line: message.split("\\r?\\n")) {
final StringBuilder builder = new StringBuilder(line);
while (builder.length() > TEXT_WARNING_WIDTH) {
int space = getLastSpace(builder, TEXT_WARNING_WIDTH);
if (space <= 0) space = TEXT_WARNING_WIDTH;
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder.substring(0, space)));
builder.delete(0, space + 1);
}
results.add(String.format("%s%s", TEXT_WARNING_PREFIX, builder));
}
} | [
"private",
"static",
"void",
"prettyPrintWarningMessage",
"(",
"final",
"List",
"<",
"String",
">",
"results",
",",
"final",
"String",
"message",
")",
"{",
"for",
"(",
"final",
"String",
"line",
":",
"message",
".",
"split",
"(",
"\"\\\\r?\\\\n\"",
")",
")",... | pretty print the warning message supplied
@param results the pretty printed message
@param message the message | [
"pretty",
"print",
"the",
"warning",
"message",
"supplied"
] | train | https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/utils/Utils.java#L79-L90 |
ehcache/ehcache3 | core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java | ServiceUtils.findSingletonAmongst | public static <T> T findSingletonAmongst(Class<T> clazz, Collection<?> instances) {
return findOptionalAmongst(clazz, instances)
.orElse(null);
} | java | public static <T> T findSingletonAmongst(Class<T> clazz, Collection<?> instances) {
return findOptionalAmongst(clazz, instances)
.orElse(null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findSingletonAmongst",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Collection",
"<",
"?",
">",
"instances",
")",
"{",
"return",
"findOptionalAmongst",
"(",
"clazz",
",",
"instances",
")",
".",
"orElse",
"(",
"null... | Find the only expected instance of {@code clazz} among the {@code instances}.
@param clazz searched class
@param instances instances looked at
@param <T> type of the searched instance
@return the compatible instance or null if none are found
@throws IllegalArgumentException if more than one matching instance | [
"Find",
"the",
"only",
"expected",
"instance",
"of",
"{",
"@code",
"clazz",
"}",
"among",
"the",
"{",
"@code",
"instances",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java#L75-L78 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java | CommonOps_ZDRM.stripReal | public static DMatrixRMaj stripReal(ZMatrixD1 input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,input.numCols);
} else if( input.numCols != output.numCols || input.numRows != output.numRows ) {
throw new IllegalArgumentException("The matrices are not all the same dimension.");
}
final int length = input.getDataLength();
for( int i = 0; i < length; i += 2 ) {
output.data[i/2] = input.data[i];
}
return output;
} | java | public static DMatrixRMaj stripReal(ZMatrixD1 input , DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,input.numCols);
} else if( input.numCols != output.numCols || input.numRows != output.numRows ) {
throw new IllegalArgumentException("The matrices are not all the same dimension.");
}
final int length = input.getDataLength();
for( int i = 0; i < length; i += 2 ) {
output.data[i/2] = input.data[i];
}
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"stripReal",
"(",
"ZMatrixD1",
"input",
",",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"input",
".",
"numRows",
",",
"input",
".",
"numCols",... | Places the real component of the input matrix into the output matrix.
@param input Complex matrix. Not modified.
@param output real matrix. Modified. | [
"Places",
"the",
"real",
"component",
"of",
"the",
"input",
"matrix",
"into",
"the",
"output",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L164-L177 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java | KerasRnnUtils.getRecurrentDropout | public static double getRecurrentDropout(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
double dropout = 1.0;
if (innerConfig.containsKey(conf.getLAYER_FIELD_DROPOUT_U()))
try {
dropout = 1.0 - (double) innerConfig.get(conf.getLAYER_FIELD_DROPOUT_U());
} catch (Exception e) {
int kerasDropout = (int) innerConfig.get(conf.getLAYER_FIELD_DROPOUT_U());
dropout = 1.0 - (double) kerasDropout;
}
if (dropout < 1.0)
throw new UnsupportedKerasConfigurationException(
"Dropout > 0 on recurrent connections not supported.");
return dropout;
} | java | public static double getRecurrentDropout(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
double dropout = 1.0;
if (innerConfig.containsKey(conf.getLAYER_FIELD_DROPOUT_U()))
try {
dropout = 1.0 - (double) innerConfig.get(conf.getLAYER_FIELD_DROPOUT_U());
} catch (Exception e) {
int kerasDropout = (int) innerConfig.get(conf.getLAYER_FIELD_DROPOUT_U());
dropout = 1.0 - (double) kerasDropout;
}
if (dropout < 1.0)
throw new UnsupportedKerasConfigurationException(
"Dropout > 0 on recurrent connections not supported.");
return dropout;
} | [
"public",
"static",
"double",
"getRecurrentDropout",
"(",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"UnsupportedKerasConfigurationException",
",",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
... | Get recurrent weight dropout from Keras layer configuration.
Non-zero dropout rates are currently not supported.
@param conf KerasLayerConfiguration
@param layerConfig dictionary containing Keras layer properties
@return recurrent dropout rate
@throws InvalidKerasConfigurationException Invalid Keras configuration | [
"Get",
"recurrent",
"weight",
"dropout",
"from",
"Keras",
"layer",
"configuration",
".",
"Non",
"-",
"zero",
"dropout",
"rates",
"are",
"currently",
"not",
"supported",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java#L59-L74 |
aws/aws-sdk-java | aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/HadoopStepConfig.java | HadoopStepConfig.withProperties | public HadoopStepConfig withProperties(java.util.Map<String, String> properties) {
setProperties(properties);
return this;
} | java | public HadoopStepConfig withProperties(java.util.Map<String, String> properties) {
setProperties(properties);
return this;
} | [
"public",
"HadoopStepConfig",
"withProperties",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"setProperties",
"(",
"properties",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The list of Java properties that are set when the step runs. You can use these properties to pass key value pairs
to your main function.
</p>
@param properties
The list of Java properties that are set when the step runs. You can use these properties to pass key
value pairs to your main function.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"list",
"of",
"Java",
"properties",
"that",
"are",
"set",
"when",
"the",
"step",
"runs",
".",
"You",
"can",
"use",
"these",
"properties",
"to",
"pass",
"key",
"value",
"pairs",
"to",
"your",
"main",
"function",
".",
"<",
"/",
"p",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/model/HadoopStepConfig.java#L143-L146 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/Record.java | Record.removeListener | public void removeListener(BaseListener theBehavior, boolean bFreeBehavior)
{
if (m_listener != null)
{
if (m_listener == theBehavior)
{
m_listener = (FileListener)theBehavior.getNextListener();
theBehavior.unlink(bFreeBehavior); // remove theBehavior from the linked list
}
else
m_listener.removeListener(theBehavior, bFreeBehavior);
}
} | java | public void removeListener(BaseListener theBehavior, boolean bFreeBehavior)
{
if (m_listener != null)
{
if (m_listener == theBehavior)
{
m_listener = (FileListener)theBehavior.getNextListener();
theBehavior.unlink(bFreeBehavior); // remove theBehavior from the linked list
}
else
m_listener.removeListener(theBehavior, bFreeBehavior);
}
} | [
"public",
"void",
"removeListener",
"(",
"BaseListener",
"theBehavior",
",",
"boolean",
"bFreeBehavior",
")",
"{",
"if",
"(",
"m_listener",
"!=",
"null",
")",
"{",
"if",
"(",
"m_listener",
"==",
"theBehavior",
")",
"{",
"m_listener",
"=",
"(",
"FileListener",
... | Remove a listener from the chain.
@param theBehavior Listener or Filter to add to this record.
@param bFreeBehavior Free the behavior. | [
"Remove",
"a",
"listener",
"from",
"the",
"chain",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L456-L468 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Link.java | Link.distance2 | public float distance2(float tx, float ty) {
float dx = tx - px;
float dy = ty - py;
return ((dx*dx) + (dy*dy));
} | java | public float distance2(float tx, float ty) {
float dx = tx - px;
float dy = ty - py;
return ((dx*dx) + (dy*dy));
} | [
"public",
"float",
"distance2",
"(",
"float",
"tx",
",",
"float",
"ty",
")",
"{",
"float",
"dx",
"=",
"tx",
"-",
"px",
";",
"float",
"dy",
"=",
"ty",
"-",
"py",
";",
"return",
"(",
"(",
"dx",
"*",
"dx",
")",
"+",
"(",
"dy",
"*",
"dy",
")",
... | Get the distance squared from this link to the given position
@param tx The x coordinate of the target location
@param ty The y coordinate of the target location
@return The distance squared from this link to the target | [
"Get",
"the",
"distance",
"squared",
"from",
"this",
"link",
"to",
"the",
"given",
"position"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Link.java#L36-L41 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/StartJobRunRequest.java | StartJobRunRequest.withArguments | public StartJobRunRequest withArguments(java.util.Map<String, String> arguments) {
setArguments(arguments);
return this;
} | java | public StartJobRunRequest withArguments(java.util.Map<String, String> arguments) {
setArguments(arguments);
return this;
} | [
"public",
"StartJobRunRequest",
"withArguments",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"arguments",
")",
"{",
"setArguments",
"(",
"arguments",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The job arguments specifically for this run. For this job run, they replace the default arguments set in the job
definition itself.
</p>
<p>
You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue
itself consumes.
</p>
<p>
For information about how to specify and consume your own Job arguments, see the <a
href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue APIs
in Python</a> topic in the developer guide.
</p>
<p>
For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a
href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special Parameters
Used by AWS Glue</a> topic in the developer guide.
</p>
@param arguments
The job arguments specifically for this run. For this job run, they replace the default arguments set in
the job definition itself.</p>
<p>
You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS
Glue itself consumes.
</p>
<p>
For information about how to specify and consume your own Job arguments, see the <a
href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-calling.html">Calling AWS Glue
APIs in Python</a> topic in the developer guide.
</p>
<p>
For information about the key-value pairs that AWS Glue consumes to set up your job, see the <a
href="http://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html">Special
Parameters Used by AWS Glue</a> topic in the developer guide.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"job",
"arguments",
"specifically",
"for",
"this",
"run",
".",
"For",
"this",
"job",
"run",
"they",
"replace",
"the",
"default",
"arguments",
"set",
"in",
"the",
"job",
"definition",
"itself",
".",
"<",
"/",
"p",
">",
"<p",
">",
"You"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/StartJobRunRequest.java#L361-L364 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.setColumn | public Matrix3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException {
return setColumn(column, src.x(), src.y(), src.z());
} | java | public Matrix3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException {
return setColumn(column, src.x(), src.y(), src.z());
} | [
"public",
"Matrix3f",
"setColumn",
"(",
"int",
"column",
",",
"Vector3fc",
"src",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"return",
"setColumn",
"(",
"column",
",",
"src",
".",
"x",
"(",
")",
",",
"src",
".",
"y",
"(",
")",
",",
"src",
".",
"z... | Set the column at the given <code>column</code> index, starting with <code>0</code>.
@param column
the column index in <code>[0..2]</code>
@param src
the column components to set
@return this
@throws IndexOutOfBoundsException if <code>column</code> is not in <code>[0..2]</code> | [
"Set",
"the",
"column",
"at",
"the",
"given",
"<code",
">",
"column<",
"/",
"code",
">",
"index",
"starting",
"with",
"<code",
">",
"0<",
"/",
"code",
">",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L3325-L3327 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java | ThrottleableTransport.blockUntilUnthrottled | public boolean blockUntilUnthrottled(long timeout, TimeUnit unit) {
// sanity: if there's no latch, don't try to access it
if (blockLatch == null) {
return false;
}
// purposely allow interrupts as a means to let the caller check if it should exit its run loop
try {
return blockLatch.await(timeout, unit);
} catch (InterruptedException e) {
return false;
}
} | java | public boolean blockUntilUnthrottled(long timeout, TimeUnit unit) {
// sanity: if there's no latch, don't try to access it
if (blockLatch == null) {
return false;
}
// purposely allow interrupts as a means to let the caller check if it should exit its run loop
try {
return blockLatch.await(timeout, unit);
} catch (InterruptedException e) {
return false;
}
} | [
"public",
"boolean",
"blockUntilUnthrottled",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"// sanity: if there's no latch, don't try to access it",
"if",
"(",
"blockLatch",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"// purposely allow interrupt... | Blocks until the blockLatch is released or until the timeout is exceeded.
@param timeout the maximum time to wait
@param unit the time unit for the {@code timeout} argument.
@return {@code true} if the blockLatch was released before the {@code timeout} elapsed. and
{@code false} if the {@code timeout} was exceeded before the blockLatch was released. | [
"Blocks",
"until",
"the",
"blockLatch",
"is",
"released",
"or",
"until",
"the",
"timeout",
"is",
"exceeded",
"."
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/inputs/transports/ThrottleableTransport.java#L239-L250 |
alkacon/opencms-core | src/org/opencms/util/CmsMacroResolver.java | CmsMacroResolver.addDynamicMacro | public void addDynamicMacro(String name, Factory factory) {
if (m_factories == null) {
m_factories = new HashMap<String, Factory>();
}
m_factories.put(name, factory);
} | java | public void addDynamicMacro(String name, Factory factory) {
if (m_factories == null) {
m_factories = new HashMap<String, Factory>();
}
m_factories.put(name, factory);
} | [
"public",
"void",
"addDynamicMacro",
"(",
"String",
"name",
",",
"Factory",
"factory",
")",
"{",
"if",
"(",
"m_factories",
"==",
"null",
")",
"{",
"m_factories",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Factory",
">",
"(",
")",
";",
"}",
"m_factories"... | Adds a macro whose value will be dynamically generated at macro resolution time.<p>
The value will be generated for each occurence of the macro in a string.<p>
@param name the name of the macro
@param factory the macro value generator | [
"Adds",
"a",
"macro",
"whose",
"value",
"will",
"be",
"dynamically",
"generated",
"at",
"macro",
"resolution",
"time",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsMacroResolver.java#L777-L783 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java | ProtectedBranchesApi.protectBranch | public ProtectedBranch protectBranch(Integer projectIdOrPath, String branchName, AccessLevel pushAccessLevel, AccessLevel mergeAccessLevel) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("name", branchName, true)
.withParam("push_access_level", pushAccessLevel.toValue(), false)
.withParam("merge_access_level", mergeAccessLevel.toValue(), false);
Response response = post(Response.Status.CREATED, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "protected_branches");
return (response.readEntity(ProtectedBranch.class));
} | java | public ProtectedBranch protectBranch(Integer projectIdOrPath, String branchName, AccessLevel pushAccessLevel, AccessLevel mergeAccessLevel) throws GitLabApiException {
Form formData = new GitLabApiForm()
.withParam("name", branchName, true)
.withParam("push_access_level", pushAccessLevel.toValue(), false)
.withParam("merge_access_level", mergeAccessLevel.toValue(), false);
Response response = post(Response.Status.CREATED, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "protected_branches");
return (response.readEntity(ProtectedBranch.class));
} | [
"public",
"ProtectedBranch",
"protectBranch",
"(",
"Integer",
"projectIdOrPath",
",",
"String",
"branchName",
",",
"AccessLevel",
"pushAccessLevel",
",",
"AccessLevel",
"mergeAccessLevel",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLab... | Protects a single repository branch or several project repository branches using a wildcard protected branch.
<pre><code>GitLab Endpoint: POST /projects/:id/protected_branches</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param branchName the name of the branch to protect
@param pushAccessLevel Access levels allowed to push (defaults: 40, maintainer access level)
@param mergeAccessLevel Access levels allowed to merge (defaults: 40, maintainer access level)
@return the branch info for the protected branch
@throws GitLabApiException if any exception occurs | [
"Protects",
"a",
"single",
"repository",
"branch",
"or",
"several",
"project",
"repository",
"branches",
"using",
"a",
"wildcard",
"protected",
"branch",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProtectedBranchesApi.java#L98-L106 |
weld/core | environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java | Weld.addPackages | public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) {
for (Class<?> packageClass : packageClasses) {
addPackage(scanRecursively, packageClass);
}
return this;
} | java | public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) {
for (Class<?> packageClass : packageClasses) {
addPackage(scanRecursively, packageClass);
}
return this;
} | [
"public",
"Weld",
"addPackages",
"(",
"boolean",
"scanRecursively",
",",
"Class",
"<",
"?",
">",
"...",
"packageClasses",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"packageClass",
":",
"packageClasses",
")",
"{",
"addPackage",
"(",
"scanRecursively",
","... | Packages of the specified classes will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive.
@param scanRecursively
@param packageClasses
@return self | [
"Packages",
"of",
"the",
"specified",
"classes",
"will",
"be",
"scanned",
"and",
"found",
"classes",
"will",
"be",
"added",
"to",
"the",
"set",
"of",
"bean",
"classes",
"for",
"the",
"synthetic",
"bean",
"archive",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L368-L373 |
landawn/AbacusUtil | src/com/landawn/abacus/util/FileSystemUtil.java | FileSystemUtil.parseBytes | long parseBytes(final String freeSpace, final String path) throws IOException {
try {
final long bytes = Long.parseLong(freeSpace);
if (bytes < 0) {
throw new IOException("Command line '" + DF + "' did not find free space in response " + "for path '" + path + "'- check path is valid");
}
return bytes;
} catch (final NumberFormatException ex) {
throw new IOException("Command line '" + DF + "' did not return numeric data as expected " + "for path '" + path + "'- check path is valid", ex);
}
} | java | long parseBytes(final String freeSpace, final String path) throws IOException {
try {
final long bytes = Long.parseLong(freeSpace);
if (bytes < 0) {
throw new IOException("Command line '" + DF + "' did not find free space in response " + "for path '" + path + "'- check path is valid");
}
return bytes;
} catch (final NumberFormatException ex) {
throw new IOException("Command line '" + DF + "' did not return numeric data as expected " + "for path '" + path + "'- check path is valid", ex);
}
} | [
"long",
"parseBytes",
"(",
"final",
"String",
"freeSpace",
",",
"final",
"String",
"path",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"long",
"bytes",
"=",
"Long",
".",
"parseLong",
"(",
"freeSpace",
")",
";",
"if",
"(",
"bytes",
"<",
"0",
... | Parses the bytes from a string.
@param freeSpace the free space string
@param path the path
@return the number of bytes
@throws IOException if an error occurs | [
"Parses",
"the",
"bytes",
"from",
"a",
"string",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/FileSystemUtil.java#L387-L398 |
alkacon/opencms-core | src/org/opencms/i18n/CmsResourceBundleLoader.java | CmsResourceBundleLoader.flushBundleCache | public static void flushBundleCache(String baseName, boolean flushPermanent) {
if (baseName != null) {
synchronized (m_bundleCache) {
// first check and clear the bundle cache
Map<BundleKey, ResourceBundle> bundleCacheNew = new ConcurrentHashMap<BundleKey, ResourceBundle>(
m_bundleCache.size());
for (Map.Entry<BundleKey, ResourceBundle> entry : m_bundleCache.entrySet()) {
if (!entry.getKey().isSameBase(baseName)) {
// entry has a different base name, keep it
bundleCacheNew.put(entry.getKey(), entry.getValue());
}
}
if (bundleCacheNew.size() < m_bundleCache.size()) {
// switch caches if only if at least one entry was removed
m_bundleCache = bundleCacheNew;
}
if (flushPermanent) {
flushPermanentCache(baseName);
}
}
}
} | java | public static void flushBundleCache(String baseName, boolean flushPermanent) {
if (baseName != null) {
synchronized (m_bundleCache) {
// first check and clear the bundle cache
Map<BundleKey, ResourceBundle> bundleCacheNew = new ConcurrentHashMap<BundleKey, ResourceBundle>(
m_bundleCache.size());
for (Map.Entry<BundleKey, ResourceBundle> entry : m_bundleCache.entrySet()) {
if (!entry.getKey().isSameBase(baseName)) {
// entry has a different base name, keep it
bundleCacheNew.put(entry.getKey(), entry.getValue());
}
}
if (bundleCacheNew.size() < m_bundleCache.size()) {
// switch caches if only if at least one entry was removed
m_bundleCache = bundleCacheNew;
}
if (flushPermanent) {
flushPermanentCache(baseName);
}
}
}
} | [
"public",
"static",
"void",
"flushBundleCache",
"(",
"String",
"baseName",
",",
"boolean",
"flushPermanent",
")",
"{",
"if",
"(",
"baseName",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"m_bundleCache",
")",
"{",
"// first check and clear the bundle cache",
"Map",
... | Flushes all variations for the provided bundle from the cache.<p>
@param baseName the bundle base name to flush the variations for
@param flushPermanent if true, the cache for additional message bundles will be flushed, too | [
"Flushes",
"all",
"variations",
"for",
"the",
"provided",
"bundle",
"from",
"the",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsResourceBundleLoader.java#L223-L246 |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSerialApiGetInitDataResponse | private void handleSerialApiGetInitDataResponse(
SerialMessage incomingMessage) {
logger.debug(String.format("Got MessageSerialApiGetInitData response."));
this.isConnected = true;
int nodeBytes = incomingMessage.getMessagePayloadByte(2);
if (nodeBytes != NODE_BYTES) {
logger.error("Invalid number of node bytes = {}", nodeBytes);
return;
}
int nodeId = 1;
// loop bytes
for (int i = 3;i < 3 + nodeBytes;i++) {
int incomingByte = incomingMessage.getMessagePayloadByte(i);
// loop bits in byte
for (int j=0;j<8;j++) {
int b1 = incomingByte & (int)Math.pow(2.0D, j);
int b2 = (int)Math.pow(2.0D, j);
if (b1 == b2) {
logger.info(String.format("Found node id = %d", nodeId));
// Place nodes in the local ZWave Controller
this.zwaveNodes.put(nodeId, new ZWaveNode(this.homeId, nodeId, this));
this.getNode(nodeId).advanceNodeStage();
}
nodeId++;
}
}
logger.info("------------Number of Nodes Found Registered to ZWave Controller------------");
logger.info(String.format("# Nodes = %d", this.zwaveNodes.size()));
logger.info("----------------------------------------------------------------------------");
// Advance node stage for the first node.
} | java | private void handleSerialApiGetInitDataResponse(
SerialMessage incomingMessage) {
logger.debug(String.format("Got MessageSerialApiGetInitData response."));
this.isConnected = true;
int nodeBytes = incomingMessage.getMessagePayloadByte(2);
if (nodeBytes != NODE_BYTES) {
logger.error("Invalid number of node bytes = {}", nodeBytes);
return;
}
int nodeId = 1;
// loop bytes
for (int i = 3;i < 3 + nodeBytes;i++) {
int incomingByte = incomingMessage.getMessagePayloadByte(i);
// loop bits in byte
for (int j=0;j<8;j++) {
int b1 = incomingByte & (int)Math.pow(2.0D, j);
int b2 = (int)Math.pow(2.0D, j);
if (b1 == b2) {
logger.info(String.format("Found node id = %d", nodeId));
// Place nodes in the local ZWave Controller
this.zwaveNodes.put(nodeId, new ZWaveNode(this.homeId, nodeId, this));
this.getNode(nodeId).advanceNodeStage();
}
nodeId++;
}
}
logger.info("------------Number of Nodes Found Registered to ZWave Controller------------");
logger.info(String.format("# Nodes = %d", this.zwaveNodes.size()));
logger.info("----------------------------------------------------------------------------");
// Advance node stage for the first node.
} | [
"private",
"void",
"handleSerialApiGetInitDataResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Got MessageSerialApiGetInitData response.\"",
")",
")",
";",
"this",
".",
"isConnected",
"=",
"tru... | Handles the response of the SerialApiGetInitData request.
@param incomingMlivessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"SerialApiGetInitData",
"request",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L490-L525 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java | CommsDiagnosticModule.ffdcDumpDefault | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "ffdcDumpDefault",
new Object[]{t, is, callerThis, objs, sourceId});
// Dump the SIB information
super.ffdcDumpDefault(t, is, callerThis, objs, sourceId);
is.writeLine("\n= ============= SIB Communications Diagnostic Information =============", "");
is.writeLine("Current Diagnostic Module: ", _instance);
dumpJFapClientStatus(is);
dumpJFapServerStatus(is);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "ffdcDumpDefault");
} | java | public void ffdcDumpDefault(Throwable t, IncidentStream is, Object callerThis, Object[] objs, String sourceId)
{
if (tc.isEntryEnabled()) SibTr.entry(this, tc, "ffdcDumpDefault",
new Object[]{t, is, callerThis, objs, sourceId});
// Dump the SIB information
super.ffdcDumpDefault(t, is, callerThis, objs, sourceId);
is.writeLine("\n= ============= SIB Communications Diagnostic Information =============", "");
is.writeLine("Current Diagnostic Module: ", _instance);
dumpJFapClientStatus(is);
dumpJFapServerStatus(is);
if (tc.isEntryEnabled()) SibTr.exit(this, tc, "ffdcDumpDefault");
} | [
"public",
"void",
"ffdcDumpDefault",
"(",
"Throwable",
"t",
",",
"IncidentStream",
"is",
",",
"Object",
"callerThis",
",",
"Object",
"[",
"]",
"objs",
",",
"String",
"sourceId",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".... | Called when an FFDC is generated and the stack matches one of our packages.
@see com.ibm.ws.sib.utils.ffdc.SibDiagnosticModule#ffdcDumpDefault(java.lang.Throwable, com.ibm.ws.ffdc.IncidentStream, java.lang.Object, java.lang.Object[], java.lang.String) | [
"Called",
"when",
"an",
"FFDC",
"is",
"generated",
"and",
"the",
"stack",
"matches",
"one",
"of",
"our",
"packages",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsDiagnosticModule.java#L111-L126 |
Quickhull3d/quickhull3d | src/main/java/com/github/quickhull3d/Face.java | Face.findEdge | public HalfEdge findEdge(Vertex vt, Vertex vh) {
HalfEdge he = he0;
do {
if (he.head() == vh && he.tail() == vt) {
return he;
}
he = he.next;
} while (he != he0);
return null;
} | java | public HalfEdge findEdge(Vertex vt, Vertex vh) {
HalfEdge he = he0;
do {
if (he.head() == vh && he.tail() == vt) {
return he;
}
he = he.next;
} while (he != he0);
return null;
} | [
"public",
"HalfEdge",
"findEdge",
"(",
"Vertex",
"vt",
",",
"Vertex",
"vh",
")",
"{",
"HalfEdge",
"he",
"=",
"he0",
";",
"do",
"{",
"if",
"(",
"he",
".",
"head",
"(",
")",
"==",
"vh",
"&&",
"he",
".",
"tail",
"(",
")",
"==",
"vt",
")",
"{",
"... | Finds the half-edge within this face which has tail <code>vt</code> and
head <code>vh</code>.
@param vt
tail point
@param vh
head point
@return the half-edge, or null if none is found. | [
"Finds",
"the",
"half",
"-",
"edge",
"within",
"this",
"face",
"which",
"has",
"tail",
"<code",
">",
"vt<",
"/",
"code",
">",
"and",
"head",
"<code",
">",
"vh<",
"/",
"code",
">",
"."
] | train | https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/Face.java#L230-L239 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java | AssertKripton.assertTrueOrUnknownParamInJQLException | public static void assertTrueOrUnknownParamInJQLException(boolean expression, SQLiteModelMethod method,
String paramName) {
if (!expression) {
throw (new UnknownParamUsedInJQLException(method, paramName));
}
} | java | public static void assertTrueOrUnknownParamInJQLException(boolean expression, SQLiteModelMethod method,
String paramName) {
if (!expression) {
throw (new UnknownParamUsedInJQLException(method, paramName));
}
} | [
"public",
"static",
"void",
"assertTrueOrUnknownParamInJQLException",
"(",
"boolean",
"expression",
",",
"SQLiteModelMethod",
"method",
",",
"String",
"paramName",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"(",
"new",
"UnknownParamUsedInJQLException",... | Assert true or unknown param in JQL exception.
@param expression
the expression
@param method
the method
@param paramName
the param name | [
"Assert",
"true",
"or",
"unknown",
"param",
"in",
"JQL",
"exception",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L292-L297 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java | CommsUtils.isRecoverable | public static boolean isRecoverable(final SIBusMessage mess, final Reliability maxUnrecoverableReliability)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isRecoverable", new Object[] {mess, maxUnrecoverableReliability});
final Reliability messageReliability = mess.getReliability();
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Message Reliability: ", messageReliability);
final boolean recoverable = messageReliability.compareTo(maxUnrecoverableReliability) > 0;
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isRecoverable", recoverable);
return recoverable;
} | java | public static boolean isRecoverable(final SIBusMessage mess, final Reliability maxUnrecoverableReliability)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "isRecoverable", new Object[] {mess, maxUnrecoverableReliability});
final Reliability messageReliability = mess.getReliability();
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "Message Reliability: ", messageReliability);
final boolean recoverable = messageReliability.compareTo(maxUnrecoverableReliability) > 0;
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "isRecoverable", recoverable);
return recoverable;
} | [
"public",
"static",
"boolean",
"isRecoverable",
"(",
"final",
"SIBusMessage",
"mess",
",",
"final",
"Reliability",
"maxUnrecoverableReliability",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
"... | Determines whether a message is recoverable compared to the supplied maxUnrecoverableReliability.
@param mess the message to check.
@para maxUnrecoverableReliability the most reliable reliability that is considered unrecoverable in the context in which this method is executed.
@return true for any message which is more recoverable than maxUnrecoverableReliability, otherwise a false is returned. | [
"Determines",
"whether",
"a",
"message",
"is",
"recoverable",
"compared",
"to",
"the",
"supplied",
"maxUnrecoverableReliability",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L220-L232 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java | CommonOps_DDF4.addEquals | public static void addEquals( DMatrix4 a , DMatrix4 b ) {
a.a1 += b.a1;
a.a2 += b.a2;
a.a3 += b.a3;
a.a4 += b.a4;
} | java | public static void addEquals( DMatrix4 a , DMatrix4 b ) {
a.a1 += b.a1;
a.a2 += b.a2;
a.a3 += b.a3;
a.a4 += b.a4;
} | [
"public",
"static",
"void",
"addEquals",
"(",
"DMatrix4",
"a",
",",
"DMatrix4",
"b",
")",
"{",
"a",
".",
"a1",
"+=",
"b",
".",
"a1",
";",
"a",
".",
"a2",
"+=",
"b",
".",
"a2",
";",
"a",
".",
"a3",
"+=",
"b",
".",
"a3",
";",
"a",
".",
"a4",
... | <p>Performs the following operation:<br>
<br>
a = a + b <br>
a<sub>i</sub> = a<sub>i</sub> + b<sub>i</sub> <br>
</p>
@param a A Vector. Modified.
@param b A Vector. Not modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"a",
"=",
"a",
"+",
"b",
"<br",
">",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"+",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L127-L132 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java | FastAdapter.onCreateViewHolder | @Override
@SuppressWarnings("unchecked")
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (mVerbose) Log.v(TAG, "onCreateViewHolder: " + viewType);
final RecyclerView.ViewHolder holder = mOnCreateViewHolderListener.onPreCreateViewHolder(this, parent, viewType);
//set the adapter
holder.itemView.setTag(R.id.fastadapter_item_adapter, FastAdapter.this);
if (mAttachDefaultListeners) {
//handle click behavior
EventHookUtil.attachToView(fastAdapterViewClickListener, holder, holder.itemView);
//handle long click behavior
EventHookUtil.attachToView(fastAdapterViewLongClickListener, holder, holder.itemView);
//handle touch behavior
EventHookUtil.attachToView(fastAdapterViewTouchListener, holder, holder.itemView);
}
return mOnCreateViewHolderListener.onPostCreateViewHolder(this, holder);
} | java | @Override
@SuppressWarnings("unchecked")
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (mVerbose) Log.v(TAG, "onCreateViewHolder: " + viewType);
final RecyclerView.ViewHolder holder = mOnCreateViewHolderListener.onPreCreateViewHolder(this, parent, viewType);
//set the adapter
holder.itemView.setTag(R.id.fastadapter_item_adapter, FastAdapter.this);
if (mAttachDefaultListeners) {
//handle click behavior
EventHookUtil.attachToView(fastAdapterViewClickListener, holder, holder.itemView);
//handle long click behavior
EventHookUtil.attachToView(fastAdapterViewLongClickListener, holder, holder.itemView);
//handle touch behavior
EventHookUtil.attachToView(fastAdapterViewTouchListener, holder, holder.itemView);
}
return mOnCreateViewHolderListener.onPostCreateViewHolder(this, holder);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"RecyclerView",
".",
"ViewHolder",
"onCreateViewHolder",
"(",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"if",
"(",
"mVerbose",
")",
"Log",
".",
"v",
"(",
"TAG",
","... | Creates the ViewHolder by the viewType
@param parent the parent view (the RecyclerView)
@param viewType the current viewType which is bound
@return the ViewHolder with the bound data | [
"Creates",
"the",
"ViewHolder",
"by",
"the",
"viewType"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/FastAdapter.java#L680-L702 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java | ThinTableModel.selectionChanged | public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
{
int iOldSelection = m_iSelectedRow;
if (m_iSelectedRow == iEndRow)
m_iSelectedRow = iStartRow;
else
m_iSelectedRow = iEndRow;
if (source instanceof JTable)
m_iSelectedRow = ((JTable)source).getSelectedRow();
try {
this.updateIfNewRow(m_iSelectedRow);
} catch (Exception ex) {
if (!(source instanceof Component))
source = null; // Never
if (!this.displayError(ex, (Component)source))
ex.printStackTrace();
}
return (iOldSelection != m_iSelectedRow);
} | java | public boolean selectionChanged(Object source, int iStartRow, int iEndRow, int iSelectType)
{
int iOldSelection = m_iSelectedRow;
if (m_iSelectedRow == iEndRow)
m_iSelectedRow = iStartRow;
else
m_iSelectedRow = iEndRow;
if (source instanceof JTable)
m_iSelectedRow = ((JTable)source).getSelectedRow();
try {
this.updateIfNewRow(m_iSelectedRow);
} catch (Exception ex) {
if (!(source instanceof Component))
source = null; // Never
if (!this.displayError(ex, (Component)source))
ex.printStackTrace();
}
return (iOldSelection != m_iSelectedRow);
} | [
"public",
"boolean",
"selectionChanged",
"(",
"Object",
"source",
",",
"int",
"iStartRow",
",",
"int",
"iEndRow",
",",
"int",
"iSelectType",
")",
"{",
"int",
"iOldSelection",
"=",
"m_iSelectedRow",
";",
"if",
"(",
"m_iSelectedRow",
"==",
"iEndRow",
")",
"m_iSe... | User selected a new row.
From the ListSelectionListener interface.
@param source The source.
@param iStartRow The starting row.
@param iEndRow The ending row..
@param iSelectType The type of selection.
@return boolean If the selection changed, return true | [
"User",
"selected",
"a",
"new",
"row",
".",
"From",
"the",
"ListSelectionListener",
"interface",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L797-L817 |
cloudfoundry/uaa | server/src/main/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimGroupBootstrap.java | ScimGroupBootstrap.setGroups | public void setGroups(Map<String,String> groups) {
if(groups==null) { groups = Collections.EMPTY_MAP; }
groups.entrySet().forEach(e -> {
if(!StringUtils.hasText(e.getValue())) { e.setValue((String) getMessageSource().getProperty(String.format(messagePropertyNameTemplate, e.getKey()))); }
});
this.configuredGroups = groups;
setCombinedGroups();
} | java | public void setGroups(Map<String,String> groups) {
if(groups==null) { groups = Collections.EMPTY_MAP; }
groups.entrySet().forEach(e -> {
if(!StringUtils.hasText(e.getValue())) { e.setValue((String) getMessageSource().getProperty(String.format(messagePropertyNameTemplate, e.getKey()))); }
});
this.configuredGroups = groups;
setCombinedGroups();
} | [
"public",
"void",
"setGroups",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"groups",
")",
"{",
"if",
"(",
"groups",
"==",
"null",
")",
"{",
"groups",
"=",
"Collections",
".",
"EMPTY_MAP",
";",
"}",
"groups",
".",
"entrySet",
"(",
")",
".",
"forEac... | Specify the list of groups to create as a comma-separated list of
group-names
@param groups | [
"Specify",
"the",
"list",
"of",
"groups",
"to",
"create",
"as",
"a",
"comma",
"-",
"separated",
"list",
"of",
"group",
"-",
"names"
] | train | https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimGroupBootstrap.java#L114-L121 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/util/PropertiesHistory.java | PropertiesHistory.checkPropertyValueOrTransition | public void checkPropertyValueOrTransition(String propertyValueOrTransition, double maxTime)
throws QTasteDataException, QTasteTestFailException {
long beginTime_ms = System.currentTimeMillis();
long maxTime_ms = Math.round(maxTime * 1000);
propertyValueOrTransition = propertyValueOrTransition.toLowerCase();
String[] splitted = propertyValueOrTransition.split(" *: *", 2);
if (splitted.length != 2) {
throw new QTasteDataException("Invalid syntax");
}
String property = splitted[0];
if (property.length() == 0) {
throw new QTasteDataException("Invalid syntax");
}
String transition = splitted[1];
boolean mustBeAtBegin = transition.matches("^\\[.*");
if (mustBeAtBegin) {
transition = transition.replaceFirst("^\\[ *", "");
}
boolean mustBeAtEnd = transition.matches(".*\\]$");
if (mustBeAtEnd) {
transition = transition.replaceFirst(" *\\]$", "");
}
String[] values = transition.split(" *-> *");
if ((values.length != 1) && (values.length != 2)) {
throw new QTasteDataException("Invalid syntax");
}
String expectedValueOrTransition = propertyValueOrTransition.replaceFirst(".*?: *", "");
long remainingTime_ms = maxTime_ms - (System.currentTimeMillis() - beginTime_ms);
checkPropertyValueOrTransition(property, values, mustBeAtBegin, mustBeAtEnd, remainingTime_ms, expectedValueOrTransition);
} | java | public void checkPropertyValueOrTransition(String propertyValueOrTransition, double maxTime)
throws QTasteDataException, QTasteTestFailException {
long beginTime_ms = System.currentTimeMillis();
long maxTime_ms = Math.round(maxTime * 1000);
propertyValueOrTransition = propertyValueOrTransition.toLowerCase();
String[] splitted = propertyValueOrTransition.split(" *: *", 2);
if (splitted.length != 2) {
throw new QTasteDataException("Invalid syntax");
}
String property = splitted[0];
if (property.length() == 0) {
throw new QTasteDataException("Invalid syntax");
}
String transition = splitted[1];
boolean mustBeAtBegin = transition.matches("^\\[.*");
if (mustBeAtBegin) {
transition = transition.replaceFirst("^\\[ *", "");
}
boolean mustBeAtEnd = transition.matches(".*\\]$");
if (mustBeAtEnd) {
transition = transition.replaceFirst(" *\\]$", "");
}
String[] values = transition.split(" *-> *");
if ((values.length != 1) && (values.length != 2)) {
throw new QTasteDataException("Invalid syntax");
}
String expectedValueOrTransition = propertyValueOrTransition.replaceFirst(".*?: *", "");
long remainingTime_ms = maxTime_ms - (System.currentTimeMillis() - beginTime_ms);
checkPropertyValueOrTransition(property, values, mustBeAtBegin, mustBeAtEnd, remainingTime_ms, expectedValueOrTransition);
} | [
"public",
"void",
"checkPropertyValueOrTransition",
"(",
"String",
"propertyValueOrTransition",
",",
"double",
"maxTime",
")",
"throws",
"QTasteDataException",
",",
"QTasteTestFailException",
"{",
"long",
"beginTime_ms",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
... | Checks that a property reaches a given value or do a given values
transition within given time.
If found, remove old values from history.
@param propertyValueOrTransition the property value or transition to check (case insensitive)
<dl>
<dd>Format: "<code><i>property</i>:</code>[<code>[</code>]<code><i>expected_value</i></code>[<code>]</code>]" or
"<code><i>property</i>:</code>[<code>[</code>]<code><i>initial_value</i>-><i>final_value</i></code>[<code>]</code>]"
<dd>beginning <code>[</code> means that the expected or initial value must be the first one in the current values history
<dd>ending <code>]</code> means that the expected or final value must be the last one in the current values history
</dl>
@param maxTime the maximum time to wait for the property value or transition, in seconds
@throws QTasteDataException in case of invalid syntax in propertyValueOrTransition
@throws QTasteTestFailException if the property doesn't reach specified value or do specified values transition or
if a possible notification loss occurred
within specified time | [
"Checks",
"that",
"a",
"property",
"reaches",
"a",
"given",
"value",
"or",
"do",
"a",
"given",
"values",
"transition",
"within",
"given",
"time",
".",
"If",
"found",
"remove",
"old",
"values",
"from",
"history",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/util/PropertiesHistory.java#L228-L258 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.addBodyFileUploads | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | java | public void addBodyFileUploads(String name, File[] file, String[] contentType, boolean[] isText)
throws ErrorDataEncoderException {
if (file.length != contentType.length && file.length != isText.length) {
throw new IllegalArgumentException("Different array length");
}
for (int i = 0; i < file.length; i++) {
addBodyFileUpload(name, file[i], contentType[i], isText[i]);
}
} | [
"public",
"void",
"addBodyFileUploads",
"(",
"String",
"name",
",",
"File",
"[",
"]",
"file",
",",
"String",
"[",
"]",
"contentType",
",",
"boolean",
"[",
"]",
"isText",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"file",
".",
"length",
"!=... | Add a series of Files associated with one File parameter
@param name
the name of the parameter
@param file
the array of files
@param contentType
the array of content Types associated with each file
@param isText
the array of isText attribute (False meaning binary mode) for each file
@throws IllegalArgumentException
also throws if array have different sizes
@throws ErrorDataEncoderException
if the encoding is in error or if the finalize were already done | [
"Add",
"a",
"series",
"of",
"Files",
"associated",
"with",
"one",
"File",
"parameter"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L429-L437 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java | HdfsFileStatus.toFileStatus | public static FileStatus toFileStatus(HdfsFileStatus stat, String src) {
if (stat == null) {
return null;
}
return new FileStatus(stat.getLen(), stat.isDir(), stat.getReplication(),
stat.getBlockSize(), stat.getModificationTime(),
stat.getAccessTime(),
stat.getPermission(), stat.getOwner(), stat.getGroup(),
stat.getFullPath(new Path(src))); // full path
} | java | public static FileStatus toFileStatus(HdfsFileStatus stat, String src) {
if (stat == null) {
return null;
}
return new FileStatus(stat.getLen(), stat.isDir(), stat.getReplication(),
stat.getBlockSize(), stat.getModificationTime(),
stat.getAccessTime(),
stat.getPermission(), stat.getOwner(), stat.getGroup(),
stat.getFullPath(new Path(src))); // full path
} | [
"public",
"static",
"FileStatus",
"toFileStatus",
"(",
"HdfsFileStatus",
"stat",
",",
"String",
"src",
")",
"{",
"if",
"(",
"stat",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"FileStatus",
"(",
"stat",
".",
"getLen",
"(",
")",
... | Convert an HdfsFileStatus to a FileStatus
@param stat an HdfsFileStatus
@param src parent path in string representation
@return a FileStatus object | [
"Convert",
"an",
"HdfsFileStatus",
"to",
"a",
"FileStatus"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java#L112-L121 |
astrapi69/jaulp-wicket | jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/save/SaveDialogPanel.java | SaveDialogPanel.newCancelButton | protected AjaxButton newCancelButton(final String id, final Form<?> form)
{
final AjaxButton cancelButton = new AjaxButton(id, form)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form)
{
onCancel(target, form);
}
};
return cancelButton;
} | java | protected AjaxButton newCancelButton(final String id, final Form<?> form)
{
final AjaxButton cancelButton = new AjaxButton(id, form)
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form)
{
onCancel(target, form);
}
};
return cancelButton;
} | [
"protected",
"AjaxButton",
"newCancelButton",
"(",
"final",
"String",
"id",
",",
"final",
"Form",
"<",
"?",
">",
"form",
")",
"{",
"final",
"AjaxButton",
"cancelButton",
"=",
"new",
"AjaxButton",
"(",
"id",
",",
"form",
")",
"{",
"/**\n\t\t\t * The serialVersi... | Factory method for creating a new cancel {@link AjaxButton}. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a cancel {@link AjaxButton}.
@param id
the id
@param form
the form
@return the new {@link AjaxButton} | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"cancel",
"{",
"@link",
"AjaxButton",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/panels/save/SaveDialogPanel.java#L123-L142 |
fabric8io/fabric8-forge | fabric8-forge-rest-client/src/main/java/io/fabric8/forge/rest/client/ForgeClientHelpers.java | ForgeClientHelpers.tailLog | public static TailResults tailLog(String uri, TailResults previousResults, Function<String, Void> lineProcessor) throws IOException {
URL logURL = new URL(uri);
try (InputStream inputStream = logURL.openStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
int count = 0;
String lastLine = null;
while (true) {
String line = reader.readLine();
if (line == null) break;
lastLine = line;
if (previousResults.isNewLine(line, count)) {
lineProcessor.apply(line);
}
count++;
}
return new TailResults(count, lastLine);
}
} | java | public static TailResults tailLog(String uri, TailResults previousResults, Function<String, Void> lineProcessor) throws IOException {
URL logURL = new URL(uri);
try (InputStream inputStream = logURL.openStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
int count = 0;
String lastLine = null;
while (true) {
String line = reader.readLine();
if (line == null) break;
lastLine = line;
if (previousResults.isNewLine(line, count)) {
lineProcessor.apply(line);
}
count++;
}
return new TailResults(count, lastLine);
}
} | [
"public",
"static",
"TailResults",
"tailLog",
"(",
"String",
"uri",
",",
"TailResults",
"previousResults",
",",
"Function",
"<",
"String",
",",
"Void",
">",
"lineProcessor",
")",
"throws",
"IOException",
"{",
"URL",
"logURL",
"=",
"new",
"URL",
"(",
"uri",
"... | Tails the log of the given URL such as a build log, processing all new lines since the last results | [
"Tails",
"the",
"log",
"of",
"the",
"given",
"URL",
"such",
"as",
"a",
"build",
"log",
"processing",
"all",
"new",
"lines",
"since",
"the",
"last",
"results"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/fabric8-forge-rest-client/src/main/java/io/fabric8/forge/rest/client/ForgeClientHelpers.java#L139-L156 |
threerings/nenya | core/src/main/java/com/threerings/openal/FileStream.java | FileStream.queueFile | public void queueFile (File file, boolean loop)
{
try {
queueURL(file.toURI().toURL(), loop);
} catch (MalformedURLException e) {
log.warning("Invalid file url.", "file", file, e);
}
} | java | public void queueFile (File file, boolean loop)
{
try {
queueURL(file.toURI().toURL(), loop);
} catch (MalformedURLException e) {
log.warning("Invalid file url.", "file", file, e);
}
} | [
"public",
"void",
"queueFile",
"(",
"File",
"file",
",",
"boolean",
"loop",
")",
"{",
"try",
"{",
"queueURL",
"(",
"file",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
",",
"loop",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
... | Adds a file to the queue of files to play.
@param loop if true, play this file in a loop if there's nothing else
on the queue | [
"Adds",
"a",
"file",
"to",
"the",
"queue",
"of",
"files",
"to",
"play",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/FileStream.java#L52-L59 |
jbundle/jbundle | main/screen/src/main/java/org/jbundle/main/user/screen/UserPreferenceScreen.java | UserPreferenceScreen.addToolbars | public ToolScreen addToolbars()
{
return new MaintToolbar(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null)
{
public void setupMiddleSFields()
{
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.SUBMIT);
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
String strDesc = UserPasswordChange.CHANGE_PASSWORD;
String strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserPasswordChange.class.getName());
if (this.getProperty(DBParams.USER_NAME) == null)
{
strDesc = UserEntryScreen.CREATE_NEW_USER;
strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserEntryScreen.class.getName());
}
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
strDesc = this.getTask().getApplication().getResources(ResourceConstants.MAIN_RESOURCE, true).getString(strDesc);
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON, ScreenConstants.DONT_SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, strCommand, MenuConstants.FORM + "Tip");
}
};
} | java | public ToolScreen addToolbars()
{
return new MaintToolbar(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null)
{
public void setupMiddleSFields()
{
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.SUBMIT);
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
String strDesc = UserPasswordChange.CHANGE_PASSWORD;
String strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserPasswordChange.class.getName());
if (this.getProperty(DBParams.USER_NAME) == null)
{
strDesc = UserEntryScreen.CREATE_NEW_USER;
strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserEntryScreen.class.getName());
}
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
strDesc = this.getTask().getApplication().getResources(ResourceConstants.MAIN_RESOURCE, true).getString(strDesc);
new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON, ScreenConstants.DONT_SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, strCommand, MenuConstants.FORM + "Tip");
}
};
} | [
"public",
"ToolScreen",
"addToolbars",
"(",
")",
"{",
"return",
"new",
"MaintToolbar",
"(",
"null",
",",
"this",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"null",
")",
"{",
"public",
"void",
"setupMiddleSFields",
"(",
")",
"{",
... | Add the toolbars that belong with this screen.
@return The new toolbar. | [
"Add",
"the",
"toolbars",
"that",
"belong",
"with",
"this",
"screen",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserPreferenceScreen.java#L104-L125 |
geomajas/geomajas-project-server | common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java | CacheFilter.shouldCompress | public boolean shouldCompress(String requestUri) {
String uri = requestUri.toLowerCase();
return checkSuffixes(uri, zipSuffixes);
} | java | public boolean shouldCompress(String requestUri) {
String uri = requestUri.toLowerCase();
return checkSuffixes(uri, zipSuffixes);
} | [
"public",
"boolean",
"shouldCompress",
"(",
"String",
"requestUri",
")",
"{",
"String",
"uri",
"=",
"requestUri",
".",
"toLowerCase",
"(",
")",
";",
"return",
"checkSuffixes",
"(",
"uri",
",",
"zipSuffixes",
")",
";",
"}"
] | Should this request URI be compressed?
@param requestUri request URI
@return true when should be compressed | [
"Should",
"this",
"request",
"URI",
"be",
"compressed?"
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java#L233-L236 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.requestJWTApplicationToken | public OAuth.OAuthToken requestJWTApplicationToken(String clientId, java.util.List<String>scopes, byte[] rsaPrivateKey, long expiresIn) throws IllegalArgumentException, IOException, ApiException {
return this.requestJWTUserToken(clientId, null, scopes, rsaPrivateKey, expiresIn);
} | java | public OAuth.OAuthToken requestJWTApplicationToken(String clientId, java.util.List<String>scopes, byte[] rsaPrivateKey, long expiresIn) throws IllegalArgumentException, IOException, ApiException {
return this.requestJWTUserToken(clientId, null, scopes, rsaPrivateKey, expiresIn);
} | [
"public",
"OAuth",
".",
"OAuthToken",
"requestJWTApplicationToken",
"(",
"String",
"clientId",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"scopes",
",",
"byte",
"[",
"]",
"rsaPrivateKey",
",",
"long",
"expiresIn",
")",
"throws",
"IllegalArgumen... | <b>RESERVED FOR PARTNERS</b> Request JWT Application Token
Configures the current instance of ApiClient with a fresh OAuth JWT access token from DocuSign
@param clientId DocuSign OAuth Client Id (AKA Integrator Key)
@param scopes the list of requested scopes. Values include {@link OAuth#Scope_SIGNATURE}, {@link OAuth#Scope_EXTENDED}, {@link OAuth#Scope_IMPERSONATION}. You can also pass any advanced scope.
@param rsaPrivateKey the byte contents of the RSA private key
@param expiresIn number of seconds remaining before the JWT assertion is considered as invalid
@return OAuth.OAuthToken object.
@throws IllegalArgumentException if one of the arguments is invalid
@throws IOException if there is an issue with either the public or private file
@throws ApiException if there is an error while exchanging the JWT with an access token | [
"<b",
">",
"RESERVED",
"FOR",
"PARTNERS<",
"/",
"b",
">",
"Request",
"JWT",
"Application",
"Token",
"Configures",
"the",
"current",
"instance",
"of",
"ApiClient",
"with",
"a",
"fresh",
"OAuth",
"JWT",
"access",
"token",
"from",
"DocuSign"
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L764-L766 |
podio/podio-java | src/main/java/com/podio/org/OrgAPI.java | OrgAPI.getEndMemberInfo | public EndMemberInfo getEndMemberInfo(int orgId, int userId) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/member/" + userId + "/end_member_info").get(
EndMemberInfo.class);
} | java | public EndMemberInfo getEndMemberInfo(int orgId, int userId) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/member/" + userId + "/end_member_info").get(
EndMemberInfo.class);
} | [
"public",
"EndMemberInfo",
"getEndMemberInfo",
"(",
"int",
"orgId",
",",
"int",
"userId",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/org/\"",
"+",
"orgId",
"+",
"\"/member/\"",
"+",
"userId",
"+",
"\"/end_member_info\"",
... | Returns information about what would happen if this user would be removed from the org
@param orgId
The id of the organization
@param userId
The id of the user
@return The information about the users workspace memberships in the org | [
"Returns",
"information",
"about",
"what",
"would",
"happen",
"if",
"this",
"user",
"would",
"be",
"removed",
"from",
"the",
"org"
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/org/OrgAPI.java#L224-L228 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java | JobAgentsInner.beginUpdateAsync | public Observable<JobAgentInner> beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1<ServiceResponse<JobAgentInner>, JobAgentInner>() {
@Override
public JobAgentInner call(ServiceResponse<JobAgentInner> response) {
return response.body();
}
});
} | java | public Observable<JobAgentInner> beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1<ServiceResponse<JobAgentInner>, JobAgentInner>() {
@Override
public JobAgentInner call(ServiceResponse<JobAgentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobAgentInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
... | Updates a job agent.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent to be updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobAgentInner object | [
"Updates",
"a",
"job",
"agent",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java#L876-L883 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java | SwiftAPIClient.setCorrectSize | private void setCorrectSize(StoredObject tmp, Container cObj) {
long objectSize = tmp.getContentLength();
if (objectSize == 0) {
// we may hit a well known Swift bug.
// container listing reports 0 for large objects.
StoredObject soDirect = cObj
.getObject(tmp.getName());
long contentLength = soDirect.getContentLength();
if (contentLength > 0) {
tmp.setContentLength(contentLength);
}
}
} | java | private void setCorrectSize(StoredObject tmp, Container cObj) {
long objectSize = tmp.getContentLength();
if (objectSize == 0) {
// we may hit a well known Swift bug.
// container listing reports 0 for large objects.
StoredObject soDirect = cObj
.getObject(tmp.getName());
long contentLength = soDirect.getContentLength();
if (contentLength > 0) {
tmp.setContentLength(contentLength);
}
}
} | [
"private",
"void",
"setCorrectSize",
"(",
"StoredObject",
"tmp",
",",
"Container",
"cObj",
")",
"{",
"long",
"objectSize",
"=",
"tmp",
".",
"getContentLength",
"(",
")",
";",
"if",
"(",
"objectSize",
"==",
"0",
")",
"{",
"// we may hit a well known Swift bug.",
... | Swift has a bug where container listing might wrongly report size 0
for large objects. It's seems to be a well known issue in Swift without
solution.
We have to provide work around for this.
If container listing reports size 0 for some object, we send
additional HEAD on that object to verify it's size.
@param tmp JOSS StoredObject
@param cObj JOSS Container object | [
"Swift",
"has",
"a",
"bug",
"where",
"container",
"listing",
"might",
"wrongly",
"report",
"size",
"0",
"for",
"large",
"objects",
".",
"It",
"s",
"seems",
"to",
"be",
"a",
"well",
"known",
"issue",
"in",
"Swift",
"without",
"solution",
".",
"We",
"have"... | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java#L839-L851 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.findByG_T_E | @Override
public List<CommerceNotificationTemplate> findByG_T_E(long groupId,
String type, boolean enabled, int start, int end) {
return findByG_T_E(groupId, type, enabled, start, end, null);
} | java | @Override
public List<CommerceNotificationTemplate> findByG_T_E(long groupId,
String type, boolean enabled, int start, int end) {
return findByG_T_E(groupId, type, enabled, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationTemplate",
">",
"findByG_T_E",
"(",
"long",
"groupId",
",",
"String",
"type",
",",
"boolean",
"enabled",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_T_E",
"(",
"groupId",
"... | Returns a range of all the commerce notification templates where groupId = ? and type = ? and enabled = ?.
<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 CommerceNotificationTemplateModelImpl}. 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 type the type
@param enabled the enabled
@param start the lower bound of the range of commerce notification templates
@param end the upper bound of the range of commerce notification templates (not inclusive)
@return the range of matching commerce notification templates | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"templates",
"where",
"groupId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"and",
"enabled",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L3408-L3412 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.noneSatisfy | @Deprecated
public static boolean noneSatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.noneSatisfyCodePoint(string, predicate);
} | java | @Deprecated
public static boolean noneSatisfy(String string, CodePointPredicate predicate)
{
return StringIterate.noneSatisfyCodePoint(string, predicate);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"noneSatisfy",
"(",
"String",
"string",
",",
"CodePointPredicate",
"predicate",
")",
"{",
"return",
"StringIterate",
".",
"noneSatisfyCodePoint",
"(",
"string",
",",
"predicate",
")",
";",
"}"
] | @return true if none of the code points in the {@code string} answer true for the specified {@code predicate}.
@deprecated since 7.0. Use {@link #noneSatisfyCodePoint(String, CodePointPredicate)} instead. | [
"@return",
"true",
"if",
"none",
"of",
"the",
"code",
"points",
"in",
"the",
"{",
"@code",
"string",
"}",
"answer",
"true",
"for",
"the",
"specified",
"{",
"@code",
"predicate",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L939-L943 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateTrue | public static boolean validateTrue(boolean value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isFalse(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | java | public static boolean validateTrue(boolean value, String errorMsgTemplate, Object... params) throws ValidateException {
if (isFalse(value)) {
throw new ValidateException(errorMsgTemplate, params);
}
return value;
} | [
"public",
"static",
"boolean",
"validateTrue",
"(",
"boolean",
"value",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"isFalse",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"ValidateExce... | 检查指定值是否为<code>ture</code>
@param value 值
@param errorMsgTemplate 错误消息内容模板(变量使用{}表示)
@param params 模板中变量替换后的值
@return 检查过后的值
@throws ValidateException 检查不满足条件抛出的异常
@since 4.4.5 | [
"检查指定值是否为<code",
">",
"ture<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L92-L97 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java | JSchema.setInterpreterCache | public void setInterpreterCache(int version, Object toCache) {
if (interpCache == null)
// JMF_ENCODING_VERSION is always the latest version we support
interpCache = new Object[JMFRegistry.JMF_ENCODING_VERSION];
interpCache[version - 1] = toCache;
} | java | public void setInterpreterCache(int version, Object toCache) {
if (interpCache == null)
// JMF_ENCODING_VERSION is always the latest version we support
interpCache = new Object[JMFRegistry.JMF_ENCODING_VERSION];
interpCache[version - 1] = toCache;
} | [
"public",
"void",
"setInterpreterCache",
"(",
"int",
"version",
",",
"Object",
"toCache",
")",
"{",
"if",
"(",
"interpCache",
"==",
"null",
")",
"// JMF_ENCODING_VERSION is always the latest version we support",
"interpCache",
"=",
"new",
"Object",
"[",
"JMFRegistry",
... | Set an entry in the interpreter Cache (indexed by JMF encoding version, of which the
first is expected to be 1).
@param version the JMF encoding version
@param toCache the Object that the SchemaInterpreter wishes to cache | [
"Set",
"an",
"entry",
"in",
"the",
"interpreter",
"Cache",
"(",
"indexed",
"by",
"JMF",
"encoding",
"version",
"of",
"which",
"the",
"first",
"is",
"expected",
"to",
"be",
"1",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java#L268-L273 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterDouble | public Double getParameterDouble(String name) throws RepositoryConfigurationException
{
try
{
return StringNumberParser.parseDouble(getParameterValue(name));
}
catch (NumberFormatException e)
{
throw new RepositoryConfigurationException(name + ": unparseable Long. " + e, e);
}
} | java | public Double getParameterDouble(String name) throws RepositoryConfigurationException
{
try
{
return StringNumberParser.parseDouble(getParameterValue(name));
}
catch (NumberFormatException e)
{
throw new RepositoryConfigurationException(name + ": unparseable Long. " + e, e);
}
} | [
"public",
"Double",
"getParameterDouble",
"(",
"String",
"name",
")",
"throws",
"RepositoryConfigurationException",
"{",
"try",
"{",
"return",
"StringNumberParser",
".",
"parseDouble",
"(",
"getParameterValue",
"(",
"name",
")",
")",
";",
"}",
"catch",
"(",
"Numbe... | Parse named parameter as Double.
@param name
parameter name
@return Double value
@throws RepositoryConfigurationException | [
"Parse",
"named",
"parameter",
"as",
"Double",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L276-L286 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.makeMarginTransform | public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double lmargin, double tmargin, double rmargin, double bmargin) {
double swidth = iwidth + lmargin + rmargin;
double sheight = iheight + tmargin + bmargin;
double scale = Math.max(swidth / owidth, sheight / oheight);
double offx = (scale * owidth - swidth) * .5 + lmargin;
double offy = (scale * oheight - sheight) * .5 + tmargin;
return "scale(" + fmt(1 / scale) + ") translate(" + fmt(offx) + " " + fmt(offy) + ")";
} | java | public static String makeMarginTransform(double owidth, double oheight, double iwidth, double iheight, double lmargin, double tmargin, double rmargin, double bmargin) {
double swidth = iwidth + lmargin + rmargin;
double sheight = iheight + tmargin + bmargin;
double scale = Math.max(swidth / owidth, sheight / oheight);
double offx = (scale * owidth - swidth) * .5 + lmargin;
double offy = (scale * oheight - sheight) * .5 + tmargin;
return "scale(" + fmt(1 / scale) + ") translate(" + fmt(offx) + " " + fmt(offy) + ")";
} | [
"public",
"static",
"String",
"makeMarginTransform",
"(",
"double",
"owidth",
",",
"double",
"oheight",
",",
"double",
"iwidth",
",",
"double",
"iheight",
",",
"double",
"lmargin",
",",
"double",
"tmargin",
",",
"double",
"rmargin",
",",
"double",
"bmargin",
"... | Make a transform string to add margins
@param owidth Width of outer (embedding) canvas
@param oheight Height of outer (embedding) canvas
@param iwidth Width of inner (embedded) canvas
@param iheight Height of inner (embedded) canvas
@param lmargin Left margin (in inner canvas' units)
@param tmargin Top margin (in inner canvas' units)
@param rmargin Right margin (in inner canvas' units)
@param bmargin Bottom margin (in inner canvas' units)
@return Transform string | [
"Make",
"a",
"transform",
"string",
"to",
"add",
"margins"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L580-L587 |
jayantk/jklol | src/com/jayantkrish/jklol/util/IntMultimap.java | IntMultimap.createFromUnsortedArrays | public static IntMultimap createFromUnsortedArrays(int[] keys, int[] values, int unsortedCapacity) {
Preconditions.checkArgument(keys.length == values.length);
ArrayUtils.sortKeyValuePairs(keys, values, 0, keys.length);
return new IntMultimap(keys, values, unsortedCapacity);
} | java | public static IntMultimap createFromUnsortedArrays(int[] keys, int[] values, int unsortedCapacity) {
Preconditions.checkArgument(keys.length == values.length);
ArrayUtils.sortKeyValuePairs(keys, values, 0, keys.length);
return new IntMultimap(keys, values, unsortedCapacity);
} | [
"public",
"static",
"IntMultimap",
"createFromUnsortedArrays",
"(",
"int",
"[",
"]",
"keys",
",",
"int",
"[",
"]",
"values",
",",
"int",
"unsortedCapacity",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"keys",
".",
"length",
"==",
"values",
".",
"le... | This method does not copy {@code keys} or {@code values}.
@param keys
@param values
@param unsortedCapacity
@return | [
"This",
"method",
"does",
"not",
"copy",
"{",
"@code",
"keys",
"}",
"or",
"{",
"@code",
"values",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/IntMultimap.java#L114-L118 |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java | NodeImpl.makeIterableAndSetMapKey | public static NodeImpl makeIterableAndSetMapKey(final NodeImpl node, final Object key) {
return new NodeImpl( //
node.name, //
node.parent, //
true, //
null, //
key, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
node.value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | java | public static NodeImpl makeIterableAndSetMapKey(final NodeImpl node, final Object key) {
return new NodeImpl( //
node.name, //
node.parent, //
true, //
null, //
key, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
node.value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | [
"public",
"static",
"NodeImpl",
"makeIterableAndSetMapKey",
"(",
"final",
"NodeImpl",
"node",
",",
"final",
"Object",
"key",
")",
"{",
"return",
"new",
"NodeImpl",
"(",
"//",
"node",
".",
"name",
",",
"//",
"node",
".",
"parent",
",",
"//",
"true",
",",
... | make it iterable and set map key.
@param node node to build
@param key map key to est
@return iterable node implementation | [
"make",
"it",
"iterable",
"and",
"set",
"map",
"key",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java#L334-L348 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java | RequestUtil.getIntSelector | public static int getIntSelector(SlingHttpServletRequest request, int defaultValue) {
String[] selectors = request.getRequestPathInfo().getSelectors();
for (String selector : selectors) {
try {
return Integer.parseInt(selector);
} catch (NumberFormatException nfex) {
// ok, try next
}
}
return defaultValue;
} | java | public static int getIntSelector(SlingHttpServletRequest request, int defaultValue) {
String[] selectors = request.getRequestPathInfo().getSelectors();
for (String selector : selectors) {
try {
return Integer.parseInt(selector);
} catch (NumberFormatException nfex) {
// ok, try next
}
}
return defaultValue;
} | [
"public",
"static",
"int",
"getIntSelector",
"(",
"SlingHttpServletRequest",
"request",
",",
"int",
"defaultValue",
")",
"{",
"String",
"[",
"]",
"selectors",
"=",
"request",
".",
"getRequestPathInfo",
"(",
")",
".",
"getSelectors",
"(",
")",
";",
"for",
"(",
... | Retrieves a number in the selectors and returns it if present otherwise the default value.
@param request the request object with the selector info
@param defaultValue the default number value | [
"Retrieves",
"a",
"number",
"in",
"the",
"selectors",
"and",
"returns",
"it",
"if",
"present",
"otherwise",
"the",
"default",
"value",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java#L89-L99 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/StringUtility.java | StringUtility.splitString | public static List<String> splitString(String line, char delim) {
return splitString(line, 0, line.length(), delim, new ArrayList<String>());
} | java | public static List<String> splitString(String line, char delim) {
return splitString(line, 0, line.length(), delim, new ArrayList<String>());
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitString",
"(",
"String",
"line",
",",
"char",
"delim",
")",
"{",
"return",
"splitString",
"(",
"line",
",",
"0",
",",
"line",
".",
"length",
"(",
")",
",",
"delim",
",",
"new",
"ArrayList",
"<",
"S... | Splits a string on the given delimiter.
Does include all empty elements on the split.
@return the modifiable list from the split | [
"Splits",
"a",
"string",
"on",
"the",
"given",
"delimiter",
".",
"Does",
"include",
"all",
"empty",
"elements",
"on",
"the",
"split",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L911-L913 |
RestComm/media-core | spi/src/main/java/org/restcomm/media/core/spi/format/FormatFactory.java | FormatFactory.createAudioFormat | public static AudioFormat createAudioFormat(EncodingName name, int sampleRate, int sampleSize, int channels) {
AudioFormat fmt = createAudioFormat(name);
fmt.setSampleRate(sampleRate);
fmt.setSampleSize(sampleSize);
fmt.setChannels(channels);
return fmt;
} | java | public static AudioFormat createAudioFormat(EncodingName name, int sampleRate, int sampleSize, int channels) {
AudioFormat fmt = createAudioFormat(name);
fmt.setSampleRate(sampleRate);
fmt.setSampleSize(sampleSize);
fmt.setChannels(channels);
return fmt;
} | [
"public",
"static",
"AudioFormat",
"createAudioFormat",
"(",
"EncodingName",
"name",
",",
"int",
"sampleRate",
",",
"int",
"sampleSize",
",",
"int",
"channels",
")",
"{",
"AudioFormat",
"fmt",
"=",
"createAudioFormat",
"(",
"name",
")",
";",
"fmt",
".",
"setSa... | Creates new format descriptor
@param name the encoding
@param sampleRate sample rate value in Hertz
@param sampleSize sample size in bits
@param channels number of channels | [
"Creates",
"new",
"format",
"descriptor"
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/spi/src/main/java/org/restcomm/media/core/spi/format/FormatFactory.java#L59-L65 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java | ZipMessage.addEntry | public ZipMessage addEntry(Resource resource) {
try {
addEntry(new Entry(resource.getFile()));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read zip entry content from given resource", e);
}
return this;
} | java | public ZipMessage addEntry(Resource resource) {
try {
addEntry(new Entry(resource.getFile()));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read zip entry content from given resource", e);
}
return this;
} | [
"public",
"ZipMessage",
"addEntry",
"(",
"Resource",
"resource",
")",
"{",
"try",
"{",
"addEntry",
"(",
"new",
"Entry",
"(",
"resource",
".",
"getFile",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CitrusRu... | Adds new zip archive entry. Resource can be a file or directory. In case of directory all files will be automatically added
to the zip archive. Directory structures are retained throughout this process.
@param resource
@return | [
"Adds",
"new",
"zip",
"archive",
"entry",
".",
"Resource",
"can",
"be",
"a",
"file",
"or",
"directory",
".",
"In",
"case",
"of",
"directory",
"all",
"files",
"will",
"be",
"automatically",
"added",
"to",
"the",
"zip",
"archive",
".",
"Directory",
"structur... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java#L68-L75 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.isGrass | public static boolean isGrass( String path ) {
File file = new File(path);
File cellFolderFile = file.getParentFile();
File mapsetFile = cellFolderFile.getParentFile();
File windFile = new File(mapsetFile, "WIND");
return cellFolderFile.getName().toLowerCase().equals("cell") && windFile.exists();
} | java | public static boolean isGrass( String path ) {
File file = new File(path);
File cellFolderFile = file.getParentFile();
File mapsetFile = cellFolderFile.getParentFile();
File windFile = new File(mapsetFile, "WIND");
return cellFolderFile.getName().toLowerCase().equals("cell") && windFile.exists();
} | [
"public",
"static",
"boolean",
"isGrass",
"(",
"String",
"path",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"File",
"cellFolderFile",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"File",
"mapsetFile",
"=",
"cellFolderFile",
... | Checks if the given path is a GRASS raster file.
<p>Note that there is no check on the existence of the file.
@param path the path to check.
@return true if the file is a grass raster. | [
"Checks",
"if",
"the",
"given",
"path",
"is",
"a",
"GRASS",
"raster",
"file",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1301-L1307 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/DefaultConnectionNameGenerator.java | DefaultConnectionNameGenerator.forProduct | public static DefaultConnectionNameGenerator forProduct(String productName, String productVersion, String... comments) {
return new DefaultConnectionNameGenerator(
new UserAgentBuilder().append(productName, productVersion, comments));
} | java | public static DefaultConnectionNameGenerator forProduct(String productName, String productVersion, String... comments) {
return new DefaultConnectionNameGenerator(
new UserAgentBuilder().append(productName, productVersion, comments));
} | [
"public",
"static",
"DefaultConnectionNameGenerator",
"forProduct",
"(",
"String",
"productName",
",",
"String",
"productVersion",
",",
"String",
"...",
"comments",
")",
"{",
"return",
"new",
"DefaultConnectionNameGenerator",
"(",
"new",
"UserAgentBuilder",
"(",
")",
... | Returns a new connection name generator that includes the given product information in the User Agent string.
@param productName Product name to include in the User Agent string.
@param productVersion Optional product version to include in the User Agent string. May be null.
@param comments Optional comments to include in the User Agent string. | [
"Returns",
"a",
"new",
"connection",
"name",
"generator",
"that",
"includes",
"the",
"given",
"product",
"information",
"in",
"the",
"User",
"Agent",
"string",
"."
] | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/DefaultConnectionNameGenerator.java#L55-L58 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java | JCusolverDn.cusolverDnSsygvd_bufferSize | public static int cusolverDnSsygvd_bufferSize(
cusolverDnHandle handle,
int itype,
int jobz,
int uplo,
int n,
Pointer A,
int lda,
Pointer B,
int ldb,
Pointer W,
int[] lwork)
{
return checkResult(cusolverDnSsygvd_bufferSizeNative(handle, itype, jobz, uplo, n, A, lda, B, ldb, W, lwork));
} | java | public static int cusolverDnSsygvd_bufferSize(
cusolverDnHandle handle,
int itype,
int jobz,
int uplo,
int n,
Pointer A,
int lda,
Pointer B,
int ldb,
Pointer W,
int[] lwork)
{
return checkResult(cusolverDnSsygvd_bufferSizeNative(handle, itype, jobz, uplo, n, A, lda, B, ldb, W, lwork));
} | [
"public",
"static",
"int",
"cusolverDnSsygvd_bufferSize",
"(",
"cusolverDnHandle",
"handle",
",",
"int",
"itype",
",",
"int",
"jobz",
",",
"int",
"uplo",
",",
"int",
"n",
",",
"Pointer",
"A",
",",
"int",
"lda",
",",
"Pointer",
"B",
",",
"int",
"ldb",
","... | generalized symmetric eigenvalue solver, A*x = lambda*B*x, by divide-and-conquer | [
"generalized",
"symmetric",
"eigenvalue",
"solver",
"A",
"*",
"x",
"=",
"lambda",
"*",
"B",
"*",
"x",
"by",
"divide",
"-",
"and",
"-",
"conquer"
] | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverDn.java#L3237-L3251 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/widget/ToastUtils.java | ToastUtils.showOnUiThread | public static void showOnUiThread(Context applicationContext, int stringResId, int duration) {
Handler handler = HandlerUtils.getMainHandler();
showOnUiThread(applicationContext, stringResId, duration, handler);
} | java | public static void showOnUiThread(Context applicationContext, int stringResId, int duration) {
Handler handler = HandlerUtils.getMainHandler();
showOnUiThread(applicationContext, stringResId, duration, handler);
} | [
"public",
"static",
"void",
"showOnUiThread",
"(",
"Context",
"applicationContext",
",",
"int",
"stringResId",
",",
"int",
"duration",
")",
"{",
"Handler",
"handler",
"=",
"HandlerUtils",
".",
"getMainHandler",
"(",
")",
";",
"showOnUiThread",
"(",
"applicationCon... | Show toast on the UI thread.
@param applicationContext the application context.
@param stringResId to show.
@param duration the display duration. | [
"Show",
"toast",
"on",
"the",
"UI",
"thread",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/widget/ToastUtils.java#L39-L42 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/widget/SearchView.java | SearchView.setQuery | public void setQuery(CharSequence query, boolean submit) {
mQueryTextView.setText(query);
if (query != null) {
mQueryTextView.setSelection(mQueryTextView.length());
mUserQuery = query;
}
// If the query is not empty and submit is requested, submit the query
if (submit && !TextUtils.isEmpty(query)) {
onSubmitQuery();
}
} | java | public void setQuery(CharSequence query, boolean submit) {
mQueryTextView.setText(query);
if (query != null) {
mQueryTextView.setSelection(mQueryTextView.length());
mUserQuery = query;
}
// If the query is not empty and submit is requested, submit the query
if (submit && !TextUtils.isEmpty(query)) {
onSubmitQuery();
}
} | [
"public",
"void",
"setQuery",
"(",
"CharSequence",
"query",
",",
"boolean",
"submit",
")",
"{",
"mQueryTextView",
".",
"setText",
"(",
"query",
")",
";",
"if",
"(",
"query",
"!=",
"null",
")",
"{",
"mQueryTextView",
".",
"setSelection",
"(",
"mQueryTextView"... | Sets a query string in the text field and optionally submits the query as well.
@param query the query string. This replaces any query text already present in the
text field.
@param submit whether to submit the query right now or only update the contents of
text field. | [
"Sets",
"a",
"query",
"string",
"in",
"the",
"text",
"field",
"and",
"optionally",
"submits",
"the",
"query",
"as",
"well",
"."
] | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/widget/SearchView.java#L533-L544 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java | JobSubmissionHelper.getFileResourceProto | private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
File file = new File(fileName);
if (file.exists()) {
// It is a local file and can be added.
if (file.isDirectory()) {
// If it is a directory, create a JAR file of it and add that instead.
file = toJar(file);
}
return FileResourceImpl.newBuilder()
.setName(file.getName())
.setPath(file.getPath())
.setType(type)
.build();
} else {
// The file isn't in the local filesytem. Assume that the file is actually a URI.
// We then assume that the underlying resource manager knows how to deal with it.
try {
final URI uri = new URI(fileName);
final String path = uri.getPath();
final String name = path.substring(path.lastIndexOf('/') + 1);
return FileResourceImpl.newBuilder()
.setName(name)
.setPath(uri.toString())
.setType(type)
.build();
} catch (final URISyntaxException e) {
throw new IOException("Unable to parse URI.", e);
}
}
} | java | private static FileResource getFileResourceProto(final String fileName, final FileType type) throws IOException {
File file = new File(fileName);
if (file.exists()) {
// It is a local file and can be added.
if (file.isDirectory()) {
// If it is a directory, create a JAR file of it and add that instead.
file = toJar(file);
}
return FileResourceImpl.newBuilder()
.setName(file.getName())
.setPath(file.getPath())
.setType(type)
.build();
} else {
// The file isn't in the local filesytem. Assume that the file is actually a URI.
// We then assume that the underlying resource manager knows how to deal with it.
try {
final URI uri = new URI(fileName);
final String path = uri.getPath();
final String name = path.substring(path.lastIndexOf('/') + 1);
return FileResourceImpl.newBuilder()
.setName(name)
.setPath(uri.toString())
.setType(type)
.build();
} catch (final URISyntaxException e) {
throw new IOException("Unable to parse URI.", e);
}
}
} | [
"private",
"static",
"FileResource",
"getFileResourceProto",
"(",
"final",
"String",
"fileName",
",",
"final",
"FileType",
"type",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"if",
"(",
"file",
".",
"exis... | Turns a pathname into the right protocol for job submission.
@param fileName
@param type
@return
@throws IOException | [
"Turns",
"a",
"pathname",
"into",
"the",
"right",
"protocol",
"for",
"job",
"submission",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/JobSubmissionHelper.java#L141-L170 |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.readFromInputStreamIntoString | public static String readFromInputStreamIntoString(InputStream inputStream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
while( (line = reader.readLine()) != null) {
text.append(line).append("\n");
}
inputStream.close();
return text.toString();
} | java | public static String readFromInputStreamIntoString(InputStream inputStream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
while( (line = reader.readLine()) != null) {
text.append(line).append("\n");
}
inputStream.close();
return text.toString();
} | [
"public",
"static",
"String",
"readFromInputStreamIntoString",
"(",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
"... | This method reads all data from an {@code InputStream} into a String object. This method will close the stream.
@param inputStream {@code InputStream} to read text from
@return <code>String</code> containing all input stream data
@throws IOException IO exception | [
"This",
"method",
"reads",
"all",
"data",
"from",
"an",
"{"
] | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L63-L74 |
jingwei/krati | krati-main/src/main/java/krati/core/array/basic/AbstractRecoverableArray.java | AbstractRecoverableArray.openArrayFile | protected final ArrayFile openArrayFile(File file, int initialLength, int elementSize) throws IOException {
boolean isNew = true;
if (file.exists()) {
isNew = false;
}
ArrayFile arrayFile = new ArrayFile(file, initialLength, elementSize);
if (isNew) {
initArrayFile();
}
return arrayFile;
} | java | protected final ArrayFile openArrayFile(File file, int initialLength, int elementSize) throws IOException {
boolean isNew = true;
if (file.exists()) {
isNew = false;
}
ArrayFile arrayFile = new ArrayFile(file, initialLength, elementSize);
if (isNew) {
initArrayFile();
}
return arrayFile;
} | [
"protected",
"final",
"ArrayFile",
"openArrayFile",
"(",
"File",
"file",
",",
"int",
"initialLength",
",",
"int",
"elementSize",
")",
"throws",
"IOException",
"{",
"boolean",
"isNew",
"=",
"true",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
... | Opens the {@link ArrayFile} with the specified initial length and the element size.
@param file - the file backing up the array.
@param initialLength - the initial length of the array.
@param elementSize - the number of bytes per element.
@return the instance of {@link ArrayFile}.
@throws IOException if this array file cannot be created for any reasons. | [
"Opens",
"the",
"{",
"@link",
"ArrayFile",
"}",
"with",
"the",
"specified",
"initial",
"length",
"and",
"the",
"element",
"size",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/AbstractRecoverableArray.java#L134-L146 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java | PJsonObject.optJSONArray | public final PJsonArray optJSONArray(final String key, final PJsonArray defaultValue) {
PJsonArray result = optJSONArray(key);
return result != null ? result : defaultValue;
} | java | public final PJsonArray optJSONArray(final String key, final PJsonArray defaultValue) {
PJsonArray result = optJSONArray(key);
return result != null ? result : defaultValue;
} | [
"public",
"final",
"PJsonArray",
"optJSONArray",
"(",
"final",
"String",
"key",
",",
"final",
"PJsonArray",
"defaultValue",
")",
"{",
"PJsonArray",
"result",
"=",
"optJSONArray",
"(",
"key",
")",
";",
"return",
"result",
"!=",
"null",
"?",
"result",
":",
"de... | Get a property as a json array or default.
@param key the property name
@param defaultValue default | [
"Get",
"a",
"property",
"as",
"a",
"json",
"array",
"or",
"default",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java#L195-L198 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Chebyshev | public static double Chebyshev(double[] p, double[] q) {
double max = Math.abs(p[0] - q[0]);
for (int i = 1; i < p.length; i++) {
double abs = Math.abs(p[i] - q[i]);
if (abs > max) max = abs;
}
return max;
} | java | public static double Chebyshev(double[] p, double[] q) {
double max = Math.abs(p[0] - q[0]);
for (int i = 1; i < p.length; i++) {
double abs = Math.abs(p[i] - q[i]);
if (abs > max) max = abs;
}
return max;
} | [
"public",
"static",
"double",
"Chebyshev",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"double",
"max",
"=",
"Math",
".",
"abs",
"(",
"p",
"[",
"0",
"]",
"-",
"q",
"[",
"0",
"]",
")",
";",
"for",
"(",
"int",
"i",
"... | Gets the Chebyshev distance between two points.
@param p A point in space.
@param q A point in space.
@return The Chebyshev distance between x and y. | [
"Gets",
"the",
"Chebyshev",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L178-L187 |
micronaut-projects/micronaut-core | runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java | JacksonConfiguration.setSerialization | public void setSerialization(Map<SerializationFeature, Boolean> serialization) {
if (CollectionUtils.isNotEmpty(serialization)) {
this.serialization = serialization;
}
} | java | public void setSerialization(Map<SerializationFeature, Boolean> serialization) {
if (CollectionUtils.isNotEmpty(serialization)) {
this.serialization = serialization;
}
} | [
"public",
"void",
"setSerialization",
"(",
"Map",
"<",
"SerializationFeature",
",",
"Boolean",
">",
"serialization",
")",
"{",
"if",
"(",
"CollectionUtils",
".",
"isNotEmpty",
"(",
"serialization",
")",
")",
"{",
"this",
".",
"serialization",
"=",
"serialization... | Sets the serialization features to use.
@param serialization The serialization features. | [
"Sets",
"the",
"serialization",
"features",
"to",
"use",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java#L235-L239 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/tools/Model.java | Model.setRange | public void setRange(final double MIN_VALUE, final double MAX_VALUE) {
maxValue = MAX_VALUE;
minValue = MIN_VALUE;
calculate();
validate();
calcAngleStep();
fireStateChanged();
} | java | public void setRange(final double MIN_VALUE, final double MAX_VALUE) {
maxValue = MAX_VALUE;
minValue = MIN_VALUE;
calculate();
validate();
calcAngleStep();
fireStateChanged();
} | [
"public",
"void",
"setRange",
"(",
"final",
"double",
"MIN_VALUE",
",",
"final",
"double",
"MAX_VALUE",
")",
"{",
"maxValue",
"=",
"MAX_VALUE",
";",
"minValue",
"=",
"MIN_VALUE",
";",
"calculate",
"(",
")",
";",
"validate",
"(",
")",
";",
"calcAngleStep",
... | Sets the minimum and maximum value for the calculation of the
nice minimum and nice maximum values.
@param MIN_VALUE
@param MAX_VALUE | [
"Sets",
"the",
"minimum",
"and",
"maximum",
"value",
"for",
"the",
"calculation",
"of",
"the",
"nice",
"minimum",
"and",
"nice",
"maximum",
"values",
"."
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/Model.java#L418-L425 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsBasicDialog.java | CmsBasicDialog.addButton | public void addButton(Component button, boolean right) {
if (right) {
m_buttonPanelRight.addComponent(button);
} else {
m_buttonPanelLeft.addComponent(button);
m_buttonPanelLeft.setVisible(true);
}
} | java | public void addButton(Component button, boolean right) {
if (right) {
m_buttonPanelRight.addComponent(button);
} else {
m_buttonPanelLeft.addComponent(button);
m_buttonPanelLeft.setVisible(true);
}
} | [
"public",
"void",
"addButton",
"(",
"Component",
"button",
",",
"boolean",
"right",
")",
"{",
"if",
"(",
"right",
")",
"{",
"m_buttonPanelRight",
".",
"addComponent",
"(",
"button",
")",
";",
"}",
"else",
"{",
"m_buttonPanelLeft",
".",
"addComponent",
"(",
... | Adds a button to the button bar.<p>
@param button the button to add
@param right to align the button right | [
"Adds",
"a",
"button",
"to",
"the",
"button",
"bar",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBasicDialog.java#L232-L240 |
ACRA/acra | acra-core/src/main/java/org/acra/collector/LogCatCollector.java | LogCatCollector.streamToString | @NonNull
private String streamToString(@NonNull CoreConfiguration config, @NonNull InputStream input, @Nullable Predicate<String> filter, int limit) throws IOException {
final StreamReader reader = new StreamReader(input).setFilter(filter).setLimit(limit);
if (config.logcatReadNonBlocking()) {
reader.setTimeout(READ_TIMEOUT);
}
return reader.read();
} | java | @NonNull
private String streamToString(@NonNull CoreConfiguration config, @NonNull InputStream input, @Nullable Predicate<String> filter, int limit) throws IOException {
final StreamReader reader = new StreamReader(input).setFilter(filter).setLimit(limit);
if (config.logcatReadNonBlocking()) {
reader.setTimeout(READ_TIMEOUT);
}
return reader.read();
} | [
"@",
"NonNull",
"private",
"String",
"streamToString",
"(",
"@",
"NonNull",
"CoreConfiguration",
"config",
",",
"@",
"NonNull",
"InputStream",
"input",
",",
"@",
"Nullable",
"Predicate",
"<",
"String",
">",
"filter",
",",
"int",
"limit",
")",
"throws",
"IOExce... | Reads an InputStream into a string respecting blocking settings.
@param input the stream
@param filter should return false for lines which should be excluded
@param limit the maximum number of lines to read (the last x lines are kept)
@return the String that was read.
@throws IOException if the stream cannot be read. | [
"Reads",
"an",
"InputStream",
"into",
"a",
"string",
"respecting",
"blocking",
"settings",
"."
] | train | https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/collector/LogCatCollector.java#L135-L142 |
marvinlabs/android-floatinglabel-widgets | library/src/main/java/com/marvinlabs/widget/floatinglabel/instantpicker/DatePickerFragment.java | DatePickerFragment.newInstance | public static <DateInstantT extends DateInstant> DatePickerFragment newInstance(int pickerId, DateInstantT selectedInstant) {
DatePickerFragment f = new DatePickerFragment();
Bundle args = new Bundle();
args.putInt(ARG_PICKER_ID, pickerId);
args.putParcelable(ARG_SELECTED_INSTANT, selectedInstant);
f.setArguments(args);
return f;
} | java | public static <DateInstantT extends DateInstant> DatePickerFragment newInstance(int pickerId, DateInstantT selectedInstant) {
DatePickerFragment f = new DatePickerFragment();
Bundle args = new Bundle();
args.putInt(ARG_PICKER_ID, pickerId);
args.putParcelable(ARG_SELECTED_INSTANT, selectedInstant);
f.setArguments(args);
return f;
} | [
"public",
"static",
"<",
"DateInstantT",
"extends",
"DateInstant",
">",
"DatePickerFragment",
"newInstance",
"(",
"int",
"pickerId",
",",
"DateInstantT",
"selectedInstant",
")",
"{",
"DatePickerFragment",
"f",
"=",
"new",
"DatePickerFragment",
"(",
")",
";",
"Bundle... | Create a new date picker
@param pickerId The id of the item picker
@param selectedInstant The positions of the items already selected
@return The arguments bundle | [
"Create",
"a",
"new",
"date",
"picker"
] | train | https://github.com/marvinlabs/android-floatinglabel-widgets/blob/bb89889f1e75ed9b228b77d3ba895ceeeb41fe4f/library/src/main/java/com/marvinlabs/widget/floatinglabel/instantpicker/DatePickerFragment.java#L30-L39 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java | TemperatureConversion.convertFromKelvin | public static double convertFromKelvin(TemperatureScale to, double temperature) {
switch(to) {
case FARENHEIT:
return convertKelvinToFarenheit(temperature);
case CELSIUS:
return convertKelvinToCelsius(temperature);
case KELVIN:
return temperature;
case RANKINE:
return convertKelvinToRankine(temperature);
default:
throw(new RuntimeException("Invalid termpature conversion"));
}
} | java | public static double convertFromKelvin(TemperatureScale to, double temperature) {
switch(to) {
case FARENHEIT:
return convertKelvinToFarenheit(temperature);
case CELSIUS:
return convertKelvinToCelsius(temperature);
case KELVIN:
return temperature;
case RANKINE:
return convertKelvinToRankine(temperature);
default:
throw(new RuntimeException("Invalid termpature conversion"));
}
} | [
"public",
"static",
"double",
"convertFromKelvin",
"(",
"TemperatureScale",
"to",
",",
"double",
"temperature",
")",
"{",
"switch",
"(",
"to",
")",
"{",
"case",
"FARENHEIT",
":",
"return",
"convertKelvinToFarenheit",
"(",
"temperature",
")",
";",
"case",
"CELSIU... | Convert a temperature value from the Kelvin temperature scale to another.
@param to TemperatureScale
@param temperature value in Kelvin
@return converted temperature value in the requested to scale | [
"Convert",
"a",
"temperature",
"value",
"from",
"the",
"Kelvin",
"temperature",
"scale",
"to",
"another",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L169-L184 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.classOrInterfaceOrEnumDeclaration | protected JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
if (token.kind == CLASS) {
return classDeclaration(mods, dc);
} else if (token.kind == INTERFACE) {
return interfaceDeclaration(mods, dc);
} else if (token.kind == ENUM) {
return enumDeclaration(mods, dc);
} else {
int pos = token.pos;
List<JCTree> errs;
if (LAX_IDENTIFIER.accepts(token.kind)) {
errs = List.of(mods, toP(F.at(pos).Ident(ident())));
setErrorEndPos(token.pos);
} else {
errs = List.of(mods);
}
final JCErroneous erroneousTree;
if (parseModuleInfo) {
erroneousTree = syntaxError(pos, errs, "expected.module.or.open");
} else {
erroneousTree = syntaxError(pos, errs, "expected3", CLASS, INTERFACE, ENUM);
}
return toP(F.Exec(erroneousTree));
}
} | java | protected JCStatement classOrInterfaceOrEnumDeclaration(JCModifiers mods, Comment dc) {
if (token.kind == CLASS) {
return classDeclaration(mods, dc);
} else if (token.kind == INTERFACE) {
return interfaceDeclaration(mods, dc);
} else if (token.kind == ENUM) {
return enumDeclaration(mods, dc);
} else {
int pos = token.pos;
List<JCTree> errs;
if (LAX_IDENTIFIER.accepts(token.kind)) {
errs = List.of(mods, toP(F.at(pos).Ident(ident())));
setErrorEndPos(token.pos);
} else {
errs = List.of(mods);
}
final JCErroneous erroneousTree;
if (parseModuleInfo) {
erroneousTree = syntaxError(pos, errs, "expected.module.or.open");
} else {
erroneousTree = syntaxError(pos, errs, "expected3", CLASS, INTERFACE, ENUM);
}
return toP(F.Exec(erroneousTree));
}
} | [
"protected",
"JCStatement",
"classOrInterfaceOrEnumDeclaration",
"(",
"JCModifiers",
"mods",
",",
"Comment",
"dc",
")",
"{",
"if",
"(",
"token",
".",
"kind",
"==",
"CLASS",
")",
"{",
"return",
"classDeclaration",
"(",
"mods",
",",
"dc",
")",
";",
"}",
"else"... | ClassOrInterfaceOrEnumDeclaration = ModifiersOpt
(ClassDeclaration | InterfaceDeclaration | EnumDeclaration)
@param mods Any modifiers starting the class or interface declaration
@param dc The documentation comment for the class, or null. | [
"ClassOrInterfaceOrEnumDeclaration",
"=",
"ModifiersOpt",
"(",
"ClassDeclaration",
"|",
"InterfaceDeclaration",
"|",
"EnumDeclaration",
")"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3350-L3374 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addMethodInfo | private void addMethodInfo(ExecutableElement method, Content dl) {
TypeElement enclosing = utils.getEnclosingTypeElement(method);
List<? extends TypeMirror> intfacs = enclosing.getInterfaces();
ExecutableElement overriddenMethod = utils.overriddenMethod(method);
// Check whether there is any implementation or overridden info to be
// printed. If no overridden or implementation info needs to be
// printed, do not print this section.
if ((!intfacs.isEmpty()
&& new ImplementedMethods(method, this.configuration).build().isEmpty() == false)
|| overriddenMethod != null) {
MethodWriterImpl.addImplementsInfo(this, method, dl);
if (overriddenMethod != null) {
MethodWriterImpl.addOverridden(this,
utils.overriddenType(method),
overriddenMethod,
dl);
}
}
} | java | private void addMethodInfo(ExecutableElement method, Content dl) {
TypeElement enclosing = utils.getEnclosingTypeElement(method);
List<? extends TypeMirror> intfacs = enclosing.getInterfaces();
ExecutableElement overriddenMethod = utils.overriddenMethod(method);
// Check whether there is any implementation or overridden info to be
// printed. If no overridden or implementation info needs to be
// printed, do not print this section.
if ((!intfacs.isEmpty()
&& new ImplementedMethods(method, this.configuration).build().isEmpty() == false)
|| overriddenMethod != null) {
MethodWriterImpl.addImplementsInfo(this, method, dl);
if (overriddenMethod != null) {
MethodWriterImpl.addOverridden(this,
utils.overriddenType(method),
overriddenMethod,
dl);
}
}
} | [
"private",
"void",
"addMethodInfo",
"(",
"ExecutableElement",
"method",
",",
"Content",
"dl",
")",
"{",
"TypeElement",
"enclosing",
"=",
"utils",
".",
"getEnclosingTypeElement",
"(",
"method",
")",
";",
"List",
"<",
"?",
"extends",
"TypeMirror",
">",
"intfacs",
... | Add method information.
@param method the method to be documented
@param dl the content tree to which the method information will be added | [
"Add",
"method",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L284-L302 |
jsonld-java/jsonld-java | core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java | JsonLdApi.removeEmbed | private static void removeEmbed(FramingContext state, String id) {
// get existing embed
final Map<String, EmbedNode> links = state.uniqueEmbeds;
final EmbedNode embed = links.get(id);
final Object parent = embed.parent;
final String property = embed.property;
// create reference to replace embed
final Map<String, Object> node = newMap(JsonLdConsts.ID, id);
// remove existing embed
if (JsonLdUtils.isNode(parent)) {
// replace subject with reference
final List<Object> newvals = new ArrayList<Object>();
final List<Object> oldvals = (List<Object>) ((Map<String, Object>) parent)
.get(property);
for (final Object v : oldvals) {
if (v instanceof Map
&& Obj.equals(((Map<String, Object>) v).get(JsonLdConsts.ID), id)) {
newvals.add(node);
} else {
newvals.add(v);
}
}
((Map<String, Object>) parent).put(property, newvals);
}
// recursively remove dependent dangling embeds
removeDependents(links, id);
} | java | private static void removeEmbed(FramingContext state, String id) {
// get existing embed
final Map<String, EmbedNode> links = state.uniqueEmbeds;
final EmbedNode embed = links.get(id);
final Object parent = embed.parent;
final String property = embed.property;
// create reference to replace embed
final Map<String, Object> node = newMap(JsonLdConsts.ID, id);
// remove existing embed
if (JsonLdUtils.isNode(parent)) {
// replace subject with reference
final List<Object> newvals = new ArrayList<Object>();
final List<Object> oldvals = (List<Object>) ((Map<String, Object>) parent)
.get(property);
for (final Object v : oldvals) {
if (v instanceof Map
&& Obj.equals(((Map<String, Object>) v).get(JsonLdConsts.ID), id)) {
newvals.add(node);
} else {
newvals.add(v);
}
}
((Map<String, Object>) parent).put(property, newvals);
}
// recursively remove dependent dangling embeds
removeDependents(links, id);
} | [
"private",
"static",
"void",
"removeEmbed",
"(",
"FramingContext",
"state",
",",
"String",
"id",
")",
"{",
"// get existing embed",
"final",
"Map",
"<",
"String",
",",
"EmbedNode",
">",
"links",
"=",
"state",
".",
"uniqueEmbeds",
";",
"final",
"EmbedNode",
"em... | Removes an existing embed.
@param state
the current framing state.
@param id
the @id of the embed to remove. | [
"Removes",
"an",
"existing",
"embed",
"."
] | train | https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/core/JsonLdApi.java#L1651-L1679 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/animation/AnimatorInflater.java | AnimatorInflater.loadAnimator | public static Animator loadAnimator(Context context, int id)
throws NotFoundException {
XmlResourceParser parser = null;
try {
parser = context.getResources().getAnimation(id);
return createAnimatorFromXml(context, parser);
} catch (XmlPullParserException ex) {
Resources.NotFoundException rnf =
new Resources.NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} catch (IOException ex) {
Resources.NotFoundException rnf =
new Resources.NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} finally {
if (parser != null) parser.close();
}
} | java | public static Animator loadAnimator(Context context, int id)
throws NotFoundException {
XmlResourceParser parser = null;
try {
parser = context.getResources().getAnimation(id);
return createAnimatorFromXml(context, parser);
} catch (XmlPullParserException ex) {
Resources.NotFoundException rnf =
new Resources.NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} catch (IOException ex) {
Resources.NotFoundException rnf =
new Resources.NotFoundException("Can't load animation resource ID #0x" +
Integer.toHexString(id));
rnf.initCause(ex);
throw rnf;
} finally {
if (parser != null) parser.close();
}
} | [
"public",
"static",
"Animator",
"loadAnimator",
"(",
"Context",
"context",
",",
"int",
"id",
")",
"throws",
"NotFoundException",
"{",
"XmlResourceParser",
"parser",
"=",
"null",
";",
"try",
"{",
"parser",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"... | Loads an {@link Animator} object from a resource
@param context Application context used to access resources
@param id The resource id of the animation to load
@return The animator object reference by the specified id
@throws android.content.res.Resources.NotFoundException when the animation cannot be loaded | [
"Loads",
"an",
"{",
"@link",
"Animator",
"}",
"object",
"from",
"a",
"resource"
] | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/animation/AnimatorInflater.java#L94-L116 |
anotheria/configureme | src/main/java/org/configureme/util/IOUtils.java | IOUtils.readFileBufferedAsString | public static String readFileBufferedAsString(final File file, final String charset) throws IOException {
return readInputStreamBufferedAsString(new FileInputStream(file), charset);
} | java | public static String readFileBufferedAsString(final File file, final String charset) throws IOException {
return readInputStreamBufferedAsString(new FileInputStream(file), charset);
} | [
"public",
"static",
"String",
"readFileBufferedAsString",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"readInputStreamBufferedAsString",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"charset"... | <p>readFileBufferedAsString.</p>
@param file a {@link java.io.File} object.
@param charset a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
@throws java.io.IOException if any. | [
"<p",
">",
"readFileBufferedAsString",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/util/IOUtils.java#L149-L151 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.setOrthoSymmetricLH | public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
_identity();
m00 = 2.0 / width;
m11 = 2.0 / height;
m22 = (zZeroToOne ? 1.0 : 2.0) / (zFar - zNear);
m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar);
properties = PROPERTY_AFFINE;
return this;
} | java | public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
_identity();
m00 = 2.0 / width;
m11 = 2.0 / height;
m22 = (zZeroToOne ? 1.0 : 2.0) / (zFar - zNear);
m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar);
properties = PROPERTY_AFFINE;
return this;
} | [
"public",
"Matrix4d",
"setOrthoSymmetricLH",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",
")",
"==",
"0",
")",
... | Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range.
<p>
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetricLH(double, double, double, double, boolean) orthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetricLH(double, double, double, double, boolean)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"This",
"method",
"is",
"equivalen... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10490-L10499 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/ringsearch/AllRingsFinder.java | AllRingsFinder.toRing | private IRing toRing(IAtomContainer container, EdgeToBondMap edges, int[] cycle) {
IRing ring = container.getBuilder().newInstance(IRing.class, 0);
int len = cycle.length - 1;
IAtom[] atoms = new IAtom[len];
IBond[] bonds = new IBond[len];
for (int i = 0; i < len; i++) {
atoms[i] = container.getAtom(cycle[i]);
bonds[i] = edges.get(cycle[i], cycle[i + 1]);
atoms[i].setFlag(CDKConstants.ISINRING, true);
}
ring.setAtoms(atoms);
ring.setBonds(bonds);
return ring;
} | java | private IRing toRing(IAtomContainer container, EdgeToBondMap edges, int[] cycle) {
IRing ring = container.getBuilder().newInstance(IRing.class, 0);
int len = cycle.length - 1;
IAtom[] atoms = new IAtom[len];
IBond[] bonds = new IBond[len];
for (int i = 0; i < len; i++) {
atoms[i] = container.getAtom(cycle[i]);
bonds[i] = edges.get(cycle[i], cycle[i + 1]);
atoms[i].setFlag(CDKConstants.ISINRING, true);
}
ring.setAtoms(atoms);
ring.setBonds(bonds);
return ring;
} | [
"private",
"IRing",
"toRing",
"(",
"IAtomContainer",
"container",
",",
"EdgeToBondMap",
"edges",
",",
"int",
"[",
"]",
"cycle",
")",
"{",
"IRing",
"ring",
"=",
"container",
".",
"getBuilder",
"(",
")",
".",
"newInstance",
"(",
"IRing",
".",
"class",
",",
... | Convert a cycle in {@literal int[]} representation to an {@link IRing}.
@param container atom container
@param edges edge map
@param cycle vertex walk forming the cycle, first and last vertex the
same
@return a new ring | [
"Convert",
"a",
"cycle",
"in",
"{",
"@literal",
"int",
"[]",
"}",
"representation",
"to",
"an",
"{",
"@link",
"IRing",
"}",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/ringsearch/AllRingsFinder.java#L249-L267 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.processUpdateGroup | protected <T> long processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException {
Logger localLogger = obj == null ? logger : LoggerFactory.getLogger(obj.getClass());
CpoClass cpoClass;
if (obj == null) {
throw new CpoException("NULL Object passed into insertObject, deleteObject, updateObject, or persistObject");
}
try {
cpoClass = metaDescriptor.getMetaClass(obj);
List<CpoFunction> cpoFunctions = cpoClass.getFunctionGroup(getGroupType(obj, groupType, groupName, sess), groupName).getFunctions();
localLogger.info("=================== Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");
for (CpoFunction cpoFunction : cpoFunctions) {
CassandraBoundStatementFactory boundStatementFactory = new CassandraBoundStatementFactory(sess, this, cpoClass, cpoFunction, obj, wheres, orderBy, nativeExpressions);
executeBoundStatement(sess, boundStatementFactory);
}
localLogger.info("=================== " + " Updates - Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");
} catch (Throwable t) {
String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + obj.getClass().getName();
// TODO FIX THIS
// localLogger.error("bound values:" + this.parameterToString(jq));
localLogger.error(msg, t);
throw new CpoException(msg, t);
}
return unknownModifyCount;
} | java | protected <T> long processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Session sess) throws CpoException {
Logger localLogger = obj == null ? logger : LoggerFactory.getLogger(obj.getClass());
CpoClass cpoClass;
if (obj == null) {
throw new CpoException("NULL Object passed into insertObject, deleteObject, updateObject, or persistObject");
}
try {
cpoClass = metaDescriptor.getMetaClass(obj);
List<CpoFunction> cpoFunctions = cpoClass.getFunctionGroup(getGroupType(obj, groupType, groupName, sess), groupName).getFunctions();
localLogger.info("=================== Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");
for (CpoFunction cpoFunction : cpoFunctions) {
CassandraBoundStatementFactory boundStatementFactory = new CassandraBoundStatementFactory(sess, this, cpoClass, cpoFunction, obj, wheres, orderBy, nativeExpressions);
executeBoundStatement(sess, boundStatementFactory);
}
localLogger.info("=================== " + " Updates - Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> =========================");
} catch (Throwable t) {
String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + obj.getClass().getName();
// TODO FIX THIS
// localLogger.error("bound values:" + this.parameterToString(jq));
localLogger.error(msg, t);
throw new CpoException(msg, t);
}
return unknownModifyCount;
} | [
"protected",
"<",
"T",
">",
"long",
"processUpdateGroup",
"(",
"T",
"obj",
",",
"String",
"groupType",
",",
"String",
"groupName",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
",",
"Collection",
"<",
"CpoOrderBy",
">",
"orderBy",
",",
"Collection",
"<"... | DOCUMENT ME!
@param obj DOCUMENT ME!
@param groupType DOCUMENT ME!
@param groupName DOCUMENT ME!
@param sess DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L2070-L2097 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmailValidator.java | EmailValidator.isValid | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
if (pvalue.length() > LENGTH_MAIL) {
// Email is to long, but that's handled by size annotation
return true;
}
if (!StringUtils.equals(pvalue, StringUtils.trim(pvalue))) {
// mail contains leading or trailing space(s), that's not correct
return false;
}
return org.apache.commons.validator.routines.EmailValidator.getInstance().isValid(pvalue);
} | java | @Override
public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
if (StringUtils.isEmpty(pvalue)) {
return true;
}
if (pvalue.length() > LENGTH_MAIL) {
// Email is to long, but that's handled by size annotation
return true;
}
if (!StringUtils.equals(pvalue, StringUtils.trim(pvalue))) {
// mail contains leading or trailing space(s), that's not correct
return false;
}
return org.apache.commons.validator.routines.EmailValidator.getInstance().isValid(pvalue);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"String",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"pvalue",
")",
")",
"{",
"return",
"true",
";",
"}",
... | {@inheritDoc} check if given string is a valid mail.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"mail",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmailValidator.java#L53-L67 |
Red5/red5-io | src/main/java/org/red5/io/flv/impl/FLVReader.java | FLVReader.readTagHeader | private ITag readTagHeader() throws UnsupportedDataTypeException {
// previous tag size (4 bytes) + flv tag header size (11 bytes)
fillBuffer(15);
// previous tag's size
int previousTagSize = in.getInt();
// start of the flv tag
byte dataType = in.get();
if (log.isTraceEnabled()) {
log.trace("Bits: {}", Integer.toBinaryString(dataType));
}
dataType = (byte) (dataType & 31);
byte filter = (byte) ((dataType & 63) >> 5);
byte reserved = (byte) ((dataType & 127) >> 6);
log.debug("Reserved: {}, Filter: {}, Datatype: {}", reserved, filter, dataType);
switch (dataType) {
case 8: // audio
log.debug("Found audio");
break;
case 9: // video
log.debug("Found video");
break;
case 15: // special fms undocumented type?
case 18: // meta / script data
log.debug("Found meta/script data");
break;
default:
log.debug("Invalid data type detected ({}), reading ahead\n current position: {} limit: {}", dataType, in.position(), in.limit());
throw new UnsupportedDataTypeException("Invalid data type detected (" + dataType + ")");
}
int bodySize = IOUtils.readUnsignedMediumInt(in);
int timestamp = IOUtils.readExtendedMediumInt(in);
int streamId = IOUtils.readUnsignedMediumInt(in);
if (log.isDebugEnabled()) {
log.debug("Data type: {} timestamp: {} stream id: {} body size: {} previous tag size: {}", new Object[] { dataType, timestamp, streamId, bodySize, previousTagSize });
}
return new Tag(dataType, timestamp, bodySize, null, previousTagSize);
} | java | private ITag readTagHeader() throws UnsupportedDataTypeException {
// previous tag size (4 bytes) + flv tag header size (11 bytes)
fillBuffer(15);
// previous tag's size
int previousTagSize = in.getInt();
// start of the flv tag
byte dataType = in.get();
if (log.isTraceEnabled()) {
log.trace("Bits: {}", Integer.toBinaryString(dataType));
}
dataType = (byte) (dataType & 31);
byte filter = (byte) ((dataType & 63) >> 5);
byte reserved = (byte) ((dataType & 127) >> 6);
log.debug("Reserved: {}, Filter: {}, Datatype: {}", reserved, filter, dataType);
switch (dataType) {
case 8: // audio
log.debug("Found audio");
break;
case 9: // video
log.debug("Found video");
break;
case 15: // special fms undocumented type?
case 18: // meta / script data
log.debug("Found meta/script data");
break;
default:
log.debug("Invalid data type detected ({}), reading ahead\n current position: {} limit: {}", dataType, in.position(), in.limit());
throw new UnsupportedDataTypeException("Invalid data type detected (" + dataType + ")");
}
int bodySize = IOUtils.readUnsignedMediumInt(in);
int timestamp = IOUtils.readExtendedMediumInt(in);
int streamId = IOUtils.readUnsignedMediumInt(in);
if (log.isDebugEnabled()) {
log.debug("Data type: {} timestamp: {} stream id: {} body size: {} previous tag size: {}", new Object[] { dataType, timestamp, streamId, bodySize, previousTagSize });
}
return new Tag(dataType, timestamp, bodySize, null, previousTagSize);
} | [
"private",
"ITag",
"readTagHeader",
"(",
")",
"throws",
"UnsupportedDataTypeException",
"{",
"// previous tag size (4 bytes) + flv tag header size (11 bytes)",
"fillBuffer",
"(",
"15",
")",
";",
"// previous tag's size",
"int",
"previousTagSize",
"=",
"in",
".",
"getInt",
"... | Read only header part of a tag.
@return Tag header
@throws UnsupportedDataTypeException | [
"Read",
"only",
"header",
"part",
"of",
"a",
"tag",
"."
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVReader.java#L888-L924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.