repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java | BinaryThinning.apply | public void apply(GrayU8 binary , int maxLoops) {
this.binary = binary;
inputBorder.setImage(binary);
ones0.reset();
zerosOut.reset();
findOnePixels(ones0);
for (int loop = 0; (loop < maxLoops || maxLoops == -1) && ones0.size > 0; loop++) {
boolean changed = false;
// do one cycle through all the masks
for (int i = 0; i < masks.length; i++) {
zerosOut.reset();
ones1.reset();
masks[i].apply(ones0, ones1, zerosOut);
changed |= ones0.size != ones1.size;
// mark all the pixels that need to be set to 0 as 0
for (int j = 0; j < zerosOut.size(); j++) {
binary.data[ zerosOut.get(j)] = 0;
}
// swap the lists
GrowQueue_I32 tmp = ones0;
ones0 = ones1;
ones1 = tmp;
}
if( !changed )
break;
}
} | java | public void apply(GrayU8 binary , int maxLoops) {
this.binary = binary;
inputBorder.setImage(binary);
ones0.reset();
zerosOut.reset();
findOnePixels(ones0);
for (int loop = 0; (loop < maxLoops || maxLoops == -1) && ones0.size > 0; loop++) {
boolean changed = false;
// do one cycle through all the masks
for (int i = 0; i < masks.length; i++) {
zerosOut.reset();
ones1.reset();
masks[i].apply(ones0, ones1, zerosOut);
changed |= ones0.size != ones1.size;
// mark all the pixels that need to be set to 0 as 0
for (int j = 0; j < zerosOut.size(); j++) {
binary.data[ zerosOut.get(j)] = 0;
}
// swap the lists
GrowQueue_I32 tmp = ones0;
ones0 = ones1;
ones1 = tmp;
}
if( !changed )
break;
}
} | [
"public",
"void",
"apply",
"(",
"GrayU8",
"binary",
",",
"int",
"maxLoops",
")",
"{",
"this",
".",
"binary",
"=",
"binary",
";",
"inputBorder",
".",
"setImage",
"(",
"binary",
")",
";",
"ones0",
".",
"reset",
"(",
")",
";",
"zerosOut",
".",
"reset",
... | Applies the thinning algorithm. Runs for the specified number of loops or until no change is detected.
@param binary Input binary image which is to be thinned. This is modified
@param maxLoops Maximum number of thinning loops. Set to -1 to run until the image is no longer modified. | [
"Applies",
"the",
"thinning",
"algorithm",
".",
"Runs",
"for",
"the",
"specified",
"number",
"of",
"loops",
"or",
"until",
"no",
"change",
"is",
"detected",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/impl/BinaryThinning.java#L99-L136 |
graphql-java/graphql-java | src/main/java/graphql/schema/diff/DiffSet.java | DiffSet.diffSet | public static DiffSet diffSet(Map<String, Object> introspectionOld, Map<String, Object> introspectionNew) {
return new DiffSet(introspectionOld, introspectionNew);
} | java | public static DiffSet diffSet(Map<String, Object> introspectionOld, Map<String, Object> introspectionNew) {
return new DiffSet(introspectionOld, introspectionNew);
} | [
"public",
"static",
"DiffSet",
"diffSet",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"introspectionOld",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"introspectionNew",
")",
"{",
"return",
"new",
"DiffSet",
"(",
"introspectionOld",
",",
"introspectionNe... | Creates a diff set out of the result of 2 introspection queries.
@param introspectionOld the older introspection query
@param introspectionNew the newer introspection query
@return a diff set representing them | [
"Creates",
"a",
"diff",
"set",
"out",
"of",
"the",
"result",
"of",
"2",
"introspection",
"queries",
"."
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/diff/DiffSet.java#L51-L53 |
joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/MapRow.java | MapRow.getTimestamp | public Date getTimestamp(FastTrackField dateName, FastTrackField timeName)
{
Date result = null;
Date date = getDate(dateName);
if (date != null)
{
Calendar dateCal = DateHelper.popCalendar(date);
Date time = getDate(timeName);
if (time != null)
{
Calendar timeCal = DateHelper.popCalendar(time);
dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
DateHelper.pushCalendar(timeCal);
}
result = dateCal.getTime();
DateHelper.pushCalendar(dateCal);
}
return result;
} | java | public Date getTimestamp(FastTrackField dateName, FastTrackField timeName)
{
Date result = null;
Date date = getDate(dateName);
if (date != null)
{
Calendar dateCal = DateHelper.popCalendar(date);
Date time = getDate(timeName);
if (time != null)
{
Calendar timeCal = DateHelper.popCalendar(time);
dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY));
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
DateHelper.pushCalendar(timeCal);
}
result = dateCal.getTime();
DateHelper.pushCalendar(dateCal);
}
return result;
} | [
"public",
"Date",
"getTimestamp",
"(",
"FastTrackField",
"dateName",
",",
"FastTrackField",
"timeName",
")",
"{",
"Date",
"result",
"=",
"null",
";",
"Date",
"date",
"=",
"getDate",
"(",
"dateName",
")",
";",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"C... | Retrieve a timestamp field.
@param dateName field containing the date component
@param timeName field containing the time component
@return Date instance | [
"Retrieve",
"a",
"timestamp",
"field",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L132-L155 |
Netflix/conductor | mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java | Query.executeScalar | public <V> V executeScalar(Class<V> returnType) {
try (ResultSet rs = executeQuery()) {
if (!rs.next()) {
Object value = null;
if (Integer.class == returnType) {
value = 0;
} else if (Long.class == returnType) {
value = 0L;
} else if (Boolean.class == returnType) {
value = false;
}
return returnType.cast(value);
} else {
return getScalarFromResultSet(rs, returnType);
}
} catch (SQLException ex) {
throw new ApplicationException(Code.BACKEND_ERROR, ex);
}
} | java | public <V> V executeScalar(Class<V> returnType) {
try (ResultSet rs = executeQuery()) {
if (!rs.next()) {
Object value = null;
if (Integer.class == returnType) {
value = 0;
} else if (Long.class == returnType) {
value = 0L;
} else if (Boolean.class == returnType) {
value = false;
}
return returnType.cast(value);
} else {
return getScalarFromResultSet(rs, returnType);
}
} catch (SQLException ex) {
throw new ApplicationException(Code.BACKEND_ERROR, ex);
}
} | [
"public",
"<",
"V",
">",
"V",
"executeScalar",
"(",
"Class",
"<",
"V",
">",
"returnType",
")",
"{",
"try",
"(",
"ResultSet",
"rs",
"=",
"executeQuery",
"(",
")",
")",
"{",
"if",
"(",
"!",
"rs",
".",
"next",
"(",
")",
")",
"{",
"Object",
"value",
... | Execute the PreparedStatement and return a single 'primitive' value from the ResultSet.
@param returnType The type to return.
@param <V> The type parameter to return a List of.
@return A single result from the execution of the statement, as a type of {@literal returnType}.
@throws ApplicationException {@literal returnType} is unsupported, cannot be cast to from the result, or any SQL
errors occur. | [
"Execute",
"the",
"PreparedStatement",
"and",
"return",
"a",
"single",
"primitive",
"value",
"from",
"the",
"ResultSet",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/Query.java#L332-L350 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/AbstractRedisClient.java | AbstractRedisClient.setDefaultTimeout | @Deprecated
public void setDefaultTimeout(long timeout, TimeUnit unit) {
setDefaultTimeout(Duration.ofNanos(unit.toNanos(timeout)));
} | java | @Deprecated
public void setDefaultTimeout(long timeout, TimeUnit unit) {
setDefaultTimeout(Duration.ofNanos(unit.toNanos(timeout)));
} | [
"@",
"Deprecated",
"public",
"void",
"setDefaultTimeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"setDefaultTimeout",
"(",
"Duration",
".",
"ofNanos",
"(",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
")",
")",
";",
"}"
] | Set the default timeout for connections created by this client. The timeout applies to connection attempts and
non-blocking commands.
@param timeout Default connection timeout.
@param unit Unit of time for the timeout.
@deprecated since 5.0, use {@link #setDefaultTimeout(Duration)}. | [
"Set",
"the",
"default",
"timeout",
"for",
"connections",
"created",
"by",
"this",
"client",
".",
"The",
"timeout",
"applies",
"to",
"connection",
"attempts",
"and",
"non",
"-",
"blocking",
"commands",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/AbstractRedisClient.java#L131-L134 |
square/dagger | compiler/src/main/java/dagger/internal/codegen/InjectAdapterProcessor.java | InjectAdapterProcessor.generateStaticInjection | private void generateStaticInjection(TypeElement type, List<Element> fields) throws IOException {
ClassName typeName = ClassName.get(type);
ClassName adapterClassName = adapterName(ClassName.get(type), STATIC_INJECTION_SUFFIX);
TypeSpec.Builder result = TypeSpec.classBuilder(adapterClassName.simpleName())
.addOriginatingElement(type)
.addJavadoc(AdapterJavadocs.STATIC_INJECTION_TYPE, type)
.addModifiers(PUBLIC, FINAL)
.superclass(StaticInjection.class);
for (Element field : fields) {
result.addField(memberBindingField(false, field));
}
result.addMethod(attachMethod(null, fields, false, typeName, null, true));
result.addMethod(staticInjectMethod(fields, typeName));
String packageName = getPackage(type).getQualifiedName().toString();
JavaFile javaFile = JavaFile.builder(packageName, result.build())
.addFileComment(AdapterJavadocs.GENERATED_BY_DAGGER)
.build();
javaFile.writeTo(processingEnv.getFiler());
} | java | private void generateStaticInjection(TypeElement type, List<Element> fields) throws IOException {
ClassName typeName = ClassName.get(type);
ClassName adapterClassName = adapterName(ClassName.get(type), STATIC_INJECTION_SUFFIX);
TypeSpec.Builder result = TypeSpec.classBuilder(adapterClassName.simpleName())
.addOriginatingElement(type)
.addJavadoc(AdapterJavadocs.STATIC_INJECTION_TYPE, type)
.addModifiers(PUBLIC, FINAL)
.superclass(StaticInjection.class);
for (Element field : fields) {
result.addField(memberBindingField(false, field));
}
result.addMethod(attachMethod(null, fields, false, typeName, null, true));
result.addMethod(staticInjectMethod(fields, typeName));
String packageName = getPackage(type).getQualifiedName().toString();
JavaFile javaFile = JavaFile.builder(packageName, result.build())
.addFileComment(AdapterJavadocs.GENERATED_BY_DAGGER)
.build();
javaFile.writeTo(processingEnv.getFiler());
} | [
"private",
"void",
"generateStaticInjection",
"(",
"TypeElement",
"type",
",",
"List",
"<",
"Element",
">",
"fields",
")",
"throws",
"IOException",
"{",
"ClassName",
"typeName",
"=",
"ClassName",
".",
"get",
"(",
"type",
")",
";",
"ClassName",
"adapterClassName"... | Write a companion class for {@code type} that extends {@link StaticInjection}. | [
"Write",
"a",
"companion",
"class",
"for",
"{"
] | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/compiler/src/main/java/dagger/internal/codegen/InjectAdapterProcessor.java#L304-L324 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java | GuiceUtil.getMemberInjectionDependencies | public Collection<Dependency> getMemberInjectionDependencies(
Key<?> typeKey, TypeLiteral<?> type) {
Set<Dependency> required = new LinkedHashSet<Dependency>();
for (MethodLiteral<?, Method> method : memberCollector.getMethods(type)) {
required.addAll(getDependencies(typeKey, method));
}
for (FieldLiteral<?> field : memberCollector.getFields(type)) {
Key<?> key = getKey(field);
required.add(new Dependency(typeKey, key, isOptional(field), false,
"member injection of " + field));
}
return required;
} | java | public Collection<Dependency> getMemberInjectionDependencies(
Key<?> typeKey, TypeLiteral<?> type) {
Set<Dependency> required = new LinkedHashSet<Dependency>();
for (MethodLiteral<?, Method> method : memberCollector.getMethods(type)) {
required.addAll(getDependencies(typeKey, method));
}
for (FieldLiteral<?> field : memberCollector.getFields(type)) {
Key<?> key = getKey(field);
required.add(new Dependency(typeKey, key, isOptional(field), false,
"member injection of " + field));
}
return required;
} | [
"public",
"Collection",
"<",
"Dependency",
">",
"getMemberInjectionDependencies",
"(",
"Key",
"<",
"?",
">",
"typeKey",
",",
"TypeLiteral",
"<",
"?",
">",
"type",
")",
"{",
"Set",
"<",
"Dependency",
">",
"required",
"=",
"new",
"LinkedHashSet",
"<",
"Depende... | Collects and returns all keys required to member-inject the given class.
@param typeKey key causing member injection
@param type class for which required keys are calculated
@return keys required to inject given class | [
"Collects",
"and",
"returns",
"all",
"keys",
"required",
"to",
"member",
"-",
"inject",
"the",
"given",
"class",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/GuiceUtil.java#L134-L147 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseShybmv | public static int cusparseShybmv(
cusparseHandle handle,
int transA,
Pointer alpha,
cusparseMatDescr descrA,
cusparseHybMat hybA,
Pointer x,
Pointer beta,
Pointer y)
{
return checkResult(cusparseShybmvNative(handle, transA, alpha, descrA, hybA, x, beta, y));
} | java | public static int cusparseShybmv(
cusparseHandle handle,
int transA,
Pointer alpha,
cusparseMatDescr descrA,
cusparseHybMat hybA,
Pointer x,
Pointer beta,
Pointer y)
{
return checkResult(cusparseShybmvNative(handle, transA, alpha, descrA, hybA, x, beta, y));
} | [
"public",
"static",
"int",
"cusparseShybmv",
"(",
"cusparseHandle",
"handle",
",",
"int",
"transA",
",",
"Pointer",
"alpha",
",",
"cusparseMatDescr",
"descrA",
",",
"cusparseHybMat",
"hybA",
",",
"Pointer",
"x",
",",
"Pointer",
"beta",
",",
"Pointer",
"y",
")"... | Description: Matrix-vector multiplication y = alpha * op(A) * x + beta * y,
where A is a sparse matrix in HYB storage format, x and y are dense vectors. | [
"Description",
":",
"Matrix",
"-",
"vector",
"multiplication",
"y",
"=",
"alpha",
"*",
"op",
"(",
"A",
")",
"*",
"x",
"+",
"beta",
"*",
"y",
"where",
"A",
"is",
"a",
"sparse",
"matrix",
"in",
"HYB",
"storage",
"format",
"x",
"and",
"y",
"are",
"den... | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L1723-L1734 |
geomajas/geomajas-project-client-gwt2 | common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java | GwtCommandDispatcher.setToken | private void setToken(String userToken, UserDetail userDetail, boolean loginPending) {
boolean changed = !isEqual(this.userToken, userToken);
this.userToken = userToken;
if (null == userDetail) {
userDetail = new UserDetail();
}
this.userDetail = userDetail;
if (changed) {
TokenChangedEvent event = new TokenChangedEvent(userToken, userDetail, loginPending);
manager.fireEvent(event);
}
} | java | private void setToken(String userToken, UserDetail userDetail, boolean loginPending) {
boolean changed = !isEqual(this.userToken, userToken);
this.userToken = userToken;
if (null == userDetail) {
userDetail = new UserDetail();
}
this.userDetail = userDetail;
if (changed) {
TokenChangedEvent event = new TokenChangedEvent(userToken, userDetail, loginPending);
manager.fireEvent(event);
}
} | [
"private",
"void",
"setToken",
"(",
"String",
"userToken",
",",
"UserDetail",
"userDetail",
",",
"boolean",
"loginPending",
")",
"{",
"boolean",
"changed",
"=",
"!",
"isEqual",
"(",
"this",
".",
"userToken",
",",
"userToken",
")",
";",
"this",
".",
"userToke... | Set the user token, so it can be sent in every command. This is the internal version, used by the token changed
handler.
@param userToken
user token
@param userDetail
user details
@param loginPending
true if this will be followed by a fresh token change | [
"Set",
"the",
"user",
"token",
"so",
"it",
"can",
"be",
"sent",
"in",
"every",
"command",
".",
"This",
"is",
"the",
"internal",
"version",
"used",
"by",
"the",
"token",
"changed",
"handler",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java#L455-L466 |
anotheria/configureme | src/main/java/org/configureme/parser/IncludeParsedAttribute.java | IncludeParsedAttribute.createIncludeValue | private static IncludeValue createIncludeValue(final String value) {
if (value.charAt(1) != '<')
return new IncludeValue();
//remove wrappers
final String unwrapped = value.substring(2, value.length() - 1);
return new IncludeValue(StringUtils.getStringBefore(unwrapped, "."), StringUtils.getStringAfter(unwrapped, "."));
} | java | private static IncludeValue createIncludeValue(final String value) {
if (value.charAt(1) != '<')
return new IncludeValue();
//remove wrappers
final String unwrapped = value.substring(2, value.length() - 1);
return new IncludeValue(StringUtils.getStringBefore(unwrapped, "."), StringUtils.getStringAfter(unwrapped, "."));
} | [
"private",
"static",
"IncludeValue",
"createIncludeValue",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
".",
"charAt",
"(",
"1",
")",
"!=",
"'",
"'",
")",
"return",
"new",
"IncludeValue",
"(",
")",
";",
"//remove wrappers",
"final",
"Stri... | Creates internal representation of the attribute value.
@param value name of the link attribute in the another config
@return internal representation of the include attribute value | [
"Creates",
"internal",
"representation",
"of",
"the",
"attribute",
"value",
"."
] | train | https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/parser/IncludeParsedAttribute.java#L33-L39 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fraction.java | Fraction.mulPosAndCheck | private static int mulPosAndCheck(final int x, final int y) {
/* assert x>=0 && y>=0; */
final long m = (long) x * (long) y;
if (m > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: mulPos");
}
return (int) m;
} | java | private static int mulPosAndCheck(final int x, final int y) {
/* assert x>=0 && y>=0; */
final long m = (long) x * (long) y;
if (m > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: mulPos");
}
return (int) m;
} | [
"private",
"static",
"int",
"mulPosAndCheck",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
")",
"{",
"/* assert x>=0 && y>=0; */",
"final",
"long",
"m",
"=",
"(",
"long",
")",
"x",
"*",
"(",
"long",
")",
"y",
";",
"if",
"(",
"m",
">",
"Integer... | Multiply two non-negative integers, checking for overflow.
@param x
a non-negative factor
@param y
a non-negative factor
@return the product <code>x*y</code>
@throws ArithmeticException
if the result can not be represented as an int | [
"Multiply",
"two",
"non",
"-",
"negative",
"integers",
"checking",
"for",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fraction.java#L780-L787 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.rightShift | public static TemporalAmount rightShift(final Temporal self, Temporal other) {
if (!self.getClass().equals(other.getClass())) {
throw new GroovyRuntimeException("Temporal arguments must be of the same type.");
}
switch ((ChronoUnit) defaultUnitFor(self)) {
case YEARS:
return DateTimeStaticExtensions.between(null, (Year) self, (Year) other);
case MONTHS:
return DateTimeStaticExtensions.between(null, (YearMonth) self, (YearMonth) other);
case DAYS:
return ChronoPeriod.between((ChronoLocalDate) self, (ChronoLocalDate) other);
default:
return Duration.between(self, other);
}
} | java | public static TemporalAmount rightShift(final Temporal self, Temporal other) {
if (!self.getClass().equals(other.getClass())) {
throw new GroovyRuntimeException("Temporal arguments must be of the same type.");
}
switch ((ChronoUnit) defaultUnitFor(self)) {
case YEARS:
return DateTimeStaticExtensions.between(null, (Year) self, (Year) other);
case MONTHS:
return DateTimeStaticExtensions.between(null, (YearMonth) self, (YearMonth) other);
case DAYS:
return ChronoPeriod.between((ChronoLocalDate) self, (ChronoLocalDate) other);
default:
return Duration.between(self, other);
}
} | [
"public",
"static",
"TemporalAmount",
"rightShift",
"(",
"final",
"Temporal",
"self",
",",
"Temporal",
"other",
")",
"{",
"if",
"(",
"!",
"self",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"other",
".",
"getClass",
"(",
")",
")",
")",
"{",
"throw",... | Returns a {@link java.time.Duration} or {@link java.time.Period} between this (inclusive) and the {@code other}
{@link java.time.temporal.Temporal} (exclusive).
<p>
A Period will be returned for types {@link java.time.Year}, {@link java.time.YearMonth}, and
{@link java.time.chrono.ChronoLocalDate}; otherwise, a Duration will be returned.
<p>
Note: if the Temporal is a ChronoLocalDate but not a {@link java.time.LocalDate}, a general
{@link java.time.chrono.ChronoPeriod} will be returned as per the return type of the method
{@link java.time.chrono.ChronoLocalDate#until(ChronoLocalDate)} .
@param self a Temporal
@param other another Temporal of the same type
@return an TemporalAmount between the two Temporals
@since 2.5.0 | [
"Returns",
"a",
"{",
"@link",
"java",
".",
"time",
".",
"Duration",
"}",
"or",
"{",
"@link",
"java",
".",
"time",
".",
"Period",
"}",
"between",
"this",
"(",
"inclusive",
")",
"and",
"the",
"{",
"@code",
"other",
"}",
"{",
"@link",
"java",
".",
"ti... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L265-L279 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.replaceOnceIgnoreCase | public static String replaceOnceIgnoreCase(final String text, final String searchString, final String replacement) {
return replaceIgnoreCase(text, searchString, replacement, 1);
} | java | public static String replaceOnceIgnoreCase(final String text, final String searchString, final String replacement) {
return replaceIgnoreCase(text, searchString, replacement, 1);
} | [
"public",
"static",
"String",
"replaceOnceIgnoreCase",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"searchString",
",",
"final",
"String",
"replacement",
")",
"{",
"return",
"replaceIgnoreCase",
"(",
"text",
",",
"searchString",
",",
"replacement",
","... | <p>Case insensitively replaces a String with another String inside a larger String, once.</p>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.replaceOnceIgnoreCase(null, *, *) = null
StringUtils.replaceOnceIgnoreCase("", *, *) = ""
StringUtils.replaceOnceIgnoreCase("any", null, *) = "any"
StringUtils.replaceOnceIgnoreCase("any", *, null) = "any"
StringUtils.replaceOnceIgnoreCase("any", "", *) = "any"
StringUtils.replaceOnceIgnoreCase("aba", "a", null) = "aba"
StringUtils.replaceOnceIgnoreCase("aba", "a", "") = "ba"
StringUtils.replaceOnceIgnoreCase("aba", "a", "z") = "zba"
StringUtils.replaceOnceIgnoreCase("FoOFoofoo", "foo", "") = "Foofoo"
</pre>
@see #replaceIgnoreCase(String text, String searchString, String replacement, int max)
@param text text to search and replace in, may be null
@param searchString the String to search for (case insensitive), may be null
@param replacement the String to replace with, may be null
@return the text with any replacements processed,
{@code null} if null String input
@since 3.5 | [
"<p",
">",
"Case",
"insensitively",
"replaces",
"a",
"String",
"with",
"another",
"String",
"inside",
"a",
"larger",
"String",
"once",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L5195-L5197 |
xerial/snappy-java | src/main/java/org/xerial/snappy/Snappy.java | Snappy.uncompressString | public static String uncompressString(byte[] input, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = uncompress(input);
return new String(uncompressed, encoding);
} | java | public static String uncompressString(byte[] input, String encoding)
throws IOException,
UnsupportedEncodingException
{
byte[] uncompressed = uncompress(input);
return new String(uncompressed, encoding);
} | [
"public",
"static",
"String",
"uncompressString",
"(",
"byte",
"[",
"]",
"input",
",",
"String",
"encoding",
")",
"throws",
"IOException",
",",
"UnsupportedEncodingException",
"{",
"byte",
"[",
"]",
"uncompressed",
"=",
"uncompress",
"(",
"input",
")",
";",
"r... | Uncompress the input as a String of the given encoding
@param input
@param encoding
@return the uncompressed data
@throws IOException
@throws UnsupportedEncodingException | [
"Uncompress",
"the",
"input",
"as",
"a",
"String",
"of",
"the",
"given",
"encoding"
] | train | https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L883-L889 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getQuagganInfo | public void getQuagganInfo(String[] ids, Callback<List<Map<String, String>>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getQuagganInfo(processIds(ids)).enqueue(callback);
} | java | public void getQuagganInfo(String[] ids, Callback<List<Map<String, String>>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getQuagganInfo(processIds(ids)).enqueue(callback);
} | [
"public",
"void",
"getQuagganInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"("... | For more info on quaggans API go <a href="https://wiki.guildwars2.com/wiki/API:2/quaggans">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of quaggan id(s)
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty | [
"For",
"more",
"info",
"on",
"quaggans",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"quaggans",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2219-L2222 |
HubSpot/jinjava | src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java | JinjavaInterpreterResolver.getValue | @Override
public Object getValue(ELContext context, Object base, Object property) {
return getValue(context, base, property, true);
} | java | @Override
public Object getValue(ELContext context, Object base, Object property) {
return getValue(context, base, property, true);
} | [
"@",
"Override",
"public",
"Object",
"getValue",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"return",
"getValue",
"(",
"context",
",",
"base",
",",
"property",
",",
"true",
")",
";",
"}"
] | {@inheritDoc}
If the base object is null, the property will be looked up in the context. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/el/JinjavaInterpreterResolver.java#L107-L110 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java | CoreJBossASClient.addExtension | public void addExtension(String name) throws Exception {
// /extension=<name>/:add(module=<name>)
final ModelNode request = createRequest(ADD, Address.root().add(EXTENSION, name));
request.get(MODULE).set(name);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to add new module extension [" + name + "]");
}
return;
} | java | public void addExtension(String name) throws Exception {
// /extension=<name>/:add(module=<name>)
final ModelNode request = createRequest(ADD, Address.root().add(EXTENSION, name));
request.get(MODULE).set(name);
final ModelNode response = execute(request);
if (!isSuccess(response)) {
throw new FailureException(response, "Failed to add new module extension [" + name + "]");
}
return;
} | [
"public",
"void",
"addExtension",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"// /extension=<name>/:add(module=<name>)",
"final",
"ModelNode",
"request",
"=",
"createRequest",
"(",
"ADD",
",",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"EXTE... | Adds a new module extension to the core system.
@param name the name of the new module extension
@throws Exception any error | [
"Adds",
"a",
"new",
"module",
"extension",
"to",
"the",
"core",
"system",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/CoreJBossASClient.java#L291-L300 |
hawkular/hawkular-apm | server/api/src/main/java/org/hawkular/apm/server/api/utils/SourceInfoUtil.java | SourceInfoUtil.getSourceInfo | public static SourceInfo getSourceInfo(String tenantId, Span serverSpan, SpanCache spanCache) {
String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId());
if (spanCache != null && clientSpanId != null) {
Span clientSpan = spanCache.get(tenantId, clientSpanId);
// Work up span hierarchy until find a server span, or top level span
Span rootOrServerSpan = findRootOrServerSpan(tenantId, clientSpan, spanCache);
if (rootOrServerSpan != null) {
// Build source information
SourceInfo si = new SourceInfo();
if (clientSpan.getDuration() != null) {
si.setDuration(clientSpan.getDuration());
}
if (clientSpan.getTimestamp() != null) {
si.setTimestamp(clientSpan.getTimestamp());
}
si.setTraceId(clientSpan.getTraceId());
si.setFragmentId(clientSpan.getId());
si.getProperties().addAll(clientSpan.binaryAnnotationMapping().getProperties());
si.setHostAddress(clientSpan.ipv4());
if (clientSpan.service() != null) {
si.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, clientSpan.service()));
}
si.setId(clientSpan.getId());
si.setMultipleConsumers(false);
URL url = rootOrServerSpan.url();
si.setEndpoint(new EndpointRef((url != null ? url.getPath() : null),
SpanDeriverUtil.deriveOperation(rootOrServerSpan), !rootOrServerSpan.serverSpan()));
return si;
}
}
return null;
} | java | public static SourceInfo getSourceInfo(String tenantId, Span serverSpan, SpanCache spanCache) {
String clientSpanId = SpanUniqueIdGenerator.getClientId(serverSpan.getId());
if (spanCache != null && clientSpanId != null) {
Span clientSpan = spanCache.get(tenantId, clientSpanId);
// Work up span hierarchy until find a server span, or top level span
Span rootOrServerSpan = findRootOrServerSpan(tenantId, clientSpan, spanCache);
if (rootOrServerSpan != null) {
// Build source information
SourceInfo si = new SourceInfo();
if (clientSpan.getDuration() != null) {
si.setDuration(clientSpan.getDuration());
}
if (clientSpan.getTimestamp() != null) {
si.setTimestamp(clientSpan.getTimestamp());
}
si.setTraceId(clientSpan.getTraceId());
si.setFragmentId(clientSpan.getId());
si.getProperties().addAll(clientSpan.binaryAnnotationMapping().getProperties());
si.setHostAddress(clientSpan.ipv4());
if (clientSpan.service() != null) {
si.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, clientSpan.service()));
}
si.setId(clientSpan.getId());
si.setMultipleConsumers(false);
URL url = rootOrServerSpan.url();
si.setEndpoint(new EndpointRef((url != null ? url.getPath() : null),
SpanDeriverUtil.deriveOperation(rootOrServerSpan), !rootOrServerSpan.serverSpan()));
return si;
}
}
return null;
} | [
"public",
"static",
"SourceInfo",
"getSourceInfo",
"(",
"String",
"tenantId",
",",
"Span",
"serverSpan",
",",
"SpanCache",
"spanCache",
")",
"{",
"String",
"clientSpanId",
"=",
"SpanUniqueIdGenerator",
".",
"getClientId",
"(",
"serverSpan",
".",
"getId",
"(",
")",... | This method attempts to derive the Source Information for the supplied server
span. If the information is not available, then a null will be returned, which
can be used to trigger a retry attempt if appropriate.
@param tenantId The tenant id
@param serverSpan The server span
@param spanCache The cache
@return The source information, or null if not found | [
"This",
"method",
"attempts",
"to",
"derive",
"the",
"Source",
"Information",
"for",
"the",
"supplied",
"server",
"span",
".",
"If",
"the",
"information",
"is",
"not",
"available",
"then",
"a",
"null",
"will",
"be",
"returned",
"which",
"can",
"be",
"used",
... | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/api/src/main/java/org/hawkular/apm/server/api/utils/SourceInfoUtil.java#L198-L238 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/DTDBasedZippedXMLMagicNumber.java | DTDBasedZippedXMLMagicNumber.isContentType | @Override
protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) {
return (this.publicId != null && this.publicId.equalsIgnoreCase(publicId))
|| (this.systemId != null && this.systemId.equalsIgnoreCase(systemId));
} | java | @Override
protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) {
return (this.publicId != null && this.publicId.equalsIgnoreCase(publicId))
|| (this.systemId != null && this.systemId.equalsIgnoreCase(systemId));
} | [
"@",
"Override",
"protected",
"boolean",
"isContentType",
"(",
"String",
"schemaId",
",",
"String",
"schemaVersion",
",",
"String",
"systemId",
",",
"String",
"publicId",
")",
"{",
"return",
"(",
"this",
".",
"publicId",
"!=",
"null",
"&&",
"this",
".",
"pub... | Replies if the specified stream contains data
that corresponds to this magic number.
@param schemaId is the ID of the XSL schema associated to this magic number.
@param schemaVersion is the ID of the XSL schema associated to this magic number.
@param systemId is the DTD system ID associated to this magic number.
@param publicId is the DTD system ID associated to this magic number.
@return <code>true</code> if this magic number is corresponding to the given
XML document, otherwise <code>false</code>. | [
"Replies",
"if",
"the",
"specified",
"stream",
"contains",
"data",
"that",
"corresponds",
"to",
"this",
"magic",
"number",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/DTDBasedZippedXMLMagicNumber.java#L78-L82 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplPlain_CustomFieldSerializer.java | OWLLiteralImplPlain_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplPlain instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplPlain instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLLiteralImplPlain",
"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",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplPlain_CustomFieldSerializer.java#L66-L69 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java | BitmapUtils.getSize | public static Point getSize(Resources res, int resId) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} | java | public static Point getSize(Resources res, int resId) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(res, resId, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} | [
"public",
"static",
"Point",
"getSize",
"(",
"Resources",
"res",
",",
"int",
"resId",
")",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"true",
";",
... | Get width and height of the bitmap specified with the resource id.
@param res resource accessor.
@param resId the resource id of the drawable.
@return the drawable bitmap size. | [
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"resource",
"id",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L153-L160 |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java | UserGroupManager.assignUserToUserGroup | @Nonnull
public EChange assignUserToUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sUserID)
{
// Resolve user group
final UserGroup aUserGroup = getOfID (sUserGroupID);
if (aUserGroup == null)
{
AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "assign-user");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock ().lock ();
try
{
if (aUserGroup.assignUser (sUserID).isUnchanged ())
return EChange.UNCHANGED;
BusinessObjectHelper.setLastModificationNow (aUserGroup);
internalUpdateItem (aUserGroup);
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
AuditHelper.onAuditModifySuccess (UserGroup.OT, "assign-user", sUserGroupID, sUserID);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupUserAssignment (aUserGroup, sUserID, true));
return EChange.CHANGED;
} | java | @Nonnull
public EChange assignUserToUserGroup (@Nullable final String sUserGroupID, @Nonnull @Nonempty final String sUserID)
{
// Resolve user group
final UserGroup aUserGroup = getOfID (sUserGroupID);
if (aUserGroup == null)
{
AuditHelper.onAuditModifyFailure (UserGroup.OT, sUserGroupID, "no-such-usergroup-id", "assign-user");
return EChange.UNCHANGED;
}
m_aRWLock.writeLock ().lock ();
try
{
if (aUserGroup.assignUser (sUserID).isUnchanged ())
return EChange.UNCHANGED;
BusinessObjectHelper.setLastModificationNow (aUserGroup);
internalUpdateItem (aUserGroup);
}
finally
{
m_aRWLock.writeLock ().unlock ();
}
AuditHelper.onAuditModifySuccess (UserGroup.OT, "assign-user", sUserGroupID, sUserID);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupUserAssignment (aUserGroup, sUserID, true));
return EChange.CHANGED;
} | [
"@",
"Nonnull",
"public",
"EChange",
"assignUserToUserGroup",
"(",
"@",
"Nullable",
"final",
"String",
"sUserGroupID",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sUserID",
")",
"{",
"// Resolve user group",
"final",
"UserGroup",
"aUserGroup",
"=",
"... | Assign the passed user ID to the passed user group.<br>
Note: no validity check must be performed for the user ID
@param sUserGroupID
ID of the user group to assign to
@param sUserID
ID of the user to be assigned.
@return {@link EChange#CHANGED} if the user group ID was valid, and the
specified user ID was not already contained. | [
"Assign",
"the",
"passed",
"user",
"ID",
"to",
"the",
"passed",
"user",
"group",
".",
"<br",
">",
"Note",
":",
"no",
"validity",
"check",
"must",
"be",
"performed",
"for",
"the",
"user",
"ID"
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java#L430-L460 |
powermock/powermock | powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java | PowerMockito.verifyNew | @SuppressWarnings("unchecked")
public static <T> ConstructorArgumentsVerification verifyNew(Class<T> mock, VerificationMode mode) {
return POWERMOCKITO_CORE.verifyNew(mock, mode);
} | java | @SuppressWarnings("unchecked")
public static <T> ConstructorArgumentsVerification verifyNew(Class<T> mock, VerificationMode mode) {
return POWERMOCKITO_CORE.verifyNew(mock, mode);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"ConstructorArgumentsVerification",
"verifyNew",
"(",
"Class",
"<",
"T",
">",
"mock",
",",
"VerificationMode",
"mode",
")",
"{",
"return",
"POWERMOCKITO_CORE",
".",
"verifyNew",... | Verifies certain behavior happened at least once / exact number of times
/ never. E.g:
<p>
<pre>
verifyNew(ClassWithStaticMethod.class, times(5));
verifyNew(ClassWithStaticMethod.class, atLeast(2));
//you can use flexible argument matchers, e.g:
verifyNew(ClassWithStaticMethod.class, atLeastOnce());
</pre>
<p>
<b>times(1) is the default</b> and can be omitted
<p>
@param mock to be verified
@param mode times(x), atLeastOnce() or never() | [
"Verifies",
"certain",
"behavior",
"happened",
"at",
"least",
"once",
"/",
"exact",
"number",
"of",
"times",
"/",
"never",
".",
"E",
".",
"g",
":",
"<p",
">",
"<pre",
">",
"verifyNew",
"(",
"ClassWithStaticMethod",
".",
"class",
"times",
"(",
"5",
"))",
... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L348-L351 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java | GeneratedDOAuth2UserDaoImpl.queryByUpdatedDate | public Iterable<DOAuth2User> queryByUpdatedDate(java.util.Date updatedDate) {
return queryByField(null, DOAuth2UserMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | java | public Iterable<DOAuth2User> queryByUpdatedDate(java.util.Date updatedDate) {
return queryByField(null, DOAuth2UserMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | [
"public",
"Iterable",
"<",
"DOAuth2User",
">",
"queryByUpdatedDate",
"(",
"java",
".",
"util",
".",
"Date",
"updatedDate",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DOAuth2UserMapper",
".",
"Field",
".",
"UPDATEDDATE",
".",
"getFieldName",
"(",
")... | query-by method for field updatedDate
@param updatedDate the specified attribute
@return an Iterable of DOAuth2Users for the specified updatedDate | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedDate"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L151-L153 |
oehf/ipf-oht-atna | nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/handlers/TLSEnabledSocketHandler.java | TLSEnabledSocketHandler.getInputStream | public InputStream getInputStream(URI uri) throws Exception {
boolean tlsURI = uri.getScheme().equalsIgnoreCase("https");
SecurityDomain securityDomain = null;
if (tlsURI) {
final NodeAuthModuleContext context = NodeAuthModuleContext.getContext();
securityDomain = context.getSecurityDomainManager().getSecurityDomain(uri);
}
return getInputStream(uri, securityDomain);
} | java | public InputStream getInputStream(URI uri) throws Exception {
boolean tlsURI = uri.getScheme().equalsIgnoreCase("https");
SecurityDomain securityDomain = null;
if (tlsURI) {
final NodeAuthModuleContext context = NodeAuthModuleContext.getContext();
securityDomain = context.getSecurityDomainManager().getSecurityDomain(uri);
}
return getInputStream(uri, securityDomain);
} | [
"public",
"InputStream",
"getInputStream",
"(",
"URI",
"uri",
")",
"throws",
"Exception",
"{",
"boolean",
"tlsURI",
"=",
"uri",
".",
"getScheme",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"https\"",
")",
";",
"SecurityDomain",
"securityDomain",
"=",
"null",
";... | /*
Note that this method always uses the system environment (specifically https.protocols)
in order to derive the HTTPS parameters. As such {@link SecurityDomain#SET_DOMAIN_ENVIRONMENT} must be
set to true if these parameters are not configured via system properties anyway.
@see org.openhealthtools.ihe.atna.nodeauth.SocketHandler#getInputStream(java.net.URI) | [
"/",
"*",
"Note",
"that",
"this",
"method",
"always",
"uses",
"the",
"system",
"environment",
"(",
"specifically",
"https",
".",
"protocols",
")",
"in",
"order",
"to",
"derive",
"the",
"HTTPS",
"parameters",
".",
"As",
"such",
"{",
"@link",
"SecurityDomain#S... | train | https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/handlers/TLSEnabledSocketHandler.java#L337-L345 |
demidenko05/beigesoft-webstore | src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java | PrcRefreshItemsInList.retrieveStartData | public final void retrieveStartData(final Map<String, Object> pReqVars) throws Exception {
try {
this.srvDatabase.setIsAutocommit(false);
this.srvDatabase.setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
this.srvDatabase.beginTransaction();
GoodsInListLuv goodsInListLuv = getSrvOrm().retrieveEntityById(pReqVars, GoodsInListLuv.class, 1L);
if (goodsInListLuv == null) {
goodsInListLuv = new GoodsInListLuv();
goodsInListLuv.setItsId(1L);
getSrvOrm().insertEntity(pReqVars, goodsInListLuv);
}
pReqVars.put("goodsInListLuv", goodsInListLuv);
List<LangPreferences> langPreferences = this.srvOrm.retrieveList(pReqVars, LangPreferences.class);
pReqVars.put("langPreferences", langPreferences);
this.srvDatabase.commitTransaction();
} catch (Exception ex) {
if (!this.srvDatabase.getIsAutocommit()) {
this.srvDatabase.rollBackTransaction();
}
throw ex;
} finally {
this.srvDatabase.releaseResources();
}
} | java | public final void retrieveStartData(final Map<String, Object> pReqVars) throws Exception {
try {
this.srvDatabase.setIsAutocommit(false);
this.srvDatabase.setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED);
this.srvDatabase.beginTransaction();
GoodsInListLuv goodsInListLuv = getSrvOrm().retrieveEntityById(pReqVars, GoodsInListLuv.class, 1L);
if (goodsInListLuv == null) {
goodsInListLuv = new GoodsInListLuv();
goodsInListLuv.setItsId(1L);
getSrvOrm().insertEntity(pReqVars, goodsInListLuv);
}
pReqVars.put("goodsInListLuv", goodsInListLuv);
List<LangPreferences> langPreferences = this.srvOrm.retrieveList(pReqVars, LangPreferences.class);
pReqVars.put("langPreferences", langPreferences);
this.srvDatabase.commitTransaction();
} catch (Exception ex) {
if (!this.srvDatabase.getIsAutocommit()) {
this.srvDatabase.rollBackTransaction();
}
throw ex;
} finally {
this.srvDatabase.releaseResources();
}
} | [
"public",
"final",
"void",
"retrieveStartData",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pReqVars",
")",
"throws",
"Exception",
"{",
"try",
"{",
"this",
".",
"srvDatabase",
".",
"setIsAutocommit",
"(",
"false",
")",
";",
"this",
".",
"srvDa... | <p>Retrieve start data.</p>
@param pReqVars additional param
@throws Exception - an exception | [
"<p",
">",
"Retrieve",
"start",
"data",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-webstore/blob/41ed2e2f1c640d37951d5fb235f26856008b87e1/src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java#L235-L258 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/util/IntBitRelation.java | IntBitRelation.composeLeftLeftInv | public void composeLeftLeftInv(IntBitRelation left, IntBitRelation right) {
int i, a, b;
IntBitSet li, ri;
for (i = 0; i < line.length; i++) {
li = left.line[i];
ri = right.line[i];
if (li != null && ri != null) {
for (a = li.first(); a != -1; a = li.next(a)) {
for (b = ri.first(); b != -1; b = ri.next(b)) {
add(b, a);
}
}
}
}
} | java | public void composeLeftLeftInv(IntBitRelation left, IntBitRelation right) {
int i, a, b;
IntBitSet li, ri;
for (i = 0; i < line.length; i++) {
li = left.line[i];
ri = right.line[i];
if (li != null && ri != null) {
for (a = li.first(); a != -1; a = li.next(a)) {
for (b = ri.first(); b != -1; b = ri.next(b)) {
add(b, a);
}
}
}
}
} | [
"public",
"void",
"composeLeftLeftInv",
"(",
"IntBitRelation",
"left",
",",
"IntBitRelation",
"right",
")",
"{",
"int",
"i",
",",
"a",
",",
"b",
";",
"IntBitSet",
"li",
",",
"ri",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"line",
".",
"length",
... | If (x,a) is element of left and (x,b) is element of right,
(b,a) is added to this relation.
@param left left relation
@param right right relation | [
"If",
"(",
"x",
"a",
")",
"is",
"element",
"of",
"left",
"and",
"(",
"x",
"b",
")",
"is",
"element",
"of",
"right",
"(",
"b",
"a",
")",
"is",
"added",
"to",
"this",
"relation",
"."
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L125-L140 |
dbracewell/mango | src/main/java/com/davidbracewell/json/JsonWriter.java | JsonWriter.property | protected JsonWriter property(String key, Iterator<?> iterator) throws IOException {
return property(key, Collect.asIterable(iterator));
} | java | protected JsonWriter property(String key, Iterator<?> iterator) throws IOException {
return property(key, Collect.asIterable(iterator));
} | [
"protected",
"JsonWriter",
"property",
"(",
"String",
"key",
",",
"Iterator",
"<",
"?",
">",
"iterator",
")",
"throws",
"IOException",
"{",
"return",
"property",
"(",
"key",
",",
"Collect",
".",
"asIterable",
"(",
"iterator",
")",
")",
";",
"}"
] | Writes an iterator with the given key name
@param key the key name for the collection
@param iterator the iterator to be written
@return This structured writer
@throws IOException Something went wrong writing | [
"Writes",
"an",
"iterator",
"with",
"the",
"given",
"key",
"name"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonWriter.java#L280-L282 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/util/Reflection.java | Reflection.constructorMethodHandle | public static MethodHandle constructorMethodHandle(StandardErrorCode errorCode, Class<?> clazz, Class<?>... parameterTypes)
{
try {
return MethodHandles.lookup().unreflectConstructor(clazz.getConstructor(parameterTypes));
}
catch (IllegalAccessException | NoSuchMethodException e) {
throw new PrestoException(errorCode, e);
}
} | java | public static MethodHandle constructorMethodHandle(StandardErrorCode errorCode, Class<?> clazz, Class<?>... parameterTypes)
{
try {
return MethodHandles.lookup().unreflectConstructor(clazz.getConstructor(parameterTypes));
}
catch (IllegalAccessException | NoSuchMethodException e) {
throw new PrestoException(errorCode, e);
}
} | [
"public",
"static",
"MethodHandle",
"constructorMethodHandle",
"(",
"StandardErrorCode",
"errorCode",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"try",
"{",
"return",
"MethodHandles",
".",
"lookup",
"(... | Returns a MethodHandle corresponding to the specified constructor.
<p>
Warning: The way Oracle JVM implements producing MethodHandle for a constructor involves
creating JNI global weak references. G1 processes such references serially. As a result,
calling this method in a tight loop can create significant GC pressure and significantly
increase application pause time. | [
"Returns",
"a",
"MethodHandle",
"corresponding",
"to",
"the",
"specified",
"constructor",
".",
"<p",
">",
"Warning",
":",
"The",
"way",
"Oracle",
"JVM",
"implements",
"producing",
"MethodHandle",
"for",
"a",
"constructor",
"involves",
"creating",
"JNI",
"global",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/Reflection.java#L121-L129 |
infinispan/infinispan | lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java | ConfigurationParseHelper.parseBoolean | public static final boolean parseBoolean(String value, String errorMsgOnParseFailure) {
// avoiding Boolean.valueOf() to have more checks: makes it easy to spot wrong type in cfg.
if (value == null) {
throw new SearchException(errorMsgOnParseFailure);
} else if ("false".equalsIgnoreCase(value.trim())) {
return false;
} else if ("true".equalsIgnoreCase(value.trim())) {
return true;
} else {
throw new SearchException(errorMsgOnParseFailure);
}
} | java | public static final boolean parseBoolean(String value, String errorMsgOnParseFailure) {
// avoiding Boolean.valueOf() to have more checks: makes it easy to spot wrong type in cfg.
if (value == null) {
throw new SearchException(errorMsgOnParseFailure);
} else if ("false".equalsIgnoreCase(value.trim())) {
return false;
} else if ("true".equalsIgnoreCase(value.trim())) {
return true;
} else {
throw new SearchException(errorMsgOnParseFailure);
}
} | [
"public",
"static",
"final",
"boolean",
"parseBoolean",
"(",
"String",
"value",
",",
"String",
"errorMsgOnParseFailure",
")",
"{",
"// avoiding Boolean.valueOf() to have more checks: makes it easy to spot wrong type in cfg.",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"thr... | Parses a string to recognize exactly either "true" or "false".
@param value the string to be parsed
@param errorMsgOnParseFailure the message to be put in the exception if thrown
@return true if value is "true", false if value is "false"
@throws SearchException for invalid format or values. | [
"Parses",
"a",
"string",
"to",
"recognize",
"exactly",
"either",
"true",
"or",
"false",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L111-L122 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.overlayString | public static String overlayString(String text, String overlay, int start, int end) {
return new StringBuffer(start + overlay.length() + text.length() - end + 1)
.append(text.substring(0, start))
.append(overlay)
.append(text.substring(end))
.toString();
} | java | public static String overlayString(String text, String overlay, int start, int end) {
return new StringBuffer(start + overlay.length() + text.length() - end + 1)
.append(text.substring(0, start))
.append(overlay)
.append(text.substring(end))
.toString();
} | [
"public",
"static",
"String",
"overlayString",
"(",
"String",
"text",
",",
"String",
"overlay",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"new",
"StringBuffer",
"(",
"start",
"+",
"overlay",
".",
"length",
"(",
")",
"+",
"text",
".",
... | <p>Overlays part of a String with another String.</p>
<pre>
GosuStringUtil.overlayString(null, *, *, *) = NullPointerException
GosuStringUtil.overlayString(*, null, *, *) = NullPointerException
GosuStringUtil.overlayString("", "abc", 0, 0) = "abc"
GosuStringUtil.overlayString("abcdef", null, 2, 4) = "abef"
GosuStringUtil.overlayString("abcdef", "", 2, 4) = "abef"
GosuStringUtil.overlayString("abcdef", "zzzz", 2, 4) = "abzzzzef"
GosuStringUtil.overlayString("abcdef", "zzzz", 4, 2) = "abcdzzzzcdef"
GosuStringUtil.overlayString("abcdef", "zzzz", -1, 4) = IndexOutOfBoundsException
GosuStringUtil.overlayString("abcdef", "zzzz", 2, 8) = IndexOutOfBoundsException
</pre>
@param text the String to do overlaying in, may be null
@param overlay the String to overlay, may be null
@param start the position to start overlaying at, must be valid
@param end the position to stop overlaying before, must be valid
@return overlayed String, <code>null</code> if null String input
@throws NullPointerException if text or overlay is null
@throws IndexOutOfBoundsException if either position is invalid
@deprecated Use better named {@link #overlay(String, String, int, int)} instead.
Method will be removed in Commons Lang 3.0. | [
"<p",
">",
"Overlays",
"part",
"of",
"a",
"String",
"with",
"another",
"String",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L3843-L3849 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return keyManager(keyCertChainInputStream, keyInputStream, null);
} | java | public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream) {
return keyManager(keyCertChainInputStream, keyInputStream, null);
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"InputStream",
"keyCertChainInputStream",
",",
"InputStream",
"keyInputStream",
")",
"{",
"return",
"keyManager",
"(",
"keyCertChainInputStream",
",",
"keyInputStream",
",",
"null",
")",
";",
"}"
] | Identifying certificate for this host. {@code keyCertChainInputStream} and {@code keyInputStream} may
be {@code null} for client contexts, which disables mutual authentication.
@param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
@param keyInputStream an input stream for a PKCS#8 private key in PEM format | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChainInputStream",
"}",
"and",
"{",
"@code",
"keyInputStream",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authenticatio... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L235-L237 |
haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/ColorSpaces.java | ColorSpaces.createColorSpace | public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) {
Validate.notNull(profile, "profile");
// Fix profile before lookup/create
profileCleaner.fixProfile(profile);
byte[] profileHeader = getProfileHeaderWithProfileId(profile);
ICC_ColorSpace cs = getInternalCS(profile.getColorSpaceType(), profileHeader);
if (cs != null) {
return cs;
}
return getCachedOrCreateCS(profile, profileHeader);
} | java | public static ICC_ColorSpace createColorSpace(final ICC_Profile profile) {
Validate.notNull(profile, "profile");
// Fix profile before lookup/create
profileCleaner.fixProfile(profile);
byte[] profileHeader = getProfileHeaderWithProfileId(profile);
ICC_ColorSpace cs = getInternalCS(profile.getColorSpaceType(), profileHeader);
if (cs != null) {
return cs;
}
return getCachedOrCreateCS(profile, profileHeader);
} | [
"public",
"static",
"ICC_ColorSpace",
"createColorSpace",
"(",
"final",
"ICC_Profile",
"profile",
")",
"{",
"Validate",
".",
"notNull",
"(",
"profile",
",",
"\"profile\"",
")",
";",
"// Fix profile before lookup/create",
"profileCleaner",
".",
"fixProfile",
"(",
"prof... | Creates an ICC color space from the given ICC color profile.
<p />
For standard Java color spaces, the built-in instance is returned.
Otherwise, color spaces are looked up from cache and created on demand.
@param profile the ICC color profile. May not be {@code null}.
@return an ICC color space
@throws IllegalArgumentException if {@code profile} is {@code null}.
@throws java.awt.color.CMMException if {@code profile} is invalid. | [
"Creates",
"an",
"ICC",
"color",
"space",
"from",
"the",
"given",
"ICC",
"color",
"profile",
".",
"<p",
"/",
">",
"For",
"standard",
"Java",
"color",
"spaces",
"the",
"built",
"-",
"in",
"instance",
"is",
"returned",
".",
"Otherwise",
"color",
"spaces",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/color/ColorSpaces.java#L129-L143 |
Waikato/moa | moa/src/main/java/moa/core/Utils.java | Utils.getFlag | public static boolean getFlag(String flag, String[] options)
throws Exception {
int pos = getOptionPos(flag, options);
if (pos > -1)
options[pos] = "";
return (pos > -1);
} | java | public static boolean getFlag(String flag, String[] options)
throws Exception {
int pos = getOptionPos(flag, options);
if (pos > -1)
options[pos] = "";
return (pos > -1);
} | [
"public",
"static",
"boolean",
"getFlag",
"(",
"String",
"flag",
",",
"String",
"[",
"]",
"options",
")",
"throws",
"Exception",
"{",
"int",
"pos",
"=",
"getOptionPos",
"(",
"flag",
",",
"options",
")",
";",
"if",
"(",
"pos",
">",
"-",
"1",
")",
"opt... | Checks if the given array contains the flag "-String". Stops
searching at the first marker "--". If the flag is found,
it is replaced with the empty string.
@param flag the String indicating the flag.
@param options the array of strings containing all the options.
@return true if the flag was found
@exception Exception if an illegal option was found | [
"Checks",
"if",
"the",
"given",
"array",
"contains",
"the",
"flag",
"-",
"String",
".",
"Stops",
"searching",
"at",
"the",
"first",
"marker",
"--",
".",
"If",
"the",
"flag",
"is",
"found",
"it",
"is",
"replaced",
"with",
"the",
"empty",
"string",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L482-L491 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_dupl.java | Scs_dupl.cs_dupl | public static boolean cs_dupl(Scs A) {
int i, j, p, q, nz = 0, n, m, Ap[], Ai[], w[];
float Ax[];
if (!Scs_util.CS_CSC(A))
return (false);
/* check inputs */
m = A.m;
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
w = new int[m]; /* get workspace */
for (i = 0; i < m; i++)
w[i] = -1; /* row i not yet seen */
for (j = 0; j < n; j++) {
q = nz; /* column j will start at q */
for (p = Ap[j]; p < Ap[j + 1]; p++) {
i = Ai[p]; /* A(i,j) is nonzero */
if (w[i] >= q) {
Ax[w[i]] += Ax[p]; /* A(i,j) is a duplicate */
} else {
w[i] = nz; /* record where row i occurs */
Ai[nz] = i; /* keep A(i,j) */
Ax[nz++] = Ax[p];
}
}
Ap[j] = q; /* record start of column j */
}
Ap[n] = nz; /* finalize A */
return Scs_util.cs_sprealloc(A, 0); /* remove extra space from A */
} | java | public static boolean cs_dupl(Scs A) {
int i, j, p, q, nz = 0, n, m, Ap[], Ai[], w[];
float Ax[];
if (!Scs_util.CS_CSC(A))
return (false);
/* check inputs */
m = A.m;
n = A.n;
Ap = A.p;
Ai = A.i;
Ax = A.x;
w = new int[m]; /* get workspace */
for (i = 0; i < m; i++)
w[i] = -1; /* row i not yet seen */
for (j = 0; j < n; j++) {
q = nz; /* column j will start at q */
for (p = Ap[j]; p < Ap[j + 1]; p++) {
i = Ai[p]; /* A(i,j) is nonzero */
if (w[i] >= q) {
Ax[w[i]] += Ax[p]; /* A(i,j) is a duplicate */
} else {
w[i] = nz; /* record where row i occurs */
Ai[nz] = i; /* keep A(i,j) */
Ax[nz++] = Ax[p];
}
}
Ap[j] = q; /* record start of column j */
}
Ap[n] = nz; /* finalize A */
return Scs_util.cs_sprealloc(A, 0); /* remove extra space from A */
} | [
"public",
"static",
"boolean",
"cs_dupl",
"(",
"Scs",
"A",
")",
"{",
"int",
"i",
",",
"j",
",",
"p",
",",
"q",
",",
"nz",
"=",
"0",
",",
"n",
",",
"m",
",",
"Ap",
"[",
"]",
",",
"Ai",
"[",
"]",
",",
"w",
"[",
"]",
";",
"float",
"Ax",
"[... | Removes and sums duplicate entries in a sparse matrix.
@param A
column-compressed matrix
@return true if successful, false on error | [
"Removes",
"and",
"sums",
"duplicate",
"entries",
"in",
"a",
"sparse",
"matrix",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_dupl.java#L44-L74 |
lets-blade/blade | src/main/java/com/blade/server/netty/RouteMethodHandler.java | RouteMethodHandler.invokeHook | private boolean invokeHook(List<Route> hooks, RouteContext context) throws Exception {
for (Route hook : hooks) {
if (hook.getTargetType() == RouteHandler.class) {
RouteHandler routeHandler = (RouteHandler) hook.getTarget();
routeHandler.handle(context);
if (context.isAbort()) {
return false;
}
} else if (hook.getTargetType() == RouteHandler0.class) {
RouteHandler0 routeHandler = (RouteHandler0) hook.getTarget();
routeHandler.handle(context.request(), context.response());
} else {
boolean flag = this.invokeHook(context, hook);
if (!flag) return false;
}
}
return true;
} | java | private boolean invokeHook(List<Route> hooks, RouteContext context) throws Exception {
for (Route hook : hooks) {
if (hook.getTargetType() == RouteHandler.class) {
RouteHandler routeHandler = (RouteHandler) hook.getTarget();
routeHandler.handle(context);
if (context.isAbort()) {
return false;
}
} else if (hook.getTargetType() == RouteHandler0.class) {
RouteHandler0 routeHandler = (RouteHandler0) hook.getTarget();
routeHandler.handle(context.request(), context.response());
} else {
boolean flag = this.invokeHook(context, hook);
if (!flag) return false;
}
}
return true;
} | [
"private",
"boolean",
"invokeHook",
"(",
"List",
"<",
"Route",
">",
"hooks",
",",
"RouteContext",
"context",
")",
"throws",
"Exception",
"{",
"for",
"(",
"Route",
"hook",
":",
"hooks",
")",
"{",
"if",
"(",
"hook",
".",
"getTargetType",
"(",
")",
"==",
... | invoke hooks
@param hooks webHook list
@param context http request
@return return invoke hook is abort | [
"invoke",
"hooks"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/server/netty/RouteMethodHandler.java#L348-L365 |
jbundle/jbundle | main/screen/src/main/java/org/jbundle/main/user/screen/UserLoginScreen.java | UserLoginScreen.addToolbars | public ToolScreen addToolbars()
{
ToolScreen screen = new ToolScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.LOGIN);
BaseApplication application = (BaseApplication)this.getTask().getApplication();
String strDesc = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(UserEntryScreen.CREATE_NEW_USER);
String strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserEntryScreen.class.getName());
new SCannedBox(screen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.DONT_SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, strCommand, MenuConstants.FORM + "Tip");
return screen;
} | java | public ToolScreen addToolbars()
{
ToolScreen screen = new ToolScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET);
new SCannedBox(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.LOGIN);
BaseApplication application = (BaseApplication)this.getTask().getApplication();
String strDesc = application.getResources(ResourceConstants.MAIN_RESOURCE, true).getString(UserEntryScreen.CREATE_NEW_USER);
String strCommand = Utility.addURLParam(null, DBParams.SCREEN, UserEntryScreen.class.getName());
new SCannedBox(screen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.DONT_SET_ANCHOR), screen, null, ScreenConstants.DEFAULT_DISPLAY, null, strDesc, MenuConstants.FORM, strCommand, MenuConstants.FORM + "Tip");
return screen;
} | [
"public",
"ToolScreen",
"addToolbars",
"(",
")",
"{",
"ToolScreen",
"screen",
"=",
"new",
"ToolScreen",
"(",
"null",
",",
"this",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"null",
")",
";",
"new",
"SCannedBox",
"(",
"screen",
... | Add the toolbars that belong with this screen.
@return The new toolbar. | [
"Add",
"the",
"toolbars",
"that",
"belong",
"with",
"this",
"screen",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserLoginScreen.java#L108-L118 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addIdInCollectionCondition | protected void addIdInCollectionCondition(final Expression<?> property, final Collection<?> values) {
if (values == null || values.isEmpty()) {
fieldConditions.add(getCriteriaBuilder().equal(property, -1));
} else {
fieldConditions.add(property.in(values));
}
} | java | protected void addIdInCollectionCondition(final Expression<?> property, final Collection<?> values) {
if (values == null || values.isEmpty()) {
fieldConditions.add(getCriteriaBuilder().equal(property, -1));
} else {
fieldConditions.add(property.in(values));
}
} | [
"protected",
"void",
"addIdInCollectionCondition",
"(",
"final",
"Expression",
"<",
"?",
">",
"property",
",",
"final",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"isEmpty",
"(",
")",
")",
"{"... | Add a Field Search Condition that will check if the id field exists in an array of values. eg. {@code field IN (values)}
@param property The field id as defined in the Entity mapping class.
@param values The List of Ids to be compared to. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"id",
"field",
"exists",
"in",
"an",
"array",
"of",
"values",
".",
"eg",
".",
"{",
"@code",
"field",
"IN",
"(",
"values",
")",
"}"
] | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L302-L308 |
apereo/person-directory | person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java | AbstractQueryPersonAttributeDao.appendCanonicalizedAttributeToQuery | protected QB appendCanonicalizedAttributeToQuery(final QB queryBuilder, final String queryAttribute, final String dataAttribute, final List<Object> queryValues) {
// All logging messages were previously in generateQuery() and were
// copy/pasted verbatim
final List<Object> canonicalizedQueryValues = this.canonicalizeAttribute(queryAttribute, queryValues, caseInsensitiveQueryAttributes);
if (dataAttribute == null) {
// preserved from historical versions which just pass queryValues through without any association to a dataAttribute,
// and a slightly different log message
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + queryAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + dataAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
} | java | protected QB appendCanonicalizedAttributeToQuery(final QB queryBuilder, final String queryAttribute, final String dataAttribute, final List<Object> queryValues) {
// All logging messages were previously in generateQuery() and were
// copy/pasted verbatim
final List<Object> canonicalizedQueryValues = this.canonicalizeAttribute(queryAttribute, queryValues, caseInsensitiveQueryAttributes);
if (dataAttribute == null) {
// preserved from historical versions which just pass queryValues through without any association to a dataAttribute,
// and a slightly different log message
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + queryAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("Adding attribute '" + dataAttribute + "' with value '" + queryValues + "' to query builder '" + queryBuilder + "'");
}
return appendAttributeToQuery(queryBuilder, dataAttribute, canonicalizedQueryValues);
} | [
"protected",
"QB",
"appendCanonicalizedAttributeToQuery",
"(",
"final",
"QB",
"queryBuilder",
",",
"final",
"String",
"queryAttribute",
",",
"final",
"String",
"dataAttribute",
",",
"final",
"List",
"<",
"Object",
">",
"queryValues",
")",
"{",
"// All logging messages... | Append the attribute and its canonicalized value/s to the
{@code queryBuilder}. Uses {@code queryAttribute} to determine whether or
not the value/s should be canonicalized. I.e. the behavior is controlled
by {@link #setCaseInsensitiveQueryAttributes(java.util.Map)}.
<p>This method is only concerned with canonicalizing the query attribute
value. It is still up to the subclass to canonicalize the data-layer
attribute value prior to comparison, if necessary. For example, if
the data layer is a case-sensitive relational database and attributes
therein are stored in mixed case, but comparison should be
case-insensitive, the relational column reference would need to be
wrapped in a {@code lower()} or {@code upper()} function. (This, of
course, needs to be handled with care, since it can lead to table
scanning if the store does not support function-based indexes.) Such
data-layer canonicalization would be unnecessary if the data layer is
case-insensitive or stores values in the same canonicalized form as has
been configured for the app-layer attribute.
See {@link AbstractJdbcPersonAttributeDao#setCaseInsensitiveDataAttributes(java.util.Map)}</p>
@param queryBuilder The sub-class specific query builder object
@param queryAttribute The full attribute name to append
@param dataAttribute The full attribute name to append
@param queryValues The values for the data attribute
@return An updated queryBuilder | [
"Append",
"the",
"attribute",
"and",
"its",
"canonicalized",
"value",
"/",
"s",
"to",
"the",
"{",
"@code",
"queryBuilder",
"}",
".",
"Uses",
"{",
"@code",
"queryAttribute",
"}",
"to",
"determine",
"whether",
"or",
"not",
"the",
"value",
"/",
"s",
"should",... | train | https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java#L325-L341 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.getVfsExportData | public CmsStaticExportData getVfsExportData(CmsObject cms, String vfsName) {
return getRfsExportData(cms, getRfsName(cms, vfsName));
} | java | public CmsStaticExportData getVfsExportData(CmsObject cms, String vfsName) {
return getRfsExportData(cms, getRfsName(cms, vfsName));
} | [
"public",
"CmsStaticExportData",
"getVfsExportData",
"(",
"CmsObject",
"cms",
",",
"String",
"vfsName",
")",
"{",
"return",
"getRfsExportData",
"(",
"cms",
",",
"getRfsName",
"(",
"cms",
",",
"vfsName",
")",
")",
";",
"}"
] | Returns the export data for a requested resource, if null is returned no export is required.<p>
@param cms an initialized cms context (should be initialized with the "Guest" user only
@param vfsName the VFS name of the resource requested
@return the export data for the request, if null is returned no export is required | [
"Returns",
"the",
"export",
"data",
"for",
"a",
"requested",
"resource",
"if",
"null",
"is",
"returned",
"no",
"export",
"is",
"required",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L1511-L1514 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeColor | @Pure
public static int getAttributeColor(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeColorWithDefault(document, true, 0, path);
} | java | @Pure
public static int getAttributeColor(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeColorWithDefault(document, true, 0, path);
} | [
"@",
"Pure",
"public",
"static",
"int",
"getAttributeColor",
"(",
"Node",
"document",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"return",
"getAttributeColorWi... | Replies the color that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of and ended by the attribute's name.
@return the color of the specified attribute. | [
"Replies",
"the",
"color",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L437-L441 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/repeater/RepeaterExampleWithStaticIDs.java | RepeaterExampleWithStaticIDs.fetchDataList | private static List<ContactDetails> fetchDataList() {
List<ContactDetails> list = new ArrayList<>();
list.add(new ContactDetails("David", "1234", new String[]{"a", "b"}));
list.add(new ContactDetails("Jun", "1111", new String[]{"c"}));
list.add(new ContactDetails("Martin", null, new String[]{"b"}));
return list;
} | java | private static List<ContactDetails> fetchDataList() {
List<ContactDetails> list = new ArrayList<>();
list.add(new ContactDetails("David", "1234", new String[]{"a", "b"}));
list.add(new ContactDetails("Jun", "1111", new String[]{"c"}));
list.add(new ContactDetails("Martin", null, new String[]{"b"}));
return list;
} | [
"private",
"static",
"List",
"<",
"ContactDetails",
">",
"fetchDataList",
"(",
")",
"{",
"List",
"<",
"ContactDetails",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"list",
".",
"add",
"(",
"new",
"ContactDetails",
"(",
"\"David\"",
",",
"\... | Retrieves dummy data used by this example.
@return the list of data for this example. | [
"Retrieves",
"dummy",
"data",
"used",
"by",
"this",
"example",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/repeater/RepeaterExampleWithStaticIDs.java#L360-L366 |
radkovo/Pdf2Dom | src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java | CSSBoxTree.createTextBox | protected TextBox createTextBox(BlockBox contblock, Text n)
{
TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create());
text.setOrder(next_order++);
text.setContainingBlockBox(contblock);
text.setClipBlock(contblock);
text.setViewport(viewport);
text.setBase(baseurl);
return text;
} | java | protected TextBox createTextBox(BlockBox contblock, Text n)
{
TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create());
text.setOrder(next_order++);
text.setContainingBlockBox(contblock);
text.setClipBlock(contblock);
text.setViewport(viewport);
text.setBase(baseurl);
return text;
} | [
"protected",
"TextBox",
"createTextBox",
"(",
"BlockBox",
"contblock",
",",
"Text",
"n",
")",
"{",
"TextBox",
"text",
"=",
"new",
"TextBox",
"(",
"n",
",",
"(",
"Graphics2D",
")",
"contblock",
".",
"getGraphics",
"(",
")",
".",
"create",
"(",
")",
",",
... | Creates a text box with the given parent and text node assigned.
@param contblock The parent node (and the containing block in the same time)
@param n The corresponding text node in the DOM tree.
@return The new text box. | [
"Creates",
"a",
"text",
"box",
"with",
"the",
"given",
"parent",
"and",
"text",
"node",
"assigned",
"."
] | train | https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L315-L324 |
alkacon/opencms-core | src/org/opencms/util/CmsXsltUtil.java | CmsXsltUtil.isFormattingInformation | private static boolean isFormattingInformation(String formatString, String delimiter) {
String[] formatStrings = formatString.split(delimiter);
for (int i = 0; i < formatStrings.length; i++) {
if (!formatStrings[i].trim().matches("[lcr]")) {
return false;
}
}
return true;
} | java | private static boolean isFormattingInformation(String formatString, String delimiter) {
String[] formatStrings = formatString.split(delimiter);
for (int i = 0; i < formatStrings.length; i++) {
if (!formatStrings[i].trim().matches("[lcr]")) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"isFormattingInformation",
"(",
"String",
"formatString",
",",
"String",
"delimiter",
")",
"{",
"String",
"[",
"]",
"formatStrings",
"=",
"formatString",
".",
"split",
"(",
"delimiter",
")",
";",
"for",
"(",
"int",
"i",
"=",
"... | Tests if the given string is a <code>delimiter</code> separated list of formatting information.<p>
@param formatString the string to check
@param delimiter the list separators
@return true if the string is a <code>delimiter</code> separated list of Formatting Information | [
"Tests",
"if",
"the",
"given",
"string",
"is",
"a",
"<code",
">",
"delimiter<",
"/",
"code",
">",
"separated",
"list",
"of",
"formatting",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsXsltUtil.java#L285-L294 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/primitives/Ints.java | Ints.fromByteArray | @GwtIncompatible // doesn't work
public static int fromByteArray(byte[] bytes) {
checkArgument(bytes.length >= BYTES, "array too small: %s < %s", bytes.length, BYTES);
return fromBytes(bytes[0], bytes[1], bytes[2], bytes[3]);
} | java | @GwtIncompatible // doesn't work
public static int fromByteArray(byte[] bytes) {
checkArgument(bytes.length >= BYTES, "array too small: %s < %s", bytes.length, BYTES);
return fromBytes(bytes[0], bytes[1], bytes[2], bytes[3]);
} | [
"@",
"GwtIncompatible",
"// doesn't work",
"public",
"static",
"int",
"fromByteArray",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"checkArgument",
"(",
"bytes",
".",
"length",
">=",
"BYTES",
",",
"\"array too small: %s < %s\"",
",",
"bytes",
".",
"length",
",",
... | Returns the {@code int} value whose big-endian representation is stored in the first 4 bytes of
{@code bytes}; equivalent to {@code ByteBuffer.wrap(bytes).getInt()}. For example, the input
byte array {@code {0x12, 0x13, 0x14, 0x15, 0x33}} would yield the {@code int} value
{@code 0x12131415}.
<p>Arguably, it's preferable to use {@link java.nio.ByteBuffer}; that library exposes much more
flexibility at little cost in readability.
@throws IllegalArgumentException if {@code bytes} has fewer than 4 elements | [
"Returns",
"the",
"{",
"@code",
"int",
"}",
"value",
"whose",
"big",
"-",
"endian",
"representation",
"is",
"stored",
"in",
"the",
"first",
"4",
"bytes",
"of",
"{",
"@code",
"bytes",
"}",
";",
"equivalent",
"to",
"{",
"@code",
"ByteBuffer",
".",
"wrap",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/primitives/Ints.java#L307-L311 |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/flattener/PatternFlattener.java | PatternFlattener.parseDateParameter | static DateFiller parseDateParameter(String wrappedParameter, String trimmedParameter) {
if (trimmedParameter.startsWith(PARAMETER_DATE + " ")
&& trimmedParameter.length() > PARAMETER_DATE.length() + 1) {
String dateFormat = trimmedParameter.substring(PARAMETER_DATE.length() + 1);
return new DateFiller(wrappedParameter, trimmedParameter, dateFormat);
} else if (trimmedParameter.equals(PARAMETER_DATE)) {
return new DateFiller(wrappedParameter, trimmedParameter, DEFAULT_DATE_FORMAT);
}
return null;
} | java | static DateFiller parseDateParameter(String wrappedParameter, String trimmedParameter) {
if (trimmedParameter.startsWith(PARAMETER_DATE + " ")
&& trimmedParameter.length() > PARAMETER_DATE.length() + 1) {
String dateFormat = trimmedParameter.substring(PARAMETER_DATE.length() + 1);
return new DateFiller(wrappedParameter, trimmedParameter, dateFormat);
} else if (trimmedParameter.equals(PARAMETER_DATE)) {
return new DateFiller(wrappedParameter, trimmedParameter, DEFAULT_DATE_FORMAT);
}
return null;
} | [
"static",
"DateFiller",
"parseDateParameter",
"(",
"String",
"wrappedParameter",
",",
"String",
"trimmedParameter",
")",
"{",
"if",
"(",
"trimmedParameter",
".",
"startsWith",
"(",
"PARAMETER_DATE",
"+",
"\" \"",
")",
"&&",
"trimmedParameter",
".",
"length",
"(",
... | Try to create a date filler if the given parameter is a date parameter.
@return created date filler, or null if the given parameter is not a date parameter | [
"Try",
"to",
"create",
"a",
"date",
"filler",
"if",
"the",
"given",
"parameter",
"is",
"a",
"date",
"parameter",
"."
] | train | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/flattener/PatternFlattener.java#L191-L200 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java | ClustersInner.update | public ClusterInner update(String resourceGroupName, String clusterName) {
return updateWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public ClusterInner update(String resourceGroupName, String clusterName) {
return updateWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"ClusterInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
"."... | Patch HDInsight cluster with the specified parameters.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ClusterInner object if successful. | [
"Patch",
"HDInsight",
"cluster",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L335-L337 |
meltmedia/cadmium | servlets/src/main/java/com/meltmedia/cadmium/servlets/jersey/error/ErrorUtil.java | ErrorUtil.internalError | public static Response internalError(Throwable throwable, UriInfo uriInfo) {
GenericError error = new GenericError(
ExceptionUtils.getRootCauseMessage(throwable),
ErrorCode.INTERNAL.getCode(),
uriInfo.getAbsolutePath().toString());
if (!isProduction()) {
error.setStack(ExceptionUtils.getStackTrace(throwable));
}
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(error)
.build();
} | java | public static Response internalError(Throwable throwable, UriInfo uriInfo) {
GenericError error = new GenericError(
ExceptionUtils.getRootCauseMessage(throwable),
ErrorCode.INTERNAL.getCode(),
uriInfo.getAbsolutePath().toString());
if (!isProduction()) {
error.setStack(ExceptionUtils.getStackTrace(throwable));
}
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(error)
.build();
} | [
"public",
"static",
"Response",
"internalError",
"(",
"Throwable",
"throwable",
",",
"UriInfo",
"uriInfo",
")",
"{",
"GenericError",
"error",
"=",
"new",
"GenericError",
"(",
"ExceptionUtils",
".",
"getRootCauseMessage",
"(",
"throwable",
")",
",",
"ErrorCode",
".... | Creates Jersey response corresponding to internal error
@param throwable {@link Throwable} object representing an error
@param uriInfo {@link UriInfo} object used for forming links
@return {@link Response} Jersey response object containing JSON representation of the error. | [
"Creates",
"Jersey",
"response",
"corresponding",
"to",
"internal",
"error"
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/jersey/error/ErrorUtil.java#L51-L65 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.listQueryResultsForSubscription | public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) {
return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().body();
} | java | public PolicyStatesQueryResultsInner listQueryResultsForSubscription(PolicyStatesResource policyStatesResource, String subscriptionId) {
return listQueryResultsForSubscriptionWithServiceResponseAsync(policyStatesResource, subscriptionId).toBlocking().single().body();
} | [
"public",
"PolicyStatesQueryResultsInner",
"listQueryResultsForSubscription",
"(",
"PolicyStatesResource",
"policyStatesResource",
",",
"String",
"subscriptionId",
")",
"{",
"return",
"listQueryResultsForSubscriptionWithServiceResponseAsync",
"(",
"policyStatesResource",
",",
"subscr... | Queries policy states for the resources under the subscription.
@param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
@param subscriptionId Microsoft Azure subscription ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyStatesQueryResultsInner object if successful. | [
"Queries",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L516-L518 |
knowm/XChange | xchange-therock/src/main/java/org/knowm/xchange/therock/service/TheRockTradeService.java | TheRockTradeService.cancelOrder | @Override
public boolean cancelOrder(String orderId) throws IOException {
CurrencyPair cp =
(CurrencyPair)
exchange
.getExchangeSpecification()
.getExchangeSpecificParameters()
.get(TheRockExchange.CURRENCY_PAIR);
if (cp == null) {
throw new ExchangeException("Provide TheRockCancelOrderParams with orderId and currencyPair");
}
return cancelOrder(cp, orderId);
} | java | @Override
public boolean cancelOrder(String orderId) throws IOException {
CurrencyPair cp =
(CurrencyPair)
exchange
.getExchangeSpecification()
.getExchangeSpecificParameters()
.get(TheRockExchange.CURRENCY_PAIR);
if (cp == null) {
throw new ExchangeException("Provide TheRockCancelOrderParams with orderId and currencyPair");
}
return cancelOrder(cp, orderId);
} | [
"@",
"Override",
"public",
"boolean",
"cancelOrder",
"(",
"String",
"orderId",
")",
"throws",
"IOException",
"{",
"CurrencyPair",
"cp",
"=",
"(",
"CurrencyPair",
")",
"exchange",
".",
"getExchangeSpecification",
"(",
")",
".",
"getExchangeSpecificParameters",
"(",
... | Not available from exchange since TheRock needs currency pair in order to cancel an order | [
"Not",
"available",
"from",
"exchange",
"since",
"TheRock",
"needs",
"currency",
"pair",
"in",
"order",
"to",
"cancel",
"an",
"order"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-therock/src/main/java/org/knowm/xchange/therock/service/TheRockTradeService.java#L90-L103 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/BaseAdsServiceClientFactory.java | BaseAdsServiceClientFactory.getServiceClientAsInterface | public <T> T getServiceClientAsInterface(S adsSession, Class<T> interfaceClass)
throws ServiceException {
return adsServiceClientFactory.getServiceClient(adsSession, interfaceClass);
} | java | public <T> T getServiceClientAsInterface(S adsSession, Class<T> interfaceClass)
throws ServiceException {
return adsServiceClientFactory.getServiceClient(adsSession, interfaceClass);
} | [
"public",
"<",
"T",
">",
"T",
"getServiceClientAsInterface",
"(",
"S",
"adsSession",
",",
"Class",
"<",
"T",
">",
"interfaceClass",
")",
"throws",
"ServiceException",
"{",
"return",
"adsServiceClientFactory",
".",
"getServiceClient",
"(",
"adsSession",
",",
"inter... | Gets a client given a session and the class of the desired stub interface.
@param adsSession the session associated with the desired
client
@param interfaceClass the class type of the desired client
@return a client for the specified ads service | [
"Gets",
"a",
"client",
"given",
"a",
"session",
"and",
"the",
"class",
"of",
"the",
"desired",
"stub",
"interface",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/BaseAdsServiceClientFactory.java#L79-L82 |
shrinkwrap/descriptors | api-base/src/main/java/org/jboss/shrinkwrap/descriptor/api/DescriptorInstantiator.java | DescriptorInstantiator.createFromUserView | static <T extends Descriptor> T createFromUserView(final Class<T> userViewClass, String descriptorName)
throws IllegalArgumentException {
// Get the construction information
final DescriptorConstructionInfo info = getDescriptorConstructionInfoForUserView(userViewClass);
@SuppressWarnings("unchecked")
final Class<? extends Descriptor> implClass = (Class<? extends Descriptor>) info.implClass;
String name = info.defaultName;
if (descriptorName != null) {
name = descriptorName;
}
// Make model class
final Descriptor descriptor = createFromImplModelType(implClass, name);
// Return
return userViewClass.cast(descriptor);
} | java | static <T extends Descriptor> T createFromUserView(final Class<T> userViewClass, String descriptorName)
throws IllegalArgumentException {
// Get the construction information
final DescriptorConstructionInfo info = getDescriptorConstructionInfoForUserView(userViewClass);
@SuppressWarnings("unchecked")
final Class<? extends Descriptor> implClass = (Class<? extends Descriptor>) info.implClass;
String name = info.defaultName;
if (descriptorName != null) {
name = descriptorName;
}
// Make model class
final Descriptor descriptor = createFromImplModelType(implClass, name);
// Return
return userViewClass.cast(descriptor);
} | [
"static",
"<",
"T",
"extends",
"Descriptor",
">",
"T",
"createFromUserView",
"(",
"final",
"Class",
"<",
"T",
">",
"userViewClass",
",",
"String",
"descriptorName",
")",
"throws",
"IllegalArgumentException",
"{",
"// Get the construction information",
"final",
"Descri... | Creates a new {@link Descriptor} instance of the specified user view type. Will consult a configuration file
visible to the {@link Thread} Context {@link ClassLoader} named "META-INF/services/$fullyQualfiedClassName" which
should contain a key=value format with the keys {@link DescriptorInstantiator#KEY_IMPL_CLASS_NAME} and
{@link DescriptorInstantiator#KEY_MODEL_CLASS_NAME}. The implementation class name must have a constructor
accepting an instance of the model class, and the model class must have a no-arg constructor.
@param <T>
@param userViewClass
@param descriptorName
The name of the descriptor. If argument is null, the default name will be used.
@return
@throws IllegalArgumentException
If the user view class was not specified | [
"Creates",
"a",
"new",
"{",
"@link",
"Descriptor",
"}",
"instance",
"of",
"the",
"specified",
"user",
"view",
"type",
".",
"Will",
"consult",
"a",
"configuration",
"file",
"visible",
"to",
"the",
"{",
"@link",
"Thread",
"}",
"Context",
"{",
"@link",
"Class... | train | https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/api-base/src/main/java/org/jboss/shrinkwrap/descriptor/api/DescriptorInstantiator.java#L85-L102 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateTimeZone.java | DateTimeZone.convertLocalToUTC | public long convertLocalToUTC(long instantLocal, boolean strict, long originalInstantUTC) {
int offsetOriginal = getOffset(originalInstantUTC);
long instantUTC = instantLocal - offsetOriginal;
int offsetLocalFromOriginal = getOffset(instantUTC);
if (offsetLocalFromOriginal == offsetOriginal) {
return instantUTC;
}
return convertLocalToUTC(instantLocal, strict);
} | java | public long convertLocalToUTC(long instantLocal, boolean strict, long originalInstantUTC) {
int offsetOriginal = getOffset(originalInstantUTC);
long instantUTC = instantLocal - offsetOriginal;
int offsetLocalFromOriginal = getOffset(instantUTC);
if (offsetLocalFromOriginal == offsetOriginal) {
return instantUTC;
}
return convertLocalToUTC(instantLocal, strict);
} | [
"public",
"long",
"convertLocalToUTC",
"(",
"long",
"instantLocal",
",",
"boolean",
"strict",
",",
"long",
"originalInstantUTC",
")",
"{",
"int",
"offsetOriginal",
"=",
"getOffset",
"(",
"originalInstantUTC",
")",
";",
"long",
"instantUTC",
"=",
"instantLocal",
"-... | Converts a local instant to a standard UTC instant with the same
local time attempting to use the same offset as the original.
<p>
This conversion is used after performing a calculation
where the calculation was done using a simple local zone.
Whenever possible, the same offset as the original offset will be used.
This is most significant during a daylight savings overlap.
@param instantLocal the local instant to convert to UTC
@param strict whether the conversion should reject non-existent local times
@param originalInstantUTC the original instant that the calculation is based on
@return the UTC instant with the same local time,
@throws ArithmeticException if the result overflows a long
@throws IllegalArgumentException if the zone has no equivalent local time
@since 2.0 | [
"Converts",
"a",
"local",
"instant",
"to",
"a",
"standard",
"UTC",
"instant",
"with",
"the",
"same",
"local",
"time",
"attempting",
"to",
"use",
"the",
"same",
"offset",
"as",
"the",
"original",
".",
"<p",
">",
"This",
"conversion",
"is",
"used",
"after",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeZone.java#L984-L992 |
liyiorg/weixin-popular | src/main/java/weixin/popular/client/HttpClientFactory.java | HttpClientFactory.createKeyMaterialHttpClient | public static CloseableHttpClient createKeyMaterialHttpClient(KeyStore keystore,String keyPassword,int timeout,int retryExecutionCount) {
return createKeyMaterialHttpClient(keystore, keyPassword, supportedProtocols,timeout,retryExecutionCount);
} | java | public static CloseableHttpClient createKeyMaterialHttpClient(KeyStore keystore,String keyPassword,int timeout,int retryExecutionCount) {
return createKeyMaterialHttpClient(keystore, keyPassword, supportedProtocols,timeout,retryExecutionCount);
} | [
"public",
"static",
"CloseableHttpClient",
"createKeyMaterialHttpClient",
"(",
"KeyStore",
"keystore",
",",
"String",
"keyPassword",
",",
"int",
"timeout",
",",
"int",
"retryExecutionCount",
")",
"{",
"return",
"createKeyMaterialHttpClient",
"(",
"keystore",
",",
"keyPa... | Key store 类型HttpClient
@param keystore keystore
@param keyPassword keyPassword
@param timeout timeout
@param retryExecutionCount retryExecutionCount
@return CloseableHttpClient | [
"Key",
"store",
"类型HttpClient"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/client/HttpClientFactory.java#L83-L85 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendUtf8String | public static File appendUtf8String(String content, String path) throws IORuntimeException {
return appendString(content, path, CharsetUtil.CHARSET_UTF_8);
} | java | public static File appendUtf8String(String content, String path) throws IORuntimeException {
return appendString(content, path, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"File",
"appendUtf8String",
"(",
"String",
"content",
",",
"String",
"path",
")",
"throws",
"IORuntimeException",
"{",
"return",
"appendString",
"(",
"content",
",",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 将String写入文件,UTF-8编码追加模式
@param content 写入的内容
@param path 文件路径
@return 写入的文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将String写入文件,UTF",
"-",
"8编码追加模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2774-L2776 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/MetricReportReporter.java | MetricReportReporter.serializeValue | protected Metric serializeValue(String name, Number value, String... path) {
return new Metric(MetricRegistry.name(name, path), value.doubleValue());
} | java | protected Metric serializeValue(String name, Number value, String... path) {
return new Metric(MetricRegistry.name(name, path), value.doubleValue());
} | [
"protected",
"Metric",
"serializeValue",
"(",
"String",
"name",
",",
"Number",
"value",
",",
"String",
"...",
"path",
")",
"{",
"return",
"new",
"Metric",
"(",
"MetricRegistry",
".",
"name",
"(",
"name",
",",
"path",
")",
",",
"value",
".",
"doubleValue",
... | Converts a single key-value pair into a metric.
@param name name of the metric
@param value value of the metric to report
@param path additional suffixes to further identify the meaning of the reported value
@return a {@link org.apache.gobblin.metrics.Metric}. | [
"Converts",
"a",
"single",
"key",
"-",
"value",
"pair",
"into",
"a",
"metric",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/MetricReportReporter.java#L243-L245 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/EdgeEffect.java | EdgeEffect.setSize | public void setSize(int width, int height) {
final float r = width * 0.75f / SIN;
final float y = COS * r;
final float h = r - y;
final float or = height * 0.75f / SIN;
final float oy = COS * or;
final float oh = or - oy;
mRadius = r;
mBaseGlowScale = h > 0 ? Math.min(oh / h, 1.f) : 1.f;
mBounds.set(mBounds.left, mBounds.top, width, (int) Math.min(height, h));
} | java | public void setSize(int width, int height) {
final float r = width * 0.75f / SIN;
final float y = COS * r;
final float h = r - y;
final float or = height * 0.75f / SIN;
final float oy = COS * or;
final float oh = or - oy;
mRadius = r;
mBaseGlowScale = h > 0 ? Math.min(oh / h, 1.f) : 1.f;
mBounds.set(mBounds.left, mBounds.top, width, (int) Math.min(height, h));
} | [
"public",
"void",
"setSize",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"final",
"float",
"r",
"=",
"width",
"*",
"0.75f",
"/",
"SIN",
";",
"final",
"float",
"y",
"=",
"COS",
"*",
"r",
";",
"final",
"float",
"h",
"=",
"r",
"-",
"y",
"... | Set the size of this edge effect in pixels.
@param width Effect width in pixels
@param height Effect height in pixels | [
"Set",
"the",
"size",
"of",
"this",
"edge",
"effect",
"in",
"pixels",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/EdgeEffect.java#L87-L99 |
janus-project/guava.janusproject.io | guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java | FluentIterable.limit | @CheckReturnValue
public final FluentIterable<E> limit(int size) {
return from(Iterables.limit(iterable, size));
} | java | @CheckReturnValue
public final FluentIterable<E> limit(int size) {
return from(Iterables.limit(iterable, size));
} | [
"@",
"CheckReturnValue",
"public",
"final",
"FluentIterable",
"<",
"E",
">",
"limit",
"(",
"int",
"size",
")",
"{",
"return",
"from",
"(",
"Iterables",
".",
"limit",
"(",
"iterable",
",",
"size",
")",
")",
";",
"}"
] | Creates a fluent iterable with the first {@code size} elements of this
fluent iterable. If this fluent iterable does not contain that many elements,
the returned fluent iterable will have the same behavior as this fluent iterable.
The returned fluent iterable's iterator supports {@code remove()} if this
fluent iterable's iterator does.
@param size the maximum number of elements in the returned fluent iterable
@throws IllegalArgumentException if {@code size} is negative | [
"Creates",
"a",
"fluent",
"iterable",
"with",
"the",
"first",
"{",
"@code",
"size",
"}",
"elements",
"of",
"this",
"fluent",
"iterable",
".",
"If",
"this",
"fluent",
"iterable",
"does",
"not",
"contain",
"that",
"many",
"elements",
"the",
"returned",
"fluent... | train | https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/FluentIterable.java#L342-L345 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.removeLongLivedPageFlow | public static void removeLongLivedPageFlow( String modulePath, HttpServletRequest request,
ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName = InternalUtils.getLongLivedFlowAttr( modulePath );
attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest );
sh.removeAttribute( rc, attrName );
//
// Now, if the current page flow is long-lived, remove the reference.
//
String currentLongLivedAttrName =
ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
String currentLongLivedModulePath =
( String ) sh.getAttribute( rc, currentLongLivedAttrName );
if ( modulePath.equals( currentLongLivedModulePath ) )
{
sh.removeAttribute( rc, currentLongLivedAttrName );
}
} | java | public static void removeLongLivedPageFlow( String modulePath, HttpServletRequest request,
ServletContext servletContext )
{
StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
HttpServletRequest unwrappedRequest = unwrapMultipart( request );
RequestContext rc = new RequestContext( unwrappedRequest, null );
String attrName = InternalUtils.getLongLivedFlowAttr( modulePath );
attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest );
sh.removeAttribute( rc, attrName );
//
// Now, if the current page flow is long-lived, remove the reference.
//
String currentLongLivedAttrName =
ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
String currentLongLivedModulePath =
( String ) sh.getAttribute( rc, currentLongLivedAttrName );
if ( modulePath.equals( currentLongLivedModulePath ) )
{
sh.removeAttribute( rc, currentLongLivedAttrName );
}
} | [
"public",
"static",
"void",
"removeLongLivedPageFlow",
"(",
"String",
"modulePath",
",",
"HttpServletRequest",
"request",
",",
"ServletContext",
"servletContext",
")",
"{",
"StorageHandler",
"sh",
"=",
"Handlers",
".",
"get",
"(",
"servletContext",
")",
".",
"getSto... | Remove a "long-lived" page flow from the session. Once it is created, a long-lived page flow
is never removed from the session unless this method or {@link PageFlowController#remove} is
called. Navigating to another page flow hides the current long-lived controller, but does not
remove it. | [
"Remove",
"a",
"long",
"-",
"lived",
"page",
"flow",
"from",
"the",
"session",
".",
"Once",
"it",
"is",
"created",
"a",
"long",
"-",
"lived",
"page",
"flow",
"is",
"never",
"removed",
"from",
"the",
"session",
"unless",
"this",
"method",
"or",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L436-L459 |
snowtide/lucene-pdf | src/java/com/snowtide/pdf/lucene/LucenePDFDocumentFactory.java | LucenePDFDocumentFactory.buildPDFDocument | public static Document buildPDFDocument (com.snowtide.pdf.Document pdf) throws IOException {
return buildPDFDocument(pdf, DEFAULT_CONFIG);
} | java | public static Document buildPDFDocument (com.snowtide.pdf.Document pdf) throws IOException {
return buildPDFDocument(pdf, DEFAULT_CONFIG);
} | [
"public",
"static",
"Document",
"buildPDFDocument",
"(",
"com",
".",
"snowtide",
".",
"pdf",
".",
"Document",
"pdf",
")",
"throws",
"IOException",
"{",
"return",
"buildPDFDocument",
"(",
"pdf",
",",
"DEFAULT_CONFIG",
")",
";",
"}"
] | Creates a new Lucene Document instance using the PDF text and metadata provided by the PDFxStream
Document using a default {@link LucenePDFConfiguration#LucenePDFConfiguration()} to control Lucene field names,
etc. | [
"Creates",
"a",
"new",
"Lucene",
"Document",
"instance",
"using",
"the",
"PDF",
"text",
"and",
"metadata",
"provided",
"by",
"the",
"PDFxStream",
"Document",
"using",
"a",
"default",
"{"
] | train | https://github.com/snowtide/lucene-pdf/blob/1d97a877912bcfb354d3e8bff8275c92397db133/src/java/com/snowtide/pdf/lucene/LucenePDFDocumentFactory.java#L87-L89 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/DataSet.java | DataSet.collect | public List<T> collect() throws Exception {
final String id = new AbstractID().toString();
final TypeSerializer<T> serializer = getType().createSerializer(getExecutionEnvironment().getConfig());
this.output(new Utils.CollectHelper<>(id, serializer)).name("collect()");
JobExecutionResult res = getExecutionEnvironment().execute();
ArrayList<byte[]> accResult = res.getAccumulatorResult(id);
if (accResult != null) {
try {
return SerializedListAccumulator.deserializeList(accResult, serializer);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot find type class of collected data type.", e);
} catch (IOException e) {
throw new RuntimeException("Serialization error while deserializing collected data", e);
}
} else {
throw new RuntimeException("The call to collect() could not retrieve the DataSet.");
}
} | java | public List<T> collect() throws Exception {
final String id = new AbstractID().toString();
final TypeSerializer<T> serializer = getType().createSerializer(getExecutionEnvironment().getConfig());
this.output(new Utils.CollectHelper<>(id, serializer)).name("collect()");
JobExecutionResult res = getExecutionEnvironment().execute();
ArrayList<byte[]> accResult = res.getAccumulatorResult(id);
if (accResult != null) {
try {
return SerializedListAccumulator.deserializeList(accResult, serializer);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot find type class of collected data type.", e);
} catch (IOException e) {
throw new RuntimeException("Serialization error while deserializing collected data", e);
}
} else {
throw new RuntimeException("The call to collect() could not retrieve the DataSet.");
}
} | [
"public",
"List",
"<",
"T",
">",
"collect",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"id",
"=",
"new",
"AbstractID",
"(",
")",
".",
"toString",
"(",
")",
";",
"final",
"TypeSerializer",
"<",
"T",
">",
"serializer",
"=",
"getType",
"(",
... | Convenience method to get the elements of a DataSet as a List.
As DataSet can contain a lot of data, this method should be used with caution.
@return A List containing the elements of the DataSet | [
"Convenience",
"method",
"to",
"get",
"the",
"elements",
"of",
"a",
"DataSet",
"as",
"a",
"List",
".",
"As",
"DataSet",
"can",
"contain",
"a",
"lot",
"of",
"data",
"this",
"method",
"should",
"be",
"used",
"with",
"caution",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/DataSet.java#L408-L427 |
overturetool/overture | ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java | SWTUtil.setAccessibilityText | public static void setAccessibilityText(Control control, final String text) {
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result= text;
}
});
} | java | public static void setAccessibilityText(Control control, final String text) {
control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result= text;
}
});
} | [
"public",
"static",
"void",
"setAccessibilityText",
"(",
"Control",
"control",
",",
"final",
"String",
"text",
")",
"{",
"control",
".",
"getAccessible",
"(",
")",
".",
"addAccessibleListener",
"(",
"new",
"AccessibleAdapter",
"(",
")",
"{",
"public",
"void",
... | Adds an accessibility listener returning the given fixed name.
@param control the control to add the accessibility support to
@param text the name | [
"Adds",
"an",
"accessibility",
"listener",
"returning",
"the",
"given",
"fixed",
"name",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java#L145-L151 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.redeemCoupon | public Redemption redeemCoupon(final String couponCode, final Redemption redemption) {
return doPOST(Coupon.COUPON_RESOURCE + "/" + couponCode + Redemption.REDEEM_RESOURCE,
redemption, Redemption.class);
} | java | public Redemption redeemCoupon(final String couponCode, final Redemption redemption) {
return doPOST(Coupon.COUPON_RESOURCE + "/" + couponCode + Redemption.REDEEM_RESOURCE,
redemption, Redemption.class);
} | [
"public",
"Redemption",
"redeemCoupon",
"(",
"final",
"String",
"couponCode",
",",
"final",
"Redemption",
"redemption",
")",
"{",
"return",
"doPOST",
"(",
"Coupon",
".",
"COUPON_RESOURCE",
"+",
"\"/\"",
"+",
"couponCode",
"+",
"Redemption",
".",
"REDEEM_RESOURCE",... | Redeem a {@link Coupon} on an account.
@param couponCode redeemed coupon id
@return the {@link Coupon} object | [
"Redeem",
"a",
"{",
"@link",
"Coupon",
"}",
"on",
"an",
"account",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1581-L1584 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Session.java | Session.updateLocalTable | public void updateLocalTable(HsqlName queryName, Type[] finalTypes) {
assert(localTables != null);
Table tbl = getLocalTable(queryName.name);
assert (tbl != null);
TableUtil.updateColumnTypes(tbl, finalTypes);
} | java | public void updateLocalTable(HsqlName queryName, Type[] finalTypes) {
assert(localTables != null);
Table tbl = getLocalTable(queryName.name);
assert (tbl != null);
TableUtil.updateColumnTypes(tbl, finalTypes);
} | [
"public",
"void",
"updateLocalTable",
"(",
"HsqlName",
"queryName",
",",
"Type",
"[",
"]",
"finalTypes",
")",
"{",
"assert",
"(",
"localTables",
"!=",
"null",
")",
";",
"Table",
"tbl",
"=",
"getLocalTable",
"(",
"queryName",
".",
"name",
")",
";",
"assert"... | Update the local table with new types. This is very dubious.
@param queryName
@param finalTypes | [
"Update",
"the",
"local",
"table",
"with",
"new",
"types",
".",
"This",
"is",
"very",
"dubious",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Session.java#L1884-L1889 |
ButterFaces/ButterFaces | components/src/main/java/org/butterfaces/context/StringHtmlEncoder.java | StringHtmlEncoder.encodeComponentWithSurroundingDiv | public static String encodeComponentWithSurroundingDiv(final FacesContext context,
final UIComponent component) throws IOException {
return encodeComponentWithSurroundingDiv(context, component, null);
} | java | public static String encodeComponentWithSurroundingDiv(final FacesContext context,
final UIComponent component) throws IOException {
return encodeComponentWithSurroundingDiv(context, component, null);
} | [
"public",
"static",
"String",
"encodeComponentWithSurroundingDiv",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"return",
"encodeComponentWithSurroundingDiv",
"(",
"context",
",",
"component",
",",
... | Encodes complete component by calling {@link UIComponent#encodeAll(FacesContext)}.
@param component component
@param context {@link FacesContext}
@return the rendered string.
@throws IOException thrown by writer | [
"Encodes",
"complete",
"component",
"by",
"calling",
"{",
"@link",
"UIComponent#encodeAll",
"(",
"FacesContext",
")",
"}",
"."
] | train | https://github.com/ButterFaces/ButterFaces/blob/e8c2bb340c89dcdbac409fcfc7a2a0e07f2462fc/components/src/main/java/org/butterfaces/context/StringHtmlEncoder.java#L45-L48 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/LinkOptionsExample.java | LinkOptionsExample.applySettings | private void applySettings() {
linkContainer.reset();
WLink exampleLink = new WLink();
exampleLink.setText(tfLinkLabel.getText());
final String url = tfUrlField.getValue();
if ("".equals(url) || !isValidUrl(url)) {
tfUrlField.setText(URL);
exampleLink.setUrl(URL);
} else {
exampleLink.setUrl(url);
}
exampleLink.setRenderAsButton(cbRenderAsButton.isSelected());
exampleLink.setText(tfLinkLabel.getText());
if (cbSetImage.isSelected()) {
WImage linkImage = new WImage("/image/attachment.png", "Add attachment");
exampleLink.setImage(linkImage.getImage());
exampleLink.setImagePosition((ImagePosition) ddImagePosition.getSelected());
}
exampleLink.setDisabled(cbDisabled.isSelected());
if (tfAccesskey.getText() != null && tfAccesskey.getText().length() > 0) {
exampleLink.setAccessKey(tfAccesskey.getText().toCharArray()[0]);
}
if (cbOpenNew.isSelected()) {
exampleLink.setOpenNewWindow(true);
exampleLink.setTargetWindowName("_blank");
} else {
exampleLink.setOpenNewWindow(false);
}
linkContainer.add(exampleLink);
} | java | private void applySettings() {
linkContainer.reset();
WLink exampleLink = new WLink();
exampleLink.setText(tfLinkLabel.getText());
final String url = tfUrlField.getValue();
if ("".equals(url) || !isValidUrl(url)) {
tfUrlField.setText(URL);
exampleLink.setUrl(URL);
} else {
exampleLink.setUrl(url);
}
exampleLink.setRenderAsButton(cbRenderAsButton.isSelected());
exampleLink.setText(tfLinkLabel.getText());
if (cbSetImage.isSelected()) {
WImage linkImage = new WImage("/image/attachment.png", "Add attachment");
exampleLink.setImage(linkImage.getImage());
exampleLink.setImagePosition((ImagePosition) ddImagePosition.getSelected());
}
exampleLink.setDisabled(cbDisabled.isSelected());
if (tfAccesskey.getText() != null && tfAccesskey.getText().length() > 0) {
exampleLink.setAccessKey(tfAccesskey.getText().toCharArray()[0]);
}
if (cbOpenNew.isSelected()) {
exampleLink.setOpenNewWindow(true);
exampleLink.setTargetWindowName("_blank");
} else {
exampleLink.setOpenNewWindow(false);
}
linkContainer.add(exampleLink);
} | [
"private",
"void",
"applySettings",
"(",
")",
"{",
"linkContainer",
".",
"reset",
"(",
")",
";",
"WLink",
"exampleLink",
"=",
"new",
"WLink",
"(",
")",
";",
"exampleLink",
".",
"setText",
"(",
"tfLinkLabel",
".",
"getText",
"(",
")",
")",
";",
"final",
... | this is were the majority of the work is done for building the link. Note that it is in a container that is
reset, effectively creating a new link. this is only done to enable to dynamically change the link to a button
and back. | [
"this",
"is",
"were",
"the",
"majority",
"of",
"the",
"work",
"is",
"done",
"for",
"building",
"the",
"link",
".",
"Note",
"that",
"it",
"is",
"in",
"a",
"container",
"that",
"is",
"reset",
"effectively",
"creating",
"a",
"new",
"link",
".",
"this",
"i... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/LinkOptionsExample.java#L162-L198 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java | XmlWriter.writeLineElement | public void writeLineElement(String name, Object text)
{
startLineElement(name);
writeText(text);
endLineElement(name);
} | java | public void writeLineElement(String name, Object text)
{
startLineElement(name);
writeText(text);
endLineElement(name);
} | [
"public",
"void",
"writeLineElement",
"(",
"String",
"name",
",",
"Object",
"text",
")",
"{",
"startLineElement",
"(",
"name",
")",
";",
"writeText",
"(",
"text",
")",
";",
"endLineElement",
"(",
"name",
")",
";",
"}"
] | Convenience method, same as doing a startLineElement(), writeText(text),
endLineElement(). | [
"Convenience",
"method",
"same",
"as",
"doing",
"a",
"startLineElement",
"()",
"writeText",
"(",
"text",
")",
"endLineElement",
"()",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/XmlWriter.java#L268-L273 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BoltNeo4jDialect.java | BoltNeo4jDialect.putAssociationOperation | private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action, AssociationContext associationContext) {
switch ( associationKey.getMetadata().getAssociationKind() ) {
case EMBEDDED_COLLECTION:
createRelationshipWithEmbeddedNode( associationKey, associationContext, action );
break;
case ASSOCIATION:
findOrCreateRelationshipWithEntityNode( associationKey, associationContext, action );
break;
default:
throw new AssertionFailure( "Unrecognized associationKind: " + associationKey.getMetadata().getAssociationKind() );
}
} | java | private void putAssociationOperation(AssociationKey associationKey, AssociationOperation action, AssociationContext associationContext) {
switch ( associationKey.getMetadata().getAssociationKind() ) {
case EMBEDDED_COLLECTION:
createRelationshipWithEmbeddedNode( associationKey, associationContext, action );
break;
case ASSOCIATION:
findOrCreateRelationshipWithEntityNode( associationKey, associationContext, action );
break;
default:
throw new AssertionFailure( "Unrecognized associationKind: " + associationKey.getMetadata().getAssociationKind() );
}
} | [
"private",
"void",
"putAssociationOperation",
"(",
"AssociationKey",
"associationKey",
",",
"AssociationOperation",
"action",
",",
"AssociationContext",
"associationContext",
")",
"{",
"switch",
"(",
"associationKey",
".",
"getMetadata",
"(",
")",
".",
"getAssociationKind... | When dealing with some scenarios like, for example, a bidirectional association, OGM calls this method twice:
<p>
the first time with the information related to the owner of the association and the {@link RowKey},
the second time using the same {@link RowKey} but with the {@link AssociationKey} referring to the other side of the association.
@param associatedEntityKeyMetadata
@param action | [
"When",
"dealing",
"with",
"some",
"scenarios",
"like",
"for",
"example",
"a",
"bidirectional",
"association",
"OGM",
"calls",
"this",
"method",
"twice",
":",
"<p",
">",
"the",
"first",
"time",
"with",
"the",
"information",
"related",
"to",
"the",
"owner",
"... | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BoltNeo4jDialect.java#L503-L514 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getUserStatistic | public UserStatListResult getUserStatistic(String startTime, int duration)
throws APIConnectionException, APIRequestException {
return _reportClient.getUserStatistic(startTime, duration);
} | java | public UserStatListResult getUserStatistic(String startTime, int duration)
throws APIConnectionException, APIRequestException {
return _reportClient.getUserStatistic(startTime, duration);
} | [
"public",
"UserStatListResult",
"getUserStatistic",
"(",
"String",
"startTime",
",",
"int",
"duration",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_reportClient",
".",
"getUserStatistic",
"(",
"startTime",
",",
"duration",
")",
... | Get user statistic, now time unit only supports DAY
@param startTime start time, format: yyyy-MM-dd
@param duration 0-60
@return {@link UserStatListResult}
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"user",
"statistic",
"now",
"time",
"unit",
"only",
"supports",
"DAY"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L996-L999 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java | JbcSrcJavaValue.of | static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error= */ false,
reporter);
}
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ false,
reporter);
} | java | static JbcSrcJavaValue of(Expression expr, Method method, JbcSrcValueErrorReporter reporter) {
checkNotNull(method);
if (expr instanceof SoyExpression) {
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ ((SoyExpression) expr).soyType(),
/* constantNull= */ false,
/* error= */ false,
reporter);
}
return new JbcSrcJavaValue(
expr,
method,
/* allowedType= */ null,
/* constantNull= */ false,
/* error= */ false,
reporter);
} | [
"static",
"JbcSrcJavaValue",
"of",
"(",
"Expression",
"expr",
",",
"Method",
"method",
",",
"JbcSrcValueErrorReporter",
"reporter",
")",
"{",
"checkNotNull",
"(",
"method",
")",
";",
"if",
"(",
"expr",
"instanceof",
"SoyExpression",
")",
"{",
"return",
"new",
... | Constructs a JbcSrcJavaValue based on the Expression. The method is used to display helpful
error messages to the user if necessary. It is not invoked. | [
"Constructs",
"a",
"JbcSrcJavaValue",
"based",
"on",
"the",
"Expression",
".",
"The",
"method",
"is",
"used",
"to",
"display",
"helpful",
"error",
"messages",
"to",
"the",
"user",
"if",
"necessary",
".",
"It",
"is",
"not",
"invoked",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcJavaValue.java#L73-L91 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseSgthrz | public static int cusparseSgthrz(
cusparseHandle handle,
int nnz,
Pointer y,
Pointer xVal,
Pointer xInd,
int idxBase)
{
return checkResult(cusparseSgthrzNative(handle, nnz, y, xVal, xInd, idxBase));
} | java | public static int cusparseSgthrz(
cusparseHandle handle,
int nnz,
Pointer y,
Pointer xVal,
Pointer xInd,
int idxBase)
{
return checkResult(cusparseSgthrzNative(handle, nnz, y, xVal, xInd, idxBase));
} | [
"public",
"static",
"int",
"cusparseSgthrz",
"(",
"cusparseHandle",
"handle",
",",
"int",
"nnz",
",",
"Pointer",
"y",
",",
"Pointer",
"xVal",
",",
"Pointer",
"xInd",
",",
"int",
"idxBase",
")",
"{",
"return",
"checkResult",
"(",
"cusparseSgthrzNative",
"(",
... | Description: Gather of non-zero elements from desne vector y into
sparse vector x (also replacing these elements in y by zeros). | [
"Description",
":",
"Gather",
"of",
"non",
"-",
"zero",
"elements",
"from",
"desne",
"vector",
"y",
"into",
"sparse",
"vector",
"x",
"(",
"also",
"replacing",
"these",
"elements",
"in",
"y",
"by",
"zeros",
")",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L934-L943 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java | ObjectToJsonConverter.extractObject | public Object extractObject(Object pValue, Stack<String> pPathParts, boolean pJsonify)
throws AttributeNotFoundException {
ObjectSerializationContext stackContext = stackContextLocal.get();
String limitReached = checkForLimits(pValue, stackContext);
Stack<String> pathStack = pPathParts != null ? pPathParts : new Stack<String>();
if (limitReached != null) {
return limitReached;
}
try {
stackContext.push(pValue);
if (pValue == null) {
return pathStack.isEmpty() ?
null :
stackContext.getValueFaultHandler().handleException(
new AttributeNotFoundException("Cannot apply a path to an null value"));
}
if (pValue.getClass().isArray()) {
// Special handling for arrays
return arrayExtractor.extractObject(this,pValue,pathStack,pJsonify);
}
return callHandler(pValue, pathStack, pJsonify);
} finally {
stackContext.pop();
}
} | java | public Object extractObject(Object pValue, Stack<String> pPathParts, boolean pJsonify)
throws AttributeNotFoundException {
ObjectSerializationContext stackContext = stackContextLocal.get();
String limitReached = checkForLimits(pValue, stackContext);
Stack<String> pathStack = pPathParts != null ? pPathParts : new Stack<String>();
if (limitReached != null) {
return limitReached;
}
try {
stackContext.push(pValue);
if (pValue == null) {
return pathStack.isEmpty() ?
null :
stackContext.getValueFaultHandler().handleException(
new AttributeNotFoundException("Cannot apply a path to an null value"));
}
if (pValue.getClass().isArray()) {
// Special handling for arrays
return arrayExtractor.extractObject(this,pValue,pathStack,pJsonify);
}
return callHandler(pValue, pathStack, pJsonify);
} finally {
stackContext.pop();
}
} | [
"public",
"Object",
"extractObject",
"(",
"Object",
"pValue",
",",
"Stack",
"<",
"String",
">",
"pPathParts",
",",
"boolean",
"pJsonify",
")",
"throws",
"AttributeNotFoundException",
"{",
"ObjectSerializationContext",
"stackContext",
"=",
"stackContextLocal",
".",
"ge... | Related to {@link #extractObjectWithContext} except that
it does not setup a context. This method is called back from the
various extractors to recursively continue the extraction, hence it is public.
This method must not be used as entry point for serialization.
Use {@link #convertToJson(Object, List, JsonConvertOptions)} or
{@link #setInnerValue(Object, Object, List)} instead.
@param pValue value to extract from
@param pPathParts stack for diving into the object
@param pJsonify whether a JSON representation {@link org.json.simple.JSONObject}
@return extracted object either in native format or as {@link org.json.simple.JSONObject}
@throws AttributeNotFoundException if an attribute is not found during traversal | [
"Related",
"to",
"{",
"@link",
"#extractObjectWithContext",
"}",
"except",
"that",
"it",
"does",
"not",
"setup",
"a",
"context",
".",
"This",
"method",
"is",
"called",
"back",
"from",
"the",
"various",
"extractors",
"to",
"recursively",
"continue",
"the",
"ext... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java#L159-L185 |
VueGWT/vue-gwt | processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java | VForDefinition.initIndexVariable | private void initIndexVariable(String name, TemplateParserContext context) {
this.indexVariableInfo = context.addLocalVariable("int", name.trim());
} | java | private void initIndexVariable(String name, TemplateParserContext context) {
this.indexVariableInfo = context.addLocalVariable("int", name.trim());
} | [
"private",
"void",
"initIndexVariable",
"(",
"String",
"name",
",",
"TemplateParserContext",
"context",
")",
"{",
"this",
".",
"indexVariableInfo",
"=",
"context",
".",
"addLocalVariable",
"(",
"\"int\"",
",",
"name",
".",
"trim",
"(",
")",
")",
";",
"}"
] | Init the index variable and add it to the parser context
@param name Name of the variable
@param context Context of the template parser | [
"Init",
"the",
"index",
"variable",
"and",
"add",
"it",
"to",
"the",
"parser",
"context"
] | train | https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/VForDefinition.java#L169-L171 |
hal/core | gui/src/main/java/org/useware/kernel/model/mapping/Node.java | Node.insertChildAt | public void insertChildAt(int index, Node<T> child) throws IndexOutOfBoundsException {
if (index == getNumberOfChildren()) {
// this is really an append
addChild(child);
return;
} else {
children.get(index); //just to throw the exception, and stop here
children.add(index, child);
}
} | java | public void insertChildAt(int index, Node<T> child) throws IndexOutOfBoundsException {
if (index == getNumberOfChildren()) {
// this is really an append
addChild(child);
return;
} else {
children.get(index); //just to throw the exception, and stop here
children.add(index, child);
}
} | [
"public",
"void",
"insertChildAt",
"(",
"int",
"index",
",",
"Node",
"<",
"T",
">",
"child",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"if",
"(",
"index",
"==",
"getNumberOfChildren",
"(",
")",
")",
"{",
"// this is really an append",
"addChild",
"(",
"... | Inserts a Node<T> at the specified position in the child list. Will * throw an ArrayIndexOutOfBoundsException if the index does not exist.
@param index the position to insert at.
@param child the Node<T> object to insert.
@throws IndexOutOfBoundsException if thrown. | [
"Inserts",
"a",
"Node<T",
">",
"at",
"the",
"specified",
"position",
"in",
"the",
"child",
"list",
".",
"Will",
"*",
"throw",
"an",
"ArrayIndexOutOfBoundsException",
"if",
"the",
"index",
"does",
"not",
"exist",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/useware/kernel/model/mapping/Node.java#L118-L127 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java | TitlePaneButtonForegroundPainter.paintEnabled | public void paintEnabled(Graphics2D g, JComponent c, int width, int height) {
paint(g, c, width, height, enabledBorder, enabledCorner, enabledInterior);
} | java | public void paintEnabled(Graphics2D g, JComponent c, int width, int height) {
paint(g, c, width, height, enabledBorder, enabledCorner, enabledInterior);
} | [
"public",
"void",
"paintEnabled",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"paint",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
",",
"enabledBorder",
",",
"enabledCorner",
",",
"enabledInte... | Paint the enabled state of the button foreground.
@param g the Graphics2D context to paint with.
@param c the button to paint.
@param width the width to paint.
@param height the height to paint. | [
"Paint",
"the",
"enabled",
"state",
"of",
"the",
"button",
"foreground",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/titlepaneforegound/TitlePaneButtonForegroundPainter.java#L34-L36 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/io/MatrixVectorWriter.java | MatrixVectorWriter.printCoordinate | public void printCoordinate(int[] index, long[] data, int offset) {
int size = index.length;
if (size != data.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i)
format(Locale.ENGLISH, "%10d %10d%n", index[i] + offset, data[i]);
} | java | public void printCoordinate(int[] index, long[] data, int offset) {
int size = index.length;
if (size != data.length)
throw new IllegalArgumentException(
"All arrays must be of the same size");
for (int i = 0; i < size; ++i)
format(Locale.ENGLISH, "%10d %10d%n", index[i] + offset, data[i]);
} | [
"public",
"void",
"printCoordinate",
"(",
"int",
"[",
"]",
"index",
",",
"long",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"int",
"size",
"=",
"index",
".",
"length",
";",
"if",
"(",
"size",
"!=",
"data",
".",
"length",
")",
"throw",
"new",... | Prints the coordinate format to the underlying stream. One index and
entry on each line. The offset is added to the index, typically, this can
transform from a 0-based indicing to a 1-based. | [
"Prints",
"the",
"coordinate",
"format",
"to",
"the",
"underlying",
"stream",
".",
"One",
"index",
"and",
"entry",
"on",
"each",
"line",
".",
"The",
"offset",
"is",
"added",
"to",
"the",
"index",
"typically",
"this",
"can",
"transform",
"from",
"a",
"0",
... | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/io/MatrixVectorWriter.java#L239-L246 |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java | GraphicsUtil.setAlpha | public static void setAlpha(final Graphics pGraphics, final float pAlpha) {
((Graphics2D) pGraphics).setComposite(
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, pAlpha)
);
} | java | public static void setAlpha(final Graphics pGraphics, final float pAlpha) {
((Graphics2D) pGraphics).setComposite(
AlphaComposite.getInstance(AlphaComposite.SRC_OVER, pAlpha)
);
} | [
"public",
"static",
"void",
"setAlpha",
"(",
"final",
"Graphics",
"pGraphics",
",",
"final",
"float",
"pAlpha",
")",
"{",
"(",
"(",
"Graphics2D",
")",
"pGraphics",
")",
".",
"setComposite",
"(",
"AlphaComposite",
".",
"getInstance",
"(",
"AlphaComposite",
".",... | Sets the alpha in the {@code Graphics} object.
<p/>
Alpha is set by casting to {@code Graphics2D} and setting the composite
to the rule {@code AlphaComposite.SRC_OVER} multiplied by the given
alpha.
@param pGraphics the graphics object
@param pAlpha the alpha level, {@code alpha} must be a floating point
number in the inclusive range [0.0, 1.0].
@throws ClassCastException if {@code pGraphics} is not an instance of
{@code Graphics2D}.
@see java.awt.AlphaComposite#SRC_OVER
@see java.awt.AlphaComposite#getInstance(int, float) | [
"Sets",
"the",
"alpha",
"in",
"the",
"{",
"@code",
"Graphics",
"}",
"object",
".",
"<p",
"/",
">",
"Alpha",
"is",
"set",
"by",
"casting",
"to",
"{",
"@code",
"Graphics2D",
"}",
"and",
"setting",
"the",
"composite",
"to",
"the",
"rule",
"{",
"@code",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java#L79-L83 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Identity.java | Identity.valueOf | public static Identity valueOf(String identityStr) {
String[] info = identityStr.split(":");
Type type = Type.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, info[0]));
if (info.length == 1) {
return new Identity(type, null);
} else if (info.length == 2) {
return new Identity(type, info[1]);
} else {
throw new IllegalArgumentException("Illegal identity string: \"" + identityStr + "\"");
}
} | java | public static Identity valueOf(String identityStr) {
String[] info = identityStr.split(":");
Type type = Type.valueOf(CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, info[0]));
if (info.length == 1) {
return new Identity(type, null);
} else if (info.length == 2) {
return new Identity(type, info[1]);
} else {
throw new IllegalArgumentException("Illegal identity string: \"" + identityStr + "\"");
}
} | [
"public",
"static",
"Identity",
"valueOf",
"(",
"String",
"identityStr",
")",
"{",
"String",
"[",
"]",
"info",
"=",
"identityStr",
".",
"split",
"(",
"\":\"",
")",
";",
"Type",
"type",
"=",
"Type",
".",
"valueOf",
"(",
"CaseFormat",
".",
"LOWER_CAMEL",
"... | Converts a string to an {@code Identity}. Used primarily for converting protobuf-generated
policy identities to {@code Identity} objects. | [
"Converts",
"a",
"string",
"to",
"an",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Identity.java#L257-L267 |
graphql-java/graphql-java | src/main/java/graphql/execution/ExecutionStrategy.java | ExecutionStrategy.resolveFieldWithInfo | protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
GraphQLFieldDefinition fieldDef = getFieldDef(executionContext, parameters, parameters.getField().getSingleField());
Instrumentation instrumentation = executionContext.getInstrumentation();
InstrumentationContext<ExecutionResult> fieldCtx = instrumentation.beginField(
new InstrumentationFieldParameters(executionContext, fieldDef, createExecutionStepInfo(executionContext, parameters, fieldDef, null))
);
CompletableFuture<FetchedValue> fetchFieldFuture = fetchField(executionContext, parameters);
CompletableFuture<FieldValueInfo> result = fetchFieldFuture.thenApply((fetchedValue) ->
completeField(executionContext, parameters, fetchedValue));
CompletableFuture<ExecutionResult> executionResultFuture = result.thenCompose(FieldValueInfo::getFieldValue);
fieldCtx.onDispatched(executionResultFuture);
executionResultFuture.whenComplete(fieldCtx::onCompleted);
return result;
} | java | protected CompletableFuture<FieldValueInfo> resolveFieldWithInfo(ExecutionContext executionContext, ExecutionStrategyParameters parameters) {
GraphQLFieldDefinition fieldDef = getFieldDef(executionContext, parameters, parameters.getField().getSingleField());
Instrumentation instrumentation = executionContext.getInstrumentation();
InstrumentationContext<ExecutionResult> fieldCtx = instrumentation.beginField(
new InstrumentationFieldParameters(executionContext, fieldDef, createExecutionStepInfo(executionContext, parameters, fieldDef, null))
);
CompletableFuture<FetchedValue> fetchFieldFuture = fetchField(executionContext, parameters);
CompletableFuture<FieldValueInfo> result = fetchFieldFuture.thenApply((fetchedValue) ->
completeField(executionContext, parameters, fetchedValue));
CompletableFuture<ExecutionResult> executionResultFuture = result.thenCompose(FieldValueInfo::getFieldValue);
fieldCtx.onDispatched(executionResultFuture);
executionResultFuture.whenComplete(fieldCtx::onCompleted);
return result;
} | [
"protected",
"CompletableFuture",
"<",
"FieldValueInfo",
">",
"resolveFieldWithInfo",
"(",
"ExecutionContext",
"executionContext",
",",
"ExecutionStrategyParameters",
"parameters",
")",
"{",
"GraphQLFieldDefinition",
"fieldDef",
"=",
"getFieldDef",
"(",
"executionContext",
",... | Called to fetch a value for a field and its extra runtime info and resolve it further in terms of the graphql query. This will call
#fetchField followed by #completeField and the completed {@link graphql.execution.FieldValueInfo} is returned.
<p>
An execution strategy can iterate the fields to be executed and call this method for each one
<p>
Graphql fragments mean that for any give logical field can have one or more {@link Field} values associated with it
in the query, hence the fieldList. However the first entry is representative of the field for most purposes.
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@return a promise to a {@link FieldValueInfo}
@throws NonNullableFieldWasNullException in the {@link FieldValueInfo#getFieldValue()} future if a non null field resolves to a null value | [
"Called",
"to",
"fetch",
"a",
"value",
"for",
"a",
"field",
"and",
"its",
"extra",
"runtime",
"info",
"and",
"resolve",
"it",
"further",
"in",
"terms",
"of",
"the",
"graphql",
"query",
".",
"This",
"will",
"call",
"#fetchField",
"followed",
"by",
"#complet... | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L189-L206 |
JOML-CI/JOML | src/org/joml/AABBd.java | AABBd.intersectRay | public boolean intersectRay(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, Vector2d result) {
return Intersectiond.intersectRayAab(originX, originY, originZ, dirX, dirY, dirZ, minX, minY, minZ, maxX, maxY, maxZ, result);
} | java | public boolean intersectRay(double originX, double originY, double originZ, double dirX, double dirY, double dirZ, Vector2d result) {
return Intersectiond.intersectRayAab(originX, originY, originZ, dirX, dirY, dirZ, minX, minY, minZ, maxX, maxY, maxZ, result);
} | [
"public",
"boolean",
"intersectRay",
"(",
"double",
"originX",
",",
"double",
"originY",
",",
"double",
"originZ",
",",
"double",
"dirX",
",",
"double",
"dirY",
",",
"double",
"dirZ",
",",
"Vector2d",
"result",
")",
"{",
"return",
"Intersectiond",
".",
"inte... | Determine whether the given ray with the origin <code>(originX, originY, originZ)</code> and direction <code>(dirX, dirY, dirZ)</code>
intersects this AABB, and return the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> of the near and far point of intersection.
<p>
This method returns <code>true</code> for a ray whose origin lies inside this AABB.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@param originX
the x coordinate of the ray's origin
@param originY
the y coordinate of the ray's origin
@param originZ
the z coordinate of the ray's origin
@param dirX
the x coordinate of the ray's direction
@param dirY
the y coordinate of the ray's direction
@param dirZ
the z coordinate of the ray's direction
@param result
a vector which will hold the resulting values of the parameter
<i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection
iff the ray intersects this AABB
@return <code>true</code> if the given ray intersects this AABB; <code>false</code> otherwise | [
"Determine",
"whether",
"the",
"given",
"ray",
"with",
"the",
"origin",
"<code",
">",
"(",
"originX",
"originY",
"originZ",
")",
"<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"(",
"dirX",
"dirY",
"dirZ",
")",
"<",
"/",
"code",
">",
"intersec... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/AABBd.java#L453-L455 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/EntryInfo.java | EntryInfo.createEntryInfoPool | static public EntryInfoPool createEntryInfoPool(String poolName, int size){
final String methodName = "createEntryInfoPool()";
EntryInfoPool pool = new EntryInfoPool(poolName, size);
//pools.add(pool);
if (tc.isDebugEnabled())
Tr.debug(tc, methodName+" poolName=" + poolName);
return pool;
} | java | static public EntryInfoPool createEntryInfoPool(String poolName, int size){
final String methodName = "createEntryInfoPool()";
EntryInfoPool pool = new EntryInfoPool(poolName, size);
//pools.add(pool);
if (tc.isDebugEnabled())
Tr.debug(tc, methodName+" poolName=" + poolName);
return pool;
} | [
"static",
"public",
"EntryInfoPool",
"createEntryInfoPool",
"(",
"String",
"poolName",
",",
"int",
"size",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"createEntryInfoPool()\"",
";",
"EntryInfoPool",
"pool",
"=",
"new",
"EntryInfoPool",
"(",
"poolName",
",",
... | /*
This allocates an EntryInfo pool.
@param poolName The name to be associated with the new pool being created
@param size size of the new pool
@return The newly created EntryInfoPool object
@ibm-private-in-use | [
"/",
"*",
"This",
"allocates",
"an",
"EntryInfo",
"pool",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/EntryInfo.java#L832-L839 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java | J2CSecurityHelper.stripRealm | private static String stripRealm(String uniqueUserId, String realm) {
if (uniqueUserId == null || realm == null)
return uniqueUserId;
int index = uniqueUserId.indexOf(realm + REALM_SEPARATOR);
if (index > -1) {
uniqueUserId = uniqueUserId.substring(index + realm.length() + 1);
}
return uniqueUserId;
} | java | private static String stripRealm(String uniqueUserId, String realm) {
if (uniqueUserId == null || realm == null)
return uniqueUserId;
int index = uniqueUserId.indexOf(realm + REALM_SEPARATOR);
if (index > -1) {
uniqueUserId = uniqueUserId.substring(index + realm.length() + 1);
}
return uniqueUserId;
} | [
"private",
"static",
"String",
"stripRealm",
"(",
"String",
"uniqueUserId",
",",
"String",
"realm",
")",
"{",
"if",
"(",
"uniqueUserId",
"==",
"null",
"||",
"realm",
"==",
"null",
")",
"return",
"uniqueUserId",
";",
"int",
"index",
"=",
"uniqueUserId",
".",
... | Some registries return user:realm/uniqueId on the invocation of the getUniqueUserId
method but do not accept it as the uniqueUserId for other methods like getUniqueGroupIds.
This method is used to strip of the user:realm/ portion and get the uniqueId
@param uniqueUserId The uniqueId of the user
@param realm The realm that this uniqueId belongs to
@return the uniqueUserId with the realm stripped off. | [
"Some",
"registries",
"return",
"user",
":",
"realm",
"/",
"uniqueId",
"on",
"the",
"invocation",
"of",
"the",
"getUniqueUserId",
"method",
"but",
"do",
"not",
"accept",
"it",
"as",
"the",
"uniqueUserId",
"for",
"other",
"methods",
"like",
"getUniqueGroupIds",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java#L668-L676 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/iupac/parser/MoleculeBuilder.java | MoleculeBuilder.buildChain | private IAtomContainer buildChain(int length, boolean isMainCyclic) {
IAtomContainer currentChain;
if (length > 0) {
//If is cyclic
if (isMainCyclic) {
//Rely on CDK's ring class constructor to generate our cyclic molecules.
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
currentChain.add(currentMolecule.getBuilder().newInstance(IRing.class, length, "C"));
} //Else must not be cyclic
else {
currentChain = makeAlkane(length);
}
} else {
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
}
return currentChain;
} | java | private IAtomContainer buildChain(int length, boolean isMainCyclic) {
IAtomContainer currentChain;
if (length > 0) {
//If is cyclic
if (isMainCyclic) {
//Rely on CDK's ring class constructor to generate our cyclic molecules.
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
currentChain.add(currentMolecule.getBuilder().newInstance(IRing.class, length, "C"));
} //Else must not be cyclic
else {
currentChain = makeAlkane(length);
}
} else {
currentChain = currentMolecule.getBuilder().newInstance(IAtomContainer.class);
}
return currentChain;
} | [
"private",
"IAtomContainer",
"buildChain",
"(",
"int",
"length",
",",
"boolean",
"isMainCyclic",
")",
"{",
"IAtomContainer",
"currentChain",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"//If is cyclic",
"if",
"(",
"isMainCyclic",
")",
"{",
"//Rely on CDK's rin... | Builds the main chain which may act as a foundation for futher working groups.
@param mainChain The parsed prefix which depicts the chain's length.
@param isMainCyclic A flag to show if the molecule is a ring. 0 means not a ring, 1 means is a ring.
@return A Molecule containing the requested chain. | [
"Builds",
"the",
"main",
"chain",
"which",
"may",
"act",
"as",
"a",
"foundation",
"for",
"futher",
"working",
"groups",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/iupac/parser/MoleculeBuilder.java#L80-L97 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/KvStateService.java | KvStateService.fromConfiguration | public static KvStateService fromConfiguration(TaskManagerServicesConfiguration taskManagerServicesConfiguration) {
KvStateRegistry kvStateRegistry = new KvStateRegistry();
QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig();
KvStateClientProxy kvClientProxy = null;
KvStateServer kvStateServer = null;
if (qsConfig != null) {
int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads();
int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads();
kvClientProxy = QueryableStateUtils.createKvStateClientProxy(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getProxyPortRange(),
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
new DisabledKvStateRequestStats());
int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads();
int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads();
kvStateServer = QueryableStateUtils.createKvStateServer(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getStateServerPortRange(),
numStateServerNetworkThreads,
numStateServerQueryThreads,
kvStateRegistry,
new DisabledKvStateRequestStats());
}
return new KvStateService(kvStateRegistry, kvStateServer, kvClientProxy);
} | java | public static KvStateService fromConfiguration(TaskManagerServicesConfiguration taskManagerServicesConfiguration) {
KvStateRegistry kvStateRegistry = new KvStateRegistry();
QueryableStateConfiguration qsConfig = taskManagerServicesConfiguration.getQueryableStateConfig();
KvStateClientProxy kvClientProxy = null;
KvStateServer kvStateServer = null;
if (qsConfig != null) {
int numProxyServerNetworkThreads = qsConfig.numProxyServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyServerThreads();
int numProxyServerQueryThreads = qsConfig.numProxyQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numProxyQueryThreads();
kvClientProxy = QueryableStateUtils.createKvStateClientProxy(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getProxyPortRange(),
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
new DisabledKvStateRequestStats());
int numStateServerNetworkThreads = qsConfig.numStateServerThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateServerThreads();
int numStateServerQueryThreads = qsConfig.numStateQueryThreads() == 0 ?
taskManagerServicesConfiguration.getNumberOfSlots() : qsConfig.numStateQueryThreads();
kvStateServer = QueryableStateUtils.createKvStateServer(
taskManagerServicesConfiguration.getTaskManagerAddress(),
qsConfig.getStateServerPortRange(),
numStateServerNetworkThreads,
numStateServerQueryThreads,
kvStateRegistry,
new DisabledKvStateRequestStats());
}
return new KvStateService(kvStateRegistry, kvStateServer, kvClientProxy);
} | [
"public",
"static",
"KvStateService",
"fromConfiguration",
"(",
"TaskManagerServicesConfiguration",
"taskManagerServicesConfiguration",
")",
"{",
"KvStateRegistry",
"kvStateRegistry",
"=",
"new",
"KvStateRegistry",
"(",
")",
";",
"QueryableStateConfiguration",
"qsConfig",
"=",
... | Creates and returns the KvState service.
@param taskManagerServicesConfiguration task manager configuration
@return service for kvState related components | [
"Creates",
"and",
"returns",
"the",
"KvState",
"service",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/KvStateService.java#L159-L193 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.moveTo | public void moveTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: moveTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'm');
} | java | public void moveTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: moveTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'm');
} | [
"public",
"void",
"moveTo",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: moveTo is not allowed within a text block.\"",
")",
";... | Move the current position to the given coordinates.
@param x
The x coordinate.
@param y
The y coordinate.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Move",
"the",
"current",
"position",
"to",
"the",
"given",
"coordinates",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1222-L1231 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/content/languagecopy/CmsLanguageCopySelectionList.java | CmsLanguageCopySelectionList.fillItem | private void fillItem(final CmsResource resource, final CmsListItem item, final int id) {
CmsObject cms = getCms();
CmsXmlContent xmlContent;
I_CmsResourceType type;
String iconPath;
// fill path column:
String sitePath = cms.getSitePath(resource);
item.set(LIST_COLUMN_PATH, sitePath);
// fill language node existence column:
item.set(LIST_COLUMN_PATH, sitePath);
boolean languageNodeExists = false;
String languageNodeHtml;
List<Locale> sysLocales = OpenCms.getLocaleManager().getAvailableLocales();
try {
xmlContent = CmsXmlContentFactory.unmarshal(cms, cms.readFile(resource));
for (Locale locale : sysLocales) {
languageNodeExists = xmlContent.hasLocale(locale);
if (languageNodeExists) {
languageNodeHtml = "<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\"/>";
} else {
languageNodeHtml = "<input type=\"checkbox\" disabled=\"disabled\"/>";
}
item.set(locale.toString(), languageNodeHtml);
}
} catch (Throwable e1) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_LANGUAGECOPY_DETERMINE_LANGUAGE_NODE_1), e1);
languageNodeHtml = "n/a";
for (Locale locale : sysLocales) {
item.set(locale.toString(), languageNodeHtml);
}
}
// type column:
type = OpenCms.getResourceManager().getResourceType(resource);
item.set(LIST_COLUMN_RESOURCETYPE, type.getTypeName());
// icon column with title property for tooltip:
String title = "";
try {
CmsProperty titleProperty = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, true);
title = titleProperty.getValue();
} catch (CmsException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_WARN_LANGUAGECOPY_READPROP_1), e);
}
iconPath = getSkinUri()
+ CmsWorkplace.RES_PATH_FILETYPES
+ OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName()).getIcon();
String iconImage;
iconImage = "<img src=\"" + iconPath + "\" alt=\"" + type.getTypeName() + "\" title=\"" + title + "\" />";
item.set(LIST_COLUMN_ICON, iconImage);
} | java | private void fillItem(final CmsResource resource, final CmsListItem item, final int id) {
CmsObject cms = getCms();
CmsXmlContent xmlContent;
I_CmsResourceType type;
String iconPath;
// fill path column:
String sitePath = cms.getSitePath(resource);
item.set(LIST_COLUMN_PATH, sitePath);
// fill language node existence column:
item.set(LIST_COLUMN_PATH, sitePath);
boolean languageNodeExists = false;
String languageNodeHtml;
List<Locale> sysLocales = OpenCms.getLocaleManager().getAvailableLocales();
try {
xmlContent = CmsXmlContentFactory.unmarshal(cms, cms.readFile(resource));
for (Locale locale : sysLocales) {
languageNodeExists = xmlContent.hasLocale(locale);
if (languageNodeExists) {
languageNodeHtml = "<input type=\"checkbox\" checked=\"checked\" disabled=\"disabled\"/>";
} else {
languageNodeHtml = "<input type=\"checkbox\" disabled=\"disabled\"/>";
}
item.set(locale.toString(), languageNodeHtml);
}
} catch (Throwable e1) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_LANGUAGECOPY_DETERMINE_LANGUAGE_NODE_1), e1);
languageNodeHtml = "n/a";
for (Locale locale : sysLocales) {
item.set(locale.toString(), languageNodeHtml);
}
}
// type column:
type = OpenCms.getResourceManager().getResourceType(resource);
item.set(LIST_COLUMN_RESOURCETYPE, type.getTypeName());
// icon column with title property for tooltip:
String title = "";
try {
CmsProperty titleProperty = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, true);
title = titleProperty.getValue();
} catch (CmsException e) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_WARN_LANGUAGECOPY_READPROP_1), e);
}
iconPath = getSkinUri()
+ CmsWorkplace.RES_PATH_FILETYPES
+ OpenCms.getWorkplaceManager().getExplorerTypeSetting(type.getTypeName()).getIcon();
String iconImage;
iconImage = "<img src=\"" + iconPath + "\" alt=\"" + type.getTypeName() + "\" title=\"" + title + "\" />";
item.set(LIST_COLUMN_ICON, iconImage);
} | [
"private",
"void",
"fillItem",
"(",
"final",
"CmsResource",
"resource",
",",
"final",
"CmsListItem",
"item",
",",
"final",
"int",
"id",
")",
"{",
"CmsObject",
"cms",
"=",
"getCms",
"(",
")",
";",
"CmsXmlContent",
"xmlContent",
";",
"I_CmsResourceType",
"type",... | Fills a single item.
<p>
@param resource the corresponding resource.
@param item the item to fill.
@param id used for the ID column. | [
"Fills",
"a",
"single",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/languagecopy/CmsLanguageCopySelectionList.java#L494-L551 |
fusepoolP3/p3-transformer-library | src/main/java/eu/fusepool/p3/transformer/server/handler/AbstractTransformingServlet.java | AbstractTransformingServlet.getServiceNode | static GraphNode getServiceNode(HttpServletRequest request) {
final IRI serviceUri = new IRI(getFullRequestUrl(request));
final Graph resultGraph = new SimpleGraph();
return new GraphNode(serviceUri, resultGraph);
} | java | static GraphNode getServiceNode(HttpServletRequest request) {
final IRI serviceUri = new IRI(getFullRequestUrl(request));
final Graph resultGraph = new SimpleGraph();
return new GraphNode(serviceUri, resultGraph);
} | [
"static",
"GraphNode",
"getServiceNode",
"(",
"HttpServletRequest",
"request",
")",
"{",
"final",
"IRI",
"serviceUri",
"=",
"new",
"IRI",
"(",
"getFullRequestUrl",
"(",
"request",
")",
")",
";",
"final",
"Graph",
"resultGraph",
"=",
"new",
"SimpleGraph",
"(",
... | Returns a GraphNode representing the requested resources in an empty Graph
@param request
@return a GraphNode representing the resource | [
"Returns",
"a",
"GraphNode",
"representing",
"the",
"requested",
"resources",
"in",
"an",
"empty",
"Graph"
] | train | https://github.com/fusepoolP3/p3-transformer-library/blob/7f2f0ff7594dc4db021f2edcea17960ba337e02b/src/main/java/eu/fusepool/p3/transformer/server/handler/AbstractTransformingServlet.java#L95-L99 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.getDataLakeStoreAccountAsync | public Observable<DataLakeStoreAccountInfoInner> getDataLakeStoreAccountAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) {
return getDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInfoInner>, DataLakeStoreAccountInfoInner>() {
@Override
public DataLakeStoreAccountInfoInner call(ServiceResponse<DataLakeStoreAccountInfoInner> response) {
return response.body();
}
});
} | java | public Observable<DataLakeStoreAccountInfoInner> getDataLakeStoreAccountAsync(String resourceGroupName, String accountName, String dataLakeStoreAccountName) {
return getDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).map(new Func1<ServiceResponse<DataLakeStoreAccountInfoInner>, DataLakeStoreAccountInfoInner>() {
@Override
public DataLakeStoreAccountInfoInner call(ServiceResponse<DataLakeStoreAccountInfoInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataLakeStoreAccountInfoInner",
">",
"getDataLakeStoreAccountAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"dataLakeStoreAccountName",
")",
"{",
"return",
"getDataLakeStoreAccountWithServiceResponseAsync",
... | Gets the specified Data Lake Store account details in the specified Data Lake Analytics account.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account from which to retrieve the Data Lake Store account details.
@param dataLakeStoreAccountName The name of the Data Lake Store account to retrieve
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataLakeStoreAccountInfoInner object | [
"Gets",
"the",
"specified",
"Data",
"Lake",
"Store",
"account",
"details",
"in",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L974-L981 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java | DynaFormRow.addLabel | public DynaFormLabel addLabel(final String value, final boolean escape, final int colspan, final int rowspan) {
final DynaFormLabel dynaFormLabel = new DynaFormLabel(value, escape, colspan, rowspan, row, elements.size() + 1, extended);
elements.add(dynaFormLabel);
dynaFormModel.getLabels().add(dynaFormLabel);
totalColspan = totalColspan + colspan;
return dynaFormLabel;
} | java | public DynaFormLabel addLabel(final String value, final boolean escape, final int colspan, final int rowspan) {
final DynaFormLabel dynaFormLabel = new DynaFormLabel(value, escape, colspan, rowspan, row, elements.size() + 1, extended);
elements.add(dynaFormLabel);
dynaFormModel.getLabels().add(dynaFormLabel);
totalColspan = totalColspan + colspan;
return dynaFormLabel;
} | [
"public",
"DynaFormLabel",
"addLabel",
"(",
"final",
"String",
"value",
",",
"final",
"boolean",
"escape",
",",
"final",
"int",
"colspan",
",",
"final",
"int",
"rowspan",
")",
"{",
"final",
"DynaFormLabel",
"dynaFormLabel",
"=",
"new",
"DynaFormLabel",
"(",
"v... | Adds a label with given text, escape flag, colspan and rowspan.
@param value label text
@param escape boolean flag if the label text should escaped or not
@param colspan colspan
@param rowspan rowspan
@return DynaFormLabel added label | [
"Adds",
"a",
"label",
"with",
"given",
"text",
"escape",
"flag",
"colspan",
"and",
"rowspan",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L177-L185 |
realtime-framework/RealtimeStorage-Android | library/src/main/java/co/realtime/storage/TableRef.java | TableRef.lessEqual | public TableRef lessEqual(String attributeName, ItemAttribute value){
filters.add(new Filter(StorageFilter.LESSEREQUAL, attributeName, value, null));
return this;
} | java | public TableRef lessEqual(String attributeName, ItemAttribute value){
filters.add(new Filter(StorageFilter.LESSEREQUAL, attributeName, value, null));
return this;
} | [
"public",
"TableRef",
"lessEqual",
"(",
"String",
"attributeName",
",",
"ItemAttribute",
"value",
")",
"{",
"filters",
".",
"add",
"(",
"new",
"Filter",
"(",
"StorageFilter",
".",
"LESSEREQUAL",
",",
"attributeName",
",",
"value",
",",
"null",
")",
")",
";",... | Applies a filter to the table. When fetched, it will return the items lesser or equals to the filter property value.
<pre>
StorageRef storage = new StorageRef("your_app_key", "your_token");
TableRef tableRef = storage.table("your_table");
// Retrieve all items that have their "itemProperty" value lesser or equal 10
tableRef.lessEqual("itemProperty",new ItemAttribute(10)).getItems(new OnItemSnapshot() {
@Override
public void run(ItemSnapshot itemSnapshot) {
if (itemSnapshot != null) {
Log.d("TableRef", "Item retrieved: " + itemSnapshot.val());
}
}
}, new OnError() {
@Override
public void run(Integer code, String errorMessage) {
Log.e("TableRef", "Error retrieving items: " + errorMessage);
}
});
</pre>
@param attributeName
The name of the property to filter.
@param value
The value of the property to filter.
@return Current table reference | [
"Applies",
"a",
"filter",
"to",
"the",
"table",
".",
"When",
"fetched",
"it",
"will",
"return",
"the",
"items",
"lesser",
"or",
"equals",
"to",
"the",
"filter",
"property",
"value",
"."
] | train | https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/TableRef.java#L728-L731 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/util/spatialrules/countries/GermanySpatialRule.java | GermanySpatialRule.getMaxSpeed | @Override
public double getMaxSpeed(String highwayTag, double _default) {
// As defined in: https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Maxspeed#Motorcar
switch (highwayTag) {
case "motorway":
return Integer.MAX_VALUE;
case "trunk":
return Integer.MAX_VALUE;
case "residential":
return 100;
case "living_street":
return 4;
default:
return super.getMaxSpeed(highwayTag, _default);
}
} | java | @Override
public double getMaxSpeed(String highwayTag, double _default) {
// As defined in: https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Maxspeed#Motorcar
switch (highwayTag) {
case "motorway":
return Integer.MAX_VALUE;
case "trunk":
return Integer.MAX_VALUE;
case "residential":
return 100;
case "living_street":
return 4;
default:
return super.getMaxSpeed(highwayTag, _default);
}
} | [
"@",
"Override",
"public",
"double",
"getMaxSpeed",
"(",
"String",
"highwayTag",
",",
"double",
"_default",
")",
"{",
"// As defined in: https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing/Maxspeed#Motorcar",
"switch",
"(",
"highwayTag",
")",
"{",
"case",
"\"motorway\"",... | Germany contains roads with no speed limit. For these roads, this method will return Integer.MAX_VALUE.
Your implementation should be able to handle these cases. | [
"Germany",
"contains",
"roads",
"with",
"no",
"speed",
"limit",
".",
"For",
"these",
"roads",
"this",
"method",
"will",
"return",
"Integer",
".",
"MAX_VALUE",
".",
"Your",
"implementation",
"should",
"be",
"able",
"to",
"handle",
"these",
"cases",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/util/spatialrules/countries/GermanySpatialRule.java#L34-L49 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieCacheData.java | CookieCacheData.getAllCookieValues | public int getAllCookieValues(String name, List<String> list) {
int added = 0;
if (0 < this.parsedList.size() && null != name) {
for (HttpCookie cookie : this.parsedList) {
if (name.equals(cookie.getName())) {
list.add(cookie.getValue());
}
}
}
return added;
} | java | public int getAllCookieValues(String name, List<String> list) {
int added = 0;
if (0 < this.parsedList.size() && null != name) {
for (HttpCookie cookie : this.parsedList) {
if (name.equals(cookie.getName())) {
list.add(cookie.getValue());
}
}
}
return added;
} | [
"public",
"int",
"getAllCookieValues",
"(",
"String",
"name",
",",
"List",
"<",
"String",
">",
"list",
")",
"{",
"int",
"added",
"=",
"0",
";",
"if",
"(",
"0",
"<",
"this",
".",
"parsedList",
".",
"size",
"(",
")",
"&&",
"null",
"!=",
"name",
")",
... | Find all instances of the input cookie name in the cache and append their
values into the input list.
@param name
@param list
@return int - number of items added | [
"Find",
"all",
"instances",
"of",
"the",
"input",
"cookie",
"name",
"in",
"the",
"cache",
"and",
"append",
"their",
"values",
"into",
"the",
"input",
"list",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/cookies/CookieCacheData.java#L164-L174 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java | VirtualNetworksInner.listUsageWithServiceResponseAsync | public Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>> listUsageWithServiceResponseAsync(final String resourceGroupName, final String virtualNetworkName) {
return listUsageSinglePageAsync(resourceGroupName, virtualNetworkName)
.concatMap(new Func1<ServiceResponse<Page<VirtualNetworkUsageInner>>, Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>> call(ServiceResponse<Page<VirtualNetworkUsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listUsageNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>> listUsageWithServiceResponseAsync(final String resourceGroupName, final String virtualNetworkName) {
return listUsageSinglePageAsync(resourceGroupName, virtualNetworkName)
.concatMap(new Func1<ServiceResponse<Page<VirtualNetworkUsageInner>>, Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VirtualNetworkUsageInner>>> call(ServiceResponse<Page<VirtualNetworkUsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listUsageNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"VirtualNetworkUsageInner",
">",
">",
">",
"listUsageWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualNetworkName",
")",
"{",
"return",
"listUsageSin... | Lists usage stats.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkUsageInner> object | [
"Lists",
"usage",
"stats",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L1378-L1390 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/Job.java | Job.setProperty | public Object setProperty(final String key, final String value) {
return prop.put(key, value);
} | java | public Object setProperty(final String key, final String value) {
return prop.put(key, value);
} | [
"public",
"Object",
"setProperty",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"return",
"prop",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set property value.
@param key property key
@param value property value
@return the previous value of the specified key in this property list, or {@code null} if it did not have one | [
"Set",
"property",
"value",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/Job.java#L443-L445 |
EsfingeFramework/ClassMock | ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java | ClassMockUtils.get | public static Object get(final Object bean, final String property) {
try {
if (property.indexOf(".") >= 0) {
final Object subBean = ClassMockUtils.get(bean, property.substring(0, property.indexOf(".")));
if (subBean == null) {
return null;
}
final String newProperty = property.substring(property.indexOf(".") + 1);
return ClassMockUtils.get(subBean, newProperty);
}
Method method = null;
try {
method = bean.getClass().getMethod(ClassMockUtils.propertyToGetter(property), new Class[] {});
} catch (final NoSuchMethodException e) {
method = bean.getClass().getMethod(ClassMockUtils.propertyToGetter(property, true), new Class[] {});
}
return method.invoke(bean, new Object[] {});
} catch (final Exception e) {
throw new RuntimeException("Can't get property " + property + " in the class " + bean.getClass().getName(), e);
}
} | java | public static Object get(final Object bean, final String property) {
try {
if (property.indexOf(".") >= 0) {
final Object subBean = ClassMockUtils.get(bean, property.substring(0, property.indexOf(".")));
if (subBean == null) {
return null;
}
final String newProperty = property.substring(property.indexOf(".") + 1);
return ClassMockUtils.get(subBean, newProperty);
}
Method method = null;
try {
method = bean.getClass().getMethod(ClassMockUtils.propertyToGetter(property), new Class[] {});
} catch (final NoSuchMethodException e) {
method = bean.getClass().getMethod(ClassMockUtils.propertyToGetter(property, true), new Class[] {});
}
return method.invoke(bean, new Object[] {});
} catch (final Exception e) {
throw new RuntimeException("Can't get property " + property + " in the class " + bean.getClass().getName(), e);
}
} | [
"public",
"static",
"Object",
"get",
"(",
"final",
"Object",
"bean",
",",
"final",
"String",
"property",
")",
"{",
"try",
"{",
"if",
"(",
"property",
".",
"indexOf",
"(",
"\".\"",
")",
">=",
"0",
")",
"{",
"final",
"Object",
"subBean",
"=",
"ClassMockU... | Access the value in the property of the bean.
@param bean
to inspect
@param property
the name of the property to be access
@return the value | [
"Access",
"the",
"value",
"in",
"the",
"property",
"of",
"the",
"bean",
"."
] | train | https://github.com/EsfingeFramework/ClassMock/blob/a354c9dc68e8813fc4e995eef13e34796af58892/ClassMock/src/main/java/net/sf/esfinge/classmock/ClassMockUtils.java#L24-L55 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/content/DocumentTypeUrl.java | DocumentTypeUrl.getDocumentTypeUrl | public static MozuUrl getDocumentTypeUrl(String documentTypeName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documenttypes/{documentTypeName}?responseFields={responseFields}");
formatter.formatUrl("documentTypeName", documentTypeName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getDocumentTypeUrl(String documentTypeName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documenttypes/{documentTypeName}?responseFields={responseFields}");
formatter.formatUrl("documentTypeName", documentTypeName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getDocumentTypeUrl",
"(",
"String",
"documentTypeName",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content/documenttypes/{documentTypeName}?responseFields={responseFields}\"",
... | Get Resource Url for GetDocumentType
@param documentTypeName The name of the document type to retrieve.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetDocumentType"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/DocumentTypeUrl.java#L38-L44 |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java | BaseMojo.newStagingFile | public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime);
}
file.getParentFile().mkdirs();
return file;
} | java | public File newStagingFile(String entryName, long modTime) {
File file = new File(stagingDirectory, entryName);
if (modTime != 0) {
file.setLastModified(modTime);
}
file.getParentFile().mkdirs();
return file;
} | [
"public",
"File",
"newStagingFile",
"(",
"String",
"entryName",
",",
"long",
"modTime",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"stagingDirectory",
",",
"entryName",
")",
";",
"if",
"(",
"modTime",
"!=",
"0",
")",
"{",
"file",
".",
"setLastMod... | Creates a new file in the staging directory. Ensures that all folders in the path are also
created.
@param entryName Entry name to create.
@param modTime Modification timestamp for the new entry. If 0, defaults to the current time.
@return the new file | [
"Creates",
"a",
"new",
"file",
"in",
"the",
"staging",
"directory",
".",
"Ensures",
"that",
"all",
"folders",
"in",
"the",
"path",
"are",
"also",
"created",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L217-L226 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/io/FileUtil.java | FileUtil.copyFile | public static void copyFile(@NotNull Path from, @NotNull Path to) throws IOException {
Validate.isTrue(Files.exists(from), "%s is not exist or not a file", from);
Validate.notNull(to);
Validate.isTrue(!FileUtil.isDirExists(to), "%s is exist but it is a dir", to);
Files.copy(from, to);
} | java | public static void copyFile(@NotNull Path from, @NotNull Path to) throws IOException {
Validate.isTrue(Files.exists(from), "%s is not exist or not a file", from);
Validate.notNull(to);
Validate.isTrue(!FileUtil.isDirExists(to), "%s is exist but it is a dir", to);
Files.copy(from, to);
} | [
"public",
"static",
"void",
"copyFile",
"(",
"@",
"NotNull",
"Path",
"from",
",",
"@",
"NotNull",
"Path",
"to",
")",
"throws",
"IOException",
"{",
"Validate",
".",
"isTrue",
"(",
"Files",
".",
"exists",
"(",
"from",
")",
",",
"\"%s is not exist or not a file... | 文件复制. @see {@link Files#copy}
@param from 如果为null,或文件不存在或者是目录,,抛出异常
@param to 如果to为null,或文件存在但是一个目录,抛出异常 | [
"文件复制",
".",
"@see",
"{",
"@link",
"Files#copy",
"}"
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/io/FileUtil.java#L251-L256 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/BaseFont.java | BaseFont.getDocumentFonts | public static ArrayList getDocumentFonts(PdfReader reader, int page) {
IntHashtable hits = new IntHashtable();
ArrayList fonts = new ArrayList();
recourseFonts(reader.getPageN(page), hits, fonts, 1);
return fonts;
} | java | public static ArrayList getDocumentFonts(PdfReader reader, int page) {
IntHashtable hits = new IntHashtable();
ArrayList fonts = new ArrayList();
recourseFonts(reader.getPageN(page), hits, fonts, 1);
return fonts;
} | [
"public",
"static",
"ArrayList",
"getDocumentFonts",
"(",
"PdfReader",
"reader",
",",
"int",
"page",
")",
"{",
"IntHashtable",
"hits",
"=",
"new",
"IntHashtable",
"(",
")",
";",
"ArrayList",
"fonts",
"=",
"new",
"ArrayList",
"(",
")",
";",
"recourseFonts",
"... | Gets a list of the document fonts in a particular page. Each element of the <CODE>ArrayList</CODE>
contains a <CODE>Object[]{String,PRIndirectReference}</CODE> with the font name
and the indirect reference to it.
@param reader the document where the fonts are to be listed from
@param page the page to list the fonts from
@return the list of fonts and references | [
"Gets",
"a",
"list",
"of",
"the",
"document",
"fonts",
"in",
"a",
"particular",
"page",
".",
"Each",
"element",
"of",
"the",
"<CODE",
">",
"ArrayList<",
"/",
"CODE",
">",
"contains",
"a",
"<CODE",
">",
"Object",
"[]",
"{",
"String",
"PRIndirectReference",
... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BaseFont.java#L1488-L1493 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsconsoleloginprompt.java | nsconsoleloginprompt.get | public static nsconsoleloginprompt get(nitro_service service, options option) throws Exception{
nsconsoleloginprompt obj = new nsconsoleloginprompt();
nsconsoleloginprompt[] response = (nsconsoleloginprompt[])obj.get_resources(service,option);
return response[0];
} | java | public static nsconsoleloginprompt get(nitro_service service, options option) throws Exception{
nsconsoleloginprompt obj = new nsconsoleloginprompt();
nsconsoleloginprompt[] response = (nsconsoleloginprompt[])obj.get_resources(service,option);
return response[0];
} | [
"public",
"static",
"nsconsoleloginprompt",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"nsconsoleloginprompt",
"obj",
"=",
"new",
"nsconsoleloginprompt",
"(",
")",
";",
"nsconsoleloginprompt",
"[",
"]",
"respon... | Use this API to fetch all the nsconsoleloginprompt resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsconsoleloginprompt",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsconsoleloginprompt.java#L118-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.