repo stringclasses 199
values | path stringlengths 28 169 | func_name stringlengths 6 98 | original_string stringlengths 91 27.2k | language stringclasses 1
value | code stringlengths 91 27.2k | code_tokens listlengths 21 5.01k | docstring stringlengths 1 6.47k | docstring_tokens listlengths 1 587 | sha stringclasses 199
values | url stringlengths 117 257 | partition stringclasses 1
value | summary stringlengths 3 207 | output stringlengths 170 27.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NanoHttpd/nanohttpd | websocket/src/main/java/org/nanohttpd/protocols/websockets/WebSocketFrame.java | WebSocketFrame.readPayloadInfo | private void readPayloadInfo(InputStream in) throws IOException {
byte b = (byte) checkedRead(in.read());
boolean masked = (b & 0x80) != 0;
this._payloadLength = (byte) (0x7F & b);
if (this._payloadLength == 126) {
// checkedRead must return int for this to work
... | java | private void readPayloadInfo(InputStream in) throws IOException {
byte b = (byte) checkedRead(in.read());
boolean masked = (b & 0x80) != 0;
this._payloadLength = (byte) (0x7F & b);
if (this._payloadLength == 126) {
// checkedRead must return int for this to work
... | [
"private",
"void",
"readPayloadInfo",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"(",
"byte",
")",
"checkedRead",
"(",
"in",
".",
"read",
"(",
")",
")",
";",
"boolean",
"masked",
"=",
"(",
"b",
"&",
"0x80",
")",
"!... | --------------------------------ENCODING-------------------------------- | [
"--------------------------------",
"ENCODING",
"--------------------------------"
] | b04a342a4bcd0ff44be65138acffc73a29381c72 | https://github.com/NanoHttpd/nanohttpd/blob/b04a342a4bcd0ff44be65138acffc73a29381c72/websocket/src/main/java/org/nanohttpd/protocols/websockets/WebSocketFrame.java#L238-L278 | test | Read the payload info from the input stream. | Of course, here is the Java code you requested:
```java
private void readPayloadInfo(InputStream in) throws IOException {
byte b = (byte) checkedRead(in.read());
boolean masked = (b & 0x80) != 0;
this._payloadLength = (byte) (0x7F & b);
if (this._payloadLength == 126) {
// ... |
Unidata/thredds | cdm/src/main/java/ucar/util/prefs/PreferencesExt.java | PreferencesExt.putBeanObject | public void putBeanObject(String key, Object newValue) {
// if matches a stored Default, dont store
Object oldValue = getBean(key, null);
if ((oldValue == null) || !oldValue.equals( newValue))
keyValues.put( key, newValue);
} | java | public void putBeanObject(String key, Object newValue) {
// if matches a stored Default, dont store
Object oldValue = getBean(key, null);
if ((oldValue == null) || !oldValue.equals( newValue))
keyValues.put( key, newValue);
} | [
"public",
"void",
"putBeanObject",
"(",
"String",
"key",
",",
"Object",
"newValue",
")",
"{",
"// if matches a stored Default, dont store",
"Object",
"oldValue",
"=",
"getBean",
"(",
"key",
",",
"null",
")",
";",
"if",
"(",
"(",
"oldValue",
"==",
"null",
")",
... | Stores an object using XMLEncoder/XMLDecoder. Use this for arbitrary objects.
If the exact key and value are already in
the storedDefaults (using equals() to test for equality), then it is not
stored.
@param key key with which the specified value is to be associated.
@param newValue store this bean object.
@throws Nul... | [
"Stores",
"an",
"object",
"using",
"XMLEncoder",
"/",
"XMLDecoder",
".",
"Use",
"this",
"for",
"arbitrary",
"objects",
".",
"If",
"the",
"exact",
"key",
"and",
"value",
"are",
"already",
"in",
"the",
"storedDefaults",
"(",
"using",
"equals",
"()",
"to",
"t... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/util/prefs/PreferencesExt.java#L157-L162 | test | Put a bean object into the cache. | Of course, here is the Java code you requested:
```java
public void putBeanObject(String key, Object newValue) {
// if matches a stored Default, dont store
Object oldValue = getBean(key, null);
if ((oldValue == null) || !oldValue.equals( newValue))
keyValues.put( key, newValue);
}
```
Ho... |
ReactiveX/RxJava | src/main/java/io/reactivex/plugins/RxJavaPlugins.java | RxJavaPlugins.applyRequireNonNull | @NonNull
static Scheduler applyRequireNonNull(@NonNull Function<? super Callable<Scheduler>, ? extends Scheduler> f, Callable<Scheduler> s) {
return ObjectHelper.requireNonNull(apply(f, s), "Scheduler Callable result can't be null");
} | java | @NonNull
static Scheduler applyRequireNonNull(@NonNull Function<? super Callable<Scheduler>, ? extends Scheduler> f, Callable<Scheduler> s) {
return ObjectHelper.requireNonNull(apply(f, s), "Scheduler Callable result can't be null");
} | [
"@",
"NonNull",
"static",
"Scheduler",
"applyRequireNonNull",
"(",
"@",
"NonNull",
"Function",
"<",
"?",
"super",
"Callable",
"<",
"Scheduler",
">",
",",
"?",
"extends",
"Scheduler",
">",
"f",
",",
"Callable",
"<",
"Scheduler",
">",
"s",
")",
"{",
"return"... | Wraps the call to the Scheduler creation function in try-catch and propagates thrown
checked exceptions as RuntimeException and enforces that result is not null.
@param f the function to call, not null (not verified). Cannot return null
@param s the parameter value to the function
@return the result of the function cal... | [
"Wraps",
"the",
"call",
"to",
"the",
"Scheduler",
"creation",
"function",
"in",
"try",
"-",
"catch",
"and",
"propagates",
"thrown",
"checked",
"exceptions",
"as",
"RuntimeException",
"and",
"enforces",
"that",
"result",
"is",
"not",
"null",
"."
] | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/plugins/RxJavaPlugins.java#L1318-L1321 | test | Apply a Callable to a Scheduler. | Of course, here is the Java code you requested:
```java
@NonNull
static Scheduler applyRequireNonNull(@NonNull Function<? super Callable<Scheduler>, ? extends Scheduler> f, Callable<Scheduler> s) {
return ObjectHelper.requireNonNull(apply(f, s), "Scheduler Callable result can't be null");
}
```
Hope t... |
TypedRest/TypedRest-Java | vaadin/src/main/java/net/typedrest/vaadin/views/ElementView.java | ElementView.onDelete | protected void onDelete()
throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException {
endpoint.delete();
eventBus.post(new ElementDeletedEvent<>(endpoint));
} | java | protected void onDelete()
throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException {
endpoint.delete();
eventBus.post(new ElementDeletedEvent<>(endpoint));
} | [
"protected",
"void",
"onDelete",
"(",
")",
"throws",
"IOException",
",",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"FileNotFoundException",
",",
"IllegalStateException",
"{",
"endpoint",
".",
"delete",
"(",
")",
";",
"eventBus",
".",
"post",
"(... | Handler for deleting the element.
@throws IOException Network communication failed.
@throws IllegalArgumentException {@link HttpStatus#SC_BAD_REQUEST}
@throws IllegalAccessException {@link HttpStatus#SC_UNAUTHORIZED} or
{@link HttpStatus#SC_FORBIDDEN}
@throws FileNotFoundException {@link HttpStatus#SC_NOT_FOUND} or
{@... | [
"Handler",
"for",
"deleting",
"the",
"element",
"."
] | 8ce8782d4b8bbe68a2fb4417928b18724f178705 | https://github.com/TypedRest/TypedRest-Java/blob/8ce8782d4b8bbe68a2fb4417928b18724f178705/vaadin/src/main/java/net/typedrest/vaadin/views/ElementView.java#L124-L128 | test | Delete the resource. | Of course, here is the Java code you requested:
```java
protected void onDelete()
throws IOException, IllegalArgumentException, IllegalAccessException, FileNotFoundException, IllegalStateException {
endpoint.delete();
eventBus.post(new ElementDeletedEvent<>(endpoint));
}
```
Hope this ... |
1gravity/Android-RTEditor | RTEditor/src/main/java/com/onegravity/rteditor/converter/tagsoup/ElementType.java | ElementType.namespace | public String namespace(String name, boolean attribute) {
int colon = name.indexOf(':');
if (colon == -1) {
return attribute ? "" : theSchema.getURI();
}
String prefix = name.substring(0, colon);
if (prefix.equals("xml")) {
return "http://www.w3.org/XML/19... | java | public String namespace(String name, boolean attribute) {
int colon = name.indexOf(':');
if (colon == -1) {
return attribute ? "" : theSchema.getURI();
}
String prefix = name.substring(0, colon);
if (prefix.equals("xml")) {
return "http://www.w3.org/XML/19... | [
"public",
"String",
"namespace",
"(",
"String",
"name",
",",
"boolean",
"attribute",
")",
"{",
"int",
"colon",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"colon",
"==",
"-",
"1",
")",
"{",
"return",
"attribute",
"?",
"\"\"",
"... | Return a namespace name from a Qname. The attribute flag tells us whether
to return an empty namespace name if there is no prefix, or use the
schema default instead.
@param name The Qname
@param attribute True if name is an attribute name
@return The namespace name | [
"Return",
"a",
"namespace",
"name",
"from",
"a",
"Qname",
".",
"The",
"attribute",
"flag",
"tells",
"us",
"whether",
"to",
"return",
"an",
"empty",
"namespace",
"name",
"if",
"there",
"is",
"no",
"prefix",
"or",
"use",
"the",
"schema",
"default",
"instead"... | 9d8fb4bb865b3b3d011e7633afedcdfb8d21754f | https://github.com/1gravity/Android-RTEditor/blob/9d8fb4bb865b3b3d011e7633afedcdfb8d21754f/RTEditor/src/main/java/com/onegravity/rteditor/converter/tagsoup/ElementType.java#L72-L83 | test | Get the namespace of a resource. | Of course, here is the Java code you requested:
```java
public String namespace(String name, boolean attribute) {
int colon = name.indexOf(':');
if (colon == -1) {
return attribute ? "" : theSchema.getURI();
}
String prefix = name.substring(0, colon);
if (prefix.equa... |
sinetja/netty-router | src/main/java/io/netty/handler/codec/http/router/Router.java | Router.uri | public String uri(HttpMethod method, T target, Object... params) {
MethodlessRouter<T> router = (method == null) ? anyMethodRouter : routers.get(method);
// Fallback to anyMethodRouter if no router is found for the method
if (router == null) {
router = anyMethodRouter;
}
... | java | public String uri(HttpMethod method, T target, Object... params) {
MethodlessRouter<T> router = (method == null) ? anyMethodRouter : routers.get(method);
// Fallback to anyMethodRouter if no router is found for the method
if (router == null) {
router = anyMethodRouter;
}
... | [
"public",
"String",
"uri",
"(",
"HttpMethod",
"method",
",",
"T",
"target",
",",
"Object",
"...",
"params",
")",
"{",
"MethodlessRouter",
"<",
"T",
">",
"router",
"=",
"(",
"method",
"==",
"null",
")",
"?",
"anyMethodRouter",
":",
"routers",
".",
"get",
... | Given a target and params, this method tries to do the reverse routing
and returns the URI.
<p>Placeholders in the path pattern will be filled with the params.
The params can be a map of {@code placeholder name -> value}
or ordered values.
<p>If a param doesn't have a corresponding placeholder, it will be put
to the ... | [
"Given",
"a",
"target",
"and",
"params",
"this",
"method",
"tries",
"to",
"do",
"the",
"reverse",
"routing",
"and",
"returns",
"the",
"URI",
"."
] | 1bdace050de26bc4d7629b7a0c1fbea238f88e5a | https://github.com/sinetja/netty-router/blob/1bdace050de26bc4d7629b7a0c1fbea238f88e5a/src/main/java/io/netty/handler/codec/http/router/Router.java#L374-L389 | test | Returns the uri for the specified request method target and parameters. | Of course, here is the Java code you requested:
```java
public String uri(HttpMethod method, T target, Object... params) {
MethodlessRouter<T> router = (method == null) ? anyMethodRouter : routers.get(method);
// Fallback to anyMethodRouter if no router is found for the method
if (router == nu... |
rupertlssmith/lojix | debugger/enhanced_text_model/src/main/com/thesett/aima/logic/fol/wam/debugger/text/AttributeGridImpl.java | AttributeGridImpl.setRowAttribute | private void setRowAttribute(AttributeSet attributes, int r)
{
if (r >= rowAttributes.size())
{
for (int i = rowAttributes.size(); i <= r; i++)
{
rowAttributes.add(null);
}
}
rowAttributes.set(r, attributes);
} | java | private void setRowAttribute(AttributeSet attributes, int r)
{
if (r >= rowAttributes.size())
{
for (int i = rowAttributes.size(); i <= r; i++)
{
rowAttributes.add(null);
}
}
rowAttributes.set(r, attributes);
} | [
"private",
"void",
"setRowAttribute",
"(",
"AttributeSet",
"attributes",
",",
"int",
"r",
")",
"{",
"if",
"(",
"r",
">=",
"rowAttributes",
".",
"size",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"rowAttributes",
".",
"size",
"(",
")",
";",
"i",... | Sets a row attribute, adding padding to the underlying array as necessary to ensure it is large enough to hold
the attribute at the requested position.
@param attributes The attribute to set.
@param r The row to set it on. | [
"Sets",
"a",
"row",
"attribute",
"adding",
"padding",
"to",
"the",
"underlying",
"array",
"as",
"necessary",
"to",
"ensure",
"it",
"is",
"large",
"enough",
"to",
"hold",
"the",
"attribute",
"at",
"the",
"requested",
"position",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/debugger/enhanced_text_model/src/main/com/thesett/aima/logic/fol/wam/debugger/text/AttributeGridImpl.java#L115-L126 | test | Set the row attribute. | Of course, here is the Java code you requested:
```java
private void setRowAttribute(AttributeSet attributes, int r)
{
if (r >= rowAttributes.size())
{
for (int i = rowAttributes.size(); i <= r; i++)
{
rowAttributes.add(null);
}
}
... |
rackerlabs/blueflood | blueflood-core/src/main/java/com/rackspacecloud/blueflood/eventemitter/Emitter.java | Emitter.on | public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>();
ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbac... | java | public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>();
ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbac... | [
"public",
"Emitter",
"on",
"(",
"String",
"event",
",",
"Listener",
"fn",
")",
"{",
"ConcurrentLinkedQueue",
"<",
"Listener",
">",
"callbacks",
"=",
"this",
".",
"callbacks",
".",
"get",
"(",
"event",
")",
";",
"if",
"(",
"callbacks",
"==",
"null",
")",
... | Listens on the event.
@param event event name.
@param fn
@return a reference to this object. | [
"Listens",
"on",
"the",
"event",
"."
] | 4722a3449b1a7f8e88889ea8c340c6f24396b5b0 | https://github.com/rackerlabs/blueflood/blob/4722a3449b1a7f8e88889ea8c340c6f24396b5b0/blueflood-core/src/main/java/com/rackspacecloud/blueflood/eventemitter/Emitter.java#L75-L86 | test | Add a listener to be called when an event occurs. | Of course, here is the Java code you requested:
```java
public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>();
ConcurrentLinkedQueue<Listene... |
ReactiveX/RxJava | src/main/java/io/reactivex/Maybe.java | Maybe.switchIfEmpty | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> switchIfEmpty(MaybeSource<? extends T> other) {
ObjectHelper.requireNonNull(other, "other is null");
return RxJavaPlugins.onAssembly(new MaybeSwitchIfEmpty<T>(this, other));
} | java | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> switchIfEmpty(MaybeSource<? extends T> other) {
ObjectHelper.requireNonNull(other, "other is null");
return RxJavaPlugins.onAssembly(new MaybeSwitchIfEmpty<T>(this, other));
} | [
"@",
"CheckReturnValue",
"@",
"NonNull",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Maybe",
"<",
"T",
">",
"switchIfEmpty",
"(",
"MaybeSource",
"<",
"?",
"extends",
"T",
">",
"other",
")",
"{",
"ObjectHelper",
"."... | Returns a Maybe that emits the items emitted by the source Maybe or the items of an alternate
MaybeSource if the current Maybe is empty.
<p>
<img width="640" height="445" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchifempty.m.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code switchI... | [
"Returns",
"a",
"Maybe",
"that",
"emits",
"the",
"items",
"emitted",
"by",
"the",
"source",
"Maybe",
"or",
"the",
"items",
"of",
"an",
"alternate",
"MaybeSource",
"if",
"the",
"current",
"Maybe",
"is",
"empty",
".",
"<p",
">",
"<img",
"width",
"=",
"640"... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Maybe.java#L4379-L4385 | test | Switch the source Maybe to an empty Maybe. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final Maybe<T> switchIfEmpty(MaybeSource<? extends T> other) {
ObjectHelper.requireNonNull(other, "other is null");
return RxJavaPlugins.onAssembly(new MaybeSwi... |
dbmdz/iiif-apis | src/main/java/de/digitalcollections/iiif/model/search/SearchResult.java | SearchResult.setWithin | @JsonDeserialize(contentAs = SearchLayer.class)
@Override
public void setWithin(List<Resource> within) throws IllegalArgumentException {
if (within.stream().anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
}
super.s... | java | @JsonDeserialize(contentAs = SearchLayer.class)
@Override
public void setWithin(List<Resource> within) throws IllegalArgumentException {
if (within.stream().anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
}
super.s... | [
"@",
"JsonDeserialize",
"(",
"contentAs",
"=",
"SearchLayer",
".",
"class",
")",
"@",
"Override",
"public",
"void",
"setWithin",
"(",
"List",
"<",
"Resource",
">",
"within",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"within",
".",
"stream",
... | Set the list of containing resources. Must all be instances of {@link SearchLayer}
@throws IllegalArgumentException if at least one of the resources is not a {@link SearchLayer} | [
"Set",
"the",
"list",
"of",
"containing",
"resources",
".",
"Must",
"all",
"be",
"instances",
"of",
"{",
"@link",
"SearchLayer",
"}"
] | 3e77c1044ca4bf4acabb38269c7d72af2f042fc8 | https://github.com/dbmdz/iiif-apis/blob/3e77c1044ca4bf4acabb38269c7d72af2f042fc8/src/main/java/de/digitalcollections/iiif/model/search/SearchResult.java#L59-L66 | test | Sets the SearchLayer within the SearchResult. | Of course, here is the Java code you requested:
```java
@JsonDeserialize(contentAs = SearchLayer.class)
@Override
public void setWithin(List<Resource> within) throws IllegalArgumentException {
if (within.stream().anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("SearchResu... |
RestComm/jain-slee | container/profiles/src/main/java/org/mobicents/slee/container/deployment/profile/jpa/JPAProfileEntityFramework.java | JPAProfileEntityFramework.getProfilesByDynamicQuery | @SuppressWarnings("unchecked")
public Collection<ProfileEntity> getProfilesByDynamicQuery(
String profileTable, QueryExpression expr)
throws UnrecognizedAttributeException,
AttributeTypeMismatchException {
// TODO check for exceptions
QueryWrapper wQuery = JPAQueryBuilder.parseDynamicQuery(expr);
Ent... | java | @SuppressWarnings("unchecked")
public Collection<ProfileEntity> getProfilesByDynamicQuery(
String profileTable, QueryExpression expr)
throws UnrecognizedAttributeException,
AttributeTypeMismatchException {
// TODO check for exceptions
QueryWrapper wQuery = JPAQueryBuilder.parseDynamicQuery(expr);
Ent... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Collection",
"<",
"ProfileEntity",
">",
"getProfilesByDynamicQuery",
"(",
"String",
"profileTable",
",",
"QueryExpression",
"expr",
")",
"throws",
"UnrecognizedAttributeException",
",",
"AttributeTypeMismatchExc... | /*
(non-Javadoc)
@see
org.mobicents.slee.container.component.profile.ProfileEntityFramework
#getProfilesByDynamicQuery(java.lang.String,
javax.slee.profile.query.QueryExpression) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/profiles/src/main/java/org/mobicents/slee/container/deployment/profile/jpa/JPAProfileEntityFramework.java#L386-L410 | test | Get a collection of profile entities using a dynamic query. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public Collection<ProfileEntity> getProfilesByDynamicQuery(
String profileTable, QueryExpression expr)
throws UnrecognizedAttributeException,
AttributeTypeMismatchException {
// TODO check for exceptions
QueryWrapper... |
turbomanage/storm-gen | storm-apt/api/src/main/java/com/turbomanage/storm/DatabaseHelper.java | DatabaseHelper.backupAndRestore | public void backupAndRestore(Context ctx, SQLiteDatabase db) {
if (backupAllTablesToCsv(ctx, db, null)) {
dropAndCreate(db);
restoreAllTablesFromCsv(ctx, db, null);
} else {
throw new RuntimeException("Backup of " + getDatabaseName() + " failed, aborting upgrade");
}
} | java | public void backupAndRestore(Context ctx, SQLiteDatabase db) {
if (backupAllTablesToCsv(ctx, db, null)) {
dropAndCreate(db);
restoreAllTablesFromCsv(ctx, db, null);
} else {
throw new RuntimeException("Backup of " + getDatabaseName() + " failed, aborting upgrade");
}
} | [
"public",
"void",
"backupAndRestore",
"(",
"Context",
"ctx",
",",
"SQLiteDatabase",
"db",
")",
"{",
"if",
"(",
"backupAllTablesToCsv",
"(",
"ctx",
",",
"db",
",",
"null",
")",
")",
"{",
"dropAndCreate",
"(",
"db",
")",
";",
"restoreAllTablesFromCsv",
"(",
... | Backs up all tables to CSV, drops and recreates them, then restores
them from CSV. By default, creates CSV filenames with no suffix. You
could override this method to supply a timestamp suffix (make sure it's
the same for both backup and restore), but beware that this could
cause backup files to proliferate. Ideally, t... | [
"Backs",
"up",
"all",
"tables",
"to",
"CSV",
"drops",
"and",
"recreates",
"them",
"then",
"restores",
"them",
"from",
"CSV",
".",
"By",
"default",
"creates",
"CSV",
"filenames",
"with",
"no",
"suffix",
".",
"You",
"could",
"override",
"this",
"method",
"to... | 22caa69439548a074d035745215bce5aff55853d | https://github.com/turbomanage/storm-gen/blob/22caa69439548a074d035745215bce5aff55853d/storm-apt/api/src/main/java/com/turbomanage/storm/DatabaseHelper.java#L173-L180 | test | Backup and restore all tables in the database. | Of course, here is the Java code you requested:
```java
public void backupAndRestore(Context ctx, SQLiteDatabase db) {
if (backupAllTablesToCsv(ctx, db, null)) {
dropAndCreate(db);
restoreAllTablesFromCsv(ctx, db, null);
} else {
throw new RuntimeException("Backup of " + getDatabaseName() + " failed, abor... |
ReactiveX/RxJava | src/main/java/io/reactivex/processors/MulticastProcessor.java | MulticastProcessor.create | @CheckReturnValue
@NonNull
public static <T> MulticastProcessor<T> create(boolean refCount) {
return new MulticastProcessor<T>(bufferSize(), refCount);
} | java | @CheckReturnValue
@NonNull
public static <T> MulticastProcessor<T> create(boolean refCount) {
return new MulticastProcessor<T>(bufferSize(), refCount);
} | [
"@",
"CheckReturnValue",
"@",
"NonNull",
"public",
"static",
"<",
"T",
">",
"MulticastProcessor",
"<",
"T",
">",
"create",
"(",
"boolean",
"refCount",
")",
"{",
"return",
"new",
"MulticastProcessor",
"<",
"T",
">",
"(",
"bufferSize",
"(",
")",
",",
"refCou... | Constructs a fresh instance with the default Flowable.bufferSize() prefetch
amount and the optional refCount-behavior.
@param <T> the input and output value type
@param refCount if true and if all Subscribers have canceled, the upstream
is cancelled
@return the new MulticastProcessor instance | [
"Constructs",
"a",
"fresh",
"instance",
"with",
"the",
"default",
"Flowable",
".",
"bufferSize",
"()",
"prefetch",
"amount",
"and",
"the",
"optional",
"refCount",
"-",
"behavior",
"."
] | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/processors/MulticastProcessor.java#L183-L187 | test | Create a new instance of a CID . | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@NonNull
public static <T> MulticastProcessor<T> create(boolean refCount) {
return new MulticastProcessor<T>(bufferSize(), refCount);
}
```
Hope this helps! |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/user/TileRow.java | TileRow.setTileData | public void setTileData(Bitmap bitmap, CompressFormat format, int quality)
throws IOException {
byte[] tileData = BitmapConverter.toBytes(bitmap, format, quality);
setTileData(tileData);
} | java | public void setTileData(Bitmap bitmap, CompressFormat format, int quality)
throws IOException {
byte[] tileData = BitmapConverter.toBytes(bitmap, format, quality);
setTileData(tileData);
} | [
"public",
"void",
"setTileData",
"(",
"Bitmap",
"bitmap",
",",
"CompressFormat",
"format",
",",
"int",
"quality",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"tileData",
"=",
"BitmapConverter",
".",
"toBytes",
"(",
"bitmap",
",",
"format",
",",
"qua... | Set the tile data from a bitmap
@param bitmap tile bitmap
@param format compress format
@param quality quality
@throws IOException upon failure | [
"Set",
"the",
"tile",
"data",
"from",
"a",
"bitmap"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/user/TileRow.java#L232-L236 | test | Set the tile data of the image | Of course, here is the Java code you requested:
```java
public void setTileData(Bitmap bitmap, CompressFormat format, int quality)
throws IOException {
byte[] tileData = BitmapConverter.toBytes(bitmap, format, quality);
setTileData(tileData);
}
```
Hope this helps! |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/util/StringCollectionUtil.java | StringCollectionUtil.retainMatching | public static void retainMatching(Collection<String> values,
Collection<String> patterns) {
if (patterns.isEmpty()) return;
List<String> matches = new ArrayList<String>(values.size());
for (String p : patterns) {
Pattern pattern = Pattern.compile(p);
for (String value : values) {
i... | java | public static void retainMatching(Collection<String> values,
Collection<String> patterns) {
if (patterns.isEmpty()) return;
List<String> matches = new ArrayList<String>(values.size());
for (String p : patterns) {
Pattern pattern = Pattern.compile(p);
for (String value : values) {
i... | [
"public",
"static",
"void",
"retainMatching",
"(",
"Collection",
"<",
"String",
">",
"values",
",",
"Collection",
"<",
"String",
">",
"patterns",
")",
"{",
"if",
"(",
"patterns",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"List",
"<",
"String",
">",
... | Retains all values in the subject collection that are matched by
at least one of a collection of regular expressions.
<p>
The semantics of this method are conceptually similar to
{@link Collection#retainAll(Collection)}, but uses pattern matching
instead of exact matching.
@param values subject value collection
@param... | [
"Retains",
"all",
"values",
"in",
"the",
"subject",
"collection",
"that",
"are",
"matched",
"by",
"at",
"least",
"one",
"of",
"a",
"collection",
"of",
"regular",
"expressions",
".",
"<p",
">",
"The",
"semantics",
"of",
"this",
"method",
"are",
"conceptually"... | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/util/StringCollectionUtil.java#L57-L70 | test | Retain all the values that match the patterns. | Of course, here is the Java code you requested:
```java
public static void retainMatching(Collection<String> values,
Collection<String> patterns) {
if (patterns.isEmpty()) return;
List<String> matches = new ArrayList<String>(values.size());
for (String p : patterns) {
Pattern pattern = Pattern.... |
OpenEstate/OpenEstate-IO | ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/Immobilie.java | Immobilie.getUserDefinedAnyfield | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<UserDefinedAnyfield> getUserDefinedAnyfield() {
if (userDefinedAnyfield == null) {
userDefinedAnyfield = new ArrayList<UserDefinedAnyfield>();
}
return thi... | java | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<UserDefinedAnyfield> getUserDefinedAnyfield() {
if (userDefinedAnyfield == null) {
userDefinedAnyfield = new ArrayList<UserDefinedAnyfield>();
}
return thi... | [
"@",
"Generated",
"(",
"value",
"=",
"\"com.sun.tools.xjc.Driver\"",
",",
"date",
"=",
"\"2018-10-12T02:50:55+02:00\"",
",",
"comments",
"=",
"\"JAXB RI v2.2.11\"",
")",
"public",
"List",
"<",
"UserDefinedAnyfield",
">",
"getUserDefinedAnyfield",
"(",
")",
"{",
"if",
... | Gets the value of the userDefinedAnyfield property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the userDefinedAnyfield property.
<... | [
"Gets",
"the",
"value",
"of",
"the",
"userDefinedAnyfield",
"property",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/Immobilie.java#L489-L495 | test | Gets the value of the userDefinedAnyfield property. | Of course, here is the Java code you requested:
```java
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<UserDefinedAnyfield> getUserDefinedAnyfield() {
if (userDefinedAnyfield == null) {
userDefinedAnyfield = new Array... |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/XArrays.java | XArrays.toPrimitive | public static long[] toPrimitive(Long... a)
{
if (a != null) {
long[] p = new long[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
} | java | public static long[] toPrimitive(Long... a)
{
if (a != null) {
long[] p = new long[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
} | [
"public",
"static",
"long",
"[",
"]",
"toPrimitive",
"(",
"Long",
"...",
"a",
")",
"{",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"long",
"[",
"]",
"p",
"=",
"new",
"long",
"[",
"a",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Converts an array of {@code Long}s to an array of {@code long}s.
Returns {@code null} if the given array is {@code null}. Does not
modify the input array.
@param a the {@code Long} array to convert.
@return the corresponding {@code long} array.
@throws NullPointerException if {@code a} contains a {@code null} value. | [
"Converts",
"an",
"array",
"of",
"{",
"@code",
"Long",
"}",
"s",
"to",
"an",
"array",
"of",
"{",
"@code",
"long",
"}",
"s",
".",
"Returns",
"{",
"@code",
"null",
"}",
"if",
"the",
"given",
"array",
"is",
"{",
"@code",
"null",
"}",
".",
"Does",
"n... | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/XArrays.java#L1808-L1818 | test | To primitive. | Of course, here is the Java code you requested:
```java
public static long[] toPrimitive(Long... a)
{
if (a != null) {
long[] p = new long[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
}
```
Hope this helps! |
DDTH/ddth-cql-utils | src/main/java/com/github/ddth/cql/DseUtils.java | DseUtils.newDseCluster | public static DseCluster newDseCluster(String hostsAndPorts, String username, String password,
String proxiedUser, Configuration configuration) {
DseCluster.Builder builder = DseCluster.builder();
if (!StringUtils.isBlank(username)) {
AuthProvider authProvider;
if (St... | java | public static DseCluster newDseCluster(String hostsAndPorts, String username, String password,
String proxiedUser, Configuration configuration) {
DseCluster.Builder builder = DseCluster.builder();
if (!StringUtils.isBlank(username)) {
AuthProvider authProvider;
if (St... | [
"public",
"static",
"DseCluster",
"newDseCluster",
"(",
"String",
"hostsAndPorts",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"proxiedUser",
",",
"Configuration",
"configuration",
")",
"{",
"DseCluster",
".",
"Builder",
"builder",
"=",
"D... | Build a new DSE cluster instance.
@param hostsAndPorts
format: "host1:port1,host2,host3:port3". If no port is
specified, the {@link #DEFAULT_CASSANDRA_PORT} is used.
@param username
@param password
@param proxiedUser
DSE allows a user to connect as another user or role, provide the name of the
user/role you want to co... | [
"Build",
"a",
"new",
"DSE",
"cluster",
"instance",
"."
] | debd5d86f64fe06e43d6f0f58cb2f7f0f6a84489 | https://github.com/DDTH/ddth-cql-utils/blob/debd5d86f64fe06e43d6f0f58cb2f7f0f6a84489/src/main/java/com/github/ddth/cql/DseUtils.java#L57-L84 | test | Creates a new DSE cluster with the specified parameters. | Of course, here is the Java code you requested:
```java
public static DseCluster newDseCluster(String hostsAndPorts, String username, String password,
String proxiedUser, Configuration configuration) {
DseCluster.Builder builder = DseCluster.builder();
if (!StringUtils.isBlank(username)) {
... |
jbee/silk | src/core/se/jbee/inject/Utils.java | Utils.annotationPropertyByType | public static Method annotationPropertyByType(Class<?> type,
Class<? extends Annotation> annotation) {
return arrayFindFirst(annotation.getDeclaredMethods(),
m -> m.getReturnType() == type);
} | java | public static Method annotationPropertyByType(Class<?> type,
Class<? extends Annotation> annotation) {
return arrayFindFirst(annotation.getDeclaredMethods(),
m -> m.getReturnType() == type);
} | [
"public",
"static",
"Method",
"annotationPropertyByType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"return",
"arrayFindFirst",
"(",
"annotation",
".",
"getDeclaredMethods",
"(",
")",
","... | /* Annotations | [
"/",
"*",
"Annotations"
] | 36237487d250c7b66bcefcf08c45d0069b55ec92 | https://github.com/jbee/silk/blob/36237487d250c7b66bcefcf08c45d0069b55ec92/src/core/se/jbee/inject/Utils.java#L191-L195 | test | Returns the first method annotated with the given type. | Of course, here is the Java code you requested:
```java
public static Method annotationPropertyByType(Class<?> type,
Class<? extends Annotation> annotation) {
return arrayFindFirst(annotation.getDeclaredMethods(),
m -> m.getReturnType() == type);
}
```
Hope this helps! |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/util/Loader.java | Loader.getClassLoaderOfClass | public static ClassLoader getClassLoaderOfClass(final Class<?> clazz) {
ClassLoader cl = clazz.getClassLoader();
if (cl == null) {
return ClassLoader.getSystemClassLoader();
} else {
return cl;
}
} | java | public static ClassLoader getClassLoaderOfClass(final Class<?> clazz) {
ClassLoader cl = clazz.getClassLoader();
if (cl == null) {
return ClassLoader.getSystemClassLoader();
} else {
return cl;
}
} | [
"public",
"static",
"ClassLoader",
"getClassLoaderOfClass",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"ClassLoader",
"cl",
"=",
"clazz",
".",
"getClassLoader",
"(",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"return",
"ClassLoader",
... | Return the class loader which loaded the class passed as argument. Return
the system class loader if appropriate.
@param clazz the class to evaluate
@return the classloader of the object | [
"Return",
"the",
"class",
"loader",
"which",
"loaded",
"the",
"class",
"passed",
"as",
"argument",
".",
"Return",
"the",
"system",
"class",
"loader",
"if",
"appropriate",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/util/Loader.java#L177-L184 | test | Get the ClassLoader of the Class. | Of course, here is the Java code you requested:
```java
public static ClassLoader getClassLoaderOfClass(final Class<?> clazz) {
ClassLoader cl = clazz.getClassLoader();
if (cl == null) {
return ClassLoader.getSystemClassLoader();
} else {
return cl;
}
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | OpenImmo/src/main/jaxb/org/openestate/io/openimmo/xml/ObjectFactory.java | ObjectFactory.createImmobilientreuhaenderid | @XmlElementDecl(namespace = "", name = "immobilientreuhaenderid")
public JAXBElement<String> createImmobilientreuhaenderid(String value) {
return new JAXBElement<String>(_Immobilientreuhaenderid_QNAME, String.class, null, value);
} | java | @XmlElementDecl(namespace = "", name = "immobilientreuhaenderid")
public JAXBElement<String> createImmobilientreuhaenderid(String value) {
return new JAXBElement<String>(_Immobilientreuhaenderid_QNAME, String.class, null, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"\"",
",",
"name",
"=",
"\"immobilientreuhaenderid\"",
")",
"public",
"JAXBElement",
"<",
"String",
">",
"createImmobilientreuhaenderid",
"(",
"String",
"value",
")",
"{",
"return",
"new",
"JAXBElement",
"<",
"String... | Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"JAXBElement",
"}",
"{",
"@code",
"<",
"}",
"{",
"@link",
"String",
"}",
"{",
"@code",
">",
"}}"
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/OpenImmo/src/main/jaxb/org/openestate/io/openimmo/xml/ObjectFactory.java#L1617-L1620 | test | Create an instance of an immobilientreuhaenderid JAXBElement. | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "", name = "immobilientreuhaenderid")
public JAXBElement<String> createImmobilientreuhaenderid(String value) {
return new JAXBElement<String>(_Immobilientreuhaenderid_QNAME, String.class, null, value);
}
```
Hope this ... |
stanfy/enroscar | io/src/main/java/com/stanfy/enroscar/io/IoUtils.java | IoUtils.transfer | public static void transfer(final InputStream input, final OutputStream output, final BuffersPool buffersPool) throws IOException {
final InputStream in = buffersPool == null
? new BufferedInputStream(input, BUFFER_SIZE_8K)
: new PoolableBufferedInputStream(input, BUFFER_SIZE_8K, buffersPool);
... | java | public static void transfer(final InputStream input, final OutputStream output, final BuffersPool buffersPool) throws IOException {
final InputStream in = buffersPool == null
? new BufferedInputStream(input, BUFFER_SIZE_8K)
: new PoolableBufferedInputStream(input, BUFFER_SIZE_8K, buffersPool);
... | [
"public",
"static",
"void",
"transfer",
"(",
"final",
"InputStream",
"input",
",",
"final",
"OutputStream",
"output",
",",
"final",
"BuffersPool",
"buffersPool",
")",
"throws",
"IOException",
"{",
"final",
"InputStream",
"in",
"=",
"buffersPool",
"==",
"null",
"... | Transfers all the bytes from input to output stream.
If read/write operations are successful, output stream will be flushed.
Input stream is always closed after this method invocation.
@param input input stream
@param output output stream
@param buffersPool buffers pool used to obtain a temporal bytes buffer, may be n... | [
"Transfers",
"all",
"the",
"bytes",
"from",
"input",
"to",
"output",
"stream",
".",
"If",
"read",
"/",
"write",
"operations",
"are",
"successful",
"output",
"stream",
"will",
"be",
"flushed",
".",
"Input",
"stream",
"is",
"always",
"closed",
"after",
"this",... | 0e64f3c309d62e359b55ddcba10e3cc592f5e083 | https://github.com/stanfy/enroscar/blob/0e64f3c309d62e359b55ddcba10e3cc592f5e083/io/src/main/java/com/stanfy/enroscar/io/IoUtils.java#L102-L124 | test | Transfers the input stream to the output stream using the supplied buffers pool. | Of course, here is the Java code you requested:
```java
public static void transfer(final InputStream input, final OutputStream output, final BuffersPool buffersPool) throws IOException {
final InputStream in = buffersPool == null
? new BufferedInputStream(input, BUFFER_SIZE_8K)
: new PoolableBuffe... |
CloudI/cloudi_api_java | src/main/java/org/cloudi/API.java | API.subscribe_count | public int subscribe_count(final String pattern)
throws InvalidInputException,
TerminateException
{
OtpOutputStream subscribe_count = new OtpOutputStream();
subscribe_count.write(OtpExternal.versionTag);
final OtpErlangObject[] tuple = {new OtpErlangAtom("subscribe_cou... | java | public int subscribe_count(final String pattern)
throws InvalidInputException,
TerminateException
{
OtpOutputStream subscribe_count = new OtpOutputStream();
subscribe_count.write(OtpExternal.versionTag);
final OtpErlangObject[] tuple = {new OtpErlangAtom("subscribe_cou... | [
"public",
"int",
"subscribe_count",
"(",
"final",
"String",
"pattern",
")",
"throws",
"InvalidInputException",
",",
"TerminateException",
"{",
"OtpOutputStream",
"subscribe_count",
"=",
"new",
"OtpOutputStream",
"(",
")",
";",
"subscribe_count",
".",
"write",
"(",
"... | Determine how may service name pattern subscriptions have occurred.
@param pattern the service name pattern
@return count of active subscriptions
@throws InvalidInputException invalid input to internal function call
@throws TerminateException service execution must terminate | [
"Determine",
"how",
"may",
"service",
"name",
"pattern",
"subscriptions",
"have",
"occurred",
"."
] | e8ccaeb9ad562c82d742dc31a5f06bcb1b637446 | https://github.com/CloudI/cloudi_api_java/blob/e8ccaeb9ad562c82d742dc31a5f06bcb1b637446/src/main/java/org/cloudi/API.java#L291-L310 | test | Get the number of subscriptions to a given pattern. | Of course, here is the Java code you requested:
```java
public int subscribe_count(final String pattern)
throws InvalidInputException,
TerminateException
{
OtpOutputStream subscribe_count = new OtpOutputStream();
subscribe_count.write(OtpExternal.versionTag);
final Ot... |
real-logic/aeron | aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java | ChannelUriStringBuilder.ttl | public ChannelUriStringBuilder ttl(final Integer ttl)
{
if (null != ttl && (ttl < 0 || ttl > 255))
{
throw new IllegalArgumentException("TTL not in range 0-255: " + ttl);
}
this.ttl = ttl;
return this;
} | java | public ChannelUriStringBuilder ttl(final Integer ttl)
{
if (null != ttl && (ttl < 0 || ttl > 255))
{
throw new IllegalArgumentException("TTL not in range 0-255: " + ttl);
}
this.ttl = ttl;
return this;
} | [
"public",
"ChannelUriStringBuilder",
"ttl",
"(",
"final",
"Integer",
"ttl",
")",
"{",
"if",
"(",
"null",
"!=",
"ttl",
"&&",
"(",
"ttl",
"<",
"0",
"||",
"ttl",
">",
"255",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"TTL not in range 0... | Set the Time To Live (TTL) for a multicast datagram. Valid values are 0-255 for the number of hops the datagram
can progress along.
@param ttl value for a multicast datagram.
@return this for a fluent API.
@see CommonContext#TTL_PARAM_NAME | [
"Set",
"the",
"Time",
"To",
"Live",
"(",
"TTL",
")",
"for",
"a",
"multicast",
"datagram",
".",
"Valid",
"values",
"are",
"0",
"-",
"255",
"for",
"the",
"number",
"of",
"hops",
"the",
"datagram",
"can",
"progress",
"along",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java#L339-L348 | test | Sets the TTL for this builder. | Of course, here is the Java code you requested:
```java
public ChannelUriStringBuilder ttl(final Integer ttl)
{
if (null != ttl && (ttl < 0 || ttl > 255))
{
throw new IllegalArgumentException("TTL not in range 0-255: " + ttl);
}
this.ttl = ttl;
return this;
... |
Jasig/NotificationPortlet | notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/jpa/JpaNotificationService.java | JpaNotificationService.prepareResponse | private NotificationResponse prepareResponse(Set<JpaEntry> entries, String username) {
Map<String,NotificationCategory> categories = new HashMap<>();
for (JpaEntry entry : entries) {
// Choose a category title
final String categryTitle = !StringUtils.isBlank(entry.getCategory()... | java | private NotificationResponse prepareResponse(Set<JpaEntry> entries, String username) {
Map<String,NotificationCategory> categories = new HashMap<>();
for (JpaEntry entry : entries) {
// Choose a category title
final String categryTitle = !StringUtils.isBlank(entry.getCategory()... | [
"private",
"NotificationResponse",
"prepareResponse",
"(",
"Set",
"<",
"JpaEntry",
">",
"entries",
",",
"String",
"username",
")",
"{",
"Map",
"<",
"String",
",",
"NotificationCategory",
">",
"categories",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"... | /*
Implementation | [
"/",
"*",
"Implementation"
] | a74b87c145b66166a2cb6849d17ce9b0f2c98f3b | https://github.com/Jasig/NotificationPortlet/blob/a74b87c145b66166a2cb6849d17ce9b0f2c98f3b/notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/jpa/JpaNotificationService.java#L163-L196 | test | Prepare the response for the given entries. | Of course, here is the Java code you requested:
```java
private NotificationResponse prepareResponse(Set<JpaEntry> entries, String username) {
Map<String,NotificationCategory> categories = new HashMap<>();
for (JpaEntry entry : entries) {
// Choose a category title
final Strin... |
jcodec/jcodec | src/main/java/net/sourceforge/jaad/aac/Decoder.java | Decoder.decodeFrame | public void decodeFrame(byte[] frame, SampleBuffer buffer) throws AACException {
if (frame != null)
_in.setData(frame);
Logger.debug("bits left " + _in.getBitsLeft());
try {
decode(buffer);
} catch (AACException e) {
if (!e.isEndOfStream())
... | java | public void decodeFrame(byte[] frame, SampleBuffer buffer) throws AACException {
if (frame != null)
_in.setData(frame);
Logger.debug("bits left " + _in.getBitsLeft());
try {
decode(buffer);
} catch (AACException e) {
if (!e.isEndOfStream())
... | [
"public",
"void",
"decodeFrame",
"(",
"byte",
"[",
"]",
"frame",
",",
"SampleBuffer",
"buffer",
")",
"throws",
"AACException",
"{",
"if",
"(",
"frame",
"!=",
"null",
")",
"_in",
".",
"setData",
"(",
"frame",
")",
";",
"Logger",
".",
"debug",
"(",
"\"bi... | Decodes one frame of AAC data in frame mode and returns the raw PCM data.
@param frame
the AAC frame
@param buffer
a buffer to hold the decoded PCM data
@throws AACException
if decoding fails | [
"Decodes",
"one",
"frame",
"of",
"AAC",
"data",
"in",
"frame",
"mode",
"and",
"returns",
"the",
"raw",
"PCM",
"data",
"."
] | cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75 | https://github.com/jcodec/jcodec/blob/cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75/src/main/java/net/sourceforge/jaad/aac/Decoder.java#L84-L96 | test | Decode a single frame from the input stream. | Of course, here is the Java code you requested:
```java
public void decodeFrame(byte[] frame, SampleBuffer buffer) throws AACException {
if (frame != null)
_in.setData(frame);
Logger.debug("bits left " + _in.getBitsLeft());
try {
decode(buffer);
} catch (AACExcep... |
RestComm/jain-slee | container/services/src/main/java/org/mobicents/slee/container/deployment/ConcreteSbbGenerator.java | ConcreteSbbGenerator.createGetChildRelationsMethod | protected void createGetChildRelationsMethod(
Collection<GetChildRelationMethodDescriptor> childRelations) {
if (childRelations == null)
return;
for (GetChildRelationMethodDescriptor childRelation : childRelations) {
String methodName = childRelation.getChildRelationMethodName();
CtMethod method = (CtMe... | java | protected void createGetChildRelationsMethod(
Collection<GetChildRelationMethodDescriptor> childRelations) {
if (childRelations == null)
return;
for (GetChildRelationMethodDescriptor childRelation : childRelations) {
String methodName = childRelation.getChildRelationMethodName();
CtMethod method = (CtMe... | [
"protected",
"void",
"createGetChildRelationsMethod",
"(",
"Collection",
"<",
"GetChildRelationMethodDescriptor",
">",
"childRelations",
")",
"{",
"if",
"(",
"childRelations",
"==",
"null",
")",
"return",
";",
"for",
"(",
"GetChildRelationMethodDescriptor",
"childRelation... | Create the get child relation method (this method redirects the call to a
child relation interceptor)
@param childRelations
the childRelations method to add to the concrete class | [
"Create",
"the",
"get",
"child",
"relation",
"method",
"(",
"this",
"method",
"redirects",
"the",
"call",
"to",
"a",
"child",
"relation",
"interceptor",
")"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/services/src/main/java/org/mobicents/slee/container/deployment/ConcreteSbbGenerator.java#L962-L994 | test | Creates the GetChildRelations method. | Of course, here is the Java code you requested:
```java
protected void createGetChildRelationsMethod(
Collection<GetChildRelationMethodDescriptor> childRelations) {
if (childRelations == null)
return;
for (GetChildRelationMethodDescriptor childRelation : childRelations) {
String methodName = childRelation... |
playframework/playframework | dev-mode/play-docs/src/main/java/play/docs/BuildDocHandlerFactory.java | BuildDocHandlerFactory.fromDirectory | public static BuildDocHandler fromDirectory(File directory) {
FileRepository repo = new FilesystemRepository(directory);
return new DocumentationHandler(repo);
} | java | public static BuildDocHandler fromDirectory(File directory) {
FileRepository repo = new FilesystemRepository(directory);
return new DocumentationHandler(repo);
} | [
"public",
"static",
"BuildDocHandler",
"fromDirectory",
"(",
"File",
"directory",
")",
"{",
"FileRepository",
"repo",
"=",
"new",
"FilesystemRepository",
"(",
"directory",
")",
";",
"return",
"new",
"DocumentationHandler",
"(",
"repo",
")",
";",
"}"
] | Create an BuildDocHandler that serves documentation from a given directory by wrapping a
FilesystemRepository.
@param directory The directory to serve the documentation from. | [
"Create",
"an",
"BuildDocHandler",
"that",
"serves",
"documentation",
"from",
"a",
"given",
"directory",
"by",
"wrapping",
"a",
"FilesystemRepository",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/dev-mode/play-docs/src/main/java/play/docs/BuildDocHandlerFactory.java#L75-L78 | test | Creates a build doc handler from a directory. | Of course, here is the Java code you requested:
```java
public static BuildDocHandler fromDirectory(File directory) {
FileRepository repo = new FilesystemRepository(directory);
return new DocumentationHandler(repo);
}
```
Hope this helps! |
rockagen/commons-lib | src/main/java/com/rockagen/commons/util/ClassUtil.java | ClassUtil.getDeclaredMethod | public static Method getDeclaredMethod(Class<?> clazz, boolean recursively,
String methodName, Class<?>... parameterTypes) {
try {
return clazz.getDeclaredMethod(methodName,
parameterTypes);
} catch (NoSuchMethodException e) {
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && ... | java | public static Method getDeclaredMethod(Class<?> clazz, boolean recursively,
String methodName, Class<?>... parameterTypes) {
try {
return clazz.getDeclaredMethod(methodName,
parameterTypes);
} catch (NoSuchMethodException e) {
Class<?> superClass = clazz.getSuperclass();
if (superClass != null && ... | [
"public",
"static",
"Method",
"getDeclaredMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"recursively",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"try",
"{",
"return",
"clazz",
".",
"getDec... | obtain method list of specified class If recursively is true, obtain
method from all class hierarchy
@param clazz class
@param recursively recursively
@param methodName method name
@param parameterTypes parameter types
@return method | [
"obtain",
"method",
"list",
"of",
"specified",
"class",
"If",
"recursively",
"is",
"true",
"obtain",
"method",
"from",
"all",
"class",
"hierarchy"
] | f37141cf40be79d130db804c39ce61690541d5f1 | https://github.com/rockagen/commons-lib/blob/f37141cf40be79d130db804c39ce61690541d5f1/src/main/java/com/rockagen/commons/util/ClassUtil.java#L239-L255 | test | Gets the declared method of the given class. | Of course, here is the Java code you requested:
```java
public static Method getDeclaredMethod(Class<?> clazz, boolean recursively,
String methodName, Class<?>... parameterTypes) {
try {
return clazz.getDeclaredMethod(methodName,
parameterTypes);
} catch (NoSuchMethodException e) {
Class<?> superCla... |
google/guice | core/src/com/google/inject/internal/InternalContext.java | InternalContext.pushDependency | Dependency<?> pushDependency(Dependency<?> dependency, Object source) {
Dependency<?> previous = this.dependency;
this.dependency = dependency;
doPushState(dependency, source);
return previous;
} | java | Dependency<?> pushDependency(Dependency<?> dependency, Object source) {
Dependency<?> previous = this.dependency;
this.dependency = dependency;
doPushState(dependency, source);
return previous;
} | [
"Dependency",
"<",
"?",
">",
"pushDependency",
"(",
"Dependency",
"<",
"?",
">",
"dependency",
",",
"Object",
"source",
")",
"{",
"Dependency",
"<",
"?",
">",
"previous",
"=",
"this",
".",
"dependency",
";",
"this",
".",
"dependency",
"=",
"dependency",
... | Sets the new current dependency & adds it to the state. | [
"Sets",
"the",
"new",
"current",
"dependency",
"&",
"adds",
"it",
"to",
"the",
"state",
"."
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/internal/InternalContext.java#L107-L112 | test | Push a dependency onto the stack. | Of course, here is the Java code you requested:
```java
Dependency<?> pushDependency(Dependency<?> dependency, Object source) {
Dependency<?> previous = this.dependency;
this.dependency = dependency;
doPushState(dependency, source);
return previous;
}
```
Hope this helps! |
braintree/braintree_android | Braintree/src/main/java/com/braintreepayments/api/UnionPay.java | UnionPay.fetchCapabilities | public static void fetchCapabilities(final BraintreeFragment fragment, final String cardNumber) {
fragment.waitForConfiguration(new ConfigurationListener() {
@Override
public void onConfigurationFetched(Configuration configuration) {
if (!configuration.getUnionPay().isEna... | java | public static void fetchCapabilities(final BraintreeFragment fragment, final String cardNumber) {
fragment.waitForConfiguration(new ConfigurationListener() {
@Override
public void onConfigurationFetched(Configuration configuration) {
if (!configuration.getUnionPay().isEna... | [
"public",
"static",
"void",
"fetchCapabilities",
"(",
"final",
"BraintreeFragment",
"fragment",
",",
"final",
"String",
"cardNumber",
")",
"{",
"fragment",
".",
"waitForConfiguration",
"(",
"new",
"ConfigurationListener",
"(",
")",
"{",
"@",
"Override",
"public",
... | Fetches the capabilities of a card. If the card needs to be enrolled use {@link
UnionPay#enroll(BraintreeFragment, UnionPayCardBuilder)}.
<p/>
On completion, returns the {@link UnionPayCapabilities} to
{@link com.braintreepayments.api.interfaces.UnionPayListener#onCapabilitiesFetched(UnionPayCapabilities)}
<p/>
On erro... | [
"Fetches",
"the",
"capabilities",
"of",
"a",
"card",
".",
"If",
"the",
"card",
"needs",
"to",
"be",
"enrolled",
"use",
"{",
"@link",
"UnionPay#enroll",
"(",
"BraintreeFragment",
"UnionPayCardBuilder",
")",
"}",
".",
"<p",
"/",
">",
"On",
"completion",
"retur... | 07b32e6fad73f9fb8432971b0e79fc8c94b11873 | https://github.com/braintree/braintree_android/blob/07b32e6fad73f9fb8432971b0e79fc8c94b11873/Braintree/src/main/java/com/braintreepayments/api/UnionPay.java#L43-L73 | test | Fetch the capabilities of the union pay card. | Of course, here is the Java code you requested:
```java
public static void fetchCapabilities(final BraintreeFragment fragment, final String cardNumber) {
fragment.waitForConfiguration(new ConfigurationListener() {
@Override
public void onConfigurationFetched(Configuration configuration)... |
oblac/jodd | jodd-core/src/main/java/jodd/io/findfile/FindFile.java | FindFile.addPath | protected void addPath(final File path) {
if (!path.exists()) {
return;
}
if (pathList == null) {
pathList = new LinkedList<>();
}
pathList.add(path);
} | java | protected void addPath(final File path) {
if (!path.exists()) {
return;
}
if (pathList == null) {
pathList = new LinkedList<>();
}
pathList.add(path);
} | [
"protected",
"void",
"addPath",
"(",
"final",
"File",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"pathList",
"==",
"null",
")",
"{",
"pathList",
"=",
"new",
"LinkedList",
"<>",
"(",
... | Adds existing search path to the file list.
Non existing files are ignored.
If path is a folder, it will be scanned for all files. | [
"Adds",
"existing",
"search",
"path",
"to",
"the",
"file",
"list",
".",
"Non",
"existing",
"files",
"are",
"ignored",
".",
"If",
"path",
"is",
"a",
"folder",
"it",
"will",
"be",
"scanned",
"for",
"all",
"files",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/io/findfile/FindFile.java#L524-L533 | test | Add a path to the path list. | Of course, here is the Java code you requested:
```java
protected void addPath(final File path) {
if (!path.exists()) {
return;
}
if (pathList == null) {
pathList = new LinkedList<>();
}
pathList.add(path);
}
```
Hope this helps! |
oblac/jodd | jodd-db/src/main/java/jodd/db/DbSession.java | DbSession.rollbackTransaction | public void rollbackTransaction() {
log.debug("Rolling-back transaction");
assertTxIsActive();
try {
connection.rollback();
} catch (SQLException sex) {
throw new DbSqlException("Rollback TX failed", sex);
} finally {
closeTx();
}
} | java | public void rollbackTransaction() {
log.debug("Rolling-back transaction");
assertTxIsActive();
try {
connection.rollback();
} catch (SQLException sex) {
throw new DbSqlException("Rollback TX failed", sex);
} finally {
closeTx();
}
} | [
"public",
"void",
"rollbackTransaction",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Rolling-back transaction\"",
")",
";",
"assertTxIsActive",
"(",
")",
";",
"try",
"{",
"connection",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sex",... | Roll back the current transaction. Transaction mode is closed. | [
"Roll",
"back",
"the",
"current",
"transaction",
".",
"Transaction",
"mode",
"is",
"closed",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-db/src/main/java/jodd/db/DbSession.java#L269-L281 | test | Rollback the current transaction. | Of course, here is the Java code you requested:
```java
public void rollbackTransaction() {
log.debug("Rolling-back transaction");
assertTxIsActive();
try {
connection.rollback();
} catch (SQLException sex) {
throw new DbSqlException("Rollback TX failed", sex);
} finally {
closeTx();
}
}
```
H... |
ieb/sparsemapcontent | core/src/main/java/org/sakaiproject/nakamura/api/lite/util/Type1UUID.java | Type1UUID.next | public static byte[] next() {
if (type1Initialized == false) {
initializeForType1();
}
// set ip addr
byte[] uuid = new byte[16];
System.arraycopy(IP, 0, uuid, 10, IP.length);
// Set time info. Have to do this processing within a synchronized
// block... | java | public static byte[] next() {
if (type1Initialized == false) {
initializeForType1();
}
// set ip addr
byte[] uuid = new byte[16];
System.arraycopy(IP, 0, uuid, 10, IP.length);
// Set time info. Have to do this processing within a synchronized
// block... | [
"public",
"static",
"byte",
"[",
"]",
"next",
"(",
")",
"{",
"if",
"(",
"type1Initialized",
"==",
"false",
")",
"{",
"initializeForType1",
"(",
")",
";",
"}",
"// set ip addr",
"byte",
"[",
"]",
"uuid",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"Syste... | /*
Creates a type 1 UUID | [
"/",
"*",
"Creates",
"a",
"type",
"1",
"UUID"
] | 0570fdf868adbbf7734790cbc09fe66480e5f2dc | https://github.com/ieb/sparsemapcontent/blob/0570fdf868adbbf7734790cbc09fe66480e5f2dc/core/src/main/java/org/sakaiproject/nakamura/api/lite/util/Type1UUID.java#L130-L166 | test | This method returns the next 16 bytes of UUID. | Of course, here is the Java code you requested:
```java
public static byte[] next() {
if (type1Initialized == false) {
initializeForType1();
}
// set ip addr
byte[] uuid = new byte[16];
System.arraycopy(IP, 0, uuid, 10, IP.length);
// Set time info. Have to ... |
jbundle/util | jbackup/src/main/java/org/jbundle/jbackup/destination/ZipDestination.java | ZipDestination.initTransfer | public void initTransfer(Properties properties)
{
super.initTransfer(properties);
String strPathname = properties.getProperty(ZIPOUT_PATHNAME_PARAM);
if ((strPathname != null)
&& (strPathname.length() > 0)
&& (strPathname.lastIndexOf(System.getProperties().getProperty("file.separator")) == strPathname.len... | java | public void initTransfer(Properties properties)
{
super.initTransfer(properties);
String strPathname = properties.getProperty(ZIPOUT_PATHNAME_PARAM);
if ((strPathname != null)
&& (strPathname.length() > 0)
&& (strPathname.lastIndexOf(System.getProperties().getProperty("file.separator")) == strPathname.len... | [
"public",
"void",
"initTransfer",
"(",
"Properties",
"properties",
")",
"{",
"super",
".",
"initTransfer",
"(",
"properties",
")",
";",
"String",
"strPathname",
"=",
"properties",
".",
"getProperty",
"(",
"ZIPOUT_PATHNAME_PARAM",
")",
";",
"if",
"(",
"(",
"str... | /*
Set up everything to start processing | [
"/",
"*",
"Set",
"up",
"everything",
"to",
"start",
"processing"
] | 5af0f2292f56f29f70cbc26d0bfa72f89ae31be0 | https://github.com/jbundle/util/blob/5af0f2292f56f29f70cbc26d0bfa72f89ae31be0/jbackup/src/main/java/org/jbundle/jbackup/destination/ZipDestination.java#L78-L113 | test | Initialize the transfer. | Of course, here is the Java code you requested:
```java
public void initTransfer(Properties properties)
{
super.initTransfer(properties);
String strPathname = properties.getProperty(ZIPOUT_PATHNAME_PARAM);
if ((strPathname != null)
&& (strPathname.length() > 0)
&& (strPathname.lastIndexOf(System.getPrope... |
GlenKPeterson/Paguro | src/main/java/org/organicdesign/fp/collections/RangeOfInt.java | RangeOfInt.of | public static RangeOfInt of(Number s, Number e) {
if ((s == null) || (e == null)) {
throw new IllegalArgumentException("Nulls not allowed");
}
if (e.longValue() < s.longValue()) {
throw new IllegalArgumentException("end of range must be >= start of range");
}
... | java | public static RangeOfInt of(Number s, Number e) {
if ((s == null) || (e == null)) {
throw new IllegalArgumentException("Nulls not allowed");
}
if (e.longValue() < s.longValue()) {
throw new IllegalArgumentException("end of range must be >= start of range");
}
... | [
"public",
"static",
"RangeOfInt",
"of",
"(",
"Number",
"s",
",",
"Number",
"e",
")",
"{",
"if",
"(",
"(",
"s",
"==",
"null",
")",
"||",
"(",
"e",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Nulls not allowed\"",
")"... | } | [
"}"
] | eac0d64b2eb9496967334f635cdb270cffb2197b | https://github.com/GlenKPeterson/Paguro/blob/eac0d64b2eb9496967334f635cdb270cffb2197b/src/main/java/org/organicdesign/fp/collections/RangeOfInt.java#L73-L81 | test | Create a RangeOfInt from the given numbers. | Of course, here is the Java code you requested:
```java
public static RangeOfInt of(Number s, Number e) {
if ((s == null) || (e == null)) {
throw new IllegalArgumentException("Nulls not allowed");
}
if (e.longValue() < s.longValue()) {
throw new IllegalArgumentException(... |
snakerflow/snakerflow | snaker-core/src/main/java/org/snaker/engine/core/SnakerEngineImpl.java | SnakerEngineImpl.configure | public SnakerEngine configure(Configuration config) {
this.configuration = config;
processService = ServiceContext.find(IProcessService.class);
queryService = ServiceContext.find(IQueryService.class);
orderService = ServiceContext.find(IOrderService.class);
taskService = ServiceContext.find(ITaskService.class... | java | public SnakerEngine configure(Configuration config) {
this.configuration = config;
processService = ServiceContext.find(IProcessService.class);
queryService = ServiceContext.find(IQueryService.class);
orderService = ServiceContext.find(IOrderService.class);
taskService = ServiceContext.find(ITaskService.class... | [
"public",
"SnakerEngine",
"configure",
"(",
"Configuration",
"config",
")",
"{",
"this",
".",
"configuration",
"=",
"config",
";",
"processService",
"=",
"ServiceContext",
".",
"find",
"(",
"IProcessService",
".",
"class",
")",
";",
"queryService",
"=",
"Service... | 根据serviceContext上下文,查找processService、orderService、taskService服务 | [
"根据serviceContext上下文,查找processService、orderService、taskService服务"
] | 9c8cb3148a76702f1eda22f1d113053cb44b1eff | https://github.com/snakerflow/snakerflow/blob/9c8cb3148a76702f1eda22f1d113053cb44b1eff/snaker-core/src/main/java/org/snaker/engine/core/SnakerEngineImpl.java#L83-L119 | test | Configure the SnakerEngine. | Of course, here is the Java code you requested:
```java
public SnakerEngine configure(Configuration config) {
this.configuration = config;
processService = ServiceContext.find(IProcessService.class);
queryService = ServiceContext.find(IQueryService.class);
orderService = ServiceContext.find(IOrderService.class... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/grid/GridUI.java | GridUI.addMapBean | public void addMapBean( MapBean mb) {
mapBeanMenu.addAction( mb.getActionDesc(), mb.getIcon(), mb.getAction());
// first one is the "default"
if (mapBeanCount == 0) {
setMapRenderer( mb.getRenderer());
}
mapBeanCount++;
mb.addPropertyChangeListener( new PropertyChangeListener() {... | java | public void addMapBean( MapBean mb) {
mapBeanMenu.addAction( mb.getActionDesc(), mb.getIcon(), mb.getAction());
// first one is the "default"
if (mapBeanCount == 0) {
setMapRenderer( mb.getRenderer());
}
mapBeanCount++;
mb.addPropertyChangeListener( new PropertyChangeListener() {... | [
"public",
"void",
"addMapBean",
"(",
"MapBean",
"mb",
")",
"{",
"mapBeanMenu",
".",
"addAction",
"(",
"mb",
".",
"getActionDesc",
"(",
")",
",",
"mb",
".",
"getIcon",
"(",
")",
",",
"mb",
".",
"getAction",
"(",
")",
")",
";",
"// first one is the \"defau... | add a MapBean to the User Interface | [
"add",
"a",
"MapBean",
"to",
"the",
"User",
"Interface"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/grid/GridUI.java#L222-L238 | test | Add a MapBean to the mapBeanMenu | Of course, here is the Java code you requested:
```java
public void addMapBean( MapBean mb) {
mapBeanMenu.addAction( mb.getActionDesc(), mb.getIcon(), mb.getAction());
// first one is the "default"
if (mapBeanCount == 0) {
setMapRenderer( mb.getRenderer());
}
mapBeanCount++;
mb.... |
GojaFramework/goja | goja-web/src/main/java/goja/security/goja/SecurityKit.java | SecurityKit.getLoginWithDb | public static <T extends Model> T getLoginWithDb(HttpServletRequest req
, HttpServletResponse response
, Function<Long, T> function) {
T loginUser = getLoginUser(req);
if (loginUser == null) {
//从Cookie中解析出用户id
CookieUser cookie_user = getUserFromCookie(re... | java | public static <T extends Model> T getLoginWithDb(HttpServletRequest req
, HttpServletResponse response
, Function<Long, T> function) {
T loginUser = getLoginUser(req);
if (loginUser == null) {
//从Cookie中解析出用户id
CookieUser cookie_user = getUserFromCookie(re... | [
"public",
"static",
"<",
"T",
"extends",
"Model",
">",
"T",
"getLoginWithDb",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"response",
",",
"Function",
"<",
"Long",
",",
"T",
">",
"function",
")",
"{",
"T",
"loginUser",
"=",
"getLoginUser",
... | Get user login information, if the session does not exist, then try to obtain from the
Cookie, if cookie exists, then decrypt obtain user information.
@param req requeset
@param response http response
@param function call function.
@return user login information. | [
"Get",
"user",
"login",
"information",
"if",
"the",
"session",
"does",
"not",
"exist",
"then",
"try",
"to",
"obtain",
"from",
"the",
"Cookie",
"if",
"cookie",
"exists",
"then",
"decrypt",
"obtain",
"user",
"information",
"."
] | 77179b495f668fc1fa20accc912991df6bb2d917 | https://github.com/GojaFramework/goja/blob/77179b495f668fc1fa20accc912991df6bb2d917/goja-web/src/main/java/goja/security/goja/SecurityKit.java#L134-L158 | test | get login with db. | Of course, here is the Java code you requested:
```java
public static <T extends Model> T getLoginWithDb(HttpServletRequest req
, HttpServletResponse response
, Function<Long, T> function) {
T loginUser = getLoginUser(req);
if (loginUser == null) {
//从Cookie中解析出用户id
... |
lessthanoptimal/GeoRegression | main/src/georegression/geometry/UtilCurves_F64.java | UtilCurves_F64.convert | public static ConicGeneral_F64 convert(ParabolaGeneral_F64 src , ConicGeneral_F64 dst ) {
if( dst == null )
dst = new ConicGeneral_F64();
dst.A = src.A*src.A;
dst.B = src.A*src.C*2.0;
dst.C = src.C*src.C;
dst.D = src.D;
dst.E = src.E;
dst.F = src.F;
return dst;
} | java | public static ConicGeneral_F64 convert(ParabolaGeneral_F64 src , ConicGeneral_F64 dst ) {
if( dst == null )
dst = new ConicGeneral_F64();
dst.A = src.A*src.A;
dst.B = src.A*src.C*2.0;
dst.C = src.C*src.C;
dst.D = src.D;
dst.E = src.E;
dst.F = src.F;
return dst;
} | [
"public",
"static",
"ConicGeneral_F64",
"convert",
"(",
"ParabolaGeneral_F64",
"src",
",",
"ConicGeneral_F64",
"dst",
")",
"{",
"if",
"(",
"dst",
"==",
"null",
")",
"dst",
"=",
"new",
"ConicGeneral_F64",
"(",
")",
";",
"dst",
".",
"A",
"=",
"src",
".",
"... | Converts the parabola into a conic.
@param src (Input) Parabola
@param dst (Output) Optional storage for converted conic
@return Conic | [
"Converts",
"the",
"parabola",
"into",
"a",
"conic",
"."
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/geometry/UtilCurves_F64.java#L163-L175 | test | Converts a ParabolaGeneral_F64 to a ConicGeneral_F64 | Of course, here is the Java code you requested:
```java
public static ConicGeneral_F64 convert(ParabolaGeneral_F64 src , ConicGeneral_F64 dst ) {
if( dst == null )
dst = new ConicGeneral_F64();
dst.A = src.A*src.A;
dst.B = src.A*src.C*2.0;
dst.C = src.C*src.C;
dst.D = src.D;
dst.E = src.E;
dst.F = sr... |
GlenKPeterson/Paguro | src/main/java/org/organicdesign/fp/StaticImports.java | StaticImports.sortedSet | public static <T extends Comparable<T>> ImSortedSet<T> sortedSet(Iterable<T> items) {
return PersistentTreeSet.of(items);
} | java | public static <T extends Comparable<T>> ImSortedSet<T> sortedSet(Iterable<T> items) {
return PersistentTreeSet.of(items);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"ImSortedSet",
"<",
"T",
">",
"sortedSet",
"(",
"Iterable",
"<",
"T",
">",
"items",
")",
"{",
"return",
"PersistentTreeSet",
".",
"of",
"(",
"items",
")",
";",
"}"
] | Returns a new PersistentTreeSet of the given comparable items. | [
"Returns",
"a",
"new",
"PersistentTreeSet",
"of",
"the",
"given",
"comparable",
"items",
"."
] | eac0d64b2eb9496967334f635cdb270cffb2197b | https://github.com/GlenKPeterson/Paguro/blob/eac0d64b2eb9496967334f635cdb270cffb2197b/src/main/java/org/organicdesign/fp/StaticImports.java#L242-L244 | test | Returns an immutable sorted set of the given items. | Of course, here is the Java code you requested:
```java
public static <T extends Comparable<T>> ImSortedSet<T> sortedSet(Iterable<T> items) {
return PersistentTreeSet.of(items);
}
```
Hope this helps! |
rupertlssmith/lojix | base/common/src/main/com/thesett/common/util/concurrent/BatchSynchQueueBase.java | BatchSynchQueueBase.tryPut | public void tryPut(E e) throws InterruptedException, SynchException
{
if (e == null)
{
throw new IllegalArgumentException("The 'e' parameter may not be null.");
}
// final Queue<E> items = this.buffer;
ReentrantLock lock = this.lock;
lock.lockInterruptibl... | java | public void tryPut(E e) throws InterruptedException, SynchException
{
if (e == null)
{
throw new IllegalArgumentException("The 'e' parameter may not be null.");
}
// final Queue<E> items = this.buffer;
ReentrantLock lock = this.lock;
lock.lockInterruptibl... | [
"public",
"void",
"tryPut",
"(",
"E",
"e",
")",
"throws",
"InterruptedException",
",",
"SynchException",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The 'e' parameter may not be null.\"",
")",
";",
"}",
"// fi... | Tries a synchronous put into the queue. If a consumer encounters an exception condition whilst processing the
data that is put, then this is returned to the caller wrapped inside a {@link SynchException}.
@param e The data element to put into the queue, may not be null.
@throws InterruptedException If the thread... | [
"Tries",
"a",
"synchronous",
"put",
"into",
"the",
"queue",
".",
"If",
"a",
"consumer",
"encounters",
"an",
"exception",
"condition",
"whilst",
"processing",
"the",
"data",
"that",
"is",
"put",
"then",
"this",
"is",
"returned",
"to",
"the",
"caller",
"wrappe... | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/base/common/src/main/com/thesett/common/util/concurrent/BatchSynchQueueBase.java#L383-L411 | test | Try to put an element into the cache. | Of course, here is the Java code you requested:
```java
public void tryPut(E e) throws InterruptedException, SynchException
{
if (e == null)
{
throw new IllegalArgumentException("The 'e' parameter may not be null.");
}
// final Queue<E> items = this.buffer;
Reen... |
Unidata/thredds | grib/src/main/java/ucar/nc2/grib/GribNumbers.java | GribNumbers.float4 | public static float float4(int a, int b, int c, int d) {
int sgn, mant, exp;
mant = b << 16 | c << 8 | d;
if (mant == 0) {
return 0.0f;
}
sgn = -(((a & 128) >> 6) - 1);
exp = (a & 127) - 64;
return (float) (sgn * Math.pow(16.0, exp - 6) * mant);
} | java | public static float float4(int a, int b, int c, int d) {
int sgn, mant, exp;
mant = b << 16 | c << 8 | d;
if (mant == 0) {
return 0.0f;
}
sgn = -(((a & 128) >> 6) - 1);
exp = (a & 127) - 64;
return (float) (sgn * Math.pow(16.0, exp - 6) * mant);
} | [
"public",
"static",
"float",
"float4",
"(",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
",",
"int",
"d",
")",
"{",
"int",
"sgn",
",",
"mant",
",",
"exp",
";",
"mant",
"=",
"b",
"<<",
"16",
"|",
"c",
"<<",
"8",
"|",
"d",
";",
"if",
"(",
... | Convert 4 bytes to a float.
@param a first byte
@param b second byte
@param c third byte
@param d fourth byte
@return float | [
"Convert",
"4",
"bytes",
"to",
"a",
"float",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/grib/src/main/java/ucar/nc2/grib/GribNumbers.java#L233-L245 | test | Returns 4 bytes of data from the given 4 - bit unsigned integer values. | Of course, here is the Java code you requested:
```java
public static float float4(int a, int b, int c, int d) {
int sgn, mant, exp;
mant = b << 16 | c << 8 | d;
if (mant == 0) {
return 0.0f;
}
sgn = -(((a & 128) >> 6) - 1);
exp = (a & 127) - 64;
return (float) (sgn * Ma... |
playframework/playframework | core/play/src/main/java/play/mvc/Results.java | Results.badRequest | public static Result badRequest(File content, boolean inline) {
return badRequest(content, inline, StaticFileMimeTypes.fileMimeTypes());
} | java | public static Result badRequest(File content, boolean inline) {
return badRequest(content, inline, StaticFileMimeTypes.fileMimeTypes());
} | [
"public",
"static",
"Result",
"badRequest",
"(",
"File",
"content",
",",
"boolean",
"inline",
")",
"{",
"return",
"badRequest",
"(",
"content",
",",
"inline",
",",
"StaticFileMimeTypes",
".",
"fileMimeTypes",
"(",
")",
")",
";",
"}"
] | Generates a 400 Bad Request result.
@param content The file to send.
@param inline Whether the file should be sent inline, or as an attachment.
@return the result | [
"Generates",
"a",
"400",
"Bad",
"Request",
"result",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/mvc/Results.java#L1102-L1104 | test | Returns a Result indicating that the content is not a valid file. | Of course, here is the Java code you requested:
```java
public static Result badRequest(File content, boolean inline) {
return badRequest(content, inline, StaticFileMimeTypes.fileMimeTypes());
}
```
Hope this helps! |
jkuhnert/ognl | src/main/java/ognl/EvaluationPool.java | EvaluationPool.create | public Evaluation create(SimpleNode node, Object source, boolean setOperation)
{
// synchronization is removed as we do not rely anymore on the in-house object pooling
return new Evaluation(node, source, setOperation);
} | java | public Evaluation create(SimpleNode node, Object source, boolean setOperation)
{
// synchronization is removed as we do not rely anymore on the in-house object pooling
return new Evaluation(node, source, setOperation);
} | [
"public",
"Evaluation",
"create",
"(",
"SimpleNode",
"node",
",",
"Object",
"source",
",",
"boolean",
"setOperation",
")",
"{",
"// synchronization is removed as we do not rely anymore on the in-house object pooling",
"return",
"new",
"Evaluation",
"(",
"node",
",",
"source... | Returns an Evaluation that contains the node, source and whether it
is a set operation. | [
"Returns",
"an",
"Evaluation",
"that",
"contains",
"the",
"node",
"source",
"and",
"whether",
"it",
"is",
"a",
"set",
"operation",
"."
] | 53d51a30c8c299b750dede779d05cb84beee73c3 | https://github.com/jkuhnert/ognl/blob/53d51a30c8c299b750dede779d05cb84beee73c3/src/main/java/ognl/EvaluationPool.java#L62-L66 | test | Create an Evaluation object. | Of course, here is the Java code you requested:
```java
public Evaluation create(SimpleNode node, Object source, boolean setOperation)
{
// synchronization is removed as we do not rely anymore on the in-house object pooling
return new Evaluation(node, source, setOperation);
}
```
Hope this hel... |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolver.java | AuthenticationPrincipalArgumentResolver.resolveArgument | public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
if (authentication == null) {
return ... | java | public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
if (authentication == null) {
return ... | [
"public",
"Object",
"resolveArgument",
"(",
"MethodParameter",
"parameter",
",",
"ModelAndViewContainer",
"mavContainer",
",",
"NativeWebRequest",
"webRequest",
",",
"WebDataBinderFactory",
"binderFactory",
")",
"throws",
"Exception",
"{",
"Authentication",
"authentication",
... | /*
(non-Javadoc)
@see org.springframework.web.method.support.HandlerMethodArgumentResolver#
resolveArgument (org.springframework.core.MethodParameter,
org.springframework.web.method.support.ModelAndViewContainer,
org.springframework.web.context.request.NativeWebRequest,
org.springframework.web.bind.support.WebDataBind... | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/bind/support/AuthenticationPrincipalArgumentResolver.java#L108-L130 | test | Resolves an argument to a value. | Of course, here is the Java code you requested:
```java
public Object resolveArgument(MethodParameter parameter,
ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
WebDataBinderFactory binderFactory) throws Exception {
Authentication authentication = SecurityContextHolder.getContext()
.getAut... |
blademainer/common_utils | common_code/src/main/java/com/xiongyingqi/utils/code/CodeBuilder.java | CodeBuilder.filterExclude | private void filterExclude() {
if (exclude == null || files == null) {
return;
}
Set<File> toExcludes = new HashSet<File>();
for (File file : files) {
Matcher matcher = exclude.matcher(file.getPath());
if (matcher.find()) {
toExcludes... | java | private void filterExclude() {
if (exclude == null || files == null) {
return;
}
Set<File> toExcludes = new HashSet<File>();
for (File file : files) {
Matcher matcher = exclude.matcher(file.getPath());
if (matcher.find()) {
toExcludes... | [
"private",
"void",
"filterExclude",
"(",
")",
"{",
"if",
"(",
"exclude",
"==",
"null",
"||",
"files",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Set",
"<",
"File",
">",
"toExcludes",
"=",
"new",
"HashSet",
"<",
"File",
">",
"(",
")",
";",
"for",
... | 过滤排除规则 | [
"过滤排除规则"
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/common_code/src/main/java/com/xiongyingqi/utils/code/CodeBuilder.java#L241-L255 | test | Filter the exclude files. | Of course, here is the Java code you requested:
```java
private void filterExclude() {
if (exclude == null || files == null) {
return;
}
Set<File> toExcludes = new HashSet<File>();
for (File file : files) {
Matcher matcher = exclude.matcher(file.getPath());
... |
Unidata/thredds | cdm/src/main/java/ucar/ma2/Index.java | Index.set | public Index set(int v0, int v1, int v2) {
setDim(0, v0);
setDim(1, v1);
setDim(2, v2);
return this;
} | java | public Index set(int v0, int v1, int v2) {
setDim(0, v0);
setDim(1, v1);
setDim(2, v2);
return this;
} | [
"public",
"Index",
"set",
"(",
"int",
"v0",
",",
"int",
"v1",
",",
"int",
"v2",
")",
"{",
"setDim",
"(",
"0",
",",
"v0",
")",
";",
"setDim",
"(",
"1",
",",
"v1",
")",
";",
"setDim",
"(",
"2",
",",
"v2",
")",
";",
"return",
"this",
";",
"}"
... | set current element at dimension 0,1,2 to v0,v1,v2
@param v0 set dimension 0 index to this value
@param v1 set dimension 1 index to this value
@param v2 set dimension 2 index to this value
@return this, so you can use A.get(i.set(i,j,k)) | [
"set",
"current",
"element",
"at",
"dimension",
"0",
"1",
"2",
"to",
"v0",
"v1",
"v2"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/ma2/Index.java#L695-L700 | test | Sets the dimensions of this index to be the specified values. | Of course, here is the Java code you requested:
```java
public Index set(int v0, int v1, int v2) {
setDim(0, v0);
setDim(1, v1);
setDim(2, v2);
return this;
}
```
Hope this helps! |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/subsystem/EJB3Subsystem10Parser.java | EJB3Subsystem10Parser.readElement | @Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
final ModelNode ejb3Subsystem = new ModelNode();
ejb3Subsystem.get(OP).set(ADD)... | java | @Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
final ModelNode ejb3Subsystem = new ModelNode();
ejb3Subsystem.get(OP).set(ADD)... | [
"@",
"Override",
"public",
"void",
"readElement",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"List",
"<",
"ModelNode",
">",
"list",
")",
"throws",
"XMLStreamException",
"{",
"ParseUtils",
".",
"requireNoAttributes",
"(",
"reader",
")",
";",
... | {@inheritDoc} | [
"{"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/EJB3Subsystem10Parser.java#L50-L58 | test | Add the ejb3 subsystem to the list. | Of course, here is the Java code you requested:
```java
@Override
public void readElement(final XMLExtendedStreamReader reader, final List<ModelNode> list) throws XMLStreamException {
ParseUtils.requireNoAttributes(reader);
ParseUtils.requireNoContent(reader);
final ModelNode ejb3Subsystem ... |
OpenEstate/OpenEstate-IO | OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_3.java | OpenImmo_1_2_3.upgradeZinshausRenditeobjektElements | protected void upgradeZinshausRenditeobjektElements(Document doc) throws JaxenException {
List nodes = XmlUtils.newXPath(
"/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]",
doc).selectNodes(doc);
for (Object item : nodes) {
... | java | protected void upgradeZinshausRenditeobjektElements(Document doc) throws JaxenException {
List nodes = XmlUtils.newXPath(
"/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]",
doc).selectNodes(doc);
for (Object item : nodes) {
... | [
"protected",
"void",
"upgradeZinshausRenditeobjektElements",
"(",
"Document",
"doc",
")",
"throws",
"JaxenException",
"{",
"List",
"nodes",
"=",
"XmlUtils",
".",
"newXPath",
"(",
"\"/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]\"",
",",
... | Upgrade <zinshaus_renditeobjekt> elements to OpenImmo 1.2.3.
<p>
The options "PFLEGEHEIM", "SANATORIUM", "SENIORENHEIM", "BETREUTES-WOHNEN"
for the "haustyp" attribute of <haus> elements are placed in the
<zinshaus_renditeobjekt> element in version 1.2.3.
@param doc OpenImmo document in version 1.2.2... | [
"Upgrade",
"<",
";",
"zinshaus_renditeobjekt>",
";",
"elements",
"to",
"OpenImmo",
"1",
".",
"2",
".",
"3",
".",
"<p",
">",
"The",
"options",
"PFLEGEHEIM",
"SANATORIUM",
"SENIORENHEIM",
"BETREUTES",
"-",
"WOHNEN",
"for",
"the",
"haustyp",
"attribute",
"of"... | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/OpenImmo/src/main/java/org/openestate/io/openimmo/converters/OpenImmo_1_2_3.java#L745-L775 | test | Upgrade the zinshaus rendite objekt elements. | Of course, here is the Java code you requested:
```java
protected void upgradeZinshausRenditeobjektElements(Document doc) throws JaxenException {
List nodes = XmlUtils.newXPath(
"/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:haus[@haustyp]",
doc).selec... |
boonproject/boon | boon/src/main/java/org/boon/core/reflection/BeanUtils.java | BeanUtils.idxStr | public static String idxStr( Object object, String path ) {
final Object val = idx(object, path);
return Conversions.toString(val);
} | java | public static String idxStr( Object object, String path ) {
final Object val = idx(object, path);
return Conversions.toString(val);
} | [
"public",
"static",
"String",
"idxStr",
"(",
"Object",
"object",
",",
"String",
"path",
")",
"{",
"final",
"Object",
"val",
"=",
"idx",
"(",
"object",
",",
"path",
")",
";",
"return",
"Conversions",
".",
"toString",
"(",
"val",
")",
";",
"}"
] | Get property value
@param object
@param path in dotted notation
@return | [
"Get",
"property",
"value"
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/core/reflection/BeanUtils.java#L1099-L1104 | test | Get the index value of the object and path. | Of course, here is the Java code you requested:
```java
public static String idxStr( Object object, String path ) {
final Object val = idx(object, path);
return Conversions.toString(val);
}
```
Hope this helps! |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/model/resource/processor/decorator/DefaultProcessorDecorator.java | DefaultProcessorDecorator.isEnabled | @Override
protected boolean isEnabled(final Resource resource) {
final boolean isApplicable = resource != null ? isEligible(criteria.isMinimize(), resource.getType()) : true;
return super.isEnabled(resource) && isApplicable;
} | java | @Override
protected boolean isEnabled(final Resource resource) {
final boolean isApplicable = resource != null ? isEligible(criteria.isMinimize(), resource.getType()) : true;
return super.isEnabled(resource) && isApplicable;
} | [
"@",
"Override",
"protected",
"boolean",
"isEnabled",
"(",
"final",
"Resource",
"resource",
")",
"{",
"final",
"boolean",
"isApplicable",
"=",
"resource",
"!=",
"null",
"?",
"isEligible",
"(",
"criteria",
".",
"isMinimize",
"(",
")",
",",
"resource",
".",
"g... | {@inheritDoc} | [
"{"
] | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/model/resource/processor/decorator/DefaultProcessorDecorator.java#L59-L63 | test | Override to check if the resource is a CDN specification and if it is a CDN specification and if it is a CDN specification and if it is a CDN specification then it is enabled. | Of course, here is the Java code you requested:
```java
@Override
protected boolean isEnabled(final Resource resource) {
final boolean isApplicable = resource != null ? isEligible(criteria.isMinimize(), resource.getType()) : true;
return super.isEnabled(resource) && isApplicable;
}
```
Hope this helps! |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/component/deployers/AbstractComponentConfigProcessor.java | AbstractComponentConfigProcessor.deploy | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collec... | java | public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION);
final Collec... | [
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"final",
"EEModuleDescription",
"... | {@inheritDoc} * | [
"{"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/component/deployers/AbstractComponentConfigProcessor.java#L46-L60 | test | Process the deployment. | Of course, here is the Java code you requested:
```java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment... |
kiegroup/droolsjbpm-tools | drools-eclipse/org.guvnor.eclipse.webdav/src/client/org/eclipse/webdav/http/client/HttpClient.java | HttpClient.getProxyServerUrl | public URL getProxyServerUrl(URL originServerUrl) {
Assert.isNotNull(originServerUrl);
return (URL) proxyServerUrls.get(originServerUrl);
} | java | public URL getProxyServerUrl(URL originServerUrl) {
Assert.isNotNull(originServerUrl);
return (URL) proxyServerUrls.get(originServerUrl);
} | [
"public",
"URL",
"getProxyServerUrl",
"(",
"URL",
"originServerUrl",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"originServerUrl",
")",
";",
"return",
"(",
"URL",
")",
"proxyServerUrls",
".",
"get",
"(",
"originServerUrl",
")",
";",
"}"
] | Returns the <code>URL</code> of the proxy server that the origin
server at the given <code>URL</code> uses, or <code>null</code> if
no proxy server is used.
@param originServerUrl the <code>URL<code> of an origin server
@return the <code>URL</code> of a proxy server, or <code>null</code>
@see #addProxyServerException(... | [
"Returns",
"the",
"<code",
">",
"URL<",
"/",
"code",
">",
"of",
"the",
"proxy",
"server",
"that",
"the",
"origin",
"server",
"at",
"the",
"given",
"<code",
">",
"URL<",
"/",
"code",
">",
"uses",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
... | 05e1f73c591178360a198dca29f99d73918991db | https://github.com/kiegroup/droolsjbpm-tools/blob/05e1f73c591178360a198dca29f99d73918991db/drools-eclipse/org.guvnor.eclipse.webdav/src/client/org/eclipse/webdav/http/client/HttpClient.java#L679-L682 | test | Get the proxy server URL. | Of course, here is the Java code you requested:
```java
public URL getProxyServerUrl(URL originServerUrl) {
Assert.isNotNull(originServerUrl);
return (URL) proxyServerUrls.get(originServerUrl);
}
```
Hope this helps! |
real-logic/aeron | aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java | ChannelUriStringBuilder.termLength | public ChannelUriStringBuilder termLength(final Integer termLength)
{
if (null != termLength)
{
LogBufferDescriptor.checkTermLength(termLength);
}
this.termLength = termLength;
return this;
} | java | public ChannelUriStringBuilder termLength(final Integer termLength)
{
if (null != termLength)
{
LogBufferDescriptor.checkTermLength(termLength);
}
this.termLength = termLength;
return this;
} | [
"public",
"ChannelUriStringBuilder",
"termLength",
"(",
"final",
"Integer",
"termLength",
")",
"{",
"if",
"(",
"null",
"!=",
"termLength",
")",
"{",
"LogBufferDescriptor",
".",
"checkTermLength",
"(",
"termLength",
")",
";",
"}",
"this",
".",
"termLength",
"=",
... | Set the length of buffer used for each term of the log. Valid values are powers of 2 in the 64K - 1G range.
@param termLength of the buffer used for each term of the log.
@return this for a fluent API.
@see CommonContext#TERM_LENGTH_PARAM_NAME | [
"Set",
"the",
"length",
"of",
"buffer",
"used",
"for",
"each",
"term",
"of",
"the",
"log",
".",
"Valid",
"values",
"are",
"powers",
"of",
"2",
"in",
"the",
"64K",
"-",
"1G",
"range",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java#L407-L416 | test | Sets the term length. | Of course, here is the Java code you requested:
```java
public ChannelUriStringBuilder termLength(final Integer termLength)
{
if (null != termLength)
{
LogBufferDescriptor.checkTermLength(termLength);
}
this.termLength = termLength;
return this;
}
```
Hope ... |
jkuhnert/ognl | src/main/java/ognl/OgnlRuntime.java | OgnlRuntime.getArgClass | public static final Class getArgClass(Object arg)
{
if (arg == null)
return null;
Class c = arg.getClass();
if (c == Boolean.class)
return Boolean.TYPE;
else if (c.getSuperclass() == Number.class) {
if (c == Integer.class)
return In... | java | public static final Class getArgClass(Object arg)
{
if (arg == null)
return null;
Class c = arg.getClass();
if (c == Boolean.class)
return Boolean.TYPE;
else if (c.getSuperclass() == Number.class) {
if (c == Integer.class)
return In... | [
"public",
"static",
"final",
"Class",
"getArgClass",
"(",
"Object",
"arg",
")",
"{",
"if",
"(",
"arg",
"==",
"null",
")",
"return",
"null",
";",
"Class",
"c",
"=",
"arg",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"c",
"==",
"Boolean",
".",
"class"... | Gets the class for a method argument that is appropriate for looking up methods by
reflection, by looking for the standard primitive wrapper classes and exchanging for them
their underlying primitive class objects. Other classes are passed through unchanged.
@param arg an object that is being passed to a method
@retur... | [
"Gets",
"the",
"class",
"for",
"a",
"method",
"argument",
"that",
"is",
"appropriate",
"for",
"looking",
"up",
"methods",
"by",
"reflection",
"by",
"looking",
"for",
"the",
"standard",
"primitive",
"wrapper",
"classes",
"and",
"exchanging",
"for",
"them",
"the... | 53d51a30c8c299b750dede779d05cb84beee73c3 | https://github.com/jkuhnert/ognl/blob/53d51a30c8c299b750dede779d05cb84beee73c3/src/main/java/ognl/OgnlRuntime.java#L895-L918 | test | Get the class of the argument object. | Of course, here is the Java code you requested:
```java
public static final Class getArgClass(Object arg)
{
if (arg == null)
return null;
Class c = arg.getClass();
if (c == Boolean.class)
return Boolean.TYPE;
else if (c.getSuperclass() == Number.class) {
... |
braintree/braintree_android | PayPalOneTouch/src/main/java/com/paypal/android/sdk/onetouch/core/config/OtcConfiguration.java | OtcConfiguration.getBrowserBillingAgreementConfig | public BillingAgreementRecipe getBrowserBillingAgreementConfig() {
for (BillingAgreementRecipe recipe : mBillingAgreementRecipesInDecreasingPriorityOrder) {
if (recipe.getTarget() == RequestTarget.browser) {
return recipe;
}
}
return null;
} | java | public BillingAgreementRecipe getBrowserBillingAgreementConfig() {
for (BillingAgreementRecipe recipe : mBillingAgreementRecipesInDecreasingPriorityOrder) {
if (recipe.getTarget() == RequestTarget.browser) {
return recipe;
}
}
return null;
} | [
"public",
"BillingAgreementRecipe",
"getBrowserBillingAgreementConfig",
"(",
")",
"{",
"for",
"(",
"BillingAgreementRecipe",
"recipe",
":",
"mBillingAgreementRecipesInDecreasingPriorityOrder",
")",
"{",
"if",
"(",
"recipe",
".",
"getTarget",
"(",
")",
"==",
"RequestTarget... | Returns the browser recipe that can handle billing agreement, or null if there is none.
@return | [
"Returns",
"the",
"browser",
"recipe",
"that",
"can",
"handle",
"billing",
"agreement",
"or",
"null",
"if",
"there",
"is",
"none",
"."
] | 07b32e6fad73f9fb8432971b0e79fc8c94b11873 | https://github.com/braintree/braintree_android/blob/07b32e6fad73f9fb8432971b0e79fc8c94b11873/PayPalOneTouch/src/main/java/com/paypal/android/sdk/onetouch/core/config/OtcConfiguration.java#L56-L64 | test | Get the browser billing agreement recipe configuration. | Of course, here is the Java code you requested:
```java
public BillingAgreementRecipe getBrowserBillingAgreementConfig() {
for (BillingAgreementRecipe recipe : mBillingAgreementRecipesInDecreasingPriorityOrder) {
if (recipe.getTarget() == RequestTarget.browser) {
return recipe;
... |
orientechnologies/orientdb | graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientVertex.java | OrientVertex.moveTo | public ORID moveTo(final String iClassName, final String iClusterName) {
final OrientBaseGraph graph = getGraph();
if (checkDeletedInTx())
graph.throwRecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted");
final ORID oldIdentity = getIdentity().copy();
final... | java | public ORID moveTo(final String iClassName, final String iClusterName) {
final OrientBaseGraph graph = getGraph();
if (checkDeletedInTx())
graph.throwRecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted");
final ORID oldIdentity = getIdentity().copy();
final... | [
"public",
"ORID",
"moveTo",
"(",
"final",
"String",
"iClassName",
",",
"final",
"String",
"iClusterName",
")",
"{",
"final",
"OrientBaseGraph",
"graph",
"=",
"getGraph",
"(",
")",
";",
"if",
"(",
"checkDeletedInTx",
"(",
")",
")",
"graph",
".",
"throwRecordN... | Moves current vertex to another class/cluster. All edges are updated automatically.
@param iClassName New class name to assign
@param iClusterName Cluster name where to save the new vertex
@return New vertex's identity
@see #moveToClass(String)
@see #moveToCluster(String) | [
"Moves",
"current",
"vertex",
"to",
"another",
"class",
"/",
"cluster",
".",
"All",
"edges",
"are",
"updated",
"automatically",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientVertex.java#L580-L660 | test | Move the current vertex to the new one. | Of course, here is the Java code you requested:
```java
public ORID moveTo(final String iClassName, final String iClusterName) {
final OrientBaseGraph graph = getGraph();
if (checkDeletedInTx())
graph.throwRecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted");
... |
Unidata/thredds | tds/src/main/java/thredds/util/StringValidateEncodeUtils.java | StringValidateEncodeUtils.validPath | @SuppressWarnings({"SimplifiableIfStatement"})
public static boolean validPath(String path) {
if (path == null)
return false;
// Don't allow ".." directories in path.
if (path.indexOf("/../") != -1 || path.equals("..")
|| path.startsWith("../") || path.endsWith("/.."))
return false... | java | @SuppressWarnings({"SimplifiableIfStatement"})
public static boolean validPath(String path) {
if (path == null)
return false;
// Don't allow ".." directories in path.
if (path.indexOf("/../") != -1 || path.equals("..")
|| path.startsWith("../") || path.endsWith("/.."))
return false... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"SimplifiableIfStatement\"",
"}",
")",
"public",
"static",
"boolean",
"validPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"return",
"false",
";",
"// Don't allow \"..\" directories in path.",
"if... | Return true if the given String is a valid path.
<p>
<p>
A String is considered a valid path if:
<ul>
<li> when passed to validSingleLineString(String) true is returned, and
<li> it does not contain any parent path segments ("../").</li>
</li>
</ul>
@param path the String to validate
@return true if the given String i... | [
"Return",
"true",
"if",
"the",
"given",
"String",
"is",
"a",
"valid",
"path",
".",
"<p",
">",
"<p",
">",
"A",
"String",
"is",
"considered",
"a",
"valid",
"path",
"if",
":",
"<ul",
">",
"<li",
">",
"when",
"passed",
"to",
"validSingleLineString",
"(",
... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/util/StringValidateEncodeUtils.java#L78-L88 | test | Check if the path is a valid path. | Of course, here is the Java code you requested:
```java
@SuppressWarnings({"SimplifiableIfStatement"})
public static boolean validPath(String path) {
if (path == null)
return false;
// Don't allow ".." directories in path.
if (path.indexOf("/../") != -1 || path.equals("..")
|| path.star... |
oblac/jodd | jodd-lagarto/src/main/java/jodd/lagarto/LagartoParser.java | LagartoParser.emitComment | protected void emitComment(final int from, final int to) {
if (config.enableConditionalComments) {
// CC: downlevel-hidden starting
if (match(CC_IF, from)) {
int endBracketNdx = find(']', from + 3, to);
CharSequence expression = charSequence(from + 1, endBracketNdx);
ndx = endBracketNdx + 1;
... | java | protected void emitComment(final int from, final int to) {
if (config.enableConditionalComments) {
// CC: downlevel-hidden starting
if (match(CC_IF, from)) {
int endBracketNdx = find(']', from + 3, to);
CharSequence expression = charSequence(from + 1, endBracketNdx);
ndx = endBracketNdx + 1;
... | [
"protected",
"void",
"emitComment",
"(",
"final",
"int",
"from",
",",
"final",
"int",
"to",
")",
"{",
"if",
"(",
"config",
".",
"enableConditionalComments",
")",
"{",
"// CC: downlevel-hidden starting",
"if",
"(",
"match",
"(",
"CC_IF",
",",
"from",
")",
")"... | Emits a comment. Also checks for conditional comments! | [
"Emits",
"a",
"comment",
".",
"Also",
"checks",
"for",
"conditional",
"comments!"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-lagarto/src/main/java/jodd/lagarto/LagartoParser.java#L2971-L3007 | test | Emit comment. | Of course, here is the Java code you requested:
```java
protected void emitComment(final int from, final int to) {
if (config.enableConditionalComments) {
// CC: downlevel-hidden starting
if (match(CC_IF, from)) {
int endBracketNdx = find(']', from + 3, to);
CharSequence expression = charSequence(from... |
phax/ph-math | ph-math/src/main/java/com/helger/numbercruncher/matrix/InvertibleMatrix.java | InvertibleMatrix.determinant | public float determinant () throws MatrixException
{
decompose ();
// Each row exchange during forward elimination flips the sign
// of the determinant, so check for an odd number of exchanges.
float determinant = ((m_nExchangeCount & 1) == 0) ? 1 : -1;
// Form the product of the diagonal elemen... | java | public float determinant () throws MatrixException
{
decompose ();
// Each row exchange during forward elimination flips the sign
// of the determinant, so check for an odd number of exchanges.
float determinant = ((m_nExchangeCount & 1) == 0) ? 1 : -1;
// Form the product of the diagonal elemen... | [
"public",
"float",
"determinant",
"(",
")",
"throws",
"MatrixException",
"{",
"decompose",
"(",
")",
";",
"// Each row exchange during forward elimination flips the sign",
"// of the determinant, so check for an odd number of exchanges.",
"float",
"determinant",
"=",
"(",
"(",
... | Compute the determinant.
@return the determinant
@throws MatrixException
if an error occurred | [
"Compute",
"the",
"determinant",
"."
] | 9f998870c7e05226e032b1f38c23e7d45ec0169d | https://github.com/phax/ph-math/blob/9f998870c7e05226e032b1f38c23e7d45ec0169d/ph-math/src/main/java/com/helger/numbercruncher/matrix/InvertibleMatrix.java#L77-L93 | test | Returns the determinant of the matrix U. | Of course, here is the Java code you requested:
```java
public float determinant () throws MatrixException
{
decompose ();
// Each row exchange during forward elimination flips the sign
// of the determinant, so check for an odd number of exchanges.
float determinant = ((m_nExchangeCount & 1) == 0) ... |
Jasig/NotificationPortlet | notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPTaskNotificationService.java | SSPTaskNotificationService.getNotificationSource | private String getNotificationSource(PortletRequest req) {
PortletPreferences preferences = req.getPreferences();
String source = preferences.getValue(NOTIFICATION_SOURCE_PREF, DEFAULT_NOTIFICATION_SOURCE);
return source;
} | java | private String getNotificationSource(PortletRequest req) {
PortletPreferences preferences = req.getPreferences();
String source = preferences.getValue(NOTIFICATION_SOURCE_PREF, DEFAULT_NOTIFICATION_SOURCE);
return source;
} | [
"private",
"String",
"getNotificationSource",
"(",
"PortletRequest",
"req",
")",
"{",
"PortletPreferences",
"preferences",
"=",
"req",
".",
"getPreferences",
"(",
")",
";",
"String",
"source",
"=",
"preferences",
".",
"getValue",
"(",
"NOTIFICATION_SOURCE_PREF",
","... | Get the source value to use for a Notification entry.
@param req the portlet request
@return the source value to use. | [
"Get",
"the",
"source",
"value",
"to",
"use",
"for",
"a",
"Notification",
"entry",
"."
] | a74b87c145b66166a2cb6849d17ce9b0f2c98f3b | https://github.com/Jasig/NotificationPortlet/blob/a74b87c145b66166a2cb6849d17ce9b0f2c98f3b/notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/ssp/SSPTaskNotificationService.java#L353-L358 | test | Get the notification source from the PortletRequest. | Of course, here is the Java code you requested:
```java
private String getNotificationSource(PortletRequest req) {
PortletPreferences preferences = req.getPreferences();
String source = preferences.getValue(NOTIFICATION_SOURCE_PREF, DEFAULT_NOTIFICATION_SOURCE);
return source;
}
```
Hope ... |
oblac/jodd | jodd-petite/src/main/java/jodd/petite/BeanData.java | BeanData.injectParams | public void injectParams(final ParamManager paramManager, final boolean implicitParamInjection) {
if (beanDefinition.name == null) {
return;
}
if (implicitParamInjection) {
// implicit
final int len = beanDefinition.name.length() + 1;
for (final String param : beanDefinition.params) {
final Objec... | java | public void injectParams(final ParamManager paramManager, final boolean implicitParamInjection) {
if (beanDefinition.name == null) {
return;
}
if (implicitParamInjection) {
// implicit
final int len = beanDefinition.name.length() + 1;
for (final String param : beanDefinition.params) {
final Objec... | [
"public",
"void",
"injectParams",
"(",
"final",
"ParamManager",
"paramManager",
",",
"final",
"boolean",
"implicitParamInjection",
")",
"{",
"if",
"(",
"beanDefinition",
".",
"name",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"implicitParamInjection"... | Injects all parameters. | [
"Injects",
"all",
"parameters",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-petite/src/main/java/jodd/petite/BeanData.java#L170-L199 | test | Injects the bean parameters. | Of course, here is the Java code you requested:
```java
public void injectParams(final ParamManager paramManager, final boolean implicitParamInjection) {
if (beanDefinition.name == null) {
return;
}
if (implicitParamInjection) {
// implicit
final int len = beanDefinition.name.length() + 1;
for (fina... |
ArpNetworking/logback-steno | src/main/java/com/arpnetworking/logback/serialization/steno/StandardSerializationStrategy.java | StandardSerializationStrategy.serialize | public String serialize(
final ILoggingEvent event,
final String eventName) throws Exception {
final StringWriter jsonWriter = new StringWriter();
final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);
// Start wrapper
StenoSerializationHelper.sta... | java | public String serialize(
final ILoggingEvent event,
final String eventName) throws Exception {
final StringWriter jsonWriter = new StringWriter();
final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);
// Start wrapper
StenoSerializationHelper.sta... | [
"public",
"String",
"serialize",
"(",
"final",
"ILoggingEvent",
"event",
",",
"final",
"String",
"eventName",
")",
"throws",
"Exception",
"{",
"final",
"StringWriter",
"jsonWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"JsonGenerator",
"jsonGenerato... | Serialize an event.
@param event The event.
@param eventName The event name.
@return Serialization of message as a <code>String</code>.
@throws Exception Serialization may throw any <code>Exception</code>. | [
"Serialize",
"an",
"event",
"."
] | abd5c68ce7d42c39f80ffbad6d162d5fed3a346e | https://github.com/ArpNetworking/logback-steno/blob/abd5c68ce7d42c39f80ffbad6d162d5fed3a346e/src/main/java/com/arpnetworking/logback/serialization/steno/StandardSerializationStrategy.java#L59-L81 | test | Serialize a ILoggingEvent to a JSON string. | Of course, here is the Java code you requested:
```java
public String serialize(
final ILoggingEvent event,
final String eventName) throws Exception {
final StringWriter jsonWriter = new StringWriter();
final JsonGenerator jsonGenerator = _jsonFactory.createGenerator(jsonWriter);
... |
Unidata/thredds | httpservices/src/main/java/ucar/httpservices/HTTPUtil.java | HTTPUtil.readbinaryfile | static public byte[]
readbinaryfile(File f)
throws IOException
{
try (FileInputStream fis = new FileInputStream(f)) {
return readbinaryfile(fis);
}
} | java | static public byte[]
readbinaryfile(File f)
throws IOException
{
try (FileInputStream fis = new FileInputStream(f)) {
return readbinaryfile(fis);
}
} | [
"static",
"public",
"byte",
"[",
"]",
"readbinaryfile",
"(",
"File",
"f",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"f",
")",
")",
"{",
"return",
"readbinaryfile",
"(",
"fis",
")",
";",
"... | Misc. | [
"Misc",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/httpservices/src/main/java/ucar/httpservices/HTTPUtil.java#L182-L189 | test | read a single SECTYPE file from a file | Of course, here is the Java code you requested:
```java
static public byte[]
readbinaryfile(File f)
throws IOException
{
try (FileInputStream fis = new FileInputStream(f)) {
return readbinaryfile(fis);
}
}
```
Hope this helps! |
Unidata/thredds | udunits/src/main/java/ucar/units/LogarithmicUnit.java | LogarithmicUnit.fromDerivedUnit | public float[] fromDerivedUnit(final float[] input, final float[] output)
throws ConversionException {
reference.fromDerivedUnit(input, output);
for (int i = input.length; --i >= 0;) {
output[i] = (float) (Math.log(output[i]) / lnBase);
}
return output;
} | java | public float[] fromDerivedUnit(final float[] input, final float[] output)
throws ConversionException {
reference.fromDerivedUnit(input, output);
for (int i = input.length; --i >= 0;) {
output[i] = (float) (Math.log(output[i]) / lnBase);
}
return output;
} | [
"public",
"float",
"[",
"]",
"fromDerivedUnit",
"(",
"final",
"float",
"[",
"]",
"input",
",",
"final",
"float",
"[",
"]",
"output",
")",
"throws",
"ConversionException",
"{",
"reference",
".",
"fromDerivedUnit",
"(",
"input",
",",
"output",
")",
";",
"for... | Converts values in the convertible derived unit to the equivalent values
in this unit.
@param input
The values in the convertible derived unit.
@param output
The equivalent values in this unit. May be the same array as
<code>input</code>.
@return <code>output</code>.
@throws ConversionException
Can't convert between u... | [
"Converts",
"values",
"in",
"the",
"convertible",
"derived",
"unit",
"to",
"the",
"equivalent",
"values",
"in",
"this",
"unit",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/udunits/src/main/java/ucar/units/LogarithmicUnit.java#L326-L333 | test | This method converts a sequence of float values from a derived unit to a sequence of float values. | Of course, here is the Java code you requested:
```java
public float[] fromDerivedUnit(final float[] input, final float[] output)
throws ConversionException {
reference.fromDerivedUnit(input, output);
for (int i = input.length; --i >= 0;) {
output[i] = (float) (Math.log(output[i... |
signalfx/appd-integration | appd-report-standalone/src/main/java/com/signalfx/appd/report/config/Config.java | Config.getConnectionConfig | public static ConnectionConfig getConnectionConfig() {
boolean isValid = true;
String appdUsername = getPropertyOrEnv("com.signalfx.appd.username", "APPD_USERNAME");
if (StringUtils.isEmpty(appdUsername)) {
log.error("AppDynamics username not specified.");
isValid = false... | java | public static ConnectionConfig getConnectionConfig() {
boolean isValid = true;
String appdUsername = getPropertyOrEnv("com.signalfx.appd.username", "APPD_USERNAME");
if (StringUtils.isEmpty(appdUsername)) {
log.error("AppDynamics username not specified.");
isValid = false... | [
"public",
"static",
"ConnectionConfig",
"getConnectionConfig",
"(",
")",
"{",
"boolean",
"isValid",
"=",
"true",
";",
"String",
"appdUsername",
"=",
"getPropertyOrEnv",
"(",
"\"com.signalfx.appd.username\"",
",",
"\"APPD_USERNAME\"",
")",
";",
"if",
"(",
"StringUtils"... | Retrieve configurations by looking up in property param first then environment variable.
@return ConnectionConfig containing AppDynamics URL, Username,Password and SignalFx Token. | [
"Retrieve",
"configurations",
"by",
"looking",
"up",
"in",
"property",
"param",
"first",
"then",
"environment",
"variable",
"."
] | f87d4d75f28a0e8f4722f4b3087522cedf63cf22 | https://github.com/signalfx/appd-integration/blob/f87d4d75f28a0e8f4722f4b3087522cedf63cf22/appd-report-standalone/src/main/java/com/signalfx/appd/report/config/Config.java#L34-L61 | test | Gets the ConnectionConfig object. | Of course, here is the Java code you requested:
```java
public static ConnectionConfig getConnectionConfig() {
boolean isValid = true;
String appdUsername = getPropertyOrEnv("com.signalfx.appd.username", "APPD_USERNAME");
if (StringUtils.isEmpty(appdUsername)) {
log.error("AppDynami... |
rest-assured/rest-assured | modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/specification/MockMvcRequestSpecBuilder.java | MockMvcRequestSpecBuilder.setBody | public MockMvcRequestSpecBuilder setBody(Object object, ObjectMapper mapper) {
spec.body(object, mapper);
return this;
} | java | public MockMvcRequestSpecBuilder setBody(Object object, ObjectMapper mapper) {
spec.body(object, mapper);
return this;
} | [
"public",
"MockMvcRequestSpecBuilder",
"setBody",
"(",
"Object",
"object",
",",
"ObjectMapper",
"mapper",
")",
"{",
"spec",
".",
"body",
"(",
"object",
",",
"mapper",
")",
";",
"return",
"this",
";",
"}"
] | Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request using a specific object mapper.
This works for the POST, PATCH and PUT methods only. Trying to do this for the other http methods will cause an exception to be thrown.
<p>
Note that {@link #setBody(Object, O... | [
"Specify",
"an",
"Object",
"request",
"content",
"that",
"will",
"automatically",
"be",
"serialized",
"to",
"JSON",
"or",
"XML",
"and",
"sent",
"with",
"the",
"request",
"using",
"a",
"specific",
"object",
"mapper",
".",
"This",
"works",
"for",
"the",
"POST"... | 165a85b65070f5a07fe0045175613fb2c2811642 | https://github.com/rest-assured/rest-assured/blob/165a85b65070f5a07fe0045175613fb2c2811642/modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/specification/MockMvcRequestSpecBuilder.java#L145-L148 | test | Sets the body of the request. | Of course, here is the Java code you requested:
```java
public MockMvcRequestSpecBuilder setBody(Object object, ObjectMapper mapper) {
spec.body(object, mapper);
return this;
}
```
Hope this helps! |
RestComm/jain-slee | container/common/src/main/java/org/mobicents/slee/container/deployment/jboss/DeployableUnit.java | DeployableUnit.hasDuplicates | public boolean hasDuplicates() {
ArrayList<String> duplicates = new ArrayList<String>();
// For each component in the DU ..
for (String componentId : componentIDs) {
// Check if it is already deployed
if (sleeContainerDeployer.getDeploymentManager().getDeployedComponents().contains(compon... | java | public boolean hasDuplicates() {
ArrayList<String> duplicates = new ArrayList<String>();
// For each component in the DU ..
for (String componentId : componentIDs) {
// Check if it is already deployed
if (sleeContainerDeployer.getDeploymentManager().getDeployedComponents().contains(compon... | [
"public",
"boolean",
"hasDuplicates",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"duplicates",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"// For each component in the DU ..\r",
"for",
"(",
"String",
"componentId",
":",
"componentIDs",
")",... | Method for checking if this DU contains any component that is already deployed.
@return true if there's a component that is already deployed. | [
"Method",
"for",
"checking",
"if",
"this",
"DU",
"contains",
"any",
"component",
"that",
"is",
"already",
"deployed",
"."
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/common/src/main/java/org/mobicents/slee/container/deployment/jboss/DeployableUnit.java#L213-L236 | test | Checks if there are duplicate components in the DU. | Of course, here is the Java code you requested:
```java
public boolean hasDuplicates() {
ArrayList<String> duplicates = new ArrayList<String>();
// For each component in the DU ..
for (String componentId : componentIDs) {
// Check if it is already deployed
if (sleeContainerDeployer.getDe... |
Unidata/thredds | legacy/src/main/java/ucar/nc2/dt/grid/CFGridWriter.java | CFGridWriter.processTransformationVars | private long processTransformationVars(ArrayList<Variable> varList, ArrayList<String> varNameList, NetcdfDataset ncd, ucar.nc2.dt.GridDataset gds,
GridDatatype grid, Range timeRange, Range zRangeUse, LatLonRect llbb, int z_stride, int y_stride, int x_stride,
... | java | private long processTransformationVars(ArrayList<Variable> varList, ArrayList<String> varNameList, NetcdfDataset ncd, ucar.nc2.dt.GridDataset gds,
GridDatatype grid, Range timeRange, Range zRangeUse, LatLonRect llbb, int z_stride, int y_stride, int x_stride,
... | [
"private",
"long",
"processTransformationVars",
"(",
"ArrayList",
"<",
"Variable",
">",
"varList",
",",
"ArrayList",
"<",
"String",
">",
"varNameList",
",",
"NetcdfDataset",
"ncd",
",",
"ucar",
".",
"nc2",
".",
"dt",
".",
"GridDataset",
"gds",
",",
"GridDataty... | Process the coordinate transformations (formula_terms) and adds the variables needed for performing that transformation to the list of variables in the new file.
Also, subsets the grids variables, if needed.
@param varList
@param varNameList
@param ncd
@param gds
@param grid
@param timeRange
@param zRangeUse
@param ll... | [
"Process",
"the",
"coordinate",
"transformations",
"(",
"formula_terms",
")",
"and",
"adds",
"the",
"variables",
"needed",
"for",
"performing",
"that",
"transformation",
"to",
"the",
"list",
"of",
"variables",
"in",
"the",
"new",
"file",
".",
"Also",
"subsets",
... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/ucar/nc2/dt/grid/CFGridWriter.java#L633-L647 | test | This method is used to process a list of transformation variables. | Of course, here is the Java code you requested:
```java
private long processTransformationVars(ArrayList<Variable> varList, ArrayList<String> varNameList, NetcdfDataset ncd, ucar.nc2.dt.GridDataset gds,
GridDatatype grid, Range timeRange, Range zRangeUse, LatLonRect llbb, int z... |
Unidata/thredds | legacy/src/main/java/thredds/catalog/InvDatasetImpl.java | InvDatasetImpl.resolve | static public String resolve(InvDataset ds, String href) {
InvCatalog cat = ds.getParentCatalog();
if (cat != null) {
try {
java.net.URI uri = cat.resolveUri(href);
href = uri.toString();
} catch (java.net.URISyntaxException e) {
logger.warn("InvDatasetImpl.writeHtml: error p... | java | static public String resolve(InvDataset ds, String href) {
InvCatalog cat = ds.getParentCatalog();
if (cat != null) {
try {
java.net.URI uri = cat.resolveUri(href);
href = uri.toString();
} catch (java.net.URISyntaxException e) {
logger.warn("InvDatasetImpl.writeHtml: error p... | [
"static",
"public",
"String",
"resolve",
"(",
"InvDataset",
"ds",
",",
"String",
"href",
")",
"{",
"InvCatalog",
"cat",
"=",
"ds",
".",
"getParentCatalog",
"(",
")",
";",
"if",
"(",
"cat",
"!=",
"null",
")",
"{",
"try",
"{",
"java",
".",
"net",
".",
... | resolve reletive URLS against the catalog URL.
@param ds use ds parent catalog, if it exists
@param href URL to resolve
@return resolved URL | [
"resolve",
"reletive",
"URLS",
"against",
"the",
"catalog",
"URL",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/catalog/InvDatasetImpl.java#L1338-L1349 | test | Resolve the URL of a resource in an invdataset. | Of course, here is the Java code you requested:
```java
static public String resolve(InvDataset ds, String href) {
InvCatalog cat = ds.getParentCatalog();
if (cat != null) {
try {
java.net.URI uri = cat.resolveUri(href);
href = uri.toString();
} catch (java.net.URISyntaxException e)... |
blademainer/common_utils | common_helper/src/main/java/com/xiongyingqi/util/WeakReferenceMonitor.java | WeakReferenceMonitor.addEntry | private static void addEntry(Reference<?> ref, ReleaseListener entry) {
synchronized (WeakReferenceMonitor.class) {
// Add entry, the key is given reference.
trackedEntries.put(ref, entry);
// Start monitoring thread lazily.
if (monitoringThread == null) {
... | java | private static void addEntry(Reference<?> ref, ReleaseListener entry) {
synchronized (WeakReferenceMonitor.class) {
// Add entry, the key is given reference.
trackedEntries.put(ref, entry);
// Start monitoring thread lazily.
if (monitoringThread == null) {
... | [
"private",
"static",
"void",
"addEntry",
"(",
"Reference",
"<",
"?",
">",
"ref",
",",
"ReleaseListener",
"entry",
")",
"{",
"synchronized",
"(",
"WeakReferenceMonitor",
".",
"class",
")",
"{",
"// Add entry, the key is given reference.",
"trackedEntries",
".",
"put"... | Add entry to internal map of tracked entries.
Internal monitoring thread is started if not already running.
@param ref reference to tracked handle
@param entry the associated entry | [
"Add",
"entry",
"to",
"internal",
"map",
"of",
"tracked",
"entries",
".",
"Internal",
"monitoring",
"thread",
"is",
"started",
"if",
"not",
"already",
"running",
"."
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/common_helper/src/main/java/com/xiongyingqi/util/WeakReferenceMonitor.java#L87-L99 | test | Add a new entry to the cache. | Of course, here is the Java code you requested:
```java
private static void addEntry(Reference<?> ref, ReleaseListener entry) {
synchronized (WeakReferenceMonitor.class) {
// Add entry, the key is given reference.
trackedEntries.put(ref, entry);
// Start monitoring thread l... |
wildfly/wildfly | messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/WildFlyBindingRegistry.java | WildFlyBindingRegistry.lookup | @Override
public Object lookup(String name) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName());
if (bindingService == null) {
return null;
}
ManagedRe... | java | @Override
public Object lookup(String name) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName());
if (bindingService == null) {
return null;
}
ManagedRe... | [
"@",
"Override",
"public",
"Object",
"lookup",
"(",
"String",
"name",
")",
"{",
"final",
"ContextNames",
".",
"BindInfo",
"bindInfo",
"=",
"ContextNames",
".",
"bindInfoFor",
"(",
"name",
")",
";",
"ServiceController",
"<",
"?",
">",
"bindingService",
"=",
"... | SPI contract for this method | [
"SPI",
"contract",
"for",
"this",
"method"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/messaging-activemq/src/main/java/org/wildfly/extension/messaging/activemq/jms/WildFlyBindingRegistry.java#L58-L67 | test | Lookup a single context attribute. | Of course, here is the Java code you requested:
```java
@Override
public Object lookup(String name) {
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
ServiceController<?> bindingService = container.getService(bindInfo.getBinderServiceName());
if (bindingService == nul... |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/mcidas/McIDASGridReader.java | McIDASGridReader.readGrid | public float[] readGrid(McIDASGridRecord gr) throws IOException {
float[] data;
//try {
int te = (gr.getOffsetToHeader() + 64) * 4;
int rows = gr.getRows();
int cols = gr.getColumns();
rf.seek(te);
float scale = (float) gr.getParamScale();
data = new float[rows * cols];
... | java | public float[] readGrid(McIDASGridRecord gr) throws IOException {
float[] data;
//try {
int te = (gr.getOffsetToHeader() + 64) * 4;
int rows = gr.getRows();
int cols = gr.getColumns();
rf.seek(te);
float scale = (float) gr.getParamScale();
data = new float[rows * cols];
... | [
"public",
"float",
"[",
"]",
"readGrid",
"(",
"McIDASGridRecord",
"gr",
")",
"throws",
"IOException",
"{",
"float",
"[",
"]",
"data",
";",
"//try {",
"int",
"te",
"=",
"(",
"gr",
".",
"getOffsetToHeader",
"(",
")",
"+",
"64",
")",
"*",
"4",
";",
"int... | Read the grid
@param gr the grid record
@return the data | [
"Read",
"the",
"grid"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/mcidas/McIDASGridReader.java#L252-L281 | test | Read a grid of float values from the file. | Of course, here is the Java code you requested:
```java
public float[] readGrid(McIDASGridRecord gr) throws IOException {
float[] data;
//try {
int te = (gr.getOffsetToHeader() + 64) * 4;
int rows = gr.getRows();
int cols = gr.getColumns();
rf.seek(te);
float scale = (float) gr.... |
ReactiveX/RxJava | src/main/java/io/reactivex/Observable.java | Observable.buffer | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <TOpening, TClosing, U extends Collection<? super T>> Observable<U> buffer(
ObservableSource<? extends TOpening> openingIndicator,
Function<? super TOpening, ? extends ObservableSource<? extends TClosing>> closingInd... | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <TOpening, TClosing, U extends Collection<? super T>> Observable<U> buffer(
ObservableSource<? extends TOpening> openingIndicator,
Function<? super TOpening, ? extends ObservableSource<? extends TClosing>> closingInd... | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"TOpening",
",",
"TClosing",
",",
"U",
"extends",
"Collection",
"<",
"?",
"super",
"T",
">",
">",
"Observable",
"<",
"U",
">",
"buffer",
"(... | Returns an Observable that emits buffers of items it collects from the source ObservableSource. The resulting
ObservableSource emits buffers that it creates when the specified {@code openingIndicator} ObservableSource emits an
item, and closes when the ObservableSource returned from {@code closingIndicator} emits an it... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"buffers",
"of",
"items",
"it",
"collects",
"from",
"the",
"source",
"ObservableSource",
".",
"The",
"resulting",
"ObservableSource",
"emits",
"buffers",
"that",
"it",
"creates",
"when",
"the",
"specified",
"{",
"@... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Observable.java#L6014-L6024 | test | Creates an observable buffer that emits the items of the source observable. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final <TOpening, TClosing, U extends Collection<? super T>> Observable<U> buffer(
ObservableSource<? extends TOpening> openingIndicator,
Function<? super TOpening, ?... |
AndrewReitz/shillelagh | shillelagh/src/main/java/shillelagh/internal/ShillelaghUtil.java | ShillelaghUtil.createInstance | @SuppressWarnings("unchecked")
public static <T> T createInstance(Class<T> clazz) {
if (clazz.isInterface()) {
if (clazz == List.class) {
return (T) new ArrayList();
} else if (clazz == Map.class) {
return (T) new HashMap();
}
throw new UnsupportedOperationException("Inter... | java | @SuppressWarnings("unchecked")
public static <T> T createInstance(Class<T> clazz) {
if (clazz.isInterface()) {
if (clazz == List.class) {
return (T) new ArrayList();
} else if (clazz == Map.class) {
return (T) new HashMap();
}
throw new UnsupportedOperationException("Inter... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
".",
"isInterface",
"(",
")",
")",
"{",
"if",
"(",
"clazz",
"==",
"List"... | Takes a class type and constructs it. If the class does not have an empty constructor this
will
find the parametrized constructor and use nulls and default values to construct the class.
@param clazz The class to construct.
@param <T> The type of the class to construct.
@return The constructed object. | [
"Takes",
"a",
"class",
"type",
"and",
"constructs",
"it",
".",
"If",
"the",
"class",
"does",
"not",
"have",
"an",
"empty",
"constructor",
"this",
"will",
"find",
"the",
"parametrized",
"constructor",
"and",
"use",
"nulls",
"and",
"default",
"values",
"to",
... | d016971487bf8993686eb7d03146110f658e0f18 | https://github.com/AndrewReitz/shillelagh/blob/d016971487bf8993686eb7d03146110f658e0f18/shillelagh/src/main/java/shillelagh/internal/ShillelaghUtil.java#L86-L100 | test | Creates an instance of the specified class. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> T createInstance(Class<T> clazz) {
if (clazz.isInterface()) {
if (clazz == List.class) {
return (T) new ArrayList();
} else if (clazz == Map.class) {
return (T) new HashMap();
... |
streamsets/datacollector | cluster-common/src/main/java/com/streamsets/pipeline/cluster/ControlChannel.java | ControlChannel.consumerCommit | public void consumerCommit(String offset) {
Object offsetValue = offset;
if (offsetValue == null) {
offsetValue = new NullOffset();
}
LOG.trace("Commit Offset: '{}'", offsetValue);
try {
producerQueue.put(new Message(MessageType.CONSUMER_COMMIT, offsetValue));
} catch (InterruptedExc... | java | public void consumerCommit(String offset) {
Object offsetValue = offset;
if (offsetValue == null) {
offsetValue = new NullOffset();
}
LOG.trace("Commit Offset: '{}'", offsetValue);
try {
producerQueue.put(new Message(MessageType.CONSUMER_COMMIT, offsetValue));
} catch (InterruptedExc... | [
"public",
"void",
"consumerCommit",
"(",
"String",
"offset",
")",
"{",
"Object",
"offsetValue",
"=",
"offset",
";",
"if",
"(",
"offsetValue",
"==",
"null",
")",
"{",
"offsetValue",
"=",
"new",
"NullOffset",
"(",
")",
";",
"}",
"LOG",
".",
"trace",
"(",
... | If a null value is passed to this method, it's replaced with
a dummy due to the fact the payload for each message is wrapped
in an Optional. | [
"If",
"a",
"null",
"value",
"is",
"passed",
"to",
"this",
"method",
"it",
"s",
"replaced",
"with",
"a",
"dummy",
"due",
"to",
"the",
"fact",
"the",
"payload",
"for",
"each",
"message",
"is",
"wrapped",
"in",
"an",
"Optional",
"."
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/cluster-common/src/main/java/com/streamsets/pipeline/cluster/ControlChannel.java#L84-L96 | test | Commit a message to the consumer. | Of course, here is the Java code you requested:
```java
public void consumerCommit(String offset) {
Object offsetValue = offset;
if (offsetValue == null) {
offsetValue = new NullOffset();
}
LOG.trace("Commit Offset: '{}'", offsetValue);
try {
producerQueue.put(new Message(MessageType.CO... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/features/user/FeatureRow.java | FeatureRow.setValue | @Override
public void setValue(int index, Object value) {
if (index == getGeometryColumnIndex() && value instanceof byte[]) {
byte[] bytes = (byte[]) value;
value = new GeoPackageGeometryData(bytes);
}
super.setValue(index, value);
}
/**
* Get the geomet... | java | @Override
public void setValue(int index, Object value) {
if (index == getGeometryColumnIndex() && value instanceof byte[]) {
byte[] bytes = (byte[]) value;
value = new GeoPackageGeometryData(bytes);
}
super.setValue(index, value);
}
/**
* Get the geomet... | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"index",
"==",
"getGeometryColumnIndex",
"(",
")",
"&&",
"value",
"instanceof",
"byte",
"[",
"]",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",... | {@inheritDoc}
Handles geometry columns | [
"{"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/features/user/FeatureRow.java#L74-L188 | test | Set the value of the Geometry in the Geometry column | Of course, here is the Java code you requested:
```java
@Override
public void setValue(int index, Object value) {
if (index == getGeometryColumnIndex() && value instanceof byte[]) {
byte[] bytes = (byte[]) value;
value = new GeoPackageGeometryData(bytes);
}
super.set... |
rupertlssmith/lojix | lojix/prolog/src/main/com/thesett/aima/logic/fol/prolog/PrologResolver.java | PrologResolver.reset | public void reset()
{
// Empty the knowledge base and clear the current query.
domain = new HashMap<Integer, List<PrologCompiledClause>>();
currentQuery = null;
// Reset the underlying search.
resolutionSearch.reset();
// If printing execution traces, ensure the exe... | java | public void reset()
{
// Empty the knowledge base and clear the current query.
domain = new HashMap<Integer, List<PrologCompiledClause>>();
currentQuery = null;
// Reset the underlying search.
resolutionSearch.reset();
// If printing execution traces, ensure the exe... | [
"public",
"void",
"reset",
"(",
")",
"{",
"// Empty the knowledge base and clear the current query.",
"domain",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"PrologCompiledClause",
">",
">",
"(",
")",
";",
"currentQuery",
"=",
"null",
";",
"// Reset th... | {@inheritDoc}
<p/>This also resets the entire knowledge base of this resolver, so that it is empty. | [
"{",
"@inheritDoc",
"}"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/prolog/src/main/com/thesett/aima/logic/fol/prolog/PrologResolver.java#L245-L259 | test | Reset the knowledge base and current query. | Of course, here is the Java code you requested:
```java
public void reset()
{
// Empty the knowledge base and clear the current query.
domain = new HashMap<Integer, List<PrologCompiledClause>>();
currentQuery = null;
// Reset the underlying search.
resolutionSearch.reset();... |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/OutputStreamAppender.java | OutputStreamAppender.subAppend | protected void subAppend(E event) {
if (!isStarted()) {
return;
}
try {
// this step avoids LBCLASSIC-139
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
}
// the synchronization prevents the OutputStream... | java | protected void subAppend(E event) {
if (!isStarted()) {
return;
}
try {
// this step avoids LBCLASSIC-139
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
}
// the synchronization prevents the OutputStream... | [
"protected",
"void",
"subAppend",
"(",
"E",
"event",
")",
"{",
"if",
"(",
"!",
"isStarted",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"// this step avoids LBCLASSIC-139",
"if",
"(",
"event",
"instanceof",
"DeferredProcessingAware",
")",
"{",
"(",
... | Actual writing occurs here.
<p>
Most subclasses of <code>WriterAppender</code> will need to override this
method.
@param event the log event
@since 0.9.0 | [
"Actual",
"writing",
"occurs",
"here",
".",
"<p",
">",
"Most",
"subclasses",
"of",
"<code",
">",
"WriterAppender<",
"/",
"code",
">",
"will",
"need",
"to",
"override",
"this",
"method",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/OutputStreamAppender.java#L229-L251 | test | Subappend the event to the output stream. | Of course, here is the Java code you requested:
```java
protected void subAppend(E event) {
if (!isStarted()) {
return;
}
try {
// this step avoids LBCLASSIC-139
if (event instanceof DeferredProcessingAware) {
((DeferredProcessingAware) event).prepareForDeferredProcessing();
... |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/Comparators.java | Comparators.compose | public static <T> Comparator<T> compose(Iterable<? extends Comparator<? super T>> comparators)
{
return new CompositeComparator<T>(comparators);
} | java | public static <T> Comparator<T> compose(Iterable<? extends Comparator<? super T>> comparators)
{
return new CompositeComparator<T>(comparators);
} | [
"public",
"static",
"<",
"T",
">",
"Comparator",
"<",
"T",
">",
"compose",
"(",
"Iterable",
"<",
"?",
"extends",
"Comparator",
"<",
"?",
"super",
"T",
">",
">",
"comparators",
")",
"{",
"return",
"new",
"CompositeComparator",
"<",
"T",
">",
"(",
"compa... | Returns a {@code Comparator} that will call each {@code Comparator}
in the given {@code Iterable} until one of them returns a non-zero
result (will return {@code 0} if they all return {@code 0}).
@param <T> the parameters type of the returned {@code Comparator}.
@param comparators the {@code Comparator}s to compose.
... | [
"Returns",
"a",
"{",
"@code",
"Comparator",
"}",
"that",
"will",
"call",
"each",
"{",
"@code",
"Comparator",
"}",
"in",
"the",
"given",
"{",
"@code",
"Iterable",
"}",
"until",
"one",
"of",
"them",
"returns",
"a",
"non",
"-",
"zero",
"result",
"(",
"wil... | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/Comparators.java#L64-L67 | test | Compose the given Comparators into a composite comparator. | Of course, here is the Java code you requested:
```java
public static <T> Comparator<T> compose(Iterable<? extends Comparator<? super T>> comparators)
{
return new CompositeComparator<T>(comparators);
}
```
Hope this helps! |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/classic/android/SQLiteAppender.java | SQLiteAppender.subAppend | private long subAppend(ILoggingEvent event, SQLiteStatement insertStatement) throws SQLException {
bindLoggingEvent(insertStatement, event);
bindLoggingEventArguments(insertStatement, event.getArgumentArray());
// This is expensive... should we do it every time?
bindCallerData(insertStatement, event.g... | java | private long subAppend(ILoggingEvent event, SQLiteStatement insertStatement) throws SQLException {
bindLoggingEvent(insertStatement, event);
bindLoggingEventArguments(insertStatement, event.getArgumentArray());
// This is expensive... should we do it every time?
bindCallerData(insertStatement, event.g... | [
"private",
"long",
"subAppend",
"(",
"ILoggingEvent",
"event",
",",
"SQLiteStatement",
"insertStatement",
")",
"throws",
"SQLException",
"{",
"bindLoggingEvent",
"(",
"insertStatement",
",",
"event",
")",
";",
"bindLoggingEventArguments",
"(",
"insertStatement",
",",
... | Inserts the main details of a log event into the database
@param event the event to insert
@param insertStatement the SQLite statement used to insert the event
@return the row ID of the newly inserted event; -1 if the insertion failed
@throws SQLException | [
"Inserts",
"the",
"main",
"details",
"of",
"a",
"log",
"event",
"into",
"the",
"database"
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/classic/android/SQLiteAppender.java#L289-L304 | test | Sub append to the log. | Of course, here is the Java code you requested:
```java
private long subAppend(ILoggingEvent event, SQLiteStatement insertStatement) throws SQLException {
bindLoggingEvent(insertStatement, event);
bindLoggingEventArguments(insertStatement, event.getArgumentArray());
// This is expensive... should we do i... |
cologneintelligence/FitGoodies | fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/file/FixedLengthFileRecordFixture.java | FixedLengthFileRecordFixture.extractWidth | public final int[] extractWidth(FitRow row) {
int[] width = new int[row.size()];
int i = 0;
for (FitCell cell : row.cells()) {
try {
String value = validator.preProcess(cell.getFitValue());
TypeHandler handler = typeHandlerFactory.getHandler(Integer.class, null);
... | java | public final int[] extractWidth(FitRow row) {
int[] width = new int[row.size()];
int i = 0;
for (FitCell cell : row.cells()) {
try {
String value = validator.preProcess(cell.getFitValue());
TypeHandler handler = typeHandlerFactory.getHandler(Integer.class, null);
... | [
"public",
"final",
"int",
"[",
"]",
"extractWidth",
"(",
"FitRow",
"row",
")",
"{",
"int",
"[",
"]",
"width",
"=",
"new",
"int",
"[",
"row",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"FitCell",
"cell",
":",
"row",
... | Parses the first table row and generates an {@code int} array
which contains the length of each record field.
@param row row to process
@return length of each field | [
"Parses",
"the",
"first",
"table",
"row",
"and",
"generates",
"an",
"{",
"@code",
"int",
"}",
"array",
"which",
"contains",
"the",
"length",
"of",
"each",
"record",
"field",
"."
] | 834e42d1f41b4b9226060b1e83a80cc69ea88c7b | https://github.com/cologneintelligence/FitGoodies/blob/834e42d1f41b4b9226060b1e83a80cc69ea88c7b/fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/file/FixedLengthFileRecordFixture.java#L80-L95 | test | Extract width from a fit row. | Of course, here is the Java code you requested:
```java
public final int[] extractWidth(FitRow row) {
int[] width = new int[row.size()];
int i = 0;
for (FitCell cell : row.cells()) {
try {
String value = validator.preProcess(cell.getFitValue());
TypeHandler handler... |
OpenEstate/OpenEstate-IO | Trovit/src/main/java/org/openestate/io/trovit/TrovitUtils.java | TrovitUtils.printYearValue | public static String printYearValue(BigInteger value) {
if (value == null)
throw new IllegalArgumentException("Can't print empty year value!");
if (value.compareTo(BigInteger.valueOf(1700L)) < 0)
throw new IllegalArgumentException("Can't print year value '" + value + "' because i... | java | public static String printYearValue(BigInteger value) {
if (value == null)
throw new IllegalArgumentException("Can't print empty year value!");
if (value.compareTo(BigInteger.valueOf(1700L)) < 0)
throw new IllegalArgumentException("Can't print year value '" + value + "' because i... | [
"public",
"static",
"String",
"printYearValue",
"(",
"BigInteger",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can't print empty year value!\"",
")",
";",
"if",
"(",
"value",
".",
"compareTo",
"("... | Write a {@link BigInteger} value into XML output for a year number.
@param value value to write
@return XML string
@throws IllegalArgumentException if a validation error occurred | [
"Write",
"a",
"{",
"@link",
"BigInteger",
"}",
"value",
"into",
"XML",
"output",
"for",
"a",
"year",
"number",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Trovit/src/main/java/org/openestate/io/trovit/TrovitUtils.java#L827-L836 | test | Print the year value. | Of course, here is the Java code you requested:
```java
public static String printYearValue(BigInteger value) {
if (value == null)
throw new IllegalArgumentException("Can't print empty year value!");
if (value.compareTo(BigInteger.valueOf(1700L)) < 0)
throw new IllegalArgumentEx... |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/ParserController.java | ParserController.resolveFileName | private String resolveFileName(String inFileName) {
String fileName = inFileName.replace('\\', '/');
boolean isAbsolute = fileName.startsWith("/");
fileName = isAbsolute ? fileName : baseDirStack.peek() + fileName;
String baseDir = fileName.substring(0, fileName.lastIndexOf("/") + 1);
baseDirS... | java | private String resolveFileName(String inFileName) {
String fileName = inFileName.replace('\\', '/');
boolean isAbsolute = fileName.startsWith("/");
fileName = isAbsolute ? fileName : baseDirStack.peek() + fileName;
String baseDir = fileName.substring(0, fileName.lastIndexOf("/") + 1);
baseDirS... | [
"private",
"String",
"resolveFileName",
"(",
"String",
"inFileName",
")",
"{",
"String",
"fileName",
"=",
"inFileName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"boolean",
"isAbsolute",
"=",
"fileName",
".",
"startsWith",
"(",
"\"/\"",
")",
... | /*
Resolve the name of the file and update baseDirStack() to keep track of
the current base directory for each included file.
The 'root' file is always an 'absolute' path, so no need to put an
initial value in the baseDirStack. | [
"/",
"*",
"Resolve",
"the",
"name",
"of",
"the",
"file",
"and",
"update",
"baseDirStack",
"()",
"to",
"keep",
"track",
"of",
"the",
"current",
"base",
"directory",
"for",
"each",
"included",
"file",
".",
"The",
"root",
"file",
"is",
"always",
"an",
"abso... | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/ParserController.java#L576-L583 | test | Resolve the file name. | Of course, here is the Java code you requested:
```java
private String resolveFileName(String inFileName) {
String fileName = inFileName.replace('\\', '/');
boolean isAbsolute = fileName.startsWith("/");
fileName = isAbsolute ? fileName : baseDirStack.peek() + fileName;
String baseDir = fileNa... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/util/CompareNetcdf2.java | CompareNetcdf2.checkAll | private boolean checkAll(String what, List list1, List list2, List result) {
boolean ok = true;
for (Object aList1 : list1) {
ok &= checkEach(what, aList1, "file1", list1, "file2", list2, result);
}
for (Object aList2 : list2) {
ok &= checkEach(what, aList2, "file2", list2, "file1"... | java | private boolean checkAll(String what, List list1, List list2, List result) {
boolean ok = true;
for (Object aList1 : list1) {
ok &= checkEach(what, aList1, "file1", list1, "file2", list2, result);
}
for (Object aList2 : list2) {
ok &= checkEach(what, aList2, "file2", list2, "file1"... | [
"private",
"boolean",
"checkAll",
"(",
"String",
"what",
",",
"List",
"list1",
",",
"List",
"list2",
",",
"List",
"result",
")",
"{",
"boolean",
"ok",
"=",
"true",
";",
"for",
"(",
"Object",
"aList1",
":",
"list1",
")",
"{",
"ok",
"&=",
"checkEach",
... | return an arrayList of paired objects. | [
"return",
"an",
"arrayList",
"of",
"paired",
"objects",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/util/CompareNetcdf2.java#L428-L440 | test | Checks all the
elements in the two lists. | Of course, here is the Java code you requested:
```java
private boolean checkAll(String what, List list1, List list2, List result) {
boolean ok = true;
for (Object aList1 : list1) {
ok &= checkEach(what, aList1, "file1", list1, "file2", list2, result);
}
for (Object aList2 : list2) {
... |
boonproject/boon | boon/src/main/java/org/boon/Str.java | Str.atIndex | @Universal
public static String atIndex( String str, int index, char c ) {
return idx (str, index, c);
} | java | @Universal
public static String atIndex( String str, int index, char c ) {
return idx (str, index, c);
} | [
"@",
"Universal",
"public",
"static",
"String",
"atIndex",
"(",
"String",
"str",
",",
"int",
"index",
",",
"char",
"c",
")",
"{",
"return",
"idx",
"(",
"str",
",",
"index",
",",
"c",
")",
";",
"}"
] | Puts character at index
@param str string
@param index index
@param c char to put in
@return new string | [
"Puts",
"character",
"at",
"index"
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/Str.java#L120-L123 | test | At index. | Of course, here is the Java code you requested:
```java
@Universal
public static String atIndex( String str, int index, char c ) {
return idx (str, index, c);
}
```
Hope this helps! |
oblac/jodd | jodd-json/src/main/java/jodd/json/JsonObject.java | JsonObject.getLong | public Long getLong(final String key, final Long def) {
Long val = getLong(key);
if (val == null) {
if (map.containsKey(key)) {
return null;
}
return def;
}
return val;
} | java | public Long getLong(final String key, final Long def) {
Long val = getLong(key);
if (val == null) {
if (map.containsKey(key)) {
return null;
}
return def;
}
return val;
} | [
"public",
"Long",
"getLong",
"(",
"final",
"String",
"key",
",",
"final",
"Long",
"def",
")",
"{",
"Long",
"val",
"=",
"getLong",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")... | Like {@link #getLong(String)} but specifies a default value to return if there is no entry. | [
"Like",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-json/src/main/java/jodd/json/JsonObject.java#L226-L237 | test | Gets the Long value associated with a key. | Of course, here is the Java code you requested:
```java
public Long getLong(final String key, final Long def) {
Long val = getLong(key);
if (val == null) {
if (map.containsKey(key)) {
return null;
}
return def;
}
return val;
}
```
Hope this helps! |
spring-projects/spring-security | config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java | SessionManagementConfigurer.invalidSessionStrategy | public SessionManagementConfigurer<H> invalidSessionStrategy(
InvalidSessionStrategy invalidSessionStrategy) {
Assert.notNull(invalidSessionStrategy, "invalidSessionStrategy");
this.invalidSessionStrategy = invalidSessionStrategy;
return this;
} | java | public SessionManagementConfigurer<H> invalidSessionStrategy(
InvalidSessionStrategy invalidSessionStrategy) {
Assert.notNull(invalidSessionStrategy, "invalidSessionStrategy");
this.invalidSessionStrategy = invalidSessionStrategy;
return this;
} | [
"public",
"SessionManagementConfigurer",
"<",
"H",
">",
"invalidSessionStrategy",
"(",
"InvalidSessionStrategy",
"invalidSessionStrategy",
")",
"{",
"Assert",
".",
"notNull",
"(",
"invalidSessionStrategy",
",",
"\"invalidSessionStrategy\"",
")",
";",
"this",
".",
"invalid... | Setting this attribute will inject the provided invalidSessionStrategy into the
{@link SessionManagementFilter}. When an invalid session ID is submitted, the
strategy will be invoked, redirecting to the configured URL.
@param invalidSessionStrategy the strategy to use when an invalid session ID is
submitted.
@return th... | [
"Setting",
"this",
"attribute",
"will",
"inject",
"the",
"provided",
"invalidSessionStrategy",
"into",
"the",
"{"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java#L142-L147 | test | Sets the invalid session strategy. | Of course, here is the Java code you requested:
```java
public SessionManagementConfigurer<H> invalidSessionStrategy(
InvalidSessionStrategy invalidSessionStrategy) {
Assert.notNull(invalidSessionStrategy, "invalidSessionStrategy");
this.invalidSessionStrategy = invalidSessionStrategy;
return this;
}
```
Ho... |
Unidata/thredds | tds/src/main/java/thredds/server/cdmrfeature/CdmrGridController.java | CdmrGridController.handleFeatureTypeRequest | @RequestMapping(value = "/**", method = RequestMethod.GET, params = "req=featureType")
public ResponseEntity<String> handleFeatureTypeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!allowedServices.isAllowed(StandardService.cdmrFeatureGrid))
throw new ServiceNotA... | java | @RequestMapping(value = "/**", method = RequestMethod.GET, params = "req=featureType")
public ResponseEntity<String> handleFeatureTypeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!allowedServices.isAllowed(StandardService.cdmrFeatureGrid))
throw new ServiceNotA... | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/**\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
",",
"params",
"=",
"\"req=featureType\"",
")",
"public",
"ResponseEntity",
"<",
"String",
">",
"handleFeatureTypeRequest",
"(",
"HttpServletRequest",
"request",
... | ////////////////////////////////////////////////////////////////// | [
"//////////////////////////////////////////////////////////////////"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/server/cdmrfeature/CdmrGridController.java#L72-L88 | test | Handle the feature type request | Of course, here is the Java code you requested:
```java
@RequestMapping(value = "/**", method = RequestMethod.GET, params = "req=featureType")
public ResponseEntity<String> handleFeatureTypeRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
if (!allowedServices.isAllowed(Stan... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/gis/shapefile/EsriShapefileRenderer.java | EsriShapefileRenderer.factory | static public EsriShapefileRenderer factory(String filename) {
if (sfileHash == null)
sfileHash = new HashMap<String, EsriShapefileRenderer>();
if (sfileHash.containsKey(filename))
return sfileHash.get(filename);
try {
EsriShapefileRenderer sfile = new EsriShapefileRenderer(filen... | java | static public EsriShapefileRenderer factory(String filename) {
if (sfileHash == null)
sfileHash = new HashMap<String, EsriShapefileRenderer>();
if (sfileHash.containsKey(filename))
return sfileHash.get(filename);
try {
EsriShapefileRenderer sfile = new EsriShapefileRenderer(filen... | [
"static",
"public",
"EsriShapefileRenderer",
"factory",
"(",
"String",
"filename",
")",
"{",
"if",
"(",
"sfileHash",
"==",
"null",
")",
"sfileHash",
"=",
"new",
"HashMap",
"<",
"String",
",",
"EsriShapefileRenderer",
">",
"(",
")",
";",
"if",
"(",
"sfileHash... | Use factory to obtain a EsriShapefileRenderer. This caches the EsriShapefile for reuse.
<p/>
Implementation note: should switch to weak references. | [
"Use",
"factory",
"to",
"obtain",
"a",
"EsriShapefileRenderer",
".",
"This",
"caches",
"the",
"EsriShapefile",
"for",
"reuse",
".",
"<p",
"/",
">",
"Implementation",
"note",
":",
"should",
"switch",
"to",
"weak",
"references",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/gis/shapefile/EsriShapefileRenderer.java#L33-L49 | test | Creates a new instance of the
class. | Of course, here is the Java code you requested:
```java
static public EsriShapefileRenderer factory(String filename) {
if (sfileHash == null)
sfileHash = new HashMap<String, EsriShapefileRenderer>();
if (sfileHash.containsKey(filename))
return sfileHash.get(filename);
try {
Esri... |
oblac/jodd | jodd-petite/src/main/java/jodd/petite/PetiteBeans.java | PetiteBeans.registerPetiteProvider | public void registerPetiteProvider(final String providerName, final Class type, final String staticMethodName, final Class[] arguments) {
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
MethodDescriptor md = cd.getMethodDescriptor(staticMethodName, arguments, true);
if (md == null) {
throw new Peti... | java | public void registerPetiteProvider(final String providerName, final Class type, final String staticMethodName, final Class[] arguments) {
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
MethodDescriptor md = cd.getMethodDescriptor(staticMethodName, arguments, true);
if (md == null) {
throw new Peti... | [
"public",
"void",
"registerPetiteProvider",
"(",
"final",
"String",
"providerName",
",",
"final",
"Class",
"type",
",",
"final",
"String",
"staticMethodName",
",",
"final",
"Class",
"[",
"]",
"arguments",
")",
"{",
"ClassDescriptor",
"cd",
"=",
"ClassIntrospector"... | Registers static method provider.
@param providerName provider name
@param type class type
@param staticMethodName static method name
@param arguments method argument types | [
"Registers",
"static",
"method",
"provider",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-petite/src/main/java/jodd/petite/PetiteBeans.java#L738-L749 | test | Registers a provider with the Petite service. | Of course, here is the Java code you requested:
```java
public void registerPetiteProvider(final String providerName, final Class type, final String staticMethodName, final Class[] arguments) {
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
MethodDescriptor md = cd.getMethodDescriptor(staticMethodName,... |
Unidata/thredds | grib/src/main/java/ucar/nc2/grib/collection/Grib1CollectionBuilderFromIndex.java | Grib1CollectionBuilderFromIndex.readFromIndex | @Nullable
static Grib1Collection readFromIndex(String name, RandomAccessFile raf,
FeatureCollectionConfig config, org.slf4j.Logger logger) {
Grib1CollectionBuilderFromIndex builder = new Grib1CollectionBuilderFromIndex(name, config, logger);
if (!builder.readIndex(raf))
return null;
if (buil... | java | @Nullable
static Grib1Collection readFromIndex(String name, RandomAccessFile raf,
FeatureCollectionConfig config, org.slf4j.Logger logger) {
Grib1CollectionBuilderFromIndex builder = new Grib1CollectionBuilderFromIndex(name, config, logger);
if (!builder.readIndex(raf))
return null;
if (buil... | [
"@",
"Nullable",
"static",
"Grib1Collection",
"readFromIndex",
"(",
"String",
"name",
",",
"RandomAccessFile",
"raf",
",",
"FeatureCollectionConfig",
"config",
",",
"org",
".",
"slf4j",
".",
"Logger",
"logger",
")",
"{",
"Grib1CollectionBuilderFromIndex",
"builder",
... | read in the index, index raf already open; return null on failure | [
"read",
"in",
"the",
"index",
"index",
"raf",
"already",
"open",
";",
"return",
"null",
"on",
"failure"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/grib/src/main/java/ucar/nc2/grib/collection/Grib1CollectionBuilderFromIndex.java#L29-L43 | test | Read a Grib1Collection from the index. | Of course, here is the Java code you requested:
```java
@Nullable
static Grib1Collection readFromIndex(String name, RandomAccessFile raf,
FeatureCollectionConfig config, org.slf4j.Logger logger) {
Grib1CollectionBuilderFromIndex builder = new Grib1CollectionBuilderFromIndex(name, config, logger);
if (... |
Unidata/thredds | cdm/src/main/java/ucar/unidata/util/StringUtil2.java | StringUtil2.unreplace | static public void unreplace(StringBuilder sb, String out, char in) {
int pos;
while (0 <= (pos = sb.indexOf(out))) {
sb.setCharAt(pos, in);
sb.delete(pos + 1, pos + out.length());
}
} | java | static public void unreplace(StringBuilder sb, String out, char in) {
int pos;
while (0 <= (pos = sb.indexOf(out))) {
sb.setCharAt(pos, in);
sb.delete(pos + 1, pos + out.length());
}
} | [
"static",
"public",
"void",
"unreplace",
"(",
"StringBuilder",
"sb",
",",
"String",
"out",
",",
"char",
"in",
")",
"{",
"int",
"pos",
";",
"while",
"(",
"0",
"<=",
"(",
"pos",
"=",
"sb",
".",
"indexOf",
"(",
"out",
")",
")",
")",
"{",
"sb",
".",
... | Replace any String "out" in sb with char "in".
@param sb StringBuilder to replace
@param out repalce this String
@param in with this char | [
"Replace",
"any",
"String",
"out",
"in",
"sb",
"with",
"char",
"in",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/util/StringUtil2.java#L708-L714 | test | Unreplace the chars in out with in. | Of course, here is the Java code you requested:
```java
static public void unreplace(StringBuilder sb, String out, char in) {
int pos;
while (0 <= (pos = sb.indexOf(out))) {
sb.setCharAt(pos, in);
sb.delete(pos + 1, pos + out.length());
}
}
```
Hope this helps! |
rupertlssmith/lojix | lojix/logic/src/main/com/thesett/aima/logic/fol/TermUtils.java | TermUtils.convertToClause | public static Clause convertToClause(Term term, VariableAndFunctorInterner interner) throws SourceCodeException
{
// Check if the top level term is a query, an implication or neither and reduce the term into a clause
// accordingly.
if (term instanceof OpSymbol)
{
OpSymbo... | java | public static Clause convertToClause(Term term, VariableAndFunctorInterner interner) throws SourceCodeException
{
// Check if the top level term is a query, an implication or neither and reduce the term into a clause
// accordingly.
if (term instanceof OpSymbol)
{
OpSymbo... | [
"public",
"static",
"Clause",
"convertToClause",
"(",
"Term",
"term",
",",
"VariableAndFunctorInterner",
"interner",
")",
"throws",
"SourceCodeException",
"{",
"// Check if the top level term is a query, an implication or neither and reduce the term into a clause",
"// accordingly.",
... | Converts a term into a clause. The term must be a functor. If it is a functor corresponding to the ':-' symbol it
is a clause with a head and a body. If it is a functor corresponding to the '?-' symbol it is a query clause with
no head but must have a body. If it is neither but is a functor it is interpreted as a progr... | [
"Converts",
"a",
"term",
"into",
"a",
"clause",
".",
"The",
"term",
"must",
"be",
"a",
"functor",
".",
"If",
"it",
"is",
"a",
"functor",
"corresponding",
"to",
"the",
":",
"-",
"symbol",
"it",
"is",
"a",
"clause",
"with",
"a",
"head",
"and",
"a",
"... | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/logic/src/main/com/thesett/aima/logic/fol/TermUtils.java#L227-L259 | test | Convert a term to a clause. | Of course, here is the Java code you requested:
```java
public static Clause convertToClause(Term term, VariableAndFunctorInterner interner) throws SourceCodeException
{
// Check if the top level term is a query, an implication or neither and reduce the term into a clause
// accordingly.
if... |
RestComm/jain-slee | api/jar/src/main/java/javax/slee/facilities/AlarmLevel.java | AlarmLevel.fromString | public static AlarmLevel fromString(String level) throws NullPointerException, IllegalArgumentException {
if (level == null) throw new NullPointerException("level is null");
if (level.equalsIgnoreCase(CLEAR_STRING)) return CLEAR;
if (level.equalsIgnoreCase(CRITICAL_STRING)) return CRITICAL;
... | java | public static AlarmLevel fromString(String level) throws NullPointerException, IllegalArgumentException {
if (level == null) throw new NullPointerException("level is null");
if (level.equalsIgnoreCase(CLEAR_STRING)) return CLEAR;
if (level.equalsIgnoreCase(CRITICAL_STRING)) return CRITICAL;
... | [
"public",
"static",
"AlarmLevel",
"fromString",
"(",
"String",
"level",
")",
"throws",
"NullPointerException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"level",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"level is null\"",
")",
";",
... | Get an <code>AlarmLevel</code> object from a string value.
@param level the level as a string, for example as returned by the {@link #toString()}
method (case insensitive).
@return an <code>AlarmLevel</code> object corresponding to <code>level</code>.
@throws NullPointerException if <code>level</code> is <code>null</co... | [
"Get",
"an",
"<code",
">",
"AlarmLevel<",
"/",
"code",
">",
"object",
"from",
"a",
"string",
"value",
"."
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/api/jar/src/main/java/javax/slee/facilities/AlarmLevel.java#L163-L172 | test | Converts a string representation of the AlarmLevel to a AlarmLevel object. | Of course, here is the Java code you requested:
```java
public static AlarmLevel fromString(String level) throws NullPointerException, IllegalArgumentException {
if (level == null) throw new NullPointerException("level is null");
if (level.equalsIgnoreCase(CLEAR_STRING)) return CLEAR;
if (level... |
spring-projects/spring-security | core/src/main/java/org/springframework/security/access/method/MapBasedMethodSecurityMetadataSource.java | MapBasedMethodSecurityMetadataSource.isMatch | private boolean isMatch(String methodName, String mappedName) {
return (mappedName.endsWith("*") && methodName.startsWith(mappedName.substring(0,
mappedName.length() - 1)))
|| (mappedName.startsWith("*") && methodName.endsWith(mappedName
.substring(1, mappedName.length())));
} | java | private boolean isMatch(String methodName, String mappedName) {
return (mappedName.endsWith("*") && methodName.startsWith(mappedName.substring(0,
mappedName.length() - 1)))
|| (mappedName.startsWith("*") && methodName.endsWith(mappedName
.substring(1, mappedName.length())));
} | [
"private",
"boolean",
"isMatch",
"(",
"String",
"methodName",
",",
"String",
"mappedName",
")",
"{",
"return",
"(",
"mappedName",
".",
"endsWith",
"(",
"\"*\"",
")",
"&&",
"methodName",
".",
"startsWith",
"(",
"mappedName",
".",
"substring",
"(",
"0",
",",
... | Return if the given method name matches the mapped name. The default implementation
checks for "xxx" and "xxx" matches.
@param methodName the method name of the class
@param mappedName the name in the descriptor
@return if the names match | [
"Return",
"if",
"the",
"given",
"method",
"name",
"matches",
"the",
"mapped",
"name",
".",
"The",
"default",
"implementation",
"checks",
"for",
"xxx",
"and",
"xxx",
"matches",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/core/src/main/java/org/springframework/security/access/method/MapBasedMethodSecurityMetadataSource.java#L257-L262 | test | isMatch returns true if the mapped name is a match of the method name. | Of course, here is the Java code you requested:
```java
private boolean isMatch(String methodName, String mappedName) {
return (mappedName.endsWith("*") && methodName.startsWith(mappedName.substring(0,
mappedName.length() - 1)))
|| (mappedName.startsWith("*") && methodName.endsWith(mappedName
.substrin... |
hibegin/simplewebserver | src/main/java/com/hibegin/http/server/handler/SSLReadWriteSelectorHandler.java | SSLReadWriteSelectorHandler.shutdown | boolean shutdown() throws IOException {
if (!shutdown) {
sslEngine.closeOutbound();
shutdown = true;
}
if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
return false;
}
/*
* By RFC 2616, we can "fire and forget" our close_notify
* message... | java | boolean shutdown() throws IOException {
if (!shutdown) {
sslEngine.closeOutbound();
shutdown = true;
}
if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
return false;
}
/*
* By RFC 2616, we can "fire and forget" our close_notify
* message... | [
"boolean",
"shutdown",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"shutdown",
")",
"{",
"sslEngine",
".",
"closeOutbound",
"(",
")",
";",
"shutdown",
"=",
"true",
";",
"}",
"if",
"(",
"outNetBB",
".",
"hasRemaining",
"(",
")",
"&&",
"tryFl... | /*
Begin the shutdown process.
<P>
Close out the SSLEngine if not already done so, then
wrap our outgoing close_notify message and try to send it on.
<P>
Return true when we're done passing the shutdown messsages. | [
"/",
"*",
"Begin",
"the",
"shutdown",
"process",
".",
"<P",
">",
"Close",
"out",
"the",
"SSLEngine",
"if",
"not",
"already",
"done",
"so",
"then",
"wrap",
"our",
"outgoing",
"close_notify",
"message",
"and",
"try",
"to",
"send",
"it",
"on",
".",
"<P",
... | 262df49e1cd75df8d8c6469ac55204208ff8eeec | https://github.com/hibegin/simplewebserver/blob/262df49e1cd75df8d8c6469ac55204208ff8eeec/src/main/java/com/hibegin/http/server/handler/SSLReadWriteSelectorHandler.java#L498-L530 | test | Close the SSLEngine and flush the output buffer. | Of course, here is the Java code you requested:
```java
boolean shutdown() throws IOException {
if (!shutdown) {
sslEngine.closeOutbound();
shutdown = true;
}
if (outNetBB.hasRemaining() && tryFlush(outNetBB)) {
return false;
}
/*
* By RFC 26... |
jboss/jboss-common-core | src/main/java/org/jboss/util/graph/Vertex.java | Vertex.addOutgoingEdge | public void addOutgoingEdge(Vertex<T> to, int cost)
{
Edge<T> out = new Edge<T>(this, to, cost);
outgoingEdges.add(out);
} | java | public void addOutgoingEdge(Vertex<T> to, int cost)
{
Edge<T> out = new Edge<T>(this, to, cost);
outgoingEdges.add(out);
} | [
"public",
"void",
"addOutgoingEdge",
"(",
"Vertex",
"<",
"T",
">",
"to",
",",
"int",
"cost",
")",
"{",
"Edge",
"<",
"T",
">",
"out",
"=",
"new",
"Edge",
"<",
"T",
">",
"(",
"this",
",",
"to",
",",
"cost",
")",
";",
"outgoingEdges",
".",
"add",
... | Add an outgoing edge ending at to.
@param to - the destination vertex
@param cost the edge cost | [
"Add",
"an",
"outgoing",
"edge",
"ending",
"at",
"to",
"."
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/graph/Vertex.java#L120-L124 | test | Add an outgoing edge to the graph. | Of course, here is the Java code you requested:
```java
public void addOutgoingEdge(Vertex<T> to, int cost)
{
Edge<T> out = new Edge<T>(this, to, cost);
outgoingEdges.add(out);
}
```
Hope this helps! |
RestComm/jain-slee | container/profiles/src/main/java/org/mobicents/slee/container/profile/ProfileTableActivityContextHandle.java | ProfileTableActivityContextHandle.readExternal | @Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.activityHandle = new ProfileTableActivityHandleImpl(in.readUTF(),
(Address) in.readObject());
} | java | @Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.activityHandle = new ProfileTableActivityHandleImpl(in.readUTF(),
(Address) in.readObject());
} | [
"@",
"Override",
"public",
"void",
"readExternal",
"(",
"ObjectInput",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"this",
".",
"activityHandle",
"=",
"new",
"ProfileTableActivityHandleImpl",
"(",
"in",
".",
"readUTF",
"(",
")",
",",
... | /*
(non-Javadoc)
@see java.io.Externalizable#readExternal(java.io.ObjectInput) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/profiles/src/main/java/org/mobicents/slee/container/profile/ProfileTableActivityContextHandle.java#L150-L155 | test | Method called to read the external fields of the ProfileTableActivityHandle object. | Of course, here is the Java code you requested:
```java
@Override
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
this.activityHandle = new ProfileTableActivityHandleImpl(in.readUTF(),
(Address) in.readObject());
}
```
Hope this helps! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.