repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
samskivert/samskivert | src/main/java/com/samskivert/util/ArrayUtil.java | ArrayUtil.indexOf | public static int indexOf (int[] values, int value)
{
int count = (values == null) ? 0 : values.length;
for (int ii = 0; ii < count; ii++) {
if (values[ii] == value) {
return ii;
}
}
return -1;
} | java | public static int indexOf (int[] values, int value)
{
int count = (values == null) ? 0 : values.length;
for (int ii = 0; ii < count; ii++) {
if (values[ii] == value) {
return ii;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"int",
"[",
"]",
"values",
",",
"int",
"value",
")",
"{",
"int",
"count",
"=",
"(",
"values",
"==",
"null",
")",
"?",
"0",
":",
"values",
".",
"length",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii... | Looks for an element that is equal to the supplied value and returns its index in the array.
@return the index of the first matching value if one was found, 1 otherwise. | [
"Looks",
"for",
"an",
"element",
"that",
"is",
"equal",
"to",
"the",
"supplied",
"value",
"and",
"returns",
"its",
"index",
"in",
"the",
"array",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ArrayUtil.java#L65-L74 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java | CollapsedRequestSubject.setExceptionIfResponseNotReceived | public Exception setExceptionIfResponseNotReceived(Exception e, String exceptionMessage) {
Exception exception = e;
if (!valueSet.get() && !isTerminated()) {
if (e == null) {
exception = new IllegalStateException(exceptionMessage);
}
setExceptionIfResponseNotReceived(exception);
}
// return any exception that was generated
return exception;
} | java | public Exception setExceptionIfResponseNotReceived(Exception e, String exceptionMessage) {
Exception exception = e;
if (!valueSet.get() && !isTerminated()) {
if (e == null) {
exception = new IllegalStateException(exceptionMessage);
}
setExceptionIfResponseNotReceived(exception);
}
// return any exception that was generated
return exception;
} | [
"public",
"Exception",
"setExceptionIfResponseNotReceived",
"(",
"Exception",
"e",
",",
"String",
"exceptionMessage",
")",
"{",
"Exception",
"exception",
"=",
"e",
";",
"if",
"(",
"!",
"valueSet",
".",
"get",
"(",
")",
"&&",
"!",
"isTerminated",
"(",
")",
")... | Set an ISE if a response is not yet received otherwise skip it
@param e A pre-generated exception. If this is null an ISE will be created and returned
@param exceptionMessage The message for the ISE | [
"Set",
"an",
"ISE",
"if",
"a",
"response",
"is",
"not",
"yet",
"received",
"otherwise",
"skip",
"it"
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java#L149-L160 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFacetRestrictionImpl_CustomFieldSerializer.java | OWLFacetRestrictionImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLFacetRestrictionImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLFacetRestrictionImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLFacetRestrictionImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFacetRestrictionImpl_CustomFieldSerializer.java#L72-L75 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java | ReflectionUtils.getFieldValue | public static Object getFieldValue(final Object object, final Field field) throws IllegalAccessException {
boolean access = field.isAccessible();
field.setAccessible(true);
Object value = field.get(object);
field.setAccessible(access);
return value;
} | java | public static Object getFieldValue(final Object object, final Field field) throws IllegalAccessException {
boolean access = field.isAccessible();
field.setAccessible(true);
Object value = field.get(object);
field.setAccessible(access);
return value;
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"final",
"Object",
"object",
",",
"final",
"Field",
"field",
")",
"throws",
"IllegalAccessException",
"{",
"boolean",
"access",
"=",
"field",
".",
"isAccessible",
"(",
")",
";",
"field",
".",
"setAccessible",
... | Get the value (accessible or not accessible) of a field of a target object.
@param object instance to get the field of
@param field field to get the value of
@return the value of the field
@throws IllegalAccessException if field can not be accessed | [
"Get",
"the",
"value",
"(",
"accessible",
"or",
"not",
"accessible",
")",
"of",
"a",
"field",
"of",
"a",
"target",
"object",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L145-L151 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java | TypeAnnotationPosition.typeParameter | public static TypeAnnotationPosition
typeParameter(final List<TypePathEntry> location,
final int parameter_index) {
return typeParameter(location, null, parameter_index, -1);
} | java | public static TypeAnnotationPosition
typeParameter(final List<TypePathEntry> location,
final int parameter_index) {
return typeParameter(location, null, parameter_index, -1);
} | [
"public",
"static",
"TypeAnnotationPosition",
"typeParameter",
"(",
"final",
"List",
"<",
"TypePathEntry",
">",
"location",
",",
"final",
"int",
"parameter_index",
")",
"{",
"return",
"typeParameter",
"(",
"location",
",",
"null",
",",
"parameter_index",
",",
"-",... | Create a {@code TypeAnnotationPosition} for a type parameter.
@param location The type path.
@param parameter_index The index of the type parameter. | [
"Create",
"a",
"{",
"@code",
"TypeAnnotationPosition",
"}",
"for",
"a",
"type",
"parameter",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L975-L979 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpHeaders.java | HttpHeaders.fromHttpHeaders | public final void fromHttpHeaders(HttpHeaders headers) {
try {
ParseHeaderState state = new ParseHeaderState(this, null);
serializeHeaders(
headers, null, null, null, new HeaderParsingFakeLevelHttpRequest(this, state));
state.finish();
} catch (IOException ex) {
// Should never occur as we are dealing with a FakeLowLevelHttpRequest
throw Throwables.propagate(ex);
}
} | java | public final void fromHttpHeaders(HttpHeaders headers) {
try {
ParseHeaderState state = new ParseHeaderState(this, null);
serializeHeaders(
headers, null, null, null, new HeaderParsingFakeLevelHttpRequest(this, state));
state.finish();
} catch (IOException ex) {
// Should never occur as we are dealing with a FakeLowLevelHttpRequest
throw Throwables.propagate(ex);
}
} | [
"public",
"final",
"void",
"fromHttpHeaders",
"(",
"HttpHeaders",
"headers",
")",
"{",
"try",
"{",
"ParseHeaderState",
"state",
"=",
"new",
"ParseHeaderState",
"(",
"this",
",",
"null",
")",
";",
"serializeHeaders",
"(",
"headers",
",",
"null",
",",
"null",
... | Puts all headers of the {@link HttpHeaders} object into this {@link HttpHeaders} object.
@param headers {@link HttpHeaders} from where the headers are taken
@since 1.10 | [
"Puts",
"all",
"headers",
"of",
"the",
"{",
"@link",
"HttpHeaders",
"}",
"object",
"into",
"this",
"{",
"@link",
"HttpHeaders",
"}",
"object",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpHeaders.java#L1055-L1065 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.skipTypeVars | public Type skipTypeVars(Type site, boolean capture) {
while (site.hasTag(TYPEVAR)) {
site = site.getUpperBound();
}
return capture ? capture(site) : site;
} | java | public Type skipTypeVars(Type site, boolean capture) {
while (site.hasTag(TYPEVAR)) {
site = site.getUpperBound();
}
return capture ? capture(site) : site;
} | [
"public",
"Type",
"skipTypeVars",
"(",
"Type",
"site",
",",
"boolean",
"capture",
")",
"{",
"while",
"(",
"site",
".",
"hasTag",
"(",
"TYPEVAR",
")",
")",
"{",
"site",
"=",
"site",
".",
"getUpperBound",
"(",
")",
";",
"}",
"return",
"capture",
"?",
"... | Recursively skip type-variables until a class/array type is found; capture conversion is then
(optionally) applied to the resulting type. This is useful for i.e. computing a site that is
suitable for a method lookup. | [
"Recursively",
"skip",
"type",
"-",
"variables",
"until",
"a",
"class",
"/",
"array",
"type",
"is",
"found",
";",
"capture",
"conversion",
"is",
"then",
"(",
"optionally",
")",
"applied",
"to",
"the",
"resulting",
"type",
".",
"This",
"is",
"useful",
"for"... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L184-L189 |
wcm-io-caravan/caravan-hal | resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java | HalResource.setEmbedded | public HalResource setEmbedded(String relation, HalResource resource) {
if (resource == null) {
return this;
}
return addResources(HalResourceType.EMBEDDED, relation, false, new HalResource[] {
resource
});
} | java | public HalResource setEmbedded(String relation, HalResource resource) {
if (resource == null) {
return this;
}
return addResources(HalResourceType.EMBEDDED, relation, false, new HalResource[] {
resource
});
} | [
"public",
"HalResource",
"setEmbedded",
"(",
"String",
"relation",
",",
"HalResource",
"resource",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"return",
"addResources",
"(",
"HalResourceType",
".",
"EMBEDDED",
",",
"r... | Embed resource for the given relation. Overwrites existing one.
@param relation Embedded resource relation
@param resource Resource to embed
@return HAL resource | [
"Embed",
"resource",
"for",
"the",
"given",
"relation",
".",
"Overwrites",
"existing",
"one",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L337-L344 |
cerner/beadledom | client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java | BeadledomResteasyClientBuilder.keyStore | @Override
public ClientBuilder keyStore(final KeyStore keyStore, final String password) {
this.clientKeyStore = keyStore;
this.clientPrivateKeyPassword = password;
return this;
} | java | @Override
public ClientBuilder keyStore(final KeyStore keyStore, final String password) {
this.clientKeyStore = keyStore;
this.clientPrivateKeyPassword = password;
return this;
} | [
"@",
"Override",
"public",
"ClientBuilder",
"keyStore",
"(",
"final",
"KeyStore",
"keyStore",
",",
"final",
"String",
"password",
")",
"{",
"this",
".",
"clientKeyStore",
"=",
"keyStore",
";",
"this",
".",
"clientPrivateKeyPassword",
"=",
"password",
";",
"retur... | Sets the default SSL key store to be used if a {@link ClientHttpEngine} isn't
specified via {@link #setHttpEngine(ClientHttpEngine)}.
<p>If a {@link ClientHttpEngine} is specified via {@link #setHttpEngine(ClientHttpEngine)},
then this property will be ignored.
<p>{@inheritDoc}
@return this builder | [
"Sets",
"the",
"default",
"SSL",
"key",
"store",
"to",
"be",
"used",
"if",
"a",
"{",
"@link",
"ClientHttpEngine",
"}",
"isn",
"t",
"specified",
"via",
"{",
"@link",
"#setHttpEngine",
"(",
"ClientHttpEngine",
")",
"}",
"."
] | train | https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java#L428-L433 |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/Storage.java | Storage.bootstrap | private static void bootstrap(final Storage pStorage, final ResourceConfiguration pResourceConf)
throws TTException {
final IBackend storage = pResourceConf.mBackend;
storage.initialize();
final IBackendWriter writer = storage.getWriter();
final UberBucket uberBucket = new UberBucket(1, 0, 1);
long newBucketKey = uberBucket.incrementBucketCounter();
uberBucket.setReferenceKey(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, newBucketKey);
uberBucket.setReferenceHash(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, IConstants.BOOTSTRAP_HASHED);
writer.write(uberBucket);
// --- Create revision tree
// ------------------------------------------------
// Initialize revision tree to guarantee that there is a revision root
// bucket.
IReferenceBucket bucket;
for (int i = 0; i < IConstants.INDIRECT_BUCKET_COUNT.length; i++) {
bucket = new IndirectBucket(newBucketKey);
newBucketKey = uberBucket.incrementBucketCounter();
bucket.setReferenceKey(0, newBucketKey);
bucket.setReferenceHash(0, IConstants.BOOTSTRAP_HASHED);
writer.write(bucket);
}
RevisionRootBucket revBucket = new RevisionRootBucket(newBucketKey, 0, 0);
newBucketKey = uberBucket.incrementBucketCounter();
// establishing fresh MetaBucket
MetaBucket metaBucker = new MetaBucket(newBucketKey);
revBucket.setReferenceKey(RevisionRootBucket.META_REFERENCE_OFFSET, newBucketKey);
revBucket.setReferenceHash(RevisionRootBucket.META_REFERENCE_OFFSET, IConstants.BOOTSTRAP_HASHED);
newBucketKey = uberBucket.incrementBucketCounter();
bucket = new IndirectBucket(newBucketKey);
revBucket.setReferenceKey(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, newBucketKey);
revBucket.setReferenceHash(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, IConstants.BOOTSTRAP_HASHED);
writer.write(revBucket);
writer.write(metaBucker);
// --- Create data tree
// ----------------------------------------------------
// Initialize revision tree to guarantee that there is a revision root
// bucket.
for (int i = 0; i < IConstants.INDIRECT_BUCKET_COUNT.length; i++) {
newBucketKey = uberBucket.incrementBucketCounter();
bucket.setReferenceKey(0, newBucketKey);
bucket.setReferenceHash(0, IConstants.BOOTSTRAP_HASHED);
writer.write(bucket);
bucket = new IndirectBucket(newBucketKey);
}
final DataBucket ndp = new DataBucket(newBucketKey, IConstants.NULLDATA);
writer.write(ndp);
writer.writeUberBucket(uberBucket);
writer.close();
storage.close();
} | java | private static void bootstrap(final Storage pStorage, final ResourceConfiguration pResourceConf)
throws TTException {
final IBackend storage = pResourceConf.mBackend;
storage.initialize();
final IBackendWriter writer = storage.getWriter();
final UberBucket uberBucket = new UberBucket(1, 0, 1);
long newBucketKey = uberBucket.incrementBucketCounter();
uberBucket.setReferenceKey(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, newBucketKey);
uberBucket.setReferenceHash(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, IConstants.BOOTSTRAP_HASHED);
writer.write(uberBucket);
// --- Create revision tree
// ------------------------------------------------
// Initialize revision tree to guarantee that there is a revision root
// bucket.
IReferenceBucket bucket;
for (int i = 0; i < IConstants.INDIRECT_BUCKET_COUNT.length; i++) {
bucket = new IndirectBucket(newBucketKey);
newBucketKey = uberBucket.incrementBucketCounter();
bucket.setReferenceKey(0, newBucketKey);
bucket.setReferenceHash(0, IConstants.BOOTSTRAP_HASHED);
writer.write(bucket);
}
RevisionRootBucket revBucket = new RevisionRootBucket(newBucketKey, 0, 0);
newBucketKey = uberBucket.incrementBucketCounter();
// establishing fresh MetaBucket
MetaBucket metaBucker = new MetaBucket(newBucketKey);
revBucket.setReferenceKey(RevisionRootBucket.META_REFERENCE_OFFSET, newBucketKey);
revBucket.setReferenceHash(RevisionRootBucket.META_REFERENCE_OFFSET, IConstants.BOOTSTRAP_HASHED);
newBucketKey = uberBucket.incrementBucketCounter();
bucket = new IndirectBucket(newBucketKey);
revBucket.setReferenceKey(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, newBucketKey);
revBucket.setReferenceHash(IReferenceBucket.GUARANTEED_INDIRECT_OFFSET, IConstants.BOOTSTRAP_HASHED);
writer.write(revBucket);
writer.write(metaBucker);
// --- Create data tree
// ----------------------------------------------------
// Initialize revision tree to guarantee that there is a revision root
// bucket.
for (int i = 0; i < IConstants.INDIRECT_BUCKET_COUNT.length; i++) {
newBucketKey = uberBucket.incrementBucketCounter();
bucket.setReferenceKey(0, newBucketKey);
bucket.setReferenceHash(0, IConstants.BOOTSTRAP_HASHED);
writer.write(bucket);
bucket = new IndirectBucket(newBucketKey);
}
final DataBucket ndp = new DataBucket(newBucketKey, IConstants.NULLDATA);
writer.write(ndp);
writer.writeUberBucket(uberBucket);
writer.close();
storage.close();
} | [
"private",
"static",
"void",
"bootstrap",
"(",
"final",
"Storage",
"pStorage",
",",
"final",
"ResourceConfiguration",
"pResourceConf",
")",
"throws",
"TTException",
"{",
"final",
"IBackend",
"storage",
"=",
"pResourceConf",
".",
"mBackend",
";",
"storage",
".",
"i... | Boostraping a resource within this storage.
@param pStorage
storage where the new resource should be created in.
@param pResourceConf
related {@link ResourceConfiguration} for the new resource
@throws TTException | [
"Boostraping",
"a",
"resource",
"within",
"this",
"storage",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/Storage.java#L338-L400 |
pagehelper/Mybatis-PageHelper | src/main/java/com/github/pagehelper/util/ExecutorUtil.java | ExecutorUtil.pageQuery | public static <E> List<E> pageQuery(Dialect dialect, Executor executor, MappedStatement ms, Object parameter,
RowBounds rowBounds, ResultHandler resultHandler,
BoundSql boundSql, CacheKey cacheKey) throws SQLException {
//判断是否需要进行分页查询
if (dialect.beforePage(ms, parameter, rowBounds)) {
//生成分页的缓存 key
CacheKey pageKey = cacheKey;
//处理参数对象
parameter = dialect.processParameterObject(ms, parameter, boundSql, pageKey);
//调用方言获取分页 sql
String pageSql = dialect.getPageSql(ms, boundSql, parameter, rowBounds, pageKey);
BoundSql pageBoundSql = new BoundSql(ms.getConfiguration(), pageSql, boundSql.getParameterMappings(), parameter);
Map<String, Object> additionalParameters = getAdditionalParameter(boundSql);
//设置动态参数
for (String key : additionalParameters.keySet()) {
pageBoundSql.setAdditionalParameter(key, additionalParameters.get(key));
}
//执行分页查询
return executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, pageKey, pageBoundSql);
} else {
//不执行分页的情况下,也不执行内存分页
return executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, cacheKey, boundSql);
}
} | java | public static <E> List<E> pageQuery(Dialect dialect, Executor executor, MappedStatement ms, Object parameter,
RowBounds rowBounds, ResultHandler resultHandler,
BoundSql boundSql, CacheKey cacheKey) throws SQLException {
//判断是否需要进行分页查询
if (dialect.beforePage(ms, parameter, rowBounds)) {
//生成分页的缓存 key
CacheKey pageKey = cacheKey;
//处理参数对象
parameter = dialect.processParameterObject(ms, parameter, boundSql, pageKey);
//调用方言获取分页 sql
String pageSql = dialect.getPageSql(ms, boundSql, parameter, rowBounds, pageKey);
BoundSql pageBoundSql = new BoundSql(ms.getConfiguration(), pageSql, boundSql.getParameterMappings(), parameter);
Map<String, Object> additionalParameters = getAdditionalParameter(boundSql);
//设置动态参数
for (String key : additionalParameters.keySet()) {
pageBoundSql.setAdditionalParameter(key, additionalParameters.get(key));
}
//执行分页查询
return executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, pageKey, pageBoundSql);
} else {
//不执行分页的情况下,也不执行内存分页
return executor.query(ms, parameter, RowBounds.DEFAULT, resultHandler, cacheKey, boundSql);
}
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"pageQuery",
"(",
"Dialect",
"dialect",
",",
"Executor",
"executor",
",",
"MappedStatement",
"ms",
",",
"Object",
"parameter",
",",
"RowBounds",
"rowBounds",
",",
"ResultHandler",
"resultHandler",
",",
... | 分页查询
@param dialect
@param executor
@param ms
@param parameter
@param rowBounds
@param resultHandler
@param boundSql
@param cacheKey
@param <E>
@return
@throws SQLException | [
"分页查询"
] | train | https://github.com/pagehelper/Mybatis-PageHelper/blob/319750fd47cf75328ff321f38125fa15e954e60f/src/main/java/com/github/pagehelper/util/ExecutorUtil.java#L158-L182 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java | TimePicker.openPopup | public void openPopup() {
// If the component is disabled, do nothing.
if (!isEnabled()) {
return;
}
// If the show popup menu button is not shown, do nothing.
if (settings.getDisplayToggleTimeMenuButton() == false) {
return;
}
// If this function was called programmatically, we may need to change the focus to this
// popup.
if (!timeTextField.hasFocus()) {
timeTextField.requestFocusInWindow();
}
// Create a new time menu.
timeMenuPanel = new TimeMenuPanel(this, settings);
// Create a new custom popup.
popup = new CustomPopup(timeMenuPanel, SwingUtilities.getWindowAncestor(this),
this, settings.borderTimePopup);
popup.setMinimumSize(new Dimension(
this.getSize().width + 1, timeMenuPanel.getSize().height));
// Calculate the default origin for the popup.
int defaultX = timeTextField.getLocationOnScreen().x;
int defaultY = timeTextField.getLocationOnScreen().y + timeTextField.getSize().height - 1;
// Set the popup location. (Shared function.)
DatePicker.zSetPopupLocation(popup, defaultX, defaultY, this, timeTextField, -1, 1);
// Show the popup and request focus.
popup.show();
timeMenuPanel.requestListFocus();
} | java | public void openPopup() {
// If the component is disabled, do nothing.
if (!isEnabled()) {
return;
}
// If the show popup menu button is not shown, do nothing.
if (settings.getDisplayToggleTimeMenuButton() == false) {
return;
}
// If this function was called programmatically, we may need to change the focus to this
// popup.
if (!timeTextField.hasFocus()) {
timeTextField.requestFocusInWindow();
}
// Create a new time menu.
timeMenuPanel = new TimeMenuPanel(this, settings);
// Create a new custom popup.
popup = new CustomPopup(timeMenuPanel, SwingUtilities.getWindowAncestor(this),
this, settings.borderTimePopup);
popup.setMinimumSize(new Dimension(
this.getSize().width + 1, timeMenuPanel.getSize().height));
// Calculate the default origin for the popup.
int defaultX = timeTextField.getLocationOnScreen().x;
int defaultY = timeTextField.getLocationOnScreen().y + timeTextField.getSize().height - 1;
// Set the popup location. (Shared function.)
DatePicker.zSetPopupLocation(popup, defaultX, defaultY, this, timeTextField, -1, 1);
// Show the popup and request focus.
popup.show();
timeMenuPanel.requestListFocus();
} | [
"public",
"void",
"openPopup",
"(",
")",
"{",
"// If the component is disabled, do nothing.",
"if",
"(",
"!",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"// If the show popup menu button is not shown, do nothing.",
"if",
"(",
"settings",
".",
"getDisplayToggle... | openPopup, This creates and shows the menu popup.
This function creates a new menu panel and a new custom popup instance each time that it is
called. The associated object instances are automatically disposed and set to null when a
popup is closed. | [
"openPopup",
"This",
"creates",
"and",
"shows",
"the",
"menu",
"popup",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/TimePicker.java#L528-L558 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Widgets.java | Widgets.newScrollPanel | public static ScrollPanel newScrollPanel (Widget contents, int xpad, int ypad)
{
ScrollPanel panel = new ScrollPanel(contents);
if (xpad >= 0) {
String maxWidth = (Window.getClientWidth() - xpad) + "px";
DOM.setStyleAttribute(panel.getElement(), "maxWidth", maxWidth);
}
if (ypad >= 0) {
String maxHeight = (Window.getClientHeight() - ypad) + "px";
DOM.setStyleAttribute(panel.getElement(), "maxHeight", maxHeight);
}
return panel;
} | java | public static ScrollPanel newScrollPanel (Widget contents, int xpad, int ypad)
{
ScrollPanel panel = new ScrollPanel(contents);
if (xpad >= 0) {
String maxWidth = (Window.getClientWidth() - xpad) + "px";
DOM.setStyleAttribute(panel.getElement(), "maxWidth", maxWidth);
}
if (ypad >= 0) {
String maxHeight = (Window.getClientHeight() - ypad) + "px";
DOM.setStyleAttribute(panel.getElement(), "maxHeight", maxHeight);
}
return panel;
} | [
"public",
"static",
"ScrollPanel",
"newScrollPanel",
"(",
"Widget",
"contents",
",",
"int",
"xpad",
",",
"int",
"ypad",
")",
"{",
"ScrollPanel",
"panel",
"=",
"new",
"ScrollPanel",
"(",
"contents",
")",
";",
"if",
"(",
"xpad",
">=",
"0",
")",
"{",
"Strin... | Wraps the supplied contents in a scroll panel that will set the max-width to
Window.getClientWidth()-xpad and the max-height to Window.getClientHeight()-ypad. If either
xpad or ypad are less than zero, the max-size attribute on that axis will not be set. | [
"Wraps",
"the",
"supplied",
"contents",
"in",
"a",
"scroll",
"panel",
"that",
"will",
"set",
"the",
"max",
"-",
"width",
"to",
"Window",
".",
"getClientWidth",
"()",
"-",
"xpad",
"and",
"the",
"max",
"-",
"height",
"to",
"Window",
".",
"getClientHeight",
... | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L102-L114 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java | MicroWriter.writeToFile | @Nonnull
public static ESuccess writeToFile (@Nonnull final IMicroNode aNode,
@Nonnull final Path aPath,
@Nonnull final IXMLWriterSettings aSettings)
{
ValueEnforcer.notNull (aPath, "Path");
return writeToFile (aNode, aPath.toFile (), aSettings);
} | java | @Nonnull
public static ESuccess writeToFile (@Nonnull final IMicroNode aNode,
@Nonnull final Path aPath,
@Nonnull final IXMLWriterSettings aSettings)
{
ValueEnforcer.notNull (aPath, "Path");
return writeToFile (aNode, aPath.toFile (), aSettings);
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"writeToFile",
"(",
"@",
"Nonnull",
"final",
"IMicroNode",
"aNode",
",",
"@",
"Nonnull",
"final",
"Path",
"aPath",
",",
"@",
"Nonnull",
"final",
"IXMLWriterSettings",
"aSettings",
")",
"{",
"ValueEnforcer",
".",
... | Write a Micro Node to a file.
@param aNode
The node to be serialized. May be any kind of node (incl.
documents). May not be <code>null</code>.
@param aPath
The file to write to. May not be <code>null</code>.
@param aSettings
The settings to be used for the creation. May not be
<code>null</code>.
@return {@link ESuccess} | [
"Write",
"a",
"Micro",
"Node",
"to",
"a",
"file",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L134-L141 |
google/auto | value/src/main/java/com/google/auto/value/processor/TypeSimplifier.java | TypeSimplifier.findImports | private static Map<String, Spelling> findImports(
Elements elementUtils,
Types typeUtils,
String codePackageName,
Set<TypeMirror> referenced,
Set<TypeMirror> defined) {
Map<String, Spelling> imports = new HashMap<>();
Set<TypeMirror> typesInScope = new TypeMirrorSet();
typesInScope.addAll(referenced);
typesInScope.addAll(defined);
Set<String> ambiguous = ambiguousNames(typeUtils, typesInScope);
for (TypeMirror type : referenced) {
TypeElement typeElement = (TypeElement) typeUtils.asElement(type);
String fullName = typeElement.getQualifiedName().toString();
String simpleName = typeElement.getSimpleName().toString();
String pkg = packageNameOf(typeElement);
boolean importIt;
String spelling;
if (ambiguous.contains(simpleName)) {
importIt = false;
spelling = fullName;
} else if (pkg.equals("java.lang")) {
importIt = false;
spelling = javaLangSpelling(elementUtils, codePackageName, typeElement);
} else if (pkg.equals(codePackageName)) {
importIt = false;
spelling = fullName.substring(pkg.isEmpty() ? 0 : pkg.length() + 1);
} else {
importIt = true;
spelling = simpleName;
}
imports.put(fullName, new Spelling(spelling, importIt));
}
return imports;
} | java | private static Map<String, Spelling> findImports(
Elements elementUtils,
Types typeUtils,
String codePackageName,
Set<TypeMirror> referenced,
Set<TypeMirror> defined) {
Map<String, Spelling> imports = new HashMap<>();
Set<TypeMirror> typesInScope = new TypeMirrorSet();
typesInScope.addAll(referenced);
typesInScope.addAll(defined);
Set<String> ambiguous = ambiguousNames(typeUtils, typesInScope);
for (TypeMirror type : referenced) {
TypeElement typeElement = (TypeElement) typeUtils.asElement(type);
String fullName = typeElement.getQualifiedName().toString();
String simpleName = typeElement.getSimpleName().toString();
String pkg = packageNameOf(typeElement);
boolean importIt;
String spelling;
if (ambiguous.contains(simpleName)) {
importIt = false;
spelling = fullName;
} else if (pkg.equals("java.lang")) {
importIt = false;
spelling = javaLangSpelling(elementUtils, codePackageName, typeElement);
} else if (pkg.equals(codePackageName)) {
importIt = false;
spelling = fullName.substring(pkg.isEmpty() ? 0 : pkg.length() + 1);
} else {
importIt = true;
spelling = simpleName;
}
imports.put(fullName, new Spelling(spelling, importIt));
}
return imports;
} | [
"private",
"static",
"Map",
"<",
"String",
",",
"Spelling",
">",
"findImports",
"(",
"Elements",
"elementUtils",
",",
"Types",
"typeUtils",
",",
"String",
"codePackageName",
",",
"Set",
"<",
"TypeMirror",
">",
"referenced",
",",
"Set",
"<",
"TypeMirror",
">",
... | Given a set of referenced types, works out which of them should be imported and what the
resulting spelling of each one is.
<p>This method operates on a {@code Set<TypeMirror>} rather than just a {@code Set<String>}
because it is not strictly possible to determine what part of a fully-qualified type name is
the package and what part is the top-level class. For example, {@code java.util.Map.Entry} is a
class called {@code Map.Entry} in a package called {@code java.util} assuming Java conventions
are being followed, but it could theoretically also be a class called {@code Entry} in a
package called {@code java.util.Map}. Since we are operating as part of the compiler, our goal
should be complete correctness, and the only way to achieve that is to operate on the real
representations of types.
@param codePackageName The name of the package where the class containing these references is
defined. Other classes within the same package do not need to be imported.
@param referenced The complete set of declared types (classes and interfaces) that will be
referenced in the generated code.
@param defined The complete set of declared types (classes and interfaces) that are defined
within the scope of the generated class (i.e. nested somewhere in its superclass chain, or
in its interface set)
@return a map where the keys are fully-qualified types and the corresponding values indicate
whether the type should be imported, and how the type should be spelled in the source code. | [
"Given",
"a",
"set",
"of",
"referenced",
"types",
"works",
"out",
"which",
"of",
"them",
"should",
"be",
"imported",
"and",
"what",
"the",
"resulting",
"spelling",
"of",
"each",
"one",
"is",
"."
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/TypeSimplifier.java#L200-L234 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java | GuestWindowsRegistryManager.setRegistryValueInGuest | public void setRegistryValueInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegValueSpec value) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyInvalid, InvalidGuestLogin,
InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().setRegistryValueInGuest(getMOR(), vm.getMOR(), auth, value);
} | java | public void setRegistryValueInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegValueSpec value) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyInvalid, InvalidGuestLogin,
InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException {
getVimService().setRegistryValueInGuest(getMOR(), vm.getMOR(), auth, value);
} | [
"public",
"void",
"setRegistryValueInGuest",
"(",
"VirtualMachine",
"vm",
",",
"GuestAuthentication",
"auth",
",",
"GuestRegValueSpec",
"value",
")",
"throws",
"GuestComponentsOutOfDate",
",",
"GuestOperationsFault",
",",
"GuestOperationsUnavailable",
",",
"GuestPermissionDen... | Set/Create a registry value.
@param vm Virtual machine to perform the operation on.
@param auth The guest authentication data.
@param value The information for the registry value to be set/created. The Value "name" (specified in {@link com.vmware.vim25.GuestRegValueNameSpec GuestRegValueNameSpec}) and the Value "data" (specified in {@link com.vmware.vim25.GuestRegValueSpec GuestRegValueSpec}) can both be empty. If "name" is empty, it sets the value for the unnamed or default value of the given key.
@throws GuestComponentsOutOfDate
@throws GuestOperationsFault
@throws GuestOperationsUnavailable
@throws GuestPermissionDenied
@throws GuestRegistryKeyInvalid
@throws InvalidGuestLogin
@throws InvalidPowerState
@throws InvalidState
@throws OperationDisabledByGuest
@throws OperationNotSupportedByGuest
@throws RuntimeFault
@throws TaskInProgress
@throws RemoteException | [
"Set",
"/",
"Create",
"a",
"registry",
"value",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java#L213-L216 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getCollectionByQuery | public ManageableCollection getCollectionByQuery(Class collectionClass, Query query)
throws PersistenceBrokerException
{
return referencesBroker.getCollectionByQuery(collectionClass, query, false);
} | java | public ManageableCollection getCollectionByQuery(Class collectionClass, Query query)
throws PersistenceBrokerException
{
return referencesBroker.getCollectionByQuery(collectionClass, query, false);
} | [
"public",
"ManageableCollection",
"getCollectionByQuery",
"(",
"Class",
"collectionClass",
",",
"Query",
"query",
")",
"throws",
"PersistenceBrokerException",
"{",
"return",
"referencesBroker",
".",
"getCollectionByQuery",
"(",
"collectionClass",
",",
"query",
",",
"false... | retrieve a collection of type collectionClass matching the Query query
@see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Class, Query) | [
"retrieve",
"a",
"collection",
"of",
"type",
"collectionClass",
"matching",
"the",
"Query",
"query"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1513-L1517 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java | BeanUtil.setFieldValue | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
if (bean instanceof Map) {
((Map) bean).put(fieldNameOrIndex, value);
} else if (bean instanceof List) {
CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
} else if (ArrayUtil.isArray(bean)) {
ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
} else {
// 普通Bean对象
ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public static void setFieldValue(Object bean, String fieldNameOrIndex, Object value) {
if (bean instanceof Map) {
((Map) bean).put(fieldNameOrIndex, value);
} else if (bean instanceof List) {
CollUtil.setOrAppend((List) bean, Convert.toInt(fieldNameOrIndex), value);
} else if (ArrayUtil.isArray(bean)) {
ArrayUtil.setOrAppend(bean, Convert.toInt(fieldNameOrIndex), value);
} else {
// 普通Bean对象
ReflectUtil.setFieldValue(bean, fieldNameOrIndex, value);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"void",
"setFieldValue",
"(",
"Object",
"bean",
",",
"String",
"fieldNameOrIndex",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"bean",
"instanceof",
"Map",
... | 设置字段值,,通过反射设置字段值,并不调用setXXX方法<br>
对象同样支持Map类型,fieldNameOrIndex即为key
@param bean Bean
@param fieldNameOrIndex 字段名或序号,序号支持负数
@param value 值 | [
"设置字段值,,通过反射设置字段值,并不调用setXXX方法<br",
">",
"对象同样支持Map类型,fieldNameOrIndex即为key"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L278-L290 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java | PasswordlessLock.newIntent | @SuppressWarnings("unused")
public Intent newIntent(Context context) {
Intent lockIntent = new Intent(context, PasswordlessLockActivity.class);
lockIntent.putExtra(Constants.OPTIONS_EXTRA, options);
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return lockIntent;
} | java | @SuppressWarnings("unused")
public Intent newIntent(Context context) {
Intent lockIntent = new Intent(context, PasswordlessLockActivity.class);
lockIntent.putExtra(Constants.OPTIONS_EXTRA, options);
lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return lockIntent;
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"Intent",
"newIntent",
"(",
"Context",
"context",
")",
"{",
"Intent",
"lockIntent",
"=",
"new",
"Intent",
"(",
"context",
",",
"PasswordlessLockActivity",
".",
"class",
")",
";",
"lockIntent",
".",
"pu... | Builds a new intent to launch LockActivity with the previously configured options
@param context a valid Context
@return the intent to which the user has to call startActivity or startActivityForResult | [
"Builds",
"a",
"new",
"intent",
"to",
"launch",
"LockActivity",
"with",
"the",
"previously",
"configured",
"options"
] | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java#L119-L125 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/AuthenticationManagerCommandAction.java | AuthenticationManagerCommandAction.persistRealmChanges | private void persistRealmChanges() {
configManager.persistProperties(realm.getProperties(), new File(applicationContentDir, PersistablePropertiesRealm.REALM_FILE_NAME), null);
} | java | private void persistRealmChanges() {
configManager.persistProperties(realm.getProperties(), new File(applicationContentDir, PersistablePropertiesRealm.REALM_FILE_NAME), null);
} | [
"private",
"void",
"persistRealmChanges",
"(",
")",
"{",
"configManager",
".",
"persistProperties",
"(",
"realm",
".",
"getProperties",
"(",
")",
",",
"new",
"File",
"(",
"applicationContentDir",
",",
"PersistablePropertiesRealm",
".",
"REALM_FILE_NAME",
")",
",",
... | Persists the user accounts to a properties file that is only available to this site only. | [
"Persists",
"the",
"user",
"accounts",
"to",
"a",
"properties",
"file",
"that",
"is",
"only",
"available",
"to",
"this",
"site",
"only",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/shiro/AuthenticationManagerCommandAction.java#L80-L82 |
alkacon/opencms-core | src/org/opencms/loader/CmsJspLoader.java | CmsJspLoader.getController | protected CmsFlexController getController(
CmsObject cms,
CmsResource resource,
HttpServletRequest req,
HttpServletResponse res,
boolean streaming,
boolean top) {
CmsFlexController controller = null;
if (top) {
// only check for existing controller if this is the "top" request/response
controller = CmsFlexController.getController(req);
}
if (controller == null) {
// create new request / response wrappers
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (CmsHistoryResourceHandler.isHistoryRequest(req) || CmsJspTagEnableAde.isDirectEditDisabled(req))) {
cms.getRequestContext().setAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT, Boolean.TRUE);
}
controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top);
CmsFlexController.setController(req, controller);
CmsFlexRequest f_req = new CmsFlexRequest(req, controller);
CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true);
controller.push(f_req, f_res);
} else if (controller.isForwardMode()) {
// reset CmsObject (because of URI) if in forward mode
controller = new CmsFlexController(cms, controller);
CmsFlexController.setController(req, controller);
}
return controller;
} | java | protected CmsFlexController getController(
CmsObject cms,
CmsResource resource,
HttpServletRequest req,
HttpServletResponse res,
boolean streaming,
boolean top) {
CmsFlexController controller = null;
if (top) {
// only check for existing controller if this is the "top" request/response
controller = CmsFlexController.getController(req);
}
if (controller == null) {
// create new request / response wrappers
if (!cms.getRequestContext().getCurrentProject().isOnlineProject()
&& (CmsHistoryResourceHandler.isHistoryRequest(req) || CmsJspTagEnableAde.isDirectEditDisabled(req))) {
cms.getRequestContext().setAttribute(CmsGwtConstants.PARAM_DISABLE_DIRECT_EDIT, Boolean.TRUE);
}
controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top);
CmsFlexController.setController(req, controller);
CmsFlexRequest f_req = new CmsFlexRequest(req, controller);
CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true);
controller.push(f_req, f_res);
} else if (controller.isForwardMode()) {
// reset CmsObject (because of URI) if in forward mode
controller = new CmsFlexController(cms, controller);
CmsFlexController.setController(req, controller);
}
return controller;
} | [
"protected",
"CmsFlexController",
"getController",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"boolean",
"streaming",
",",
"boolean",
"top",
")",
"{",
"CmsFlexController",
"control... | Delivers a Flex controller, either by creating a new one, or by re-using an existing one.<p>
@param cms the initial CmsObject to wrap in the controller
@param resource the resource requested
@param req the current request
@param res the current response
@param streaming indicates if the response is streaming
@param top indicates if the response is the top response
@return a Flex controller | [
"Delivers",
"a",
"Flex",
"controller",
"either",
"by",
"creating",
"a",
"new",
"one",
"or",
"by",
"re",
"-",
"using",
"an",
"existing",
"one",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1136-L1166 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java | CommonOps_ZDRM.transposeConjugate | public static ZMatrixRMaj transposeConjugate(ZMatrixRMaj input , ZMatrixRMaj output )
{
if( output == null ) {
output = new ZMatrixRMaj(input.numCols,input.numRows);
} else if( input.numCols != output.numRows || input.numRows != output.numCols ) {
throw new IllegalArgumentException("Input and output shapes are not compatible");
}
TransposeAlgs_ZDRM.standardConjugate(input, output);
return output;
} | java | public static ZMatrixRMaj transposeConjugate(ZMatrixRMaj input , ZMatrixRMaj output )
{
if( output == null ) {
output = new ZMatrixRMaj(input.numCols,input.numRows);
} else if( input.numCols != output.numRows || input.numRows != output.numCols ) {
throw new IllegalArgumentException("Input and output shapes are not compatible");
}
TransposeAlgs_ZDRM.standardConjugate(input, output);
return output;
} | [
"public",
"static",
"ZMatrixRMaj",
"transposeConjugate",
"(",
"ZMatrixRMaj",
"input",
",",
"ZMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"ZMatrixRMaj",
"(",
"input",
".",
"numCols",
",",
"input",
".",
... | <p>
Conjugate transposes input matrix 'a' and stores the results in output matrix 'b':<br>
<br>
b-real<sub>i,j</sub> = a-real<sub>j,i</sub><br>
b-imaginary<sub>i,j</sub> = -1*a-imaginary<sub>j,i</sub><br>
where 'b' is the transpose of 'a'.
</p>
@param input The original matrix. Not modified.
@param output Where the transpose is stored. If null a new matrix is created. Modified.
@return The transposed matrix. | [
"<p",
">",
"Conjugate",
"transposes",
"input",
"matrix",
"a",
"and",
"stores",
"the",
"results",
"in",
"output",
"matrix",
"b",
":",
"<br",
">",
"<br",
">",
"b",
"-",
"real<sub",
">",
"i",
"j<",
"/",
"sub",
">",
"=",
"a",
"-",
"real<sub",
">",
"j",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L779-L790 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java | Tetrahedron.getVertices | @Override
public Point3d[] getVertices() {
double x = getSideLengthFromCircumscribedRadius(circumscribedRadius)/2;
double z = x/Math.sqrt(2);
Point3d[] tetrahedron = new Point3d[4];
tetrahedron[0] = new Point3d(-x, 0, -z);
tetrahedron[1] = new Point3d( x, 0, -z);
tetrahedron[2] = new Point3d( 0, -x, z);
tetrahedron[3] = new Point3d( 0, x, z);
Point3d centroid = CalcPoint.centroid(tetrahedron);
// rotate tetrahedron to align one vertex with the +z axis
Matrix3d m = new Matrix3d();
m.rotX(0.5 * TETRAHEDRAL_ANGLE);
for (Point3d p: tetrahedron) {
p.sub(centroid);
m.transform(p);
}
return tetrahedron;
} | java | @Override
public Point3d[] getVertices() {
double x = getSideLengthFromCircumscribedRadius(circumscribedRadius)/2;
double z = x/Math.sqrt(2);
Point3d[] tetrahedron = new Point3d[4];
tetrahedron[0] = new Point3d(-x, 0, -z);
tetrahedron[1] = new Point3d( x, 0, -z);
tetrahedron[2] = new Point3d( 0, -x, z);
tetrahedron[3] = new Point3d( 0, x, z);
Point3d centroid = CalcPoint.centroid(tetrahedron);
// rotate tetrahedron to align one vertex with the +z axis
Matrix3d m = new Matrix3d();
m.rotX(0.5 * TETRAHEDRAL_ANGLE);
for (Point3d p: tetrahedron) {
p.sub(centroid);
m.transform(p);
}
return tetrahedron;
} | [
"@",
"Override",
"public",
"Point3d",
"[",
"]",
"getVertices",
"(",
")",
"{",
"double",
"x",
"=",
"getSideLengthFromCircumscribedRadius",
"(",
"circumscribedRadius",
")",
"/",
"2",
";",
"double",
"z",
"=",
"x",
"/",
"Math",
".",
"sqrt",
"(",
"2",
")",
";... | Returns the vertices of an n-fold polygon of given radius and center
@param n
@param radius
@param center
@return | [
"Returns",
"the",
"vertices",
"of",
"an",
"n",
"-",
"fold",
"polygon",
"of",
"given",
"radius",
"and",
"center"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Tetrahedron.java#L104-L123 |
spotify/apollo | examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java | ArtistResource.parseFirstArtistId | private String parseFirstArtistId(String json) {
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode node : jsonNode.get("artists").get("items")) {
return node.get("id").asText();
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return null;
} | java | private String parseFirstArtistId(String json) {
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode node : jsonNode.get("artists").get("items")) {
return node.get("id").asText();
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return null;
} | [
"private",
"String",
"parseFirstArtistId",
"(",
"String",
"json",
")",
"{",
"try",
"{",
"JsonNode",
"jsonNode",
"=",
"this",
".",
"objectMapper",
".",
"readTree",
"(",
"json",
")",
";",
"for",
"(",
"JsonNode",
"node",
":",
"jsonNode",
".",
"get",
"(",
"\... | Parses the first artist id from a JSON response from a
<a href="https://developer.spotify.com/web-api/search-item/">Spotify API search query</a>.
@param json The json response
@return The id of the first artist in the response. null if response was empty. | [
"Parses",
"the",
"first",
"artist",
"id",
"from",
"a",
"JSON",
"response",
"from",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"developer",
".",
"spotify",
".",
"com",
"/",
"web",
"-",
"api",
"/",
"search",
"-",
"item",
"/",
">",
"Spotify",
"API",
... | train | https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/examples/spotify-api-example/src/main/java/com/spotify/apollo/example/ArtistResource.java#L112-L122 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java | MyStringUtils.getContent | public static String getContent(String stringUrl, Map<String, String> requestProperties) {
try {
URL url = new URL(stringUrl);
URLConnection conn = url.openConnection();
if (requestProperties != null) {
for (Entry<String, String> entry : requestProperties.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
}
InputStream is = conn.getInputStream();
if ("gzip".equals(conn.getContentEncoding())) {
is = new GZIPInputStream(is);
}
return MyStreamUtils.readContent(is);
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | java | public static String getContent(String stringUrl, Map<String, String> requestProperties) {
try {
URL url = new URL(stringUrl);
URLConnection conn = url.openConnection();
if (requestProperties != null) {
for (Entry<String, String> entry : requestProperties.entrySet()) {
conn.setRequestProperty(entry.getKey(), entry.getValue());
}
}
InputStream is = conn.getInputStream();
if ("gzip".equals(conn.getContentEncoding())) {
is = new GZIPInputStream(is);
}
return MyStreamUtils.readContent(is);
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"String",
"getContent",
"(",
"String",
"stringUrl",
",",
"Map",
"<",
"String",
",",
"String",
">",
"requestProperties",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"stringUrl",
")",
";",
"URLConnection",
"conn",
"=",
"... | Returns content for the given URL
@param stringUrl URL
@param requestProperties Properties
@return Response content | [
"Returns",
"content",
"for",
"the",
"given",
"URL"
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L1004-L1026 |
antlrjavaparser/antlr-java-parser | src/main/java/com/github/antlrjavaparser/ASTHelper.java | ASTHelper.addArgument | public static void addArgument(MethodCallExpr call, Expression arg) {
List<Expression> args = call.getArgs();
if (args == null) {
args = new ArrayList<Expression>();
call.setArgs(args);
}
args.add(arg);
} | java | public static void addArgument(MethodCallExpr call, Expression arg) {
List<Expression> args = call.getArgs();
if (args == null) {
args = new ArrayList<Expression>();
call.setArgs(args);
}
args.add(arg);
} | [
"public",
"static",
"void",
"addArgument",
"(",
"MethodCallExpr",
"call",
",",
"Expression",
"arg",
")",
"{",
"List",
"<",
"Expression",
">",
"args",
"=",
"call",
".",
"getArgs",
"(",
")",
";",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"args",
"=",
... | Adds the given argument to the method call. The list of arguments will be
initialized if it is <code>null</code>.
@param call
method call
@param arg
argument value | [
"Adds",
"the",
"given",
"argument",
"to",
"the",
"method",
"call",
".",
"The",
"list",
"of",
"arguments",
"will",
"be",
"initialized",
"if",
"it",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L184-L191 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfo.java | TEEJBInvocationInfo.tracePreInvokeBegins | public static void tracePreInvokeBegins(EJSDeployedSupport s, EJSWrapperBase wrapper)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(MthdPreInvokeEntry_Type_Str).append(DataDelimiter)
.append(MthdPreInvokeEntry_Type).append(DataDelimiter);
writeDeployedSupportInfo(s, sbuf, wrapper, null);
Tr.debug(tc, sbuf.toString());
}
} | java | public static void tracePreInvokeBegins(EJSDeployedSupport s, EJSWrapperBase wrapper)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
StringBuffer sbuf = new StringBuffer();
sbuf
.append(MthdPreInvokeEntry_Type_Str).append(DataDelimiter)
.append(MthdPreInvokeEntry_Type).append(DataDelimiter);
writeDeployedSupportInfo(s, sbuf, wrapper, null);
Tr.debug(tc, sbuf.toString());
}
} | [
"public",
"static",
"void",
"tracePreInvokeBegins",
"(",
"EJSDeployedSupport",
"s",
",",
"EJSWrapperBase",
"wrapper",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuffe... | This is called by the EJB container server code to write a
EJB method call preinvoke begins record to the trace log, if enabled. | [
"This",
"is",
"called",
"by",
"the",
"EJB",
"container",
"server",
"code",
"to",
"write",
"a",
"EJB",
"method",
"call",
"preinvoke",
"begins",
"record",
"to",
"the",
"trace",
"log",
"if",
"enabled",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfo.java#L31-L45 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java | ReplaceValueStream.replaceValues | public static InputStream replaceValues(InputStream is, Map<String, String> valuesMap) {
return new ReplaceValueStream(valuesMap).createInputStream(is);
} | java | public static InputStream replaceValues(InputStream is, Map<String, String> valuesMap) {
return new ReplaceValueStream(valuesMap).createInputStream(is);
} | [
"public",
"static",
"InputStream",
"replaceValues",
"(",
"InputStream",
"is",
",",
"Map",
"<",
"String",
",",
"String",
">",
"valuesMap",
")",
"{",
"return",
"new",
"ReplaceValueStream",
"(",
"valuesMap",
")",
".",
"createInputStream",
"(",
"is",
")",
";",
"... | Returns a stream with the template parameter expressions replaced
@param is {@link InputStream} inputstream for
@param valuesMap a hashmap containing parameters
@return returns stream with template parameter expressions replaced | [
"Returns",
"a",
"stream",
"with",
"the",
"template",
"parameter",
"expressions",
"replaced"
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java#L39-L41 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.contains | public static boolean contains(Bbox parent, Bbox child) {
if (child.getX() < parent.getX()) {
return false;
}
if (child.getY() < parent.getY()) {
return false;
}
if (child.getMaxX() > parent.getMaxX()) {
return false;
}
if (child.getMaxY() > parent.getMaxY()) {
return false;
}
return true;
} | java | public static boolean contains(Bbox parent, Bbox child) {
if (child.getX() < parent.getX()) {
return false;
}
if (child.getY() < parent.getY()) {
return false;
}
if (child.getMaxX() > parent.getMaxX()) {
return false;
}
if (child.getMaxY() > parent.getMaxY()) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Bbox",
"parent",
",",
"Bbox",
"child",
")",
"{",
"if",
"(",
"child",
".",
"getX",
"(",
")",
"<",
"parent",
".",
"getX",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"child",
".",
"ge... | Does one bounding box contain another?
@param parent
The parent bounding box in the relation. Does this one contain the child?
@param child
The child bounding box in the relation. Is this one contained within the parent?
@return true if the child is completely contained(surrounded) by the parent, false otherwise. | [
"Does",
"one",
"bounding",
"box",
"contain",
"another?"
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L106-L120 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java | DatatypeConverter.getLong | public static final long getLong(InputStream is) throws IOException
{
byte[] data = new byte[8];
is.read(data);
return getLong(data, 0);
} | java | public static final long getLong(InputStream is) throws IOException
{
byte[] data = new byte[8];
is.read(data);
return getLong(data, 0);
} | [
"public",
"static",
"final",
"long",
"getLong",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"is",
".",
"read",
"(",
"data",
")",
";",
"return",
"getLong",
"(",
"data",... | Read a long int from an input stream.
@param is input stream
@return long value | [
"Read",
"a",
"long",
"int",
"from",
"an",
"input",
"stream",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/DatatypeConverter.java#L169-L174 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/util/FinalizerService.java | FinalizerService.addFinalizer | public void addFinalizer(Object referent, Runnable cleanup)
{
requireNonNull(referent, "referent is null");
requireNonNull(cleanup, "cleanup is null");
finalizers.add(new FinalizerReference(referent, finalizerQueue, cleanup));
} | java | public void addFinalizer(Object referent, Runnable cleanup)
{
requireNonNull(referent, "referent is null");
requireNonNull(cleanup, "cleanup is null");
finalizers.add(new FinalizerReference(referent, finalizerQueue, cleanup));
} | [
"public",
"void",
"addFinalizer",
"(",
"Object",
"referent",
",",
"Runnable",
"cleanup",
")",
"{",
"requireNonNull",
"(",
"referent",
",",
"\"referent is null\"",
")",
";",
"requireNonNull",
"(",
"cleanup",
",",
"\"cleanup is null\"",
")",
";",
"finalizers",
".",
... | When referent is freed by the garbage collector, run cleanup.
<p>
Note: cleanup must not contain a reference to the referent object. | [
"When",
"referent",
"is",
"freed",
"by",
"the",
"garbage",
"collector",
"run",
"cleanup",
".",
"<p",
">",
"Note",
":",
"cleanup",
"must",
"not",
"contain",
"a",
"reference",
"to",
"the",
"referent",
"object",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/FinalizerService.java#L81-L86 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/DbPro.java | DbPro.batchUpdate | public int[] batchUpdate(List<? extends Model> modelList, int batchSize) {
if (modelList == null || modelList.size() == 0)
return new int[0];
Model model = modelList.get(0);
Table table = TableMapping.me().getTable(model.getClass());
String[] pKeys = table.getPrimaryKey();
Map<String, Object> attrs = model._getAttrs();
List<String> attrNames = new ArrayList<String>();
// the same as the iterator in Dialect.forModelSave() to ensure the order of the attrs
for (Entry<String, Object> e : attrs.entrySet()) {
String attr = e.getKey();
if (config.dialect.isPrimaryKey(attr, pKeys) == false && table.hasColumnLabel(attr))
attrNames.add(attr);
}
for (String pKey : pKeys)
attrNames.add(pKey);
String columns = StrKit.join(attrNames.toArray(new String[attrNames.size()]), ",");
// update all attrs of the model not use the midifyFlag of every single model
Set<String> modifyFlag = attrs.keySet(); // model.getModifyFlag();
StringBuilder sql = new StringBuilder();
List<Object> parasNoUse = new ArrayList<Object>();
config.dialect.forModelUpdate(TableMapping.me().getTable(model.getClass()), attrs, modifyFlag, sql, parasNoUse);
return batch(sql.toString(), columns, modelList, batchSize);
} | java | public int[] batchUpdate(List<? extends Model> modelList, int batchSize) {
if (modelList == null || modelList.size() == 0)
return new int[0];
Model model = modelList.get(0);
Table table = TableMapping.me().getTable(model.getClass());
String[] pKeys = table.getPrimaryKey();
Map<String, Object> attrs = model._getAttrs();
List<String> attrNames = new ArrayList<String>();
// the same as the iterator in Dialect.forModelSave() to ensure the order of the attrs
for (Entry<String, Object> e : attrs.entrySet()) {
String attr = e.getKey();
if (config.dialect.isPrimaryKey(attr, pKeys) == false && table.hasColumnLabel(attr))
attrNames.add(attr);
}
for (String pKey : pKeys)
attrNames.add(pKey);
String columns = StrKit.join(attrNames.toArray(new String[attrNames.size()]), ",");
// update all attrs of the model not use the midifyFlag of every single model
Set<String> modifyFlag = attrs.keySet(); // model.getModifyFlag();
StringBuilder sql = new StringBuilder();
List<Object> parasNoUse = new ArrayList<Object>();
config.dialect.forModelUpdate(TableMapping.me().getTable(model.getClass()), attrs, modifyFlag, sql, parasNoUse);
return batch(sql.toString(), columns, modelList, batchSize);
} | [
"public",
"int",
"[",
"]",
"batchUpdate",
"(",
"List",
"<",
"?",
"extends",
"Model",
">",
"modelList",
",",
"int",
"batchSize",
")",
"{",
"if",
"(",
"modelList",
"==",
"null",
"||",
"modelList",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"new",... | Batch update models using the attrs names of the first model in modelList.
Ensure all the models can use the same sql as the first model. | [
"Batch",
"update",
"models",
"using",
"the",
"attrs",
"names",
"of",
"the",
"first",
"model",
"in",
"modelList",
".",
"Ensure",
"all",
"the",
"models",
"can",
"use",
"the",
"same",
"sql",
"as",
"the",
"first",
"model",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/DbPro.java#L1191-L1217 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/UploadManager.java | UploadManager.put | public Response put(String filePath, String key, String token) throws QiniuException {
return put(filePath, key, token, null, null, false);
} | java | public Response put(String filePath, String key, String token) throws QiniuException {
return put(filePath, key, token, null, null, false);
} | [
"public",
"Response",
"put",
"(",
"String",
"filePath",
",",
"String",
"key",
",",
"String",
"token",
")",
"throws",
"QiniuException",
"{",
"return",
"put",
"(",
"filePath",
",",
"key",
",",
"token",
",",
"null",
",",
"null",
",",
"false",
")",
";",
"}... | 上传文件
@param filePath 上传的文件路径
@param key 上传文件保存的文件名
@param token 上传凭证 | [
"上传文件"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/UploadManager.java#L159-L161 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsSiteSelectDialog.java | CmsSiteSelectDialog.prepareComboBox | private ComboBox prepareComboBox(IndexedContainer container, String captionKey) {
ComboBox result = new ComboBox(CmsVaadinUtils.getWpMessagesForCurrentLocale().key(captionKey), container);
result.setTextInputAllowed(true);
result.setNullSelectionAllowed(false);
result.setWidth("100%");
result.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
result.setItemCaptionPropertyId(CAPTION_PROPERTY);
result.setFilteringMode(FilteringMode.CONTAINS);
return result;
} | java | private ComboBox prepareComboBox(IndexedContainer container, String captionKey) {
ComboBox result = new ComboBox(CmsVaadinUtils.getWpMessagesForCurrentLocale().key(captionKey), container);
result.setTextInputAllowed(true);
result.setNullSelectionAllowed(false);
result.setWidth("100%");
result.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
result.setItemCaptionPropertyId(CAPTION_PROPERTY);
result.setFilteringMode(FilteringMode.CONTAINS);
return result;
} | [
"private",
"ComboBox",
"prepareComboBox",
"(",
"IndexedContainer",
"container",
",",
"String",
"captionKey",
")",
"{",
"ComboBox",
"result",
"=",
"new",
"ComboBox",
"(",
"CmsVaadinUtils",
".",
"getWpMessagesForCurrentLocale",
"(",
")",
".",
"key",
"(",
"captionKey",... | Prepares a combo box.<p>
@param container the indexed item container
@param captionKey the caption message key
@return the combo box | [
"Prepares",
"a",
"combo",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsSiteSelectDialog.java#L182-L193 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.rebootComputeNode | public void rebootComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
rebootComputeNode(poolId, nodeId, null, null);
} | java | public void rebootComputeNode(String poolId, String nodeId) throws BatchErrorException, IOException {
rebootComputeNode(poolId, nodeId, null, null);
} | [
"public",
"void",
"rebootComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"rebootComputeNode",
"(",
"poolId",
",",
"nodeId",
",",
"null",
",",
"null",
")",
";",
"}"
] | Reboots the specified compute node.
<p>You can reboot a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node to reboot.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Reboots",
"the",
"specified",
"compute",
"node",
".",
"<p",
">",
"You",
"can",
"reboot",
"a",
"compute",
"node",
"only",
"when",
"it",
"is",
"in",
"the",
"{",
"@link",
"com",
".",
"microsoft",
".",
"azure",
".",
"batch",
".",
"protocol",
".",
"models"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L277-L279 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.containsNone | public static boolean containsNone(String str, String invalidChars) {
if (str == null || invalidChars == null) {
return true;
}
return containsNone(str, invalidChars.toCharArray());
} | java | public static boolean containsNone(String str, String invalidChars) {
if (str == null || invalidChars == null) {
return true;
}
return containsNone(str, invalidChars.toCharArray());
} | [
"public",
"static",
"boolean",
"containsNone",
"(",
"String",
"str",
",",
"String",
"invalidChars",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"invalidChars",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"containsNone",
"(",
"str",
... | <p>Checks that the String does not contain certain characters.</p>
<p>A <code>null</code> String will return <code>true</code>.
A <code>null</code> invalid character array will return <code>true</code>.
An empty String ("") always returns true.</p>
<pre>
GosuStringUtil.containsNone(null, *) = true
GosuStringUtil.containsNone(*, null) = true
GosuStringUtil.containsNone("", *) = true
GosuStringUtil.containsNone("ab", "") = true
GosuStringUtil.containsNone("abab", "xyz") = true
GosuStringUtil.containsNone("ab1", "xyz") = true
GosuStringUtil.containsNone("abz", "xyz") = false
</pre>
@param str the String to check, may be null
@param invalidChars a String of invalid chars, may be null
@return true if it contains none of the invalid chars, or is null
@since 2.0 | [
"<p",
">",
"Checks",
"that",
"the",
"String",
"does",
"not",
"contain",
"certain",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1388-L1393 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java | WNExtendedSemanticGlossComparison.getRelationFromInts | private char getRelationFromInts(int lg, int mg, int syn, int opp) {
if ((lg >= mg) && (lg >= syn) && (lg >= opp) && (lg > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((mg >= lg) && (mg >= syn) && (mg >= opp) && (mg > 0)) {
return IMappingElement.MORE_GENERAL;
}
if ((syn >= mg) && (syn >= lg) && (syn >= opp) && (syn > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((opp >= mg) && (opp >= syn) && (opp >= lg) && (opp > 0)) {
return IMappingElement.LESS_GENERAL;
}
return IMappingElement.IDK;
} | java | private char getRelationFromInts(int lg, int mg, int syn, int opp) {
if ((lg >= mg) && (lg >= syn) && (lg >= opp) && (lg > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((mg >= lg) && (mg >= syn) && (mg >= opp) && (mg > 0)) {
return IMappingElement.MORE_GENERAL;
}
if ((syn >= mg) && (syn >= lg) && (syn >= opp) && (syn > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((opp >= mg) && (opp >= syn) && (opp >= lg) && (opp > 0)) {
return IMappingElement.LESS_GENERAL;
}
return IMappingElement.IDK;
} | [
"private",
"char",
"getRelationFromInts",
"(",
"int",
"lg",
",",
"int",
"mg",
",",
"int",
"syn",
",",
"int",
"opp",
")",
"{",
"if",
"(",
"(",
"lg",
">=",
"mg",
")",
"&&",
"(",
"lg",
">=",
"syn",
")",
"&&",
"(",
"lg",
">=",
"opp",
")",
"&&",
"... | Decides which relation to return.
@param lg number of less general words between two extended gloss
@param mg number of more general words between two extended gloss
@param syn number of synonym words between two extended gloss
@param opp number of opposite words between two extended gloss
@return the more frequent relation between two extended glosses. | [
"Decides",
"which",
"relation",
"to",
"return",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L130-L144 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.PUT | public void PUT(String partialUrl, Object payload)
{
URI uri = buildUri(partialUrl);
executePutRequest(uri, payload);
} | java | public void PUT(String partialUrl, Object payload)
{
URI uri = buildUri(partialUrl);
executePutRequest(uri, payload);
} | [
"public",
"void",
"PUT",
"(",
"String",
"partialUrl",
",",
"Object",
"payload",
")",
"{",
"URI",
"uri",
"=",
"buildUri",
"(",
"partialUrl",
")",
";",
"executePutRequest",
"(",
"uri",
",",
"payload",
")",
";",
"}"
] | Execute a PUT call against the partial URL.
@param partialUrl The partial URL to build
@param payload The object to use for the PUT | [
"Execute",
"a",
"PUT",
"call",
"against",
"the",
"partial",
"URL",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L136-L140 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageSenderFromEntityPathAsync | public static CompletableFuture<IMessageSender> createMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath) {
return createMessageSenderFromEntityPathAsync(messagingFactory, entityPath, null);
} | java | public static CompletableFuture<IMessageSender> createMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath) {
return createMessageSenderFromEntityPathAsync(messagingFactory, entityPath, null);
} | [
"public",
"static",
"CompletableFuture",
"<",
"IMessageSender",
">",
"createMessageSenderFromEntityPathAsync",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
")",
"{",
"return",
"createMessageSenderFromEntityPathAsync",
"(",
"messagingFactory",
",",
... | Creates a message sender asynchronously to the entity using the {@link MessagingFactory}
@param messagingFactory messaging factory (which represents a connection) on which sender needs to be created
@param entityPath path of entity
@return a CompletableFuture representing the pending creating of IMessageSender instance | [
"Creates",
"a",
"message",
"sender",
"asynchronously",
"to",
"the",
"entity",
"using",
"the",
"{"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L187-L189 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriterExtraAdapter.java | JBBPTextWriterExtraAdapter.extractFieldValue | public Object extractFieldValue(final Object instance, final Field field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
try {
return ReflectUtils.makeAccessible(field).get(instance);
} catch (Exception ex) {
throw new JBBPException("Can't extract value from field for exception", ex);
}
} | java | public Object extractFieldValue(final Object instance, final Field field) {
JBBPUtils.assertNotNull(field, "Field must not be null");
try {
return ReflectUtils.makeAccessible(field).get(instance);
} catch (Exception ex) {
throw new JBBPException("Can't extract value from field for exception", ex);
}
} | [
"public",
"Object",
"extractFieldValue",
"(",
"final",
"Object",
"instance",
",",
"final",
"Field",
"field",
")",
"{",
"JBBPUtils",
".",
"assertNotNull",
"(",
"field",
",",
"\"Field must not be null\"",
")",
";",
"try",
"{",
"return",
"ReflectUtils",
".",
"makeA... | Auxiliary method to extract field value.
@param instance object instance, can be null
@param field the filed which value should be extracted, must not be null
@return the field value | [
"Auxiliary",
"method",
"to",
"extract",
"field",
"value",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriterExtraAdapter.java#L97-L104 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java | JCusolverSp.cusolverSpScsrlsvluHost | public static int cusolverSpScsrlsvluHost(
cusolverSpHandle handle,
int n,
int nnzA,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvluHostNative(handle, n, nnzA, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, reorder, x, singularity));
} | java | public static int cusolverSpScsrlsvluHost(
cusolverSpHandle handle,
int n,
int nnzA,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvluHostNative(handle, n, nnzA, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, reorder, x, singularity));
} | [
"public",
"static",
"int",
"cusolverSpScsrlsvluHost",
"(",
"cusolverSpHandle",
"handle",
",",
"int",
"n",
",",
"int",
"nnzA",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrValA",
",",
"Pointer",
"csrRowPtrA",
",",
"Pointer",
"csrColIndA",
",",
"Pointer",
... | <pre>
-------- GPU linear solver by LU factorization
solve A*x = b, A can be singular
[ls] stands for linear solve
[v] stands for vector
[lu] stands for LU factorization
</pre> | [
"<pre",
">",
"--------",
"GPU",
"linear",
"solver",
"by",
"LU",
"factorization",
"solve",
"A",
"*",
"x",
"=",
"b",
"A",
"can",
"be",
"singular",
"[",
"ls",
"]",
"stands",
"for",
"linear",
"solve",
"[",
"v",
"]",
"stands",
"for",
"vector",
"[",
"lu",
... | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L137-L152 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java | LoggerCreator.createModuleLogger | public static Logger createModuleLogger(String name, Logger parent) {
final Logger logger = Logger.getLogger(name);
if (parent != null) {
logger.setParent(parent);
}
logger.setUseParentHandlers(true);
final Level level = getLoggingLevelFromProperties();
logger.setLevel(level);
return logger;
} | java | public static Logger createModuleLogger(String name, Logger parent) {
final Logger logger = Logger.getLogger(name);
if (parent != null) {
logger.setParent(parent);
}
logger.setUseParentHandlers(true);
final Level level = getLoggingLevelFromProperties();
logger.setLevel(level);
return logger;
} | [
"public",
"static",
"Logger",
"createModuleLogger",
"(",
"String",
"name",
",",
"Logger",
"parent",
")",
"{",
"final",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"name",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"logger",
".",... | Create a logger with the given name for a module (kernel or agent).
<p>The level of logging is influence by {@link JanusConfig#VERBOSE_LEVEL_NAME}.
@param name
- the name of the new logger.
@param parent
- the parent logger.
@return the logger. | [
"Create",
"a",
"logger",
"with",
"the",
"given",
"name",
"for",
"a",
"module",
"(",
"kernel",
"or",
"agent",
")",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/util/LoggerCreator.java#L110-L119 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java | SLINK.step2primitive | private void step2primitive(DBIDRef id, DBIDArrayIter it, int n, Relation<? extends O> relation, PrimitiveDistanceFunction<? super O> distFunc, WritableDoubleDataStore m) {
O newObj = relation.get(id);
for(it.seek(0); it.getOffset() < n; it.advance()) {
// M(i) = dist(i, n+1)
m.putDouble(it, distFunc.distance(relation.get(it), newObj));
}
} | java | private void step2primitive(DBIDRef id, DBIDArrayIter it, int n, Relation<? extends O> relation, PrimitiveDistanceFunction<? super O> distFunc, WritableDoubleDataStore m) {
O newObj = relation.get(id);
for(it.seek(0); it.getOffset() < n; it.advance()) {
// M(i) = dist(i, n+1)
m.putDouble(it, distFunc.distance(relation.get(it), newObj));
}
} | [
"private",
"void",
"step2primitive",
"(",
"DBIDRef",
"id",
",",
"DBIDArrayIter",
"it",
",",
"int",
"n",
",",
"Relation",
"<",
"?",
"extends",
"O",
">",
"relation",
",",
"PrimitiveDistanceFunction",
"<",
"?",
"super",
"O",
">",
"distFunc",
",",
"WritableDoubl... | Second step: Determine the pairwise distances from all objects in the
pointer representation to the new object with the specified id.
@param id the id of the object to be inserted into the pointer
representation
@param it Array iterator
@param n Last object
@param m Data store
@param relation Data relation
@param distFunc Distance function to use | [
"Second",
"step",
":",
"Determine",
"the",
"pairwise",
"distances",
"from",
"all",
"objects",
"in",
"the",
"pointer",
"representation",
"to",
"the",
"new",
"object",
"with",
"the",
"specified",
"id",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINK.java#L181-L187 |
HiddenStage/divide | Client/java-client/src/main/java/io/divide/client/BackendUser.java | BackendUser.signUpInBackground | public static Observable<BackendUser> signUpInBackground(String username, String email, String password){
return getAM().signUpASync(new SignUpCredentials(username, email, password));
} | java | public static Observable<BackendUser> signUpInBackground(String username, String email, String password){
return getAM().signUpASync(new SignUpCredentials(username, email, password));
} | [
"public",
"static",
"Observable",
"<",
"BackendUser",
">",
"signUpInBackground",
"(",
"String",
"username",
",",
"String",
"email",
",",
"String",
"password",
")",
"{",
"return",
"getAM",
"(",
")",
".",
"signUpASync",
"(",
"new",
"SignUpCredentials",
"(",
"use... | Perform asyncronously sign up attempt.
@param username user name user will be identified by.
@param email user email address
@param password user password
@return login results as observable. | [
"Perform",
"asyncronously",
"sign",
"up",
"attempt",
"."
] | train | https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Client/java-client/src/main/java/io/divide/client/BackendUser.java#L193-L195 |
arakelian/docker-junit-rule | src/main/java/com/arakelian/docker/junit/Container.java | Container.isSocketAlive | public static boolean isSocketAlive(final SocketAddress socketAddress, final int timeoutMsecs) {
final Socket socket = new Socket();
try {
socket.connect(socketAddress, timeoutMsecs);
socket.close();
return true;
} catch (final SocketTimeoutException exception) {
return false;
} catch (final IOException exception) {
return false;
}
} | java | public static boolean isSocketAlive(final SocketAddress socketAddress, final int timeoutMsecs) {
final Socket socket = new Socket();
try {
socket.connect(socketAddress, timeoutMsecs);
socket.close();
return true;
} catch (final SocketTimeoutException exception) {
return false;
} catch (final IOException exception) {
return false;
}
} | [
"public",
"static",
"boolean",
"isSocketAlive",
"(",
"final",
"SocketAddress",
"socketAddress",
",",
"final",
"int",
"timeoutMsecs",
")",
"{",
"final",
"Socket",
"socket",
"=",
"new",
"Socket",
"(",
")",
";",
"try",
"{",
"socket",
".",
"connect",
"(",
"socke... | Returns true if a connection can be established to the given socket address within the
timeout provided.
@param socketAddress
socket address
@param timeoutMsecs
timeout
@return true if a connection can be established to the given socket address | [
"Returns",
"true",
"if",
"a",
"connection",
"can",
"be",
"established",
"to",
"the",
"given",
"socket",
"address",
"within",
"the",
"timeout",
"provided",
"."
] | train | https://github.com/arakelian/docker-junit-rule/blob/cc99d63896a07df398b53fd5f0f6e4777e3b23cf/src/main/java/com/arakelian/docker/junit/Container.java#L87-L98 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/xml/XmlParser.java | XmlParser.setXpath | public void setXpath(String xpath)
{
_xpath = xpath;
StringTokenizer tok = new StringTokenizer(xpath,"| ");
while(tok.hasMoreTokens())
_xpaths=LazyList.add(_xpaths, tok.nextToken());
} | java | public void setXpath(String xpath)
{
_xpath = xpath;
StringTokenizer tok = new StringTokenizer(xpath,"| ");
while(tok.hasMoreTokens())
_xpaths=LazyList.add(_xpaths, tok.nextToken());
} | [
"public",
"void",
"setXpath",
"(",
"String",
"xpath",
")",
"{",
"_xpath",
"=",
"xpath",
";",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"xpath",
",",
"\"| \"",
")",
";",
"while",
"(",
"tok",
".",
"hasMoreTokens",
"(",
")",
")",
"_xpath... | Set an XPath
A very simple subset of xpath is supported to select a partial
tree. Currently only path like "/node1/nodeA | /node1/nodeB"
are supported.
@param xpath The xpath to set. | [
"Set",
"an",
"XPath",
"A",
"very",
"simple",
"subset",
"of",
"xpath",
"is",
"supported",
"to",
"select",
"a",
"partial",
"tree",
".",
"Currently",
"only",
"path",
"like",
"/",
"node1",
"/",
"nodeA",
"|",
"/",
"node1",
"/",
"nodeB",
"are",
"supported",
... | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/xml/XmlParser.java#L147-L153 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java | CsvFiles.getCsvDataMap | public static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent)
throws IOException {
return getCsvDataMap(fileName, 0, 1, headerPresent);
} | java | public static Map<String, String> getCsvDataMap(String fileName, boolean headerPresent)
throws IOException {
return getCsvDataMap(fileName, 0, 1, headerPresent);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getCsvDataMap",
"(",
"String",
"fileName",
",",
"boolean",
"headerPresent",
")",
"throws",
"IOException",
"{",
"return",
"getCsvDataMap",
"(",
"fileName",
",",
"0",
",",
"1",
",",
"headerPresent",
... | Returns a {@code Map<String, String>} mapping of the first column to the
second column. This method also ignores all columns other than the first
two.
@param fileName the CSV file to load
@param headerPresent {@code true} if the fist line is the header
@return a {@code Map<String, String>} mapping of the first to the second
column
@throws IOException if there was an exception reading the file
@throws IllegalArgumentException if CSV file has fewer than two
columns | [
"Returns",
"a",
"{",
"@code",
"Map<String",
"String",
">",
"}",
"mapping",
"of",
"the",
"first",
"column",
"to",
"the",
"second",
"column",
".",
"This",
"method",
"also",
"ignores",
"all",
"columns",
"other",
"than",
"the",
"first",
"two",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java#L79-L82 |
h2oai/h2o-3 | h2o-core/src/main/java/water/parser/CharSkippingBufferedString.java | CharSkippingBufferedString.toBufferedString | public BufferedString toBufferedString() {
if (_skipped.length == 0)
return _bufferedString;
byte[] buf = MemoryManager.malloc1(_bufferedString._len - _skipped.length); // Length of the buffer window minus skipped chars
int copyStart = _bufferedString._off;
int target = 0;
for (int skippedIndex : _skipped) {
for (int i = copyStart; i < skippedIndex; i++) {
buf[target++] = _bufferedString._buf[i];
}
copyStart = skippedIndex + 1;
}
int windowEnd = _bufferedString._off + _bufferedString._len;
for (int i = copyStart; i < windowEnd; i++) {
buf[target++] = _bufferedString._buf[i];
}
assert target == buf.length;
return new BufferedString(buf, 0, buf.length);
} | java | public BufferedString toBufferedString() {
if (_skipped.length == 0)
return _bufferedString;
byte[] buf = MemoryManager.malloc1(_bufferedString._len - _skipped.length); // Length of the buffer window minus skipped chars
int copyStart = _bufferedString._off;
int target = 0;
for (int skippedIndex : _skipped) {
for (int i = copyStart; i < skippedIndex; i++) {
buf[target++] = _bufferedString._buf[i];
}
copyStart = skippedIndex + 1;
}
int windowEnd = _bufferedString._off + _bufferedString._len;
for (int i = copyStart; i < windowEnd; i++) {
buf[target++] = _bufferedString._buf[i];
}
assert target == buf.length;
return new BufferedString(buf, 0, buf.length);
} | [
"public",
"BufferedString",
"toBufferedString",
"(",
")",
"{",
"if",
"(",
"_skipped",
".",
"length",
"==",
"0",
")",
"return",
"_bufferedString",
";",
"byte",
"[",
"]",
"buf",
"=",
"MemoryManager",
".",
"malloc1",
"(",
"_bufferedString",
".",
"_len",
"-",
... | Converts the current window into byte buffer to a {@link BufferedString}. The resulting new instance of {@link BufferedString}
is backed by a newly allocated byte[] buffer sized exactly to fit the desired string represented by current buffer window,
excluding the skipped characters.
@return An instance of {@link BufferedString} containing only bytes from the original window, without skipped bytes. | [
"Converts",
"the",
"current",
"window",
"into",
"byte",
"buffer",
"to",
"a",
"{",
"@link",
"BufferedString",
"}",
".",
"The",
"resulting",
"new",
"instance",
"of",
"{",
"@link",
"BufferedString",
"}",
"is",
"backed",
"by",
"a",
"newly",
"allocated",
"byte",
... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/CharSkippingBufferedString.java#L87-L108 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ExportJobsOperationResultsInner.java | ExportJobsOperationResultsInner.getAsync | public Observable<OperationResultInfoBaseResourceInner> getAsync(String vaultName, String resourceGroupName, String operationId) {
return getWithServiceResponseAsync(vaultName, resourceGroupName, operationId).map(new Func1<ServiceResponse<OperationResultInfoBaseResourceInner>, OperationResultInfoBaseResourceInner>() {
@Override
public OperationResultInfoBaseResourceInner call(ServiceResponse<OperationResultInfoBaseResourceInner> response) {
return response.body();
}
});
} | java | public Observable<OperationResultInfoBaseResourceInner> getAsync(String vaultName, String resourceGroupName, String operationId) {
return getWithServiceResponseAsync(vaultName, resourceGroupName, operationId).map(new Func1<ServiceResponse<OperationResultInfoBaseResourceInner>, OperationResultInfoBaseResourceInner>() {
@Override
public OperationResultInfoBaseResourceInner call(ServiceResponse<OperationResultInfoBaseResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationResultInfoBaseResourceInner",
">",
"getAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"operationId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName... | Gets the operation result of operation triggered by Export Jobs API. If the operation is successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param operationId OperationID which represents the export job.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationResultInfoBaseResourceInner object | [
"Gets",
"the",
"operation",
"result",
"of",
"operation",
"triggered",
"by",
"Export",
"Jobs",
"API",
".",
"If",
"the",
"operation",
"is",
"successful",
"then",
"it",
"also",
"contains",
"URL",
"of",
"a",
"Blob",
"and",
"a",
"SAS",
"key",
"to",
"access",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ExportJobsOperationResultsInner.java#L98-L105 |
wildfly/wildfly-maven-plugin | plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java | ServerOperations.createOperation | public static ModelNode createOperation(final String operation, final ModelNode address, final boolean recursive) {
final ModelNode op = createOperation(operation, address);
op.get(RECURSIVE).set(recursive);
return op;
} | java | public static ModelNode createOperation(final String operation, final ModelNode address, final boolean recursive) {
final ModelNode op = createOperation(operation, address);
op.get(RECURSIVE).set(recursive);
return op;
} | [
"public",
"static",
"ModelNode",
"createOperation",
"(",
"final",
"String",
"operation",
",",
"final",
"ModelNode",
"address",
",",
"final",
"boolean",
"recursive",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createOperation",
"(",
"operation",
",",
"address",
"... | Creates an operation.
@param operation the operation name
@param address the address for the operation
@param recursive whether the operation is recursive or not
@return the operation
@throws IllegalArgumentException if the address is not of type {@link ModelType#LIST} | [
"Creates",
"an",
"operation",
"."
] | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/common/ServerOperations.java#L154-L158 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java | ServletBeanContext.beginContext | public void beginContext(ServletContext context, ServletRequest req, ServletResponse resp)
{
pushRequestContext(context, req, resp);
super.beginContext();
} | java | public void beginContext(ServletContext context, ServletRequest req, ServletResponse resp)
{
pushRequestContext(context, req, resp);
super.beginContext();
} | [
"public",
"void",
"beginContext",
"(",
"ServletContext",
"context",
",",
"ServletRequest",
"req",
",",
"ServletResponse",
"resp",
")",
"{",
"pushRequestContext",
"(",
"context",
",",
"req",
",",
"resp",
")",
";",
"super",
".",
"beginContext",
"(",
")",
";",
... | Begins a new execution context, associated with a specific ServletRequest | [
"Begins",
"a",
"new",
"execution",
"context",
"associated",
"with",
"a",
"specific",
"ServletRequest"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/servlet/ServletBeanContext.java#L81-L85 |
RestComm/media-core | ice/src/main/java/org/restcomm/media/core/ice/network/stun/StunHandler.java | StunHandler.canHandle | @Override
public boolean canHandle(byte[] data, int length, int offset) {
/*
* All STUN messages MUST start with a 20-byte header followed by zero
* or more Attributes.
*/
if(length >= 20) {
// The most significant 2 bits of every STUN message MUST be zeroes.
byte b0 = data[offset];
boolean firstBitsValid = ((b0 & 0xC0) == 0);
// The magic cookie field MUST contain the fixed value 0x2112A442 in network byte order.
boolean hasMagicCookie = data[offset + 4] == StunMessage.MAGIC_COOKIE[0]
&& data[offset + 5] == StunMessage.MAGIC_COOKIE[1]
&& data[offset + 6] == StunMessage.MAGIC_COOKIE[2]
&& data[offset + 7] == StunMessage.MAGIC_COOKIE[3];
return firstBitsValid && hasMagicCookie;
}
return false;
} | java | @Override
public boolean canHandle(byte[] data, int length, int offset) {
/*
* All STUN messages MUST start with a 20-byte header followed by zero
* or more Attributes.
*/
if(length >= 20) {
// The most significant 2 bits of every STUN message MUST be zeroes.
byte b0 = data[offset];
boolean firstBitsValid = ((b0 & 0xC0) == 0);
// The magic cookie field MUST contain the fixed value 0x2112A442 in network byte order.
boolean hasMagicCookie = data[offset + 4] == StunMessage.MAGIC_COOKIE[0]
&& data[offset + 5] == StunMessage.MAGIC_COOKIE[1]
&& data[offset + 6] == StunMessage.MAGIC_COOKIE[2]
&& data[offset + 7] == StunMessage.MAGIC_COOKIE[3];
return firstBitsValid && hasMagicCookie;
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"canHandle",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"length",
",",
"int",
"offset",
")",
"{",
"/*\n\t\t * All STUN messages MUST start with a 20-byte header followed by zero\n\t\t * or more Attributes.\n\t\t */",
"if",
"(",
"length"... | /*
All STUN messages MUST start with a 20-byte header followed by zero or more Attributes.
The STUN header contains a STUN message type, magic cookie, transaction ID, and message length.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0 0| STUN Message Type | Message Length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Magic Cookie |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
| Transaction ID (96 bits) |
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@param data
@param length
@return
@see <a href="http://tools.ietf.org/html/rfc5389#page-10">RFC5389</a> | [
"/",
"*",
"All",
"STUN",
"messages",
"MUST",
"start",
"with",
"a",
"20",
"-",
"byte",
"header",
"followed",
"by",
"zero",
"or",
"more",
"Attributes",
".",
"The",
"STUN",
"header",
"contains",
"a",
"STUN",
"message",
"type",
"magic",
"cookie",
"transaction"... | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/ice/src/main/java/org/restcomm/media/core/ice/network/stun/StunHandler.java#L220-L239 |
yanzhenjie/AndServer | sample/src/main/java/com/yanzhenjie/andserver/sample/util/JsonUtils.java | JsonUtils.failedJson | public static String failedJson(int code, String message) {
ReturnData returnData = new ReturnData();
returnData.setSuccess(false);
returnData.setErrorCode(code);
returnData.setErrorMsg(message);
return JSON.toJSONString(returnData);
} | java | public static String failedJson(int code, String message) {
ReturnData returnData = new ReturnData();
returnData.setSuccess(false);
returnData.setErrorCode(code);
returnData.setErrorMsg(message);
return JSON.toJSONString(returnData);
} | [
"public",
"static",
"String",
"failedJson",
"(",
"int",
"code",
",",
"String",
"message",
")",
"{",
"ReturnData",
"returnData",
"=",
"new",
"ReturnData",
"(",
")",
";",
"returnData",
".",
"setSuccess",
"(",
"false",
")",
";",
"returnData",
".",
"setErrorCode... | Business is failed.
@param code error code.
@param message message.
@return json. | [
"Business",
"is",
"failed",
"."
] | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/sample/src/main/java/com/yanzhenjie/andserver/sample/util/JsonUtils.java#L51-L57 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java | BndUtils.createBundle | public static InputStream createBundle( final InputStream jarInputStream,
final Properties instructions,
final String jarInfo )
throws IOException
{
return createBundle( jarInputStream, instructions, jarInfo, OverwriteMode.KEEP );
} | java | public static InputStream createBundle( final InputStream jarInputStream,
final Properties instructions,
final String jarInfo )
throws IOException
{
return createBundle( jarInputStream, instructions, jarInfo, OverwriteMode.KEEP );
} | [
"public",
"static",
"InputStream",
"createBundle",
"(",
"final",
"InputStream",
"jarInputStream",
",",
"final",
"Properties",
"instructions",
",",
"final",
"String",
"jarInfo",
")",
"throws",
"IOException",
"{",
"return",
"createBundle",
"(",
"jarInputStream",
",",
... | Processes the input jar and generates the necessary OSGi headers using specified instructions.
@param jarInputStream input stream for the jar to be processed. Cannot be null.
@param instructions bnd specific processing instructions. Cannot be null.
@param jarInfo information about the jar to be processed. Usually the jar url. Cannot be null or empty.
@return an input stream for the generated bundle
@throws NullArgumentException if any of the parameters is null
@throws IOException re-thron during jar processing | [
"Processes",
"the",
"input",
"jar",
"and",
"generates",
"the",
"necessary",
"OSGi",
"headers",
"using",
"specified",
"instructions",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java#L88-L94 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.getContactsPublicPhotos | public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf)
throws FlickrException {
return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf);
} | java | public PhotoList<Photo> getContactsPublicPhotos(String userId, int count, boolean justFriends, boolean singlePhoto, boolean includeSelf)
throws FlickrException {
return getContactsPublicPhotos(userId, Extras.MIN_EXTRAS, count, justFriends, singlePhoto, includeSelf);
} | [
"public",
"PhotoList",
"<",
"Photo",
">",
"getContactsPublicPhotos",
"(",
"String",
"userId",
",",
"int",
"count",
",",
"boolean",
"justFriends",
",",
"boolean",
"singlePhoto",
",",
"boolean",
"includeSelf",
")",
"throws",
"FlickrException",
"{",
"return",
"getCon... | Get public photos from the user's contacts.
This method does not require authentication.
@see com.flickr4java.flickr.photos.Extras
@param userId
The user ID
@param count
The number of photos to return
@param justFriends
True to include friends
@param singlePhoto
True to get a single photo
@param includeSelf
True to include self
@return A collection of Photo objects
@throws FlickrException | [
"Get",
"public",
"photos",
"from",
"the",
"user",
"s",
"contacts",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L308-L311 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequenceQuality.java | SequenceQuality.create | public static SequenceQuality create(QualityFormat format, byte[] data, boolean check) {
return create(format, data, 0, data.length, check);
} | java | public static SequenceQuality create(QualityFormat format, byte[] data, boolean check) {
return create(format, data, 0, data.length, check);
} | [
"public",
"static",
"SequenceQuality",
"create",
"(",
"QualityFormat",
"format",
",",
"byte",
"[",
"]",
"data",
",",
"boolean",
"check",
")",
"{",
"return",
"create",
"(",
"format",
",",
"data",
",",
"0",
",",
"data",
".",
"length",
",",
"check",
")",
... | Factory method for the SequenceQualityPhred object. It performs all necessary range checks if required.
@param format format of encoded quality values
@param data byte with encoded quality values
@param check determines whether range check is required
@return quality line object
@throws WrongQualityFormat if encoded value are out of range and checking is enabled | [
"Factory",
"method",
"for",
"the",
"SequenceQualityPhred",
"object",
".",
"It",
"performs",
"all",
"necessary",
"range",
"checks",
"if",
"required",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequenceQuality.java#L376-L378 |
dickschoeller/gedbrowser | gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/ChildrenOrderAnalyzer.java | ChildrenOrderAnalyzer.analyzeChild | private Person analyzeChild(final Person child, final Person prevChild) {
Person retChild = prevChild;
if (retChild == null) {
return child;
}
final LocalDate birthDate = getNearBirthEventDate(child);
if (birthDate == null) {
return retChild;
}
final LocalDate prevDate = getNearBirthEventDate(prevChild);
if (prevDate == null) {
return child;
}
if (birthDate.isBefore(prevDate)) {
final String message = String.format(CHILD_ORDER_FORMAT,
child.getName().getString(), birthDate,
prevChild.getName().getString(), prevDate);
getResult().addMismatch(message);
}
retChild = child;
return retChild;
} | java | private Person analyzeChild(final Person child, final Person prevChild) {
Person retChild = prevChild;
if (retChild == null) {
return child;
}
final LocalDate birthDate = getNearBirthEventDate(child);
if (birthDate == null) {
return retChild;
}
final LocalDate prevDate = getNearBirthEventDate(prevChild);
if (prevDate == null) {
return child;
}
if (birthDate.isBefore(prevDate)) {
final String message = String.format(CHILD_ORDER_FORMAT,
child.getName().getString(), birthDate,
prevChild.getName().getString(), prevDate);
getResult().addMismatch(message);
}
retChild = child;
return retChild;
} | [
"private",
"Person",
"analyzeChild",
"(",
"final",
"Person",
"child",
",",
"final",
"Person",
"prevChild",
")",
"{",
"Person",
"retChild",
"=",
"prevChild",
";",
"if",
"(",
"retChild",
"==",
"null",
")",
"{",
"return",
"child",
";",
"}",
"final",
"LocalDat... | Check the order of one child against the previous dated child.
@param child the child
@param prevChild the previous child
@return the current child if dated | [
"Check",
"the",
"order",
"of",
"one",
"child",
"against",
"the",
"previous",
"dated",
"child",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-analytics/src/main/java/org/schoellerfamily/gedbrowser/analytics/order/ChildrenOrderAnalyzer.java#L69-L90 |
menacher/java-game-server | jetserver/src/main/java/org/menacheri/jetserver/event/Events.java | Events.networkEvent | public static NetworkEvent networkEvent(Object source, DeliveryGuaranty deliveryGuaranty)
{
Event event = event(source,Events.NETWORK_MESSAGE);
NetworkEvent networkEvent = new DefaultNetworkEvent(event);
networkEvent.setDeliveryGuaranty(deliveryGuaranty);
return networkEvent;
} | java | public static NetworkEvent networkEvent(Object source, DeliveryGuaranty deliveryGuaranty)
{
Event event = event(source,Events.NETWORK_MESSAGE);
NetworkEvent networkEvent = new DefaultNetworkEvent(event);
networkEvent.setDeliveryGuaranty(deliveryGuaranty);
return networkEvent;
} | [
"public",
"static",
"NetworkEvent",
"networkEvent",
"(",
"Object",
"source",
",",
"DeliveryGuaranty",
"deliveryGuaranty",
")",
"{",
"Event",
"event",
"=",
"event",
"(",
"source",
",",
"Events",
".",
"NETWORK_MESSAGE",
")",
";",
"NetworkEvent",
"networkEvent",
"=",... | Creates a network event with the source set to the object passed in as
parameter and the {@link DeliveryGuaranty} set to the incoming
parameter.
@param source
The payload of the event. This is the actual data that gets
transmitted to remote machine.
@param deliveryGuaranty
This decides which transport TCP or UDP to be used to send the
message to remote machine.
@return An instance of {@link NetworkEvent} | [
"Creates",
"a",
"network",
"event",
"with",
"the",
"source",
"set",
"to",
"the",
"object",
"passed",
"in",
"as",
"parameter",
"and",
"the",
"{",
"@link",
"DeliveryGuaranty",
"}",
"set",
"to",
"the",
"incoming",
"parameter",
"."
] | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetserver/src/main/java/org/menacheri/jetserver/event/Events.java#L142-L148 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.writeXML | public static void writeXML(DocumentFragment fragment, Writer writer) throws IOException {
assert fragment != null : AssertMessages.notNullParameter(0);
assert writer != null : AssertMessages.notNullParameter(1);
writeNode(fragment, writer);
} | java | public static void writeXML(DocumentFragment fragment, Writer writer) throws IOException {
assert fragment != null : AssertMessages.notNullParameter(0);
assert writer != null : AssertMessages.notNullParameter(1);
writeNode(fragment, writer);
} | [
"public",
"static",
"void",
"writeXML",
"(",
"DocumentFragment",
"fragment",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"assert",
"fragment",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"assert",
"writer",
... | Write the given node tree into a XML file.
@param fragment is the object that contains the node tree
@param writer is the target stream
@throws IOException if the stream cannot be read. | [
"Write",
"the",
"given",
"node",
"tree",
"into",
"a",
"XML",
"file",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L2444-L2448 |
alibaba/jstorm | jstorm-core/src/main/java/storm/trident/Stream.java | Stream.maxBy | public Stream maxBy(String inputFieldName) {
Aggregator<ComparisonAggregator.State> max = new Max(inputFieldName);
return comparableAggregateStream(inputFieldName, max);
} | java | public Stream maxBy(String inputFieldName) {
Aggregator<ComparisonAggregator.State> max = new Max(inputFieldName);
return comparableAggregateStream(inputFieldName, max);
} | [
"public",
"Stream",
"maxBy",
"(",
"String",
"inputFieldName",
")",
"{",
"Aggregator",
"<",
"ComparisonAggregator",
".",
"State",
">",
"max",
"=",
"new",
"Max",
"(",
"inputFieldName",
")",
";",
"return",
"comparableAggregateStream",
"(",
"inputFieldName",
",",
"m... | This aggregator operation computes the maximum of tuples by the given {@code inputFieldName} and it is
assumed that its value is an instance of {@code Comparable}. If the value of tuple with field {@code inputFieldName} is not an
instance of {@code Comparable} then it throws {@code ClassCastException}
@param inputFieldName input field name
@return the new stream with this operation. | [
"This",
"aggregator",
"operation",
"computes",
"the",
"maximum",
"of",
"tuples",
"by",
"the",
"given",
"{",
"@code",
"inputFieldName",
"}",
"and",
"it",
"is",
"assumed",
"that",
"its",
"value",
"is",
"an",
"instance",
"of",
"{",
"@code",
"Comparable",
"}",
... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/storm/trident/Stream.java#L522-L525 |
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/targeting/AddCustomerNegativeCriteria.java | AddCustomerNegativeCriteria.runExample | public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session)
throws RemoteException {
// Get the CustomerNegativeCriterionService.
CustomerNegativeCriterionServiceInterface customerNegativeCriterionService =
adWordsServices.get(session, CustomerNegativeCriterionServiceInterface.class);
List<Criterion> criteria = new ArrayList<>();
// Exclude tragedy & conflict content.
ContentLabel tragedyContentLabel = new ContentLabel();
tragedyContentLabel.setContentLabelType(ContentLabelType.TRAGEDY);
criteria.add(tragedyContentLabel);
// Exclude a specific placement.
Placement placement = new Placement();
placement.setUrl("http://www.example.com");
criteria.add(placement);
// Additional criteria types are available for this service. See the types listed
// under Criterion here:
// https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion
// Create operations to add each of the criteria above.
List<CustomerNegativeCriterionOperation> operations = new ArrayList<>();
for (Criterion criterion : criteria) {
CustomerNegativeCriterion negativeCriterion = new CustomerNegativeCriterion();
negativeCriterion.setCriterion(criterion);
CustomerNegativeCriterionOperation operation = new CustomerNegativeCriterionOperation();
operation.setOperator(Operator.ADD);
operation.setOperand(negativeCriterion);
operations.add(operation);
}
// Send the request to add the criteria.
CustomerNegativeCriterionReturnValue result =
customerNegativeCriterionService.mutate(
operations.toArray(new CustomerNegativeCriterionOperation[operations.size()]));
// Display the results.
for (CustomerNegativeCriterion negativeCriterion : result.getValue()) {
System.out.printf(
"Customer negative criterion with criterion ID %d and type '%s' was added.%n",
negativeCriterion.getCriterion().getId(),
negativeCriterion.getCriterion().getCriterionType());
}
} | java | public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session)
throws RemoteException {
// Get the CustomerNegativeCriterionService.
CustomerNegativeCriterionServiceInterface customerNegativeCriterionService =
adWordsServices.get(session, CustomerNegativeCriterionServiceInterface.class);
List<Criterion> criteria = new ArrayList<>();
// Exclude tragedy & conflict content.
ContentLabel tragedyContentLabel = new ContentLabel();
tragedyContentLabel.setContentLabelType(ContentLabelType.TRAGEDY);
criteria.add(tragedyContentLabel);
// Exclude a specific placement.
Placement placement = new Placement();
placement.setUrl("http://www.example.com");
criteria.add(placement);
// Additional criteria types are available for this service. See the types listed
// under Criterion here:
// https://developers.google.com/adwords/api/docs/reference/latest/CustomerNegativeCriterionService.Criterion
// Create operations to add each of the criteria above.
List<CustomerNegativeCriterionOperation> operations = new ArrayList<>();
for (Criterion criterion : criteria) {
CustomerNegativeCriterion negativeCriterion = new CustomerNegativeCriterion();
negativeCriterion.setCriterion(criterion);
CustomerNegativeCriterionOperation operation = new CustomerNegativeCriterionOperation();
operation.setOperator(Operator.ADD);
operation.setOperand(negativeCriterion);
operations.add(operation);
}
// Send the request to add the criteria.
CustomerNegativeCriterionReturnValue result =
customerNegativeCriterionService.mutate(
operations.toArray(new CustomerNegativeCriterionOperation[operations.size()]));
// Display the results.
for (CustomerNegativeCriterion negativeCriterion : result.getValue()) {
System.out.printf(
"Customer negative criterion with criterion ID %d and type '%s' was added.%n",
negativeCriterion.getCriterion().getId(),
negativeCriterion.getCriterion().getCriterionType());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdWordsServicesInterface",
"adWordsServices",
",",
"AdWordsSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the CustomerNegativeCriterionService.",
"CustomerNegativeCriterionServiceInterface",
"customerNegativeCriteri... | Runs the example.
@param adWordsServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/targeting/AddCustomerNegativeCriteria.java#L117-L162 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/Msvc.java | Msvc.registryGet32StringValue | private static String registryGet32StringValue(com.sun.jna.platform.win32.WinReg.HKEY root, String key, String value)
throws com.sun.jna.platform.win32.Win32Exception {
com.sun.jna.platform.win32.WinReg.HKEYByReference phkKey = new com.sun.jna.platform.win32.WinReg.HKEYByReference();
int rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0,
com.sun.jna.platform.win32.WinNT.KEY_READ | com.sun.jna.platform.win32.WinNT.KEY_WOW64_32KEY, phkKey);
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
try {
return com.sun.jna.platform.win32.Advapi32Util.registryGetStringValue(phkKey.getValue(), value);
} finally {
rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
}
} | java | private static String registryGet32StringValue(com.sun.jna.platform.win32.WinReg.HKEY root, String key, String value)
throws com.sun.jna.platform.win32.Win32Exception {
com.sun.jna.platform.win32.WinReg.HKEYByReference phkKey = new com.sun.jna.platform.win32.WinReg.HKEYByReference();
int rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegOpenKeyEx(root, key, 0,
com.sun.jna.platform.win32.WinNT.KEY_READ | com.sun.jna.platform.win32.WinNT.KEY_WOW64_32KEY, phkKey);
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
try {
return com.sun.jna.platform.win32.Advapi32Util.registryGetStringValue(phkKey.getValue(), value);
} finally {
rc = com.sun.jna.platform.win32.Advapi32.INSTANCE.RegCloseKey(phkKey.getValue());
if (rc != com.sun.jna.platform.win32.W32Errors.ERROR_SUCCESS) {
throw new com.sun.jna.platform.win32.Win32Exception(rc);
}
}
} | [
"private",
"static",
"String",
"registryGet32StringValue",
"(",
"com",
".",
"sun",
".",
"jna",
".",
"platform",
".",
"win32",
".",
"WinReg",
".",
"HKEY",
"root",
",",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"com",
".",
"sun",
".",
"jna",
... | Get a registry REG_SZ value.
@param root Root key.
@param key Registry path.
@param value Name of the value to retrieve.
@return String value. | [
"Get",
"a",
"registry",
"REG_SZ",
"value",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/Msvc.java#L505-L521 |
haraldk/TwelveMonkeys | imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGQuality.java | JPEGQuality.getJPEGQuality | public static float getJPEGQuality(final ImageInputStream input) throws IOException {
return getJPEGQuality(JPEGSegmentUtil.readSegments(input, JPEG.DQT, null));
} | java | public static float getJPEGQuality(final ImageInputStream input) throws IOException {
return getJPEGQuality(JPEGSegmentUtil.readSegments(input, JPEG.DQT, null));
} | [
"public",
"static",
"float",
"getJPEGQuality",
"(",
"final",
"ImageInputStream",
"input",
")",
"throws",
"IOException",
"{",
"return",
"getJPEGQuality",
"(",
"JPEGSegmentUtil",
".",
"readSegments",
"(",
"input",
",",
"JPEG",
".",
"DQT",
",",
"null",
")",
")",
... | Determines an approximate JPEG compression quality value from the quantization tables.
The value will be in the range {@code [0...1]}, where {@code 1} is the best possible value.
@param input an image input stream containing JPEG data.
@return a float in the range {@code [0...1]}, representing the JPEG quality,
or {@code -1} if the quality can't be determined.
@throws IIOException if a JPEG format error is found during parsing.
@throws IOException if an I/O exception occurs during parsing.
@see javax.imageio.plugins.jpeg.JPEGImageWriteParam#setCompressionQuality(float)
@see JPEG#DQT | [
"Determines",
"an",
"approximate",
"JPEG",
"compression",
"quality",
"value",
"from",
"the",
"quantization",
"tables",
".",
"The",
"value",
"will",
"be",
"in",
"the",
"range",
"{",
"@code",
"[",
"0",
"...",
"1",
"]",
"}",
"where",
"{",
"@code",
"1",
"}",... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGQuality.java#L87-L89 |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java | SarlBehaviorUnitBuilderImpl.eInit | public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
setTypeResolutionContext(context);
if (this.sarlBehaviorUnit == null) {
this.container = container;
this.sarlBehaviorUnit = SarlFactory.eINSTANCE.createSarlBehaviorUnit();
this.sarlBehaviorUnit.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
this.sarlBehaviorUnit.setName(newTypeRef(container, name));
container.getMembers().add(this.sarlBehaviorUnit);
}
} | java | public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
setTypeResolutionContext(context);
if (this.sarlBehaviorUnit == null) {
this.container = container;
this.sarlBehaviorUnit = SarlFactory.eINSTANCE.createSarlBehaviorUnit();
this.sarlBehaviorUnit.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
this.sarlBehaviorUnit.setName(newTypeRef(container, name));
container.getMembers().add(this.sarlBehaviorUnit);
}
} | [
"public",
"void",
"eInit",
"(",
"XtendTypeDeclaration",
"container",
",",
"String",
"name",
",",
"IJvmTypeProvider",
"context",
")",
"{",
"setTypeResolutionContext",
"(",
"context",
")",
";",
"if",
"(",
"this",
".",
"sarlBehaviorUnit",
"==",
"null",
")",
"{",
... | Initialize the Ecore element.
@param container the container of the SarlBehaviorUnit.
@param name the type of the SarlBehaviorUnit. | [
"Initialize",
"the",
"Ecore",
"element",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlBehaviorUnitBuilderImpl.java#L65-L74 |
Lucas3oo/jicunit | src/jicunit-framework/src/main/java/org/jicunit/framework/internal/BasicProxyRunner.java | BasicProxyRunner.runChild | @Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(description);
return;
}
notifier.fireTestStarted(description);
String testClassName = getTestClass().getJavaClass().getName();
String testName = description.getDisplayName();
try {
Document result = mClient.runAtServer(mContainerUrl, testClassName, testName);
mClient.processResults(result);
} catch (Throwable e) {
notifier.fireTestFailure(new Failure(description, e));
} finally {
notifier.fireTestFinished(description);
}
} | java | @Override
protected void runChild(FrameworkMethod method, RunNotifier notifier) {
Description description = describeChild(method);
if (method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(description);
return;
}
notifier.fireTestStarted(description);
String testClassName = getTestClass().getJavaClass().getName();
String testName = description.getDisplayName();
try {
Document result = mClient.runAtServer(mContainerUrl, testClassName, testName);
mClient.processResults(result);
} catch (Throwable e) {
notifier.fireTestFailure(new Failure(description, e));
} finally {
notifier.fireTestFinished(description);
}
} | [
"@",
"Override",
"protected",
"void",
"runChild",
"(",
"FrameworkMethod",
"method",
",",
"RunNotifier",
"notifier",
")",
"{",
"Description",
"description",
"=",
"describeChild",
"(",
"method",
")",
";",
"if",
"(",
"method",
".",
"getAnnotation",
"(",
"Ignore",
... | This method will be called for the set of methods annotated with
Before/Test/After. | [
"This",
"method",
"will",
"be",
"called",
"for",
"the",
"set",
"of",
"methods",
"annotated",
"with",
"Before",
"/",
"Test",
"/",
"After",
"."
] | train | https://github.com/Lucas3oo/jicunit/blob/1ed41891ccf8e5c6068c6b544d214280bb93945b/src/jicunit-framework/src/main/java/org/jicunit/framework/internal/BasicProxyRunner.java#L60-L81 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java | ServerDnsAliasesInner.beginCreateOrUpdate | public ServerDnsAliasInner beginCreateOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body();
} | java | public ServerDnsAliasInner beginCreateOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).toBlocking().single().body();
} | [
"public",
"ServerDnsAliasInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"dnsAliasName",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"dnsA... | Creates a server dns alias.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server that the alias is pointing to.
@param dnsAliasName The name of the server DNS alias.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServerDnsAliasInner object if successful. | [
"Creates",
"a",
"server",
"dns",
"alias",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L283-L285 |
bwkimmel/java-util | src/main/java/ca/eandb/util/StringUtil.java | StringUtil.hexToByte | public static byte hexToByte(char hex) {
if ('0' <= hex && hex <= '9') {
return (byte) (hex - '0');
} else if ('A' <= hex && hex <= 'F') {
return (byte) (10 + hex - 'A');
} else if ('a' <= hex && hex <= 'f') {
return (byte) (10 + hex - 'a');
} else {
throw new IllegalArgumentException(String.format("'%c' is not a hexadecimal digit.", hex));
}
} | java | public static byte hexToByte(char hex) {
if ('0' <= hex && hex <= '9') {
return (byte) (hex - '0');
} else if ('A' <= hex && hex <= 'F') {
return (byte) (10 + hex - 'A');
} else if ('a' <= hex && hex <= 'f') {
return (byte) (10 + hex - 'a');
} else {
throw new IllegalArgumentException(String.format("'%c' is not a hexadecimal digit.", hex));
}
} | [
"public",
"static",
"byte",
"hexToByte",
"(",
"char",
"hex",
")",
"{",
"if",
"(",
"'",
"'",
"<=",
"hex",
"&&",
"hex",
"<=",
"'",
"'",
")",
"{",
"return",
"(",
"byte",
")",
"(",
"hex",
"-",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"'",
"'... | Converts a hexadecimal digit to a byte.
@param hex The hexadecimal digit.
@return The byte value corresponding to <code>hex</code>. | [
"Converts",
"a",
"hexadecimal",
"digit",
"to",
"a",
"byte",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/StringUtil.java#L86-L96 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java | SuperPositions.getRmsd | public static double getRmsd(Point3d[] fixed, Point3d[] moved) {
superposer.setCentered(false);
return superposer.getRmsd(fixed, moved);
} | java | public static double getRmsd(Point3d[] fixed, Point3d[] moved) {
superposer.setCentered(false);
return superposer.getRmsd(fixed, moved);
} | [
"public",
"static",
"double",
"getRmsd",
"(",
"Point3d",
"[",
"]",
"fixed",
",",
"Point3d",
"[",
"]",
"moved",
")",
"{",
"superposer",
".",
"setCentered",
"(",
"false",
")",
";",
"return",
"superposer",
".",
"getRmsd",
"(",
"fixed",
",",
"moved",
")",
... | Use the {@link SuperPosition#getRmsd(Point3d[], Point3d[])} method of the
default static SuperPosition algorithm contained in this Class. | [
"Use",
"the",
"{"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java#L89-L92 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/TapClient.java | TapClient.tapCustom | public TapStream tapCustom(final String id, final RequestMessage message)
throws ConfigurationException, IOException {
final TapConnectionProvider conn = new TapConnectionProvider(addrs);
final TapStream ts = new TapStream();
conn.broadcastOp(new BroadcastOpFactory() {
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
Operation op = conn.getOpFactory().tapCustom(id, message,
new TapOperation.Callback() {
public void receivedStatus(OperationStatus status) {
}
public void gotData(ResponseMessage tapMessage) {
rqueue.add(tapMessage);
messagesRead++;
}
public void gotAck(MemcachedNode node, TapOpcode opcode,
int opaque) {
rqueue.add(new TapAck(conn, node, opcode, opaque, this));
}
public void complete() {
latch.countDown();
}
});
ts.addOp((TapOperation)op);
return op;
}
});
synchronized (omap) {
omap.put(ts, conn);
}
return ts;
} | java | public TapStream tapCustom(final String id, final RequestMessage message)
throws ConfigurationException, IOException {
final TapConnectionProvider conn = new TapConnectionProvider(addrs);
final TapStream ts = new TapStream();
conn.broadcastOp(new BroadcastOpFactory() {
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
Operation op = conn.getOpFactory().tapCustom(id, message,
new TapOperation.Callback() {
public void receivedStatus(OperationStatus status) {
}
public void gotData(ResponseMessage tapMessage) {
rqueue.add(tapMessage);
messagesRead++;
}
public void gotAck(MemcachedNode node, TapOpcode opcode,
int opaque) {
rqueue.add(new TapAck(conn, node, opcode, opaque, this));
}
public void complete() {
latch.countDown();
}
});
ts.addOp((TapOperation)op);
return op;
}
});
synchronized (omap) {
omap.put(ts, conn);
}
return ts;
} | [
"public",
"TapStream",
"tapCustom",
"(",
"final",
"String",
"id",
",",
"final",
"RequestMessage",
"message",
")",
"throws",
"ConfigurationException",
",",
"IOException",
"{",
"final",
"TapConnectionProvider",
"conn",
"=",
"new",
"TapConnectionProvider",
"(",
"addrs",
... | Allows the user to specify a custom tap message.
@param id the named tap id that can be used to resume a disconnected tap
stream
@param message the custom tap message that will be used to initiate the tap
stream.
@return the operation that controls the tap stream.
@throws ConfigurationException a bad configuration was received from the
memcached cluster.
@throws IOException if there are errors connecting to the cluster. | [
"Allows",
"the",
"user",
"to",
"specify",
"a",
"custom",
"tap",
"message",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/TapClient.java#L166-L197 |
dbracewell/mango | src/main/java/com/davidbracewell/io/Resources.java | Resources.temporaryFile | public static Resource temporaryFile(String name, String extension) throws IOException {
return new FileResource(File.createTempFile(name, extension));
} | java | public static Resource temporaryFile(String name, String extension) throws IOException {
return new FileResource(File.createTempFile(name, extension));
} | [
"public",
"static",
"Resource",
"temporaryFile",
"(",
"String",
"name",
",",
"String",
"extension",
")",
"throws",
"IOException",
"{",
"return",
"new",
"FileResource",
"(",
"File",
".",
"createTempFile",
"(",
"name",
",",
"extension",
")",
")",
";",
"}"
] | Creates a resource wrapping a temporary file
@param name The file name
@param extension The file extension
@return The resource representing the temporary file
@throws IOException the io exception | [
"Creates",
"a",
"resource",
"wrapping",
"a",
"temporary",
"file"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/io/Resources.java#L270-L272 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getHierarchicalEntityRolesAsync | public Observable<List<EntityRole>> getHierarchicalEntityRolesAsync(UUID appId, String versionId, UUID hEntityId) {
return getHierarchicalEntityRolesWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() {
@Override
public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) {
return response.body();
}
});
} | java | public Observable<List<EntityRole>> getHierarchicalEntityRolesAsync(UUID appId, String versionId, UUID hEntityId) {
return getHierarchicalEntityRolesWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() {
@Override
public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"EntityRole",
">",
">",
"getHierarchicalEntityRolesAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
")",
"{",
"return",
"getHierarchicalEntityRolesWithServiceResponseAsync",
"(",
"appId",
","... | Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EntityRole> object | [
"Get",
"All",
"Entity",
"Roles",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9366-L9373 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.collectMany | public static <T,K,V> Collection<T> collectMany(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<Collection<? extends T>> projection) {
return collectMany(self, new ArrayList<T>(), projection);
} | java | public static <T,K,V> Collection<T> collectMany(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<Collection<? extends T>> projection) {
return collectMany(self, new ArrayList<T>(), projection);
} | [
"public",
"static",
"<",
"T",
",",
"K",
",",
"V",
">",
"Collection",
"<",
"T",
">",
"collectMany",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"MapEntryOrKeyValue",
".",
"class",
")",
"Closure",
"<",
"Collection",
"<"... | Projects each item from a source map to a result collection and concatenates (flattens) the resulting
collections adding them into a collection.
<p>
<pre class="groovyTestCase">
def map = [bread:3, milk:5, butter:2]
def result = map.collectMany{ k, v {@code ->} k.startsWith('b') ? k.toList() : [] }
assert result == ['b', 'r', 'e', 'a', 'd', 'b', 'u', 't', 't', 'e', 'r']
</pre>
@param self a map
@param projection a projecting Closure returning a collection of items
@return the collector with the projected collections concatenated (flattened) to it
@since 1.8.8 | [
"Projects",
"each",
"item",
"from",
"a",
"source",
"map",
"to",
"a",
"result",
"collection",
"and",
"concatenates",
"(",
"flattens",
")",
"the",
"resulting",
"collections",
"adding",
"them",
"into",
"a",
"collection",
".",
"<p",
">",
"<pre",
"class",
"=",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3872-L3874 |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/Multinomials.java | Multinomials.klDivergence | public static double klDivergence(double[] p, double[] q) {
if (p.length != q.length) {
throw new IllegalStateException("The length of p and q must be the same.");
}
double delta = 1e-8;
if (!Multinomials.isMultinomial(p, delta)) {
throw new IllegalStateException("p is not a multinomial");
}
if (!Multinomials.isMultinomial(q, delta)) {
throw new IllegalStateException("q is not a multinomial");
}
double kl = 0.0;
for (int i=0; i<p.length; i++) {
if (p[i] == 0.0 || q[i] == 0.0) {
continue;
}
kl += p[i] * FastMath.log(p[i] / q[i]);
}
return kl;
} | java | public static double klDivergence(double[] p, double[] q) {
if (p.length != q.length) {
throw new IllegalStateException("The length of p and q must be the same.");
}
double delta = 1e-8;
if (!Multinomials.isMultinomial(p, delta)) {
throw new IllegalStateException("p is not a multinomial");
}
if (!Multinomials.isMultinomial(q, delta)) {
throw new IllegalStateException("q is not a multinomial");
}
double kl = 0.0;
for (int i=0; i<p.length; i++) {
if (p[i] == 0.0 || q[i] == 0.0) {
continue;
}
kl += p[i] * FastMath.log(p[i] / q[i]);
}
return kl;
} | [
"public",
"static",
"double",
"klDivergence",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"if",
"(",
"p",
".",
"length",
"!=",
"q",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The length of p and q ... | Gets the KL divergence between two multinomial distributions p and q.
@param p Array representing a multinomial distribution, p.
@param q Array representing a multinomial distribution, q.
@return KL(p || q) | [
"Gets",
"the",
"KL",
"divergence",
"between",
"two",
"multinomial",
"distributions",
"p",
"and",
"q",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/Multinomials.java#L131-L151 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/IoUtils.java | IoUtils.copyStream | public static void copyStream(InputStream is, OutputStream os) throws IOException {
copyStream(is, os, DEFAULT_BUFFER_SIZE);
} | java | public static void copyStream(InputStream is, OutputStream os) throws IOException {
copyStream(is, os, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"copyStream",
"(",
"is",
",",
"os",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | Copy input stream to output stream without closing streams. Flushes output stream when done.
@param is input stream
@param os output stream
@throws IOException for any error | [
"Copy",
"input",
"stream",
"to",
"output",
"stream",
"without",
"closing",
"streams",
".",
"Flushes",
"output",
"stream",
"when",
"done",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/IoUtils.java#L80-L82 |
aol/cyclops | cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/traits/future/operators/LazyFutureStreamUtils.java | LazyFutureStreamUtils.forEachX | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachX(
final FutureStream<T> stream, final long x, final Consumer<? super T> consumerElement) {
final CompletableFuture<Subscription> subscription = new CompletableFuture<>();
final CompletableFuture<Boolean> streamCompleted = new CompletableFuture<>();
return tuple(subscription, () -> {
stream.subscribe(new Subscriber<T>() {
@Override
public void onSubscribe(final Subscription s) {
Objects.requireNonNull(s);
if(x!=0)
s.request(x);
subscription.complete(s);
}
@Override
public void onNext(final T t) {
consumerElement.accept(t);
}
@Override
public void onError(final Throwable t) {
}
@Override
public void onComplete() {
streamCompleted.complete(true);
}
});
} , streamCompleted);
} | java | public static <T, X extends Throwable> Tuple3<CompletableFuture<Subscription>, Runnable, CompletableFuture<Boolean>> forEachX(
final FutureStream<T> stream, final long x, final Consumer<? super T> consumerElement) {
final CompletableFuture<Subscription> subscription = new CompletableFuture<>();
final CompletableFuture<Boolean> streamCompleted = new CompletableFuture<>();
return tuple(subscription, () -> {
stream.subscribe(new Subscriber<T>() {
@Override
public void onSubscribe(final Subscription s) {
Objects.requireNonNull(s);
if(x!=0)
s.request(x);
subscription.complete(s);
}
@Override
public void onNext(final T t) {
consumerElement.accept(t);
}
@Override
public void onError(final Throwable t) {
}
@Override
public void onComplete() {
streamCompleted.complete(true);
}
});
} , streamCompleted);
} | [
"public",
"static",
"<",
"T",
",",
"X",
"extends",
"Throwable",
">",
"Tuple3",
"<",
"CompletableFuture",
"<",
"Subscription",
">",
",",
"Runnable",
",",
"CompletableFuture",
"<",
"Boolean",
">",
">",
"forEachX",
"(",
"final",
"FutureStream",
"<",
"T",
">",
... | Perform a forEach operation over the Stream, without closing it, consuming only the specified number of elements from
the Stream, at this time. More elements can be consumed later, by called request on the returned Subscription
<pre>
@{code
Subscription next = StreamUtils.forEach(Stream.of(1,2,3,4),2,System.out::println);
System.out.println("First batch processed!");
next.request(2);
System.out.println("Second batch processed!");
//prints
1
2
First batch processed!
3
4
Second batch processed!
}
</pre>
@param stream - the Stream to consume data from
@param x To consume from the Stream at this time
@param consumerElement To accept incoming events from the Stream
@return Subscription so that further processing can be continued or cancelled. | [
"Perform",
"a",
"forEach",
"operation",
"over",
"the",
"Stream",
"without",
"closing",
"it",
"consuming",
"only",
"the",
"specified",
"number",
"of",
"elements",
"from",
"the",
"Stream",
"at",
"this",
"time",
".",
"More",
"elements",
"can",
"be",
"consumed",
... | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/com/oath/cyclops/internal/react/stream/traits/future/operators/LazyFutureStreamUtils.java#L45-L79 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntry.java | MapEntry.isInitialized | private static <V> boolean isInitialized(Metadata metadata, V value) {
if (metadata.valueType.getJavaType() == WireFormat.JavaType.MESSAGE) {
return value != null;
}
return true;
} | java | private static <V> boolean isInitialized(Metadata metadata, V value) {
if (metadata.valueType.getJavaType() == WireFormat.JavaType.MESSAGE) {
return value != null;
}
return true;
} | [
"private",
"static",
"<",
"V",
">",
"boolean",
"isInitialized",
"(",
"Metadata",
"metadata",
",",
"V",
"value",
")",
"{",
"if",
"(",
"metadata",
".",
"valueType",
".",
"getJavaType",
"(",
")",
"==",
"WireFormat",
".",
"JavaType",
".",
"MESSAGE",
")",
"{"... | Checks if is initialized.
@param <V> the value type
@param metadata the metadata
@param value the value
@return true, if is initialized | [
"Checks",
"if",
"is",
"initialized",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntry.java#L637-L642 |
playn/playn | robovm/src/playn/robovm/RoboFont.java | RoboFont.registerVariant | public static void registerVariant(String name, Style style, String variantName) {
Map<String,String> styleVariants = _variants.get(style);
if (styleVariants == null) {
_variants.put(style, styleVariants = new HashMap<String,String>());
}
styleVariants.put(name, variantName);
} | java | public static void registerVariant(String name, Style style, String variantName) {
Map<String,String> styleVariants = _variants.get(style);
if (styleVariants == null) {
_variants.put(style, styleVariants = new HashMap<String,String>());
}
styleVariants.put(name, variantName);
} | [
"public",
"static",
"void",
"registerVariant",
"(",
"String",
"name",
",",
"Style",
"style",
",",
"String",
"variantName",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"styleVariants",
"=",
"_variants",
".",
"get",
"(",
"style",
")",
";",
"if",
"(... | Registers a font for use when a bold, italic or bold italic variant is requested. iOS does not
programmatically generate bold, italic and bold italic variants of fonts. Instead it uses the
actual bold, italic or bold italic variant of the font provided by the original designer.
<p> The built-in iOS fonts (Helvetica, Courier) have already had their variants mapped, but if
you add custom fonts to your game, you will need to register variants for the bold, italic or
bold italic versions if you intend to make use of them. </p>
<p> Alternatively, you can simply request a font variant by name (e.g. {@code
graphics().createFont("Arial Bold Italic", Font.Style.PLAIN, 16)}) to use a specific font
variant directly. This variant mapping process exists only to simplify cross-platform
development. </p> | [
"Registers",
"a",
"font",
"for",
"use",
"when",
"a",
"bold",
"italic",
"or",
"bold",
"italic",
"variant",
"is",
"requested",
".",
"iOS",
"does",
"not",
"programmatically",
"generate",
"bold",
"italic",
"and",
"bold",
"italic",
"variants",
"of",
"fonts",
".",... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/robovm/src/playn/robovm/RoboFont.java#L41-L47 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.findAllGroup0 | public static List<String> findAllGroup0(String regex, CharSequence content) {
return findAll(regex, content, 0);
} | java | public static List<String> findAllGroup0(String regex, CharSequence content) {
return findAll(regex, content, 0);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"findAllGroup0",
"(",
"String",
"regex",
",",
"CharSequence",
"content",
")",
"{",
"return",
"findAll",
"(",
"regex",
",",
"content",
",",
"0",
")",
";",
"}"
] | 取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容
@param regex 正则
@param content 被查找的内容
@return 结果列表
@since 3.1.2 | [
"取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L363-L365 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.getLastRefreshDate | public static Date getLastRefreshDate(Bundle bundle) {
Validate.notNull(bundle, "bundle");
return getDate(bundle, LAST_REFRESH_DATE_KEY);
} | java | public static Date getLastRefreshDate(Bundle bundle) {
Validate.notNull(bundle, "bundle");
return getDate(bundle, LAST_REFRESH_DATE_KEY);
} | [
"public",
"static",
"Date",
"getLastRefreshDate",
"(",
"Bundle",
"bundle",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"return",
"getDate",
"(",
"bundle",
",",
"LAST_REFRESH_DATE_KEY",
")",
";",
"}"
] | Gets the cached last refresh date from a Bundle.
@param bundle
A Bundle in which the last refresh date was stored.
@return the cached last refresh Date, or null.
@throws NullPointerException if the passed in Bundle is null | [
"Gets",
"the",
"cached",
"last",
"refresh",
"date",
"from",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L342-L345 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.storeBugCollection | public static void storeBugCollection(IProject project, final SortedBugCollection bugCollection, IProgressMonitor monitor)
throws IOException, CoreException {
// Store the bug collection and findbugs project in the session
project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugCollection);
if (bugCollection != null) {
writeBugCollection(project, bugCollection, monitor);
}
} | java | public static void storeBugCollection(IProject project, final SortedBugCollection bugCollection, IProgressMonitor monitor)
throws IOException, CoreException {
// Store the bug collection and findbugs project in the session
project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugCollection);
if (bugCollection != null) {
writeBugCollection(project, bugCollection, monitor);
}
} | [
"public",
"static",
"void",
"storeBugCollection",
"(",
"IProject",
"project",
",",
"final",
"SortedBugCollection",
"bugCollection",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"IOException",
",",
"CoreException",
"{",
"// Store the bug collection and findbugs project i... | Store a new bug collection for a project. The collection is stored in the
session, and also in a file in the project.
@param project
the project
@param bugCollection
the bug collection
@param monitor
progress monitor
@throws IOException
@throws CoreException | [
"Store",
"a",
"new",
"bug",
"collection",
"for",
"a",
"project",
".",
"The",
"collection",
"is",
"stored",
"in",
"the",
"session",
"and",
"also",
"in",
"a",
"file",
"in",
"the",
"project",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L744-L753 |
VoltDB/voltdb | src/frontend/org/voltdb/PostgreSQLBackend.java | PostgreSQLBackend.numOccurencesOfCharIn | static private int numOccurencesOfCharIn(String str, char ch) {
boolean inMiddleOfQuote = false;
int num = 0, previousIndex = 0;
for (int index = str.indexOf(ch); index >= 0 ; index = str.indexOf(ch, index+1)) {
if (hasOddNumberOfSingleQuotes(str.substring(previousIndex, index))) {
inMiddleOfQuote = !inMiddleOfQuote;
}
if (!inMiddleOfQuote) {
num++;
}
previousIndex = index;
}
return num;
} | java | static private int numOccurencesOfCharIn(String str, char ch) {
boolean inMiddleOfQuote = false;
int num = 0, previousIndex = 0;
for (int index = str.indexOf(ch); index >= 0 ; index = str.indexOf(ch, index+1)) {
if (hasOddNumberOfSingleQuotes(str.substring(previousIndex, index))) {
inMiddleOfQuote = !inMiddleOfQuote;
}
if (!inMiddleOfQuote) {
num++;
}
previousIndex = index;
}
return num;
} | [
"static",
"private",
"int",
"numOccurencesOfCharIn",
"(",
"String",
"str",
",",
"char",
"ch",
")",
"{",
"boolean",
"inMiddleOfQuote",
"=",
"false",
";",
"int",
"num",
"=",
"0",
",",
"previousIndex",
"=",
"0",
";",
"for",
"(",
"int",
"index",
"=",
"str",
... | Returns the number of occurrences of the specified character in the
specified String, but ignoring those contained in single quotes. | [
"Returns",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"specified",
"character",
"in",
"the",
"specified",
"String",
"but",
"ignoring",
"those",
"contained",
"in",
"single",
"quotes",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/PostgreSQLBackend.java#L649-L662 |
meertensinstituut/mtas | src/main/java/mtas/codec/tree/MtasRBTree.java | MtasRBTree.addRange | private MtasRBTreeNode addRange(MtasRBTreeNode n, Integer left, Integer right,
int additionalId, long additionalRef, Integer id, Long ref) {
MtasRBTreeNode localN = n;
if (localN == null) {
String key = left.toString() + "_" + right.toString();
localN = new MtasRBTreeNode(left, right, MtasRBTreeNode.RED, 1);
localN.addIdAndRef(id, ref, additionalId, additionalRef);
index.put(key, localN);
} else {
if (left <= localN.left) {
localN.leftChild = addRange(localN.leftChild, left, right, additionalId,
additionalRef, id, ref);
updateMax(localN, localN.leftChild);
} else {
localN.rightChild = addRange(localN.rightChild, left, right,
additionalId, additionalRef, id, ref);
updateMax(localN, localN.rightChild);
}
if (isRed(localN.rightChild) && !isRed(localN.leftChild)) {
localN = rotateLeft(localN);
}
if (isRed(localN.leftChild) && isRed(localN.leftChild.leftChild)) {
localN = rotateRight(localN);
}
if (isRed(localN.leftChild) && isRed(localN.rightChild)) {
flipColors(localN);
}
localN.n = size(localN.leftChild) + size(localN.rightChild) + 1;
}
return localN;
} | java | private MtasRBTreeNode addRange(MtasRBTreeNode n, Integer left, Integer right,
int additionalId, long additionalRef, Integer id, Long ref) {
MtasRBTreeNode localN = n;
if (localN == null) {
String key = left.toString() + "_" + right.toString();
localN = new MtasRBTreeNode(left, right, MtasRBTreeNode.RED, 1);
localN.addIdAndRef(id, ref, additionalId, additionalRef);
index.put(key, localN);
} else {
if (left <= localN.left) {
localN.leftChild = addRange(localN.leftChild, left, right, additionalId,
additionalRef, id, ref);
updateMax(localN, localN.leftChild);
} else {
localN.rightChild = addRange(localN.rightChild, left, right,
additionalId, additionalRef, id, ref);
updateMax(localN, localN.rightChild);
}
if (isRed(localN.rightChild) && !isRed(localN.leftChild)) {
localN = rotateLeft(localN);
}
if (isRed(localN.leftChild) && isRed(localN.leftChild.leftChild)) {
localN = rotateRight(localN);
}
if (isRed(localN.leftChild) && isRed(localN.rightChild)) {
flipColors(localN);
}
localN.n = size(localN.leftChild) + size(localN.rightChild) + 1;
}
return localN;
} | [
"private",
"MtasRBTreeNode",
"addRange",
"(",
"MtasRBTreeNode",
"n",
",",
"Integer",
"left",
",",
"Integer",
"right",
",",
"int",
"additionalId",
",",
"long",
"additionalRef",
",",
"Integer",
"id",
",",
"Long",
"ref",
")",
"{",
"MtasRBTreeNode",
"localN",
"=",... | Adds the range.
@param n the n
@param left the left
@param right the right
@param additionalId the additional id
@param additionalRef the additional ref
@param id the id
@param ref the ref
@return the mtas RB tree node | [
"Adds",
"the",
"range",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/tree/MtasRBTree.java#L86-L116 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java | PathManagerService.addRelativePathService | final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path,
final boolean possiblyAbsolute, final String relativeTo) {
if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) {
return addAbsolutePathService(serviceTarget, pathName, path);
} else {
return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget);
}
} | java | final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path,
final boolean possiblyAbsolute, final String relativeTo) {
if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) {
return addAbsolutePathService(serviceTarget, pathName, path);
} else {
return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget);
}
} | [
"final",
"ServiceController",
"<",
"?",
">",
"addRelativePathService",
"(",
"final",
"ServiceTarget",
"serviceTarget",
",",
"final",
"String",
"pathName",
",",
"final",
"String",
"path",
",",
"final",
"boolean",
"possiblyAbsolute",
",",
"final",
"String",
"relativeT... | Install an {@code Service<String>} for the given path.
@param serviceTarget the service target associated with the management operation making this request. Cannot be {@code null}
@param pathName the name of the relevant path. Cannot be {@code null}
@param path the value of the path within the model. This is either an absolute path or
the relative portion of the path. Cannot be {@code null}
@param possiblyAbsolute {@code true} if the path may be absolute and a check should be performed before installing
a service variant that depends on the service associated with {@code relativeTo}
@param relativeTo the name of the path this path is relative to. If {@code null} this is an absolute path
@return the service controller for the {@code Service<String>} | [
"Install",
"an",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L273-L280 |
duracloud/duracloud | storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java | StorageProviderUtil.contains | public static boolean contains(Iterator<String> iterator, String value) {
if (iterator == null || value == null) {
return false;
}
while (iterator.hasNext()) {
if (value.equals(iterator.next())) {
return true;
}
}
return false;
} | java | public static boolean contains(Iterator<String> iterator, String value) {
if (iterator == null || value == null) {
return false;
}
while (iterator.hasNext()) {
if (value.equals(iterator.next())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"contains",
"(",
"Iterator",
"<",
"String",
">",
"iterator",
",",
"String",
"value",
")",
"{",
"if",
"(",
"iterator",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"while",
"(",
"iterat... | Determines if a String value is included in a Iterated list.
The iteration is only run as far as necessary to determine
if the value is included in the underlying list.
@param iterator
@param value
@return | [
"Determines",
"if",
"a",
"String",
"value",
"is",
"included",
"in",
"a",
"Iterated",
"list",
".",
"The",
"iteration",
"is",
"only",
"run",
"as",
"far",
"as",
"necessary",
"to",
"determine",
"if",
"the",
"value",
"is",
"included",
"in",
"the",
"underlying",... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java#L165-L175 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.asType | public static <T> T asType(CharSequence self, Class<T> c) {
return asType(self.toString(), c);
} | java | public static <T> T asType(CharSequence self, Class<T> c) {
return asType(self.toString(), c);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"CharSequence",
"self",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"return",
"asType",
"(",
"self",
".",
"toString",
"(",
")",
",",
"c",
")",
";",
"}"
] | <p>Provides a method to perform custom 'dynamic' type conversion
to the given class using the <code>as</code> operator.
@param self a CharSequence
@param c the desired class
@return the converted object
@see #asType(String, Class)
@since 1.8.2 | [
"<p",
">",
"Provides",
"a",
"method",
"to",
"perform",
"custom",
"dynamic",
"type",
"conversion",
"to",
"the",
"given",
"class",
"using",
"the",
"<code",
">",
"as<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L139-L141 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/LABInitialMeans.java | LABInitialMeans.getMinDist | protected static double getMinDist(DBIDArrayIter j, DistanceQuery<?> distQ, DBIDArrayIter mi, WritableDoubleDataStore mindist) {
double prev = mindist.doubleValue(j);
if(Double.isNaN(prev)) { // NaN = unknown
prev = Double.POSITIVE_INFINITY;
for(mi.seek(0); mi.valid(); mi.advance()) {
double d = distQ.distance(j, mi);
prev = d < prev ? d : prev;
}
mindist.putDouble(j, prev);
}
return prev;
} | java | protected static double getMinDist(DBIDArrayIter j, DistanceQuery<?> distQ, DBIDArrayIter mi, WritableDoubleDataStore mindist) {
double prev = mindist.doubleValue(j);
if(Double.isNaN(prev)) { // NaN = unknown
prev = Double.POSITIVE_INFINITY;
for(mi.seek(0); mi.valid(); mi.advance()) {
double d = distQ.distance(j, mi);
prev = d < prev ? d : prev;
}
mindist.putDouble(j, prev);
}
return prev;
} | [
"protected",
"static",
"double",
"getMinDist",
"(",
"DBIDArrayIter",
"j",
",",
"DistanceQuery",
"<",
"?",
">",
"distQ",
",",
"DBIDArrayIter",
"mi",
",",
"WritableDoubleDataStore",
"mindist",
")",
"{",
"double",
"prev",
"=",
"mindist",
".",
"doubleValue",
"(",
... | Get the minimum distance to previous medoids.
@param j current object
@param distQ distance query
@param mi medoid iterator
@param mindist distance storage
@return minimum distance | [
"Get",
"the",
"minimum",
"distance",
"to",
"previous",
"medoids",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/LABInitialMeans.java#L214-L225 |
apache/spark | sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java | ThriftHttpServlet.doKerberosAuth | private String doKerberosAuth(HttpServletRequest request)
throws HttpAuthenticationException {
// Try authenticating with the http/_HOST principal
if (httpUGI != null) {
try {
return httpUGI.doAs(new HttpKerberosServerAction(request, httpUGI));
} catch (Exception e) {
LOG.info("Failed to authenticate with http/_HOST kerberos principal, " +
"trying with hive/_HOST kerberos principal");
}
}
// Now try with hive/_HOST principal
try {
return serviceUGI.doAs(new HttpKerberosServerAction(request, serviceUGI));
} catch (Exception e) {
LOG.error("Failed to authenticate with hive/_HOST kerberos principal");
throw new HttpAuthenticationException(e);
}
} | java | private String doKerberosAuth(HttpServletRequest request)
throws HttpAuthenticationException {
// Try authenticating with the http/_HOST principal
if (httpUGI != null) {
try {
return httpUGI.doAs(new HttpKerberosServerAction(request, httpUGI));
} catch (Exception e) {
LOG.info("Failed to authenticate with http/_HOST kerberos principal, " +
"trying with hive/_HOST kerberos principal");
}
}
// Now try with hive/_HOST principal
try {
return serviceUGI.doAs(new HttpKerberosServerAction(request, serviceUGI));
} catch (Exception e) {
LOG.error("Failed to authenticate with hive/_HOST kerberos principal");
throw new HttpAuthenticationException(e);
}
} | [
"private",
"String",
"doKerberosAuth",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"HttpAuthenticationException",
"{",
"// Try authenticating with the http/_HOST principal",
"if",
"(",
"httpUGI",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"httpUGI",
".",
"do... | Do the GSS-API kerberos authentication.
We already have a logged in subject in the form of serviceUGI,
which GSS-API will extract information from.
In case of a SPNego request we use the httpUGI,
for the authenticating service tickets.
@param request
@return
@throws HttpAuthenticationException | [
"Do",
"the",
"GSS",
"-",
"API",
"kerberos",
"authentication",
".",
"We",
"already",
"have",
"a",
"logged",
"in",
"subject",
"in",
"the",
"form",
"of",
"serviceUGI",
"which",
"GSS",
"-",
"API",
"will",
"extract",
"information",
"from",
".",
"In",
"case",
... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L344-L363 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/NumberUtils.java | NumberUtils.parseNumber | public static <T extends Number> T parseNumber(String text, Class<T> targetClass, NumberFormat numberFormat) {
if (numberFormat != null) {
Assert.notNull(text, "Text must not be null");
Assert.notNull(targetClass, "Target class must not be null");
DecimalFormat decimalFormat = null;
boolean resetBigDecimal = false;
if (numberFormat instanceof DecimalFormat) {
decimalFormat = (DecimalFormat) numberFormat;
if (BigDecimal.class.equals(targetClass) && !decimalFormat.isParseBigDecimal()) {
decimalFormat.setParseBigDecimal(true);
resetBigDecimal = true;
}
}
try {
Number number = numberFormat.parse(StringUtils.trimAllWhitespace(text));
return convertNumberToTargetClass(number, targetClass);
}
catch (ParseException ex) {
throw new IllegalArgumentException("Could not parse number: " + ex.getMessage());
}
finally {
if (resetBigDecimal) {
decimalFormat.setParseBigDecimal(false);
}
}
}
else {
return parseNumber(text, targetClass);
}
} | java | public static <T extends Number> T parseNumber(String text, Class<T> targetClass, NumberFormat numberFormat) {
if (numberFormat != null) {
Assert.notNull(text, "Text must not be null");
Assert.notNull(targetClass, "Target class must not be null");
DecimalFormat decimalFormat = null;
boolean resetBigDecimal = false;
if (numberFormat instanceof DecimalFormat) {
decimalFormat = (DecimalFormat) numberFormat;
if (BigDecimal.class.equals(targetClass) && !decimalFormat.isParseBigDecimal()) {
decimalFormat.setParseBigDecimal(true);
resetBigDecimal = true;
}
}
try {
Number number = numberFormat.parse(StringUtils.trimAllWhitespace(text));
return convertNumberToTargetClass(number, targetClass);
}
catch (ParseException ex) {
throw new IllegalArgumentException("Could not parse number: " + ex.getMessage());
}
finally {
if (resetBigDecimal) {
decimalFormat.setParseBigDecimal(false);
}
}
}
else {
return parseNumber(text, targetClass);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"T",
"parseNumber",
"(",
"String",
"text",
",",
"Class",
"<",
"T",
">",
"targetClass",
",",
"NumberFormat",
"numberFormat",
")",
"{",
"if",
"(",
"numberFormat",
"!=",
"null",
")",
"{",
"Assert",
"."... | Parse the given text into a number instance of the given target class,
using the given NumberFormat. Trims the input {@code String}
before attempting to parse the number.
@param text the text to convert
@param targetClass the target class to parse into
@param numberFormat the NumberFormat to use for parsing (if {@code null},
this method falls back to {@code parseNumber(String, Class)})
@return the parsed number
@throws IllegalArgumentException if the target class is not supported
(i.e. not a standard Number subclass as included in the JDK)
@see java.text.NumberFormat#parse
@see #convertNumberToTargetClass
@see #parseNumber(String, Class) | [
"Parse",
"the",
"given",
"text",
"into",
"a",
"number",
"instance",
"of",
"the",
"given",
"target",
"class",
"using",
"the",
"given",
"NumberFormat",
".",
"Trims",
"the",
"input",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/NumberUtils.java#L193-L222 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/range/ZonedDateTimeRangeRandomizer.java | ZonedDateTimeRangeRandomizer.aNewZonedDateTimeRangeRandomizer | public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max, final long seed) {
return new ZonedDateTimeRangeRandomizer(min, max, seed);
} | java | public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max, final long seed) {
return new ZonedDateTimeRangeRandomizer(min, max, seed);
} | [
"public",
"static",
"ZonedDateTimeRangeRandomizer",
"aNewZonedDateTimeRangeRandomizer",
"(",
"final",
"ZonedDateTime",
"min",
",",
"final",
"ZonedDateTime",
"max",
",",
"final",
"long",
"seed",
")",
"{",
"return",
"new",
"ZonedDateTimeRangeRandomizer",
"(",
"min",
",",
... | Create a new {@link ZonedDateTimeRangeRandomizer}.
@param min min value
@param max max value
@param seed initial seed
@return a new {@link ZonedDateTimeRangeRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"ZonedDateTimeRangeRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/ZonedDateTimeRangeRandomizer.java#L76-L78 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java | ActivityUtils.launchActivity | public static void launchActivity(Activity context, Class<? extends Activity> activity, boolean closeCurrentActivity, Map<String, String> params) {
Intent intent = new Intent(context, activity);
if (params != null) {
Bundle bundle = new Bundle();
for (Entry<String, String> param : params.entrySet()) {
bundle.putString(param.getKey(), param.getValue());
}
intent.putExtras(bundle);
}
context.startActivity(intent);
if (closeCurrentActivity) {
context.finish();
}
} | java | public static void launchActivity(Activity context, Class<? extends Activity> activity, boolean closeCurrentActivity, Map<String, String> params) {
Intent intent = new Intent(context, activity);
if (params != null) {
Bundle bundle = new Bundle();
for (Entry<String, String> param : params.entrySet()) {
bundle.putString(param.getKey(), param.getValue());
}
intent.putExtras(bundle);
}
context.startActivity(intent);
if (closeCurrentActivity) {
context.finish();
}
} | [
"public",
"static",
"void",
"launchActivity",
"(",
"Activity",
"context",
",",
"Class",
"<",
"?",
"extends",
"Activity",
">",
"activity",
",",
"boolean",
"closeCurrentActivity",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"Intent",
"in... | Launch an Activity.
@param context The current Context or Activity that this method is called from.
@param activity The new Activity to open.
@param closeCurrentActivity whether or not the current activity should close.
@param params Parameters to add to the intent as a Bundle. | [
"Launch",
"an",
"Activity",
"."
] | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ActivityUtils.java#L30-L45 |
joniles/mpxj | src/main/java/net/sf/mpxj/common/FieldTypeHelper.java | FieldTypeHelper.getPlaceholder | private static FieldType getPlaceholder(final Class<?> type, final int fieldID)
{
return new FieldType()
{
@Override public FieldTypeClass getFieldTypeClass()
{
return FieldTypeClass.UNKNOWN;
}
@Override public String name()
{
return "UNKNOWN";
}
@Override public int getValue()
{
return fieldID;
}
@Override public String getName()
{
return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")");
}
@Override public String getName(Locale locale)
{
return getName();
}
@Override public DataType getDataType()
{
return null;
}
@Override public FieldType getUnitsType()
{
return null;
}
@Override public String toString()
{
return getName();
}
};
} | java | private static FieldType getPlaceholder(final Class<?> type, final int fieldID)
{
return new FieldType()
{
@Override public FieldTypeClass getFieldTypeClass()
{
return FieldTypeClass.UNKNOWN;
}
@Override public String name()
{
return "UNKNOWN";
}
@Override public int getValue()
{
return fieldID;
}
@Override public String getName()
{
return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")");
}
@Override public String getName(Locale locale)
{
return getName();
}
@Override public DataType getDataType()
{
return null;
}
@Override public FieldType getUnitsType()
{
return null;
}
@Override public String toString()
{
return getName();
}
};
} | [
"private",
"static",
"FieldType",
"getPlaceholder",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"int",
"fieldID",
")",
"{",
"return",
"new",
"FieldType",
"(",
")",
"{",
"@",
"Override",
"public",
"FieldTypeClass",
"getFieldTypeClass",
"(",
")... | Generate a placeholder for an unknown type.
@param type expected type
@param fieldID field ID
@return placeholder | [
"Generate",
"a",
"placeholder",
"for",
"an",
"unknown",
"type",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L218-L262 |
grpc/grpc-java | xds/src/main/java/io/grpc/xds/XdsLoadReportStore.java | XdsLoadReportStore.interceptPickResult | PickResult interceptPickResult(PickResult pickResult, Locality locality) {
if (!pickResult.getStatus().isOk()) {
return pickResult;
}
XdsClientLoadRecorder.ClientLoadCounter counter = localityLoadCounters.get(locality);
if (counter == null) {
return pickResult;
}
ClientStreamTracer.Factory originFactory = pickResult.getStreamTracerFactory();
if (originFactory == null) {
originFactory = NOOP_CLIENT_STREAM_TRACER_FACTORY;
}
XdsClientLoadRecorder recorder = new XdsClientLoadRecorder(counter, originFactory);
return PickResult.withSubchannel(pickResult.getSubchannel(), recorder);
} | java | PickResult interceptPickResult(PickResult pickResult, Locality locality) {
if (!pickResult.getStatus().isOk()) {
return pickResult;
}
XdsClientLoadRecorder.ClientLoadCounter counter = localityLoadCounters.get(locality);
if (counter == null) {
return pickResult;
}
ClientStreamTracer.Factory originFactory = pickResult.getStreamTracerFactory();
if (originFactory == null) {
originFactory = NOOP_CLIENT_STREAM_TRACER_FACTORY;
}
XdsClientLoadRecorder recorder = new XdsClientLoadRecorder(counter, originFactory);
return PickResult.withSubchannel(pickResult.getSubchannel(), recorder);
} | [
"PickResult",
"interceptPickResult",
"(",
"PickResult",
"pickResult",
",",
"Locality",
"locality",
")",
"{",
"if",
"(",
"!",
"pickResult",
".",
"getStatus",
"(",
")",
".",
"isOk",
"(",
")",
")",
"{",
"return",
"pickResult",
";",
"}",
"XdsClientLoadRecorder",
... | Intercepts a in-locality PickResult with load recording {@link ClientStreamTracer.Factory}. | [
"Intercepts",
"a",
"in",
"-",
"locality",
"PickResult",
"with",
"load",
"recording",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/xds/src/main/java/io/grpc/xds/XdsLoadReportStore.java#L139-L153 |
alibaba/simpleimage | simpleimage.core/src/main/java/com/alibaba/simpleimage/util/PaletteBuilder.java | PaletteBuilder.getSrcColor | private int getSrcColor(int x, int y) {
int argb = srcColorModel.getRGB(srcRaster.getDataElements(x, y, null));
if (transparency == Transparency.OPAQUE) {
argb = 0xff000000 | argb;
}
return argb;
} | java | private int getSrcColor(int x, int y) {
int argb = srcColorModel.getRGB(srcRaster.getDataElements(x, y, null));
if (transparency == Transparency.OPAQUE) {
argb = 0xff000000 | argb;
}
return argb;
} | [
"private",
"int",
"getSrcColor",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"argb",
"=",
"srcColorModel",
".",
"getRGB",
"(",
"srcRaster",
".",
"getDataElements",
"(",
"x",
",",
"y",
",",
"null",
")",
")",
";",
"if",
"(",
"transparency",
"=="... | 原方法签名 private Color getSrcColor(int x, int y),原实现返回一个Color对象,对于一张上百万像素的图片,将会产生
上百万个对象,对性能有严重影响,顾改为返回整形,作为替代
@param x
@param y
@return | [
"原方法签名",
"private",
"Color",
"getSrcColor",
"(",
"int",
"x",
"int",
"y",
")",
",原实现返回一个Color对象,对于一张上百万像素的图片,将会产生",
"上百万个对象,对性能有严重影响,顾改为返回整形,作为替代"
] | train | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.core/src/main/java/com/alibaba/simpleimage/util/PaletteBuilder.java#L161-L168 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java | ApiOvhVrack.serviceName_dedicatedServerInterface_dedicatedServerInterface_GET | public OvhDedicatedServerInterface serviceName_dedicatedServerInterface_dedicatedServerInterface_GET(String serviceName, String dedicatedServerInterface) throws IOException {
String qPath = "/vrack/{serviceName}/dedicatedServerInterface/{dedicatedServerInterface}";
StringBuilder sb = path(qPath, serviceName, dedicatedServerInterface);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDedicatedServerInterface.class);
} | java | public OvhDedicatedServerInterface serviceName_dedicatedServerInterface_dedicatedServerInterface_GET(String serviceName, String dedicatedServerInterface) throws IOException {
String qPath = "/vrack/{serviceName}/dedicatedServerInterface/{dedicatedServerInterface}";
StringBuilder sb = path(qPath, serviceName, dedicatedServerInterface);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDedicatedServerInterface.class);
} | [
"public",
"OvhDedicatedServerInterface",
"serviceName_dedicatedServerInterface_dedicatedServerInterface_GET",
"(",
"String",
"serviceName",
",",
"String",
"dedicatedServerInterface",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/vrack/{serviceName}/dedicatedServerInt... | Get this object properties
REST: GET /vrack/{serviceName}/dedicatedServerInterface/{dedicatedServerInterface}
@param serviceName [required] The internal name of your vrack
@param dedicatedServerInterface [required] Dedicated Server Interface | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L570-L575 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java | OutputsInner.updateAsync | public Observable<OutputInner> updateAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch).map(new Func1<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>, OutputInner>() {
@Override
public OutputInner call(ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders> response) {
return response.body();
}
});
} | java | public Observable<OutputInner> updateAsync(String resourceGroupName, String jobName, String outputName, OutputInner output, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, jobName, outputName, output, ifMatch).map(new Func1<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>, OutputInner>() {
@Override
public OutputInner call(ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OutputInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"outputName",
",",
"OutputInner",
"output",
",",
"String",
"ifMatch",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"... | Updates an existing output under an existing streaming job. This can be used to partially update (ie. update one or two properties) an output without affecting the rest the job or output definition.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param outputName The name of the output.
@param output An Output object. The properties specified here will overwrite the corresponding properties in the existing output (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing output will remain the same and not change as a result of this PATCH operation.
@param ifMatch The ETag of the output. Omit this value to always overwrite the current output. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OutputInner object | [
"Updates",
"an",
"existing",
"output",
"under",
"an",
"existing",
"streaming",
"job",
".",
"This",
"can",
"be",
"used",
"to",
"partially",
"update",
"(",
"ie",
".",
"update",
"one",
"or",
"two",
"properties",
")",
"an",
"output",
"without",
"affecting",
"t... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/OutputsInner.java#L449-L456 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java | Jdk8Methods.safeSubtract | public static int safeSubtract(int a, int b) {
int result = a - b;
// check for a change of sign in the result when the inputs have the different signs
if ((a ^ result) < 0 && (a ^ b) < 0) {
throw new ArithmeticException("Subtraction overflows an int: " + a + " - " + b);
}
return result;
} | java | public static int safeSubtract(int a, int b) {
int result = a - b;
// check for a change of sign in the result when the inputs have the different signs
if ((a ^ result) < 0 && (a ^ b) < 0) {
throw new ArithmeticException("Subtraction overflows an int: " + a + " - " + b);
}
return result;
} | [
"public",
"static",
"int",
"safeSubtract",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"int",
"result",
"=",
"a",
"-",
"b",
";",
"// check for a change of sign in the result when the inputs have the different signs",
"if",
"(",
"(",
"a",
"^",
"result",
")",
"<",... | Safely subtracts one int from another.
@param a the first value
@param b the second value to subtract from the first
@return the result
@throws ArithmeticException if the result overflows an int | [
"Safely",
"subtracts",
"one",
"int",
"from",
"another",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java#L180-L187 |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java | Native.epollBusyWait | public static int epollBusyWait(FileDescriptor epollFd, EpollEventArray events) throws IOException {
int ready = epollBusyWait0(epollFd.intValue(), events.memoryAddress(), events.length());
if (ready < 0) {
throw newIOException("epoll_wait", ready);
}
return ready;
} | java | public static int epollBusyWait(FileDescriptor epollFd, EpollEventArray events) throws IOException {
int ready = epollBusyWait0(epollFd.intValue(), events.memoryAddress(), events.length());
if (ready < 0) {
throw newIOException("epoll_wait", ready);
}
return ready;
} | [
"public",
"static",
"int",
"epollBusyWait",
"(",
"FileDescriptor",
"epollFd",
",",
"EpollEventArray",
"events",
")",
"throws",
"IOException",
"{",
"int",
"ready",
"=",
"epollBusyWait0",
"(",
"epollFd",
".",
"intValue",
"(",
")",
",",
"events",
".",
"memoryAddres... | Non-blocking variant of
{@link #epollWait(FileDescriptor, EpollEventArray, FileDescriptor, int, int)}
that will also hint to processor we are in a busy-wait loop. | [
"Non",
"-",
"blocking",
"variant",
"of",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/Native.java#L128-L134 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/util/ValidationObjUtil.java | ValidationObjUtil.getValue | public static Object getValue(Object obj, String field) {
Method getter = getGetterMethod(obj.getClass(), field);
try {
return getter.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
} | java | public static Object getValue(Object obj, String field) {
Method getter = getGetterMethod(obj.getClass(), field);
try {
return getter.invoke(obj);
} catch (IllegalAccessException | InvocationTargetException e) {
return null;
}
} | [
"public",
"static",
"Object",
"getValue",
"(",
"Object",
"obj",
",",
"String",
"field",
")",
"{",
"Method",
"getter",
"=",
"getGetterMethod",
"(",
"obj",
".",
"getClass",
"(",
")",
",",
"field",
")",
";",
"try",
"{",
"return",
"getter",
".",
"invoke",
... | Gets value.
@param obj the obj
@param field the field
@return the value | [
"Gets",
"value",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L237-L245 |
h2oai/h2o-2 | src/main/java/water/api/Frames.java | Frames.serveOneOrAll | private Response serveOneOrAll(Map<String, Frame> framesMap) {
// returns empty sets if !this.find_compatible_models
Pair<Map<String, Model>, Map<String, Set<String>>> models_info = fetchModels();
Map<String, Model> all_models = models_info.getFirst();
Map<String, Set<String>> all_models_cols = models_info.getSecond();
Map<String, FrameSummary> frameSummaries = Frames.generateFrameSummaries(null, framesMap, find_compatible_models, all_models, all_models_cols);
Map resultsMap = new LinkedHashMap();
resultsMap.put("frames", frameSummaries);
// If find_compatible_models then include a map of the Model summaries. Should we put this on a separate switch?
if (this.find_compatible_models) {
Set<String> all_referenced_models = new TreeSet<String>();
for (Map.Entry<String, FrameSummary> entry: frameSummaries.entrySet()) {
FrameSummary summary = entry.getValue();
all_referenced_models.addAll(summary.compatible_models);
}
Map<String, ModelSummary> modelSummaries = Models.generateModelSummaries(all_referenced_models, all_models, false, null, null);
resultsMap.put("models", modelSummaries);
}
// TODO: temporary hack to get things going
String json = gson.toJson(resultsMap);
JsonObject result = gson.fromJson(json, JsonElement.class).getAsJsonObject();
return Response.done(result);
} | java | private Response serveOneOrAll(Map<String, Frame> framesMap) {
// returns empty sets if !this.find_compatible_models
Pair<Map<String, Model>, Map<String, Set<String>>> models_info = fetchModels();
Map<String, Model> all_models = models_info.getFirst();
Map<String, Set<String>> all_models_cols = models_info.getSecond();
Map<String, FrameSummary> frameSummaries = Frames.generateFrameSummaries(null, framesMap, find_compatible_models, all_models, all_models_cols);
Map resultsMap = new LinkedHashMap();
resultsMap.put("frames", frameSummaries);
// If find_compatible_models then include a map of the Model summaries. Should we put this on a separate switch?
if (this.find_compatible_models) {
Set<String> all_referenced_models = new TreeSet<String>();
for (Map.Entry<String, FrameSummary> entry: frameSummaries.entrySet()) {
FrameSummary summary = entry.getValue();
all_referenced_models.addAll(summary.compatible_models);
}
Map<String, ModelSummary> modelSummaries = Models.generateModelSummaries(all_referenced_models, all_models, false, null, null);
resultsMap.put("models", modelSummaries);
}
// TODO: temporary hack to get things going
String json = gson.toJson(resultsMap);
JsonObject result = gson.fromJson(json, JsonElement.class).getAsJsonObject();
return Response.done(result);
} | [
"private",
"Response",
"serveOneOrAll",
"(",
"Map",
"<",
"String",
",",
"Frame",
">",
"framesMap",
")",
"{",
"// returns empty sets if !this.find_compatible_models",
"Pair",
"<",
"Map",
"<",
"String",
",",
"Model",
">",
",",
"Map",
"<",
"String",
",",
"Set",
"... | For one or more Frame from the KV store, sumamrize and enhance them and Response containing a map of them. | [
"For",
"one",
"or",
"more",
"Frame",
"from",
"the",
"KV",
"store",
"sumamrize",
"and",
"enhance",
"them",
"and",
"Response",
"containing",
"a",
"map",
"of",
"them",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/api/Frames.java#L172-L201 |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java | BasicSourceMapConsumer.generatedPositionFor | @Override
public GeneratedPosition generatedPositionFor(String source, int line, int column, Bias bias) {
if (this.sourceRoot != null) {
source = Util.relative(this.sourceRoot, source);
}
if (!this._sources.has(source)) {
return new GeneratedPosition();
}
int source_ = this._sources.indexOf(source);
ParsedMapping needle = new ParsedMapping(null, null, line, column, source_, null);
if (bias == null) {
bias = Bias.GREATEST_LOWER_BOUND;
}
int index = _findMapping(needle, this._originalMappings(), "originalLine", "originalColumn",
(mapping1, mapping2) -> Util.compareByOriginalPositions(mapping1, mapping2, true), bias);
if (index >= 0) {
ParsedMapping mapping = this._originalMappings().get(index);
if (mapping.source == needle.source) {
return new GeneratedPosition(mapping.generatedLine != null ? mapping.generatedLine : null,
mapping.generatedColumn != null ? mapping.generatedColumn : null,
mapping.lastGeneratedColumn != null ? mapping.lastGeneratedColumn : null);
}
}
return new GeneratedPosition();
} | java | @Override
public GeneratedPosition generatedPositionFor(String source, int line, int column, Bias bias) {
if (this.sourceRoot != null) {
source = Util.relative(this.sourceRoot, source);
}
if (!this._sources.has(source)) {
return new GeneratedPosition();
}
int source_ = this._sources.indexOf(source);
ParsedMapping needle = new ParsedMapping(null, null, line, column, source_, null);
if (bias == null) {
bias = Bias.GREATEST_LOWER_BOUND;
}
int index = _findMapping(needle, this._originalMappings(), "originalLine", "originalColumn",
(mapping1, mapping2) -> Util.compareByOriginalPositions(mapping1, mapping2, true), bias);
if (index >= 0) {
ParsedMapping mapping = this._originalMappings().get(index);
if (mapping.source == needle.source) {
return new GeneratedPosition(mapping.generatedLine != null ? mapping.generatedLine : null,
mapping.generatedColumn != null ? mapping.generatedColumn : null,
mapping.lastGeneratedColumn != null ? mapping.lastGeneratedColumn : null);
}
}
return new GeneratedPosition();
} | [
"@",
"Override",
"public",
"GeneratedPosition",
"generatedPositionFor",
"(",
"String",
"source",
",",
"int",
"line",
",",
"int",
"column",
",",
"Bias",
"bias",
")",
"{",
"if",
"(",
"this",
".",
"sourceRoot",
"!=",
"null",
")",
"{",
"source",
"=",
"Util",
... | Returns the generated line and column information for the original source, line, and column positions provided. The only argument is an object
with the following properties:
- source: The filename of the original source. - line: The line number in the original source. - column: The column number in the original
source. - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
closest element that is smaller than or greater than the one we are searching for, respectively, if the exact element cannot be found. Defaults
to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
and an object is returned with the following properties:
- line: The line number in the generated source, or null. - column: The column number in the generated source, or null. | [
"Returns",
"the",
"generated",
"line",
"and",
"column",
"information",
"for",
"the",
"original",
"source",
"line",
"and",
"column",
"positions",
"provided",
".",
"The",
"only",
"argument",
"is",
"an",
"object",
"with",
"the",
"following",
"properties",
":"
] | train | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java#L424-L454 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.