repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java | FutureUtils.orTimeout | public static <T> CompletableFuture<T> orTimeout(CompletableFuture<T> future, long timeout, TimeUnit timeUnit) {
return orTimeout(future, timeout, timeUnit, Executors.directExecutor());
} | java | public static <T> CompletableFuture<T> orTimeout(CompletableFuture<T> future, long timeout, TimeUnit timeUnit) {
return orTimeout(future, timeout, timeUnit, Executors.directExecutor());
} | [
"public",
"static",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"orTimeout",
"(",
"CompletableFuture",
"<",
"T",
">",
"future",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"orTimeout",
"(",
"future",
",",
"timeout",
",",... | Times the given future out after the timeout.
@param future to time out
@param timeout after which the given future is timed out
@param timeUnit time unit of the timeout
@param <T> type of the given future
@return The timeout enriched future | [
"Times",
"the",
"given",
"future",
"out",
"after",
"the",
"timeout",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L338-L340 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java | Converter.registerConverter | public static void registerConverter(final Class<?> pType, final PropertyConverter pConverter) {
getInstance().converters.put(pType, pConverter);
} | java | public static void registerConverter(final Class<?> pType, final PropertyConverter pConverter) {
getInstance().converters.put(pType, pConverter);
} | [
"public",
"static",
"void",
"registerConverter",
"(",
"final",
"Class",
"<",
"?",
">",
"pType",
",",
"final",
"PropertyConverter",
"pConverter",
")",
"{",
"getInstance",
"(",
")",
".",
"converters",
".",
"put",
"(",
"pType",
",",
"pConverter",
")",
";",
"}... | Registers a converter for a given type.
This converter will also be used for all subclasses, unless a more
specific version is registered.
</p>
By default, converters for {@link com.twelvemonkeys.util.Time}, {@link Date}
and {@link Object}
(the {@link DefaultConverter}) are registered by this class' static
initializer. You might remove them using the
{@code unregisterConverter} method.
@param pType the (super) type to register a converter for
@param pConverter the converter
@see #unregisterConverter(Class) | [
"Registers",
"a",
"converter",
"for",
"a",
"given",
"type",
".",
"This",
"converter",
"will",
"also",
"be",
"used",
"for",
"all",
"subclasses",
"unless",
"a",
"more",
"specific",
"version",
"is",
"registered",
".",
"<",
"/",
"p",
">",
"By",
"default",
"c... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/Converter.java#L120-L122 |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201805/ReportDownloader.java | ReportDownloader.getDownloadUrl | public URL getDownloadUrl(ReportDownloadOptions options) throws RemoteException,
MalformedURLException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
Preconditions.checkState(status == ReportJobStatus.COMPLETED, "Report " + reportJobId
+ " must be completed before downloading. It is currently: " + status);
return new URL(reportService.getReportDownloadUrlWithOptions(reportJobId, options));
} | java | public URL getDownloadUrl(ReportDownloadOptions options) throws RemoteException,
MalformedURLException {
ReportJobStatus status = reportService.getReportJobStatus(reportJobId);
Preconditions.checkState(status == ReportJobStatus.COMPLETED, "Report " + reportJobId
+ " must be completed before downloading. It is currently: " + status);
return new URL(reportService.getReportDownloadUrlWithOptions(reportJobId, options));
} | [
"public",
"URL",
"getDownloadUrl",
"(",
"ReportDownloadOptions",
"options",
")",
"throws",
"RemoteException",
",",
"MalformedURLException",
"{",
"ReportJobStatus",
"status",
"=",
"reportService",
".",
"getReportJobStatus",
"(",
"reportJobId",
")",
";",
"Preconditions",
... | Gets the download URL for a GZip or plain-text format report. If you requested
a compressed report, you may want to save your file with a gz or zip extension.
<pre><code>
URL url = reportDownloader.getDownloadUrl(options);
Resources.asByteSource(url).copyTo(Files.asByteSink(file));
</code></pre>
@param options the options to download the report with
@return the URL for the report download
@throws RemoteException if there was an error performing any Axis call
@throws MalformedURLException if there is an error forming the download URL
@throws IllegalStateException if the report is not ready to be downloaded | [
"Gets",
"the",
"download",
"URL",
"for",
"a",
"GZip",
"or",
"plain",
"-",
"text",
"format",
"report",
".",
"If",
"you",
"requested",
"a",
"compressed",
"report",
"you",
"may",
"want",
"to",
"save",
"your",
"file",
"with",
"a",
"gz",
"or",
"zip",
"exten... | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201805/ReportDownloader.java#L182-L188 |
threerings/narya | core/src/main/java/com/threerings/io/ObjectInputStream.java | ObjectInputStream.mapClass | protected ClassMapping mapClass (short code, String cname)
throws IOException, ClassNotFoundException
{
// create a class mapping record, and cache it
ClassMapping cmap = createClassMapping(code, cname);
_classmap.add(code, cmap);
return cmap;
} | java | protected ClassMapping mapClass (short code, String cname)
throws IOException, ClassNotFoundException
{
// create a class mapping record, and cache it
ClassMapping cmap = createClassMapping(code, cname);
_classmap.add(code, cmap);
return cmap;
} | [
"protected",
"ClassMapping",
"mapClass",
"(",
"short",
"code",
",",
"String",
"cname",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// create a class mapping record, and cache it",
"ClassMapping",
"cmap",
"=",
"createClassMapping",
"(",
"code",
",",
... | Creates, adds, and returns the class mapping for the specified code and class name. | [
"Creates",
"adds",
"and",
"returns",
"the",
"class",
"mapping",
"for",
"the",
"specified",
"code",
"and",
"class",
"name",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ObjectInputStream.java#L226-L233 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.safeTruncate | public static String safeTruncate(final String value, final int length, final String filler) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (length == 0) {
return "";
}
if (length >= value.length()) {
return value;
}
String[] words = words(value);
StringJoiner result = new StringJoiner(" ");
int spaceCount = 0;
for (String word : words) {
if (result.length() + word.length() + filler.length() + spaceCount > length) {
break;
} else {
result.add(word);
spaceCount++;
}
}
return append(result.toString(), filler);
} | java | public static String safeTruncate(final String value, final int length, final String filler) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (length == 0) {
return "";
}
if (length >= value.length()) {
return value;
}
String[] words = words(value);
StringJoiner result = new StringJoiner(" ");
int spaceCount = 0;
for (String word : words) {
if (result.length() + word.length() + filler.length() + spaceCount > length) {
break;
} else {
result.add(word);
spaceCount++;
}
}
return append(result.toString(), filler);
} | [
"public",
"static",
"String",
"safeTruncate",
"(",
"final",
"String",
"value",
",",
"final",
"int",
"length",
",",
"final",
"String",
"filler",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"if",
"... | Truncate the string securely, not cutting a word in half. It always returns the last full word.
@param value The input String
@param length Max size of the truncated String
@param filler String that will be added to the end of the return string. Example: '...'
@return The truncated String | [
"Truncate",
"the",
"string",
"securely",
"not",
"cutting",
"a",
"word",
"in",
"half",
".",
"It",
"always",
"returns",
"the",
"last",
"full",
"word",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L872-L893 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java | NumberUtil.div | public static BigDecimal div(String v1, String v2, int scale) {
return div(v1, v2, scale, RoundingMode.HALF_UP);
} | java | public static BigDecimal div(String v1, String v2, int scale) {
return div(v1, v2, scale, RoundingMode.HALF_UP);
} | [
"public",
"static",
"BigDecimal",
"div",
"(",
"String",
"v1",
",",
"String",
"v2",
",",
"int",
"scale",
")",
"{",
"return",
"div",
"(",
"v1",
",",
"v2",
",",
"scale",
",",
"RoundingMode",
".",
"HALF_UP",
")",
";",
"}"
] | 提供(相对)精确的除法运算,当发生除不尽的情况时,由scale指定精确度,后面的四舍五入
@param v1 被除数
@param v2 除数
@param scale 精确度,如果为负值,取绝对值
@return 两个参数的商 | [
"提供",
"(",
"相对",
")",
"精确的除法运算",
"当发生除不尽的情况时",
"由scale指定精确度",
"后面的四舍五入"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L635-L637 |
spacecowboy/NoNonsense-FilePicker | library/src/main/java/com/nononsenseapps/filepicker/Utils.java | Utils.getFileForUri | @NonNull
public static File getFileForUri(@NonNull Uri uri) {
String path = uri.getEncodedPath();
final int splitIndex = path.indexOf('/', 1);
final String tag = Uri.decode(path.substring(1, splitIndex));
path = Uri.decode(path.substring(splitIndex + 1));
if (!"root".equalsIgnoreCase(tag)) {
throw new IllegalArgumentException(
String.format("Can't decode paths to '%s', only for 'root' paths.",
tag));
}
final File root = new File("/");
File file = new File(root, path);
try {
file = file.getCanonicalFile();
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
}
if (!file.getPath().startsWith(root.getPath())) {
throw new SecurityException("Resolved path jumped beyond configured root");
}
return file;
} | java | @NonNull
public static File getFileForUri(@NonNull Uri uri) {
String path = uri.getEncodedPath();
final int splitIndex = path.indexOf('/', 1);
final String tag = Uri.decode(path.substring(1, splitIndex));
path = Uri.decode(path.substring(splitIndex + 1));
if (!"root".equalsIgnoreCase(tag)) {
throw new IllegalArgumentException(
String.format("Can't decode paths to '%s', only for 'root' paths.",
tag));
}
final File root = new File("/");
File file = new File(root, path);
try {
file = file.getCanonicalFile();
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
}
if (!file.getPath().startsWith(root.getPath())) {
throw new SecurityException("Resolved path jumped beyond configured root");
}
return file;
} | [
"@",
"NonNull",
"public",
"static",
"File",
"getFileForUri",
"(",
"@",
"NonNull",
"Uri",
"uri",
")",
"{",
"String",
"path",
"=",
"uri",
".",
"getEncodedPath",
"(",
")",
";",
"final",
"int",
"splitIndex",
"=",
"path",
".",
"indexOf",
"(",
"'",
"'",
",",... | Convert a uri generated by a fileprovider, like content://AUTHORITY/ROOT/actual/path
to a file pointing to file:///actual/path
Note that it only works for paths generated with `ROOT` as the path element. This is done if
nnf_provider_paths.xml is used to define the file provider in the manifest.
@param uri generated from a file provider
@return Corresponding {@link File} object | [
"Convert",
"a",
"uri",
"generated",
"by",
"a",
"fileprovider",
"like",
"content",
":",
"//",
"AUTHORITY",
"/",
"ROOT",
"/",
"actual",
"/",
"path",
"to",
"a",
"file",
"pointing",
"to",
"file",
":",
"///",
"actual",
"/",
"path"
] | train | https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/library/src/main/java/com/nononsenseapps/filepicker/Utils.java#L70-L97 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.lastIndexOfAny | public static int lastIndexOfAny(final CharSequence str, final CharSequence... searchStrs) {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
int ret = INDEX_NOT_FOUND;
int tmp = 0;
for (final CharSequence search : searchStrs) {
if (search == null) {
continue;
}
tmp = CharSequenceUtils.lastIndexOf(str, search, str.length());
if (tmp > ret) {
ret = tmp;
}
}
return ret;
} | java | public static int lastIndexOfAny(final CharSequence str, final CharSequence... searchStrs) {
if (str == null || searchStrs == null) {
return INDEX_NOT_FOUND;
}
int ret = INDEX_NOT_FOUND;
int tmp = 0;
for (final CharSequence search : searchStrs) {
if (search == null) {
continue;
}
tmp = CharSequenceUtils.lastIndexOf(str, search, str.length());
if (tmp > ret) {
ret = tmp;
}
}
return ret;
} | [
"public",
"static",
"int",
"lastIndexOfAny",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"...",
"searchStrs",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStrs",
"==",
"null",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
... | <p>Find the latest index of any of a set of potential substrings.</p>
<p>A {@code null} CharSequence will return {@code -1}.
A {@code null} search array will return {@code -1}.
A {@code null} or zero length search array entry will be ignored,
but a search array containing "" will return the length of {@code str}
if {@code str} is not null. This method uses {@link String#indexOf(String)} if possible</p>
<pre>
StringUtils.lastIndexOfAny(null, *) = -1
StringUtils.lastIndexOfAny(*, null) = -1
StringUtils.lastIndexOfAny(*, []) = -1
StringUtils.lastIndexOfAny(*, [null]) = -1
StringUtils.lastIndexOfAny("zzabyycdxx", ["ab","cd"]) = 6
StringUtils.lastIndexOfAny("zzabyycdxx", ["cd","ab"]) = 6
StringUtils.lastIndexOfAny("zzabyycdxx", ["mn","op"]) = -1
StringUtils.lastIndexOfAny("zzabyycdxx", ["mn","op"]) = -1
StringUtils.lastIndexOfAny("zzabyycdxx", ["mn",""]) = 10
</pre>
@param str the CharSequence to check, may be null
@param searchStrs the CharSequences to search for, may be null
@return the last index of any of the CharSequences, -1 if no match
@since 3.0 Changed signature from lastIndexOfAny(String, String[]) to lastIndexOfAny(CharSequence, CharSequence) | [
"<p",
">",
"Find",
"the",
"latest",
"index",
"of",
"any",
"of",
"a",
"set",
"of",
"potential",
"substrings",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L2593-L2609 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java | ActivityManagerUtils.isServiceRunning | public static boolean isServiceRunning(Context context, Class<? extends Service> service, int maxCheckCount) {
if (context == null || service == null) {
return false;
}
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> list = manager.getRunningServices(maxCheckCount);
for (RunningServiceInfo info : list) {
if (service.getCanonicalName().equals(info.service.getClassName())) {
return true;
}
}
return false;
} | java | public static boolean isServiceRunning(Context context, Class<? extends Service> service, int maxCheckCount) {
if (context == null || service == null) {
return false;
}
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> list = manager.getRunningServices(maxCheckCount);
for (RunningServiceInfo info : list) {
if (service.getCanonicalName().equals(info.service.getClassName())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isServiceRunning",
"(",
"Context",
"context",
",",
"Class",
"<",
"?",
"extends",
"Service",
">",
"service",
",",
"int",
"maxCheckCount",
")",
"{",
"if",
"(",
"context",
"==",
"null",
"||",
"service",
"==",
"null",
")",
"{",
... | Checks if the specified service is currently running or not.
@param context the context.
@param service the {@link java.lang.Class} of the service.
@param maxCheckCount maximum value of the running service count for this check.
@return true if the service is running, false otherwise. | [
"Checks",
"if",
"the",
"specified",
"service",
"is",
"currently",
"running",
"or",
"not",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java#L60-L73 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java | LBFGS_port.QUARD_MINIMIZER2 | private static double QUARD_MINIMIZER2(double qm, double u, double du, double v, double dv) {
double a, d, gamma, theta, p, q, r, s;
a = (u) - (v);
(qm) = (v) + (dv) / ((dv) - (du)) * a;
return qm;
} | java | private static double QUARD_MINIMIZER2(double qm, double u, double du, double v, double dv) {
double a, d, gamma, theta, p, q, r, s;
a = (u) - (v);
(qm) = (v) + (dv) / ((dv) - (du)) * a;
return qm;
} | [
"private",
"static",
"double",
"QUARD_MINIMIZER2",
"(",
"double",
"qm",
",",
"double",
"u",
",",
"double",
"du",
",",
"double",
"v",
",",
"double",
"dv",
")",
"{",
"double",
"a",
",",
"d",
",",
"gamma",
",",
"theta",
",",
"p",
",",
"q",
",",
"r",
... | Find a minimizer of an interpolated quadratic function.
@param qm The minimizer of the interpolated quadratic.
@param u The value of one point, u.
@param du The value of f'(u).
@param v The value of another point, v.
@param dv The value of f'(v). | [
"Find",
"a",
"minimizer",
"of",
"an",
"interpolated",
"quadratic",
"function",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java#L1866-L1871 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/BsfUtils.java | BsfUtils.selectMomentJSDateTimeFormat | public static String selectMomentJSDateTimeFormat(Locale locale, String momentJSFormat, boolean withDate, boolean withTime) {
if (momentJSFormat == null) {
String dateFormat = "";
if (withDate) {
dateFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern();
}
String timeFormat = "";
if (withTime) {
timeFormat = ((SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.MEDIUM, locale)).toPattern();
}
// Since DateFormat.SHORT is silly, return a smart format
if (dateFormat.equals("M/d/yy")) {
dateFormat = "MM/dd/yyyy";
}
else if (dateFormat.equals("d/M/yy")) {
dateFormat = "dd/MM/yyyy";
}
String result = LocaleUtils.javaToMomentFormat((dateFormat + " " + timeFormat).trim());
// System.out.println(result);
return result;
} else {
return momentJSFormat;
}
} | java | public static String selectMomentJSDateTimeFormat(Locale locale, String momentJSFormat, boolean withDate, boolean withTime) {
if (momentJSFormat == null) {
String dateFormat = "";
if (withDate) {
dateFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern();
}
String timeFormat = "";
if (withTime) {
timeFormat = ((SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.MEDIUM, locale)).toPattern();
}
// Since DateFormat.SHORT is silly, return a smart format
if (dateFormat.equals("M/d/yy")) {
dateFormat = "MM/dd/yyyy";
}
else if (dateFormat.equals("d/M/yy")) {
dateFormat = "dd/MM/yyyy";
}
String result = LocaleUtils.javaToMomentFormat((dateFormat + " " + timeFormat).trim());
// System.out.println(result);
return result;
} else {
return momentJSFormat;
}
} | [
"public",
"static",
"String",
"selectMomentJSDateTimeFormat",
"(",
"Locale",
"locale",
",",
"String",
"momentJSFormat",
",",
"boolean",
"withDate",
",",
"boolean",
"withTime",
")",
"{",
"if",
"(",
"momentJSFormat",
"==",
"null",
")",
"{",
"String",
"dateFormat",
... | Selects the Date Pattern to use based on the given Locale if the input
format is null
@param locale
Locale (may be the result of a call to selectLocale)
@param momentJSFormat
Input format String
@return moment.js Date Pattern eg. DD/MM/YYYY | [
"Selects",
"the",
"Date",
"Pattern",
"to",
"use",
"based",
"on",
"the",
"given",
"Locale",
"if",
"the",
"input",
"format",
"is",
"null"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/BsfUtils.java#L570-L593 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/conversion/converters/NumberConverter.java | NumberConverter.canConvert | @Override
public boolean canConvert(Class<?> fromType, Class<?> toType) {
return fromType != null && isAssignableTo(fromType, Number.class, String.class)
&& toType != null && Number.class.isAssignableFrom(toType);
} | java | @Override
public boolean canConvert(Class<?> fromType, Class<?> toType) {
return fromType != null && isAssignableTo(fromType, Number.class, String.class)
&& toType != null && Number.class.isAssignableFrom(toType);
} | [
"@",
"Override",
"public",
"boolean",
"canConvert",
"(",
"Class",
"<",
"?",
">",
"fromType",
",",
"Class",
"<",
"?",
">",
"toType",
")",
"{",
"return",
"fromType",
"!=",
"null",
"&&",
"isAssignableTo",
"(",
"fromType",
",",
"Number",
".",
"class",
",",
... | Determines whether this {@link Converter} can convert {@link Object Objects}
{@link Class from type} {@link Class to type}.
@param fromType {@link Class type} to convert from.
@param toType {@link Class type} to convert to.
@return a boolean indicating whether this {@link Converter} can convert {@link Object Objects}
{@link Class from type} {@link Class to type}.
@see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class)
@see #canConvert(Object, Class) | [
"Determines",
"whether",
"this",
"{",
"@link",
"Converter",
"}",
"can",
"convert",
"{",
"@link",
"Object",
"Objects",
"}",
"{",
"@link",
"Class",
"from",
"type",
"}",
"{",
"@link",
"Class",
"to",
"type",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/converters/NumberConverter.java#L135-L139 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/ScriptConverter.java | ScriptConverter._serializeQuery | private void _serializeQuery(Query query, StringBuilder sb, Set<Object> done) throws ConverterException {
// Collection.Key[] keys = query.keys();
Iterator<Key> it = query.keyIterator();
Key k;
sb.append(goIn());
sb.append("query(");
deep++;
boolean oDoIt = false;
int len = query.getRecordcount();
while (it.hasNext()) {
k = it.next();
if (oDoIt) sb.append(',');
oDoIt = true;
sb.append(goIn());
sb.append(QUOTE_CHR);
sb.append(escape(k.getString()));
sb.append(QUOTE_CHR);
sb.append(":[");
boolean doIt = false;
for (int y = 1; y <= len; y++) {
if (doIt) sb.append(',');
doIt = true;
try {
_serialize(query.getAt(k, y), sb, done);
}
catch (PageException e) {
_serialize(e.getMessage(), sb, done);
}
}
sb.append(']');
}
deep--;
sb.append(')');
} | java | private void _serializeQuery(Query query, StringBuilder sb, Set<Object> done) throws ConverterException {
// Collection.Key[] keys = query.keys();
Iterator<Key> it = query.keyIterator();
Key k;
sb.append(goIn());
sb.append("query(");
deep++;
boolean oDoIt = false;
int len = query.getRecordcount();
while (it.hasNext()) {
k = it.next();
if (oDoIt) sb.append(',');
oDoIt = true;
sb.append(goIn());
sb.append(QUOTE_CHR);
sb.append(escape(k.getString()));
sb.append(QUOTE_CHR);
sb.append(":[");
boolean doIt = false;
for (int y = 1; y <= len; y++) {
if (doIt) sb.append(',');
doIt = true;
try {
_serialize(query.getAt(k, y), sb, done);
}
catch (PageException e) {
_serialize(e.getMessage(), sb, done);
}
}
sb.append(']');
}
deep--;
sb.append(')');
} | [
"private",
"void",
"_serializeQuery",
"(",
"Query",
"query",
",",
"StringBuilder",
"sb",
",",
"Set",
"<",
"Object",
">",
"done",
")",
"throws",
"ConverterException",
"{",
"// Collection.Key[] keys = query.keys();",
"Iterator",
"<",
"Key",
">",
"it",
"=",
"query",
... | serialize a Query
@param query Query to serialize
@param sb
@param done
@throws ConverterException | [
"serialize",
"a",
"Query"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L365-L402 |
groupe-sii/ogham | ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java | OvhSmsSender.handleResponse | private void handleResponse(Sms message, Response response) throws IOException, JsonProcessingException, MessageNotSentException {
if (response.getStatus().isSuccess()) {
JsonNode json = mapper.readTree(response.getBody());
int ovhStatus = json.get("status").asInt();
// 100 <= ovh status < 200 ====> OK -> just log response
// 200 <= ovh status ====> KO -> throw an exception
if (ovhStatus >= OK_STATUS) {
LOG.error("SMS failed to be sent through OVH");
LOG.debug("Sent SMS: {}", message);
LOG.debug("Response status {}", response.getStatus());
LOG.debug("Response body {}", response.getBody());
throw new MessageNotSentException("SMS couldn't be sent through OVH: " + json.get("message").asText(), message);
} else {
LOG.info("SMS successfully sent through OVH");
LOG.debug("Sent SMS: {}", message);
LOG.debug("Response: {}", response.getBody());
}
} else {
LOG.error("Response status {}", response.getStatus());
LOG.error("Response body {}", response.getBody());
throw new MessageNotSentException("SMS couldn't be sent. Response status is " + response.getStatus(), message);
}
} | java | private void handleResponse(Sms message, Response response) throws IOException, JsonProcessingException, MessageNotSentException {
if (response.getStatus().isSuccess()) {
JsonNode json = mapper.readTree(response.getBody());
int ovhStatus = json.get("status").asInt();
// 100 <= ovh status < 200 ====> OK -> just log response
// 200 <= ovh status ====> KO -> throw an exception
if (ovhStatus >= OK_STATUS) {
LOG.error("SMS failed to be sent through OVH");
LOG.debug("Sent SMS: {}", message);
LOG.debug("Response status {}", response.getStatus());
LOG.debug("Response body {}", response.getBody());
throw new MessageNotSentException("SMS couldn't be sent through OVH: " + json.get("message").asText(), message);
} else {
LOG.info("SMS successfully sent through OVH");
LOG.debug("Sent SMS: {}", message);
LOG.debug("Response: {}", response.getBody());
}
} else {
LOG.error("Response status {}", response.getStatus());
LOG.error("Response body {}", response.getBody());
throw new MessageNotSentException("SMS couldn't be sent. Response status is " + response.getStatus(), message);
}
} | [
"private",
"void",
"handleResponse",
"(",
"Sms",
"message",
",",
"Response",
"response",
")",
"throws",
"IOException",
",",
"JsonProcessingException",
",",
"MessageNotSentException",
"{",
"if",
"(",
"response",
".",
"getStatus",
"(",
")",
".",
"isSuccess",
"(",
... | Handle OVH response. If status provided in response is less than 200,
then the message has been sent. Otherwise, the message has not been sent.
@param message
the SMS to send
@param response
the received response from OVH API
@throws IOException
when the response couldn't be read
@throws JsonProcessingException
when the response format is not valid JSON
@throws MessageNotSentException
generated exception to indicate that the message couldn't be
sent | [
"Handle",
"OVH",
"response",
".",
"If",
"status",
"provided",
"in",
"response",
"is",
"less",
"than",
"200",
"then",
"the",
"message",
"has",
"been",
"sent",
".",
"Otherwise",
"the",
"message",
"has",
"not",
"been",
"sent",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-sms-ovh/src/main/java/fr/sii/ogham/sms/sender/impl/OvhSmsSender.java#L125-L147 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java | DigestUtils.shaBase32 | public static String shaBase32(final String salt, final String data, final String separator, final boolean chunked) {
val result = rawDigest(MessageDigestAlgorithms.SHA_1, salt, separator == null ? data : data + separator);
return EncodingUtils.encodeBase32(result, chunked);
} | java | public static String shaBase32(final String salt, final String data, final String separator, final boolean chunked) {
val result = rawDigest(MessageDigestAlgorithms.SHA_1, salt, separator == null ? data : data + separator);
return EncodingUtils.encodeBase32(result, chunked);
} | [
"public",
"static",
"String",
"shaBase32",
"(",
"final",
"String",
"salt",
",",
"final",
"String",
"data",
",",
"final",
"String",
"separator",
",",
"final",
"boolean",
"chunked",
")",
"{",
"val",
"result",
"=",
"rawDigest",
"(",
"MessageDigestAlgorithms",
"."... | Sha base 32 string.
@param salt the salt
@param data the data
@param separator a string separator, if any
@param chunked the chunked
@return the string | [
"Sha",
"base",
"32",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java#L111-L114 |
apache/flink | flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java | FieldParser.nextStringLength | protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) {
if (length <= 0) {
throw new IllegalArgumentException("Invalid input: Empty string");
}
int limitedLength = 0;
final byte delByte = (byte) delimiter;
while (limitedLength < length && bytes[startPos + limitedLength] != delByte) {
limitedLength++;
}
return limitedLength;
} | java | protected static final int nextStringLength(byte[] bytes, int startPos, int length, char delimiter) {
if (length <= 0) {
throw new IllegalArgumentException("Invalid input: Empty string");
}
int limitedLength = 0;
final byte delByte = (byte) delimiter;
while (limitedLength < length && bytes[startPos + limitedLength] != delByte) {
limitedLength++;
}
return limitedLength;
} | [
"protected",
"static",
"final",
"int",
"nextStringLength",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"startPos",
",",
"int",
"length",
",",
"char",
"delimiter",
")",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Returns the length of a string. Throws an exception if the column is empty.
@return the length of the string | [
"Returns",
"the",
"length",
"of",
"a",
"string",
".",
"Throws",
"an",
"exception",
"if",
"the",
"column",
"is",
"empty",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/FieldParser.java#L230-L242 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java | RemoteLockMapImpl.hasReadLock | public boolean hasReadLock(TransactionImpl tx, Object obj)
{
try
{
LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(), tx.getGUID());
boolean result = hasReadLockRemote(lock);
return result;
}
catch (Throwable t)
{
log.error("Cannot check read lock for object " + obj + " in transaction " + tx, t);
return false;
}
} | java | public boolean hasReadLock(TransactionImpl tx, Object obj)
{
try
{
LockEntry lock = new LockEntry(new Identity(obj,getBroker()).toString(), tx.getGUID());
boolean result = hasReadLockRemote(lock);
return result;
}
catch (Throwable t)
{
log.error("Cannot check read lock for object " + obj + " in transaction " + tx, t);
return false;
}
} | [
"public",
"boolean",
"hasReadLock",
"(",
"TransactionImpl",
"tx",
",",
"Object",
"obj",
")",
"{",
"try",
"{",
"LockEntry",
"lock",
"=",
"new",
"LockEntry",
"(",
"new",
"Identity",
"(",
"obj",
",",
"getBroker",
"(",
")",
")",
".",
"toString",
"(",
")",
... | check if there is a reader lock entry for transaction tx on object obj
in the persistent storage. | [
"check",
"if",
"there",
"is",
"a",
"reader",
"lock",
"entry",
"for",
"transaction",
"tx",
"on",
"object",
"obj",
"in",
"the",
"persistent",
"storage",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L433-L446 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/xml/XmlBeanAssert.java | XmlBeanAssert.assertEquals | public static void assertEquals(XmlObject expected, XmlObject actual)
{
assertEquals(null, expected.newCursor(), actual.newCursor());
} | java | public static void assertEquals(XmlObject expected, XmlObject actual)
{
assertEquals(null, expected.newCursor(), actual.newCursor());
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"XmlObject",
"expected",
",",
"XmlObject",
"actual",
")",
"{",
"assertEquals",
"(",
"null",
",",
"expected",
".",
"newCursor",
"(",
")",
",",
"actual",
".",
"newCursor",
"(",
")",
")",
";",
"}"
] | Asserts that two XmlBeans are equivalent based on a deep compare (ignoring
whitespace and ordering of element attributes). If the two XmlBeans are
not equivalent, an AssertionFailedError is thrown, failing the test case.
Note: we can't provide line numbers since XmlBeans only makes these available
if we're using the Picollo parser. We'll get line numbers when we upgrade to
XmlBeans 2.0.
@param expected
@param actual | [
"Asserts",
"that",
"two",
"XmlBeans",
"are",
"equivalent",
"based",
"on",
"a",
"deep",
"compare",
"(",
"ignoring",
"whitespace",
"and",
"ordering",
"of",
"element",
"attributes",
")",
".",
"If",
"the",
"two",
"XmlBeans",
"are",
"not",
"equivalent",
"an",
"As... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/xml/XmlBeanAssert.java#L49-L52 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/codec/Base64.java | Base64.decodeToStream | public static void decodeToStream(String base64, OutputStream out, boolean isCloseOut) {
IoUtil.write(out, isCloseOut, Base64Decoder.decode(base64));
} | java | public static void decodeToStream(String base64, OutputStream out, boolean isCloseOut) {
IoUtil.write(out, isCloseOut, Base64Decoder.decode(base64));
} | [
"public",
"static",
"void",
"decodeToStream",
"(",
"String",
"base64",
",",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
")",
"{",
"IoUtil",
".",
"write",
"(",
"out",
",",
"isCloseOut",
",",
"Base64Decoder",
".",
"decode",
"(",
"base64",
")",
")",
... | base64解码
@param base64 被解码的base64字符串
@param out 写出到的流
@param isCloseOut 是否关闭输出流
@since 4.0.9 | [
"base64解码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/codec/Base64.java#L301-L303 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java | MetricServiceClient.createTimeSeries | public final void createTimeSeries(ProjectName name, List<TimeSeries> timeSeries) {
CreateTimeSeriesRequest request =
CreateTimeSeriesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.addAllTimeSeries(timeSeries)
.build();
createTimeSeries(request);
} | java | public final void createTimeSeries(ProjectName name, List<TimeSeries> timeSeries) {
CreateTimeSeriesRequest request =
CreateTimeSeriesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.addAllTimeSeries(timeSeries)
.build();
createTimeSeries(request);
} | [
"public",
"final",
"void",
"createTimeSeries",
"(",
"ProjectName",
"name",
",",
"List",
"<",
"TimeSeries",
">",
"timeSeries",
")",
"{",
"CreateTimeSeriesRequest",
"request",
"=",
"CreateTimeSeriesRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
... | Creates or adds data to one or more time series. The response is empty if all time series in
the request were written. If any time series could not be written, a corresponding failure
message is included in the error response.
<p>Sample code:
<pre><code>
try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
ProjectName name = ProjectName.of("[PROJECT]");
List<TimeSeries> timeSeries = new ArrayList<>();
metricServiceClient.createTimeSeries(name, timeSeries);
}
</code></pre>
@param name The project on which to execute the request. The format is
`"projects/{project_id_or_number}"`.
@param timeSeries The new data to be added to a list of time series. Adds at most one data
point to each of several time series. The new data point must be more recent than any other
point in its time series. Each `TimeSeries` value must fully specify a unique time series
by supplying all label values for the metric and the monitored resource.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"or",
"adds",
"data",
"to",
"one",
"or",
"more",
"time",
"series",
".",
"The",
"response",
"is",
"empty",
"if",
"all",
"time",
"series",
"in",
"the",
"request",
"were",
"written",
".",
"If",
"any",
"time",
"series",
"could",
"not",
"be",
"wr... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java#L1091-L1099 |
google/closure-compiler | src/com/google/javascript/jscomp/DefaultPassConfig.java | DefaultPassConfig.combineChecks | private static HotSwapCompilerPass combineChecks(AbstractCompiler compiler,
List<Callback> callbacks) {
checkArgument(!callbacks.isEmpty());
return new CombinedCompilerPass(compiler, callbacks);
} | java | private static HotSwapCompilerPass combineChecks(AbstractCompiler compiler,
List<Callback> callbacks) {
checkArgument(!callbacks.isEmpty());
return new CombinedCompilerPass(compiler, callbacks);
} | [
"private",
"static",
"HotSwapCompilerPass",
"combineChecks",
"(",
"AbstractCompiler",
"compiler",
",",
"List",
"<",
"Callback",
">",
"callbacks",
")",
"{",
"checkArgument",
"(",
"!",
"callbacks",
".",
"isEmpty",
"(",
")",
")",
";",
"return",
"new",
"CombinedComp... | Executes the given callbacks with a {@link CombinedCompilerPass}. | [
"Executes",
"the",
"given",
"callbacks",
"with",
"a",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DefaultPassConfig.java#L2088-L2092 |
netty/netty | codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java | ByteToMessageDecoder.channelInputClosed | void channelInputClosed(ChannelHandlerContext ctx, List<Object> out) throws Exception {
if (cumulation != null) {
callDecode(ctx, cumulation, out);
decodeLast(ctx, cumulation, out);
} else {
decodeLast(ctx, Unpooled.EMPTY_BUFFER, out);
}
} | java | void channelInputClosed(ChannelHandlerContext ctx, List<Object> out) throws Exception {
if (cumulation != null) {
callDecode(ctx, cumulation, out);
decodeLast(ctx, cumulation, out);
} else {
decodeLast(ctx, Unpooled.EMPTY_BUFFER, out);
}
} | [
"void",
"channelInputClosed",
"(",
"ChannelHandlerContext",
"ctx",
",",
"List",
"<",
"Object",
">",
"out",
")",
"throws",
"Exception",
"{",
"if",
"(",
"cumulation",
"!=",
"null",
")",
"{",
"callDecode",
"(",
"ctx",
",",
"cumulation",
",",
"out",
")",
";",
... | Called when the input of the channel was closed which may be because it changed to inactive or because of
{@link ChannelInputShutdownEvent}. | [
"Called",
"when",
"the",
"input",
"of",
"the",
"channel",
"was",
"closed",
"which",
"may",
"be",
"because",
"it",
"changed",
"to",
"inactive",
"or",
"because",
"of",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java#L403-L410 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_replace | public static String preg_replace(String regex, String replacement, String subject) {
Pattern p = Pattern.compile(regex);
return preg_replace(p, replacement, subject);
} | java | public static String preg_replace(String regex, String replacement, String subject) {
Pattern p = Pattern.compile(regex);
return preg_replace(p, replacement, subject);
} | [
"public",
"static",
"String",
"preg_replace",
"(",
"String",
"regex",
",",
"String",
"replacement",
",",
"String",
"subject",
")",
"{",
"Pattern",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"regex",
")",
";",
"return",
"preg_replace",
"(",
"p",
",",
"replac... | Matches a string with a regex and replaces the matched components with
a provided string.
@param regex
@param replacement
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"regex",
"and",
"replaces",
"the",
"matched",
"components",
"with",
"a",
"provided",
"string",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L106-L109 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.updateInvoice | public Invoice updateInvoice(final String invoiceId, final Invoice invoice) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId, invoice, Invoice.class);
} | java | public Invoice updateInvoice(final String invoiceId, final Invoice invoice) {
return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId, invoice, Invoice.class);
} | [
"public",
"Invoice",
"updateInvoice",
"(",
"final",
"String",
"invoiceId",
",",
"final",
"Invoice",
"invoice",
")",
"{",
"return",
"doPUT",
"(",
"Invoices",
".",
"INVOICES_RESOURCE",
"+",
"\"/\"",
"+",
"invoiceId",
",",
"invoice",
",",
"Invoice",
".",
"class",... | Update an invoice
<p>
Updates an existing invoice.
@param invoiceId String Recurly Invoice ID
@return the updated invoice object on success, null otherwise | [
"Update",
"an",
"invoice",
"<p",
">",
"Updates",
"an",
"existing",
"invoice",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1009-L1011 |
hibernate/hibernate-ogm | infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/PersistenceStrategy.java | PersistenceStrategy.getPerTableStrategy | private static PersistenceStrategy<?, ?, ?> getPerTableStrategy(
EmbeddedCacheManager externalCacheManager,
URL configUrl,
JtaPlatform platform,
Set<EntityKeyMetadata> entityTypes,
Set<AssociationKeyMetadata> associationTypes,
Set<IdSourceKeyMetadata> idSourceTypes) {
PerTableKeyProvider keyProvider = new PerTableKeyProvider();
PerTableCacheManager cacheManager = externalCacheManager != null ?
new PerTableCacheManager( externalCacheManager, entityTypes, associationTypes, idSourceTypes ) :
new PerTableCacheManager( configUrl, platform, entityTypes, associationTypes, idSourceTypes );
return new PersistenceStrategy<PersistentEntityKey, PersistentAssociationKey, PersistentIdSourceKey>( cacheManager, keyProvider );
} | java | private static PersistenceStrategy<?, ?, ?> getPerTableStrategy(
EmbeddedCacheManager externalCacheManager,
URL configUrl,
JtaPlatform platform,
Set<EntityKeyMetadata> entityTypes,
Set<AssociationKeyMetadata> associationTypes,
Set<IdSourceKeyMetadata> idSourceTypes) {
PerTableKeyProvider keyProvider = new PerTableKeyProvider();
PerTableCacheManager cacheManager = externalCacheManager != null ?
new PerTableCacheManager( externalCacheManager, entityTypes, associationTypes, idSourceTypes ) :
new PerTableCacheManager( configUrl, platform, entityTypes, associationTypes, idSourceTypes );
return new PersistenceStrategy<PersistentEntityKey, PersistentAssociationKey, PersistentIdSourceKey>( cacheManager, keyProvider );
} | [
"private",
"static",
"PersistenceStrategy",
"<",
"?",
",",
"?",
",",
"?",
">",
"getPerTableStrategy",
"(",
"EmbeddedCacheManager",
"externalCacheManager",
",",
"URL",
"configUrl",
",",
"JtaPlatform",
"platform",
",",
"Set",
"<",
"EntityKeyMetadata",
">",
"entityType... | Returns the "per-table" persistence strategy, i.e. one dedicated cache will be used for each
entity/association/id source table. | [
"Returns",
"the",
"per",
"-",
"table",
"persistence",
"strategy",
"i",
".",
"e",
".",
"one",
"dedicated",
"cache",
"will",
"be",
"used",
"for",
"each",
"entity",
"/",
"association",
"/",
"id",
"source",
"table",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/PersistenceStrategy.java#L107-L122 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java | BusItinerary.getNearestBusHalt | @Pure
public final BusItineraryHalt getNearestBusHalt(Point2D<?, ?> point) {
return getNearestBusHalt(point.getX(), point.getY());
} | java | @Pure
public final BusItineraryHalt getNearestBusHalt(Point2D<?, ?> point) {
return getNearestBusHalt(point.getX(), point.getY());
} | [
"@",
"Pure",
"public",
"final",
"BusItineraryHalt",
"getNearestBusHalt",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"return",
"getNearestBusHalt",
"(",
"point",
".",
"getX",
"(",
")",
",",
"point",
".",
"getY",
"(",
")",
")",
";",
"}"
... | Replies the nearest bus halt to the given point.
@param point the point.
@return the nearest bus halt or <code>null</code> if none was found. | [
"Replies",
"the",
"nearest",
"bus",
"halt",
"to",
"the",
"given",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1006-L1009 |
craftercms/core | src/main/java/org/craftercms/core/cache/impl/CacheImpl.java | CacheImpl.checkForRefresh | protected boolean checkForRefresh(CacheItem item, List<CacheItem> itemsToRefresh) {
if (item.getLoader() != null && item.needsRefresh(ticks.get())) {
itemsToRefresh.add(item);
return true;
} else {
return false;
}
} | java | protected boolean checkForRefresh(CacheItem item, List<CacheItem> itemsToRefresh) {
if (item.getLoader() != null && item.needsRefresh(ticks.get())) {
itemsToRefresh.add(item);
return true;
} else {
return false;
}
} | [
"protected",
"boolean",
"checkForRefresh",
"(",
"CacheItem",
"item",
",",
"List",
"<",
"CacheItem",
">",
"itemsToRefresh",
")",
"{",
"if",
"(",
"item",
".",
"getLoader",
"(",
")",
"!=",
"null",
"&&",
"item",
".",
"needsRefresh",
"(",
"ticks",
".",
"get",
... | Checks if a given {@link CacheItem} needs to be refreshed. If so, then it is added to the listen of items to
refresh.
@param item
@param itemsToRefresh the list of items where to put the specified item if it needs to be refreshed
@return true if the item will be refreshed, false otherwise | [
"Checks",
"if",
"a",
"given",
"{",
"@link",
"CacheItem",
"}",
"needs",
"to",
"be",
"refreshed",
".",
"If",
"so",
"then",
"it",
"is",
"added",
"to",
"the",
"listen",
"of",
"items",
"to",
"refresh",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/cache/impl/CacheImpl.java#L400-L408 |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java | StreamSourceProcessor.sendEndEvaluationInstance | public void sendEndEvaluationInstance(Stream inputStream) {
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(-1, firstInstance,false, true);
inputStream.put(instanceContentEvent);
} | java | public void sendEndEvaluationInstance(Stream inputStream) {
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(-1, firstInstance,false, true);
inputStream.put(instanceContentEvent);
} | [
"public",
"void",
"sendEndEvaluationInstance",
"(",
"Stream",
"inputStream",
")",
"{",
"InstanceContentEvent",
"instanceContentEvent",
"=",
"new",
"InstanceContentEvent",
"(",
"-",
"1",
",",
"firstInstance",
",",
"false",
",",
"true",
")",
";",
"inputStream",
".",
... | Send end evaluation instance.
@param inputStream the input stream | [
"Send",
"end",
"evaluation",
"instance",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java#L110-L113 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java | IndexForHeaderIndexFile.setLargestKey | public void setLargestKey(int chunkIdx, byte[] largestKeyInChunk) {
maxKeyPerChunk[chunkIdx] = largestKeyInChunk;
filledUpTo = Math.max(filledUpTo, chunkIdx);
indexBuffer.position(chunkIdx * keySize);
indexBuffer.put(largestKeyInChunk);
} | java | public void setLargestKey(int chunkIdx, byte[] largestKeyInChunk) {
maxKeyPerChunk[chunkIdx] = largestKeyInChunk;
filledUpTo = Math.max(filledUpTo, chunkIdx);
indexBuffer.position(chunkIdx * keySize);
indexBuffer.put(largestKeyInChunk);
} | [
"public",
"void",
"setLargestKey",
"(",
"int",
"chunkIdx",
",",
"byte",
"[",
"]",
"largestKeyInChunk",
")",
"{",
"maxKeyPerChunk",
"[",
"chunkIdx",
"]",
"=",
"largestKeyInChunk",
";",
"filledUpTo",
"=",
"Math",
".",
"max",
"(",
"filledUpTo",
",",
"chunkIdx",
... | Sets a new largest key in the chunk with the given index.
@param chunkIdx
@param largestKeyInChunk | [
"Sets",
"a",
"new",
"largest",
"key",
"in",
"the",
"chunk",
"with",
"the",
"given",
"index",
"."
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/file/IndexForHeaderIndexFile.java#L167-L172 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotGetOptionalUnsafe | public static <T> Optional<T> dotGetOptionalUnsafe(
final Map map, final String pathString, final Class<T> clazz
) {
return dotGetUnsafe(map, Optional.class, pathString);
} | java | public static <T> Optional<T> dotGetOptionalUnsafe(
final Map map, final String pathString, final Class<T> clazz
) {
return dotGetUnsafe(map, Optional.class, pathString);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"dotGetOptionalUnsafe",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"dotGetUnsafe",
"(",
"map",
",",
... | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param pathString nodes to walk in map
@return value | [
"Get",
"optional",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L268-L272 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/TypeConversion.java | TypeConversion.selfConvert | private static Object selfConvert( String parsingMethod, String value, Class<?> type )
{
try
{
Method method = type.getMethod( parsingMethod, String.class );
return method.invoke( null, value );
}
catch (InvocationTargetException e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e.getCause() );
}
catch (Exception e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e );
}
} | java | private static Object selfConvert( String parsingMethod, String value, Class<?> type )
{
try
{
Method method = type.getMethod( parsingMethod, String.class );
return method.invoke( null, value );
}
catch (InvocationTargetException e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e.getCause() );
}
catch (Exception e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e );
}
} | [
"private",
"static",
"Object",
"selfConvert",
"(",
"String",
"parsingMethod",
",",
"String",
"value",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"try",
"{",
"Method",
"method",
"=",
"type",
".",
"getMethod",
"(",
"parsingMethod",
",",
"String",
".",
... | SelfConversion implies that if a class has the given static method named
that receive a String and that returns a instance of the
class, then it can serve for conversion purpose. | [
"SelfConversion",
"implies",
"that",
"if",
"a",
"class",
"has",
"the",
"given",
"static",
"method",
"named",
"that",
"receive",
"a",
"String",
"and",
"that",
"returns",
"a",
"instance",
"of",
"the",
"class",
"then",
"it",
"can",
"serve",
"for",
"conversion",... | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/TypeConversion.java#L152-L167 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java | GroovyScript2RestLoader.setAttributeSmart | protected void setAttributeSmart(Element element, String attr, String value)
{
if (value == null)
{
element.removeAttribute(attr);
}
else
{
element.setAttribute(attr, value);
}
} | java | protected void setAttributeSmart(Element element, String attr, String value)
{
if (value == null)
{
element.removeAttribute(attr);
}
else
{
element.setAttribute(attr, value);
}
} | [
"protected",
"void",
"setAttributeSmart",
"(",
"Element",
"element",
",",
"String",
"attr",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"element",
".",
"removeAttribute",
"(",
"attr",
")",
";",
"}",
"else",
"{",
"element... | Set attribute value. If value is null the attribute will be removed.
@param element The element to set attribute value
@param attr The attribute name
@param value The value of attribute | [
"Set",
"attribute",
"value",
".",
"If",
"value",
"is",
"null",
"the",
"attribute",
"will",
"be",
"removed",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L681-L691 |
cloudfoundry/cf-java-client | cloudfoundry-util/src/main/java/org/cloudfoundry/util/FileUtils.java | FileUtils.getRelativePathName | public static String getRelativePathName(Path root, Path path) {
Path relative = root.relativize(path);
return Files.isDirectory(path) && !relative.toString().endsWith("/") ? String.format("%s/", relative.toString()) : relative.toString();
} | java | public static String getRelativePathName(Path root, Path path) {
Path relative = root.relativize(path);
return Files.isDirectory(path) && !relative.toString().endsWith("/") ? String.format("%s/", relative.toString()) : relative.toString();
} | [
"public",
"static",
"String",
"getRelativePathName",
"(",
"Path",
"root",
",",
"Path",
"path",
")",
"{",
"Path",
"relative",
"=",
"root",
".",
"relativize",
"(",
"path",
")",
";",
"return",
"Files",
".",
"isDirectory",
"(",
"path",
")",
"&&",
"!",
"relat... | Get the relative path of an application
@param root the root to relativize against
@param path the path to relativize
@return the relative path | [
"Get",
"the",
"relative",
"path",
"of",
"an",
"application"
] | train | https://github.com/cloudfoundry/cf-java-client/blob/caa1cb889cfe8717614c071703d833a1540784df/cloudfoundry-util/src/main/java/org/cloudfoundry/util/FileUtils.java#L108-L111 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java | AbstractExtraLanguageValidator.createFeatureNameConverterInstance | protected ExtraLanguageFeatureNameConverter createFeatureNameConverterInstance(
IExtraLanguageConversionInitializer initializer,
IExtraLanguageGeneratorContext context) {
return new ExtraLanguageFeatureNameConverter(initializer, context, getExtraLanguageKeywordProvider());
} | java | protected ExtraLanguageFeatureNameConverter createFeatureNameConverterInstance(
IExtraLanguageConversionInitializer initializer,
IExtraLanguageGeneratorContext context) {
return new ExtraLanguageFeatureNameConverter(initializer, context, getExtraLanguageKeywordProvider());
} | [
"protected",
"ExtraLanguageFeatureNameConverter",
"createFeatureNameConverterInstance",
"(",
"IExtraLanguageConversionInitializer",
"initializer",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"return",
"new",
"ExtraLanguageFeatureNameConverter",
"(",
"initializer",
","... | Create the instance of the feature name converter.
@param initializer the converter initializer.
@param context the generation context.
@return the feature name converter. | [
"Create",
"the",
"instance",
"of",
"the",
"feature",
"name",
"converter",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/AbstractExtraLanguageValidator.java#L377-L381 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/DurationFunction.java | DurationFunction.invoke | public FEELFnResult<TemporalAmount> invoke(@ParameterName( "from" ) TemporalAmount val) {
if ( val == null ) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "cannot be null"));
}
return FEELFnResult.ofResult( val );
} | java | public FEELFnResult<TemporalAmount> invoke(@ParameterName( "from" ) TemporalAmount val) {
if ( val == null ) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "from", "cannot be null"));
}
return FEELFnResult.ofResult( val );
} | [
"public",
"FEELFnResult",
"<",
"TemporalAmount",
">",
"invoke",
"(",
"@",
"ParameterName",
"(",
"\"from\"",
")",
"TemporalAmount",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"FEELFnResult",
".",
"ofError",
"(",
"new",
"InvalidParame... | This is the identity function implementation
@param val
@return | [
"This",
"is",
"the",
"identity",
"function",
"implementation"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/runtime/functions/DurationFunction.java#L67-L72 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Member.java | Member.getTotalToDo | public Double getTotalToDo(WorkitemFilter filter) {
filter = (filter != null) ? filter : new WorkitemFilter();
return getSum("OwnedWorkitems", filter, "ToDo");
} | java | public Double getTotalToDo(WorkitemFilter filter) {
filter = (filter != null) ? filter : new WorkitemFilter();
return getSum("OwnedWorkitems", filter, "ToDo");
} | [
"public",
"Double",
"getTotalToDo",
"(",
"WorkitemFilter",
"filter",
")",
"{",
"filter",
"=",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"WorkitemFilter",
"(",
")",
";",
"return",
"getSum",
"(",
"\"OwnedWorkitems\"",
",",
"filter",
",",
"... | Return the total to do for all workitems owned by this member optionally
filtered.
@param filter Criteria to filter workitems on.
@return total to do of selected Workitems. | [
"Return",
"the",
"total",
"to",
"do",
"for",
"all",
"workitems",
"owned",
"by",
"this",
"member",
"optionally",
"filtered",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Member.java#L309-L313 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibTag.java | TagLibTag.setTDBTClassDefinition | public void setTDBTClassDefinition(String tdbtClass, Identification id, Attributes attr) {
this.tdbtCD = ClassDefinitionImpl.toClassDefinition(tdbtClass, id, attr);
this.tdbt = null;
} | java | public void setTDBTClassDefinition(String tdbtClass, Identification id, Attributes attr) {
this.tdbtCD = ClassDefinitionImpl.toClassDefinition(tdbtClass, id, attr);
this.tdbt = null;
} | [
"public",
"void",
"setTDBTClassDefinition",
"(",
"String",
"tdbtClass",
",",
"Identification",
"id",
",",
"Attributes",
"attr",
")",
"{",
"this",
".",
"tdbtCD",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"tdbtClass",
",",
"id",
",",
"attr",
")",
... | Setzt die implementierende Klassendefinition des TagDependentBodyTransformer. Diese Methode wird
durch die Klasse TagLibFactory verwendet.
@param tdbtClass Klassendefinition der TagDependentBodyTransformer-Implementation. | [
"Setzt",
"die",
"implementierende",
"Klassendefinition",
"des",
"TagDependentBodyTransformer",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibTag.java#L609-L612 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateIssuer | public IssuerBundle updateCertificateIssuer(String vaultBaseUrl, String issuerName) {
return updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body();
} | java | public IssuerBundle updateCertificateIssuer(String vaultBaseUrl, String issuerName) {
return updateCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).toBlocking().single().body();
} | [
"public",
"IssuerBundle",
"updateCertificateIssuer",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
")",
"{",
"return",
"updateCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName",
")",
".",
"toBlocking",
"(",
")",
".",
"single... | Updates the specified certificate issuer.
The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the IssuerBundle object if successful. | [
"Updates",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"UpdateCertificateIssuer",
"operation",
"performs",
"an",
"update",
"on",
"the",
"specified",
"certificate",
"issuer",
"entity",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"se... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6110-L6112 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.decode | public static String decode(String content, Charset charset) {
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return decode(content, charset.name());
} | java | public static String decode(String content, Charset charset) {
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return decode(content, charset.name());
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"content",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"null",
"==",
"charset",
")",
"{",
"charset",
"=",
"CharsetUtil",
".",
"defaultCharset",
"(",
")",
";",
"}",
"return",
"decode",
"(",
"conte... | 解码application/x-www-form-urlencoded字符
@param content 被解码内容
@param charset 编码
@return 编码后的字符
@since 4.4.1 | [
"解码application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded字符"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L357-L362 |
UrielCh/ovh-java-sdk | ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java | ApiOvhDeskaas.serviceName_upgrade_POST | public OvhTask serviceName_upgrade_POST(String serviceName, String newReference, String planCode) throws IOException {
String qPath = "/deskaas/{serviceName}/upgrade";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "newReference", newReference);
addBody(o, "planCode", planCode);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_upgrade_POST(String serviceName, String newReference, String planCode) throws IOException {
String qPath = "/deskaas/{serviceName}/upgrade";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "newReference", newReference);
addBody(o, "planCode", planCode);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_upgrade_POST",
"(",
"String",
"serviceName",
",",
"String",
"newReference",
",",
"String",
"planCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/deskaas/{serviceName}/upgrade\"",
";",
"StringBuilder",
"sb",
"=",
"... | Upgrading the Desktop As A Service to another profile. The Virtual Desktop will not be available during upgrade and has to be restarted. You cannot downgrade a Virtual Desktop
REST: POST /deskaas/{serviceName}/upgrade
@param planCode [required] New plan of Desktop As A Service
@param newReference [required] New reference of Desktop As A Service
@param serviceName [required] Domain of the service | [
"Upgrading",
"the",
"Desktop",
"As",
"A",
"Service",
"to",
"another",
"profile",
".",
"The",
"Virtual",
"Desktop",
"will",
"not",
"be",
"available",
"during",
"upgrade",
"and",
"has",
"to",
"be",
"restarted",
".",
"You",
"cannot",
"downgrade",
"a",
"Virtual"... | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java#L124-L132 |
tobato/FastDFS_Client | src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java | BytesUtil.buff2long | public static long buff2long(byte[] bs, int offset) {
return (((long) (bs[offset] >= 0 ? bs[offset] : 256 + bs[offset])) << 56)
| (((long) (bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1])) << 48)
| (((long) (bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2])) << 40)
| (((long) (bs[offset + 3] >= 0 ? bs[offset + 3] : 256 + bs[offset + 3])) << 32)
| (((long) (bs[offset + 4] >= 0 ? bs[offset + 4] : 256 + bs[offset + 4])) << 24)
| (((long) (bs[offset + 5] >= 0 ? bs[offset + 5] : 256 + bs[offset + 5])) << 16)
| (((long) (bs[offset + 6] >= 0 ? bs[offset + 6] : 256 + bs[offset + 6])) << 8)
| (bs[offset + 7] >= 0 ? bs[offset + 7] : 256 + bs[offset + 7]);
} | java | public static long buff2long(byte[] bs, int offset) {
return (((long) (bs[offset] >= 0 ? bs[offset] : 256 + bs[offset])) << 56)
| (((long) (bs[offset + 1] >= 0 ? bs[offset + 1] : 256 + bs[offset + 1])) << 48)
| (((long) (bs[offset + 2] >= 0 ? bs[offset + 2] : 256 + bs[offset + 2])) << 40)
| (((long) (bs[offset + 3] >= 0 ? bs[offset + 3] : 256 + bs[offset + 3])) << 32)
| (((long) (bs[offset + 4] >= 0 ? bs[offset + 4] : 256 + bs[offset + 4])) << 24)
| (((long) (bs[offset + 5] >= 0 ? bs[offset + 5] : 256 + bs[offset + 5])) << 16)
| (((long) (bs[offset + 6] >= 0 ? bs[offset + 6] : 256 + bs[offset + 6])) << 8)
| (bs[offset + 7] >= 0 ? bs[offset + 7] : 256 + bs[offset + 7]);
} | [
"public",
"static",
"long",
"buff2long",
"(",
"byte",
"[",
"]",
"bs",
",",
"int",
"offset",
")",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"(",
"bs",
"[",
"offset",
"]",
">=",
"0",
"?",
"bs",
"[",
"offset",
"]",
":",
"256",
"+",
"bs",
"[",
"... | buff convert to long
@param bs the buffer (big-endian)
@param offset the start position based 0
@return long number | [
"buff",
"convert",
"to",
"long"
] | train | https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/BytesUtil.java#L42-L51 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java | Security.setProperty | public static void setProperty(String key, String datum) {
check("setProperty."+key);
props.put(key, datum);
increaseVersion();
invalidateSMCache(key); /* See below. */
} | java | public static void setProperty(String key, String datum) {
check("setProperty."+key);
props.put(key, datum);
increaseVersion();
invalidateSMCache(key); /* See below. */
} | [
"public",
"static",
"void",
"setProperty",
"(",
"String",
"key",
",",
"String",
"datum",
")",
"{",
"check",
"(",
"\"setProperty.\"",
"+",
"key",
")",
";",
"props",
".",
"put",
"(",
"key",
",",
"datum",
")",
";",
"increaseVersion",
"(",
")",
";",
"inval... | Sets a security property value.
<p>First, if there is a security manager, its
<code>checkPermission</code> method is called with a
<code>java.security.SecurityPermission("setProperty."+key)</code>
permission to see if it's ok to set the specified
security property value.
@param key the name of the property to be set.
@param datum the value of the property to be set.
@throws SecurityException
if a security manager exists and its <code>{@link
java.lang.SecurityManager#checkPermission}</code> method
denies access to set the specified security property value
@throws NullPointerException if key or datum is null
@see #getProperty
@see java.security.SecurityPermission | [
"Sets",
"a",
"security",
"property",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java#L670-L675 |
google/closure-compiler | src/com/google/javascript/jscomp/Strings.java | Strings.truncateAtMaxLength | static String truncateAtMaxLength(String source, int maxLength,
boolean addEllipsis) {
if (source.length() <= maxLength) {
return source;
}
if (addEllipsis && maxLength > 3) {
return unicodePreservingSubstring(source, 0, maxLength - 3) + "...";
}
return unicodePreservingSubstring(source, 0, maxLength);
} | java | static String truncateAtMaxLength(String source, int maxLength,
boolean addEllipsis) {
if (source.length() <= maxLength) {
return source;
}
if (addEllipsis && maxLength > 3) {
return unicodePreservingSubstring(source, 0, maxLength - 3) + "...";
}
return unicodePreservingSubstring(source, 0, maxLength);
} | [
"static",
"String",
"truncateAtMaxLength",
"(",
"String",
"source",
",",
"int",
"maxLength",
",",
"boolean",
"addEllipsis",
")",
"{",
"if",
"(",
"source",
".",
"length",
"(",
")",
"<=",
"maxLength",
")",
"{",
"return",
"source",
";",
"}",
"if",
"(",
"add... | If this given string is of length {@code maxLength} or less, it will
be returned as-is.
Otherwise, it will be truncated to {@code maxLength}, regardless of whether
there are any space characters in the String. If an ellipsis is requested
to be appended to the truncated String, the String will be truncated so
that the ellipsis will also fit within maxLength.
If no truncation was necessary, no ellipsis will be added.
@param source the String to truncate if necessary
@param maxLength the maximum number of characters to keep
@param addEllipsis if true, and if the String had to be truncated,
add "..." to the end of the String before returning. Additionally,
the ellipsis will only be added if maxLength is greater than 3.
@return the original string if it's length is less than or equal to
maxLength, otherwise a truncated string as mentioned above | [
"If",
"this",
"given",
"string",
"is",
"of",
"length",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Strings.java#L45-L55 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java | GeoJsonReaderDriver.parseGeometryCollection | private GeometryCollection parseGeometryCollection(JsonParser jp) throws IOException, SQLException {
jp.nextToken(); // FIELD_NAME geometries
String coordinatesField = jp.getText();
if (coordinatesField.equalsIgnoreCase(GeoJsonField.GEOMETRIES)) {
jp.nextToken();//START array
jp.nextToken();//START object
ArrayList<Geometry> geometries = new ArrayList<Geometry>();
while (jp.getCurrentToken() != JsonToken.END_ARRAY) {
jp.nextToken(); // FIELD_NAME type
jp.nextToken(); //VALUE_STRING Point
String geometryType = jp.getText();
geometries.add(parseGeometry(jp, geometryType));
jp.nextToken();
}
jp.nextToken();//END_OBJECT } geometry
return GF.createGeometryCollection(geometries.toArray(new Geometry[0]));
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'geometries', found '" + coordinatesField + "'");
}
} | java | private GeometryCollection parseGeometryCollection(JsonParser jp) throws IOException, SQLException {
jp.nextToken(); // FIELD_NAME geometries
String coordinatesField = jp.getText();
if (coordinatesField.equalsIgnoreCase(GeoJsonField.GEOMETRIES)) {
jp.nextToken();//START array
jp.nextToken();//START object
ArrayList<Geometry> geometries = new ArrayList<Geometry>();
while (jp.getCurrentToken() != JsonToken.END_ARRAY) {
jp.nextToken(); // FIELD_NAME type
jp.nextToken(); //VALUE_STRING Point
String geometryType = jp.getText();
geometries.add(parseGeometry(jp, geometryType));
jp.nextToken();
}
jp.nextToken();//END_OBJECT } geometry
return GF.createGeometryCollection(geometries.toArray(new Geometry[0]));
} else {
throw new SQLException("Malformed GeoJSON file. Expected 'geometries', found '" + coordinatesField + "'");
}
} | [
"private",
"GeometryCollection",
"parseGeometryCollection",
"(",
"JsonParser",
"jp",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"jp",
".",
"nextToken",
"(",
")",
";",
"// FIELD_NAME geometries ",
"String",
"coordinatesField",
"=",
"jp",
".",
"getTe... | Each element in the geometries array of a GeometryCollection is one of
the geometry objects described above:
{ "type": "GeometryCollection", "geometries": [ { "type": "Point",
"coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [
[101.0, 0.0], [102.0, 1.0] ] } ]
@param jp
@throws IOException
@throws SQLException
@return GeometryCollection | [
"Each",
"element",
"in",
"the",
"geometries",
"array",
"of",
"a",
"GeometryCollection",
"is",
"one",
"of",
"the",
"geometry",
"objects",
"described",
"above",
":"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java#L1164-L1184 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java | SwapAnnuity.getSwapAnnuity | public static RandomVariable getSwapAnnuity(TimeDiscretization tenor, ForwardCurveInterface forwardCurve) {
return getSwapAnnuity(new RegularSchedule(tenor), forwardCurve);
} | java | public static RandomVariable getSwapAnnuity(TimeDiscretization tenor, ForwardCurveInterface forwardCurve) {
return getSwapAnnuity(new RegularSchedule(tenor), forwardCurve);
} | [
"public",
"static",
"RandomVariable",
"getSwapAnnuity",
"(",
"TimeDiscretization",
"tenor",
",",
"ForwardCurveInterface",
"forwardCurve",
")",
"{",
"return",
"getSwapAnnuity",
"(",
"new",
"RegularSchedule",
"(",
"tenor",
")",
",",
"forwardCurve",
")",
";",
"}"
] | Function to calculate an (idealized) single curve swap annuity for a given schedule and forward curve.
The discount curve used to calculate the annuity is calculated from the forward curve using classical
single curve interpretations of forwards and a default period length. The may be a crude approximation.
@param tenor The schedule discretization, i.e., the period start and end dates. End dates are considered payment dates and start of the next period.
@param forwardCurve The forward curve.
@return The swap annuity. | [
"Function",
"to",
"calculate",
"an",
"(",
"idealized",
")",
"single",
"curve",
"swap",
"annuity",
"for",
"a",
"given",
"schedule",
"and",
"forward",
"curve",
".",
"The",
"discount",
"curve",
"used",
"to",
"calculate",
"the",
"annuity",
"is",
"calculated",
"f... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/products/SwapAnnuity.java#L72-L74 |
Coveros/selenified | src/main/java/com/coveros/selenified/element/Element.java | Element.cantScroll | private void cantScroll(Exception e, String action, String expected) {
log.warn(e);
reporter.fail(action, expected, CANT_SCROLL + prettyOutputEnd() + e.getMessage());
} | java | private void cantScroll(Exception e, String action, String expected) {
log.warn(e);
reporter.fail(action, expected, CANT_SCROLL + prettyOutputEnd() + e.getMessage());
} | [
"private",
"void",
"cantScroll",
"(",
"Exception",
"e",
",",
"String",
"action",
",",
"String",
"expected",
")",
"{",
"log",
".",
"warn",
"(",
"e",
")",
";",
"reporter",
".",
"fail",
"(",
"action",
",",
"expected",
",",
"CANT_SCROLL",
"+",
"prettyOutputE... | Generates and logs an error (with a screenshot), stating that the element
was unable to be scrolled to
@param e - the exception that was thrown
@param action - what is the action occurring
@param expected - what is the expected outcome of said action | [
"Generates",
"and",
"logs",
"an",
"error",
"(",
"with",
"a",
"screenshot",
")",
"stating",
"that",
"the",
"element",
"was",
"unable",
"to",
"be",
"scrolled",
"to"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L1100-L1103 |
unbescape/unbescape | src/main/java/org/unbescape/html/HtmlEscape.java | HtmlEscape.escapeHtml4Xml | public static void escapeHtml4Xml(final String text, final Writer writer)
throws IOException {
escapeHtml(text, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | java | public static void escapeHtml4Xml(final String text, final Writer writer)
throws IOException {
escapeHtml(text, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeHtml4Xml",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeHtml",
"(",
"text",
",",
"writer",
",",
"HtmlEscapeType",
".",
"HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL",
",",... | <p>
Perform an HTML 4 level 1 (XML-style) <strong>escape</strong> operation on a <tt>String</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>. It is called
<em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's
<tt><c:out ... /></tt> tags.
</p>
<p>
Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml5Xml(String, Writer)} because
it will escape the apostrophe as <tt>&#39;</tt>, whereas in HTML5 there is a specific NCR for
such character (<tt>&apos;</tt>).
</p>
<p>
This method calls {@link #escapeHtml(String, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li>
<li><tt>level</tt>:
{@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"HTML",
"4",
"level",
"1",
"(",
"XML",
"-",
"style",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L539-L543 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getMapInfo | public void getMapInfo(int[] ids, Callback<List<MapOverview>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getMapInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getMapInfo(int[] ids, Callback<List<MapOverview>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getMapInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getMapInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"MapOverview",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",... | For more info on map API go <a href="https://wiki.guildwars2.com/wiki/API:2/mailcarriers">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 map id
@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
@see MapOverview map info | [
"For",
"more",
"info",
"on",
"map",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"mailcarriers",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1805-L1808 |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java | Asn1Utils.encodeGeneralizedTime | public static int encodeGeneralizedTime(Date date, ByteBuffer buf) {
if (date == null) {
throw new IllegalArgumentException();
}
int pos = buf.position();
SimpleDateFormat format = new SimpleDateFormat(GENERALIZED_TIME_FORMAT);
format.setTimeZone(TimeZone.getTimeZone("GMT")); // always use UTC
String value = format.format(date);
byte[] data = value.getBytes();
for (int i = data.length - 1; i >= 0; i--) {
pos--;
buf.put(pos, data[i]);
}
buf.position(buf.position() - data.length);
int headerLength = DerUtils.encodeIdAndLength(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE,
ASN1_GENERALIZED_TIME_TAG_NUM, data.length, buf);
return headerLength + data.length;
} | java | public static int encodeGeneralizedTime(Date date, ByteBuffer buf) {
if (date == null) {
throw new IllegalArgumentException();
}
int pos = buf.position();
SimpleDateFormat format = new SimpleDateFormat(GENERALIZED_TIME_FORMAT);
format.setTimeZone(TimeZone.getTimeZone("GMT")); // always use UTC
String value = format.format(date);
byte[] data = value.getBytes();
for (int i = data.length - 1; i >= 0; i--) {
pos--;
buf.put(pos, data[i]);
}
buf.position(buf.position() - data.length);
int headerLength = DerUtils.encodeIdAndLength(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE,
ASN1_GENERALIZED_TIME_TAG_NUM, data.length, buf);
return headerLength + data.length;
} | [
"public",
"static",
"int",
"encodeGeneralizedTime",
"(",
"Date",
"date",
",",
"ByteBuffer",
"buf",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"int",
"pos",
"=",
"buf",
".",
"positi... | Encode an ASN.1 GeneralizedTime.
@param date
the date value
@param buf
the buffer with space to the left of current position where the value will be encoded
@return the length of the encoded data | [
"Encode",
"an",
"ASN",
".",
"1",
"GeneralizedTime",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L279-L297 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java | RepositoryResourceImpl.copyFieldsFrom | protected void copyFieldsFrom(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) {
setName(fromResource.getName()); // part of the identification so locked
setDescription(fromResource.getDescription());
setShortDescription(fromResource.getShortDescription());
setProviderName(fromResource.getProviderName()); // part of the identification so locked
setProviderUrl(fromResource.getProviderUrl());
setVersion(fromResource.getVersion());
setDownloadPolicy(fromResource.getDownloadPolicy());
setLicenseId(fromResource.getLicenseId());
setLicenseType(fromResource.getLicenseType());
setMainAttachmentSize(fromResource.getMainAttachmentSize());
setMainAttachmentSHA256(fromResource.getMainAttachmentSHA256());
setFeaturedWeight(fromResource.getFeaturedWeight());
setDisplayPolicy(fromResource.getDisplayPolicy());
setVanityURL(fromResource.getVanityURL());
setWlpInformationVersion(fromResource.getWlpInformationVersion());
setMavenCoordinates(fromResource.getMavenCoordinates());
if (includeAttachmentInfo) {
setMainAttachmentSize(fromResource.getMainAttachmentSize());
}
_asset.getWlpInformation().setAppliesToFilterInfo(fromResource.getAsset().getWlpInformation().getAppliesToFilterInfo());
} | java | protected void copyFieldsFrom(RepositoryResourceImpl fromResource, boolean includeAttachmentInfo) {
setName(fromResource.getName()); // part of the identification so locked
setDescription(fromResource.getDescription());
setShortDescription(fromResource.getShortDescription());
setProviderName(fromResource.getProviderName()); // part of the identification so locked
setProviderUrl(fromResource.getProviderUrl());
setVersion(fromResource.getVersion());
setDownloadPolicy(fromResource.getDownloadPolicy());
setLicenseId(fromResource.getLicenseId());
setLicenseType(fromResource.getLicenseType());
setMainAttachmentSize(fromResource.getMainAttachmentSize());
setMainAttachmentSHA256(fromResource.getMainAttachmentSHA256());
setFeaturedWeight(fromResource.getFeaturedWeight());
setDisplayPolicy(fromResource.getDisplayPolicy());
setVanityURL(fromResource.getVanityURL());
setWlpInformationVersion(fromResource.getWlpInformationVersion());
setMavenCoordinates(fromResource.getMavenCoordinates());
if (includeAttachmentInfo) {
setMainAttachmentSize(fromResource.getMainAttachmentSize());
}
_asset.getWlpInformation().setAppliesToFilterInfo(fromResource.getAsset().getWlpInformation().getAppliesToFilterInfo());
} | [
"protected",
"void",
"copyFieldsFrom",
"(",
"RepositoryResourceImpl",
"fromResource",
",",
"boolean",
"includeAttachmentInfo",
")",
"{",
"setName",
"(",
"fromResource",
".",
"getName",
"(",
")",
")",
";",
"// part of the identification so locked",
"setDescription",
"(",
... | Resources should override this method to copy fields that should be used as part of an
update
@param fromResource | [
"Resources",
"should",
"override",
"this",
"method",
"to",
"copy",
"fields",
"that",
"should",
"be",
"used",
"as",
"part",
"of",
"an",
"update"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L1053-L1075 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java | SelectionPageGenerator.displaySelectionPage | public void displaySelectionPage(HttpServletRequest request, HttpServletResponse response, SocialTaiRequest socialTaiRequest) throws IOException {
setRequestAndConfigInformation(request, response, socialTaiRequest);
if (selectableConfigs == null || selectableConfigs.isEmpty()) {
sendDisplayError(response, "SIGN_IN_NO_CONFIGS", new Object[0]);
return;
}
generateOrSendToAppropriateSelectionPage(response);
} | java | public void displaySelectionPage(HttpServletRequest request, HttpServletResponse response, SocialTaiRequest socialTaiRequest) throws IOException {
setRequestAndConfigInformation(request, response, socialTaiRequest);
if (selectableConfigs == null || selectableConfigs.isEmpty()) {
sendDisplayError(response, "SIGN_IN_NO_CONFIGS", new Object[0]);
return;
}
generateOrSendToAppropriateSelectionPage(response);
} | [
"public",
"void",
"displaySelectionPage",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"SocialTaiRequest",
"socialTaiRequest",
")",
"throws",
"IOException",
"{",
"setRequestAndConfigInformation",
"(",
"request",
",",
"response",
",",
... | Generates the sign in page to allow a user to select from the configured social login services. If no services are
configured, the user is redirected to an error page.
@param request
@param response
@param socialTaiRequest
@throws IOException | [
"Generates",
"the",
"sign",
"in",
"page",
"to",
"allow",
"a",
"user",
"to",
"select",
"from",
"the",
"configured",
"social",
"login",
"services",
".",
"If",
"no",
"services",
"are",
"configured",
"the",
"user",
"is",
"redirected",
"to",
"an",
"error",
"pag... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/web/SelectionPageGenerator.java#L89-L96 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/NetworkLocationIgnorer.java | NetworkLocationIgnorer.shouldIgnore | public boolean shouldIgnore(final String pProvider, final long pTime) {
if (LocationManager.GPS_PROVIDER.equals(pProvider)) {
mLastGps = pTime;
} else {
if (pTime < mLastGps + Configuration.getInstance().getGpsWaitTime()) {
return true;
}
}
return false;
} | java | public boolean shouldIgnore(final String pProvider, final long pTime) {
if (LocationManager.GPS_PROVIDER.equals(pProvider)) {
mLastGps = pTime;
} else {
if (pTime < mLastGps + Configuration.getInstance().getGpsWaitTime()) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"shouldIgnore",
"(",
"final",
"String",
"pProvider",
",",
"final",
"long",
"pTime",
")",
"{",
"if",
"(",
"LocationManager",
".",
"GPS_PROVIDER",
".",
"equals",
"(",
"pProvider",
")",
")",
"{",
"mLastGps",
"=",
"pTime",
";",
"}",
"else"... | Whether we should ignore this location.
@param pProvider
the provider that provided the location
@param pTime
the time of the location
@return true if we should ignore this location, false if not | [
"Whether",
"we",
"should",
"ignore",
"this",
"location",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/NetworkLocationIgnorer.java#L30-L41 |
mongodb/stitch-android-sdk | android/examples/todo/src/main/java/com/mongodb/stitch/android/examples/todo/TodoAdapter.java | TodoAdapter.onBindViewHolder | @Override
public void onBindViewHolder(@NonNull final TodoItemViewHolder holder, final int position) {
final TodoItem item = todoItems.get(position);
holder.taskTextView.setText(item.getTask());
holder.taskCheckbox.setChecked(item.getChecked());
} | java | @Override
public void onBindViewHolder(@NonNull final TodoItemViewHolder holder, final int position) {
final TodoItem item = todoItems.get(position);
holder.taskTextView.setText(item.getTask());
holder.taskCheckbox.setChecked(item.getChecked());
} | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"@",
"NonNull",
"final",
"TodoItemViewHolder",
"holder",
",",
"final",
"int",
"position",
")",
"{",
"final",
"TodoItem",
"item",
"=",
"todoItems",
".",
"get",
"(",
"position",
")",
";",
"holder",
".... | Replace the contents of a view (invoked by the layout manager) | [
"Replace",
"the",
"contents",
"of",
"a",
"view",
"(",
"invoked",
"by",
"the",
"layout",
"manager",
")"
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/android/examples/todo/src/main/java/com/mongodb/stitch/android/examples/todo/TodoAdapter.java#L54-L60 |
FilteredPush/event_date_qc | src/main/java/org/filteredpush/qc/date/DateUtils.java | DateUtils.extractDateFromVerbatim | public static Map<String,String> extractDateFromVerbatim(String verbatimEventDate) {
return extractDateFromVerbatim(verbatimEventDate, DateUtils.YEAR_BEFORE_SUSPECT);
} | java | public static Map<String,String> extractDateFromVerbatim(String verbatimEventDate) {
return extractDateFromVerbatim(verbatimEventDate, DateUtils.YEAR_BEFORE_SUSPECT);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"extractDateFromVerbatim",
"(",
"String",
"verbatimEventDate",
")",
"{",
"return",
"extractDateFromVerbatim",
"(",
"verbatimEventDate",
",",
"DateUtils",
".",
"YEAR_BEFORE_SUSPECT",
")",
";",
"}"
] | Attempt to extract a date or date range in standard format from a provided verbatim
date string.
@param verbatimEventDate a string containing a verbatim event date.
@return a map with result and resultState as keys
@deprecated
@see #extractDateFromVerbatimER(String) replacement method. | [
"Attempt",
"to",
"extract",
"a",
"date",
"or",
"date",
"range",
"in",
"standard",
"format",
"from",
"a",
"provided",
"verbatim",
"date",
"string",
"."
] | train | https://github.com/FilteredPush/event_date_qc/blob/52957a71b94b00b767e37924f976e2c7e8868ff3/src/main/java/org/filteredpush/qc/date/DateUtils.java#L243-L245 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java | Director.getServerPackageFeatureLicense | public Set<InstallLicense> getServerPackageFeatureLicense(File archive, boolean offlineOnly, Locale locale) throws InstallException {
String aName = archive.getAbsolutePath().toLowerCase();
ServerPackageAsset spa = null;
if (ServerPackageZipAsset.validType(aName)) {
spa = new ServerPackageZipAsset(archive, false);
} else if (ServerPackageJarAsset.validType(aName)) {
spa = new ServerPackageJarAsset(archive, false);
} else {
return new HashSet<InstallLicense>();
}
return getFeatureLicense(spa.getRequiredFeatures(), locale, null, null);
} | java | public Set<InstallLicense> getServerPackageFeatureLicense(File archive, boolean offlineOnly, Locale locale) throws InstallException {
String aName = archive.getAbsolutePath().toLowerCase();
ServerPackageAsset spa = null;
if (ServerPackageZipAsset.validType(aName)) {
spa = new ServerPackageZipAsset(archive, false);
} else if (ServerPackageJarAsset.validType(aName)) {
spa = new ServerPackageJarAsset(archive, false);
} else {
return new HashSet<InstallLicense>();
}
return getFeatureLicense(spa.getRequiredFeatures(), locale, null, null);
} | [
"public",
"Set",
"<",
"InstallLicense",
">",
"getServerPackageFeatureLicense",
"(",
"File",
"archive",
",",
"boolean",
"offlineOnly",
",",
"Locale",
"locale",
")",
"throws",
"InstallException",
"{",
"String",
"aName",
"=",
"archive",
".",
"getAbsolutePath",
"(",
"... | Gets the licenses for the specified archive file
@param archive the archive file
@param offlineOnly if features should be only retrieved locally
@param locale Locale for the licenses
@return A set of InstallLicesese for the features in the archive file
@throws InstallException | [
"Gets",
"the",
"licenses",
"for",
"the",
"specified",
"archive",
"file"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L719-L731 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java | CommonUtils.listEquals | public static <T> boolean listEquals(List<T> left, List<T> right) {
if (left == null) {
return right == null;
} else {
if (right == null) {
return false;
}
if (left.size() != right.size()) {
return false;
}
List<T> ltmp = new ArrayList<T>(left);
List<T> rtmp = new ArrayList<T>(right);
for (T t : ltmp) {
rtmp.remove(t);
}
return rtmp.isEmpty();
}
} | java | public static <T> boolean listEquals(List<T> left, List<T> right) {
if (left == null) {
return right == null;
} else {
if (right == null) {
return false;
}
if (left.size() != right.size()) {
return false;
}
List<T> ltmp = new ArrayList<T>(left);
List<T> rtmp = new ArrayList<T>(right);
for (T t : ltmp) {
rtmp.remove(t);
}
return rtmp.isEmpty();
}
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"listEquals",
"(",
"List",
"<",
"T",
">",
"left",
",",
"List",
"<",
"T",
">",
"right",
")",
"{",
"if",
"(",
"left",
"==",
"null",
")",
"{",
"return",
"right",
"==",
"null",
";",
"}",
"else",
"{",
"i... | 比较list元素是否一致,忽略顺序
@param left 左边List
@param right 右边List
@param <T> 元素类型
@return 是否一致 | [
"比较list元素是否一致,忽略顺序"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L236-L254 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/concurrent/CopyJob.java | CopyJob.copy | private void copy( final InputStream is, final OutputStream os ) throws IOException
{
final byte[] buffer = new byte[ 512 ];
int countOfBytes = -1;
while ( !this.terminated )
{
while ( is.available() <= 0 )
{
synchronized( this )
{
try
{
this.wait( 50 ); // guard
if ( this.terminated ) return;
}
catch ( InterruptedException ie )
{
log.error(ie);
}
}
}
countOfBytes = is.read( buffer, 0, buffer.length );
os.write( buffer, 0, countOfBytes );
}
} | java | private void copy( final InputStream is, final OutputStream os ) throws IOException
{
final byte[] buffer = new byte[ 512 ];
int countOfBytes = -1;
while ( !this.terminated )
{
while ( is.available() <= 0 )
{
synchronized( this )
{
try
{
this.wait( 50 ); // guard
if ( this.terminated ) return;
}
catch ( InterruptedException ie )
{
log.error(ie);
}
}
}
countOfBytes = is.read( buffer, 0, buffer.length );
os.write( buffer, 0, countOfBytes );
}
} | [
"private",
"void",
"copy",
"(",
"final",
"InputStream",
"is",
",",
"final",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"512",
"]",
";",
"int",
"countOfBytes",
"=",
"-",
"1",
";... | Copies all data from <b>is</b> to <b>os</b> until job is killed
@param is input stream to read data from
@param os output stream to write data to
@throws IOException if I/O error occurs | [
"Copies",
"all",
"data",
"from",
"<b",
">",
"is<",
"/",
"b",
">",
"to",
"<b",
">",
"os<",
"/",
"b",
">",
"until",
"job",
"is",
"killed"
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/concurrent/CopyJob.java#L143-L169 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java | ASTElementFactory.getMethod | public ASTMethod getMethod(ExecutableElement executableElement) {
ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters());
ASTAccessModifier modifier = buildAccessModifier(executableElement);
ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes());
return new ASTElementMethod(executableElement, astTypeBuilderVisitor, parameters, modifier, getAnnotations(executableElement), throwsTypes);
} | java | public ASTMethod getMethod(ExecutableElement executableElement) {
ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters());
ASTAccessModifier modifier = buildAccessModifier(executableElement);
ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes());
return new ASTElementMethod(executableElement, astTypeBuilderVisitor, parameters, modifier, getAnnotations(executableElement), throwsTypes);
} | [
"public",
"ASTMethod",
"getMethod",
"(",
"ExecutableElement",
"executableElement",
")",
"{",
"ImmutableList",
"<",
"ASTParameter",
">",
"parameters",
"=",
"getParameters",
"(",
"executableElement",
".",
"getParameters",
"(",
")",
")",
";",
"ASTAccessModifier",
"modifi... | Build an ASTMethod from the provided ExecutableElement
@param executableElement required input element
@return ASTMethod | [
"Build",
"an",
"ASTMethod",
"from",
"the",
"provided",
"ExecutableElement"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L213-L220 |
seedstack/business | core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java | FieldUtils.getFieldValue | public static Object getFieldValue(Object candidate, Field field) {
try {
return ReflectUtils.getValue(ReflectUtils.makeAccessible(field), candidate);
} catch (Exception e) {
throw BusinessException.wrap(e, BusinessErrorCode.ERROR_ACCESSING_FIELD)
.put("className", candidate.getClass())
.put("fieldName", field.getName());
}
} | java | public static Object getFieldValue(Object candidate, Field field) {
try {
return ReflectUtils.getValue(ReflectUtils.makeAccessible(field), candidate);
} catch (Exception e) {
throw BusinessException.wrap(e, BusinessErrorCode.ERROR_ACCESSING_FIELD)
.put("className", candidate.getClass())
.put("fieldName", field.getName());
}
} | [
"public",
"static",
"Object",
"getFieldValue",
"(",
"Object",
"candidate",
",",
"Field",
"field",
")",
"{",
"try",
"{",
"return",
"ReflectUtils",
".",
"getValue",
"(",
"ReflectUtils",
".",
"makeAccessible",
"(",
"field",
")",
",",
"candidate",
")",
";",
"}",... | Return the value contained in the specified field of the candidate object.
@param candidate the object to retrieve the value of.
@param field the field.
@return the value contained in the field of the candidate. | [
"Return",
"the",
"value",
"contained",
"in",
"the",
"specified",
"field",
"of",
"the",
"candidate",
"object",
"."
] | train | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/internal/utils/FieldUtils.java#L43-L51 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFile.java | BoxFile.setClassification | public String setClassification(String classificationType) {
Metadata metadata = new Metadata().add(Metadata.CLASSIFICATION_KEY, classificationType);
Metadata classification = null;
try {
classification = this.createMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY, "enterprise", metadata);
} catch (BoxAPIException e) {
if (e.getResponseCode() == 409) {
metadata = new Metadata("enterprise", Metadata.CLASSIFICATION_TEMPLATE_KEY);
metadata.replace(Metadata.CLASSIFICATION_KEY, classificationType);
classification = this.updateMetadata(metadata);
} else {
throw e;
}
}
return classification.getString(Metadata.CLASSIFICATION_KEY);
} | java | public String setClassification(String classificationType) {
Metadata metadata = new Metadata().add(Metadata.CLASSIFICATION_KEY, classificationType);
Metadata classification = null;
try {
classification = this.createMetadata(Metadata.CLASSIFICATION_TEMPLATE_KEY, "enterprise", metadata);
} catch (BoxAPIException e) {
if (e.getResponseCode() == 409) {
metadata = new Metadata("enterprise", Metadata.CLASSIFICATION_TEMPLATE_KEY);
metadata.replace(Metadata.CLASSIFICATION_KEY, classificationType);
classification = this.updateMetadata(metadata);
} else {
throw e;
}
}
return classification.getString(Metadata.CLASSIFICATION_KEY);
} | [
"public",
"String",
"setClassification",
"(",
"String",
"classificationType",
")",
"{",
"Metadata",
"metadata",
"=",
"new",
"Metadata",
"(",
")",
".",
"add",
"(",
"Metadata",
".",
"CLASSIFICATION_KEY",
",",
"classificationType",
")",
";",
"Metadata",
"classificati... | Attempts to add classification to a file. If classification already exists then do update.
@param classificationType the metadata classification type.
@return the metadata classification type on the file. | [
"Attempts",
"to",
"add",
"classification",
"to",
"a",
"file",
".",
"If",
"classification",
"already",
"exists",
"then",
"do",
"update",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L1113-L1130 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.appendText | public DateTimeFormatterBuilder appendText(TemporalField field, TextStyle textStyle) {
Jdk8Methods.requireNonNull(field, "field");
Jdk8Methods.requireNonNull(textStyle, "textStyle");
appendInternal(new TextPrinterParser(field, textStyle, DateTimeTextProvider.getInstance()));
return this;
} | java | public DateTimeFormatterBuilder appendText(TemporalField field, TextStyle textStyle) {
Jdk8Methods.requireNonNull(field, "field");
Jdk8Methods.requireNonNull(textStyle, "textStyle");
appendInternal(new TextPrinterParser(field, textStyle, DateTimeTextProvider.getInstance()));
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"appendText",
"(",
"TemporalField",
"field",
",",
"TextStyle",
"textStyle",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"field",
",",
"\"field\"",
")",
";",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"textStyle",
",",
... | Appends the text of a date-time field to the formatter.
<p>
The text of the field will be output during a print.
The value must be within the valid range of the field.
If the value cannot be obtained then an exception will be thrown.
If the field has no textual representation, then the numeric value will be used.
<p>
The value will be printed as per the normal print of an integer value.
Only negative numbers will be signed. No padding will be added.
@param field the field to append, not null
@param textStyle the text style to use, not null
@return this, for chaining, not null | [
"Appends",
"the",
"text",
"of",
"a",
"date",
"-",
"time",
"field",
"to",
"the",
"formatter",
".",
"<p",
">",
"The",
"text",
"of",
"the",
"field",
"will",
"be",
"output",
"during",
"a",
"print",
".",
"The",
"value",
"must",
"be",
"within",
"the",
"val... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L680-L685 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/ServiceHandler.java | ServiceHandler.isTopologyActive | public boolean isTopologyActive(StormClusterState stormClusterState, String topologyName) throws Exception {
boolean rtn = false;
if (Cluster.get_topology_id(stormClusterState, topologyName) != null) {
rtn = true;
}
return rtn;
} | java | public boolean isTopologyActive(StormClusterState stormClusterState, String topologyName) throws Exception {
boolean rtn = false;
if (Cluster.get_topology_id(stormClusterState, topologyName) != null) {
rtn = true;
}
return rtn;
} | [
"public",
"boolean",
"isTopologyActive",
"(",
"StormClusterState",
"stormClusterState",
",",
"String",
"topologyName",
")",
"throws",
"Exception",
"{",
"boolean",
"rtn",
"=",
"false",
";",
"if",
"(",
"Cluster",
".",
"get_topology_id",
"(",
"stormClusterState",
",",
... | whether the topology is active by topology name
@param stormClusterState see Cluster_clj
@param topologyName topology name
@return boolean if the storm is active, return true, otherwise return false | [
"whether",
"the",
"topology",
"is",
"active",
"by",
"topology",
"name"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/ServiceHandler.java#L1493-L1499 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/EigenOps_DDRM.java | EigenOps_DDRM.createMatrixD | public static DMatrixRMaj createMatrixD(EigenDecomposition_F64 eig )
{
int N = eig.getNumberOfEigenvalues();
DMatrixRMaj D = new DMatrixRMaj( N , N );
for( int i = 0; i < N; i++ ) {
Complex_F64 c = eig.getEigenvalue(i);
if( c.isReal() ) {
D.set(i,i,c.real);
}
}
return D;
} | java | public static DMatrixRMaj createMatrixD(EigenDecomposition_F64 eig )
{
int N = eig.getNumberOfEigenvalues();
DMatrixRMaj D = new DMatrixRMaj( N , N );
for( int i = 0; i < N; i++ ) {
Complex_F64 c = eig.getEigenvalue(i);
if( c.isReal() ) {
D.set(i,i,c.real);
}
}
return D;
} | [
"public",
"static",
"DMatrixRMaj",
"createMatrixD",
"(",
"EigenDecomposition_F64",
"eig",
")",
"{",
"int",
"N",
"=",
"eig",
".",
"getNumberOfEigenvalues",
"(",
")",
";",
"DMatrixRMaj",
"D",
"=",
"new",
"DMatrixRMaj",
"(",
"N",
",",
"N",
")",
";",
"for",
"(... | <p>
A diagonal matrix where real diagonal element contains a real eigenvalue. If an eigenvalue
is imaginary then zero is stored in its place.
</p>
@param eig An eigenvalue decomposition which has already decomposed a matrix.
@return A diagonal matrix containing the eigenvalues. | [
"<p",
">",
"A",
"diagonal",
"matrix",
"where",
"real",
"diagonal",
"element",
"contains",
"a",
"real",
"eigenvalue",
".",
"If",
"an",
"eigenvalue",
"is",
"imaginary",
"then",
"zero",
"is",
"stored",
"in",
"its",
"place",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/EigenOps_DDRM.java#L255-L270 |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java | HelpUtil.associateCSH | public static void associateCSH(BaseUIComponent component, HelpContext helpContext, BaseUIComponent commandTarget) {
if (component != null) {
component.setAttribute(CSH_TARGET, helpContext);
CommandUtil.associateCommand("help", component, commandTarget);
}
} | java | public static void associateCSH(BaseUIComponent component, HelpContext helpContext, BaseUIComponent commandTarget) {
if (component != null) {
component.setAttribute(CSH_TARGET, helpContext);
CommandUtil.associateCommand("help", component, commandTarget);
}
} | [
"public",
"static",
"void",
"associateCSH",
"(",
"BaseUIComponent",
"component",
",",
"HelpContext",
"helpContext",
",",
"BaseUIComponent",
"commandTarget",
")",
"{",
"if",
"(",
"component",
"!=",
"null",
")",
"{",
"component",
".",
"setAttribute",
"(",
"CSH_TARGE... | Associates context-sensitive help topic with a component. Any existing association is
replaced.
@param component Component to be associated.
@param helpContext The help target.
@param commandTarget The command target. | [
"Associates",
"context",
"-",
"sensitive",
"help",
"topic",
"with",
"a",
"component",
".",
"Any",
"existing",
"association",
"is",
"replaced",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpUtil.java#L279-L284 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/ClusterLabeledImage.java | ClusterLabeledImage.process | public void process(GrayS32 input , GrayS32 output , GrowQueue_I32 regionMemberCount ) {
// initialize data structures
this.regionMemberCount = regionMemberCount;
regionMemberCount.reset();
setUpEdges(input,output);
ImageMiscOps.fill(output,-1);
// this is a bit of a hack here. Normally you call the parent's init function.
// since the number of regions is not initially known this will grow
mergeList.reset();
connectInner(input, output);
connectLeftRight(input, output);
connectBottom(input, output);
// Merge together all the regions that are connected in the output image
performMerge(output, regionMemberCount);
} | java | public void process(GrayS32 input , GrayS32 output , GrowQueue_I32 regionMemberCount ) {
// initialize data structures
this.regionMemberCount = regionMemberCount;
regionMemberCount.reset();
setUpEdges(input,output);
ImageMiscOps.fill(output,-1);
// this is a bit of a hack here. Normally you call the parent's init function.
// since the number of regions is not initially known this will grow
mergeList.reset();
connectInner(input, output);
connectLeftRight(input, output);
connectBottom(input, output);
// Merge together all the regions that are connected in the output image
performMerge(output, regionMemberCount);
} | [
"public",
"void",
"process",
"(",
"GrayS32",
"input",
",",
"GrayS32",
"output",
",",
"GrowQueue_I32",
"regionMemberCount",
")",
"{",
"// initialize data structures",
"this",
".",
"regionMemberCount",
"=",
"regionMemberCount",
";",
"regionMemberCount",
".",
"reset",
"(... | Relabels the image such that all pixels with the same label are a member of the same graph.
@param input Labeled input image.
@param output Labeled output image.
@param regionMemberCount (Input/Output) Number of pixels which belong to each group. | [
"Relabels",
"the",
"image",
"such",
"that",
"all",
"pixels",
"with",
"the",
"same",
"label",
"are",
"a",
"member",
"of",
"the",
"same",
"graph",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/ClusterLabeledImage.java#L125-L143 |
CloudBees-community/syslog-java-client | src/main/java/com/cloudbees/syslog/SDElement.java | SDElement.addSDParam | public SDElement addSDParam(String paramName, String paramValue) {
return addSDParam(new SDParam(paramName, paramValue));
} | java | public SDElement addSDParam(String paramName, String paramValue) {
return addSDParam(new SDParam(paramName, paramValue));
} | [
"public",
"SDElement",
"addSDParam",
"(",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"{",
"return",
"addSDParam",
"(",
"new",
"SDParam",
"(",
"paramName",
",",
"paramValue",
")",
")",
";",
"}"
] | Adds a SDParam
@param paramName the PARAM-NAME
@param paramValue the PARAM-VALUE
@return | [
"Adds",
"a",
"SDParam"
] | train | https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/SDElement.java#L90-L92 |
Falydoor/limesurvey-rc | src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java | LimesurveyRC.createIncompleteResponse | public int createIncompleteResponse(int surveyId, String token) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
HashMap<String, String> responseData = new HashMap<>();
responseData.put("submitdate", "");
String date = ZonedDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " " + ZonedDateTime.now().format(DateTimeFormatter.ISO_LOCAL_TIME);
responseData.put("startdate", date);
responseData.put("datestamp", date);
if (StringUtils.isNotEmpty(token)) {
responseData.put("token", token);
}
params.setResponseData(responseData);
return callRC(new LsApiBody("add_response", params)).getAsInt();
} | java | public int createIncompleteResponse(int surveyId, String token) throws LimesurveyRCException {
LsApiBody.LsApiParams params = getParamsWithKey(surveyId);
HashMap<String, String> responseData = new HashMap<>();
responseData.put("submitdate", "");
String date = ZonedDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE) + " " + ZonedDateTime.now().format(DateTimeFormatter.ISO_LOCAL_TIME);
responseData.put("startdate", date);
responseData.put("datestamp", date);
if (StringUtils.isNotEmpty(token)) {
responseData.put("token", token);
}
params.setResponseData(responseData);
return callRC(new LsApiBody("add_response", params)).getAsInt();
} | [
"public",
"int",
"createIncompleteResponse",
"(",
"int",
"surveyId",
",",
"String",
"token",
")",
"throws",
"LimesurveyRCException",
"{",
"LsApiBody",
".",
"LsApiParams",
"params",
"=",
"getParamsWithKey",
"(",
"surveyId",
")",
";",
"HashMap",
"<",
"String",
",",
... | Create an incomplete response, its field "completed" is set to "N" and the response doesn't have a submitdate.
@param surveyId the survey id of the survey you want to create the response
@param token the token used for the response, no token will be set if the value is empty
@return the id of the response
@throws LimesurveyRCException the limesurvey rc exception | [
"Create",
"an",
"incomplete",
"response",
"its",
"field",
"completed",
"is",
"set",
"to",
"N",
"and",
"the",
"response",
"doesn",
"t",
"have",
"a",
"submitdate",
"."
] | train | https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L132-L144 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java | Bbox.getCenterPoint | public Coordinate getCenterPoint() {
double centerX = (width == 0 ? x : x + width / 2);
double centerY = (height == 0 ? y : y + height / 2);
return new Coordinate(centerX, centerY);
} | java | public Coordinate getCenterPoint() {
double centerX = (width == 0 ? x : x + width / 2);
double centerY = (height == 0 ? y : y + height / 2);
return new Coordinate(centerX, centerY);
} | [
"public",
"Coordinate",
"getCenterPoint",
"(",
")",
"{",
"double",
"centerX",
"=",
"(",
"width",
"==",
"0",
"?",
"x",
":",
"x",
"+",
"width",
"/",
"2",
")",
";",
"double",
"centerY",
"=",
"(",
"height",
"==",
"0",
"?",
"y",
":",
"y",
"+",
"height... | Get the center of the bounding box as a Coordinate.
@return center point | [
"Get",
"the",
"center",
"of",
"the",
"bounding",
"box",
"as",
"a",
"Coordinate",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L141-L145 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.doLinkPass | protected void doLinkPass(final BuildData buildData, final Set<String> bookIdAttributes) throws BuildProcessingException {
log.info("Doing " + buildData.getBuildLocale() + " Topic Link Pass");
validateTopicLinks(buildData, bookIdAttributes);
// Apply the duplicate ids for the spec topics
buildData.getBuildDatabase().setDatabaseDuplicateIds();
} | java | protected void doLinkPass(final BuildData buildData, final Set<String> bookIdAttributes) throws BuildProcessingException {
log.info("Doing " + buildData.getBuildLocale() + " Topic Link Pass");
validateTopicLinks(buildData, bookIdAttributes);
// Apply the duplicate ids for the spec topics
buildData.getBuildDatabase().setDatabaseDuplicateIds();
} | [
"protected",
"void",
"doLinkPass",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"Set",
"<",
"String",
">",
"bookIdAttributes",
")",
"throws",
"BuildProcessingException",
"{",
"log",
".",
"info",
"(",
"\"Doing \"",
"+",
"buildData",
".",
"getBuildLocale",
... | Go through each topic and ensure that the links are valid, and then sets the duplicate ids for the SpecTopics/Levels
@param buildData
@param bookIdAttributes The set of ids that have been used in the set of topics in the content spec.
@throws BuildProcessingException | [
"Go",
"through",
"each",
"topic",
"and",
"ensure",
"that",
"the",
"links",
"are",
"valid",
"and",
"then",
"sets",
"the",
"duplicate",
"ids",
"for",
"the",
"SpecTopics",
"/",
"Levels"
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L1380-L1387 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java | PlatformBitmapFactory.setPropertyFromSourceBitmap | private static void setPropertyFromSourceBitmap(Bitmap source, Bitmap destination) {
// The new bitmap was created from a known bitmap source so assume that
// they use the same density
destination.setDensity(source.getDensity());
if (Build.VERSION.SDK_INT >= 12) {
destination.setHasAlpha(source.hasAlpha());
}
if (Build.VERSION.SDK_INT >= 19) {
destination.setPremultiplied(source.isPremultiplied());
}
} | java | private static void setPropertyFromSourceBitmap(Bitmap source, Bitmap destination) {
// The new bitmap was created from a known bitmap source so assume that
// they use the same density
destination.setDensity(source.getDensity());
if (Build.VERSION.SDK_INT >= 12) {
destination.setHasAlpha(source.hasAlpha());
}
if (Build.VERSION.SDK_INT >= 19) {
destination.setPremultiplied(source.isPremultiplied());
}
} | [
"private",
"static",
"void",
"setPropertyFromSourceBitmap",
"(",
"Bitmap",
"source",
",",
"Bitmap",
"destination",
")",
"{",
"// The new bitmap was created from a known bitmap source so assume that",
"// they use the same density",
"destination",
".",
"setDensity",
"(",
"source",... | Set some property of the source bitmap to the destination bitmap
@param source the source bitmap
@param destination the destination bitmap | [
"Set",
"some",
"property",
"of",
"the",
"source",
"bitmap",
"to",
"the",
"destination",
"bitmap"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L750-L761 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java | ParameterSerializer.parseCollection | @SuppressWarnings({ "rawtypes", "unchecked" })
protected Object parseCollection(GetterMethodCover method,
Collection collection) {
if(method.isArrayObjectCollection()) {
return parseArrayObjectCollection(method, collection);
}
else if(method.isObjectCollection()) {
return parseObjectCollection(method, collection);
}
else if(method.isByteCollection()) {
return collectionToPrimitiveByteArray(collection);
}
else if(method.isCharCollection()) {
return charCollectionToPrimitiveByteArray(collection);
}
else if(method.isArrayCollection()) {
return parseArrayCollection(method, collection);
}
return collection;
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
protected Object parseCollection(GetterMethodCover method,
Collection collection) {
if(method.isArrayObjectCollection()) {
return parseArrayObjectCollection(method, collection);
}
else if(method.isObjectCollection()) {
return parseObjectCollection(method, collection);
}
else if(method.isByteCollection()) {
return collectionToPrimitiveByteArray(collection);
}
else if(method.isCharCollection()) {
return charCollectionToPrimitiveByteArray(collection);
}
else if(method.isArrayCollection()) {
return parseArrayCollection(method, collection);
}
return collection;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"Object",
"parseCollection",
"(",
"GetterMethodCover",
"method",
",",
"Collection",
"collection",
")",
"{",
"if",
"(",
"method",
".",
"isArrayObjectCollection",
"(",
")... | Parse collection of values and get the value mapped to smartfox value
@param method structure of getter method
@param collection collection of value
@return the value after parsed | [
"Parse",
"collection",
"of",
"values",
"and",
"get",
"the",
"value",
"mapped",
"to",
"smartfox",
"value"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java#L261-L280 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobgraph/JobGraph.java | JobGraph.writeRequiredJarFiles | private void writeRequiredJarFiles(final DataOutput out, final AbstractJobVertex[] jobVertices) throws IOException {
// Now check if all the collected jar files really exist
final FileSystem fs = FileSystem.getLocalFileSystem();
for (int i = 0; i < this.userJars.size(); i++) {
if (!fs.exists(this.userJars.get(i))) {
throw new IOException("Cannot find jar file " + this.userJars.get(i));
}
}
// How many jar files follow?
out.writeInt(this.userJars.size());
for (int i = 0; i < this.userJars.size(); i++) {
final Path jar = this.userJars.get(i);
// Write out the actual path
jar.write(out);
// Write out the length of the file
final FileStatus file = fs.getFileStatus(jar);
out.writeLong(file.getLen());
// Now write the jar file
final FSDataInputStream inStream = fs.open(this.userJars.get(i));
final byte[] buf = new byte[BUFFERSIZE];
int read = inStream.read(buf, 0, buf.length);
while (read > 0) {
out.write(buf, 0, read);
read = inStream.read(buf, 0, buf.length);
}
}
} | java | private void writeRequiredJarFiles(final DataOutput out, final AbstractJobVertex[] jobVertices) throws IOException {
// Now check if all the collected jar files really exist
final FileSystem fs = FileSystem.getLocalFileSystem();
for (int i = 0; i < this.userJars.size(); i++) {
if (!fs.exists(this.userJars.get(i))) {
throw new IOException("Cannot find jar file " + this.userJars.get(i));
}
}
// How many jar files follow?
out.writeInt(this.userJars.size());
for (int i = 0; i < this.userJars.size(); i++) {
final Path jar = this.userJars.get(i);
// Write out the actual path
jar.write(out);
// Write out the length of the file
final FileStatus file = fs.getFileStatus(jar);
out.writeLong(file.getLen());
// Now write the jar file
final FSDataInputStream inStream = fs.open(this.userJars.get(i));
final byte[] buf = new byte[BUFFERSIZE];
int read = inStream.read(buf, 0, buf.length);
while (read > 0) {
out.write(buf, 0, read);
read = inStream.read(buf, 0, buf.length);
}
}
} | [
"private",
"void",
"writeRequiredJarFiles",
"(",
"final",
"DataOutput",
"out",
",",
"final",
"AbstractJobVertex",
"[",
"]",
"jobVertices",
")",
"throws",
"IOException",
"{",
"// Now check if all the collected jar files really exist",
"final",
"FileSystem",
"fs",
"=",
"Fil... | Writes the JAR files of all vertices in array <code>jobVertices</code> to the specified output stream.
@param out
the output stream to write the JAR files to
@param jobVertices
array of job vertices whose required JAR file are to be written to the output stream
@throws IOException
thrown if an error occurs while writing to the stream | [
"Writes",
"the",
"JAR",
"files",
"of",
"all",
"vertices",
"in",
"array",
"<code",
">",
"jobVertices<",
"/",
"code",
">",
"to",
"the",
"specified",
"output",
"stream",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobgraph/JobGraph.java#L676-L710 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java | CommerceOrderPersistenceImpl.countByU_LtC_O | @Override
public int countByU_LtC_O(long userId, Date createDate, int orderStatus) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC_O;
Object[] finderArgs = new Object[] {
userId, _getTime(createDate), orderStatus
};
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_COMMERCEORDER_WHERE);
query.append(_FINDER_COLUMN_U_LTC_O_USERID_2);
boolean bindCreateDate = false;
if (createDate == null) {
query.append(_FINDER_COLUMN_U_LTC_O_CREATEDATE_1);
}
else {
bindCreateDate = true;
query.append(_FINDER_COLUMN_U_LTC_O_CREATEDATE_2);
}
query.append(_FINDER_COLUMN_U_LTC_O_ORDERSTATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(userId);
if (bindCreateDate) {
qPos.add(new Timestamp(createDate.getTime()));
}
qPos.add(orderStatus);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | java | @Override
public int countByU_LtC_O(long userId, Date createDate, int orderStatus) {
FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC_O;
Object[] finderArgs = new Object[] {
userId, _getTime(createDate), orderStatus
};
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_COUNT_COMMERCEORDER_WHERE);
query.append(_FINDER_COLUMN_U_LTC_O_USERID_2);
boolean bindCreateDate = false;
if (createDate == null) {
query.append(_FINDER_COLUMN_U_LTC_O_CREATEDATE_1);
}
else {
bindCreateDate = true;
query.append(_FINDER_COLUMN_U_LTC_O_CREATEDATE_2);
}
query.append(_FINDER_COLUMN_U_LTC_O_ORDERSTATUS_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(userId);
if (bindCreateDate) {
qPos.add(new Timestamp(createDate.getTime()));
}
qPos.add(orderStatus);
count = (Long)q.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return count.intValue();
} | [
"@",
"Override",
"public",
"int",
"countByU_LtC_O",
"(",
"long",
"userId",
",",
"Date",
"createDate",
",",
"int",
"orderStatus",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_WITH_PAGINATION_COUNT_BY_U_LTC_O",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
... | Returns the number of commerce orders where userId = ? and createDate < ? and orderStatus = ?.
@param userId the user ID
@param createDate the create date
@param orderStatus the order status
@return the number of matching commerce orders | [
"Returns",
"the",
"number",
"of",
"commerce",
"orders",
"where",
"userId",
"=",
"?",
";",
"and",
"createDate",
"<",
";",
"?",
";",
"and",
"orderStatus",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L5787-L5851 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/PartialOrderPriorityQueue.java | PartialOrderPriorityQueue.offer | public boolean offer(T element) {
if (size < capacity) {
put(element);
return true;
} else if (size > 0 && !lessThan(element, peek())) {
heap[1] = element;
adjustTop();
return true;
} else {
return false;
}
} | java | public boolean offer(T element) {
if (size < capacity) {
put(element);
return true;
} else if (size > 0 && !lessThan(element, peek())) {
heap[1] = element;
adjustTop();
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"offer",
"(",
"T",
"element",
")",
"{",
"if",
"(",
"size",
"<",
"capacity",
")",
"{",
"put",
"(",
"element",
")",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"size",
">",
"0",
"&&",
"!",
"lessThan",
"(",
"element",
",... | Adds element to the PriorityQueue in log(size) time if either the
PriorityQueue is not full, or not lessThan(element, top()).
@param element
The element to insert,
@return True, if element is added, false otherwise. | [
"Adds",
"element",
"to",
"the",
"PriorityQueue",
"in",
"log",
"(",
"size",
")",
"time",
"if",
"either",
"the",
"PriorityQueue",
"is",
"not",
"full",
"or",
"not",
"lessThan",
"(",
"element",
"top",
"()",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/sort/PartialOrderPriorityQueue.java#L110-L121 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java | NavMesh.findSpace | public Space findSpace(float x, float y) {
for (int i=0;i<spaces.size();i++) {
Space space = getSpace(i);
if (space.contains(x,y)) {
return space;
}
}
return null;
} | java | public Space findSpace(float x, float y) {
for (int i=0;i<spaces.size();i++) {
Space space = getSpace(i);
if (space.contains(x,y)) {
return space;
}
}
return null;
} | [
"public",
"Space",
"findSpace",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"spaces",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Space",
"space",
"=",
"getSpace",
"(",
"i",
")",
";",... | Find the space at a given location
@param x The x coordinate at which to find the space
@param y The y coordinate at which to find the space
@return The space at the given location | [
"Find",
"the",
"space",
"at",
"a",
"given",
"location"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/NavMesh.java#L69-L78 |
rzwitserloot/lombok | src/core/lombok/core/AST.java | AST.setElementInASTCollection | @SuppressWarnings({"rawtypes", "unchecked"})
protected void setElementInASTCollection(Field field, Object fieldRef, List<Collection<?>> chain, Collection<?> collection, int idx, N newN) throws IllegalAccessException {
if (collection instanceof List<?>) {
((List) collection).set(idx, newN);
}
} | java | @SuppressWarnings({"rawtypes", "unchecked"})
protected void setElementInASTCollection(Field field, Object fieldRef, List<Collection<?>> chain, Collection<?> collection, int idx, N newN) throws IllegalAccessException {
if (collection instanceof List<?>) {
((List) collection).set(idx, newN);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"protected",
"void",
"setElementInASTCollection",
"(",
"Field",
"field",
",",
"Object",
"fieldRef",
",",
"List",
"<",
"Collection",
"<",
"?",
">",
">",
"chain",
",",
"Collection... | Override if your AST collection does not support the set method. Javac's for example, does not.
@param field The field that contains the array or list of AST nodes.
@param fieldRef The object that you can supply to the field's {@code get} method.
@param chain If the collection is immutable, you need to update the pointer to the collection in each element in the chain.
@throws IllegalAccessException This exception won't happen, but we allow you to throw it so you can avoid having to catch it. | [
"Override",
"if",
"your",
"AST",
"collection",
"does",
"not",
"support",
"the",
"set",
"method",
".",
"Javac",
"s",
"for",
"example",
"does",
"not",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/AST.java#L363-L368 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java | GenerateEntityIdOnTheClient.trySetIdentity | public void trySetIdentity(Object entity, String id) {
Class<?> entityType = entity.getClass();
Field identityProperty = _conventions.getIdentityProperty(entityType);
if (identityProperty == null) {
return;
}
setPropertyOrField(identityProperty.getType(), entity, identityProperty, id);
} | java | public void trySetIdentity(Object entity, String id) {
Class<?> entityType = entity.getClass();
Field identityProperty = _conventions.getIdentityProperty(entityType);
if (identityProperty == null) {
return;
}
setPropertyOrField(identityProperty.getType(), entity, identityProperty, id);
} | [
"public",
"void",
"trySetIdentity",
"(",
"Object",
"entity",
",",
"String",
"id",
")",
"{",
"Class",
"<",
"?",
">",
"entityType",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"Field",
"identityProperty",
"=",
"_conventions",
".",
"getIdentityProperty",
"("... | Tries to set the identity property
@param entity Entity
@param id Id to set | [
"Tries",
"to",
"set",
"the",
"identity",
"property"
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java#L81-L90 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java | ErrorHandling.reportErrors | public void reportErrors(Writer writer, String tagName)
throws JspException
{
try {
writer.write(getErrorsReport(tagName));
}
catch (IOException e) {
JspException jspException = new JspException(e.getMessage(), e);
// todo: future cleanup
// The 2.5 Servlet api will set the initCause in the Throwable superclass during construction,
// this will cause an IllegalStateException on the following call.
if (jspException.getCause() == null) {
jspException.initCause(e);
}
throw jspException;
}
} | java | public void reportErrors(Writer writer, String tagName)
throws JspException
{
try {
writer.write(getErrorsReport(tagName));
}
catch (IOException e) {
JspException jspException = new JspException(e.getMessage(), e);
// todo: future cleanup
// The 2.5 Servlet api will set the initCause in the Throwable superclass during construction,
// this will cause an IllegalStateException on the following call.
if (jspException.getCause() == null) {
jspException.initCause(e);
}
throw jspException;
}
} | [
"public",
"void",
"reportErrors",
"(",
"Writer",
"writer",
",",
"String",
"tagName",
")",
"throws",
"JspException",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"getErrorsReport",
"(",
"tagName",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
... | This method will write out the <code>String</code> returned by <code>getErrorsReport</code> to the
response output stream.
@throws JspException if <code>write</code> throws an exception.
@see #getErrorsReport | [
"This",
"method",
"will",
"write",
"out",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"returned",
"by",
"<code",
">",
"getErrorsReport<",
"/",
"code",
">",
"to",
"the",
"response",
"output",
"stream",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ErrorHandling.java#L144-L161 |
opendatatrentino/smatch-webapi-client | src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java | MatchMethods.generateJSONRequest | public JSONObject generateJSONRequest(String sourceName, List<String> sourceNodes,
String targetName, List<String> targetNodes) throws JSONException {
Context sourceContext = new Context("SourceContext", sourceName, sourceNodes);
Context targetContext = new Context("TargetContext", targetName, targetNodes);
JSONObject jRequest = new JSONObject();
JSONObject jContexts = new JSONObject();
JSONArray jContextList = new JSONArray();
JSONObject jsourceContext = sourceContext.toJsonObject();
JSONObject jtargetContext = targetContext.toJsonObject();
jContextList.put(jsourceContext);
jContextList.put(jtargetContext);
jContexts.put("Contexts", jContextList);
jRequest.put("parameters", jContexts);
return jRequest;
} | java | public JSONObject generateJSONRequest(String sourceName, List<String> sourceNodes,
String targetName, List<String> targetNodes) throws JSONException {
Context sourceContext = new Context("SourceContext", sourceName, sourceNodes);
Context targetContext = new Context("TargetContext", targetName, targetNodes);
JSONObject jRequest = new JSONObject();
JSONObject jContexts = new JSONObject();
JSONArray jContextList = new JSONArray();
JSONObject jsourceContext = sourceContext.toJsonObject();
JSONObject jtargetContext = targetContext.toJsonObject();
jContextList.put(jsourceContext);
jContextList.put(jtargetContext);
jContexts.put("Contexts", jContextList);
jRequest.put("parameters", jContexts);
return jRequest;
} | [
"public",
"JSONObject",
"generateJSONRequest",
"(",
"String",
"sourceName",
",",
"List",
"<",
"String",
">",
"sourceNodes",
",",
"String",
"targetName",
",",
"List",
"<",
"String",
">",
"targetNodes",
")",
"throws",
"JSONException",
"{",
"Context",
"sourceContext"... | Generates JSON request from input parameters
@param sourceName - The name of the root node in the source tree
@param sourceNodes - Names of the source nodes under the source root node
@param targetName - The name of the root node in the target tree
@param targetNodes -Names of the target nodes under the target root node
@return JSON request to S-Match Web API Server
@throws JSONException | [
"Generates",
"JSON",
"request",
"from",
"input",
"parameters"
] | train | https://github.com/opendatatrentino/smatch-webapi-client/blob/d74fc41ab5bdc29afafd11c9001ac25dff20f965/src/main/java/it/unitn/disi/smatch/webapi/client/methods/MatchMethods.java#L89-L110 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.compareAndSetLeaf | boolean compareAndSetLeaf(Page oldPage, Page page)
{
if (oldPage == page) {
return true;
}
int pid = (int) page.getId();
updateTailPid(pid);
if (oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl) {
PageLeafImpl oldLeaf = (PageLeafImpl) oldPage;
PageLeafImpl newLeaf = (PageLeafImpl) page;
if (BlockTree.compareKey(oldLeaf.getMaxKey(), newLeaf.getMaxKey(), 0) < 0) {
System.err.println(" DERP: " + oldPage + " " + page);
Thread.dumpStack();
/*
throw new IllegalStateException("DERP: old=" + oldPage + " " + page
+ " old-dirt:" + oldPage.isDirty());
*/
}
}
boolean result = _pages.compareAndSet(pid, oldPage, page);
return result;
} | java | boolean compareAndSetLeaf(Page oldPage, Page page)
{
if (oldPage == page) {
return true;
}
int pid = (int) page.getId();
updateTailPid(pid);
if (oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl) {
PageLeafImpl oldLeaf = (PageLeafImpl) oldPage;
PageLeafImpl newLeaf = (PageLeafImpl) page;
if (BlockTree.compareKey(oldLeaf.getMaxKey(), newLeaf.getMaxKey(), 0) < 0) {
System.err.println(" DERP: " + oldPage + " " + page);
Thread.dumpStack();
/*
throw new IllegalStateException("DERP: old=" + oldPage + " " + page
+ " old-dirt:" + oldPage.isDirty());
*/
}
}
boolean result = _pages.compareAndSet(pid, oldPage, page);
return result;
} | [
"boolean",
"compareAndSetLeaf",
"(",
"Page",
"oldPage",
",",
"Page",
"page",
")",
"{",
"if",
"(",
"oldPage",
"==",
"page",
")",
"{",
"return",
"true",
";",
"}",
"int",
"pid",
"=",
"(",
"int",
")",
"page",
".",
"getId",
"(",
")",
";",
"updateTailPid",... | Updates the leaf to a new page.
Called only from TableService. | [
"Updates",
"the",
"leaf",
"to",
"a",
"new",
"page",
".",
"Called",
"only",
"from",
"TableService",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L970-L997 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java | TaskConfig.setImplicitConvergenceCriterion | public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) {
try {
InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION);
} catch (IOException e) {
throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration.");
}
this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName);
} | java | public void setImplicitConvergenceCriterion(String aggregatorName, ConvergenceCriterion<?> convCriterion) {
try {
InstantiationUtil.writeObjectToConfig(convCriterion, this.config, ITERATION_IMPLICIT_CONVERGENCE_CRITERION);
} catch (IOException e) {
throw new RuntimeException("Error while writing the implicit convergence criterion object to the task configuration.");
}
this.config.setString(ITERATION_IMPLICIT_CONVERGENCE_CRITERION_AGG_NAME, aggregatorName);
} | [
"public",
"void",
"setImplicitConvergenceCriterion",
"(",
"String",
"aggregatorName",
",",
"ConvergenceCriterion",
"<",
"?",
">",
"convCriterion",
")",
"{",
"try",
"{",
"InstantiationUtil",
".",
"writeObjectToConfig",
"(",
"convCriterion",
",",
"this",
".",
"config",
... | Sets the default convergence criterion of a {@link DeltaIteration}
@param aggregatorName
@param convCriterion | [
"Sets",
"the",
"default",
"convergence",
"criterion",
"of",
"a",
"{",
"@link",
"DeltaIteration",
"}"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/util/TaskConfig.java#L1004-L1011 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public Toast setTypeface(Toast toast, @StringRes int strResId, int style) {
return setTypeface(toast, mApplication.getString(strResId), style);
} | java | public Toast setTypeface(Toast toast, @StringRes int strResId, int style) {
return setTypeface(toast, mApplication.getString(strResId), style);
} | [
"public",
"Toast",
"setTypeface",
"(",
"Toast",
"toast",
",",
"@",
"StringRes",
"int",
"strResId",
",",
"int",
"style",
")",
"{",
"return",
"setTypeface",
"(",
"toast",
",",
"mApplication",
".",
"getString",
"(",
"strResId",
")",
",",
"style",
")",
";",
... | Set the typeface for the toast view.
@param toast toast.
@param strResId string resource containing typeface name.
@param style the typeface style.
@return toast that the typeface is injected. | [
"Set",
"the",
"typeface",
"for",
"the",
"toast",
"view",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L538-L540 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.enumTemplate | @Deprecated
public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
return enumTemplate(cl, createTemplate(template), args);
} | java | @Deprecated
public static <T extends Enum<T>> EnumTemplate<T> enumTemplate(Class<? extends T> cl,
String template, ImmutableList<?> args) {
return enumTemplate(cl, createTemplate(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"EnumTemplate",
"<",
"T",
">",
"enumTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
... | Create a new Template expression
@deprecated Use {@link #enumTemplate(Class, String, List)} instead.
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L740-L744 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/FleetsApi.java | FleetsApi.deleteFleetsFleetIdWingsWingId | public void deleteFleetsFleetIdWingsWingId(Long fleetId, Long wingId, String datasource, String token)
throws ApiException {
deleteFleetsFleetIdWingsWingIdWithHttpInfo(fleetId, wingId, datasource, token);
} | java | public void deleteFleetsFleetIdWingsWingId(Long fleetId, Long wingId, String datasource, String token)
throws ApiException {
deleteFleetsFleetIdWingsWingIdWithHttpInfo(fleetId, wingId, datasource, token);
} | [
"public",
"void",
"deleteFleetsFleetIdWingsWingId",
"(",
"Long",
"fleetId",
",",
"Long",
"wingId",
",",
"String",
"datasource",
",",
"String",
"token",
")",
"throws",
"ApiException",
"{",
"deleteFleetsFleetIdWingsWingIdWithHttpInfo",
"(",
"fleetId",
",",
"wingId",
","... | Delete fleet wing Delete a fleet wing, only empty wings can be deleted.
The wing may contain squads, but the squads must be empty --- SSO Scope:
esi-fleets.write_fleet.v1
@param fleetId
ID for a fleet (required)
@param wingId
The wing to delete (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Delete",
"fleet",
"wing",
"Delete",
"a",
"fleet",
"wing",
"only",
"empty",
"wings",
"can",
"be",
"deleted",
".",
"The",
"wing",
"may",
"contain",
"squads",
"but",
"the",
"squads",
"must",
"be",
"empty",
"---",
"SSO",
"Scope",
":",
"esi",
"-",
"fleets",
... | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L473-L476 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIterator.java | WalkingIterator.setRoot | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
if(null != m_firstWalker)
{
m_firstWalker.setRoot(context);
m_lastUsedWalker = m_firstWalker;
}
} | java | public void setRoot(int context, Object environment)
{
super.setRoot(context, environment);
if(null != m_firstWalker)
{
m_firstWalker.setRoot(context);
m_lastUsedWalker = m_firstWalker;
}
} | [
"public",
"void",
"setRoot",
"(",
"int",
"context",
",",
"Object",
"environment",
")",
"{",
"super",
".",
"setRoot",
"(",
"context",
",",
"environment",
")",
";",
"if",
"(",
"null",
"!=",
"m_firstWalker",
")",
"{",
"m_firstWalker",
".",
"setRoot",
"(",
"... | Initialize the context values for this expression
after it is cloned.
@param context The XPath runtime context for this
transformation. | [
"Initialize",
"the",
"context",
"values",
"for",
"this",
"expression",
"after",
"it",
"is",
"cloned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIterator.java#L150-L160 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_trafficExtracts_POST | public OvhTrafficExtract billingAccount_line_serviceName_trafficExtracts_POST(String billingAccount, String serviceName, Date dateEnd, Date dateStart) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/trafficExtracts";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dateEnd", dateEnd);
addBody(o, "dateStart", dateStart);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTrafficExtract.class);
} | java | public OvhTrafficExtract billingAccount_line_serviceName_trafficExtracts_POST(String billingAccount, String serviceName, Date dateEnd, Date dateStart) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/trafficExtracts";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "dateEnd", dateEnd);
addBody(o, "dateStart", dateStart);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTrafficExtract.class);
} | [
"public",
"OvhTrafficExtract",
"billingAccount_line_serviceName_trafficExtracts_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Date",
"dateEnd",
",",
"Date",
"dateStart",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony... | Launch a traffic extract on your line
REST: POST /telephony/{billingAccount}/line/{serviceName}/trafficExtracts
@param dateStart [required] The start date of the traffic extract
@param dateEnd [required] The end date of the traffic extract
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Launch",
"a",
"traffic",
"extract",
"on",
"your",
"line"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L799-L807 |
sporniket/core | sporniket-core-lang/src/main/java/com/sporniket/libre/lang/ExceptionTools.java | ExceptionTools.getStackTrace | public static String getStackTrace(final Throwable t, final int limit)
{
if (0 >= limit)
{
return getStackTrace(t);
}
StringBuffer _resultBuffer = new StringBuffer();
_resultBuffer.append(t.getClass().getName()).append(" : ").append(t.getLocalizedMessage());
StackTraceElement[] _stackTrace = t.getStackTrace();
for (int _index = 0; _index < _stackTrace.length && _index < limit; _index++)
{
StackTraceElement _traceElement = _stackTrace[_index];
_resultBuffer.append("\n\tat ").append(_traceElement);
}
if (_stackTrace.length > limit)
{
_resultBuffer.append("\n\t...");
}
return _resultBuffer.toString();
} | java | public static String getStackTrace(final Throwable t, final int limit)
{
if (0 >= limit)
{
return getStackTrace(t);
}
StringBuffer _resultBuffer = new StringBuffer();
_resultBuffer.append(t.getClass().getName()).append(" : ").append(t.getLocalizedMessage());
StackTraceElement[] _stackTrace = t.getStackTrace();
for (int _index = 0; _index < _stackTrace.length && _index < limit; _index++)
{
StackTraceElement _traceElement = _stackTrace[_index];
_resultBuffer.append("\n\tat ").append(_traceElement);
}
if (_stackTrace.length > limit)
{
_resultBuffer.append("\n\t...");
}
return _resultBuffer.toString();
} | [
"public",
"static",
"String",
"getStackTrace",
"(",
"final",
"Throwable",
"t",
",",
"final",
"int",
"limit",
")",
"{",
"if",
"(",
"0",
">=",
"limit",
")",
"{",
"return",
"getStackTrace",
"(",
"t",
")",
";",
"}",
"StringBuffer",
"_resultBuffer",
"=",
"new... | Return a string containing the result of <code>printStackTrace()</code>.
<p>
This method is not limited to exceptions but is applicable on any throwable objects.
</p>
@param t
the throwable to trace.
@param limit
limit the number of trace to display. 0 means all the stack.
@return the String containing the trace | [
"Return",
"a",
"string",
"containing",
"the",
"result",
"of",
"<code",
">",
"printStackTrace",
"()",
"<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"method",
"is",
"not",
"limited",
"to",
"exceptions",
"but",
"is",
"applicable",
"on",
"any",
"throwable",
... | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/ExceptionTools.java#L75-L94 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/IdentityLinkEntityManagerImpl.java | IdentityLinkEntityManagerImpl.involveUser | @Override
public IdentityLinkEntity involveUser(ExecutionEntity executionEntity, String userId, String type) {
for (IdentityLinkEntity identityLink : executionEntity.getIdentityLinks()) {
if (identityLink.isUser() && identityLink.getUserId().equals(userId)) {
return identityLink;
}
}
return addIdentityLink(executionEntity, userId, null, type);
} | java | @Override
public IdentityLinkEntity involveUser(ExecutionEntity executionEntity, String userId, String type) {
for (IdentityLinkEntity identityLink : executionEntity.getIdentityLinks()) {
if (identityLink.isUser() && identityLink.getUserId().equals(userId)) {
return identityLink;
}
}
return addIdentityLink(executionEntity, userId, null, type);
} | [
"@",
"Override",
"public",
"IdentityLinkEntity",
"involveUser",
"(",
"ExecutionEntity",
"executionEntity",
",",
"String",
"userId",
",",
"String",
"type",
")",
"{",
"for",
"(",
"IdentityLinkEntity",
"identityLink",
":",
"executionEntity",
".",
"getIdentityLinks",
"(",... | Adds an IdentityLink for the given user id with the specified type,
but only if the user is not associated with the execution entity yet. | [
"Adds",
"an",
"IdentityLink",
"for",
"the",
"given",
"user",
"id",
"with",
"the",
"specified",
"type",
"but",
"only",
"if",
"the",
"user",
"is",
"not",
"associated",
"with",
"the",
"execution",
"entity",
"yet",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/IdentityLinkEntityManagerImpl.java#L152-L160 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/compiler/Type.java | Type.convertableFrom | public int convertableFrom(Type other, boolean vararg) {
int cost = convertableFrom(other);
if (cost < 0) { return cost; }
return (vararg ? cost + 40 : cost);
} | java | public int convertableFrom(Type other, boolean vararg) {
int cost = convertableFrom(other);
if (cost < 0) { return cost; }
return (vararg ? cost + 40 : cost);
} | [
"public",
"int",
"convertableFrom",
"(",
"Type",
"other",
",",
"boolean",
"vararg",
")",
"{",
"int",
"cost",
"=",
"convertableFrom",
"(",
"other",
")",
";",
"if",
"(",
"cost",
"<",
"0",
")",
"{",
"return",
"cost",
";",
"}",
"return",
"(",
"vararg",
"... | Check if a type is convertable including support for varargs. If varargs
is true, then this will add 40 to the total cost such that non-varargs
will always take precedence.
@see #convertableFrom(Type) | [
"Check",
"if",
"a",
"type",
"is",
"convertable",
"including",
"support",
"for",
"varargs",
".",
"If",
"varargs",
"is",
"true",
"then",
"this",
"will",
"add",
"40",
"to",
"the",
"total",
"cost",
"such",
"that",
"non",
"-",
"varargs",
"will",
"always",
"ta... | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Type.java#L1180-L1185 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/util/GraphicUtils.java | GraphicUtils.fillCircle | public static void fillCircle(Graphics g, int centerX, int centerY, int diam, Color color){
Color c = g.getColor();
g.setColor(color);
fillCircle(g, centerX, centerY, diam);
g.setColor(c);
} | java | public static void fillCircle(Graphics g, int centerX, int centerY, int diam, Color color){
Color c = g.getColor();
g.setColor(color);
fillCircle(g, centerX, centerY, diam);
g.setColor(c);
} | [
"public",
"static",
"void",
"fillCircle",
"(",
"Graphics",
"g",
",",
"int",
"centerX",
",",
"int",
"centerY",
",",
"int",
"diam",
",",
"Color",
"color",
")",
"{",
"Color",
"c",
"=",
"g",
".",
"getColor",
"(",
")",
";",
"g",
".",
"setColor",
"(",
"c... | Draws a circle with the specified diameter using the given point coordinates as center
and fills it with the given color.
@param g Graphics context
@param centerX X coordinate of circle center
@param centerY Y coordinate of circle center
@param diam Circle diameter | [
"Draws",
"a",
"circle",
"with",
"the",
"specified",
"diameter",
"using",
"the",
"given",
"point",
"coordinates",
"as",
"center",
"and",
"fills",
"it",
"with",
"the",
"given",
"color",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/util/GraphicUtils.java#L76-L81 |
lucastheisen/jsch-extension | src/main/java/com/pastdev/jsch/tunnel/TunnelConnectionManager.java | TunnelConnectionManager.getTunnel | public Tunnel getTunnel( String destinationHostname, int destinationPort ) {
// might be better to cache, but dont anticipate massive numbers
// of tunnel connections...
for ( TunnelConnection tunnelConnection : tunnelConnections ) {
Tunnel tunnel = tunnelConnection.getTunnel(
destinationHostname, destinationPort );
if ( tunnel != null ) {
return tunnel;
}
}
return null;
} | java | public Tunnel getTunnel( String destinationHostname, int destinationPort ) {
// might be better to cache, but dont anticipate massive numbers
// of tunnel connections...
for ( TunnelConnection tunnelConnection : tunnelConnections ) {
Tunnel tunnel = tunnelConnection.getTunnel(
destinationHostname, destinationPort );
if ( tunnel != null ) {
return tunnel;
}
}
return null;
} | [
"public",
"Tunnel",
"getTunnel",
"(",
"String",
"destinationHostname",
",",
"int",
"destinationPort",
")",
"{",
"// might be better to cache, but dont anticipate massive numbers",
"// of tunnel connections...",
"for",
"(",
"TunnelConnection",
"tunnelConnection",
":",
"tunnelConne... | Returns the tunnel matching the supplied values, or <code>null</code> if
there isn't one that matches.
@param destinationHostname
The tunnels destination hostname
@param destinationPort
The tunnels destination port
@return The tunnel matching the supplied values
@see com.pastdev.jsch.tunnel.TunnelConnection#getTunnel(String, int) | [
"Returns",
"the",
"tunnel",
"matching",
"the",
"supplied",
"values",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"there",
"isn",
"t",
"one",
"that",
"matches",
"."
] | train | https://github.com/lucastheisen/jsch-extension/blob/3c5bfae84d63e8632828a10721f2e605b68d749a/src/main/java/com/pastdev/jsch/tunnel/TunnelConnectionManager.java#L141-L152 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/Variables.java | Variables.findSingletonVariable | @SuppressWarnings("unchecked")
public <FRAMETYPE extends WindupVertexFrame> FRAMETYPE findSingletonVariable(Class<FRAMETYPE> type, String name)
{
WindupVertexFrame frame = findSingletonVariable(name);
if (type != null && !type.isAssignableFrom(frame.getClass()))
{
throw new IllegalTypeArgumentException(name, type, frame.getClass());
}
return (FRAMETYPE) frame;
} | java | @SuppressWarnings("unchecked")
public <FRAMETYPE extends WindupVertexFrame> FRAMETYPE findSingletonVariable(Class<FRAMETYPE> type, String name)
{
WindupVertexFrame frame = findSingletonVariable(name);
if (type != null && !type.isAssignableFrom(frame.getClass()))
{
throw new IllegalTypeArgumentException(name, type, frame.getClass());
}
return (FRAMETYPE) frame;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"FRAMETYPE",
"extends",
"WindupVertexFrame",
">",
"FRAMETYPE",
"findSingletonVariable",
"(",
"Class",
"<",
"FRAMETYPE",
">",
"type",
",",
"String",
"name",
")",
"{",
"WindupVertexFrame",
"frame",
"... | Type-safe wrapper around {@link #findVariable(String)} returns a unique {@link WindupVertexFrame}.
@throws IllegalStateException If more than one frame was found. | [
"Type",
"-",
"safe",
"wrapper",
"around",
"{",
"@link",
"#findVariable",
"(",
"String",
")",
"}",
"returns",
"a",
"unique",
"{",
"@link",
"WindupVertexFrame",
"}",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/Variables.java#L154-L165 |
google/auto | service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java | AutoServiceProcessor.process | @Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
try {
return processImpl(annotations, roundEnv);
} catch (Exception e) {
// We don't allow exceptions of any kind to propagate to the compiler
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
fatalError(writer.toString());
return true;
}
} | java | @Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
try {
return processImpl(annotations, roundEnv);
} catch (Exception e) {
// We don't allow exceptions of any kind to propagate to the compiler
StringWriter writer = new StringWriter();
e.printStackTrace(new PrintWriter(writer));
fatalError(writer.toString());
return true;
}
} | [
"@",
"Override",
"public",
"boolean",
"process",
"(",
"Set",
"<",
"?",
"extends",
"TypeElement",
">",
"annotations",
",",
"RoundEnvironment",
"roundEnv",
")",
"{",
"try",
"{",
"return",
"processImpl",
"(",
"annotations",
",",
"roundEnv",
")",
";",
"}",
"catc... | <ol>
<li> For each class annotated with {@link AutoService}<ul>
<li> Verify the {@link AutoService} interface value is correct
<li> Categorize the class by its service interface
</ul>
<li> For each {@link AutoService} interface <ul>
<li> Create a file named {@code META-INF/services/<interface>}
<li> For each {@link AutoService} annotated class for this interface <ul>
<li> Create an entry in the file
</ul>
</ul>
</ol> | [
"<ol",
">",
"<li",
">",
"For",
"each",
"class",
"annotated",
"with",
"{",
"@link",
"AutoService",
"}",
"<ul",
">",
"<li",
">",
"Verify",
"the",
"{",
"@link",
"AutoService",
"}",
"interface",
"value",
"is",
"correct",
"<li",
">",
"Categorize",
"the",
"cla... | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java#L104-L115 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract1.java | Tesseract1.setImage | protected void setImage(RenderedImage image, Rectangle rect) throws IOException {
ByteBuffer buff = ImageIOHelper.getImageByteBuffer(image);
int bpp;
DataBuffer dbuff = image.getData(new Rectangle(1, 1)).getDataBuffer();
if (dbuff instanceof DataBufferByte) {
bpp = image.getColorModel().getPixelSize();
} else {
bpp = 8; // BufferedImage.TYPE_BYTE_GRAY image
}
setImage(image.getWidth(), image.getHeight(), buff, rect, bpp);
} | java | protected void setImage(RenderedImage image, Rectangle rect) throws IOException {
ByteBuffer buff = ImageIOHelper.getImageByteBuffer(image);
int bpp;
DataBuffer dbuff = image.getData(new Rectangle(1, 1)).getDataBuffer();
if (dbuff instanceof DataBufferByte) {
bpp = image.getColorModel().getPixelSize();
} else {
bpp = 8; // BufferedImage.TYPE_BYTE_GRAY image
}
setImage(image.getWidth(), image.getHeight(), buff, rect, bpp);
} | [
"protected",
"void",
"setImage",
"(",
"RenderedImage",
"image",
",",
"Rectangle",
"rect",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"buff",
"=",
"ImageIOHelper",
".",
"getImageByteBuffer",
"(",
"image",
")",
";",
"int",
"bpp",
";",
"DataBuffer",
"dbuff",
... | A wrapper for {@link #setImage(int, int, ByteBuffer, Rectangle, int)}.
@param image a rendered image
@param rect region of interest
@throws java.io.IOException | [
"A",
"wrapper",
"for",
"{",
"@link",
"#setImage",
"(",
"int",
"int",
"ByteBuffer",
"Rectangle",
"int",
")",
"}",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L435-L445 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.noteResponse | protected void noteResponse(ServerStats stats, ClientRequest request, Object response, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && response != null) {
stats.clearSuccessiveConnectionFailureCount();
}
} catch (Exception ex) {
logger.error("Error noting stats for client {}", clientName, ex);
}
} | java | protected void noteResponse(ServerStats stats, ClientRequest request, Object response, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && response != null) {
stats.clearSuccessiveConnectionFailureCount();
}
} catch (Exception ex) {
logger.error("Error noting stats for client {}", clientName, ex);
}
} | [
"protected",
"void",
"noteResponse",
"(",
"ServerStats",
"stats",
",",
"ClientRequest",
"request",
",",
"Object",
"response",
",",
"long",
"responseTime",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"recordStats",
... | This is called after a response is received from the client
to update related stats. | [
"This",
"is",
"called",
"after",
"a",
"response",
"is",
"received",
"from",
"the",
"client",
"to",
"update",
"related",
"stats",
"."
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L317-L330 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java | AbstractJsonDeserializer.parseDefault | public Integer parseDefault(String input, Integer defaultValue) {
if (input == null) {
return defaultValue;
}
Integer answer = defaultValue;
try {
answer = Integer.parseInt(input);
} catch (NumberFormatException ignored) {
}
return answer;
} | java | public Integer parseDefault(String input, Integer defaultValue) {
if (input == null) {
return defaultValue;
}
Integer answer = defaultValue;
try {
answer = Integer.parseInt(input);
} catch (NumberFormatException ignored) {
}
return answer;
} | [
"public",
"Integer",
"parseDefault",
"(",
"String",
"input",
",",
"Integer",
"defaultValue",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"Integer",
"answer",
"=",
"defaultValue",
";",
"try",
"{",
"answer",
"=",... | Convenience method. Parses a string into a double. If it can no be converted to a double, the
defaultvalue is returned. Depending on your choice, you can allow null as output or assign it some value
and have very convenient syntax such as: double d = parseDefault(myString, 0.0); which is a lot shorter
than dealing with all kinds of numberformatexceptions.
@param input The inputstring
@param defaultValue The value to assign in case of error
@return A double corresponding with the input, or defaultValue if no double can be extracted | [
"Convenience",
"method",
".",
"Parses",
"a",
"string",
"into",
"a",
"double",
".",
"If",
"it",
"can",
"no",
"be",
"converted",
"to",
"a",
"double",
"the",
"defaultvalue",
"is",
"returned",
".",
"Depending",
"on",
"your",
"choice",
"you",
"can",
"allow",
... | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/AbstractJsonDeserializer.java#L336-L346 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java | HScreenField.printData | public boolean printData(PrintWriter out, int iHtmlAttributes)
{
String strFieldDesc = " ";
if (this.getScreenField().getConverter() != null)
strFieldDesc = this.getScreenField().getConverter().getFieldDesc();
this.printHtmlControlDesc(out, strFieldDesc, iHtmlAttributes);
if (this.getScreenField().isEnabled() == false)
iHtmlAttributes = iHtmlAttributes & (~HtmlConstants.HTML_INPUT); // Display control
if ((iHtmlAttributes & HtmlConstants.HTML_INPUT) != 0)
{ // Input field
String strFieldName = this.getHtmlFieldParam();
Convert converter = this.getScreenField().getConverter();
int iMaxSize = 10; //?
if (converter != null)
iMaxSize = converter.getMaxLength();
String strMaxSize = Integer.toString(iMaxSize);
String strSize = "40";
if (iMaxSize < 40)
strSize = strMaxSize;
String strValue = this.getScreenField().getSFieldValue(false, false);
// Overriding methods will replace with: text int checkbox radio hidden float date url textbox
String strControlType = this.getInputType(null);
this.printInputControl(out, strFieldDesc, strFieldName, strSize, strMaxSize, strValue, strControlType, iHtmlAttributes);
}
else
this.printDisplayControl(out);
return true;
} | java | public boolean printData(PrintWriter out, int iHtmlAttributes)
{
String strFieldDesc = " ";
if (this.getScreenField().getConverter() != null)
strFieldDesc = this.getScreenField().getConverter().getFieldDesc();
this.printHtmlControlDesc(out, strFieldDesc, iHtmlAttributes);
if (this.getScreenField().isEnabled() == false)
iHtmlAttributes = iHtmlAttributes & (~HtmlConstants.HTML_INPUT); // Display control
if ((iHtmlAttributes & HtmlConstants.HTML_INPUT) != 0)
{ // Input field
String strFieldName = this.getHtmlFieldParam();
Convert converter = this.getScreenField().getConverter();
int iMaxSize = 10; //?
if (converter != null)
iMaxSize = converter.getMaxLength();
String strMaxSize = Integer.toString(iMaxSize);
String strSize = "40";
if (iMaxSize < 40)
strSize = strMaxSize;
String strValue = this.getScreenField().getSFieldValue(false, false);
// Overriding methods will replace with: text int checkbox radio hidden float date url textbox
String strControlType = this.getInputType(null);
this.printInputControl(out, strFieldDesc, strFieldName, strSize, strMaxSize, strValue, strControlType, iHtmlAttributes);
}
else
this.printDisplayControl(out);
return true;
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iHtmlAttributes",
")",
"{",
"String",
"strFieldDesc",
"=",
"\" \"",
";",
"if",
"(",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
"!=",
"null",
")",
"s... | Get the current string value in HTML.<p/>
May want to check GetRootScreen().GetScreenType() & INPUT/DISPLAY_MODE
@exception DBException File exception.
@param out The html out stream.
@param iHtmlAttribures The attributes.
@return true if any fields were found. | [
"Get",
"the",
"current",
"string",
"value",
"in",
"HTML",
".",
"<p",
"/",
">",
"May",
"want",
"to",
"check",
"GetRootScreen",
"()",
".",
"GetScreenType",
"()",
"&",
"INPUT",
"/",
"DISPLAY_MODE"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HScreenField.java#L105-L132 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelHelper.java | HpelHelper.getHpelHandler | public static Handler getHpelHandler(String repositoryLoc, String pid, String label,
boolean useDirTree, Properties overrideProps) {
LogRecordHandler handler = null;
String methodName = "getHpelHandler";
try { // Set up log and traceWriter for the handler (trace only if min level < INFO
handler = new LogRecordHandler(Level.OFF.intValue(), LogRepositoryBaseImpl.KNOWN_FORMATTERS[0], overrideProps); // hpel handler
File repositoryLocation = new File(repositoryLoc + "logdata");
LogRepositoryManager manager = new LogRepositoryManagerImpl(repositoryLocation, pid, label, useDirTree);
LogRepositoryWriter logWriter = new LogRepositoryWriterImpl(manager);
handler.setLogWriter(logWriter);
} catch (Exception e) {
if (log.isLoggable(Level.FINE)) {
log.logp(Level.FINE, CLASS_NAME, methodName, "Error in setting up handler: " + e);
}
return null;
}
return handler;
} | java | public static Handler getHpelHandler(String repositoryLoc, String pid, String label,
boolean useDirTree, Properties overrideProps) {
LogRecordHandler handler = null;
String methodName = "getHpelHandler";
try { // Set up log and traceWriter for the handler (trace only if min level < INFO
handler = new LogRecordHandler(Level.OFF.intValue(), LogRepositoryBaseImpl.KNOWN_FORMATTERS[0], overrideProps); // hpel handler
File repositoryLocation = new File(repositoryLoc + "logdata");
LogRepositoryManager manager = new LogRepositoryManagerImpl(repositoryLocation, pid, label, useDirTree);
LogRepositoryWriter logWriter = new LogRepositoryWriterImpl(manager);
handler.setLogWriter(logWriter);
} catch (Exception e) {
if (log.isLoggable(Level.FINE)) {
log.logp(Level.FINE, CLASS_NAME, methodName, "Error in setting up handler: " + e);
}
return null;
}
return handler;
} | [
"public",
"static",
"Handler",
"getHpelHandler",
"(",
"String",
"repositoryLoc",
",",
"String",
"pid",
",",
"String",
"label",
",",
"boolean",
"useDirTree",
",",
"Properties",
"overrideProps",
")",
"{",
"LogRecordHandler",
"handler",
"=",
"null",
";",
"String",
... | Create an HPEL handler. This handler will not split out trace and log data (since retention not that specific).
This also speeds up query since no internal merge is done. If separate Trace is needed, simply specify the threshold
level on the LogRecordHandler constructor, construct a traceWriter in the same way that the logWriter is specified,
and add the traceWriter to the handler
@param logRepositoryLoc Location of the log repository
@param pid Process ID to use
@param label Label to be included in subDirectories or files
@param minLevel Minimum level to be handled by this handler
@param traceRepositoryLoc If trace records to be handled, this is the location of the trace repository. If trace not
needed, then this can be null
@param useDirTree multiLevel hierarchy or flat storage
@return | [
"Create",
"an",
"HPEL",
"handler",
".",
"This",
"handler",
"will",
"not",
"split",
"out",
"trace",
"and",
"log",
"data",
"(",
"since",
"retention",
"not",
"that",
"specific",
")",
".",
"This",
"also",
"speeds",
"up",
"query",
"since",
"no",
"internal",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/HpelHelper.java#L199-L217 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/SceneBlock.java | SceneBlock.canTraverse | public boolean canTraverse (Object traverser, int tx, int ty)
{
if (_covered[index(tx, ty)]) {
return false;
}
// null base or impassable base kills traversal
BaseTile base = getBaseTile(tx, ty);
if ((base == null) || !base.isPassable()) {
return false;
}
// fringe can only kill traversal if it is present
BaseTile fringe = getFringeTile(tx, ty);
return (fringe == null) || fringe.isPassable();
} | java | public boolean canTraverse (Object traverser, int tx, int ty)
{
if (_covered[index(tx, ty)]) {
return false;
}
// null base or impassable base kills traversal
BaseTile base = getBaseTile(tx, ty);
if ((base == null) || !base.isPassable()) {
return false;
}
// fringe can only kill traversal if it is present
BaseTile fringe = getFringeTile(tx, ty);
return (fringe == null) || fringe.isPassable();
} | [
"public",
"boolean",
"canTraverse",
"(",
"Object",
"traverser",
",",
"int",
"tx",
",",
"int",
"ty",
")",
"{",
"if",
"(",
"_covered",
"[",
"index",
"(",
"tx",
",",
"ty",
")",
"]",
")",
"{",
"return",
"false",
";",
"}",
"// null base or impassable base kil... | Returns true if the specified traverser can traverse the specified
tile (which is assumed to be in the bounds of this scene block). | [
"Returns",
"true",
"if",
"the",
"specified",
"traverser",
"can",
"traverse",
"the",
"specified",
"tile",
"(",
"which",
"is",
"assumed",
"to",
"be",
"in",
"the",
"bounds",
"of",
"this",
"scene",
"block",
")",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L411-L426 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/service/JavaClassService.java | JavaClassService.addInterface | public void addInterface(JavaClassModel jcm, JavaClassModel interfaceJCM)
{
for (JavaClassModel existingInterface : jcm.getInterfaces())
{
if (existingInterface.equals(interfaceJCM))
return;
}
jcm.addInterface(interfaceJCM);
} | java | public void addInterface(JavaClassModel jcm, JavaClassModel interfaceJCM)
{
for (JavaClassModel existingInterface : jcm.getInterfaces())
{
if (existingInterface.equals(interfaceJCM))
return;
}
jcm.addInterface(interfaceJCM);
} | [
"public",
"void",
"addInterface",
"(",
"JavaClassModel",
"jcm",
",",
"JavaClassModel",
"interfaceJCM",
")",
"{",
"for",
"(",
"JavaClassModel",
"existingInterface",
":",
"jcm",
".",
"getInterfaces",
"(",
")",
")",
"{",
"if",
"(",
"existingInterface",
".",
"equals... | This simply adds the interface to the provided {@link JavaClassModel} while checking for duplicate entries. | [
"This",
"simply",
"adds",
"the",
"interface",
"to",
"the",
"provided",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/service/JavaClassService.java#L175-L184 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.