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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/cache/support/AbstractSynchronizedCacheStrategyDecorator.java | AbstractSynchronizedCacheStrategyDecorator.getLockForKey | private ReadWriteLock getLockForKey(final K key) {
final ReadWriteLock lock = locks.putIfAbsent(key, new ReentrantReadWriteLock());
return lock == null ? locks.get(key) : lock;
} | java | private ReadWriteLock getLockForKey(final K key) {
final ReadWriteLock lock = locks.putIfAbsent(key, new ReentrantReadWriteLock());
return lock == null ? locks.get(key) : lock;
} | [
"private",
"ReadWriteLock",
"getLockForKey",
"(",
"final",
"K",
"key",
")",
"{",
"final",
"ReadWriteLock",
"lock",
"=",
"locks",
".",
"putIfAbsent",
"(",
"key",
",",
"new",
"ReentrantReadWriteLock",
"(",
")",
")",
";",
"return",
"lock",
"==",
"null",
"?",
... | Ensure that the returned lock will never be null. | [
"Ensure",
"that",
"the",
"returned",
"lock",
"will",
"never",
"be",
"null",
"."
] | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/cache/support/AbstractSynchronizedCacheStrategyDecorator.java#L86-L89 | test | Get lock for given key. | Of course, here is the Java code you requested:
```java
private ReadWriteLock getLockForKey(final K key) {
final ReadWriteLock lock = locks.putIfAbsent(key, new ReentrantReadWriteLock());
return lock == null ? locks.get(key) : lock;
}
```
Hope this helps! |
lessthanoptimal/GeoRegression | main/src/georegression/metric/ClosestPoint2D_F64.java | ClosestPoint2D_F64.closestPoint | public static Point2D_F64 closestPoint( LineParametric2D_F64 line,
Point2D_F64 p,
Point2D_F64 output ) {
if( output == null )
output = new Point2D_F64();
double t = closestPointT( line, p );
output.x = line.p.x + line.slope.x * t;
output.y = line.p.y + line.slope.y * t;
return outp... | java | public static Point2D_F64 closestPoint( LineParametric2D_F64 line,
Point2D_F64 p,
Point2D_F64 output ) {
if( output == null )
output = new Point2D_F64();
double t = closestPointT( line, p );
output.x = line.p.x + line.slope.x * t;
output.y = line.p.y + line.slope.y * t;
return outp... | [
"public",
"static",
"Point2D_F64",
"closestPoint",
"(",
"LineParametric2D_F64",
"line",
",",
"Point2D_F64",
"p",
",",
"Point2D_F64",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"output",
"=",
"new",
"Point2D_F64",
"(",
")",
";",
"double",
"t"... | <p>
Finds the closest point on 'line' to the specified point.
</p>
@param line Line along which the closest point is being found.
@param p Point.
@param output Where the solution is stored. If null a new instance is created. Modified.
@return Closest point on the line. | [
"<p",
">",
"Finds",
"the",
"closest",
"point",
"on",
"line",
"to",
"the",
"specified",
"point",
".",
"<",
"/",
"p",
">"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/metric/ClosestPoint2D_F64.java#L76-L88 | test | Computes the closest point from the line to the given point. | Of course, here is the Java code you requested:
```java
public static Point2D_F64 closestPoint( LineParametric2D_F64 line,
Point2D_F64 p,
Point2D_F64 output ) {
if( output == null )
output = new Point2D_F64();
double t = closestPointT( line, p );
output.x = line.p.x + line.slope.x * t;... |
spring-projects/spring-security | crypto/src/main/java/org/springframework/security/crypto/encrypt/Encryptors.java | Encryptors.standard | public static BytesEncryptor standard(CharSequence password, CharSequence salt) {
return new AesBytesEncryptor(password.toString(), salt,
KeyGenerators.secureRandom(16));
} | java | public static BytesEncryptor standard(CharSequence password, CharSequence salt) {
return new AesBytesEncryptor(password.toString(), salt,
KeyGenerators.secureRandom(16));
} | [
"public",
"static",
"BytesEncryptor",
"standard",
"(",
"CharSequence",
"password",
",",
"CharSequence",
"salt",
")",
"{",
"return",
"new",
"AesBytesEncryptor",
"(",
"password",
".",
"toString",
"(",
")",
",",
"salt",
",",
"KeyGenerators",
".",
"secureRandom",
"(... | Creates a standard password-based bytes encryptor using 256 bit AES encryption.
Derives the secret key using PKCS #5's PBKDF2 (Password-Based Key Derivation
Function #2). Salts the password to prevent dictionary attacks against the key. The
provided salt is expected to be hex-encoded; it should be random and at least 8... | [
"Creates",
"a",
"standard",
"password",
"-",
"based",
"bytes",
"encryptor",
"using",
"256",
"bit",
"AES",
"encryption",
".",
"Derives",
"the",
"secret",
"key",
"using",
"PKCS",
"#5",
"s",
"PBKDF2",
"(",
"Password",
"-",
"Based",
"Key",
"Derivation",
"Functio... | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/crypto/src/main/java/org/springframework/security/crypto/encrypt/Encryptors.java#L64-L67 | test | Creates a standard encryption bytes encryptor. | Of course, here is the Java code you requested:
```java
public static BytesEncryptor standard(CharSequence password, CharSequence salt) {
return new AesBytesEncryptor(password.toString(), salt,
KeyGenerators.secureRandom(16));
}
```
Hope this helps! |
google/guice | core/src/com/google/inject/multibindings/MapBinder.java | MapBinder.newMapBinder | public static <K, V> MapBinder<K, V> newMapBinder(
Binder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType, Annotation annotation) {
return new MapBinder<K, V>(
newRealMapBinder(binder.skipSources(MapBinder.class), keyType, valueType, annotation));
} | java | public static <K, V> MapBinder<K, V> newMapBinder(
Binder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType, Annotation annotation) {
return new MapBinder<K, V>(
newRealMapBinder(binder.skipSources(MapBinder.class), keyType, valueType, annotation));
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapBinder",
"<",
"K",
",",
"V",
">",
"newMapBinder",
"(",
"Binder",
"binder",
",",
"TypeLiteral",
"<",
"K",
">",
"keyType",
",",
"TypeLiteral",
"<",
"V",
">",
"valueType",
",",
"Annotation",
"annotation",
"... | Returns a new mapbinder that collects entries of {@code keyType}/{@code valueType} in a {@link
Map} that is itself bound with {@code annotation}. | [
"Returns",
"a",
"new",
"mapbinder",
"that",
"collects",
"entries",
"of",
"{"
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/multibindings/MapBinder.java#L119-L123 | test | Create a new MapBinder. | Of course, here is the Java code you requested:
```java
public static <K, V> MapBinder<K, V> newMapBinder(
Binder binder, TypeLiteral<K> keyType, TypeLiteral<V> valueType, Annotation annotation) {
return new MapBinder<K, V>(
newRealMapBinder(binder.skipSources(MapBinder.class), keyType, valueType, an... |
OpenEstate/OpenEstate-IO | ImmoXML/src/main/jaxb/org/openestate/io/immoxml/xml/ObjectFactory.java | ObjectFactory.createNutzflaeche | @XmlElementDecl(namespace = "http://www.immoxml.de", name = "nutzflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createNutzflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Nutzflaeche_QNAME, BigDecimal.class, null, value);
} | java | @XmlElementDecl(namespace = "http://www.immoxml.de", name = "nutzflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createNutzflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Nutzflaeche_QNAME, BigDecimal.class, null, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"http://www.immoxml.de\"",
",",
"name",
"=",
"\"nutzflaeche\"",
")",
"@",
"XmlJavaTypeAdapter",
"(",
"Adapter7",
".",
"class",
")",
"public",
"JAXBElement",
"<",
"BigDecimal",
">",
"createNutzflaeche",
"(",
"BigDecimal... | 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#L1419-L1423 | test | Create an instance of an nutzflaeche element. | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "http://www.immoxml.de", name = "nutzflaeche")
@XmlJavaTypeAdapter(Adapter7 .class)
public JAXBElement<BigDecimal> createNutzflaeche(BigDecimal value) {
return new JAXBElement<BigDecimal>(_Nutzflaeche_QNAME, BigDecimal.... |
spring-projects/spring-security | web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java | ServerWebExchangeMatchers.anyExchange | public static ServerWebExchangeMatcher anyExchange() {
// we don't use a lambda to ensure a unique equals and hashcode
// which otherwise can cause problems with adding multiple entries to an ordered LinkedHashMap
return new ServerWebExchangeMatcher() {
@Override
public Mono<MatchResult> matches(ServerWebEx... | java | public static ServerWebExchangeMatcher anyExchange() {
// we don't use a lambda to ensure a unique equals and hashcode
// which otherwise can cause problems with adding multiple entries to an ordered LinkedHashMap
return new ServerWebExchangeMatcher() {
@Override
public Mono<MatchResult> matches(ServerWebEx... | [
"public",
"static",
"ServerWebExchangeMatcher",
"anyExchange",
"(",
")",
"{",
"// we don't use a lambda to ensure a unique equals and hashcode",
"// which otherwise can cause problems with adding multiple entries to an ordered LinkedHashMap",
"return",
"new",
"ServerWebExchangeMatcher",
"(",... | Matches any exchange
@return the matcher to use | [
"Matches",
"any",
"exchange"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatchers.java#L68-L77 | test | Returns a matcher that matches any HTTP request on any server. | Of course, here is the Java code you requested:
```java
public static ServerWebExchangeMatcher anyExchange() {
// we don't use a lambda to ensure a unique equals and hashcode
// which otherwise can cause problems with adding multiple entries to an ordered LinkedHashMap
return new ServerWebExchangeMatcher() {
... |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/JspUtil.java | JspUtil.getTagHandlerClassName | public static String getTagHandlerClassName(String path,
ErrorDispatcher err)
throws JasperException {
String className = null;
int begin = 0;
int index;
index = path.lastIndexOf(".tag");
if (index == -1) {
err.jspError("jsp.error.tagfi... | java | public static String getTagHandlerClassName(String path,
ErrorDispatcher err)
throws JasperException {
String className = null;
int begin = 0;
int index;
index = path.lastIndexOf(".tag");
if (index == -1) {
err.jspError("jsp.error.tagfi... | [
"public",
"static",
"String",
"getTagHandlerClassName",
"(",
"String",
"path",
",",
"ErrorDispatcher",
"err",
")",
"throws",
"JasperException",
"{",
"String",
"className",
"=",
"null",
";",
"int",
"begin",
"=",
"0",
";",
"int",
"index",
";",
"index",
"=",
"p... | Gets the fully-qualified class name of the tag handler corresponding to
the given tag file path.
@param path Tag file path
@param err Error dispatcher
@return Fully-qualified class name of the tag handler corresponding to
the given tag file path | [
"Gets",
"the",
"fully",
"-",
"qualified",
"class",
"name",
"of",
"the",
"tag",
"handler",
"corresponding",
"to",
"the",
"given",
"tag",
"file",
"path",
"."
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/JspUtil.java#L933-L973 | test | Get the tag handler class name from the path. | Of course, here is the Java code you requested:
```java
public static String getTagHandlerClassName(String path,
ErrorDispatcher err)
throws JasperException {
String className = null;
int begin = 0;
int index;
index = path.lastIndexOf(".tag");
if ... |
spring-projects/spring-security | core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java | AbstractMethodSecurityMetadataSource.getAttributes | public final Collection<ConfigAttribute> getAttributes(Object object) {
if (object instanceof MethodInvocation) {
MethodInvocation mi = (MethodInvocation) object;
Object target = mi.getThis();
Class<?> targetClass = null;
if (target != null) {
targetClass = target instanceof Class<?> ? (Class<?>) tar... | java | public final Collection<ConfigAttribute> getAttributes(Object object) {
if (object instanceof MethodInvocation) {
MethodInvocation mi = (MethodInvocation) object;
Object target = mi.getThis();
Class<?> targetClass = null;
if (target != null) {
targetClass = target instanceof Class<?> ? (Class<?>) tar... | [
"public",
"final",
"Collection",
"<",
"ConfigAttribute",
">",
"getAttributes",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"MethodInvocation",
")",
"{",
"MethodInvocation",
"mi",
"=",
"(",
"MethodInvocation",
")",
"object",
";",
"Object... | ======================================================================================================== | [
"========================================================================================================"
] | 98a8467e4c2ae05b3e09c67ece856944fa48ed23 | https://github.com/spring-projects/spring-security/blob/98a8467e4c2ae05b3e09c67ece856944fa48ed23/core/src/main/java/org/springframework/security/access/method/AbstractMethodSecurityMetadataSource.java#L42-L63 | test | Get the attributes of a method invocation. | Of course, here is the Java code you requested:
```java
public final Collection<ConfigAttribute> getAttributes(Object object) {
if (object instanceof MethodInvocation) {
MethodInvocation mi = (MethodInvocation) object;
Object target = mi.getThis();
Class<?> targetClass = null;
if (target != null) {
... |
mbeiter/jaas | loginmodules/password/authenticators/jdbc/src/main/java/org/beiter/michael/authn/jaas/loginmodules/password/authenticators/jdbc/propsbuilder/JaasBasedDbPropsBuilder.java | JaasBasedDbPropsBuilder.build | public static DbProperties build(final Map<String, ?> properties) {
Validate.notNull(properties, "The validated object 'properties' is null");
final DbProperties dbProps = new DbProperties();
String tmp = getOption(KEY_JNDI_CONNECTION_NAME, properties);
if (StringUtils.isNotEmpty(tmp))... | java | public static DbProperties build(final Map<String, ?> properties) {
Validate.notNull(properties, "The validated object 'properties' is null");
final DbProperties dbProps = new DbProperties();
String tmp = getOption(KEY_JNDI_CONNECTION_NAME, properties);
if (StringUtils.isNotEmpty(tmp))... | [
"public",
"static",
"DbProperties",
"build",
"(",
"final",
"Map",
"<",
"String",
",",
"?",
">",
"properties",
")",
"{",
"Validate",
".",
"notNull",
"(",
"properties",
",",
"\"The validated object 'properties' is null\"",
")",
";",
"final",
"DbProperties",
"dbProps... | Initialize a set of database properties based on key / values in a <code>HashMap</code>.
@param properties A <code>HashMap</code> with configuration properties as required by the init() method in JAAS,
using the keys as specified in this class
@return A <code>DbProperties</code> object with default values, plus the pr... | [
"Initialize",
"a",
"set",
"of",
"database",
"properties",
"based",
"on",
"key",
"/",
"values",
"in",
"a",
"<code",
">",
"HashMap<",
"/",
"code",
">",
"."
] | 540e78af91c73291fa0e57b0df352f4a22950772 | https://github.com/mbeiter/jaas/blob/540e78af91c73291fa0e57b0df352f4a22950772/loginmodules/password/authenticators/jdbc/src/main/java/org/beiter/michael/authn/jaas/loginmodules/password/authenticators/jdbc/propsbuilder/JaasBasedDbPropsBuilder.java#L119-L166 | test | Build the DbProperties object from the given properties. | Of course, here is the Java code you requested:
```java
public static DbProperties build(final Map<String, ?> properties) {
Validate.notNull(properties, "The validated object 'properties' is null");
final DbProperties dbProps = new DbProperties();
String tmp = getOption(KEY_JNDI_CONNECTION_NA... |
playframework/playframework | web/play-java-forms/src/main/java/play/data/Form.java | Form.bind | @SuppressWarnings("unchecked")
public Form<T> bind(
Lang lang,
TypedMap attrs,
Map<String, String> data,
Map<String, Http.MultipartFormData.FilePart<?>> files,
String... allowedFields) {
final DataBinder dataBinder = dataBinder(allowedFields);
final Map<String, Object> objectDat... | java | @SuppressWarnings("unchecked")
public Form<T> bind(
Lang lang,
TypedMap attrs,
Map<String, String> data,
Map<String, Http.MultipartFormData.FilePart<?>> files,
String... allowedFields) {
final DataBinder dataBinder = dataBinder(allowedFields);
final Map<String, Object> objectDat... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Form",
"<",
"T",
">",
"bind",
"(",
"Lang",
"lang",
",",
"TypedMap",
"attrs",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
",",
"Map",
"<",
"String",
",",
"Http",
".",
"MultipartFo... | Binds data to this form - that is, handles form submission.
@param lang used for validators and formatters during binding and is part of {@link
ValidationPayload}. Later also used for formatting when retrieving a field (via {@link
#field(String)} or {@link #apply(String)}) and for translations in {@link #errorsAsJson(... | [
"Binds",
"data",
"to",
"this",
"form",
"-",
"that",
"is",
"handles",
"form",
"submission",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/web/play-java-forms/src/main/java/play/data/Form.java#L1095-L1149 | test | Bind a form to a single field. | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public Form<T> bind(
Lang lang,
TypedMap attrs,
Map<String, String> data,
Map<String, Http.MultipartFormData.FilePart<?>> files,
String... allowedFields) {
final DataBinder dataBinder = dataBinde... |
RestComm/jain-slee | container/services/src/main/java/org/mobicents/slee/runtime/sbbentity/ChildRelationImpl.java | ChildRelationImpl.contains | public boolean contains(Object object) {
if (!(object instanceof SbbLocalObject))
return false;
final SbbLocalObjectImpl sbblocal = (SbbLocalObjectImpl) object;
final SbbEntityID sbbEntityId = sbblocal.getSbbEntityId();
if(!idBelongsToChildRelation(sbbEntityId)) {... | java | public boolean contains(Object object) {
if (!(object instanceof SbbLocalObject))
return false;
final SbbLocalObjectImpl sbblocal = (SbbLocalObjectImpl) object;
final SbbEntityID sbbEntityId = sbblocal.getSbbEntityId();
if(!idBelongsToChildRelation(sbbEntityId)) {... | [
"public",
"boolean",
"contains",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"!",
"(",
"object",
"instanceof",
"SbbLocalObject",
")",
")",
"return",
"false",
";",
"final",
"SbbLocalObjectImpl",
"sbblocal",
"=",
"(",
"SbbLocalObjectImpl",
")",
"object",
";",
... | The contains method. This method returns true if the SBB entity
represented by the SBB local object specified by the input argument is a
member of this child relation. If the method argument is not an SBB local
object, is an invalid SBB local object, or is an SBB local object whose
underlying SBB entity is not a member... | [
"The",
"contains",
"method",
".",
"This",
"method",
"returns",
"true",
"if",
"the",
"SBB",
"entity",
"represented",
"by",
"the",
"SBB",
"local",
"object",
"specified",
"by",
"the",
"input",
"argument",
"is",
"a",
"member",
"of",
"this",
"child",
"relation",
... | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/services/src/main/java/org/mobicents/slee/runtime/sbbentity/ChildRelationImpl.java#L123-L135 | test | Check if the specified object is in the cache. | Of course, here is the Java code you requested:
```java
public boolean contains(Object object) {
if (!(object instanceof SbbLocalObject))
return false;
final SbbLocalObjectImpl sbblocal = (SbbLocalObjectImpl) object;
final SbbEntityID sbbEntityId = sbblocal.getSbbEntityI... |
ReactiveX/RxJava | src/main/java/io/reactivex/Flowable.java | Flowable.publish | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<R>> selector) {
return publish(selector, bufferSize());
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<R>> selector) {
return publish(selector, bufferSize());
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"FULL",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"<",
"R",
">",
"Flowable",
"<",
"R",
">",
"publish",
"(",
"Function",
"<",
... | Returns a Flowable that emits the results of invoking a specified selector on items emitted by a
{@link ConnectableFlowable} that shares a single subscription to the underlying sequence.
<p>
<img width="640" height="510" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/publishConnect.f.png" alt="">... | [
"Returns",
"a",
"Flowable",
"that",
"emits",
"the",
"results",
"of",
"invoking",
"a",
"specified",
"selector",
"on",
"items",
"emitted",
"by",
"a",
"{",
"@link",
"ConnectableFlowable",
"}",
"that",
"shares",
"a",
"single",
"subscription",
"to",
"the",
"underly... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Flowable.java#L12353-L12358 | test | Publish a sequence of items using a single selector. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
@SchedulerSupport(SchedulerSupport.NONE)
public final <R> Flowable<R> publish(Function<? super Flowable<T>, ? extends Publisher<R>> selector) {
return publish(selector, bufferSize()... |
oblac/jodd | jodd-servlet/src/main/java/jodd/servlet/ServletUtil.java | ServletUtil.getRequestParameter | public static Object getRequestParameter(final ServletRequest request, final String name) {
String[] values = request.getParameterValues(name);
if (values == null) {
return null;
}
if (values.length == 1) {
return values[0];
}
return values;
} | java | public static Object getRequestParameter(final ServletRequest request, final String name) {
String[] values = request.getParameterValues(name);
if (values == null) {
return null;
}
if (values.length == 1) {
return values[0];
}
return values;
} | [
"public",
"static",
"Object",
"getRequestParameter",
"(",
"final",
"ServletRequest",
"request",
",",
"final",
"String",
"name",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"request",
".",
"getParameterValues",
"(",
"name",
")",
";",
"if",
"(",
"values",
"==... | Returns HTTP request parameter as String or String[]. | [
"Returns",
"HTTP",
"request",
"parameter",
"as",
"String",
"or",
"String",
"[]",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-servlet/src/main/java/jodd/servlet/ServletUtil.java#L572-L581 | test | Gets the value of a request parameter. | Of course, here is the Java code you requested:
```java
public static Object getRequestParameter(final ServletRequest request, final String name) {
String[] values = request.getParameterValues(name);
if (values == null) {
return null;
}
if (values.length == 1) {
return values[0];
}
return values;
}
... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.asFlatBuffers | public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration) {
Nd4j.getExecutioner().commit();
FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
val idCounter = new AtomicInteger(0);
val flatVariables = new ArrayList<Integer>();
val flatOffsets = ne... | java | public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration) {
Nd4j.getExecutioner().commit();
FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
val idCounter = new AtomicInteger(0);
val flatVariables = new ArrayList<Integer>();
val flatOffsets = ne... | [
"public",
"ByteBuffer",
"asFlatBuffers",
"(",
"@",
"NonNull",
"ExecutorConfiguration",
"configuration",
")",
"{",
"Nd4j",
".",
"getExecutioner",
"(",
")",
".",
"commit",
"(",
")",
";",
"FlatBufferBuilder",
"bufferBuilder",
"=",
"new",
"FlatBufferBuilder",
"(",
"10... | This method exports given SameDiff instance into FlatBuffers
@param configuration - ExecutorConfiguration to be embedded into serialized graph
@return | [
"This",
"method",
"exports",
"given",
"SameDiff",
"instance",
"into",
"FlatBuffers"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L6253-L6341 | test | Export the data structure to a flat buffer | Of course, here is the Java code you requested:
```java
public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration) {
Nd4j.getExecutioner().commit();
FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
val idCounter = new AtomicInteger(0);
val flatVariables... |
GojaFramework/goja | goja-core/src/main/java/goja/core/kits/lang/Strs.java | Strs.fillBinary | public static String fillBinary(int d, int width) {
return Strs.alignRight(Integer.toBinaryString(d), width, '0');
} | java | public static String fillBinary(int d, int width) {
return Strs.alignRight(Integer.toBinaryString(d), width, '0');
} | [
"public",
"static",
"String",
"fillBinary",
"(",
"int",
"d",
",",
"int",
"width",
")",
"{",
"return",
"Strs",
".",
"alignRight",
"(",
"Integer",
".",
"toBinaryString",
"(",
"d",
")",
",",
"width",
",",
"'",
"'",
")",
";",
"}"
] | 将一个整数转换成最小长度为某一固定数值的二进制形式字符串
@param d 整数
@param width 宽度
@return 新字符串 | [
"将一个整数转换成最小长度为某一固定数值的二进制形式字符串"
] | 77179b495f668fc1fa20accc912991df6bb2d917 | https://github.com/GojaFramework/goja/blob/77179b495f668fc1fa20accc912991df6bb2d917/goja-core/src/main/java/goja/core/kits/lang/Strs.java#L1600-L1602 | test | Fill binary string. | Of course, here is the Java code you requested:
```java
public static String fillBinary(int d, int width) {
return Strs.alignRight(Integer.toBinaryString(d), width, '0');
}
```
Hope this helps! |
wildfly/wildfly | pojo/src/main/java/org/jboss/as/pojo/service/Configurator.java | Configurator.simpleCheck | protected static boolean simpleCheck(String[] typeNames, Class<?>[] typeInfos) {
return typeNames != null && typeInfos != null && typeNames.length == typeInfos.length;
} | java | protected static boolean simpleCheck(String[] typeNames, Class<?>[] typeInfos) {
return typeNames != null && typeInfos != null && typeNames.length == typeInfos.length;
} | [
"protected",
"static",
"boolean",
"simpleCheck",
"(",
"String",
"[",
"]",
"typeNames",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"typeInfos",
")",
"{",
"return",
"typeNames",
"!=",
"null",
"&&",
"typeInfos",
"!=",
"null",
"&&",
"typeNames",
".",
"length",
"... | A simple null and length check.
@param typeNames the type names
@param typeInfos the type infos
@return false if either argument is null or lengths differ, else true | [
"A",
"simple",
"null",
"and",
"length",
"check",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/pojo/src/main/java/org/jboss/as/pojo/service/Configurator.java#L239-L241 | test | Simple check. | Of course, here is the Java code you requested:
```java
protected static boolean simpleCheck(String[] typeNames, Class<?>[] typeInfos) {
return typeNames != null && typeInfos != null && typeNames.length == typeInfos.length;
}
```
Hope this helps! |
kiegroup/droolsjbpm-tools | drools-eclipse/org.guvnor.eclipse.webdav/src/interface/org/eclipse/webdav/dom/ElementEditor.java | ElementEditor.declareNS | public static void declareNS(Element element, String prefix, String namespaceUrl) {
Assert.isNotNull(element);
Assert.isTrue(namespaceUrl != null || prefix == null && namespaceUrl == null);
String name = XML_PREFIX + (prefix == null ? "" : ":" + prefix); //$NON-NLS-1$ //$NON-NLS-2$
Strin... | java | public static void declareNS(Element element, String prefix, String namespaceUrl) {
Assert.isNotNull(element);
Assert.isTrue(namespaceUrl != null || prefix == null && namespaceUrl == null);
String name = XML_PREFIX + (prefix == null ? "" : ":" + prefix); //$NON-NLS-1$ //$NON-NLS-2$
Strin... | [
"public",
"static",
"void",
"declareNS",
"(",
"Element",
"element",
",",
"String",
"prefix",
",",
"String",
"namespaceUrl",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"element",
")",
";",
"Assert",
".",
"isTrue",
"(",
"namespaceUrl",
"!=",
"null",
"||",
"p... | Adds a namespace declaration to the given element. If only the prefix
is <code>null</code>, a default namespace is declared. If the prefix
and the namespaceUrl are <code>null</code> the default namespace is
removed. The element must not be <code>null</code>. If the
namespaceUrl is <code>null</code>, the <code>prefix</c... | [
"Adds",
"a",
"namespace",
"declaration",
"to",
"the",
"given",
"element",
".",
"If",
"only",
"the",
"prefix",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"a",
"default",
"namespace",
"is",
"declared",
".",
"If",
"the",
"prefix",
"and",
"the",
"namespa... | 05e1f73c591178360a198dca29f99d73918991db | https://github.com/kiegroup/droolsjbpm-tools/blob/05e1f73c591178360a198dca29f99d73918991db/drools-eclipse/org.guvnor.eclipse.webdav/src/interface/org/eclipse/webdav/dom/ElementEditor.java#L385-L391 | test | Declare the namespace of the given element. | Of course, here is the Java code you requested:
```java
public static void declareNS(Element element, String prefix, String namespaceUrl) {
Assert.isNotNull(element);
Assert.isTrue(namespaceUrl != null || prefix == null && namespaceUrl == null);
String name = XML_PREFIX + (prefix == null ? "" :... |
OpenEstate/OpenEstate-IO | Core/src/main/java/org/openestate/io/core/LocaleUtils.java | LocaleUtils.getCountryISO3FromISO2 | public static String getCountryISO3FromISO2(String iso2Code) {
iso2Code = StringUtils.trimToNull(iso2Code);
if (iso2Code == null) return null;
if (iso2Code.length() == 2) {
Locale countryLocale = new Locale(iso2Code, iso2Code);
String iso3Code = StringUtils.trimToNull(cou... | java | public static String getCountryISO3FromISO2(String iso2Code) {
iso2Code = StringUtils.trimToNull(iso2Code);
if (iso2Code == null) return null;
if (iso2Code.length() == 2) {
Locale countryLocale = new Locale(iso2Code, iso2Code);
String iso3Code = StringUtils.trimToNull(cou... | [
"public",
"static",
"String",
"getCountryISO3FromISO2",
"(",
"String",
"iso2Code",
")",
"{",
"iso2Code",
"=",
"StringUtils",
".",
"trimToNull",
"(",
"iso2Code",
")",
";",
"if",
"(",
"iso2Code",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"iso2Code",... | Create an ISO-3 country code from an ISO-2 country code.
@param iso2Code ISO-2 country code
@return ISO-3 country code or null, if no code was found | [
"Create",
"an",
"ISO",
"-",
"3",
"country",
"code",
"from",
"an",
"ISO",
"-",
"2",
"country",
"code",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Core/src/main/java/org/openestate/io/core/LocaleUtils.java#L126-L135 | test | Get the country ISO 3 code from ISO 2. | Of course, here is the Java code you requested:
```java
public static String getCountryISO3FromISO2(String iso2Code) {
iso2Code = StringUtils.trimToNull(iso2Code);
if (iso2Code == null) return null;
if (iso2Code.length() == 2) {
Locale countryLocale = new Locale(iso2Code, iso2Code);... |
Unidata/thredds | cdm/src/main/java/ucar/unidata/io/Swap.java | Swap.swapFloat | static public float swapFloat(float v) {
int l = swapInt(Float.floatToIntBits(v));
return (Float.intBitsToFloat(l));
} | java | static public float swapFloat(float v) {
int l = swapInt(Float.floatToIntBits(v));
return (Float.intBitsToFloat(l));
} | [
"static",
"public",
"float",
"swapFloat",
"(",
"float",
"v",
")",
"{",
"int",
"l",
"=",
"swapInt",
"(",
"Float",
".",
"floatToIntBits",
"(",
"v",
")",
")",
";",
"return",
"(",
"Float",
".",
"intBitsToFloat",
"(",
"l",
")",
")",
";",
"}"
] | Returns the float resulting from reversing 4 bytes of a specified
float.
@param v input value for which byte reversal is desired
@return the value represented by the bytes of <code>v</code>
reversed | [
"Returns",
"the",
"float",
"resulting",
"from",
"reversing",
"4",
"bytes",
"of",
"a",
"specified",
"float",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/unidata/io/Swap.java#L169-L172 | test | Swaps the input float value. | Of course, here is the Java code you requested:
```java
static public float swapFloat(float v) {
int l = swapInt(Float.floatToIntBits(v));
return (Float.intBitsToFloat(l));
}
```
Hope this helps! |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/deployment/processors/ViewInterfaces.java | ViewInterfaces.getPotentialViewInterfaces | static Set<Class<?>> getPotentialViewInterfaces(Class<?> beanClass) {
Class<?>[] interfaces = beanClass.getInterfaces();
if (interfaces == null) {
return Collections.emptySet();
}
final Set<Class<?>> potentialBusinessInterfaces = new HashSet<Class<?>>();
for (Class<?>... | java | static Set<Class<?>> getPotentialViewInterfaces(Class<?> beanClass) {
Class<?>[] interfaces = beanClass.getInterfaces();
if (interfaces == null) {
return Collections.emptySet();
}
final Set<Class<?>> potentialBusinessInterfaces = new HashSet<Class<?>>();
for (Class<?>... | [
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"getPotentialViewInterfaces",
"(",
"Class",
"<",
"?",
">",
"beanClass",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"beanClass",
".",
"getInterfaces",
"(",
")",
";",
"if",
"(",
"in... | Returns all interfaces implemented by a bean that are eligible to be view interfaces
@param beanClass The bean class
@return A collection of all potential view interfaces | [
"Returns",
"all",
"interfaces",
"implemented",
"by",
"a",
"bean",
"that",
"are",
"eligible",
"to",
"be",
"view",
"interfaces"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/deployment/processors/ViewInterfaces.java#L43-L60 | test | Get the list of view interfaces that are not serializable or externalizable. | Of course, here is the Java code you requested:
```java
static Set<Class<?>> getPotentialViewInterfaces(Class<?> beanClass) {
Class<?>[] interfaces = beanClass.getInterfaces();
if (interfaces == null) {
return Collections.emptySet();
}
final Set<Class<?>> potentialBusinessIn... |
algolia/algoliasearch-client-android | algoliasearch/src/main/java/com/algolia/search/saas/helpers/DisjunctiveFaceting.java | DisjunctiveFaceting.searchDisjunctiveFacetingAsync | public <T extends Collection<String>> Request searchDisjunctiveFacetingAsync(@NonNull Query query, @NonNull final Collection<String> disjunctiveFacets, @NonNull final Map<String, T> refinements, @NonNull final CompletionHandler completionHandler) {
final List<Query> queries = computeDisjunctiveFacetingQueries(q... | java | public <T extends Collection<String>> Request searchDisjunctiveFacetingAsync(@NonNull Query query, @NonNull final Collection<String> disjunctiveFacets, @NonNull final Map<String, T> refinements, @NonNull final CompletionHandler completionHandler) {
final List<Query> queries = computeDisjunctiveFacetingQueries(q... | [
"public",
"<",
"T",
"extends",
"Collection",
"<",
"String",
">",
">",
"Request",
"searchDisjunctiveFacetingAsync",
"(",
"@",
"NonNull",
"Query",
"query",
",",
"@",
"NonNull",
"final",
"Collection",
"<",
"String",
">",
"disjunctiveFacets",
",",
"@",
"NonNull",
... | Perform a search with disjunctive facets, generating as many queries as number of disjunctive facets.
@param query The query.
@param disjunctiveFacets List of disjunctive facets.
@param refinements The current refinements, mapping facet names to a list of values.
@param completionHandler The listener... | [
"Perform",
"a",
"search",
"with",
"disjunctive",
"facets",
"generating",
"as",
"many",
"queries",
"as",
"number",
"of",
"disjunctive",
"facets",
"."
] | 3293ba6e6116a4f6c1face2cc606bc047d6d4a3c | https://github.com/algolia/algoliasearch-client-android/blob/3293ba6e6116a4f6c1face2cc606bc047d6d4a3c/algoliasearch/src/main/java/com/algolia/search/saas/helpers/DisjunctiveFaceting.java#L69-L85 | test | Asynchronously search for disjunctive facets. | Of course, here is the Java code you requested:
```java
public <T extends Collection<String>> Request searchDisjunctiveFacetingAsync(@NonNull Query query, @NonNull final Collection<String> disjunctiveFacets, @NonNull final Map<String, T> refinements, @NonNull final CompletionHandler completionHandler) {
final ... |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageImpl.java | GeoPackageImpl.getAttributesDao | @Override
public AttributesDao getAttributesDao(Contents contents) {
if (contents == null) {
throw new GeoPackageException("Non null "
+ Contents.class.getSimpleName()
+ " is required to create "
+ AttributesDao.class.getSimpleName());... | java | @Override
public AttributesDao getAttributesDao(Contents contents) {
if (contents == null) {
throw new GeoPackageException("Non null "
+ Contents.class.getSimpleName()
+ " is required to create "
+ AttributesDao.class.getSimpleName());... | [
"@",
"Override",
"public",
"AttributesDao",
"getAttributesDao",
"(",
"Contents",
"contents",
")",
"{",
"if",
"(",
"contents",
"==",
"null",
")",
"{",
"throw",
"new",
"GeoPackageException",
"(",
"\"Non null \"",
"+",
"Contents",
".",
"class",
".",
"getSimpleName"... | {@inheritDoc} | [
"{"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageImpl.java#L325-L361 | test | Get the Attributes DAO | Of course, here is the Java code you requested:
```java
@Override
public AttributesDao getAttributesDao(Contents contents) {
if (contents == null) {
throw new GeoPackageException("Non null "
+ Contents.class.getSimpleName()
+ " is required to create "
... |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java | BaseNDArrayFactory.setDType | @Override
public void setDType(DataBuffer.Type dtype) {
assert dtype == DataBuffer.Type.DOUBLE || dtype == DataBuffer.Type.FLOAT
|| dtype == DataBuffer.Type.INT : "Invalid opType passed, must be float or double";
// this.dtype = dtype;
} | java | @Override
public void setDType(DataBuffer.Type dtype) {
assert dtype == DataBuffer.Type.DOUBLE || dtype == DataBuffer.Type.FLOAT
|| dtype == DataBuffer.Type.INT : "Invalid opType passed, must be float or double";
// this.dtype = dtype;
} | [
"@",
"Override",
"public",
"void",
"setDType",
"(",
"DataBuffer",
".",
"Type",
"dtype",
")",
"{",
"assert",
"dtype",
"==",
"DataBuffer",
".",
"Type",
".",
"DOUBLE",
"||",
"dtype",
"==",
"DataBuffer",
".",
"Type",
".",
"FLOAT",
"||",
"dtype",
"==",
"DataB... | Sets the data opType
@param dtype | [
"Sets",
"the",
"data",
"opType"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L173-L178 | test | Sets the data type of the record. | Of course, here is the Java code you requested:
```java
@Override
public void setDType(DataBuffer.Type dtype) {
assert dtype == DataBuffer.Type.DOUBLE || dtype == DataBuffer.Type.FLOAT
|| dtype == DataBuffer.Type.INT : "Invalid opType passed, must be float or double";
// thi... |
deeplearning4j/nd4j | nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java | BigDecimalMath.hypot | static public BigDecimal hypot(final BigDecimal x, final BigDecimal y) {
/* compute x^2+y^2
*/
BigDecimal z = x.pow(2).add(y.pow(2));
/* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
* where the two errors are 1/2 of the ulp’s. Two intermediate p... | java | static public BigDecimal hypot(final BigDecimal x, final BigDecimal y) {
/* compute x^2+y^2
*/
BigDecimal z = x.pow(2).add(y.pow(2));
/* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
* where the two errors are 1/2 of the ulp’s. Two intermediate p... | [
"static",
"public",
"BigDecimal",
"hypot",
"(",
"final",
"BigDecimal",
"x",
",",
"final",
"BigDecimal",
"y",
")",
"{",
"/* compute x^2+y^2\n */",
"BigDecimal",
"z",
"=",
"x",
".",
"pow",
"(",
"2",
")",
".",
"add",
"(",
"y",
".",
"pow",
"(",
"2",
... | The hypotenuse.
@param x the first argument.
@param y the second argument.
@return the square root of the sum of the squares of the two arguments, sqrt(x^2+y^2). | [
"The",
"hypotenuse",
"."
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java#L284-L299 | test | Compute the hypot of two numbers. | Of course, here is the Java code you requested:
```java
static public BigDecimal hypot(final BigDecimal x, final BigDecimal y) {
/* compute x^2+y^2
*/
BigDecimal z = x.pow(2).add(y.pow(2));
/* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
* wher... |
boonproject/boon | boon/src/main/java/org/boon/validation/RecursiveDescentPropertyValidator.java | RecursiveDescentPropertyValidator.lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties | private List<FieldValidator>
lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties(
List<ValidatorMetaData> validationMetaDataList ) {
List<FieldValidator> validatorsList = new ArrayList<>();
/*
* Look up the crank validators and then apply the properties from the
... | java | private List<FieldValidator>
lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties(
List<ValidatorMetaData> validationMetaDataList ) {
List<FieldValidator> validatorsList = new ArrayList<>();
/*
* Look up the crank validators and then apply the properties from the
... | [
"private",
"List",
"<",
"FieldValidator",
">",
"lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties",
"(",
"List",
"<",
"ValidatorMetaData",
">",
"validationMetaDataList",
")",
"{",
"List",
"<",
"FieldValidator",
">",
"validatorsList",
"=",
"new",
"ArrayList",
... | Lookup the list of validators for the current field and initialize them
with validation meta-data properties.
@param validationMetaDataList list of validation meta-data
@return list of field validators. | [
"Lookup",
"the",
"list",
"of",
"validators",
"for",
"the",
"current",
"field",
"and",
"initialize",
"them",
"with",
"validation",
"meta",
"-",
"data",
"properties",
"."
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/validation/RecursiveDescentPropertyValidator.java#L203-L227 | test | This method is used to lookup the list of validators and initialize the them with the validationMetaDataList. | Of course, here is the Java code you requested:
```java
private List<FieldValidator>
lookupTheListOfValidatorsAndInitializeThemWithMetaDataProperties(
List<ValidatorMetaData> validationMetaDataList ) {
List<FieldValidator> validatorsList = new ArrayList<>();
/*
* Look up the ... |
blademainer/common_utils | commons-scan/src/main/java/com/xiongyingqi/util/PackageScanner.java | PackageScanner.addPackage | public PackageScanner addPackage(String pkg) {
Package aPackage = Package.getPackage(pkg);
addPackage(aPackage);
return this;
} | java | public PackageScanner addPackage(String pkg) {
Package aPackage = Package.getPackage(pkg);
addPackage(aPackage);
return this;
} | [
"public",
"PackageScanner",
"addPackage",
"(",
"String",
"pkg",
")",
"{",
"Package",
"aPackage",
"=",
"Package",
".",
"getPackage",
"(",
"pkg",
")",
";",
"addPackage",
"(",
"aPackage",
")",
";",
"return",
"this",
";",
"}"
] | 增加扫描的包
@param pkg
@return | [
"增加扫描的包"
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/commons-scan/src/main/java/com/xiongyingqi/util/PackageScanner.java#L47-L51 | test | Add a package to the scanner. | Of course, here is the Java code you requested:
```java
public PackageScanner addPackage(String pkg) {
Package aPackage = Package.getPackage(pkg);
addPackage(aPackage);
return this;
}
```
Hope this helps! |
agentsoz/jill | jill/src/main/java/io/github/agentsoz/jill/util/ArgumentsLoader.java | ArgumentsLoader.usage | public static String usage() {
return GlobalConstant.APP_HEADER + "\n\n" + "usage: " + Main.class.getName()
+ " [options] --agent-class <agentclass> --num-agents <numagents>" + "\n"
+ " --config <string> load configuration from string" + "\n"
+ " --configfile <file> ... | java | public static String usage() {
return GlobalConstant.APP_HEADER + "\n\n" + "usage: " + Main.class.getName()
+ " [options] --agent-class <agentclass> --num-agents <numagents>" + "\n"
+ " --config <string> load configuration from string" + "\n"
+ " --configfile <file> ... | [
"public",
"static",
"String",
"usage",
"(",
")",
"{",
"return",
"GlobalConstant",
".",
"APP_HEADER",
"+",
"\"\\n\\n\"",
"+",
"\"usage: \"",
"+",
"Main",
".",
"class",
".",
"getName",
"(",
")",
"+",
"\" [options] --agent-class <agentclass> --num-agents <numagents>\"",... | Returns a usage string for the Jill command line arguments.
@return the usage string | [
"Returns",
"a",
"usage",
"string",
"for",
"the",
"Jill",
"command",
"line",
"arguments",
"."
] | 13126fc78350465b477386132465f84cad719426 | https://github.com/agentsoz/jill/blob/13126fc78350465b477386132465f84cad719426/jill/src/main/java/io/github/agentsoz/jill/util/ArgumentsLoader.java#L56-L68 | test | Get the usage message for the application | Of course, here is the Java code you requested:
```java
public static String usage() {
return GlobalConstant.APP_HEADER + "\n\n" + "usage: " + Main.class.getName()
+ " [options] --agent-class <agentclass> --num-agents <numagents>" + "\n"
+ " --config <string> load configuration f... |
Unidata/thredds | tds/src/main/java/thredds/server/TdsErrorHandling.java | TdsErrorHandling.handle | @ExceptionHandler(Throwable.class)
public ResponseEntity<String> handle(Throwable ex) throws Throwable {
// If the exception is annotated with @ResponseStatus rethrow it and let
// the framework handle it - like the OrderNotFoundException example
// at the start of this post.
// AnnotationUtils is a S... | java | @ExceptionHandler(Throwable.class)
public ResponseEntity<String> handle(Throwable ex) throws Throwable {
// If the exception is annotated with @ResponseStatus rethrow it and let
// the framework handle it - like the OrderNotFoundException example
// at the start of this post.
// AnnotationUtils is a S... | [
"@",
"ExceptionHandler",
"(",
"Throwable",
".",
"class",
")",
"public",
"ResponseEntity",
"<",
"String",
">",
"handle",
"(",
"Throwable",
"ex",
")",
"throws",
"Throwable",
"{",
"// If the exception is annotated with @ResponseStatus rethrow it and let",
"// the framework han... | LOOK this could be a problem | [
"LOOK",
"this",
"could",
"be",
"a",
"problem"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/tds/src/main/java/thredds/server/TdsErrorHandling.java#L146-L169 | test | Handle an exception. | Of course, here is the Java code you requested:
```java
@ExceptionHandler(Throwable.class)
public ResponseEntity<String> handle(Throwable ex) throws Throwable {
// If the exception is annotated with @ResponseStatus rethrow it and let
// the framework handle it - like the OrderNotFoundException example
//... |
kocakosm/pitaya | src/org/kocakosm/pitaya/util/BaseEncoding.java | BaseEncoding.withSeparator | public BaseEncoding withSeparator(String separator, int n)
{
Parameters.checkCondition(n > 0);
for (char c : separator.toCharArray()) {
if (isPaddingChar(c) || isInAlphabet(c)) {
throw new IllegalArgumentException(
"Invalid separator character: '" + c + "'");
}
}
return new BaseEncoding(alphabet... | java | public BaseEncoding withSeparator(String separator, int n)
{
Parameters.checkCondition(n > 0);
for (char c : separator.toCharArray()) {
if (isPaddingChar(c) || isInAlphabet(c)) {
throw new IllegalArgumentException(
"Invalid separator character: '" + c + "'");
}
}
return new BaseEncoding(alphabet... | [
"public",
"BaseEncoding",
"withSeparator",
"(",
"String",
"separator",
",",
"int",
"n",
")",
"{",
"Parameters",
".",
"checkCondition",
"(",
"n",
">",
"0",
")",
";",
"for",
"(",
"char",
"c",
":",
"separator",
".",
"toCharArray",
"(",
")",
")",
"{",
"if"... | Returns a {@code BaseEncoding} that behaves as this one except that
it adds the specified separator after every {@code n} characters when
encoding data and ignores any occurence of the specified separator
when decoding encoded data.
See <a href="http://tools.ietf.org/html/rfc4648#section-3.1">RFC 4648
section 3.1</a> ... | [
"Returns",
"a",
"{",
"@code",
"BaseEncoding",
"}",
"that",
"behaves",
"as",
"this",
"one",
"except",
"that",
"it",
"adds",
"the",
"specified",
"separator",
"after",
"every",
"{",
"@code",
"n",
"}",
"characters",
"when",
"encoding",
"data",
"and",
"ignores",
... | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/util/BaseEncoding.java#L84-L95 | test | Returns a new BaseEncoding with the specified separator. | Of course, here is the Java code you requested:
```java
public BaseEncoding withSeparator(String separator, int n)
{
Parameters.checkCondition(n > 0);
for (char c : separator.toCharArray()) {
if (isPaddingChar(c) || isInAlphabet(c)) {
throw new IllegalArgumentException(
"Invalid separator character: '... |
vibur/vibur-dbcp | src/main/java/org/vibur/dbcp/proxy/ExceptionCollector.java | ExceptionCollector.addException | final void addException(SQLException exception) {
if (!(exception instanceof SQLTimeoutException) && !(exception instanceof SQLTransactionRollbackException)) {
getOrInit().offer(exception); // SQLExceptions from the above two sub-types are not stored
}
} | java | final void addException(SQLException exception) {
if (!(exception instanceof SQLTimeoutException) && !(exception instanceof SQLTransactionRollbackException)) {
getOrInit().offer(exception); // SQLExceptions from the above two sub-types are not stored
}
} | [
"final",
"void",
"addException",
"(",
"SQLException",
"exception",
")",
"{",
"if",
"(",
"!",
"(",
"exception",
"instanceof",
"SQLTimeoutException",
")",
"&&",
"!",
"(",
"exception",
"instanceof",
"SQLTransactionRollbackException",
")",
")",
"{",
"getOrInit",
"(",
... | This method will be called when an operation invoked on a JDBC object throws an SQLException.
It will accumulate a list of all non-transient SQL exceptions.
@param exception the exception thrown | [
"This",
"method",
"will",
"be",
"called",
"when",
"an",
"operation",
"invoked",
"on",
"a",
"JDBC",
"object",
"throws",
"an",
"SQLException",
".",
"It",
"will",
"accumulate",
"a",
"list",
"of",
"all",
"non",
"-",
"transient",
"SQL",
"exceptions",
"."
] | 9f3f0a2b41f1a76a4e408446e9e444db7ad8f1c2 | https://github.com/vibur/vibur-dbcp/blob/9f3f0a2b41f1a76a4e408446e9e444db7ad8f1c2/src/main/java/org/vibur/dbcp/proxy/ExceptionCollector.java#L44-L48 | test | Add an exception to the exception list. | Of course, here is the Java code you requested:
```java
final void addException(SQLException exception) {
if (!(exception instanceof SQLTimeoutException) && !(exception instanceof SQLTransactionRollbackException)) {
getOrInit().offer(exception); // SQLExceptions from the above two sub-types are not... |
apache/parquet-mr | parquet-column/src/main/java/org/apache/parquet/filter/PagedRecordFilter.java | PagedRecordFilter.page | public static final UnboundRecordFilter page( final long startPos, final long pageSize ) {
return new UnboundRecordFilter() {
@Override
public RecordFilter bind(Iterable<ColumnReader> readers) {
return new PagedRecordFilter( startPos, pageSize );
}
};
} | java | public static final UnboundRecordFilter page( final long startPos, final long pageSize ) {
return new UnboundRecordFilter() {
@Override
public RecordFilter bind(Iterable<ColumnReader> readers) {
return new PagedRecordFilter( startPos, pageSize );
}
};
} | [
"public",
"static",
"final",
"UnboundRecordFilter",
"page",
"(",
"final",
"long",
"startPos",
",",
"final",
"long",
"pageSize",
")",
"{",
"return",
"new",
"UnboundRecordFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"RecordFilter",
"bind",
"(",
"Iterable",
... | Returns builder for creating a paged query.
@param startPos The record to start from, numbering starts at 1.
@param pageSize The size of the page.
@return a paged record filter | [
"Returns",
"builder",
"for",
"creating",
"a",
"paged",
"query",
"."
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-column/src/main/java/org/apache/parquet/filter/PagedRecordFilter.java#L38-L45 | test | Create a new unbound record filter that will return a page of records. | Of course, here is the Java code you requested:
```java
public static final UnboundRecordFilter page( final long startPos, final long pageSize ) {
return new UnboundRecordFilter() {
@Override
public RecordFilter bind(Iterable<ColumnReader> readers) {
return new PagedRecordFilter( startPos, page... |
ReactiveX/RxJava | src/main/java/io/reactivex/Single.java | Single.error | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> error(final Callable<? extends Throwable> errorSupplier) {
ObjectHelper.requireNonNull(errorSupplier, "errorSupplier is null");
return RxJavaPlugins.onAssembly(new SingleError<T>(errorSupplier));
... | java | @CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> error(final Callable<? extends Throwable> errorSupplier) {
ObjectHelper.requireNonNull(errorSupplier, "errorSupplier is null");
return RxJavaPlugins.onAssembly(new SingleError<T>(errorSupplier));
... | [
"@",
"CheckReturnValue",
"@",
"NonNull",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"static",
"<",
"T",
">",
"Single",
"<",
"T",
">",
"error",
"(",
"final",
"Callable",
"<",
"?",
"extends",
"Throwable",
">",
"errorSupplier"... | Signals a Throwable returned by the callback function for each individual SingleObserver.
<p>
<img width="640" height="283" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.error.c.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code error} does not operate by default on a particular {@li... | [
"Signals",
"a",
"Throwable",
"returned",
"by",
"the",
"callback",
"function",
"for",
"each",
"individual",
"SingleObserver",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"283",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"co... | ac84182aa2bd866b53e01c8e3fe99683b882c60e | https://github.com/ReactiveX/RxJava/blob/ac84182aa2bd866b53e01c8e3fe99683b882c60e/src/main/java/io/reactivex/Single.java#L557-L563 | test | Creates an Single error from a Callable that returns an exception. | Of course, here is the Java code you requested:
```java
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T> Single<T> error(final Callable<? extends Throwable> errorSupplier) {
ObjectHelper.requireNonNull(errorSupplier, "errorSupplier is null");
return RxJa... |
oblac/jodd | jodd-core/src/main/java/jodd/util/PropertiesUtil.java | PropertiesUtil.createFromString | public static Properties createFromString(final String data) throws IOException {
Properties p = new Properties();
loadFromString(p, data);
return p;
} | java | public static Properties createFromString(final String data) throws IOException {
Properties p = new Properties();
loadFromString(p, data);
return p;
} | [
"public",
"static",
"Properties",
"createFromString",
"(",
"final",
"String",
"data",
")",
"throws",
"IOException",
"{",
"Properties",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"loadFromString",
"(",
"p",
",",
"data",
")",
";",
"return",
"p",
";",
"}"
... | Creates properties from string. | [
"Creates",
"properties",
"from",
"string",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/util/PropertiesUtil.java#L150-L154 | test | Create a Properties object from a String. | Of course, here is the Java code you requested:
```java
public static Properties createFromString(final String data) throws IOException {
Properties p = new Properties();
loadFromString(p, data);
return p;
}
```
Hope this helps! |
oblac/jodd | jodd-mail/src/main/java/jodd/mail/EMLProperties.java | EMLProperties.createSession | protected Session createSession(Properties properties) {
if (properties == null) {
properties = System.getProperties();
}
this.session = Session.getInstance(properties);
return session;
} | java | protected Session createSession(Properties properties) {
if (properties == null) {
properties = System.getProperties();
}
this.session = Session.getInstance(properties);
return session;
} | [
"protected",
"Session",
"createSession",
"(",
"Properties",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"properties",
"=",
"System",
".",
"getProperties",
"(",
")",
";",
"}",
"this",
".",
"session",
"=",
"Session",
".",
"getIns... | Creates new {@link Session} with or without custom {@link Properties}.
@param properties Custom properties to be used during {@link Session} creation. It is acceptable is this value is {@code null}.
@return {@link Session} with any custom {@link Properties} | [
"Creates",
"new",
"{",
"@link",
"Session",
"}",
"with",
"or",
"without",
"custom",
"{",
"@link",
"Properties",
"}",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-mail/src/main/java/jodd/mail/EMLProperties.java#L71-L79 | test | Creates a new Session instance. | Of course, here is the Java code you requested:
```java
protected Session createSession(Properties properties) {
if (properties == null) {
properties = System.getProperties();
}
this.session = Session.getInstance(properties);
return session;
}
```
Hope this helps! |
amlinv/stat-collection-utils | src/main/java/com/amlinv/jmxutil/polling/AttributeInjector.java | AttributeInjector.copyOutAttributes | public void copyOutAttributes(Object target, List<Attribute> jmxAttributeValues,
Map<String, Method> attributeSetters, ObjectName objectName) {
this.copyOutAttributes(target, jmxAttributeValues, attributeSetters, "oname", objectName);
} | java | public void copyOutAttributes(Object target, List<Attribute> jmxAttributeValues,
Map<String, Method> attributeSetters, ObjectName objectName) {
this.copyOutAttributes(target, jmxAttributeValues, attributeSetters, "oname", objectName);
} | [
"public",
"void",
"copyOutAttributes",
"(",
"Object",
"target",
",",
"List",
"<",
"Attribute",
">",
"jmxAttributeValues",
",",
"Map",
"<",
"String",
",",
"Method",
">",
"attributeSetters",
",",
"ObjectName",
"objectName",
")",
"{",
"this",
".",
"copyOutAttribute... | For a JMX MBean idenfitied by an ObjectName, copy the values of the given attributes into the target object
using the specified setter methods mapped by attribute name.
@param target object into which values are injected.
@param jmxAttributeValues values of the attributes to inject.
@param attributeSetters map of attr... | [
"For",
"a",
"JMX",
"MBean",
"idenfitied",
"by",
"an",
"ObjectName",
"copy",
"the",
"values",
"of",
"the",
"given",
"attributes",
"into",
"the",
"target",
"object",
"using",
"the",
"specified",
"setter",
"methods",
"mapped",
"by",
"attribute",
"name",
"."
] | 44da9965afbd2e92ce17ce2271d3bf21f69e2e97 | https://github.com/amlinv/stat-collection-utils/blob/44da9965afbd2e92ce17ce2271d3bf21f69e2e97/src/main/java/com/amlinv/jmxutil/polling/AttributeInjector.java#L56-L60 | test | Copy out attributes of an object. | Of course, here is the Java code you requested:
```java
public void copyOutAttributes(Object target, List<Attribute> jmxAttributeValues,
Map<String, Method> attributeSetters, ObjectName objectName) {
this.copyOutAttributes(target, jmxAttributeValues, attributeSetters, "oname"... |
objectify/objectify | src/main/java/com/googlecode/objectify/cache/MemcacheServiceRetryProxy.java | MemcacheServiceRetryProxy.createProxy | public static MemcacheService createProxy(final MemcacheService raw, final int retryCount) {
return (MemcacheService)java.lang.reflect.Proxy.newProxyInstance(
raw.getClass().getClassLoader(),
raw.getClass().getInterfaces(),
new MemcacheServiceRetryProxy(raw, retryCount));
} | java | public static MemcacheService createProxy(final MemcacheService raw, final int retryCount) {
return (MemcacheService)java.lang.reflect.Proxy.newProxyInstance(
raw.getClass().getClassLoader(),
raw.getClass().getInterfaces(),
new MemcacheServiceRetryProxy(raw, retryCount));
} | [
"public",
"static",
"MemcacheService",
"createProxy",
"(",
"final",
"MemcacheService",
"raw",
",",
"final",
"int",
"retryCount",
")",
"{",
"return",
"(",
"MemcacheService",
")",
"java",
".",
"lang",
".",
"reflect",
".",
"Proxy",
".",
"newProxyInstance",
"(",
"... | Create the proxy that does retries. Adds a strict error handler to the service. | [
"Create",
"the",
"proxy",
"that",
"does",
"retries",
".",
"Adds",
"a",
"strict",
"error",
"handler",
"to",
"the",
"service",
"."
] | 4bf325d2e49b400326416977c7d9bbdf5380175b | https://github.com/objectify/objectify/blob/4bf325d2e49b400326416977c7d9bbdf5380175b/src/main/java/com/googlecode/objectify/cache/MemcacheServiceRetryProxy.java#L34-L39 | test | Creates a proxy instance. | Of course, here is the Java code you requested:
```java
public static MemcacheService createProxy(final MemcacheService raw, final int retryCount) {
return (MemcacheService)java.lang.reflect.Proxy.newProxyInstance(
raw.getClass().getClassLoader(),
raw.getClass().getInterfaces(),
new MemcacheServiceRetry... |
wildfly/wildfly | connector/src/main/java/org/jboss/as/connector/util/SecurityActions.java | SecurityActions.getDeclaredMethods | static Method[] getDeclaredMethods(final Class<?> c) {
if (System.getSecurityManager() == null)
return c.getDeclaredMethods();
return AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
public Method[] run() {
return c.getDeclaredMethods();
... | java | static Method[] getDeclaredMethods(final Class<?> c) {
if (System.getSecurityManager() == null)
return c.getDeclaredMethods();
return AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
public Method[] run() {
return c.getDeclaredMethods();
... | [
"static",
"Method",
"[",
"]",
"getDeclaredMethods",
"(",
"final",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
")",
"==",
"null",
")",
"return",
"c",
".",
"getDeclaredMethods",
"(",
")",
";",
"return",
"Ac... | Get the declared methods
@param c The class
@return The methods | [
"Get",
"the",
"declared",
"methods"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/connector/src/main/java/org/jboss/as/connector/util/SecurityActions.java#L51-L60 | test | Get the declared methods of a class. | Of course, here is the Java code you requested:
```java
static Method[] getDeclaredMethods(final Class<?> c) {
if (System.getSecurityManager() == null)
return c.getDeclaredMethods();
return AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
public Method[] run() {... |
braintree/braintree_android | Braintree/src/main/java/com/braintreepayments/api/models/PaymentMethodNonce.java | PaymentMethodNonce.parsePaymentMethodNonces | @Nullable
public static PaymentMethodNonce parsePaymentMethodNonces(String json, String type) throws JSONException {
return parsePaymentMethodNonces(new JSONObject(json), type);
} | java | @Nullable
public static PaymentMethodNonce parsePaymentMethodNonces(String json, String type) throws JSONException {
return parsePaymentMethodNonces(new JSONObject(json), type);
} | [
"@",
"Nullable",
"public",
"static",
"PaymentMethodNonce",
"parsePaymentMethodNonces",
"(",
"String",
"json",
",",
"String",
"type",
")",
"throws",
"JSONException",
"{",
"return",
"parsePaymentMethodNonces",
"(",
"new",
"JSONObject",
"(",
"json",
")",
",",
"type",
... | Parses a {@link PaymentMethodNonce} from json.
@param json {@link String} representation of a {@link PaymentMethodNonce}.
@param type The {@link String} type of the {@link PaymentMethodNonce}.
@return {@link PaymentMethodNonce}
@throws JSONException | [
"Parses",
"a",
"{",
"@link",
"PaymentMethodNonce",
"}",
"from",
"json",
"."
] | 07b32e6fad73f9fb8432971b0e79fc8c94b11873 | https://github.com/braintree/braintree_android/blob/07b32e6fad73f9fb8432971b0e79fc8c94b11873/Braintree/src/main/java/com/braintreepayments/api/models/PaymentMethodNonce.java#L114-L117 | test | Parses a PaymentMethodNonce JSON string. | Of course, here is the Java code you requested:
```java
@Nullable
public static PaymentMethodNonce parsePaymentMethodNonces(String json, String type) throws JSONException {
return parsePaymentMethodNonces(new JSONObject(json), type);
}
```
Hope this helps! |
cglib/cglib | cglib/src/main/java/net/sf/cglib/core/EmitUtils.java | EmitUtils.process_array | public static void process_array(CodeEmitter e, Type type, ProcessArrayCallback callback) {
Type componentType = TypeUtils.getComponentType(type);
Local array = e.make_local();
Local loopvar = e.make_local(Type.INT_TYPE);
Label loopbody = e.make_label();
Label checkloop = e.make_... | java | public static void process_array(CodeEmitter e, Type type, ProcessArrayCallback callback) {
Type componentType = TypeUtils.getComponentType(type);
Local array = e.make_local();
Local loopvar = e.make_local(Type.INT_TYPE);
Label loopbody = e.make_label();
Label checkloop = e.make_... | [
"public",
"static",
"void",
"process_array",
"(",
"CodeEmitter",
"e",
",",
"Type",
"type",
",",
"ProcessArrayCallback",
"callback",
")",
"{",
"Type",
"componentType",
"=",
"TypeUtils",
".",
"getComponentType",
"(",
"type",
")",
";",
"Local",
"array",
"=",
"e",... | Process an array on the stack. Assumes the top item on the stack
is an array of the specified type. For each element in the array,
puts the element on the stack and triggers the callback.
@param type the type of the array (type.isArray() must be true)
@param callback the callback triggered for each element | [
"Process",
"an",
"array",
"on",
"the",
"stack",
".",
"Assumes",
"the",
"top",
"item",
"on",
"the",
"stack",
"is",
"an",
"array",
"of",
"the",
"specified",
"type",
".",
"For",
"each",
"element",
"in",
"the",
"array",
"puts",
"the",
"element",
"on",
"the... | cd01695c11fd3c66641b295b9596f74cf13c548b | https://github.com/cglib/cglib/blob/cd01695c11fd3c66641b295b9596f74cf13c548b/cglib/src/main/java/net/sf/cglib/core/EmitUtils.java#L103-L126 | test | Processes an array of type. | Of course, here is the Java code you requested:
```java
public static void process_array(CodeEmitter e, Type type, ProcessArrayCallback callback) {
Type componentType = TypeUtils.getComponentType(type);
Local array = e.make_local();
Local loopvar = e.make_local(Type.INT_TYPE);
Label loo... |
Unidata/thredds | ui/src/main/java/ucar/nc2/ui/widget/SuperComboBox.java | MyTextField.getItem | protected int getItem( int pixel) {
if (nitems < 2)
return 0;
int eff_width = b.width - 2*arrow_size; // effective width
double fitem = ((double) (pixel-arrow_size)*(nitems-1)) / eff_width;
int item = (int)(fitem+.5);
item = Math.max( Math.min(item, nitems-1), 0);
... | java | protected int getItem( int pixel) {
if (nitems < 2)
return 0;
int eff_width = b.width - 2*arrow_size; // effective width
double fitem = ((double) (pixel-arrow_size)*(nitems-1)) / eff_width;
int item = (int)(fitem+.5);
item = Math.max( Math.min(item, nitems-1), 0);
... | [
"protected",
"int",
"getItem",
"(",
"int",
"pixel",
")",
"{",
"if",
"(",
"nitems",
"<",
"2",
")",
"return",
"0",
";",
"int",
"eff_width",
"=",
"b",
".",
"width",
"-",
"2",
"*",
"arrow_size",
";",
"// effective width\r",
"double",
"fitem",
"=",
"(",
"... | return item selected by this pixel position | [
"return",
"item",
"selected",
"by",
"this",
"pixel",
"position"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/ui/src/main/java/ucar/nc2/ui/widget/SuperComboBox.java#L465-L474 | test | Get the item of a given pixel. | Of course, here is the Java code you requested:
```java
protected int getItem( int pixel) {
if (nitems < 2)
return 0;
int eff_width = b.width - 2*arrow_size; // effective width
double fitem = ((double) (pixel-arrow_size)*(nitems-1)) / eff_width;
int item = (int)(fitem+.5);
... |
boonproject/boon | boon/src/main/java/org/boon/validation/readers/AnnotationValidatorMetaDataReader.java | AnnotationValidatorMetaDataReader.convertAnnotationDataToValidatorMetaData | private ValidatorMetaData convertAnnotationDataToValidatorMetaData(
AnnotationData annotationData ) {
ValidatorMetaData metaData = new ValidatorMetaData();
metaData.setName( annotationData.getName() );
metaData.setProperties( annotationData.getValues() );
return me... | java | private ValidatorMetaData convertAnnotationDataToValidatorMetaData(
AnnotationData annotationData ) {
ValidatorMetaData metaData = new ValidatorMetaData();
metaData.setName( annotationData.getName() );
metaData.setProperties( annotationData.getValues() );
return me... | [
"private",
"ValidatorMetaData",
"convertAnnotationDataToValidatorMetaData",
"(",
"AnnotationData",
"annotationData",
")",
"{",
"ValidatorMetaData",
"metaData",
"=",
"new",
"ValidatorMetaData",
"(",
")",
";",
"metaData",
".",
"setName",
"(",
"annotationData",
".",
"getName... | Converts an AnnotationData into a ValidatorMetaData POJO.
@param annotationData annotationData
@return validator meta data
<p/>
TODO
@NeedsRefactoring("This method shows we are calling annotationData.getValues a lot. " +
"Therefore, we must cache the results of getValues as the annoationData is static " +
"per propert... | [
"Converts",
"an",
"AnnotationData",
"into",
"a",
"ValidatorMetaData",
"POJO",
"."
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/validation/readers/AnnotationValidatorMetaDataReader.java#L191-L200 | test | Converts an AnnotationData object to a ValidatorMetaData object. | Of course, here is the Java code you requested:
```java
private ValidatorMetaData convertAnnotationDataToValidatorMetaData(
AnnotationData annotationData ) {
ValidatorMetaData metaData = new ValidatorMetaData();
metaData.setName( annotationData.getName() );
metaData.setPrope... |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/util/WroUtil.java | WroUtil.toJSMultiLineString | public static String toJSMultiLineString(final String data) {
final StringBuffer result = new StringBuffer("[");
if (data != null) {
final String[] lines = data.split("\n");
if (lines.length == 0) {
result.append("\"\"");
}
for (int i = 0; i < lines.length; i++) {
... | java | public static String toJSMultiLineString(final String data) {
final StringBuffer result = new StringBuffer("[");
if (data != null) {
final String[] lines = data.split("\n");
if (lines.length == 0) {
result.append("\"\"");
}
for (int i = 0; i < lines.length; i++) {
... | [
"public",
"static",
"String",
"toJSMultiLineString",
"(",
"final",
"String",
"data",
")",
"{",
"final",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"\"[\"",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"final",
"String",
"[",
"]",
... | Transforms a java multi-line string into javascript multi-line string. This technique was found at {@link http
://stackoverflow.com/questions/805107/multiline-strings-in-javascript/}
@param data
a string containing new lines.
@return a string which being evaluated on the client-side will be treated as a correct multi-... | [
"Transforms",
"a",
"java",
"multi",
"-",
"line",
"string",
"into",
"javascript",
"multi",
"-",
"line",
"string",
".",
"This",
"technique",
"was",
"found",
"at",
"{",
"@link",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"805107",
... | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/util/WroUtil.java#L235-L258 | test | Converts a JS multi line string to JS array. | Of course, here is the Java code you requested:
```java
public static String toJSMultiLineString(final String data) {
final StringBuffer result = new StringBuffer("[");
if (data != null) {
final String[] lines = data.split("\n");
if (lines.length == 0) {
result.append("\"\"");
}... |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/servlet/JspCServletContext.java | JspCServletContext.addServlet | public void addServlet(String servletName,
String description,
String className,
Map<String, String> initParameters,
int loadOnStartup) {
// Do nothing
return;
} | java | public void addServlet(String servletName,
String description,
String className,
Map<String, String> initParameters,
int loadOnStartup) {
// Do nothing
return;
} | [
"public",
"void",
"addServlet",
"(",
"String",
"servletName",
",",
"String",
"description",
",",
"String",
"className",
",",
"Map",
"<",
"String",
",",
"String",
">",
"initParameters",
",",
"int",
"loadOnStartup",
")",
"{",
"// Do nothing",
"return",
";",
"}"
... | /*
Adds the servlet with the given name, description, class name,
init parameters, and loadOnStartup, to this servlet context. | [
"/",
"*",
"Adds",
"the",
"servlet",
"with",
"the",
"given",
"name",
"description",
"class",
"name",
"init",
"parameters",
"and",
"loadOnStartup",
"to",
"this",
"servlet",
"context",
"."
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/servlet/JspCServletContext.java#L504-L511 | test | Add a servlet to the application. | Of course, here is the Java code you requested:
```java
public void addServlet(String servletName,
String description,
String className,
Map<String, String> initParameters,
int loadOnStartup) {
// Do not... |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java | OConsoleApplication.getConsoleMethods | protected Map<Method, Object> getConsoleMethods() {
if (methods != null)
return methods;
// search for declared command collections
final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator();
final Collection<Object> candidates = new ArrayList<O... | java | protected Map<Method, Object> getConsoleMethods() {
if (methods != null)
return methods;
// search for declared command collections
final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator();
final Collection<Object> candidates = new ArrayList<O... | [
"protected",
"Map",
"<",
"Method",
",",
"Object",
">",
"getConsoleMethods",
"(",
")",
"{",
"if",
"(",
"methods",
"!=",
"null",
")",
"return",
"methods",
";",
"// search for declared command collections",
"final",
"Iterator",
"<",
"OConsoleCommandCollection",
">",
... | Returns a map of all console method and the object they can be called on.
@return Map<Method,Object> | [
"Returns",
"a",
"map",
"of",
"all",
"console",
"method",
"and",
"the",
"object",
"they",
"can",
"be",
"called",
"on",
"."
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/common/console/OConsoleApplication.java#L619-L672 | test | Gets the methods of the console application. | Of course, here is the Java code you requested:
```java
protected Map<Method, Object> getConsoleMethods() {
if (methods != null)
return methods;
// search for declared command collections
final Iterator<OConsoleCommandCollection> ite = ServiceLoader.load(OConsoleCommandCollection.class).iterator();
... |
rest-assured/rest-assured | modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/config/RestAssuredMockMvcConfig.java | RestAssuredMockMvcConfig.multiPartConfig | public RestAssuredMockMvcConfig multiPartConfig(MultiPartConfig multiPartConfig) {
notNull(multiPartConfig, MultiPartConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncCo... | java | public RestAssuredMockMvcConfig multiPartConfig(MultiPartConfig multiPartConfig) {
notNull(multiPartConfig, MultiPartConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectMapperConfig, jsonConfig, xmlConfig, headerConfig, asyncCo... | [
"public",
"RestAssuredMockMvcConfig",
"multiPartConfig",
"(",
"MultiPartConfig",
"multiPartConfig",
")",
"{",
"notNull",
"(",
"multiPartConfig",
",",
"MultiPartConfig",
".",
"class",
")",
";",
"return",
"new",
"RestAssuredMockMvcConfig",
"(",
"logConfig",
",",
"encoderC... | Set the multi-part config
@param multiPartConfig The {@link MultiPartConfig} to set
@return An updated RestAssuredMockMvcConfig | [
"Set",
"the",
"multi",
"-",
"part",
"config"
] | 165a85b65070f5a07fe0045175613fb2c2811642 | https://github.com/rest-assured/rest-assured/blob/165a85b65070f5a07fe0045175613fb2c2811642/modules/spring-mock-mvc/src/main/java/io/restassured/module/mockmvc/config/RestAssuredMockMvcConfig.java#L227-L231 | test | Create a new instance of the mock config class with the specified multi part config. | Of course, here is the Java code you requested:
```java
public RestAssuredMockMvcConfig multiPartConfig(MultiPartConfig multiPartConfig) {
notNull(multiPartConfig, MultiPartConfig.class);
return new RestAssuredMockMvcConfig(logConfig, encoderConfig, decoderConfig, sessionConfig,
objectM... |
jbee/silk | src/core/se/jbee/inject/Utils.java | Utils.arrayFlatmap | public static <A, B> B[] arrayFlatmap(A[] as, Class<B> to,
Function<A, B> flatmapOp) {
B[] bs = newArray(to, as.length);
int j = 0;
for (int i = 0; i < as.length; i++) {
B b = flatmapOp.apply(as[i]);
if (b != null)
bs[j++] = b;
}
return j == as.length ? bs : copyOf(bs, j);
} | java | public static <A, B> B[] arrayFlatmap(A[] as, Class<B> to,
Function<A, B> flatmapOp) {
B[] bs = newArray(to, as.length);
int j = 0;
for (int i = 0; i < as.length; i++) {
B b = flatmapOp.apply(as[i]);
if (b != null)
bs[j++] = b;
}
return j == as.length ? bs : copyOf(bs, j);
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"B",
"[",
"]",
"arrayFlatmap",
"(",
"A",
"[",
"]",
"as",
",",
"Class",
"<",
"B",
">",
"to",
",",
"Function",
"<",
"A",
",",
"B",
">",
"flatmapOp",
")",
"{",
"B",
"[",
"]",
"bs",
"=",
"newArray",
... | This is a special form of flatmap where the mapping does not return zero
to n Bs but always returns a B. If {@code null} is returned this means
"zero" or remove the B. So length of {@code B[]} is always {@code <=}
length of {@code A[]}. | [
"This",
"is",
"a",
"special",
"form",
"of",
"flatmap",
"where",
"the",
"mapping",
"does",
"not",
"return",
"zero",
"to",
"n",
"Bs",
"but",
"always",
"returns",
"a",
"B",
".",
"If",
"{"
] | 36237487d250c7b66bcefcf08c45d0069b55ec92 | https://github.com/jbee/silk/blob/36237487d250c7b66bcefcf08c45d0069b55ec92/src/core/se/jbee/inject/Utils.java#L102-L112 | test | Flatmap an array of objects. | Of course, here is the Java code you requested:
```java
public static <A, B> B[] arrayFlatmap(A[] as, Class<B> to,
Function<A, B> flatmapOp) {
B[] bs = newArray(to, as.length);
int j = 0;
for (int i = 0; i < as.length; i++) {
B b = flatmapOp.apply(as[i]);
if (b != null)
bs[j++] = b;
}
return j =... |
Koekiebox-PTY-LTD/Fluid | fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/flow/FlowStepRuleClient.java | FlowStepRuleClient.compileFlowStepViewRule | public FlowStepRule compileFlowStepViewRule(String viewRuleSyntaxParam)
{
FlowStepRule flowStepRule = new FlowStepRule();
flowStepRule.setRule(viewRuleSyntaxParam);
if(this.serviceTicket != null)
{
flowStepRule.setServiceTicket(this.serviceTicket);
}
ret... | java | public FlowStepRule compileFlowStepViewRule(String viewRuleSyntaxParam)
{
FlowStepRule flowStepRule = new FlowStepRule();
flowStepRule.setRule(viewRuleSyntaxParam);
if(this.serviceTicket != null)
{
flowStepRule.setServiceTicket(this.serviceTicket);
}
ret... | [
"public",
"FlowStepRule",
"compileFlowStepViewRule",
"(",
"String",
"viewRuleSyntaxParam",
")",
"{",
"FlowStepRule",
"flowStepRule",
"=",
"new",
"FlowStepRule",
"(",
")",
";",
"flowStepRule",
".",
"setRule",
"(",
"viewRuleSyntaxParam",
")",
";",
"if",
"(",
"this",
... | Compiles the {@code viewRuleSyntaxParam} text within the Fluid workflow engine.
@param viewRuleSyntaxParam The syntax to compile.
@return Compiled rule. | [
"Compiles",
"the",
"{",
"@code",
"viewRuleSyntaxParam",
"}",
"text",
"within",
"the",
"Fluid",
"workflow",
"engine",
"."
] | 81153d865f71b84ca933532c7115717bc3979270 | https://github.com/Koekiebox-PTY-LTD/Fluid/blob/81153d865f71b84ca933532c7115717bc3979270/fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/flow/FlowStepRuleClient.java#L168-L180 | test | Compiles a FlowStepRule for the given syntax parameter. | Of course, here is the Java code you requested:
```java
public FlowStepRule compileFlowStepViewRule(String viewRuleSyntaxParam)
{
FlowStepRule flowStepRule = new FlowStepRule();
flowStepRule.setRule(viewRuleSyntaxParam);
if(this.serviceTicket != null)
{
flowStepRule.set... |
kiegroup/droolsjbpm-tools | drools-eclipse/org.kie.eclipse.navigator/src/main/java/org/kie/eclipse/navigator/view/KieNavigatorView.java | KieNavigatorView.createDefaultPage | private Control createDefaultPage(FormToolkit kit) {
Form form = kit.createForm(book);
Composite body = form.getBody();
GridLayout layout = new GridLayout(2, false);
body.setLayout(layout);
Link hlink = new Link(body, SWT.NONE);
hlink.setText("<a>Use the Servers View to create a new server...</a>");
hlin... | java | private Control createDefaultPage(FormToolkit kit) {
Form form = kit.createForm(book);
Composite body = form.getBody();
GridLayout layout = new GridLayout(2, false);
body.setLayout(layout);
Link hlink = new Link(body, SWT.NONE);
hlink.setText("<a>Use the Servers View to create a new server...</a>");
hlin... | [
"private",
"Control",
"createDefaultPage",
"(",
"FormToolkit",
"kit",
")",
"{",
"Form",
"form",
"=",
"kit",
".",
"createForm",
"(",
"book",
")",
";",
"Composite",
"body",
"=",
"form",
".",
"getBody",
"(",
")",
";",
"GridLayout",
"layout",
"=",
"new",
"Gr... | Creates a page displayed when there are no servers defined.
@param kit
@return Control | [
"Creates",
"a",
"page",
"displayed",
"when",
"there",
"are",
"no",
"servers",
"defined",
"."
] | 05e1f73c591178360a198dca29f99d73918991db | https://github.com/kiegroup/droolsjbpm-tools/blob/05e1f73c591178360a198dca29f99d73918991db/drools-eclipse/org.kie.eclipse.navigator/src/main/java/org/kie/eclipse/navigator/view/KieNavigatorView.java#L157-L217 | test | Creates the default page. | Of course, here is the Java code you requested:
```java
private Control createDefaultPage(FormToolkit kit) {
Form form = kit.createForm(book);
Composite body = form.getBody();
GridLayout layout = new GridLayout(2, false);
body.setLayout(layout);
Link hlink = new Link(body, SWT.NONE);
hlink.setText("<a>Use... |
oblac/jodd | jodd-lagarto/src/main/java/jodd/csselly/selector/PseudoClassSelector.java | PseudoClassSelector.accept | @Override
public boolean accept(final List<Node> currentResults, final Node node, final int index) {
return pseudoClass.match(currentResults, node, index);
} | java | @Override
public boolean accept(final List<Node> currentResults, final Node node, final int index) {
return pseudoClass.match(currentResults, node, index);
} | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"final",
"List",
"<",
"Node",
">",
"currentResults",
",",
"final",
"Node",
"node",
",",
"final",
"int",
"index",
")",
"{",
"return",
"pseudoClass",
".",
"match",
"(",
"currentResults",
",",
"node",
",",
... | Accepts node within selected results. Invoked after results are matched. | [
"Accepts",
"node",
"within",
"selected",
"results",
".",
"Invoked",
"after",
"results",
"are",
"matched",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-lagarto/src/main/java/jodd/csselly/selector/PseudoClassSelector.java#L140-L143 | test | Accept a node. | Of course, here is the Java code you requested:
```java
@Override
public boolean accept(final List<Node> currentResults, final Node node, final int index) {
return pseudoClass.match(currentResults, node, index);
}
```
Hope this helps! |
cologneintelligence/FitGoodies | fitgoodies-db-jdbc/src/main/java/de/cologneintelligence/fitgoodies/database/dynamic/DynamicObjectFactory.java | DynamicObjectFactory.compile | public final Class<?> compile() {
if (result == null) {
loader.loadJavaClass(cg.getClassName(), cg.getJavaClass());
try {
result = loader.loadClass(cg.getClassName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
return result;
} | java | public final Class<?> compile() {
if (result == null) {
loader.loadJavaClass(cg.getClassName(), cg.getJavaClass());
try {
result = loader.loadClass(cg.getClassName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
return result;
} | [
"public",
"final",
"Class",
"<",
"?",
">",
"compile",
"(",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"loader",
".",
"loadJavaClass",
"(",
"cg",
".",
"getClassName",
"(",
")",
",",
"cg",
".",
"getJavaClass",
"(",
")",
")",
";",
"try",
... | Compiles the class and returns a class object which contains all
added fields.
@return dynamic generated class with all added fields. | [
"Compiles",
"the",
"class",
"and",
"returns",
"a",
"class",
"object",
"which",
"contains",
"all",
"added",
"fields",
"."
] | 834e42d1f41b4b9226060b1e83a80cc69ea88c7b | https://github.com/cologneintelligence/FitGoodies/blob/834e42d1f41b4b9226060b1e83a80cc69ea88c7b/fitgoodies-db-jdbc/src/main/java/de/cologneintelligence/fitgoodies/database/dynamic/DynamicObjectFactory.java#L140-L150 | test | Compile the Java class. | Of course, here is the Java code you requested:
```java
public final Class<?> compile() {
if (result == null) {
loader.loadJavaClass(cg.getClassName(), cg.getJavaClass());
try {
result = loader.loadClass(cg.getClassName());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}... |
PistoiaHELM/HELMNotationParser | src/main/java/org/helm/notation2/parser/connectionsection/BetweenInlineConnectionParser.java | BetweenInlineConnectionParser.doAction | @Override
public void doAction(char cha) throws ConnectionSectionException {
/* new connection is starting */
if (cha == '|') {
LOG.info("A new connection is starting:");
_parser.setState(new ConnectionsParser(_parser));
} /* grouping section is starting */ else if (cha == '$') {
... | java | @Override
public void doAction(char cha) throws ConnectionSectionException {
/* new connection is starting */
if (cha == '|') {
LOG.info("A new connection is starting:");
_parser.setState(new ConnectionsParser(_parser));
} /* grouping section is starting */ else if (cha == '$') {
... | [
"@",
"Override",
"public",
"void",
"doAction",
"(",
"char",
"cha",
")",
"throws",
"ConnectionSectionException",
"{",
"/* new connection is starting */",
"if",
"(",
"cha",
"==",
"'",
"'",
")",
"{",
"LOG",
".",
"info",
"(",
"\"A new connection is starting:\"",
")",
... | {@inheritDoc} | [
"{"
] | 685d7ab7886e9b5cc15fb904025fe6eee703f8f6 | https://github.com/PistoiaHELM/HELMNotationParser/blob/685d7ab7886e9b5cc15fb904025fe6eee703f8f6/src/main/java/org/helm/notation2/parser/connectionsection/BetweenInlineConnectionParser.java#L57-L72 | test | Override the method to handle the
action. | Of course, here is the Java code you requested:
```java
@Override
public void doAction(char cha) throws ConnectionSectionException {
/* new connection is starting */
if (cha == '|') {
LOG.info("A new connection is starting:");
_parser.setState(new ConnectionsParser(_parser));
} /* group... |
chenlb/mmseg4j-from-googlecode | src/com/chenlb/mmseg4j/Dictionary.java | Dictionary.wordsFileIsChange | public synchronized boolean wordsFileIsChange() {
//检查是否有修改文件,包括删除的
for(Entry<File, Long> flt : wordsLastTime.entrySet()) {
File words = flt.getKey();
if(!words.canRead()) { //可能是删除了
return true;
}
if(words.lastModified() > flt.getValue()) { //更新了文件
return true;
}
}
//检查是否有新文件
... | java | public synchronized boolean wordsFileIsChange() {
//检查是否有修改文件,包括删除的
for(Entry<File, Long> flt : wordsLastTime.entrySet()) {
File words = flt.getKey();
if(!words.canRead()) { //可能是删除了
return true;
}
if(words.lastModified() > flt.getValue()) { //更新了文件
return true;
}
}
//检查是否有新文件
... | [
"public",
"synchronized",
"boolean",
"wordsFileIsChange",
"(",
")",
"{",
"//检查是否有修改文件,包括删除的\r",
"for",
"(",
"Entry",
"<",
"File",
",",
"Long",
">",
"flt",
":",
"wordsLastTime",
".",
"entrySet",
"(",
")",
")",
"{",
"File",
"words",
"=",
"flt",
".",
"getKey"... | 词典文件是否有修改过
@return | [
"词典文件是否有修改过"
] | 3053a70c29c1bc8e7c280a8098fb41b5ad9ec3cb | https://github.com/chenlb/mmseg4j-from-googlecode/blob/3053a70c29c1bc8e7c280a8098fb41b5ad9ec3cb/src/com/chenlb/mmseg4j/Dictionary.java#L321-L342 | test | Checks if the words file is changed. | Of course, here is the Java code you requested:
```java
public synchronized boolean wordsFileIsChange() {
//检查是否有修改文件,包括删除的
for(Entry<File, Long> flt : wordsLastTime.entrySet()) {
File words = flt.getKey();
if(!words.canRead()) { //可能是删除了
return true;
}
if(words.lastModified() > flt.getValue... |
oblac/jodd | jodd-proxetta/src/main/java/jodd/proxetta/asm/ProxettaMethodBuilder.java | ProxettaMethodBuilder.createFirstChainDelegate_Start | protected void createFirstChainDelegate_Start() {
// check invalid access flags
int access = msign.getAccessFlags();
if (!wd.allowFinalMethods) {
if ((access & AsmUtil.ACC_FINAL) != 0) { // detect final
throw new ProxettaException(
"Unable to create proxy for final method: " + msign + ". Remove fina... | java | protected void createFirstChainDelegate_Start() {
// check invalid access flags
int access = msign.getAccessFlags();
if (!wd.allowFinalMethods) {
if ((access & AsmUtil.ACC_FINAL) != 0) { // detect final
throw new ProxettaException(
"Unable to create proxy for final method: " + msign + ". Remove fina... | [
"protected",
"void",
"createFirstChainDelegate_Start",
"(",
")",
"{",
"// check invalid access flags",
"int",
"access",
"=",
"msign",
".",
"getAccessFlags",
"(",
")",
";",
"if",
"(",
"!",
"wd",
".",
"allowFinalMethods",
")",
"{",
"if",
"(",
"(",
"access",
"&",... | Starts creation of first chain delegate. | [
"Starts",
"creation",
"of",
"first",
"chain",
"delegate",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/proxetta/asm/ProxettaMethodBuilder.java#L142-L160 | test | Create the first chain delegate. | Of course, here is the Java code you requested:
```java
protected void createFirstChainDelegate_Start() {
// check invalid access flags
int access = msign.getAccessFlags();
if (!wd.allowFinalMethods) {
if ((access & AsmUtil.ACC_FINAL) != 0) { // detect final
throw new ProxettaException(
"Unable to ... |
stanfy/enroscar | images/src/main/java/com/stanfy/enroscar/images/ImageRequestsBuilder.java | ImageRequestsBuilder.add | public ImageRequestsBuilder add(final String url) {
requests.add(new ImageRequest(manager, url, defaultAllowedSize));
return this;
} | java | public ImageRequestsBuilder add(final String url) {
requests.add(new ImageRequest(manager, url, defaultAllowedSize));
return this;
} | [
"public",
"ImageRequestsBuilder",
"add",
"(",
"final",
"String",
"url",
")",
"{",
"requests",
".",
"add",
"(",
"new",
"ImageRequest",
"(",
"manager",
",",
"url",
",",
"defaultAllowedSize",
")",
")",
";",
"return",
"this",
";",
"}"
] | Plan an image on loading.
@param url image URL
@return this for chaining | [
"Plan",
"an",
"image",
"on",
"loading",
"."
] | 0e64f3c309d62e359b55ddcba10e3cc592f5e083 | https://github.com/stanfy/enroscar/blob/0e64f3c309d62e359b55ddcba10e3cc592f5e083/images/src/main/java/com/stanfy/enroscar/images/ImageRequestsBuilder.java#L78-L81 | test | Add an image request to the request list. | Of course, here is the Java code you requested:
```java
public ImageRequestsBuilder add(final String url) {
requests.add(new ImageRequest(manager, url, defaultAllowedSize));
return this;
}
```
Hope this helps! |
oblac/jodd | jodd-core/src/main/java/jodd/util/StringUtil.java | StringUtil.trimRight | public static String trimRight(final String src) {
int len = src.length();
int count = len;
while ((len > 0) && (CharUtil.isWhitespace(src.charAt(len - 1)))) {
len--;
}
return (len < count) ? src.substring(0, len) : src;
} | java | public static String trimRight(final String src) {
int len = src.length();
int count = len;
while ((len > 0) && (CharUtil.isWhitespace(src.charAt(len - 1)))) {
len--;
}
return (len < count) ? src.substring(0, len) : src;
} | [
"public",
"static",
"String",
"trimRight",
"(",
"final",
"String",
"src",
")",
"{",
"int",
"len",
"=",
"src",
".",
"length",
"(",
")",
";",
"int",
"count",
"=",
"len",
";",
"while",
"(",
"(",
"len",
">",
"0",
")",
"&&",
"(",
"CharUtil",
".",
"isW... | Trim whitespaces from the right. | [
"Trim",
"whitespaces",
"from",
"the",
"right",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/util/StringUtil.java#L2019-L2026 | test | Trims the right side of a String. | Of course, here is the Java code you requested:
```java
public static String trimRight(final String src) {
int len = src.length();
int count = len;
while ((len > 0) && (CharUtil.isWhitespace(src.charAt(len - 1)))) {
len--;
}
return (len < count) ? src.substring(0, len) : src;
}
```
Hope this helps! |
Unidata/thredds | dap4/d4servlet/src/main/java/dap4/servlet/SerialWriter.java | SerialWriter.encodeArray | static public ByteBuffer
encodeArray(DapType vtype, Object values, ByteOrder order)
throws IOException
{
TypeSort atomtype = vtype.getAtomicType();
assert values != null && values.getClass().isArray();
int count = Array.getLength(values);
int total = (int) TypeSort.ge... | java | static public ByteBuffer
encodeArray(DapType vtype, Object values, ByteOrder order)
throws IOException
{
TypeSort atomtype = vtype.getAtomicType();
assert values != null && values.getClass().isArray();
int count = Array.getLength(values);
int total = (int) TypeSort.ge... | [
"static",
"public",
"ByteBuffer",
"encodeArray",
"(",
"DapType",
"vtype",
",",
"Object",
"values",
",",
"ByteOrder",
"order",
")",
"throws",
"IOException",
"{",
"TypeSort",
"atomtype",
"=",
"vtype",
".",
"getAtomicType",
"(",
")",
";",
"assert",
"values",
"!="... | Encode an array of primitive values.
@param vtype The type of the object
@param values The value array
@return bytebuffer encoding of the array using the
platform's native encoding. | [
"Encode",
"an",
"array",
"of",
"primitive",
"values",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4servlet/src/main/java/dap4/servlet/SerialWriter.java#L113-L215 | test | Encode array. | Of course, here is the Java code you requested:
```java
static public ByteBuffer
encodeArray(DapType vtype, Object values, ByteOrder order)
throws IOException
{
TypeSort atomtype = vtype.getAtomicType();
assert values != null && values.getClass().isArray();
int count = Array... |
subchen/jetbrick-all-1x | jetbrick-commons/src/main/java/jetbrick/typecast/TypeCastResolver.java | TypeCastResolver.convert | public <T> T convert(String value, Class<T> type) {
// fast-path
if (value == null) {
return null;
}
if (type == String.class) {
return (T) value;
}
// normal-path
Convertor<T> c = (Convertor<T>) pool.get(type);
if (c != null) {
... | java | public <T> T convert(String value, Class<T> type) {
// fast-path
if (value == null) {
return null;
}
if (type == String.class) {
return (T) value;
}
// normal-path
Convertor<T> c = (Convertor<T>) pool.get(type);
if (c != null) {
... | [
"public",
"<",
"T",
">",
"T",
"convert",
"(",
"String",
"value",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"// fast-path",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"type",
"==",
"String",
".",
"class... | -------- convert string ----------------------------------------------------------- | [
"--------",
"convert",
"string",
"-----------------------------------------------------------"
] | abe54629a508592287afe5ca4ffc93bf8bf4940c | https://github.com/subchen/jetbrick-all-1x/blob/abe54629a508592287afe5ca4ffc93bf8bf4940c/jetbrick-commons/src/main/java/jetbrick/typecast/TypeCastResolver.java#L139-L156 | test | Convert a string value to a type. | Of course, here is the Java code you requested:
```java
public <T> T convert(String value, Class<T> type) {
// fast-path
if (value == null) {
return null;
}
if (type == String.class) {
return (T) value;
}
// normal-path
Convertor<T> c = (C... |
eclipse/packagedrone | bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/ParserController.java | ParserController.getPageEncodingFromDirective | private String getPageEncodingFromDirective(Attributes attrs,
String attrName) {
String value = attrs.getValue(attrName);
if (attrName.equals("pageEncoding")) {
return value;
}
// attrName = contentType
String contentType = va... | java | private String getPageEncodingFromDirective(Attributes attrs,
String attrName) {
String value = attrs.getValue(attrName);
if (attrName.equals("pageEncoding")) {
return value;
}
// attrName = contentType
String contentType = va... | [
"private",
"String",
"getPageEncodingFromDirective",
"(",
"Attributes",
"attrs",
",",
"String",
"attrName",
")",
"{",
"String",
"value",
"=",
"attrs",
".",
"getValue",
"(",
"attrName",
")",
";",
"if",
"(",
"attrName",
".",
"equals",
"(",
"\"pageEncoding\"",
")... | /*
Scans the given attributes for the attribute with the given name,
which is either 'pageEncoding' or 'contentType', and returns the
specified page encoding.
In the case of 'contentType', the page encoding is taken from the
content type's 'charset' component.
@param attrs The page directive attributes
@param attrNam... | [
"/",
"*",
"Scans",
"the",
"given",
"attributes",
"for",
"the",
"attribute",
"with",
"the",
"given",
"name",
"which",
"is",
"either",
"pageEncoding",
"or",
"contentType",
"and",
"returns",
"the",
"specified",
"page",
"encoding",
"."
] | 3869c1643cdc6f7cb8b26097a7b6994683b13d7e | https://github.com/eclipse/packagedrone/blob/3869c1643cdc6f7cb8b26097a7b6994683b13d7e/bundles/org.apache.jasper.glassfish/src/org/apache/jasper/compiler/ParserController.java#L550-L568 | test | Get the pageEncoding from a pageEncoding attribute. | Of course, here is the Java code you requested:
```java
private String getPageEncodingFromDirective(Attributes attrs,
String attrName) {
String value = attrs.getValue(attrName);
if (attrName.equals("pageEncoding")) {
return value;
}
... |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/timerservice/persistence/database/DatabaseTimerPersistence.java | DatabaseTimerPersistence.extractDialects | private void extractDialects() {
for (Object prop : sql.keySet()) {
int dot = ((String)prop).indexOf('.');
if (dot > 0) {
databaseDialects.add(((String)prop).substring(dot+1));
}
}
} | java | private void extractDialects() {
for (Object prop : sql.keySet()) {
int dot = ((String)prop).indexOf('.');
if (dot > 0) {
databaseDialects.add(((String)prop).substring(dot+1));
}
}
} | [
"private",
"void",
"extractDialects",
"(",
")",
"{",
"for",
"(",
"Object",
"prop",
":",
"sql",
".",
"keySet",
"(",
")",
")",
"{",
"int",
"dot",
"=",
"(",
"(",
"String",
")",
"prop",
")",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"dot"... | Read the properties from the timer-sql and extract the database dialects. | [
"Read",
"the",
"properties",
"from",
"the",
"timer",
"-",
"sql",
"and",
"extract",
"the",
"database",
"dialects",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/timerservice/persistence/database/DatabaseTimerPersistence.java#L187-L194 | test | Extract the dialects from the sql. | Of course, here is the Java code you requested:
```java
private void extractDialects() {
for (Object prop : sql.keySet()) {
int dot = ((String)prop).indexOf('.');
if (dot > 0) {
databaseDialects.add(((String)prop).substring(dot+1));
}
}
}
```
Hop... |
deeplearning4j/nd4j | nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/memory/CudaMemoryManager.java | CudaMemoryManager.allocate | @Override
public Pointer allocate(long bytes, MemoryKind kind, boolean initialize) {
AtomicAllocator allocator = AtomicAllocator.getInstance();
//log.info("Allocating {} bytes in {} memory...", bytes, kind);
if (kind == MemoryKind.HOST) {
Pointer ptr = NativeOpsHolder.getInstan... | java | @Override
public Pointer allocate(long bytes, MemoryKind kind, boolean initialize) {
AtomicAllocator allocator = AtomicAllocator.getInstance();
//log.info("Allocating {} bytes in {} memory...", bytes, kind);
if (kind == MemoryKind.HOST) {
Pointer ptr = NativeOpsHolder.getInstan... | [
"@",
"Override",
"public",
"Pointer",
"allocate",
"(",
"long",
"bytes",
",",
"MemoryKind",
"kind",
",",
"boolean",
"initialize",
")",
"{",
"AtomicAllocator",
"allocator",
"=",
"AtomicAllocator",
".",
"getInstance",
"(",
")",
";",
"//log.info(\"Allocating {} bytes in... | This method returns Pointer to allocated memory chunk
PLEASE NOTE: Cache options depend on specific implementations
@param bytes
@param kind
@param initialize | [
"This",
"method",
"returns",
"Pointer",
"to",
"allocated",
"memory",
"chunk"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/memory/CudaMemoryManager.java#L37-L76 | test | allocate bytes in the specified memory kind | Of course, here is the Java code you requested:
```java
@Override
public Pointer allocate(long bytes, MemoryKind kind, boolean initialize) {
AtomicAllocator allocator = AtomicAllocator.getInstance();
//log.info("Allocating {} bytes in {} memory...", bytes, kind);
if (kind == MemoryKind.HO... |
oblac/jodd | jodd-json/src/main/java/jodd/json/JsonObject.java | JsonObject.getString | public String getString(final String key) {
CharSequence cs = (CharSequence) map.get(key);
return cs == null ? null : cs.toString();
} | java | public String getString(final String key) {
CharSequence cs = (CharSequence) map.get(key);
return cs == null ? null : cs.toString();
} | [
"public",
"String",
"getString",
"(",
"final",
"String",
"key",
")",
"{",
"CharSequence",
"cs",
"=",
"(",
"CharSequence",
")",
"map",
".",
"get",
"(",
"key",
")",
";",
"return",
"cs",
"==",
"null",
"?",
"null",
":",
"cs",
".",
"toString",
"(",
")",
... | Returns the string value with the specified key. | [
"Returns",
"the",
"string",
"value",
"with",
"the",
"specified",
"key",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-json/src/main/java/jodd/json/JsonObject.java#L66-L69 | test | Get the string value for the given key. | Of course, here is the Java code you requested:
```java
public String getString(final String key) {
CharSequence cs = (CharSequence) map.get(key);
return cs == null ? null : cs.toString();
}
```
Hope this helps! |
objectify/objectify | src/main/java/com/googlecode/objectify/Key.java | Key.getKindHere | private static String getKindHere(final Class<?> clazz) {
// @Entity is inherited so we have to be explicit about the declared annotations
final Entity ourAnn = TypeUtils.getDeclaredAnnotation(clazz, Entity.class);
if (ourAnn != null)
if (ourAnn.name().length() != 0)
return ourAnn.name();
else
... | java | private static String getKindHere(final Class<?> clazz) {
// @Entity is inherited so we have to be explicit about the declared annotations
final Entity ourAnn = TypeUtils.getDeclaredAnnotation(clazz, Entity.class);
if (ourAnn != null)
if (ourAnn.name().length() != 0)
return ourAnn.name();
else
... | [
"private",
"static",
"String",
"getKindHere",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"// @Entity is inherited so we have to be explicit about the declared annotations\r",
"final",
"Entity",
"ourAnn",
"=",
"TypeUtils",
".",
"getDeclaredAnnotation",
"(",
"... | Get the kind from the class if the class has an @Entity annotation, otherwise return null. | [
"Get",
"the",
"kind",
"from",
"the",
"class",
"if",
"the",
"class",
"has",
"an"
] | 4bf325d2e49b400326416977c7d9bbdf5380175b | https://github.com/objectify/objectify/blob/4bf325d2e49b400326416977c7d9bbdf5380175b/src/main/java/com/googlecode/objectify/Key.java#L381-L391 | test | Gets the kindHere method. | Of course, here is the Java code you requested:
```java
private static String getKindHere(final Class<?> clazz) {
// @Entity is inherited so we have to be explicit about the declared annotations
final Entity ourAnn = TypeUtils.getDeclaredAnnotation(clazz, Entity.class);
if (ourAnn != null)
if (ourAnn.name... |
ArpNetworking/logback-steno | src/main/java/com/arpnetworking/steno/Logger.java | Logger.info | public void info(
@Nullable final String event,
@Nullable final String message,
@Nullable final String[] dataKeys,
@Nullable final Object... dataValues) {
final Throwable throwable = extractThrowable(dataKeys, dataValues);
log(LogLevel.INFO, event, message... | java | public void info(
@Nullable final String event,
@Nullable final String message,
@Nullable final String[] dataKeys,
@Nullable final Object... dataValues) {
final Throwable throwable = extractThrowable(dataKeys, dataValues);
log(LogLevel.INFO, event, message... | [
"public",
"void",
"info",
"(",
"@",
"Nullable",
"final",
"String",
"event",
",",
"@",
"Nullable",
"final",
"String",
"message",
",",
"@",
"Nullable",
"final",
"String",
"[",
"]",
"dataKeys",
",",
"@",
"Nullable",
"final",
"Object",
"...",
"dataValues",
")"... | Log a message for a canonical event with supporting key-value pairs at
the info level.
The number of elements in the <code>dataNames</code> array should
match the number of arguments provided as <code>data</code>
unless a <code>Throwable</code> is specified as the final argument in
<code>data</code> in which case ther... | [
"Log",
"a",
"message",
"for",
"a",
"canonical",
"event",
"with",
"supporting",
"key",
"-",
"value",
"pairs",
"at",
"the",
"info",
"level",
"."
] | abd5c68ce7d42c39f80ffbad6d162d5fed3a346e | https://github.com/ArpNetworking/logback-steno/blob/abd5c68ce7d42c39f80ffbad6d162d5fed3a346e/src/main/java/com/arpnetworking/steno/Logger.java#L852-L859 | test | Logs an info event. | Of course, here is the Java code you requested:
```java
public void info(
@Nullable final String event,
@Nullable final String message,
@Nullable final String[] dataKeys,
@Nullable final Object... dataValues) {
final Throwable throwable = extractThrowable(dataKey... |
playframework/playframework | web/play-java-forms/src/main/java/play/data/DynamicForm.java | DynamicForm.fill | public DynamicForm fill(Map<String, Object> value) {
Form<Dynamic> form = super.fill(new Dynamic(value));
return new DynamicForm(
form.rawData(),
form.files(),
form.errors(),
form.value(),
messagesApi,
formatters,
validatorFactory,
config,
... | java | public DynamicForm fill(Map<String, Object> value) {
Form<Dynamic> form = super.fill(new Dynamic(value));
return new DynamicForm(
form.rawData(),
form.files(),
form.errors(),
form.value(),
messagesApi,
formatters,
validatorFactory,
config,
... | [
"public",
"DynamicForm",
"fill",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"value",
")",
"{",
"Form",
"<",
"Dynamic",
">",
"form",
"=",
"super",
".",
"fill",
"(",
"new",
"Dynamic",
"(",
"value",
")",
")",
";",
"return",
"new",
"DynamicForm",
"("... | Fills the form with existing data.
@param value the map of values to fill in the form.
@return the modified form. | [
"Fills",
"the",
"form",
"with",
"existing",
"data",
"."
] | 3c46dca803d24e715d85de678c59dcfac9525a00 | https://github.com/playframework/playframework/blob/3c46dca803d24e715d85de678c59dcfac9525a00/web/play-java-forms/src/main/java/play/data/DynamicForm.java#L245-L257 | test | Fill the form with the data from the given map. | Of course, here is the Java code you requested:
```java
public DynamicForm fill(Map<String, Object> value) {
Form<Dynamic> form = super.fill(new Dynamic(value));
return new DynamicForm(
form.rawData(),
form.files(),
form.errors(),
form.value(),
messagesApi,
forma... |
objectify/objectify | src/main/java/com/googlecode/objectify/impl/SimpleQueryImpl.java | SimpleQueryImpl.project | @Override
public QueryImpl<T> project(String... fields) {
QueryImpl<T> q = createQuery();
q.addProjection(fields);
return q;
} | java | @Override
public QueryImpl<T> project(String... fields) {
QueryImpl<T> q = createQuery();
q.addProjection(fields);
return q;
} | [
"@",
"Override",
"public",
"QueryImpl",
"<",
"T",
">",
"project",
"(",
"String",
"...",
"fields",
")",
"{",
"QueryImpl",
"<",
"T",
">",
"q",
"=",
"createQuery",
"(",
")",
";",
"q",
".",
"addProjection",
"(",
"fields",
")",
";",
"return",
"q",
";",
... | /* (non-Javadoc)
@see com.googlecode.objectify.cmd.SimpleQuery#project(String...) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 4bf325d2e49b400326416977c7d9bbdf5380175b | https://github.com/objectify/objectify/blob/4bf325d2e49b400326416977c7d9bbdf5380175b/src/main/java/com/googlecode/objectify/impl/SimpleQueryImpl.java#L165-L170 | test | Creates a new Query that will be aggregated on the results of a DELETE or DELETE operation. | Of course, here is the Java code you requested:
```java
@Override
public QueryImpl<T> project(String... fields) {
QueryImpl<T> q = createQuery();
q.addProjection(fields);
return q;
}
```
Hope this helps! |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageManagerImpl.java | GeoPackageManagerImpl.importGeoPackage | @Override
public boolean importGeoPackage(String database, InputStream stream,
boolean override, GeoPackageProgress progress) {
if (progress != null) {
try {
int streamLength = stream.available();
if (streamLength > 0) {
... | java | @Override
public boolean importGeoPackage(String database, InputStream stream,
boolean override, GeoPackageProgress progress) {
if (progress != null) {
try {
int streamLength = stream.available();
if (streamLength > 0) {
... | [
"@",
"Override",
"public",
"boolean",
"importGeoPackage",
"(",
"String",
"database",
",",
"InputStream",
"stream",
",",
"boolean",
"override",
",",
"GeoPackageProgress",
"progress",
")",
"{",
"if",
"(",
"progress",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
... | {@inheritDoc} | [
"{"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/factory/GeoPackageManagerImpl.java#L617-L634 | test | Import the GeoPackage from the input stream | Of course, here is the Java code you requested:
```java
@Override
public boolean importGeoPackage(String database, InputStream stream,
boolean override, GeoPackageProgress progress) {
if (progress != null) {
try {
int streamLength = stream.av... |
Unidata/thredds | opendap/src/main/java/opendap/servers/RelOpClause.java | RelOpClause.printConstraint | public void printConstraint(PrintWriter os)
{
lhs.printConstraint(os);
String op = ExprParserConstants.tokenImage[operator];
op = op.substring(1, op.length() - 1);
os.print(op);
//os.print(ExprParserConstants.tokenImage[operator].substring(2, 3));
if (rhs.size() == 1)... | java | public void printConstraint(PrintWriter os)
{
lhs.printConstraint(os);
String op = ExprParserConstants.tokenImage[operator];
op = op.substring(1, op.length() - 1);
os.print(op);
//os.print(ExprParserConstants.tokenImage[operator].substring(2, 3));
if (rhs.size() == 1)... | [
"public",
"void",
"printConstraint",
"(",
"PrintWriter",
"os",
")",
"{",
"lhs",
".",
"printConstraint",
"(",
"os",
")",
";",
"String",
"op",
"=",
"ExprParserConstants",
".",
"tokenImage",
"[",
"operator",
"]",
";",
"op",
"=",
"op",
".",
"substring",
"(",
... | Prints the original string representation of this clause.
For use in debugging. | [
"Prints",
"the",
"original",
"string",
"representation",
"of",
"this",
"clause",
".",
"For",
"use",
"in",
"debugging",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/opendap/src/main/java/opendap/servers/RelOpClause.java#L151-L171 | test | Print the constraint for a single language language | Of course, here is the Java code you requested:
```java
public void printConstraint(PrintWriter os)
{
lhs.printConstraint(os);
String op = ExprParserConstants.tokenImage[operator];
op = op.substring(1, op.length() - 1);
os.print(op);
//os.print(ExprParserConstants.tokenImage... |
wildfly/wildfly | iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/naming/CorbaNamingContext.java | CorbaNamingContext.getObjectOID | private String getObjectOID(org.omg.CORBA.Object object) {
String oid = null;
try {
byte[] oidBytes = this.poa.reference_to_id(object);
if (oidBytes != null)
oid = new String(oidBytes, StandardCharsets.UTF_8);
} catch (Exception e) {
IIOPLogger... | java | private String getObjectOID(org.omg.CORBA.Object object) {
String oid = null;
try {
byte[] oidBytes = this.poa.reference_to_id(object);
if (oidBytes != null)
oid = new String(oidBytes, StandardCharsets.UTF_8);
} catch (Exception e) {
IIOPLogger... | [
"private",
"String",
"getObjectOID",
"(",
"org",
".",
"omg",
".",
"CORBA",
".",
"Object",
"object",
")",
"{",
"String",
"oid",
"=",
"null",
";",
"try",
"{",
"byte",
"[",
"]",
"oidBytes",
"=",
"this",
".",
"poa",
".",
"reference_to_id",
"(",
"object",
... | <p>
Obtains the OID of the specified CORBA object.
</p>
@param object the CORBA object whose OID is to be extracted.
@return a {@code String} representing the object OID or null if the method is unable to obtain the object OID. | [
"<p",
">",
"Obtains",
"the",
"OID",
"of",
"the",
"specified",
"CORBA",
"object",
".",
"<",
"/",
"p",
">"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/iiop-openjdk/src/main/java/org/wildfly/iiop/openjdk/naming/CorbaNamingContext.java#L565-L575 | test | Get the OID of the object. | Of course, here is the Java code you requested:
```java
private String getObjectOID(org.omg.CORBA.Object object) {
String oid = null;
try {
byte[] oidBytes = this.poa.reference_to_id(object);
if (oidBytes != null)
oid = new String(oidBytes, StandardCharsets.UTF_8... |
kocakosm/pitaya | src/org/kocakosm/pitaya/collection/ImmutableList.java | ImmutableList.copyOf | public static <E> List<E> copyOf(Iterable<? extends E> i)
{
return new ImmutableList<E>(Iterables.toList(i));
} | java | public static <E> List<E> copyOf(Iterable<? extends E> i)
{
return new ImmutableList<E>(Iterables.toList(i));
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"copyOf",
"(",
"Iterable",
"<",
"?",
"extends",
"E",
">",
"i",
")",
"{",
"return",
"new",
"ImmutableList",
"<",
"E",
">",
"(",
"Iterables",
".",
"toList",
"(",
"i",
")",
")",
";",
"}"
] | Creates a new {@code ImmutableList} from the given {@code Iterable}.
@param <E> the type of the {@code List}'s elements.
@param i the source {@code Iterable}.
@return the created {@code ImmutableList}.
@throws NullPointerException if {@code i} is {@code null}. | [
"Creates",
"a",
"new",
"{",
"@code",
"ImmutableList",
"}",
"from",
"the",
"given",
"{",
"@code",
"Iterable",
"}",
"."
] | f2b203b6cdb32723bd1249a1325a3bb5918bf99a | https://github.com/kocakosm/pitaya/blob/f2b203b6cdb32723bd1249a1325a3bb5918bf99a/src/org/kocakosm/pitaya/collection/ImmutableList.java#L240-L243 | test | Creates a new immutable list from the given iterable. | Of course, here is the Java code you requested:
```java
public static <E> List<E> copyOf(Iterable<? extends E> i)
{
return new ImmutableList<E>(Iterables.toList(i));
}
```
Hope this helps! |
Unidata/thredds | waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapCalendar2.java | ErddapCalendar2.getTimeBaseAndFactor | public static double[] getTimeBaseAndFactor(String tsUnits) throws Exception {
String errorInMethod = ErddapString2.ERROR + " in Calendar2.getTimeBaseAndFactor(" + tsUnits + "):\n";
if (tsUnits == null) {
throw new NullPointerException(errorInMethod + "tsUnits must be non-null.");
}... | java | public static double[] getTimeBaseAndFactor(String tsUnits) throws Exception {
String errorInMethod = ErddapString2.ERROR + " in Calendar2.getTimeBaseAndFactor(" + tsUnits + "):\n";
if (tsUnits == null) {
throw new NullPointerException(errorInMethod + "tsUnits must be non-null.");
}... | [
"public",
"static",
"double",
"[",
"]",
"getTimeBaseAndFactor",
"(",
"String",
"tsUnits",
")",
"throws",
"Exception",
"{",
"String",
"errorInMethod",
"=",
"ErddapString2",
".",
"ERROR",
"+",
"\" in Calendar2.getTimeBaseAndFactor(\"",
"+",
"tsUnits",
"+",
"\"):\\n\"",
... | This converts a string "[units] since [isoDate]"
(e.g., "minutes since 1985-01-01") into
a baseSeconds (seconds since 1970-01-01) and a factor ("minutes" returns 60).
<br>So simplistically, epochSeconds = storedTime * factor + baseSeconds.
<br>Or simplistically, storedTime = (epochSeconds - baseSeconds) / factor.
<p>W... | [
"This",
"converts",
"a",
"string",
"[",
"units",
"]",
"since",
"[",
"isoDate",
"]",
"(",
"e",
".",
"g",
".",
"minutes",
"since",
"1985",
"-",
"01",
"-",
"01",
")",
"into",
"a",
"baseSeconds",
"(",
"seconds",
"since",
"1970",
"-",
"01",
"-",
"01",
... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/waterml/src/main/java/ucar/nc2/ogc/erddap/util/ErddapCalendar2.java#L81-L96 | test | Get the time base and factor from the string. | Of course, here is the Java code you requested:
```java
public static double[] getTimeBaseAndFactor(String tsUnits) throws Exception {
String errorInMethod = ErddapString2.ERROR + " in Calendar2.getTimeBaseAndFactor(" + tsUnits + "):\n";
if (tsUnits == null) {
throw new NullPointerExceptio... |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/model/resource/locator/wildcard/JarWildcardStreamLocator.java | JarWildcardStreamLocator.locateStreamFromJar | private InputStream locateStreamFromJar(final String uri, final File jarPath)
throws IOException {
JarFile jarFile = null;
try {
LOG.debug("Locating stream from jar: {}", jarPath);
final WildcardContext wildcardContext = new WildcardContext(uri, jarPath);
String classPath = FilenameUtils... | java | private InputStream locateStreamFromJar(final String uri, final File jarPath)
throws IOException {
JarFile jarFile = null;
try {
LOG.debug("Locating stream from jar: {}", jarPath);
final WildcardContext wildcardContext = new WildcardContext(uri, jarPath);
String classPath = FilenameUtils... | [
"private",
"InputStream",
"locateStreamFromJar",
"(",
"final",
"String",
"uri",
",",
"final",
"File",
"jarPath",
")",
"throws",
"IOException",
"{",
"JarFile",
"jarFile",
"=",
"null",
";",
"try",
"{",
"LOG",
".",
"debug",
"(",
"\"Locating stream from jar: {}\"",
... | Finds the specified wildcard-URI resource(s) inside a JAR file and returns an {@link InputStream} to read a bundle
of matching resources.
@param uri
Resource(s) URI to match. It cannot be null or empty.
@param jarPath
A valid JAR file. It cannot be null.
@return A valid {@link InputStream} to read the bundle. Clients ... | [
"Finds",
"the",
"specified",
"wildcard",
"-",
"URI",
"resource",
"(",
"s",
")",
"inside",
"a",
"JAR",
"file",
"and",
"returns",
"an",
"{",
"@link",
"InputStream",
"}",
"to",
"read",
"a",
"bundle",
"of",
"matching",
"resources",
"."
] | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/model/resource/locator/wildcard/JarWildcardStreamLocator.java#L136-L175 | test | Locate stream from jar. | Of course, here is the Java code you requested:
```java
private InputStream locateStreamFromJar(final String uri, final File jarPath)
throws IOException {
JarFile jarFile = null;
try {
LOG.debug("Locating stream from jar: {}", jarPath);
final WildcardContext wildcardContext = new WildcardCont... |
snakerflow/snakerflow | snaker-core/src/main/java/org/snaker/engine/impl/SchedulerInterceptor.java | SchedulerInterceptor.intercept | public void intercept(Execution execution) {
if(!isScheduled) return;
for(Task task : execution.getTasks()) {
String id = execution.getProcess().getId()
+ "-" + execution.getOrder().getId()
+ "-" + task.getId();
Date expireDate = task.getExpireDate();
if(expireDate != null) {
schedule(id, t... | java | public void intercept(Execution execution) {
if(!isScheduled) return;
for(Task task : execution.getTasks()) {
String id = execution.getProcess().getId()
+ "-" + execution.getOrder().getId()
+ "-" + task.getId();
Date expireDate = task.getExpireDate();
if(expireDate != null) {
schedule(id, t... | [
"public",
"void",
"intercept",
"(",
"Execution",
"execution",
")",
"{",
"if",
"(",
"!",
"isScheduled",
")",
"return",
";",
"for",
"(",
"Task",
"task",
":",
"execution",
".",
"getTasks",
"(",
")",
")",
"{",
"String",
"id",
"=",
"execution",
".",
"getPro... | 时限控制拦截方法 | [
"时限控制拦截方法"
] | 9c8cb3148a76702f1eda22f1d113053cb44b1eff | https://github.com/snakerflow/snakerflow/blob/9c8cb3148a76702f1eda22f1d113053cb44b1eff/snaker-core/src/main/java/org/snaker/engine/impl/SchedulerInterceptor.java#L52-L67 | test | Intercepts the given execution. | Of course, here is the Java code you requested:
```java
public void intercept(Execution execution) {
if(!isScheduled) return;
for(Task task : execution.getTasks()) {
String id = execution.getProcess().getId()
+ "-" + execution.getOrder().getId()
+ "-" + task.getId();
Date expireDate = task.getExp... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/dataset/CoordTransBuilder.java | CoordTransBuilder.makeCoordinateTransform | static public CoordinateTransform makeCoordinateTransform (NetcdfDataset ds, AttributeContainer ctv, Formatter parseInfo, Formatter errInfo) {
// standard name
String transform_name = ctv.findAttValueIgnoreCase("transform_name", null);
if (null == transform_name)
transform_name = ctv.findAttValueI... | java | static public CoordinateTransform makeCoordinateTransform (NetcdfDataset ds, AttributeContainer ctv, Formatter parseInfo, Formatter errInfo) {
// standard name
String transform_name = ctv.findAttValueIgnoreCase("transform_name", null);
if (null == transform_name)
transform_name = ctv.findAttValueI... | [
"static",
"public",
"CoordinateTransform",
"makeCoordinateTransform",
"(",
"NetcdfDataset",
"ds",
",",
"AttributeContainer",
"ctv",
",",
"Formatter",
"parseInfo",
",",
"Formatter",
"errInfo",
")",
"{",
"// standard name\r",
"String",
"transform_name",
"=",
"ctv",
".",
... | Make a CoordinateTransform object from the parameters in a Coordinate Transform Variable, using an intrinsic or registered CoordTransBuilder.
@param ds enclosing dataset, only used for vertical transforms
@param ctv the Coordinate Transform Variable - container for the transform parameters
@param parseInfo pass back in... | [
"Make",
"a",
"CoordinateTransform",
"object",
"from",
"the",
"parameters",
"in",
"a",
"Coordinate",
"Transform",
"Variable",
"using",
"an",
"intrinsic",
"or",
"registered",
"CoordTransBuilder",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/dataset/CoordTransBuilder.java#L145-L213 | test | Make a CoordinateTransform object from the given AttributeContainer | Of course, here is the Java code you requested:
```java
static public CoordinateTransform makeCoordinateTransform (NetcdfDataset ds, AttributeContainer ctv, Formatter parseInfo, Formatter errInfo) {
// standard name
String transform_name = ctv.findAttValueIgnoreCase("transform_name", null);
if (null == ... |
AndrewReitz/shillelagh | shillelagh/src/main/java/shillelagh/internal/ShillelaghUtil.java | ShillelaghUtil.serialize | public static <T> byte[] serialize(T object) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(object);
return byteArrayOutputStream.toByteAr... | java | public static <T> byte[] serialize(T object) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeObject(object);
return byteArrayOutputStream.toByteAr... | [
"public",
"static",
"<",
"T",
">",
"byte",
"[",
"]",
"serialize",
"(",
"T",
"object",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"objectOutputStream",
"=",
"ne... | Takes an object and serializes it to a byte array. Don't enforce that it extends serializable
to allow for lists and maps to be passed in.
@param object The object to serialize. Must implement {@link java.io.Serializable}
@return The object as a byte array. | [
"Takes",
"an",
"object",
"and",
"serializes",
"it",
"to",
"a",
"byte",
"array",
".",
"Don",
"t",
"enforce",
"that",
"it",
"extends",
"serializable",
"to",
"allow",
"for",
"lists",
"and",
"maps",
"to",
"be",
"passed",
"in",
"."
] | d016971487bf8993686eb7d03146110f658e0f18 | https://github.com/AndrewReitz/shillelagh/blob/d016971487bf8993686eb7d03146110f658e0f18/shillelagh/src/main/java/shillelagh/internal/ShillelaghUtil.java#L46-L55 | test | Serialize a single object to a byte array. | Of course, here is the Java code you requested:
```java
public static <T> byte[] serialize(T object) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
objectOutputStream.writeOb... |
markhobson/microbrowser | tck/src/main/java/org/hobsoft/microbrowser/tck/MicrodataDocumentTck.java | MicrodataDocumentTck.getLinkWhenAnchorReturnsLink | @Test
public void getLinkWhenAnchorReturnsLink() throws MalformedURLException
{
server().enqueue(new MockResponse().setBody("<html><body>"
+ "<a rel='x' href='http://y/'/>"
+ "</body></html>"));
Link actual = newBrowser().get(url(server()))
.getLink("x");
assertThat("link", actual, is(link("x", "... | java | @Test
public void getLinkWhenAnchorReturnsLink() throws MalformedURLException
{
server().enqueue(new MockResponse().setBody("<html><body>"
+ "<a rel='x' href='http://y/'/>"
+ "</body></html>"));
Link actual = newBrowser().get(url(server()))
.getLink("x");
assertThat("link", actual, is(link("x", "... | [
"@",
"Test",
"public",
"void",
"getLinkWhenAnchorReturnsLink",
"(",
")",
"throws",
"MalformedURLException",
"{",
"server",
"(",
")",
".",
"enqueue",
"(",
"new",
"MockResponse",
"(",
")",
".",
"setBody",
"(",
"\"<html><body>\"",
"+",
"\"<a rel='x' href='http://y/'/>\... | ---------------------------------------------------------------------------------------------------------------- | [
"----------------------------------------------------------------------------------------------------------------"
] | 732d2dadc1c3eaad688de31dc09f360df580faf1 | https://github.com/markhobson/microbrowser/blob/732d2dadc1c3eaad688de31dc09f360df580faf1/tck/src/main/java/org/hobsoft/microbrowser/tck/MicrodataDocumentTck.java#L163-L174 | test | Gets a link when an anchor returns a URL. | Of course, here is the Java code you requested:
```java
@Test
public void getLinkWhenAnchorReturnsLink() throws MalformedURLException
{
server().enqueue(new MockResponse().setBody("<html><body>"
+ "<a rel='x' href='http://y/'/>"
+ "</body></html>"));
Link actual = newBrowser().get(url(server()))
.get... |
Unidata/thredds | dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java | Nc4Cursor.readAtomicScalar | protected Object
readAtomicScalar(VarNotes vi, TypeNotes ti)
throws DapException
{
DapVariable atomvar = (DapVariable) getTemplate();
// Get into memory
Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI();
int ret;
DapType basetype = ti.getType();
Object ... | java | protected Object
readAtomicScalar(VarNotes vi, TypeNotes ti)
throws DapException
{
DapVariable atomvar = (DapVariable) getTemplate();
// Get into memory
Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI();
int ret;
DapType basetype = ti.getType();
Object ... | [
"protected",
"Object",
"readAtomicScalar",
"(",
"VarNotes",
"vi",
",",
"TypeNotes",
"ti",
")",
"throws",
"DapException",
"{",
"DapVariable",
"atomvar",
"=",
"(",
"DapVariable",
")",
"getTemplate",
"(",
")",
";",
"// Get into memory",
"Nc4prototypes",
"nc4",
"=",
... | Read a top-level scalar atomic variable
@param vi
@param ti
@return
@throws DapException | [
"Read",
"a",
"top",
"-",
"level",
"scalar",
"atomic",
"variable"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4lib/src/main/java/dap4/dap4lib/netcdf/Nc4Cursor.java#L235-L265 | test | read atomic scalar. | Of course, here is the Java code you requested:
```java
protected Object
readAtomicScalar(VarNotes vi, TypeNotes ti)
throws DapException
{
DapVariable atomvar = (DapVariable) getTemplate();
// Get into memory
Nc4prototypes nc4 = ((Nc4DSP) this.dsp).getJNI();
int ret;... |
Unidata/thredds | cdm/src/main/java/ucar/nc2/util/EscapeStrings.java | EscapeStrings.indexOf | public static int indexOf(String escapedName, char c) {
int pos = 0;
while (true) {
pos = escapedName.indexOf(c, pos + 1);
if (pos <= 0) return pos;
if ((pos > 0) && escapedName.charAt(pos - 1) != '\\') return pos;
}
} | java | public static int indexOf(String escapedName, char c) {
int pos = 0;
while (true) {
pos = escapedName.indexOf(c, pos + 1);
if (pos <= 0) return pos;
if ((pos > 0) && escapedName.charAt(pos - 1) != '\\') return pos;
}
} | [
"public",
"static",
"int",
"indexOf",
"(",
"String",
"escapedName",
",",
"char",
"c",
")",
"{",
"int",
"pos",
"=",
"0",
";",
"while",
"(",
"true",
")",
"{",
"pos",
"=",
"escapedName",
".",
"indexOf",
"(",
"c",
",",
"pos",
"+",
"1",
")",
";",
"if"... | Find first occurence of char c in escapedName, excluding escaped c.
@param escapedName search in this string
@param c for this char but not \\cha
@return pos in string, or -1 | [
"Find",
"first",
"occurence",
"of",
"char",
"c",
"in",
"escapedName",
"excluding",
"escaped",
"c",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/util/EscapeStrings.java#L438-L445 | test | Gets the index of the first occurrence of c in the escaped name. | Of course, here is the Java code you requested:
```java
public static int indexOf(String escapedName, char c) {
int pos = 0;
while (true) {
pos = escapedName.indexOf(c, pos + 1);
if (pos <= 0) return pos;
if ((pos > 0) && escapedName.charAt(pos - 1) != '\\') return pos;
}
}
```
Hope th... |
aoindustries/semanticcms-core-view-content | src/main/java/com/semanticcms/core/view/content/ContentView.java | ContentView.getLastModified | @Override
public ReadableInstant getLastModified(
ServletContext servletContext,
HttpServletRequest request,
HttpServletResponse response,
Page page
) throws ServletException, IOException {
return AoArrays.maxNonNull(
page.getDateCreated(),
page.getDatePublished(),
page.getDateModified()
);
} | java | @Override
public ReadableInstant getLastModified(
ServletContext servletContext,
HttpServletRequest request,
HttpServletResponse response,
Page page
) throws ServletException, IOException {
return AoArrays.maxNonNull(
page.getDateCreated(),
page.getDatePublished(),
page.getDateModified()
);
} | [
"@",
"Override",
"public",
"ReadableInstant",
"getLastModified",
"(",
"ServletContext",
"servletContext",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"Page",
"page",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"retu... | The last modified time of a page is the most recent of:
<ol>
<li>{@link Page#getDateCreated()}</li>
<li>{@link Page#getDatePublished()}</li>
<li>{@link Page#getDateModified()}</li>
</ol>
Note: {@link Page#getDateReviewed()} is left out because a change in its value alone does not indicate a change in content. | [
"The",
"last",
"modified",
"time",
"of",
"a",
"page",
"is",
"the",
"most",
"recent",
"of",
":",
"<ol",
">",
"<li",
">",
"{"
] | 3dd7e3e8f37b8c5d8435c207ce93a53abbb8b4b0 | https://github.com/aoindustries/semanticcms-core-view-content/blob/3dd7e3e8f37b8c5d8435c207ce93a53abbb8b4b0/src/main/java/com/semanticcms/core/view/content/ContentView.java#L79-L91 | test | Get the last modified date of the page. | Of course, here is the Java code you requested:
```java
@Override
public ReadableInstant getLastModified(
ServletContext servletContext,
HttpServletRequest request,
HttpServletResponse response,
Page page
) throws ServletException, IOException {
return AoArrays.maxNonNull(
page.getDateCreated(),
page... |
square/retrofit | retrofit-mock/src/main/java/retrofit2/mock/Calls.java | Calls.defer | public static <T> Call<T> defer(Callable<Call<T>> callable) {
return new DeferredCall<>(callable);
} | java | public static <T> Call<T> defer(Callable<Call<T>> callable) {
return new DeferredCall<>(callable);
} | [
"public",
"static",
"<",
"T",
">",
"Call",
"<",
"T",
">",
"defer",
"(",
"Callable",
"<",
"Call",
"<",
"T",
">",
">",
"callable",
")",
"{",
"return",
"new",
"DeferredCall",
"<>",
"(",
"callable",
")",
";",
"}"
] | Invokes {@code callable} once for the returned {@link Call} and once for each instance that is
obtained from {@linkplain Call#clone() cloning} the returned {@link Call}. | [
"Invokes",
"{"
] | 81a6193a7b3f2b1bf25e78adc2638681b0514fe8 | https://github.com/square/retrofit/blob/81a6193a7b3f2b1bf25e78adc2638681b0514fe8/retrofit-mock/src/main/java/retrofit2/mock/Calls.java#L33-L35 | test | Defer a call to a function. | Of course, here is the Java code you requested:
```java
public static <T> Call<T> defer(Callable<Call<T>> callable) {
return new DeferredCall<>(callable);
}
```
Hope this helps! |
Unidata/thredds | cdm/src/main/java/ucar/nc2/NetcdfFile.java | NetcdfFile.addGroup | public Group addGroup(Group parent, Group g) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addGroup(g);
return g;
} | java | public Group addGroup(Group parent, Group g) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addGroup(g);
return g;
} | [
"public",
"Group",
"addGroup",
"(",
"Group",
"parent",
",",
"Group",
"g",
")",
"{",
"if",
"(",
"immutable",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cant modify\"",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"parent",
"=",
"rootGroup",
... | Add a group to the parent group.
@param parent add to this group. If group is null, use root group
@param g add this group
@return the group that was added | [
"Add",
"a",
"group",
"to",
"the",
"parent",
"group",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/cdm/src/main/java/ucar/nc2/NetcdfFile.java#L1746-L1751 | test | Add a group to a parent group. | Of course, here is the Java code you requested:
```java
public Group addGroup(Group parent, Group g) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addGroup(g);
return g;
}
```
Hope this helps! |
rackerlabs/blueflood | blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java | Granularity.granularityFromPointsInInterval | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis) {
return granularityFromPointsInInterval(tenantid, from, to, points, algorithm, assumedIntervalMillis, DEFAULT_TTL_COMPARISON_SOURCE);
} | java | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis) {
return granularityFromPointsInInterval(tenantid, from, to, points, algorithm, assumedIntervalMillis, DEFAULT_TTL_COMPARISON_SOURCE);
} | [
"public",
"static",
"Granularity",
"granularityFromPointsInInterval",
"(",
"String",
"tenantid",
",",
"long",
"from",
",",
"long",
"to",
",",
"int",
"points",
",",
"String",
"algorithm",
",",
"long",
"assumedIntervalMillis",
")",
"{",
"return",
"granularityFromPoint... | {@code ttlComparisonClock} defaults to {@link #DEFAULT_TTL_COMPARISON_SOURCE}.
@see #granularityFromPointsInInterval(String, long, long, int, String, long, Clock) | [
"{",
"@code",
"ttlComparisonClock",
"}",
"defaults",
"to",
"{",
"@link",
"#DEFAULT_TTL_COMPARISON_SOURCE",
"}",
"."
] | 4722a3449b1a7f8e88889ea8c340c6f24396b5b0 | https://github.com/rackerlabs/blueflood/blob/4722a3449b1a7f8e88889ea8c340c6f24396b5b0/blueflood-core/src/main/java/com/rackspacecloud/blueflood/rollup/Granularity.java#L193-L195 | test | Returns a granularity that is appropriate for a given interval of time. | Of course, here is the Java code you requested:
```java
public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis) {
return granularityFromPointsInInterval(tenantid, from, to, points, algorithm, assumedIntervalMillis,... |
oblac/jodd | jodd-core/src/main/java/jodd/buffer/FastCharBuffer.java | FastCharBuffer.grow | private void grow(final int minCapacity) {
final int oldCapacity = buffer.length;
int newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0) {
// special case, min capacity is larger then a grow
newCapacity = minCapacity + 512;
}
buffer = Arrays.copyOf(buffer, newCapacity);
} | java | private void grow(final int minCapacity) {
final int oldCapacity = buffer.length;
int newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0) {
// special case, min capacity is larger then a grow
newCapacity = minCapacity + 512;
}
buffer = Arrays.copyOf(buffer, newCapacity);
} | [
"private",
"void",
"grow",
"(",
"final",
"int",
"minCapacity",
")",
"{",
"final",
"int",
"oldCapacity",
"=",
"buffer",
".",
"length",
";",
"int",
"newCapacity",
"=",
"oldCapacity",
"<<",
"1",
";",
"if",
"(",
"newCapacity",
"-",
"minCapacity",
"<",
"0",
"... | Grows the buffer. | [
"Grows",
"the",
"buffer",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/buffer/FastCharBuffer.java#L62-L70 | test | Grows the buffer by a given capacity. | Of course, here is the Java code you requested:
```java
private void grow(final int minCapacity) {
final int oldCapacity = buffer.length;
int newCapacity = oldCapacity << 1;
if (newCapacity - minCapacity < 0) {
// special case, min capacity is larger then a grow
newCapacity = minCapacity + 512;
}
buffe... |
basis-technology-corp/tcl-regex-java | src/main/java/com/basistech/tclre/Runtime.java | Runtime.find | boolean find(Cnfa cnfa) {
int begin;
int end = -1;
int cold;
int open; /* open and close of range of possible starts */
int close;
boolean hitend;
boolean shorter = 0 != (g.tree.flags & Subre.SHORTER);
boolean lookingAt = 0 != (eflags & Flags.REG_LOO... | java | boolean find(Cnfa cnfa) {
int begin;
int end = -1;
int cold;
int open; /* open and close of range of possible starts */
int close;
boolean hitend;
boolean shorter = 0 != (g.tree.flags & Subre.SHORTER);
boolean lookingAt = 0 != (eflags & Flags.REG_LOO... | [
"boolean",
"find",
"(",
"Cnfa",
"cnfa",
")",
"{",
"int",
"begin",
";",
"int",
"end",
"=",
"-",
"1",
";",
"int",
"cold",
";",
"int",
"open",
";",
"/* open and close of range of possible starts */",
"int",
"close",
";",
"boolean",
"hitend",
";",
"boolean",
"... | find - find a match for the main NFA (no-complications case)
<p>
First, it runs the 'search machine' in non-greedy mode (shortest). The 'search machine' is the NFA with
.* added to the front and the back, more or less. See 'makesearch'. In many cases, running the search machine
'shortest' is considerably faster than ru... | [
"find",
"-",
"find",
"a",
"match",
"for",
"the",
"main",
"NFA",
"(",
"no",
"-",
"complications",
"case",
")",
"<p",
">",
"First",
"it",
"runs",
"the",
"search",
"machine",
"in",
"non",
"-",
"greedy",
"mode",
"(",
"shortest",
")",
".",
"The",
"search"... | de0d5eaccf9a61b694cb8793f234cc229c395b43 | https://github.com/basis-technology-corp/tcl-regex-java/blob/de0d5eaccf9a61b694cb8793f234cc229c395b43/src/main/java/com/basistech/tclre/Runtime.java#L125-L200 | test | Find the best match. | Of course, here is the Java code you requested:
```java
boolean find(Cnfa cnfa) {
int begin;
int end = -1;
int cold;
int open; /* open and close of range of possible starts */
int close;
boolean hitend;
boolean shorter = 0 != (g.tree.flags & Subre.SHORTER);... |
intellimate/IzouSDK | src/main/java/org/intellimate/izou/sdk/frameworks/music/resources/CommandResource.java | CommandResource.verify | public static boolean verify(String command, Capabilities capabilities) {
return verifyCommand(command) && verifyCapabilities(command, capabilities);
} | java | public static boolean verify(String command, Capabilities capabilities) {
return verifyCommand(command) && verifyCapabilities(command, capabilities);
} | [
"public",
"static",
"boolean",
"verify",
"(",
"String",
"command",
",",
"Capabilities",
"capabilities",
")",
"{",
"return",
"verifyCommand",
"(",
"command",
")",
"&&",
"verifyCapabilities",
"(",
"command",
",",
"capabilities",
")",
";",
"}"
] | verifies tha the command is legal and able to be executed
@param command the command
@param capabilities the capabilities
@return true if able, false if not | [
"verifies",
"tha",
"the",
"command",
"is",
"legal",
"and",
"able",
"to",
"be",
"executed"
] | bc8705ad48a6ca12a722f2b787be435949fa5d08 | https://github.com/intellimate/IzouSDK/blob/bc8705ad48a6ca12a722f2b787be435949fa5d08/src/main/java/org/intellimate/izou/sdk/frameworks/music/resources/CommandResource.java#L109-L111 | test | Verify the command and capabilities. | Of course, here is the Java code you requested:
```java
public static boolean verify(String command, Capabilities capabilities) {
return verifyCommand(command) && verifyCapabilities(command, capabilities);
}
```
Hope this helps! |
OpenEstate/OpenEstate-IO | Examples/src/main/java/org/openestate/io/examples/DaftIeReadingExample.java | DaftIeReadingExample.read | protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file is invalid");
return;
}
DaftIe... | java | protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file is invalid");
return;
}
DaftIe... | [
"protected",
"static",
"void",
"read",
"(",
"File",
"xmlFile",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"ParserConfigurationException",
",",
"JAXBException",
"{",
"LOGGER",
".",
"info",
"(",
"\"process file: \"",
"+",
"xmlFile",
".",
"getAbsolutePath"... | Read a {@link File} into a {@link DaftIeDocument} and print some of its
content to console.
@param xmlFile the file to read
@throws SAXException if the file is not readable by the XML parser
@throws IOException if the file is not readable
@throws ParserConfigurationException if the XML... | [
"Read",
"a",
"{",
"@link",
"File",
"}",
"into",
"a",
"{",
"@link",
"DaftIeDocument",
"}",
"and",
"print",
"some",
"of",
"its",
"content",
"to",
"console",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/Examples/src/main/java/org/openestate/io/examples/DaftIeReadingExample.java#L94-L106 | test | Read the Daft Ie XML file. | Of course, here is the Java code you requested:
```java
protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file i... |
RestComm/jain-slee | container/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextCacheData.java | ActivityContextCacheData.getNamesBoundCopy | public Set getNamesBoundCopy() {
final Node node = getNamesBoundNode(false);
return node != null ? node.getChildrenNames() : Collections.emptySet();
} | java | public Set getNamesBoundCopy() {
final Node node = getNamesBoundNode(false);
return node != null ? node.getChildrenNames() : Collections.emptySet();
} | [
"public",
"Set",
"getNamesBoundCopy",
"(",
")",
"{",
"final",
"Node",
"node",
"=",
"getNamesBoundNode",
"(",
"false",
")",
";",
"return",
"node",
"!=",
"null",
"?",
"node",
".",
"getChildrenNames",
"(",
")",
":",
"Collections",
".",
"emptySet",
"(",
")",
... | Returns the set of names bound to the ac
@return | [
"Returns",
"the",
"set",
"of",
"names",
"bound",
"to",
"the",
"ac"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextCacheData.java#L333-L336 | test | Returns a copy of the names bound to this node. | Of course, here is the Java code you requested:
```java
public Set getNamesBoundCopy() {
final Node node = getNamesBoundNode(false);
return node != null ? node.getChildrenNames() : Collections.emptySet();
}
```
Hope this helps! |
WASdev/ci.common | src/main/java/net/wasdev/wlp/common/plugins/util/InstallFeatureUtil.java | InstallFeatureUtil.getOverrideBundleDescriptor | public String getOverrideBundleDescriptor(String groupId, String artifactId) throws PluginExecutionException {
File overrideJar = downloadOverrideJar(groupId, artifactId);
if (overrideJar != null && overrideJar.exists()) {
String symbolicName = extractSymbolicName(overrideJar);
i... | java | public String getOverrideBundleDescriptor(String groupId, String artifactId) throws PluginExecutionException {
File overrideJar = downloadOverrideJar(groupId, artifactId);
if (overrideJar != null && overrideJar.exists()) {
String symbolicName = extractSymbolicName(overrideJar);
i... | [
"public",
"String",
"getOverrideBundleDescriptor",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
")",
"throws",
"PluginExecutionException",
"{",
"File",
"overrideJar",
"=",
"downloadOverrideJar",
"(",
"groupId",
",",
"artifactId",
")",
";",
"if",
"(",
"over... | Download the override bundle from the repository with the given groupId and
artifactId, corresponding to the latest version in the range between the
current Open Liberty version (inclusive) and the next version
(exclusive). Returns a string in the format "filepath;BundleName" where
BundleName is the bundle symbolic nam... | [
"Download",
"the",
"override",
"bundle",
"from",
"the",
"repository",
"with",
"the",
"given",
"groupId",
"and",
"artifactId",
"corresponding",
"to",
"the",
"latest",
"version",
"in",
"the",
"range",
"between",
"the",
"current",
"Open",
"Liberty",
"version",
"(",... | 24fc917383e9ff60ea6a42972c86577fe0f4591e | https://github.com/WASdev/ci.common/blob/24fc917383e9ff60ea6a42972c86577fe0f4591e/src/main/java/net/wasdev/wlp/common/plugins/util/InstallFeatureUtil.java#L778-L787 | test | Get the bundle descriptor of the override bundle. | Of course, here is the Java code you requested:
```java
public String getOverrideBundleDescriptor(String groupId, String artifactId) throws PluginExecutionException {
File overrideJar = downloadOverrideJar(groupId, artifactId);
if (overrideJar != null && overrideJar.exists()) {
String symbo... |
jcodec/jcodec | src/main/java/net/sourceforge/jaad/aac/sbr/SBR.java | SBR.sbr_envelope | private void sbr_envelope(IBitStream ld, int ch) throws AACException {
int env, band;
int delta = 0;
int[][] t_huff, f_huff;
if((this.L_E[ch]==1)&&(this.bs_frame_class[ch]==FIXFIX))
this.amp_res[ch] = false;
else
this.amp_res[ch] = this.bs_amp_res;
if((this.bs_coupling)&&(ch==1)) {
delta = 1;
... | java | private void sbr_envelope(IBitStream ld, int ch) throws AACException {
int env, band;
int delta = 0;
int[][] t_huff, f_huff;
if((this.L_E[ch]==1)&&(this.bs_frame_class[ch]==FIXFIX))
this.amp_res[ch] = false;
else
this.amp_res[ch] = this.bs_amp_res;
if((this.bs_coupling)&&(ch==1)) {
delta = 1;
... | [
"private",
"void",
"sbr_envelope",
"(",
"IBitStream",
"ld",
",",
"int",
"ch",
")",
"throws",
"AACException",
"{",
"int",
"env",
",",
"band",
";",
"int",
"delta",
"=",
"0",
";",
"int",
"[",
"]",
"[",
"]",
"t_huff",
",",
"f_huff",
";",
"if",
"(",
"("... | /* table 10 | [
"/",
"*",
"table",
"10"
] | cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75 | https://github.com/jcodec/jcodec/blob/cd6efa51ef05f409a8ba8cfb7521f4b4f10ccc75/src/main/java/net/sourceforge/jaad/aac/sbr/SBR.java#L976-L1041 | test | SBR envelope. | Of course, here is the Java code you requested:
```java
private void sbr_envelope(IBitStream ld, int ch) throws AACException {
int env, band;
int delta = 0;
int[][] t_huff, f_huff;
if((this.L_E[ch]==1)&&(this.bs_frame_class[ch]==FIXFIX))
this.amp_res[ch] = false;
else
this.amp_res[ch] = this.bs_amp_re... |
RestComm/jain-slee | container/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java | ServiceManagementImpl.activate | public void activate(ServiceID[] serviceIDs) throws NullPointerException,
InvalidArgumentException, UnrecognizedServiceException,
InvalidStateException, ManagementException {
if (serviceIDs.length == 0) {
throw new InvalidArgumentException("InvalidArgumentException");
}
for (int i = 0; i < serviceIDs.le... | java | public void activate(ServiceID[] serviceIDs) throws NullPointerException,
InvalidArgumentException, UnrecognizedServiceException,
InvalidStateException, ManagementException {
if (serviceIDs.length == 0) {
throw new InvalidArgumentException("InvalidArgumentException");
}
for (int i = 0; i < serviceIDs.le... | [
"public",
"void",
"activate",
"(",
"ServiceID",
"[",
"]",
"serviceIDs",
")",
"throws",
"NullPointerException",
",",
"InvalidArgumentException",
",",
"UnrecognizedServiceException",
",",
"InvalidStateException",
",",
"ManagementException",
"{",
"if",
"(",
"serviceIDs",
"... | /*
(non-Javadoc)
@see
javax.slee.management.ServiceManagementMBean#activate(javax.slee.ServiceID
[]) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 0eaa16ff2d4b6faf43f0d99260e88878fd54dee0 | https://github.com/RestComm/jain-slee/blob/0eaa16ff2d4b6faf43f0d99260e88878fd54dee0/container/services/src/main/java/org/mobicents/slee/container/management/ServiceManagementImpl.java#L327-L349 | test | Activates the service. | Of course, here is the Java code you requested:
```java
public void activate(ServiceID[] serviceIDs) throws NullPointerException,
InvalidArgumentException, UnrecognizedServiceException,
InvalidStateException, ManagementException {
if (serviceIDs.length == 0) {
throw new InvalidArgumentException("InvalidArgu... |
agentsoz/jill | jill/src/main/java/io/github/agentsoz/jill/struct/GoalPlanType.java | GoalPlanType.getParents | public byte[] getParents() {
if (parents == null) {
return null;
}
byte[] arr = new byte[parents.length];
System.arraycopy(parents, 0, arr, 0, arr.length);
return arr;
} | java | public byte[] getParents() {
if (parents == null) {
return null;
}
byte[] arr = new byte[parents.length];
System.arraycopy(parents, 0, arr, 0, arr.length);
return arr;
} | [
"public",
"byte",
"[",
"]",
"getParents",
"(",
")",
"{",
"if",
"(",
"parents",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
"[",
"parents",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"... | Gets the parents of this object in the Goal-Plan tree.
@return array of parent IDs, or null if this object has no parents | [
"Gets",
"the",
"parents",
"of",
"this",
"object",
"in",
"the",
"Goal",
"-",
"Plan",
"tree",
"."
] | 13126fc78350465b477386132465f84cad719426 | https://github.com/agentsoz/jill/blob/13126fc78350465b477386132465f84cad719426/jill/src/main/java/io/github/agentsoz/jill/struct/GoalPlanType.java#L50-L57 | test | Get the parents of this node. | Of course, here is the Java code you requested:
```java
public byte[] getParents() {
if (parents == null) {
return null;
}
byte[] arr = new byte[parents.length];
System.arraycopy(parents, 0, arr, 0, arr.length);
return arr;
}
```
Hope this helps! |
oaqa/baseqa | src/main/java/edu/cmu/lti/oaqa/type/retrieval/Passage.java | Passage.getBeginSection | public String getBeginSection() {
if (Passage_Type.featOkTst && ((Passage_Type)jcasType).casFeat_beginSection == null)
jcasType.jcas.throwFeatMissing("beginSection", "edu.cmu.lti.oaqa.type.retrieval.Passage");
return jcasType.ll_cas.ll_getStringValue(addr, ((Passage_Type)jcasType).casFeatCode_beginSection... | java | public String getBeginSection() {
if (Passage_Type.featOkTst && ((Passage_Type)jcasType).casFeat_beginSection == null)
jcasType.jcas.throwFeatMissing("beginSection", "edu.cmu.lti.oaqa.type.retrieval.Passage");
return jcasType.ll_cas.ll_getStringValue(addr, ((Passage_Type)jcasType).casFeatCode_beginSection... | [
"public",
"String",
"getBeginSection",
"(",
")",
"{",
"if",
"(",
"Passage_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Passage_Type",
")",
"jcasType",
")",
".",
"casFeat_beginSection",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\... | getter for beginSection - gets The start section of this passage within the document that contains this passage.
@generated
@return value of the feature | [
"getter",
"for",
"beginSection",
"-",
"gets",
"The",
"start",
"section",
"of",
"this",
"passage",
"within",
"the",
"document",
"that",
"contains",
"this",
"passage",
"."
] | 6ea632d8e51e3e617d4876fc1185c49be0ad7eb8 | https://github.com/oaqa/baseqa/blob/6ea632d8e51e3e617d4876fc1185c49be0ad7eb8/src/main/java/edu/cmu/lti/oaqa/type/retrieval/Passage.java#L161-L164 | test | getter for beginSection - gets | Of course, here is the Java code you requested:
```java
public String getBeginSection() {
if (Passage_Type.featOkTst && ((Passage_Type)jcasType).casFeat_beginSection == null)
jcasType.jcas.throwFeatMissing("beginSection", "edu.cmu.lti.oaqa.type.retrieval.Passage");
return jcasType.ll_cas.ll_getStringValu... |
cglib/cglib | cglib/src/main/java/net/sf/cglib/proxy/Enhancer.java | Enhancer.setSuperclass | public void setSuperclass(Class superclass) {
if (superclass != null && superclass.isInterface()) {
setInterfaces(new Class[]{ superclass });
} else if (superclass != null && superclass.equals(Object.class)) {
// affects choice of ClassLoader
this.superclass = null;
... | java | public void setSuperclass(Class superclass) {
if (superclass != null && superclass.isInterface()) {
setInterfaces(new Class[]{ superclass });
} else if (superclass != null && superclass.equals(Object.class)) {
// affects choice of ClassLoader
this.superclass = null;
... | [
"public",
"void",
"setSuperclass",
"(",
"Class",
"superclass",
")",
"{",
"if",
"(",
"superclass",
"!=",
"null",
"&&",
"superclass",
".",
"isInterface",
"(",
")",
")",
"{",
"setInterfaces",
"(",
"new",
"Class",
"[",
"]",
"{",
"superclass",
"}",
")",
";",
... | Set the class which the generated class will extend. As a convenience,
if the supplied superclass is actually an interface, <code>setInterfaces</code>
will be called with the appropriate argument instead.
A non-interface argument must not be declared as final, and must have an
accessible constructor.
@param superclass ... | [
"Set",
"the",
"class",
"which",
"the",
"generated",
"class",
"will",
"extend",
".",
"As",
"a",
"convenience",
"if",
"the",
"supplied",
"superclass",
"is",
"actually",
"an",
"interface",
"<code",
">",
"setInterfaces<",
"/",
"code",
">",
"will",
"be",
"called"... | cd01695c11fd3c66641b295b9596f74cf13c548b | https://github.com/cglib/cglib/blob/cd01695c11fd3c66641b295b9596f74cf13c548b/cglib/src/main/java/net/sf/cglib/proxy/Enhancer.java#L185-L194 | test | Sets the superclass of this class. | Of course, here is the Java code you requested:
```java
public void setSuperclass(Class superclass) {
if (superclass != null && superclass.isInterface()) {
setInterfaces(new Class[]{ superclass });
} else if (superclass != null && superclass.equals(Object.class)) {
// affects ch... |
alipay/sofa-bolt | src/main/java/com/alipay/remoting/rpc/RpcCommandFactory.java | RpcCommandFactory.createServerException | private RpcServerException createServerException(Throwable t, String errMsg) {
String formattedErrMsg = String.format(
"[Server]OriginErrorMsg: %s: %s. AdditionalErrorMsg: %s", t.getClass().getName(),
t.getMessage(), errMsg);
RpcServerException e = new RpcServerException(formatte... | java | private RpcServerException createServerException(Throwable t, String errMsg) {
String formattedErrMsg = String.format(
"[Server]OriginErrorMsg: %s: %s. AdditionalErrorMsg: %s", t.getClass().getName(),
t.getMessage(), errMsg);
RpcServerException e = new RpcServerException(formatte... | [
"private",
"RpcServerException",
"createServerException",
"(",
"Throwable",
"t",
",",
"String",
"errMsg",
")",
"{",
"String",
"formattedErrMsg",
"=",
"String",
".",
"format",
"(",
"\"[Server]OriginErrorMsg: %s: %s. AdditionalErrorMsg: %s\"",
",",
"t",
".",
"getClass",
"... | create server exception using error msg and fill the stack trace using the stack trace of throwable.
@param t the origin throwable to fill the stack trace of rpc server exception
@param errMsg additional error msg, <code>null</code> is allowed
@return an instance of RpcServerException | [
"create",
"server",
"exception",
"using",
"error",
"msg",
"and",
"fill",
"the",
"stack",
"trace",
"using",
"the",
"stack",
"trace",
"of",
"throwable",
"."
] | 0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046 | https://github.com/alipay/sofa-bolt/blob/0ad7b46b2649bfc4e2ecc1f5e1c1f935d179c046/src/main/java/com/alipay/remoting/rpc/RpcCommandFactory.java#L134-L141 | test | Create a server exception. | Of course, here is the Java code you requested:
```java
private RpcServerException createServerException(Throwable t, String errMsg) {
String formattedErrMsg = String.format(
"[Server]OriginErrorMsg: %s: %s. AdditionalErrorMsg: %s", t.getClass().getName(),
t.getMessage(), errMsg);
... |
apache/parquet-mr | parquet-tools/src/main/java/org/apache/parquet/tools/command/MergeCommand.java | MergeCommand.getInputFilesFromDirectory | private List<Path> getInputFilesFromDirectory(FileStatus partitionDir) throws IOException {
FileSystem fs = partitionDir.getPath().getFileSystem(conf);
FileStatus[] inputFiles = fs.listStatus(partitionDir.getPath(), HiddenFileFilter.INSTANCE);
List<Path> input = new ArrayList<Path>();
for (FileStatus f... | java | private List<Path> getInputFilesFromDirectory(FileStatus partitionDir) throws IOException {
FileSystem fs = partitionDir.getPath().getFileSystem(conf);
FileStatus[] inputFiles = fs.listStatus(partitionDir.getPath(), HiddenFileFilter.INSTANCE);
List<Path> input = new ArrayList<Path>();
for (FileStatus f... | [
"private",
"List",
"<",
"Path",
">",
"getInputFilesFromDirectory",
"(",
"FileStatus",
"partitionDir",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fs",
"=",
"partitionDir",
".",
"getPath",
"(",
")",
".",
"getFileSystem",
"(",
"conf",
")",
";",
"FileStatus",... | Get all parquet files under partition directory.
@param partitionDir partition directory.
@return parquet files to be merged. | [
"Get",
"all",
"parquet",
"files",
"under",
"partition",
"directory",
"."
] | 62dcc68acaf64012bf731e103be780956f1f446d | https://github.com/apache/parquet-mr/blob/62dcc68acaf64012bf731e103be780956f1f446d/parquet-tools/src/main/java/org/apache/parquet/tools/command/MergeCommand.java#L162-L171 | test | Get input files from directory | Of course, here is the Java code you requested:
```java
private List<Path> getInputFilesFromDirectory(FileStatus partitionDir) throws IOException {
FileSystem fs = partitionDir.getPath().getFileSystem(conf);
FileStatus[] inputFiles = fs.listStatus(partitionDir.getPath(), HiddenFileFilter.INSTANCE);
List<P... |
OpenEstate/OpenEstate-IO | DaftIE/src/main/jaxb/org/openestate/io/daft_ie/xml/PdfsType.java | PdfsType.getPdf | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
public List<URI> getPdf() {
if (pdf == null) {
pdf = new ArrayList<URI>();
}
return this.pdf;
} | java | @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
public List<URI> getPdf() {
if (pdf == null) {
pdf = new ArrayList<URI>();
}
return this.pdf;
} | [
"@",
"Generated",
"(",
"value",
"=",
"\"com.sun.tools.xjc.Driver\"",
",",
"date",
"=",
"\"2018-10-12T02:41:42+02:00\"",
",",
"comments",
"=",
"\"JAXB RI v2.2.11\"",
")",
"public",
"List",
"<",
"URI",
">",
"getPdf",
"(",
")",
"{",
"if",
"(",
"pdf",
"==",
"null"... | Gets the value of the pdf property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the pdf property.
<p>
For example, to add a new ite... | [
"Gets",
"the",
"value",
"of",
"the",
"pdf",
"property",
"."
] | f961dae78f40823f05a8c0d4e59d639e718aa18a | https://github.com/OpenEstate/OpenEstate-IO/blob/f961dae78f40823f05a8c0d4e59d639e718aa18a/DaftIE/src/main/jaxb/org/openestate/io/daft_ie/xml/PdfsType.java#L83-L89 | test | Gets the value of the pdf property. | Of course, here is the Java code you requested:
```java
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
public List<URI> getPdf() {
if (pdf == null) {
pdf = new ArrayList<URI>();
}
return this.pdf;
}
```
Hope ... |
Unidata/thredds | dap4/d4core/src/main/java/dap4/core/util/Slice.java | Slice.compose | static public Slice
compose(Slice target, Slice src)
throws DapException
{
long sr_stride = target.getStride() * src.getStride();
long sr_first = MAP(target, src.getFirst());
long lastx = MAP(target, src.getLast());
long sr_last = (target.getLast() < lastx ? target.ge... | java | static public Slice
compose(Slice target, Slice src)
throws DapException
{
long sr_stride = target.getStride() * src.getStride();
long sr_first = MAP(target, src.getFirst());
long lastx = MAP(target, src.getLast());
long sr_last = (target.getLast() < lastx ? target.ge... | [
"static",
"public",
"Slice",
"compose",
"(",
"Slice",
"target",
",",
"Slice",
"src",
")",
"throws",
"DapException",
"{",
"long",
"sr_stride",
"=",
"target",
".",
"getStride",
"(",
")",
"*",
"src",
".",
"getStride",
"(",
")",
";",
"long",
"sr_first",
"=",... | Take two slices and compose src wrt target
Assume neither argument is null. This code
should match ucar.ma2.Section in thredds
and dceconstraint.c in the netcdf-c library.
@param target
@param src
@return new, composed Range
@throws DapException | [
"Take",
"two",
"slices",
"and",
"compose",
"src",
"wrt",
"target",
"Assume",
"neither",
"argument",
"is",
"null",
".",
"This",
"code",
"should",
"match",
"ucar",
".",
"ma2",
".",
"Section",
"in",
"thredds",
"and",
"dceconstraint",
".",
"c",
"in",
"the",
... | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/dap4/d4core/src/main/java/dap4/core/util/Slice.java#L370-L379 | test | Compose two NSA Slices. | Of course, here is the Java code you requested:
```java
static public Slice
compose(Slice target, Slice src)
throws DapException
{
long sr_stride = target.getStride() * src.getStride();
long sr_first = MAP(target, src.getFirst());
long lastx = MAP(target, src.getLast());
... |
blademainer/common_utils | common_helper/src/main/java/com/xiongyingqi/jackson/helper/ThreadJacksonMixInHolder.java | ThreadJacksonMixInHolder.builderMapper | public static ObjectMapper builderMapper() {
ThreadJacksonMixInHolder holder = holderThreadLocal.get();
if (holder.mapper == null && isContainsMixIn()) {
holder.mapper = new ObjectMapper();
for (Map.Entry<Class<?>, Class<?>> mixIn : holder.mixIns) {
holder.mapper.... | java | public static ObjectMapper builderMapper() {
ThreadJacksonMixInHolder holder = holderThreadLocal.get();
if (holder.mapper == null && isContainsMixIn()) {
holder.mapper = new ObjectMapper();
for (Map.Entry<Class<?>, Class<?>> mixIn : holder.mixIns) {
holder.mapper.... | [
"public",
"static",
"ObjectMapper",
"builderMapper",
"(",
")",
"{",
"ThreadJacksonMixInHolder",
"holder",
"=",
"holderThreadLocal",
".",
"get",
"(",
")",
";",
"if",
"(",
"holder",
".",
"mapper",
"==",
"null",
"&&",
"isContainsMixIn",
"(",
")",
")",
"{",
"hol... | 根据当前MixIn集合生成objectMapper<p>
<p>
<b>注意:该方法在返回mapper对象之后调用clear方法,如果再次调用builderMapper()肯定会保存</b>
@return | [
"根据当前MixIn集合生成objectMapper<p",
">",
"<p",
">",
"<b",
">",
"注意:该方法在返回mapper对象之后调用clear方法,如果再次调用builderMapper",
"()",
"肯定会保存<",
"/",
"b",
">"
] | ef6baf0367c16de95a28caab67a7d5842a6d13db | https://github.com/blademainer/common_utils/blob/ef6baf0367c16de95a28caab67a7d5842a6d13db/common_helper/src/main/java/com/xiongyingqi/jackson/helper/ThreadJacksonMixInHolder.java#L26-L36 | test | Get the ObjectMapper builder | Of course, here is the Java code you requested:
```java
public static ObjectMapper builderMapper() {
ThreadJacksonMixInHolder holder = holderThreadLocal.get();
if (holder.mapper == null && isContainsMixIn()) {
holder.mapper = new ObjectMapper();
for (Map.Entry<Class<?>, Class<?>... |
oblac/jodd | jodd-mail/src/main/java/jodd/mail/CommonEmail.java | CommonEmail.storeAttachments | protected T storeAttachments(final List<EmailAttachment<? extends DataSource>> attachments) {
this.attachments.addAll(attachments);
return _this();
} | java | protected T storeAttachments(final List<EmailAttachment<? extends DataSource>> attachments) {
this.attachments.addAll(attachments);
return _this();
} | [
"protected",
"T",
"storeAttachments",
"(",
"final",
"List",
"<",
"EmailAttachment",
"<",
"?",
"extends",
"DataSource",
">",
">",
"attachments",
")",
"{",
"this",
".",
"attachments",
".",
"addAll",
"(",
"attachments",
")",
";",
"return",
"_this",
"(",
")",
... | Adds {@link EmailAttachment}s.
@param attachments {@link List} of {@link EmailAttachment}s to add.
@return this | [
"Adds",
"{",
"@link",
"EmailAttachment",
"}",
"s",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-mail/src/main/java/jodd/mail/CommonEmail.java#L696-L699 | test | Store attachments. | Of course, here is the Java code you requested:
```java
protected T storeAttachments(final List<EmailAttachment<? extends DataSource>> attachments) {
this.attachments.addAll(attachments);
return _this();
}
```
Hope this helps! |
oblac/jodd | jodd-json/src/main/java/jodd/json/JsonObject.java | JsonObject.getLong | public Long getLong(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Long) {
return (Long) number;
}
return number.longValue();
} | java | public Long getLong(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Long) {
return (Long) number;
}
return number.longValue();
} | [
"public",
"Long",
"getLong",
"(",
"final",
"String",
"key",
")",
"{",
"Number",
"number",
"=",
"(",
"Number",
")",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"numbe... | Returns the long value with the specified key. | [
"Returns",
"the",
"long",
"value",
"with",
"the",
"specified",
"key",
"."
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-json/src/main/java/jodd/json/JsonObject.java#L89-L99 | test | Gets the Long value associated with the specified key. | Of course, here is the Java code you requested:
```java
public Long getLong(final String key) {
Number number = (Number) map.get(key);
if (number == null) {
return null;
}
if (number instanceof Long) {
return (Long) number;
}
return number.longValue();
}
```
Hope this helps! |
lessthanoptimal/GeoRegression | main/src/georegression/metric/UtilAngle.java | UtilAngle.boundHalf | public static double boundHalf( double angle ) {
angle = bound(angle);
if( angle > GrlConstants.PId2 ) {
angle -= Math.PI;
} else if( angle < -GrlConstants.PId2 ){
angle += Math.PI;
}
return angle;
} | java | public static double boundHalf( double angle ) {
angle = bound(angle);
if( angle > GrlConstants.PId2 ) {
angle -= Math.PI;
} else if( angle < -GrlConstants.PId2 ){
angle += Math.PI;
}
return angle;
} | [
"public",
"static",
"double",
"boundHalf",
"(",
"double",
"angle",
")",
"{",
"angle",
"=",
"bound",
"(",
"angle",
")",
";",
"if",
"(",
"angle",
">",
"GrlConstants",
".",
"PId2",
")",
"{",
"angle",
"-=",
"Math",
".",
"PI",
";",
"}",
"else",
"if",
"(... | Bounds the angle between -π/2 and π/2
@param angle angle in radians
@return bounded angle | [
"Bounds",
"the",
"angle",
"between",
"-",
"&pi",
";",
"/",
"2",
"and",
"&pi",
";",
"/",
"2"
] | c067cd44a4e95bd826119f6e658bd82386ef289f | https://github.com/lessthanoptimal/GeoRegression/blob/c067cd44a4e95bd826119f6e658bd82386ef289f/main/src/georegression/metric/UtilAngle.java#L184-L193 | test | Returns the half of the angle. | Of course, here is the Java code you requested:
```java
public static double boundHalf( double angle ) {
angle = bound(angle);
if( angle > GrlConstants.PId2 ) {
angle -= Math.PI;
} else if( angle < -GrlConstants.PId2 ){
angle += Math.PI;
}
return angle;
}
```
Hope this helps! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.