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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java | OSimpleKeySerializer.deserializeFromByteBufferObject | @Override
public T deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) {
final byte typeId = walChanges.getByteValue(buffer, offset++);
init(typeId);
return (T) binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, offset);
} | java | @Override
public T deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) {
final byte typeId = walChanges.getByteValue(buffer, offset++);
init(typeId);
return (T) binarySerializer.deserializeFromByteBufferObject(buffer, walChanges, offset);
} | [
"@",
"Override",
"public",
"T",
"deserializeFromByteBufferObject",
"(",
"ByteBuffer",
"buffer",
",",
"OWALChanges",
"walChanges",
",",
"int",
"offset",
")",
"{",
"final",
"byte",
"typeId",
"=",
"walChanges",
".",
"getByteValue",
"(",
"buffer",
",",
"offset",
"++... | {@inheritDoc} | [
"{"
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/binary/impl/index/OSimpleKeySerializer.java#L180-L186 | test | Deserializes a
object from the given buffer. | Of course, here is the Java code you requested:
```java
@Override
public T deserializeFromByteBufferObject(ByteBuffer buffer, OWALChanges walChanges, int offset) {
final byte typeId = walChanges.getByteValue(buffer, offset++);
init(typeId);
return (T) binarySerializer.deserializeFromByteBufferObjec... |
dschulten/hydra-java | spring-hateoas-ext/src/main/java/de/escalon/hypermedia/affordance/DataType.java | DataType.isSingleValueType | public static boolean isSingleValueType(Class<?> clazz) {
boolean ret;
if (isNumber(clazz)
|| isBoolean(clazz)
|| isString(clazz)
|| isEnum(clazz)
|| isDate(clazz)
|| isCalendar(clazz)
|| isCurrency(clazz)
... | java | public static boolean isSingleValueType(Class<?> clazz) {
boolean ret;
if (isNumber(clazz)
|| isBoolean(clazz)
|| isString(clazz)
|| isEnum(clazz)
|| isDate(clazz)
|| isCalendar(clazz)
|| isCurrency(clazz)
... | [
"public",
"static",
"boolean",
"isSingleValueType",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"boolean",
"ret",
";",
"if",
"(",
"isNumber",
"(",
"clazz",
")",
"||",
"isBoolean",
"(",
"clazz",
")",
"||",
"isString",
"(",
"clazz",
")",
"||",
"isEnu... | Determines if the given class holds only one data item. Can be useful to determine if a value should be rendered
as scalar.
@param clazz
to check
@return true if class is scalar | [
"Determines",
"if",
"the",
"given",
"class",
"holds",
"only",
"one",
"data",
"item",
".",
"Can",
"be",
"useful",
"to",
"determine",
"if",
"a",
"value",
"should",
"be",
"rendered",
"as",
"scalar",
"."
] | 21f2ec64ed8f8294dcd7705a55477a4f85ed9d0a | https://github.com/dschulten/hydra-java/blob/21f2ec64ed8f8294dcd7705a55477a4f85ed9d0a/spring-hateoas-ext/src/main/java/de/escalon/hypermedia/affordance/DataType.java#L38-L53 | test | Checks if the class is a single value type. | Of course, here is the Java code you requested:
```java
public static boolean isSingleValueType(Class<?> clazz) {
boolean ret;
if (isNumber(clazz)
|| isBoolean(clazz)
|| isString(clazz)
|| isEnum(clazz)
|| isDate(clazz)
|| ... |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java | ComponentConfiguration.getPostConstructInterceptors | public List<InterceptorFactory> getPostConstructInterceptors() {
List<List<InterceptorFactory>> sortedItems = postConstructInterceptors.getSortedItems();
List<InterceptorFactory> interceptorFactories = new ArrayList<>();
for(List<InterceptorFactory> i : sortedItems) {
interceptorFact... | java | public List<InterceptorFactory> getPostConstructInterceptors() {
List<List<InterceptorFactory>> sortedItems = postConstructInterceptors.getSortedItems();
List<InterceptorFactory> interceptorFactories = new ArrayList<>();
for(List<InterceptorFactory> i : sortedItems) {
interceptorFact... | [
"public",
"List",
"<",
"InterceptorFactory",
">",
"getPostConstructInterceptors",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"InterceptorFactory",
">>",
"sortedItems",
"=",
"postConstructInterceptors",
".",
"getSortedItems",
"(",
")",
";",
"List",
"<",
"InterceptorFac... | Get the post-construct interceptors.
<p/>
This method should only be called after all interceptors have been added
@return the sorted interceptors | [
"Get",
"the",
"post",
"-",
"construct",
"interceptors",
".",
"<p",
"/",
">",
"This",
"method",
"should",
"only",
"be",
"called",
"after",
"all",
"interceptors",
"have",
"been",
"added"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java#L338-L345 | test | Gets the postConstructInterceptors list. | Of course, here is the Java code you requested:
```java
public List<InterceptorFactory> getPostConstructInterceptors() {
List<List<InterceptorFactory>> sortedItems = postConstructInterceptors.getSortedItems();
List<InterceptorFactory> interceptorFactories = new ArrayList<>();
for(List<Intercept... |
intellimate/IzouSDK | src/main/java/org/intellimate/izou/sdk/resource/ListResourceProviderImpl.java | ListResourceProviderImpl.providesResource | @Override
public boolean providesResource(ResourceModel resource) {
return resources.stream()
.map(ResourceModel::getResourceID)
.anyMatch(resourceS -> resourceS.equals(resource.getResourceID()));
} | java | @Override
public boolean providesResource(ResourceModel resource) {
return resources.stream()
.map(ResourceModel::getResourceID)
.anyMatch(resourceS -> resourceS.equals(resource.getResourceID()));
} | [
"@",
"Override",
"public",
"boolean",
"providesResource",
"(",
"ResourceModel",
"resource",
")",
"{",
"return",
"resources",
".",
"stream",
"(",
")",
".",
"map",
"(",
"ResourceModel",
"::",
"getResourceID",
")",
".",
"anyMatch",
"(",
"resourceS",
"->",
"resour... | checks whether it can provide the resource
@param resource the resource to provide
@return true if the container can provide the resource | [
"checks",
"whether",
"it",
"can",
"provide",
"the",
"resource"
] | bc8705ad48a6ca12a722f2b787be435949fa5d08 | https://github.com/intellimate/IzouSDK/blob/bc8705ad48a6ca12a722f2b787be435949fa5d08/src/main/java/org/intellimate/izou/sdk/resource/ListResourceProviderImpl.java#L41-L46 | test | Checks if the resource is a CRA - SECTYPE resource. | Of course, here is the Java code you requested:
```java
@Override
public boolean providesResource(ResourceModel resource) {
return resources.stream()
.map(ResourceModel::getResourceID)
.anyMatch(resourceS -> resourceS.equals(resource.getResourceID()));
}
```
Hope this h... |
ReactiveX/RxJava | src/main/java/io/reactivex/Flowable.java | Flowable.startWithArray | @SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> startWithArray(T... items) {
Flowable<T> fromArray = fromArray(items);
if (fromArray == empty()) {
return RxJavaPlugi... | java | @SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> startWithArray(T... items) {
Flowable<T> fromArray = fromArray(items);
if (fromArray == empty()) {
return RxJavaPlugi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
... | Returns a Flowable that emits the specified items before it begins to emit items emitted by the source
Publisher.
<p>
<img width="640" height="315" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/startWith.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator honors backpressure from do... | [
"Returns",
"a",
"Flowable",
"that",
"emits",
"the",
"specified",
"items",
"before",
"it",
"begins",
"to",
"emit",
"items",
"emitted",
"by",
"the",
"source",
"Publisher",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"315",
"src",
"=",
"http... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Flowable.java#L14588-L14598 | test | Start with an array. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final Flowable<T> startWithArray(T... items) {
Flowable<T> fromArray = fromArray(items);
i... |
1gravity/Android-RTEditor | RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java | IOUtils.toByteArray | public static byte[] toByteArray(URL url) throws IOException {
URLConnection conn = url.openConnection();
try {
return IOUtils.toByteArray(conn);
} finally {
close(conn);
}
} | java | public static byte[] toByteArray(URL url) throws IOException {
URLConnection conn = url.openConnection();
try {
return IOUtils.toByteArray(conn);
} finally {
close(conn);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"URLConnection",
"conn",
"=",
"url",
".",
"openConnection",
"(",
")",
";",
"try",
"{",
"return",
"IOUtils",
".",
"toByteArray",
"(",
"conn",
")",
"... | Get the contents of a <code>URL</code> as a <code>byte[]</code>.
@param url the <code>URL</code> to read
@return the requested byte array
@throws NullPointerException if the input is null
@throws IOException if an I/O exception occurs
@since 2.4 | [
"Get",
"the",
"contents",
"of",
"a",
"<code",
">",
"URL<",
"/",
"code",
">",
"as",
"a",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
"."
] | 9d8fb4bb865b3b3d011e7633afedcdfb8d21754f | https://github.com/1gravity/Android-RTEditor/blob/9d8fb4bb865b3b3d011e7633afedcdfb8d21754f/RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java#L627-L634 | test | Get a byte array from a URL. | Of course, here is the Java code you requested:
```java
public static byte[] toByteArray(URL url) throws IOException {
URLConnection conn = url.openConnection();
try {
return IOUtils.toByteArray(conn);
} finally {
close(conn);
}
}
```
Hope this helps! |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/mcidas/McIDASGridReader.java | McIDASGridReader.readInt | public int readInt(int word) throws IOException {
if (rf == null) {
throw new IOException("no file to read from");
}
rf.seek(word * 4);
// set the order
if (needToSwap) {
rf.order(RandomAccessFile.LITTLE_ENDIAN); // swap
} else {
rf.order(RandomAccessFile.BIG_ENDIAN);
}
... | java | public int readInt(int word) throws IOException {
if (rf == null) {
throw new IOException("no file to read from");
}
rf.seek(word * 4);
// set the order
if (needToSwap) {
rf.order(RandomAccessFile.LITTLE_ENDIAN); // swap
} else {
rf.order(RandomAccessFile.BIG_ENDIAN);
}
... | [
"public",
"int",
"readInt",
"(",
"int",
"word",
")",
"throws",
"IOException",
"{",
"if",
"(",
"rf",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"no file to read from\"",
")",
";",
"}",
"rf",
".",
"seek",
"(",
"word",
"*",
"4",
")",
... | Read an integer
@param word word in file (0 based) to read
@return int read
@throws IOException problem reading file | [
"Read",
"an",
"integer"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/mcidas/McIDASGridReader.java#L299-L313 | test | Read an int from the file. | Of course, here is the Java code you requested:
```java
public int readInt(int word) throws IOException {
if (rf == null) {
throw new IOException("no file to read from");
}
rf.seek(word * 4);
// set the order
if (needToSwap) {
rf.order(RandomAccessFile.LITTLE_ENDIAN); // swap
} els... |
pierre/goodwill-access | src/main/java/com/ning/metrics/goodwill/access/CachingGoodwillAccessor.java | CachingGoodwillAccessor.refreshSchemataCache | public void refreshSchemataCache()
{
try {
final List<GoodwillSchema> schemata = delegate.getSchemata().get();
// If Goodwill is down - keep the old cache around
if (schemata == null) {
return;
}
final Map<String,GoodwillSchema> n... | java | public void refreshSchemataCache()
{
try {
final List<GoodwillSchema> schemata = delegate.getSchemata().get();
// If Goodwill is down - keep the old cache around
if (schemata == null) {
return;
}
final Map<String,GoodwillSchema> n... | [
"public",
"void",
"refreshSchemataCache",
"(",
")",
"{",
"try",
"{",
"final",
"List",
"<",
"GoodwillSchema",
">",
"schemata",
"=",
"delegate",
".",
"getSchemata",
"(",
")",
".",
"get",
"(",
")",
";",
"// If Goodwill is down - keep the old cache around",
"if",
"(... | Invalidate and refresh the cache
<p/>
This is blocking and returns when the cache has been updated | [
"Invalidate",
"and",
"refresh",
"the",
"cache",
"<p",
"/",
">",
"This",
"is",
"blocking",
"and",
"returns",
"when",
"the",
"cache",
"has",
"been",
"updated"
] | 2a9741a106599b417eb280404ed39bdfa046caef | https://github.com/pierre/goodwill-access/blob/2a9741a106599b417eb280404ed39bdfa046caef/src/main/java/com/ning/metrics/goodwill/access/CachingGoodwillAccessor.java#L62-L89 | test | Refresh the cache of the schemata. | Of course, here is the Java code you requested:
```java
public void refreshSchemataCache()
{
try {
final List<GoodwillSchema> schemata = delegate.getSchemata().get();
// If Goodwill is down - keep the old cache around
if (schemata == null) {
return;
... |
intellimate/IzouSDK | src/main/java/org/intellimate/izou/sdk/frameworks/music/player/template/Player.java | Player.updatePlayInfo | @SuppressWarnings("unused")
public void updatePlayInfo(Playlist playlist, Progress progress, Volume volume) {
if (playlist != null)
this.playlist = playlist;
if (progress != null)
this.progress = progress;
if (volume != null)
this.volume = volume;
... | java | @SuppressWarnings("unused")
public void updatePlayInfo(Playlist playlist, Progress progress, Volume volume) {
if (playlist != null)
this.playlist = playlist;
if (progress != null)
this.progress = progress;
if (volume != null)
this.volume = volume;
... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"updatePlayInfo",
"(",
"Playlist",
"playlist",
",",
"Progress",
"progress",
",",
"Volume",
"volume",
")",
"{",
"if",
"(",
"playlist",
"!=",
"null",
")",
"this",
".",
"playlist",
"=",
"playlis... | updates the Info about the current song
@param playlist the playlist, or null
@param progress the progress, or null
@param volume the volume, or null | [
"updates",
"the",
"Info",
"about",
"the",
"current",
"song"
] | bc8705ad48a6ca12a722f2b787be435949fa5d08 | https://github.com/intellimate/IzouSDK/blob/bc8705ad48a6ca12a722f2b787be435949fa5d08/src/main/java/org/intellimate/izou/sdk/frameworks/music/player/template/Player.java#L362-L371 | test | Update the playlist progress and volume fields in the exception. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unused")
public void updatePlayInfo(Playlist playlist, Progress progress, Volume volume) {
if (playlist != null)
this.playlist = playlist;
if (progress != null)
this.progress = progress;
if (v... |
boonproject/boon | boon/src/main/java/org/boon/validation/readers/AnnotationValidatorMetaDataReader.java | AnnotationValidatorMetaDataReader.extractValidatorMetaData | private List<ValidatorMetaData> extractValidatorMetaData( Class<?> clazz, String propertyName, List<ValidatorMetaData> validatorMetaDataList ) {
/* If the meta-data was not found, then generate it. */
if ( validatorMetaDataList == null ) { // if not found
/* Read the annotation from the c... | java | private List<ValidatorMetaData> extractValidatorMetaData( Class<?> clazz, String propertyName, List<ValidatorMetaData> validatorMetaDataList ) {
/* If the meta-data was not found, then generate it. */
if ( validatorMetaDataList == null ) { // if not found
/* Read the annotation from the c... | [
"private",
"List",
"<",
"ValidatorMetaData",
">",
"extractValidatorMetaData",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"propertyName",
",",
"List",
"<",
"ValidatorMetaData",
">",
"validatorMetaDataList",
")",
"{",
"/* If the meta-data was not found, then gen... | Extract BaseValidator Meta Data.
@param clazz class
@param propertyName property name
@param validatorMetaDataList validatorMetaDataList
@return validator meta data | [
"Extract",
"BaseValidator",
"Meta",
"Data",
"."
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/validation/readers/AnnotationValidatorMetaDataReader.java#L148-L160 | test | Extract the validator meta - data from the annotation. | Of course, here is the Java code you requested:
```java
private List<ValidatorMetaData> extractValidatorMetaData( Class<?> clazz, String propertyName, List<ValidatorMetaData> validatorMetaDataList ) {
/* If the meta-data was not found, then generate it. */
if ( validatorMetaDataList == null ) { // if... |
RestComm/jain-slee | container/usage/src/main/java/org/mobicents/slee/container/management/jmx/ServiceUsageMBeanImpl.java | ServiceUsageMBeanImpl._createUsageParameterSet | private synchronized void _createUsageParameterSet(SbbID sbbId,
String name, boolean failIfSbbHasNoUsageParamSet)
throws NullPointerException, UnrecognizedSbbException,
InvalidArgumentException,
UsageParameterSetNameAlreadyExistsException, ManagementException {
if (sbbId == null)
throw new Null... | java | private synchronized void _createUsageParameterSet(SbbID sbbId,
String name, boolean failIfSbbHasNoUsageParamSet)
throws NullPointerException, UnrecognizedSbbException,
InvalidArgumentException,
UsageParameterSetNameAlreadyExistsException, ManagementException {
if (sbbId == null)
throw new Null... | [
"private",
"synchronized",
"void",
"_createUsageParameterSet",
"(",
"SbbID",
"sbbId",
",",
"String",
"name",
",",
"boolean",
"failIfSbbHasNoUsageParamSet",
")",
"throws",
"NullPointerException",
",",
"UnrecognizedSbbException",
",",
"InvalidArgumentException",
",",
"UsagePa... | /*
(non-Javadoc)
@see javax.slee.management.ServiceUsageMBean#createUsageParameterSet(javax.slee.SbbID,
java.lang.String) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/usage/src/main/java/org/mobicents/slee/container/management/jmx/ServiceUsageMBeanImpl.java#L192-L326 | test | Creates the usage parameter set. | Of course, here is the Java code you requested:
```java
private synchronized void _createUsageParameterSet(SbbID sbbId,
String name, boolean failIfSbbHasNoUsageParamSet)
throws NullPointerException, UnrecognizedSbbException,
InvalidArgumentException,
UsageParameterSetNameAlreadyExistsException, Managem... |
lightcouch/LightCouch | src/main/java/org/lightcouch/CouchDbClientBase.java | CouchDbClientBase.batch | public void batch(Object object) {
assertNotEmpty(object, "object");
HttpResponse response = null;
try {
URI uri = buildUri(getDBUri()).query("batch", "ok").build();
response = post(uri, getGson().toJson(object));
} finally {
close(response);
}
} | java | public void batch(Object object) {
assertNotEmpty(object, "object");
HttpResponse response = null;
try {
URI uri = buildUri(getDBUri()).query("batch", "ok").build();
response = post(uri, getGson().toJson(object));
} finally {
close(response);
}
} | [
"public",
"void",
"batch",
"(",
"Object",
"object",
")",
"{",
"assertNotEmpty",
"(",
"object",
",",
"\"object\"",
")",
";",
"HttpResponse",
"response",
"=",
"null",
";",
"try",
"{",
"URI",
"uri",
"=",
"buildUri",
"(",
"getDBUri",
"(",
")",
")",
".",
"q... | Saves a document with <tt>batch=ok</tt> query param.
@param object The object to save. | [
"Saves",
"a",
"document",
"with",
"<tt",
">",
"batch",
"=",
"ok<",
"/",
"tt",
">",
"query",
"param",
"."
] | 9646889503475e862fd2158487e1cdd805447f4a | https://github.com/lightcouch/LightCouch/blob/9646889503475e862fd2158487e1cdd805447f4a/src/main/java/org/lightcouch/CouchDbClientBase.java#L343-L352 | test | Batch insert a single object in the database. | Of course, here is the Java code you requested:
```java
public void batch(Object object) {
assertNotEmpty(object, "object");
HttpResponse response = null;
try {
URI uri = buildUri(getDBUri()).query("batch", "ok").build();
response = post(uri, getGson().toJson(object));
} finally {
close(response);
... |
playframework/playframework | core/play/src/main/java/play/inject/SourceProvider.java | SourceProvider.get | public StackTraceElement get() {
for (final StackTraceElement element : new Throwable().getStackTrace()) {
String className = element.getClassName();
if (!classNamesToSkip.contains(className)) {
return element;
}
}
throw new AssertionError();
} | java | public StackTraceElement get() {
for (final StackTraceElement element : new Throwable().getStackTrace()) {
String className = element.getClassName();
if (!classNamesToSkip.contains(className)) {
return element;
}
}
throw new AssertionError();
} | [
"public",
"StackTraceElement",
"get",
"(",
")",
"{",
"for",
"(",
"final",
"StackTraceElement",
"element",
":",
"new",
"Throwable",
"(",
")",
".",
"getStackTrace",
"(",
")",
")",
"{",
"String",
"className",
"=",
"element",
".",
"getClassName",
"(",
")",
";"... | Returns the calling line of code. The selected line is the nearest to the top of the stack that
is not skipped.
@return a stack trace element containing the caller. | [
"Returns",
"the",
"calling",
"line",
"of",
"code",
".",
"The",
"selected",
"line",
"is",
"the",
"nearest",
"to",
"the",
"top",
"of",
"the",
"stack",
"that",
"is",
"not",
"skipped",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play/src/main/java/play/inject/SourceProvider.java#L70-L78 | test | Get the stack trace from the exception. | Of course, here is the Java code you requested:
```java
public StackTraceElement get() {
for (final StackTraceElement element : new Throwable().getStackTrace()) {
String className = element.getClassName();
if (!classNamesToSkip.contains(className)) {
return element;
}
}
throw new ... |
apache/parquet-mr | parquet-hadoop/src/main/java/org/apache/parquet/hadoop/LruCache.java | LruCache.getCurrentValue | public V getCurrentValue(final K key) {
V value = cacheMap.get(key);
LOG.debug("Value for '{}' {} in cache", key, (value == null ? "not " : ""));
if (value != null && !value.isCurrent(key)) {
// value is not current; remove it and return null
remove(key);
return null;
}
return val... | java | public V getCurrentValue(final K key) {
V value = cacheMap.get(key);
LOG.debug("Value for '{}' {} in cache", key, (value == null ? "not " : ""));
if (value != null && !value.isCurrent(key)) {
// value is not current; remove it and return null
remove(key);
return null;
}
return val... | [
"public",
"V",
"getCurrentValue",
"(",
"final",
"K",
"key",
")",
"{",
"V",
"value",
"=",
"cacheMap",
".",
"get",
"(",
"key",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Value for '{}' {} in cache\"",
",",
"key",
",",
"(",
"value",
"==",
"null",
"?",
"\"not ... | Returns the value to which the specified key is mapped, or null if 1) the
value is not current or 2) this cache contains no mapping for the key.
@param key the key whose associated value is to be returned
@return the value to which the specified key is mapped, or null if 1) the
value is not current or 2) this cache con... | [
"Returns",
"the",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"null",
"if",
"1",
")",
"the",
"value",
"is",
"not",
"current",
"or",
"2",
")",
"this",
"cache",
"contains",
"no",
"mapping",
"for",
"the",
"key",
"."
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/LruCache.java#L145-L155 | test | Get the value for the given key from the cache. | Of course, here is the Java code you requested:
```java
public V getCurrentValue(final K key) {
V value = cacheMap.get(key);
LOG.debug("Value for '{}' {} in cache", key, (value == null ? "not " : ""));
if (value != null && !value.isCurrent(key)) {
// value is not current; remove it and return null
... |
oblac/jodd | jodd-madvoc/src/main/java/jodd/madvoc/result/PathResult.java | PathResult.path | public String path() {
if (methref != null) {
final String methodName = methref.ref();
return target.getName() + '#' + methodName;
}
return path;
} | java | public String path() {
if (methref != null) {
final String methodName = methref.ref();
return target.getName() + '#' + methodName;
}
return path;
} | [
"public",
"String",
"path",
"(",
")",
"{",
"if",
"(",
"methref",
"!=",
"null",
")",
"{",
"final",
"String",
"methodName",
"=",
"methref",
".",
"ref",
"(",
")",
";",
"return",
"target",
".",
"getName",
"(",
")",
"+",
"'",
"'",
"+",
"methodName",
";"... | Returns path value. | [
"Returns",
"path",
"value",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-madvoc/src/main/java/jodd/madvoc/result/PathResult.java#L66-L72 | test | Returns the path of the resource. | Of course, here is the Java code you requested:
```java
public String path() {
if (methref != null) {
final String methodName = methref.ref();
return target.getName() + '#' + methodName;
}
return path;
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/units/DateFormatter.java | DateFormatter.toDateTimeString | public String toDateTimeString( Date date) {
if (date == null) return "Unknown";
stdDateTimeFormat();
return stdDateTimeFormat.format( date) +"Z";
} | java | public String toDateTimeString( Date date) {
if (date == null) return "Unknown";
stdDateTimeFormat();
return stdDateTimeFormat.format( date) +"Z";
} | [
"public",
"String",
"toDateTimeString",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"return",
"\"Unknown\"",
";",
"stdDateTimeFormat",
"(",
")",
";",
"return",
"stdDateTimeFormat",
".",
"format",
"(",
"date",
")",
"+",
"\"Z\"",
";"... | "standard date format" = yyyy-MM-dd HH:mm:ssZ
@param date format this date
@return date formatted as date/time | [
"standard",
"date",
"format",
"=",
"yyyy",
"-",
"MM",
"-",
"dd",
"HH",
":",
"mm",
":",
"ssZ"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/units/DateFormatter.java#L200-L204 | test | Returns a string representation of the given date. | Of course, here is the Java code you requested:
```java
public String toDateTimeString( Date date) {
if (date == null) return "Unknown";
stdDateTimeFormat();
return stdDateTimeFormat.format( date) +"Z";
}
```
Hope this helps! |
Jasig/NotificationPortlet | notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/action/read/ReadAction.java | ReadAction.getReadNotices | Set<String> getReadNotices(final PortletRequest req) {
final HashSet<String> rslt = new HashSet<>();
final PortletPreferences prefs = req.getPreferences();
final String[] ids = prefs.getValues(READ_NOTIFICATION_IDS_PREFERENCE, new String[0]);
for (int i=0; i < ids.length; i++) {
... | java | Set<String> getReadNotices(final PortletRequest req) {
final HashSet<String> rslt = new HashSet<>();
final PortletPreferences prefs = req.getPreferences();
final String[] ids = prefs.getValues(READ_NOTIFICATION_IDS_PREFERENCE, new String[0]);
for (int i=0; i < ids.length; i++) {
... | [
"Set",
"<",
"String",
">",
"getReadNotices",
"(",
"final",
"PortletRequest",
"req",
")",
"{",
"final",
"HashSet",
"<",
"String",
">",
"rslt",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"final",
"PortletPreferences",
"prefs",
"=",
"req",
".",
"getPreferenc... | /* package-private | [
"/",
"*",
"package",
"-",
"private"
] | a74b87c145b66166a2cb6849d17ce9b0f2c98f3b | https://github.com/Jasig/NotificationPortlet/blob/a74b87c145b66166a2cb6849d17ce9b0f2c98f3b/notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/action/read/ReadAction.java#L141-L149 | test | Gets the read notices. | Of course, here is the Java code you requested:
```java
Set<String> getReadNotices(final PortletRequest req) {
final HashSet<String> rslt = new HashSet<>();
final PortletPreferences prefs = req.getPreferences();
final String[] ids = prefs.getValues(READ_NOTIFICATION_IDS_PREFERENCE, new String[0... |
Unidata/thredds | cdm/src/main/java/ucar/ma2/StructureDataW.java | StructureDataW.getScalarDouble | public double getScalarDouble(StructureMembers.Member m) {
Array data = getArray(m);
return data.getDouble(Index.scalarIndexImmutable);
} | java | public double getScalarDouble(StructureMembers.Member m) {
Array data = getArray(m);
return data.getDouble(Index.scalarIndexImmutable);
} | [
"public",
"double",
"getScalarDouble",
"(",
"StructureMembers",
".",
"Member",
"m",
")",
"{",
"Array",
"data",
"=",
"getArray",
"(",
"m",
")",
";",
"return",
"data",
".",
"getDouble",
"(",
"Index",
".",
"scalarIndexImmutable",
")",
";",
"}"
] | Get member data of type double.
@param m get data from this StructureMembers.Member. Must be of type double.
@return scalar double value | [
"Get",
"member",
"data",
"of",
"type",
"double",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/ma2/StructureDataW.java#L99-L102 | test | Get the scalar value of a member. | Of course, here is the Java code you requested:
```java
public double getScalarDouble(StructureMembers.Member m) {
Array data = getArray(m);
return data.getDouble(Index.scalarIndexImmutable);
}
```
Hope this helps! |
GojaFramework/goja | goja-core/src/main/java/goja/core/kits/io/ResourceKit.java | ResourceKit.isJarURL | public static boolean isJarURL(URL url) {
String up = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(up) || URL_PROTOCOL_ZIP.equals(up) || URL_PROTOCOL_WSJAR.equals(
up));
} | java | public static boolean isJarURL(URL url) {
String up = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(up) || URL_PROTOCOL_ZIP.equals(up) || URL_PROTOCOL_WSJAR.equals(
up));
} | [
"public",
"static",
"boolean",
"isJarURL",
"(",
"URL",
"url",
")",
"{",
"String",
"up",
"=",
"url",
".",
"getProtocol",
"(",
")",
";",
"return",
"(",
"URL_PROTOCOL_JAR",
".",
"equals",
"(",
"up",
")",
"||",
"URL_PROTOCOL_ZIP",
".",
"equals",
"(",
"up",
... | Determine whether the given URL points to a resource in a jar file, that is, has protocol
"jar", "zip", "wsjar" or "code-source". <p>"zip" and "wsjar" are used by WebLogic Server and
WebSphere, respectively, but can be treated like jar files.
@param url the URL to check
@return whether the URL has been identified as a... | [
"Determine",
"whether",
"the",
"given",
"URL",
"points",
"to",
"a",
"resource",
"in",
"a",
"jar",
"file",
"that",
"is",
"has",
"protocol",
"jar",
"zip",
"wsjar",
"or",
"code",
"-",
"source",
".",
"<p",
">",
"zip",
"and",
"wsjar",
"are",
"used",
"by",
... | 77179b495f668fc1fa20accc912991df6bb2d917 | https://github.com/GojaFramework/goja/blob/77179b495f668fc1fa20accc912991df6bb2d917/goja-core/src/main/java/goja/core/kits/io/ResourceKit.java#L275-L279 | test | Checks if the given URL is a jar URL. | Of course, here is the Java code you requested:
```java
public static boolean isJarURL(URL url) {
String up = url.getProtocol();
return (URL_PROTOCOL_JAR.equals(up) || URL_PROTOCOL_ZIP.equals(up) || URL_PROTOCOL_WSJAR.equals(
up));
}
```
Hope this helps! |
kocakosm/pitaya | src/org/kocakosm/pitaya/net/MediaType.java | MediaType.withoutParameters | public MediaType withoutParameters()
{
Map<String, String> params = Collections.emptyMap();
return new MediaType(type, subtype, params);
} | java | public MediaType withoutParameters()
{
Map<String, String> params = Collections.emptyMap();
return new MediaType(type, subtype, params);
} | [
"public",
"MediaType",
"withoutParameters",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"return",
"new",
"MediaType",
"(",
"type",
",",
"subtype",
",",
"params",
")",
";",
"}"
] | Returns a new {@code MediaType} instance with the same type and
subtype as this instance but without any parameters.
@return the created {@code MediaType}. | [
"Returns",
"a",
"new",
"{",
"@code",
"MediaType",
"}",
"instance",
"with",
"the",
"same",
"type",
"and",
"subtype",
"as",
"this",
"instance",
"but",
"without",
"any",
"parameters",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/net/MediaType.java#L347-L351 | test | Returns a new instance with the parameters set to an empty map. | Of course, here is the Java code you requested:
```java
public MediaType withoutParameters()
{
Map<String, String> params = Collections.emptyMap();
return new MediaType(type, subtype, params);
}
```
Hope this helps! |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/ToolsUI.java | ToolsUI.makeComponent | public void makeComponent(JTabbedPane parent, final String title) {
if (parent == null) {
parent = tabbedPane;
}
// find the correct index
int n = parent.getTabCount();
int idx;
for (idx = 0; idx < n; idx++) {
String cTitle = parent.getTitl... | java | public void makeComponent(JTabbedPane parent, final String title) {
if (parent == null) {
parent = tabbedPane;
}
// find the correct index
int n = parent.getTabCount();
int idx;
for (idx = 0; idx < n; idx++) {
String cTitle = parent.getTitl... | [
"public",
"void",
"makeComponent",
"(",
"JTabbedPane",
"parent",
",",
"final",
"String",
"title",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"parent",
"=",
"tabbedPane",
";",
"}",
"// find the correct index\r",
"int",
"n",
"=",
"parent",
".",
"... | deferred creation of components to minimize startup | [
"deferred",
"creation",
"of",
"components",
"to",
"minimize",
"startup"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/ToolsUI.java#L333-L640 | test | Creates a component with the specified title and a parent tabbed pane. | Of course, here is the Java code you requested:
```java
public void makeComponent(JTabbedPane parent, final String title) {
if (parent == null) {
parent = tabbedPane;
}
// find the correct index
int n = parent.getTabCount();
int idx;
for (idx = 0; id... |
apache/parquet-mr | parquet-common/src/main/java/org/apache/parquet/glob/GlobParser.java | GlobParser.annotateMessage | private static String annotateMessage(String message, int pos) {
StringBuilder sb = new StringBuilder(message);
sb.append('\n');
for (int i = 0; i < pos; i++) {
sb.append('-');
}
sb.append('^');
return sb.toString();
} | java | private static String annotateMessage(String message, int pos) {
StringBuilder sb = new StringBuilder(message);
sb.append('\n');
for (int i = 0; i < pos; i++) {
sb.append('-');
}
sb.append('^');
return sb.toString();
} | [
"private",
"static",
"String",
"annotateMessage",
"(",
"String",
"message",
",",
"int",
"pos",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"message",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",... | for pretty printing which character had the error | [
"for",
"pretty",
"printing",
"which",
"character",
"had",
"the",
"error"
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-common/src/main/java/org/apache/parquet/glob/GlobParser.java#L202-L210 | test | Annotate a message with a word at position pos. | Of course, here is the Java code you requested:
```java
private static String annotateMessage(String message, int pos) {
StringBuilder sb = new StringBuilder(message);
sb.append('\n');
for (int i = 0; i < pos; i++) {
sb.append('-');
}
sb.append('^');
return sb.toString();
}
```
Hope th... |
open-korean-text/open-korean-text | src/main/java/org/openkoreantext/processor/OpenKoreanTextProcessorJava.java | OpenKoreanTextProcessorJava.tokensToJavaKoreanTokenList | public static List<KoreanTokenJava> tokensToJavaKoreanTokenList(Seq<KoreanToken> tokens, boolean keepSpace) {
Iterator<KoreanToken> tokenized = tokens.iterator();
List<KoreanTokenJava> output = new LinkedList<>();
while (tokenized.hasNext()) {
KoreanToken token = tokenized.next();
String stem = ... | java | public static List<KoreanTokenJava> tokensToJavaKoreanTokenList(Seq<KoreanToken> tokens, boolean keepSpace) {
Iterator<KoreanToken> tokenized = tokens.iterator();
List<KoreanTokenJava> output = new LinkedList<>();
while (tokenized.hasNext()) {
KoreanToken token = tokenized.next();
String stem = ... | [
"public",
"static",
"List",
"<",
"KoreanTokenJava",
">",
"tokensToJavaKoreanTokenList",
"(",
"Seq",
"<",
"KoreanToken",
">",
"tokens",
",",
"boolean",
"keepSpace",
")",
"{",
"Iterator",
"<",
"KoreanToken",
">",
"tokenized",
"=",
"tokens",
".",
"iterator",
"(",
... | Transforms the tokenization output to List<KoreanTokenJava>
@param tokens Korean tokens (output of tokenize(CharSequence text)).
@return List of KoreanTokenJava. | [
"Transforms",
"the",
"tokenization",
"output",
"to",
"List<KoreanTokenJava",
">"
] | ed815a224b986e5a5d03fbd8f5c8d154e84e5b40 | https://github.com/open-korean-text/open-korean-text/blob/ed815a224b986e5a5d03fbd8f5c8d154e84e5b40/src/main/java/org/openkoreantext/processor/OpenKoreanTextProcessorJava.java#L96-L117 | test | Tokenize a sequence of tokens into a list of Java tokens. | Of course, here is the Java code you requested:
```java
public static List<KoreanTokenJava> tokensToJavaKoreanTokenList(Seq<KoreanToken> tokens, boolean keepSpace) {
Iterator<KoreanToken> tokenized = tokens.iterator();
List<KoreanTokenJava> output = new LinkedList<>();
while (tokenized.hasNext()) {
K... |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/XArrays.java | XArrays.toPrimitive | public static char[] toPrimitive(Character... a)
{
if (a != null) {
char[] p = new char[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
} | java | public static char[] toPrimitive(Character... a)
{
if (a != null) {
char[] p = new char[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
} | [
"public",
"static",
"char",
"[",
"]",
"toPrimitive",
"(",
"Character",
"...",
"a",
")",
"{",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"char",
"[",
"]",
"p",
"=",
"new",
"char",
"[",
"a",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0... | Converts an array of {@code Character}s to an array of {@code char}s.
Returns {@code null} if the given array is {@code null}. Does not
modify the input array.
@param a the {@code Character} array to convert.
@return the corresponding {@code char} array.
@throws NullPointerException if {@code a} contains a {@code nu... | [
"Converts",
"an",
"array",
"of",
"{",
"@code",
"Character",
"}",
"s",
"to",
"an",
"array",
"of",
"{",
"@code",
"char",
"}",
"s",
".",
"Returns",
"{",
"@code",
"null",
"}",
"if",
"the",
"given",
"array",
"is",
"{",
"@code",
"null",
"}",
".",
"Does",... | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/XArrays.java#L1877-L1887 | test | To primitive char array. | Of course, here is the Java code you requested:
```java
public static char[] toPrimitive(Character... a)
{
if (a != null) {
char[] p = new char[a.length];
for (int i = 0; i < a.length; i++) {
p[i] = a[i];
}
return p;
}
return null;
}
```
Hope this helps! |
playframework/playframework | core/play-java/src/main/java/play/libs/Comet.java | Comet.flow | public static Flow<ByteString, ByteString, NotUsed> flow(String callbackName) {
ByteString cb = ByteString.fromString(callbackName);
return Flow.of(ByteString.class)
.map(
(msg) -> {
return formatted(cb, msg);
} | java | public static Flow<ByteString, ByteString, NotUsed> flow(String callbackName) {
ByteString cb = ByteString.fromString(callbackName);
return Flow.of(ByteString.class)
.map(
(msg) -> {
return formatted(cb, msg);
} | [
"public",
"static",
"Flow",
"<",
"ByteString",
",",
"ByteString",
",",
"NotUsed",
">",
"flow",
"(",
"String",
"callbackName",
")",
"{",
"ByteString",
"cb",
"=",
"ByteString",
".",
"fromString",
"(",
"callbackName",
")",
";",
"return",
"Flow",
".",
"of",
"(... | Produces a flow of ByteString with a prepended block and a script wrapper.
@param callbackName the javascript callback method.
@return a flow of ByteString elements. | [
"Produces",
"a",
"flow",
"of",
"ByteString",
"with",
"a",
"prepended",
"block",
"and",
"a",
"script",
"wrapper",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/core/play-java/src/main/java/play/libs/Comet.java#L84-L90 | test | Create a flow from a callback name | Of course, here is the Java code you requested:
```java
public static Flow<ByteString, ByteString, NotUsed> flow(String callbackName) {
ByteString cb = ByteString.fromString(callbackName);
return Flow.of(ByteString.class)
.map(
(msg) -> {
return formatted(cb, msg);
... |
NanoHttpd/nanohttpd | webserver/src/main/java/org/nanohttpd/webserver/SimpleWebServer.java | SimpleWebServer.serveFile | Response serveFile(String uri, Map<String, String> header, File file, String mime) {
Response res;
try {
// Calculate etag
String etag = Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()).hashCode());
// Support (simple) skipping:... | java | Response serveFile(String uri, Map<String, String> header, File file, String mime) {
Response res;
try {
// Calculate etag
String etag = Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()).hashCode());
// Support (simple) skipping:... | [
"Response",
"serveFile",
"(",
"String",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"header",
",",
"File",
"file",
",",
"String",
"mime",
")",
"{",
"Response",
"res",
";",
"try",
"{",
"// Calculate etag",
"String",
"etag",
"=",
"Integer",
".",
... | Serves file from homeDir and its' subdirectories (only). Uses only URI,
ignores all headers and HTTP parameters. | [
"Serves",
"file",
"from",
"homeDir",
"and",
"its",
"subdirectories",
"(",
"only",
")",
".",
"Uses",
"only",
"URI",
"ignores",
"all",
"headers",
"and",
"HTTP",
"parameters",
"."
] | b04a342a4bcd0ff44be65138acffc73a29381c72 | https://github.com/NanoHttpd/nanohttpd/blob/b04a342a4bcd0ff44be65138acffc73a29381c72/webserver/src/main/java/org/nanohttpd/webserver/SimpleWebServer.java#L474-L571 | test | serveFile method. | Of course, here is the Java code you requested:
```java
Response serveFile(String uri, Map<String, String> header, File file, String mime) {
Response res;
try {
// Calculate etag
String etag = Integer.toHexString((file.getAbsolutePath() + file.lastModified() + "" + file.length()... |
wildfly/wildfly | sar/src/main/java/org/jboss/as/service/ParsedServiceDeploymentProcessor.java | ParsedServiceDeploymentProcessor.deploy | @Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit.getAttachment(JBossServiceXmlDescriptor.ATT... | java | @Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit.getAttachment(JBossServiceXmlDescriptor.ATT... | [
"@",
"Override",
"public",
"void",
"deploy",
"(",
"final",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"deploymentUnit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"fina... | Process a deployment for JbossService configuration. Will install a {@code JBossService} for each configured service.
@param phaseContext the deployment unit context
@throws DeploymentUnitProcessingException | [
"Process",
"a",
"deployment",
"for",
"JbossService",
"configuration",
".",
"Will",
"install",
"a",
"{",
"@code",
"JBossService",
"}",
"for",
"each",
"configured",
"service",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/sar/src/main/java/org/jboss/as/service/ParsedServiceDeploymentProcessor.java#L84-L111 | test | Add the services to the application. | Of course, here is the Java code you requested:
```java
@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final JBossServiceXmlDescriptor serviceXmlDescriptor = d... |
GojaFramework/goja | goja-core/src/main/java/goja/core/kits/reflect/ReflectionKit.java | ReflectionKit.declaresException | public static boolean declaresException(Method method, Class<?> exceptionType) {
Preconditions.checkNotNull(method, "Method must not be null");
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (Class<?> declaredException : declaredExceptions) {
if (declaredException.is... | java | public static boolean declaresException(Method method, Class<?> exceptionType) {
Preconditions.checkNotNull(method, "Method must not be null");
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (Class<?> declaredException : declaredExceptions) {
if (declaredException.is... | [
"public",
"static",
"boolean",
"declaresException",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"exceptionType",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"method",
",",
"\"Method must not be null\"",
")",
";",
"Class",
"<",
"?",
">",
"[",... | Determine whether the given method explicitly declares the given
exception or one of its superclasses, which means that an exception of
that type can be propagated as-is within a reflective invocation.
@param method the declaring method
@param exceptionType the exception to throw
@return {@code true} if the exc... | [
"Determine",
"whether",
"the",
"given",
"method",
"explicitly",
"declares",
"the",
"given",
"exception",
"or",
"one",
"of",
"its",
"superclasses",
"which",
"means",
"that",
"an",
"exception",
"of",
"that",
"type",
"can",
"be",
"propagated",
"as",
"-",
"is",
... | 77179b495f668fc1fa20accc912991df6bb2d917 | https://github.com/GojaFramework/goja/blob/77179b495f668fc1fa20accc912991df6bb2d917/goja-core/src/main/java/goja/core/kits/reflect/ReflectionKit.java#L365-L374 | test | Checks if the given method declares an exception type. | Of course, here is the Java code you requested:
```java
public static boolean declaresException(Method method, Class<?> exceptionType) {
Preconditions.checkNotNull(method, "Method must not be null");
Class<?>[] declaredExceptions = method.getExceptionTypes();
for (Class<?> declaredException : d... |
Unidata/thredds | legacy/src/main/java/thredds/catalog/InvDatasetImpl.java | InvDatasetImpl.replaceDataset | public boolean replaceDataset(InvDatasetImpl remove, InvDatasetImpl add) {
for (int i = 0; i < datasets.size(); i++) {
InvDataset dataset = datasets.get(i);
if (dataset.equals(remove)) {
datasets.set(i, add);
InvCatalogImpl cat = (InvCatalogImpl) getParentCatalog();
if (cat != nu... | java | public boolean replaceDataset(InvDatasetImpl remove, InvDatasetImpl add) {
for (int i = 0; i < datasets.size(); i++) {
InvDataset dataset = datasets.get(i);
if (dataset.equals(remove)) {
datasets.set(i, add);
InvCatalogImpl cat = (InvCatalogImpl) getParentCatalog();
if (cat != nu... | [
"public",
"boolean",
"replaceDataset",
"(",
"InvDatasetImpl",
"remove",
",",
"InvDatasetImpl",
"add",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"datasets",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"InvDataset",
"dataset",
"=",
... | Replace the given dataset if it is a nesetd dataset.
@param remove - the dataset element to be removed
@param add - the dataset element to be added
@return true on success | [
"Replace",
"the",
"given",
"dataset",
"if",
"it",
"is",
"a",
"nesetd",
"dataset",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/catalog/InvDatasetImpl.java#L733-L747 | test | Replace a dataset in this catalog. | Of course, here is the Java code you requested:
```java
public boolean replaceDataset(InvDatasetImpl remove, InvDatasetImpl add) {
for (int i = 0; i < datasets.size(); i++) {
InvDataset dataset = datasets.get(i);
if (dataset.equals(remove)) {
datasets.set(i, add);
InvCatalogImpl cat = (... |
polyjdbc/polyjdbc | src/main/java/org/polyjdbc/core/query/SelectQuery.java | SelectQuery.withArgument | public SelectQuery withArgument(String argumentName, Object object) {
query.setArgument(argumentName, object);
return this;
} | java | public SelectQuery withArgument(String argumentName, Object object) {
query.setArgument(argumentName, object);
return this;
} | [
"public",
"SelectQuery",
"withArgument",
"(",
"String",
"argumentName",
",",
"Object",
"object",
")",
"{",
"query",
".",
"setArgument",
"(",
"argumentName",
",",
"object",
")",
";",
"return",
"this",
";",
"}"
] | Sets value for placeholder defined in query. Placeholder name should
not start with <b>:</b>, it is stripped off. Based on passed object type,
appropriate JDBC type is chosen.
@see org.polyjdbc.core.type.ColumnTypeMapper | [
"Sets",
"value",
"for",
"placeholder",
"defined",
"in",
"query",
".",
"Placeholder",
"name",
"should",
"not",
"start",
"with",
"<b",
">",
":",
"<",
"/",
"b",
">",
"it",
"is",
"stripped",
"off",
".",
"Based",
"on",
"passed",
"object",
"type",
"appropriate... | 824d0e1ad14390a5b52cb96e527c943c14e28339 | https://github.com/polyjdbc/polyjdbc/blob/824d0e1ad14390a5b52cb96e527c943c14e28339/src/main/java/org/polyjdbc/core/query/SelectQuery.java#L142-L145 | test | Add an argument to the query. | Of course, here is the Java code you requested:
```java
public SelectQuery withArgument(String argumentName, Object object) {
query.setArgument(argumentName, object);
return this;
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | Examples/src/main/java/org/openestate/io/examples/FilemakerWritingExample.java | FilemakerWritingExample.writeToConsole | @SuppressWarnings("Duplicates")
protected static void writeToConsole(FilemakerResultDocument doc) {
LOGGER.info("writing document");
try {
String xml = doc.toXmlString(PRETTY_PRINT);
LOGGER.info(StringUtils.repeat("-", 50)
+ System.lineSeparator() + xml);
... | java | @SuppressWarnings("Duplicates")
protected static void writeToConsole(FilemakerResultDocument doc) {
LOGGER.info("writing document");
try {
String xml = doc.toXmlString(PRETTY_PRINT);
LOGGER.info(StringUtils.repeat("-", 50)
+ System.lineSeparator() + xml);
... | [
"@",
"SuppressWarnings",
"(",
"\"Duplicates\"",
")",
"protected",
"static",
"void",
"writeToConsole",
"(",
"FilemakerResultDocument",
"doc",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"writing document\"",
")",
";",
"try",
"{",
"String",
"xml",
"=",
"doc",
".",
"... | Write a {@link FilemakerResultDocument} into a {@link String} and print the
results to the console.
@param doc the document to write | [
"Write",
"a",
"{",
"@link",
"FilemakerResultDocument",
"}",
"into",
"a",
"{",
"@link",
"String",
"}",
"and",
"print",
"the",
"results",
"to",
"the",
"console",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Examples/src/main/java/org/openestate/io/examples/FilemakerWritingExample.java#L282-L294 | test | Write a document to the console. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("Duplicates")
protected static void writeToConsole(FilemakerResultDocument doc) {
LOGGER.info("writing document");
try {
String xml = doc.toXmlString(PRETTY_PRINT);
LOGGER.info(StringUtils.repeat("-", ... |
Unidata/thredds | tds/src/main/java/thredds/server/config/TdsConfigMapper.java | TdsConfigMapper.getValueFromThreddsConfig | private static String getValueFromThreddsConfig(String key, String alternateKey, String defaultValue) {
String value = ThreddsConfig.get(key, null);
if (value == null && alternateKey != null)
value = ThreddsConfig.get(alternateKey, null);
if (value == null)
value = defaultValue;
return... | java | private static String getValueFromThreddsConfig(String key, String alternateKey, String defaultValue) {
String value = ThreddsConfig.get(key, null);
if (value == null && alternateKey != null)
value = ThreddsConfig.get(alternateKey, null);
if (value == null)
value = defaultValue;
return... | [
"private",
"static",
"String",
"getValueFromThreddsConfig",
"(",
"String",
"key",
",",
"String",
"alternateKey",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"ThreddsConfig",
".",
"get",
"(",
"key",
",",
"null",
")",
";",
"if",
"(",
"valu... | static so can be called from static enum classes | [
"static",
"so",
"can",
"be",
"called",
"from",
"static",
"enum",
"classes"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/server/config/TdsConfigMapper.java#L36-L43 | test | Get the value from the ThreddsConfig | Of course, here is the Java code you requested:
```java
private static String getValueFromThreddsConfig(String key, String alternateKey, String defaultValue) {
String value = ThreddsConfig.get(key, null);
if (value == null && alternateKey != null)
value = ThreddsConfig.get(alternateKey, null);
if... |
OpenEstate/OpenEstate-IO | ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/ObjectFactory.java | ObjectFactory.createVerwaltungsflaeche | @XmlElementDecl(namespace = "http://www.immoxml.de", name = "verwaltungsflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createVerwaltungsflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Verwaltungsflaeche_QNAME, BigDecimal.class, null, value);
} | java | @XmlElementDecl(namespace = "http://www.immoxml.de", name = "verwaltungsflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createVerwaltungsflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Verwaltungsflaeche_QNAME, BigDecimal.class, null, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"http://www.immoxml.de\"",
",",
"name",
"=",
"\"verwaltungsflaeche\"",
")",
"@",
"XmlJavaTypeAdapter",
"(",
"Adapter7",
".",
"class",
")",
"public",
"JAXBElement",
"<",
"BigDecimal",
">",
"createVerwaltungsflaeche",
"(",... | Create an instance of {@link JAXBElement }{@code <}{@link BigDecimal }{@code >}} | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"JAXBElement",
"}",
"{",
"@code",
"<",
"}",
"{",
"@link",
"BigDecimal",
"}",
"{",
"@code",
">",
"}}"
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/ObjectFactory.java#L1519-L1523 | test | Create an instance of a Verwaltungsflaeche feature. | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "http://www.immoxml.de", name = "verwaltungsflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createVerwaltungsflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Verwaltungsflaec... |
real-logic/aeron | aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java | AeronCluster.connect | public static AeronCluster connect(final AeronCluster.Context ctx)
{
Subscription subscription = null;
AsyncConnect asyncConnect = null;
try
{
ctx.conclude();
final Aeron aeron = ctx.aeron();
final long deadlineNs = aeron.context().nanoClock().nan... | java | public static AeronCluster connect(final AeronCluster.Context ctx)
{
Subscription subscription = null;
AsyncConnect asyncConnect = null;
try
{
ctx.conclude();
final Aeron aeron = ctx.aeron();
final long deadlineNs = aeron.context().nanoClock().nan... | [
"public",
"static",
"AeronCluster",
"connect",
"(",
"final",
"AeronCluster",
".",
"Context",
"ctx",
")",
"{",
"Subscription",
"subscription",
"=",
"null",
";",
"AsyncConnect",
"asyncConnect",
"=",
"null",
";",
"try",
"{",
"ctx",
".",
"conclude",
"(",
")",
";... | Connect to the cluster providing {@link Context} for configuration.
@param ctx for configuration.
@return allocated cluster client if the connection is successful. | [
"Connect",
"to",
"the",
"cluster",
"providing",
"{",
"@link",
"Context",
"}",
"for",
"configuration",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java#L96-L136 | test | Connect to a single Aeron cluster. | Of course, here is the Java code you requested:
```java
public static AeronCluster connect(final AeronCluster.Context ctx)
{
Subscription subscription = null;
AsyncConnect asyncConnect = null;
try
{
ctx.conclude();
final Aeron aeron = ctx.aeron();
... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/common/util/OMemory.java | OMemory.fixCommonConfigurationProblems | public static void fixCommonConfigurationProblems() {
long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong();
final int max32BitCacheSize = 512;
if (getJavaBitWidth() == 32 && diskCacheSize > max32BitCacheSize) {
OLogManager.instance()
.infoNoDb(OGlobalConfiguration.clas... | java | public static void fixCommonConfigurationProblems() {
long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong();
final int max32BitCacheSize = 512;
if (getJavaBitWidth() == 32 && diskCacheSize > max32BitCacheSize) {
OLogManager.instance()
.infoNoDb(OGlobalConfiguration.clas... | [
"public",
"static",
"void",
"fixCommonConfigurationProblems",
"(",
")",
"{",
"long",
"diskCacheSize",
"=",
"OGlobalConfiguration",
".",
"DISK_CACHE_SIZE",
".",
"getValueAsLong",
"(",
")",
";",
"final",
"int",
"max32BitCacheSize",
"=",
"512",
";",
"if",
"(",
"getJa... | Tries to fix some common cache/memory configuration problems: <ul> <li>Cache size is larger than direct memory size.</li>
<li>Memory chunk size is larger than cache size.</li> <ul/> | [
"Tries",
"to",
"fix",
"some",
"common",
"cache",
"/",
"memory",
"configuration",
"problems",
":",
"<ul",
">",
"<li",
">",
"Cache",
"size",
"is",
"larger",
"than",
"direct",
"memory",
"size",
".",
"<",
"/",
"li",
">",
"<li",
">",
"Memory",
"chunk",
"siz... | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/common/util/OMemory.java#L73-L83 | test | Fixes the problem that is caused by the common configuration problems. | Of course, here is the Java code you requested:
```java
public static void fixCommonConfigurationProblems() {
long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong();
final int max32BitCacheSize = 512;
if (getJavaBitWidth() == 32 && diskCacheSize > max32BitCacheSize) {
OLogManager... |
js-lib-com/tiny-container | src/main/java/js/servlet/Cookies.java | Cookies.add | public void add(String name, String value) {
Params.notNullOrEmpty(name, "Cookie name");
Params.notNull(value, "Cookie value");
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
httpResponse.addCookie(cookie);
} | java | public void add(String name, String value) {
Params.notNullOrEmpty(name, "Cookie name");
Params.notNull(value, "Cookie value");
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
httpResponse.addCookie(cookie);
} | [
"public",
"void",
"add",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Params",
".",
"notNullOrEmpty",
"(",
"name",
",",
"\"Cookie name\"",
")",
";",
"Params",
".",
"notNull",
"(",
"value",
",",
"\"Cookie value\"",
")",
";",
"Cookie",
"cookie",... | Add cookie to HTTP response of the current request context. Override cookie value if already exists.
@param name cookie name, not null or empty,
@param value cookie value, not null or empty.
@throws IllegalArgumentException if <code>name</code> argument is null or empty.
@throws IllegalArgumentException if <code>value... | [
"Add",
"cookie",
"to",
"HTTP",
"response",
"of",
"the",
"current",
"request",
"context",
".",
"Override",
"cookie",
"value",
"if",
"already",
"exists",
"."
] | ef68deb9ec40b217b4cd2df56d9c5a213dd6b89e | https://github.com/js-lib-com/tiny-container/blob/ef68deb9ec40b217b4cd2df56d9c5a213dd6b89e/src/main/java/js/servlet/Cookies.java#L79-L85 | test | Adds a new Cookie to the response. | Of course, here is the Java code you requested:
```java
public void add(String name, String value) {
Params.notNullOrEmpty(name, "Cookie name");
Params.notNull(value, "Cookie value");
Cookie cookie = new Cookie(name, value);
cookie.setPath("/");
httpResponse.addCookie(cookie);
}
```
Hope this helps! |
google/guice | core/src/com/google/inject/TypeLiteral.java | TypeLiteral.getSupertype | public TypeLiteral<?> getSupertype(Class<?> supertype) {
checkArgument(
supertype.isAssignableFrom(rawType), "%s is not a supertype of %s", supertype, this.type);
return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype));
} | java | public TypeLiteral<?> getSupertype(Class<?> supertype) {
checkArgument(
supertype.isAssignableFrom(rawType), "%s is not a supertype of %s", supertype, this.type);
return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype));
} | [
"public",
"TypeLiteral",
"<",
"?",
">",
"getSupertype",
"(",
"Class",
"<",
"?",
">",
"supertype",
")",
"{",
"checkArgument",
"(",
"supertype",
".",
"isAssignableFrom",
"(",
"rawType",
")",
",",
"\"%s is not a supertype of %s\"",
",",
"supertype",
",",
"this",
... | Returns the generic form of {@code supertype}. For example, if this is {@code
ArrayList<String>}, this returns {@code Iterable<String>} given the input {@code
Iterable.class}.
@param supertype a superclass of, or interface implemented by, this.
@since 2.0 | [
"Returns",
"the",
"generic",
"form",
"of",
"{",
"@code",
"supertype",
"}",
".",
"For",
"example",
"if",
"this",
"is",
"{",
"@code",
"ArrayList<String",
">",
"}",
"this",
"returns",
"{",
"@code",
"Iterable<String",
">",
"}",
"given",
"the",
"input",
"{",
... | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/TypeLiteral.java#L237-L241 | test | Get the supertype of this type. | Of course, here is the Java code you requested:
```java
public TypeLiteral<?> getSupertype(Class<?> supertype) {
checkArgument(
supertype.isAssignableFrom(rawType), "%s is not a supertype of %s", supertype, this.type);
return resolve(MoreTypes.getGenericSupertype(type, rawType, supertype));
}
```
Ho... |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/subsystem/TimerServiceAdd.java | TimerServiceAdd.populateModel | protected void populateModel(ModelNode operation, ModelNode timerServiceModel) throws OperationFailedException {
for (AttributeDefinition attr : TimerServiceResourceDefinition.ATTRIBUTES.values()) {
attr.validateAndSet(operation, timerServiceModel);
}
} | java | protected void populateModel(ModelNode operation, ModelNode timerServiceModel) throws OperationFailedException {
for (AttributeDefinition attr : TimerServiceResourceDefinition.ATTRIBUTES.values()) {
attr.validateAndSet(operation, timerServiceModel);
}
} | [
"protected",
"void",
"populateModel",
"(",
"ModelNode",
"operation",
",",
"ModelNode",
"timerServiceModel",
")",
"throws",
"OperationFailedException",
"{",
"for",
"(",
"AttributeDefinition",
"attr",
":",
"TimerServiceResourceDefinition",
".",
"ATTRIBUTES",
".",
"values",
... | Populate the <code>timerService</code> from the <code>operation</code>
@param operation the operation
@param timerServiceModel strict-max-pool ModelNode
@throws org.jboss.as.controller.OperationFailedException | [
"Populate",
"the",
"<code",
">",
"timerService<",
"/",
"code",
">",
"from",
"the",
"<code",
">",
"operation<",
"/",
"code",
">"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/subsystem/TimerServiceAdd.java#L69-L73 | test | Populate the model with the attributes in the timer service model. | Of course, here is the Java code you requested:
```java
protected void populateModel(ModelNode operation, ModelNode timerServiceModel) throws OperationFailedException {
for (AttributeDefinition attr : TimerServiceResourceDefinition.ATTRIBUTES.values()) {
attr.validateAndSet(operation, timerServiceM... |
lessthanoptimal/GeoRegression | main/src/georegression/struct/line/LineGeneral2D_F64.java | LineGeneral2D_F64.set | public void set(double a, double b, double c) {
this.A = a;
this.B = b;
this.C = c;
} | java | public void set(double a, double b, double c) {
this.A = a;
this.B = b;
this.C = c;
} | [
"public",
"void",
"set",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
")",
"{",
"this",
".",
"A",
"=",
"a",
";",
"this",
".",
"B",
"=",
"b",
";",
"this",
".",
"C",
"=",
"c",
";",
"}"
] | A*x + B*y + C = 0
@param a parameter A
@param b parameter B
@param c parameter C | [
"A",
"*",
"x",
"+",
"B",
"*",
"y",
"+",
"C",
"=",
"0"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/struct/line/LineGeneral2D_F64.java#L91-L95 | test | Sets the values of this Point3D object. | Of course, here is the Java code you requested:
```java
public void set(double a, double b, double c) {
this.A = a;
this.B = b;
this.C = c;
}
```
Hope this helps! |
real-logic/aeron | aeron-driver/src/main/java/io/aeron/driver/PublicationImage.java | PublicationImage.removeSubscriber | public void removeSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition);
subscriberPosition.close();
if (!subscriptionLink.isTether())
{
for (int la... | java | public void removeSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition);
subscriberPosition.close();
if (!subscriptionLink.isTether())
{
for (int la... | [
"public",
"void",
"removeSubscriber",
"(",
"final",
"SubscriptionLink",
"subscriptionLink",
",",
"final",
"ReadablePosition",
"subscriberPosition",
")",
"{",
"subscriberPositions",
"=",
"ArrayUtil",
".",
"remove",
"(",
"subscriberPositions",
",",
"subscriberPosition",
")"... | {@inheritDoc} | [
"{"
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-driver/src/main/java/io/aeron/driver/PublicationImage.java#L316-L332 | test | Remove a subscriber from the source. | Of course, here is the Java code you requested:
```java
public void removeSubscriber(final SubscriptionLink subscriptionLink, final ReadablePosition subscriberPosition)
{
subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition);
subscriberPosition.close();
if (!subsc... |
oblac/jodd | jodd-mail/src/main/java/jodd/mail/CommonEmail.java | CommonEmail.subject | public T subject(final String subject, final String encoding) {
subject(subject);
this.subjectEncoding = encoding;
return _this();
} | java | public T subject(final String subject, final String encoding) {
subject(subject);
this.subjectEncoding = encoding;
return _this();
} | [
"public",
"T",
"subject",
"(",
"final",
"String",
"subject",
",",
"final",
"String",
"encoding",
")",
"{",
"subject",
"(",
"subject",
")",
";",
"this",
".",
"subjectEncoding",
"=",
"encoding",
";",
"return",
"_this",
"(",
")",
";",
"}"
] | Sets message subject with specified encoding to override default platform encoding.
If the subject contains non US-ASCII characters, it will be encoded using the specified charset.
If the subject contains only US-ASCII characters, no encoding is done and it is used as-is.
The application must ensure that the subject do... | [
"Sets",
"message",
"subject",
"with",
"specified",
"encoding",
"to",
"override",
"default",
"platform",
"encoding",
".",
"If",
"the",
"subject",
"contains",
"non",
"US",
"-",
"ASCII",
"characters",
"it",
"will",
"be",
"encoded",
"using",
"the",
"specified",
"c... | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-mail/src/main/java/jodd/mail/CommonEmail.java#L457-L461 | test | Sets the subject. | Of course, here is the Java code you requested:
```java
public T subject(final String subject, final String encoding) {
subject(subject);
this.subjectEncoding = encoding;
return _this();
}
```
Hope this helps! |
sialcasa/mvvmFX | mvvmfx-utils/src/main/java/de/saxsys/mvvmfx/utils/listener/ListenerManager.java | ListenerManager.register | public <T> void register(ObservableValue<T> observable, ChangeListener<? super T> listener) {
if (!simpleChangeListeners.containsKey(observable)) {
this.simpleChangeListeners.put(observable, Collections.newSetFromMap(new WeakHashMap<>()));
}
Set<ChangeListener> observers = this.simpleChangeListeners.get(obs... | java | public <T> void register(ObservableValue<T> observable, ChangeListener<? super T> listener) {
if (!simpleChangeListeners.containsKey(observable)) {
this.simpleChangeListeners.put(observable, Collections.newSetFromMap(new WeakHashMap<>()));
}
Set<ChangeListener> observers = this.simpleChangeListeners.get(obs... | [
"public",
"<",
"T",
">",
"void",
"register",
"(",
"ObservableValue",
"<",
"T",
">",
"observable",
",",
"ChangeListener",
"<",
"?",
"super",
"T",
">",
"listener",
")",
"{",
"if",
"(",
"!",
"simpleChangeListeners",
".",
"containsKey",
"(",
"observable",
")",... | Register the given {@link ChangeListener} to the {@link ObservableValue}. The listener is added to the observable
and will be added for management so it can be cleaned up with the {@link #clean()} method.
@param observable
the observable that the listener is added to.
@param listener
the listener that is registered.
@... | [
"Register",
"the",
"given",
"{",
"@link",
"ChangeListener",
"}",
"to",
"the",
"{",
"@link",
"ObservableValue",
"}",
".",
"The",
"listener",
"is",
"added",
"to",
"the",
"observable",
"and",
"will",
"be",
"added",
"for",
"management",
"so",
"it",
"can",
"be"... | 240566a358a8e01c94c0bbb99228140a69690d02 | https://github.com/sialcasa/mvvmFX/blob/240566a358a8e01c94c0bbb99228140a69690d02/mvvmfx-utils/src/main/java/de/saxsys/mvvmfx/utils/listener/ListenerManager.java#L63-L71 | test | Registers a listener for the specified observable value. | Of course, here is the Java code you requested:
```java
public <T> void register(ObservableValue<T> observable, ChangeListener<? super T> listener) {
if (!simpleChangeListeners.containsKey(observable)) {
this.simpleChangeListeners.put(observable, Collections.newSetFromMap(new WeakHashMap<>()));
}
Set<Chang... |
eiichiro/bootleg | src/main/java/org/eiichiro/bootleg/Responses.java | Responses.json | public static JSONResponse json(Object value) {
JSONResponse response = new JSONResponse();
response.entity(value);
return response;
} | java | public static JSONResponse json(Object value) {
JSONResponse response = new JSONResponse();
response.entity(value);
return response;
} | [
"public",
"static",
"JSONResponse",
"json",
"(",
"Object",
"value",
")",
"{",
"JSONResponse",
"response",
"=",
"new",
"JSONResponse",
"(",
")",
";",
"response",
".",
"entity",
"(",
"value",
")",
";",
"return",
"response",
";",
"}"
] | Creates {@code JSONResponse} to send the specified entity to the client
as JSON format response.
@param value The object to be sent to the client.
@return {@code JSONResponse}. | [
"Creates",
"{",
"@code",
"JSONResponse",
"}",
"to",
"send",
"the",
"specified",
"entity",
"to",
"the",
"client",
"as",
"JSON",
"format",
"response",
"."
] | b98a108500597cb6185056be2eef7de5ba1963d2 | https://github.com/eiichiro/bootleg/blob/b98a108500597cb6185056be2eef7de5ba1963d2/src/main/java/org/eiichiro/bootleg/Responses.java#L83-L87 | test | Creates a JSONResponse object with the specified entity value. | Of course, here is the Java code you requested:
```java
public static JSONResponse json(Object value) {
JSONResponse response = new JSONResponse();
response.entity(value);
return response;
}
```
Hope this helps! |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/db/metadata/GeometryMetadataDataSource.java | GeometryMetadataDataSource.query | public Cursor query(long geoPackageId, String tableName, GeometryEnvelope envelope) {
StringBuilder selection = new StringBuilder();
selection.append(GeometryMetadata.COLUMN_GEOPACKAGE_ID).append(" = ? AND ")
.append(GeometryMetadata.COLUMN_TABLE_NAME).append(" = ?");
selection.a... | java | public Cursor query(long geoPackageId, String tableName, GeometryEnvelope envelope) {
StringBuilder selection = new StringBuilder();
selection.append(GeometryMetadata.COLUMN_GEOPACKAGE_ID).append(" = ? AND ")
.append(GeometryMetadata.COLUMN_TABLE_NAME).append(" = ?");
selection.a... | [
"public",
"Cursor",
"query",
"(",
"long",
"geoPackageId",
",",
"String",
"tableName",
",",
"GeometryEnvelope",
"envelope",
")",
"{",
"StringBuilder",
"selection",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"selection",
".",
"append",
"(",
"GeometryMetadata",
".... | Query for all table geometry metadata matching the envelope
@param geoPackageId GeoPackage id
@param tableName table name
@param envelope geometry envelope
@return cursor that must be closed | [
"Query",
"for",
"all",
"table",
"geometry",
"metadata",
"matching",
"the",
"envelope"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/db/metadata/GeometryMetadataDataSource.java#L547-L596 | test | Query for the records in the GeometryStore. | Of course, here is the Java code you requested:
```java
public Cursor query(long geoPackageId, String tableName, GeometryEnvelope envelope) {
StringBuilder selection = new StringBuilder();
selection.append(GeometryMetadata.COLUMN_GEOPACKAGE_ID).append(" = ? AND ")
.append(GeometryMetada... |
wildfly/wildfly | clustering/common/src/main/java/org/jboss/as/clustering/controller/Operations.java | Operations.createReadAttributeOperation | public static ModelNode createReadAttributeOperation(PathAddress address, Attribute attribute) {
return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, attribute);
} | java | public static ModelNode createReadAttributeOperation(PathAddress address, Attribute attribute) {
return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, attribute);
} | [
"public",
"static",
"ModelNode",
"createReadAttributeOperation",
"(",
"PathAddress",
"address",
",",
"Attribute",
"attribute",
")",
"{",
"return",
"createAttributeOperation",
"(",
"ModelDescriptionConstants",
".",
"READ_ATTRIBUTE_OPERATION",
",",
"address",
",",
"attribute"... | Creates a read-attribute operation using the specified address and name.
@param address a resource path
@param attribute an attribute
@return a read-attribute operation | [
"Creates",
"a",
"read",
"-",
"attribute",
"operation",
"using",
"the",
"specified",
"address",
"and",
"name",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/clustering/common/src/main/java/org/jboss/as/clustering/controller/Operations.java#L170-L172 | test | Create a read attribute operation. | Of course, here is the Java code you requested:
```java
public static ModelNode createReadAttributeOperation(PathAddress address, Attribute attribute) {
return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, attribute);
}
```
Hope this helps! |
oblac/jodd | jodd-core/src/main/java/jodd/net/URLCoder.java | URLCoder.encodePath | public static String encodePath(final String path, final String encoding) {
return encodeUriComponent(path, encoding, URIPart.PATH);
} | java | public static String encodePath(final String path, final String encoding) {
return encodeUriComponent(path, encoding, URIPart.PATH);
} | [
"public",
"static",
"String",
"encodePath",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"encoding",
")",
"{",
"return",
"encodeUriComponent",
"(",
"path",
",",
"encoding",
",",
"URIPart",
".",
"PATH",
")",
";",
"}"
] | Encodes the given URI path with the given encoding. | [
"Encodes",
"the",
"given",
"URI",
"path",
"with",
"the",
"given",
"encoding",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/net/URLCoder.java#L290-L292 | test | Encodes the given path with the given encoding. | Of course, here is the Java code you requested:
```java
public static String encodePath(final String path, final String encoding) {
return encodeUriComponent(path, encoding, URIPart.PATH);
}
```
Hope this helps! |
real-logic/aeron | aeron-cluster/src/main/java/io/aeron/cluster/ClusterMember.java | ClusterMember.isQuorumCandidate | public static boolean isQuorumCandidate(final ClusterMember[] clusterMembers, final ClusterMember candidate)
{
int possibleVotes = 0;
for (final ClusterMember member : clusterMembers)
{
if (NULL_POSITION == member.logPosition || compareLog(candidate, member) < 0)
{
... | java | public static boolean isQuorumCandidate(final ClusterMember[] clusterMembers, final ClusterMember candidate)
{
int possibleVotes = 0;
for (final ClusterMember member : clusterMembers)
{
if (NULL_POSITION == member.logPosition || compareLog(candidate, member) < 0)
{
... | [
"public",
"static",
"boolean",
"isQuorumCandidate",
"(",
"final",
"ClusterMember",
"[",
"]",
"clusterMembers",
",",
"final",
"ClusterMember",
"candidate",
")",
"{",
"int",
"possibleVotes",
"=",
"0",
";",
"for",
"(",
"final",
"ClusterMember",
"member",
":",
"clus... | Has the member achieved a quorum view to be a suitable candidate in an election.
@param clusterMembers to compare the candidate against.
@param candidate for leadership.
@return true if the candidate is suitable otherwise false. | [
"Has",
"the",
"member",
"achieved",
"a",
"quorum",
"view",
"to",
"be",
"a",
"suitable",
"candidate",
"in",
"an",
"election",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-cluster/src/main/java/io/aeron/cluster/ClusterMember.java#L971-L985 | test | Checks if a candidate is a quorum candidate. | Of course, here is the Java code you requested:
```java
public static boolean isQuorumCandidate(final ClusterMember[] clusterMembers, final ClusterMember candidate)
{
int possibleVotes = 0;
for (final ClusterMember member : clusterMembers)
{
if (NULL_POSITION == member.logPositi... |
streamsets/datacollector | container/src/main/java/com/streamsets/datacollector/definition/ConfigDefinitionExtractor.java | ConfigDefinitionExtractor.verifyDependencyExists | private void verifyDependencyExists(
Map<String, ConfigDefinition> definitionsMap,
ConfigDefinition def,
String dependsOnKey,
Object contextMsg
) {
Preconditions.checkState(definitionsMap.containsKey(dependsOnKey),
Utils.format("Error while processing {} ConfigDef='{}'. Dependency=... | java | private void verifyDependencyExists(
Map<String, ConfigDefinition> definitionsMap,
ConfigDefinition def,
String dependsOnKey,
Object contextMsg
) {
Preconditions.checkState(definitionsMap.containsKey(dependsOnKey),
Utils.format("Error while processing {} ConfigDef='{}'. Dependency=... | [
"private",
"void",
"verifyDependencyExists",
"(",
"Map",
"<",
"String",
",",
"ConfigDefinition",
">",
"definitionsMap",
",",
"ConfigDefinition",
"def",
",",
"String",
"dependsOnKey",
",",
"Object",
"contextMsg",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"... | Verify that the config definition's dependency actually maps to a valid config definition | [
"Verify",
"that",
"the",
"config",
"definition",
"s",
"dependency",
"actually",
"maps",
"to",
"a",
"valid",
"config",
"definition"
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/container/src/main/java/com/streamsets/datacollector/definition/ConfigDefinitionExtractor.java#L343-L352 | test | Verify that the dependency exists in the context message. | Of course, here is the Java code you requested:
```java
private void verifyDependencyExists(
Map<String, ConfigDefinition> definitionsMap,
ConfigDefinition def,
String dependsOnKey,
Object contextMsg
) {
Preconditions.checkState(definitionsMap.containsKey(dependsOnKey),
Utils.form... |
Unidata/thredds | cdm/src/main/java/ucar/unidata/geoloc/projection/AlbersEqualArea.java | AlbersEqualArea.main | public static void main(String[] args) {
AlbersEqualArea a = new AlbersEqualArea(23, -96, 29.5, 45.5);
System.out.printf("name=%s%n", a.getName());
System.out.println("ll = 35N 75W");
ProjectionPoint p = a.latLonToProj(35, -75);
System.out.println("proj point = " + p);
LatLonPoint ll = a.p... | java | public static void main(String[] args) {
AlbersEqualArea a = new AlbersEqualArea(23, -96, 29.5, 45.5);
System.out.printf("name=%s%n", a.getName());
System.out.println("ll = 35N 75W");
ProjectionPoint p = a.latLonToProj(35, -75);
System.out.println("proj point = " + p);
LatLonPoint ll = a.p... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"AlbersEqualArea",
"a",
"=",
"new",
"AlbersEqualArea",
"(",
"23",
",",
"-",
"96",
",",
"29.5",
",",
"45.5",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"name=%s%... | Test
@param args not used | [
"Test"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/geoloc/projection/AlbersEqualArea.java#L697-L705 | test | Example of the
class. | Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
AlbersEqualArea a = new AlbersEqualArea(23, -96, 29.5, 45.5);
System.out.printf("name=%s%n", a.getName());
System.out.println("ll = 35N 75W");
ProjectionPoint p = a.latLonToProj(35, -75);
System.ou... |
wildfly/wildfly | naming/src/main/java/org/jboss/as/naming/NamingContext.java | NamingContext.unbind | public void unbind(final Name name) throws NamingException {
check(name, JndiPermission.ACTION_UNBIND);
if(namingStore instanceof WritableNamingStore) {
final Name absoluteName = getAbsoluteName(name);
getWritableNamingStore().unbind(absoluteName);
} else {
t... | java | public void unbind(final Name name) throws NamingException {
check(name, JndiPermission.ACTION_UNBIND);
if(namingStore instanceof WritableNamingStore) {
final Name absoluteName = getAbsoluteName(name);
getWritableNamingStore().unbind(absoluteName);
} else {
t... | [
"public",
"void",
"unbind",
"(",
"final",
"Name",
"name",
")",
"throws",
"NamingException",
"{",
"check",
"(",
"name",
",",
"JndiPermission",
".",
"ACTION_UNBIND",
")",
";",
"if",
"(",
"namingStore",
"instanceof",
"WritableNamingStore",
")",
"{",
"final",
"Nam... | {@inheritDoc} | [
"{"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/naming/src/main/java/org/jboss/as/naming/NamingContext.java#L313-L322 | test | Unbind a named object from the context. | Of course, here is the Java code you requested:
```java
public void unbind(final Name name) throws NamingException {
check(name, JndiPermission.ACTION_UNBIND);
if(namingStore instanceof WritableNamingStore) {
final Name absoluteName = getAbsoluteName(name);
getWritableNamingSto... |
oblac/jodd | jodd-madvoc/src/main/java/jodd/madvoc/config/Routes.java | Routes.buildActionPathMacros | public PathMacros buildActionPathMacros(final String actionPath) {
if (actionPath.isEmpty()) {
return null;
}
PathMacros pathMacros = createPathMacroInstance();
if (!pathMacros.init(actionPath, actionsManager.getPathMacroSeparators())) {
return null;
}
return pathMacros;
} | java | public PathMacros buildActionPathMacros(final String actionPath) {
if (actionPath.isEmpty()) {
return null;
}
PathMacros pathMacros = createPathMacroInstance();
if (!pathMacros.init(actionPath, actionsManager.getPathMacroSeparators())) {
return null;
}
return pathMacros;
} | [
"public",
"PathMacros",
"buildActionPathMacros",
"(",
"final",
"String",
"actionPath",
")",
"{",
"if",
"(",
"actionPath",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"PathMacros",
"pathMacros",
"=",
"createPathMacroInstance",
"(",
")",
";",... | Builds {@link PathMacros action path macros} from given action
path chunks. Returns either <code>null</code>, if
no action path contains no macros, or instance of the <code>PathMacro</code>
implementations. | [
"Builds",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-madvoc/src/main/java/jodd/madvoc/config/Routes.java#L210-L222 | test | Build the path macros for the given action path. | Of course, here is the Java code you requested:
```java
public PathMacros buildActionPathMacros(final String actionPath) {
if (actionPath.isEmpty()) {
return null;
}
PathMacros pathMacros = createPathMacroInstance();
if (!pathMacros.init(actionPath, actionsManager.getPathMacroSeparators())) {
return nu... |
Unidata/thredds | grib/src/main/java/ucar/nc2/grib/grib2/Grib2Utils.java | Grib2Utils.getLatLon2DcoordType | @Nullable
public static LatLon2DCoord getLatLon2DcoordType(int discipline, int category, int parameter) {
if ((discipline != 0) || (category != 2) || (parameter < 198 || parameter > 203)) return null;
switch (parameter) {
case 198:
return LatLon2DCoord.U_Latitude;
case 199:
... | java | @Nullable
public static LatLon2DCoord getLatLon2DcoordType(int discipline, int category, int parameter) {
if ((discipline != 0) || (category != 2) || (parameter < 198 || parameter > 203)) return null;
switch (parameter) {
case 198:
return LatLon2DCoord.U_Latitude;
case 199:
... | [
"@",
"Nullable",
"public",
"static",
"LatLon2DCoord",
"getLatLon2DcoordType",
"(",
"int",
"discipline",
",",
"int",
"category",
",",
"int",
"parameter",
")",
"{",
"if",
"(",
"(",
"discipline",
"!=",
"0",
")",
"||",
"(",
"category",
"!=",
"2",
")",
"||",
... | isLatLon2D is true, check parameter to see if its a 2D lat/lon coordinate | [
"isLatLon2D",
"is",
"true",
"check",
"parameter",
"to",
"see",
"if",
"its",
"a",
"2D",
"lat",
"/",
"lon",
"coordinate"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/grib/src/main/java/ucar/nc2/grib/grib2/Grib2Utils.java#L115-L133 | test | Returns the type of the
feature. | Of course, here is the Java code you requested:
```java
@Nullable
public static LatLon2DCoord getLatLon2DcoordType(int discipline, int category, int parameter) {
if ((discipline != 0) || (category != 2) || (parameter < 198 || parameter > 203)) return null;
switch (parameter) {
case 198:
re... |
AlejandroRivera/embedded-rabbitmq | src/main/java/io/arivera/oss/embedded/rabbitmq/EmbeddedRabbitMqConfig.java | EmbeddedRabbitMqConfig.getRabbitMqPort | public int getRabbitMqPort() {
String portValue = this.envVars.get(RabbitMqEnvVar.NODE_PORT.getEnvVarName());
if (portValue == null) {
return RabbitMqEnvVar.DEFAULT_NODE_PORT;
} else {
return Integer.parseInt(portValue);
}
} | java | public int getRabbitMqPort() {
String portValue = this.envVars.get(RabbitMqEnvVar.NODE_PORT.getEnvVarName());
if (portValue == null) {
return RabbitMqEnvVar.DEFAULT_NODE_PORT;
} else {
return Integer.parseInt(portValue);
}
} | [
"public",
"int",
"getRabbitMqPort",
"(",
")",
"{",
"String",
"portValue",
"=",
"this",
".",
"envVars",
".",
"get",
"(",
"RabbitMqEnvVar",
".",
"NODE_PORT",
".",
"getEnvVarName",
"(",
")",
")",
";",
"if",
"(",
"portValue",
"==",
"null",
")",
"{",
"return"... | Returns the RabbitMQ node port as defined by the {@link #envVars} or the default port if not defined.
<p>
This method will return the correct port even if the {@link Builder#randomPort()} method was used. | [
"Returns",
"the",
"RabbitMQ",
"node",
"port",
"as",
"defined",
"by",
"the",
"{"
] | b9dc6e0a1b7eabf16bf5a573d0d6bf4d536f0a46 | https://github.com/AlejandroRivera/embedded-rabbitmq/blob/b9dc6e0a1b7eabf16bf5a573d0d6bf4d536f0a46/src/main/java/io/arivera/oss/embedded/rabbitmq/EmbeddedRabbitMqConfig.java#L148-L155 | test | Get the value of the node port environment variable. | Of course, here is the Java code you requested:
```java
public int getRabbitMqPort() {
String portValue = this.envVars.get(RabbitMqEnvVar.NODE_PORT.getEnvVarName());
if (portValue == null) {
return RabbitMqEnvVar.DEFAULT_NODE_PORT;
} else {
return Integer.parseInt(portValue);
}
}
```
Hop... |
oblac/jodd | jodd-madvoc/src/main/java/jodd/madvoc/interceptor/ServletConfigInterceptor.java | ServletConfigInterceptor.outject | protected void outject(final ActionRequest actionRequest) {
final Targets targets = actionRequest.getTargets();
scopeResolver.forEachScope(madvocScope -> madvocScope.outject(actionRequest, targets));
} | java | protected void outject(final ActionRequest actionRequest) {
final Targets targets = actionRequest.getTargets();
scopeResolver.forEachScope(madvocScope -> madvocScope.outject(actionRequest, targets));
} | [
"protected",
"void",
"outject",
"(",
"final",
"ActionRequest",
"actionRequest",
")",
"{",
"final",
"Targets",
"targets",
"=",
"actionRequest",
".",
"getTargets",
"(",
")",
";",
"scopeResolver",
".",
"forEachScope",
"(",
"madvocScope",
"->",
"madvocScope",
".",
"... | Performs outjection. | [
"Performs",
"outjection",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-madvoc/src/main/java/jodd/madvoc/interceptor/ServletConfigInterceptor.java#L101-L105 | test | Outjects the action request. | Of course, here is the Java code you requested:
```java
protected void outject(final ActionRequest actionRequest) {
final Targets targets = actionRequest.getTargets();
scopeResolver.forEachScope(madvocScope -> madvocScope.outject(actionRequest, targets));
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | ImmobiliareIT/src/main/jaxb/org/openestate/io/immobiliare_it/xml/LocationStructure.java | LocationStructure.setLocality | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11")
public void setLocality(LocationStructure.Locality value) {
this.locality = value;
} | java | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11")
public void setLocality(LocationStructure.Locality value) {
this.locality = value;
} | [
"@",
"Generated",
"(",
"value",
"=",
"\"com.sun.tools.xjc.Driver\"",
",",
"date",
"=",
"\"2018-10-12T02:48:12+02:00\"",
",",
"comments",
"=",
"\"JAXB RI v2.2.11\"",
")",
"public",
"void",
"setLocality",
"(",
"LocationStructure",
".",
"Locality",
"value",
")",
"{",
"... | Sets the value of the locality property.
@param value
allowed object is
{@link LocationStructure.Locality } | [
"Sets",
"the",
"value",
"of",
"the",
"locality",
"property",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/ImmobiliareIT/src/main/jaxb/org/openestate/io/immobiliare_it/xml/LocationStructure.java#L270-L273 | test | Sets the value of the locality property. | Of course, here is the Java code you requested:
```java
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11")
public void setLocality(LocationStructure.Locality value) {
this.locality = value;
}
```
Hope this helps! |
ReactiveX/RxJava | src/main/java/io/reactivex/Maybe.java | Maybe.concatMap | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Maybe<R> concatMap(Function<? super T, ? extends MaybeSource<? extends R>> mapper) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
return RxJavaPlugins.onAssembly(new MaybeFlatten<T, R>(this, mapper... | java | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Maybe<R> concatMap(Function<? super T, ? extends MaybeSource<? extends R>> mapper) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
return RxJavaPlugins.onAssembly(new MaybeFlatten<T, R>(this, mapper... | [
"@",
"CheckReturnValue",
"@",
"NonNull",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"R",
">",
"Maybe",
"<",
"R",
">",
"concatMap",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"MaybeSource",... | Returns a Maybe that is based on applying a specified function to the item emitted by the source Maybe,
where that function returns a MaybeSource.
<p>
<img width="640" height="356" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.flatMap.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code... | [
"Returns",
"a",
"Maybe",
"that",
"is",
"based",
"on",
"applying",
"a",
"specified",
"function",
"to",
"the",
"item",
"emitted",
"by",
"the",
"source",
"Maybe",
"where",
"that",
"function",
"returns",
"a",
"MaybeSource",
".",
"<p",
">",
"<img",
"width",
"="... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Maybe.java#L2432-L2438 | test | Concatenates this Maybe with the results of applying the given function to each element of the Maybe. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Maybe<R> concatMap(Function<? super T, ? extends MaybeSource<? extends R>> mapper) {
ObjectHelper.requireNonNull(mapper, "mapper is null");
return RxJ... |
snakerflow/snakerflow | snaker-core/src/main/java/org/snaker/engine/helper/XmlHelper.java | XmlHelper.elements | public static List<Element> elements(Element element, String tagName) {
if (element == null || !element.hasChildNodes()) {
return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
if (c... | java | public static List<Element> elements(Element element, String tagName) {
if (element == null || !element.hasChildNodes()) {
return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
if (c... | [
"public",
"static",
"List",
"<",
"Element",
">",
"elements",
"(",
"Element",
"element",
",",
"String",
"tagName",
")",
"{",
"if",
"(",
"element",
"==",
"null",
"||",
"!",
"element",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"return",
"Collections",
".",
... | 从element元素查找所有tagName指定的子节点元素集合
@param element
@param tagName
@return | [
"从element元素查找所有tagName指定的子节点元素集合"
] | 9c8cb3148a76702f1eda22f1d113053cb44b1eff | https://github.com/snakerflow/snakerflow/blob/9c8cb3148a76702f1eda22f1d113053cb44b1eff/snaker-core/src/main/java/org/snaker/engine/helper/XmlHelper.java#L65-L80 | test | Gets the elements of the given element whose tag name is the given tag name. | Of course, here is the Java code you requested:
```java
public static List<Element> elements(Element element, String tagName) {
if (element == null || !element.hasChildNodes()) {
return Collections.emptyList();
}
List<Element> elements = new ArrayList<Element>();
for (Node child = element.getFirstChild(); ... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/grib/Grib2ReportPanel.java | Grib2ReportPanel.doLocalUseSection | private void doLocalUseSection(Formatter f, MCollection dcm, boolean useIndex) throws IOException {
f.format("Show Local Use Section%n");
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath());
doLocalUseSection(mfile, f, useIndex);
}
} | java | private void doLocalUseSection(Formatter f, MCollection dcm, boolean useIndex) throws IOException {
f.format("Show Local Use Section%n");
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath());
doLocalUseSection(mfile, f, useIndex);
}
} | [
"private",
"void",
"doLocalUseSection",
"(",
"Formatter",
"f",
",",
"MCollection",
"dcm",
",",
"boolean",
"useIndex",
")",
"throws",
"IOException",
"{",
"f",
".",
"format",
"(",
"\"Show Local Use Section%n\"",
")",
";",
"for",
"(",
"MFile",
"mfile",
":",
"dcm"... | ///////////////////////////////////////////// | [
"/////////////////////////////////////////////"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/grib/Grib2ReportPanel.java#L346-L353 | test | Show Local Use Section | Of course, here is the Java code you requested:
```java
private void doLocalUseSection(Formatter f, MCollection dcm, boolean useIndex) throws IOException {
f.format("Show Local Use Section%n");
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath());
doLocalUseSection(mfile, ... |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java | Parser.parseGetProperty | private void parseGetProperty(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
reader.skipSpaces();
Node getPropertyNode = new Node.GetProperty( attrs, start, parent );
parseOptionalBody(getPropertyNode, "jsp:getProperty",
TagInfo.BODY_CONTENT_EMPTY);
} | java | private void parseGetProperty(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
reader.skipSpaces();
Node getPropertyNode = new Node.GetProperty( attrs, start, parent );
parseOptionalBody(getPropertyNode, "jsp:getProperty",
TagInfo.BODY_CONTENT_EMPTY);
} | [
"private",
"void",
"parseGetProperty",
"(",
"Node",
"parent",
")",
"throws",
"JasperException",
"{",
"Attributes",
"attrs",
"=",
"parseAttributes",
"(",
")",
";",
"reader",
".",
"skipSpaces",
"(",
")",
";",
"Node",
"getPropertyNode",
"=",
"new",
"Node",
".",
... | /*
For GetProperty:
StdActionContent ::= Attributes EmptyBody | [
"/",
"*",
"For",
"GetProperty",
":",
"StdActionContent",
"::",
"=",
"Attributes",
"EmptyBody"
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/Parser.java#L1042-L1050 | test | Parse a getProperty tag. | Of course, here is the Java code you requested:
```java
private void parseGetProperty(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
reader.skipSpaces();
Node getPropertyNode = new Node.GetProperty( attrs, start, parent );
parseOptionalBody(getPropertyNode, "jsp... |
wildfly/wildfly | iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/naming/CorbaNamingContext.java | CorbaNamingContext.init | public void init(POA poa, boolean doPurge, boolean noPing) {
this.poa = poa;
this.doPurge = doPurge;
this.noPing = noPing;
} | java | public void init(POA poa, boolean doPurge, boolean noPing) {
this.poa = poa;
this.doPurge = doPurge;
this.noPing = noPing;
} | [
"public",
"void",
"init",
"(",
"POA",
"poa",
",",
"boolean",
"doPurge",
",",
"boolean",
"noPing",
")",
"{",
"this",
".",
"poa",
"=",
"poa",
";",
"this",
".",
"doPurge",
"=",
"doPurge",
";",
"this",
".",
"noPing",
"=",
"noPing",
";",
"}"
] | <p>
This method needs to be called for each newly created or re-read naming context to set its POA.
</p>
@param poa a reference to the Naming Service {@code POA}.
@param doPurge a boolean that indicates if dead objects should be purged from the context ({@code true}) upon cleanup
or not ({@code false}).
@param noP... | [
"<p",
">",
"This",
"method",
"needs",
"to",
"be",
"called",
"for",
"each",
"newly",
"created",
"or",
"re",
"-",
"read",
"naming",
"context",
"to",
"set",
"its",
"POA",
".",
"<",
"/",
"p",
">"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/naming/CorbaNamingContext.java#L135-L139 | test | Initialize the object. | Of course, here is the Java code you requested:
```java
public void init(POA poa, boolean doPurge, boolean noPing) {
this.poa = poa;
this.doPurge = doPurge;
this.noPing = noPing;
}
```
Hope this helps! |
apache/parquet-mr | parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java | ParquetFileReader.readFooter | public static ParquetMetadata readFooter(Configuration configuration, Path file, MetadataFilter filter) throws IOException {
return readFooter(HadoopInputFile.fromPath(file, configuration), filter);
} | java | public static ParquetMetadata readFooter(Configuration configuration, Path file, MetadataFilter filter) throws IOException {
return readFooter(HadoopInputFile.fromPath(file, configuration), filter);
} | [
"public",
"static",
"ParquetMetadata",
"readFooter",
"(",
"Configuration",
"configuration",
",",
"Path",
"file",
",",
"MetadataFilter",
"filter",
")",
"throws",
"IOException",
"{",
"return",
"readFooter",
"(",
"HadoopInputFile",
".",
"fromPath",
"(",
"file",
",",
... | Reads the meta data in the footer of the file.
Skipping row groups (or not) based on the provided filter
@param configuration a configuration
@param file the Parquet File
@param filter the filter to apply to row groups
@return the metadata with row groups filtered.
@throws IOException if an error occurs while reading ... | [
"Reads",
"the",
"meta",
"data",
"in",
"the",
"footer",
"of",
"the",
"file",
".",
"Skipping",
"row",
"groups",
"(",
"or",
"not",
")",
"based",
"on",
"the",
"provided",
"filter"
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java#L457-L459 | test | Read a Parquet file with a footer. | Of course, here is the Java code you requested:
```java
public static ParquetMetadata readFooter(Configuration configuration, Path file, MetadataFilter filter) throws IOException {
return readFooter(HadoopInputFile.fromPath(file, configuration), filter);
}
```
Hope this helps! |
1gravity/Android-RTEditor | RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java | IOUtils.write | public static void write(byte[] data, Writer output, Charset encoding) throws IOException {
if (data != null) {
output.write(new String(data, Charsets.toCharset(encoding)));
}
} | java | public static void write(byte[] data, Writer output, Charset encoding) throws IOException {
if (data != null) {
output.write(new String(data, Charsets.toCharset(encoding)));
}
} | [
"public",
"static",
"void",
"write",
"(",
"byte",
"[",
"]",
"data",
",",
"Writer",
"output",
",",
"Charset",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"output",
".",
"write",
"(",
"new",
"String",
"(",
... | Writes bytes from a <code>byte[]</code> to chars on a <code>Writer</code>
using the specified character encoding.
<p/>
This method uses {@link String#String(byte[], String)}.
@param data the byte array to write, do not modify during output,
null ignored
@param output the <code>Writer</code> to write to
@param en... | [
"Writes",
"bytes",
"from",
"a",
"<code",
">",
"byte",
"[]",
"<",
"/",
"code",
">",
"to",
"chars",
"on",
"a",
"<code",
">",
"Writer<",
"/",
"code",
">",
"using",
"the",
"specified",
"character",
"encoding",
".",
"<p",
"/",
">",
"This",
"method",
"uses... | 9d8fb4bb865b3b3d011e7633afedcdfb8d21754f | https://github.com/1gravity/Android-RTEditor/blob/9d8fb4bb865b3b3d011e7633afedcdfb8d21754f/RTEditor/src/main/java/com/onegravity/rteditor/utils/io/IOUtils.java#L1266-L1270 | test | Write a byte array to a Writer using the specified encoding. | Of course, here is the Java code you requested:
```java
public static void write(byte[] data, Writer output, Charset encoding) throws IOException {
if (data != null) {
output.write(new String(data, Charsets.toCharset(encoding)));
}
}
```
Hope this helps! |
Koekiebox-PTY-LTD/Fluid | fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/sqlutil/SQLUtilWebSocketGetDescendantsClient.java | SQLUtilWebSocketGetDescendantsClient.getDescendantsSynchronized | public List<FormListing> getDescendantsSynchronized(
Form ... formToGetDescendantsForParam) {
if(formToGetDescendantsForParam == null ||
formToGetDescendantsForParam.length == 0) {
return null;
}
//Start a new request...
String uniqueReqId = this.initNewRequest();
//Mass data fetch...
int numbe... | java | public List<FormListing> getDescendantsSynchronized(
Form ... formToGetDescendantsForParam) {
if(formToGetDescendantsForParam == null ||
formToGetDescendantsForParam.length == 0) {
return null;
}
//Start a new request...
String uniqueReqId = this.initNewRequest();
//Mass data fetch...
int numbe... | [
"public",
"List",
"<",
"FormListing",
">",
"getDescendantsSynchronized",
"(",
"Form",
"...",
"formToGetDescendantsForParam",
")",
"{",
"if",
"(",
"formToGetDescendantsForParam",
"==",
"null",
"||",
"formToGetDescendantsForParam",
".",
"length",
"==",
"0",
")",
"{",
... | Retrieves all the Descendants (Forms) for the {@code formToGetTableFormsForParam}.
@param formToGetDescendantsForParam The Fluid Form to get Descendants for.
@return The {@code formToGetDescendantsForParam} Descendants as {@code Form}'s. | [
"Retrieves",
"all",
"the",
"Descendants",
"(",
"Forms",
")",
"for",
"the",
"{",
"@code",
"formToGetTableFormsForParam",
"}",
"."
] | 81153d865f71b84ca933532c7115717bc3979270 | https://github.com/Koekiebox-PTY-LTD/Fluid/blob/81153d865f71b84ca933532c7115717bc3979270/fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/sqlutil/SQLUtilWebSocketGetDescendantsClient.java#L138-L229 | test | Get a list of descendants for a form. | Of course, here is the Java code you requested:
```java
public List<FormListing> getDescendantsSynchronized(
Form ... formToGetDescendantsForParam) {
if(formToGetDescendantsForParam == null ||
formToGetDescendantsForParam.length == 0) {
return null;
}
//Start a new request...
String uniqueReqId = t... |
sialcasa/mvvmFX | mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java | ModelWrapper.field | public StringProperty field(String identifier, StringGetter<M> getter, StringSetter<M> setter) {
return addIdentified(identifier, new BeanPropertyField<>(this::propertyWasChanged, getter, setter,
() -> new SimpleStringProperty(null, identifier)));
} | java | public StringProperty field(String identifier, StringGetter<M> getter, StringSetter<M> setter) {
return addIdentified(identifier, new BeanPropertyField<>(this::propertyWasChanged, getter, setter,
() -> new SimpleStringProperty(null, identifier)));
} | [
"public",
"StringProperty",
"field",
"(",
"String",
"identifier",
",",
"StringGetter",
"<",
"M",
">",
"getter",
",",
"StringSetter",
"<",
"M",
">",
"setter",
")",
"{",
"return",
"addIdentified",
"(",
"identifier",
",",
"new",
"BeanPropertyField",
"<>",
"(",
... | Add a new field of type String to this instance of the wrapper. See {@link #field(StringGetter, StringSetter)}.
This method additionally takes a string identifier as first parameter.
<p/>
This identifier is used to return the same property instance even when the method is invoked multiple times.
@param identifier
an i... | [
"Add",
"a",
"new",
"field",
"of",
"type",
"String",
"to",
"this",
"instance",
"of",
"the",
"wrapper",
".",
"See",
"{",
"@link",
"#field",
"(",
"StringGetter",
"StringSetter",
")",
"}",
".",
"This",
"method",
"additionally",
"takes",
"a",
"string",
"identif... | 240566a358a8e01c94c0bbb99228140a69690d02 | https://github.com/sialcasa/mvvmFX/blob/240566a358a8e01c94c0bbb99228140a69690d02/mvvmfx/src/main/java/de/saxsys/mvvmfx/utils/mapping/ModelWrapper.java#L814-L817 | test | Adds a field to this BeanProperty. The field will be assigned the given getter and setter. | Of course, here is the Java code you requested:
```java
public StringProperty field(String identifier, StringGetter<M> getter, StringSetter<M> setter) {
return addIdentified(identifier, new BeanPropertyField<>(this::propertyWasChanged, getter, setter,
() -> new SimpleStringProperty(null, identifier)));
}
```
H... |
Unidata/thredds | cdm/src/main/java/ucar/atd/dorade/DoradePARM.java | DoradePARM.uncompressHRD | private short[] uncompressHRD(byte[] compressedData, int nCells)
throws DescriptorException {
short[] svalues = new short[nCells];
int cPos = 0; // position in the compressed data, in bytes
int nextCell = 0;
int runLength;
for (;; nextCell += runLength) {
... | java | private short[] uncompressHRD(byte[] compressedData, int nCells)
throws DescriptorException {
short[] svalues = new short[nCells];
int cPos = 0; // position in the compressed data, in bytes
int nextCell = 0;
int runLength;
for (;; nextCell += runLength) {
... | [
"private",
"short",
"[",
"]",
"uncompressHRD",
"(",
"byte",
"[",
"]",
"compressedData",
",",
"int",
"nCells",
")",
"throws",
"DescriptorException",
"{",
"short",
"[",
"]",
"svalues",
"=",
"new",
"short",
"[",
"nCells",
"]",
";",
"int",
"cPos",
"=",
"0",
... | Unpack MIT/HRD-compressed data into an array of exactly nCells shorts.
@param compressedData the raw HRD-compressed data array
@return an array of nCells unpacked short values
@throws DescriptorException | [
"Unpack",
"MIT",
"/",
"HRD",
"-",
"compressed",
"data",
"into",
"an",
"array",
"of",
"exactly",
"nCells",
"shorts",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/atd/dorade/DoradePARM.java#L306-L356 | test | Uncompress HD data. | Of course, here is the Java code you requested:
```java
private short[] uncompressHRD(byte[] compressedData, int nCells)
throws DescriptorException {
short[] svalues = new short[nCells];
int cPos = 0; // position in the compressed data, in bytes
int nextCell = 0;
int runLe... |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/component/ViewConfiguration.java | ViewConfiguration.addClientInterceptor | public void addClientInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = clientInterceptors.get(method);
if (container == null) {
clientInterceptors.put(method, container = new OrderedItemContainer<Interceptor... | java | public void addClientInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = clientInterceptors.get(method);
if (container == null) {
clientInterceptors.put(method, container = new OrderedItemContainer<Interceptor... | [
"public",
"void",
"addClientInterceptor",
"(",
"Method",
"method",
",",
"InterceptorFactory",
"interceptorFactory",
",",
"int",
"priority",
")",
"{",
"OrderedItemContainer",
"<",
"InterceptorFactory",
">",
"container",
"=",
"clientInterceptors",
".",
"get",
"(",
"meth... | Adds a client interceptor to the given method
@param method The method to add
@param interceptorFactory The interceptor factory
@param priority The priority | [
"Adds",
"a",
"client",
"interceptor",
"to",
"the",
"given",
"method"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/component/ViewConfiguration.java#L175-L181 | test | Add a client interceptor to the given method. | Of course, here is the Java code you requested:
```java
public void addClientInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = clientInterceptors.get(method);
if (container == null) {
clientInterceptors.put... |
jryans/jless | src/main/java/com/bazaarvoice/jless/parser/Parser.java | Parser.ExpressionFunction | Rule ExpressionFunction() {
return Sequence(
Sequence(
"expression(",
ZeroOrMore(
TestNot(
')',
Ws0(),
... | java | Rule ExpressionFunction() {
return Sequence(
Sequence(
"expression(",
ZeroOrMore(
TestNot(
')',
Ws0(),
... | [
"Rule",
"ExpressionFunction",
"(",
")",
"{",
"return",
"Sequence",
"(",
"Sequence",
"(",
"\"expression(\"",
",",
"ZeroOrMore",
"(",
"TestNot",
"(",
"'",
"'",
",",
"Ws0",
"(",
")",
",",
"AnyOf",
"(",
"\";}\"",
")",
")",
",",
"ANY",
")",
",",
"'",
"'",... | 'expression(' (!(')' Ws0 [;}]) .)* ');' | [
"expression",
"(",
"(",
"!",
"(",
")",
"Ws0",
"[",
";",
"}",
"]",
")",
".",
")",
"*",
")",
";"
] | 0e448fac752b4fc7bfef6b220ed1c64a490c29c0 | https://github.com/jryans/jless/blob/0e448fac752b4fc7bfef6b220ed1c64a490c29c0/src/main/java/com/bazaarvoice/jless/parser/Parser.java#L646-L662 | test | ExpressionFunction returns a single expression. | Of course, here is the Java code you requested:
```java
Rule ExpressionFunction() {
return Sequence(
Sequence(
"expression(",
ZeroOrMore(
TestNot(
')',
... |
streamsets/datacollector | jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcBaseRecordWriter.java | JdbcBaseRecordWriter.setPrimaryKeys | int setPrimaryKeys(int index, final Record record, PreparedStatement statement, int opCode)
throws OnRecordErrorException {
for (String key : getPrimaryKeyColumns()) {
Field field = record.get(recordReader.getFieldPath(key, getColumnsToFields(), opCode));
if(field == null){
LOG.error("Prim... | java | int setPrimaryKeys(int index, final Record record, PreparedStatement statement, int opCode)
throws OnRecordErrorException {
for (String key : getPrimaryKeyColumns()) {
Field field = record.get(recordReader.getFieldPath(key, getColumnsToFields(), opCode));
if(field == null){
LOG.error("Prim... | [
"int",
"setPrimaryKeys",
"(",
"int",
"index",
",",
"final",
"Record",
"record",
",",
"PreparedStatement",
"statement",
",",
"int",
"opCode",
")",
"throws",
"OnRecordErrorException",
"{",
"for",
"(",
"String",
"key",
":",
"getPrimaryKeyColumns",
"(",
")",
")",
... | Set primary key values to query. This is called only for UPDATE and DELETE operations.
If primary key value is missing in record, it throws OnRecordErrorException.
@param index
@param record
@param statement
@param opCode
@return
@throws OnRecordErrorException | [
"Set",
"primary",
"key",
"values",
"to",
"query",
".",
"This",
"is",
"called",
"only",
"for",
"UPDATE",
"and",
"DELETE",
"operations",
".",
"If",
"primary",
"key",
"value",
"is",
"missing",
"in",
"record",
"it",
"throws",
"OnRecordErrorException",
"."
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcBaseRecordWriter.java#L666-L685 | test | Sets the primary keys of the given record to the given statement. | Of course, here is the Java code you requested:
```java
int setPrimaryKeys(int index, final Record record, PreparedStatement statement, int opCode)
throws OnRecordErrorException {
for (String key : getPrimaryKeyColumns()) {
Field field = record.get(recordReader.getFieldPath(key, getColumnsToFields(), o... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java | OAbstractPaginatedStorage.preallocateRids | public void preallocateRids(final OTransactionInternal clientTx) {
try {
checkOpenness();
checkLowDiskSpaceRequestsAndReadOnlyConditions();
final Iterable<ORecordOperation> entries = clientTx.getRecordOperations();
final TreeMap<Integer, OCluster> clustersToLock = new TreeMap<>();
fi... | java | public void preallocateRids(final OTransactionInternal clientTx) {
try {
checkOpenness();
checkLowDiskSpaceRequestsAndReadOnlyConditions();
final Iterable<ORecordOperation> entries = clientTx.getRecordOperations();
final TreeMap<Integer, OCluster> clustersToLock = new TreeMap<>();
fi... | [
"public",
"void",
"preallocateRids",
"(",
"final",
"OTransactionInternal",
"clientTx",
")",
"{",
"try",
"{",
"checkOpenness",
"(",
")",
";",
"checkLowDiskSpaceRequestsAndReadOnlyConditions",
"(",
")",
";",
"final",
"Iterable",
"<",
"ORecordOperation",
">",
"entries",
... | Scan the given transaction for new record and allocate a record id for them, the relative record id is inserted inside the
transaction for future use.
@param clientTx the transaction of witch allocate rids | [
"Scan",
"the",
"given",
"transaction",
"for",
"new",
"record",
"and",
"allocate",
"a",
"record",
"id",
"for",
"them",
"the",
"relative",
"record",
"id",
"is",
"inserted",
"inside",
"the",
"transaction",
"for",
"future",
"use",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OAbstractPaginatedStorage.java#L1887-L1969 | test | Preallocate RIDs. | Of course, here is the Java code you requested:
```java
public void preallocateRids(final OTransactionInternal clientTx) {
try {
checkOpenness();
checkLowDiskSpaceRequestsAndReadOnlyConditions();
final Iterable<ORecordOperation> entries = clientTx.getRecordOperations();
final TreeMap<Integ... |
oblac/jodd | jodd-bean/src/main/java/jodd/introspector/CachingIntrospector.java | CachingIntrospector.lookup | @Override
public ClassDescriptor lookup(final Class type) {
return cache.get(type, () ->
new ClassDescriptor(
type,
scanAccessible,
enhancedProperties,
includeFieldsAsProperties,
propertyFieldPrefix));
} | java | @Override
public ClassDescriptor lookup(final Class type) {
return cache.get(type, () ->
new ClassDescriptor(
type,
scanAccessible,
enhancedProperties,
includeFieldsAsProperties,
propertyFieldPrefix));
} | [
"@",
"Override",
"public",
"ClassDescriptor",
"lookup",
"(",
"final",
"Class",
"type",
")",
"{",
"return",
"cache",
".",
"get",
"(",
"type",
",",
"(",
")",
"->",
"new",
"ClassDescriptor",
"(",
"type",
",",
"scanAccessible",
",",
"enhancedProperties",
",",
... | {@inheritDoc} | [
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-bean/src/main/java/jodd/introspector/CachingIntrospector.java#L67-L76 | test | Lookup a ClassDescriptor for a Class. | Of course, here is the Java code you requested:
```java
@Override
public ClassDescriptor lookup(final Class type) {
return cache.get(type, () ->
new ClassDescriptor(
type,
scanAccessible,
enhancedProperties,
includeFieldsAsProperties,
propertyFieldPrefix));
}
```
Hope this helps! |
jryans/jless | src/main/java/com/bazaarvoice/jless/parser/Parser.java | Parser.MixinReference | @MemoMismatches
Rule MixinReference() {
Var<String> name = new Var<String>();
return FirstOf(
// No arguments, reference an existing rule set's properties
Sequence(
SelectorGroup(), ';',
resolveMixinReference(NodeTreeUti... | java | @MemoMismatches
Rule MixinReference() {
Var<String> name = new Var<String>();
return FirstOf(
// No arguments, reference an existing rule set's properties
Sequence(
SelectorGroup(), ';',
resolveMixinReference(NodeTreeUti... | [
"@",
"MemoMismatches",
"Rule",
"MixinReference",
"(",
")",
"{",
"Var",
"<",
"String",
">",
"name",
"=",
"new",
"Var",
"<",
"String",
">",
"(",
")",
";",
"return",
"FirstOf",
"(",
"// No arguments, reference an existing rule set's properties",
"Sequence",
"(",
"S... | SelectorGroup ';' Ws0
/ Class Arguments ';' Ws0 | [
"SelectorGroup",
";",
"Ws0",
"/",
"Class",
"Arguments",
";",
"Ws0"
] | 0e448fac752b4fc7bfef6b220ed1c64a490c29c0 | https://github.com/jryans/jless/blob/0e448fac752b4fc7bfef6b220ed1c64a490c29c0/src/main/java/com/bazaarvoice/jless/parser/Parser.java#L257-L274 | test | A mixin reference is a sequence of rules that are used to reference a rule set s properties. | Of course, here is the Java code you requested:
```java
@MemoMismatches
Rule MixinReference() {
Var<String> name = new Var<String>();
return FirstOf(
// No arguments, reference an existing rule set's properties
Sequence(
SelectorGroup(), ';',
... |
artclarke/humble-video | humble-video-noarch/src/main/java/io/humble/video/Configurable.java | Configurable.getPropertyAsRational | public Rational getPropertyAsRational(String name) {
long cPtr = VideoJNI.Configurable_getPropertyAsRational(swigCPtr, this, name);
return (cPtr == 0) ? null : new Rational(cPtr, false);
} | java | public Rational getPropertyAsRational(String name) {
long cPtr = VideoJNI.Configurable_getPropertyAsRational(swigCPtr, this, name);
return (cPtr == 0) ? null : new Rational(cPtr, false);
} | [
"public",
"Rational",
"getPropertyAsRational",
"(",
"String",
"name",
")",
"{",
"long",
"cPtr",
"=",
"VideoJNI",
".",
"Configurable_getPropertyAsRational",
"(",
"swigCPtr",
",",
"this",
",",
"name",
")",
";",
"return",
"(",
"cPtr",
"==",
"0",
")",
"?",
"null... | Gets the value of this property, and returns as an Rational;<br>
<br>
@param name name of option<br>
<br>
@return long value of property.<br>
<br>
@throws PropertyNotFoundException if this property is not found. | [
"Gets",
"the",
"value",
"of",
"this",
"property",
"and",
"returns",
"as",
"an",
"Rational",
";",
"<br",
">",
"<br",
">"
] | aa349ae2d7ef74160b7074feac8d298cf90394d1 | https://github.com/artclarke/humble-video/blob/aa349ae2d7ef74160b7074feac8d298cf90394d1/humble-video-noarch/src/main/java/io/humble/video/Configurable.java#L285-L288 | test | Gets the value of a property as a rational. | Of course, here is the Java code you requested:
```java
public Rational getPropertyAsRational(String name) {
long cPtr = VideoJNI.Configurable_getPropertyAsRational(swigCPtr, this, name);
return (cPtr == 0) ? null : new Rational(cPtr, false);
}
```
Hope this helps! |
intellimate/IzouSDK | src/main/java/org/intellimate/izou/sdk/properties/EventPropertiesAssistant.java | EventPropertiesAssistant.doWithLock | private void doWithLock(FileChannel channel, Consumer<FileLock> consumer) {
FileLock lock = null;
try {
while (lock == null) {
try {
lock = channel.tryLock();
} catch (OverlappingFileLockException e) {
Thread.sleep(500);... | java | private void doWithLock(FileChannel channel, Consumer<FileLock> consumer) {
FileLock lock = null;
try {
while (lock == null) {
try {
lock = channel.tryLock();
} catch (OverlappingFileLockException e) {
Thread.sleep(500);... | [
"private",
"void",
"doWithLock",
"(",
"FileChannel",
"channel",
",",
"Consumer",
"<",
"FileLock",
">",
"consumer",
")",
"{",
"FileLock",
"lock",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"lock",
"==",
"null",
")",
"{",
"try",
"{",
"lock",
"=",
"chann... | executes with a lock
@param channel the channel where the lock is acquired from
@param consumer the consumer to execute | [
"executes",
"with",
"a",
"lock"
] | bc8705ad48a6ca12a722f2b787be435949fa5d08 | https://github.com/intellimate/IzouSDK/blob/bc8705ad48a6ca12a722f2b787be435949fa5d08/src/main/java/org/intellimate/izou/sdk/properties/EventPropertiesAssistant.java#L164-L186 | test | Do with lock. | Of course, here is the Java code you requested:
```java
private void doWithLock(FileChannel channel, Consumer<FileLock> consumer) {
FileLock lock = null;
try {
while (lock == null) {
try {
lock = channel.tryLock();
} catch (OverlappingFile... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/extension/style/StyleMappingRow.java | StyleMappingRow.setGeometryType | public void setGeometryType(GeometryType geometryType) {
String geometryTypeName = null;
if (geometryType != null) {
geometryTypeName = geometryType.getName();
}
setValue(getGeometryTypeNameColumnIndex(), geometryTypeName);
} | java | public void setGeometryType(GeometryType geometryType) {
String geometryTypeName = null;
if (geometryType != null) {
geometryTypeName = geometryType.getName();
}
setValue(getGeometryTypeNameColumnIndex(), geometryTypeName);
} | [
"public",
"void",
"setGeometryType",
"(",
"GeometryType",
"geometryType",
")",
"{",
"String",
"geometryTypeName",
"=",
"null",
";",
"if",
"(",
"geometryType",
"!=",
"null",
")",
"{",
"geometryTypeName",
"=",
"geometryType",
".",
"getName",
"(",
")",
";",
"}",
... | Set the geometry type
@param geometryType geometry type | [
"Set",
"the",
"geometry",
"type"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/extension/style/StyleMappingRow.java#L97-L103 | test | Sets the GeometryType of the image. | Of course, here is the Java code you requested:
```java
public void setGeometryType(GeometryType geometryType) {
String geometryTypeName = null;
if (geometryType != null) {
geometryTypeName = geometryType.getName();
}
setValue(getGeometryTypeNameColumnIndex(), geometryTypeNa... |
eclipse/packagedrone | bundles/org.eclipse.packagedrone.web.common/src/org/eclipse/packagedrone/web/common/page/Pagination.java | Pagination.paginate | public static <T> PaginationResult<T> paginate ( final Integer startPage, final int pageSize, final List<T> fullDataSet )
{
return paginate ( startPage, pageSize, ( start, length ) -> {
final int len = fullDataSet.size ();
if ( start > len )
{
return Coll... | java | public static <T> PaginationResult<T> paginate ( final Integer startPage, final int pageSize, final List<T> fullDataSet )
{
return paginate ( startPage, pageSize, ( start, length ) -> {
final int len = fullDataSet.size ();
if ( start > len )
{
return Coll... | [
"public",
"static",
"<",
"T",
">",
"PaginationResult",
"<",
"T",
">",
"paginate",
"(",
"final",
"Integer",
"startPage",
",",
"final",
"int",
"pageSize",
",",
"final",
"List",
"<",
"T",
">",
"fullDataSet",
")",
"{",
"return",
"paginate",
"(",
"startPage",
... | Paginate from a full data set
@param startPage
the start page
@param pageSize
the size of a single page
@param fullDataSet
the full data set
@return a subset of the full data set, containing the items which match
the page window | [
"Paginate",
"from",
"a",
"full",
"data",
"set"
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.eclipse.packagedrone.web.common/src/org/eclipse/packagedrone/web/common/page/Pagination.java#L68-L80 | test | Paginate a list of images. | Of course, here is the Java code you requested:
```java
public static <T> PaginationResult<T> paginate ( final Integer startPage, final int pageSize, final List<T> fullDataSet )
{
return paginate ( startPage, pageSize, ( start, length ) -> {
final int len = fullDataSet.size ();
if ... |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/model/resource/locator/support/DispatcherStreamLocator.java | DispatcherStreamLocator.getInputStream | public InputStream getInputStream(final HttpServletRequest request, final HttpServletResponse response,
final String location)
throws IOException {
if (request == null || response == null || location == null) {
throw new IOException("Cannot get stream for location: " + location
+ " ... | java | public InputStream getInputStream(final HttpServletRequest request, final HttpServletResponse response,
final String location)
throws IOException {
if (request == null || response == null || location == null) {
throw new IOException("Cannot get stream for location: " + location
+ " ... | [
"public",
"InputStream",
"getInputStream",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"location",
")",
"throws",
"IOException",
"{",
"if",
"(",
"request",
"==",
"null",
"||",
"response",
... | /** When using JBoss Portal and it has some funny quirks...actually a portal application have several small web
application behind it. So when it intercepts a requests for portal then it start bombing the the application behind
the portal with multiple threads (web requests) that are combined with threads for wro4j.
@... | [
"/",
"**",
"When",
"using",
"JBoss",
"Portal",
"and",
"it",
"has",
"some",
"funny",
"quirks",
"...",
"actually",
"a",
"portal",
"application",
"have",
"several",
"small",
"web",
"application",
"behind",
"it",
".",
"So",
"when",
"it",
"intercepts",
"a",
"re... | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/model/resource/locator/support/DispatcherStreamLocator.java#L59-L104 | test | Returns an input stream for the specified resource location. | Of course, here is the Java code you requested:
```java
public InputStream getInputStream(final HttpServletRequest request, final HttpServletResponse response,
final String location)
throws IOException {
if (request == null || response == null || location == null) {
throw new IOException("Can... |
Unidata/thredds | legacy/src/main/java/thredds/cataloggen/CollectionLevelScanner.java | CollectionLevelScanner.scan | public void scan() throws IOException
{
if ( state == 1 ) throw new IllegalStateException( "Scan already underway." );
if ( state >= 2 ) throw new IllegalStateException( "Scan has already been generated." );
state = 1;
// Make sure proxyDsHandlers Map is not null.
if ( proxyDsHandlers == null ) p... | java | public void scan() throws IOException
{
if ( state == 1 ) throw new IllegalStateException( "Scan already underway." );
if ( state >= 2 ) throw new IllegalStateException( "Scan has already been generated." );
state = 1;
// Make sure proxyDsHandlers Map is not null.
if ( proxyDsHandlers == null ) p... | [
"public",
"void",
"scan",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"state",
"==",
"1",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Scan already underway.\"",
")",
";",
"if",
"(",
"state",
">=",
"2",
")",
"throw",
"new",
"IllegalStateExcep... | Scan the collection and gather information on contained datasets.
@throws IOException if an I/O error occurs while locating the contained datasets. | [
"Scan",
"the",
"collection",
"and",
"gather",
"information",
"on",
"contained",
"datasets",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/legacy/src/main/java/thredds/cataloggen/CollectionLevelScanner.java#L475-L556 | test | Scan the data. | Of course, here is the Java code you requested:
```java
public void scan() throws IOException
{
if ( state == 1 ) throw new IllegalStateException( "Scan already underway." );
if ( state >= 2 ) throw new IllegalStateException( "Scan has already been generated." );
state = 1;
// Make sure proxyDsHandl... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/util/rc/RC.java | RC.setWellKnown | static void
setWellKnown() {
if (dfaltRC.triplestore.size() == 0) return;
// Walk the set of triples looking for those that have no url
for (String key : dfaltRC.keySet()) {
Triple triple = dfaltRC.lookup(key);
if (triple.url == null) {
RC.set(key, triple.value); // let set sort it out... | java | static void
setWellKnown() {
if (dfaltRC.triplestore.size() == 0) return;
// Walk the set of triples looking for those that have no url
for (String key : dfaltRC.keySet()) {
Triple triple = dfaltRC.lookup(key);
if (triple.url == null) {
RC.set(key, triple.value); // let set sort it out... | [
"static",
"void",
"setWellKnown",
"(",
")",
"{",
"if",
"(",
"dfaltRC",
".",
"triplestore",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
";",
"// Walk the set of triples looking for those that have no url",
"for",
"(",
"String",
"key",
":",
"dfaltRC",
".",
... | Record some well known parameters | [
"Record",
"some",
"well",
"known",
"parameters"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/util/rc/RC.java#L236-L246 | test | Set the missing url in the CRA | Of course, here is the Java code you requested:
```java
static void
setWellKnown() {
if (dfaltRC.triplestore.size() == 0) return;
// Walk the set of triples looking for those that have no url
for (String key : dfaltRC.keySet()) {
Triple triple = dfaltRC.lookup(key);
if (triple.url == null) {
... |
jcodec/jcodec | src/main/java/org/jcodec/common/io/DummyBitstreamReader.java | DummyBitstreamReader.peakNextBits | public int peakNextBits(int n) throws IOException {
if (n > 8)
throw new IllegalArgumentException("N should be less then 8");
if (nBit == 8) {
advance();
if (curByte == -1) {
return -1;
}
}
int[] bits = new int[16 - nBit];
... | java | public int peakNextBits(int n) throws IOException {
if (n > 8)
throw new IllegalArgumentException("N should be less then 8");
if (nBit == 8) {
advance();
if (curByte == -1) {
return -1;
}
}
int[] bits = new int[16 - nBit];
... | [
"public",
"int",
"peakNextBits",
"(",
"int",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"n",
">",
"8",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"N should be less then 8\"",
")",
";",
"if",
"(",
"nBit",
"==",
"8",
")",
"{",
"advance",... | /*
(non-Javadoc)
@see ua.org.jplayer.javcodec.h264.RBSPInputStream#next_bits(int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75 | https://github.com/jcodec/jcodec/blob/cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75/src/main/java/org/jcodec/common/io/DummyBitstreamReader.java#L153-L180 | test | peak next n bits. | Of course, here is the Java code you requested:
```java
public int peakNextBits(int n) throws IOException {
if (n > 8)
throw new IllegalArgumentException("N should be less then 8");
if (nBit == 8) {
advance();
if (curByte == -1) {
return -1;
... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java | OWOWCache.freeSpaceCheckAfterNewPageAdd | private void freeSpaceCheckAfterNewPageAdd() throws IOException {
final long newPagesAdded = amountOfNewPagesAdded.addAndGet(1);
final long lastSpaceCheck = lastDiskSpaceCheck.get();
if (newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastSpaceCheck == 0) {
//usable space may be less than f... | java | private void freeSpaceCheckAfterNewPageAdd() throws IOException {
final long newPagesAdded = amountOfNewPagesAdded.addAndGet(1);
final long lastSpaceCheck = lastDiskSpaceCheck.get();
if (newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastSpaceCheck == 0) {
//usable space may be less than f... | [
"private",
"void",
"freeSpaceCheckAfterNewPageAdd",
"(",
")",
"throws",
"IOException",
"{",
"final",
"long",
"newPagesAdded",
"=",
"amountOfNewPagesAdded",
".",
"addAndGet",
"(",
"1",
")",
";",
"final",
"long",
"lastSpaceCheck",
"=",
"lastDiskSpaceCheck",
".",
"get"... | This method is called once new pages are added to the disk inside of
{@link OWriteCache#load(long, long, int, OModifiableBoolean, boolean)} method.
If total amount of added pages minus amount of added pages at the time of last disk space check bigger than threshold value
{@link #diskSizeCheckInterval} new disk space c... | [
"This",
"method",
"is",
"called",
"once",
"new",
"pages",
"are",
"added",
"to",
"the",
"disk",
"inside",
"of",
"{"
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/storage/cache/local/OWOWCache.java#L602-L616 | test | Check if free space is less than free space limit | Of course, here is the Java code you requested:
```java
private void freeSpaceCheckAfterNewPageAdd() throws IOException {
final long newPagesAdded = amountOfNewPagesAdded.addAndGet(1);
final long lastSpaceCheck = lastDiskSpaceCheck.get();
if (newPagesAdded - lastSpaceCheck > diskSizeCheckInterval || lastS... |
email2vimalraj/CucumberExtentReporter | src/main/java/com/vimalselvam/cucumber/listener/Reporter.java | Reporter.addScreenCaptureFromPath | public static void addScreenCaptureFromPath(String imagePath, String title) throws IOException {
getCurrentStep().addScreenCaptureFromPath(imagePath, title);
} | java | public static void addScreenCaptureFromPath(String imagePath, String title) throws IOException {
getCurrentStep().addScreenCaptureFromPath(imagePath, title);
} | [
"public",
"static",
"void",
"addScreenCaptureFromPath",
"(",
"String",
"imagePath",
",",
"String",
"title",
")",
"throws",
"IOException",
"{",
"getCurrentStep",
"(",
")",
".",
"addScreenCaptureFromPath",
"(",
"imagePath",
",",
"title",
")",
";",
"}"
] | Adds the screenshot from the given path with the given title to the current step
@param imagePath The image path
@param title The title for the image
@throws IOException Exception if imagePath is erroneous | [
"Adds",
"the",
"screenshot",
"from",
"the",
"given",
"path",
"with",
"the",
"given",
"title",
"to",
"the",
"current",
"step"
] | e321ff73def28cb530acebc576e3d87b83939c6b | https://github.com/email2vimalraj/CucumberExtentReporter/blob/e321ff73def28cb530acebc576e3d87b83939c6b/src/main/java/com/vimalselvam/cucumber/listener/Reporter.java#L104-L106 | test | Add a screenshot to the current step. | Of course, here is the Java code you requested:
```java
public static void addScreenCaptureFromPath(String imagePath, String title) throws IOException {
getCurrentStep().addScreenCaptureFromPath(imagePath, title);
}
```
Hope this helps! |
streamsets/datacollector | jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/multithread/TableContextUtil.java | TableContextUtil.listTablesForConfig | public Map<String, TableContext> listTablesForConfig(
DatabaseVendor vendor,
PushSource.Context context,
List<Stage.ConfigIssue> issues,
Connection connection,
TableConfigBean tableConfigBean,
TableJdbcELEvalContext tableJdbcELEvalContext,
QuoteChar quoteChar
) throws SQLExce... | java | public Map<String, TableContext> listTablesForConfig(
DatabaseVendor vendor,
PushSource.Context context,
List<Stage.ConfigIssue> issues,
Connection connection,
TableConfigBean tableConfigBean,
TableJdbcELEvalContext tableJdbcELEvalContext,
QuoteChar quoteChar
) throws SQLExce... | [
"public",
"Map",
"<",
"String",
",",
"TableContext",
">",
"listTablesForConfig",
"(",
"DatabaseVendor",
"vendor",
",",
"PushSource",
".",
"Context",
"context",
",",
"List",
"<",
"Stage",
".",
"ConfigIssue",
">",
"issues",
",",
"Connection",
"connection",
",",
... | Lists all tables matching the {@link TableConfigBean} and creates a table context for each table.
@param connection JDBC connection
@param tableConfigBean {@link TableConfigBean}
@return Map of qualified table name to Table Context
@throws SQLException If list tables call fails
@throws StageException if partition confi... | [
"Lists",
"all",
"tables",
"matching",
"the",
"{"
] | ea63245ea14d59d5229248387f0628f46131eae5 | https://github.com/streamsets/datacollector/blob/ea63245ea14d59d5229248387f0628f46131eae5/jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/multithread/TableContextUtil.java#L394-L439 | test | List tables for a given configuration object. | Of course, here is the Java code you requested:
```java
public Map<String, TableContext> listTablesForConfig(
DatabaseVendor vendor,
PushSource.Context context,
List<Stage.ConfigIssue> issues,
Connection connection,
TableConfigBean tableConfigBean,
TableJdbcELEvalContext tableJdbcEL... |
objectify/objectify | src/main/java/com/googlecode/objectify/impl/KeyMetadata.java | KeyMetadata.findKeyFields | private void findKeyFields(Class<?> inspect, CreateContext ctx, Path path) {
if (inspect == Object.class)
return;
findKeyFields(inspect.getSuperclass(), ctx, path);
for (Field field: inspect.getDeclaredFields()) {
if (field.getAnnotation(Id.class) != null) {
if (this.idMeta != null)
throw new Ill... | java | private void findKeyFields(Class<?> inspect, CreateContext ctx, Path path) {
if (inspect == Object.class)
return;
findKeyFields(inspect.getSuperclass(), ctx, path);
for (Field field: inspect.getDeclaredFields()) {
if (field.getAnnotation(Id.class) != null) {
if (this.idMeta != null)
throw new Ill... | [
"private",
"void",
"findKeyFields",
"(",
"Class",
"<",
"?",
">",
"inspect",
",",
"CreateContext",
"ctx",
",",
"Path",
"path",
")",
"{",
"if",
"(",
"inspect",
"==",
"Object",
".",
"class",
")",
"return",
";",
"findKeyFields",
"(",
"inspect",
".",
"getSupe... | Recursively go through the class hierarchy looking for the idMeta and parentMeta fields.
@throws IllegalStateException if @Id or @Parent shows up twice. | [
"Recursively",
"go",
"through",
"the",
"class",
"hierarchy",
"looking",
"for",
"the",
"idMeta",
"and",
"parentMeta",
"fields",
"."
] | 4bf325d2e49b400326416977c7d9bbdf5380175b | https://github.com/objectify/objectify/blob/4bf325d2e49b400326416977c7d9bbdf5380175b/src/main/java/com/googlecode/objectify/impl/KeyMetadata.java#L67-L99 | test | Find the key fields of the given class. | Of course, here is the Java code you requested:
```java
private void findKeyFields(Class<?> inspect, CreateContext ctx, Path path) {
if (inspect == Object.class)
return;
findKeyFields(inspect.getSuperclass(), ctx, path);
for (Field field: inspect.getDeclaredFields()) {
if (field.getAnnotation(Id.class) !... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.validateConcat | protected static void validateConcat(int dimension, INDArray... arrs) {
if (arrs[0].isScalar()) {
for (int i = 1; i < arrs.length; i++)
if (!arrs[i].isScalar())
throw new IllegalArgumentException("All arrays must have same dimensions");
} else {
... | java | protected static void validateConcat(int dimension, INDArray... arrs) {
if (arrs[0].isScalar()) {
for (int i = 1; i < arrs.length; i++)
if (!arrs[i].isScalar())
throw new IllegalArgumentException("All arrays must have same dimensions");
} else {
... | [
"protected",
"static",
"void",
"validateConcat",
"(",
"int",
"dimension",
",",
"INDArray",
"...",
"arrs",
")",
"{",
"if",
"(",
"arrs",
"[",
"0",
"]",
".",
"isScalar",
"(",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"arrs",
".... | input arrays must have same number of dimensions | [
"input",
"arrays",
"must",
"have",
"same",
"number",
"of",
"dimensions"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L121-L136 | test | Validate that the arrays are concatenated with the same dimensions | Of course, here is the Java code you requested:
```java
protected static void validateConcat(int dimension, INDArray... arrs) {
if (arrs[0].isScalar()) {
for (int i = 1; i < arrs.length; i++)
if (!arrs[i].isScalar())
throw new IllegalArgumentException("All arrays... |
tiefaces/TieFaces | src/org/tiefaces/components/websheet/utility/CommandUtility.java | CommandUtility.isUserFormula | private static boolean isUserFormula(final String str) {
return str.startsWith(TieConstants.USER_FORMULA_PREFIX)
&& str.endsWith(TieConstants.USER_FORMULA_SUFFIX);
} | java | private static boolean isUserFormula(final String str) {
return str.startsWith(TieConstants.USER_FORMULA_PREFIX)
&& str.endsWith(TieConstants.USER_FORMULA_SUFFIX);
} | [
"private",
"static",
"boolean",
"isUserFormula",
"(",
"final",
"String",
"str",
")",
"{",
"return",
"str",
".",
"startsWith",
"(",
"TieConstants",
".",
"USER_FORMULA_PREFIX",
")",
"&&",
"str",
".",
"endsWith",
"(",
"TieConstants",
".",
"USER_FORMULA_SUFFIX",
")"... | Checks if is user formula.
@param str
the str
@return true, if is user formula | [
"Checks",
"if",
"is",
"user",
"formula",
"."
] | 3b57b9701ed0f080b5fa4fa78269cc0c422b34ba | https://github.com/tiefaces/TieFaces/blob/3b57b9701ed0f080b5fa4fa78269cc0c422b34ba/src/org/tiefaces/components/websheet/utility/CommandUtility.java#L601-L604 | test | Checks if the given string is a user formula. | Of course, here is the Java code you requested:
```java
private static boolean isUserFormula(final String str) {
return str.startsWith(TieConstants.USER_FORMULA_PREFIX)
&& str.endsWith(TieConstants.USER_FORMULA_SUFFIX);
}
```
Hope this helps! |
oblac/jodd | jodd-json/src/main/java/jodd/json/JsonObject.java | JsonObject.getInteger | public Integer getInteger(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Integer) {
return (Integer) number;
}
return number.intValue();
} | java | public Integer getInteger(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Integer) {
return (Integer) number;
}
return number.intValue();
} | [
"public",
"Integer",
"getInteger",
"(",
"final",
"String",
"key",
")",
"{",
"Number",
"number",
"=",
"(",
"Number",
")",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
... | returns the integer value with the specified key. | [
"returns",
"the",
"integer",
"value",
"with",
"the",
"specified",
"key",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-json/src/main/java/jodd/json/JsonObject.java#L74-L84 | test | Gets the Integer value for the given key. | Of course, here is the Java code you requested:
```java
public Integer getInteger(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Integer) {
return (Integer) number;
}
return number.intValue();
}
```
Hope this helps! |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.deconv2d | public SDVariable deconv2d(String name, SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
SDVariable ret = f().deconv2d(inputs, deconv2DConfig);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable deconv2d(String name, SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
SDVariable ret = f().deconv2d(inputs, deconv2DConfig);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"deconv2d",
"(",
"String",
"name",
",",
"SDVariable",
"[",
"]",
"inputs",
",",
"DeConv2DConfig",
"deconv2DConfig",
")",
"{",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"deconv2d",
"(",
"inputs",
",",
"deconv2DConfig",
")",
";",
"... | Deconv2d operation.
@param name name of the operation in SameDiff
@param inputs the inputs to sconv2d
@param deconv2DConfig the configuration
@return | [
"Deconv2d",
"operation",
"."
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1915-L1918 | test | Deconv2d operation. | Of course, here is the Java code you requested:
```java
public SDVariable deconv2d(String name, SDVariable[] inputs, DeConv2DConfig deconv2DConfig) {
SDVariable ret = f().deconv2d(inputs, deconv2DConfig);
return updateVariableNameAndReference(ret, name);
}
```
Hope this helps! |
wildfly/wildfly | pojo/src/main/java/org/jboss/as/pojo/KernelDeploymentModuleProcessor.java | KernelDeploymentModuleProcessor.deploy | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final List<KernelDeploymentXmlDescriptor> kdXmlDescriptors = unit.getAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY);
... | java | @Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final List<KernelDeploymentXmlDescriptor> kdXmlDescriptors = unit.getAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY);
... | [
"@",
"Override",
"public",
"void",
"deploy",
"(",
"DeploymentPhaseContext",
"phaseContext",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"final",
"DeploymentUnit",
"unit",
"=",
"phaseContext",
".",
"getDeploymentUnit",
"(",
")",
";",
"final",
"List",
"<",
... | Add POJO module if we have any bean factories.
@param phaseContext the deployment unit context
@throws org.jboss.as.server.deployment.DeploymentUnitProcessingException | [
"Add",
"POJO",
"module",
"if",
"we",
"have",
"any",
"bean",
"factories",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/pojo/src/main/java/org/jboss/as/pojo/KernelDeploymentModuleProcessor.java#L57-L76 | test | Override this method to add the necessary modules to the deployment. | Of course, here is the Java code you requested:
```java
@Override
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final List<KernelDeploymentXmlDescriptor> kdXmlDescriptors = unit.getAtt... |
spring-projects/spring-security | ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java | SpringSecurityLdapTemplate.buildControls | private static SearchControls buildControls(SearchControls originalControls) {
return new SearchControls(originalControls.getSearchScope(),
originalControls.getCountLimit(), originalControls.getTimeLimit(),
originalControls.getReturningAttributes(), RETURN_OBJECT,
originalControls.getDerefLinkFlag());
} | java | private static SearchControls buildControls(SearchControls originalControls) {
return new SearchControls(originalControls.getSearchScope(),
originalControls.getCountLimit(), originalControls.getTimeLimit(),
originalControls.getReturningAttributes(), RETURN_OBJECT,
originalControls.getDerefLinkFlag());
} | [
"private",
"static",
"SearchControls",
"buildControls",
"(",
"SearchControls",
"originalControls",
")",
"{",
"return",
"new",
"SearchControls",
"(",
"originalControls",
".",
"getSearchScope",
"(",
")",
",",
"originalControls",
".",
"getCountLimit",
"(",
")",
",",
"o... | We need to make sure the search controls has the return object flag set to true, in
order for the search to return DirContextAdapter instances.
@param originalControls
@return | [
"We",
"need",
"to",
"make",
"sure",
"the",
"search",
"controls",
"has",
"the",
"return",
"object",
"flag",
"set",
"to",
"true",
"in",
"order",
"for",
"the",
"search",
"to",
"return",
"DirContextAdapter",
"instances",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/ldap/src/main/java/org/springframework/security/ldap/SpringSecurityLdapTemplate.java#L377-L382 | test | Build the SearchControls object from the given SearchControls object. | Of course, here is the Java code you requested:
```java
private static SearchControls buildControls(SearchControls originalControls) {
return new SearchControls(originalControls.getSearchScope(),
originalControls.getCountLimit(), originalControls.getTimeLimit(),
originalControls.getReturningAttributes(), RET... |
oblac/jodd | jodd-json/src/main/java/jodd/json/JsonWriter.java | JsonWriter.pushName | public void pushName(final String name, final boolean withComma) {
pushedName = name;
pushedComma = withComma;
isPushed = true;
} | java | public void pushName(final String name, final boolean withComma) {
pushedName = name;
pushedComma = withComma;
isPushed = true;
} | [
"public",
"void",
"pushName",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"withComma",
")",
"{",
"pushedName",
"=",
"name",
";",
"pushedComma",
"=",
"withComma",
";",
"isPushed",
"=",
"true",
";",
"}"
] | Stores name to temporary stack. Used when name's value may or may not be
serialized (e.g. it may be excluded), in that case we do not need to
write the name. | [
"Stores",
"name",
"to",
"temporary",
"stack",
".",
"Used",
"when",
"name",
"s",
"value",
"may",
"or",
"may",
"not",
"be",
"serialized",
"(",
"e",
".",
"g",
".",
"it",
"may",
"be",
"excluded",
")",
"in",
"that",
"case",
"we",
"do",
"not",
"need",
"t... | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-json/src/main/java/jodd/json/JsonWriter.java#L59-L63 | test | Push a name to the stack. | Of course, here is the Java code you requested:
```java
public void pushName(final String name, final boolean withComma) {
pushedName = name;
pushedComma = withComma;
isPushed = true;
}
```
Hope this helps! |
real-logic/aeron | aeron-driver/src/main/java/io/aeron/driver/reports/LossReportUtil.java | LossReportUtil.mapLossReport | public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength)
{
return mapNewFile(file(aeronDirectoryName), reportFileLength, false);
} | java | public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength)
{
return mapNewFile(file(aeronDirectoryName), reportFileLength, false);
} | [
"public",
"static",
"MappedByteBuffer",
"mapLossReport",
"(",
"final",
"String",
"aeronDirectoryName",
",",
"final",
"int",
"reportFileLength",
")",
"{",
"return",
"mapNewFile",
"(",
"file",
"(",
"aeronDirectoryName",
")",
",",
"reportFileLength",
",",
"false",
")",... | Map a new loss report in the Aeron directory for a given length.
@param aeronDirectoryName in which to create the file.
@param reportFileLength for the file.
@return the newly mapped buffer for the file. | [
"Map",
"a",
"new",
"loss",
"report",
"in",
"the",
"Aeron",
"directory",
"for",
"a",
"given",
"length",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-driver/src/main/java/io/aeron/driver/reports/LossReportUtil.java#L48-L51 | test | Map a loss report to a mapped byte buffer. | Of course, here is the Java code you requested:
```java
public static MappedByteBuffer mapLossReport(final String aeronDirectoryName, final int reportFileLength)
{
return mapNewFile(file(aeronDirectoryName), reportFileLength, false);
}
```
Hope this helps! |
spring-projects/spring-security | oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java | JwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter | public void setJwtGrantedAuthoritiesConverter(Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) {
Assert.notNull(jwtGrantedAuthoritiesConverter, "jwtGrantedAuthoritiesConverter cannot be null");
this.jwtGrantedAuthoritiesConverter = jwtGrantedAuthoritiesConverter;
} | java | public void setJwtGrantedAuthoritiesConverter(Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) {
Assert.notNull(jwtGrantedAuthoritiesConverter, "jwtGrantedAuthoritiesConverter cannot be null");
this.jwtGrantedAuthoritiesConverter = jwtGrantedAuthoritiesConverter;
} | [
"public",
"void",
"setJwtGrantedAuthoritiesConverter",
"(",
"Converter",
"<",
"Jwt",
",",
"Collection",
"<",
"GrantedAuthority",
">",
">",
"jwtGrantedAuthoritiesConverter",
")",
"{",
"Assert",
".",
"notNull",
"(",
"jwtGrantedAuthoritiesConverter",
",",
"\"jwtGrantedAuthor... | Sets the {@link Converter Converter<Jwt, Collection<GrantedAuthority>>} to use.
Defaults to {@link JwtGrantedAuthoritiesConverter}.
@param jwtGrantedAuthoritiesConverter The converter
@since 5.2
@see JwtGrantedAuthoritiesConverter | [
"Sets",
"the",
"{",
"@link",
"Converter",
"Converter<",
";",
"Jwt",
"Collection<",
";",
"GrantedAuthority>",
";",
">",
";",
"}",
"to",
"use",
".",
"Defaults",
"to",
"{",
"@link",
"JwtGrantedAuthoritiesConverter",
"}",
"."
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/JwtAuthenticationConverter.java#L64-L67 | test | Sets the converter that converts the collection of Granted Authorities to the corresponding JWT. | Of course, here is the Java code you requested:
```java
public void setJwtGrantedAuthoritiesConverter(Converter<Jwt, Collection<GrantedAuthority>> jwtGrantedAuthoritiesConverter) {
Assert.notNull(jwtGrantedAuthoritiesConverter, "jwtGrantedAuthoritiesConverter cannot be null");
this.jwtGrantedAuthoritiesConverter =... |
CAFapi/caf-common | decoder-js/src/main/java/com/hpe/caf/decoder/JavascriptDecoder.java | JavascriptDecoder.invokeStringMethod | private static String invokeStringMethod(final ScriptEngine jsEngine, final Object thiz, final String name, final Object... args)
throws NoSuchMethodException, ScriptException
{
return (String) ((Invocable) jsEngine).invokeMethod(thiz, name, args);
} | java | private static String invokeStringMethod(final ScriptEngine jsEngine, final Object thiz, final String name, final Object... args)
throws NoSuchMethodException, ScriptException
{
return (String) ((Invocable) jsEngine).invokeMethod(thiz, name, args);
} | [
"private",
"static",
"String",
"invokeStringMethod",
"(",
"final",
"ScriptEngine",
"jsEngine",
",",
"final",
"Object",
"thiz",
",",
"final",
"String",
"name",
",",
"final",
"Object",
"...",
"args",
")",
"throws",
"NoSuchMethodException",
",",
"ScriptException",
"{... | Calls a method on a script object compiled during a previous script execution, which is retained in the state of the ScriptEngine.
@param jsEngine the JavaScript engine
@param thiz the instance of the class that contains the method to be called
@param name the name of the method to be called
@param args the arguments ... | [
"Calls",
"a",
"method",
"on",
"a",
"script",
"object",
"compiled",
"during",
"a",
"previous",
"script",
"execution",
"which",
"is",
"retained",
"in",
"the",
"state",
"of",
"the",
"ScriptEngine",
"."
] | c9e617cd0b39e19d9480653f8c82efee53dee885 | https://github.com/CAFapi/caf-common/blob/c9e617cd0b39e19d9480653f8c82efee53dee885/decoder-js/src/main/java/com/hpe/caf/decoder/JavascriptDecoder.java#L111-L115 | test | Invoke a method on a class with a string argument. | Of course, here is the Java code you requested:
```java
private static String invokeStringMethod(final ScriptEngine jsEngine, final Object thiz, final String name, final Object... args)
throws NoSuchMethodException, ScriptException
{
return (String) ((Invocable) jsEngine).invokeMethod(thiz, name, a... |
ReactiveX/RxJava | src/main/java/io/reactivex/Observable.java | Observable.blockingIterable | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Iterable<T> blockingIterable(int bufferSize) {
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return new BlockingObservableIterable<T>(this, bufferSize);
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Iterable<T> blockingIterable(int bufferSize) {
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return new BlockingObservableIterable<T>(this, bufferSize);
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Iterable",
"<",
"T",
">",
"blockingIterable",
"(",
"int",
"bufferSize",
")",
"{",
"ObjectHelper",
".",
"verifyPositive",
"(",
"bufferSize",
",",
"\"b... | Converts this {@code Observable} into an {@link Iterable}.
<p>
<img width="640" height="315" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/blockingIterable.o.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code blockingIterable} does not operate by default on a particular {@link Scheduler}.</dd>
... | [
"Converts",
"this",
"{",
"@code",
"Observable",
"}",
"into",
"an",
"{",
"@link",
"Iterable",
"}",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"315",
"src",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"ReactiveX",
"/",
"RxJava"... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Observable.java#L5226-L5231 | test | Returns an iterable over the elements of this sequence in a blocking manner. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Iterable<T> blockingIterable(int bufferSize) {
ObjectHelper.verifyPositive(bufferSize, "bufferSize");
return new BlockingObservableIterable<T>(this, bufferSize);
}... |
deeplearning4j/nd4j | nd4j-common/src/main/java/org/nd4j/linalg/util/MathUtils.java | MathUtils.mergeCoords | public static List<Double> mergeCoords(List<Double> x, List<Double> y) {
if (x.size() != y.size())
throw new IllegalArgumentException(
"Sample sizes must be the same for each data applyTransformToDestination.");
List<Double> ret = new ArrayList<Double>();
... | java | public static List<Double> mergeCoords(List<Double> x, List<Double> y) {
if (x.size() != y.size())
throw new IllegalArgumentException(
"Sample sizes must be the same for each data applyTransformToDestination.");
List<Double> ret = new ArrayList<Double>();
... | [
"public",
"static",
"List",
"<",
"Double",
">",
"mergeCoords",
"(",
"List",
"<",
"Double",
">",
"x",
",",
"List",
"<",
"Double",
">",
"y",
")",
"{",
"if",
"(",
"x",
".",
"size",
"(",
")",
"!=",
"y",
".",
"size",
"(",
")",
")",
"throw",
"new",
... | This will merge the coordinates of the given coordinate system.
@param x the x coordinates
@param y the y coordinates
@return a vector such that each (x,y) pair is at ret[i],ret[i+1] | [
"This",
"will",
"merge",
"the",
"coordinates",
"of",
"the",
"given",
"coordinate",
"system",
"."
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-common/src/main/java/org/nd4j/linalg/util/MathUtils.java#L370-L382 | test | Merge Coordinates. | Of course, here is the Java code you requested:
```java
public static List<Double> mergeCoords(List<Double> x, List<Double> y) {
if (x.size() != y.size())
throw new IllegalArgumentException(
"Sample sizes must be the same for each data applyTransformToDestination.");
... |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/gempak/GempakGridServiceProvider.java | GempakGridServiceProvider.sync | public boolean sync() throws IOException {
if ((gemreader.getInitFileSize() < raf.length()) && extendIndex) {
gemreader.init(true);
GridIndex index = gemreader.getGridIndex();
// reconstruct the ncfile objects
ncfile.empty();
open(index, null);
return true;
}
return false... | java | public boolean sync() throws IOException {
if ((gemreader.getInitFileSize() < raf.length()) && extendIndex) {
gemreader.init(true);
GridIndex index = gemreader.getGridIndex();
// reconstruct the ncfile objects
ncfile.empty();
open(index, null);
return true;
}
return false... | [
"public",
"boolean",
"sync",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"gemreader",
".",
"getInitFileSize",
"(",
")",
"<",
"raf",
".",
"length",
"(",
")",
")",
"&&",
"extendIndex",
")",
"{",
"gemreader",
".",
"init",
"(",
"true",
")",
"... | Sync the file
@return true if needed to sync
@throws IOException problem synching the file | [
"Sync",
"the",
"file"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/gempak/GempakGridServiceProvider.java#L109-L119 | test | Synchronize the contents of the file with the NCFile. | Of course, here is the Java code you requested:
```java
public boolean sync() throws IOException {
if ((gemreader.getInitFileSize() < raf.length()) && extendIndex) {
gemreader.init(true);
GridIndex index = gemreader.getGridIndex();
// reconstruct the ncfile objects
ncfile.empty();
ope... |
oblac/jodd | jodd-bean/src/main/java/jodd/bean/BeanUtilUtil.java | BeanUtilUtil.convertToCollection | @SuppressWarnings("unchecked")
protected Object convertToCollection(final Object value, final Class destinationType, final Class componentType) {
return typeConverterManager.convertToCollection(value, destinationType, componentType);
} | java | @SuppressWarnings("unchecked")
protected Object convertToCollection(final Object value, final Class destinationType, final Class componentType) {
return typeConverterManager.convertToCollection(value, destinationType, componentType);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Object",
"convertToCollection",
"(",
"final",
"Object",
"value",
",",
"final",
"Class",
"destinationType",
",",
"final",
"Class",
"componentType",
")",
"{",
"return",
"typeConverterManager",
".",
"con... | Converter to collection. | [
"Converter",
"to",
"collection",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-bean/src/main/java/jodd/bean/BeanUtilUtil.java#L82-L85 | test | Convert to collection. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
protected Object convertToCollection(final Object value, final Class destinationType, final Class componentType) {
return typeConverterManager.convertToCollection(value, destinationType, componentType);
}
```
Hope this helps! |
objectify/objectify | src/main/java/com/googlecode/objectify/impl/Keys.java | Keys.raw | public static com.google.cloud.datastore.Key raw(final Key<?> key) {
return key == null ? null : key.getRaw();
} | java | public static com.google.cloud.datastore.Key raw(final Key<?> key) {
return key == null ? null : key.getRaw();
} | [
"public",
"static",
"com",
".",
"google",
".",
"cloud",
".",
"datastore",
".",
"Key",
"raw",
"(",
"final",
"Key",
"<",
"?",
">",
"key",
")",
"{",
"return",
"key",
"==",
"null",
"?",
"null",
":",
"key",
".",
"getRaw",
"(",
")",
";",
"}"
] | Null-safe extraction of the raw key | [
"Null",
"-",
"safe",
"extraction",
"of",
"the",
"raw",
"key"
] | 4bf325d2e49b400326416977c7d9bbdf5380175b | https://github.com/objectify/objectify/blob/4bf325d2e49b400326416977c7d9bbdf5380175b/src/main/java/com/googlecode/objectify/impl/Keys.java#L215-L217 | test | Gets the raw value of the given key. | Of course, here is the Java code you requested:
```java
public static com.google.cloud.datastore.Key raw(final Key<?> key) {
return key == null ? null : key.getRaw();
}
```
Hope this helps! |
oblac/jodd | jodd-bean/src/main/java/jodd/typeconverter/Converter.java | Converter.toLong | public Long toLong(final Object value) {
final TypeConverter<Long> tc = TypeConverterManager.get().lookup(Long.class);
return tc.convert(value);
} | java | public Long toLong(final Object value) {
final TypeConverter<Long> tc = TypeConverterManager.get().lookup(Long.class);
return tc.convert(value);
} | [
"public",
"Long",
"toLong",
"(",
"final",
"Object",
"value",
")",
"{",
"final",
"TypeConverter",
"<",
"Long",
">",
"tc",
"=",
"TypeConverterManager",
".",
"get",
"(",
")",
".",
"lookup",
"(",
"Long",
".",
"class",
")",
";",
"return",
"tc",
".",
"conver... | Converts value to <code>Long</code>. | [
"Converts",
"value",
"to",
"<code",
">",
"Long<",
"/",
"code",
">",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-bean/src/main/java/jodd/typeconverter/Converter.java#L132-L135 | test | Converts value to Long. | Of course, here is the Java code you requested:
```java
public Long toLong(final Object value) {
final TypeConverter<Long> tc = TypeConverterManager.get().lookup(Long.class);
return tc.convert(value);
}
```
Hope this helps! |
tony19/logback-android | logback-android/src/main/java/ch/qos/logback/core/joran/action/ShutdownHookAction.java | ShutdownHookAction.begin | @Override
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {
hook = null;
inError = false;
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (OptionHelper.isEmpty(className)) {
className = DefaultShutdownHoo... | java | @Override
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {
hook = null;
inError = false;
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (OptionHelper.isEmpty(className)) {
className = DefaultShutdownHoo... | [
"@",
"Override",
"public",
"void",
"begin",
"(",
"InterpretationContext",
"ic",
",",
"String",
"name",
",",
"Attributes",
"attributes",
")",
"throws",
"ActionException",
"{",
"hook",
"=",
"null",
";",
"inError",
"=",
"false",
";",
"String",
"className",
"=",
... | Instantiates a shutdown hook of the given class and sets its name.
The hook thus generated is placed in the {@link InterpretationContext}'s
shutdown hook bag. | [
"Instantiates",
"a",
"shutdown",
"hook",
"of",
"the",
"given",
"class",
"and",
"sets",
"its",
"name",
"."
] | 028489c11ccfc1237a53923db06f22a90b41809c | https://github.com/tony19/logback-android/blob/028489c11ccfc1237a53923db06f22a90b41809c/logback-android/src/main/java/ch/qos/logback/core/joran/action/ShutdownHookAction.java#L43-L67 | test | Begin processing of the Hibernate shutdown hook. | Of course, here is the Java code you requested:
```java
@Override
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {
hook = null;
inError = false;
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (OptionHelper.isEmpty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.